@glatam/calendar-ui 1.0.5 → 1.0.7

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.
@@ -1,9 +1,9 @@
1
- import { css as M, LitElement as E, html as d } from "lit";
2
- import { property as s, customElement as T, state as u } from "lit/decorators.js";
3
- import { isTimeBlocked as C, formatISODate as _, generateMonthDays as P, generateWeekDays as j } from "@glatam/calendar-core";
4
- import { formatISODate as nt, isTimeBlocked as dt, parseISODate as ct } from "@glatam/calendar-core";
5
- import { classMap as N } from "lit/directives/class-map.js";
6
- const A = M`
1
+ import { css as M, LitElement as O, html as c } from "lit";
2
+ import { property as l, customElement as C, state as m } from "lit/decorators.js";
3
+ import { formatISODate as z, parseISODate as N, isTimeBlocked as _, generateMonthDays as Y, generateWeekDays as U } from "@glatam/calendar-core";
4
+ import { formatISODate as yt, isTimeBlocked as xt, parseISODate as wt } from "@glatam/calendar-core";
5
+ import { classMap as A } from "lit/directives/class-map.js";
6
+ const H = M`
7
7
  :host {
8
8
  /* Fonts */
9
9
  --glatam-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -91,7 +91,7 @@ const A = M`
91
91
  --glatam-padding: 24px;
92
92
  font-size: 1.1rem;
93
93
  }
94
- `, W = M`
94
+ `, q = M`
95
95
  :host {
96
96
  display: grid;
97
97
  min-width: 0;
@@ -348,9 +348,9 @@ const A = M`
348
348
  }
349
349
  }
