universal-datetime-picker 2.0.0 → 2.0.1

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 +1 @@
1
- "use strict";var UniversalDatetimePicker=(()=>{var St=Object.create;var fe=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var Tt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ot=(t,e)=>{for(var n in e)fe(t,n,{get:e[n],enumerable:!0})},Je=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ct(e))!Et.call(t,a)&&a!==n&&fe(t,a,{get:()=>e[a],enumerable:!(s=kt(e,a))||s.enumerable});return t};var ie=(t,e,n)=>(n=t!=null?St(Tt(t)):{},Je(e||!t||!t.__esModule?fe(n,"default",{value:t,enumerable:!0}):n,t)),Pt=t=>Je(fe({},"__esModule",{value:!0}),t);var Qe=ae((xe,Le)=>{"use strict";(function(t,e){typeof xe=="object"&&typeof Le<"u"?Le.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(xe,(function(){"use strict";var t=1e3,e=6e4,n=36e5,s="millisecond",a="second",o="minute",r="hour",y="day",m="week",d="month",i="quarter",D="year",M="date",p="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,f=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(g){var c=["th","st","nd","rd"],l=g%100;return"["+g+(c[(l-20)%10]||c[l]||c[0])+"]"}},C=function(g,c,l){var b=String(g);return!b||b.length>=c?g:""+Array(c+1-b.length).join(l)+g},$={s:C,z:function(g){var c=-g.utcOffset(),l=Math.abs(c),b=Math.floor(l/60),h=l%60;return(c<=0?"+":"-")+C(b,2,"0")+":"+C(h,2,"0")},m:function g(c,l){if(c.date()<l.date())return-g(l,c);var b=12*(l.year()-c.year())+(l.month()-c.month()),h=c.clone().add(b,d),w=l-h<0,S=c.clone().add(b+(w?-1:1),d);return+(-(b+(l-h)/(w?h-S:S-h))||0)},a:function(g){return g<0?Math.ceil(g)||0:Math.floor(g)},p:function(g){return{M:d,y:D,w:m,d:y,D:M,h:r,m:o,s:a,ms:s,Q:i}[g]||String(g||"").toLowerCase().replace(/s$/,"")},u:function(g){return g===void 0}},A="en",j={};j[A]=v;var Y="$isDayjsObject",L=function(g){return g instanceof F||!(!g||!g[Y])},T=function g(c,l,b){var h;if(!c)return A;if(typeof c=="string"){var w=c.toLowerCase();j[w]&&(h=w),l&&(j[w]=l,h=w);var S=c.split("-");if(!h&&S.length>1)return g(S[0])}else{var E=c.name;j[E]=c,h=E}return!b&&h&&(A=h),h||!b&&A},P=function(g,c){if(L(g))return g.clone();var l=typeof c=="object"?c:{};return l.date=g,l.args=arguments,new F(l)},k=$;k.l=T,k.i=L,k.w=function(g,c){return P(g,{locale:c.$L,utc:c.$u,x:c.$x,$offset:c.$offset})};var F=(function(){function g(l){this.$L=T(l.locale,null,!0),this.parse(l),this.$x=this.$x||l.x||{},this[Y]=!0}var c=g.prototype;return c.parse=function(l){this.$d=(function(b){var h=b.date,w=b.utc;if(h===null)return new Date(NaN);if(k.u(h))return new Date;if(h instanceof Date)return new Date(h);if(typeof h=="string"&&!/Z$/i.test(h)){var S=h.match(u);if(S){var E=S[2]-1||0,H=(S[7]||"0").substring(0,3);return w?new Date(Date.UTC(S[1],E,S[3]||1,S[4]||0,S[5]||0,S[6]||0,H)):new Date(S[1],E,S[3]||1,S[4]||0,S[5]||0,S[6]||0,H)}}return new Date(h)})(l),this.init()},c.init=function(){var l=this.$d;this.$y=l.getFullYear(),this.$M=l.getMonth(),this.$D=l.getDate(),this.$W=l.getDay(),this.$H=l.getHours(),this.$m=l.getMinutes(),this.$s=l.getSeconds(),this.$ms=l.getMilliseconds()},c.$utils=function(){return k},c.isValid=function(){return this.$d.toString()!==p},c.isSame=function(l,b){var h=P(l);return this.startOf(b)<=h&&h<=this.endOf(b)},c.isAfter=function(l,b){return P(l)<this.startOf(b)},c.isBefore=function(l,b){return this.endOf(b)<P(l)},c.$g=function(l,b,h){return k.u(l)?this[b]:this.set(h,l)},c.unix=function(){return Math.floor(this.valueOf()/1e3)},c.valueOf=function(){return this.$d.getTime()},c.startOf=function(l,b){var h=this,w=!!k.u(b)||b,S=k.p(l),E=function(z,_){var K=k.w(h.$u?Date.UTC(h.$y,_,z):new Date(h.$y,_,z),h);return w?K:K.endOf(y)},H=function(z,_){return k.w(h.toDate()[z].apply(h.toDate("s"),(w?[0,0,0,0]:[23,59,59,999]).slice(_)),h)},N=this.$W,V=this.$M,B=this.$D,Q="set"+(this.$u?"UTC":"");switch(S){case D:return w?E(1,0):E(31,11);case d:return w?E(1,V):E(0,V+1);case m:var q=this.$locale().weekStart||0,te=(N<q?N+7:N)-q;return E(w?B-te:B+(6-te),V);case y:case M:return H(Q+"Hours",0);case r:return H(Q+"Minutes",1);case o:return H(Q+"Seconds",2);case a:return H(Q+"Milliseconds",3);default:return this.clone()}},c.endOf=function(l){return this.startOf(l,!1)},c.$set=function(l,b){var h,w=k.p(l),S="set"+(this.$u?"UTC":""),E=(h={},h[y]=S+"Date",h[M]=S+"Date",h[d]=S+"Month",h[D]=S+"FullYear",h[r]=S+"Hours",h[o]=S+"Minutes",h[a]=S+"Seconds",h[s]=S+"Milliseconds",h)[w],H=w===y?this.$D+(b-this.$W):b;if(w===d||w===D){var N=this.clone().set(M,1);N.$d[E](H),N.init(),this.$d=N.set(M,Math.min(this.$D,N.daysInMonth())).$d}else E&&this.$d[E](H);return this.init(),this},c.set=function(l,b){return this.clone().$set(l,b)},c.get=function(l){return this[k.p(l)]()},c.add=function(l,b){var h,w=this;l=Number(l);var S=k.p(b),E=function(V){var B=P(w);return k.w(B.date(B.date()+Math.round(V*l)),w)};if(S===d)return this.set(d,this.$M+l);if(S===D)return this.set(D,this.$y+l);if(S===y)return E(1);if(S===m)return E(7);var H=(h={},h[o]=e,h[r]=n,h[a]=t,h)[S]||1,N=this.$d.getTime()+l*H;return k.w(N,this)},c.subtract=function(l,b){return this.add(-1*l,b)},c.format=function(l){var b=this,h=this.$locale();if(!this.isValid())return h.invalidDate||p;var w=l||"YYYY-MM-DDTHH:mm:ssZ",S=k.z(this),E=this.$H,H=this.$m,N=this.$M,V=h.weekdays,B=h.months,Q=h.meridiem,q=function(_,K,J,X){return _&&(_[K]||_(b,w))||J[K].slice(0,X)},te=function(_){return k.s(E%12||12,_,"0")},z=Q||function(_,K,J){var X=_<12?"AM":"PM";return J?X.toLowerCase():X};return w.replace(f,(function(_,K){return K||(function(J){switch(J){case"YY":return String(b.$y).slice(-2);case"YYYY":return k.s(b.$y,4,"0");case"M":return N+1;case"MM":return k.s(N+1,2,"0");case"MMM":return q(h.monthsShort,N,B,3);case"MMMM":return q(B,N);case"D":return b.$D;case"DD":return k.s(b.$D,2,"0");case"d":return String(b.$W);case"dd":return q(h.weekdaysMin,b.$W,V,2);case"ddd":return q(h.weekdaysShort,b.$W,V,3);case"dddd":return V[b.$W];case"H":return String(E);case"HH":return k.s(E,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return z(E,H,!0);case"A":return z(E,H,!1);case"m":return String(H);case"mm":return k.s(H,2,"0");case"s":return String(b.$s);case"ss":return k.s(b.$s,2,"0");case"SSS":return k.s(b.$ms,3,"0");case"Z":return S}return null})(_)||S.replace(":","")}))},c.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},c.diff=function(l,b,h){var w,S=this,E=k.p(b),H=P(l),N=(H.utcOffset()-this.utcOffset())*e,V=this-H,B=function(){return k.m(S,H)};switch(E){case D:w=B()/12;break;case d:w=B();break;case i:w=B()/3;break;case m:w=(V-N)/6048e5;break;case y:w=(V-N)/864e5;break;case r:w=V/n;break;case o:w=V/e;break;case a:w=V/t;break;default:w=V}return h?w:k.a(w)},c.daysInMonth=function(){return this.endOf(d).$D},c.$locale=function(){return j[this.$L]},c.locale=function(l,b){if(!l)return this.$L;var h=this.clone(),w=T(l,b,!0);return w&&(h.$L=w),h},c.clone=function(){return k.w(this.$d,this)},c.toDate=function(){return new Date(this.valueOf())},c.toJSON=function(){return this.isValid()?this.toISOString():null},c.toISOString=function(){return this.$d.toISOString()},c.toString=function(){return this.$d.toUTCString()},g})(),I=F.prototype;return P.prototype=I,[["$ms",s],["$s",a],["$m",o],["$H",r],["$W",y],["$M",d],["$y",D],["$D",M]].forEach((function(g){I[g[1]]=function(c){return this.$g(c,g[0],g[1])}})),P.extend=function(g,c){return g.$i||(g(c,F,P),g.$i=!0),P},P.locale=T,P.isDayjs=L,P.unix=function(g){return P(1e3*g)},P.en=j[A],P.Ls=j,P.p={},P}))});var Xe=ae((Ae,He)=>{"use strict";(function(t,e){typeof Ae=="object"&&typeof He<"u"?He.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Ae,(function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,s=/\d\d/,a=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,r={},y=function(u){return(u=+u)+(u>68?1900:2e3)},m=function(u){return function(f){this[u]=+f}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(u){(this.zone||(this.zone={})).offset=(function(f){if(!f||f==="Z")return 0;var v=f.match(/([+-]|\d\d)/g),C=60*v[1]+(+v[2]||0);return C===0?0:v[0]==="+"?-C:C})(u)}],i=function(u){var f=r[u];return f&&(f.indexOf?f:f.s.concat(f.f))},D=function(u,f){var v,C=r.meridiem;if(C){for(var $=1;$<=24;$+=1)if(u.indexOf(C($,0,f))>-1){v=$>12;break}}else v=u===(f?"pm":"PM");return v},M={A:[o,function(u){this.afternoon=D(u,!1)}],a:[o,function(u){this.afternoon=D(u,!0)}],Q:[n,function(u){this.month=3*(u-1)+1}],S:[n,function(u){this.milliseconds=100*+u}],SS:[s,function(u){this.milliseconds=10*+u}],SSS:[/\d{3}/,function(u){this.milliseconds=+u}],s:[a,m("seconds")],ss:[a,m("seconds")],m:[a,m("minutes")],mm:[a,m("minutes")],H:[a,m("hours")],h:[a,m("hours")],HH:[a,m("hours")],hh:[a,m("hours")],D:[a,m("day")],DD:[s,m("day")],Do:[o,function(u){var f=r.ordinal,v=u.match(/\d+/);if(this.day=v[0],f)for(var C=1;C<=31;C+=1)f(C).replace(/\[|\]/g,"")===u&&(this.day=C)}],w:[a,m("week")],ww:[s,m("week")],M:[a,m("month")],MM:[s,m("month")],MMM:[o,function(u){var f=i("months"),v=(i("monthsShort")||f.map((function(C){return C.slice(0,3)}))).indexOf(u)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[o,function(u){var f=i("months").indexOf(u)+1;if(f<1)throw new Error;this.month=f%12||f}],Y:[/[+-]?\d+/,m("year")],YY:[s,function(u){this.year=y(u)}],YYYY:[/\d{4}/,m("year")],Z:d,ZZ:d};function p(u){var f,v;f=u,v=r&&r.formats;for(var C=(u=f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(P,k,F){var I=F&&F.toUpperCase();return k||v[F]||t[F]||v[I].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(g,c,l){return c||l.slice(1)}))}))).match(e),$=C.length,A=0;A<$;A+=1){var j=C[A],Y=M[j],L=Y&&Y[0],T=Y&&Y[1];C[A]=T?{regex:L,parser:T}:j.replace(/^\[|\]$/g,"")}return function(P){for(var k={},F=0,I=0;F<$;F+=1){var g=C[F];if(typeof g=="string")I+=g.length;else{var c=g.regex,l=g.parser,b=P.slice(I),h=c.exec(b)[0];l.call(k,h),P=P.replace(h,"")}}return(function(w){var S=w.afternoon;if(S!==void 0){var E=w.hours;S?E<12&&(w.hours+=12):E===12&&(w.hours=0),delete w.afternoon}})(k),k}}return function(u,f,v){v.p.customParseFormat=!0,u&&u.parseTwoDigitYear&&(y=u.parseTwoDigitYear);var C=f.prototype,$=C.parse;C.parse=function(A){var j=A.date,Y=A.utc,L=A.args;this.$u=Y;var T=L[1];if(typeof T=="string"){var P=L[2]===!0,k=L[3]===!0,F=P||k,I=L[2];k&&(I=L[2]),r=this.$locale(),!P&&I&&(r=v.Ls[I]),this.$d=(function(b,h,w,S){try{if(["x","X"].indexOf(h)>-1)return new Date((h==="X"?1e3:1)*b);var E=p(h)(b),H=E.year,N=E.month,V=E.day,B=E.hours,Q=E.minutes,q=E.seconds,te=E.milliseconds,z=E.zone,_=E.week,K=new Date,J=V||(H||N?1:K.getDate()),X=H||K.getFullYear(),ce=0;H&&!N||(ce=N>0?N-1:K.getMonth());var he,Te=B||0,Ee=Q||0,Oe=q||0,Pe=te||0;return z?new Date(Date.UTC(X,ce,J,Te,Ee,Oe,Pe+60*z.offset*1e3)):w?new Date(Date.UTC(X,ce,J,Te,Ee,Oe,Pe)):(he=new Date(X,ce,J,Te,Ee,Oe,Pe),_&&(he=S(he).week(_).toDate()),he)}catch{return new Date("")}})(j,T,Y,v),this.init(),I&&I!==!0&&(this.$L=this.locale(I).$L),F&&j!=this.format(T)&&(this.$d=new Date("")),r={}}else if(T instanceof Array)for(var g=T.length,c=1;c<=g;c+=1){L[1]=T[c-1];var l=v.apply(this,L);if(l.isValid()){this.$d=l.$d,this.$L=l.$L,this.init();break}c===g&&(this.$d=new Date(""))}else $.call(this,A)}}}))});var et=ae(($e,Ye)=>{"use strict";(function(t,e){typeof $e=="object"&&typeof Ye<"u"?Ye.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isSameOrAfter=e()})($e,(function(){"use strict";return function(t,e){e.prototype.isSameOrAfter=function(n,s){return this.isSame(n,s)||this.isAfter(n,s)}}}))});var tt=ae((Ne,Re)=>{"use strict";(function(t,e){typeof Ne=="object"&&typeof Re<"u"?Re.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isSameOrBefore=e()})(Ne,(function(){"use strict";return function(t,e){e.prototype.isSameOrBefore=function(n,s){return this.isSame(n,s)||this.isBefore(n,s)}}}))});var nt=ae((je,Ve)=>{"use strict";(function(t,e){typeof je=="object"&&typeof Ve<"u"?Ve.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_localeData=e()})(je,(function(){"use strict";return function(t,e,n){var s=e.prototype,a=function(d){return d&&(d.indexOf?d:d.s)},o=function(d,i,D,M,p){var u=d.name?d:d.$locale(),f=a(u[i]),v=a(u[D]),C=f||v.map((function(A){return A.slice(0,M)}));if(!p)return C;var $=u.weekStart;return C.map((function(A,j){return C[(j+($||0))%7]}))},r=function(){return n.Ls[n.locale()]},y=function(d,i){return d.formats[i]||(function(D){return D.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(M,p,u){return p||u.slice(1)}))})(d.formats[i.toUpperCase()])},m=function(){var d=this;return{months:function(i){return i?i.format("MMMM"):o(d,"months")},monthsShort:function(i){return i?i.format("MMM"):o(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(i){return i?i.format("dddd"):o(d,"weekdays")},weekdaysMin:function(i){return i?i.format("dd"):o(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(i){return i?i.format("ddd"):o(d,"weekdaysShort","weekdays",3)},longDateFormat:function(i){return y(d.$locale(),i)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};s.localeData=function(){return m.bind(this)()},n.localeData=function(){var d=r();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return n.weekdays()},weekdaysShort:function(){return n.weekdaysShort()},weekdaysMin:function(){return n.weekdaysMin()},months:function(){return n.months()},monthsShort:function(){return n.monthsShort()},longDateFormat:function(i){return y(d,i)},meridiem:d.meridiem,ordinal:d.ordinal}},n.months=function(){return o(r(),"months")},n.monthsShort=function(){return o(r(),"monthsShort","months",3)},n.weekdays=function(d){return o(r(),"weekdays",null,null,d)},n.weekdaysShort=function(d){return o(r(),"weekdaysShort","weekdays",3,d)},n.weekdaysMin=function(d){return o(r(),"weekdaysMin","weekdays",2,d)}}}))});var st=ae((_e,Fe)=>{"use strict";(function(t,e){typeof _e=="object"&&typeof Fe<"u"?Fe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_weekday=e()})(_e,(function(){"use strict";return function(t,e){e.prototype.weekday=function(n){var s=this.$locale().weekStart||0,a=this.$W,o=(a<s?a+7:a)-s;return this.$utils().u(n)?o:this.subtract(o,"day").add(n,"day")}}}))});var Rt={};Ot(Rt,{defineCustomElements:()=>Ce,ensureStylesheet:()=>ke});var x=ie(Qe()),it=ie(Xe()),ot=ie(et()),rt=ie(tt()),lt=ie(nt()),ut=ie(st());x.default.extend(it.default);x.default.extend(ot.default);x.default.extend(rt.default);x.default.extend(lt.default);x.default.extend(ut.default);var dt="YYYY-MM-DD HH:mm:ss",ne="YYYY-MM-DD";function re(t){if(t.format)return t.format;let e=t.mode??"datetime",n=t.showSeconds!==!1,a=!!t.use12Hours?n?"hh:mm:ss A":"hh:mm A":n?"HH:mm:ss":"HH:mm";return e==="date"?ne:e==="time"?a:`${ne} ${a}`}function ct(t,e){let n=t.hour(),{hour:s,isAm:a}=le(n);return{hour:s,hour24:n,minute:t.minute(),second:t.second(),ampm:a?"AM":"PM",formatted:t.format(e)}}var at=!1;function me(){at||typeof process<"u"&&process.env.NODE_ENV==="production"||(at=!0,console.warn("[universal-datetime-picker] Omitting `asString` currently returns a formatted string. Set `asString={true}` to keep strings, or `asString={false}` to receive a Date / TimeValue. A future major release will default to Date / TimeValue."))}function G(t,e=dt){if(t==null||t==="")return null;if(x.default.isDayjs(t))return t.isValid()?t:null;if(t instanceof Date){let s=(0,x.default)(t);return s.isValid()?s:null}if(typeof t=="string"){let s=(0,x.default)(t,e,!0);if(s.isValid())return s;let a=(0,x.default)(t);return a.isValid()?a:null}let n=(0,x.default)(t);return n.isValid()?n:null}function ee(t,e=dt){return!t||!t.isValid()?null:t.format(e)}function Ie(t){return String(t).padStart(2,"0")}var ht=Array.from({length:24},(t,e)=>Ie(e)),ft=Array.from({length:12},(t,e)=>Ie(e===0?12:e)),mt=Array.from({length:60},(t,e)=>Ie(e));function le(t){let e=t<12;return{hour:t%12===0?12:t%12,isAm:e}}function pe(t,e){return t===12?e?0:12:e?t:t+12}function U(t,e,n){return t.locale(n).format(e)}function be(t,e){let n=(0,x.default)().locale(t).localeData().weekdaysMin();return[...n.slice(e),...n.slice(0,e)]}function se(t,e){let s=(t.day()-e+7)%7;return t.subtract(s,"day").startOf("day")}function oe(t,e){return se(t,e).add(6,"day").endOf("day")}function xt(t,e){let n=(0,x.default)().startOf("day"),s=t.startOf("day");if(e.disablePastDates&&s.isBefore(n,"day")||e.disableFutureDates&&s.isAfter(n,"day"))return!0;let a=G(e.minDate??null),o=G(e.maxDate??null);return!!(a&&s.isBefore(a.startOf("day"),"day")||o&&s.isAfter(o.startOf("day"),"day"))}function ye(t){let e=t.weekStartsOn??0,n=t.viewMonth.startOf("month"),s=t.viewMonth.endOf("month"),a=se(n,e),o=oe(s,e),r=[],y=a.clone();for(;y.isBefore(o)||y.isSame(o,"day");){let m=[];for(let d=0;d<7;d+=1){let i=y.clone(),D=i.isSame(t.viewMonth,"month"),M=!!(t.selected&&i.isSame(t.selected,"day")),p=!!(t.rangeStart&&i.isSame(t.rangeStart,"day")),u=!!(t.rangeEnd&&i.isSame(t.rangeEnd,"day")),f=t.rangeEnd??t.hoverEnd??null,v=!1;if(t.rangeStart&&f){let C=t.rangeStart.isBefore(f,"day")?t.rangeStart:f,$=t.rangeStart.isBefore(f,"day")?f:t.rangeStart;v=i.isAfter(C,"day")&&i.isBefore($,"day")||i.isSame(C,"day")||i.isSame($,"day")}m.push({date:i,isCurrentMonth:D,isCurrentDate:i.isSame((0,x.default)(),"day"),isFuture:i.isAfter((0,x.default)(),"day"),isPast:i.isBefore((0,x.default)(),"day"),isWeekend:i.day()===0||i.day()===6,isDisabled:xt(i,t),isSelected:M,isInRange:v,isRangeStart:p,isRangeEnd:u}),y=y.add(1,"day")}r.push(m)}return r}var ve={date:"Date",time:"Time",clear:"Clear",close:"Close",ok:"OK",start:"Start",end:"End",chooseDate:"Choose date",chooseDateRange:"Choose date range",chooseMonth:"Choose month",chooseYear:"Choose year",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",selectEnd:"Select end date"};function ge(t){return String(t).padStart(2,"0")}var De=class{constructor(e={}){this.listeners=new Set;this.calPanel="day";this.showHours=!1;this.showMinutes=!1;this.showSecondsOpen=!1;this.showAmPm=!1;this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});this.getSnapshot=()=>this.snapshot;this.getServerSnapshot=()=>this.snapshot;this.options={...e};let n=e.mode??"datetime",s=e.showSeconds!==!1,a=!!e.use12Hours,o=re({mode:n,format:e.format,use12Hours:a,showSeconds:s}),r=G(e.value??e.defaultValue??(0,x.default)(),o)??(0,x.default)();this.draft=r,this.viewMonth=r.startOf("month"),this.focusedDay=r,this.tab=n==="time"?"time":"date",this.open=e.open??(e.inline?!0:e.defaultOpen??!0),this.snapshot=this.buildSnapshot()}setOptions(e){let n=this.options;if(this.options={...this.options,...e},e.mode!==void 0&&e.mode!==n.mode&&(this.tab=e.mode==="time"?"time":"date"),e.open!==void 0&&(this.open=e.open),"value"in e){if(e.value===null){let s=(0,x.default)();this.draft=s,this.viewMonth=s.startOf("month"),this.focusedDay=s}else if(e.value!==void 0){let s=this.getResolvedFormat(),a=G(e.value,s);a&&(this.draft=a,this.viewMonth=a.startOf("month"),this.focusedDay=a)}}this.emit()}getResolvedFormat(){return re({mode:this.options.mode??"datetime",format:this.options.format,use12Hours:!!this.options.use12Hours,showSeconds:this.options.showSeconds!==!1})}getLabels(){return{...ve,...this.options.labels}}emit(){this.snapshot=this.buildSnapshot(),this.listeners.forEach(e=>e())}buildSnapshot(){let e=this.options.mode??"datetime",n=this.options.layout??"combined",s=this.options.showSeconds!==!1,a=!!this.options.use12Hours,o=!!this.options.inline,r=!!this.options.popover,y=this.options.weekStartsOn??0,m=this.options.locale??"en",d=this.getResolvedFormat(),i=this.getLabels(),D=ye({viewMonth:this.viewMonth,selected:this.draft,minDate:this.options.minDate,maxDate:this.options.maxDate,disablePastDates:this.options.disablePastDates,disableFutureDates:this.options.disableFutureDates,weekStartsOn:y}),M=e!=="time",p=e!=="date",u=e==="datetime"&&n==="tabs",f=M&&(!u||this.tab==="date"),v=p&&(!u||this.tab==="time"),C=this.draft.hour(),{hour:$,isAm:A}=le(C);return{draft:this.draft,viewMonth:this.viewMonth,calPanel:this.calPanel,tab:this.tab,showHours:this.showHours,showMinutes:this.showMinutes,showSecondsOpen:this.showSecondsOpen,showAmPm:this.showAmPm,focusedDay:this.focusedDay,open:this.open,mode:e,layout:n,showSeconds:s,use12Hours:a,inline:o,popover:r,weekStartsOn:y,locale:m,labels:i,resolvedFormat:d,asString:this.options.asString,className:this.options.className,theme:this.options.theme,weeks:D,weekdayLabels:be(m,y),showDate:M,showTime:p,useTabs:u,showDatePanel:f,showTimePanel:v,showModeTabs:u,hour24:C,hour12:$,isAm:A,hourOptions:a?ft:ht,displayHour:ge(a?$:C),displayMinute:ge(this.draft.minute()),displaySecond:ge(this.draft.second()),minuteOptions:mt}}setOpen(e){this.options.inline||(this.open=e,this.options.onOpenChange?.(e),this.emit())}close(){this.options.inline||this.setOpen(!1)}setTab(e){this.tab=e,this.emit()}setCalPanel(e){this.calPanel=e,this.emit()}setViewMonth(e){this.viewMonth=typeof e=="function"?e(this.viewMonth):e,this.emit()}selectDay(e){this.draft=this.draft.year(e.year()).month(e.month()).date(e.date()),this.focusedDay=e,this.emit()}setHour(e){this.draft=this.draft.hour(e),this.emit()}setMinute(e){this.draft=this.draft.minute(e),this.emit()}setSecond(e){this.draft=this.draft.second(e),this.emit()}setAmPm(e){let{hour:n}=le(this.draft.hour());this.draft=this.draft.hour(pe(n,e)),this.emit()}toggleHours(){this.showHours=!this.showHours,this.showMinutes=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}toggleMinutes(){this.showMinutes=!this.showMinutes,this.showHours=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}toggleSeconds(){this.showSecondsOpen=!this.showSecondsOpen,this.showHours=!1,this.showMinutes=!1,this.showAmPm=!1,this.emit()}toggleAmPm(){this.showAmPm=!this.showAmPm,this.showHours=!1,this.showMinutes=!1,this.showSecondsOpen=!1,this.emit()}closeTimeColumns(){this.showHours=!1,this.showMinutes=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}selectHourOption(e){let n=this.snapshot;n.use12Hours?this.draft=this.draft.hour(pe(Number(e),n.isAm)):this.draft=this.draft.hour(Number(e)),this.showHours=!1,this.emit()}selectMinuteOption(e){this.draft=this.draft.minute(Number(e)),this.showMinutes=!1,this.emit()}selectSecondOption(e){this.draft=this.draft.second(Number(e)),this.showSecondsOpen=!1,this.emit()}selectAmPmOption(e){let{hour:n}=le(this.draft.hour());this.draft=this.draft.hour(pe(n,e==="AM")),this.showAmPm=!1,this.emit()}handleGridKeyDown(e){let n=this.snapshot,s=this.focusedDay;switch(e){case"ArrowLeft":s=this.focusedDay.subtract(1,"day");break;case"ArrowRight":s=this.focusedDay.add(1,"day");break;case"ArrowUp":s=this.focusedDay.subtract(7,"day");break;case"ArrowDown":s=this.focusedDay.add(7,"day");break;case"Home":s=se(this.focusedDay,n.weekStartsOn);break;case"End":s=oe(this.focusedDay,n.weekStartsOn);break;case"PageUp":s=this.focusedDay.subtract(1,"month"),this.viewMonth=s.startOf("month");break;case"PageDown":s=this.focusedDay.add(1,"month"),this.viewMonth=s.startOf("month");break;case"Enter":case" ":{let a=n.weeks.flat().find(o=>o.date.isSame(this.focusedDay,"day"));return a&&!a.isDisabled&&a.isCurrentMonth&&this.selectDay(a.date),!0}default:return!1}return this.focusedDay=s,s.isSame(this.viewMonth,"month")||(this.viewMonth=s.startOf("month")),this.emit(),!0}confirm(){let e=this.snapshot,n;return e.asString===!1?e.mode==="time"?n=ct(this.draft,e.resolvedFormat):e.mode==="date"?n=this.draft.startOf("day").toDate():n=this.draft.toDate():(e.asString===void 0&&me(),n=ee(this.draft,e.resolvedFormat)),this.options.onChange?.(n),this.close(),n}clear(){this.options.onChange?.(null),this.close()}yearWindowStart(e){return Math.floor(e/12)*12}navigatePrev(){this.calPanel==="day"?this.viewMonth=this.viewMonth.subtract(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.subtract(1,"year"):this.viewMonth=this.viewMonth.subtract(12,"year"),this.emit()}navigateNext(){this.calPanel==="day"?this.viewMonth=this.viewMonth.add(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.add(1,"year"):this.viewMonth=this.viewMonth.add(12,"year"),this.emit()}selectMonth(e){this.viewMonth=this.viewMonth.month(e),this.calPanel="day",this.emit()}selectYear(e){this.viewMonth=this.viewMonth.year(e),this.calPanel="month",this.emit()}};var Lt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ue(t,e){if(!e)return()=>{};let n=document.activeElement,s=()=>Array.from(t.querySelectorAll(Lt)).filter(r=>!r.hasAttribute("disabled")&&r.offsetParent!==null);s()[0]?.focus({preventScroll:!0});let o=r=>{if(r.key!=="Tab")return;let y=s();if(y.length===0)return;let m=y[0],d=y[y.length-1];r.shiftKey&&document.activeElement===m?(r.preventDefault(),d.focus({preventScroll:!0})):!r.shiftKey&&document.activeElement===d&&(r.preventDefault(),m.focus({preventScroll:!0}))};return t.addEventListener("keydown",o),()=>{t.removeEventListener("keydown",o),n?.focus?.({preventScroll:!0})}}function de(t,e){if(!e)return()=>{};let n=s=>{s.key==="Escape"&&(s.preventDefault(),t())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}function bt(t,e,n,s){if(!e)return()=>{};let a=o=>{let r=o.target;r instanceof Node&&(n?.contains(r)||s?.contains(r)||t())};return document.addEventListener("pointerdown",a,!0),()=>{document.removeEventListener("pointerdown",a,!0)}}function pt(t,e,n){let s=t.getBoundingClientRect(),a=s.bottom+8,o=s.left;if(o+e>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-e-8)),o<8&&(o=8),a+n>window.innerHeight-8){let r=s.top-n-8;r>=8?a=r:a=Math.max(8,window.innerHeight-n-8)}return{top:a,left:o}}function yt(t,e,n,s,a){if(!e||!n||!t)return a(null),()=>{};let o=()=>{if(!s){a(pt(t,300,360));return}let y=s.offsetWidth||300,m=s.offsetHeight||360;a(pt(t,y,m))};o(),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);let r;return s&&typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>o()),r.observe(s)),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),r?.disconnect()}}function Be(t,e){if(t==="light"||t==="dark")return t;let n=e??null;for(;n;){let s=n.getAttribute("data-ctp-theme");if(s==="dark"||s==="light")return s;n=n.parentElement}if(typeof document<"u"){let s=document.documentElement.getAttribute("data-ctp-theme");if(s==="dark"||s==="light")return s}}function W(...t){return t.filter(Boolean).join(" ")}function At(t,e){if(e){if(typeof e=="string"){t.setAttribute("style",e);return}Object.assign(t.style,e)}}function O(t,e={},n=[]){let s=document.createElement(t);for(let[a,o]of Object.entries(e))if(!(o==null||o===!1))if(a==="className")s.className=String(o);else if(a==="textContent")s.textContent=String(o);else if(a.startsWith("on")&&typeof o=="function"){let r=a.slice(2).toLowerCase();s.addEventListener(r,o)}else a==="disabled"?s.disabled=!!o:a==="tabIndex"?s.tabIndex=Number(o):s.setAttribute(a==="ariaLabel"?"aria-label":a==="ariaSelected"?"aria-selected":a==="ariaDisabled"?"aria-disabled":a==="ariaExpanded"?"aria-expanded":a==="ariaControls"?"aria-controls":a==="ariaHaspopup"?"aria-haspopup":a==="ariaModal"?"aria-modal":a==="ariaLabelledby"?"aria-labelledby":a==="ariaCurrent"?"aria-current":a,String(o));for(let a of n)a!=null&&s.append(a);return s}function Ht(t,e,n){let s=e.viewMonth.year(),a=t.yearWindowStart(s),o=a+11,r=(0,x.default)(),y=e.calPanel==="day"?e.labels.previousMonth:e.labels.previousYear,m=e.calPanel==="day"?e.labels.nextMonth:e.labels.nextYear,d;e.calPanel==="day"?d=O("button",{type:"button",className:"ctp-current-month",id:n,ariaLabel:`${U(e.viewMonth,"MMMM YYYY",e.locale)}. ${e.labels.chooseMonth}`,onClick:()=>t.setCalPanel("month"),textContent:U(e.viewMonth,"MMMM YYYY",e.locale)}):e.calPanel==="month"?d=O("button",{type:"button",className:"ctp-current-month",id:n,ariaLabel:`${s}. ${e.labels.chooseYear}`,onClick:()=>t.setCalPanel("year"),textContent:String(s)}):d=O("span",{className:"ctp-current-month",id:n,textContent:`${a} \u2013 ${o}`});let i=O("div",{className:"ctp-body ctp-body-calendar-date"},[O("div",{className:"ctp-month-year"},[O("button",{type:"button",className:"ctp-prev-month",ariaLabel:y,onClick:()=>t.navigatePrev(),textContent:"\u2039"}),d,O("button",{type:"button",className:"ctp-next-month",ariaLabel:m,onClick:()=>t.navigateNext(),textContent:"\u203A"})])]);if(e.calPanel==="month"){let D=O("div",{className:"ctp-month-grid",role:"grid",ariaLabel:e.labels.chooseMonth});for(let M=0;M<12;M+=1){let p=e.viewMonth.month(M),u=e.viewMonth.year()===r.year()&&M===r.month();D.append(O("button",{type:"button",role:"gridcell",ariaCurrent:u?"date":void 0,ariaLabel:U(p,"MMMM YYYY",e.locale),className:W("ctp-box","ctp-box-month",u&&"ctp-current"),onClick:()=>t.selectMonth(M),textContent:U(p,"MMM",e.locale)}))}i.append(D)}else if(e.calPanel==="year"){let D=O("div",{className:"ctp-year-grid",role:"grid",ariaLabel:e.labels.chooseYear});for(let M=0;M<12;M+=1){let p=a+M,u=r.year()===p;D.append(O("button",{type:"button",role:"gridcell",ariaCurrent:u?"date":void 0,ariaLabel:String(p),className:W("ctp-box","ctp-box-year",u&&"ctp-current"),onClick:()=>t.selectYear(p),textContent:String(p)}))}i.append(D)}else{let D=O("div",{className:"ctp-main-calendar",role:"grid",ariaLabel:e.labels.chooseDate,tabIndex:0,onKeydown:M=>{let p=M;t.handleGridKeyDown(p.key)&&p.preventDefault()}});for(let M of e.weekdayLabels)D.append(O("div",{className:"ctp-box ctp-box-days",role:"columnheader",textContent:M}));for(let M of e.weeks)for(let p of M){let u=p.isSelected,f=p.date.isSame(e.focusedDay,"day"),v=!p.isCurrentMonth||p.isDisabled;D.append(O("button",{type:"button",role:"gridcell",tabIndex:f?0:-1,ariaSelected:u,ariaDisabled:v,disabled:v,ariaLabel:U(p.date,"dddd, MMMM D, YYYY",e.locale),className:W("ctp-box","ctp-box-date",!p.isCurrentMonth&&"not-current-month",u&&"selected",p.isDisabled&&"disabled-date",p.isWeekend&&"weekend-day",p.isCurrentDate&&"ctp-today",p.isInRange&&"ctp-in-range",p.isRangeStart&&"ctp-range-start",p.isRangeEnd&&"ctp-range-end"),onClick:()=>{v||t.selectDay(p.date)},textContent:p.date.format("D")}))}i.append(D)}return i}function we(t,e,n,s,a,o){let r=`ctp-${t}-${Math.random().toString(36).slice(2,8)}`,y=t==="am-pm"?"am-pm":t.endsWith("s")?t.slice(0,-1):t,m=O("div",{id:r,role:"listbox",ariaLabel:t,className:W(`ctp-overflow-${t}`,!e&&"not-visible")},s.map(d=>O("button",{type:"button",role:"option",ariaSelected:d===n,className:`ctp-${y}`,onClick:()=>o(d),textContent:d})));return O("div",{className:W("ctp-box","ctp-box-time",!e&&"not-opened")},[O("button",{type:"button",className:`ctp-${y} ctp-initial-time`,ariaHaspopup:"listbox",ariaExpanded:e,ariaControls:r,ariaLabel:`Select ${t}`,onClick:a,textContent:n}),m])}function $t(t,e,n){let s=O("div",{className:"ctp-body ctp-body-calendar-time"});e.showDatePanel?s.append(O("div",{className:"ctp-section-label",textContent:e.labels.time})):s.append(O("span",{className:"ctp-visually-hidden",id:n,textContent:e.labels.time}));let a=O("div",{className:"ctp-main-time-header"},[O("div",{className:"ctp-box",textContent:"Hr"}),O("div",{className:"ctp-box",textContent:"Min"}),e.showSeconds?O("div",{className:"ctp-box",textContent:"Sec"}):null,e.use12Hours?O("div",{className:"ctp-box",textContent:"AM/PM"}):null]),o=O("div",{className:"ctp-main-time-body"},[we("hours",e.showHours,e.displayHour,e.hourOptions,()=>t.toggleHours(),r=>t.selectHourOption(r)),we("minutes",e.showMinutes,e.displayMinute,e.minuteOptions,()=>t.toggleMinutes(),r=>t.selectMinuteOption(r)),e.showSeconds?we("seconds",e.showSecondsOpen,e.displaySecond,e.minuteOptions,()=>t.toggleSeconds(),r=>t.selectSecondOption(r)):null,e.use12Hours?we("am-pm",e.showAmPm,e.isAm?"AM":"PM",["AM","PM"],()=>t.toggleAmPm(),r=>t.selectAmPmOption(r)):null]);return s.append(O("div",{className:"ctp-main-time"},[a,o])),s}function Yt(t,e,n,s,a){let o=Be(a.theme,a.anchorEl),r=O("div",{className:W("ctp-calendar-time-picker",e.popover&&!e.inline&&"ctp-popover",e.use12Hours&&"ctp-use-12h",e.mode==="time"&&"ctp-mode-time",!e.showSeconds&&"ctp-no-seconds",e.showDatePanel&&e.showTimePanel&&"ctp-layout-combined",e.className),role:e.inline?void 0:"dialog",ariaModal:e.inline?void 0:!0,ariaLabelledby:n});o&&r.setAttribute("data-ctp-theme",o),At(r,a.style),e.popover&&!e.inline&&s&&(r.style.position="fixed",r.style.top=`${s.top}px`,r.style.left=`${s.left}px`),e.showModeTabs&&r.append(O("div",{className:"ctp-header"},[O("div",{className:"ctp-button-container",role:"tablist",ariaLabel:"Picker mode"},[O("button",{type:"button",role:"tab",ariaSelected:e.tab==="date",className:W("ctp-date",e.tab==="date"&&"ctp-active"),onClick:()=>t.setTab("date"),textContent:e.labels.date}),O("button",{type:"button",role:"tab",ariaSelected:e.tab==="time",className:W("ctp-time",e.tab==="time"&&"ctp-active"),onClick:()=>t.setTab("time"),textContent:e.labels.time})])])),e.showDatePanel&&r.append(Ht(t,e,n)),e.showTimePanel&&r.append($t(t,e,n));let y=[O("button",{type:"button",className:"close-button",onClick:()=>t.clear(),textContent:e.labels.clear})];return e.inline||y.push(O("button",{type:"button",className:"ctp-cancel",onClick:()=>t.close(),textContent:e.labels.close})),y.push(O("button",{type:"button",onClick:()=>t.confirm(),textContent:e.labels.ok})),r.append(O("div",{className:"ctp-footer"},y)),r}function We(t,e={}){let n=new De(e),s=`ctp-title-${Math.random().toString(36).slice(2,9)}`,a=[],o=null,r=null,y=null,m=()=>{a.forEach(D=>D()),a=[],y?.remove(),y=null,r&&r.parentElement===t&&r.remove(),r=null},d=()=>{m();let D=n.getSnapshot();if(!D.open&&!D.inline)return;let M={...e},p=Yt(n,D,s,o,M);if(D.inline){r=p,t.append(p);return}if(D.popover){y=p,document.body.append(p),a.push(ue(p,!0),de(()=>n.close(),!0),bt(()=>n.close(),!0,p,e.anchorEl),yt(e.anchorEl,!0,!0,p,v=>{o=v,v&&(p.style.position="fixed",p.style.top=`${v.top}px`,p.style.left=`${v.left}px`)}));return}let u=Be(e.theme,e.anchorEl),f=O("div",{className:"ctp-calendar-time-picker-absolute-container",onClick:v=>{v.target===v.currentTarget&&n.close()}});u&&f.setAttribute("data-ctp-theme",u),f.append(p),y=f,document.body.append(f),a.push(ue(p,!0),de(()=>n.close(),!0))},i=n.subscribe(d);return d(),{update(D){Object.assign(e,D),n.setOptions(D)},destroy(){i(),m()},getController:()=>n}}var Me=class{constructor(e={}){this.listeners=new Set;this.hoverEnd=null;this.calPanel="day";this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});this.getSnapshot=()=>this.snapshot;this.getServerSnapshot=()=>this.snapshot;this.options={...e};let n=e.format??ne,s=this.parseRange(e.value??e.defaultValue,n);this.start=s.start,this.end=s.end,this.viewMonth=(s.start??(0,x.default)()).startOf("month"),this.focusedDay=s.start??(0,x.default)(),this.open=e.open??(e.inline?!0:e.defaultOpen??!0),this.snapshot=this.buildSnapshot()}parseRange(e,n){return{start:G(e?.start??null,n),end:G(e?.end??null,n)}}setOptions(e){if(this.options={...this.options,...e},e.open!==void 0&&(this.open=e.open),"value"in e){if(e.value===null)this.start=null,this.end=null,this.hoverEnd=null;else if(e.value!==void 0){let n=this.options.format??ne,s=this.parseRange(e.value,n);this.start=s.start,this.end=s.end,s.start&&(this.viewMonth=s.start.startOf("month"),this.focusedDay=s.start)}}this.emit()}getLabels(){return{...ve,...this.options.labels}}emit(){this.snapshot=this.buildSnapshot(),this.listeners.forEach(e=>e())}buildSnapshot(){let e=this.options.format??ne,n=this.options.weekStartsOn??0,s=this.options.locale??"en",a=ye({viewMonth:this.viewMonth,rangeStart:this.start,rangeEnd:this.end,hoverEnd:this.start&&!this.end?this.hoverEnd:null,minDate:this.options.minDate,maxDate:this.options.maxDate,disablePastDates:this.options.disablePastDates,disableFutureDates:this.options.disableFutureDates,weekStartsOn:n});return{start:this.start,end:this.end,hoverEnd:this.hoverEnd,viewMonth:this.viewMonth,focusedDay:this.focusedDay,calPanel:this.calPanel,open:this.open,inline:!!this.options.inline,format:e,asString:this.options.asString,weekStartsOn:n,locale:s,labels:this.getLabels(),className:this.options.className,weeks:a,weekdayLabels:be(s,n)}}setOpen(e){this.options.inline||(this.open=e,this.options.onOpenChange?.(e),this.emit())}close(){this.options.inline||this.setOpen(!1)}setCalPanel(e){this.calPanel=e,this.emit()}setViewMonth(e){this.viewMonth=typeof e=="function"?e(this.viewMonth):e,this.emit()}navigatePrev(){this.calPanel==="day"?this.viewMonth=this.viewMonth.subtract(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.subtract(1,"year"):this.viewMonth=this.viewMonth.subtract(12,"year"),this.emit()}navigateNext(){this.calPanel==="day"?this.viewMonth=this.viewMonth.add(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.add(1,"year"):this.viewMonth=this.viewMonth.add(12,"year"),this.emit()}selectMonth(e){this.viewMonth=this.viewMonth.month(e),this.calPanel="day",this.emit()}selectYear(e){this.viewMonth=this.viewMonth.year(e),this.calPanel="month",this.emit()}emitRange(e,n){if(this.options.asString===!1)this.options.onChange?.({start:e?e.toDate():null,end:n?n.toDate():null});else{this.options.asString===void 0&&me();let s=this.options.format??ne;this.options.onChange?.({start:ee(e,s),end:ee(n,s)})}}pickDay(e){!this.start||this.start&&this.end?(this.start=e,this.end=null,this.hoverEnd=null,this.focusedDay=e):e.isBefore(this.start,"day")?(this.start=e,this.end=null,this.hoverEnd=null,this.focusedDay=e):(this.end=e,this.hoverEnd=null,this.focusedDay=e),this.emit()}setHoverEnd(e){this.start&&!this.end&&(this.hoverEnd=e,this.emit())}handleGridKeyDown(e){let n=this.snapshot,s=this.focusedDay;switch(e){case"ArrowLeft":s=this.focusedDay.subtract(1,"day");break;case"ArrowRight":s=this.focusedDay.add(1,"day");break;case"ArrowUp":s=this.focusedDay.subtract(7,"day");break;case"ArrowDown":s=this.focusedDay.add(7,"day");break;case"Home":s=se(this.focusedDay,n.weekStartsOn);break;case"End":s=oe(this.focusedDay,n.weekStartsOn);break;case"PageUp":s=this.focusedDay.subtract(1,"month"),this.viewMonth=s.startOf("month");break;case"PageDown":s=this.focusedDay.add(1,"month"),this.viewMonth=s.startOf("month");break;case"Enter":case" ":{let a=n.weeks.flat().find(o=>o.date.isSame(this.focusedDay,"day"));return a&&!a.isDisabled&&a.isCurrentMonth&&this.pickDay(a.date),!0}default:return!1}return this.focusedDay=s,s.isSame(this.viewMonth,"month")||(this.viewMonth=s.startOf("month")),this.emit(),!0}confirm(){return!this.start||!this.end?null:(this.emitRange(this.start,this.end),this.close(),{start:this.start.toDate(),end:this.end.toDate()})}clear(){this.start=null,this.end=null,this.hoverEnd=null,this.emitRange(null,null),this.emit(),this.close()}};function R(t,e={},n=[]){let s=document.createElement(t);for(let[a,o]of Object.entries(e))if(!(o==null||o===!1))if(a==="className")s.className=String(o);else if(a==="textContent")s.textContent=String(o);else if(a.startsWith("on")&&typeof o=="function")s.addEventListener(a.slice(2).toLowerCase(),o);else if(a==="disabled")s.disabled=!!o;else if(a==="tabIndex")s.tabIndex=Number(o);else{let r=a==="ariaLabel"?"aria-label":a==="ariaSelected"?"aria-selected":a==="ariaDisabled"?"aria-disabled":a==="ariaModal"?"aria-modal":a==="ariaLabelledby"?"aria-labelledby":a==="ariaCurrent"?"aria-current":a;s.setAttribute(r,String(o))}for(let a of n)a!=null&&s.append(a);return s}function Nt(t,e){if(e){if(typeof e=="string"){t.setAttribute("style",e);return}Object.assign(t.style,e)}}function vt(t,e={}){let n=new Me(e),s=`ctp-range-${Math.random().toString(36).slice(2,9)}`,a=[],o=null,r=null,y=()=>{a.forEach(i=>i()),a=[],r?.remove(),r=null,o?.remove(),o=null},m=()=>{y();let i=n.getSnapshot();if(!i.open&&!i.inline)return;let D=(0,x.default)(),M=i.viewMonth.year(),p=Math.floor(M/12)*12,u=p+11,f=i.start&&!i.end?i.labels.selectEnd:`${i.start?U(i.start,"MMM D, YYYY",i.locale):i.labels.start} \u2014 ${i.end?U(i.end,"MMM D, YYYY",i.locale):i.labels.end}`,v;i.calPanel==="day"?v=R("button",{type:"button",className:"ctp-current-month",ariaLabel:`${U(i.viewMonth,"MMMM YYYY",i.locale)}. ${i.labels.chooseMonth}`,onClick:()=>n.setCalPanel("month"),textContent:U(i.viewMonth,"MMMM YYYY",i.locale)}):i.calPanel==="month"?v=R("button",{type:"button",className:"ctp-current-month",ariaLabel:`${M}. ${i.labels.chooseYear}`,onClick:()=>n.setCalPanel("year"),textContent:String(M)}):v=R("span",{className:"ctp-current-month",textContent:`${p} \u2013 ${u}`});let C=R("div",{className:"ctp-body ctp-body-calendar-date"},[R("div",{className:"ctp-month-year"},[R("button",{type:"button",className:"ctp-prev-month",ariaLabel:i.calPanel==="day"?i.labels.previousMonth:i.labels.previousYear,onClick:()=>n.navigatePrev(),textContent:"\u2039"}),v,R("button",{type:"button",className:"ctp-next-month",ariaLabel:i.calPanel==="day"?i.labels.nextMonth:i.labels.nextYear,onClick:()=>n.navigateNext(),textContent:"\u203A"})])]);if(i.calPanel==="day"){let Y=R("div",{className:"ctp-main-calendar",role:"grid",ariaLabel:i.labels.chooseDateRange,tabIndex:0,onKeydown:L=>{let T=L;n.handleGridKeyDown(T.key)&&T.preventDefault()}});for(let L of i.weekdayLabels)Y.append(R("div",{className:"ctp-box ctp-box-days",role:"columnheader",textContent:L}));for(let L of i.weeks)for(let T of L){let P=T.date.isSame(i.focusedDay,"day"),k=!T.isCurrentMonth||T.isDisabled;Y.append(R("button",{type:"button",role:"gridcell",tabIndex:P?0:-1,ariaSelected:!!(T.isRangeStart||T.isRangeEnd),ariaDisabled:k,disabled:k,ariaLabel:U(T.date,"dddd, MMMM D, YYYY",i.locale),className:W("ctp-box","ctp-box-date",!T.isCurrentMonth&&"not-current-month",T.isDisabled&&"disabled-date",T.isWeekend&&"weekend-day",T.isCurrentDate&&"ctp-today",T.isInRange&&"ctp-in-range",T.isRangeStart&&"ctp-range-start",T.isRangeEnd&&"ctp-range-end"),onClick:()=>{k||n.pickDay(T.date)},onMouseenter:()=>{!k&&i.start&&!i.end&&n.setHoverEnd(T.date)},textContent:T.date.format("D")}))}C.append(Y)}else if(i.calPanel==="month"){let Y=R("div",{className:"ctp-month-grid",role:"grid",ariaLabel:i.labels.chooseMonth});for(let L=0;L<12;L+=1){let T=i.viewMonth.month(L),P=i.viewMonth.year()===D.year()&&L===D.month();Y.append(R("button",{type:"button",role:"gridcell",ariaCurrent:P?"date":void 0,className:W("ctp-box","ctp-box-month",P&&"ctp-current"),onClick:()=>n.selectMonth(L),textContent:U(T,"MMM",i.locale)}))}C.append(Y)}else{let Y=R("div",{className:"ctp-year-grid",role:"grid",ariaLabel:i.labels.chooseYear});for(let L=0;L<12;L+=1){let T=p+L;Y.append(R("button",{type:"button",role:"gridcell",ariaCurrent:D.year()===T?"date":void 0,className:W("ctp-box","ctp-box-year",D.year()===T&&"ctp-current"),onClick:()=>n.selectYear(T),textContent:String(T)}))}C.append(Y)}let $=[R("button",{type:"button",className:"close-button",onClick:()=>n.clear(),textContent:i.labels.clear})];i.inline||$.push(R("button",{type:"button",className:"ctp-cancel",onClick:()=>n.close(),textContent:i.labels.close})),$.push(R("button",{type:"button",disabled:!i.start||!i.end,onClick:()=>n.confirm(),textContent:i.labels.ok}));let A=R("div",{className:W("ctp-calendar-time-picker",i.className),role:i.inline?void 0:"dialog",ariaModal:i.inline?void 0:!0,ariaLabelledby:s},[R("div",{className:"ctp-header"},[R("span",{id:s,className:"ctp-range-title",textContent:f})]),C,R("div",{className:"ctp-footer"},$)]);if(Nt(A,e.style),i.inline){o=A,t.append(A);return}let j=R("div",{className:"ctp-calendar-time-picker-absolute-container",onClick:Y=>{Y.target===Y.currentTarget&&n.close()}});j.append(A),r=j,document.body.append(j),a.push(ue(A,!0),de(()=>n.close(),!0))},d=n.subscribe(m);return m(),{update(i){Object.assign(e,i),n.setOptions(i)},destroy(){d(),y()},getController:()=>n}}function Z(t,e,n=!1){if(!t.hasAttribute(e))return n;let s=t.getAttribute(e);return s===""||s==="true"||s===e}function qe(t){if(t.hasAttribute("as-string"))return Z(t,"as-string",!0)}function wt(t,e){return t?!0:e.hasAttribute("open")?Z(e,"open"):!1}function Mt(t,e){e?t.setAttribute("open",""):t.removeAttribute("open")}var gt="universal-datetime-picker-styles";function ke(t){if(typeof document>"u"||document.getElementById(gt))return;let e=document.createElement("link");e.id=gt,e.rel="stylesheet",e.href=t??"https://cdn.jsdelivr.net/npm/universal-datetime-picker/style.css",document.head.append(e)}var Se=class extends HTMLElement{constructor(){super(...arguments);this.handle=null;this.mountEl=null}connectedCallback(){this.mountEl||(this.mountEl=document.createElement("div"),this.append(this.mountEl)),this.mount()}disconnectedCallback(){this.handle?.destroy(),this.handle=null}emitChange(n){this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))}},Ge=class extends Se{static get observedAttributes(){return["mode","layout","inline","open","use12hours","show-seconds","as-string","locale","format","theme","value","popover"]}attributeChangedCallback(){this.isConnected&&this.mount()}get value(){return this._value??null}set value(e){this._value=e,this.isConnected&&this.mount()}mount(){if(this.handle?.destroy(),!this.mountEl)return;this.mountEl.replaceChildren();let e=this.getAttribute("mode")||"datetime",n=this.getAttribute("layout")||"combined",s=this.hasAttribute("show-seconds")?Z(this,"show-seconds",!0):!0,a=Z(this,"use12hours"),o=Z(this,"inline"),r=Z(this,"popover"),y=qe(this),m=this.getAttribute("format")||void 0,d=this.getAttribute("locale")||"en",i=this.getAttribute("theme")||void 0,D=wt(o,this),M=this.getAttribute("value"),p=this._value,u=p!==void 0?p:M??void 0;this.handle=We(this.mountEl,{mode:e,layout:n,showSeconds:s,use12Hours:a,inline:o,popover:r,asString:y,format:m,locale:d,theme:i,open:D,value:u===void 0?void 0:u,onChange:f=>{this._value=f,this.emitChange(f)},onOpenChange:f=>{Mt(this,f),this.dispatchEvent(new CustomEvent("openchange",{detail:f,bubbles:!0,composed:!0}))}})}},ze=class extends HTMLElement{constructor(){super(...arguments);this.handle=null;this.input=null;this.root=null}static get observedAttributes(){return["mode","placeholder","disabled","use12hours","show-seconds","as-string","locale","format","value","theme"]}connectedCallback(){this.root||(this.root=document.createElement("div"),this.root.className="ctp-input-root",this.input=document.createElement("input"),this.input.className="ctp-input",this.input.readOnly=!0,this.root.append(this.input),this.append(this.root)),this.sync()}disconnectedCallback(){this.handle?.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.sync()}sync(){if(!this.input||!this.root)return;this.handle?.destroy();let n=this.getAttribute("mode")||"datetime",s=this.hasAttribute("show-seconds")?Z(this,"show-seconds",!0):!0,a=Z(this,"use12hours"),o=qe(this),r=this.getAttribute("format")||void 0,y=re({mode:n,format:r,use12Hours:a,showSeconds:s}),m=this.getAttribute("placeholder")||"Select date and time",d=Z(this,"disabled"),i=this.getAttribute("locale")||"en",D=this.getAttribute("theme")||void 0,M=this.getAttribute("value");this.input.placeholder=m,this.input.disabled=d,this.input.setAttribute("aria-haspopup","dialog"),this.input.setAttribute("aria-label",m);let p=M?ee(G(M,y),y)??M:"";this.input.value=p;let u=()=>{d||(this.handle?.destroy(),this.handle=We(this.root,{mode:n,showSeconds:s,use12Hours:a,asString:o,format:r,locale:i,theme:D,popover:!0,anchorEl:this.input,open:!0,value:M,onChange:f=>{let v="";f===null?v="":typeof f=="string"?v=f:f instanceof Date?v=ee((0,x.default)(f),y)??"":v=f.formatted,this.input&&(this.input.value=v),v?this.setAttribute("value",v):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:f,bubbles:!0,composed:!0}))},onOpenChange:f=>{this.input?.setAttribute("aria-expanded",String(f)),f||(this.handle?.destroy(),this.handle=null)}}))};this.input.onclick=u,this.input.onkeydown=f=>{d||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u())}}},Ze=class extends Se{static get observedAttributes(){return["inline","open","as-string","locale","format","value-start","value-end"]}attributeChangedCallback(){this.isConnected&&this.mount()}mount(){if(this.handle?.destroy(),!this.mountEl)return;this.mountEl.replaceChildren();let e=Z(this,"inline"),n=qe(this),s=this.getAttribute("format")||void 0,a=this.getAttribute("locale")||"en",o=wt(e,this),r=this.getAttribute("value-start"),y=this.getAttribute("value-end");this.handle=vt(this.mountEl,{inline:e,asString:n,format:s,locale:a,open:o,value:r||y?{start:r??null,end:y??null}:void 0,onChange:m=>{(typeof m.start=="string"||m.start===null)&&(m.start?this.setAttribute("value-start",m.start):this.removeAttribute("value-start")),(typeof m.end=="string"||m.end===null)&&(m.end?this.setAttribute("value-end",m.end):this.removeAttribute("value-end")),this.emitChange(m)},onOpenChange:m=>{Mt(this,m),this.dispatchEvent(new CustomEvent("openchange",{detail:m,bubbles:!0,composed:!0}))}})}},Dt=!1;function Ue(t,e){let n=e?.trim();return n?`${n}-${t}`:t}function Ke(t,e,n){if(customElements.get(t))return;let s=n?class extends e{}:e;customElements.define(t,s)}function Ce(t){if(typeof customElements>"u")return;let e=t?.prefix?.trim(),n=!!e,s=Ue("datetime-picker",e),a=Ue("datetime-picker-input",e),o=Ue("datetime-picker-range",e);if(!e){if(Dt)return;Dt=!0}Ke(s,Ge,n),Ke(a,ze,n),Ke(o,Ze,n)}ke();Ce();return Pt(Rt);})();
1
+ "use strict";var UniversalDatetimePicker=(()=>{var kt=Object.create;var me=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Et=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,Ot=Object.prototype.hasOwnProperty;var ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xt=(t,e)=>{for(var n in e)me(t,n,{get:e[n],enumerable:!0})},Je=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Et(e))!Ot.call(t,a)&&a!==n&&me(t,a,{get:()=>e[a],enumerable:!(s=Tt(e,a))||s.enumerable});return t};var ie=(t,e,n)=>(n=t!=null?kt(Pt(t)):{},Je(e||!t||!t.__esModule?me(n,"default",{value:t,enumerable:!0}):n,t)),Lt=t=>Je(me({},"__esModule",{value:!0}),t);var Qe=ae((xe,Le)=>{"use strict";(function(t,e){typeof xe=="object"&&typeof Le<"u"?Le.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(xe,(function(){"use strict";var t=1e3,e=6e4,n=36e5,s="millisecond",a="second",o="minute",r="hour",y="day",f="week",c="month",p="quarter",S="year",i="date",b="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(g){var d=["th","st","nd","rd"],l=g%100;return"["+g+(d[(l-20)%10]||d[l]||d[0])+"]"}},E=function(g,d,l){var v=String(g);return!v||v.length>=d?g:""+Array(d+1-v.length).join(l)+g},$={s:E,z:function(g){var d=-g.utcOffset(),l=Math.abs(d),v=Math.floor(l/60),h=l%60;return(d<=0?"+":"-")+E(v,2,"0")+":"+E(h,2,"0")},m:function g(d,l){if(d.date()<l.date())return-g(l,d);var v=12*(l.year()-d.year())+(l.month()-d.month()),h=d.clone().add(v,c),w=l-h<0,C=d.clone().add(v+(w?-1:1),c);return+(-(v+(l-h)/(w?h-C:C-h))||0)},a:function(g){return g<0?Math.ceil(g)||0:Math.floor(g)},p:function(g){return{M:c,y:S,w:f,d:y,D:i,h:r,m:o,s:a,ms:s,Q:p}[g]||String(g||"").toLowerCase().replace(/s$/,"")},u:function(g){return g===void 0}},A="en",R={};R[A]=D;var I="$isDayjsObject",V=function(g){return g instanceof O||!(!g||!g[I])},L=function g(d,l,v){var h;if(!d)return A;if(typeof d=="string"){var w=d.toLowerCase();R[w]&&(h=w),l&&(R[w]=l,h=w);var C=d.split("-");if(!h&&C.length>1)return g(C[0])}else{var T=d.name;R[T]=d,h=T}return!v&&h&&(A=h),h||!v&&A},k=function(g,d){if(V(g))return g.clone();var l=typeof d=="object"?d:{};return l.date=g,l.args=arguments,new O(l)},M=$;M.l=L,M.i=V,M.w=function(g,d){return k(g,{locale:d.$L,utc:d.$u,x:d.$x,$offset:d.$offset})};var O=(function(){function g(l){this.$L=L(l.locale,null,!0),this.parse(l),this.$x=this.$x||l.x||{},this[I]=!0}var d=g.prototype;return d.parse=function(l){this.$d=(function(v){var h=v.date,w=v.utc;if(h===null)return new Date(NaN);if(M.u(h))return new Date;if(h instanceof Date)return new Date(h);if(typeof h=="string"&&!/Z$/i.test(h)){var C=h.match(u);if(C){var T=C[2]-1||0,H=(C[7]||"0").substring(0,3);return w?new Date(Date.UTC(C[1],T,C[3]||1,C[4]||0,C[5]||0,C[6]||0,H)):new Date(C[1],T,C[3]||1,C[4]||0,C[5]||0,C[6]||0,H)}}return new Date(h)})(l),this.init()},d.init=function(){var l=this.$d;this.$y=l.getFullYear(),this.$M=l.getMonth(),this.$D=l.getDate(),this.$W=l.getDay(),this.$H=l.getHours(),this.$m=l.getMinutes(),this.$s=l.getSeconds(),this.$ms=l.getMilliseconds()},d.$utils=function(){return M},d.isValid=function(){return this.$d.toString()!==b},d.isSame=function(l,v){var h=k(l);return this.startOf(v)<=h&&h<=this.endOf(v)},d.isAfter=function(l,v){return k(l)<this.startOf(v)},d.isBefore=function(l,v){return this.endOf(v)<k(l)},d.$g=function(l,v,h){return M.u(l)?this[v]:this.set(h,l)},d.unix=function(){return Math.floor(this.valueOf()/1e3)},d.valueOf=function(){return this.$d.getTime()},d.startOf=function(l,v){var h=this,w=!!M.u(v)||v,C=M.p(l),T=function(z,_){var K=M.w(h.$u?Date.UTC(h.$y,_,z):new Date(h.$y,_,z),h);return w?K:K.endOf(y)},H=function(z,_){return M.w(h.toDate()[z].apply(h.toDate("s"),(w?[0,0,0,0]:[23,59,59,999]).slice(_)),h)},Y=this.$W,j=this.$M,B=this.$D,Q="set"+(this.$u?"UTC":"");switch(C){case S:return w?T(1,0):T(31,11);case c:return w?T(1,j):T(0,j+1);case f:var q=this.$locale().weekStart||0,te=(Y<q?Y+7:Y)-q;return T(w?B-te:B+(6-te),j);case y:case i:return H(Q+"Hours",0);case r:return H(Q+"Minutes",1);case o:return H(Q+"Seconds",2);case a:return H(Q+"Milliseconds",3);default:return this.clone()}},d.endOf=function(l){return this.startOf(l,!1)},d.$set=function(l,v){var h,w=M.p(l),C="set"+(this.$u?"UTC":""),T=(h={},h[y]=C+"Date",h[i]=C+"Date",h[c]=C+"Month",h[S]=C+"FullYear",h[r]=C+"Hours",h[o]=C+"Minutes",h[a]=C+"Seconds",h[s]=C+"Milliseconds",h)[w],H=w===y?this.$D+(v-this.$W):v;if(w===c||w===S){var Y=this.clone().set(i,1);Y.$d[T](H),Y.init(),this.$d=Y.set(i,Math.min(this.$D,Y.daysInMonth())).$d}else T&&this.$d[T](H);return this.init(),this},d.set=function(l,v){return this.clone().$set(l,v)},d.get=function(l){return this[M.p(l)]()},d.add=function(l,v){var h,w=this;l=Number(l);var C=M.p(v),T=function(j){var B=k(w);return M.w(B.date(B.date()+Math.round(j*l)),w)};if(C===c)return this.set(c,this.$M+l);if(C===S)return this.set(S,this.$y+l);if(C===y)return T(1);if(C===f)return T(7);var H=(h={},h[o]=e,h[r]=n,h[a]=t,h)[C]||1,Y=this.$d.getTime()+l*H;return M.w(Y,this)},d.subtract=function(l,v){return this.add(-1*l,v)},d.format=function(l){var v=this,h=this.$locale();if(!this.isValid())return h.invalidDate||b;var w=l||"YYYY-MM-DDTHH:mm:ssZ",C=M.z(this),T=this.$H,H=this.$m,Y=this.$M,j=h.weekdays,B=h.months,Q=h.meridiem,q=function(_,K,J,X){return _&&(_[K]||_(v,w))||J[K].slice(0,X)},te=function(_){return M.s(T%12||12,_,"0")},z=Q||function(_,K,J){var X=_<12?"AM":"PM";return J?X.toLowerCase():X};return w.replace(m,(function(_,K){return K||(function(J){switch(J){case"YY":return String(v.$y).slice(-2);case"YYYY":return M.s(v.$y,4,"0");case"M":return Y+1;case"MM":return M.s(Y+1,2,"0");case"MMM":return q(h.monthsShort,Y,B,3);case"MMMM":return q(B,Y);case"D":return v.$D;case"DD":return M.s(v.$D,2,"0");case"d":return String(v.$W);case"dd":return q(h.weekdaysMin,v.$W,j,2);case"ddd":return q(h.weekdaysShort,v.$W,j,3);case"dddd":return j[v.$W];case"H":return String(T);case"HH":return M.s(T,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return z(T,H,!0);case"A":return z(T,H,!1);case"m":return String(H);case"mm":return M.s(H,2,"0");case"s":return String(v.$s);case"ss":return M.s(v.$s,2,"0");case"SSS":return M.s(v.$ms,3,"0");case"Z":return C}return null})(_)||C.replace(":","")}))},d.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},d.diff=function(l,v,h){var w,C=this,T=M.p(v),H=k(l),Y=(H.utcOffset()-this.utcOffset())*e,j=this-H,B=function(){return M.m(C,H)};switch(T){case S:w=B()/12;break;case c:w=B();break;case p:w=B()/3;break;case f:w=(j-Y)/6048e5;break;case y:w=(j-Y)/864e5;break;case r:w=j/n;break;case o:w=j/e;break;case a:w=j/t;break;default:w=j}return h?w:M.a(w)},d.daysInMonth=function(){return this.endOf(c).$D},d.$locale=function(){return R[this.$L]},d.locale=function(l,v){if(!l)return this.$L;var h=this.clone(),w=L(l,v,!0);return w&&(h.$L=w),h},d.clone=function(){return M.w(this.$d,this)},d.toDate=function(){return new Date(this.valueOf())},d.toJSON=function(){return this.isValid()?this.toISOString():null},d.toISOString=function(){return this.$d.toISOString()},d.toString=function(){return this.$d.toUTCString()},g})(),F=O.prototype;return k.prototype=F,[["$ms",s],["$s",a],["$m",o],["$H",r],["$W",y],["$M",c],["$y",S],["$D",i]].forEach((function(g){F[g[1]]=function(d){return this.$g(d,g[0],g[1])}})),k.extend=function(g,d){return g.$i||(g(d,O,k),g.$i=!0),k},k.locale=L,k.isDayjs=V,k.unix=function(g){return k(1e3*g)},k.en=R[A],k.Ls=R,k.p={},k}))});var Xe=ae((Ae,He)=>{"use strict";(function(t,e){typeof Ae=="object"&&typeof He<"u"?He.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Ae,(function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,s=/\d\d/,a=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,r={},y=function(u){return(u=+u)+(u>68?1900:2e3)},f=function(u){return function(m){this[u]=+m}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(u){(this.zone||(this.zone={})).offset=(function(m){if(!m||m==="Z")return 0;var D=m.match(/([+-]|\d\d)/g),E=60*D[1]+(+D[2]||0);return E===0?0:D[0]==="+"?-E:E})(u)}],p=function(u){var m=r[u];return m&&(m.indexOf?m:m.s.concat(m.f))},S=function(u,m){var D,E=r.meridiem;if(E){for(var $=1;$<=24;$+=1)if(u.indexOf(E($,0,m))>-1){D=$>12;break}}else D=u===(m?"pm":"PM");return D},i={A:[o,function(u){this.afternoon=S(u,!1)}],a:[o,function(u){this.afternoon=S(u,!0)}],Q:[n,function(u){this.month=3*(u-1)+1}],S:[n,function(u){this.milliseconds=100*+u}],SS:[s,function(u){this.milliseconds=10*+u}],SSS:[/\d{3}/,function(u){this.milliseconds=+u}],s:[a,f("seconds")],ss:[a,f("seconds")],m:[a,f("minutes")],mm:[a,f("minutes")],H:[a,f("hours")],h:[a,f("hours")],HH:[a,f("hours")],hh:[a,f("hours")],D:[a,f("day")],DD:[s,f("day")],Do:[o,function(u){var m=r.ordinal,D=u.match(/\d+/);if(this.day=D[0],m)for(var E=1;E<=31;E+=1)m(E).replace(/\[|\]/g,"")===u&&(this.day=E)}],w:[a,f("week")],ww:[s,f("week")],M:[a,f("month")],MM:[s,f("month")],MMM:[o,function(u){var m=p("months"),D=(p("monthsShort")||m.map((function(E){return E.slice(0,3)}))).indexOf(u)+1;if(D<1)throw new Error;this.month=D%12||D}],MMMM:[o,function(u){var m=p("months").indexOf(u)+1;if(m<1)throw new Error;this.month=m%12||m}],Y:[/[+-]?\d+/,f("year")],YY:[s,function(u){this.year=y(u)}],YYYY:[/\d{4}/,f("year")],Z:c,ZZ:c};function b(u){var m,D;m=u,D=r&&r.formats;for(var E=(u=m.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(k,M,O){var F=O&&O.toUpperCase();return M||D[O]||t[O]||D[F].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(g,d,l){return d||l.slice(1)}))}))).match(e),$=E.length,A=0;A<$;A+=1){var R=E[A],I=i[R],V=I&&I[0],L=I&&I[1];E[A]=L?{regex:V,parser:L}:R.replace(/^\[|\]$/g,"")}return function(k){for(var M={},O=0,F=0;O<$;O+=1){var g=E[O];if(typeof g=="string")F+=g.length;else{var d=g.regex,l=g.parser,v=k.slice(F),h=d.exec(v)[0];l.call(M,h),k=k.replace(h,"")}}return(function(w){var C=w.afternoon;if(C!==void 0){var T=w.hours;C?T<12&&(w.hours+=12):T===12&&(w.hours=0),delete w.afternoon}})(M),M}}return function(u,m,D){D.p.customParseFormat=!0,u&&u.parseTwoDigitYear&&(y=u.parseTwoDigitYear);var E=m.prototype,$=E.parse;E.parse=function(A){var R=A.date,I=A.utc,V=A.args;this.$u=I;var L=V[1];if(typeof L=="string"){var k=V[2]===!0,M=V[3]===!0,O=k||M,F=V[2];M&&(F=V[2]),r=this.$locale(),!k&&F&&(r=D.Ls[F]),this.$d=(function(v,h,w,C){try{if(["x","X"].indexOf(h)>-1)return new Date((h==="X"?1e3:1)*v);var T=b(h)(v),H=T.year,Y=T.month,j=T.day,B=T.hours,Q=T.minutes,q=T.seconds,te=T.milliseconds,z=T.zone,_=T.week,K=new Date,J=j||(H||Y?1:K.getDate()),X=H||K.getFullYear(),ce=0;H&&!Y||(ce=Y>0?Y-1:K.getMonth());var he,Te=B||0,Ee=Q||0,Pe=q||0,Oe=te||0;return z?new Date(Date.UTC(X,ce,J,Te,Ee,Pe,Oe+60*z.offset*1e3)):w?new Date(Date.UTC(X,ce,J,Te,Ee,Pe,Oe)):(he=new Date(X,ce,J,Te,Ee,Pe,Oe),_&&(he=C(he).week(_).toDate()),he)}catch{return new Date("")}})(R,L,I,D),this.init(),F&&F!==!0&&(this.$L=this.locale(F).$L),O&&R!=this.format(L)&&(this.$d=new Date("")),r={}}else if(L instanceof Array)for(var g=L.length,d=1;d<=g;d+=1){V[1]=L[d-1];var l=D.apply(this,V);if(l.isValid()){this.$d=l.$d,this.$L=l.$L,this.init();break}d===g&&(this.$d=new Date(""))}else $.call(this,A)}}}))});var et=ae(($e,Ye)=>{"use strict";(function(t,e){typeof $e=="object"&&typeof Ye<"u"?Ye.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isSameOrAfter=e()})($e,(function(){"use strict";return function(t,e){e.prototype.isSameOrAfter=function(n,s){return this.isSame(n,s)||this.isAfter(n,s)}}}))});var tt=ae((Ne,Re)=>{"use strict";(function(t,e){typeof Ne=="object"&&typeof Re<"u"?Re.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isSameOrBefore=e()})(Ne,(function(){"use strict";return function(t,e){e.prototype.isSameOrBefore=function(n,s){return this.isSame(n,s)||this.isBefore(n,s)}}}))});var nt=ae((je,Ve)=>{"use strict";(function(t,e){typeof je=="object"&&typeof Ve<"u"?Ve.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_localeData=e()})(je,(function(){"use strict";return function(t,e,n){var s=e.prototype,a=function(c){return c&&(c.indexOf?c:c.s)},o=function(c,p,S,i,b){var u=c.name?c:c.$locale(),m=a(u[p]),D=a(u[S]),E=m||D.map((function(A){return A.slice(0,i)}));if(!b)return E;var $=u.weekStart;return E.map((function(A,R){return E[(R+($||0))%7]}))},r=function(){return n.Ls[n.locale()]},y=function(c,p){return c.formats[p]||(function(S){return S.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(i,b,u){return b||u.slice(1)}))})(c.formats[p.toUpperCase()])},f=function(){var c=this;return{months:function(p){return p?p.format("MMMM"):o(c,"months")},monthsShort:function(p){return p?p.format("MMM"):o(c,"monthsShort","months",3)},firstDayOfWeek:function(){return c.$locale().weekStart||0},weekdays:function(p){return p?p.format("dddd"):o(c,"weekdays")},weekdaysMin:function(p){return p?p.format("dd"):o(c,"weekdaysMin","weekdays",2)},weekdaysShort:function(p){return p?p.format("ddd"):o(c,"weekdaysShort","weekdays",3)},longDateFormat:function(p){return y(c.$locale(),p)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};s.localeData=function(){return f.bind(this)()},n.localeData=function(){var c=r();return{firstDayOfWeek:function(){return c.weekStart||0},weekdays:function(){return n.weekdays()},weekdaysShort:function(){return n.weekdaysShort()},weekdaysMin:function(){return n.weekdaysMin()},months:function(){return n.months()},monthsShort:function(){return n.monthsShort()},longDateFormat:function(p){return y(c,p)},meridiem:c.meridiem,ordinal:c.ordinal}},n.months=function(){return o(r(),"months")},n.monthsShort=function(){return o(r(),"monthsShort","months",3)},n.weekdays=function(c){return o(r(),"weekdays",null,null,c)},n.weekdaysShort=function(c){return o(r(),"weekdaysShort","weekdays",3,c)},n.weekdaysMin=function(c){return o(r(),"weekdaysMin","weekdays",2,c)}}}))});var st=ae((_e,Ie)=>{"use strict";(function(t,e){typeof _e=="object"&&typeof Ie<"u"?Ie.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_weekday=e()})(_e,(function(){"use strict";return function(t,e){e.prototype.weekday=function(n){var s=this.$locale().weekStart||0,a=this.$W,o=(a<s?a+7:a)-s;return this.$utils().u(n)?o:this.subtract(o,"day").add(n,"day")}}}))});var It={};xt(It,{defineCustomElements:()=>ke,ensureStylesheet:()=>Ce});var x=ie(Qe()),it=ie(Xe()),ot=ie(et()),rt=ie(tt()),lt=ie(nt()),ut=ie(st());x.default.extend(it.default);x.default.extend(ot.default);x.default.extend(rt.default);x.default.extend(lt.default);x.default.extend(ut.default);var dt="YYYY-MM-DD HH:mm:ss",ne="YYYY-MM-DD";function re(t){if(t.format)return t.format;let e=t.mode??"datetime",n=t.showSeconds!==!1,a=!!t.use12Hours?n?"hh:mm:ss A":"hh:mm A":n?"HH:mm:ss":"HH:mm";return e==="date"?ne:e==="time"?a:`${ne} ${a}`}function ct(t,e){let n=t.hour(),{hour:s,isAm:a}=le(n);return{hour:s,hour24:n,minute:t.minute(),second:t.second(),ampm:a?"AM":"PM",formatted:t.format(e)}}var at=!1;function fe(){at||typeof process<"u"&&process.env.NODE_ENV==="production"||(at=!0,console.warn("[universal-datetime-picker] Omitting `asString` currently returns a formatted string. Set `asString={true}` to keep strings, or `asString={false}` to receive a Date / TimeValue. A future major release will default to Date / TimeValue."))}function G(t,e=dt){if(t==null||t==="")return null;if(x.default.isDayjs(t))return t.isValid()?t:null;if(t instanceof Date){let s=(0,x.default)(t);return s.isValid()?s:null}if(typeof t=="string"){let s=(0,x.default)(t,e,!0);if(s.isValid())return s;let a=(0,x.default)(t);return a.isValid()?a:null}let n=(0,x.default)(t);return n.isValid()?n:null}function ee(t,e=dt){return!t||!t.isValid()?null:t.format(e)}function Fe(t){return String(t).padStart(2,"0")}var ht=Array.from({length:24},(t,e)=>Fe(e)),mt=Array.from({length:12},(t,e)=>Fe(e===0?12:e)),ft=Array.from({length:60},(t,e)=>Fe(e));function le(t){let e=t<12;return{hour:t%12===0?12:t%12,isAm:e}}function pe(t,e){return t===12?e?0:12:e?t:t+12}function U(t,e,n){return t.locale(n).format(e)}function be(t,e){let n=(0,x.default)().locale(t).localeData().weekdaysMin();return[...n.slice(e),...n.slice(0,e)]}function se(t,e){let s=(t.day()-e+7)%7;return t.subtract(s,"day").startOf("day")}function oe(t,e){return se(t,e).add(6,"day").endOf("day")}function At(t,e){let n=(0,x.default)().startOf("day"),s=t.startOf("day");if(e.disablePastDates&&s.isBefore(n,"day")||e.disableFutureDates&&s.isAfter(n,"day"))return!0;let a=G(e.minDate??null),o=G(e.maxDate??null);return!!(a&&s.isBefore(a.startOf("day"),"day")||o&&s.isAfter(o.startOf("day"),"day"))}function ye(t){let e=t.weekStartsOn??0,n=t.viewMonth.startOf("month"),s=t.viewMonth.endOf("month"),a=se(n,e),o=oe(s,e),r=[],y=a.clone();for(;y.isBefore(o)||y.isSame(o,"day");){let f=[];for(let c=0;c<7;c+=1){let p=y.clone(),S=p.isSame(t.viewMonth,"month"),i=!!(t.selected&&p.isSame(t.selected,"day")),b=!!(t.rangeStart&&p.isSame(t.rangeStart,"day")),u=!!(t.rangeEnd&&p.isSame(t.rangeEnd,"day")),m=t.rangeEnd??t.hoverEnd??null,D=!1;if(t.rangeStart&&m){let E=t.rangeStart.isBefore(m,"day")?t.rangeStart:m,$=t.rangeStart.isBefore(m,"day")?m:t.rangeStart;D=p.isAfter(E,"day")&&p.isBefore($,"day")||p.isSame(E,"day")||p.isSame($,"day")}f.push({date:p,isCurrentMonth:S,isCurrentDate:p.isSame((0,x.default)(),"day"),isFuture:p.isAfter((0,x.default)(),"day"),isPast:p.isBefore((0,x.default)(),"day"),isWeekend:p.day()===0||p.day()===6,isDisabled:At(p,t),isSelected:i,isInRange:D,isRangeStart:b,isRangeEnd:u}),y=y.add(1,"day")}r.push(f)}return r}var ge={date:"Date",time:"Time",clear:"Clear",close:"Close",ok:"OK",start:"Start",end:"End",chooseDate:"Choose date",chooseDateRange:"Choose date range",chooseMonth:"Choose month",chooseYear:"Choose year",previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",selectEnd:"Select end date"};function ve(t){return String(t).padStart(2,"0")}var De=class{constructor(e={}){this.listeners=new Set;this.calPanel="day";this.showHours=!1;this.showMinutes=!1;this.showSecondsOpen=!1;this.showAmPm=!1;this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});this.getSnapshot=()=>this.snapshot;this.getServerSnapshot=()=>this.snapshot;this.options={...e};let n=e.mode??"datetime",s=e.showSeconds!==!1,a=!!e.use12Hours,o=re({mode:n,format:e.format,use12Hours:a,showSeconds:s}),r=G(e.value??e.defaultValue??(0,x.default)(),o)??(0,x.default)();this.draft=r,this.viewMonth=r.startOf("month"),this.focusedDay=r,this.tab=n==="time"?"time":"date",this.open=e.open??(e.inline?!0:e.defaultOpen??!0),this.snapshot=this.buildSnapshot()}setOptions(e){let n=this.options;if(this.options={...this.options,...e},e.mode!==void 0&&e.mode!==n.mode&&(this.tab=e.mode==="time"?"time":"date"),e.open!==void 0&&(this.open=e.open),"value"in e){if(e.value===null){let s=(0,x.default)();this.draft=s,this.viewMonth=s.startOf("month"),this.focusedDay=s}else if(e.value!==void 0){let s=this.getResolvedFormat(),a=G(e.value,s);a&&(this.draft=a,this.viewMonth=a.startOf("month"),this.focusedDay=a)}}this.emit()}getResolvedFormat(){return re({mode:this.options.mode??"datetime",format:this.options.format,use12Hours:!!this.options.use12Hours,showSeconds:this.options.showSeconds!==!1})}getLabels(){return{...ge,...this.options.labels}}emit(){this.snapshot=this.buildSnapshot(),this.listeners.forEach(e=>e())}buildSnapshot(){let e=this.options.mode??"datetime",n=this.options.layout??"combined",s=this.options.showSeconds!==!1,a=!!this.options.use12Hours,o=!!this.options.inline,r=!!this.options.popover,y=this.options.weekStartsOn??0,f=this.options.locale??"en",c=this.getResolvedFormat(),p=this.getLabels(),S=ye({viewMonth:this.viewMonth,selected:this.draft,minDate:this.options.minDate,maxDate:this.options.maxDate,disablePastDates:this.options.disablePastDates,disableFutureDates:this.options.disableFutureDates,weekStartsOn:y}),i=e!=="time",b=e!=="date",u=e==="datetime"&&n==="tabs",m=i&&(!u||this.tab==="date"),D=b&&(!u||this.tab==="time"),E=this.draft.hour(),{hour:$,isAm:A}=le(E);return{draft:this.draft,viewMonth:this.viewMonth,calPanel:this.calPanel,tab:this.tab,showHours:this.showHours,showMinutes:this.showMinutes,showSecondsOpen:this.showSecondsOpen,showAmPm:this.showAmPm,focusedDay:this.focusedDay,open:this.open,mode:e,layout:n,showSeconds:s,use12Hours:a,inline:o,popover:r,weekStartsOn:y,locale:f,labels:p,resolvedFormat:c,asString:this.options.asString,className:this.options.className,theme:this.options.theme,weeks:S,weekdayLabels:be(f,y),showDate:i,showTime:b,useTabs:u,showDatePanel:m,showTimePanel:D,showModeTabs:u,hour24:E,hour12:$,isAm:A,hourOptions:a?mt:ht,displayHour:ve(a?$:E),displayMinute:ve(this.draft.minute()),displaySecond:ve(this.draft.second()),minuteOptions:ft}}setOpen(e){this.options.inline||(this.open=e,this.options.onOpenChange?.(e),this.emit())}close(){this.options.inline||this.setOpen(!1)}setTab(e){this.tab=e,this.emit()}setCalPanel(e){this.calPanel=e,this.emit()}setViewMonth(e){this.viewMonth=typeof e=="function"?e(this.viewMonth):e,this.emit()}selectDay(e){this.draft=this.draft.year(e.year()).month(e.month()).date(e.date()),this.focusedDay=e,this.emit(),this.maybeCommitInline()}setHour(e){this.draft=this.draft.hour(e),this.emit(),this.maybeCommitInline()}setMinute(e){this.draft=this.draft.minute(e),this.emit(),this.maybeCommitInline()}setSecond(e){this.draft=this.draft.second(e),this.emit(),this.maybeCommitInline()}setAmPm(e){let{hour:n}=le(this.draft.hour());this.draft=this.draft.hour(pe(n,e)),this.emit(),this.maybeCommitInline()}toggleHours(){this.showHours=!this.showHours,this.showMinutes=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}toggleMinutes(){this.showMinutes=!this.showMinutes,this.showHours=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}toggleSeconds(){this.showSecondsOpen=!this.showSecondsOpen,this.showHours=!1,this.showMinutes=!1,this.showAmPm=!1,this.emit()}toggleAmPm(){this.showAmPm=!this.showAmPm,this.showHours=!1,this.showMinutes=!1,this.showSecondsOpen=!1,this.emit()}closeTimeColumns(){this.showHours=!1,this.showMinutes=!1,this.showSecondsOpen=!1,this.showAmPm=!1,this.emit()}selectHourOption(e){let n=this.snapshot;n.use12Hours?this.draft=this.draft.hour(pe(Number(e),n.isAm)):this.draft=this.draft.hour(Number(e)),this.showHours=!1,this.emit(),this.maybeCommitInline()}selectMinuteOption(e){this.draft=this.draft.minute(Number(e)),this.showMinutes=!1,this.emit(),this.maybeCommitInline()}selectSecondOption(e){this.draft=this.draft.second(Number(e)),this.showSecondsOpen=!1,this.emit(),this.maybeCommitInline()}selectAmPmOption(e){let{hour:n}=le(this.draft.hour());this.draft=this.draft.hour(pe(n,e==="AM")),this.showAmPm=!1,this.emit(),this.maybeCommitInline()}handleGridKeyDown(e){let n=this.snapshot,s=this.focusedDay;switch(e){case"ArrowLeft":s=this.focusedDay.subtract(1,"day");break;case"ArrowRight":s=this.focusedDay.add(1,"day");break;case"ArrowUp":s=this.focusedDay.subtract(7,"day");break;case"ArrowDown":s=this.focusedDay.add(7,"day");break;case"Home":s=se(this.focusedDay,n.weekStartsOn);break;case"End":s=oe(this.focusedDay,n.weekStartsOn);break;case"PageUp":s=this.focusedDay.subtract(1,"month"),this.viewMonth=s.startOf("month");break;case"PageDown":s=this.focusedDay.add(1,"month"),this.viewMonth=s.startOf("month");break;case"Enter":case" ":{let a=n.weeks.flat().find(o=>o.date.isSame(this.focusedDay,"day"));return a&&!a.isDisabled&&a.isCurrentMonth&&this.selectDay(a.date),!0}default:return!1}return this.focusedDay=s,s.isSame(this.viewMonth,"month")||(this.viewMonth=s.startOf("month")),this.emit(),!0}buildPayload(){let e=this.snapshot;return e.asString===!1?e.mode==="time"?ct(this.draft,e.resolvedFormat):e.mode==="date"?this.draft.startOf("day").toDate():this.draft.toDate():(e.asString===void 0&&fe(),ee(this.draft,e.resolvedFormat))}maybeCommitInline(){this.options.inline&&this.options.onChange?.(this.buildPayload())}confirm(){let e=this.buildPayload();return this.options.onChange?.(e),this.close(),e}clear(){this.options.onChange?.(null),this.close()}yearWindowStart(e){return Math.floor(e/12)*12}navigatePrev(){this.calPanel==="day"?this.viewMonth=this.viewMonth.subtract(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.subtract(1,"year"):this.viewMonth=this.viewMonth.subtract(12,"year"),this.emit()}navigateNext(){this.calPanel==="day"?this.viewMonth=this.viewMonth.add(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.add(1,"year"):this.viewMonth=this.viewMonth.add(12,"year"),this.emit()}selectMonth(e){this.viewMonth=this.viewMonth.month(e),this.calPanel="day",this.emit()}selectYear(e){this.viewMonth=this.viewMonth.year(e),this.calPanel="month",this.emit()}};var Ht='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ue(t,e){if(!e)return()=>{};let n=document.activeElement,s=()=>Array.from(t.querySelectorAll(Ht)).filter(r=>!r.hasAttribute("disabled")&&r.offsetParent!==null);s()[0]?.focus({preventScroll:!0});let o=r=>{if(r.key!=="Tab")return;let y=s();if(y.length===0)return;let f=y[0],c=y[y.length-1];r.shiftKey&&document.activeElement===f?(r.preventDefault(),c.focus({preventScroll:!0})):!r.shiftKey&&document.activeElement===c&&(r.preventDefault(),f.focus({preventScroll:!0}))};return t.addEventListener("keydown",o),()=>{t.removeEventListener("keydown",o),n?.focus?.({preventScroll:!0})}}function de(t,e){if(!e)return()=>{};let n=s=>{s.key==="Escape"&&(s.preventDefault(),t())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)}function bt(t,e,n,s){if(!e)return()=>{};let a=o=>{let r=o.target;r instanceof Node&&(n?.contains(r)||s?.contains(r)||t())};return document.addEventListener("pointerdown",a,!0),()=>{document.removeEventListener("pointerdown",a,!0)}}function pt(t,e,n){let s=t.getBoundingClientRect(),a=s.bottom+8,o=s.left;if(o+e>window.innerWidth-8&&(o=Math.max(8,window.innerWidth-e-8)),o<8&&(o=8),a+n>window.innerHeight-8){let r=s.top-n-8;r>=8?a=r:a=Math.max(8,window.innerHeight-n-8)}return{top:a,left:o}}function yt(t,e,n,s,a){if(!e||!n||!t)return a(null),()=>{};let o=()=>{if(!s){a(pt(t,300,360));return}let y=s.offsetWidth||300,f=s.offsetHeight||360;a(pt(t,y,f))};o(),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0);let r;return s&&typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>o()),r.observe(s)),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0),r?.disconnect()}}function Be(t,e){if(t==="light"||t==="dark")return t;let n=e??null;for(;n;){let s=n.getAttribute("data-ctp-theme");if(s==="dark"||s==="light")return s;n=n.parentElement}if(typeof document<"u"){let s=document.documentElement.getAttribute("data-ctp-theme");if(s==="dark"||s==="light")return s}}function W(...t){return t.filter(Boolean).join(" ")}function $t(t,e){if(e){if(typeof e=="string"){t.setAttribute("style",e);return}Object.assign(t.style,e)}}function P(t,e={},n=[]){let s=document.createElement(t);for(let[a,o]of Object.entries(e))if(!(o==null||o===!1))if(a==="className")s.className=String(o);else if(a==="textContent")s.textContent=String(o);else if(a.startsWith("on")&&typeof o=="function"){let r=a.slice(2).toLowerCase();s.addEventListener(r,o)}else a==="disabled"?s.disabled=!!o:a==="tabIndex"?s.tabIndex=Number(o):s.setAttribute(a==="ariaLabel"?"aria-label":a==="ariaSelected"?"aria-selected":a==="ariaDisabled"?"aria-disabled":a==="ariaExpanded"?"aria-expanded":a==="ariaControls"?"aria-controls":a==="ariaHaspopup"?"aria-haspopup":a==="ariaModal"?"aria-modal":a==="ariaLabelledby"?"aria-labelledby":a==="ariaCurrent"?"aria-current":a,String(o));for(let a of n)a!=null&&s.append(a);return s}function Yt(t,e,n){let s=e.viewMonth.year(),a=t.yearWindowStart(s),o=a+11,r=(0,x.default)(),y=e.calPanel==="day"?e.labels.previousMonth:e.labels.previousYear,f=e.calPanel==="day"?e.labels.nextMonth:e.labels.nextYear,c;e.calPanel==="day"?c=P("button",{type:"button",className:"ctp-current-month",id:n,ariaLabel:`${U(e.viewMonth,"MMMM YYYY",e.locale)}. ${e.labels.chooseMonth}`,onClick:()=>t.setCalPanel("month"),textContent:U(e.viewMonth,"MMMM YYYY",e.locale)}):e.calPanel==="month"?c=P("button",{type:"button",className:"ctp-current-month",id:n,ariaLabel:`${s}. ${e.labels.chooseYear}`,onClick:()=>t.setCalPanel("year"),textContent:String(s)}):c=P("span",{className:"ctp-current-month",id:n,textContent:`${a} \u2013 ${o}`});let p=P("div",{className:"ctp-body ctp-body-calendar-date"},[P("div",{className:"ctp-month-year"},[P("button",{type:"button",className:"ctp-prev-month",ariaLabel:y,onClick:()=>t.navigatePrev(),textContent:"\u2039"}),c,P("button",{type:"button",className:"ctp-next-month",ariaLabel:f,onClick:()=>t.navigateNext(),textContent:"\u203A"})])]);if(e.calPanel==="month"){let S=P("div",{className:"ctp-month-grid",role:"grid",ariaLabel:e.labels.chooseMonth});for(let i=0;i<12;i+=1){let b=e.viewMonth.month(i),u=e.viewMonth.year()===r.year()&&i===r.month();S.append(P("button",{type:"button",role:"gridcell",ariaCurrent:u?"date":void 0,ariaLabel:U(b,"MMMM YYYY",e.locale),className:W("ctp-box","ctp-box-month",u&&"ctp-current"),onClick:()=>t.selectMonth(i),textContent:U(b,"MMM",e.locale)}))}p.append(S)}else if(e.calPanel==="year"){let S=P("div",{className:"ctp-year-grid",role:"grid",ariaLabel:e.labels.chooseYear});for(let i=0;i<12;i+=1){let b=a+i,u=r.year()===b;S.append(P("button",{type:"button",role:"gridcell",ariaCurrent:u?"date":void 0,ariaLabel:String(b),className:W("ctp-box","ctp-box-year",u&&"ctp-current"),onClick:()=>t.selectYear(b),textContent:String(b)}))}p.append(S)}else{let S=P("div",{className:"ctp-main-calendar",role:"grid",ariaLabel:e.labels.chooseDate,tabIndex:0,onKeydown:i=>{let b=i;t.handleGridKeyDown(b.key)&&b.preventDefault()}});for(let i of e.weekdayLabels)S.append(P("div",{className:"ctp-box ctp-box-days",role:"columnheader",textContent:i}));for(let i of e.weeks)for(let b of i){let u=b.isSelected,m=b.date.isSame(e.focusedDay,"day"),D=!b.isCurrentMonth||b.isDisabled;S.append(P("button",{type:"button",role:"gridcell",tabIndex:m?0:-1,ariaSelected:u,ariaDisabled:D,disabled:D,ariaLabel:U(b.date,"dddd, MMMM D, YYYY",e.locale),className:W("ctp-box","ctp-box-date",!b.isCurrentMonth&&"not-current-month",u&&"selected",b.isDisabled&&"disabled-date",b.isWeekend&&"weekend-day",b.isCurrentDate&&"ctp-today",b.isInRange&&"ctp-in-range",b.isRangeStart&&"ctp-range-start",b.isRangeEnd&&"ctp-range-end"),onClick:()=>{D||t.selectDay(b.date)},textContent:b.date.format("D")}))}p.append(S)}return p}function Me(t,e,n,s,a,o){let r=`ctp-${t}-${Math.random().toString(36).slice(2,8)}`,y=t==="am-pm"?"am-pm":t.endsWith("s")?t.slice(0,-1):t,f=P("div",{id:r,role:"listbox",ariaLabel:t,className:W(`ctp-overflow-${t}`,!e&&"not-visible")},s.map(c=>P("button",{type:"button",role:"option",ariaSelected:c===n,className:`ctp-${y}`,onClick:()=>o(c),textContent:c})));return P("div",{className:W("ctp-box","ctp-box-time",!e&&"not-opened")},[P("button",{type:"button",className:`ctp-${y} ctp-initial-time`,ariaHaspopup:"listbox",ariaExpanded:e,ariaControls:r,ariaLabel:`Select ${t}`,onClick:a,textContent:n}),f])}function Nt(t,e,n){let s=P("div",{className:"ctp-body ctp-body-calendar-time"});e.showDatePanel?s.append(P("div",{className:"ctp-section-label",textContent:e.labels.time})):s.append(P("span",{className:"ctp-visually-hidden",id:n,textContent:e.labels.time}));let a=P("div",{className:"ctp-main-time-header"},[P("div",{className:"ctp-box",textContent:"Hr"}),P("div",{className:"ctp-box",textContent:"Min"}),e.showSeconds?P("div",{className:"ctp-box",textContent:"Sec"}):null,e.use12Hours?P("div",{className:"ctp-box",textContent:"AM/PM"}):null]),o=P("div",{className:"ctp-main-time-body"},[Me("hours",e.showHours,e.displayHour,e.hourOptions,()=>t.toggleHours(),r=>t.selectHourOption(r)),Me("minutes",e.showMinutes,e.displayMinute,e.minuteOptions,()=>t.toggleMinutes(),r=>t.selectMinuteOption(r)),e.showSeconds?Me("seconds",e.showSecondsOpen,e.displaySecond,e.minuteOptions,()=>t.toggleSeconds(),r=>t.selectSecondOption(r)):null,e.use12Hours?Me("am-pm",e.showAmPm,e.isAm?"AM":"PM",["AM","PM"],()=>t.toggleAmPm(),r=>t.selectAmPmOption(r)):null]);return s.append(P("div",{className:"ctp-main-time"},[a,o])),s}function Rt(t,e,n,s,a){let o=Be(a.theme,a.anchorEl),r=P("div",{className:W("ctp-calendar-time-picker",e.popover&&!e.inline&&"ctp-popover",e.use12Hours&&"ctp-use-12h",e.mode==="time"&&"ctp-mode-time",!e.showSeconds&&"ctp-no-seconds",e.showDatePanel&&e.showTimePanel&&"ctp-layout-combined",e.className),role:e.inline?void 0:"dialog",ariaModal:e.inline?void 0:!0,ariaLabelledby:n});o&&r.setAttribute("data-ctp-theme",o),$t(r,a.style),e.popover&&!e.inline&&s&&(r.style.position="fixed",r.style.top=`${s.top}px`,r.style.left=`${s.left}px`),e.showModeTabs&&r.append(P("div",{className:"ctp-header"},[P("div",{className:"ctp-button-container",role:"tablist",ariaLabel:"Picker mode"},[P("button",{type:"button",role:"tab",ariaSelected:e.tab==="date",className:W("ctp-date",e.tab==="date"&&"ctp-active"),onClick:()=>t.setTab("date"),textContent:e.labels.date}),P("button",{type:"button",role:"tab",ariaSelected:e.tab==="time",className:W("ctp-time",e.tab==="time"&&"ctp-active"),onClick:()=>t.setTab("time"),textContent:e.labels.time})])])),e.showDatePanel&&r.append(Yt(t,e,n)),e.showTimePanel&&r.append(Nt(t,e,n));let y=[P("button",{type:"button",className:"close-button",onClick:()=>t.clear(),textContent:e.labels.clear})];return e.inline||y.push(P("button",{type:"button",className:"ctp-cancel",onClick:()=>t.close(),textContent:e.labels.close})),e.inline||y.push(P("button",{type:"button",onClick:()=>t.confirm(),textContent:e.labels.ok})),r.append(P("div",{className:"ctp-footer"},y)),r}function We(t,e={}){let n=new De(e),s=`ctp-title-${Math.random().toString(36).slice(2,9)}`,a=[],o=null,r=null,y=null,f=()=>{a.forEach(S=>S()),a=[],y?.remove(),y=null,r&&r.parentElement===t&&r.remove(),r=null},c=()=>{f();let S=n.getSnapshot();if(!S.open&&!S.inline)return;let i={...e},b=Rt(n,S,s,o,i);if(S.inline){r=b,t.append(b);return}if(S.popover){y=b,document.body.append(b),a.push(ue(b,!0),de(()=>n.close(),!0),bt(()=>n.close(),!0,b,e.anchorEl),yt(e.anchorEl,!0,!0,b,D=>{o=D,D&&(b.style.position="fixed",b.style.top=`${D.top}px`,b.style.left=`${D.left}px`)}));return}let u=Be(e.theme,e.anchorEl),m=P("div",{className:"ctp-calendar-time-picker-absolute-container",onClick:D=>{D.target===D.currentTarget&&n.close()}});u&&m.setAttribute("data-ctp-theme",u),m.append(b),y=m,document.body.append(m),a.push(ue(b,!0),de(()=>n.close(),!0))},p=n.subscribe(c);return c(),{update(S){Object.assign(e,S),n.setOptions(S)},destroy(){p(),f()},getController:()=>n}}var we=class{constructor(e={}){this.listeners=new Set;this.hoverEnd=null;this.calPanel="day";this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});this.getSnapshot=()=>this.snapshot;this.getServerSnapshot=()=>this.snapshot;this.options={...e};let n=e.format??ne,s=this.parseRange(e.value??e.defaultValue,n);this.start=s.start,this.end=s.end,this.viewMonth=(s.start??(0,x.default)()).startOf("month"),this.focusedDay=s.start??(0,x.default)(),this.open=e.open??(e.inline?!0:e.defaultOpen??!0),this.snapshot=this.buildSnapshot()}parseRange(e,n){return{start:G(e?.start??null,n),end:G(e?.end??null,n)}}sameDay(e,n){return e===null&&n===null?!0:e===null||n===null?!1:e.isSame(n,"day")}setOptions(e){if(this.options={...this.options,...e},e.open!==void 0&&(this.open=e.open),"value"in e){if(e.value===null)this.start=null,this.end=null,this.hoverEnd=null;else if(e.value!==void 0){let n=this.options.format??ne,s=this.parseRange(e.value,n);this.sameDay(s.start,this.start)&&this.sameDay(s.end,this.end)||(this.start=s.start,this.end=s.end,s.start&&(this.viewMonth=s.start.startOf("month"),this.focusedDay=s.start))}}this.emit()}getLabels(){return{...ge,...this.options.labels}}emit(){this.snapshot=this.buildSnapshot(),this.listeners.forEach(e=>e())}buildSnapshot(){let e=this.options.format??ne,n=this.options.weekStartsOn??0,s=this.options.locale??"en",a=ye({viewMonth:this.viewMonth,rangeStart:this.start,rangeEnd:this.end,hoverEnd:this.start&&!this.end?this.hoverEnd:null,minDate:this.options.minDate,maxDate:this.options.maxDate,disablePastDates:this.options.disablePastDates,disableFutureDates:this.options.disableFutureDates,weekStartsOn:n});return{start:this.start,end:this.end,hoverEnd:this.hoverEnd,viewMonth:this.viewMonth,focusedDay:this.focusedDay,calPanel:this.calPanel,open:this.open,inline:!!this.options.inline,format:e,asString:this.options.asString,weekStartsOn:n,locale:s,labels:this.getLabels(),className:this.options.className,weeks:a,weekdayLabels:be(s,n)}}setOpen(e){this.options.inline||(this.open=e,this.options.onOpenChange?.(e),this.emit())}close(){this.options.inline||this.setOpen(!1)}setCalPanel(e){this.calPanel=e,this.emit()}setViewMonth(e){this.viewMonth=typeof e=="function"?e(this.viewMonth):e,this.emit()}navigatePrev(){this.calPanel==="day"?this.viewMonth=this.viewMonth.subtract(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.subtract(1,"year"):this.viewMonth=this.viewMonth.subtract(12,"year"),this.emit()}navigateNext(){this.calPanel==="day"?this.viewMonth=this.viewMonth.add(1,"month"):this.calPanel==="month"?this.viewMonth=this.viewMonth.add(1,"year"):this.viewMonth=this.viewMonth.add(12,"year"),this.emit()}selectMonth(e){this.viewMonth=this.viewMonth.month(e),this.calPanel="day",this.emit()}selectYear(e){this.viewMonth=this.viewMonth.year(e),this.calPanel="month",this.emit()}emitRange(e,n){if(this.options.asString===!1)this.options.onChange?.({start:e?e.toDate():null,end:n?n.toDate():null});else{this.options.asString===void 0&&fe();let s=this.options.format??ne;this.options.onChange?.({start:ee(e,s),end:ee(n,s)})}}pickDay(e){!this.start||this.start&&this.end?(this.start=e,this.end=null,this.hoverEnd=null,this.focusedDay=e):e.isBefore(this.start,"day")?(this.start=e,this.end=null,this.hoverEnd=null,this.focusedDay=e):(this.end=e,this.hoverEnd=null,this.focusedDay=e),this.emit(),this.options.asString===!1?this.emitRange(this.start,this.end):this.options.inline&&this.start&&this.end&&this.emitRange(this.start,this.end)}setHoverEnd(e){this.start&&!this.end&&(this.hoverEnd=e,this.emit())}handleGridKeyDown(e){let n=this.snapshot,s=this.focusedDay;switch(e){case"ArrowLeft":s=this.focusedDay.subtract(1,"day");break;case"ArrowRight":s=this.focusedDay.add(1,"day");break;case"ArrowUp":s=this.focusedDay.subtract(7,"day");break;case"ArrowDown":s=this.focusedDay.add(7,"day");break;case"Home":s=se(this.focusedDay,n.weekStartsOn);break;case"End":s=oe(this.focusedDay,n.weekStartsOn);break;case"PageUp":s=this.focusedDay.subtract(1,"month"),this.viewMonth=s.startOf("month");break;case"PageDown":s=this.focusedDay.add(1,"month"),this.viewMonth=s.startOf("month");break;case"Enter":case" ":{let a=n.weeks.flat().find(o=>o.date.isSame(this.focusedDay,"day"));return a&&!a.isDisabled&&a.isCurrentMonth&&this.pickDay(a.date),!0}default:return!1}return this.focusedDay=s,s.isSame(this.viewMonth,"month")||(this.viewMonth=s.startOf("month")),this.emit(),!0}confirm(){return!this.start||!this.end?null:(this.emitRange(this.start,this.end),this.close(),{start:this.start.toDate(),end:this.end.toDate()})}clear(){this.start=null,this.end=null,this.hoverEnd=null,this.emitRange(null,null),this.emit(),this.close()}};function N(t,e={},n=[]){let s=document.createElement(t);for(let[a,o]of Object.entries(e))if(!(o==null||o===!1))if(a==="className")s.className=String(o);else if(a==="textContent")s.textContent=String(o);else if(a.startsWith("on")&&typeof o=="function")s.addEventListener(a.slice(2).toLowerCase(),o);else if(a==="disabled")s.disabled=!!o;else if(a==="tabIndex")s.tabIndex=Number(o);else{let r=a==="ariaLabel"?"aria-label":a==="ariaSelected"?"aria-selected":a==="ariaDisabled"?"aria-disabled":a==="ariaModal"?"aria-modal":a==="ariaLabelledby"?"aria-labelledby":a==="ariaCurrent"?"aria-current":a;s.setAttribute(r,String(o))}for(let a of n)a!=null&&s.append(a);return s}function jt(t,e){if(e){if(typeof e=="string"){t.setAttribute("style",e);return}Object.assign(t.style,e)}}function gt(t,e){return t===null&&e===null?!0:t===null||e===null?!1:t.isSame(e,"day")}function vt(t){return W("ctp-box","ctp-box-date",!t.isCurrentMonth&&"not-current-month",t.isDisabled&&"disabled-date",t.isWeekend&&"weekend-day",t.isCurrentDate&&"ctp-today",t.isInRange&&"ctp-in-range",t.isRangeStart&&"ctp-range-start",t.isRangeEnd&&"ctp-range-end")}function Vt(t,e,n){let s=e.date.isSame(n.focusedDay,"day"),a=!e.isCurrentMonth||e.isDisabled;t.className=vt(e),t.tabIndex=s?0:-1,t.disabled=a,t.setAttribute("aria-selected",String(!!(e.isRangeStart||e.isRangeEnd))),t.setAttribute("aria-disabled",String(a))}function _t(t,e){return t.calPanel==="day"&&e.calPanel==="day"&&t.viewMonth.isSame(e.viewMonth,"month")&&gt(t.start,e.start)&&gt(t.end,e.end)&&t.focusedDay.isSame(e.focusedDay,"day")&&t.open===e.open&&t.inline===e.inline}function Dt(t,e={}){let n=new we(e),s=`ctp-range-${Math.random().toString(36).slice(2,9)}`,a=[],o=null,r=null,y=null,f=null,c=()=>{a.forEach(i=>i()),a=[],r?.remove(),r=null,o?.remove(),o=null,y=null,f=null},p=()=>{let i=n.getSnapshot();if(!i.open&&!i.inline){c();return}if(y&&f&&o&&_t(y,i)){for(let L of i.weeks)for(let k of L){let M=k.date.format("YYYY-MM-DD"),O=f.get(M);O&&Vt(O,k,i)}y=i;return}c();let b=(0,x.default)(),u=i.viewMonth.year(),m=Math.floor(u/12)*12,D=m+11,E=i.start&&!i.end?i.labels.selectEnd:`${i.start?U(i.start,"MMM D, YYYY",i.locale):i.labels.start} \u2014 ${i.end?U(i.end,"MMM D, YYYY",i.locale):i.labels.end}`,$;i.calPanel==="day"?$=N("button",{type:"button",className:"ctp-current-month",ariaLabel:`${U(i.viewMonth,"MMMM YYYY",i.locale)}. ${i.labels.chooseMonth}`,onClick:()=>n.setCalPanel("month"),textContent:U(i.viewMonth,"MMMM YYYY",i.locale)}):i.calPanel==="month"?$=N("button",{type:"button",className:"ctp-current-month",ariaLabel:`${u}. ${i.labels.chooseYear}`,onClick:()=>n.setCalPanel("year"),textContent:String(u)}):$=N("span",{className:"ctp-current-month",textContent:`${m} \u2013 ${D}`});let A=N("div",{className:"ctp-body ctp-body-calendar-date"},[N("div",{className:"ctp-month-year"},[N("button",{type:"button",className:"ctp-prev-month",ariaLabel:i.calPanel==="day"?i.labels.previousMonth:i.labels.previousYear,onClick:()=>n.navigatePrev(),textContent:"\u2039"}),$,N("button",{type:"button",className:"ctp-next-month",ariaLabel:i.calPanel==="day"?i.labels.nextMonth:i.labels.nextYear,onClick:()=>n.navigateNext(),textContent:"\u203A"})])]);if(i.calPanel==="day"){let L=new Map,k=N("div",{className:"ctp-main-calendar",role:"grid",ariaLabel:i.labels.chooseDateRange,tabIndex:0,onKeydown:M=>{let O=M;n.handleGridKeyDown(O.key)&&O.preventDefault()},onMouseleave:()=>n.setHoverEnd(null)});for(let M of i.weekdayLabels)k.append(N("div",{className:"ctp-box ctp-box-days",role:"columnheader",textContent:M}));for(let M of i.weeks)for(let O of M){let F=O.date.isSame(i.focusedDay,"day"),g=!O.isCurrentMonth||O.isDisabled,d=N("button",{type:"button",role:"gridcell",tabIndex:F?0:-1,ariaSelected:!!(O.isRangeStart||O.isRangeEnd),ariaDisabled:g,disabled:g,ariaLabel:U(O.date,"dddd, MMMM D, YYYY",i.locale),className:vt(O),onClick:()=>{g||n.pickDay(O.date)},onMouseenter:()=>{!g&&i.start&&!i.end&&n.setHoverEnd(O.date)},textContent:O.date.format("D")});L.set(O.date.format("YYYY-MM-DD"),d),k.append(d)}f=L,A.append(k)}else if(i.calPanel==="month"){let L=N("div",{className:"ctp-month-grid",role:"grid",ariaLabel:i.labels.chooseMonth});for(let k=0;k<12;k+=1){let M=i.viewMonth.month(k),O=i.viewMonth.year()===b.year()&&k===b.month();L.append(N("button",{type:"button",role:"gridcell",ariaCurrent:O?"date":void 0,className:W("ctp-box","ctp-box-month",O&&"ctp-current"),onClick:()=>n.selectMonth(k),textContent:U(M,"MMM",i.locale)}))}A.append(L)}else{let L=N("div",{className:"ctp-year-grid",role:"grid",ariaLabel:i.labels.chooseYear});for(let k=0;k<12;k+=1){let M=m+k;L.append(N("button",{type:"button",role:"gridcell",ariaCurrent:b.year()===M?"date":void 0,className:W("ctp-box","ctp-box-year",b.year()===M&&"ctp-current"),onClick:()=>n.selectYear(M),textContent:String(M)}))}A.append(L)}let R=[N("button",{type:"button",className:"close-button",onClick:()=>n.clear(),textContent:i.labels.clear})];i.inline||R.push(N("button",{type:"button",className:"ctp-cancel",onClick:()=>n.close(),textContent:i.labels.close})),i.inline||R.push(N("button",{type:"button",disabled:!i.start||!i.end,onClick:()=>n.confirm(),textContent:i.labels.ok}));let I=N("div",{className:W("ctp-calendar-time-picker",i.className),role:i.inline?void 0:"dialog",ariaModal:i.inline?void 0:!0,ariaLabelledby:s},[N("div",{className:"ctp-header"},[N("span",{id:s,className:"ctp-range-title",textContent:E})]),A,N("div",{className:"ctp-footer"},R)]);if(jt(I,e.style),i.inline){o=I,t.append(I),y=i;return}let V=N("div",{className:"ctp-calendar-time-picker-absolute-container",onClick:L=>{L.target===L.currentTarget&&n.close()}});V.append(I),r=V,document.body.append(V),a.push(ue(I,!0),de(()=>n.close(),!0)),y=i},S=n.subscribe(p);return p(),{update(i){Object.assign(e,i),n.setOptions(i)},destroy(){S(),c()},getController:()=>n}}function Z(t,e,n=!1){if(!t.hasAttribute(e))return n;let s=t.getAttribute(e);return s===""||s==="true"||s===e}function qe(t){if(t.hasAttribute("as-string"))return Z(t,"as-string",!0)}function St(t,e){return t?!0:e.hasAttribute("open")?Z(e,"open"):!1}function Ct(t,e){e?t.setAttribute("open",""):t.removeAttribute("open")}var Mt="universal-datetime-picker-styles";function Ce(t){if(typeof document>"u"||document.getElementById(Mt))return;let e=document.createElement("link");e.id=Mt,e.rel="stylesheet",e.href=t??"https://cdn.jsdelivr.net/npm/universal-datetime-picker/dist/style.css",document.head.append(e)}var Se=class extends HTMLElement{constructor(){super(...arguments);this.handle=null;this.mountEl=null}connectedCallback(){this.mountEl||(this.mountEl=document.createElement("div"),this.append(this.mountEl)),this.mount()}disconnectedCallback(){this.handle?.destroy(),this.handle=null}emitChange(n){this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))}},Ge=class extends Se{static get observedAttributes(){return["mode","layout","inline","open","use12hours","show-seconds","as-string","locale","format","theme","value","popover"]}attributeChangedCallback(){this.isConnected&&this.mount()}get value(){return this._value??null}set value(e){this._value=e,this.isConnected&&this.mount()}mount(){if(this.handle?.destroy(),!this.mountEl)return;this.mountEl.replaceChildren();let e=this.getAttribute("mode")||"datetime",n=this.getAttribute("layout")||"combined",s=this.hasAttribute("show-seconds")?Z(this,"show-seconds",!0):!0,a=Z(this,"use12hours"),o=Z(this,"inline"),r=Z(this,"popover"),y=qe(this),f=this.getAttribute("format")||void 0,c=this.getAttribute("locale")||"en",p=this.getAttribute("theme")||void 0,S=St(o,this),i=this.getAttribute("value"),b=this._value,u=b!==void 0?b:i??void 0;this.handle=We(this.mountEl,{mode:e,layout:n,showSeconds:s,use12Hours:a,inline:o,popover:r,asString:y,format:f,locale:c,theme:p,open:S,value:u===void 0?void 0:u,onChange:m=>{this._value=m,this.emitChange(m)},onOpenChange:m=>{Ct(this,m),this.dispatchEvent(new CustomEvent("openchange",{detail:m,bubbles:!0,composed:!0}))}})}},ze=class extends HTMLElement{constructor(){super(...arguments);this.handle=null;this.input=null;this.root=null}static get observedAttributes(){return["mode","placeholder","disabled","use12hours","show-seconds","as-string","locale","format","value","theme"]}connectedCallback(){this.root||(this.root=document.createElement("div"),this.root.className="ctp-input-root",this.input=document.createElement("input"),this.input.className="ctp-input",this.input.readOnly=!0,this.root.append(this.input),this.append(this.root)),this.sync()}disconnectedCallback(){this.handle?.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.sync()}sync(){if(!this.input||!this.root)return;this.handle?.destroy();let n=this.getAttribute("mode")||"datetime",s=this.hasAttribute("show-seconds")?Z(this,"show-seconds",!0):!0,a=Z(this,"use12hours"),o=qe(this),r=this.getAttribute("format")||void 0,y=re({mode:n,format:r,use12Hours:a,showSeconds:s}),f=this.getAttribute("placeholder")||"Select date and time",c=Z(this,"disabled"),p=this.getAttribute("locale")||"en",S=this.getAttribute("theme")||void 0,i=this.getAttribute("value");this.input.placeholder=f,this.input.disabled=c,this.input.setAttribute("aria-haspopup","dialog"),this.input.setAttribute("aria-label",f);let b=i?ee(G(i,y),y)??i:"";this.input.value=b;let u=()=>{c||(this.handle?.destroy(),this.handle=We(this.root,{mode:n,showSeconds:s,use12Hours:a,asString:o,format:r,locale:p,theme:S,popover:!0,anchorEl:this.input,open:!0,value:i,onChange:m=>{let D="";m===null?D="":typeof m=="string"?D=m:m instanceof Date?D=ee((0,x.default)(m),y)??"":D=m.formatted,this.input&&(this.input.value=D),D?this.setAttribute("value",D):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("change",{detail:m,bubbles:!0,composed:!0}))},onOpenChange:m=>{this.input?.setAttribute("aria-expanded",String(m)),m||(this.handle?.destroy(),this.handle=null)}}))};this.input.onclick=u,this.input.onkeydown=m=>{c||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),u())}}},Ze=class extends Se{static get observedAttributes(){return["inline","open","as-string","locale","format","value-start","value-end"]}attributeChangedCallback(){this.isConnected&&this.mount()}mount(){if(this.handle?.destroy(),!this.mountEl)return;this.mountEl.replaceChildren();let e=Z(this,"inline"),n=qe(this),s=this.getAttribute("format")||void 0,a=this.getAttribute("locale")||"en",o=St(e,this),r=this.getAttribute("value-start"),y=this.getAttribute("value-end");this.handle=Dt(this.mountEl,{inline:e,asString:n,format:s,locale:a,open:o,value:r||y?{start:r??null,end:y??null}:void 0,onChange:f=>{(typeof f.start=="string"||f.start===null)&&(f.start?this.setAttribute("value-start",f.start):this.removeAttribute("value-start")),(typeof f.end=="string"||f.end===null)&&(f.end?this.setAttribute("value-end",f.end):this.removeAttribute("value-end")),this.emitChange(f)},onOpenChange:f=>{Ct(this,f),this.dispatchEvent(new CustomEvent("openchange",{detail:f,bubbles:!0,composed:!0}))}})}},wt=!1;function Ue(t,e){let n=e?.trim();return n?`${n}-${t}`:t}function Ke(t,e,n){if(customElements.get(t))return;let s=n?class extends e{}:e;customElements.define(t,s)}function ke(t){if(typeof customElements>"u")return;let e=t?.prefix?.trim(),n=!!e,s=Ue("datetime-picker",e),a=Ue("datetime-picker-input",e),o=Ue("datetime-picker-range",e);if(!e){if(wt)return;wt=!0}Ke(s,Ge,n),Ke(a,ze,n),Ke(o,Ze,n)}Ce();ke();return Lt(It);})();
@@ -1,5 +1,5 @@
1
- import { T as TimeValue, D as DateTimeMode, a as DateTimeValue, C as CalendarDay } from '../rangeController-Bq35aBwe.mjs';
2
- export { b as CalendarPanel, c as DEFAULT_LABELS, d as DateRangeValue, e as DateTimeBaseOptions, f as DateTimeChangeValue, g as DateTimeLabels, h as DateTimeLayout, i as DateTimeRangeOptions, L as Listener, P as PickerController, j as PickerControllerOptions, k as PickerSnapshot, R as RangeController, l as RangeSnapshot } from '../rangeController-Bq35aBwe.mjs';
1
+ import { T as TimeValue, D as DateTimeMode, a as DateTimeValue, C as CalendarDay } from '../rangeController-BBZcdM0Z.mjs';
2
+ export { b as CalendarPanel, c as DEFAULT_LABELS, d as DateRangeValue, e as DateTimeBaseOptions, f as DateTimeChangeValue, g as DateTimeLabels, h as DateTimeLayout, i as DateTimeRangeOptions, L as Listener, P as PickerController, j as PickerControllerOptions, k as PickerSnapshot, R as RangeController, l as RangeSnapshot } from '../rangeController-BBZcdM0Z.mjs';
3
3
  import { Dayjs, ConfigType } from 'dayjs';
4
4
  export { Dayjs, default as dayjs } from 'dayjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { T as TimeValue, D as DateTimeMode, a as DateTimeValue, C as CalendarDay } from '../rangeController-Bq35aBwe.js';
2
- export { b as CalendarPanel, c as DEFAULT_LABELS, d as DateRangeValue, e as DateTimeBaseOptions, f as DateTimeChangeValue, g as DateTimeLabels, h as DateTimeLayout, i as DateTimeRangeOptions, L as Listener, P as PickerController, j as PickerControllerOptions, k as PickerSnapshot, R as RangeController, l as RangeSnapshot } from '../rangeController-Bq35aBwe.js';
1
+ import { T as TimeValue, D as DateTimeMode, a as DateTimeValue, C as CalendarDay } from '../rangeController-BBZcdM0Z.js';
2
+ export { b as CalendarPanel, c as DEFAULT_LABELS, d as DateRangeValue, e as DateTimeBaseOptions, f as DateTimeChangeValue, g as DateTimeLabels, h as DateTimeLayout, i as DateTimeRangeOptions, L as Listener, P as PickerController, j as PickerControllerOptions, k as PickerSnapshot, R as RangeController, l as RangeSnapshot } from '../rangeController-BBZcdM0Z.js';
3
3
  import { Dayjs, ConfigType } from 'dayjs';
4
4
  export { Dayjs, default as dayjs } from 'dayjs';
5
5
 
@@ -396,23 +396,28 @@ var PickerController = class {
396
396
  this.draft = this.draft.year(day.year()).month(day.month()).date(day.date());
397
397
  this.focusedDay = day;
398
398
  this.emit();
399
+ this.maybeCommitInline();
399
400
  }
400
401
  setHour(hourValue) {
401
402
  this.draft = this.draft.hour(hourValue);
402
403
  this.emit();
404
+ this.maybeCommitInline();
403
405
  }
404
406
  setMinute(minute) {
405
407
  this.draft = this.draft.minute(minute);
406
408
  this.emit();
409
+ this.maybeCommitInline();
407
410
  }
408
411
  setSecond(second) {
409
412
  this.draft = this.draft.second(second);
410
413
  this.emit();
414
+ this.maybeCommitInline();
411
415
  }
412
416
  setAmPm(isAm) {
413
417
  const { hour } = to12Hour(this.draft.hour());
414
418
  this.draft = this.draft.hour(to24Hour(hour, isAm));
415
419
  this.emit();
420
+ this.maybeCommitInline();
416
421
  }
417
422
  toggleHours() {
418
423
  this.showHours = !this.showHours;
@@ -458,22 +463,26 @@ var PickerController = class {
458
463
  }
459
464
  this.showHours = false;
460
465
  this.emit();
466
+ this.maybeCommitInline();
461
467
  }
462
468
  selectMinuteOption(opt) {
463
469
  this.draft = this.draft.minute(Number(opt));
464
470
  this.showMinutes = false;
465
471
  this.emit();
472
+ this.maybeCommitInline();
466
473
  }
467
474
  selectSecondOption(opt) {
468
475
  this.draft = this.draft.second(Number(opt));
469
476
  this.showSecondsOpen = false;
470
477
  this.emit();
478
+ this.maybeCommitInline();
471
479
  }
472
480
  selectAmPmOption(opt) {
473
481
  const { hour } = to12Hour(this.draft.hour());
474
482
  this.draft = this.draft.hour(to24Hour(hour, opt === "AM"));
475
483
  this.showAmPm = false;
476
484
  this.emit();
485
+ this.maybeCommitInline();
477
486
  }
478
487
  handleGridKeyDown(key) {
479
488
  const snap = this.snapshot;
@@ -523,23 +532,30 @@ var PickerController = class {
523
532
  this.emit();
524
533
  return true;
525
534
  }
526
- confirm() {
535
+ buildPayload() {
527
536
  const snap = this.snapshot;
528
- let payload;
529
537
  if (snap.asString === false) {
530
538
  if (snap.mode === "time") {
531
- payload = buildTimeValue(this.draft, snap.resolvedFormat);
532
- } else if (snap.mode === "date") {
533
- payload = this.draft.startOf("day").toDate();
534
- } else {
535
- payload = this.draft.toDate();
539
+ return buildTimeValue(this.draft, snap.resolvedFormat);
536
540
  }
537
- } else {
538
- if (snap.asString === void 0) {
539
- warnAsStringDeprecation();
541
+ if (snap.mode === "date") {
542
+ return this.draft.startOf("day").toDate();
540
543
  }
541
- payload = formatValue(this.draft, snap.resolvedFormat);
544
+ return this.draft.toDate();
545
+ }
546
+ if (snap.asString === void 0) {
547
+ warnAsStringDeprecation();
548
+ }
549
+ return formatValue(this.draft, snap.resolvedFormat);
550
+ }
551
+ maybeCommitInline() {
552
+ if (!this.options.inline) {
553
+ return;
542
554
  }
555
+ this.options.onChange?.(this.buildPayload());
556
+ }
557
+ confirm() {
558
+ const payload = this.buildPayload();
543
559
  this.options.onChange?.(payload);
544
560
  this.close();
545
561
  return payload;
@@ -614,6 +630,15 @@ var RangeController = class {
614
630
  end: parseValue(range?.end ?? null, format)
615
631
  };
616
632
  }
633
+ sameDay(a, b) {
634
+ if (a === null && b === null) {
635
+ return true;
636
+ }
637
+ if (a === null || b === null) {
638
+ return false;
639
+ }
640
+ return a.isSame(b, "day");
641
+ }
617
642
  setOptions(partial) {
618
643
  this.options = { ...this.options, ...partial };
619
644
  if (partial.open !== void 0) {
@@ -627,11 +652,14 @@ var RangeController = class {
627
652
  } else if (partial.value !== void 0) {
628
653
  const format = this.options.format ?? DATE_FORMAT;
629
654
  const parsed = this.parseRange(partial.value, format);
630
- this.start = parsed.start;
631
- this.end = parsed.end;
632
- if (parsed.start) {
633
- this.viewMonth = parsed.start.startOf("month");
634
- this.focusedDay = parsed.start;
655
+ const unchanged = this.sameDay(parsed.start, this.start) && this.sameDay(parsed.end, this.end);
656
+ if (!unchanged) {
657
+ this.start = parsed.start;
658
+ this.end = parsed.end;
659
+ if (parsed.start) {
660
+ this.viewMonth = parsed.start.startOf("month");
661
+ this.focusedDay = parsed.start;
662
+ }
635
663
  }
636
664
  }
637
665
  }
@@ -763,6 +791,11 @@ var RangeController = class {
763
791
  this.focusedDay = day;
764
792
  }
765
793
  this.emit();
794
+ if (this.options.asString === false) {
795
+ this.emitRange(this.start, this.end);
796
+ } else if (this.options.inline && this.start && this.end) {
797
+ this.emitRange(this.start, this.end);
798
+ }
766
799
  }
767
800
  setHoverEnd(day) {
768
801
  if (this.start && !this.end) {
@@ -386,23 +386,28 @@ var PickerController = class {
386
386
  this.draft = this.draft.year(day.year()).month(day.month()).date(day.date());
387
387
  this.focusedDay = day;
388
388
  this.emit();
389
+ this.maybeCommitInline();
389
390
  }
390
391
  setHour(hourValue) {
391
392
  this.draft = this.draft.hour(hourValue);
392
393
  this.emit();
394
+ this.maybeCommitInline();
393
395
  }
394
396
  setMinute(minute) {
395
397
  this.draft = this.draft.minute(minute);
396
398
  this.emit();
399
+ this.maybeCommitInline();
397
400
  }
398
401
  setSecond(second) {
399
402
  this.draft = this.draft.second(second);
400
403
  this.emit();
404
+ this.maybeCommitInline();
401
405
  }
402
406
  setAmPm(isAm) {
403
407
  const { hour } = to12Hour(this.draft.hour());
404
408
  this.draft = this.draft.hour(to24Hour(hour, isAm));
405
409
  this.emit();
410
+ this.maybeCommitInline();
406
411
  }
407
412
  toggleHours() {
408
413
  this.showHours = !this.showHours;
@@ -448,22 +453,26 @@ var PickerController = class {
448
453
  }
449
454
  this.showHours = false;
450
455
  this.emit();
456
+ this.maybeCommitInline();
451
457
  }
452
458
  selectMinuteOption(opt) {
453
459
  this.draft = this.draft.minute(Number(opt));
454
460
  this.showMinutes = false;
455
461
  this.emit();
462
+ this.maybeCommitInline();
456
463
  }
457
464
  selectSecondOption(opt) {
458
465
  this.draft = this.draft.second(Number(opt));
459
466
  this.showSecondsOpen = false;
460
467
  this.emit();
468
+ this.maybeCommitInline();
461
469
  }
462
470
  selectAmPmOption(opt) {
463
471
  const { hour } = to12Hour(this.draft.hour());
464
472
  this.draft = this.draft.hour(to24Hour(hour, opt === "AM"));
465
473
  this.showAmPm = false;
466
474
  this.emit();
475
+ this.maybeCommitInline();
467
476
  }
468
477
  handleGridKeyDown(key) {
469
478
  const snap = this.snapshot;
@@ -513,23 +522,30 @@ var PickerController = class {
513
522
  this.emit();
514
523
  return true;
515
524
  }
516
- confirm() {
525
+ buildPayload() {
517
526
  const snap = this.snapshot;
518
- let payload;
519
527
  if (snap.asString === false) {
520
528
  if (snap.mode === "time") {
521
- payload = buildTimeValue(this.draft, snap.resolvedFormat);
522
- } else if (snap.mode === "date") {
523
- payload = this.draft.startOf("day").toDate();
524
- } else {
525
- payload = this.draft.toDate();
529
+ return buildTimeValue(this.draft, snap.resolvedFormat);
526
530
  }
527
- } else {
528
- if (snap.asString === void 0) {
529
- warnAsStringDeprecation();
531
+ if (snap.mode === "date") {
532
+ return this.draft.startOf("day").toDate();
530
533
  }
531
- payload = formatValue(this.draft, snap.resolvedFormat);
534
+ return this.draft.toDate();
535
+ }
536
+ if (snap.asString === void 0) {
537
+ warnAsStringDeprecation();
538
+ }
539
+ return formatValue(this.draft, snap.resolvedFormat);
540
+ }
541
+ maybeCommitInline() {
542
+ if (!this.options.inline) {
543
+ return;
532
544
  }
545
+ this.options.onChange?.(this.buildPayload());
546
+ }
547
+ confirm() {
548
+ const payload = this.buildPayload();
533
549
  this.options.onChange?.(payload);
534
550
  this.close();
535
551
  return payload;
@@ -604,6 +620,15 @@ var RangeController = class {
604
620
  end: parseValue(range?.end ?? null, format)
605
621
  };
606
622
  }
623
+ sameDay(a, b) {
624
+ if (a === null && b === null) {
625
+ return true;
626
+ }
627
+ if (a === null || b === null) {
628
+ return false;
629
+ }
630
+ return a.isSame(b, "day");
631
+ }
607
632
  setOptions(partial) {
608
633
  this.options = { ...this.options, ...partial };
609
634
  if (partial.open !== void 0) {
@@ -617,11 +642,14 @@ var RangeController = class {
617
642
  } else if (partial.value !== void 0) {
618
643
  const format = this.options.format ?? DATE_FORMAT;
619
644
  const parsed = this.parseRange(partial.value, format);
620
- this.start = parsed.start;
621
- this.end = parsed.end;
622
- if (parsed.start) {
623
- this.viewMonth = parsed.start.startOf("month");
624
- this.focusedDay = parsed.start;
645
+ const unchanged = this.sameDay(parsed.start, this.start) && this.sameDay(parsed.end, this.end);
646
+ if (!unchanged) {
647
+ this.start = parsed.start;
648
+ this.end = parsed.end;
649
+ if (parsed.start) {
650
+ this.viewMonth = parsed.start.startOf("month");
651
+ this.focusedDay = parsed.start;
652
+ }
625
653
  }
626
654
  }
627
655
  }
@@ -753,6 +781,11 @@ var RangeController = class {
753
781
  this.focusedDay = day;
754
782
  }
755
783
  this.emit();
784
+ if (this.options.asString === false) {
785
+ this.emitRange(this.start, this.end);
786
+ } else if (this.options.inline && this.start && this.end) {
787
+ this.emitRange(this.start, this.end);
788
+ }
756
789
  }
757
790
  setHoverEnd(day) {
758
791
  if (this.start && !this.end) {