universal-datetime-picker 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +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);})();
@@ -0,0 +1,58 @@
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';
3
+ import { Dayjs, ConfigType } from 'dayjs';
4
+ export { Dayjs, default as dayjs } from 'dayjs';
5
+
6
+ declare const DEFAULT_FORMAT = "YYYY-MM-DD HH:mm:ss";
7
+ declare const DATE_FORMAT = "YYYY-MM-DD";
8
+ declare const TIME_FORMAT = "HH:mm:ss";
9
+ declare function resolveFormat(options: {
10
+ mode?: DateTimeMode;
11
+ format?: string;
12
+ use12Hours?: boolean;
13
+ showSeconds?: boolean;
14
+ }): string;
15
+ declare function buildTimeValue(value: Dayjs, format: string): TimeValue;
16
+ /** One-time warning when `asString` is omitted (string return is deprecated). */
17
+ declare function warnAsStringDeprecation(): void;
18
+ declare function parseValue(value: ConfigType | undefined | null, format?: string): Dayjs | null;
19
+ declare function formatValue(value: Dayjs | null, format?: string): string | null;
20
+ declare function pad2(n: number): string;
21
+ declare const HOURS_24: string[];
22
+ declare const HOURS_12: string[];
23
+ declare const MINUTES: string[];
24
+ declare function to12Hour(hour24: number): {
25
+ hour: number;
26
+ isAm: boolean;
27
+ };
28
+ declare function to24Hour(hour12: number, isAm: boolean): number;
29
+ /** Formats a date with an instance locale (does not mutate global dayjs locale). */
30
+ declare function formatLocalized(date: Dayjs, template: string, locale: string): string;
31
+ /**
32
+ * Weekday labels for the given locale without mutating the global dayjs locale.
33
+ * Consumers should import the locale module first, e.g. `import "dayjs/locale/fr"`.
34
+ */
35
+ declare function getWeekdayLabels(locale: string, weekStartsOn: number): string[];
36
+ declare function startOfWeek(date: Dayjs, weekStartsOn: number): Dayjs;
37
+ declare function endOfWeek(date: Dayjs, weekStartsOn: number): Dayjs;
38
+
39
+ interface BuildCalendarOptions {
40
+ viewMonth: Dayjs;
41
+ selected?: Dayjs | null;
42
+ rangeStart?: Dayjs | null;
43
+ rangeEnd?: Dayjs | null;
44
+ /** Tentative end for hover preview while selecting a range. */
45
+ hoverEnd?: Dayjs | null;
46
+ minDate?: DateTimeValue;
47
+ maxDate?: DateTimeValue;
48
+ disablePastDates?: boolean;
49
+ disableFutureDates?: boolean;
50
+ weekStartsOn?: number;
51
+ }
52
+ /**
53
+ * Builds a month grid of weeks × days with correct current-month flags
54
+ * (including the last day of the month).
55
+ */
56
+ declare function buildCalendarMonth(options: BuildCalendarOptions): CalendarDay[][];
57
+
58
+ export { type BuildCalendarOptions, CalendarDay, DATE_FORMAT, DEFAULT_FORMAT, DateTimeMode, DateTimeValue, HOURS_12, HOURS_24, MINUTES, TIME_FORMAT, TimeValue, buildCalendarMonth, buildTimeValue, endOfWeek, formatLocalized, formatValue, getWeekdayLabels, pad2, parseValue, resolveFormat, startOfWeek, to12Hour, to24Hour, warnAsStringDeprecation };
@@ -0,0 +1,58 @@
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';
3
+ import { Dayjs, ConfigType } from 'dayjs';
4
+ export { Dayjs, default as dayjs } from 'dayjs';
5
+
6
+ declare const DEFAULT_FORMAT = "YYYY-MM-DD HH:mm:ss";
7
+ declare const DATE_FORMAT = "YYYY-MM-DD";
8
+ declare const TIME_FORMAT = "HH:mm:ss";
9
+ declare function resolveFormat(options: {
10
+ mode?: DateTimeMode;
11
+ format?: string;
12
+ use12Hours?: boolean;
13
+ showSeconds?: boolean;
14
+ }): string;
15
+ declare function buildTimeValue(value: Dayjs, format: string): TimeValue;
16
+ /** One-time warning when `asString` is omitted (string return is deprecated). */
17
+ declare function warnAsStringDeprecation(): void;
18
+ declare function parseValue(value: ConfigType | undefined | null, format?: string): Dayjs | null;
19
+ declare function formatValue(value: Dayjs | null, format?: string): string | null;
20
+ declare function pad2(n: number): string;
21
+ declare const HOURS_24: string[];
22
+ declare const HOURS_12: string[];
23
+ declare const MINUTES: string[];
24
+ declare function to12Hour(hour24: number): {
25
+ hour: number;
26
+ isAm: boolean;
27
+ };
28
+ declare function to24Hour(hour12: number, isAm: boolean): number;
29
+ /** Formats a date with an instance locale (does not mutate global dayjs locale). */
30
+ declare function formatLocalized(date: Dayjs, template: string, locale: string): string;
31
+ /**
32
+ * Weekday labels for the given locale without mutating the global dayjs locale.
33
+ * Consumers should import the locale module first, e.g. `import "dayjs/locale/fr"`.
34
+ */
35
+ declare function getWeekdayLabels(locale: string, weekStartsOn: number): string[];
36
+ declare function startOfWeek(date: Dayjs, weekStartsOn: number): Dayjs;
37
+ declare function endOfWeek(date: Dayjs, weekStartsOn: number): Dayjs;
38
+
39
+ interface BuildCalendarOptions {
40
+ viewMonth: Dayjs;
41
+ selected?: Dayjs | null;
42
+ rangeStart?: Dayjs | null;
43
+ rangeEnd?: Dayjs | null;
44
+ /** Tentative end for hover preview while selecting a range. */
45
+ hoverEnd?: Dayjs | null;
46
+ minDate?: DateTimeValue;
47
+ maxDate?: DateTimeValue;
48
+ disablePastDates?: boolean;
49
+ disableFutureDates?: boolean;
50
+ weekStartsOn?: number;
51
+ }
52
+ /**
53
+ * Builds a month grid of weeks × days with correct current-month flags
54
+ * (including the last day of the month).
55
+ */
56
+ declare function buildCalendarMonth(options: BuildCalendarOptions): CalendarDay[][];
57
+
58
+ export { type BuildCalendarOptions, CalendarDay, DATE_FORMAT, DEFAULT_FORMAT, DateTimeMode, DateTimeValue, HOURS_12, HOURS_24, MINUTES, TIME_FORMAT, TimeValue, buildCalendarMonth, buildTimeValue, endOfWeek, formatLocalized, formatValue, getWeekdayLabels, pad2, parseValue, resolveFormat, startOfWeek, to12Hour, to24Hour, warnAsStringDeprecation };