@glatam/calendar-ui 1.0.1 → 1.0.3

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.
@@ -14,6 +14,8 @@ export declare class GlatamCalendarModal extends LitElement {
14
14
  private isRecurring;
15
15
  private selectedDays;
16
16
  willUpdate(changedProperties: Map<string, any>): void;
17
+ updated(changedProperties: Map<string, any>): void;
18
+ private handleDialogClose;
17
19
  private toggleDay;
18
20
  private handleSave;
19
21
  private handleDelete;
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-modal.d.ts","sourceRoot":"","sources":["../../src/components/calendar-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBACa,mBAAoB,SAAQ,UAAU;IACjD,MAAM,CAAC,MAAM,0BAqJX;IAE2B,IAAI,UAAS;IACd,UAAU,SAAM;IAChB,SAAS,SAAM;IACf,OAAO,SAAM;IACZ,OAAO,UAAS;IACjB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IAE5D,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAgB;IAE7C,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAgB9C,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,YAAY;IAUpB,MAAM;CA8EP"}
1
+ {"version":3,"file":"calendar-modal.d.ts","sourceRoot":"","sources":["../../src/components/calendar-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,qBACa,mBAAoB,SAAQ,UAAU;IACjD,MAAM,CAAC,MAAM,0BAAe;IAEC,IAAI,UAAS;IACd,UAAU,SAAM;IAChB,SAAS,SAAM;IACf,OAAO,SAAM;IACZ,OAAO,UAAS;IACjB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IAE5D,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAgB;IAE7C,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAgB9C,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAa3C,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,YAAY;IAUpB,MAAM;CA8EP"}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),l=require("lit/decorators.js"),y=require("@glatam/calendar-core"),k=require("lit/directives/class-map.js"),C=s.css`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),l=require("lit/decorators.js"),y=require("@glatam/calendar-core"),$=require("lit/directives/class-map.js"),M=s.css`
2
2
  :host {
3
3
  /* Fonts */
4
4
  --glatam-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -86,7 +86,7 @@
86
86
  --glatam-padding: 24px;
87
87
  font-size: 1.1rem;
88
88
  }
89
- `,$=s.css`
89
+ `,G=s.css`
90
90
  :host {
91
91
  display: grid;
92
92
  min-width: 0;
@@ -342,21 +342,21 @@
342
342
  min-width: 32px;
343
343
  }
344
344
  }
345
- `;function D(d,t,e){if(t===e)return 0;const a=(r,i)=>{const o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1};i!=="local"&&(o.timeZone=i);const c=new Intl.DateTimeFormat("en-US",o).formatToParts(r),n=new Map(c.map(b=>[b.type,b.value])),g=Number(n.get("hour")),h=g===24?0:g;return new Date(Number(n.get("year")),Number(n.get("month"))-1,Number(n.get("day")),h,Number(n.get("minute")),Number(n.get("second")))};try{const r=a(d,t);return(a(d,e).getTime()-r.getTime())/(60*1e3)}catch{return 0}}function G(d,t){if(t===0)return{start:d.start,end:d.end,dayShift:0};const e=n=>{const[g,h]=n.split(":").map(Number);return g*60+h},a=n=>{let g=n%1440;g<0&&(g+=1440);const h=String(Math.floor(g/60)).padStart(2,"0"),b=String(g%60).padStart(2,"0");return`${h}:${b}`},r=e(d.start),i=e(d.end),o=r+t,p=i+t;let c=0;return o<0?c=-1:o>=1440&&(c=1),{start:a(o),end:a(p),dayShift:c}}var R=Object.defineProperty,E=Object.getOwnPropertyDescriptor,v=(d,t,e,a)=>{for(var r=a>1?void 0:a?E(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&R(t,e,r),r};exports.GlatamCalendarMonthView=class extends s.LitElement{constructor(){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}getWeekdayNames(){const t=[],e=new Date(2026,6,12+this.startOfWeekDay),a=new Intl.DateTimeFormat(this.locale,{weekday:"short"});for(let r=0;r<7;r++)t.push(a.format(e)),e.setDate(e.getDate()+1);return t}handleDayClick(t){this.role==="buyer"&&t.isBlocked||this.dispatchEvent(new CustomEvent("day-select",{detail:{dateString:t.dateString,isBlocked:t.isBlocked},bubbles:!0,composed:!0}))}render(){const t=this.getWeekdayNames();return s.html`
345
+ `;function k(d,t,e){if(t===e)return 0;const a=(r,i)=>{const o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1};i!=="local"&&(o.timeZone=i);const p=new Intl.DateTimeFormat("en-US",o).formatToParts(r),n=new Map(p.map(u=>[u.type,u.value])),g=Number(n.get("hour")),m=g===24?0:g;return new Date(Number(n.get("year")),Number(n.get("month"))-1,Number(n.get("day")),m,Number(n.get("minute")),Number(n.get("second")))};try{const r=a(d,t);return(a(d,e).getTime()-r.getTime())/(60*1e3)}catch{return 0}}function R(d,t){if(t===0)return{start:d.start,end:d.end,dayShift:0};const e=n=>{const[g,m]=n.split(":").map(Number);return g*60+m},a=n=>{let g=n%1440;g<0&&(g+=1440);const m=String(Math.floor(g/60)).padStart(2,"0"),u=String(g%60).padStart(2,"0");return`${m}:${u}`},r=e(d.start),i=e(d.end),o=r+t,c=i+t;let p=0;return o<0?p=-1:o>=1440&&(p=1),{start:a(o),end:a(c),dayShift:p}}var E=Object.defineProperty,z=Object.getOwnPropertyDescriptor,v=(d,t,e,a)=>{for(var r=a>1?void 0:a?z(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&E(t,e,r),r};exports.GlatamCalendarMonthView=class extends s.LitElement{constructor(){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}getWeekdayNames(){const t=[],e=new Date(2026,6,12+this.startOfWeekDay),a=new Intl.DateTimeFormat(this.locale,{weekday:"short"});for(let r=0;r<7;r++)t.push(a.format(e)),e.setDate(e.getDate()+1);return t}handleDayClick(t){const e=this.minDate&&t.dateString<this.minDate||this.maxDate&&t.dateString>this.maxDate;this.role==="buyer"&&(t.isBlocked||e)||this.dispatchEvent(new CustomEvent("day-select",{detail:{dateString:t.dateString,isBlocked:t.isBlocked},bubbles:!0,composed:!0}))}render(){const t=this.getWeekdayNames();return s.html`
346
346
  ${t.map(e=>s.html`<div class="weekday">${e}</div>`)}
347
347
 
