calkit 0.1.0 → 0.2.0

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,4 +1,4 @@
1
- (function(fe,be){typeof exports=="object"&&typeof module<"u"?be(exports):typeof define=="function"&&define.amd?define(["exports"],be):(fe=typeof globalThis<"u"?globalThis:fe||self,be(fe.CalKit={}))})(this,(function(fe){"use strict";class be extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this._initialized=!1}static get styles(){return[]}connectedCallback(){this._initialized||(this._adoptStyles(),this._initialized=!0),this.render()}_adoptStyles(){const e=this.constructor.styles;if(e.length)if("adoptedStyleSheets"in this.shadowRoot)this.shadowRoot.adoptedStyleSheets=e.map(a=>{if(a instanceof CSSStyleSheet)return a;const t=new CSSStyleSheet;return t.replaceSync(a),t});else for(const a of e){const t=document.createElement("style");t.textContent=a instanceof CSSStyleSheet?"":a,this.shadowRoot.prepend(t)}}render(){}emit(e,a={}){this.dispatchEvent(new CustomEvent(e,{detail:a,bubbles:!0,composed:!0}))}showStatus(e,a,t={}){if(!this._store)return;const{autoDismiss:s,dismissible:i=!0}=t;clearTimeout(this._statusTimer),this._store.set({statusType:e,statusMessage:a,statusDismissible:i}),this.emit("cal:status",{type:e,message:a}),s&&s>0&&(this._statusTimer=setTimeout(()=>this.clearStatus(),s))}clearStatus(){this._store&&(clearTimeout(this._statusTimer),this._store.set({statusType:null,statusMessage:null,statusDismissible:!0}),this.emit("cal:status",{type:null,message:null}))}$(e){return this.shadowRoot.querySelector(e)}$$(e){return this.shadowRoot.querySelectorAll(e)}}function De(n){let e={...n};const a=new Set;return{get(t){return e[t]},set(t){const s=e;e={...e,...t};let i=!1;for(const l of Object.keys(t))if(s[l]!==e[l]){i=!0;break}if(i)for(const l of a)l(e,s)},getState(){return e},subscribe(t){return a.add(t),()=>a.delete(t)}}}const se=["January","February","March","April","May","June","July","August","September","October","November","December"],kt=["Su","Mo","Tu","We","Th","Fr","Sa"],wt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Et=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function We(n,e="short"){const a=W(n);return a?e==="long"?wt[a.getDay()]:Et[a.getDay()]:""}function Xe(n=0){const e=[];for(let a=0;a<7;a++)e.push(kt[(n+a)%7]);return e}function Ge(n,e){return new Date(n,e+1,0).getDate()}function Lt(n,e){return new Date(n,e,1).getDay()}function Z(n){if(typeof n=="string")return n;const e=n instanceof Date?n:new Date(n.year,n.month,n.day),a=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${a}-${t}-${s}`}function W(n){if(!n)return null;if(n instanceof Date)return n;if(typeof n=="string"){const[e,a,t]=n.split("-").map(Number);return!e||!a||!t?null:new Date(e,a-1,t)}return null}function re(n,e){if(!n||!e)return!1;const a=W(n),t=W(e);return!a||!t?!1:a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}function Ct(n,e,a){if(!n||!e||!a)return!1;const t=W(n),s=W(e),i=W(a);if(!t||!s||!i)return!1;const l=t.getTime(),r=Math.min(s.getTime(),i.getTime()),o=Math.max(s.getTime(),i.getTime());return l>=r&&l<=o}function ue(){return Z(new Date)}function pe(n,e,a){const t=new Date(n,e+a,1);return{year:t.getFullYear(),month:t.getMonth()}}function ye(n,e){const a=W(n);return a?(a.setDate(a.getDate()+e),Z(a)):n}function Ke(n,e,a=0){const t=Ge(n,e),i=(Lt(n,e)-a+7)%7,l=[],r=ue(),o=pe(n,e,-1),h=Ge(o.year,o.month);for(let g=i-1;g>=0;g--){const u=h-g,p=Z({year:o.year,month:o.month,day:u});l.push({year:o.year,month:o.month,day:u,dateString:p,isCurrentMonth:!1,isToday:p===r})}for(let g=1;g<=t;g++){const u=Z({year:n,month:e,day:g});l.push({year:n,month:e,day:g,dateString:u,isCurrentMonth:!0,isToday:u===r})}const c=pe(n,e,1);let d=1;for(;l.length<42;){const g=Z({year:c.year,month:c.month,day:d});l.push({year:c.year,month:c.month,day:d,dateString:g,isCurrentMonth:!1,isToday:g===r}),d++}return l}const Se=`
1
+ (function(fe,ve){typeof exports=="object"&&typeof module<"u"?ve(exports):typeof define=="function"&&define.amd?define(["exports"],ve):(fe=typeof globalThis<"u"?globalThis:fe||self,ve(fe.CalKit={}))})(this,(function(fe){"use strict";class ve extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this._initialized=!1}static get styles(){return[]}connectedCallback(){this._initialized||(this._adoptStyles(),this._initialized=!0),this.render()}_adoptStyles(){const e=this.constructor.styles;if(e.length)if("adoptedStyleSheets"in this.shadowRoot)this.shadowRoot.adoptedStyleSheets=e.map(a=>{if(a instanceof CSSStyleSheet)return a;const t=new CSSStyleSheet;return t.replaceSync(a),t});else for(const a of e){const t=document.createElement("style");t.textContent=a instanceof CSSStyleSheet?"":a,this.shadowRoot.prepend(t)}}render(){}clear(){}emit(e,a={}){this.dispatchEvent(new CustomEvent(e,{detail:a,bubbles:!0,composed:!0}))}showStatus(e,a,t={}){if(!this._store)return;const{autoDismiss:s,dismissible:i=!0}=t;clearTimeout(this._statusTimer),this._store.set({statusType:e,statusMessage:a,statusDismissible:i}),this.emit("cal:status",{type:e,message:a}),s&&s>0&&(this._statusTimer=setTimeout(()=>this.clearStatus(),s))}clearStatus(){this._store&&(clearTimeout(this._statusTimer),this._store.set({statusType:null,statusMessage:null,statusDismissible:!0}),this.emit("cal:status",{type:null,message:null}))}$(e){return this.shadowRoot.querySelector(e)}$$(e){return this.shadowRoot.querySelectorAll(e)}}function De(n){let e={...n};const a=new Set;return{get(t){return e[t]},set(t){const s=e;e={...e,...t};let i=!1;for(const l of Object.keys(t))if(s[l]!==e[l]){i=!0;break}if(i)for(const l of a)l(e,s)},getState(){return e},subscribe(t){return a.add(t),()=>a.delete(t)}}}const Te=["January","February","March","April","May","June","July","August","September","October","November","December"],Tt=["Su","Mo","Tu","We","Th","Fr","Sa"],St=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Mt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ke(n){if(!n)return Te;try{const e=new Intl.DateTimeFormat(n,{month:"long"});return Array.from({length:12},(a,t)=>{const s=e.format(new Date(2024,t,1));return s.charAt(0).toUpperCase()+s.slice(1)})}catch{return Te}}function Be(n){if(!n)return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];try{const e=new Intl.DateTimeFormat(n,{month:"short"});return Array.from({length:12},(a,t)=>{const s=e.format(new Date(2024,t,1));return s.charAt(0).toUpperCase()+s.slice(1)})}catch{return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}}function Ue(n,e="short",a){const t=K(n);return t?e==="long"?St[t.getDay()]:Mt[t.getDay()]:""}function Je(n=0,e){if(e)try{const t=new Intl.DateTimeFormat(e,{weekday:"short"}),s=[];for(let i=0;i<7;i++){const l=new Date(2024,0,7+(n+i)%7),r=t.format(l);s.push(r.charAt(0).toUpperCase()+r.slice(1))}return s}catch{}const a=[];for(let t=0;t<7;t++)a.push(Tt[(n+t)%7]);return a}function Ve(n,e){return new Date(n,e+1,0).getDate()}function At(n,e){return new Date(n,e,1).getDay()}function Z(n){if(typeof n=="string")return n;const e=n instanceof Date?n:new Date(n.year,n.month,n.day),a=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${a}-${t}-${s}`}function K(n){if(!n)return null;if(n instanceof Date)return n;if(typeof n=="string"){const[e,a,t]=n.split("-").map(Number);return!e||!a||!t?null:new Date(e,a-1,t)}return null}function re(n,e){if(!n||!e)return!1;const a=K(n),t=K(e);return!a||!t?!1:a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}function $t(n,e,a){if(!n||!e||!a)return!1;const t=K(n),s=K(e),i=K(a);if(!t||!s||!i)return!1;const l=t.getTime(),r=Math.min(s.getTime(),i.getTime()),o=Math.max(s.getTime(),i.getTime());return l>=r&&l<=o}function ue(){return Z(new Date)}function pe(n,e,a){const t=new Date(n,e+a,1);return{year:t.getFullYear(),month:t.getMonth()}}function ye(n,e){const a=K(n);return a?(a.setDate(a.getDate()+e),Z(a)):n}function Ze(n,e,a=0){const t=Ve(n,e),i=(At(n,e)-a+7)%7,l=[],r=ue(),o=pe(n,e,-1),h=Ve(o.year,o.month);for(let p=i-1;p>=0;p--){const u=h-p,g=Z({year:o.year,month:o.month,day:u});l.push({year:o.year,month:o.month,day:u,dateString:g,isCurrentMonth:!1,isToday:g===r})}for(let p=1;p<=t;p++){const u=Z({year:n,month:e,day:p});l.push({year:n,month:e,day:p,dateString:u,isCurrentMonth:!0,isToday:u===r})}const c=pe(n,e,1);let d=1;for(;l.length<42;){const p=Z({year:c.year,month:c.month,day:d});l.push({year:c.year,month:c.month,day:d,dateString:p,isCurrentMonth:!1,isToday:p===r}),d++}return l}const Se=`
2
2
  :host {
3
3
  /* Light theme (default) */
4
4
  --cal-bg: 0 0% 100%;
@@ -166,7 +166,7 @@
166
166
  --cal-status-success-border: 152 40% 28%;
167
167
  }
168
168
  }
169
- `,Te=`
169
+ `,Me=`
170
170
  :host {
171
171
  display: inline-block;
172
172
  font-family: inherit;
@@ -207,7 +207,7 @@
207
207
  [hidden] {
208
208
  display: none !important;
209
209
  }
210
- `,Me=`
210
+ `,Ae=`
211
211
  @keyframes cal-fade-in {
212
212
  from { opacity: 0; }
213
213
  to { opacity: 1; }
@@ -271,7 +271,7 @@
271
271
  .cal-skeleton--rect {
272
272
  border-radius: var(--cal-radius-sm);
273
273
  }
274
- `,Ue={blue:{bg:"var(--cal-booking-blue-bg)",fg:"var(--cal-booking-blue-fg)",hover:"var(--cal-booking-blue-hover)"},green:{bg:"var(--cal-booking-green-bg)",fg:"var(--cal-booking-green-fg)",hover:"var(--cal-booking-green-hover)"},red:{bg:"var(--cal-booking-red-bg)",fg:"var(--cal-booking-red-fg)",hover:"var(--cal-booking-red-hover)"},orange:{bg:"var(--cal-booking-orange-bg)",fg:"var(--cal-booking-orange-fg)",hover:"var(--cal-booking-orange-hover)"},gray:{bg:"var(--cal-booking-gray-bg)",fg:"var(--cal-booking-gray-fg)",hover:"var(--cal-booking-gray-hover)"}},xe="blue";function we(n){return Ue[n]||Ue[xe]}function Dt(n,e=[],a={},t=null){const s=e.find(p=>p.end===n),i=e.find(p=>p.start===n),l=e.find(p=>p.start<n&&p.end>n);let r="available",o=null,h=!1,c=null,d=null,g=null;s&&i?(r="half-day",h=!0,c=we(s.color||xe),d=we(i.color||xe)):l?(r="booked",g=we(l.color||xe)):i&&!s?(r="checkin-only",d=we(i.color||xe)):s&&!i&&(r="checkout-only",c=we(s.color||xe));const u=a[n];if(u&&(u.status&&(r=u.status),u.label!==void 0&&(o=u.label)),t){const p=t(n);p&&(p.status&&(r=p.status),p.label!==void 0&&(o=p.label))}return{status:r,label:o,checkoutBooking:s,checkinBooking:i,halfDay:h,colorOut:c,colorIn:d,colorFull:g}}function Ve(n,e,a=[]){if(!n||!e)return!0;const t=n<e?n:e,s=n<e?e:n;for(const i of a)if(t<i.end&&s>i.start)return!1;return!0}function St(n,e,a=[]){return!n||!e?!1:!Ve(n,e,a)}function Je(n){const{year:e,month:a,firstDay:t=0,selectedDates:s=[],rangeStart:i,rangeEnd:l,hoverDate:r,minDate:o,maxDate:h,disabledDates:c=[],mode:d="single",focusedDate:g,onSelect:u,onHover:p,bookings:_=null,dayData:m=null,labelFormula:v=null,showLabelsOnHover:C=!1}=n,k=_!==null,S=document.createElement("div");S.setAttribute("role","grid"),S.classList.add("cal-grid");const B=document.createElement("div");B.setAttribute("role","row"),B.classList.add("cal-weekdays");for(const M of Xe(t)){const x=document.createElement("div");x.setAttribute("role","columnheader"),x.setAttribute("aria-label",M),x.classList.add("cal-weekday"),x.textContent=M,B.appendChild(x)}S.appendChild(B);const V=Ke(e,a,t),O=d==="range"&&i&&!l&&r||k&&i&&!l&&r?r:l,N=k?St(i,r,_):!1;let I;return V.forEach((M,x)=>{x%7===0&&(I=document.createElement("div"),I.setAttribute("role","row"),I.classList.add("cal-row"),S.appendChild(I));const f=document.createElement("button");f.setAttribute("role","gridcell"),f.setAttribute("part","day"),f.classList.add("cal-day");const F=M.dateString;f.dataset.date=F;const R=new Date(M.year,M.month,M.day);f.setAttribute("aria-label",R.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})),M.isCurrentMonth||f.classList.add("cal-day--outside"),M.isToday&&f.classList.add("cal-day--today");let L=null,y=!1;if(k){L=Dt(F,_,m||{},v);const{status:E,label:Y,halfDay:X,colorOut:$,colorIn:T,colorFull:z}=L;if(E==="booked"&&(f.classList.add("cal-day--booked"),z&&(f.style.setProperty("--booking-bg",`hsl(${z.bg})`),f.style.setProperty("--booking-fg",`hsl(${z.fg})`),f.style.setProperty("--booking-hover",`hsl(${z.hover})`)),y=!0),E==="blocked"&&(f.classList.add("cal-day--blocked"),y=!0),X&&(f.classList.add("cal-day--half-day"),$&&f.style.setProperty("--half-day-color-out",`hsl(${$.bg})`),T&&f.style.setProperty("--half-day-color-in",`hsl(${T.bg})`),y=!0),E==="checkout-only"&&(f.classList.add("cal-day--checkout-only"),$&&f.style.setProperty("--half-day-color-out",`hsl(${$.bg})`)),E==="checkin-only"&&(f.classList.add("cal-day--checkin-only"),T&&f.style.setProperty("--half-day-color-in",`hsl(${T.bg})`)),C){let q=null;if(X&&L.checkoutBooking&&L.checkinBooking)q=`${L.checkoutBooking.label||""} / ${L.checkinBooking.label||""}`;else if(E==="booked"){const Q=_.find(ke=>ke.start<=F&&ke.end>F);Q&&(q=Q.label)}else E==="checkout-only"&&L.checkoutBooking?q=L.checkoutBooking.label:E==="checkin-only"&&L.checkinBooking&&(q=L.checkinBooking.label);q&&f.setAttribute("data-booking-label",q)}if(N&&i&&!l&&r){const q=i<r?i:r,Q=i<r?r:i;F>=q&&F<=Q&&f.classList.add("cal-day--invalid-range")}}if(k?i&&l&&(re(F,i)||re(F,l))?(f.classList.add("cal-day--selected"),f.setAttribute("aria-selected","true")):f.setAttribute("aria-selected","false"):s.some(Y=>re(Y,F))?(f.classList.add("cal-day--selected"),f.setAttribute("aria-selected","true")):f.setAttribute("aria-selected","false"),(d==="range"||k)&&i&&O){const E=re(F,i),Y=re(F,O),X=Ct(F,i,O);E&&f.classList.add("cal-day--range-start"),Y&&f.classList.add("cal-day--range-end"),X&&!E&&!Y&&f.classList.add("cal-day--in-range")}const K=Tt(F,o,h,c)||y;if(K&&(f.classList.add("cal-day--disabled"),f.disabled=!0,f.setAttribute("aria-disabled","true")),g&&re(F,g)?f.setAttribute("tabindex","0"):f.setAttribute("tabindex","-1"),k&&L&&L.label!=null){f.classList.add("cal-day--with-label");const E=document.createElement("span");E.classList.add("cal-day__number"),E.textContent=M.day,f.appendChild(E);const Y=document.createElement("span");Y.classList.add("cal-day__label"),Y.textContent=L.label,f.appendChild(Y)}else f.textContent=M.day;K?k&&f.addEventListener("mouseenter",()=>p==null?void 0:p(F)):(f.addEventListener("click",()=>u==null?void 0:u(F)),f.addEventListener("mouseenter",()=>p==null?void 0:p(F))),I.appendChild(f)}),S.addEventListener("mouseleave",()=>p==null?void 0:p(null)),S}function Tt(n,e,a,t){return!!(t.includes(n)||e&&n<e||a&&n>a)}const Ze=`
274
+ `,Qe={blue:{bg:"var(--cal-booking-blue-bg)",fg:"var(--cal-booking-blue-fg)",hover:"var(--cal-booking-blue-hover)"},green:{bg:"var(--cal-booking-green-bg)",fg:"var(--cal-booking-green-fg)",hover:"var(--cal-booking-green-hover)"},red:{bg:"var(--cal-booking-red-bg)",fg:"var(--cal-booking-red-fg)",hover:"var(--cal-booking-red-hover)"},orange:{bg:"var(--cal-booking-orange-bg)",fg:"var(--cal-booking-orange-fg)",hover:"var(--cal-booking-orange-hover)"},gray:{bg:"var(--cal-booking-gray-bg)",fg:"var(--cal-booking-gray-fg)",hover:"var(--cal-booking-gray-hover)"}},xe="blue";function we(n,e){return e&&e[n]?e[n]:Qe[n]||Qe[xe]}function et(n){if(!Array.isArray(n)||!n.length)return null;const e={};for(const a of n)!a.name||!a.bg||!a.fg||(e[a.name]={bg:a.bg,fg:a.fg,hover:a.hover||a.bg});return Object.keys(e).length?e:null}function zt(n,e=[],a={},t=null,s=null){const i=e.find(f=>f.end===n),l=e.find(f=>f.start===n),r=e.find(f=>f.start<n&&f.end>n);let o="available",h=null,c=!1,d=null,p=null,u=null;i&&l?(o="half-day",c=!0,d=we(i.color||xe,s),p=we(l.color||xe,s)):r?(o="booked",u=we(r.color||xe,s)):l&&!i?(o="checkin-only",p=we(l.color||xe,s)):i&&!l&&(o="checkout-only",d=we(i.color||xe,s));const g=a[n];if(g&&(g.status&&(o=g.status),g.label!==void 0&&(h=g.label)),t){const f=t(n);f&&(f.status&&(o=f.status),f.label!==void 0&&(h=f.label))}return{status:o,label:h,checkoutBooking:i,checkinBooking:l,halfDay:c,colorOut:d,colorIn:p,colorFull:u}}function tt(n,e,a=[]){if(!n||!e)return!0;const t=n<e?n:e,s=n<e?e:n;for(const i of a)if(t<i.end&&s>i.start)return!1;return!0}function It(n,e,a=[]){return!n||!e?!1:!tt(n,e,a)}function at(n){const{year:e,month:a,firstDay:t=0,selectedDates:s=[],rangeStart:i,rangeEnd:l,hoverDate:r,minDate:o,maxDate:h,disabledDates:c=[],mode:d="single",focusedDate:p,onSelect:u,onHover:g,bookings:f=null,dayData:m=null,labelFormula:b=null,showLabelsOnHover:y=!1,locale:w,customColors:A=null}=n,I=f!==null,q=document.createElement("div");q.setAttribute("role","grid"),q.classList.add("cal-grid");const B=document.createElement("div");B.setAttribute("role","row"),B.classList.add("cal-weekdays");for(const L of Je(t,w)){const W=document.createElement("div");W.setAttribute("role","columnheader"),W.setAttribute("aria-label",L),W.classList.add("cal-weekday"),W.textContent=L,B.appendChild(W)}q.appendChild(B);const R=Ze(e,a,t),H=d==="range"&&i&&!l&&r||I&&i&&!l&&r?r:l,F=I?It(i,r,f):!1;let k;return R.forEach((L,W)=>{W%7===0&&(k=document.createElement("div"),k.setAttribute("role","row"),k.classList.add("cal-row"),q.appendChild(k));const v=document.createElement("button");v.setAttribute("role","gridcell"),v.setAttribute("part","day"),v.classList.add("cal-day");const C=L.dateString;v.dataset.date=C;const x=new Date(L.year,L.month,L.day);v.setAttribute("aria-label",x.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})),L.isCurrentMonth||v.classList.add("cal-day--outside"),L.isToday&&v.classList.add("cal-day--today");let T=null,X=!1;if(I){T=zt(C,f,m||{},b,A);const{status:O,label:S,halfDay:M,colorOut:z,colorIn:G,colorFull:Q}=T;if(O==="booked"&&(v.classList.add("cal-day--booked"),Q&&(v.style.setProperty("--booking-bg",`hsl(${Q.bg})`),v.style.setProperty("--booking-fg",`hsl(${Q.fg})`),v.style.setProperty("--booking-hover",`hsl(${Q.hover})`)),X=!0),O==="blocked"&&(v.classList.add("cal-day--blocked"),X=!0),M&&(v.classList.add("cal-day--half-day"),z&&v.style.setProperty("--half-day-color-out",`hsl(${z.bg})`),G&&v.style.setProperty("--half-day-color-in",`hsl(${G.bg})`),X=!0),O==="checkout-only"&&(v.classList.add("cal-day--checkout-only"),z&&v.style.setProperty("--half-day-color-out",`hsl(${z.bg})`)),O==="checkin-only"&&(v.classList.add("cal-day--checkin-only"),G&&v.style.setProperty("--half-day-color-in",`hsl(${G.bg})`)),y){let le=null;if(M&&T.checkoutBooking&&T.checkinBooking)le=`${T.checkoutBooking.label||""} / ${T.checkinBooking.label||""}`;else if(O==="booked"){const ke=f.find(E=>E.start<=C&&E.end>C);ke&&(le=ke.label)}else O==="checkout-only"&&T.checkoutBooking?le=T.checkoutBooking.label:O==="checkin-only"&&T.checkinBooking&&(le=T.checkinBooking.label);le&&v.setAttribute("data-booking-label",le)}if(F&&i&&!l&&r){const le=i<r?i:r,ke=i<r?r:i;C>=le&&C<=ke&&v.classList.add("cal-day--invalid-range")}}if(I?i&&l&&(re(C,i)||re(C,l))?(v.classList.add("cal-day--selected"),v.setAttribute("aria-selected","true")):v.setAttribute("aria-selected","false"):s.some(S=>re(S,C))?(v.classList.add("cal-day--selected"),v.setAttribute("aria-selected","true")):v.setAttribute("aria-selected","false"),(d==="range"||I)&&i&&H){const O=re(C,i),S=re(C,H),M=$t(C,i,H);O&&v.classList.add("cal-day--range-start"),S&&v.classList.add("cal-day--range-end"),M&&!O&&!S&&v.classList.add("cal-day--in-range")}const j=Yt(C,o,h,c)||X;if(j&&(v.classList.add("cal-day--disabled"),v.disabled=!0,v.setAttribute("aria-disabled","true")),p&&re(C,p)?v.setAttribute("tabindex","0"):v.setAttribute("tabindex","-1"),I&&T&&T.label!=null){v.classList.add("cal-day--with-label");const O=document.createElement("span");O.classList.add("cal-day__number"),O.textContent=L.day,v.appendChild(O);const S=document.createElement("span");S.classList.add("cal-day__label"),S.textContent=T.label,v.appendChild(S)}else v.textContent=L.day;j?I&&v.addEventListener("mouseenter",()=>g==null?void 0:g(C)):(v.addEventListener("click",()=>u==null?void 0:u(C)),v.addEventListener("mouseenter",()=>g==null?void 0:g(C))),k.appendChild(v)}),q.addEventListener("mouseleave",()=>g==null?void 0:g(null)),q}function Yt(n,e,a,t){return!!(t.includes(n)||e&&n<e||a&&n>a)}const st=`
275
275
  .cal-grid {
276
276
  display: flex;
277
277
  flex-direction: column;
@@ -529,7 +529,7 @@
529
529
  pointer-events: none;
530
530
  z-index: 10;
531
531
  }
532
- `,Pe='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>',He='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';function Ae({year:n,month:e,onPrev:a,onNext:t,onTitleClick:s}){const i=document.createElement("div");i.classList.add("cal-nav");const l=document.createElement("button");l.classList.add("cal-nav__btn","cal-nav__btn--prev"),l.innerHTML=Pe,l.setAttribute("aria-label","Previous month"),l.addEventListener("click",a);const r=s?"button":"div",o=document.createElement(r);o.classList.add("cal-nav__title"),s&&(o.classList.add("cal-nav__title--interactive"),o.setAttribute("aria-label",`Select month and year, currently ${se[e]} ${n}`),o.addEventListener("click",s)),o.setAttribute("aria-live","polite"),o.textContent=`${se[e]} ${n}`;const h=document.createElement("button");return h.classList.add("cal-nav__btn","cal-nav__btn--next"),h.innerHTML=He,h.setAttribute("aria-label","Next month"),h.addEventListener("click",t),i.appendChild(l),i.appendChild(o),i.appendChild(h),i}const Qe=`
532
+ `,Oe='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>',Fe='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';function $e({year:n,month:e,onPrev:a,onNext:t,onTitleClick:s,locale:i}){const l=document.createElement("div");l.classList.add("cal-nav");const r=document.createElement("button");r.classList.add("cal-nav__btn","cal-nav__btn--prev"),r.innerHTML=Oe,r.setAttribute("aria-label","Previous month"),r.addEventListener("click",a);const o=Ke(i),h=s?"button":"div",c=document.createElement(h);c.classList.add("cal-nav__title"),s&&(c.classList.add("cal-nav__title--interactive"),c.setAttribute("aria-label",`Select month and year, currently ${o[e]} ${n}`),c.addEventListener("click",s)),c.setAttribute("aria-live","polite"),c.textContent=`${o[e]} ${n}`;const d=document.createElement("button");return d.classList.add("cal-nav__btn","cal-nav__btn--next"),d.innerHTML=Fe,d.setAttribute("aria-label","Next month"),d.addEventListener("click",t),l.appendChild(r),l.appendChild(c),l.appendChild(d),l}const nt=`
533
533
  .cal-nav {
534
534
  display: flex;
535
535
  align-items: center;
@@ -570,7 +570,7 @@
570
570
  .cal-nav__title--interactive:hover {
571
571
  background: hsl(var(--cal-hover));
572
572
  }
573
- `,Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function et({pickerYear:n,viewMonth:e,viewYear:a,onMonthSelect:t,onYearPrev:s,onYearNext:i,onClose:l}){const r=document.createElement("div");r.classList.add("cal-myp","cal-animate-fade");const o=document.createElement("div");o.classList.add("cal-myp__year-nav");const h=document.createElement("button");h.classList.add("cal-nav__btn"),h.innerHTML=Pe,h.setAttribute("aria-label","Previous year"),h.addEventListener("click",s);const c=document.createElement("div");c.classList.add("cal-myp__year-label"),c.textContent=n;const d=document.createElement("button");d.classList.add("cal-nav__btn"),d.innerHTML=He,d.setAttribute("aria-label","Next year"),d.addEventListener("click",i),o.appendChild(h),o.appendChild(c),o.appendChild(d),r.appendChild(o);const g=document.createElement("div");g.classList.add("cal-myp__grid");const u=new Date,p=u.getMonth(),_=u.getFullYear();for(let m=0;m<12;m++){const v=document.createElement("button");v.classList.add("cal-myp__cell"),v.textContent=Mt[m],m===e&&n===a&&v.classList.add("cal-myp__cell--active"),m===p&&n===_&&v.classList.add("cal-myp__cell--today"),v.addEventListener("click",()=>t(m,n)),g.appendChild(v)}return r.appendChild(g),r.addEventListener("keydown",m=>{m.key==="Escape"&&(m.stopPropagation(),l())}),r}const tt=`
573
+ `;function it({pickerYear:n,viewMonth:e,viewYear:a,onMonthSelect:t,onYearPrev:s,onYearNext:i,onClose:l,locale:r}){const o=document.createElement("div");o.classList.add("cal-myp","cal-animate-fade");const h=document.createElement("div");h.classList.add("cal-myp__year-nav");const c=document.createElement("button");c.classList.add("cal-nav__btn"),c.innerHTML=Oe,c.setAttribute("aria-label","Previous year"),c.addEventListener("click",s);const d=document.createElement("div");d.classList.add("cal-myp__year-label"),d.textContent=n;const p=document.createElement("button");p.classList.add("cal-nav__btn"),p.innerHTML=Fe,p.setAttribute("aria-label","Next year"),p.addEventListener("click",i),h.appendChild(c),h.appendChild(d),h.appendChild(p),o.appendChild(h);const u=document.createElement("div");u.classList.add("cal-myp__grid");const g=Be(r),f=new Date,m=f.getMonth(),b=f.getFullYear();for(let y=0;y<12;y++){const w=document.createElement("button");w.classList.add("cal-myp__cell"),w.textContent=g[y],y===e&&n===a&&w.classList.add("cal-myp__cell--active"),y===m&&n===b&&w.classList.add("cal-myp__cell--today"),w.addEventListener("click",()=>t(y,n)),u.appendChild(w)}return o.appendChild(u),o.addEventListener("keydown",y=>{y.key==="Escape"&&(y.stopPropagation(),l())}),o}const lt=`
574
574
  .cal-myp {
575
575
  width: calc(7 * var(--cal-cell-size));
576
576
  }
@@ -628,7 +628,7 @@
628
628
  border: 1px solid hsl(var(--cal-border));
629
629
  font-weight: 600;
630
630
  }
631
- `;function At(){return[{key:"today",label:"Today",resolve(){const n=ue();return{start:n,end:n}}},{key:"this-week",label:"This Week",resolve(){const n=new Date,e=n.getDay(),a=new Date(n);a.setDate(n.getDate()-e);const t=new Date(a);return t.setDate(a.getDate()+6),{start:Z(a),end:Z(t)}}},{key:"next-7",label:"Next 7 Days",resolve(){const n=new Date,e=new Date;return e.setDate(n.getDate()+6),{start:Z(n),end:Z(e)}}},{key:"next-30",label:"Next 30 Days",resolve(){const n=new Date,e=new Date;return e.setDate(n.getDate()+29),{start:Z(n),end:Z(e)}}}]}function $t({presetKeys:n,onSelect:e}){const a=document.createElement("div");a.classList.add("cal-presets");const t=At(),s=n.map(i=>t.find(l=>l.key===i)).filter(Boolean);for(const i of s){const l=document.createElement("button");l.classList.add("cal-preset"),l.textContent=i.label,l.addEventListener("click",()=>{e==null||e(i.resolve())}),a.appendChild(l)}return a}const zt=`
631
+ `,rt={today:"Today","this-week":"This Week","next-7":"Next 7 Days","next-30":"Next 30 Days"};function ze(n,e){if(!e)return rt[n]||n;try{if(n==="today"){const s=new Intl.RelativeTimeFormat(e,{numeric:"auto"}).formatToParts(0,"day").map(i=>i.value).join("");return s.charAt(0).toUpperCase()+s.slice(1)}}catch{}return rt[n]||n}function Pt(n){return[{key:"today",label:ze("today",n),resolve(){const e=ue();return{start:e,end:e}}},{key:"this-week",label:ze("this-week",n),resolve(){const e=new Date,a=e.getDay(),t=new Date(e);t.setDate(e.getDate()-a);const s=new Date(t);return s.setDate(t.getDate()+6),{start:Z(t),end:Z(s)}}},{key:"next-7",label:ze("next-7",n),resolve(){const e=new Date,a=new Date;return a.setDate(e.getDate()+6),{start:Z(e),end:Z(a)}}},{key:"next-30",label:ze("next-30",n),resolve(){const e=new Date,a=new Date;return a.setDate(e.getDate()+29),{start:Z(e),end:Z(a)}}}]}function Ht({presetKeys:n,onSelect:e,locale:a}){const t=document.createElement("div");t.classList.add("cal-presets");const s=Pt(a),i=n.map(l=>s.find(r=>r.key===l)).filter(Boolean);for(const l of i){const r=document.createElement("button");r.classList.add("cal-preset"),r.textContent=l.label,r.addEventListener("click",()=>{e==null||e(l.resolve())}),t.appendChild(r)}return t}const Bt=`
632
632
  .cal-presets {
633
633
  display: flex;
634
634
  flex-wrap: wrap;
@@ -654,7 +654,7 @@
654
654
  .cal-preset:hover {
655
655
  background: hsl(var(--cal-hover));
656
656
  }
657
- `;function Be({trigger:n,content:e,onClose:a}){const t=document.createElement("div");t.classList.add("cal-popover"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.style.display="none",t.appendChild(e);let s=!1;function i(){t.classList.remove("cal-popover--above");const d=n.getBoundingClientRect(),g=t.offsetHeight,u=window.innerHeight-d.bottom,p=d.top;u<g+8&&p>u?(t.classList.add("cal-popover--above"),t.style.top="auto",t.style.bottom="100%",t.style.marginBottom="4px",t.style.marginTop="0"):(t.style.top="100%",t.style.bottom="auto",t.style.marginTop="4px",t.style.marginBottom="0")}function l(){s||(s=!0,t.style.display="",t.classList.add("cal-animate-slide-up"),requestAnimationFrame(()=>i()),document.addEventListener("click",o,!0),document.addEventListener("keydown",h,!0))}function r(){s&&(s=!1,t.style.display="none",t.classList.remove("cal-animate-slide-up"),document.removeEventListener("click",o,!0),document.removeEventListener("keydown",h,!0),a==null||a())}function o(d){var u;const g=(u=n.getRootNode())==null?void 0:u.host;g&&!g.contains(d.target)&&d.target!==g&&r()}function h(d){d.key==="Escape"&&(d.stopPropagation(),r())}function c(){s&&(s=!1,t.style.display="none",t.classList.remove("cal-animate-slide-up")),document.removeEventListener("click",o,!0),document.removeEventListener("keydown",h,!0)}return{panel:t,open:l,close:r,destroy:c,get isOpen(){return s}}}const Oe=`
657
+ `;function je({trigger:n,content:e,onClose:a}){const t=document.createElement("div");t.classList.add("cal-popover"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.style.display="none",t.appendChild(e);let s=!1;function i(){t.classList.remove("cal-popover--above");const d=n.getBoundingClientRect(),p=t.offsetHeight,u=window.innerHeight-d.bottom,g=d.top;u<p+8&&g>u?(t.classList.add("cal-popover--above"),t.style.top="auto",t.style.bottom="100%",t.style.marginBottom="4px",t.style.marginTop="0"):(t.style.top="100%",t.style.bottom="auto",t.style.marginTop="4px",t.style.marginBottom="0")}function l(){s||(s=!0,t.style.display="",t.classList.add("cal-animate-slide-up"),requestAnimationFrame(()=>i()),document.addEventListener("click",o,!0),document.addEventListener("keydown",h,!0))}function r(){s&&(s=!1,t.style.display="none",t.classList.remove("cal-animate-slide-up"),document.removeEventListener("click",o,!0),document.removeEventListener("keydown",h,!0),a==null||a())}function o(d){var u;const p=(u=n.getRootNode())==null?void 0:u.host;p&&!p.contains(d.target)&&d.target!==p&&r()}function h(d){d.key==="Escape"&&(d.stopPropagation(),r())}function c(){s&&(s=!1,t.style.display="none",t.classList.remove("cal-animate-slide-up")),document.removeEventListener("click",o,!0),document.removeEventListener("keydown",h,!0)}return{panel:t,open:l,close:r,destroy:c,get isOpen(){return s}}}const Re=`
658
658
  .cal-popover-wrapper {
659
659
  position: relative;
660
660
  display: inline-block;
@@ -699,7 +699,7 @@
699
699
  display: flex;
700
700
  color: hsl(var(--cal-fg-muted));
701
701
  }
702
- `;function at({columns:n=3,rows:e=4,durationLabels:a=!1}={}){const t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-label","Loading..."),t.classList.add("cal-skeleton-time-grid"),a&&t.classList.add("cal-skeleton-time-grid--duration");const s=n*e;for(let i=0;i<s;i++){const l=document.createElement("div");l.classList.add("cal-skeleton"),t.appendChild(l)}return t}function st({rows:n=5}={}){const e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-label","Loading..."),e.classList.add("cal-skeleton-calendar-grid");for(let t=0;t<7;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-skeleton-calendar-grid__header"),e.appendChild(s)}const a=7*n;for(let t=0;t<a;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-skeleton-calendar-grid__day"),e.appendChild(s)}return e}const Fe=`
702
+ `;function ot({columns:n=3,rows:e=4,durationLabels:a=!1}={}){const t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-label","Loading..."),t.classList.add("cal-skeleton-time-grid"),a&&t.classList.add("cal-skeleton-time-grid--duration");const s=n*e;for(let i=0;i<s;i++){const l=document.createElement("div");l.classList.add("cal-skeleton"),t.appendChild(l)}return t}function ct({rows:n=5}={}){const e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-label","Loading..."),e.classList.add("cal-skeleton-calendar-grid");for(let t=0;t<7;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-skeleton-calendar-grid__header"),e.appendChild(s)}const a=7*n;for(let t=0;t<a;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-skeleton-calendar-grid__day"),e.appendChild(s)}return e}const Ne=`
703
703
  .cal-skeleton-time-grid {
704
704
  display: grid;
705
705
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
@@ -732,7 +732,7 @@
732
732
  aspect-ratio: 1;
733
733
  border-radius: var(--cal-radius-sm) !important;
734
734
  }
735
- `,nt={error:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',warning:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',info:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',success:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'};function $e({type:n="info",message:e,dismissible:a=!0,onDismiss:t}){const s=document.createElement("div");s.classList.add("cal-status",`cal-status--${n}`,"cal-animate-slide-up"),s.setAttribute("role",n==="error"?"alert":"status"),s.setAttribute("aria-live",n==="error"?"assertive":"polite");const i=document.createElement("span");i.classList.add("cal-status__icon"),i.innerHTML=nt[n]||nt.info,s.appendChild(i);const l=document.createElement("span");if(l.classList.add("cal-status__text"),l.textContent=e,s.appendChild(l),a){const r=document.createElement("button");r.classList.add("cal-status__close"),r.setAttribute("aria-label","Dismiss"),r.innerHTML='<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>',r.addEventListener("click",()=>t==null?void 0:t()),s.appendChild(r)}return s}const ze=`
735
+ `,dt={error:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',warning:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',info:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',success:'<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'};function Ie({type:n="info",message:e,dismissible:a=!0,onDismiss:t}){const s=document.createElement("div");s.classList.add("cal-status",`cal-status--${n}`,"cal-animate-slide-up"),s.setAttribute("role",n==="error"?"alert":"status"),s.setAttribute("aria-live",n==="error"?"assertive":"polite");const i=document.createElement("span");i.classList.add("cal-status__icon"),i.innerHTML=dt[n]||dt.info,s.appendChild(i);const l=document.createElement("span");if(l.classList.add("cal-status__text"),l.textContent=e,s.appendChild(l),a){const r=document.createElement("button");r.classList.add("cal-status__close"),r.setAttribute("aria-label","Dismiss"),r.innerHTML='<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>',r.addEventListener("click",()=>t==null?void 0:t()),s.appendChild(r)}return s}const Ye=`
736
736
  .cal-status {
737
737
  display: flex;
738
738
  align-items: center;
@@ -794,7 +794,7 @@
794
794
  color: hsl(var(--cal-status-success-fg));
795
795
  border: 1px solid hsl(var(--cal-status-success-border));
796
796
  }
797
- `,Yt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>',It=`
797
+ `,Ot='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>',Ft=`
798
798
  .cal-picker {
799
799
  background: hsl(var(--cal-bg));
800
800
  border-radius: var(--cal-radius);
@@ -814,7 +814,7 @@
814
814
  .cal-month {
815
815
  flex: 0 0 auto;
816
816
  }
817
- `;class it extends be{static get styles(){return[Se,Te,Me,Ze,Qe,tt,zt,Oe,Fe,ze,It]}static get observedAttributes(){return["mode","display","theme","value","min-date","max-date","disabled-dates","first-day","locale","presets","placeholder","loading"]}constructor(){super();const e=new Date;this._store=De({viewYear:e.getFullYear(),viewMonth:e.getMonth(),selectedDates:[],rangeStart:null,rangeEnd:null,hoverDate:null,isOpen:!1,focusedDate:ue(),navDirection:null,pickingMonth:!1,pickerYear:e.getFullYear(),statusType:null,statusMessage:null,statusDismissible:!0}),this._popover=null,this._unsubscribe=null,this._rendering=!1}get mode(){return this.getAttribute("mode")||"single"}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select date"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get minDate(){return this.getAttribute("min-date")||null}get maxDate(){return this.getAttribute("max-date")||null}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get disabledDates(){const e=this.getAttribute("disabled-dates");return e?e.split(",").map(a=>a.trim()):[]}get presetKeys(){const e=this.getAttribute("presets");return e?e.split(",").map(a=>a.trim()):[]}get value(){const e=this._store.getState();return this.mode==="range"?e.rangeStart&&e.rangeEnd?{start:e.rangeStart,end:e.rangeEnd}:null:this.mode==="multi"?[...e.selectedDates]:e.selectedDates[0]||null}set value(e){if(this.mode==="range"&&e&&typeof e=="object"){const a=typeof e.start=="string"?e.start:Z(e.start),t=typeof e.end=="string"?e.end:Z(e.end);this._store.set({rangeStart:a,rangeEnd:t,selectedDates:[a,t]}),this._navigateToDate(a)}else this.mode==="multi"&&Array.isArray(e)?(this._store.set({selectedDates:e}),e.length&&this._navigateToDate(e[0])):typeof e=="string"?(this._store.set({selectedDates:[e],rangeStart:null,rangeEnd:null}),this._navigateToDate(e)):this._store.set({selectedDates:[],rangeStart:null,rangeEnd:null})}_navigateToDate(e){const a=W(e);a&&this._store.set({viewYear:a.getFullYear(),viewMonth:a.getMonth()})}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverDate!==t.hoverDate&&a.viewYear===t.viewYear&&a.viewMonth===t.viewMonth&&a.selectedDates===t.selectedDates&&a.rangeStart===t.rangeStart&&a.rangeEnd===t.rangeEnd&&a.isOpen===t.isOpen&&a.navDirection===t.navDirection&&a.pickingMonth===t.pickingMonth&&a.pickerYear===t.pickerYear?this._updateGridHighlight(a):this.render()});const e=this.getAttribute("value");if(e)if(this.mode==="range"&&e.includes("/")){const[a,t]=e.split("/");this.value={start:a,end:t}}else this.mode==="multi"&&e.includes(",")?this.value=e.split(",").map(a=>a.trim()):this.value=e}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="value"&&this._initialized)if(this.mode==="range"&&t&&t.includes("/")){const[s,i]=t.split("/");this.value={start:s,end:i}}else this.mode==="multi"&&t&&t.includes(",")?this.value=t.split(",").map(s=>s.trim()):this.value=t;this._initialized&&this.render()}}_handleSelect(e){const a=this._store.getState();if(this.mode==="single")this._store.set({selectedDates:[e],focusedDate:e}),this.emit("cal:change",{value:e}),this.display==="popover"&&this.close();else if(this.mode==="range")if(!a.rangeStart||a.rangeEnd)this._store.set({rangeStart:e,rangeEnd:null,selectedDates:[e],focusedDate:e});else{let t=a.rangeStart,s=e;t>s&&([t,s]=[s,t]),this._store.set({rangeStart:t,rangeEnd:s,selectedDates:[t,s],hoverDate:null,focusedDate:s}),this.emit("cal:change",{value:{start:t,end:s}}),this.display==="popover"&&this.close()}else if(this.mode==="multi"){const t=[...a.selectedDates],s=t.findIndex(i=>re(i,e));s>=0?t.splice(s,1):t.push(e),t.sort(),this._store.set({selectedDates:t,focusedDate:e}),this.emit("cal:change",{value:t})}}_handleHover(e){this.mode==="range"&&this._store.set({hoverDate:e})}_handlePresetSelect({start:e,end:a}){this._store.set({rangeStart:e,rangeEnd:a,selectedDates:[e,a],hoverDate:null}),this._navigateToDate(e),this.emit("cal:change",{value:{start:e,end:a}}),this.display==="popover"&&this.close()}_prevMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,-1);this._store.set({viewYear:t,viewMonth:s,navDirection:"prev"}),this.emit("cal:month-change",{year:t,month:s})}_nextMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,1);this._store.set({viewYear:t,viewMonth:s,navDirection:"next"}),this.emit("cal:month-change",{year:t,month:s})}_toggleMonthPicker(){const e=this._store.getState();this._store.set({pickingMonth:!e.pickingMonth,pickerYear:e.viewYear})}_selectMonthFromPicker(e,a){this._store.set({viewYear:a,viewMonth:e,pickingMonth:!1}),this.emit("cal:month-change",{year:a,month:e})}_handleKeydown(e){if(e.key==="Escape"&&this._store.get("pickingMonth")){e.stopPropagation(),this._store.set({pickingMonth:!1});return}const a=this._store.getState(),t=W(a.focusedDate);if(!t)return;let s=null;switch(e.key){case"ArrowLeft":s=new Date(t),s.setDate(t.getDate()-1);break;case"ArrowRight":s=new Date(t),s.setDate(t.getDate()+1);break;case"ArrowUp":s=new Date(t),s.setDate(t.getDate()-7);break;case"ArrowDown":s=new Date(t),s.setDate(t.getDate()+7);break;case"Enter":case" ":e.preventDefault(),this._handleSelect(a.focusedDate);return;case"Escape":this.display==="popover"&&this.close();return;default:return}if(s){e.preventDefault();const i=Z(s);s.getMonth()!==a.viewMonth||s.getFullYear()!==a.viewYear?this._store.set({viewYear:s.getFullYear(),viewMonth:s.getMonth(),focusedDate:i,navDirection:s>t?"next":"prev"}):this._store.set({focusedDate:i}),requestAnimationFrame(()=>{const l=this.$(`[data-date="${i}"]`);l==null||l.focus()})}}_updateGridHighlight(e){const a=this.$$(".cal-day"),{rangeStart:t,hoverDate:s}=e,i=t&&!e.rangeEnd&&s?s:e.rangeEnd;for(const l of a){const r=l.dataset.date;if(!r||l.classList.contains("cal-day--disabled"))continue;const o=r===t,h=r===i;let c=!1;if(t&&i){const d=t<i?t:i,g=t<i?i:t;c=r>=d&&r<=g&&!o&&!h}l.classList.toggle("cal-day--range-start",o&&!!i),l.classList.toggle("cal-day--range-end",h&&!!i),l.classList.toggle("cal-day--in-range",c)}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}goToMonth(e,a){this._store.set({viewYear:a,viewMonth:e})}_renderCalendarContent(){const e=this._store.getState(),a=document.createElement("div");if(a.classList.add("cal-picker"),e.statusType&&e.statusMessage&&a.appendChild($e({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()})),this.loading){const l=document.createElement("div");l.classList.add("cal-months");const r=document.createElement("div");return r.classList.add("cal-month"),r.appendChild(st()),l.appendChild(r),a.appendChild(l),a.addEventListener("keydown",o=>this._handleKeydown(o)),a}const t=document.createElement("div");t.classList.add("cal-months");const s=this.mode==="range"&&this.hasAttribute("dual"),i=s?2:1;for(let l=0;l<i;l++){const{year:r,month:o}=l===0?{year:e.viewYear,month:e.viewMonth}:pe(e.viewYear,e.viewMonth,1),h=document.createElement("div");if(h.classList.add("cal-month"),l===0&&h.appendChild(Ae({year:r,month:o,onPrev:e.pickingMonth?()=>{}:()=>this._prevMonth(),onNext:e.pickingMonth?()=>{}:()=>{s||this._nextMonth()},onTitleClick:()=>this._toggleMonthPicker()})),l===1&&h.appendChild(Ae({year:r,month:o,onPrev:()=>{},onNext:()=>this._nextMonth()})),e.pickingMonth&&l===0){const c=et({pickerYear:e.pickerYear,viewMonth:e.viewMonth,viewYear:e.viewYear,onMonthSelect:(d,g)=>this._selectMonthFromPicker(d,g),onYearPrev:()=>this._store.set({pickerYear:e.pickerYear-1}),onYearNext:()=>this._store.set({pickerYear:e.pickerYear+1}),onClose:()=>this._store.set({pickingMonth:!1})});h.appendChild(c)}else{const c=e.navDirection==="next"?"cal-animate-slide-left":e.navDirection==="prev"?"cal-animate-slide-right":"",d=Je({year:r,month:o,firstDay:this.firstDay,selectedDates:e.selectedDates,rangeStart:e.rangeStart,rangeEnd:e.rangeEnd,hoverDate:e.hoverDate,minDate:this.minDate,maxDate:this.maxDate,disabledDates:this.disabledDates,mode:this.mode,focusedDate:e.focusedDate,onSelect:g=>this._handleSelect(g),onHover:g=>this._handleHover(g)});c&&d.classList.add(c),h.appendChild(d)}t.appendChild(h)}return a.appendChild(t),this.mode==="range"&&this.presetKeys.length&&a.appendChild($t({presetKeys:this.presetKeys,onSelect:l=>this._handlePresetSelect(l)})),a.addEventListener("keydown",l=>this._handleKeydown(l)),a}_formatTriggerText(){const e=this._store.getState();return this.mode==="range"&&e.rangeStart&&e.rangeEnd?`${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}`:e.selectedDates.length?this.mode==="multi"?`${e.selectedDates.length} dates selected`:this._formatShortDate(e.selectedDates[0]):null}_formatShortDate(e){const a=W(e);return a?`${se[a.getMonth()].slice(0,3)} ${a.getDate()}, ${a.getFullYear()}`:e}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Yt,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderCalendarContent(),c=Be({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderCalendarContent());this._store.set({navDirection:null}),this._rendering=!1}}function ie(n){if(!n||typeof n!="string")return null;const e=n.trim().toUpperCase(),a=e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);if(a){let s=parseInt(a[1],10);const i=parseInt(a[2],10),l=a[3];return l==="AM"&&s===12&&(s=0),l==="PM"&&s!==12&&(s+=12),{hours:s,minutes:i}}const t=e.match(/^(\d{1,2}):(\d{2})$/);return t?{hours:parseInt(t[1],10),minutes:parseInt(t[2],10)}:null}function oe(n,e,a="24h"){const t=String(e).padStart(2,"0");if(a==="12h"){const s=n>=12?"PM":"AM";return`${n%12||12}:${t} ${s}`}return`${String(n).padStart(2,"0")}:${t}`}function b(n){const e=ie(n);return e?e.hours*60+e.minutes:0}function le(n){const e=Math.floor(n/60)%24,a=n%60;return`${String(e).padStart(2,"0")}:${String(a).padStart(2,"0")}`}function Ee(n,e,a){const t=[],s=b(n),i=b(e);for(let l=s;l<=i;l+=a)t.push(le(l));return t}function lt(n,e,a,t="24h"){const s=[],i=b(n),l=b(e);for(let r=i;r<=l;r+=a){const o=le(r),h=r+a,c=le(Math.min(h,l+a)),d=ie(o),g=ie(c),u=d?oe(d.hours,d.minutes,t):o,p=g?oe(g.hours,g.minutes,t):c;s.push({time:o,displayText:`${u}–${p}`})}return s}function rt(){const n=new Date;return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function ot(n,e,a){const t=b(n),s=b(e),i=b(a),l=Math.min(s,i),r=Math.max(s,i);return t>=l&&t<=r}function ct(n){const{slots:e=[],mode:a="single",format:t="24h",selected:s,hoverTime:i,rangeStart:l,unavailableTimes:r=[],onSelect:o,onHover:h,durationLabels:c=!1}=n,d=document.createElement("div");d.classList.add("cal-time-grid"),c&&d.classList.add("cal-time-grid--duration"),d.setAttribute("role","listbox"),a==="multi"&&d.setAttribute("aria-multiselectable","true");for(const g of e){const u=document.createElement("button");u.classList.add("cal-time-slot"),u.setAttribute("role","option"),u.dataset.time=g.time;const p=ie(g.time),_=g.displayText?g.displayText:p?oe(p.hours,p.minutes,t):g.time,m=document.createElement("span");if(m.classList.add("cal-time-slot__time"),m.textContent=_,u.appendChild(m),g.label){const k=document.createElement("span");k.classList.add("cal-time-slot__label"),k.textContent=g.label,u.appendChild(k)}const v=g.available===!1||r.includes(g.time);if(v&&(u.classList.add("cal-time-slot--unavailable"),u.disabled=!0,u.setAttribute("aria-disabled","true")),Pt(g.time,s,a)?(u.classList.add("cal-time-slot--selected"),u.setAttribute("aria-selected","true")):u.setAttribute("aria-selected","false"),a==="range"&&l&&!Ht(s)&&i){const k=ot(g.time,l,i),S=g.time===l,B=g.time===i;k&&!S&&!B&&u.classList.add("cal-time-slot--in-range"),S&&u.classList.add("cal-time-slot--range-start"),B&&u.classList.add("cal-time-slot--range-end")}else if(a==="range"&&s&&typeof s=="object"&&s.start&&s.end){const k=ot(g.time,s.start,s.end),S=g.time===s.start,B=g.time===s.end;S&&u.classList.add("cal-time-slot--range-start","cal-time-slot--selected"),B&&u.classList.add("cal-time-slot--range-end","cal-time-slot--selected"),k&&!S&&!B&&u.classList.add("cal-time-slot--in-range")}v||(u.addEventListener("click",()=>o==null?void 0:o(g.time)),u.addEventListener("mouseenter",()=>h==null?void 0:h(g.time))),d.appendChild(u)}return d.addEventListener("mouseleave",()=>h==null?void 0:h(null)),d}function Pt(n,e,a){return e?a==="single"?e===n:a==="multi"?Array.isArray(e)&&e.includes(n):a==="range"&&typeof e=="object"&&e.start&&e.end?e.start===n||e.end===n:!1:!1}function Ht(n){return n&&typeof n=="object"&&n.start&&n.end}const dt=`
817
+ `;class ht extends ve{static get styles(){return[Se,Me,Ae,st,nt,lt,Bt,Re,Ne,Ye,Ft]}static get observedAttributes(){return["mode","display","theme","value","min-date","max-date","disabled-dates","first-day","locale","presets","placeholder","loading"]}constructor(){super();const e=new Date;this._store=De({viewYear:e.getFullYear(),viewMonth:e.getMonth(),selectedDates:[],rangeStart:null,rangeEnd:null,hoverDate:null,isOpen:!1,focusedDate:ue(),navDirection:null,pickingMonth:!1,pickerYear:e.getFullYear(),statusType:null,statusMessage:null,statusDismissible:!0}),this._popover=null,this._unsubscribe=null,this._rendering=!1}get mode(){return this.getAttribute("mode")||"single"}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select date"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get minDate(){return this.getAttribute("min-date")||null}get maxDate(){return this.getAttribute("max-date")||null}get locale(){return this.getAttribute("locale")||void 0}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get disabledDates(){const e=this.getAttribute("disabled-dates");return e?e.split(",").map(a=>a.trim()):[]}get presetKeys(){const e=this.getAttribute("presets");return e?e.split(",").map(a=>a.trim()):[]}get value(){const e=this._store.getState();return this.mode==="range"?e.rangeStart&&e.rangeEnd?{start:e.rangeStart,end:e.rangeEnd}:null:this.mode==="multi"?[...e.selectedDates]:e.selectedDates[0]||null}set value(e){if(this.mode==="range"&&e&&typeof e=="object"){const a=typeof e.start=="string"?e.start:Z(e.start),t=typeof e.end=="string"?e.end:Z(e.end);this._store.set({rangeStart:a,rangeEnd:t,selectedDates:[a,t]}),this._navigateToDate(a)}else this.mode==="multi"&&Array.isArray(e)?(this._store.set({selectedDates:e}),e.length&&this._navigateToDate(e[0])):typeof e=="string"?(this._store.set({selectedDates:[e],rangeStart:null,rangeEnd:null}),this._navigateToDate(e)):this._store.set({selectedDates:[],rangeStart:null,rangeEnd:null})}_navigateToDate(e){const a=K(e);a&&this._store.set({viewYear:a.getFullYear(),viewMonth:a.getMonth()})}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverDate!==t.hoverDate&&a.viewYear===t.viewYear&&a.viewMonth===t.viewMonth&&a.selectedDates===t.selectedDates&&a.rangeStart===t.rangeStart&&a.rangeEnd===t.rangeEnd&&a.isOpen===t.isOpen&&a.navDirection===t.navDirection&&a.pickingMonth===t.pickingMonth&&a.pickerYear===t.pickerYear?this._updateGridHighlight(a):this.render()});const e=this.getAttribute("value");if(e)if(this.mode==="range"&&e.includes("/")){const[a,t]=e.split("/");this.value={start:a,end:t}}else this.mode==="multi"&&e.includes(",")?this.value=e.split(",").map(a=>a.trim()):this.value=e}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="value"&&this._initialized)if(this.mode==="range"&&t&&t.includes("/")){const[s,i]=t.split("/");this.value={start:s,end:i}}else this.mode==="multi"&&t&&t.includes(",")?this.value=t.split(",").map(s=>s.trim()):this.value=t;this._initialized&&this.render()}}_handleSelect(e){const a=this._store.getState();if(this.mode==="single")this._store.set({selectedDates:[e],focusedDate:e}),this.emit("cal:change",{value:e}),this.display==="popover"&&this.close();else if(this.mode==="range")if(!a.rangeStart||a.rangeEnd)this._store.set({rangeStart:e,rangeEnd:null,selectedDates:[e],focusedDate:e});else{let t=a.rangeStart,s=e;t>s&&([t,s]=[s,t]),this._store.set({rangeStart:t,rangeEnd:s,selectedDates:[t,s],hoverDate:null,focusedDate:s}),this.emit("cal:change",{value:{start:t,end:s}}),this.display==="popover"&&this.close()}else if(this.mode==="multi"){const t=[...a.selectedDates],s=t.findIndex(i=>re(i,e));s>=0?t.splice(s,1):t.push(e),t.sort(),this._store.set({selectedDates:t,focusedDate:e}),this.emit("cal:change",{value:t})}}_handleHover(e){this.mode==="range"&&this._store.set({hoverDate:e})}_handlePresetSelect({start:e,end:a}){this._store.set({rangeStart:e,rangeEnd:a,selectedDates:[e,a],hoverDate:null}),this._navigateToDate(e),this.emit("cal:change",{value:{start:e,end:a}}),this.display==="popover"&&this.close()}_prevMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,-1);this._store.set({viewYear:t,viewMonth:s,navDirection:"prev"}),this.emit("cal:month-change",{year:t,month:s})}_nextMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,1);this._store.set({viewYear:t,viewMonth:s,navDirection:"next"}),this.emit("cal:month-change",{year:t,month:s})}_toggleMonthPicker(){const e=this._store.getState();this._store.set({pickingMonth:!e.pickingMonth,pickerYear:e.viewYear})}_selectMonthFromPicker(e,a){this._store.set({viewYear:a,viewMonth:e,pickingMonth:!1}),this.emit("cal:month-change",{year:a,month:e})}_handleKeydown(e){if(e.key==="Escape"&&this._store.get("pickingMonth")){e.stopPropagation(),this._store.set({pickingMonth:!1});return}const a=this._store.getState(),t=K(a.focusedDate);if(!t)return;let s=null;switch(e.key){case"ArrowLeft":s=new Date(t),s.setDate(t.getDate()-1);break;case"ArrowRight":s=new Date(t),s.setDate(t.getDate()+1);break;case"ArrowUp":s=new Date(t),s.setDate(t.getDate()-7);break;case"ArrowDown":s=new Date(t),s.setDate(t.getDate()+7);break;case"Enter":case" ":e.preventDefault(),this._handleSelect(a.focusedDate);return;case"Escape":this.display==="popover"&&this.close();return;default:return}if(s){e.preventDefault();const i=Z(s);s.getMonth()!==a.viewMonth||s.getFullYear()!==a.viewYear?this._store.set({viewYear:s.getFullYear(),viewMonth:s.getMonth(),focusedDate:i,navDirection:s>t?"next":"prev"}):this._store.set({focusedDate:i}),requestAnimationFrame(()=>{const l=this.$(`[data-date="${i}"]`);l==null||l.focus()})}}_updateGridHighlight(e){const a=this.$$(".cal-day"),{rangeStart:t,hoverDate:s}=e,i=t&&!e.rangeEnd&&s?s:e.rangeEnd;for(const l of a){const r=l.dataset.date;if(!r||l.classList.contains("cal-day--disabled"))continue;const o=r===t,h=r===i;let c=!1;if(t&&i){const d=t<i?t:i,p=t<i?i:t;c=r>=d&&r<=p&&!o&&!h}l.classList.toggle("cal-day--range-start",o&&!!i),l.classList.toggle("cal-day--range-end",h&&!!i),l.classList.toggle("cal-day--in-range",c)}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}goToMonth(e,a){this._store.set({viewYear:a,viewMonth:e})}clear(){this._store.set({selectedDates:[],rangeStart:null,rangeEnd:null,hoverDate:null}),this.emit("cal:change",{value:null})}_renderCalendarContent(){const e=this._store.getState(),a=document.createElement("div");if(a.classList.add("cal-picker"),e.statusType&&e.statusMessage&&a.appendChild(Ie({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()})),this.loading){const l=document.createElement("div");l.classList.add("cal-months");const r=document.createElement("div");return r.classList.add("cal-month"),r.appendChild(ct()),l.appendChild(r),a.appendChild(l),a.addEventListener("keydown",o=>this._handleKeydown(o)),a}const t=document.createElement("div");t.classList.add("cal-months");const s=this.mode==="range"&&this.hasAttribute("dual"),i=s?2:1;for(let l=0;l<i;l++){const{year:r,month:o}=l===0?{year:e.viewYear,month:e.viewMonth}:pe(e.viewYear,e.viewMonth,1),h=document.createElement("div");if(h.classList.add("cal-month"),l===0&&h.appendChild($e({year:r,month:o,onPrev:e.pickingMonth?()=>{}:()=>this._prevMonth(),onNext:e.pickingMonth?()=>{}:()=>{s||this._nextMonth()},onTitleClick:()=>this._toggleMonthPicker(),locale:this.locale})),l===1&&h.appendChild($e({year:r,month:o,onPrev:()=>{},onNext:()=>this._nextMonth(),locale:this.locale})),e.pickingMonth&&l===0){const c=it({pickerYear:e.pickerYear,viewMonth:e.viewMonth,viewYear:e.viewYear,onMonthSelect:(d,p)=>this._selectMonthFromPicker(d,p),onYearPrev:()=>this._store.set({pickerYear:e.pickerYear-1}),onYearNext:()=>this._store.set({pickerYear:e.pickerYear+1}),onClose:()=>this._store.set({pickingMonth:!1}),locale:this.locale});h.appendChild(c)}else{const c=e.navDirection==="next"?"cal-animate-slide-left":e.navDirection==="prev"?"cal-animate-slide-right":"",d=at({year:r,month:o,firstDay:this.firstDay,selectedDates:e.selectedDates,rangeStart:e.rangeStart,rangeEnd:e.rangeEnd,hoverDate:e.hoverDate,minDate:this.minDate,maxDate:this.maxDate,disabledDates:this.disabledDates,mode:this.mode,focusedDate:e.focusedDate,onSelect:p=>this._handleSelect(p),onHover:p=>this._handleHover(p),locale:this.locale});c&&d.classList.add(c),h.appendChild(d)}t.appendChild(h)}return a.appendChild(t),this.mode==="range"&&this.presetKeys.length&&a.appendChild(Ht({presetKeys:this.presetKeys,onSelect:l=>this._handlePresetSelect(l),locale:this.locale})),a.addEventListener("keydown",l=>this._handleKeydown(l)),a}_formatTriggerText(){const e=this._store.getState();return this.mode==="range"&&e.rangeStart&&e.rangeEnd?`${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}`:e.selectedDates.length?this.mode==="multi"?`${e.selectedDates.length} dates selected`:this._formatShortDate(e.selectedDates[0]):null}_formatShortDate(e){const a=K(e);if(!a)return e;if(this.locale)try{return new Intl.DateTimeFormat(this.locale,{month:"short",day:"numeric",year:"numeric"}).format(a)}catch{}return`${Be(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Ot,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderCalendarContent(),c=je({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderCalendarContent());this._store.set({navDirection:null}),this._rendering=!1}}function ne(n){if(!n||typeof n!="string")return null;const e=n.trim().toUpperCase(),a=e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);if(a){let s=parseInt(a[1],10);const i=parseInt(a[2],10),l=a[3];return l==="AM"&&s===12&&(s=0),l==="PM"&&s!==12&&(s+=12),{hours:s,minutes:i}}const t=e.match(/^(\d{1,2}):(\d{2})$/);return t?{hours:parseInt(t[1],10),minutes:parseInt(t[2],10)}:null}function oe(n,e,a="24h"){const t=String(e).padStart(2,"0");if(a==="12h"){const s=n>=12?"PM":"AM";return`${n%12||12}:${t} ${s}`}return`${String(n).padStart(2,"0")}:${t}`}function _(n){const e=ne(n);return e?e.hours*60+e.minutes:0}function ie(n){const e=Math.floor(n/60)%24,a=n%60;return`${String(e).padStart(2,"0")}:${String(a).padStart(2,"0")}`}function Ee(n,e,a){const t=[],s=_(n);let i=_(e);i<=s&&(i+=1440);for(let l=s;l<=i;l+=a)t.push(ie(l%1440));return t}function ut(n,e,a,t="24h"){const s=[],i=_(n);let l=_(e);l<=i&&(l+=1440);for(let r=i;r<=l;r+=a){const o=ie(r%1440),h=r+a,c=ie(Math.min(h,l+a)%1440),d=ne(o),p=ne(c),u=d?oe(d.hours,d.minutes,t):o,g=p?oe(p.hours,p.minutes,t):c;s.push({time:o,displayText:`${u}–${g}`})}return s}function pt(){const n=new Date;return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function gt(n,e,a){const t=_(n),s=_(e),i=_(a);return i>=s?t>=s&&t<=i:t>=s||t<=i}function mt(n){const{slots:e=[],mode:a="single",format:t="24h",selected:s,hoverTime:i,rangeStart:l,unavailableTimes:r=[],onSelect:o,onHover:h,durationLabels:c=!1}=n,d=document.createElement("div");d.classList.add("cal-time-grid"),c&&d.classList.add("cal-time-grid--duration"),d.setAttribute("role","listbox"),a==="multi"&&d.setAttribute("aria-multiselectable","true");for(const p of e){const u=document.createElement("button");u.classList.add("cal-time-slot"),u.setAttribute("role","option"),u.dataset.time=p.time;const g=ne(p.time),f=p.displayText?p.displayText:g?oe(g.hours,g.minutes,t):p.time,m=document.createElement("span");if(m.classList.add("cal-time-slot__time"),m.textContent=f,u.appendChild(m),p.label){const w=document.createElement("span");w.classList.add("cal-time-slot__label"),w.textContent=p.label,u.appendChild(w)}const b=p.available===!1||r.includes(p.time);if(b&&(u.classList.add("cal-time-slot--unavailable"),u.disabled=!0,u.setAttribute("aria-disabled","true")),jt(p.time,s,a)?(u.classList.add("cal-time-slot--selected"),u.setAttribute("aria-selected","true")):u.setAttribute("aria-selected","false"),a==="range"&&l&&!Rt(s)&&i){const w=gt(p.time,l,i),A=p.time===l,I=p.time===i;w&&!A&&!I&&u.classList.add("cal-time-slot--in-range"),A&&u.classList.add("cal-time-slot--range-start"),I&&u.classList.add("cal-time-slot--range-end")}else if(a==="range"&&s&&typeof s=="object"&&s.start&&s.end){const w=gt(p.time,s.start,s.end),A=p.time===s.start,I=p.time===s.end;A&&u.classList.add("cal-time-slot--range-start","cal-time-slot--selected"),I&&u.classList.add("cal-time-slot--range-end","cal-time-slot--selected"),w&&!A&&!I&&u.classList.add("cal-time-slot--in-range")}b||(u.addEventListener("click",()=>o==null?void 0:o(p.time)),u.addEventListener("mouseenter",()=>h==null?void 0:h(p.time))),d.appendChild(u)}return d.addEventListener("mouseleave",()=>h==null?void 0:h(null)),d}function jt(n,e,a){return e?a==="single"?e===n:a==="multi"?Array.isArray(e)&&e.includes(n):a==="range"&&typeof e=="object"&&e.start&&e.end?e.start===n||e.end===n:!1:!1}function Rt(n){return n&&typeof n=="object"&&n.start&&n.end}const ft=`
818
818
  .cal-time-grid {
819
819
  display: grid;
820
820
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
@@ -896,7 +896,7 @@
896
896
  .cal-time-grid--duration .cal-time-slot {
897
897
  font-size: 12px;
898
898
  }
899
- `,Bt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>',Ot=`
899
+ `,Nt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>',qt=`
900
900
  .cal-picker {
901
901
  background: hsl(var(--cal-bg));
902
902
  border-radius: var(--cal-radius);
@@ -930,7 +930,7 @@
930
930
  color: hsl(var(--cal-fg));
931
931
  margin-bottom: 8px;
932
932
  }
933
- `;class ht extends be{static get styles(){return[Se,Te,Me,Ze,dt,Qe,tt,Oe,Fe,ze,Ot]}static get observedAttributes(){return["theme","display","min-date","max-date","first-day","placeholder","dual","show-labels-on-hover","time-slots","time-start","time-end","time-interval","time-format","duration-labels","loading"]}constructor(){super();const e=new Date;this._store=De({viewYear:e.getFullYear(),viewMonth:e.getMonth(),rangeStart:null,rangeEnd:null,hoverDate:null,isOpen:!1,focusedDate:ue(),navDirection:null,pickingMonth:!1,pickerYear:e.getFullYear(),startTime:null,endTime:null,timeSelectPhase:null,statusType:null,statusMessage:null,statusDismissible:!0}),this._bookings=[],this._dayData={},this._labelFormula=null,this._timeSlots=null,this._popover=null,this._unsubscribe=null,this._rendering=!1}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select dates"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get minDate(){return this.getAttribute("min-date")||null}get maxDate(){return this.getAttribute("max-date")||null}get showLabelsOnHover(){return this.hasAttribute("show-labels-on-hover")}get timeSlotsEnabled(){return this.hasAttribute("time-slots")}get timeStartTime(){return this.getAttribute("time-start")||"09:00"}get timeEndTime(){return this.getAttribute("time-end")||"17:00"}get timeInterval(){return parseInt(this.getAttribute("time-interval")||"60",10)}get timeFormat(){return this.getAttribute("time-format")||"24h"}get durationLabels(){return this.hasAttribute("duration-labels")}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get bookings(){return this._bookings}set bookings(e){this._bookings=Array.isArray(e)?e:[],this._initialized&&this.render()}get dayData(){return this._dayData}set dayData(e){this._dayData=e&&typeof e=="object"?e:{},this._initialized&&this.render()}get labelFormula(){return this._labelFormula}set labelFormula(e){this._labelFormula=typeof e=="function"?e:null,this._initialized&&this.render()}get timeSlots(){return this._timeSlots}set timeSlots(e){this._timeSlots=Array.isArray(e)?e:null,this._initialized&&this.render()}get value(){const e=this._store.getState();if(!e.rangeStart||!e.rangeEnd)return null;const a={start:e.rangeStart,end:e.rangeEnd};return this.timeSlotsEnabled&&(e.startTime&&(a.startTime=e.startTime),e.endTime&&(a.endTime=e.endTime)),a}set value(e){if(e&&typeof e=="object"&&e.start&&e.end){const a=typeof e.start=="string"?e.start:Z(e.start),t=typeof e.end=="string"?e.end:Z(e.end),s={rangeStart:a,rangeEnd:t};e.startTime&&(s.startTime=e.startTime),e.endTime&&(s.endTime=e.endTime),this._store.set(s),this._navigateToDate(a)}else this._store.set({rangeStart:null,rangeEnd:null,startTime:null,endTime:null,timeSelectPhase:null})}_navigateToDate(e){const a=W(e);a&&this._store.set({viewYear:a.getFullYear(),viewMonth:a.getMonth()})}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverDate!==t.hoverDate&&a.viewYear===t.viewYear&&a.viewMonth===t.viewMonth&&a.rangeStart===t.rangeStart&&a.rangeEnd===t.rangeEnd&&a.isOpen===t.isOpen&&a.navDirection===t.navDirection&&a.pickingMonth===t.pickingMonth&&a.pickerYear===t.pickerYear&&a.timeSelectPhase===t.timeSelectPhase?this._updateGridHighlight(a):this.render()});const e=this.getAttribute("bookings");if(e&&!this._bookings.length)try{this._bookings=JSON.parse(e)}catch{}}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){a!==t&&this._initialized&&this.render()}_handleSelect(e){const a=this._store.getState();if(!a.rangeStart||a.rangeEnd)this._store.set({rangeStart:e,rangeEnd:null,hoverDate:null,focusedDate:e,startTime:null,endTime:null,timeSelectPhase:null});else{let t=a.rangeStart,s=e;if(t>s&&([t,s]=[s,t]),!Ve(t,s,this._bookings)){this.emit("cal:selection-invalid",{start:t,end:s}),this._store.set({rangeStart:null,rangeEnd:null,hoverDate:null,startTime:null,endTime:null,timeSelectPhase:null}),this.showStatus("error","Selection overlaps an existing booking",{autoDismiss:4e3});return}this.timeSlotsEnabled?this._store.set({rangeStart:t,rangeEnd:s,hoverDate:null,focusedDate:s,timeSelectPhase:"start"}):(this._store.set({rangeStart:t,rangeEnd:s,hoverDate:null,focusedDate:s}),this.emit("cal:change",{value:{start:t,end:s}}),this.display==="popover"&&this.close())}}_handleTimeSelect(e){const a=this._store.getState();if(a.timeSelectPhase==="start")this._store.set({startTime:e,timeSelectPhase:"end"});else if(a.timeSelectPhase==="end"){this._store.set({endTime:e,timeSelectPhase:null});const t={start:a.rangeStart,end:a.rangeEnd,startTime:a.startTime,endTime:e};this.emit("cal:change",{value:t}),this.display==="popover"&&this.close()}}_handleHover(e){this._store.set({hoverDate:e})}_updateGridHighlight(e){const a=this.$$(".cal-day"),{rangeStart:t,hoverDate:s}=e,i=t&&!e.rangeEnd&&s?s:e.rangeEnd;let l=!1;if(t&&!e.rangeEnd&&s){const r=t<s?t:s,o=t<s?s:t;for(const h of this._bookings)if(r<h.end&&o>h.start){l=!0;break}}for(const r of a){const o=r.dataset.date;if(!o)continue;const h=o===t&&!!i,c=o===i&&!!i;let d=!1;if(t&&i){const u=t<i?t:i,p=t<i?i:t;d=o>=u&&o<=p&&!h&&!c}const g=l&&t&&!e.rangeEnd&&s&&(()=>{const u=t<s?t:s,p=t<s?s:t;return o>=u&&o<=p})();r.classList.toggle("cal-day--range-start",h),r.classList.toggle("cal-day--range-end",c),r.classList.toggle("cal-day--in-range",d),r.classList.toggle("cal-day--invalid-range",!!g)}}_prevMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,-1);this._store.set({viewYear:t,viewMonth:s,navDirection:"prev"}),this.emit("cal:month-change",{year:t,month:s})}_nextMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,1);this._store.set({viewYear:t,viewMonth:s,navDirection:"next"}),this.emit("cal:month-change",{year:t,month:s})}_toggleMonthPicker(){const e=this._store.getState();this._store.set({pickingMonth:!e.pickingMonth,pickerYear:e.viewYear})}_selectMonthFromPicker(e,a){this._store.set({viewYear:a,viewMonth:e,pickingMonth:!1}),this.emit("cal:month-change",{year:a,month:e})}_handleKeydown(e){if(e.key==="Escape"&&this._store.get("pickingMonth")){e.stopPropagation(),this._store.set({pickingMonth:!1});return}const a=this._store.getState(),t=W(a.focusedDate);if(!t)return;let s=null;switch(e.key){case"ArrowLeft":s=new Date(t),s.setDate(t.getDate()-1);break;case"ArrowRight":s=new Date(t),s.setDate(t.getDate()+1);break;case"ArrowUp":s=new Date(t),s.setDate(t.getDate()-7);break;case"ArrowDown":s=new Date(t),s.setDate(t.getDate()+7);break;case"Enter":case" ":e.preventDefault(),this._handleSelect(a.focusedDate);return;case"Escape":this.display==="popover"&&this.close();return;default:return}if(s){e.preventDefault();const i=Z(s);s.getMonth()!==a.viewMonth||s.getFullYear()!==a.viewYear?this._store.set({viewYear:s.getFullYear(),viewMonth:s.getMonth(),focusedDate:i,navDirection:s>t?"next":"prev"}):this._store.set({focusedDate:i}),requestAnimationFrame(()=>{const l=this.$(`[data-date="${i}"]`);l==null||l.focus()})}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}goToMonth(e,a){this._store.set({viewYear:a,viewMonth:e})}_getTimeSlotArray(){return this._timeSlots?this._timeSlots:this.durationLabels?lt(this.timeStartTime,this.timeEndTime,this.timeInterval,this.timeFormat).map(a=>({...a,available:!0})):Ee(this.timeStartTime,this.timeEndTime,this.timeInterval).map(a=>({time:a,available:!0}))}_renderCalendarContent(){const e=this._store.getState(),a=document.createElement("div");if(a.classList.add("cal-picker"),e.statusType&&e.statusMessage&&a.appendChild($e({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()})),this.loading){const l=document.createElement("div");l.classList.add("cal-months");const r=document.createElement("div");if(r.classList.add("cal-month"),r.appendChild(st()),l.appendChild(r),a.appendChild(l),this.timeSlotsEnabled){const o=document.createElement("div");o.classList.add("cal-booking-time-section"),o.appendChild(at({durationLabels:this.durationLabels})),a.appendChild(o)}return a.addEventListener("keydown",o=>this._handleKeydown(o)),a}const t=document.createElement("div");t.classList.add("cal-months");const s=this.hasAttribute("dual"),i=s?2:1;for(let l=0;l<i;l++){const{year:r,month:o}=l===0?{year:e.viewYear,month:e.viewMonth}:pe(e.viewYear,e.viewMonth,1),h=document.createElement("div");if(h.classList.add("cal-month"),l===0&&h.appendChild(Ae({year:r,month:o,onPrev:e.pickingMonth?()=>{}:()=>this._prevMonth(),onNext:e.pickingMonth?()=>{}:()=>{s||this._nextMonth()},onTitleClick:()=>this._toggleMonthPicker()})),l===1&&h.appendChild(Ae({year:r,month:o,onPrev:()=>{},onNext:()=>this._nextMonth()})),e.pickingMonth&&l===0){const c=et({pickerYear:e.pickerYear,viewMonth:e.viewMonth,viewYear:e.viewYear,onMonthSelect:(d,g)=>this._selectMonthFromPicker(d,g),onYearPrev:()=>this._store.set({pickerYear:e.pickerYear-1}),onYearNext:()=>this._store.set({pickerYear:e.pickerYear+1}),onClose:()=>this._store.set({pickingMonth:!1})});h.appendChild(c)}else{const c=e.navDirection==="next"?"cal-animate-slide-left":e.navDirection==="prev"?"cal-animate-slide-right":"",d=Je({year:r,month:o,firstDay:this.firstDay,rangeStart:e.rangeStart,rangeEnd:e.rangeEnd,hoverDate:e.hoverDate,minDate:this.minDate,maxDate:this.maxDate,focusedDate:e.focusedDate,mode:"range",onSelect:g=>this._handleSelect(g),onHover:g=>this._handleHover(g),bookings:this._bookings,dayData:this._dayData,labelFormula:this._labelFormula,showLabelsOnHover:this.showLabelsOnHover});c&&d.classList.add(c),h.appendChild(d)}t.appendChild(h)}if(a.appendChild(t),this.timeSlotsEnabled&&e.timeSelectPhase&&!e.pickingMonth){const l=document.createElement("div");l.classList.add("cal-booking-time-section");const r=document.createElement("div");r.classList.add("cal-booking-time-header"),r.textContent=e.timeSelectPhase==="start"?"Select check-in time":"Select check-out time",l.appendChild(r);const o=this._getTimeSlotArray(),h=ct({slots:o,mode:"single",format:this.timeFormat,selected:e.timeSelectPhase==="end"?e.startTime:null,onSelect:c=>this._handleTimeSelect(c),onHover:()=>{},durationLabels:this.durationLabels});l.appendChild(h),a.appendChild(l)}return a.addEventListener("keydown",l=>this._handleKeydown(l)),a}_formatTriggerText(){const e=this._store.getState();if(e.rangeStart&&e.rangeEnd){let a=`${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}`;return e.startTime&&e.endTime&&(a+=` (${e.startTime} – ${e.endTime})`),a}return null}_formatShortDate(e){const a=W(e);return a?`${se[a.getMonth()].slice(0,3)} ${a.getDate()}, ${a.getFullYear()}`:e}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Bt,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderCalendarContent(),c=Be({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderCalendarContent());this._store.set({navDirection:null}),this._rendering=!1}}const Ft='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>',Nt=`
933
+ `;class bt extends ve{static get styles(){return[Se,Me,Ae,st,ft,nt,lt,Re,Ne,Ye,qt]}static get observedAttributes(){return["theme","display","min-date","max-date","first-day","locale","placeholder","dual","show-labels-on-hover","time-slots","time-start","time-end","time-interval","time-format","duration-labels","loading"]}constructor(){super();const e=new Date;this._store=De({viewYear:e.getFullYear(),viewMonth:e.getMonth(),rangeStart:null,rangeEnd:null,hoverDate:null,isOpen:!1,focusedDate:ue(),navDirection:null,pickingMonth:!1,pickerYear:e.getFullYear(),startTime:null,endTime:null,timeSelectPhase:null,statusType:null,statusMessage:null,statusDismissible:!0}),this._bookings=[],this._dayData={},this._labelFormula=null,this._colors=null,this._customColorMap=null,this._timeSlots=null,this._popover=null,this._unsubscribe=null,this._rendering=!1}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select dates"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get minDate(){return this.getAttribute("min-date")||null}get maxDate(){return this.getAttribute("max-date")||null}get locale(){return this.getAttribute("locale")||void 0}get showLabelsOnHover(){return this.hasAttribute("show-labels-on-hover")}get timeSlotsEnabled(){return this.hasAttribute("time-slots")}get timeStartTime(){return this.getAttribute("time-start")||"09:00"}get timeEndTime(){return this.getAttribute("time-end")||"17:00"}get timeInterval(){return parseInt(this.getAttribute("time-interval")||"60",10)}get timeFormat(){return this.getAttribute("time-format")||"24h"}get durationLabels(){return this.hasAttribute("duration-labels")}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get bookings(){return this._bookings}set bookings(e){this._bookings=Array.isArray(e)?e:[],this._initialized&&this.render()}get dayData(){return this._dayData}set dayData(e){this._dayData=e&&typeof e=="object"?e:{},this._initialized&&this.render()}get labelFormula(){return this._labelFormula}set labelFormula(e){this._labelFormula=typeof e=="function"?e:null,this._initialized&&this.render()}get timeSlots(){return this._timeSlots}set timeSlots(e){this._timeSlots=Array.isArray(e)?e:null,this._initialized&&this.render()}get colors(){return this._colors}set colors(e){if(this._colors=Array.isArray(e)?e:null,this._customColorMap=et(this._colors),this._customColorMap)for(const[a,t]of Object.entries(this._customColorMap))this.style.setProperty(`--cal-booking-${a}-bg`,t.bg),this.style.setProperty(`--cal-booking-${a}-fg`,t.fg),this.style.setProperty(`--cal-booking-${a}-hover`,t.hover);this._initialized&&this.render()}get value(){const e=this._store.getState();if(!e.rangeStart||!e.rangeEnd)return null;const a={start:e.rangeStart,end:e.rangeEnd};return this.timeSlotsEnabled&&(e.startTime&&(a.startTime=e.startTime),e.endTime&&(a.endTime=e.endTime)),a}set value(e){if(e&&typeof e=="object"&&e.start&&e.end){const a=typeof e.start=="string"?e.start:Z(e.start),t=typeof e.end=="string"?e.end:Z(e.end),s={rangeStart:a,rangeEnd:t};e.startTime&&(s.startTime=e.startTime),e.endTime&&(s.endTime=e.endTime),this._store.set(s),this._navigateToDate(a)}else this._store.set({rangeStart:null,rangeEnd:null,startTime:null,endTime:null,timeSelectPhase:null})}_navigateToDate(e){const a=K(e);a&&this._store.set({viewYear:a.getFullYear(),viewMonth:a.getMonth()})}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverDate!==t.hoverDate&&a.viewYear===t.viewYear&&a.viewMonth===t.viewMonth&&a.rangeStart===t.rangeStart&&a.rangeEnd===t.rangeEnd&&a.isOpen===t.isOpen&&a.navDirection===t.navDirection&&a.pickingMonth===t.pickingMonth&&a.pickerYear===t.pickerYear&&a.timeSelectPhase===t.timeSelectPhase?this._updateGridHighlight(a):this.render()});const e=this.getAttribute("bookings");if(e&&!this._bookings.length)try{this._bookings=JSON.parse(e)}catch{}}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){a!==t&&this._initialized&&this.render()}_handleSelect(e){const a=this._store.getState();if(!a.rangeStart||a.rangeEnd)this._store.set({rangeStart:e,rangeEnd:null,hoverDate:null,focusedDate:e,startTime:null,endTime:null,timeSelectPhase:null});else{let t=a.rangeStart,s=e;if(t>s&&([t,s]=[s,t]),!tt(t,s,this._bookings)){this.emit("cal:selection-invalid",{start:t,end:s}),this._store.set({rangeStart:null,rangeEnd:null,hoverDate:null,startTime:null,endTime:null,timeSelectPhase:null}),this.showStatus("error","Selection overlaps an existing booking",{autoDismiss:4e3});return}this.timeSlotsEnabled?this._store.set({rangeStart:t,rangeEnd:s,hoverDate:null,focusedDate:s,timeSelectPhase:"start"}):(this._store.set({rangeStart:t,rangeEnd:s,hoverDate:null,focusedDate:s}),this.emit("cal:change",{value:{start:t,end:s}}),this.display==="popover"&&this.close())}}_handleTimeSelect(e){const a=this._store.getState();if(a.timeSelectPhase==="start")this._store.set({startTime:e,timeSelectPhase:"end"});else if(a.timeSelectPhase==="end"){this._store.set({endTime:e,timeSelectPhase:null});const t={start:a.rangeStart,end:a.rangeEnd,startTime:a.startTime,endTime:e};this.emit("cal:change",{value:t}),this.display==="popover"&&this.close()}}_handleHover(e){this._store.set({hoverDate:e})}_updateGridHighlight(e){const a=this.$$(".cal-day"),{rangeStart:t,hoverDate:s}=e,i=t&&!e.rangeEnd&&s?s:e.rangeEnd;let l=!1;if(t&&!e.rangeEnd&&s){const r=t<s?t:s,o=t<s?s:t;for(const h of this._bookings)if(r<h.end&&o>h.start){l=!0;break}}for(const r of a){const o=r.dataset.date;if(!o)continue;const h=o===t&&!!i,c=o===i&&!!i;let d=!1;if(t&&i){const u=t<i?t:i,g=t<i?i:t;d=o>=u&&o<=g&&!h&&!c}const p=l&&t&&!e.rangeEnd&&s&&(()=>{const u=t<s?t:s,g=t<s?s:t;return o>=u&&o<=g})();r.classList.toggle("cal-day--range-start",h),r.classList.toggle("cal-day--range-end",c),r.classList.toggle("cal-day--in-range",d),r.classList.toggle("cal-day--invalid-range",!!p)}}_prevMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,-1);this._store.set({viewYear:t,viewMonth:s,navDirection:"prev"}),this.emit("cal:month-change",{year:t,month:s})}_nextMonth(){const{viewYear:e,viewMonth:a}=this._store.getState(),{year:t,month:s}=pe(e,a,1);this._store.set({viewYear:t,viewMonth:s,navDirection:"next"}),this.emit("cal:month-change",{year:t,month:s})}_toggleMonthPicker(){const e=this._store.getState();this._store.set({pickingMonth:!e.pickingMonth,pickerYear:e.viewYear})}_selectMonthFromPicker(e,a){this._store.set({viewYear:a,viewMonth:e,pickingMonth:!1}),this.emit("cal:month-change",{year:a,month:e})}_handleKeydown(e){if(e.key==="Escape"&&this._store.get("pickingMonth")){e.stopPropagation(),this._store.set({pickingMonth:!1});return}const a=this._store.getState(),t=K(a.focusedDate);if(!t)return;let s=null;switch(e.key){case"ArrowLeft":s=new Date(t),s.setDate(t.getDate()-1);break;case"ArrowRight":s=new Date(t),s.setDate(t.getDate()+1);break;case"ArrowUp":s=new Date(t),s.setDate(t.getDate()-7);break;case"ArrowDown":s=new Date(t),s.setDate(t.getDate()+7);break;case"Enter":case" ":e.preventDefault(),this._handleSelect(a.focusedDate);return;case"Escape":this.display==="popover"&&this.close();return;default:return}if(s){e.preventDefault();const i=Z(s);s.getMonth()!==a.viewMonth||s.getFullYear()!==a.viewYear?this._store.set({viewYear:s.getFullYear(),viewMonth:s.getMonth(),focusedDate:i,navDirection:s>t?"next":"prev"}):this._store.set({focusedDate:i}),requestAnimationFrame(()=>{const l=this.$(`[data-date="${i}"]`);l==null||l.focus()})}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}goToMonth(e,a){this._store.set({viewYear:a,viewMonth:e})}clear(){this._store.set({rangeStart:null,rangeEnd:null,hoverDate:null,startTime:null,endTime:null,timeSelectPhase:null}),this.emit("cal:change",{value:null})}_getTimeSlotArray(){return this._timeSlots?this._timeSlots:this.durationLabels?ut(this.timeStartTime,this.timeEndTime,this.timeInterval,this.timeFormat).map(a=>({...a,available:!0})):Ee(this.timeStartTime,this.timeEndTime,this.timeInterval).map(a=>({time:a,available:!0}))}_renderCalendarContent(){const e=this._store.getState(),a=document.createElement("div");if(a.classList.add("cal-picker"),e.statusType&&e.statusMessage&&a.appendChild(Ie({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()})),this.loading){const l=document.createElement("div");l.classList.add("cal-months");const r=document.createElement("div");if(r.classList.add("cal-month"),r.appendChild(ct()),l.appendChild(r),a.appendChild(l),this.timeSlotsEnabled){const o=document.createElement("div");o.classList.add("cal-booking-time-section"),o.appendChild(ot({durationLabels:this.durationLabels})),a.appendChild(o)}return a.addEventListener("keydown",o=>this._handleKeydown(o)),a}const t=document.createElement("div");t.classList.add("cal-months");const s=this.hasAttribute("dual"),i=s?2:1;for(let l=0;l<i;l++){const{year:r,month:o}=l===0?{year:e.viewYear,month:e.viewMonth}:pe(e.viewYear,e.viewMonth,1),h=document.createElement("div");if(h.classList.add("cal-month"),l===0&&h.appendChild($e({year:r,month:o,onPrev:e.pickingMonth?()=>{}:()=>this._prevMonth(),onNext:e.pickingMonth?()=>{}:()=>{s||this._nextMonth()},onTitleClick:()=>this._toggleMonthPicker(),locale:this.locale})),l===1&&h.appendChild($e({year:r,month:o,onPrev:()=>{},onNext:()=>this._nextMonth(),locale:this.locale})),e.pickingMonth&&l===0){const c=it({pickerYear:e.pickerYear,viewMonth:e.viewMonth,viewYear:e.viewYear,onMonthSelect:(d,p)=>this._selectMonthFromPicker(d,p),onYearPrev:()=>this._store.set({pickerYear:e.pickerYear-1}),onYearNext:()=>this._store.set({pickerYear:e.pickerYear+1}),onClose:()=>this._store.set({pickingMonth:!1}),locale:this.locale});h.appendChild(c)}else{const c=e.navDirection==="next"?"cal-animate-slide-left":e.navDirection==="prev"?"cal-animate-slide-right":"",d=at({year:r,month:o,firstDay:this.firstDay,rangeStart:e.rangeStart,rangeEnd:e.rangeEnd,hoverDate:e.hoverDate,minDate:this.minDate,maxDate:this.maxDate,focusedDate:e.focusedDate,mode:"range",onSelect:p=>this._handleSelect(p),onHover:p=>this._handleHover(p),bookings:this._bookings,dayData:this._dayData,labelFormula:this._labelFormula,showLabelsOnHover:this.showLabelsOnHover,locale:this.locale,customColors:this._customColorMap});c&&d.classList.add(c),h.appendChild(d)}t.appendChild(h)}if(a.appendChild(t),this.timeSlotsEnabled&&e.timeSelectPhase&&!e.pickingMonth){const l=document.createElement("div");l.classList.add("cal-booking-time-section");const r=document.createElement("div");r.classList.add("cal-booking-time-header"),r.textContent=e.timeSelectPhase==="start"?"Select check-in time":"Select check-out time",l.appendChild(r);const o=this._getTimeSlotArray(),h=mt({slots:o,mode:"single",format:this.timeFormat,selected:e.timeSelectPhase==="end"?e.startTime:null,onSelect:c=>this._handleTimeSelect(c),onHover:()=>{},durationLabels:this.durationLabels});l.appendChild(h),a.appendChild(l)}return a.addEventListener("keydown",l=>this._handleKeydown(l)),a}_formatTriggerText(){const e=this._store.getState();if(e.rangeStart&&e.rangeEnd){let a=`${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}`;return e.startTime&&e.endTime&&(a+=` (${e.startTime} – ${e.endTime})`),a}return null}_formatShortDate(e){const a=K(e);if(!a)return e;if(this.locale)try{return new Intl.DateTimeFormat(this.locale,{month:"short",day:"numeric",year:"numeric"}).format(a)}catch{}return`${Be(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Nt,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderCalendarContent(),c=je({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderCalendarContent());this._store.set({navDirection:null}),this._rendering=!1}}const Wt='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>',Xt=`
934
934
  .cal-timepicker {
935
935
  background: hsl(var(--cal-bg));
936
936
  border-radius: var(--cal-radius);
@@ -950,7 +950,7 @@
950
950
  margin-bottom: 8px;
951
951
  padding: 0 4px;
952
952
  }
953
- `;class ut extends be{static get styles(){return[Se,Te,Me,dt,Oe,Fe,ze,Nt]}static get observedAttributes(){return["mode","display","theme","start-time","end-time","interval","format","placeholder","value","duration-labels","loading"]}constructor(){super(),this._store=De({selected:null,rangeStart:null,hoverTime:null,isOpen:!1,statusType:null,statusMessage:null,statusDismissible:!0}),this._slots=null,this._unavailableTimes=[],this._popover=null,this._unsubscribe=null,this._rendering=!1}get mode(){return this.getAttribute("mode")||"single"}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select time"}get startTime(){return this.getAttribute("start-time")||"09:00"}get endTime(){return this.getAttribute("end-time")||"17:00"}get interval(){return parseInt(this.getAttribute("interval")||"30",10)}get format(){return this.getAttribute("format")||"24h"}get durationLabels(){return this.hasAttribute("duration-labels")}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get slots(){return this._slots}set slots(e){this._slots=Array.isArray(e)?e:null,this._initialized&&this.render()}get unavailableTimes(){return this._unavailableTimes}set unavailableTimes(e){this._unavailableTimes=Array.isArray(e)?e:[],this._initialized&&this.render()}get value(){return this._store.getState().selected}set value(e){this.mode==="single"&&typeof e=="string"?this._store.set({selected:e,rangeStart:null}):this.mode==="multi"&&Array.isArray(e)?this._store.set({selected:[...e].sort((a,t)=>b(a)-b(t)),rangeStart:null}):this.mode==="range"&&e&&typeof e=="object"?this._store.set({selected:{start:e.start,end:e.end},rangeStart:null}):this._store.set({selected:null,rangeStart:null})}_getEffectiveSlots(){return this._slots?this._slots:this.durationLabels?lt(this.startTime,this.endTime,this.interval,this.format).map(t=>({...t,available:!this._unavailableTimes.includes(t.time)})):Ee(this.startTime,this.endTime,this.interval).map(a=>({time:a,available:!this._unavailableTimes.includes(a)}))}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverTime!==t.hoverTime&&a.selected===t.selected&&a.rangeStart===t.rangeStart&&a.isOpen===t.isOpen?this._updateSlotHighlight(a):this.render()});const e=this.getAttribute("value");if(e)if(this.mode==="multi"&&e.includes(","))this.value=e.split(",").map(a=>a.trim());else if(this.mode==="range"&&e.includes("/")){const[a,t]=e.split("/");this.value={start:a.trim(),end:t.trim()}}else this.value=e}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="value"&&this._initialized)if(this.mode==="multi"&&t&&t.includes(","))this.value=t.split(",").map(s=>s.trim());else if(this.mode==="range"&&t&&t.includes("/")){const[s,i]=t.split("/");this.value={start:s.trim(),end:i.trim()}}else this.value=t;this._initialized&&this.render()}}_handleSelect(e){const a=this._store.getState();if(this.mode==="single")this._store.set({selected:e}),this.emit("cal:time-change",{value:e}),this.display==="popover"&&this.close();else if(this.mode==="multi"){const t=Array.isArray(a.selected)?[...a.selected]:[],s=t.indexOf(e);s>=0?t.splice(s,1):t.push(e),t.sort((i,l)=>b(i)-b(l)),this._store.set({selected:t}),this.emit("cal:time-change",{value:t})}else if(this.mode==="range")if(!a.rangeStart||a.selected&&typeof a.selected=="object"&&a.selected.start&&a.selected.end)this._store.set({rangeStart:e,selected:null,hoverTime:null});else{let t=a.rangeStart,s=e;b(t)>b(s)&&([t,s]=[s,t]);const i={start:t,end:s};this._store.set({selected:i,rangeStart:null,hoverTime:null}),this.emit("cal:time-change",{value:i}),this.display==="popover"&&this.close()}}_handleHover(e){this.mode==="range"&&this._store.set({hoverTime:e})}_updateSlotHighlight(e){const a=this.$$(".cal-time-slot"),{rangeStart:t,hoverTime:s,selected:i}=e,l=i&&typeof i=="object"&&i.start&&i.end;for(const r of a){const o=r.dataset.time;if(!(!o||r.disabled))if(t&&!l&&s){const h=b(t)<b(s)?t:s,c=b(t)<b(s)?s:t,d=b(o),g=d>b(h)&&d<b(c),u=o===t,p=o===s;r.classList.toggle("cal-time-slot--range-start",u),r.classList.toggle("cal-time-slot--range-end",p),r.classList.toggle("cal-time-slot--in-range",g)}else t||r.classList.remove("cal-time-slot--range-start","cal-time-slot--range-end","cal-time-slot--in-range")}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}_renderTimepickerContent(){const e=this._store.getState(),a=document.createElement("div");a.classList.add("cal-timepicker"),e.statusType&&e.statusMessage&&a.appendChild($e({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()}));const t=document.createElement("div");if(t.classList.add("cal-timepicker__header"),t.textContent="Select Time",a.appendChild(t),this.loading)a.appendChild(at({durationLabels:this.durationLabels}));else{const s=this._getEffectiveSlots(),i=ct({slots:s,mode:this.mode,format:this.format,selected:e.selected,hoverTime:e.hoverTime,rangeStart:e.rangeStart,unavailableTimes:this._unavailableTimes,onSelect:l=>this._handleSelect(l),onHover:l=>this._handleHover(l),durationLabels:this.durationLabels});a.appendChild(i)}return a}_formatTriggerText(){const e=this._store.getState();return e.selected?this.mode==="single"&&typeof e.selected=="string"?e.selected:this.mode==="multi"&&Array.isArray(e.selected)&&e.selected.length?`${e.selected.length} time${e.selected.length>1?"s":""} selected`:this.mode==="range"&&typeof e.selected=="object"&&e.selected.start?`${e.selected.start} – ${e.selected.end}`:null:null}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Ft,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderTimepickerContent(),c=Be({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderTimepickerContent());this._rendering=!1}}function Rt(n,e=0){const a=W(n);if(!a)return n;const s=(a.getDay()-e+7)%7;return a.setDate(a.getDate()-s),Z(a)}function Ne(n,e=0){const a=Rt(n,e),t=[];for(let s=0;s<7;s++)t.push(ye(a,s));return t}function jt(n,e,a){const t=W(e);if(!t)return"";if(n==="day")return`${se[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`;if(n==="week"&&a&&a.length===7){const s=W(a[0]),i=W(a[6]);return!s||!i?"":s.getMonth()===i.getMonth()?`${se[s.getMonth()]} ${s.getDate()}–${i.getDate()}, ${s.getFullYear()}`:s.getFullYear()===i.getFullYear()?`${se[s.getMonth()].slice(0,3)} ${s.getDate()} – ${se[i.getMonth()].slice(0,3)} ${i.getDate()}, ${s.getFullYear()}`:`${se[s.getMonth()].slice(0,3)} ${s.getDate()}, ${s.getFullYear()} – ${se[i.getMonth()].slice(0,3)} ${i.getDate()}, ${i.getFullYear()}`}return n==="month"?`${se[t.getMonth()]} ${t.getFullYear()}`:""}function Le(n,e){return n.filter(a=>a.start?a.end&&a.end!==a.start?e>=a.start&&e<=a.end:a.start===e:!1)}function Ye(n){if(!n.length)return n;const e=[...n].sort((t,s)=>{const i=b(t.startTime||"00:00"),l=b(s.startTime||"00:00");if(i!==l)return i-l;const r=b(t.endTime||"23:59");return b(s.endTime||"23:59")-l-(r-i)}),a=[];for(const t of e){const s=b(t.startTime||"00:00"),i=b(t.endTime||"23:59");let l=!1;for(let r=0;r<a.length;r++)if(s>=a[r]){t._col=r,a[r]=i,l=!0;break}l||(t._col=a.length,a.push(i))}for(const t of e){const s=b(t.startTime||"00:00"),i=b(t.endTime||"23:59");let l=t._col;for(const r of e){const o=b(r.startTime||"00:00"),h=b(r.endTime||"23:59");o<i&&h>s&&(l=Math.max(l,r._col))}t._totalCols=l+1}return e}function ge(n,e,a,t){return(b(n)-b(e))/t*a}function pt(n,e,a,t){const s=n/a*t,i=b(e)+s;return le(Math.round(i))}function gt(n,e){const a=b(n),t=Math.round(a/e)*e;return le(t)}function qt(n,e,a){return Le(n,a).filter(t=>t.resourceId===e)}function mt(n,e,a,t,s){const i=qt(n,e,a),l=b(t),r=b(s);for(const o of i){if(!o.startTime||!o.endTime)continue;const h=b(o.startTime),c=b(o.endTime);if(l<c&&r>h)return!1}return!0}function Wt(n,e,a,t,s="08:00",i="18:00"){const{duration:l,resourceId:r,minCapacity:o}=n,h=n.date||ue(),c=14;let d=e;r&&(d=e.filter(p=>p.id===r)),o&&(d=d.filter(p=>p.capacity&&p.capacity>=o));const g=b(s),u=b(i);for(let p=0;p<c;p++){const _=ye(h,p);for(const m of d)for(let v=g;v+l<=u;v+=t){const C=le(v),k=le(v+l);if(mt(a,m.id,_,C,k))return{resourceId:m.id,date:_,startTime:C,endTime:k}}}return null}function Xt({title:n,view:e,onPrev:a,onNext:t,onToday:s,onViewChange:i}){const l=document.createElement("div");l.classList.add("cal-sched-nav");const r=document.createElement("div");r.classList.add("cal-sched-nav__left");const o=document.createElement("button");o.classList.add("cal-sched-nav__btn"),o.innerHTML=Pe,o.setAttribute("aria-label","Previous"),o.addEventListener("click",a);const h=document.createElement("button");h.classList.add("cal-sched-nav__btn"),h.innerHTML=He,h.setAttribute("aria-label","Next"),h.addEventListener("click",t);const c=document.createElement("button");c.classList.add("cal-sched-nav__today"),c.textContent="Today",c.addEventListener("click",s);const d=document.createElement("span");d.classList.add("cal-sched-nav__title"),d.setAttribute("aria-live","polite"),d.textContent=n,r.appendChild(o),r.appendChild(h),r.appendChild(c),r.appendChild(d);const g=document.createElement("div");g.classList.add("cal-sched-nav__tabs");for(const u of["day","week","month"]){const p=document.createElement("button");p.classList.add("cal-sched-nav__tab"),u===e&&p.classList.add("cal-sched-nav__tab--active"),p.textContent=u.charAt(0).toUpperCase()+u.slice(1),p.addEventListener("click",()=>i(u)),g.appendChild(p)}return l.appendChild(r),l.appendChild(g),l}const Gt=`
953
+ `;class vt extends ve{static get styles(){return[Se,Me,Ae,ft,Re,Ne,Ye,Xt]}static get observedAttributes(){return["mode","display","theme","start-time","end-time","interval","format","placeholder","value","duration-labels","loading","locale","min-time"]}constructor(){super(),this._store=De({selected:null,rangeStart:null,hoverTime:null,isOpen:!1,statusType:null,statusMessage:null,statusDismissible:!0}),this._slots=null,this._unavailableTimes=[],this._popover=null,this._unsubscribe=null,this._rendering=!1}get mode(){return this.getAttribute("mode")||"single"}get display(){return this.getAttribute("display")||"inline"}get placeholder(){return this.getAttribute("placeholder")||"Select time"}get startTime(){return this.getAttribute("start-time")||"09:00"}get endTime(){return this.getAttribute("end-time")||"17:00"}get interval(){return parseInt(this.getAttribute("interval")||"30",10)}get format(){return this.getAttribute("format")||"24h"}get durationLabels(){return this.hasAttribute("duration-labels")}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get locale(){return this.getAttribute("locale")||void 0}get minTime(){return this.getAttribute("min-time")||null}get slots(){return this._slots}set slots(e){this._slots=Array.isArray(e)?e:null,this._initialized&&this.render()}get unavailableTimes(){return this._unavailableTimes}set unavailableTimes(e){this._unavailableTimes=Array.isArray(e)?e:[],this._initialized&&this.render()}get value(){return this._store.getState().selected}set value(e){this.mode==="single"&&typeof e=="string"?this._store.set({selected:e,rangeStart:null}):this.mode==="multi"&&Array.isArray(e)?this._store.set({selected:[...e].sort((a,t)=>_(a)-_(t)),rangeStart:null}):this.mode==="range"&&e&&typeof e=="object"?this._store.set({selected:{start:e.start,end:e.end},rangeStart:null}):this._store.set({selected:null,rangeStart:null})}_getEffectiveSlots(){let e;this._slots?e=this._slots:this.durationLabels?e=ut(this.startTime,this.endTime,this.interval,this.format).map(s=>({...s,available:!this._unavailableTimes.includes(s.time)})):e=Ee(this.startTime,this.endTime,this.interval).map(s=>({time:s,available:!this._unavailableTimes.includes(s)}));const a=this.minTime;if(a){const t=_(a);e=e.map(s=>{const i=typeof s=="string"?s:s.time;return _(i)<t?typeof s=="string"?{time:s,available:!1}:{...s,available:!1}:s})}return e}connectedCallback(){super.connectedCallback(),this._unsubscribe=this._store.subscribe((a,t)=>{if(this._rendering)return;a.hoverTime!==t.hoverTime&&a.selected===t.selected&&a.rangeStart===t.rangeStart&&a.isOpen===t.isOpen?this._updateSlotHighlight(a):this.render()});const e=this.getAttribute("value");if(e)if(this.mode==="multi"&&e.includes(","))this.value=e.split(",").map(a=>a.trim());else if(this.mode==="range"&&e.includes("/")){const[a,t]=e.split("/");this.value={start:a.trim(),end:t.trim()}}else this.value=e}disconnectedCallback(){var e,a;(e=this._unsubscribe)==null||e.call(this),(a=this._popover)==null||a.destroy(),clearTimeout(this._statusTimer)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="value"&&this._initialized)if(this.mode==="multi"&&t&&t.includes(","))this.value=t.split(",").map(s=>s.trim());else if(this.mode==="range"&&t&&t.includes("/")){const[s,i]=t.split("/");this.value={start:s.trim(),end:i.trim()}}else this.value=t;this._initialized&&this.render()}}_handleSelect(e){const a=this._store.getState();if(this.mode==="single")this._store.set({selected:e}),this.emit("cal:time-change",{value:e}),this.display==="popover"&&this.close();else if(this.mode==="multi"){const t=Array.isArray(a.selected)?[...a.selected]:[],s=t.indexOf(e);s>=0?t.splice(s,1):t.push(e),t.sort((i,l)=>_(i)-_(l)),this._store.set({selected:t}),this.emit("cal:time-change",{value:t})}else if(this.mode==="range")if(!a.rangeStart||a.selected&&typeof a.selected=="object"&&a.selected.start&&a.selected.end)this._store.set({rangeStart:e,selected:null,hoverTime:null});else{let t=a.rangeStart,s=e;_(t)>_(s)&&([t,s]=[s,t]);const i={start:t,end:s};this._store.set({selected:i,rangeStart:null,hoverTime:null}),this.emit("cal:time-change",{value:i}),this.display==="popover"&&this.close()}}_handleHover(e){this.mode==="range"&&this._store.set({hoverTime:e})}_updateSlotHighlight(e){const a=this.$$(".cal-time-slot"),{rangeStart:t,hoverTime:s,selected:i}=e,l=i&&typeof i=="object"&&i.start&&i.end;for(const r of a){const o=r.dataset.time;if(!(!o||r.disabled))if(t&&!l&&s){const h=_(t)<_(s)?t:s,c=_(t)<_(s)?s:t,d=_(o),p=d>_(h)&&d<_(c),u=o===t,g=o===s;r.classList.toggle("cal-time-slot--range-start",u),r.classList.toggle("cal-time-slot--range-end",g),r.classList.toggle("cal-time-slot--in-range",p)}else t||r.classList.remove("cal-time-slot--range-start","cal-time-slot--range-end","cal-time-slot--in-range")}}open(){this._popover&&(this._popover.open(),this._store.set({isOpen:!0}),this.emit("cal:open"))}close(){this._popover&&(this._popover.close(),this._store.set({isOpen:!1}),this.emit("cal:close"))}clear(){this._store.set({selected:null,rangeStart:null,hoverTime:null}),this.emit("cal:time-change",{value:null})}_renderTimepickerContent(){const e=this._store.getState(),a=document.createElement("div");a.classList.add("cal-timepicker"),e.statusType&&e.statusMessage&&a.appendChild(Ie({type:e.statusType,message:e.statusMessage,dismissible:e.statusDismissible,onDismiss:()=>this.clearStatus()}));const t=document.createElement("div");if(t.classList.add("cal-timepicker__header"),t.textContent="Select Time",a.appendChild(t),this.loading)a.appendChild(ot({durationLabels:this.durationLabels}));else{const s=this._getEffectiveSlots(),i=mt({slots:s,mode:this.mode,format:this.format,selected:e.selected,hoverTime:e.hoverTime,rangeStart:e.rangeStart,unavailableTimes:this._unavailableTimes,onSelect:l=>this._handleSelect(l),onHover:l=>this._handleHover(l),durationLabels:this.durationLabels});a.appendChild(i)}return a}_formatTriggerText(){const e=this._store.getState();return e.selected?this.mode==="single"&&typeof e.selected=="string"?e.selected:this.mode==="multi"&&Array.isArray(e.selected)&&e.selected.length?`${e.selected.length} time${e.selected.length>1?"s":""} selected`:this.mode==="range"&&typeof e.selected=="object"&&e.selected.start?`${e.selected.start} – ${e.selected.end}`:null:null}render(){var t;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const s of a)s.nodeName!=="STYLE"&&!(s instanceof CSSStyleSheet)&&e.removeChild(s);if((t=this._popover)==null||t.destroy(),this._popover=null,this.display==="popover"){const s=document.createElement("div");s.classList.add("cal-popover-wrapper");const i=document.createElement("button");i.classList.add("cal-trigger");const l=document.createElement("span");l.classList.add("cal-trigger__icon"),l.innerHTML=Wt,i.appendChild(l);const r=this._formatTriggerText(),o=document.createElement("span");r?o.textContent=r:(o.textContent=this.placeholder,o.classList.add("cal-trigger--placeholder")),i.appendChild(o),s.appendChild(i);const h=this._renderTimepickerContent(),c=je({trigger:i,content:h,onClose:()=>{this._store.set({isOpen:!1}),this.emit("cal:close")}});s.appendChild(c.panel),e.appendChild(s),i.addEventListener("click",d=>{d.stopPropagation(),c.isOpen?this.close():this.open()}),this._popover=c,this._store.get("isOpen")&&c.open()}else e.appendChild(this._renderTimepickerContent());this._rendering=!1}}function Gt(n,e=0){const a=K(n);if(!a)return n;const s=(a.getDay()-e+7)%7;return a.setDate(a.getDate()-s),Z(a)}function qe(n,e=0){const a=Gt(n,e),t=[];for(let s=0;s<7;s++)t.push(ye(a,s));return t}function Kt(n,e,a,t){const s=K(e);if(!s)return"";const i=Ke(t);if(n==="day")return`${i[s.getMonth()]} ${s.getDate()}, ${s.getFullYear()}`;if(n==="week"&&a&&a.length===7){const l=K(a[0]),r=K(a[6]);return!l||!r?"":l.getMonth()===r.getMonth()?`${i[l.getMonth()]} ${l.getDate()}–${r.getDate()}, ${l.getFullYear()}`:l.getFullYear()===r.getFullYear()?`${i[l.getMonth()].slice(0,3)} ${l.getDate()} – ${i[r.getMonth()].slice(0,3)} ${r.getDate()}, ${l.getFullYear()}`:`${i[l.getMonth()].slice(0,3)} ${l.getDate()}, ${l.getFullYear()} – ${i[r.getMonth()].slice(0,3)} ${r.getDate()}, ${r.getFullYear()}`}return n==="month"?`${i[s.getMonth()]} ${s.getFullYear()}`:""}function Le(n,e){return n.filter(a=>a.start?a.end&&a.end!==a.start?e>=a.start&&e<=a.end:a.start===e:!1)}function Pe(n){if(!n.length)return n;const e=[...n].sort((t,s)=>{const i=_(t.startTime||"00:00"),l=_(s.startTime||"00:00");if(i!==l)return i-l;const r=_(t.endTime||"23:59");return _(s.endTime||"23:59")-l-(r-i)}),a=[];for(const t of e){const s=_(t.startTime||"00:00"),i=_(t.endTime||"23:59");let l=!1;for(let r=0;r<a.length;r++)if(s>=a[r]){t._col=r,a[r]=i,l=!0;break}l||(t._col=a.length,a.push(i))}for(const t of e){const s=_(t.startTime||"00:00"),i=_(t.endTime||"23:59");let l=t._col;for(const r of e){const o=_(r.startTime||"00:00"),h=_(r.endTime||"23:59");o<i&&h>s&&(l=Math.max(l,r._col))}t._totalCols=l+1}return e}function ge(n,e,a,t){return(_(n)-_(e))/t*a}function _t(n,e,a,t){const s=n/a*t,i=_(e)+s;return ie(Math.round(i))}function yt(n,e){const a=_(n),t=Math.round(a/e)*e;return ie(t)}function Ut(n,e,a){return Le(n,a).filter(t=>t.resourceId===e)}function xt(n,e,a,t,s){const i=Ut(n,e,a),l=_(t),r=_(s);for(const o of i){if(!o.startTime||!o.endTime)continue;const h=_(o.startTime),c=_(o.endTime);if(l<c&&r>h)return!1}return!0}function Jt(n,e,a,t,s="08:00",i="18:00"){const{duration:l,resourceId:r,minCapacity:o}=n,h=n.date||ue(),c=14;let d=e;r&&(d=e.filter(g=>g.id===r)),o&&(d=d.filter(g=>g.capacity&&g.capacity>=o));const p=_(s),u=_(i);for(let g=0;g<c;g++){const f=ye(h,g);for(const m of d)for(let b=p;b+l<=u;b+=t){const y=ie(b),w=ie(b+l);if(xt(a,m.id,f,y,w))return{resourceId:m.id,date:f,startTime:y,endTime:w}}}return null}function Vt({title:n,view:e,onPrev:a,onNext:t,onToday:s,onViewChange:i,locale:l}){const r=document.createElement("div");r.classList.add("cal-sched-nav");const o=document.createElement("div");o.classList.add("cal-sched-nav__left");const h=document.createElement("button");h.classList.add("cal-sched-nav__btn"),h.innerHTML=Oe,h.setAttribute("aria-label","Previous"),h.addEventListener("click",a);const c=document.createElement("button");c.classList.add("cal-sched-nav__btn"),c.innerHTML=Fe,c.setAttribute("aria-label","Next"),c.addEventListener("click",t);let d="Today";if(l)try{const y=new Intl.RelativeTimeFormat(l,{numeric:"auto"}).formatToParts(0,"day").map(w=>w.value).join("");d=y.charAt(0).toUpperCase()+y.slice(1)}catch{}const p=document.createElement("button");p.classList.add("cal-sched-nav__today"),p.textContent=d,p.addEventListener("click",s);const u=document.createElement("span");u.classList.add("cal-sched-nav__title"),u.setAttribute("aria-live","polite"),u.textContent=n,o.appendChild(h),o.appendChild(c),o.appendChild(p),o.appendChild(u);const g=document.createElement("div");g.classList.add("cal-sched-nav__tabs");const f={day:"Day",week:"Week",month:"Month"};if(l)try{const m=new Intl.DisplayNames(l,{type:"dateTimeField"});for(const b of["day","week","month"]){const y=m.of(b);y&&(f[b]=y.charAt(0).toUpperCase()+y.slice(1))}}catch{}for(const m of["day","week","month"]){const b=document.createElement("button");b.classList.add("cal-sched-nav__tab"),m===e&&b.classList.add("cal-sched-nav__tab--active"),b.textContent=f[m],b.addEventListener("click",()=>i(m)),g.appendChild(b)}return r.appendChild(o),r.appendChild(g),r}const Zt=`
954
954
  .cal-sched-nav {
955
955
  display: flex;
956
956
  align-items: center;
@@ -1038,7 +1038,7 @@
1038
1038
  background: hsl(var(--cal-accent));
1039
1039
  color: hsl(var(--cal-accent-fg));
1040
1040
  }
1041
- `;function ft({startTime:n,endTime:e,interval:a,slotHeight:t,format:s}){const i=document.createElement("div");i.classList.add("cal-sched-time-axis");const l=Ee(n,e,a);for(let r=0;r<l.length;r++){const o=l[r],h=ie(o);if(!h)continue;const c=document.createElement("div");if(c.classList.add("cal-sched-time-axis__slot"),c.style.height=`${t}px`,h.minutes===0){const d=document.createElement("span");d.classList.add("cal-sched-time-axis__label"),d.textContent=oe(h.hours,h.minutes,s),c.appendChild(d)}i.appendChild(c)}return i}const Kt=`
1041
+ `;function kt({startTime:n,endTime:e,interval:a,slotHeight:t,format:s}){const i=document.createElement("div");i.classList.add("cal-sched-time-axis");const l=Ee(n,e,a);for(let r=0;r<l.length;r++){const o=l[r],h=ne(o);if(!h)continue;const c=document.createElement("div");if(c.classList.add("cal-sched-time-axis__slot"),c.style.height=`${t}px`,h.minutes===0){const d=document.createElement("span");d.classList.add("cal-sched-time-axis__label"),d.textContent=oe(h.hours,h.minutes,s),c.appendChild(d)}i.appendChild(c)}return i}const Qt=`
1042
1042
  .cal-sched-time-axis {
1043
1043
  display: flex;
1044
1044
  flex-direction: column;
@@ -1063,7 +1063,7 @@
1063
1063
  white-space: nowrap;
1064
1064
  user-select: none;
1065
1065
  }
1066
- `;function Ut({resource:n,width:e}){const a=document.createElement("div");a.classList.add("cal-sched-resource-header"),e&&(a.style.width=`${e}px`),a.style.flex=e?`0 0 ${e}px`:"1 1 0";const t=document.createElement("span");t.classList.add("cal-sched-resource-header__dot");const s=n.color||"blue";t.style.background=`hsl(var(--cal-booking-${s}-fg))`,a.appendChild(t);const i=document.createElement("span");if(i.classList.add("cal-sched-resource-header__name"),i.textContent=n.name,a.appendChild(i),n.capacity){const l=document.createElement("span");l.classList.add("cal-sched-resource-header__capacity"),l.textContent=n.capacity,l.setAttribute("title",`Capacity: ${n.capacity}`),a.appendChild(l)}return a}function Vt({resources:n}){const e=document.createElement("div");e.classList.add("cal-sched-resource-header-row");for(const a of n)e.appendChild(Ut({resource:a}));return e}const Jt=`
1066
+ `;function ea({resource:n,width:e}){const a=document.createElement("div");a.classList.add("cal-sched-resource-header"),e&&(a.style.width=`${e}px`),a.style.flex=e?`0 0 ${e}px`:"1 1 0";const t=document.createElement("span");t.classList.add("cal-sched-resource-header__dot");const s=n.color||"blue";t.style.background=`hsl(var(--cal-booking-${s}-fg))`,a.appendChild(t);const i=document.createElement("span");if(i.classList.add("cal-sched-resource-header__name"),i.textContent=n.name,a.appendChild(i),n.capacity){const l=document.createElement("span");l.classList.add("cal-sched-resource-header__capacity"),l.textContent=n.capacity,l.setAttribute("title",`Capacity: ${n.capacity}`),a.appendChild(l)}return a}function ta({resources:n}){const e=document.createElement("div");e.classList.add("cal-sched-resource-header-row");for(const a of n)e.appendChild(ea({resource:a}));return e}const aa=`
1067
1067
  .cal-sched-resource-header-row {
1068
1068
  display: flex;
1069
1069
  border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
@@ -1107,7 +1107,7 @@
1107
1107
  border-radius: 999px;
1108
1108
  flex-shrink: 0;
1109
1109
  }
1110
- `;function Ie({event:n,gridStartTime:e,slotHeight:a,interval:t,format:s,onClick:i,eventContent:l,showTime:r=!0,resource:o,draggable:h}){const c=document.createElement("div");c.classList.add("cal-sched-event"),c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.dataset.eventId=n.id;const d=!!n.locked;h&&!d&&(c.dataset.draggable="true"),d&&c.classList.add("cal-sched-event--locked");const g=n.color||"blue";if(c.style.setProperty("--ev-bg",`var(--cal-booking-${g}-bg)`),c.style.setProperty("--ev-fg",`var(--cal-booking-${g}-fg)`),n.startTime&&n.endTime){const u=ge(n.startTime,e,a,t),p=ge(n.endTime,e,a,t),_=Math.max(p-u,a*.5);if(c.style.top=`${u}px`,c.style.height=`${_}px`,n._totalCols>1){const m=100/n._totalCols;c.style.left=`${n._col*m}%`,c.style.width=`${m}%`}}if(typeof l=="function"){const u=l(n,o),p=document.createElement("div");p.classList.add("cal-sched-event__custom"),u instanceof HTMLElement?p.appendChild(u):u!=null&&(p.textContent=String(u)),c.appendChild(p)}else{const u=document.createElement("div");if(u.classList.add("cal-sched-event__title"),u.textContent=n.title||"",c.appendChild(u),r&&n.startTime&&n.endTime){const p=document.createElement("div");p.classList.add("cal-sched-event__time");const _=ie(n.startTime),m=ie(n.endTime);_&&m&&(p.textContent=`${oe(_.hours,_.minutes,s)}–${oe(m.hours,m.minutes,s)}`),c.appendChild(p)}}if(h&&!d){const u=document.createElement("div");u.classList.add("cal-sched-event__resize-handle"),c.appendChild(u)}return i&&(c.addEventListener("click",u=>{if(c.dataset.wasDragged){delete c.dataset.wasDragged;return}u.stopPropagation(),i(n)}),c.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i(n))})),c}function vt({event:n,onClick:e,eventContent:a,resource:t}){const s=document.createElement("div");s.classList.add("cal-sched-allday-chip"),s.dataset.eventId=n.id;const i=n.color||"blue";if(s.style.setProperty("--ev-bg",`var(--cal-booking-${i}-bg)`),s.style.setProperty("--ev-fg",`var(--cal-booking-${i}-fg)`),typeof a=="function"){const l=a(n,t);l instanceof HTMLElement?s.appendChild(l):l!=null&&(s.textContent=String(l))}else s.textContent=n.title||"";return e&&s.addEventListener("click",l=>{l.stopPropagation(),e(n)}),s}function Zt({event:n,format:e,onClick:a,eventContent:t,resource:s}){const i=document.createElement("div");i.classList.add("cal-sched-month-chip"),i.dataset.eventId=n.id;const l=n.color||"blue";if(i.style.setProperty("--ev-bg",`var(--cal-booking-${l}-bg)`),i.style.setProperty("--ev-fg",`var(--cal-booking-${l}-fg)`),typeof t=="function"){const r=t(n,s);r instanceof HTMLElement?i.appendChild(r):r!=null&&(i.textContent=String(r))}else{const r=document.createElement("span");r.classList.add("cal-sched-month-chip__dot"),r.style.background=`hsl(var(--cal-booking-${l}-fg))`,i.appendChild(r);const o=document.createElement("span");if(o.classList.add("cal-sched-month-chip__text"),n.startTime){const h=ie(n.startTime),c=h?oe(h.hours,h.minutes,e):n.startTime;o.textContent=`${c} ${n.title||""}`}else o.textContent=n.title||"";i.appendChild(o)}return a&&i.addEventListener("click",r=>{r.stopPropagation(),a(n)}),i}const Qt=`
1110
+ `;function He({event:n,gridStartTime:e,slotHeight:a,interval:t,format:s,onClick:i,eventContent:l,showTime:r=!0,resource:o,draggable:h}){const c=document.createElement("div");c.classList.add("cal-sched-event"),c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.dataset.eventId=n.id;const d=!!n.locked;h&&!d&&(c.dataset.draggable="true"),d&&c.classList.add("cal-sched-event--locked");const p=n.color||"blue";if(c.style.setProperty("--ev-bg",`var(--cal-booking-${p}-bg)`),c.style.setProperty("--ev-fg",`var(--cal-booking-${p}-fg)`),n.startTime&&n.endTime){const u=ge(n.startTime,e,a,t),g=ge(n.endTime,e,a,t),f=Math.max(g-u,a*.5);if(c.style.top=`${u}px`,c.style.height=`${f}px`,n._totalCols>1){const m=100/n._totalCols;c.style.left=`${n._col*m}%`,c.style.width=`${m}%`}}if(typeof l=="function"){const u=l(n,o),g=document.createElement("div");g.classList.add("cal-sched-event__custom"),u instanceof HTMLElement?g.appendChild(u):u!=null&&(g.textContent=String(u)),c.appendChild(g)}else{const u=document.createElement("div");if(u.classList.add("cal-sched-event__title"),u.textContent=n.title||"",c.appendChild(u),r&&n.startTime&&n.endTime){const g=document.createElement("div");g.classList.add("cal-sched-event__time");const f=ne(n.startTime),m=ne(n.endTime);f&&m&&(g.textContent=`${oe(f.hours,f.minutes,s)}–${oe(m.hours,m.minutes,s)}`),c.appendChild(g)}}if(h&&!d){const u=document.createElement("div");u.classList.add("cal-sched-event__resize-handle"),c.appendChild(u)}return i&&(c.addEventListener("click",u=>{if(c.dataset.wasDragged){delete c.dataset.wasDragged;return}u.stopPropagation(),i(n)}),c.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),i(n))})),c}function wt({event:n,onClick:e,eventContent:a,resource:t}){const s=document.createElement("div");s.classList.add("cal-sched-allday-chip"),s.dataset.eventId=n.id;const i=n.color||"blue";if(s.style.setProperty("--ev-bg",`var(--cal-booking-${i}-bg)`),s.style.setProperty("--ev-fg",`var(--cal-booking-${i}-fg)`),typeof a=="function"){const l=a(n,t);l instanceof HTMLElement?s.appendChild(l):l!=null&&(s.textContent=String(l))}else s.textContent=n.title||"";return e&&s.addEventListener("click",l=>{l.stopPropagation(),e(n)}),s}function sa({event:n,format:e,onClick:a,eventContent:t,resource:s}){const i=document.createElement("div");i.classList.add("cal-sched-month-chip"),i.dataset.eventId=n.id;const l=n.color||"blue";if(i.style.setProperty("--ev-bg",`var(--cal-booking-${l}-bg)`),i.style.setProperty("--ev-fg",`var(--cal-booking-${l}-fg)`),typeof t=="function"){const r=t(n,s);r instanceof HTMLElement?i.appendChild(r):r!=null&&(i.textContent=String(r))}else{const r=document.createElement("span");r.classList.add("cal-sched-month-chip__dot"),r.style.background=`hsl(var(--cal-booking-${l}-fg))`,i.appendChild(r);const o=document.createElement("span");if(o.classList.add("cal-sched-month-chip__text"),n.startTime){const h=ne(n.startTime),c=h?oe(h.hours,h.minutes,e):n.startTime;o.textContent=`${c} ${n.title||""}`}else o.textContent=n.title||"";i.appendChild(o)}return a&&i.addEventListener("click",r=>{r.stopPropagation(),a(n)}),i}const na=`
1111
1111
  .cal-sched-event {
1112
1112
  position: absolute;
1113
1113
  left: 2px;
@@ -1223,7 +1223,7 @@
1223
1223
  overflow: hidden;
1224
1224
  text-overflow: ellipsis;
1225
1225
  }
1226
- `;function Ce({date:n,startTime:e,endTime:a,resourceName:t,format:s,onCreate:i}){const l=document.createElement("div");l.classList.add("cal-sched-slot-prompt","cal-animate-fade");const r=document.createElement("div");if(r.classList.add("cal-sched-slot-prompt__info"),e&&a){const h=ie(e),c=ie(a),d=document.createElement("div");d.classList.add("cal-sched-slot-prompt__time"),h&&c&&(d.textContent=`${oe(h.hours,h.minutes,s)}–${oe(c.hours,c.minutes,s)}`),r.appendChild(d)}else{const h=document.createElement("div");h.classList.add("cal-sched-slot-prompt__time"),h.textContent=n,r.appendChild(h)}if(t){const h=document.createElement("div");h.classList.add("cal-sched-slot-prompt__resource"),h.textContent=t,r.appendChild(h)}l.appendChild(r);const o=document.createElement("button");return o.classList.add("cal-sched-slot-prompt__btn"),o.setAttribute("aria-label","Create event"),o.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M7 3v8M3 7h8"/></svg>',o.addEventListener("click",h=>{h.stopPropagation(),i==null||i()}),l.appendChild(o),l.addEventListener("click",h=>h.stopPropagation()),l}const ea=`
1226
+ `;function Ce({date:n,startTime:e,endTime:a,resourceName:t,format:s,onCreate:i}){const l=document.createElement("div");l.classList.add("cal-sched-slot-prompt","cal-animate-fade");const r=document.createElement("div");if(r.classList.add("cal-sched-slot-prompt__info"),e&&a){const h=ne(e),c=ne(a),d=document.createElement("div");d.classList.add("cal-sched-slot-prompt__time"),h&&c&&(d.textContent=`${oe(h.hours,h.minutes,s)}–${oe(c.hours,c.minutes,s)}`),r.appendChild(d)}else{const h=document.createElement("div");h.classList.add("cal-sched-slot-prompt__time"),h.textContent=n,r.appendChild(h)}if(t){const h=document.createElement("div");h.classList.add("cal-sched-slot-prompt__resource"),h.textContent=t,r.appendChild(h)}l.appendChild(r);const o=document.createElement("button");return o.classList.add("cal-sched-slot-prompt__btn"),o.setAttribute("aria-label","Create event"),o.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M7 3v8M3 7h8"/></svg>',o.addEventListener("click",h=>{h.stopPropagation(),i==null||i()}),l.appendChild(o),l.addEventListener("click",h=>h.stopPropagation()),l}const ia=`
1227
1227
  .cal-sched-slot-prompt {
1228
1228
  position: absolute;
1229
1229
  z-index: 10;
@@ -1287,7 +1287,7 @@
1287
1287
  background: hsl(var(--cal-accent-subtle));
1288
1288
  box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
1289
1289
  }
1290
- `;function ta({date:n,resources:e,events:a,startTime:t,endTime:s,interval:i,slotHeight:l,format:r,layout:o,resourceMode:h,selectedSlot:c,eventContent:d,showTime:g=!0,draggable:u,onSlotClick:p,onEventClick:_,onSlotCreate:m}){const v=document.createElement("div");v.classList.add("cal-sched-day"),o==="horizontal"&&v.classList.add("cal-sched-day--horizontal");const C=h==="tabs",k=e.length>1&&!C,S=Le(a,n),B=S.filter(x=>!x.startTime||!x.endTime),V=S.filter(x=>x.startTime&&x.endTime),O=Ee(t,s,i);if(B.length>0){const x=document.createElement("div");x.classList.add("cal-sched-day__allday");const f=document.createElement("div");f.classList.add("cal-sched-day__allday-label"),f.textContent="All day",x.appendChild(f);const F=document.createElement("div");F.classList.add("cal-sched-day__allday-chips");for(const R of B){const L=e.find(y=>y.id===R.resourceId);F.appendChild(vt({event:R,onClick:y=>_==null?void 0:_(y,R.resourceId,L),eventContent:d,resource:L}))}x.appendChild(F),v.appendChild(x)}if(k){const x=document.createElement("div");x.classList.add("cal-sched-day__header");const f=document.createElement("div");f.classList.add("cal-sched-day__header-spacer"),x.appendChild(f),x.appendChild(Vt({resources:e})),v.appendChild(x)}const N=document.createElement("div");N.classList.add("cal-sched-day__grid-area"),N.appendChild(ft({startTime:t,endTime:s,interval:i,slotHeight:l,format:r}));const I=document.createElement("div");if(I.classList.add("cal-sched-day__lanes"),k)for(const x of e){const f=document.createElement("div");f.classList.add("cal-sched-day__lane"),f.style.flex="1 1 0",f.dataset.resourceId=x.id,f.dataset.date=n;for(let L=0;L<O.length;L++){const y=document.createElement("div");y.classList.add("cal-sched-day__slot"),y.style.height=`${l}px`,y.dataset.time=O[L],y.dataset.resourceId=x.id;const H=L<O.length-1?O[L+1]:s;c&&c.date===n&&c.startTime===O[L]&&c.resourceId===x.id&&(y.classList.add("cal-sched-day__slot--selected"),y.appendChild(Ce({date:n,startTime:O[L],endTime:H,resourceName:x.name,format:r,onCreate:()=>m==null?void 0:m(n,O[L],H,x.id,x)}))),y.addEventListener("click",()=>{p==null||p(n,O[L],H,x.id,x)}),f.appendChild(y)}const F=V.filter(L=>L.resourceId===x.id),R=Ye(F);for(const L of R)f.appendChild(Ie({event:L,gridStartTime:t,slotHeight:l,interval:i,format:r,onClick:y=>_==null?void 0:_(y,x.id,x),eventContent:d,showTime:g,resource:x,draggable:u}));I.appendChild(f)}else{const x=document.createElement("div");x.classList.add("cal-sched-day__lane"),x.style.flex="1 1 0",x.dataset.date=n;const f=e.length===1?e[0]:null;f&&(x.dataset.resourceId=f.id);for(let R=0;R<O.length;R++){const L=document.createElement("div");L.classList.add("cal-sched-day__slot"),L.style.height=`${l}px`,L.dataset.time=O[R];const y=R<O.length-1?O[R+1]:s,H=(f==null?void 0:f.id)||null;c&&c.date===n&&c.startTime===O[R]&&(c.resourceId===H||!c.resourceId&&!H)&&(L.classList.add("cal-sched-day__slot--selected"),L.appendChild(Ce({date:n,startTime:O[R],endTime:y,resourceName:(f==null?void 0:f.name)||null,format:r,onCreate:()=>m==null?void 0:m(n,O[R],y,H,f)}))),L.addEventListener("click",()=>{p==null||p(n,O[R],y,H,f)}),x.appendChild(L)}const F=Ye(V);for(const R of F){const L=e.find(y=>y.id===R.resourceId)||e[0];x.appendChild(Ie({event:R,gridStartTime:t,slotHeight:l,interval:i,format:r,onClick:y=>_==null?void 0:_(y,R.resourceId,L),eventContent:d,showTime:g,resource:L,draggable:u}))}I.appendChild(x)}N.appendChild(I);const M=ue();if(re(n,M)){const x=rt(),f=b(x),F=b(t),R=b(s);if(f>=F&&f<=R){const L=ge(x,t,l,i),y=document.createElement("div");y.classList.add("cal-sched-now-line"),y.style.top=`${L}px`;const H=document.createElement("div");H.classList.add("cal-sched-now-line__dot"),y.appendChild(H),I.appendChild(y)}}return v.appendChild(N),v}const aa=`
1290
+ `;function la({date:n,resources:e,events:a,startTime:t,endTime:s,interval:i,slotHeight:l,format:r,layout:o,resourceMode:h,selectedSlot:c,eventContent:d,showTime:p=!0,draggable:u,onSlotClick:g,onEventClick:f,onSlotCreate:m}){const b=document.createElement("div");b.classList.add("cal-sched-day"),o==="horizontal"&&b.classList.add("cal-sched-day--horizontal");const y=h==="tabs",w=e.length>1&&!y,A=Le(a,n),I=A.filter(k=>!k.startTime||!k.endTime),q=A.filter(k=>k.startTime&&k.endTime),B=Ee(t,s,i);if(I.length>0){const k=document.createElement("div");k.classList.add("cal-sched-day__allday");const L=document.createElement("div");L.classList.add("cal-sched-day__allday-label"),L.textContent="All day",k.appendChild(L);const W=document.createElement("div");W.classList.add("cal-sched-day__allday-chips");for(const v of I){const C=e.find(x=>x.id===v.resourceId);W.appendChild(wt({event:v,onClick:x=>f==null?void 0:f(x,v.resourceId,C),eventContent:d,resource:C}))}k.appendChild(W),b.appendChild(k)}if(w){const k=document.createElement("div");k.classList.add("cal-sched-day__header");const L=document.createElement("div");L.classList.add("cal-sched-day__header-spacer"),k.appendChild(L),k.appendChild(ta({resources:e})),b.appendChild(k)}const R=document.createElement("div");R.classList.add("cal-sched-day__grid-area"),R.appendChild(kt({startTime:t,endTime:s,interval:i,slotHeight:l,format:r}));const H=document.createElement("div");if(H.classList.add("cal-sched-day__lanes"),w)for(const k of e){const L=document.createElement("div");L.classList.add("cal-sched-day__lane"),L.style.flex="1 1 0",L.dataset.resourceId=k.id,L.dataset.date=n;for(let C=0;C<B.length;C++){const x=document.createElement("div");x.classList.add("cal-sched-day__slot"),x.style.height=`${l}px`,x.dataset.time=B[C],x.dataset.resourceId=k.id;const T=C<B.length-1?B[C+1]:s;c&&c.date===n&&c.startTime===B[C]&&c.resourceId===k.id&&(x.classList.add("cal-sched-day__slot--selected"),x.appendChild(Ce({date:n,startTime:B[C],endTime:T,resourceName:k.name,format:r,onCreate:()=>m==null?void 0:m(n,B[C],T,k.id,k)}))),x.addEventListener("click",()=>{g==null||g(n,B[C],T,k.id,k)}),L.appendChild(x)}const W=q.filter(C=>C.resourceId===k.id),v=Pe(W);for(const C of v)L.appendChild(He({event:C,gridStartTime:t,slotHeight:l,interval:i,format:r,onClick:x=>f==null?void 0:f(x,k.id,k),eventContent:d,showTime:p,resource:k,draggable:u}));H.appendChild(L)}else{const k=document.createElement("div");k.classList.add("cal-sched-day__lane"),k.style.flex="1 1 0",k.dataset.date=n;const L=e.length===1?e[0]:null;L&&(k.dataset.resourceId=L.id);for(let v=0;v<B.length;v++){const C=document.createElement("div");C.classList.add("cal-sched-day__slot"),C.style.height=`${l}px`,C.dataset.time=B[v];const x=v<B.length-1?B[v+1]:s,T=(L==null?void 0:L.id)||null;c&&c.date===n&&c.startTime===B[v]&&(c.resourceId===T||!c.resourceId&&!T)&&(C.classList.add("cal-sched-day__slot--selected"),C.appendChild(Ce({date:n,startTime:B[v],endTime:x,resourceName:(L==null?void 0:L.name)||null,format:r,onCreate:()=>m==null?void 0:m(n,B[v],x,T,L)}))),C.addEventListener("click",()=>{g==null||g(n,B[v],x,T,L)}),k.appendChild(C)}const W=Pe(q);for(const v of W){const C=e.find(x=>x.id===v.resourceId)||e[0];k.appendChild(He({event:v,gridStartTime:t,slotHeight:l,interval:i,format:r,onClick:x=>f==null?void 0:f(x,v.resourceId,C),eventContent:d,showTime:p,resource:C,draggable:u}))}H.appendChild(k)}R.appendChild(H);const F=ue();if(re(n,F)){const k=pt(),L=_(k),W=_(t),v=_(s);if(L>=W&&L<=v){const C=ge(k,t,l,i),x=document.createElement("div");x.classList.add("cal-sched-now-line"),x.style.top=`${C}px`;const T=document.createElement("div");T.classList.add("cal-sched-now-line__dot"),x.appendChild(T),H.appendChild(x)}}return b.appendChild(R),b}const ra=`
1291
1291
  .cal-sched-day {
1292
1292
  display: flex;
1293
1293
  flex-direction: column;
@@ -1426,7 +1426,7 @@
1426
1426
  justify-content: center;
1427
1427
  padding: 4px 0;
1428
1428
  }
1429
- `,Re=3,je=5;function sa({date:n,firstDay:e,resources:a,events:t,startTime:s,endTime:i,interval:l,slotHeight:r,format:o,layout:h,resourceMode:c,selectedSlot:d,eventContent:g,showTime:u=!0,draggable:p,allDayCollapsed:_,onToggleAllDay:m,onSlotClick:v,onEventClick:C,onSlotCreate:k}){const S=document.createElement("div");S.classList.add("cal-sched-week"),h==="horizontal"&&S.classList.add("cal-sched-week--horizontal");const B=Ne(n,e),V=c==="tabs",O=a.length>1&&!V,N=Ee(s,i,l),I=ue(),M={};for(const y of B){const H=Le(t,y).filter(K=>!K.startTime||!K.endTime);H.length&&(M[y]=H)}if(Object.keys(M).length>0){const y=document.createElement("div");y.classList.add("cal-sched-week__allday"),_&&y.classList.add("cal-sched-week__allday--collapsed");const H=document.createElement("div");H.classList.add("cal-sched-week__allday-spacer");const K=document.createElement("span");K.textContent="All day",H.appendChild(K);const E=document.createElement("button");E.classList.add("cal-sched-week__allday-toggle"),E.setAttribute("aria-label",_?"Expand all-day events":"Collapse all-day events"),E.innerHTML=_?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>',E.addEventListener("click",Y=>{Y.stopPropagation(),m==null||m()}),H.appendChild(E),y.appendChild(H);for(const Y of B){const X=document.createElement("div");X.classList.add("cal-sched-week__allday-cell");const $=M[Y]||[];if(_){if($.length>0){const T=document.createElement("div");T.classList.add("cal-sched-week__allday-dots");const z=$.slice(0,je);for(const q of z){const Q=document.createElement("span");Q.classList.add("cal-sched-week__allday-dot");const ke=q.color||"blue";Q.style.background=`hsl(var(--cal-booking-${ke}-fg))`,T.appendChild(Q)}if($.length>je){const q=document.createElement("span");q.classList.add("cal-sched-week__allday-overflow"),q.textContent=`+${$.length-je}`,T.appendChild(q)}X.appendChild(T)}}else{const T=$.slice(0,Re);for(const z of T){const q=a.find(Q=>Q.id===z.resourceId);X.appendChild(vt({event:z,onClick:Q=>C==null?void 0:C(Q,z.resourceId,q),eventContent:g,resource:q}))}if($.length>Re){const z=document.createElement("span");z.classList.add("cal-sched-week__allday-overflow"),z.textContent=`+${$.length-Re}`,X.appendChild(z)}}y.appendChild(X)}S.appendChild(y)}const f=document.createElement("div");f.classList.add("cal-sched-week__header");const F=document.createElement("div");F.classList.add("cal-sched-week__header-spacer"),f.appendChild(F);for(const y of B){const H=W(y),K=document.createElement("div");K.classList.add("cal-sched-week__day-header"),re(y,I)&&K.classList.add("cal-sched-week__day-header--today");const E=document.createElement("span");E.classList.add("cal-sched-week__day-name"),E.textContent=We(y);const Y=document.createElement("span");if(Y.classList.add("cal-sched-week__day-num"),re(y,I)&&Y.classList.add("cal-sched-week__day-num--today"),Y.textContent=H?H.getDate():"",K.appendChild(E),K.appendChild(Y),O){const X=document.createElement("div");X.classList.add("cal-sched-week__res-row");for(const $ of a){const T=document.createElement("span");T.classList.add("cal-sched-week__res-label");const z=document.createElement("span");z.classList.add("cal-sched-week__res-dot"),z.style.background=`hsl(var(--cal-booking-${$.color||"blue"}-fg))`,T.appendChild(z),T.appendChild(document.createTextNode($.name)),X.appendChild(T)}K.appendChild(X)}f.appendChild(K)}S.appendChild(f);const R=document.createElement("div");R.classList.add("cal-sched-week__grid-area"),R.appendChild(ft({startTime:s,endTime:i,interval:l,slotHeight:r,format:o}));const L=document.createElement("div");L.classList.add("cal-sched-week__cols");for(const y of B){const H=document.createElement("div");H.classList.add("cal-sched-week__day-col"),H.dataset.date=y,re(y,I)&&H.classList.add("cal-sched-week__day-col--today");const K=Le(t,y).filter(E=>E.startTime&&E.endTime);if(O)for(const E of a){const Y=document.createElement("div");Y.classList.add("cal-sched-week__lane"),Y.dataset.resourceId=E.id;for(let T=0;T<N.length;T++){const z=document.createElement("div");z.classList.add("cal-sched-week__slot"),z.style.height=`${r}px`,z.dataset.time=N[T];const q=T<N.length-1?N[T+1]:i;d&&d.date===y&&d.startTime===N[T]&&d.resourceId===E.id&&(z.classList.add("cal-sched-week__slot--selected"),z.appendChild(Ce({date:y,startTime:N[T],endTime:q,resourceName:E.name,format:o,onCreate:()=>k==null?void 0:k(y,N[T],q,E.id,E)}))),z.addEventListener("click",()=>{v==null||v(y,N[T],q,E.id,E)}),Y.appendChild(z)}const X=K.filter(T=>T.resourceId===E.id),$=Ye(X);for(const T of $)Y.appendChild(Ie({event:T,gridStartTime:s,slotHeight:r,interval:l,format:o,onClick:z=>C==null?void 0:C(z,E.id,E),eventContent:g,showTime:u,resource:E,draggable:p}));H.appendChild(Y)}else{const E=document.createElement("div");E.classList.add("cal-sched-week__lane","cal-sched-week__lane--full");const Y=a.length===1?a[0]:null;Y&&(E.dataset.resourceId=Y.id);for(let $=0;$<N.length;$++){const T=document.createElement("div");T.classList.add("cal-sched-week__slot"),T.style.height=`${r}px`,T.dataset.time=N[$];const z=$<N.length-1?N[$+1]:i,q=(Y==null?void 0:Y.id)||null;d&&d.date===y&&d.startTime===N[$]&&(d.resourceId===q||!d.resourceId&&!q)&&(T.classList.add("cal-sched-week__slot--selected"),T.appendChild(Ce({date:y,startTime:N[$],endTime:z,resourceName:(Y==null?void 0:Y.name)||null,format:o,onCreate:()=>k==null?void 0:k(y,N[$],z,q,Y)}))),T.addEventListener("click",()=>{v==null||v(y,N[$],z,q,Y)}),E.appendChild(T)}const X=Ye(K);for(const $ of X){const T=a.find(z=>z.id===$.resourceId)||a[0];E.appendChild(Ie({event:$,gridStartTime:s,slotHeight:r,interval:l,format:o,onClick:z=>C==null?void 0:C(z,$.resourceId,T),eventContent:g,showTime:u,resource:T,draggable:p}))}H.appendChild(E)}L.appendChild(H)}if(B.includes(I)){const y=rt(),H=b(y),K=b(s),E=b(i);if(H>=K&&H<=E){const Y=B.indexOf(I),X=ge(y,s,r,l),$=document.createElement("div");$.classList.add("cal-sched-now-line","cal-sched-now-line--week"),$.style.top=`${X}px`;const T=100/7;$.style.left=`${Y*T}%`,$.style.width=`${T}%`;const z=document.createElement("div");z.classList.add("cal-sched-now-line__dot"),$.appendChild(z),L.appendChild($)}}return R.appendChild(L),S.appendChild(R),S}const na=`
1429
+ `,We=3,Xe=5;function oa({date:n,firstDay:e,resources:a,events:t,startTime:s,endTime:i,interval:l,slotHeight:r,format:o,layout:h,resourceMode:c,selectedSlot:d,eventContent:p,showTime:u=!0,draggable:g,allDayCollapsed:f,onToggleAllDay:m,onSlotClick:b,onEventClick:y,onSlotCreate:w}){const A=document.createElement("div");A.classList.add("cal-sched-week"),h==="horizontal"&&A.classList.add("cal-sched-week--horizontal");const I=qe(n,e),q=c==="tabs",B=a.length>1&&!q,R=Ee(s,i,l),H=ue(),F={};for(const x of I){const T=Le(t,x).filter(X=>!X.startTime||!X.endTime);T.length&&(F[x]=T)}if(Object.keys(F).length>0){const x=document.createElement("div");x.classList.add("cal-sched-week__allday"),f&&x.classList.add("cal-sched-week__allday--collapsed");const T=document.createElement("div");T.classList.add("cal-sched-week__allday-spacer");const X=document.createElement("span");X.textContent="All day",T.appendChild(X);const Y=document.createElement("button");Y.classList.add("cal-sched-week__allday-toggle"),Y.setAttribute("aria-label",f?"Expand all-day events":"Collapse all-day events"),Y.innerHTML=f?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>',Y.addEventListener("click",j=>{j.stopPropagation(),m==null||m()}),T.appendChild(Y),x.appendChild(T);for(const j of I){const O=document.createElement("div");O.classList.add("cal-sched-week__allday-cell");const S=F[j]||[];if(f){if(S.length>0){const M=document.createElement("div");M.classList.add("cal-sched-week__allday-dots");const z=S.slice(0,Xe);for(const G of z){const Q=document.createElement("span");Q.classList.add("cal-sched-week__allday-dot");const le=G.color||"blue";Q.style.background=`hsl(var(--cal-booking-${le}-fg))`,M.appendChild(Q)}if(S.length>Xe){const G=document.createElement("span");G.classList.add("cal-sched-week__allday-overflow"),G.textContent=`+${S.length-Xe}`,M.appendChild(G)}O.appendChild(M)}}else{const M=S.slice(0,We);for(const z of M){const G=a.find(Q=>Q.id===z.resourceId);O.appendChild(wt({event:z,onClick:Q=>y==null?void 0:y(Q,z.resourceId,G),eventContent:p,resource:G}))}if(S.length>We){const z=document.createElement("span");z.classList.add("cal-sched-week__allday-overflow"),z.textContent=`+${S.length-We}`,O.appendChild(z)}}x.appendChild(O)}A.appendChild(x)}const L=document.createElement("div");L.classList.add("cal-sched-week__header");const W=document.createElement("div");W.classList.add("cal-sched-week__header-spacer"),L.appendChild(W);for(const x of I){const T=K(x),X=document.createElement("div");X.classList.add("cal-sched-week__day-header"),re(x,H)&&X.classList.add("cal-sched-week__day-header--today");const Y=document.createElement("span");Y.classList.add("cal-sched-week__day-name"),Y.textContent=Ue(x);const j=document.createElement("span");if(j.classList.add("cal-sched-week__day-num"),re(x,H)&&j.classList.add("cal-sched-week__day-num--today"),j.textContent=T?T.getDate():"",X.appendChild(Y),X.appendChild(j),B){const O=document.createElement("div");O.classList.add("cal-sched-week__res-row");for(const S of a){const M=document.createElement("span");M.classList.add("cal-sched-week__res-label");const z=document.createElement("span");z.classList.add("cal-sched-week__res-dot"),z.style.background=`hsl(var(--cal-booking-${S.color||"blue"}-fg))`,M.appendChild(z),M.appendChild(document.createTextNode(S.name)),O.appendChild(M)}X.appendChild(O)}L.appendChild(X)}A.appendChild(L);const v=document.createElement("div");v.classList.add("cal-sched-week__grid-area"),v.appendChild(kt({startTime:s,endTime:i,interval:l,slotHeight:r,format:o}));const C=document.createElement("div");C.classList.add("cal-sched-week__cols");for(const x of I){const T=document.createElement("div");T.classList.add("cal-sched-week__day-col"),T.dataset.date=x,re(x,H)&&T.classList.add("cal-sched-week__day-col--today");const X=Le(t,x).filter(Y=>Y.startTime&&Y.endTime);if(B)for(const Y of a){const j=document.createElement("div");j.classList.add("cal-sched-week__lane"),j.dataset.resourceId=Y.id;for(let M=0;M<R.length;M++){const z=document.createElement("div");z.classList.add("cal-sched-week__slot"),z.style.height=`${r}px`,z.dataset.time=R[M];const G=M<R.length-1?R[M+1]:i;d&&d.date===x&&d.startTime===R[M]&&d.resourceId===Y.id&&(z.classList.add("cal-sched-week__slot--selected"),z.appendChild(Ce({date:x,startTime:R[M],endTime:G,resourceName:Y.name,format:o,onCreate:()=>w==null?void 0:w(x,R[M],G,Y.id,Y)}))),z.addEventListener("click",()=>{b==null||b(x,R[M],G,Y.id,Y)}),j.appendChild(z)}const O=X.filter(M=>M.resourceId===Y.id),S=Pe(O);for(const M of S)j.appendChild(He({event:M,gridStartTime:s,slotHeight:r,interval:l,format:o,onClick:z=>y==null?void 0:y(z,Y.id,Y),eventContent:p,showTime:u,resource:Y,draggable:g}));T.appendChild(j)}else{const Y=document.createElement("div");Y.classList.add("cal-sched-week__lane","cal-sched-week__lane--full");const j=a.length===1?a[0]:null;j&&(Y.dataset.resourceId=j.id);for(let S=0;S<R.length;S++){const M=document.createElement("div");M.classList.add("cal-sched-week__slot"),M.style.height=`${r}px`,M.dataset.time=R[S];const z=S<R.length-1?R[S+1]:i,G=(j==null?void 0:j.id)||null;d&&d.date===x&&d.startTime===R[S]&&(d.resourceId===G||!d.resourceId&&!G)&&(M.classList.add("cal-sched-week__slot--selected"),M.appendChild(Ce({date:x,startTime:R[S],endTime:z,resourceName:(j==null?void 0:j.name)||null,format:o,onCreate:()=>w==null?void 0:w(x,R[S],z,G,j)}))),M.addEventListener("click",()=>{b==null||b(x,R[S],z,G,j)}),Y.appendChild(M)}const O=Pe(X);for(const S of O){const M=a.find(z=>z.id===S.resourceId)||a[0];Y.appendChild(He({event:S,gridStartTime:s,slotHeight:r,interval:l,format:o,onClick:z=>y==null?void 0:y(z,S.resourceId,M),eventContent:p,showTime:u,resource:M,draggable:g}))}T.appendChild(Y)}C.appendChild(T)}if(I.includes(H)){const x=pt(),T=_(x),X=_(s),Y=_(i);if(T>=X&&T<=Y){const j=I.indexOf(H),O=ge(x,s,r,l),S=document.createElement("div");S.classList.add("cal-sched-now-line","cal-sched-now-line--week"),S.style.top=`${O}px`;const M=100/7;S.style.left=`${j*M}%`,S.style.width=`${M}%`;const z=document.createElement("div");z.classList.add("cal-sched-now-line__dot"),S.appendChild(z),C.appendChild(S)}}return v.appendChild(C),A.appendChild(v),A}const ca=`
1430
1430
  .cal-sched-week {
1431
1431
  display: flex;
1432
1432
  flex-direction: column;
@@ -1644,7 +1644,7 @@
1644
1644
  z-index: 5;
1645
1645
  pointer-events: none;
1646
1646
  }
1647
- `,bt=3;function ia({date:n,firstDay:e,resources:a,events:t,format:s,selectedResourceId:i,selectedDate:l,eventContent:r,onSlotClick:o,onEventClick:h,onSlotCreate:c}){const d=document.createElement("div");d.classList.add("cal-sched-month");const g=W(n);if(!g)return d;const u=g.getFullYear(),p=g.getMonth();ue();const _=document.createElement("div");_.classList.add("cal-sched-month__weekdays");const m=Xe(e);for(const k of m){const S=document.createElement("div");S.classList.add("cal-sched-month__weekday"),S.textContent=k,_.appendChild(S)}d.appendChild(_);const v=document.createElement("div");v.classList.add("cal-sched-month__grid");const C=Ke(u,p,e);for(const k of C){const S=document.createElement("div");S.classList.add("cal-sched-month__cell"),k.isCurrentMonth||S.classList.add("cal-sched-month__cell--outside"),k.isToday&&S.classList.add("cal-sched-month__cell--today"),l&&k.dateString===l&&S.classList.add("cal-sched-month__cell--selected"),S.addEventListener("click",M=>{M.target.closest(".cal-sched-month-chip")||o==null||o(k.dateString)});const B=document.createElement("div");B.classList.add("cal-sched-month__day-num"),k.isToday&&B.classList.add("cal-sched-month__day-num--today"),B.textContent=k.day,S.appendChild(B);let V=Le(t,k.dateString);i&&(V=V.filter(M=>M.resourceId===i)),V.sort((M,x)=>M.startTime&&!x.startTime?-1:!M.startTime&&x.startTime?1:M.startTime&&x.startTime?M.startTime.localeCompare(x.startTime):0);const O=document.createElement("div");O.classList.add("cal-sched-month__events");const N=V.slice(0,bt),I=V.length-bt;for(const M of N){const x=a.find(f=>f.id===M.resourceId);O.appendChild(Zt({event:M,format:s,onClick:f=>h==null?void 0:h(f,M.resourceId,x),eventContent:r,resource:x}))}if(I>0){const M=document.createElement("div");M.classList.add("cal-sched-month__more"),M.textContent=`+${I} more`,O.appendChild(M)}S.appendChild(O),l&&k.dateString===l&&(S.style.position="relative",S.appendChild(Ce({date:k.dateString,startTime:null,endTime:null,resourceName:null,format:s,onCreate:()=>c==null?void 0:c(k.dateString)}))),v.appendChild(S)}return d.appendChild(v),d}const la=`
1647
+ `,Et=3;function da({date:n,firstDay:e,resources:a,events:t,format:s,selectedResourceId:i,selectedDate:l,eventContent:r,onSlotClick:o,onEventClick:h,onSlotCreate:c}){const d=document.createElement("div");d.classList.add("cal-sched-month");const p=K(n);if(!p)return d;const u=p.getFullYear(),g=p.getMonth();ue();const f=document.createElement("div");f.classList.add("cal-sched-month__weekdays");const m=Je(e);for(const w of m){const A=document.createElement("div");A.classList.add("cal-sched-month__weekday"),A.textContent=w,f.appendChild(A)}d.appendChild(f);const b=document.createElement("div");b.classList.add("cal-sched-month__grid");const y=Ze(u,g,e);for(const w of y){const A=document.createElement("div");A.classList.add("cal-sched-month__cell"),w.isCurrentMonth||A.classList.add("cal-sched-month__cell--outside"),w.isToday&&A.classList.add("cal-sched-month__cell--today"),l&&w.dateString===l&&A.classList.add("cal-sched-month__cell--selected"),A.addEventListener("click",F=>{F.target.closest(".cal-sched-month-chip")||o==null||o(w.dateString)});const I=document.createElement("div");I.classList.add("cal-sched-month__day-num"),w.isToday&&I.classList.add("cal-sched-month__day-num--today"),I.textContent=w.day,A.appendChild(I);let q=Le(t,w.dateString);i&&(q=q.filter(F=>F.resourceId===i)),q.sort((F,k)=>F.startTime&&!k.startTime?-1:!F.startTime&&k.startTime?1:F.startTime&&k.startTime?F.startTime.localeCompare(k.startTime):0);const B=document.createElement("div");B.classList.add("cal-sched-month__events");const R=q.slice(0,Et),H=q.length-Et;for(const F of R){const k=a.find(L=>L.id===F.resourceId);B.appendChild(sa({event:F,format:s,onClick:L=>h==null?void 0:h(L,F.resourceId,k),eventContent:r,resource:k}))}if(H>0){const F=document.createElement("div");F.classList.add("cal-sched-month__more"),F.textContent=`+${H} more`,B.appendChild(F)}A.appendChild(B),l&&w.dateString===l&&(A.style.position="relative",A.appendChild(Ce({date:w.dateString,startTime:null,endTime:null,resourceName:null,format:s,onCreate:()=>c==null?void 0:c(w.dateString)}))),b.appendChild(A)}return d.appendChild(b),d}const ha=`
1648
1648
  .cal-sched-month {
1649
1649
  border: 1px solid hsl(var(--cal-sched-grid-line));
1650
1650
  border-radius: var(--cal-radius);
@@ -1728,7 +1728,7 @@
1728
1728
  .cal-sched-month__more:hover {
1729
1729
  color: hsl(var(--cal-fg));
1730
1730
  }
1731
- `;function ra({columns:n=3,rows:e=10,slotHeight:a=48}={}){const t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-label","Loading..."),t.classList.add("cal-sched-skeleton-grid");const s=document.createElement("div");s.classList.add("cal-sched-skeleton-grid__header");const i=document.createElement("div");i.classList.add("cal-sched-skeleton-grid__spacer"),s.appendChild(i);for(let r=0;r<n;r++){const o=document.createElement("div");o.classList.add("cal-skeleton","cal-sched-skeleton-grid__col-header"),s.appendChild(o)}t.appendChild(s);const l=document.createElement("div");l.classList.add("cal-sched-skeleton-grid__body");for(let r=0;r<e;r++){const o=document.createElement("div");o.classList.add("cal-sched-skeleton-grid__row"),o.style.height=`${a}px`;const h=document.createElement("div");h.classList.add("cal-skeleton","cal-sched-skeleton-grid__time"),o.appendChild(h);for(let c=0;c<n;c++){const d=document.createElement("div");if(d.classList.add("cal-sched-skeleton-grid__cell"),Math.random()<.15){const g=document.createElement("div");g.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-grid__event"),g.style.height=`${a*(1+Math.floor(Math.random()*2))}px`,d.appendChild(g)}o.appendChild(d)}l.appendChild(o)}return t.appendChild(l),t}function oa(){const n=document.createElement("div");n.setAttribute("role","status"),n.setAttribute("aria-label","Loading..."),n.classList.add("cal-sched-skeleton-month");const e=document.createElement("div");e.classList.add("cal-sched-skeleton-month__weekdays");for(let t=0;t<7;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-sched-skeleton-month__weekday"),e.appendChild(s)}n.appendChild(e);const a=document.createElement("div");a.classList.add("cal-sched-skeleton-month__grid");for(let t=0;t<35;t++){const s=document.createElement("div");s.classList.add("cal-sched-skeleton-month__cell");const i=document.createElement("div");i.classList.add("cal-skeleton","cal-sched-skeleton-month__num"),s.appendChild(i);const l=Math.floor(Math.random()*3);for(let r=0;r<l;r++){const o=document.createElement("div");o.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-month__chip"),s.appendChild(o)}a.appendChild(s)}return n.appendChild(a),n}const ca=`
1731
+ `;function ua({columns:n=3,rows:e=10,slotHeight:a=48}={}){const t=document.createElement("div");t.setAttribute("role","status"),t.setAttribute("aria-label","Loading..."),t.classList.add("cal-sched-skeleton-grid");const s=document.createElement("div");s.classList.add("cal-sched-skeleton-grid__header");const i=document.createElement("div");i.classList.add("cal-sched-skeleton-grid__spacer"),s.appendChild(i);for(let r=0;r<n;r++){const o=document.createElement("div");o.classList.add("cal-skeleton","cal-sched-skeleton-grid__col-header"),s.appendChild(o)}t.appendChild(s);const l=document.createElement("div");l.classList.add("cal-sched-skeleton-grid__body");for(let r=0;r<e;r++){const o=document.createElement("div");o.classList.add("cal-sched-skeleton-grid__row"),o.style.height=`${a}px`;const h=document.createElement("div");h.classList.add("cal-skeleton","cal-sched-skeleton-grid__time"),o.appendChild(h);for(let c=0;c<n;c++){const d=document.createElement("div");if(d.classList.add("cal-sched-skeleton-grid__cell"),Math.random()<.15){const p=document.createElement("div");p.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-grid__event"),p.style.height=`${a*(1+Math.floor(Math.random()*2))}px`,d.appendChild(p)}o.appendChild(d)}l.appendChild(o)}return t.appendChild(l),t}function pa(){const n=document.createElement("div");n.setAttribute("role","status"),n.setAttribute("aria-label","Loading..."),n.classList.add("cal-sched-skeleton-month");const e=document.createElement("div");e.classList.add("cal-sched-skeleton-month__weekdays");for(let t=0;t<7;t++){const s=document.createElement("div");s.classList.add("cal-skeleton","cal-sched-skeleton-month__weekday"),e.appendChild(s)}n.appendChild(e);const a=document.createElement("div");a.classList.add("cal-sched-skeleton-month__grid");for(let t=0;t<35;t++){const s=document.createElement("div");s.classList.add("cal-sched-skeleton-month__cell");const i=document.createElement("div");i.classList.add("cal-skeleton","cal-sched-skeleton-month__num"),s.appendChild(i);const l=Math.floor(Math.random()*3);for(let r=0;r<l;r++){const o=document.createElement("div");o.classList.add("cal-skeleton","cal-skeleton--rect","cal-sched-skeleton-month__chip"),s.appendChild(o)}a.appendChild(s)}return n.appendChild(a),n}const ga=`
1732
1732
  .cal-sched-skeleton-grid {
1733
1733
  border: 1px solid hsl(var(--cal-sched-grid-line));
1734
1734
  border-radius: var(--cal-radius);
@@ -1832,7 +1832,7 @@
1832
1832
  margin-bottom: 2px;
1833
1833
  width: 85%;
1834
1834
  }
1835
- `;function da({event:n,resource:e,format:a,onClose:t,actions:s,onAction:i}){const l=document.createElement("div");l.classList.add("cal-sched-detail-backdrop"),l.addEventListener("click",t);const r=document.createElement("div");r.classList.add("cal-sched-detail","cal-animate-fade"),r.addEventListener("click",u=>u.stopPropagation());const o=document.createElement("button");o.classList.add("cal-sched-detail__close"),o.setAttribute("aria-label","Close"),o.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 4l6 6M10 4l-6 6"/></svg>',o.addEventListener("click",t),r.appendChild(o);const h=n.color||"blue",c=document.createElement("div");c.classList.add("cal-sched-detail__accent"),c.style.background=`hsl(var(--cal-booking-${h}-fg))`,r.appendChild(c);const d=document.createElement("div");if(d.classList.add("cal-sched-detail__title"),d.textContent=n.title||"Untitled",r.appendChild(d),n.startTime&&n.endTime){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__icon"),p.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>',u.appendChild(p);const _=ie(n.startTime),m=ie(n.endTime),v=document.createElement("span");_&&m&&(v.textContent=`${oe(_.hours,_.minutes,a)}–${oe(m.hours,m.minutes,a)}`),u.appendChild(v),r.appendChild(u)}if(n.start){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__icon"),p.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>',u.appendChild(p);const _=W(n.start),m=document.createElement("span");if(_){let v=`${We(n.start,"long")}, ${se[_.getMonth()]} ${_.getDate()}`;if(n.end&&n.end!==n.start){const C=W(n.end);C&&(v+=` – ${se[C.getMonth()]} ${C.getDate()}`)}m.textContent=v}u.appendChild(m),r.appendChild(u)}if(e&&e.name){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const p=document.createElement("span");p.classList.add("cal-sched-detail__res-dot"),p.style.background=`hsl(var(--cal-booking-${e.color||"blue"}-fg))`,u.appendChild(p);const _=document.createElement("span");_.textContent=e.name,e.capacity&&(_.textContent+=` (capacity: ${e.capacity})`),u.appendChild(_),r.appendChild(u)}if(n.metadata&&typeof n.metadata=="object"){const u=Object.entries(n.metadata);if(u.length>0){const p=document.createElement("div");p.classList.add("cal-sched-detail__meta");for(const[_,m]of u){const v=document.createElement("div");v.classList.add("cal-sched-detail__meta-row");const C=document.createElement("span");C.classList.add("cal-sched-detail__meta-label"),C.textContent=_;const k=document.createElement("span");k.textContent=String(m),v.appendChild(C),v.appendChild(k),p.appendChild(v)}r.appendChild(p)}}if(s&&s.length>0){const u=document.createElement("div");u.classList.add("cal-sched-detail__actions");for(const p of s){const _=document.createElement("button");_.classList.add("cal-sched-detail__action"),p.type==="danger"&&_.classList.add("cal-sched-detail__action--danger"),_.textContent=p.label,_.addEventListener("click",()=>{i==null||i(p.label)}),u.appendChild(_)}r.appendChild(u)}l.appendChild(r);const g=u=>{u.key==="Escape"&&t()};return l.addEventListener("keydown",g),requestAnimationFrame(()=>o.focus()),l}const ha=`
1835
+ `;function ma({event:n,resource:e,format:a,onClose:t,actions:s,onAction:i}){const l=document.createElement("div");l.classList.add("cal-sched-detail-backdrop"),l.addEventListener("click",t);const r=document.createElement("div");r.classList.add("cal-sched-detail","cal-animate-fade"),r.addEventListener("click",u=>u.stopPropagation());const o=document.createElement("button");o.classList.add("cal-sched-detail__close"),o.setAttribute("aria-label","Close"),o.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 4l6 6M10 4l-6 6"/></svg>',o.addEventListener("click",t),r.appendChild(o);const h=n.color||"blue",c=document.createElement("div");c.classList.add("cal-sched-detail__accent"),c.style.background=`hsl(var(--cal-booking-${h}-fg))`,r.appendChild(c);const d=document.createElement("div");if(d.classList.add("cal-sched-detail__title"),d.textContent=n.title||"Untitled",r.appendChild(d),n.startTime&&n.endTime){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const g=document.createElement("span");g.classList.add("cal-sched-detail__icon"),g.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>',u.appendChild(g);const f=ne(n.startTime),m=ne(n.endTime),b=document.createElement("span");f&&m&&(b.textContent=`${oe(f.hours,f.minutes,a)}–${oe(m.hours,m.minutes,a)}`),u.appendChild(b),r.appendChild(u)}if(n.start){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const g=document.createElement("span");g.classList.add("cal-sched-detail__icon"),g.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>',u.appendChild(g);const f=K(n.start),m=document.createElement("span");if(f){let b=`${Ue(n.start,"long")}, ${Te[f.getMonth()]} ${f.getDate()}`;if(n.end&&n.end!==n.start){const y=K(n.end);y&&(b+=` – ${Te[y.getMonth()]} ${y.getDate()}`)}m.textContent=b}u.appendChild(m),r.appendChild(u)}if(e&&e.name){const u=document.createElement("div");u.classList.add("cal-sched-detail__row");const g=document.createElement("span");g.classList.add("cal-sched-detail__res-dot"),g.style.background=`hsl(var(--cal-booking-${e.color||"blue"}-fg))`,u.appendChild(g);const f=document.createElement("span");f.textContent=e.name,e.capacity&&(f.textContent+=` (capacity: ${e.capacity})`),u.appendChild(f),r.appendChild(u)}if(n.metadata&&typeof n.metadata=="object"){const u=Object.entries(n.metadata);if(u.length>0){const g=document.createElement("div");g.classList.add("cal-sched-detail__meta");for(const[f,m]of u){const b=document.createElement("div");b.classList.add("cal-sched-detail__meta-row");const y=document.createElement("span");y.classList.add("cal-sched-detail__meta-label"),y.textContent=f;const w=document.createElement("span");w.textContent=String(m),b.appendChild(y),b.appendChild(w),g.appendChild(b)}r.appendChild(g)}}if(s&&s.length>0){const u=document.createElement("div");u.classList.add("cal-sched-detail__actions");for(const g of s){const f=document.createElement("button");f.classList.add("cal-sched-detail__action"),g.type==="danger"&&f.classList.add("cal-sched-detail__action--danger"),f.textContent=g.label,f.addEventListener("click",()=>{i==null||i(g.label)}),u.appendChild(f)}r.appendChild(u)}l.appendChild(r);const p=u=>{u.key==="Escape"&&t()};return l.addEventListener("keydown",p),requestAnimationFrame(()=>o.focus()),l}const fa=`
1836
1836
  .cal-sched-detail-backdrop {
1837
1837
  position: absolute;
1838
1838
  inset: 0;
@@ -1970,7 +1970,7 @@
1970
1970
  .cal-sched-detail__action--danger:hover {
1971
1971
  background: hsl(var(--cal-status-error-bg));
1972
1972
  }
1973
- `;function ua({resources:n,selectedResourceId:e,onResourceFilter:a}){const t=document.createElement("div");t.classList.add("cal-sched-res-tabs");const s=document.createElement("button");s.classList.add("cal-sched-res-tabs__tab"),e||s.classList.add("cal-sched-res-tabs__tab--active"),s.textContent="All",s.addEventListener("click",()=>a==null?void 0:a(null)),t.appendChild(s);for(const i of n){const l=document.createElement("button");l.classList.add("cal-sched-res-tabs__tab"),e===i.id&&l.classList.add("cal-sched-res-tabs__tab--active");const r=document.createElement("span");r.classList.add("cal-sched-res-tabs__dot"),r.style.background=`hsl(var(--cal-booking-${i.color||"blue"}-fg))`,l.appendChild(r),l.appendChild(document.createTextNode(i.name)),l.addEventListener("click",()=>a==null?void 0:a(i.id)),t.appendChild(l)}return t}const pa=`
1973
+ `;function ba({resources:n,selectedResourceId:e,onResourceFilter:a}){const t=document.createElement("div");t.classList.add("cal-sched-res-tabs");const s=document.createElement("button");s.classList.add("cal-sched-res-tabs__tab"),e||s.classList.add("cal-sched-res-tabs__tab--active"),s.textContent="All",s.addEventListener("click",()=>a==null?void 0:a(null)),t.appendChild(s);for(const i of n){const l=document.createElement("button");l.classList.add("cal-sched-res-tabs__tab"),e===i.id&&l.classList.add("cal-sched-res-tabs__tab--active");const r=document.createElement("span");r.classList.add("cal-sched-res-tabs__dot"),r.style.background=`hsl(var(--cal-booking-${i.color||"blue"}-fg))`,l.appendChild(r),l.appendChild(document.createTextNode(i.name)),l.addEventListener("click",()=>a==null?void 0:a(i.id)),t.appendChild(l)}return t}const va=`
1974
1974
  .cal-sched-res-tabs {
1975
1975
  display: flex;
1976
1976
  gap: 4px;
@@ -2014,7 +2014,7 @@
2014
2014
  height: 6px;
2015
2015
  border-radius: 50%;
2016
2016
  }
2017
- `;function ga({onClick:n}){const e=document.createElement("button");return e.classList.add("cal-sched-fab"),e.setAttribute("aria-label","Create event"),e.innerHTML='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>',e.addEventListener("click",a=>{a.stopPropagation(),n==null||n()}),e}const ma=`
2017
+ `;function _a({onClick:n}){const e=document.createElement("button");return e.classList.add("cal-sched-fab"),e.setAttribute("aria-label","Create event"),e.innerHTML='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>',e.addEventListener("click",a=>{a.stopPropagation(),n==null||n()}),e}const ya=`
2018
2018
  .cal-sched-fab {
2019
2019
  position: absolute;
2020
2020
  bottom: 16px;
@@ -2046,12 +2046,12 @@
2046
2046
  outline: 2px solid hsl(var(--cal-ring));
2047
2047
  outline-offset: 2px;
2048
2048
  }
2049
- `,fa=4;function va({shadowRoot:n,getConfig:e,getViewInfo:a,getEvents:t,onMove:s,onResize:i,onCreate:l}){let r=!1,o=null,h=null,c=null,d=null,g=0,u=0,p=0,_=0,m=!1,v=null,C=null,k=null,S=null,B=null,V=null,O=null,N=null,I=null,M=null,x=null,f=null,F=0;function R(w){if(!r||w.button!==0)return;const A=w.target.closest(".cal-sched-event__resize-handle"),P=w.target.closest('.cal-sched-event[data-draggable="true"]');if(P){const U=P.dataset.eventId;if(h=t().find(j=>j.id===U),!h)return;w.preventDefault(),w.stopPropagation(),N=P,O=w.pointerId,P.setPointerCapture(w.pointerId),p=w.clientX,_=w.clientY,m=!1,C=h.startTime,v=h.endTime,k=h.start,S=h.resourceId,A?(o="resize",d=P,d.classList.add("cal-sched-event--resizing")):(o="move",d=P)}else{const U=w.target.closest("[data-time]");if(!U||w.target.closest(".cal-sched-slot-prompt"))return;const D=H(w.clientX,w.clientY);if(!D)return;w.preventDefault(),o="create",p=w.clientX,_=w.clientY,m=!1,M=D.date,x=D.resourceId,f=D.time;const j=n.querySelectorAll("[data-time]");j.length>0&&(F=j[0].getBoundingClientRect().top),N=U,O=w.pointerId,U.setPointerCapture(w.pointerId)}n.addEventListener("pointermove",L),n.addEventListener("pointerup",y)}function L(w){if(!o)return;const A=w.clientX-p,P=w.clientY-_,U=Math.sqrt(A*A+P*P);if(!(!m&&U<fa)){if(m=!0,o==="move"){if(!c&&d){const j=d.getBoundingClientRect();g=p-j.left,u=_-j.top,c=d.cloneNode(!0),c.classList.add("cal-sched-event--ghost"),c.style.cssText=`
2049
+ `,xa=4;function ka({shadowRoot:n,getConfig:e,getViewInfo:a,getEvents:t,onMove:s,onResize:i,onCreate:l}){let r=!1,o=null,h=null,c=null,d=null,p=0,u=0,g=0,f=0,m=!1,b=null,y=null,w=null,A=null,I=null,q=null,B=null,R=null,H=null,F=null,k=null,L=null,W=0;function v(E){if(!r||E.button!==0)return;const $=E.target.closest(".cal-sched-event__resize-handle"),P=E.target.closest('.cal-sched-event[data-draggable="true"]');if(P){const J=P.dataset.eventId;if(h=t().find(N=>N.id===J),!h)return;E.preventDefault(),E.stopPropagation(),R=P,B=E.pointerId,P.setPointerCapture(E.pointerId),g=E.clientX,f=E.clientY,m=!1,y=h.startTime,b=h.endTime,w=h.start,A=h.resourceId,$?(o="resize",d=P,d.classList.add("cal-sched-event--resizing")):(o="move",d=P)}else{const J=E.target.closest("[data-time]");if(!J||E.target.closest(".cal-sched-slot-prompt"))return;const D=T(E.clientX,E.clientY);if(!D)return;E.preventDefault(),o="create",g=E.clientX,f=E.clientY,m=!1,F=D.date,k=D.resourceId,L=D.time;const N=n.querySelectorAll("[data-time]");N.length>0&&(W=N[0].getBoundingClientRect().top),R=J,B=E.pointerId,J.setPointerCapture(E.pointerId)}n.addEventListener("pointermove",C),n.addEventListener("pointerup",x)}function C(E){if(!o)return;const $=E.clientX-g,P=E.clientY-f,J=Math.sqrt($*$+P*P);if(!(!m&&J<xa)){if(m=!0,o==="move"){if(!c&&d){const N=d.getBoundingClientRect();p=g-N.left,u=f-N.top,c=d.cloneNode(!0),c.classList.add("cal-sched-event--ghost"),c.style.cssText=`
2050
2050
  position: fixed;
2051
- width: ${j.width}px;
2052
- height: ${j.height}px;
2053
- left: ${j.left}px;
2054
- top: ${j.top}px;
2051
+ width: ${N.width}px;
2052
+ height: ${N.height}px;
2053
+ left: ${N.left}px;
2054
+ top: ${N.top}px;
2055
2055
  z-index: 1000;
2056
2056
  pointer-events: none;
2057
2057
  opacity: 0.85;
@@ -2064,7 +2064,7 @@
2064
2064
  font-size: 12px;
2065
2065
  line-height: 1.3;
2066
2066
  overflow: hidden;
2067
- `,c.style.setProperty("--ev-bg",d.style.getPropertyValue("--ev-bg")),c.style.setProperty("--ev-fg",d.style.getPropertyValue("--ev-fg")),n.appendChild(c),d.classList.add("cal-sched-event--dragging")}c&&(c.style.left=`${w.clientX-g}px`,c.style.top=`${w.clientY-u}px`);const D=H(w.clientX,w.clientY);D?K(D):E()}else if(o==="resize"){const D=e(),j=D.snapInterval||D.interval,ae=D.slotHeight*(j/D.interval),ce=w.clientY-_,J=Math.round(ce/ae)*j,_e=b(v),me=b(C);let te=_e+J;const ne=D.minDuration||j,de=me+ne;if(te<de&&(te=de),D.maxDuration){const ve=me+D.maxDuration;te>ve&&(te=ve)}const G=b(D.endTime);te>G&&(te=G);const he=le(te);if(d){const ve=ge(C,D.startTime,D.slotHeight,D.interval),qe=ge(he,D.startTime,D.slotHeight,D.interval);d.style.height=`${Math.max(qe-ve,D.slotHeight*.5)}px`}X(w.clientX,w.clientY,he,D.format)}else if(o==="create"){const D=e(),j=D.snapInterval||D.interval,ae=w.clientY-F,ce=pt(Math.max(0,ae),D.startTime,D.slotHeight,D.interval),ee=gt(ce,j),J=b(ee),_e=b(f),me=b(D.endTime),te=D.minDuration||j;let ne=Math.max(J,_e+te);if(D.maxDuration){const G=_e+D.maxDuration;ne>G&&(ne=G)}ne>me&&(ne=me);const de=le(ne);if(!I){I=document.createElement("div"),I.classList.add("cal-sched-create-preview");let G=null;x&&(G=n.querySelector(`[data-resource-id="${x}"][data-date="${M}"]`),G||(G=n.querySelector(`[data-date="${M}"] [data-resource-id="${x}"]`))),G||(G=n.querySelector(`[data-date="${M}"] .cal-sched-week__lane`)||n.querySelector(`[data-date="${M}"] .cal-sched-day__lane`)||n.querySelector(`[data-date="${M}"]`)),G&&G.appendChild(I)}if(I){const G=e(),he=ge(f,G.startTime,G.slotHeight,G.interval),ve=ge(de,G.startTime,G.slotHeight,G.interval);I.style.top=`${he}px`,I.style.height=`${Math.max(ve-he,G.slotHeight*.5)}px`,I.dataset.endTime=de}X(w.clientX,w.clientY,de,D.format)}}}function y(w){if(o){if(n.removeEventListener("pointermove",L),n.removeEventListener("pointerup",y),N&&O!=null){try{N.releasePointerCapture(O)}catch{}N=null,O=null}if(o==="move"){if(E(),c&&(c.remove(),c=null),d&&d.classList.remove("cal-sched-event--dragging"),m){d&&(d.dataset.wasDragged="true");const A=H(w.clientX,w.clientY);if(A&&h){const P=e(),U=b(v)-b(C),D=A.time,j=b(D),ae=Math.min(j+U,b(P.endTime)),ce=le(ae),ee={date:k,startTime:C,endTime:v,resourceId:S},J={date:A.date,startTime:D,endTime:ce,resourceId:A.resourceId||S};(ee.date!==J.date||ee.startTime!==J.startTime||ee.resourceId!==J.resourceId)&&(s==null||s({event:h,from:ee,to:J}))}}}else if(o==="resize"){if(m){const A=e(),P=A.snapInterval||A.interval,U=A.slotHeight*(P/A.interval),D=w.clientY-_,ae=Math.round(D/U)*P,ce=b(v),ee=b(C);let J=ce+ae;const _e=A.minDuration||P,me=ee+_e;if(J<me&&(J=me),A.maxDuration){const de=ee+A.maxDuration;J>de&&(J=de)}const te=b(A.endTime);J>te&&(J=te);const ne=le(J);d&&(d.dataset.wasDragged="true"),ne!==v&&h&&(i==null||i({event:h,from:{endTime:v},to:{endTime:ne}}))}d&&d.classList.remove("cal-sched-event--resizing"),$()}else if(o==="create"){$();const A=(I==null?void 0:I.dataset.endTime)||null;I&&(I.remove(),I=null),m&&M&&f&&A&&(l==null||l({date:M,startTime:f,endTime:A,resourceId:x})),M=null,x=null,f=null,F=0}o=null,h=null,d=null,g=0,u=0,p=0,_=0,m=!1,v=null,C=null,k=null,S=null}}function H(w,A){const P=e(),U=n.querySelectorAll("[data-date]");let D=null,j=null;for(const he of U){const ve=he.getBoundingClientRect();if(w>=ve.left&&w<=ve.right){if(D=he.dataset.date,he.dataset.resourceId)j=he.dataset.resourceId;else{const qe=he.querySelectorAll("[data-resource-id]");for(const yt of qe){const xt=yt.getBoundingClientRect();if(w>=xt.left&&w<=xt.right){j=yt.dataset.resourceId;break}}}break}}if(!D)return null;const ae=n.querySelectorAll("[data-time]");if(ae.length===0)return null;const ee=ae[0].getBoundingClientRect().top,J=A-ee;if(J<0)return null;const _e=P.snapInterval||P.interval,me=pt(J,P.startTime,P.slotHeight,P.interval),te=gt(me,_e),ne=b(te),de=b(P.startTime),G=b(P.endTime);return ne<de||ne>=G?null:{date:D,time:te,resourceId:j}}function K(w){E();const A=e();let P=A.interval;h&&C&&v&&(P=b(v)-b(C));let D=b(w.time)+P;const j=b(A.endTime);D>j&&(D=j);const ae=le(D);let ce=Y(w.date,w.resourceId);if(!ce)return;V=document.createElement("div"),V.classList.add("cal-sched-drop-preview");const ee=ge(w.time,A.startTime,A.slotHeight,A.interval),J=ge(ae,A.startTime,A.slotHeight,A.interval);V.style.top=`${ee}px`,V.style.height=`${Math.max(J-ee,A.slotHeight*.5)}px`,ce.appendChild(V)}function E(){V&&(V.remove(),V=null)}function Y(w,A){if(A){let U=n.querySelector(`[data-resource-id="${A}"][data-date="${w}"]`);if(U||(U=n.querySelector(`[data-date="${w}"] [data-resource-id="${A}"]`)),U)return U}const P=n.querySelector(`[data-date="${w}"]`);return P?P.querySelector(".cal-sched-week__lane")||P.querySelector(".cal-sched-day__lane")||P:null}function X(w,A,P,U){B||(B=document.createElement("div"),B.classList.add("cal-sched-drag-time-label"),n.appendChild(B));const{hours:D,minutes:j}=T(P),ae=U==="12h"?z(D,j):P;B.textContent=ae,B.style.left=`${w+12}px`,B.style.top=`${A-8}px`}function $(){B&&(B.remove(),B=null)}function T(w){const[A,P]=w.split(":").map(Number);return{hours:A,minutes:P}}function z(w,A){const P=w>=12?"PM":"AM";return`${w%12||12}:${String(A).padStart(2,"0")} ${P}`}function q(){r||(r=!0,n.addEventListener("pointerdown",R))}function Q(){r=!1,n.removeEventListener("pointerdown",R),n.removeEventListener("pointermove",L),n.removeEventListener("pointerup",y),ke()}function ke(){c&&(c.remove(),c=null),I&&(I.remove(),I=null),d&&(d.classList.remove("cal-sched-event--dragging","cal-sched-event--resizing"),d=null),E(),$(),o=null,h=null,m=!1}function ya(){Q()}return{enable:q,disable:Q,destroy:ya}}const ba=`
2067
+ `,c.style.setProperty("--ev-bg",d.style.getPropertyValue("--ev-bg")),c.style.setProperty("--ev-fg",d.style.getPropertyValue("--ev-fg")),n.appendChild(c),d.classList.add("cal-sched-event--dragging")}c&&(c.style.left=`${E.clientX-p}px`,c.style.top=`${E.clientY-u}px`);const D=T(E.clientX,E.clientY);D?X(D):Y()}else if(o==="resize"){const D=e(),N=D.snapInterval||D.interval,ae=D.slotHeight*(N/D.interval),ce=E.clientY-f,V=Math.round(ce/ae)*N,_e=_(b),me=_(y);let te=_e+V;const se=D.minDuration||N,de=me+se;if(te<de&&(te=de),D.maxDuration){const be=me+D.maxDuration;te>be&&(te=be)}const U=_(D.endTime);te>U&&(te=U);const he=ie(te);if(d){const be=ge(y,D.startTime,D.slotHeight,D.interval),Ge=ge(he,D.startTime,D.slotHeight,D.interval);d.style.height=`${Math.max(Ge-be,D.slotHeight*.5)}px`}O(E.clientX,E.clientY,he,D.format)}else if(o==="create"){const D=e(),N=D.snapInterval||D.interval,ae=E.clientY-W,ce=_t(Math.max(0,ae),D.startTime,D.slotHeight,D.interval),ee=yt(ce,N),V=_(ee),_e=_(L),me=_(D.endTime),te=D.minDuration||N;let se=Math.max(V,_e+te);if(D.maxDuration){const U=_e+D.maxDuration;se>U&&(se=U)}se>me&&(se=me);const de=ie(se);if(!H){H=document.createElement("div"),H.classList.add("cal-sched-create-preview");let U=null;k&&(U=n.querySelector(`[data-resource-id="${k}"][data-date="${F}"]`),U||(U=n.querySelector(`[data-date="${F}"] [data-resource-id="${k}"]`))),U||(U=n.querySelector(`[data-date="${F}"] .cal-sched-week__lane`)||n.querySelector(`[data-date="${F}"] .cal-sched-day__lane`)||n.querySelector(`[data-date="${F}"]`)),U&&U.appendChild(H)}if(H){const U=e(),he=ge(L,U.startTime,U.slotHeight,U.interval),be=ge(de,U.startTime,U.slotHeight,U.interval);H.style.top=`${he}px`,H.style.height=`${Math.max(be-he,U.slotHeight*.5)}px`,H.dataset.endTime=de}O(E.clientX,E.clientY,de,D.format)}}}function x(E){if(o){if(n.removeEventListener("pointermove",C),n.removeEventListener("pointerup",x),R&&B!=null){try{R.releasePointerCapture(B)}catch{}R=null,B=null}if(o==="move"){if(Y(),c&&(c.remove(),c=null),d&&d.classList.remove("cal-sched-event--dragging"),m){d&&(d.dataset.wasDragged="true");const $=T(E.clientX,E.clientY);if($&&h){const P=e(),J=_(b)-_(y),D=$.time,N=_(D),ae=Math.min(N+J,_(P.endTime)),ce=ie(ae),ee={date:w,startTime:y,endTime:b,resourceId:A},V={date:$.date,startTime:D,endTime:ce,resourceId:$.resourceId||A};(ee.date!==V.date||ee.startTime!==V.startTime||ee.resourceId!==V.resourceId)&&(s==null||s({event:h,from:ee,to:V}))}}}else if(o==="resize"){if(m){const $=e(),P=$.snapInterval||$.interval,J=$.slotHeight*(P/$.interval),D=E.clientY-f,ae=Math.round(D/J)*P,ce=_(b),ee=_(y);let V=ce+ae;const _e=$.minDuration||P,me=ee+_e;if(V<me&&(V=me),$.maxDuration){const de=ee+$.maxDuration;V>de&&(V=de)}const te=_($.endTime);V>te&&(V=te);const se=ie(V);d&&(d.dataset.wasDragged="true"),se!==b&&h&&(i==null||i({event:h,from:{endTime:b},to:{endTime:se}}))}d&&d.classList.remove("cal-sched-event--resizing"),S()}else if(o==="create"){S();const $=(H==null?void 0:H.dataset.endTime)||null;H&&(H.remove(),H=null),m&&F&&L&&$&&(l==null||l({date:F,startTime:L,endTime:$,resourceId:k})),F=null,k=null,L=null,W=0}o=null,h=null,d=null,p=0,u=0,g=0,f=0,m=!1,b=null,y=null,w=null,A=null}}function T(E,$){const P=e(),J=n.querySelectorAll("[data-date]");let D=null,N=null;for(const he of J){const be=he.getBoundingClientRect();if(E>=be.left&&E<=be.right){if(D=he.dataset.date,he.dataset.resourceId)N=he.dataset.resourceId;else{const Ge=he.querySelectorAll("[data-resource-id]");for(const Ct of Ge){const Dt=Ct.getBoundingClientRect();if(E>=Dt.left&&E<=Dt.right){N=Ct.dataset.resourceId;break}}}break}}if(!D)return null;const ae=n.querySelectorAll("[data-time]");if(ae.length===0)return null;const ee=ae[0].getBoundingClientRect().top,V=$-ee;if(V<0)return null;const _e=P.snapInterval||P.interval,me=_t(V,P.startTime,P.slotHeight,P.interval),te=yt(me,_e),se=_(te),de=_(P.startTime),U=_(P.endTime);return se<de||se>=U?null:{date:D,time:te,resourceId:N}}function X(E){Y();const $=e();let P=$.interval;h&&y&&b&&(P=_(b)-_(y));let D=_(E.time)+P;const N=_($.endTime);D>N&&(D=N);const ae=ie(D);let ce=j(E.date,E.resourceId);if(!ce)return;q=document.createElement("div"),q.classList.add("cal-sched-drop-preview");const ee=ge(E.time,$.startTime,$.slotHeight,$.interval),V=ge(ae,$.startTime,$.slotHeight,$.interval);q.style.top=`${ee}px`,q.style.height=`${Math.max(V-ee,$.slotHeight*.5)}px`,ce.appendChild(q)}function Y(){q&&(q.remove(),q=null)}function j(E,$){if($){let J=n.querySelector(`[data-resource-id="${$}"][data-date="${E}"]`);if(J||(J=n.querySelector(`[data-date="${E}"] [data-resource-id="${$}"]`)),J)return J}const P=n.querySelector(`[data-date="${E}"]`);return P?P.querySelector(".cal-sched-week__lane")||P.querySelector(".cal-sched-day__lane")||P:null}function O(E,$,P,J){I||(I=document.createElement("div"),I.classList.add("cal-sched-drag-time-label"),n.appendChild(I));const{hours:D,minutes:N}=M(P),ae=J==="12h"?z(D,N):P;I.textContent=ae,I.style.left=`${E+12}px`,I.style.top=`${$-8}px`}function S(){I&&(I.remove(),I=null)}function M(E){const[$,P]=E.split(":").map(Number);return{hours:$,minutes:P}}function z(E,$){const P=E>=12?"PM":"AM";return`${E%12||12}:${String($).padStart(2,"0")} ${P}`}function G(){r||(r=!0,n.addEventListener("pointerdown",v))}function Q(){r=!1,n.removeEventListener("pointerdown",v),n.removeEventListener("pointermove",C),n.removeEventListener("pointerup",x),le()}function le(){c&&(c.remove(),c=null),H&&(H.remove(),H=null),d&&(d.classList.remove("cal-sched-event--dragging","cal-sched-event--resizing"),d=null),Y(),S(),o=null,h=null,m=!1}function ke(){Q()}return{enable:G,disable:Q,destroy:ke}}const wa=`
2068
2068
  [data-draggable="true"] {
2069
2069
  cursor: grab;
2070
2070
  }
@@ -2149,7 +2149,7 @@
2149
2149
  z-index: 1001;
2150
2150
  white-space: nowrap;
2151
2151
  }
2152
- `,_a=`
2152
+ `,Ea=`
2153
2153
  .cal-sched {
2154
2154
  background: hsl(var(--cal-bg));
2155
2155
  border-radius: var(--cal-radius);
@@ -2160,5 +2160,5 @@
2160
2160
  .cal-sched__body {
2161
2161
  position: relative;
2162
2162
  }
2163
- `;class _t extends be{static get styles(){return[Se,Te,Me,Gt,Kt,Jt,Qt,aa,na,la,ca,ze,ha,pa,ea,ma,ba,_a]}static get observedAttributes(){return["theme","view","layout","date","start-time","end-time","interval","format","first-day","loading","slot-height","resource-mode","show-event-time","show-fab","draggable-events","snap-interval","min-duration","max-duration"]}constructor(){super(),this._store=De({view:"week",anchorDate:ue(),layout:"vertical",selectedResourceId:null,selectedSlot:null,detailEvent:null,detailResource:null,statusType:null,statusMessage:null,statusDismissible:!0,allDayCollapsed:!1}),this._resources=[],this._events=[],this._eventActions=[],this._eventContent=null,this._unsubscribe=null,this._rendering=!1,this._nowTimer=null,this._dragManager=null}get view(){return this.getAttribute("view")||this._store.get("view")}get layout(){return this.getAttribute("layout")||this._store.get("layout")}get startTime(){return this.getAttribute("start-time")||"08:00"}get endTime(){return this.getAttribute("end-time")||"18:00"}get interval(){return parseInt(this.getAttribute("interval")||"30",10)}get format(){return this.getAttribute("format")||"24h"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get slotHeight(){return parseInt(this.getAttribute("slot-height")||"48",10)}get resourceMode(){return this.getAttribute("resource-mode")||"tabs"}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get showEventTime(){return this.getAttribute("show-event-time")!=="false"}get showFab(){return this.hasAttribute("show-fab")}get draggableEvents(){return this.hasAttribute("draggable-events")}get snapInterval(){const e=this.getAttribute("snap-interval");return e?parseInt(e,10):null}get minDuration(){const e=this.getAttribute("min-duration");return e?parseInt(e,10):null}get maxDuration(){const e=this.getAttribute("max-duration");return e?parseInt(e,10):null}get resources(){return this._resources}set resources(e){this._resources=Array.isArray(e)?e:[],this._initialized&&this.render()}get events(){return this._events}set events(e){this._events=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventActions(){return this._eventActions}set eventActions(e){this._eventActions=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventContent(){return this._eventContent}set eventContent(e){this._eventContent=typeof e=="function"?e:null,this._initialized&&this.render()}get value(){return this._lastSlotValue||null}connectedCallback(){const e=this.getAttribute("date");e&&this._store.set({anchorDate:e});const a=this.getAttribute("view");a&&this._store.set({view:a});const t=this.getAttribute("layout");t&&this._store.set({layout:t}),super.connectedCallback(),this._unsubscribe=this._store.subscribe(()=>{this._rendering||this.render()}),this._nowTimer=setInterval(()=>{const s=this._store.get("view");(s==="day"||s==="week")&&this.render()},6e4),this.draggableEvents&&this._initDrag()}disconnectedCallback(){var e;(e=this._unsubscribe)==null||e.call(this),clearInterval(this._nowTimer),clearTimeout(this._statusTimer),this._destroyDrag(),this._escHandler&&(document.removeEventListener("keydown",this._escHandler),this._escHandler=null)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="date"&&t){this._store.set({anchorDate:t});return}if(e==="view"&&t){this._store.set({view:t});return}if(e==="layout"&&t){this._store.set({layout:t});return}e==="draggable-events"&&(t!==null?this._initDrag():this._destroyDrag()),this._initialized&&this.render()}}goToDate(e){this._store.set({anchorDate:e}),this.emit("cal:date-change",{date:e,view:this._store.get("view")})}setView(e){["day","week","month"].includes(e)&&(this._store.set({view:e}),this.emit("cal:view-change",{view:e,date:this._store.get("anchorDate")}))}today(){this.goToDate(ue())}next(){const e=this._store.getState(),a=W(e.anchorDate);if(!a)return;let t;if(e.view==="day")t=ye(e.anchorDate,1);else if(e.view==="week")t=ye(e.anchorDate,7);else{const{year:s,month:i}=pe(a.getFullYear(),a.getMonth(),1);t=Z(new Date(s,i,1))}this._store.set({anchorDate:t}),this.emit("cal:date-change",{date:t,view:e.view})}prev(){const e=this._store.getState(),a=W(e.anchorDate);if(!a)return;let t;if(e.view==="day")t=ye(e.anchorDate,-1);else if(e.view==="week")t=ye(e.anchorDate,-7);else{const{year:s,month:i}=pe(a.getFullYear(),a.getMonth(),-1);t=Z(new Date(s,i,1))}this._store.set({anchorDate:t}),this.emit("cal:date-change",{date:t,view:e.view})}findAvailableSlot(e){return Wt(e,this._resources,this._events,this.interval,this.startTime,this.endTime)}isSlotAvailable(e,a,t,s){return mt(this._events,s,e,a,t)}_handleSlotClick(e,a,t,s,i){this._lastSlotValue={date:e,startTime:a,endTime:t,resourceId:s,resource:i},this._store.set({selectedSlot:{date:e,startTime:a,endTime:t,resourceId:s,resource:i}}),this.emit("cal:slot-select",{date:e,startTime:a,endTime:t,resourceId:s,resource:i})}_handleSlotCreate(e,a,t,s,i){this.emit("cal:slot-create",{date:e,startTime:a,endTime:t,resourceId:s,resource:i})}_dismissSlot(){this._store.set({selectedSlot:null})}_handleEventClick(e,a,t){this._dismissSlot(),this._store.set({detailEvent:e,detailResource:t||null}),this.emit("cal:event-click",{event:e,resourceId:a,resource:t})}_closeDetail(){this._store.set({detailEvent:null,detailResource:null})}_handleViewChange(e){this._dismissSlot(),this.setView(e)}_handleResourceFilter(e){this._dismissSlot(),this._store.set({selectedResourceId:e})}_handleEventAction(e){const a=this._store.getState(),t=a.detailEvent,s=a.detailResource;this.emit("cal:event-action",{action:e,event:t,resourceId:t==null?void 0:t.resourceId,resource:s})}_initDrag(){this._dragManager||(this._dragManager=va({shadowRoot:this.shadowRoot,getConfig:()=>({slotHeight:this.slotHeight,interval:this.interval,startTime:this.startTime,endTime:this.endTime,format:this.format,snapInterval:this.snapInterval,minDuration:this.minDuration,maxDuration:this.maxDuration}),getViewInfo:()=>{const e=this._store.getState();return{view:e.view,anchorDate:e.anchorDate,weekDates:Ne(e.anchorDate,this.firstDay),resources:this._resources.length>0?this._resources:[{id:"__default",name:""}],resourceMode:this.resourceMode,selectedResourceId:e.selectedResourceId}},getEvents:()=>this._events,onMove:e=>{this.emit("cal:event-move",e)},onResize:e=>{this.emit("cal:event-resize",e)},onCreate:e=>{const a=this._resources.find(t=>t.id===e.resourceId)||null;this.emit("cal:slot-create",{...e,resource:a})}}),this._dragManager.enable())}_destroyDrag(){this._dragManager&&(this._dragManager.destroy(),this._dragManager=null)}_handleFabClick(){const e=this._store.getState();this.emit("cal:fab-create",{date:e.anchorDate,view:e.view})}render(){var _;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const m of a)m.nodeName!=="STYLE"&&!(m instanceof CSSStyleSheet)&&e.removeChild(m);const t=this._store.getState(),s=document.createElement("div");s.classList.add("cal-sched"),t.statusType&&t.statusMessage&&s.appendChild($e({type:t.statusType,message:t.statusMessage,dismissible:t.statusDismissible,onDismiss:()=>this.clearStatus()}));const i=t.view,l=t.anchorDate,r=Ne(l,this.firstDay),o=jt(i,l,r),h=this.resourceMode;s.appendChild(Xt({title:o,view:i,onPrev:()=>this.prev(),onNext:()=>this.next(),onToday:()=>this.today(),onViewChange:m=>this._handleViewChange(m)}));const c=this._resources.length>0?this._resources:[{id:"__default",name:""}],d=h==="tabs"&&c.length>1&&c[0].id!=="__default";d&&!this.loading&&s.appendChild(ua({resources:c,selectedResourceId:t.selectedResourceId,onResourceFilter:m=>this._handleResourceFilter(m)}));let g=this._events;d&&t.selectedResourceId&&(g=this._events.filter(m=>m.resourceId===t.selectedResourceId));let u=c;if(d&&t.selectedResourceId){const m=c.find(v=>v.id===t.selectedResourceId);m&&(u=[m])}const p=document.createElement("div");if(p.classList.add("cal-sched__body"),this.loading)if(i==="month")p.appendChild(oa());else{const m=i==="week"?7:Math.max(this._resources.length,1);p.appendChild(ra({columns:m,rows:Math.ceil((b(this.endTime)-b(this.startTime))/this.interval),slotHeight:this.slotHeight}))}else i==="day"?p.appendChild(ta({date:l,resources:u,events:g,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:t.layout,resourceMode:h,selectedSlot:t.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,onSlotClick:(m,v,C,k,S)=>this._handleSlotClick(m,v,C,k,S),onEventClick:(m,v,C)=>this._handleEventClick(m,v,C),onSlotCreate:(m,v,C,k,S)=>this._handleSlotCreate(m,v,C,k,S)})):i==="week"?p.appendChild(sa({date:l,firstDay:this.firstDay,resources:u,events:g,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:t.layout,resourceMode:h,selectedSlot:t.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,allDayCollapsed:t.allDayCollapsed,onToggleAllDay:()=>this._store.set({allDayCollapsed:!t.allDayCollapsed}),onSlotClick:(m,v,C,k,S)=>this._handleSlotClick(m,v,C,k,S),onEventClick:(m,v,C)=>this._handleEventClick(m,v,C),onSlotCreate:(m,v,C,k,S)=>this._handleSlotCreate(m,v,C,k,S)})):i==="month"&&p.appendChild(ia({date:l,firstDay:this.firstDay,resources:u,events:g,format:this.format,selectedResourceId:t.selectedResourceId,selectedDate:((_=t.selectedSlot)==null?void 0:_.date)||null,eventContent:this._eventContent,onSlotClick:m=>this._handleSlotClick(m,null,null,null,null),onEventClick:(m,v,C)=>this._handleEventClick(m,v,C),onSlotCreate:m=>this._handleSlotCreate(m,null,null,null,null)}));s.appendChild(p),t.detailEvent&&p.appendChild(da({event:t.detailEvent,resource:t.detailResource,format:this.format,onClose:()=>this._closeDetail(),actions:this._eventActions,onAction:m=>this._handleEventAction(m)})),this.showFab&&!this.loading&&p.appendChild(ga({onClick:()=>this._handleFabClick()})),e.appendChild(s),this._escHandler||(this._escHandler=m=>{m.key==="Escape"&&this._store.get("selectedSlot")&&this._dismissSlot()},this.shadowRoot.addEventListener("keydown",this._escHandler),document.addEventListener("keydown",this._escHandler)),this._rendering=!1}}customElements.get("cal-datepicker")||customElements.define("cal-datepicker",it),customElements.get("cal-booking")||customElements.define("cal-booking",ht),customElements.get("cal-timepicker")||customElements.define("cal-timepicker",ut),customElements.get("cal-scheduler")||customElements.define("cal-scheduler",_t),fe.CalBooking=ht,fe.CalDatepicker=it,fe.CalScheduler=_t,fe.CalTimepicker=ut,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})}));
2163
+ `;class Lt extends ve{static get styles(){return[Se,Me,Ae,Zt,Qt,aa,na,ra,ca,ha,ga,Ye,fa,va,ia,ya,wa,Ea]}static get observedAttributes(){return["theme","view","layout","date","start-time","end-time","interval","format","first-day","loading","slot-height","resource-mode","show-event-time","show-fab","draggable-events","snap-interval","min-duration","max-duration","locale"]}constructor(){super(),this._store=De({view:"week",anchorDate:ue(),layout:"vertical",selectedResourceId:null,selectedSlot:null,detailEvent:null,detailResource:null,statusType:null,statusMessage:null,statusDismissible:!0,allDayCollapsed:!1}),this._resources=[],this._events=[],this._eventActions=[],this._eventContent=null,this._colors=null,this._customColorMap=null,this._unsubscribe=null,this._rendering=!1,this._nowTimer=null,this._dragManager=null}get view(){return this.getAttribute("view")||this._store.get("view")}get layout(){return this.getAttribute("layout")||this._store.get("layout")}get startTime(){return this.getAttribute("start-time")||"08:00"}get endTime(){return this.getAttribute("end-time")||"18:00"}get interval(){return parseInt(this.getAttribute("interval")||"30",10)}get format(){return this.getAttribute("format")||"24h"}get firstDay(){return parseInt(this.getAttribute("first-day")||"0",10)}get slotHeight(){return parseInt(this.getAttribute("slot-height")||"48",10)}get resourceMode(){return this.getAttribute("resource-mode")||"tabs"}get loading(){return this.hasAttribute("loading")}set loading(e){e?this.setAttribute("loading",""):this.removeAttribute("loading")}get showEventTime(){return this.getAttribute("show-event-time")!=="false"}get showFab(){return this.hasAttribute("show-fab")}get draggableEvents(){return this.hasAttribute("draggable-events")}get snapInterval(){const e=this.getAttribute("snap-interval");return e?parseInt(e,10):null}get minDuration(){const e=this.getAttribute("min-duration");return e?parseInt(e,10):null}get maxDuration(){const e=this.getAttribute("max-duration");return e?parseInt(e,10):null}get locale(){return this.getAttribute("locale")||void 0}get resources(){return this._resources}set resources(e){this._resources=Array.isArray(e)?e:[],this._initialized&&this.render()}get events(){return this._events}set events(e){this._events=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventActions(){return this._eventActions}set eventActions(e){this._eventActions=Array.isArray(e)?e:[],this._initialized&&this.render()}get eventContent(){return this._eventContent}set eventContent(e){this._eventContent=typeof e=="function"?e:null,this._initialized&&this.render()}get colors(){return this._colors}set colors(e){if(this._colors=Array.isArray(e)?e:null,this._customColorMap=et(this._colors),this._customColorMap)for(const[a,t]of Object.entries(this._customColorMap))this.style.setProperty(`--cal-booking-${a}-bg`,t.bg),this.style.setProperty(`--cal-booking-${a}-fg`,t.fg),this.style.setProperty(`--cal-booking-${a}-hover`,t.hover);this._initialized&&this.render()}get value(){return this._lastSlotValue||null}connectedCallback(){const e=this.getAttribute("date");e&&this._store.set({anchorDate:e});const a=this.getAttribute("view");a&&this._store.set({view:a});const t=this.getAttribute("layout");t&&this._store.set({layout:t}),super.connectedCallback(),this._unsubscribe=this._store.subscribe(()=>{this._rendering||this.render()}),this._nowTimer=setInterval(()=>{const s=this._store.get("view");(s==="day"||s==="week")&&this.render()},6e4),this.draggableEvents&&this._initDrag()}disconnectedCallback(){var e;(e=this._unsubscribe)==null||e.call(this),clearInterval(this._nowTimer),clearTimeout(this._statusTimer),this._destroyDrag(),this._escHandler&&(document.removeEventListener("keydown",this._escHandler),this._escHandler=null)}attributeChangedCallback(e,a,t){if(a!==t){if(e==="date"&&t){this._store.set({anchorDate:t});return}if(e==="view"&&t){this._store.set({view:t});return}if(e==="layout"&&t){this._store.set({layout:t});return}e==="draggable-events"&&(t!==null?this._initDrag():this._destroyDrag()),this._initialized&&this.render()}}goToDate(e){this._store.set({anchorDate:e}),this.emit("cal:date-change",{date:e,view:this._store.get("view")})}setView(e){["day","week","month"].includes(e)&&(this._store.set({view:e}),this.emit("cal:view-change",{view:e,date:this._store.get("anchorDate")}))}today(){this.goToDate(ue())}next(){const e=this._store.getState(),a=K(e.anchorDate);if(!a)return;let t;if(e.view==="day")t=ye(e.anchorDate,1);else if(e.view==="week")t=ye(e.anchorDate,7);else{const{year:s,month:i}=pe(a.getFullYear(),a.getMonth(),1);t=Z(new Date(s,i,1))}this._store.set({anchorDate:t}),this.emit("cal:date-change",{date:t,view:e.view})}prev(){const e=this._store.getState(),a=K(e.anchorDate);if(!a)return;let t;if(e.view==="day")t=ye(e.anchorDate,-1);else if(e.view==="week")t=ye(e.anchorDate,-7);else{const{year:s,month:i}=pe(a.getFullYear(),a.getMonth(),-1);t=Z(new Date(s,i,1))}this._store.set({anchorDate:t}),this.emit("cal:date-change",{date:t,view:e.view})}findAvailableSlot(e){return Jt(e,this._resources,this._events,this.interval,this.startTime,this.endTime)}isSlotAvailable(e,a,t,s){return xt(this._events,s,e,a,t)}clear(){this._store.set({selectedSlot:null,detailEvent:null,detailResource:null}),this._lastSlotValue=null}_handleSlotClick(e,a,t,s,i){this._lastSlotValue={date:e,startTime:a,endTime:t,resourceId:s,resource:i},this._store.set({selectedSlot:{date:e,startTime:a,endTime:t,resourceId:s,resource:i}}),this.emit("cal:slot-select",{date:e,startTime:a,endTime:t,resourceId:s,resource:i})}_handleSlotCreate(e,a,t,s,i){this.emit("cal:slot-create",{date:e,startTime:a,endTime:t,resourceId:s,resource:i})}_dismissSlot(){this._store.set({selectedSlot:null})}_handleEventClick(e,a,t){this._dismissSlot(),this._store.set({detailEvent:e,detailResource:t||null}),this.emit("cal:event-click",{event:e,resourceId:a,resource:t})}_closeDetail(){this._store.set({detailEvent:null,detailResource:null})}_handleViewChange(e){this._dismissSlot(),this.setView(e)}_handleResourceFilter(e){this._dismissSlot(),this._store.set({selectedResourceId:e})}_handleEventAction(e){const a=this._store.getState(),t=a.detailEvent,s=a.detailResource;this.emit("cal:event-action",{action:e,event:t,resourceId:t==null?void 0:t.resourceId,resource:s})}_initDrag(){this._dragManager||(this._dragManager=ka({shadowRoot:this.shadowRoot,getConfig:()=>({slotHeight:this.slotHeight,interval:this.interval,startTime:this.startTime,endTime:this.endTime,format:this.format,snapInterval:this.snapInterval,minDuration:this.minDuration,maxDuration:this.maxDuration}),getViewInfo:()=>{const e=this._store.getState();return{view:e.view,anchorDate:e.anchorDate,weekDates:qe(e.anchorDate,this.firstDay),resources:this._resources.length>0?this._resources:[{id:"__default",name:""}],resourceMode:this.resourceMode,selectedResourceId:e.selectedResourceId}},getEvents:()=>this._events,onMove:e=>{this.emit("cal:event-move",e)},onResize:e=>{this.emit("cal:event-resize",e)},onCreate:e=>{const a=this._resources.find(t=>t.id===e.resourceId)||null;this.emit("cal:slot-create",{...e,resource:a})}}),this._dragManager.enable())}_destroyDrag(){this._dragManager&&(this._dragManager.destroy(),this._dragManager=null)}_handleFabClick(){const e=this._store.getState();this.emit("cal:fab-create",{date:e.anchorDate,view:e.view})}render(){var f;if(this._rendering)return;this._rendering=!0;const e=this.shadowRoot,a=[...e.childNodes];for(const m of a)m.nodeName!=="STYLE"&&!(m instanceof CSSStyleSheet)&&e.removeChild(m);const t=this._store.getState(),s=document.createElement("div");s.classList.add("cal-sched"),t.statusType&&t.statusMessage&&s.appendChild(Ie({type:t.statusType,message:t.statusMessage,dismissible:t.statusDismissible,onDismiss:()=>this.clearStatus()}));const i=t.view,l=t.anchorDate,r=qe(l,this.firstDay),o=Kt(i,l,r,this.locale),h=this.resourceMode;s.appendChild(Vt({title:o,view:i,onPrev:()=>this.prev(),onNext:()=>this.next(),onToday:()=>this.today(),onViewChange:m=>this._handleViewChange(m),locale:this.locale}));const c=this._resources.length>0?this._resources:[{id:"__default",name:""}],d=h==="tabs"&&c.length>1&&c[0].id!=="__default";d&&!this.loading&&s.appendChild(ba({resources:c,selectedResourceId:t.selectedResourceId,onResourceFilter:m=>this._handleResourceFilter(m)}));let p=this._events;d&&t.selectedResourceId&&(p=this._events.filter(m=>m.resourceId===t.selectedResourceId));let u=c;if(d&&t.selectedResourceId){const m=c.find(b=>b.id===t.selectedResourceId);m&&(u=[m])}const g=document.createElement("div");if(g.classList.add("cal-sched__body"),this.loading)if(i==="month")g.appendChild(pa());else{const m=i==="week"?7:Math.max(this._resources.length,1);g.appendChild(ua({columns:m,rows:Math.ceil((_(this.endTime)-_(this.startTime))/this.interval),slotHeight:this.slotHeight}))}else i==="day"?g.appendChild(la({date:l,resources:u,events:p,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:t.layout,resourceMode:h,selectedSlot:t.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,onSlotClick:(m,b,y,w,A)=>this._handleSlotClick(m,b,y,w,A),onEventClick:(m,b,y)=>this._handleEventClick(m,b,y),onSlotCreate:(m,b,y,w,A)=>this._handleSlotCreate(m,b,y,w,A)})):i==="week"?g.appendChild(oa({date:l,firstDay:this.firstDay,resources:u,events:p,startTime:this.startTime,endTime:this.endTime,interval:this.interval,slotHeight:this.slotHeight,format:this.format,layout:t.layout,resourceMode:h,selectedSlot:t.selectedSlot,eventContent:this._eventContent,showTime:this.showEventTime,draggable:this.draggableEvents,allDayCollapsed:t.allDayCollapsed,onToggleAllDay:()=>this._store.set({allDayCollapsed:!t.allDayCollapsed}),onSlotClick:(m,b,y,w,A)=>this._handleSlotClick(m,b,y,w,A),onEventClick:(m,b,y)=>this._handleEventClick(m,b,y),onSlotCreate:(m,b,y,w,A)=>this._handleSlotCreate(m,b,y,w,A)})):i==="month"&&g.appendChild(da({date:l,firstDay:this.firstDay,resources:u,events:p,format:this.format,selectedResourceId:t.selectedResourceId,selectedDate:((f=t.selectedSlot)==null?void 0:f.date)||null,eventContent:this._eventContent,onSlotClick:m=>this._handleSlotClick(m,null,null,null,null),onEventClick:(m,b,y)=>this._handleEventClick(m,b,y),onSlotCreate:m=>this._handleSlotCreate(m,null,null,null,null)}));s.appendChild(g),t.detailEvent&&g.appendChild(ma({event:t.detailEvent,resource:t.detailResource,format:this.format,onClose:()=>this._closeDetail(),actions:this._eventActions,onAction:m=>this._handleEventAction(m)})),this.showFab&&!this.loading&&g.appendChild(_a({onClick:()=>this._handleFabClick()})),e.appendChild(s),this._escHandler||(this._escHandler=m=>{m.key==="Escape"&&this._store.get("selectedSlot")&&this._dismissSlot()},this.shadowRoot.addEventListener("keydown",this._escHandler),document.addEventListener("keydown",this._escHandler)),this._rendering=!1}}customElements.get("cal-datepicker")||customElements.define("cal-datepicker",ht),customElements.get("cal-booking")||customElements.define("cal-booking",bt),customElements.get("cal-timepicker")||customElements.define("cal-timepicker",vt),customElements.get("cal-scheduler")||customElements.define("cal-scheduler",Lt),fe.CalBooking=bt,fe.CalDatepicker=ht,fe.CalScheduler=Lt,fe.CalTimepicker=vt,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})}));
2164
2164
  //# sourceMappingURL=calkit.umd.js.map