350
350
  `;
351
- function I(t, e, a) {
352
- if (e === a) return 0;
353
- const i = (r, l) => {
351
+ function B(e, t, a) {
352
+ if (t === a) return 0;
353
+ const r = (i, s) => {
354
354
  const o = {
355
355
  year: "numeric",
356
356
  month: "numeric",
@@ -360,102 +360,118 @@ function I(t, e, a) {
360
360
  second: "numeric",
361
361
  hour12: !1
362
362
  };
363
- l !== "local" && (o.timeZone = l);
364
- const n = new Intl.DateTimeFormat("en-US", o).formatToParts(r), c = new Map(n.map(($) => [$.type, $.value])), m = Number(c.get("hour")), v = m === 24 ? 0 : m;
363
+ s !== "local" && (o.timeZone = s);
364
+ const n = new Intl.DateTimeFormat("en-US", o).formatToParts(i), d = new Map(n.map((f) => [f.type, f.value])), h = Number(d.get("hour")), y = h === 24 ? 0 : h;
365
365
  return new Date(
366
- Number(c.get("year")),
367
- Number(c.get("month")) - 1,
368
- Number(c.get("day")),
369
- v,
370
- Number(c.get("minute")),
371
- Number(c.get("second"))
366
+ Number(d.get("year")),
367
+ Number(d.get("month")) - 1,
368
+ Number(d.get("day")),
369
+ y,
370
+ Number(d.get("minute")),
371
+ Number(d.get("second"))
372
372
  );
373
373
  };
374
374
  try {
375
- const r = i(t, e);
376
- return (i(t, a).getTime() - r.getTime()) / (60 * 1e3);
375
+ const i = r(e, t);
376
+ return (r(e, a).getTime() - i.getTime()) / (60 * 1e3);
377
377
  } catch {
378
378
  return 0;
379
379
  }
380
380
  }
381
- function U(t, e) {
382
- if (e === 0)
383
- return { start: t.start, end: t.end, dayShift: 0 };
384
- const a = (c) => {
385
- const [m, v] = c.split(":").map(Number);
386
- return m * 60 + v;
387
- }, i = (c) => {
388
- let m = c % 1440;
389
- m < 0 && (m += 1440);
390
- const v = String(Math.floor(m / 60)).padStart(2, "0"), $ = String(m % 60).padStart(2, "0");
391
- return `${v}:${$}`;
392
- }, r = a(t.start), l = a(t.end), o = r + e, h = l + e;
381
+ function G(e, t) {
382
+ if (t === 0)
383
+ return { start: e.start, end: e.end, dayShift: 0 };
384
+ const a = (d) => {
385
+ const [h, y] = d.split(":").map(Number);
386
+ return h * 60 + y;
387
+ }, r = (d) => {
388
+ let h = d % 1440;
389
+ h < 0 && (h += 1440);
390
+ const y = String(Math.floor(h / 60)).padStart(2, "0"), f = String(h % 60).padStart(2, "0");
391
+ return `${y}:${f}`;
392
+ }, i = a(e.start), s = a(e.end), o = i + t, u = s + t;
393
393
  let n = 0;
394
394
  return o < 0 ? n = -1 : o >= 1440 && (n = 1), {
395
- start: i(o),
396
- end: i(h),
395
+ start: r(o),
396
+ end: r(u),
397
397
  dayShift: n
398
398
  };
399
399
  }
400
- var L = Object.defineProperty, F = Object.getOwnPropertyDescriptor, D = (t, e, a, i) => {
401
- for (var r = i > 1 ? void 0 : i ? F(e, a) : e, l = t.length - 1, o; l >= 0; l--)
402
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
403
- return i && r && L(e, a, r), r;
400
+ function V(e, t, a) {
401
+ let r = null;
402
+ return { updatedRules: e.map((s) => {
403
+ if (s.id !== t) return s;
404
+ r = s;
405
+ const o = s.exceptions || [], u = o.includes(a) ? o : [...o, a];
406
+ return {
407
+ ...s,
408
+ exceptions: u
409
+ };
410
+ }), targetRule: r };
411
+ }
412
+ function F(e, t) {
413
+ const a = e.find((i) => i.id === t) || null;
414
+ return { updatedRules: e.filter((i) => i.id !== t), targetRule: a };
415
+ }
416
+ var X = Object.defineProperty, K = Object.getOwnPropertyDescriptor, $ = (e, t, a, r) => {
417
+ for (var i = r > 1 ? void 0 : r ? K(t, a) : t, s = e.length - 1, o; s >= 0; s--)
418
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
419
+ return r && i && X(t, a, i), i;
404
420
  };
405
- let f = class extends E {
421
+ let w = class extends O {
406
422
  constructor() {
407
423
  super(...arguments), this.days = [], this.locale = "es", this.startOfWeekDay = 0, this.selectedDates = [], this.role = "provider", this.size = "medium", this.minDate = "", this.maxDate = "", this.showNeighboringMonth = !0, this.tileClassName = null;
408
424
  }
409
425
  getWeekdayNames() {
410
- const t = [], e = new Date(2026, 6, 12 + this.startOfWeekDay), a = new Intl.DateTimeFormat(this.locale, { weekday: "short" });
411
- for (let i = 0; i < 7; i++)
412
- t.push(a.format(e)), e.setDate(e.getDate() + 1);
413
- return t;
414
- }
415
- handleDayClick(t) {
416
- const e = this.minDate && t.dateString < this.minDate || this.maxDate && t.dateString > this.maxDate;
417
- this.role === "buyer" && (t.isBlocked || e) || this.dispatchEvent(new CustomEvent("day-select", {
418
- detail: { dateString: t.dateString, isBlocked: t.isBlocked },
426
+ const e = [], t = new Date(2026, 6, 12 + this.startOfWeekDay), a = new Intl.DateTimeFormat(this.locale, { weekday: "short" });
427
+ for (let r = 0; r < 7; r++)
428
+ e.push(a.format(t)), t.setDate(t.getDate() + 1);
429
+ return e;
430
+ }
431
+ handleDayClick(e) {
432
+ const t = this.minDate && e.dateString < this.minDate || this.maxDate && e.dateString > this.maxDate;
433
+ this.role === "buyer" && (e.isBlocked || t) || this.dispatchEvent(new CustomEvent("day-select", {
434
+ detail: { dateString: e.dateString, isBlocked: e.isBlocked },
419
435
  bubbles: !0,
420
436
  composed: !0
421
437
  }));
422
438
  }
423
439
  render() {
424
- const t = this.getWeekdayNames();
425
- return d`
426
- ${t.map((e) => d`<div class="weekday">${e}</div>`)}
440
+ const e = this.getWeekdayNames();
441
+ return c`
442
+ ${e.map((t) => c`<div class="weekday">${t}</div>`)}
427
443
 
428
- ${this.days.map((e) => {
429
- var h;
430
- if (!e.isCurrentMonth && !this.showNeighboringMonth)
431
- return d`<div class="day-cell empty"></div>`;
432
- const a = e.dateString === (/* @__PURE__ */ new Date()).toISOString().split("T")[0], i = this.selectedDates.includes(e.dateString), r = e.slots.filter((n) => n.isBlocked), l = this.minDate && e.dateString < this.minDate || this.maxDate && e.dateString > this.maxDate, o = this.tileClassName ? this.tileClassName({ date: e.date, dateString: e.dateString }) : "";
433
- return d`
444
+ ${this.days.map((t) => {
445
+ var u;
446
+ if (!t.isCurrentMonth && !this.showNeighboringMonth)
447
+ return c`<div class="day-cell empty"></div>`;
448
+ const a = t.dateString === z(/* @__PURE__ */ new Date()), r = this.selectedDates.includes(t.dateString), i = t.slots.filter((n) => n.isBlocked), s = this.minDate && t.dateString < this.minDate || this.maxDate && t.dateString > this.maxDate, o = this.tileClassName ? this.tileClassName({ date: t.date, dateString: t.dateString }) : "";
449
+ return c`
434
450
  <div
435
- class=${N({
451
+ class=${A({
436
452
  "day-cell": !0,
437
- padding: !e.isCurrentMonth,
438
- blocked: e.isBlocked,
453
+ padding: !t.isCurrentMonth,
454
+ blocked: t.isBlocked,
439
455
  today: a,
440
- selected: i,
441
- disabled: !!l,
456
+ selected: r,
457
+ disabled: !!s,
442
458
  [o]: !!o
443
459
  })}
444
460
  part="day-cell ${o}"
445
- @click=${() => this.handleDayClick(e)}
461
+ @click=${() => this.handleDayClick(t)}
446
462
  >
447
- <div class="day-number">${e.dayNumber}</div>
463
+ <div class="day-number">${t.dayNumber}</div>
448
464
 
449
465
  <div class="slot-indicator">
450
- ${e.isBlocked ? d`<div class="badge blocked-day">${((h = e.rule) == null ? void 0 : h.description) || "Bloqueado"}</div>` : r.slice(0, 2).map((n) => {
451
- var c, m;
452
- return d`
453
- <div class="badge blocked-slot" title=${((c = n.rule) == null ? void 0 : c.description) || ""}>
454
- 🚫 ${((m = n.rule) == null ? void 0 : m.description) || n.start}
466
+ ${t.isBlocked ? c`<div class="badge blocked-day">${((u = t.rule) == null ? void 0 : u.description) || "Bloqueado"}</div>` : i.slice(0, 2).map((n) => {
467
+ var d, h;
468
+ return c`
469
+ <div class="badge blocked-slot" title=${((d = n.rule) == null ? void 0 : d.description) || ""}>
470
+ 🚫 ${((h = n.rule) == null ? void 0 : h.description) || n.start}
455
471
  </div>
456
472
  `;
457
473
  })}
458
- ${!e.isBlocked && r.length > 2 ? d`<div style="text-align: center; font-size: 0.65rem; color: var(--glatam-text-secondary);">+${r.length - 2} tareas</div>` : ""}
474
+ ${!t.isBlocked && i.length > 2 ? c`<div style="text-align: center; font-size: 0.65rem; color: var(--glatam-text-secondary);">+${i.length - 2} tareas</div>` : ""}
459
475
  </div>
460
476
  </div>
461
477
  `;
@@ -463,7 +479,7 @@ let f = class extends E {
463
479
  `;
464
480
  }
465
481
  };
466
- f.styles = M`
482
+ w.styles = M`
467
483
  :host { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; width: 100%; }
468
484
  .weekday { font-size: 0.75rem; font-weight: 600; color: var(--glatam-text-secondary); text-transform: uppercase; text-align: center; padding: 8px 0; letter-spacing: 0.05em; }
469
485
  .day-cell {
@@ -496,55 +512,55 @@ f.styles = M`
496
512
  .day-number { margin-bottom: 0; font-size: 0.8rem; }
497
513
  }
498
514
  `;
499
- D([
500
- s({ type: Array })
501
- ], f.prototype, "days", 2);
502
- D([
503
- s({ type: String })
504
- ], f.prototype, "locale", 2);
505
- D([
506
- s({ type: Number })
507
- ], f.prototype, "startOfWeekDay", 2);
508
- D([
509
- s({ type: Array })
510
- ], f.prototype, "selectedDates", 2);
511
- D([
512
- s({ type: String })
513
- ], f.prototype, "role", 2);
514
- D([
515
- s({ type: String, reflect: !0 })
516
- ], f.prototype, "size", 2);
517
- D([
518
- s({ type: String })
519
- ], f.prototype, "minDate", 2);
520
- D([
521
- s({ type: String })
522
- ], f.prototype, "maxDate", 2);
523
- D([
524
- s({ type: Boolean })
525
- ], f.prototype, "showNeighboringMonth", 2);
526
- D([
527
- s({ attribute: !1 })
528
- ], f.prototype, "tileClassName", 2);
529
- f = D([
530
- T("glatam-calendar-month-view")
531
- ], f);
532
- var Y = Object.defineProperty, H = Object.getOwnPropertyDescriptor, R = (t, e, a, i) => {
533
- for (var r = i > 1 ? void 0 : i ? H(e, a) : e, l = t.length - 1, o; l >= 0; l--)
534
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
535
- return i && r && Y(e, a, r), r;
515
+ $([
516
+ l({ type: Array })
517
+ ], w.prototype, "days", 2);
518
+ $([
519
+ l({ type: String })
520
+ ], w.prototype, "locale", 2);
521
+ $([
522
+ l({ type: Number })
523
+ ], w.prototype, "startOfWeekDay", 2);
524
+ $([
525
+ l({ type: Array })
526
+ ], w.prototype, "selectedDates", 2);
527
+ $([
528
+ l({ type: String })
529
+ ], w.prototype, "role", 2);
530
+ $([
531
+ l({ type: String, reflect: !0 })
532
+ ], w.prototype, "size", 2);
533
+ $([
534
+ l({ type: String })
535
+ ], w.prototype, "minDate", 2);
536
+ $([
537
+ l({ type: String })
538
+ ], w.prototype, "maxDate", 2);
539
+ $([
540
+ l({ type: Boolean })
541
+ ], w.prototype, "showNeighboringMonth", 2);
542
+ $([
543
+ l({ attribute: !1 })
544
+ ], w.prototype, "tileClassName", 2);
545
+ w = $([
546
+ C("glatam-calendar-month-view")
547
+ ], w);
548
+ var Z = Object.defineProperty, J = Object.getOwnPropertyDescriptor, k = (e, t, a, r) => {
549
+ for (var i = r > 1 ? void 0 : r ? J(t, a) : t, s = e.length - 1, o; s >= 0; s--)
550
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
551
+ return r && i && Z(t, a, i), i;
536
552
  };
537
- let w = class extends E {
553
+ let x = class extends O {
538
554
  constructor() {
539
- super(...arguments), this.days = [], this.slots = [], this.locale = "es", this.selectedRange = null, this.role = "provider", this.isDragging = !1, this.dragDayIndex = null, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null, this.handleMouseUp = () => {
555
+ super(...arguments), this.days = [], this.slots = [], this.locale = "es", this.selectedRange = null, this.role = "provider", this.minDate = "", this.maxDate = "", this.isDragging = !1, this.dragDayIndex = null, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null, this.handleMouseUp = () => {
540
556
  if (!this.isDragging || this.dragDayIndex === null || this.dragStartSlotIndex === null || this.dragEndSlotIndex === null) {
541
557
  this.isDragging = !1;
542
558
  return;
543
559
  }
544
560
  this.isDragging = !1;
545
- const t = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), e = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex), a = this.days[this.dragDayIndex], i = a.slots.slice(t, e + 1);
546
- i.some((r) => r.isBlocked) || this.dispatchEvent(new CustomEvent("range-select", {
547
- detail: { dateString: a.dateString, start: i[0].start, end: i[i.length - 1].end },
561
+ const e = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), t = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex), a = this.days[this.dragDayIndex], r = a.slots.slice(e, t + 1);
562
+ r.some((i) => i.isBlocked) || this.dispatchEvent(new CustomEvent("range-select", {
563
+ detail: { dateString: a.dateString, start: r[0].start, end: r[r.length - 1].end },
548
564
  bubbles: !0,
549
565
  composed: !0
550
566
  })), this.dragDayIndex = null, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null;
@@ -556,63 +572,68 @@ let w = class extends E {
556
572
  disconnectedCallback() {
557
573
  window.removeEventListener("mouseup", this.handleMouseUp), super.disconnectedCallback();
558
574
  }
559
- handleMouseDown(t, e, a) {
560
- if (a) {
561
- if (this.role === "buyer") return;
562
- this.dispatchEvent(new CustomEvent("slot-click", {
563
- detail: { dateString: this.days[t].dateString, slot: this.days[t].slots[e], isBlocked: !0 },
564
- bubbles: !0,
565
- composed: !0
566
- }));
567
- return;
575
+ handleMouseDown(e, t, a) {
576
+ var s;
577
+ const r = (s = this.days[e]) == null ? void 0 : s.dateString;
578
+ if (!(this.minDate && r < this.minDate || this.maxDate && r > this.maxDate)) {
579
+ if (a) {
580
+ if (this.role === "buyer") return;
581
+ this.dispatchEvent(new CustomEvent("slot-click", {
582
+ detail: { dateString: this.days[e].dateString, slot: this.days[e].slots[t], isBlocked: !0 },
583
+ bubbles: !0,
584
+ composed: !0
585
+ }));
586
+ return;
587
+ }
588
+ this.isDragging = !0, this.dragDayIndex = e, this.dragStartSlotIndex = t, this.dragEndSlotIndex = t;
568
589
  }
569
- this.isDragging = !0, this.dragDayIndex = t, this.dragStartSlotIndex = e, this.dragEndSlotIndex = e;
570
590
  }
571
- handleMouseEnter(t, e, a) {
572
- this.isDragging && t === this.dragDayIndex && !a && (this.dragEndSlotIndex = e);
591
+ handleMouseEnter(e, t, a) {
592
+ this.isDragging && e === this.dragDayIndex && !a && (this.dragEndSlotIndex = t);
573
593
  }
574
- isSlotSelected(t, e) {
575
- return !this.selectedRange || this.selectedRange.dateString !== t ? !1 : e.start >= this.selectedRange.start && e.end <= this.selectedRange.end;
594
+ isSlotSelected(e, t) {
595
+ return !this.selectedRange || this.selectedRange.dateString !== e ? !1 : t.start >= this.selectedRange.start && t.end <= this.selectedRange.end;
576
596
  }
577
- isSlotDragSelecting(t, e) {
578
- if (!this.isDragging || t !== this.dragDayIndex) return !1;
579
- const a = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), i = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex);
580
- return e >= a && e <= i;
597
+ isSlotDragSelecting(e, t) {
598
+ if (!this.isDragging || e !== this.dragDayIndex) return !1;
599
+ const a = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), r = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex);
600
+ return t >= a && t <= r;
581
601
  }
582
602
  render() {
583
- const t = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
584
- return d`
603
+ const e = z(/* @__PURE__ */ new Date());
604
+ return c`
585
605
  <div class="time-col">
586
606
  <div class="header-cell">Hora</div>
587
- ${this.slots.map((e) => d`<div class="slot-cell time-slot-label">${e.start}</div>`)}
607
+ ${this.slots.map((t) => c`<div class="slot-cell time-slot-label">${t.start}</div>`)}
588
608
  </div>
589
609
 
590
- ${this.days.map((e, a) => {
591
- const i = e.dateString === t, r = new Intl.DateTimeFormat(this.locale, { weekday: "short" }).format(e.date);
592
- return d`
610
+ ${this.days.map((t, a) => {
611
+ const r = t.dateString === e, i = new Intl.DateTimeFormat(this.locale, { weekday: "short" }).format(t.date), s = this.minDate && t.dateString < this.minDate || this.maxDate && t.dateString > this.maxDate;
612
+ return c`
593
613
  <div class="day-col">
594
- <div class="header-cell ${i ? "today" : ""}">
595
- <div>${r}</div>
596
- <div class="day-num">${e.dayNumber}</div>
614
+ <div class="header-cell ${r ? "today" : ""}">
615
+ <div>${i}</div>
616
+ <div class="day-num">${t.dayNumber}</div>
597
617
  </div>
598
618
 
599
- ${e.slots.map((l, o) => {
600
- var m, v;
601
- const h = l.isBlocked, n = this.isSlotSelected(e.dateString, l), c = this.isSlotDragSelecting(a, o);
602
- return d`
619
+ ${t.slots.map((o, u) => {
620
+ var y, f;
621
+ const n = o.isBlocked, d = this.isSlotSelected(t.dateString, o), h = this.isSlotDragSelecting(a, u);
622
+ return c`
603
623
  <div
604
- class=${N({
624
+ class=${A({
605
625
  "slot-cell": !0,
606
- available: !h,
607
- blocked: h,
608
- selected: n,
609
- "drag-selecting": c
626
+ available: !n && !s,
627
+ blocked: n,
628
+ selected: d,
629
+ "drag-selecting": h,
630
+ disabled: s
610
631
  })}
611
- @mousedown=${() => this.handleMouseDown(a, o, h)}
612
- @mouseenter=${() => this.handleMouseEnter(a, o, h)}
613
- title=${h && ((m = l.rule) != null && m.description) ? l.rule.description : ""}
632
+ @mousedown=${() => this.handleMouseDown(a, u, n)}
633
+ @mouseenter=${() => this.handleMouseEnter(a, u, n)}
634
+ title=${n && ((y = o.rule) != null && y.description) ? o.rule.description : ""}
614
635
  >
615
- ${h ? ((v = l.rule) == null ? void 0 : v.description) || "Ocupado" : n ? "Reservado" : ""}
636
+ ${n ? ((f = o.rule) == null ? void 0 : f.description) || "Ocupado" : d ? "Reservado" : ""}
616
637
  </div>
617
638
  `;
618
639
  })}
@@ -622,7 +643,7 @@ let w = class extends E {
622
643
  `;
623
644
  }
624
645
  };
625
- w.styles = M`
646
+ x.styles = M`
626
647
  :host {
627
648
  display: grid; grid-template-columns: var(--glatam-time-col-width) repeat(7, 1fr); gap: 2px;
628
649
  width: 100%; background-color: var(--glatam-border); border: 1px solid var(--glatam-border);
@@ -674,52 +695,59 @@ w.styles = M`
674
695
  }
675
696
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
676
697
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
698
+ .slot-cell.disabled { opacity: 0.35; cursor: not-allowed; background-color: var(--glatam-surface); pointer-events: none; }
677
699
  `;
678
- R([
679
- s({ type: Array })
680
- ], w.prototype, "days", 2);
681
- R([
682
- s({ type: Array })
683
- ], w.prototype, "slots", 2);
684
- R([
685
- s({ type: String })
686
- ], w.prototype, "locale", 2);
687
- R([
688
- s({ type: Object })
689
- ], w.prototype, "selectedRange", 2);
690
- R([
691
- s({ type: String })
692
- ], w.prototype, "role", 2);
693
- R([
694
- u()
695
- ], w.prototype, "isDragging", 2);
696
- R([
697
- u()
698
- ], w.prototype, "dragDayIndex", 2);
699
- R([
700
- u()
701
- ], w.prototype, "dragStartSlotIndex", 2);
702
- R([
703
- u()
704
- ], w.prototype, "dragEndSlotIndex", 2);
705
- w = R([
706
- T("glatam-calendar-week-view")
707
- ], w);
708
- var q = Object.defineProperty, G = Object.getOwnPropertyDescriptor, z = (t, e, a, i) => {
709
- for (var r = i > 1 ? void 0 : i ? G(e, a) : e, l = t.length - 1, o; l >= 0; l--)
710
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
711
- return i && r && q(e, a, r), r;
700
+ k([
701
+ l({ type: Array })
702
+ ], x.prototype, "days", 2);
703
+ k([
704
+ l({ type: Array })
705
+ ], x.prototype, "slots", 2);
706
+ k([
707
+ l({ type: String })
708
+ ], x.prototype, "locale", 2);
709
+ k([
710
+ l({ type: Object })
711
+ ], x.prototype, "selectedRange", 2);
712
+ k([
713
+ l({ type: String })
714
+ ], x.prototype, "role", 2);
715
+ k([
716
+ l({ type: String })
717
+ ], x.prototype, "minDate", 2);
718
+ k([
719
+ l({ type: String })
720
+ ], x.prototype, "maxDate", 2);
721
+ k([
722
+ m()
723
+ ], x.prototype, "isDragging", 2);
724
+ k([
725
+ m()
726
+ ], x.prototype, "dragDayIndex", 2);
727
+ k([
728
+ m()
729
+ ], x.prototype, "dragStartSlotIndex", 2);
730
+ k([
731
+ m()
732
+ ], x.prototype, "dragEndSlotIndex", 2);
733
+ x = k([
734
+ C("glatam-calendar-week-view")
735
+ ], x);
736
+ var Q = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, R = (e, t, a, r) => {
737
+ for (var i = r > 1 ? void 0 : r ? tt(t, a) : t, s = e.length - 1, o; s >= 0; s--)
738
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
739
+ return r && i && Q(t, a, i), i;
712
740
  };
713
- let S = class extends E {
741
+ let S = class extends O {
714
742
  constructor() {
715
- super(...arguments), this.day = null, this.slots = [], this.locale = "es", this.selectedRange = null, this.role = "provider", this.isDragging = !1, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null, this.handleMouseUp = () => {
743
+ super(...arguments), this.day = null, this.slots = [], this.locale = "es", this.selectedRange = null, this.role = "provider", this.minDate = "", this.maxDate = "", this.isDragging = !1, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null, this.handleMouseUp = () => {
716
744
  if (!this.isDragging || !this.day || this.dragStartSlotIndex === null || this.dragEndSlotIndex === null) {
717
745
  this.isDragging = !1;
718
746
  return;
719
747
  }
720
748
  this.isDragging = !1;
721
- const t = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), e = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex), a = this.day.slots.slice(t, e + 1);
722
- a.some((i) => i.isBlocked) || this.dispatchEvent(new CustomEvent("range-select", {
749
+ const e = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), t = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex), a = this.day.slots.slice(e, t + 1);
750
+ a.some((r) => r.isBlocked) || this.dispatchEvent(new CustomEvent("range-select", {
723
751
  detail: { dateString: this.day.dateString, start: a[0].start, end: a[a.length - 1].end },
724
752
  bubbles: !0,
725
753
  composed: !0
@@ -732,60 +760,65 @@ let S = class extends E {
732
760
  disconnectedCallback() {
733
761
  window.removeEventListener("mouseup", this.handleMouseUp), super.disconnectedCallback();
734
762
  }
735
- handleMouseDown(t, e) {
736
- if (e && this.day) {
737
- if (this.role === "buyer") return;
738
- this.dispatchEvent(new CustomEvent("slot-click", {
739
- detail: { dateString: this.day.dateString, slot: this.day.slots[t], isBlocked: !0 },
740
- bubbles: !0,
741
- composed: !0
742
- }));
743
- return;
763
+ handleMouseDown(e, t) {
764
+ if (!this.day) return;
765
+ const a = this.day.dateString;
766
+ if (!(this.minDate && a < this.minDate || this.maxDate && a > this.maxDate)) {
767
+ if (t) {
768
+ if (this.role === "buyer") return;
769
+ this.dispatchEvent(new CustomEvent("slot-click", {
770
+ detail: { dateString: this.day.dateString, slot: this.day.slots[e], isBlocked: !0 },
771
+ bubbles: !0,
772
+ composed: !0
773
+ }));
774
+ return;
775
+ }
776
+ this.isDragging = !0, this.dragStartSlotIndex = e, this.dragEndSlotIndex = e;
744
777
  }
745
- this.isDragging = !0, this.dragStartSlotIndex = t, this.dragEndSlotIndex = t;
746
778
  }
747
- handleMouseEnter(t, e) {
748
- this.isDragging && !e && (this.dragEndSlotIndex = t);
779
+ handleMouseEnter(e, t) {
780
+ this.isDragging && !t && (this.dragEndSlotIndex = e);
749
781
  }
750
- isSlotSelected(t) {
751
- return !this.day || !this.selectedRange || this.selectedRange.dateString !== this.day.dateString ? !1 : t.start >= this.selectedRange.start && t.end <= this.selectedRange.end;
782
+ isSlotSelected(e) {
783
+ return !this.day || !this.selectedRange || this.selectedRange.dateString !== this.day.dateString ? !1 : e.start >= this.selectedRange.start && e.end <= this.selectedRange.end;
752
784
  }
753
- isSlotDragSelecting(t) {
785
+ isSlotDragSelecting(e) {
754
786
  if (!this.isDragging) return !1;
755
- const e = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), a = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex);
756
- return t >= e && t <= a;
787
+ const t = Math.min(this.dragStartSlotIndex, this.dragEndSlotIndex), a = Math.max(this.dragStartSlotIndex, this.dragEndSlotIndex);
788
+ return e >= t && e <= a;
757
789
  }
758
790
  render() {
759
- if (!this.day) return d`<div>Cargando...</div>`;
760
- const t = this.day.dateString === (/* @__PURE__ */ new Date()).toISOString().split("T")[0], e = new Intl.DateTimeFormat(this.locale, { weekday: "long", day: "numeric", month: "long" }).format(this.day.date);
761
- return d`
791
+ if (!this.day) return c`<div>Cargando...</div>`;
792
+ const e = this.day.dateString === z(/* @__PURE__ */ new Date()), t = this.minDate && this.day.dateString < this.minDate || this.maxDate && this.day.dateString > this.maxDate, a = new Intl.DateTimeFormat(this.locale, { weekday: "long", day: "numeric", month: "long" }).format(this.day.date);
793
+ return c`
762
794
  <div class="time-col">
763
795
  <div class="header-cell">Hora</div>
764
- ${this.slots.map((a) => d`<div class="slot-cell time-slot-label">${a.start}</div>`)}
796
+ ${this.slots.map((r) => c`<div class="slot-cell time-slot-label">${r.start}</div>`)}
765
797
  </div>
766
798
 
767
799
  <div class="day-col">
768
- <div class="header-cell ${t ? "today" : ""}">
769
- <div style="text-transform: capitalize;">${e}</div>
800
+ <div class="header-cell ${e ? "today" : ""}">
801
+ <div style="text-transform: capitalize;">${a}</div>
770
802
  </div>
771
803
 
772
- ${this.day.slots.map((a, i) => {
773
- var h, n;
774
- const r = a.isBlocked, l = this.isSlotSelected(a), o = this.isSlotDragSelecting(i);
775
- return d`
804
+ ${this.day.slots.map((r, i) => {
805
+ var n, d;
806
+ const s = r.isBlocked, o = this.isSlotSelected(r), u = this.isSlotDragSelecting(i);
807
+ return c`
776
808
  <div
777
- class=${N({
809
+ class=${A({
778
810
  "slot-cell": !0,
779
- available: !r,
780
- blocked: r,
781
- selected: l,
782
- "drag-selecting": o
811
+ available: !s && !t,
812
+ blocked: s,
813
+ selected: o,
814
+ "drag-selecting": u,
815
+ disabled: t
783
816
  })}
784
- @mousedown=${() => this.handleMouseDown(i, r)}
785
- @mouseenter=${() => this.handleMouseEnter(i, r)}
786
- title=${r && ((h = a.rule) != null && h.description) ? a.rule.description : ""}
817
+ @mousedown=${() => this.handleMouseDown(i, s)}
818
+ @mouseenter=${() => this.handleMouseEnter(i, s)}
819
+ title=${s && ((n = r.rule) != null && n.description) ? r.rule.description : ""}
787
820
  >
788
- ${r ? ((n = a.rule) == null ? void 0 : n.description) || "Ocupado" : l ? "Reservado" : ""}
821
+ ${s ? ((d = r.rule) == null ? void 0 : d.description) || "Ocupado" : o ? "Reservado" : ""}
789
822
  </div>
790
823
  `;
791
824
  })}
@@ -822,35 +855,42 @@ S.styles = M`
822
855
  }
823
856
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
824
857
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
858
+ .slot-cell.disabled { opacity: 0.35; cursor: not-allowed; background-color: var(--glatam-surface); pointer-events: none; }
825
859
  `;
826
- z([
827
- s({ type: Object })
860
+ R([
861
+ l({ type: Object })
828
862
  ], S.prototype, "day", 2);
829
- z([
830
- s({ type: Array })
863
+ R([
864
+ l({ type: Array })
831
865
  ], S.prototype, "slots", 2);
832
- z([
833
- s({ type: String })
866
+ R([
867
+ l({ type: String })
834
868
  ], S.prototype, "locale", 2);
835
- z([
836
- s({ type: Object })
869
+ R([
870
+ l({ type: Object })
837
871
  ], S.prototype, "selectedRange", 2);
838
- z([
839
- s({ type: String })
872
+ R([
873
+ l({ type: String })
840
874
  ], S.prototype, "role", 2);
841
- z([
842
- u()
875
+ R([
876
+ l({ type: String })
877
+ ], S.prototype, "minDate", 2);
878
+ R([
879
+ l({ type: String })
880
+ ], S.prototype, "maxDate", 2);
881
+ R([
882
+ m()
843
883
  ], S.prototype, "isDragging", 2);
844
- z([
845
- u()
884
+ R([
885
+ m()
846
886
  ], S.prototype, "dragStartSlotIndex", 2);
847
- z([
848
- u()
887
+ R([
888
+ m()
849
889
  ], S.prototype, "dragEndSlotIndex", 2);
850
- S = z([
851
- T("glatam-calendar-day-view")
890
+ S = R([
891
+ C("glatam-calendar-day-view")
852
892
  ], S);
853
- const V = M`
893
+ const et = M`
854
894
  dialog {
855
895
  background: transparent;
856
896
  border: none;
@@ -1006,35 +1046,42 @@ const V = M`
1006
1046
  background: rgba(255, 69, 58, 0.18);
1007
1047
  }
1008
1048
  `;
1009
- var X = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, k = (t, e, a, i) => {
1010
- for (var r = i > 1 ? void 0 : i ? Z(e, a) : e, l = t.length - 1, o; l >= 0; l--)
1011
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
1012
- return i && r && X(e, a, r), r;
1049
+ var at = Object.defineProperty, it = Object.getOwnPropertyDescriptor, E = (e, t, a, r) => {
1050
+ for (var i = r > 1 ? void 0 : r ? it(t, a) : t, s = e.length - 1, o; s >= 0; s--)
1051
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
1052
+ return r && i && at(t, a, i), i;
1013
1053
  };
1014
- let x = class extends E {
1054
+ let D = class extends O {
1015
1055
  constructor() {
1016
1056
  super(...arguments), this.open = !1, this.dateString = "", this.startTime = "", this.endTime = "", this.isRange = !1, this.existingRule = null, this.description = "", this.blockAllDay = !0, this.isRecurring = !1, this.selectedDays = [];
1017
1057
  }
1018
- willUpdate(t) {
1019
- t.has("open") && this.open && (this.existingRule ? (this.description = "Bloqueo", this.blockAllDay = !this.existingRule.slots || this.existingRule.slots.length === 0, this.isRecurring = this.existingRule.type === "weekly", this.selectedDays = this.existingRule.daysOfWeek || []) : (this.description = "", this.blockAllDay = !this.isRange, this.isRecurring = !1, this.selectedDays = [(/* @__PURE__ */ new Date(this.dateString + "T00:00:00")).getDay()]));
1058
+ willUpdate(e) {
1059
+ if (e.has("open") && this.open)
1060
+ if (this.existingRule)
1061
+ this.description = this.existingRule.description || "", this.blockAllDay = !this.existingRule.slots || this.existingRule.slots.length === 0, this.isRecurring = this.existingRule.type === "weekly", this.selectedDays = this.existingRule.daysOfWeek || [], this.existingRule.slots && this.existingRule.slots.length > 0 && (this.startTime = this.existingRule.slots[0].start, this.endTime = this.existingRule.slots[0].end);
1062
+ else {
1063
+ this.description = "", this.blockAllDay = !this.isRange, this.isRecurring = !1;
1064
+ const t = N(this.dateString);
1065
+ this.selectedDays = [t.getDay()];
1066
+ }
1020
1067
  }
1021
- updated(t) {
1022
- var e;
1023
- if (t.has("open")) {
1024
- const a = (e = this.shadowRoot) == null ? void 0 : e.getElementById("booking-dialog");
1068
+ updated(e) {
1069
+ var t;
1070
+ if (e.has("open")) {
1071
+ const a = (t = this.shadowRoot) == null ? void 0 : t.getElementById("booking-dialog");
1025
1072
  a && (this.open ? a.open || a.showModal() : a.open && a.close());
1026
1073
  }
1027
1074
  }
1028
1075
  handleDialogClose() {
1029
1076
  this.open && this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }));
1030
1077
  }
1031
- toggleDay(t) {
1032
- const e = this.selectedDays.indexOf(t);
1033
- this.selectedDays = e > -1 ? this.selectedDays.filter((a) => a !== t) : [...this.selectedDays, t];
1078
+ toggleDay(e) {
1079
+ const t = this.selectedDays.indexOf(e);
1080
+ this.selectedDays = t > -1 ? this.selectedDays.filter((a) => a !== e) : [...this.selectedDays, e];
1034
1081
  }
1035
1082
  handleSave() {
1036
- const t = {
1037
- title: this.description || "Bloqueo",
1083
+ const e = {
1084
+ title: this.description.trim(),
1038
1085
  blockAllDay: this.blockAllDay,
1039
1086
  isRecurring: this.isRecurring,
1040
1087
  selectedDays: this.selectedDays,
@@ -1042,24 +1089,24 @@ let x = class extends E {
1042
1089
  startTime: this.startTime,
1043
1090
  endTime: this.endTime
1044
1091
  };
1045
- this.dispatchEvent(new CustomEvent("save-rule", { detail: t, bubbles: !0, composed: !0 }));
1092
+ this.dispatchEvent(new CustomEvent("save-rule", { detail: e, bubbles: !0, composed: !0 }));
1046
1093
  }
1047
1094
  handleDelete() {
1048
1095
  this.existingRule && this.dispatchEvent(new CustomEvent("delete-rule", {
1049
- detail: { id: this.existingRule.id },
1096
+ detail: { id: this.existingRule.id, dateString: this.dateString, rule: this.existingRule },
1050
1097
  bubbles: !0,
1051
1098
  composed: !0
1052
1099
  }));
1053
1100
  }
1054
1101
  render() {
1055
- const t = ["D", "L", "M", "M", "J", "V", "S"], e = this.isRange ? `${this.dateString} (${this.startTime} - ${this.endTime})` : this.dateString;
1056
- return d`
1102
+ const e = ["D", "L", "M", "M", "J", "V", "S"], t = this.isRange ? `${this.dateString} (${this.startTime} - ${this.endTime})` : this.dateString;
1103
+ return c`
1057
1104
  <dialog id="booking-dialog" @close=${this.handleDialogClose}>
1058
1105
  <div class="modal-content">
1059
1106
  <h3>${this.existingRule ? "Gestionar Bloqueo" : "Crear Bloqueo"}</h3>
1060
1107
 
1061
1108
  <div style="font-size: 0.85rem; color: var(--glatam-text-secondary);">
1062
- Selección: <strong>${e}</strong>
1109
+ Selección: <strong>${t}</strong>
1063
1110
  </div>
1064
1111
 
1065
1112
  <div class="form-group">
@@ -1084,6 +1131,27 @@ let x = class extends E {
1084
1131
  </label>
1085
1132
  </div>
1086
1133
 
1134
+ ${this.blockAllDay ? "" : c`
1135
+ <div style="display: flex; gap: 12px;" class="form-group">
1136
+ <div style="flex: 1;">
1137
+ <label>Hora Inicio</label>
1138
+ <input
1139
+ type="time"
1140
+ .value=${this.startTime}
1141
+ @input=${(a) => this.startTime = a.target.value}
1142
+ />
1143
+ </div>
1144
+ <div style="flex: 1;">
1145
+ <label>Hora Fin</label>
1146
+ <input
1147
+ type="time"
1148
+ .value=${this.endTime}
1149
+ @input=${(a) => this.endTime = a.target.value}
1150
+ />
1151
+ </div>
1152
+ </div>
1153
+ `}
1154
+
1087
1155
  <div class="switch-row">
1088
1156
  <label>Repetir semanalmente</label>
1089
1157
  <label class="switch">
@@ -1096,16 +1164,17 @@ let x = class extends E {
1096
1164
  </label>
1097
1165
  </div>
1098
1166
 
1099
- ${this.isRecurring ? d`
1167
+ ${this.isRecurring ? c`
1100
1168
  <div class="form-group">
1101
1169
  <label>Repetir los días</label>
1102
1170
  <div class="days-grid">
1103
- ${[1, 2, 3, 4, 5, 6, 0].map((a) => d`
1171
+ ${[1, 2, 3, 4, 5, 6, 0].map((a) => c`
1104
1172
  <button
1173
+ type="button"
1105
1174
  class="day-btn ${this.selectedDays.includes(a) ? "selected" : ""}"
1106
1175
  @click=${() => this.toggleDay(a)}
1107
1176
  >
1108
- ${t[a]}
1177
+ ${e[a]}
1109
1178
  </button>
1110
1179
  `)}
1111
1180
  </div>
@@ -1113,55 +1182,303 @@ let x = class extends E {
1113
1182
  ` : ""}
1114
1183
 
1115
1184
  <div class="btn-actions">
1116
- ${this.existingRule ? d`<button class="btn btn-danger" @click=${this.handleDelete}>Eliminar</button>` : ""}
1117
- <button class="btn btn-cancel" @click=${() => this.dispatchEvent(new CustomEvent("close"))}>Cancelar</button>
1118
- <button class="btn btn-save" @click=${this.handleSave}>Guardar</button>
1185
+ ${this.existingRule ? c`<button type="button" class="btn btn-danger" @click=${this.handleDelete}>Eliminar</button>` : ""}
1186
+ <button type="button" class="btn btn-cancel" @click=${() => this.dispatchEvent(new CustomEvent("close"))}>Cancelar</button>
1187
+ <button type="button" class="btn btn-save" @click=${this.handleSave}>Guardar</button>
1119
1188
  </div>
1120
1189
  </div>
1121
1190
  </dialog>
1122
1191
  `;
1123
1192
  }
1124
1193
  };
1125
- x.styles = V;
1126
- k([
1127
- s({ type: Boolean })
1128
- ], x.prototype, "open", 2);
1129
- k([
1130
- s({ type: String })
1131
- ], x.prototype, "dateString", 2);
1132
- k([
1133
- s({ type: String })
1134
- ], x.prototype, "startTime", 2);
1135
- k([
1136
- s({ type: String })
1137
- ], x.prototype, "endTime", 2);
1138
- k([
1139
- s({ type: Boolean })
1140
- ], x.prototype, "isRange", 2);
1141
- k([
1142
- s({ type: Object })
1143
- ], x.prototype, "existingRule", 2);
1144
- k([
1145
- u()
1146
- ], x.prototype, "description", 2);
1147
- k([
1148
- u()
1149
- ], x.prototype, "blockAllDay", 2);
1150
- k([
1151
- u()
1152
- ], x.prototype, "isRecurring", 2);
1153
- k([
1154
- u()
1155
- ], x.prototype, "selectedDays", 2);
1156
- x = k([
1157
- T("glatam-calendar-modal")
1158
- ], x);
1159
- var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, p = (t, e, a, i) => {
1160
- for (var r = i > 1 ? void 0 : i ? K(e, a) : e, l = t.length - 1, o; l >= 0; l--)
1161
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
1162
- return i && r && J(e, a, r), r;
1194
+ D.styles = et;
1195
+ E([
1196
+ l({ type: Boolean })
1197
+ ], D.prototype, "open", 2);
1198
+ E([
1199
+ l({ type: String })
1200
+ ], D.prototype, "dateString", 2);
1201
+ E([
1202
+ l({ type: String })
1203
+ ], D.prototype, "startTime", 2);
1204
+ E([
1205
+ l({ type: String })
1206
+ ], D.prototype, "endTime", 2);
1207
+ E([
1208
+ l({ type: Boolean })
1209
+ ], D.prototype, "isRange", 2);
1210
+ E([
1211
+ l({ type: Object })
1212
+ ], D.prototype, "existingRule", 2);
1213
+ E([
1214
+ m()
1215
+ ], D.prototype, "description", 2);
1216
+ E([
1217
+ m()
1218
+ ], D.prototype, "blockAllDay", 2);
1219
+ E([
1220
+ m()
1221
+ ], D.prototype, "isRecurring", 2);
1222
+ E([
1223
+ m()
1224
+ ], D.prototype, "selectedDays", 2);
1225
+ D = E([
1226
+ C("glatam-calendar-modal")
1227
+ ], D);
1228
+ const rt = M`
1229
+ :host {
1230
+ display: contents;
1231
+ font-family: var(--glatam-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
1232
+ }
1233
+
1234
+ dialog {
1235
+ border: none;
1236
+ border-radius: var(--glatam-border-radius, 16px);
1237
+ padding: 0;
1238
+ background: var(--glatam-bg, #ffffff);
1239
+ color: var(--glatam-text, #1d1d1f);
1240
+ max-width: 440px;
1241
+ width: 90vw;
1242
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
1243
+ overflow: hidden;
1244
+ }
1245
+
1246
+ dialog::backdrop {
1247
+ background: rgba(0, 0, 0, 0.4);
1248
+ backdrop-filter: blur(8px);
1249
+ -webkit-backdrop-filter: blur(8px);
1250
+ }
1251
+
1252
+ .confirmation-container {
1253
+ padding: 24px;
1254
+ display: flex;
1255
+ flex-direction: column;
1256
+ gap: 18px;
1257
+ }
1258
+
1259
+ .header {
1260
+ display: flex;
1261
+ flex-direction: column;
1262
+ gap: 6px;
1263
+ }
1264
+
1265
+ .title {
1266
+ font-size: 1.15rem;
1267
+ font-weight: 600;
1268
+ margin: 0;
1269
+ color: var(--glatam-text, #1d1d1f);
1270
+ line-height: 1.3;
1271
+ }
1272
+
1273
+ .subtitle {
1274
+ font-size: 0.88rem;
1275
+ color: var(--glatam-text-secondary, #86868b);
1276
+ margin: 0;
1277
+ line-height: 1.4;
1278
+ }
1279
+
1280
+ .rule-badge {
1281
+ display: inline-flex;
1282
+ align-items: center;
1283
+ gap: 6px;
1284
+ padding: 6px 12px;
1285
+ background: var(--glatam-surface, #f5f5f7);
1286
+ border-radius: 8px;
1287
+ font-size: 0.82rem;
1288
+ font-weight: 500;
1289
+ color: var(--glatam-text, #1d1d1f);
1290
+ }
1291
+
1292
+ .options-group {
1293
+ display: flex;
1294
+ flex-direction: column;
1295
+ gap: 10px;
1296
+ }
1297
+
1298
+ .option-card {
1299
+ display: flex;
1300
+ align-items: flex-start;
1301
+ gap: 12px;
1302
+ padding: 14px 16px;
1303
+ border: 1.5px solid var(--glatam-border, #e5e5ea);
1304
+ border-radius: 12px;
1305
+ background: var(--glatam-bg, #ffffff);
1306
+ cursor: pointer;
1307
+ text-align: left;
1308
+ transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
1309
+ width: 100%;
1310
+ box-sizing: border-box;
1311
+ }
1312
+
1313
+ .option-card:hover {
1314
+ border-color: var(--glatam-primary, #5856d6);
1315
+ background: var(--glatam-primary-light, rgba(88, 86, 214, 0.06));
1316
+ transform: translateY(-1px);
1317
+ }
1318
+
1319
+ .option-card:active {
1320
+ transform: scale(0.99);
1321
+ }
1322
+
1323
+ .option-icon {
1324
+ font-size: 1.25rem;
1325
+ line-height: 1;
1326
+ margin-top: 2px;
1327
+ }
1328
+
1329
+ .option-text {
1330
+ display: flex;
1331
+ flex-direction: column;
1332
+ gap: 3px;
1333
+ }
1334
+
1335
+ .option-title {
1336
+ font-size: 0.92rem;
1337
+ font-weight: 600;
1338
+ color: var(--glatam-text, #1d1d1f);
1339
+ }
1340
+
1341
+ .option-desc {
1342
+ font-size: 0.8rem;
1343
+ color: var(--glatam-text-secondary, #86868b);
1344
+ line-height: 1.35;
1345
+ }
1346
+
1347
+ .actions {
1348
+ display: flex;
1349
+ justify-content: flex-end;
1350
+ margin-top: 4px;
1351
+ }
1352
+
1353
+ .btn-cancel {
1354
+ padding: 10px 18px;
1355
+ border-radius: 10px;
1356
+ border: 1px solid var(--glatam-border, #e5e5ea);
1357
+ background: var(--glatam-surface, #f5f5f7);
1358
+ color: var(--glatam-text, #1d1d1f);
1359
+ font-weight: 500;
1360
+ font-size: 0.88rem;
1361
+ cursor: pointer;
1362
+ transition: background 0.15s ease;
1363
+ }
1364
+
1365
+ .btn-cancel:hover {
1366
+ background: var(--glatam-border, #e5e5ea);
1367
+ }
1368
+ `;
1369
+ var ot = Object.defineProperty, st = Object.getOwnPropertyDescriptor, j = (e, t, a, r) => {
1370
+ for (var i = r > 1 ? void 0 : r ? st(t, a) : t, s = e.length - 1, o; s >= 0; s--)
1371
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
1372
+ return r && i && ot(t, a, i), i;
1163
1373
  };
1164
- const Q = [
1374
+ let T = class extends O {
1375
+ constructor() {
1376
+ super(...arguments), this.open = !1, this.dateString = "", this.targetRule = null;
1377
+ }
1378
+ updated(e) {
1379
+ var t;
1380
+ if (e.has("open")) {
1381
+ const a = (t = this.shadowRoot) == null ? void 0 : t.getElementById("series-dialog");
1382
+ a && (this.open ? a.open || a.showModal() : a.open && a.close());
1383
+ }
1384
+ }
1385
+ handleDialogClose() {
1386
+ this.open && this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }));
1387
+ }
1388
+ handleSelectOption(e) {
1389
+ this.targetRule && this.dispatchEvent(
1390
+ new CustomEvent("confirm-action", {
1391
+ detail: {
1392
+ actionType: e,
1393
+ dateString: this.dateString,
1394
+ targetRule: this.targetRule
1395
+ },
1396
+ bubbles: !0,
1397
+ composed: !0
1398
+ })
1399
+ );
1400
+ }
1401
+ render() {
1402
+ var t;
1403
+ const e = ((t = this.targetRule) == null ? void 0 : t.description) || "Bloqueo recurrente";
1404
+ return c`
1405
+ <dialog id="series-dialog" @close=${this.handleDialogClose}>
1406
+ <div class="confirmation-container">
1407
+ <div class="header">
1408
+ <h3 class="title">¿Eliminar bloqueo recurrente?</h3>
1409
+ <p class="subtitle">
1410
+ Este horario pertenece a una regla con patrón de repetición semanal.
1411
+ </p>
1412
+ <div class="rule-badge">
1413
+ <span>📅 ${this.dateString}</span> • <span>${e}</span>
1414
+ </div>
1415
+ </div>
1416
+
1417
+ <div class="options-group">
1418
+ <button
1419
+ type="button"
1420
+ class="option-card"
1421
+ @click=${() => this.handleSelectOption("delete_instance")}
1422
+ title="Anular la regla solo en esta fecha"
1423
+ >
1424
+ <span class="option-icon">🗓️</span>
1425
+ <div class="option-text">
1426
+ <span class="option-title">Eliminar / Liberar solo este día</span>
1427
+ <span class="option-desc">
1428
+ Libera el horario exclusivamente para el ${this.dateString}. El resto de semanas continuarán bloqueadas.
1429
+ </span>
1430
+ </div>
1431
+ </button>
1432
+
1433
+ <button
1434
+ type="button"
1435
+ class="option-card"
1436
+ @click=${() => this.handleSelectOption("delete_series")}
1437
+ title="Eliminar la regla semanal completa"
1438
+ >
1439
+ <span class="option-icon">🔄</span>
1440
+ <div class="option-text">
1441
+ <span class="option-title">Eliminar toda la serie recurrente</span>
1442
+ <span class="option-desc">
1443
+ Remueve la regla semanal completa, liberando este horario para todas las semanas pasadas y futuras.
1444
+ </span>
1445
+ </div>
1446
+ </button>
1447
+ </div>
1448
+
1449
+ <div class="actions">
1450
+ <button
1451
+ type="button"
1452
+ class="btn-cancel"
1453
+ @click=${() => this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }))}
1454
+ >
1455
+ Cancelar
1456
+ </button>
1457
+ </div>
1458
+ </div>
1459
+ </dialog>
1460
+ `;
1461
+ }
1462
+ };
1463
+ T.styles = rt;
1464
+ j([
1465
+ l({ type: Boolean })
1466
+ ], T.prototype, "open", 2);
1467
+ j([
1468
+ l({ type: String })
1469
+ ], T.prototype, "dateString", 2);
1470
+ j([
1471
+ l({ type: Object })
1472
+ ], T.prototype, "targetRule", 2);
1473
+ T = j([
1474
+ C("glatam-series-confirmation-modal")
1475
+ ], T);
1476
+ var lt = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, g = (e, t, a, r) => {
1477
+ for (var i = r > 1 ? void 0 : r ? nt(t, a) : t, s = e.length - 1, o; s >= 0; s--)
1478
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
1479
+ return r && i && lt(t, a, i), i;
1480
+ };
1481
+ const dt = [
1165
1482
  { start: "09:00", end: "10:00" },
1166
1483
  { start: "10:00", end: "11:00" },
1167
1484
  { start: "11:00", end: "12:00" },
@@ -1172,92 +1489,112 @@ const Q = [
1172
1489
  { start: "16:00", end: "17:00" },
1173
1490
  { start: "17:00", end: "18:00" }
1174
1491
  ];
1175
- let g = class extends E {
1492
+ let p = class extends O {
1176
1493
  constructor() {
1177
- super(...arguments), this.role = "provider", this.size = "medium", this.view = "month", this.locale = "es", this.startOfWeekDay = 0, this.rules = [], this.selectedDates = [], this.selectedRange = null, this.hostTimezone = "America/Bogota", this.activeTimezone = "local", this.slots = Q, this.minDate = "", this.maxDate = "", this.showNeighboringMonth = !0, this.tileClassName = null, this.activeDate = /* @__PURE__ */ new Date(), this.localRules = [], this.darkMode = !1, this.modalOpen = !1, this.modalDateString = "", this.modalStartTime = "", this.modalEndTime = "", this.modalIsRange = !1, this.modalExistingRule = null;
1494
+ super(...arguments), this.role = "provider", this.size = "medium", this.view = "month", this.locale = "es", this.startOfWeekDay = 0, this.rules = [], this.selectedDates = [], this.selectedRange = null, this.hostTimezone = "America/Bogota", this.activeTimezone = "local", this.slots = dt, this.minDate = "", this.maxDate = "", this.showNeighboringMonth = !0, this.tileClassName = null, this.enableSeriesConfirmation = !1, this.activeDate = /* @__PURE__ */ new Date(), this.localRules = [], this.darkMode = !1, this.modalOpen = !1, this.modalDateString = "", this.modalStartTime = "", this.modalEndTime = "", this.modalIsRange = !1, this.modalExistingRule = null, this.seriesModalOpen = !1, this.seriesTargetRule = null, this.seriesTargetDateString = "";
1178
1495
  }
1179
1496
  firstUpdated() {
1180
1497
  this.darkMode = window.matchMedia("(prefers-color-scheme: dark)").matches, this.localRules = [...this.rules];
1181
1498
  }
1182
- willUpdate(t) {
1183
- t.has("rules") && (this.localRules = [...this.rules || []]);
1499
+ willUpdate(e) {
1500
+ e.has("rules") && this.rules !== this.localRules && (this.localRules = [...this.rules || []]);
1184
1501
  }
1185
- updated(t) {
1186
- t.has("darkMode") && this.classList.toggle("dark-mode", this.darkMode);
1502
+ updated(e) {
1503
+ e.has("darkMode") && this.classList.toggle("dark-mode", this.darkMode);
1187
1504
  }
1188
1505
  handlePrev() {
1189
- const t = new Date(this.activeDate);
1190
- this.view === "month" ? t.setMonth(t.getMonth() - 1) : this.view === "week" ? t.setDate(t.getDate() - 7) : t.setDate(t.getDate() - 1), this.activeDate = t;
1506
+ const e = new Date(this.activeDate);
1507
+ this.view === "month" ? e.setMonth(e.getMonth() - 1) : this.view === "week" ? e.setDate(e.getDate() - 7) : e.setDate(e.getDate() - 1), this.activeDate = e;
1191
1508
  }
1192
1509
  handleNext() {
1193
- const t = new Date(this.activeDate);
1194
- this.view === "month" ? t.setMonth(t.getMonth() + 1) : this.view === "week" ? t.setDate(t.getDate() + 7) : t.setDate(t.getDate() + 1), this.activeDate = t;
1510
+ const e = new Date(this.activeDate);
1511
+ this.view === "month" ? e.setMonth(e.getMonth() + 1) : this.view === "week" ? e.setDate(e.getDate() + 7) : e.setDate(e.getDate() + 1), this.activeDate = e;
1195
1512
  }
1196
1513
  getHeaderTitle() {
1197
- const t = this.view === "month" ? { month: "long", year: "numeric" } : this.view === "week" ? { month: "short", year: "numeric" } : { day: "numeric", month: "long", year: "numeric" };
1198
- return new Intl.DateTimeFormat(this.locale, t).format(this.activeDate);
1199
- }
1200
- handleDaySelect(t) {
1201
- const { dateString: e, isBlocked: a } = t.detail;
1202
- this.role === "buyer" && a || (this.activeDate = /* @__PURE__ */ new Date(e + "T00:00:00"), this.view = "day", this.dispatchEvent(new CustomEvent("date-selected", { detail: { dateString: e }, bubbles: !0, composed: !0 })));
1203
- }
1204
- handleRangeSelect(t) {
1205
- var $, O;
1206
- const { dateString: e, start: a, end: i } = t.detail, r = this.activeTimezone === "local" ? I(this.activeDate, this.hostTimezone, "local") : 0, l = (/* @__PURE__ */ new Date()).toISOString().split("T")[0], o = this.minDate || (this.role === "buyer" ? l : "");
1207
- if (this.role === "buyer" && o && e < o) return;
1208
- const h = this.getDisplaySlots(r), n = h.findIndex((B) => B.start === a), c = h.findIndex((B) => B.end === i), m = (($ = this.slots[n]) == null ? void 0 : $.start) || a, v = ((O = this.slots[c]) == null ? void 0 : O.end) || i;
1514
+ const e = this.view === "month" ? { month: "long", year: "numeric" } : this.view === "week" ? { month: "short", year: "numeric" } : { day: "numeric", month: "long", year: "numeric" };
1515
+ return new Intl.DateTimeFormat(this.locale, e).format(this.activeDate);
1516
+ }
1517
+ handleDaySelect(e) {
1518
+ const { dateString: t, isBlocked: a } = e.detail;
1519
+ this.role === "buyer" && a || (this.activeDate = N(t), this.view = "day", this.dispatchEvent(new CustomEvent("date-selected", { detail: { dateString: t }, bubbles: !0, composed: !0 })));
1520
+ }
1521
+ handleRangeSelect(e) {
1522
+ var W, L;
1523
+ const { dateString: t, start: a, end: r } = e.detail, i = this.activeTimezone === "local" ? B(this.activeDate, this.hostTimezone, "local") : 0, s = z(/* @__PURE__ */ new Date()), o = this.minDate || (this.role === "buyer" ? s : "");
1524
+ if (this.role === "buyer" && (o && t < o || this.maxDate && t > this.maxDate)) return;
1525
+ const u = this.getDisplaySlots(i), n = a.split(" ")[0], d = r.split(" ")[0], h = u.findIndex((P) => P.start.startsWith(n)), y = u.findIndex((P) => P.end.startsWith(d)), f = ((W = this.slots[h]) == null ? void 0 : W.start) || n, I = ((L = this.slots[y]) == null ? void 0 : L.end) || d;
1209
1526
  if (this.role === "buyer") {
1210
- this.selectedRange = { dateString: e, start: a, end: i }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: e, start: a, end: i, hostStart: m, hostEnd: v }, bubbles: !0, composed: !0 }));
1527
+ this.selectedRange = { dateString: t, start: n, end: d }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: t, start: n, end: d, hostStart: f, hostEnd: I }, bubbles: !0, composed: !0 }));
1211
1528
  return;
1212
1529
  }
1213
- this.openModal(e, m, v, !0, null);
1530
+ this.openModal(t, f, I, !0, null);
1214
1531
  }
1215
- handleSlotClick(t) {
1216
- const { dateString: e, slot: a } = t.detail, i = /* @__PURE__ */ new Date(e + "T00:00:00"), r = this.activeTimezone === "local" ? I(this.activeDate, this.hostTimezone, "local") : 0, l = (/* @__PURE__ */ new Date()).toISOString().split("T")[0], o = this.minDate || (this.role === "buyer" ? l : "");
1217
- if (this.role === "buyer" && (a.isBlocked || o && e < o)) return;
1218
- const h = this.getDisplaySlots(r), n = h.findIndex((v) => v.start === a.start), c = this.slots[n] || a;
1532
+ handleSlotClick(e) {
1533
+ const { dateString: t, slot: a } = e.detail, r = N(t), i = this.activeTimezone === "local" ? B(this.activeDate, this.hostTimezone, "local") : 0, s = z(/* @__PURE__ */ new Date()), o = this.minDate || (this.role === "buyer" ? s : "");
1534
+ if (this.role === "buyer" && (a.isBlocked || o && t < o || this.maxDate && t > this.maxDate)) return;
1535
+ const u = this.getDisplaySlots(i), n = a.start.split(" ")[0], d = u.findIndex((f) => f.start.startsWith(n)), h = this.slots[d] || a;
1219
1536
  if (this.role === "buyer") {
1220
- this.selectedRange = { dateString: e, start: a.start, end: a.end }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: e, start: a.start, end: a.end, hostStart: c.start, hostEnd: c.end }, bubbles: !0, composed: !0 }));
1537
+ this.selectedRange = { dateString: t, start: a.start, end: a.end }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: t, start: a.start, end: a.end, hostStart: h.start, hostEnd: h.end }, bubbles: !0, composed: !0 }));
1221
1538
  return;
1222
1539
  }
1223
- const m = this.localRules.find((v) => C(i, c, [v]));
1224
- this.openModal(e, c.start, c.end, !0, m || null);
1540
+ const y = this.localRules.find((f) => _(r, h, [f]));
1541
+ this.openModal(t, h.start, h.end, !0, y || null);
1225
1542
  }
1226
1543
  handleBlockDayAction() {
1227
- const t = _(this.activeDate), e = this.localRules.find((a) => C(this.activeDate, void 0, [a]));
1228
- this.openModal(t, "", "", !1, e || null);
1544
+ const e = z(this.activeDate), t = this.localRules.find((a) => _(this.activeDate, void 0, [a]));
1545
+ this.openModal(e, "", "", !1, t || null);
1229
1546
  }
1230
- openModal(t, e, a, i, r) {
1231
- this.modalDateString = t, this.modalStartTime = e, this.modalEndTime = a, this.modalIsRange = i, this.modalExistingRule = r, this.modalOpen = !0;
1547
+ openModal(e, t, a, r, i) {
1548
+ this.modalDateString = e, this.modalStartTime = t, this.modalEndTime = a, this.modalIsRange = r, this.modalExistingRule = i, this.modalOpen = !0;
1232
1549
  }
1233
- handleSaveRule(t) {
1234
- const e = t.detail, a = this.modalExistingRule ? this.modalExistingRule.id : `rule-${Date.now()}`, i = {
1550
+ handleSaveRule(e) {
1551
+ var s;
1552
+ const t = e.detail, a = this.modalExistingRule ? this.modalExistingRule.id : `rule-${Date.now()}`, r = {
1235
1553
  id: a,
1236
- type: e.isRecurring ? "weekly" : "date-range",
1237
- slots: e.blockAllDay ? void 0 : [{ start: e.startTime, end: e.endTime }],
1238
- daysOfWeek: e.isRecurring ? e.selectedDays : void 0,
1239
- startDate: e.isRecurring ? void 0 : e.dateString,
1240
- endDate: e.isRecurring ? void 0 : e.dateString,
1241
- description: e.title
1242
- };
1243
- this.localRules = this.modalExistingRule ? this.localRules.map((r) => r.id === a ? i : r) : [...this.localRules, i], this.modalOpen = !1, this.dispatchEvent(new CustomEvent("rules-changed", { detail: { rules: this.localRules }, bubbles: !0, composed: !0 }));
1554
+ type: t.isRecurring ? "weekly" : "date-range",
1555
+ slots: t.blockAllDay ? void 0 : [{ start: t.startTime, end: t.endTime }],
1556
+ daysOfWeek: t.isRecurring ? t.selectedDays : void 0,
1557
+ startDate: t.isRecurring ? void 0 : t.dateString,
1558
+ endDate: t.isRecurring ? void 0 : t.dateString,
1559
+ description: t.title,
1560
+ exceptions: (s = this.modalExistingRule) == null ? void 0 : s.exceptions
1561
+ }, i = this.modalExistingRule ? this.localRules.map((o) => o.id === a ? r : o) : [...this.localRules, r];
1562
+ this.localRules = i, this.rules = i, this.modalOpen = !1, this.dispatchEvent(new CustomEvent("rules-changed", { detail: { rules: i }, bubbles: !0, composed: !0 }));
1563
+ }
1564
+ handleDeleteRule(e) {
1565
+ const t = e.detail.rule || this.localRules.find((s) => s.id === e.detail.id), a = e.detail.dateString || this.modalDateString;
1566
+ if (this.enableSeriesConfirmation && t && t.type === "weekly") {
1567
+ this.modalOpen = !1, this.seriesTargetRule = t, this.seriesTargetDateString = a, this.seriesModalOpen = !0;
1568
+ return;
1569
+ }
1570
+ const { updatedRules: r, targetRule: i } = F(this.localRules, e.detail.id);
1571
+ if (this.localRules = r, this.rules = r, this.modalOpen = !1, i) {
1572
+ const s = { actionType: "delete_series", targetRule: i, dateString: a, updatedRules: r };
1573
+ this.dispatchEvent(new CustomEvent("rule-action-triggered", { detail: s, bubbles: !0, composed: !0 }));
1574
+ }
1575
+ this.dispatchEvent(new CustomEvent("rules-changed", { detail: { rules: r }, bubbles: !0, composed: !0 }));
1244
1576
  }
1245
- handleDeleteRule(t) {
1246
- this.localRules = this.localRules.filter((e) => e.id !== t.detail.id), this.modalOpen = !1, this.dispatchEvent(new CustomEvent("rules-changed", { detail: { rules: this.localRules }, bubbles: !0, composed: !0 }));
1577
+ handleConfirmSeriesAction(e) {
1578
+ const { actionType: t, dateString: a, targetRule: r } = e.detail, { updatedRules: i, targetRule: s } = t === "delete_instance" ? V(this.localRules, r.id, a) : F(this.localRules, r.id);
1579
+ if (this.localRules = i, this.rules = i, this.seriesModalOpen = !1, s) {
1580
+ const o = { actionType: t, targetRule: s, dateString: a, updatedRules: i };
1581
+ this.dispatchEvent(new CustomEvent("rule-action-triggered", { detail: o, bubbles: !0, composed: !0 }));
1582
+ }
1583
+ this.dispatchEvent(new CustomEvent("rules-changed", { detail: { rules: i }, bubbles: !0, composed: !0 }));
1247
1584
  }
1248
- getDisplaySlots(t) {
1249
- return t === 0 ? this.slots : this.slots.map((e) => {
1250
- const a = U(e, t), i = a.dayShift > 0 ? " (+1d)" : a.dayShift < 0 ? " (-1d)" : "";
1251
- return { start: a.start + i, end: a.end + i };
1585
+ getDisplaySlots(e) {
1586
+ return e === 0 ? this.slots : this.slots.map((t) => {
1587
+ const a = G(t, e), r = a.dayShift > 0 ? " (+1d)" : a.dayShift < 0 ? " (-1d)" : "";
1588
+ return { start: a.start + r, end: a.end + r };
1252
1589
  });
1253
1590
  }
1254
1591
  render() {
1255
- var h;
1256
- const t = this.activeDate.getFullYear(), e = this.activeDate.getMonth(), a = C(this.activeDate, void 0, this.localRules), i = this.activeTimezone === "local" ? I(this.activeDate, this.hostTimezone, "local") : 0, r = this.getDisplaySlots(i), l = (n) => n.map((c) => ({ ...c, slots: c.slots.map((m, v) => {
1257
- var $, O;
1258
- return { ...m, start: (($ = r[v]) == null ? void 0 : $.start) || m.start, end: ((O = r[v]) == null ? void 0 : O.end) || m.end };
1259
- }) })), o = ((h = this.hostTimezone.split("/").pop()) == null ? void 0 : h.replace("_", " ")) || "Anfitrión";
1260
- return d`
1592
+ var u;
1593
+ const e = this.activeDate.getFullYear(), t = this.activeDate.getMonth(), a = _(this.activeDate, void 0, this.localRules), r = this.activeTimezone === "local" ? B(this.activeDate, this.hostTimezone, "local") : 0, i = this.getDisplaySlots(r), s = (n) => n.map((d) => ({ ...d, slots: d.slots.map((h, y) => {
1594
+ var f, I;
1595
+ return { ...h, start: ((f = i[y]) == null ? void 0 : f.start) || h.start, end: ((I = i[y]) == null ? void 0 : I.end) || h.end };
1596
+ }) })), o = ((u = this.hostTimezone.split("/").pop()) == null ? void 0 : u.replace("_", " ")) || "Anfitrión";
1597
+ return c`
1261
1598
  <div class="calendar-header">
1262
1599
  <div class="nav-group">
1263
1600
  <button class="btn" @click=${() => this.activeDate = /* @__PURE__ */ new Date()}>Hoy</button>
@@ -1267,7 +1604,7 @@ let g = class extends E {
1267
1604
  </div>
1268
1605
 
1269
1606
  <div class="view-group">
1270
- ${this.role === "provider" ? d`
1607
+ ${this.role === "provider" ? c`
1271
1608
  <div class="timezone-badge">
1272
1609
  🌐 Zona:
1273
1610
  <select class="timezone-select" @change=${(n) => this.activeTimezone = n.target.value}>
@@ -1276,7 +1613,7 @@ let g = class extends E {
1276
1613
  </select>
1277
1614
  </div>
1278
1615
  ` : ""}
1279
- ${this.role === "provider" && this.view === "day" ? d`<button class="btn btn-primary" @click=${this.handleBlockDayAction} style="margin-right: 8px;">${a ? "Liberar Día" : "Bloquear Día"}</button>` : ""}
1616
+ ${this.role === "provider" && this.view === "day" ? c`<button class="btn btn-primary" @click=${this.handleBlockDayAction} style="margin-right: 8px;">${a ? "Liberar Día" : "Bloquear Día"}</button>` : ""}
1280
1617
  <button class="btn" @click=${() => this.darkMode = !this.darkMode} style="margin-right: 8px;">${this.darkMode ? "☀️" : "🌙"}</button>
1281
1618
  <div class="btn-group">
1282
1619
  <button class="btn ${this.view === "month" ? "active" : ""}" @click=${() => this.view = "month"}>Mes</button>
@@ -1287,7 +1624,7 @@ let g = class extends E {
1287
1624
  </div>
1288
1625
 
1289
1626
  <div class="calendar-body">
1290
- ${this.view === "month" ? d`<glatam-calendar-month-view .days=${P(t, e, this.localRules, this.slots, this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate || (this.role === "buyer" ? (/* @__PURE__ */ new Date()).toISOString().split("T")[0] : "")} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>` : this.view === "week" ? d`<glatam-calendar-week-view .days=${l(j(this.activeDate, this.localRules, this.slots, this.startOfWeekDay))} .slots=${r} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>` : d`<glatam-calendar-day-view .day=${l(j(this.activeDate, this.localRules, this.slots, this.startOfWeekDay)).find((n) => n.dateString === _(this.activeDate)) || null} .slots=${r} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
1627
+ ${this.view === "month" ? c`<glatam-calendar-month-view .days=${Y(e, t, this.localRules, this.slots, this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate || (this.role === "buyer" ? z(/* @__PURE__ */ new Date()) : "")} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>` : this.view === "week" ? c`<glatam-calendar-week-view .days=${s(U(this.activeDate, this.localRules, this.slots, this.startOfWeekDay))} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} .minDate=${this.minDate || (this.role === "buyer" ? z(/* @__PURE__ */ new Date()) : "")} .maxDate=${this.maxDate} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>` : c`<glatam-calendar-day-view .day=${s(U(this.activeDate, this.localRules, this.slots, this.startOfWeekDay)).find((n) => n.dateString === z(this.activeDate)) || null} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} .minDate=${this.minDate || (this.role === "buyer" ? z(/* @__PURE__ */ new Date()) : "")} .maxDate=${this.maxDate} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
1291
1628
  </div>
1292
1629
 
1293
1630
  <glatam-calendar-modal
@@ -1295,91 +1632,160 @@ let g = class extends E {
1295
1632
  .isRange=${this.modalIsRange} .existingRule=${this.modalExistingRule} @save-rule=${this.handleSaveRule}
1296
1633
  @delete-rule=${this.handleDeleteRule} @close=${() => this.modalOpen = !1}
1297
1634
  ></glatam-calendar-modal>
1635
+
1636
+ <glatam-series-confirmation-modal
1637
+ .open=${this.seriesModalOpen} .dateString=${this.seriesTargetDateString} .targetRule=${this.seriesTargetRule}
1638
+ @confirm-action=${this.handleConfirmSeriesAction} @close=${() => this.seriesModalOpen = !1}
1639
+ ></glatam-series-confirmation-modal>
1298
1640
  `;
1299
1641
  }
1300
1642
  };
1301
- g.styles = [A, W];
1302
- p([
1303
- s({ type: String })
1304
- ], g.prototype, "role", 2);
1305
- p([
1306
- s({ type: String, reflect: !0 })
1307
- ], g.prototype, "size", 2);
1308
- p([
1309
- s({ type: String })
1310
- ], g.prototype, "view", 2);
1311
- p([
1312
- s({ type: String })
1313
- ], g.prototype, "locale", 2);
1314
- p([
1315
- s({ type: Number })
1316
- ], g.prototype, "startOfWeekDay", 2);
1317
- p([
1318
- s({ type: Array })
1319
- ], g.prototype, "rules", 2);
1320
- p([
1321
- s({ type: Array })
1322
- ], g.prototype, "selectedDates", 2);
1323
- p([
1324
- s({ type: Object })
1325
- ], g.prototype, "selectedRange", 2);
1326
- p([
1327
- s({ type: String })
1328
- ], g.prototype, "hostTimezone", 2);
1329
- p([
1330
- s({ type: String })
1331
- ], g.prototype, "activeTimezone", 2);
1332
- p([
1333
- s({ type: Array })
1334
- ], g.prototype, "slots", 2);
1335
- p([
1336
- s({ type: String })
1337
- ], g.prototype, "minDate", 2);
1338
- p([
1339
- s({ type: String })
1340
- ], g.prototype, "maxDate", 2);
1341
- p([
1342
- s({ type: Boolean })
1343
- ], g.prototype, "showNeighboringMonth", 2);
1344
- p([
1345
- s({ attribute: !1 })
1346
- ], g.prototype, "tileClassName", 2);
1347
- p([
1348
- u()
1349
- ], g.prototype, "activeDate", 2);
1350
- p([
1351
- u()
1352
- ], g.prototype, "localRules", 2);
1353
- p([
1354
- u()
1355
- ], g.prototype, "darkMode", 2);
1356
- p([
1357
- u()
1358
- ], g.prototype, "modalOpen", 2);
1359
- p([
1360
- u()
1361
- ], g.prototype, "modalDateString", 2);
1362
- p([
1363
- u()
1364
- ], g.prototype, "modalStartTime", 2);
1365
- p([
1366
- u()
1367
- ], g.prototype, "modalEndTime", 2);
1368
- p([
1369
- u()
1370
- ], g.prototype, "modalIsRange", 2);
1371
- p([
1372
- u()
1373
- ], g.prototype, "modalExistingRule", 2);
1374
- g = p([
1375
- T("glatam-calendar")
1376
- ], g);
1377
- var tt = Object.defineProperty, et = Object.getOwnPropertyDescriptor, y = (t, e, a, i) => {
1378
- for (var r = i > 1 ? void 0 : i ? et(e, a) : e, l = t.length - 1, o; l >= 0; l--)
1379
- (o = t[l]) && (r = (i ? o(e, a, r) : o(r)) || r);
1380
- return i && r && tt(e, a, r), r;
1643
+ p.styles = [H, q];
1644
+ g([
1645
+ l({ type: String })
1646
+ ], p.prototype, "role", 2);
1647
+ g([
1648
+ l({ type: String, reflect: !0 })
1649
+ ], p.prototype, "size", 2);
1650
+ g([
1651
+ l({ type: String })
1652
+ ], p.prototype, "view", 2);
1653
+ g([
1654
+ l({ type: String })
1655
+ ], p.prototype, "locale", 2);
1656
+ g([
1657
+ l({ type: Number })
1658
+ ], p.prototype, "startOfWeekDay", 2);
1659
+ g([
1660
+ l({ type: Array })
1661
+ ], p.prototype, "rules", 2);
1662
+ g([
1663
+ l({ type: Array })
1664
+ ], p.prototype, "selectedDates", 2);
1665
+ g([
1666
+ l({ type: Object })
1667
+ ], p.prototype, "selectedRange", 2);
1668
+ g([
1669
+ l({ type: String })
1670
+ ], p.prototype, "hostTimezone", 2);
1671
+ g([
1672
+ l({ type: String })
1673
+ ], p.prototype, "activeTimezone", 2);
1674
+ g([
1675
+ l({ type: Array })
1676
+ ], p.prototype, "slots", 2);
1677
+ g([
1678
+ l({ type: String })
1679
+ ], p.prototype, "minDate", 2);
1680
+ g([
1681
+ l({ type: String })
1682
+ ], p.prototype, "maxDate", 2);
1683
+ g([
1684
+ l({ type: Boolean })
1685
+ ], p.prototype, "showNeighboringMonth", 2);
1686
+ g([
1687
+ l({ attribute: !1 })
1688
+ ], p.prototype, "tileClassName", 2);
1689
+ g([
1690
+ l({ type: Boolean, attribute: "enable-series-confirmation" })
1691
+ ], p.prototype, "enableSeriesConfirmation", 2);
1692
+ g([
1693
+ m()
1694
+ ], p.prototype, "activeDate", 2);
1695
+ g([
1696
+ m()
1697
+ ], p.prototype, "localRules", 2);
1698
+ g([
1699
+ m()
1700
+ ], p.prototype, "darkMode", 2);
1701
+ g([
1702
+ m()
1703
+ ], p.prototype, "modalOpen", 2);
1704
+ g([
1705
+ m()
1706
+ ], p.prototype, "modalDateString", 2);
1707
+ g([
1708
+ m()
1709
+ ], p.prototype, "modalStartTime", 2);
1710
+ g([
1711
+ m()
1712
+ ], p.prototype, "modalEndTime", 2);
1713
+ g([
1714
+ m()
1715
+ ], p.prototype, "modalIsRange", 2);
1716
+ g([
1717
+ m()
1718
+ ], p.prototype, "modalExistingRule", 2);
1719
+ g([
1720
+ m()
1721
+ ], p.prototype, "seriesModalOpen", 2);
1722
+ g([
1723
+ m()
1724
+ ], p.prototype, "seriesTargetRule", 2);
1725
+ g([
1726
+ m()
1727
+ ], p.prototype, "seriesTargetDateString", 2);
1728
+ p = g([
1729
+ C("glatam-calendar")
1730
+ ], p);
1731
+ const ct = M`
1732
+ :host {
1733
+ display: inline-block;
1734
+ background: transparent;
1735
+ border: none;
1736
+ padding: 0;
1737
+ box-shadow: none;
1738
+ width: 100%;
1739
+ overflow: visible !important;
1740
+ }
1741
+
1742
+ .mini-calendar-header {
1743
+ display: flex;
1744
+ justify-content: space-between;
1745
+ align-items: center;
1746
+ padding: 4px 8px;
1747
+ margin-bottom: 8px;
1748
+ user-select: none;
1749
+ }
1750
+
1751
+ .mini-month-title {
1752
+ font-size: 0.875rem;
1753
+ font-weight: 600;
1754
+ color: var(--glatam-text);
1755
+ text-transform: capitalize;
1756
+ letter-spacing: -0.01em;
1757
+ }
1758
+
1759
+ .mini-nav-btn {
1760
+ background: transparent;
1761
+ border: 1px solid var(--glatam-border);
1762
+ border-radius: 8px;
1763
+ color: var(--glatam-text);
1764
+ width: 28px;
1765
+ height: 28px;
1766
+ display: flex;
1767
+ align-items: center;
1768
+ justify-content: center;
1769
+ cursor: pointer;
1770
+ font-size: 0.75rem;
1771
+ transition: background-color var(--glatam-transition-fast), border-color var(--glatam-transition-fast), transform var(--glatam-transition-fast);
1772
+ }
1773
+
1774
+ .mini-nav-btn:hover:not(:disabled) {
1775
+ background-color: var(--glatam-surface);
1776
+ border-color: var(--glatam-text-secondary);
1777
+ }
1778
+
1779
+ .mini-nav-btn:active:not(:disabled) {
1780
+ transform: scale(0.95);
1781
+ }
1782
+ `;
1783
+ var pt = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, v = (e, t, a, r) => {
1784
+ for (var i = r > 1 ? void 0 : r ? gt(t, a) : t, s = e.length - 1, o; s >= 0; s--)
1785
+ (o = e[s]) && (i = (r ? o(t, a, i) : o(i)) || i);
1786
+ return r && i && pt(t, a, i), i;
1381
1787
  };
1382
- let b = class extends E {
1788
+ let b = class extends O {
1383
1789
  constructor() {
1384
1790
  super(...arguments), this.role = "buyer", this.locale = "es", this.startOfWeekDay = 0, this.rules = [], this.selectedRange = null, this.size = "medium", this.hostTimezone = "America/Bogota", this.activeTimezone = "local", this.minDate = "", this.maxDate = "", this.showNeighboringMonth = !0, this.tileClassName = null, this.slots = [
1385
1791
  { start: "09:00", end: "10:00" },
@@ -1391,241 +1797,168 @@ let b = class extends E {
1391
1797
  { start: "15:00", end: "16:00" },
1392
1798
  { start: "16:00", end: "17:00" },
1393
1799
  { start: "17:00", end: "18:00" }
1394
- ], this.activeDate = /* @__PURE__ */ new Date(), this.dropdownOpen = !1, this.dropdownSelectedDateString = "", this.touchStartX = 0, this.touchStartY = 0;
1800
+ ], this.activeDate = /* @__PURE__ */ new Date(), this.dropdownOpen = !1, this.dropdownSelectedDateString = "", this.touchStartX = 0, this.touchStartY = 0, this.handleOutsideClick = (e) => {
1801
+ this.dropdownOpen && !e.composedPath().includes(this) && (this.dropdownOpen = !1, this.dropdownSelectedDateString = "");
1802
+ }, this.handleKeyDown = (e) => {
1803
+ e.key === "Escape" && this.dropdownOpen && (this.dropdownOpen = !1, this.dropdownSelectedDateString = "");
1804
+ };
1395
1805
  }
1396
- handlePrevMonth(t) {
1397
- t.stopPropagation();
1398
- const e = new Date(this.activeDate);
1399
- e.setMonth(e.getMonth() - 1), this.activeDate = e;
1806
+ connectedCallback() {
1807
+ super.connectedCallback(), window.addEventListener("click", this.handleOutsideClick), window.addEventListener("keydown", this.handleKeyDown);
1400
1808
  }
1401
- handleNextMonth(t) {
1402
- t.stopPropagation();
1403
- const e = new Date(this.activeDate);
1404
- e.setMonth(e.getMonth() + 1), this.activeDate = e;
1809
+ disconnectedCallback() {
1810
+ window.removeEventListener("click", this.handleOutsideClick), window.removeEventListener("keydown", this.handleKeyDown), super.disconnectedCallback();
1811
+ }
1812
+ toggleDropdown(e) {
1813
+ e.stopPropagation(), this.dropdownOpen = !this.dropdownOpen, this.dropdownOpen || (this.dropdownSelectedDateString = "");
1814
+ }
1815
+ handlePrevMonth(e) {
1816
+ e.stopPropagation();
1817
+ const t = new Date(this.activeDate);
1818
+ t.setMonth(t.getMonth() - 1), this.activeDate = t;
1819
+ }
1820
+ handleNextMonth(e) {
1821
+ e.stopPropagation();
1822
+ const t = new Date(this.activeDate);
1823
+ t.setMonth(t.getMonth() + 1), this.activeDate = t;
1405
1824
  }
1406
- handleTouchStart(t) {
1407
- t.touches && t.touches.length > 0 && (this.touchStartX = t.touches[0].clientX, this.touchStartY = t.touches[0].clientY);
1825
+ handleTouchStart(e) {
1826
+ e.touches && e.touches.length > 0 && (this.touchStartX = e.touches[0].clientX, this.touchStartY = e.touches[0].clientY);
1408
1827
  }
1409
- handleTouchEnd(t) {
1410
- if (t.changedTouches && t.changedTouches.length > 0) {
1411
- const e = t.changedTouches[0].clientX, a = t.changedTouches[0].clientY, i = this.touchStartX - e, r = this.touchStartY - a;
1412
- Math.abs(i) > 50 && Math.abs(i) > Math.abs(r) && (i > 0 ? this.handleNextMonth(t) : this.handlePrevMonth(t));
1828
+ handleTouchEnd(e) {
1829
+ if (e.changedTouches && e.changedTouches.length > 0) {
1830
+ const t = this.touchStartX - e.changedTouches[0].clientX, a = this.touchStartY - e.changedTouches[0].clientY;
1831
+ Math.abs(t) > 50 && Math.abs(t) > Math.abs(a) && (t > 0 ? this.handleNextMonth(e) : this.handlePrevMonth(e));
1413
1832
  }
1414
1833
  }
1415
1834
  getFormattedMonthTitle() {
1416
- const t = this.activeDate.toLocaleDateString(this.locale || "es", { month: "long", year: "numeric" });
1417
- return t.charAt(0).toUpperCase() + t.slice(1);
1835
+ const e = this.activeDate.toLocaleDateString(this.locale || "es", { month: "long", year: "numeric" });
1836
+ return e.charAt(0).toUpperCase() + e.slice(1);
1418
1837
  }
1419
- handleDropdownDaySelect(t) {
1420
- this.dropdownSelectedDateString = t.detail.dateString;
1838
+ handleDropdownDaySelect(e) {
1839
+ this.dropdownSelectedDateString = e.detail.dateString;
1421
1840
  }
1422
- selectDropdownSlot(t) {
1423
- const e = {
1841
+ selectDropdownSlot(e) {
1842
+ const t = {
1424
1843
  dateString: this.dropdownSelectedDateString,
1425
- start: t.displayStart,
1426
- end: t.displayEnd,
1427
- hostStart: t.start,
1428
- hostEnd: t.end
1844
+ start: e.displayStart,
1845
+ end: e.displayEnd,
1846
+ hostStart: e.start,
1847
+ hostEnd: e.end
1429
1848
  };
1430
- this.selectedRange = { dateString: this.dropdownSelectedDateString, start: t.displayStart, end: t.displayEnd }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: e, bubbles: !0, composed: !0 })), this.dropdownOpen = !1, this.dropdownSelectedDateString = "";
1849
+ this.selectedRange = { dateString: this.dropdownSelectedDateString, start: e.displayStart, end: e.displayEnd }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: t, bubbles: !0, composed: !0 })), this.dropdownOpen = !1, this.dropdownSelectedDateString = "";
1431
1850
  }
1432
1851
  render() {
1433
- const t = this.selectedRange ? `Reserva: ${this.selectedRange.dateString} (${this.selectedRange.start} - ${this.selectedRange.end})` : "Seleccionar Fecha y Hora", e = this.activeDate.getFullYear(), a = this.activeDate.getMonth(), i = this.dropdownSelectedDateString ? /* @__PURE__ */ new Date(this.dropdownSelectedDateString + "T00:00:00") : null, r = i && this.activeTimezone === "local" ? I(i, this.hostTimezone, "local") : 0, l = i ? this.slots.map((o) => {
1434
- const h = C(i, o, this.rules), n = U(o, r), c = n.dayShift > 0 ? " (+1d)" : n.dayShift < 0 ? " (-1d)" : "";
1435
- return {
1436
- ...o,
1437
- displayStart: n.start + c,
1438
- displayEnd: n.end + c,
1439
- isBlocked: h
1440
- };
1852
+ const e = this.selectedRange ? `Reserva: ${this.selectedRange.dateString} (${this.selectedRange.start} - ${this.selectedRange.end})` : "Seleccionar Fecha y Hora", t = this.activeDate.getFullYear(), a = this.activeDate.getMonth(), r = this.dropdownSelectedDateString ? N(this.dropdownSelectedDateString) : null, i = r && this.activeTimezone === "local" ? B(r, this.hostTimezone, "local") : 0, s = r ? this.slots.map((o) => {
1853
+ const u = _(r, o, this.rules), n = G(o, i), d = n.dayShift > 0 ? " (+1d)" : n.dayShift < 0 ? " (-1d)" : "";
1854
+ return { ...o, displayStart: n.start + d, displayEnd: n.end + d, isBlocked: u };
1441
1855
  }) : [];
1442
- return d`
1856
+ return c`
1443
1857
  <div class="dropdown-container">
1444
- <button class="btn btn-primary dropdown-toggle" @click=${() => this.dropdownOpen = !this.dropdownOpen}>
1445
- <span>${t}</span> <span>${this.dropdownOpen ? "▲" : "▼"}</span>
1858
+ <button class="btn btn-primary dropdown-toggle" @click=${this.toggleDropdown}>
1859
+ <span>${e}</span> <span>${this.dropdownOpen ? "▲" : "▼"}</span>
1446
1860
  </button>
1447
1861
 
1448
- ${this.dropdownOpen ? d`
1449
- <div class="dropdown-card" style="--glatam-day-min-height: 38px;">
1450
- ${this.dropdownSelectedDateString ? d`
1451
- <div style="display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid var(--glatam-border); padding-bottom:8px;">
1452
- <button class="btn" style="height:28px; padding:0 8px; font-size:0.75rem;" @click=${() => this.dropdownSelectedDateString = ""}>&lt; Volver</button>
1453
- <span style="font-size:0.8rem; font-weight:600; color: var(--glatam-text);">${this.dropdownSelectedDateString}</span>
1454
- </div>
1455
- <div class="slot-list">
1456
- ${l.map((o) => d`
1457
- <button
1458
- class="slot-btn ${o.isBlocked ? "blocked" : ""}"
1459
- ?disabled=${o.isBlocked}
1460
- @click=${() => this.selectDropdownSlot(o)}
1461
- >
1462
- ${o.displayStart} - ${o.displayEnd} ${o.isBlocked ? "(Ocupado)" : ""}
1463
- </button>
1464
- `)}
1465
- </div>
1466
- ` : d`
1467
- <div class="mini-calendar-header">
1468
- <button
1469
- type="button"
1470
- class="mini-nav-btn"
1471
- aria-label="Mes anterior"
1472
- @click=${this.handlePrevMonth}
1473
- >
1474
- &lt;
1475
- </button>
1476
- <span class="mini-month-title">
1477
- ${this.getFormattedMonthTitle()}
1478
- </span>
1479
- <button
1480
- type="button"
1481
- class="mini-nav-btn"
1482
- aria-label="Mes siguiente"
1483
- @click=${this.handleNextMonth}
1484
- >
1485
- &gt;
1486
- </button>
1487
- </div>
1488
- <div
1489
- class="mini-calendar-touch-wrapper"
1490
- @touchstart=${this.handleTouchStart}
1491
- @touchend=${this.handleTouchEnd}
1492
- >
1493
- <glatam-calendar-month-view
1494
- .days=${P(e, a, this.rules, this.slots, this.startOfWeekDay)}
1495
- .locale=${this.locale}
1496
- .startOfWeekDay=${this.startOfWeekDay}
1497
- .role=${this.role}
1498
- size="small"
1499
- .minDate=${this.minDate}
1500
- .maxDate=${this.maxDate}
1501
- .showNeighboringMonth=${this.showNeighboringMonth}
1502
- .tileClassName=${this.tileClassName}
1503
- @day-select=${this.handleDropdownDaySelect}
1504
- ></glatam-calendar-month-view>
1505
- </div>
1506
- `}
1862
+ ${this.dropdownOpen ? c`
1863
+ <div class="dropdown-card" style="--glatam-day-min-height: 38px;">
1864
+ ${this.dropdownSelectedDateString ? c`
1865
+ <div style="display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid var(--glatam-border); padding-bottom:8px;">
1866
+ <button type="button" class="btn" style="height:28px; padding:0 8px; font-size:0.75rem;" @click=${() => this.dropdownSelectedDateString = ""}>&lt; Volver</button>
1867
+ <span style="font-size:0.8rem; font-weight:600; color: var(--glatam-text);">${this.dropdownSelectedDateString}</span>
1868
+ </div>
1869
+ <div class="slot-list">
1870
+ ${s.map((o) => c`
1871
+ <button type="button" class="slot-btn ${o.isBlocked ? "blocked" : ""}" ?disabled=${o.isBlocked} @click=${() => this.selectDropdownSlot(o)}>
1872
+ ${o.displayStart} - ${o.displayEnd} ${o.isBlocked ? "(Ocupado)" : ""}
1873
+ </button>
1874
+ `)}
1875
+ </div>
1876
+ ` : c`
1877
+ <div class="mini-calendar-header">
1878
+ <button type="button" class="mini-nav-btn" aria-label="Mes anterior" @click=${this.handlePrevMonth}>&lt;</button>
1879
+ <span class="mini-month-title">${this.getFormattedMonthTitle()}</span>
1880
+ <button type="button" class="mini-nav-btn" aria-label="Mes siguiente" @click=${this.handleNextMonth}>&gt;</button>
1507
1881
  </div>
1508
- ` : ""}
1882
+ <div class="mini-calendar-touch-wrapper" @touchstart=${this.handleTouchStart} @touchend=${this.handleTouchEnd}>
1883
+ <glatam-calendar-month-view
1884
+ .days=${Y(t, a, this.rules, this.slots, this.startOfWeekDay)}
1885
+ .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${"small"}
1886
+ .minDate=${this.minDate} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth}
1887
+ .tileClassName=${this.tileClassName} @day-select=${this.handleDropdownDaySelect}
1888
+ ></glatam-calendar-month-view>
1889
+ </div>
1890
+ `}
1891
+ </div>
1892
+ ` : ""}
1509
1893
  </div>
1510
1894
  `;
1511
1895
  }
1512
1896
  };
1513
- b.styles = [
1514
- A,
1515
- W,
1516
- M`
1517
- :host {
1518
- display: inline-block;
1519
- background: transparent;
1520
- border: none;
1521
- padding: 0;
1522
- box-shadow: none;
1523
- width: 100%;
1524
- }
1525
-
1526
- .mini-calendar-header {
1527
- display: flex;
1528
- justify-content: space-between;
1529
- align-items: center;
1530
- padding: 4px 8px;
1531
- margin-bottom: 8px;
1532
- user-select: none;
1533
- }
1534
-
1535
- .mini-month-title {
1536
- font-size: 0.875rem;
1537
- font-weight: 600;
1538
- color: var(--glatam-text);
1539
- text-transform: capitalize;
1540
- letter-spacing: -0.01em;
1541
- }
1542
-
1543
- .mini-nav-btn {
1544
- background: transparent;
1545
- border: 1px solid var(--glatam-border);
1546
- border-radius: 8px;
1547
- color: var(--glatam-text);
1548
- width: 28px;
1549
- height: 28px;
1550
- display: flex;
1551
- align-items: center;
1552
- justify-content: center;
1553
- cursor: pointer;
1554
- font-size: 0.75rem;
1555
- transition: background-color var(--glatam-transition-fast), border-color var(--glatam-transition-fast), transform var(--glatam-transition-fast);
1556
- }
1557
-
1558
- .mini-nav-btn:hover:not(:disabled) {
1559
- background-color: var(--glatam-surface);
1560
- border-color: var(--glatam-text-secondary);
1561
- }
1562
-
1563
- .mini-nav-btn:active:not(:disabled) {
1564
- transform: scale(0.95);
1565
- }
1566
- `
1567
- ];
1568
- y([
1569
- s({ type: String })
1897
+ b.styles = [H, q, ct];
1898
+ v([
1899
+ l({ type: String })
1570
1900
  ], b.prototype, "role", 2);
1571
- y([
1572
- s({ type: String })
1901
+ v([
1902
+ l({ type: String })
1573
1903
  ], b.prototype, "locale", 2);
1574
- y([
1575
- s({ type: Number })
1904
+ v([
1905
+ l({ type: Number })
1576
1906
  ], b.prototype, "startOfWeekDay", 2);
1577
- y([
1578
- s({ type: Array })
1907
+ v([
1908
+ l({ type: Array })
1579
1909
  ], b.prototype, "rules", 2);
1580
- y([
1581
- s({ type: Object })
1910
+ v([
1911
+ l({ type: Object })
1582
1912
  ], b.prototype, "selectedRange", 2);
1583
- y([
1584
- s({ type: String, reflect: !0 })
1913
+ v([
1914
+ l({ type: String, reflect: !0 })
1585
1915
  ], b.prototype, "size", 2);
1586
- y([
1587
- s({ type: String })
1916
+ v([
1917
+ l({ type: String })
1588
1918
  ], b.prototype, "hostTimezone", 2);
1589
- y([
1590
- s({ type: String })
1919
+ v([
1920
+ l({ type: String })
1591
1921
  ], b.prototype, "activeTimezone", 2);
1592
- y([
1593
- s({ type: String })
1922
+ v([
1923
+ l({ type: String })
1594
1924
  ], b.prototype, "minDate", 2);
1595
- y([
1596
- s({ type: String })
1925
+ v([
1926
+ l({ type: String })
1597
1927
  ], b.prototype, "maxDate", 2);
1598
- y([
1599
- s({ type: Boolean })
1928
+ v([
1929
+ l({ type: Boolean })
1600
1930
  ], b.prototype, "showNeighboringMonth", 2);
1601
- y([
1602
- s({ attribute: !1 })
1931
+ v([
1932
+ l({ attribute: !1 })
1603
1933
  ], b.prototype, "tileClassName", 2);
1604
- y([
1605
- s({ type: Array })
1934
+ v([
1935
+ l({ type: Array })
1606
1936
  ], b.prototype, "slots", 2);
1607
- y([
1608
- u()
1937
+ v([
1938
+ m()
1609
1939
  ], b.prototype, "activeDate", 2);
1610
- y([
1611
- u()
1940
+ v([
1941
+ m()
1612
1942
  ], b.prototype, "dropdownOpen", 2);
1613
- y([
1614
- u()
1943
+ v([
1944
+ m()
1615
1945
  ], b.prototype, "dropdownSelectedDateString", 2);
1616
- b = y([
1617
- T("glatam-calendar-mini")
1946
+ b = v([
1947
+ C("glatam-calendar-mini")
1618
1948
  ], b);
1619
1949
  export {
1620
- g as GlatamCalendar,
1950
+ p as GlatamCalendar,
1621
1951
  S as GlatamCalendarDayView,
1622
1952
  b as GlatamCalendarMini,
1623
- x as GlatamCalendarModal,
1624
- f as GlatamCalendarMonthView,
1625
- w as GlatamCalendarWeekView,
1626
- W as calendarStyles,
1627
- nt as formatISODate,
1628
- dt as isTimeBlocked,
1629
- ct as parseISODate,
1630
- A as variablesStyles
1953
+ D as GlatamCalendarModal,
1954
+ w as GlatamCalendarMonthView,
1955
+ x as GlatamCalendarWeekView,
1956
+ T as GlatamSeriesConfirmationModal,
1957
+ q as calendarStyles,
1958
+ F as deleteSeries,
1959
+ V as deleteSingleInstance,
1960
+ yt as formatISODate,
1961
+ xt as isTimeBlocked,
1962
+ wt as parseISODate,
1963
+ H as variablesStyles
1631
1964
  };