348
- ${this.days.map(e=>{var c;if(!e.isCurrentMonth&&!this.showNeighboringMonth)return s.html`<div class="day-cell empty"></div>`;const a=e.dateString===new Date().toISOString().split("T")[0],r=this.selectedDates.includes(e.dateString),i=e.slots.filter(n=>n.isBlocked),o=this.minDate&&e.dateString<this.minDate||this.maxDate&&e.dateString>this.maxDate,p=this.tileClassName?this.tileClassName({date:e.date,dateString:e.dateString}):"";return s.html`
348
+ ${this.days.map(e=>{var p;if(!e.isCurrentMonth&&!this.showNeighboringMonth)return s.html`<div class="day-cell empty"></div>`;const a=e.dateString===new Date().toISOString().split("T")[0],r=this.selectedDates.includes(e.dateString),i=e.slots.filter(n=>n.isBlocked),o=this.minDate&&e.dateString<this.minDate||this.maxDate&&e.dateString>this.maxDate,c=this.tileClassName?this.tileClassName({date:e.date,dateString:e.dateString}):"";return s.html`
349
349
  <div
350
- class=${k.classMap({"day-cell":!0,padding:!e.isCurrentMonth,blocked:e.isBlocked,today:a,selected:r,disabled:!!o,[p]:!!p})}
351
- part="day-cell ${p}"
350
+ class=${$.classMap({"day-cell":!0,padding:!e.isCurrentMonth,blocked:e.isBlocked,today:a,selected:r,disabled:!!o,[c]:!!c})}
351
+ part="day-cell ${c}"
352
352
  @click=${()=>this.handleDayClick(e)}
353
353
  >
354
354
  <div class="day-number">${e.dayNumber}</div>
355
355
 
356
356
  <div class="slot-indicator">
357
- ${e.isBlocked?s.html`<div class="badge blocked-day">${((c=e.rule)==null?void 0:c.description)||"Bloqueado"}</div>`:i.slice(0,2).map(n=>{var g,h;return s.html`
357
+ ${e.isBlocked?s.html`<div class="badge blocked-day">${((p=e.rule)==null?void 0:p.description)||"Bloqueado"}</div>`:i.slice(0,2).map(n=>{var g,m;return s.html`
358
358
  <div class="badge blocked-slot" title=${((g=n.rule)==null?void 0:g.description)||""}>
359
- 🚫 ${((h=n.rule)==null?void 0:h.description)||n.start}
359
+ 🚫 ${((m=n.rule)==null?void 0:m.description)||n.start}
360
360
  </div>
361
361
  `})}
362
362
  ${!e.isBlocked&&i.length>2?s.html`<div style="text-align: center; font-size: 0.65rem; color: var(--glatam-text-secondary);">+${i.length-2} tareas</div>`:""}
@@ -395,7 +395,7 @@
395
395
  .slot-indicator { display: none; }
396
396
  .day-number { margin-bottom: 0; font-size: 0.8rem; }
397
397
  }
398
- `;v([l.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"days",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"locale",2);v([l.property({type:Number})],exports.GlatamCalendarMonthView.prototype,"startOfWeekDay",2);v([l.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"selectedDates",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"role",2);v([l.property({type:String,reflect:!0})],exports.GlatamCalendarMonthView.prototype,"size",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"minDate",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"maxDate",2);v([l.property({type:Boolean})],exports.GlatamCalendarMonthView.prototype,"showNeighboringMonth",2);v([l.property({attribute:!1})],exports.GlatamCalendarMonthView.prototype,"tileClassName",2);exports.GlatamCalendarMonthView=v([l.customElement("glatam-calendar-month-view")],exports.GlatamCalendarMonthView);var z=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=(d,t,e,a)=>{for(var r=a>1?void 0:a?O(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&z(t,e,r),r};exports.GlatamCalendarWeekView=class extends s.LitElement{constructor(){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=()=>{if(!this.isDragging||this.dragDayIndex===null||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.days[this.dragDayIndex],r=a.slots.slice(t,e+1);r.some(i=>i.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:a.dateString,start:r[0].start,end:r[r.length-1].end},bubbles:!0,composed:!0})),this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e,a){if(a){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.days[t].dateString,slot:this.days[t].slots[e],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragDayIndex=t,this.dragStartSlotIndex=e,this.dragEndSlotIndex=e}handleMouseEnter(t,e,a){this.isDragging&&t===this.dragDayIndex&&!a&&(this.dragEndSlotIndex=e)}isSlotSelected(t,e){return!this.selectedRange||this.selectedRange.dateString!==t?!1:e.start>=this.selectedRange.start&&e.end<=this.selectedRange.end}isSlotDragSelecting(t,e){if(!this.isDragging||t!==this.dragDayIndex)return!1;const a=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),r=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return e>=a&&e<=r}render(){const t=new Date().toISOString().split("T")[0];return s.html`
398
+ `;v([l.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"days",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"locale",2);v([l.property({type:Number})],exports.GlatamCalendarMonthView.prototype,"startOfWeekDay",2);v([l.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"selectedDates",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"role",2);v([l.property({type:String,reflect:!0})],exports.GlatamCalendarMonthView.prototype,"size",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"minDate",2);v([l.property({type:String})],exports.GlatamCalendarMonthView.prototype,"maxDate",2);v([l.property({type:Boolean})],exports.GlatamCalendarMonthView.prototype,"showNeighboringMonth",2);v([l.property({attribute:!1})],exports.GlatamCalendarMonthView.prototype,"tileClassName",2);exports.GlatamCalendarMonthView=v([l.customElement("glatam-calendar-month-view")],exports.GlatamCalendarMonthView);var O=Object.defineProperty,T=Object.getOwnPropertyDescriptor,x=(d,t,e,a)=>{for(var r=a>1?void 0:a?T(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&O(t,e,r),r};exports.GlatamCalendarWeekView=class extends s.LitElement{constructor(){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=()=>{if(!this.isDragging||this.dragDayIndex===null||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.days[this.dragDayIndex],r=a.slots.slice(t,e+1);r.some(i=>i.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:a.dateString,start:r[0].start,end:r[r.length-1].end},bubbles:!0,composed:!0})),this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e,a){if(a){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.days[t].dateString,slot:this.days[t].slots[e],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragDayIndex=t,this.dragStartSlotIndex=e,this.dragEndSlotIndex=e}handleMouseEnter(t,e,a){this.isDragging&&t===this.dragDayIndex&&!a&&(this.dragEndSlotIndex=e)}isSlotSelected(t,e){return!this.selectedRange||this.selectedRange.dateString!==t?!1:e.start>=this.selectedRange.start&&e.end<=this.selectedRange.end}isSlotDragSelecting(t,e){if(!this.isDragging||t!==this.dragDayIndex)return!1;const a=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),r=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return e>=a&&e<=r}render(){const t=new Date().toISOString().split("T")[0];return s.html`
399
399
  <div class="time-col">
400
400
  <div class="header-cell">Hora</div>
401
401
  ${this.slots.map(e=>s.html`<div class="slot-cell time-slot-label">${e.start}</div>`)}
@@ -408,14 +408,14 @@
408
408
  <div class="day-num">${e.dayNumber}</div>
409
409
  </div>
410
410
 
411
- ${e.slots.map((o,p)=>{var h,b;const c=o.isBlocked,n=this.isSlotSelected(e.dateString,o),g=this.isSlotDragSelecting(a,p);return s.html`
411
+ ${e.slots.map((o,c)=>{var m,u;const p=o.isBlocked,n=this.isSlotSelected(e.dateString,o),g=this.isSlotDragSelecting(a,c);return s.html`
412
412
  <div
413
- class=${k.classMap({"slot-cell":!0,available:!c,blocked:c,selected:n,"drag-selecting":g})}
414
- @mousedown=${()=>this.handleMouseDown(a,p,c)}
415
- @mouseenter=${()=>this.handleMouseEnter(a,p,c)}
416
- title=${c&&((h=o.rule)!=null&&h.description)?o.rule.description:""}
413
+ class=${$.classMap({"slot-cell":!0,available:!p,blocked:p,selected:n,"drag-selecting":g})}
414
+ @mousedown=${()=>this.handleMouseDown(a,c,p)}
415
+ @mouseenter=${()=>this.handleMouseEnter(a,c,p)}
416
+ title=${p&&((m=o.rule)!=null&&m.description)?o.rule.description:""}
417
417
  >
418
- ${c?((b=o.rule)==null?void 0:b.description)||"Ocupado":n?"Reservado":""}
418
+ ${p?((u=o.rule)==null?void 0:u.description)||"Ocupado":n?"Reservado":""}
419
419
  </div>
420
420
  `})}
421
421
  </div>
@@ -472,7 +472,7 @@
472
472
  }
473
473
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
474
474
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
475
- `;x([l.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"days",2);x([l.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"slots",2);x([l.property({type:String})],exports.GlatamCalendarWeekView.prototype,"locale",2);x([l.property({type:Object})],exports.GlatamCalendarWeekView.prototype,"selectedRange",2);x([l.property({type:String})],exports.GlatamCalendarWeekView.prototype,"role",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"isDragging",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragDayIndex",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragStartSlotIndex",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarWeekView=x([l.customElement("glatam-calendar-week-view")],exports.GlatamCalendarWeekView);var T=Object.defineProperty,I=Object.getOwnPropertyDescriptor,w=(d,t,e,a)=>{for(var r=a>1?void 0:a?I(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&T(t,e,r),r};exports.GlatamCalendarDayView=class extends s.LitElement{constructor(){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=()=>{if(!this.isDragging||!this.day||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.day.slots.slice(t,e+1);a.some(r=>r.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:this.day.dateString,start:a[0].start,end:a[a.length-1].end},bubbles:!0,composed:!0})),this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e){if(e&&this.day){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.day.dateString,slot:this.day.slots[t],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragStartSlotIndex=t,this.dragEndSlotIndex=t}handleMouseEnter(t,e){this.isDragging&&!e&&(this.dragEndSlotIndex=t)}isSlotSelected(t){return!this.day||!this.selectedRange||this.selectedRange.dateString!==this.day.dateString?!1:t.start>=this.selectedRange.start&&t.end<=this.selectedRange.end}isSlotDragSelecting(t){if(!this.isDragging)return!1;const e=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),a=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return t>=e&&t<=a}render(){if(!this.day)return s.html`<div>Cargando...</div>`;const t=this.day.dateString===new Date().toISOString().split("T")[0],e=new Intl.DateTimeFormat(this.locale,{weekday:"long",day:"numeric",month:"long"}).format(this.day.date);return s.html`
475
+ `;x([l.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"days",2);x([l.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"slots",2);x([l.property({type:String})],exports.GlatamCalendarWeekView.prototype,"locale",2);x([l.property({type:Object})],exports.GlatamCalendarWeekView.prototype,"selectedRange",2);x([l.property({type:String})],exports.GlatamCalendarWeekView.prototype,"role",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"isDragging",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragDayIndex",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragStartSlotIndex",2);x([l.state()],exports.GlatamCalendarWeekView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarWeekView=x([l.customElement("glatam-calendar-week-view")],exports.GlatamCalendarWeekView);var I=Object.defineProperty,V=Object.getOwnPropertyDescriptor,w=(d,t,e,a)=>{for(var r=a>1?void 0:a?V(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&I(t,e,r),r};exports.GlatamCalendarDayView=class extends s.LitElement{constructor(){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=()=>{if(!this.isDragging||!this.day||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.day.slots.slice(t,e+1);a.some(r=>r.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:this.day.dateString,start:a[0].start,end:a[a.length-1].end},bubbles:!0,composed:!0})),this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e){if(e&&this.day){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.day.dateString,slot:this.day.slots[t],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragStartSlotIndex=t,this.dragEndSlotIndex=t}handleMouseEnter(t,e){this.isDragging&&!e&&(this.dragEndSlotIndex=t)}isSlotSelected(t){return!this.day||!this.selectedRange||this.selectedRange.dateString!==this.day.dateString?!1:t.start>=this.selectedRange.start&&t.end<=this.selectedRange.end}isSlotDragSelecting(t){if(!this.isDragging)return!1;const e=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),a=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return t>=e&&t<=a}render(){if(!this.day)return s.html`<div>Cargando...</div>`;const t=this.day.dateString===new Date().toISOString().split("T")[0],e=new Intl.DateTimeFormat(this.locale,{weekday:"long",day:"numeric",month:"long"}).format(this.day.date);return s.html`
476
476
  <div class="time-col">
477
477
  <div class="header-cell">Hora</div>
478
478
  ${this.slots.map(a=>s.html`<div class="slot-cell time-slot-label">${a.start}</div>`)}
@@ -483,12 +483,12 @@
483
483
  <div style="text-transform: capitalize;">${e}</div>
484
484
  </div>
485
485
 
486
- ${this.day.slots.map((a,r)=>{var c,n;const i=a.isBlocked,o=this.isSlotSelected(a),p=this.isSlotDragSelecting(r);return s.html`
486
+ ${this.day.slots.map((a,r)=>{var p,n;const i=a.isBlocked,o=this.isSlotSelected(a),c=this.isSlotDragSelecting(r);return s.html`
487
487
  <div
488
- class=${k.classMap({"slot-cell":!0,available:!i,blocked:i,selected:o,"drag-selecting":p})}
488
+ class=${$.classMap({"slot-cell":!0,available:!i,blocked:i,selected:o,"drag-selecting":c})}
489
489
  @mousedown=${()=>this.handleMouseDown(r,i)}
490
490
  @mouseenter=${()=>this.handleMouseEnter(r,i)}
491
- title=${i&&((c=a.rule)!=null&&c.description)?a.rule.description:""}
491
+ title=${i&&((p=a.rule)!=null&&p.description)?a.rule.description:""}
492
492
  >
493
493
  ${i?((n=a.rule)==null?void 0:n.description)||"Ocupado":o?"Reservado":""}
494
494
  </div>
@@ -523,8 +523,163 @@
523
523
  }
524
524
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
525
525
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
526
- `;w([l.property({type:Object})],exports.GlatamCalendarDayView.prototype,"day",2);w([l.property({type:Array})],exports.GlatamCalendarDayView.prototype,"slots",2);w([l.property({type:String})],exports.GlatamCalendarDayView.prototype,"locale",2);w([l.property({type:Object})],exports.GlatamCalendarDayView.prototype,"selectedRange",2);w([l.property({type:String})],exports.GlatamCalendarDayView.prototype,"role",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"isDragging",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"dragStartSlotIndex",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarDayView=w([l.customElement("glatam-calendar-day-view")],exports.GlatamCalendarDayView);var V=Object.defineProperty,B=Object.getOwnPropertyDescriptor,f=(d,t,e,a)=>{for(var r=a>1?void 0:a?B(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&V(t,e,r),r};exports.GlatamCalendarModal=class extends s.LitElement{constructor(){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=[]}willUpdate(t){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=[new Date(this.dateString+"T00:00:00").getDay()]))}toggleDay(t){this.selectedDays.indexOf(t)>-1?this.selectedDays=this.selectedDays.filter(a=>a!==t):this.selectedDays=[...this.selectedDays,t]}handleSave(){const t={title:this.description||"Bloqueo",blockAllDay:this.blockAllDay,isRecurring:this.isRecurring,selectedDays:this.selectedDays,dateString:this.dateString,startTime:this.startTime,endTime:this.endTime};this.dispatchEvent(new CustomEvent("save-rule",{detail:t,bubbles:!0,composed:!0}))}handleDelete(){this.existingRule&&this.dispatchEvent(new CustomEvent("delete-rule",{detail:{id:this.existingRule.id},bubbles:!0,composed:!0}))}render(){const t=["D","L","M","M","J","V","S"],e=this.isRange?`${this.dateString} (${this.startTime} - ${this.endTime})`:this.dateString;return s.html`
527
- <div class=${k.classMap({"modal-overlay":!0,open:this.open})}>
526
+ `;w([l.property({type:Object})],exports.GlatamCalendarDayView.prototype,"day",2);w([l.property({type:Array})],exports.GlatamCalendarDayView.prototype,"slots",2);w([l.property({type:String})],exports.GlatamCalendarDayView.prototype,"locale",2);w([l.property({type:Object})],exports.GlatamCalendarDayView.prototype,"selectedRange",2);w([l.property({type:String})],exports.GlatamCalendarDayView.prototype,"role",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"isDragging",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"dragStartSlotIndex",2);w([l.state()],exports.GlatamCalendarDayView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarDayView=w([l.customElement("glatam-calendar-day-view")],exports.GlatamCalendarDayView);const B=s.css`
527
+ dialog {
528
+ background: transparent;
529
+ border: none;
530
+ padding: 0;
531
+ overflow: visible;
532
+ outline: none;
533
+ max-width: 100vw;
534
+ max-height: 100vh;
535
+ }
536
+ dialog::backdrop {
537
+ background: rgba(0, 0, 0, 0.35);
538
+ backdrop-filter: blur(10px);
539
+ -webkit-backdrop-filter: blur(10px);
540
+ }
541
+ .modal-content {
542
+ background: var(--glatam-bg);
543
+ color: var(--glatam-text);
544
+ border-radius: 24px;
545
+ padding: 28px;
546
+ width: 90vw;
547
+ max-width: 400px;
548
+ box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
549
+ border: 1px solid var(--glatam-border);
550
+ display: flex;
551
+ flex-direction: column;
552
+ gap: 18px;
553
+ box-sizing: border-box;
554
+ animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
555
+ }
556
+ @keyframes zoomIn {
557
+ from {
558
+ transform: scale(0.92) translateY(10px);
559
+ opacity: 0;
560
+ }
561
+ to {
562
+ transform: scale(1) translateY(0);
563
+ opacity: 1;
564
+ }
565
+ }
566
+ h3 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
567
+ .form-group { display: flex; flex-direction: column; gap: 6px; }
568
+ label { font-size: 0.8rem; color: var(--glatam-text-secondary); font-weight: 600; }
569
+ input[type="text"] {
570
+ background: var(--glatam-surface);
571
+ border: 1px solid var(--glatam-border);
572
+ border-radius: 10px;
573
+ padding: 10px 14px;
574
+ color: var(--glatam-text);
575
+ font-family: inherit;
576
+ font-size: 0.9rem;
577
+ outline: none;
578
+ transition: border-color var(--glatam-transition-fast);
579
+ }
580
+ input[type="text"]:focus {
581
+ border-color: var(--glatam-primary);
582
+ }
583
+ .switch-row {
584
+ display: flex;
585
+ justify-content: space-between;
586
+ align-items: center;
587
+ padding: 4px 0;
588
+ }
589
+
590
+ /* Apple Switch Style */
591
+ .switch {
592
+ position: relative;
593
+ display: inline-block;
594
+ width: 46px;
595
+ height: 26px;
596
+ }
597
+ .switch input { opacity: 0; width: 0; height: 0; }
598
+ .slider {
599
+ position: absolute;
600
+ cursor: pointer;
601
+ top: 0; left: 0; right: 0; bottom: 0;
602
+ background-color: var(--glatam-border);
603
+ transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
604
+ border-radius: 26px;
605
+ }
606
+ .slider:before {
607
+ position: absolute;
608
+ content: "";
609
+ height: 20px;
610
+ width: 20px;
611
+ left: 3px;
612
+ bottom: 3px;
613
+ background-color: white;
614
+ transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
615
+ border-radius: 50%;
616
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
617
+ }
618
+ input:checked + .slider {
619
+ background-color: var(--glatam-primary);
620
+ }
621
+ input:checked + .slider:before {
622
+ transform: translateX(20px);
623
+ }
624
+
625
+ .days-grid {
626
+ display: grid;
627
+ grid-template-columns: repeat(7, 1fr);
628
+ gap: 6px;
629
+ margin-top: 4px;
630
+ }
631
+ .day-btn {
632
+ width: 36px;
633
+ height: 36px;
634
+ margin: 0 auto;
635
+ border-radius: 50%;
636
+ border: 1px solid var(--glatam-border);
637
+ background: var(--glatam-bg);
638
+ color: var(--glatam-text);
639
+ font-size: 0.8rem;
640
+ font-weight: 600;
641
+ cursor: pointer;
642
+ display: flex;
643
+ align-items: center;
644
+ justify-content: center;
645
+ transition: background-color var(--glatam-transition-fast), color var(--glatam-transition-fast), border-color var(--glatam-transition-fast);
646
+ }
647
+ .day-btn:hover {
648
+ background-color: var(--glatam-surface);
649
+ }
650
+ .day-btn.selected {
651
+ background: var(--glatam-primary);
652
+ color: var(--glatam-text-light);
653
+ border-color: var(--glatam-primary);
654
+ }
655
+ .btn-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }
656
+ .btn {
657
+ padding: 10px 18px;
658
+ border-radius: 20px;
659
+ font-size: 0.875rem;
660
+ font-weight: 600;
661
+ cursor: pointer;
662
+ border: none;
663
+ transition: opacity var(--glatam-transition-fast), transform var(--glatam-transition-fast);
664
+ display: inline-flex;
665
+ align-items: center;
666
+ justify-content: center;
667
+ }
668
+ .btn:active { transform: scale(0.97); }
669
+ .btn-cancel { background: transparent; color: var(--glatam-text); border: 1px solid var(--glatam-border); }
670
+ .btn-cancel:hover { background-color: var(--glatam-surface); }
671
+ .btn-save { background: var(--glatam-primary); color: var(--glatam-text-light); }
672
+ .btn-save:hover { opacity: 0.95; }
673
+ .btn-danger {
674
+ background: rgba(255, 69, 58, 0.12);
675
+ color: #ff453a;
676
+ margin-right: auto;
677
+ }
678
+ .btn-danger:hover {
679
+ background: rgba(255, 69, 58, 0.18);
680
+ }
681
+ `;var j=Object.defineProperty,_=Object.getOwnPropertyDescriptor,f=(d,t,e,a)=>{for(var r=a>1?void 0:a?_(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&j(t,e,r),r};exports.GlatamCalendarModal=class extends s.LitElement{constructor(){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=[]}willUpdate(t){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=[new Date(this.dateString+"T00:00:00").getDay()]))}updated(t){var e;if(t.has("open")){const a=(e=this.shadowRoot)==null?void 0:e.getElementById("booking-dialog");a&&(this.open?a.open||a.showModal():a.open&&a.close())}}handleDialogClose(){this.open&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}toggleDay(t){const e=this.selectedDays.indexOf(t);this.selectedDays=e>-1?this.selectedDays.filter(a=>a!==t):[...this.selectedDays,t]}handleSave(){const t={title:this.description||"Bloqueo",blockAllDay:this.blockAllDay,isRecurring:this.isRecurring,selectedDays:this.selectedDays,dateString:this.dateString,startTime:this.startTime,endTime:this.endTime};this.dispatchEvent(new CustomEvent("save-rule",{detail:t,bubbles:!0,composed:!0}))}handleDelete(){this.existingRule&&this.dispatchEvent(new CustomEvent("delete-rule",{detail:{id:this.existingRule.id},bubbles:!0,composed:!0}))}render(){const t=["D","L","M","M","J","V","S"],e=this.isRange?`${this.dateString} (${this.startTime} - ${this.endTime})`:this.dateString;return s.html`
682
+ <dialog id="booking-dialog" @close=${this.handleDialogClose}>
528
683
  <div class="modal-content">
529
684
  <h3>${this.existingRule?"Gestionar Bloqueo":"Crear Bloqueo"}</h3>
530
685
 
@@ -588,157 +743,8 @@
588
743
  <button class="btn btn-save" @click=${this.handleSave}>Guardar</button>
589
744
  </div>
590
745
  </div>
591
- </div>
592
- `}};exports.GlatamCalendarModal.styles=s.css`
593
- .modal-overlay {
594
- position: fixed;
595
- top: 0; left: 0; right: 0; bottom: 0;
596
- background: rgba(0, 0, 0, 0.35);
597
- backdrop-filter: blur(10px);
598
- display: flex;
599
- align-items: center;
600
- justify-content: center;
601
- z-index: 1000;
602
- opacity: 0; pointer-events: none;
603
- transition: opacity var(--glatam-transition-normal);
604
- }
605
- .modal-overlay.open {
606
- opacity: 1; pointer-events: auto;
607
- }
608
- .modal-content {
609
- background: var(--glatam-bg);
610
- color: var(--glatam-text);
611
- border-radius: 24px;
612
- padding: 28px;
613
- width: 90%;
614
- max-width: 400px;
615
- box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
616
- border: 1px solid var(--glatam-border);
617
- transform: scale(0.92) translateY(10px);
618
- transition: transform var(--glatam-transition-normal), background-color var(--glatam-transition-normal);
619
- display: flex;
620
- flex-direction: column;
621
- gap: 18px;
622
- }
623
- .modal-overlay.open .modal-content {
624
- transform: scale(1) translateY(0);
625
- }
626
- h3 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
627
- .form-group { display: flex; flex-direction: column; gap: 6px; }
628
- label { font-size: 0.8rem; color: var(--glatam-text-secondary); font-weight: 600; }
629
- input[type="text"] {
630
- background: var(--glatam-surface);
631
- border: 1px solid var(--glatam-border);
632
- border-radius: 10px;
633
- padding: 10px 14px;
634
- color: var(--glatam-text);
635
- font-family: inherit;
636
- font-size: 0.9rem;
637
- outline: none;
638
- transition: border-color var(--glatam-transition-fast);
639
- }
640
- input[type="text"]:focus {
641
- border-color: var(--glatam-primary);
642
- }
643
- .switch-row {
644
- display: flex;
645
- justify-content: space-between;
646
- align-items: center;
647
- padding: 4px 0;
648
- }
649
-
650
- /* Apple Switch Style */
651
- .switch {
652
- position: relative;
653
- display: inline-block;
654
- width: 46px;
655
- height: 26px;
656
- }
657
- .switch input { opacity: 0; width: 0; height: 0; }
658
- .slider {
659
- position: absolute;
660
- cursor: pointer;
661
- top: 0; left: 0; right: 0; bottom: 0;
662
- background-color: var(--glatam-border);
663
- transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
664
- border-radius: 26px;
665
- }
666
- .slider:before {
667
- position: absolute;
668
- content: "";
669
- height: 20px;
670
- width: 20px;
671
- left: 3px;
672
- bottom: 3px;
673
- background-color: white;
674
- transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
675
- border-radius: 50%;
676
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
677
- }
678
- input:checked + .slider {
679
- background-color: var(--glatam-primary);
680
- }
681
- input:checked + .slider:before {
682
- transform: translateX(20px);
683
- }
684
-
685
- .days-grid {
686
- display: grid;
687
- grid-template-columns: repeat(7, 1fr);
688
- gap: 6px;
689
- margin-top: 4px;
690
- }
691
- .day-btn {
692
- width: 36px;
693
- height: 36px;
694
- margin: 0 auto;
695
- border-radius: 50%;
696
- border: 1px solid var(--glatam-border);
697
- background: var(--glatam-bg);
698
- color: var(--glatam-text);
699
- font-size: 0.8rem;
700
- font-weight: 600;
701
- cursor: pointer;
702
- display: flex;
703
- align-items: center;
704
- justify-content: center;
705
- transition: background-color var(--glatam-transition-fast), color var(--glatam-transition-fast), border-color var(--glatam-transition-fast);
706
- }
707
- .day-btn:hover {
708
- background-color: var(--glatam-surface);
709
- }
710
- .day-btn.selected {
711
- background: var(--glatam-primary);
712
- color: var(--glatam-text-light);
713
- border-color: var(--glatam-primary);
714
- }
715
- .btn-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }
716
- .btn {
717
- padding: 10px 18px;
718
- border-radius: 20px;
719
- font-size: 0.875rem;
720
- font-weight: 600;
721
- cursor: pointer;
722
- border: none;
723
- transition: opacity var(--glatam-transition-fast), transform var(--glatam-transition-fast);
724
- display: inline-flex;
725
- align-items: center;
726
- justify-content: center;
727
- }
728
- .btn:active { transform: scale(0.97); }
729
- .btn-cancel { background: transparent; color: var(--glatam-text); border: 1px solid var(--glatam-border); }
730
- .btn-cancel:hover { background-color: var(--glatam-surface); }
731
- .btn-save { background: var(--glatam-primary); color: var(--glatam-text-light); }
732
- .btn-save:hover { opacity: 0.95; }
733
- .btn-danger {
734
- background: rgba(255, 69, 58, 0.12);
735
- color: #ff453a;
736
- margin-right: auto;
737
- }
738
- .btn-danger:hover {
739
- background: rgba(255, 69, 58, 0.18);
740
- }
741
- `;f([l.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"open",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"dateString",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"startTime",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"endTime",2);f([l.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"isRange",2);f([l.property({type:Object})],exports.GlatamCalendarModal.prototype,"existingRule",2);f([l.state()],exports.GlatamCalendarModal.prototype,"description",2);f([l.state()],exports.GlatamCalendarModal.prototype,"blockAllDay",2);f([l.state()],exports.GlatamCalendarModal.prototype,"isRecurring",2);f([l.state()],exports.GlatamCalendarModal.prototype,"selectedDays",2);exports.GlatamCalendarModal=f([l.customElement("glatam-calendar-modal")],exports.GlatamCalendarModal);var j=Object.defineProperty,_=Object.getOwnPropertyDescriptor,m=(d,t,e,a)=>{for(var r=a>1?void 0:a?_(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&j(t,e,r),r};const N=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}];exports.GlatamCalendar=class extends s.LitElement{constructor(){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=N,this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.activeDate=new Date,this.localRules=[],this.darkMode=!1,this.modalOpen=!1,this.modalDateString="",this.modalStartTime="",this.modalEndTime="",this.modalIsRange=!1,this.modalExistingRule=null}firstUpdated(){this.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches,this.localRules=[...this.rules]}willUpdate(t){t.has("rules")&&this.rules.length>0&&this.localRules.length===0&&(this.localRules=[...this.rules])}updated(t){t.has("darkMode")&&this.classList.toggle("dark-mode",this.darkMode)}handlePrev(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()-1):this.view==="week"?t.setDate(t.getDate()-7):t.setDate(t.getDate()-1),this.activeDate=t}handleNext(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()+1):this.view==="week"?t.setDate(t.getDate()+7):t.setDate(t.getDate()+1),this.activeDate=t}getHeaderTitle(){const t=this.view==="month"?{month:"long",year:"numeric"}:this.view==="week"?{month:"short",year:"numeric"}:{day:"numeric",month:"long",year:"numeric"};return new Intl.DateTimeFormat(this.locale,t).format(this.activeDate)}handleDaySelect(t){const{dateString:e,isBlocked:a}=t.detail;this.role==="buyer"&&a||(this.activeDate=new Date(e+"T00:00:00"),this.view="day",this.dispatchEvent(new CustomEvent("date-selected",{detail:{dateString:e},bubbles:!0,composed:!0})))}handleRangeSelect(t){var h,b;const{dateString:e,start:a,end:r}=t.detail,i=this.activeTimezone==="local"?D(this.activeDate,this.hostTimezone,"local"):0,o=this.getDisplaySlots(i),p=o.findIndex(S=>S.start===a),c=o.findIndex(S=>S.end===r),n=((h=this.slots[p])==null?void 0:h.start)||a,g=((b=this.slots[c])==null?void 0:b.end)||r;if(this.role==="buyer"){this.selectedRange={dateString:e,start:a,end:r},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:a,end:r,hostStart:n,hostEnd:g},bubbles:!0,composed:!0}));return}this.openModal(e,n,g,!0,null)}handleSlotClick(t){const{dateString:e,slot:a}=t.detail,r=new Date(e+"T00:00:00"),i=this.activeTimezone==="local"?D(this.activeDate,this.hostTimezone,"local"):0,o=this.getDisplaySlots(i),p=o.findIndex(g=>g.start===a.start),c=this.slots[p]||a;if(this.role==="buyer"){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}));return}const n=this.localRules.find(g=>y.isTimeBlocked(r,c,[g]));this.openModal(e,c.start,c.end,!0,n||null)}handleBlockDayAction(){const t=y.formatISODate(this.activeDate),e=this.localRules.find(a=>y.isTimeBlocked(this.activeDate,void 0,[a]));this.openModal(t,"","",!1,e||null)}openModal(t,e,a,r,i){this.modalDateString=t,this.modalStartTime=e,this.modalEndTime=a,this.modalIsRange=r,this.modalExistingRule=i,this.modalOpen=!0}handleSaveRule(t){const e=t.detail,a=this.modalExistingRule?this.modalExistingRule.id:`rule-${Date.now()}`,r={id:a,type:e.isRecurring?"weekly":"date-range",slots:e.blockAllDay?void 0:[{start:e.startTime,end:e.endTime}],daysOfWeek:e.isRecurring?e.selectedDays:void 0,startDate:e.isRecurring?void 0:e.dateString,endDate:e.isRecurring?void 0:e.dateString,description:e.title};this.localRules=this.modalExistingRule?this.localRules.map(i=>i.id===a?r:i):[...this.localRules,r],this.modalOpen=!1,this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:this.localRules},bubbles:!0,composed:!0}))}handleDeleteRule(t){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}))}getDisplaySlots(t){return t===0?this.slots:this.slots.map(e=>{const a=G(e,t),r=a.dayShift>0?" (+1d)":a.dayShift<0?" (-1d)":"";return{start:a.start+r,end:a.end+r}})}render(){var c;const t=this.activeDate.getFullYear(),e=this.activeDate.getMonth(),a=y.isTimeBlocked(this.activeDate,void 0,this.localRules),r=this.activeTimezone==="local"?D(this.activeDate,this.hostTimezone,"local"):0,i=this.getDisplaySlots(r),o=n=>n.map(g=>({...g,slots:g.slots.map((h,b)=>{var S,M;return{...h,start:((S=i[b])==null?void 0:S.start)||h.start,end:((M=i[b])==null?void 0:M.end)||h.end}})})),p=((c=this.hostTimezone.split("/").pop())==null?void 0:c.replace("_"," "))||"Anfitrión";return s.html`
746
+ </dialog>
747
+ `}};exports.GlatamCalendarModal.styles=B;f([l.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"open",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"dateString",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"startTime",2);f([l.property({type:String})],exports.GlatamCalendarModal.prototype,"endTime",2);f([l.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"isRange",2);f([l.property({type:Object})],exports.GlatamCalendarModal.prototype,"existingRule",2);f([l.state()],exports.GlatamCalendarModal.prototype,"description",2);f([l.state()],exports.GlatamCalendarModal.prototype,"blockAllDay",2);f([l.state()],exports.GlatamCalendarModal.prototype,"isRecurring",2);f([l.state()],exports.GlatamCalendarModal.prototype,"selectedDays",2);exports.GlatamCalendarModal=f([l.customElement("glatam-calendar-modal")],exports.GlatamCalendarModal);var N=Object.defineProperty,W=Object.getOwnPropertyDescriptor,h=(d,t,e,a)=>{for(var r=a>1?void 0:a?W(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&N(t,e,r),r};const P=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}];exports.GlatamCalendar=class extends s.LitElement{constructor(){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=P,this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.activeDate=new Date,this.localRules=[],this.darkMode=!1,this.modalOpen=!1,this.modalDateString="",this.modalStartTime="",this.modalEndTime="",this.modalIsRange=!1,this.modalExistingRule=null}firstUpdated(){this.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches,this.localRules=[...this.rules]}willUpdate(t){t.has("rules")&&this.rules.length>0&&this.localRules.length===0&&(this.localRules=[...this.rules])}updated(t){t.has("darkMode")&&this.classList.toggle("dark-mode",this.darkMode)}handlePrev(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()-1):this.view==="week"?t.setDate(t.getDate()-7):t.setDate(t.getDate()-1),this.activeDate=t}handleNext(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()+1):this.view==="week"?t.setDate(t.getDate()+7):t.setDate(t.getDate()+1),this.activeDate=t}getHeaderTitle(){const t=this.view==="month"?{month:"long",year:"numeric"}:this.view==="week"?{month:"short",year:"numeric"}:{day:"numeric",month:"long",year:"numeric"};return new Intl.DateTimeFormat(this.locale,t).format(this.activeDate)}handleDaySelect(t){const{dateString:e,isBlocked:a}=t.detail;this.role==="buyer"&&a||(this.activeDate=new Date(e+"T00:00:00"),this.view="day",this.dispatchEvent(new CustomEvent("date-selected",{detail:{dateString:e},bubbles:!0,composed:!0})))}handleRangeSelect(t){var S,D;const{dateString:e,start:a,end:r}=t.detail,i=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,o=new Date().toISOString().split("T")[0],c=this.minDate||(this.role==="buyer"?o:"");if(this.role==="buyer"&&c&&e<c)return;const p=this.getDisplaySlots(i),n=p.findIndex(C=>C.start===a),g=p.findIndex(C=>C.end===r),m=((S=this.slots[n])==null?void 0:S.start)||a,u=((D=this.slots[g])==null?void 0:D.end)||r;if(this.role==="buyer"){this.selectedRange={dateString:e,start:a,end:r},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:a,end:r,hostStart:m,hostEnd:u},bubbles:!0,composed:!0}));return}this.openModal(e,m,u,!0,null)}handleSlotClick(t){const{dateString:e,slot:a}=t.detail,r=new Date(e+"T00:00:00"),i=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,o=new Date().toISOString().split("T")[0],c=this.minDate||(this.role==="buyer"?o:"");if(this.role==="buyer"&&(a.isBlocked||c&&e<c))return;const p=this.getDisplaySlots(i),n=p.findIndex(u=>u.start===a.start),g=this.slots[n]||a;if(this.role==="buyer"){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:g.start,hostEnd:g.end},bubbles:!0,composed:!0}));return}const m=this.localRules.find(u=>y.isTimeBlocked(r,g,[u]));this.openModal(e,g.start,g.end,!0,m||null)}handleBlockDayAction(){const t=y.formatISODate(this.activeDate),e=this.localRules.find(a=>y.isTimeBlocked(this.activeDate,void 0,[a]));this.openModal(t,"","",!1,e||null)}openModal(t,e,a,r,i){this.modalDateString=t,this.modalStartTime=e,this.modalEndTime=a,this.modalIsRange=r,this.modalExistingRule=i,this.modalOpen=!0}handleSaveRule(t){const e=t.detail,a=this.modalExistingRule?this.modalExistingRule.id:`rule-${Date.now()}`,r={id:a,type:e.isRecurring?"weekly":"date-range",slots:e.blockAllDay?void 0:[{start:e.startTime,end:e.endTime}],daysOfWeek:e.isRecurring?e.selectedDays:void 0,startDate:e.isRecurring?void 0:e.dateString,endDate:e.isRecurring?void 0:e.dateString,description:e.title};this.localRules=this.modalExistingRule?this.localRules.map(i=>i.id===a?r:i):[...this.localRules,r],this.modalOpen=!1,this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:this.localRules},bubbles:!0,composed:!0}))}handleDeleteRule(t){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}))}getDisplaySlots(t){return t===0?this.slots:this.slots.map(e=>{const a=R(e,t),r=a.dayShift>0?" (+1d)":a.dayShift<0?" (-1d)":"";return{start:a.start+r,end:a.end+r}})}render(){var p;const t=this.activeDate.getFullYear(),e=this.activeDate.getMonth(),a=y.isTimeBlocked(this.activeDate,void 0,this.localRules),r=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,i=this.getDisplaySlots(r),o=n=>n.map(g=>({...g,slots:g.slots.map((m,u)=>{var S,D;return{...m,start:((S=i[u])==null?void 0:S.start)||m.start,end:((D=i[u])==null?void 0:D.end)||m.end}})})),c=((p=this.hostTimezone.split("/").pop())==null?void 0:p.replace("_"," "))||"Anfitrión";return s.html`
742
748
  <div class="calendar-header">
743
749
  <div class="nav-group">
744
750
  <button class="btn" @click=${()=>this.activeDate=new Date}>Hoy</button>
@@ -753,7 +759,7 @@
753
759
  🌐 Zona:
754
760
  <select class="timezone-select" @change=${n=>this.activeTimezone=n.target.value}>
755
761
  <option value="local" ?selected=${this.activeTimezone==="local"}>Mi Hora</option>
756
- <option value="host" ?selected=${this.activeTimezone==="host"}>Hora ${p}</option>
762
+ <option value="host" ?selected=${this.activeTimezone==="host"}>Hora ${c}</option>
757
763
  </select>
758
764
  </div>
759
765
  `:""}
@@ -768,7 +774,7 @@
768
774
  </div>
769
775
 
770
776
  <div class="calendar-body">
771
- ${this.view==="month"?s.html`<glatam-calendar-month-view .days=${y.generateMonthDays(t,e,this.localRules,this.slots,this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>`:this.view==="week"?s.html`<glatam-calendar-week-view .days=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay))} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>`:s.html`<glatam-calendar-day-view .day=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay)).find(n=>n.dateString===y.formatISODate(this.activeDate))||null} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
777
+ ${this.view==="month"?s.html`<glatam-calendar-month-view .days=${y.generateMonthDays(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"?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"?s.html`<glatam-calendar-week-view .days=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay))} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>`:s.html`<glatam-calendar-day-view .day=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay)).find(n=>n.dateString===y.formatISODate(this.activeDate))||null} .slots=${i} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
772
778
  </div>
773
779
 
774
780
  <glatam-calendar-modal
@@ -776,7 +782,7 @@
776
782
  .isRange=${this.modalIsRange} .existingRule=${this.modalExistingRule} @save-rule=${this.handleSaveRule}
777
783
  @delete-rule=${this.handleDeleteRule} @close=${()=>this.modalOpen=!1}
778
784
  ></glatam-calendar-modal>
779
- `}};exports.GlatamCalendar.styles=[C,$];m([l.property({type:String})],exports.GlatamCalendar.prototype,"role",2);m([l.property({type:String,reflect:!0})],exports.GlatamCalendar.prototype,"size",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"view",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"locale",2);m([l.property({type:Number})],exports.GlatamCalendar.prototype,"startOfWeekDay",2);m([l.property({type:Array})],exports.GlatamCalendar.prototype,"rules",2);m([l.property({type:Array})],exports.GlatamCalendar.prototype,"selectedDates",2);m([l.property({type:Object})],exports.GlatamCalendar.prototype,"selectedRange",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"hostTimezone",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"activeTimezone",2);m([l.property({type:Array})],exports.GlatamCalendar.prototype,"slots",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"minDate",2);m([l.property({type:String})],exports.GlatamCalendar.prototype,"maxDate",2);m([l.property({type:Boolean})],exports.GlatamCalendar.prototype,"showNeighboringMonth",2);m([l.property({attribute:!1})],exports.GlatamCalendar.prototype,"tileClassName",2);m([l.state()],exports.GlatamCalendar.prototype,"activeDate",2);m([l.state()],exports.GlatamCalendar.prototype,"localRules",2);m([l.state()],exports.GlatamCalendar.prototype,"darkMode",2);m([l.state()],exports.GlatamCalendar.prototype,"modalOpen",2);m([l.state()],exports.GlatamCalendar.prototype,"modalDateString",2);m([l.state()],exports.GlatamCalendar.prototype,"modalStartTime",2);m([l.state()],exports.GlatamCalendar.prototype,"modalEndTime",2);m([l.state()],exports.GlatamCalendar.prototype,"modalIsRange",2);m([l.state()],exports.GlatamCalendar.prototype,"modalExistingRule",2);exports.GlatamCalendar=m([l.customElement("glatam-calendar")],exports.GlatamCalendar);var W=Object.defineProperty,P=Object.getOwnPropertyDescriptor,u=(d,t,e,a)=>{for(var r=a>1?void 0:a?P(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&W(t,e,r),r};exports.GlatamCalendarMini=class extends s.LitElement{constructor(){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=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}],this.activeDate=new Date,this.dropdownOpen=!1,this.dropdownSelectedDateString=""}handleDropdownDaySelect(t){this.dropdownSelectedDateString=t.detail.dateString}selectDropdownSlot(t){const e={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd,hostStart:t.start,hostEnd:t.end};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=""}render(){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(),r=this.dropdownSelectedDateString?new Date(this.dropdownSelectedDateString+"T00:00:00"):null,i=r&&this.activeTimezone==="local"?D(r,this.hostTimezone,"local"):0,o=r?this.slots.map(p=>{const c=y.isTimeBlocked(r,p,this.rules),n=G(p,i),g=n.dayShift>0?" (+1d)":n.dayShift<0?" (-1d)":"";return{...p,displayStart:n.start+g,displayEnd:n.end+g,isBlocked:c}}):[];return s.html`
785
+ `}};exports.GlatamCalendar.styles=[M,G];h([l.property({type:String})],exports.GlatamCalendar.prototype,"role",2);h([l.property({type:String,reflect:!0})],exports.GlatamCalendar.prototype,"size",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"view",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"locale",2);h([l.property({type:Number})],exports.GlatamCalendar.prototype,"startOfWeekDay",2);h([l.property({type:Array})],exports.GlatamCalendar.prototype,"rules",2);h([l.property({type:Array})],exports.GlatamCalendar.prototype,"selectedDates",2);h([l.property({type:Object})],exports.GlatamCalendar.prototype,"selectedRange",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"hostTimezone",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"activeTimezone",2);h([l.property({type:Array})],exports.GlatamCalendar.prototype,"slots",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"minDate",2);h([l.property({type:String})],exports.GlatamCalendar.prototype,"maxDate",2);h([l.property({type:Boolean})],exports.GlatamCalendar.prototype,"showNeighboringMonth",2);h([l.property({attribute:!1})],exports.GlatamCalendar.prototype,"tileClassName",2);h([l.state()],exports.GlatamCalendar.prototype,"activeDate",2);h([l.state()],exports.GlatamCalendar.prototype,"localRules",2);h([l.state()],exports.GlatamCalendar.prototype,"darkMode",2);h([l.state()],exports.GlatamCalendar.prototype,"modalOpen",2);h([l.state()],exports.GlatamCalendar.prototype,"modalDateString",2);h([l.state()],exports.GlatamCalendar.prototype,"modalStartTime",2);h([l.state()],exports.GlatamCalendar.prototype,"modalEndTime",2);h([l.state()],exports.GlatamCalendar.prototype,"modalIsRange",2);h([l.state()],exports.GlatamCalendar.prototype,"modalExistingRule",2);exports.GlatamCalendar=h([l.customElement("glatam-calendar")],exports.GlatamCalendar);var A=Object.defineProperty,L=Object.getOwnPropertyDescriptor,b=(d,t,e,a)=>{for(var r=a>1?void 0:a?L(t,e):t,i=d.length-1,o;i>=0;i--)(o=d[i])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&A(t,e,r),r};exports.GlatamCalendarMini=class extends s.LitElement{constructor(){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=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}],this.activeDate=new Date,this.dropdownOpen=!1,this.dropdownSelectedDateString=""}handleDropdownDaySelect(t){this.dropdownSelectedDateString=t.detail.dateString}selectDropdownSlot(t){const e={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd,hostStart:t.start,hostEnd:t.end};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=""}render(){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(),r=this.dropdownSelectedDateString?new Date(this.dropdownSelectedDateString+"T00:00:00"):null,i=r&&this.activeTimezone==="local"?k(r,this.hostTimezone,"local"):0,o=r?this.slots.map(c=>{const p=y.isTimeBlocked(r,c,this.rules),n=R(c,i),g=n.dayShift>0?" (+1d)":n.dayShift<0?" (-1d)":"";return{...c,displayStart:n.start+g,displayEnd:n.end+g,isBlocked:p}}):[];return s.html`
780
786
  <div class="dropdown-container">
781
787
  <button class="btn btn-primary dropdown-toggle" @click=${()=>this.dropdownOpen=!this.dropdownOpen}>
782
788
  <span>${t}</span> <span>${this.dropdownOpen?"▲":"▼"}</span>
@@ -790,13 +796,13 @@
790
796
  <span style="font-size:0.8rem; font-weight:600; color: var(--glatam-text);">${this.dropdownSelectedDateString}</span>
791
797
  </div>
792
798
  <div class="slot-list">
793
- ${o.map(p=>s.html`
799
+ ${o.map(c=>s.html`
794
800
  <button
795
- class="slot-btn ${p.isBlocked?"blocked":""}"
796
- ?disabled=${p.isBlocked}
797
- @click=${()=>this.selectDropdownSlot(p)}
801
+ class="slot-btn ${c.isBlocked?"blocked":""}"
802
+ ?disabled=${c.isBlocked}
803
+ @click=${()=>this.selectDropdownSlot(c)}
798
804
  >
799
- ${p.displayStart} - ${p.displayEnd} ${p.isBlocked?"(Ocupado)":""}
805
+ ${c.displayStart} - ${c.displayEnd} ${c.isBlocked?"(Ocupado)":""}
800
806
  </button>
801
807
  `)}
802
808
  </div>
@@ -818,7 +824,7 @@
818
824
  </div>
819
825
  `:""}
820
826
  </div>
821
- `}};exports.GlatamCalendarMini.styles=[C,$,s.css`
827
+ `}};exports.GlatamCalendarMini.styles=[M,G,s.css`
822
828
  :host {
823
829
  display: inline-block;
824
830
  background: transparent;
@@ -827,4 +833,4 @@
827
833
  box-shadow: none;
828
834
  width: 100%;
829
835
  }
830
- `];u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"role",2);u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"locale",2);u([l.property({type:Number})],exports.GlatamCalendarMini.prototype,"startOfWeekDay",2);u([l.property({type:Array})],exports.GlatamCalendarMini.prototype,"rules",2);u([l.property({type:Object})],exports.GlatamCalendarMini.prototype,"selectedRange",2);u([l.property({type:String,reflect:!0})],exports.GlatamCalendarMini.prototype,"size",2);u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"hostTimezone",2);u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"activeTimezone",2);u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"minDate",2);u([l.property({type:String})],exports.GlatamCalendarMini.prototype,"maxDate",2);u([l.property({type:Boolean})],exports.GlatamCalendarMini.prototype,"showNeighboringMonth",2);u([l.property({attribute:!1})],exports.GlatamCalendarMini.prototype,"tileClassName",2);u([l.property({type:Array})],exports.GlatamCalendarMini.prototype,"slots",2);u([l.state()],exports.GlatamCalendarMini.prototype,"activeDate",2);u([l.state()],exports.GlatamCalendarMini.prototype,"dropdownOpen",2);u([l.state()],exports.GlatamCalendarMini.prototype,"dropdownSelectedDateString",2);exports.GlatamCalendarMini=u([l.customElement("glatam-calendar-mini")],exports.GlatamCalendarMini);Object.defineProperty(exports,"formatISODate",{enumerable:!0,get:()=>y.formatISODate});Object.defineProperty(exports,"isTimeBlocked",{enumerable:!0,get:()=>y.isTimeBlocked});Object.defineProperty(exports,"parseISODate",{enumerable:!0,get:()=>y.parseISODate});exports.calendarStyles=$;exports.variablesStyles=C;
836
+ `];b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"role",2);b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"locale",2);b([l.property({type:Number})],exports.GlatamCalendarMini.prototype,"startOfWeekDay",2);b([l.property({type:Array})],exports.GlatamCalendarMini.prototype,"rules",2);b([l.property({type:Object})],exports.GlatamCalendarMini.prototype,"selectedRange",2);b([l.property({type:String,reflect:!0})],exports.GlatamCalendarMini.prototype,"size",2);b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"hostTimezone",2);b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"activeTimezone",2);b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"minDate",2);b([l.property({type:String})],exports.GlatamCalendarMini.prototype,"maxDate",2);b([l.property({type:Boolean})],exports.GlatamCalendarMini.prototype,"showNeighboringMonth",2);b([l.property({attribute:!1})],exports.GlatamCalendarMini.prototype,"tileClassName",2);b([l.property({type:Array})],exports.GlatamCalendarMini.prototype,"slots",2);b([l.state()],exports.GlatamCalendarMini.prototype,"activeDate",2);b([l.state()],exports.GlatamCalendarMini.prototype,"dropdownOpen",2);b([l.state()],exports.GlatamCalendarMini.prototype,"dropdownSelectedDateString",2);exports.GlatamCalendarMini=b([l.customElement("glatam-calendar-mini")],exports.GlatamCalendarMini);Object.defineProperty(exports,"formatISODate",{enumerable:!0,get:()=>y.formatISODate});Object.defineProperty(exports,"isTimeBlocked",{enumerable:!0,get:()=>y.isTimeBlocked});Object.defineProperty(exports,"parseISODate",{enumerable:!0,get:()=>y.parseISODate});exports.calendarStyles=G;exports.variablesStyles=M;
@@ -1 +1 @@
1
- {"version":3,"file":"glatam-calendar.d.ts","sourceRoot":"","sources":["../src/glatam-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAqE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKlI,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AAUxC,qBACa,cAAe,SAAQ,UAAU;IAC5C,MAAM,CAAC,MAAM,4BAAqC;IAEtB,IAAI,SAAc;IACH,IAAI,SAAY;IAC/B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAW;IACzC,MAAM,SAAQ;IACd,cAAc,SAAK;IACpB,KAAK,EAAE,YAAY,EAAE,CAAM;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAM;IAC5B,aAAa,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAQ;IAChF,YAAY,SAAoB;IAA6B,cAAc,SAAW;IACvF,KAAK,EAAE,QAAQ,EAAE,CAAiB;IACjC,OAAO,SAAM;IAA6B,OAAO,SAAM;IACtD,oBAAoB,UAAQ;IACzB,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,GAAG,IAAI,CAAQ;IAE3G,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,iBAAiB,CAA6B;IAE/D,YAAY;IACZ,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IACzC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAEtC,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,MAAM;CAoDP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAAG,iBAAiB,EAAE,cAAc,CAAC;KAAE;CACvE"}
1
+ {"version":3,"file":"glatam-calendar.d.ts","sourceRoot":"","sources":["../src/glatam-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAqE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKlI,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,gCAAgC,CAAC;AAUxC,qBACa,cAAe,SAAQ,UAAU;IAC5C,MAAM,CAAC,MAAM,4BAAqC;IAEtB,IAAI,SAAc;IAA4C,IAAI,SAAY;IAC9E,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAW;IAA6B,MAAM,SAAQ;IACpF,cAAc,SAAK;IAA4B,KAAK,EAAE,YAAY,EAAE,CAAM;IAC3E,aAAa,EAAE,MAAM,EAAE,CAAM;IAA6B,aAAa,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAQ;IACzI,YAAY,SAAoB;IAA6B,cAAc,SAAW;IACvF,KAAK,EAAE,QAAQ,EAAE,CAAiB;IAA6B,OAAO,SAAM;IAA6B,OAAO,SAAM;IACpH,oBAAoB,UAAQ;IAAiC,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,GAAG,IAAI,CAAQ;IAErK,OAAO,CAAC,UAAU,CAAc;IAAU,OAAO,CAAC,UAAU,CAAsB;IAClF,OAAO,CAAC,QAAQ,CAAS;IAAU,OAAO,CAAC,SAAS,CAAS;IAC7D,OAAO,CAAC,eAAe,CAAM;IAAU,OAAO,CAAC,cAAc,CAAM;IAAU,OAAO,CAAC,YAAY,CAAM;IACvG,OAAO,CAAC,YAAY,CAAS;IAAU,OAAO,CAAC,iBAAiB,CAA6B;IAEtG,YAAY;IACZ,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IACzC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAEtC,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,MAAM;CAoDP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAAG,iBAAiB,EAAE,cAAc,CAAC;KAAE;CACvE"}