/*!
 * Built with Stencil
 * By PostNord.
 */
'use strict';

var index = require('./index-CfUQZtlH.js');
var index$2 = require('./index.cjs.js');
var index$1 = require('./index-CNdVg5VI.js');
var arrow_left = require('./arrow_left-Crkz484c.js');
var arrow_right = require('./arrow_right-CABi9Wkp.js');

const icon$1 = '<svg class="pn-icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M9 3.5a1 1 0 0 1 1 1V5h4v-.5a1 1 0 1 1 2 0V5h2a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2v-.5a1 1 0 0 1 1-1M8 7H6a1 1 0 0 0-1 1v1.5h14V8a1 1 0 0 0-1-1h-2v.5a1 1 0 1 1-2 0V7h-4v.5a1 1 0 0 1-2 0zm11 4.5H5V17a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z" clip-rule="evenodd"/></svg>';
const calendar = icon$1;

const icon = '<svg class="pn-icon-svg" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#000" fill-rule="evenodd" d="M11.707 21.707a1 1 0 0 0 0-1.414L8.414 17H11.5a7.5 7.5 0 0 0 0-15H11a1 1 0 1 0 0 2h.5a5.5 5.5 0 1 1 0 11H8.414l3.293-3.293a1 1 0 0 0-1.414-1.414l-5 5a1 1 0 0 0 0 1.414l5 5a1 1 0 0 0 1.414 0M7 3a1 1 0 0 0 1 1h.01a1 1 0 0 0 0-2H8a1 1 0 0 0-1 1" clip-rule="evenodd"/></svg>';
const pn_return = icon;

const translations = {
    CALENDAR_NAVIGATION: {
        en: 'Calendar',
        sv: 'Kalender',
        da: 'Kalender',
        fi: 'Kalenteri',
        no: 'Kalender',
    },
    NEXT_YEAR: {
        en: 'Scroll forward',
        sv: 'Bläddra framåt',
        da: 'Rul frem',
        fi: 'Vieritä eteenpäin',
        no: 'Rull fremover',
    },
    PREVIOUS_YEAR: {
        en: 'Scroll backwards',
        sv: 'Bläddra bakåt',
        da: 'Rul baglæns',
        fi: 'Vieritä taaksepäin',
        no: 'Bla bakover',
    },
    NEXT_DATE: {
        en: 'Next month',
        sv: 'Nästa månad',
        da: 'Næste måned',
        fi: 'Ensi kuussa',
        no: 'Neste måned',
    },
    PREVIOUS_DATE: {
        en: 'Previous month',
        sv: 'Föregående månad',
        da: 'Forrige måned',
        fi: 'Edellinen kuukausi',
        no: 'Forrige måned',
    },
    SELECT_YEAR: {
        en: 'Choose year',
        sv: 'Välj år',
        da: 'Vælg år',
        fi: 'Valitse vuosi',
        no: 'Velg år',
    },
    SELECT_MONTH: {
        en: 'Choose month',
        sv: 'Välj månad',
        da: 'Vælg måned',
        fi: 'Valitse kuukausi',
        no: 'Velg måned',
    },
    SELECT_DATE: {
        en: 'Choose date',
        sv: 'Välj datum',
        da: 'Vælg dato',
        fi: 'Valitse päivämäärä',
        no: 'Velg dato',
    },
    SELECTED_DATE: {
        en: 'selected date is {date}.',
        sv: 'valt datum är {date}.',
        da: 'den valgte dato er {date}.',
        fi: 'valittu päivämäärä on {date}.',
        no: 'valgt dato er {date}.',
    },
    SELECTED_START_DATE: {
        en: 'selected start date is {date}.',
        sv: 'valt startdatum är {date}.',
        da: 'den valgte startdato er {date}.',
        fi: 'valittu aloituspäivä on {date}.',
        no: 'valgt startdato er {date}.',
    },
    SELECTED_END_DATE: {
        en: 'selected end date is {date}.',
        sv: 'valt slutdatum är {date}.',
        da: 'den valgte slutdato er {date}.',
        fi: 'valittu lopetuspäivä on {date}.',
        no: 'valgt sluttdato er {date}.',
    },
    WEEK_NAME: {
        en: 'Week',
        sv: 'Vecka',
        da: 'Uge',
        fi: 'Viikko',
        no: 'Uke',
    },
    GO_CALENDAR: {
        en: 'Calendar view',
        sv: 'Kalendervyn',
        da: 'Kalendervisning',
        fi: 'Kalenterinäkymä',
        no: 'Kalendervisning',
    },
};

function getDefaultExportFromCjs (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

var dayjs_min$1 = {exports: {}};

var dayjs_min = dayjs_min$1.exports;

var hasRequiredDayjs_min;

function requireDayjs_min () {
	if (hasRequiredDayjs_min) return dayjs_min$1.exports;
	hasRequiredDayjs_min = 1;
	(function (module, exports) {
		!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|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,M={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(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O})); 
	} (dayjs_min$1));
	return dayjs_min$1.exports;
}

var dayjs_minExports = requireDayjs_min();
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);

var weekOfYear$2 = {exports: {}};

var weekOfYear$1 = weekOfYear$2.exports;

var hasRequiredWeekOfYear;

function requireWeekOfYear () {
	if (hasRequiredWeekOfYear) return weekOfYear$2.exports;
	hasRequiredWeekOfYear = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t();}(weekOfYear$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,true);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)};}})); 
	} (weekOfYear$2));
	return weekOfYear$2.exports;
}

var weekOfYearExports = requireWeekOfYear();
var weekOfYear = /*@__PURE__*/getDefaultExportFromCjs(weekOfYearExports);

var customParseFormat$2 = {exports: {}};

var customParseFormat$1 = customParseFormat$2.exports;

var hasRequiredCustomParseFormat;

function requireCustomParseFormat () {
	if (hasRequiredCustomParseFormat) return customParseFormat$2.exports;
	hasRequiredCustomParseFormat = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t();}(customParseFormat$1,(function(){var e={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"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return (e=+e)+(e>68?1900:2e3)};var f=function(e){return function(t){this[e]=+t;}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},c={A:[o,function(e){this.afternoon=d(e,false);}],a:[o,function(e){this.afternoon=d(e,true);}],Q:[n,function(e){this.month=3*(e-1)+1;}],S:[n,function(e){this.milliseconds=100*+e;}],SS:[r,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e){var t=u("months"),n=(u("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e){this.year=a(e);}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n){var r,i;r=n,i=s&&s.formats;for(var o=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=o.length,f=0;f<a;f+=1){var h=o[f],u=c[h],d=u&&u[0],l=u&&u[1];o[f]=l?{regex:d,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=o[n];if("string"==typeof i)r+=i.length;else {var s=i.regex,f=i.parser,h=e.slice(r),u=s.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=true,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,o=e.args;this.$u=r;var a=o[1];if("string"==typeof a){var f=true===o[2],h=true===o[3],u=f||h,d=o[2];h&&(d=o[2]),s=this.$locale(),!f&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var i=l(t)(e),o=i.year,s=i.month,a=i.day,f=i.hours,h=i.minutes,u=i.seconds,d=i.milliseconds,c=i.zone,m=i.week,M=new Date,Y=a||(o||s?1:M.getDate()),p=o||M.getFullYear(),v=0;o&&!s||(v=s>0?s-1:M.getMonth());var D,w=f||0,g=h||0,y=u||0,L=d||0;return c?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c.offset*1e3)):n?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m&&(D=r(D).week(m).toDate()),D)}catch(e){return new Date("")}}(t,a,r,n),this.init(),d&&true!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={};}else if(a instanceof Array)for(var c=a.length,m=1;m<=c;m+=1){o[1]=a[m-1];var M=n.apply(this,o);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===c&&(this.$d=new Date(""));}else i.call(this,e);};}})); 
	} (customParseFormat$2));
	return customParseFormat$2.exports;
}

var customParseFormatExports = requireCustomParseFormat();
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);

var isSameOrBefore$2 = {exports: {}};

var isSameOrBefore$1 = isSameOrBefore$2.exports;

var hasRequiredIsSameOrBefore;

function requireIsSameOrBefore () {
	if (hasRequiredIsSameOrBefore) return isSameOrBefore$2.exports;
	hasRequiredIsSameOrBefore = 1;
	(function (module, exports) {
		!function(e,i){module.exports=i();}(isSameOrBefore$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}})); 
	} (isSameOrBefore$2));
	return isSameOrBefore$2.exports;
}

var isSameOrBeforeExports = requireIsSameOrBefore();
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);

var isSameOrAfter$2 = {exports: {}};

var isSameOrAfter$1 = isSameOrAfter$2.exports;

var hasRequiredIsSameOrAfter;

function requireIsSameOrAfter () {
	if (hasRequiredIsSameOrAfter) return isSameOrAfter$2.exports;
	hasRequiredIsSameOrAfter = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t();}(isSameOrAfter$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}})); 
	} (isSameOrAfter$2));
	return isSameOrAfter$2.exports;
}

var isSameOrAfterExports = requireIsSameOrAfter();
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);

var toObject$2 = {exports: {}};

var toObject$1 = toObject$2.exports;

var hasRequiredToObject;

function requireToObject () {
	if (hasRequiredToObject) return toObject$2.exports;
	hasRequiredToObject = 1;
	(function (module, exports) {
		!function(t,e){module.exports=e();}(toObject$1,(function(){return function(t,e){e.prototype.toObject=function(){return {years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}};}})); 
	} (toObject$2));
	return toObject$2.exports;
}

var toObjectExports = requireToObject();
var toObject = /*@__PURE__*/getDefaultExportFromCjs(toObjectExports);

var sv$1 = {exports: {}};

var sv = sv$1.exports;

var hasRequiredSv;

function requireSv () {
	if (hasRequiredSv) return sv$1.exports;
	hasRequiredSv = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t(requireDayjs_min());}(sv,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null,true),d})); 
	} (sv$1));
	return sv$1.exports;
}

requireSv();

var en$1 = {exports: {}};

var en = en$1.exports;

var hasRequiredEn;

function requireEn () {
	if (hasRequiredEn) return en$1.exports;
	hasRequiredEn = 1;
	(function (module, exports) {
		!function(e,n){module.exports=n();}(en,(function(){return {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(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}})); 
	} (en$1));
	return en$1.exports;
}

requireEn();

var da$1 = {exports: {}};

var da = da$1.exports;

var hasRequiredDa;

function requireDa () {
	if (hasRequiredDa) return da$1.exports;
	hasRequiredDa = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t(requireDayjs_min());}(da,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=t(e),a={name:"da",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn._man._tirs._ons._tors._fre._lør.".split("_"),weekdaysMin:"sø._ma._ti._on._to._fr._lø.".split("_"),months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj_juni_juli_aug._sept._okt._nov._dec.".split("_"),weekStart:1,yearStart:4,ordinal:function(e){return e+"."},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"}};return d.default.locale(a,null,true),a})); 
	} (da$1));
	return da$1.exports;
}

requireDa();

var fi$1 = {exports: {}};

var fi = fi$1.exports;

var hasRequiredFi;

function requireFi () {
	if (hasRequiredFi) return fi$1.exports;
	hasRequiredFi = 1;
	(function (module, exports) {
		!function(u,e){module.exports=e(requireDayjs_min());}(fi,(function(u){function e(u){return u&&"object"==typeof u&&"default"in u?u:{default:u}}var t=e(u);function n(u,e,t,n){var i={s:"muutama sekunti",m:"minuutti",mm:"%d minuuttia",h:"tunti",hh:"%d tuntia",d:"päivä",dd:"%d päivää",M:"kuukausi",MM:"%d kuukautta",y:"vuosi",yy:"%d vuotta",numbers:"nolla_yksi_kaksi_kolme_neljä_viisi_kuusi_seitsemän_kahdeksan_yhdeksän".split("_")},a={s:"muutaman sekunnin",m:"minuutin",mm:"%d minuutin",h:"tunnin",hh:"%d tunnin",d:"päivän",dd:"%d päivän",M:"kuukauden",MM:"%d kuukauden",y:"vuoden",yy:"%d vuoden",numbers:"nollan_yhden_kahden_kolmen_neljän_viiden_kuuden_seitsemän_kahdeksan_yhdeksän".split("_")},s=n&&!e?a:i,_=s[t];return u<10?_.replace("%d",s.numbers[u]):_.replace("%d",u)}var i={name:"fi",weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),ordinal:function(u){return u+"."},weekStart:1,yearStart:4,relativeTime:{future:"%s päästä",past:"%s sitten",s:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},formats:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM[ta] YYYY",LLL:"D. MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, D. MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"D. MMM YYYY",lll:"D. MMM YYYY, [klo] HH.mm",llll:"ddd, D. MMM YYYY, [klo] HH.mm"}};return t.default.locale(i,null,true),i})); 
	} (fi$1));
	return fi$1.exports;
}

requireFi();

var nb$1 = {exports: {}};

var nb = nb$1.exports;

var hasRequiredNb;

function requireNb () {
	if (hasRequiredNb) return nb$1.exports;
	hasRequiredNb = 1;
	(function (module, exports) {
		!function(e,t){module.exports=t(requireDayjs_min());}(nb,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),a={name:"nb",weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),ordinal:function(e){return e+"."},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"}};return n.default.locale(a,null,true),a})); 
	} (nb$1));
	return nb$1.exports;
}

requireNb();

dayjs.extend(weekOfYear);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
dayjs.extend(isSameOrAfter);
dayjs.extend(toObject);
const CALENDAR = 'calendar';
const MONTHS = 'months';
const YEARS = 'years';
function getToday() {
    return dayjs();
}
function getDayjsObject({ year, month, date }) {
    return dayjs().set('year', year).set('month', month).set('date', date);
}
/** Validate the date. */
function validateDate(value, format) {
    if (!value)
        return false;
    const val = typeof value === 'string' ? value : getDayjsObject(value);
    return dayjs(val, format, true).isValid();
}
/**
 * Get the Dayjs object with the value & format param.
 **/
function getDate(value, format) {
    const val = typeof value === 'string' ? value : getDayjsObject(value);
    return dayjs(val, format);
}
/** Get a readable i18n format of the date. */
function getReadableDate(date, lang, format) {
    const data = getDateJs(date);
    return data.locale(lang === 'no' ? 'nb' : lang).format(format);
}
function getDateJs({ year, month, date, day }) {
    const dateObject = dayjs().set('y', year).set('M', month).set('D', date);
    if (typeof day === 'number')
        return dateObject.set('d', day);
    return dateObject;
}
function getDateObject(data, format) {
    const dateObj = typeof data === 'string' ? getDate(data, format) : data;
    const year = dateObj.get('year');
    const month = dateObj.get('month');
    const date = dateObj.get('date');
    const day = dateObj.get('day');
    return {
        year,
        month,
        date,
        day,
    };
}
function getDiff(from, to, format) {
    const dateFrom = getDate(from, format);
    const dateTo = getDate(to, format);
    return dateTo.diff(dateFrom, 'd');
}
function isBefore(data, max, format, type) {
    const date = getDate(data, format);
    const dateMax = getDate(max, format);
    return date.isSameOrBefore(dateMax, type);
}
function isAfter(data, min, format, type) {
    const date = getDate(data, format);
    const dateMin = getDate(min, format);
    return date.isSameOrAfter(dateMin, type);
}
function selectedDate(dateOne, dateTwo, format, type) {
    if (!validateDate(dateOne, format) || !validateDate(dateTwo, format))
        return false;
    let date = getDate(dateOne, format);
    let compare = getDate(dateTwo, format);
    if (type === 'month') {
        date = date.set('year', 2000);
        compare = compare.set('year', 2000);
    }
    return date.isSame(compare, type);
}
function modifyDate({ data, amount = 1, unit, minus, plus, }) {
    if (minus)
        return data.subtract(amount, unit);
    if (plus)
        return data.add(amount, unit);
    return data;
}
/** Set another year for the value. */
function setYear({ year, minus = false, plus = false, }) {
    const data = dayjs().set('year', year);
    return modifyDate({ data, unit: 'y', plus, minus }).year();
}
/**
 * You select a month you wish to decrease or increase by 1.
 */
function setMonth({ month, minus = false, plus = false, }) {
    const data = dayjs().set('month', month);
    return modifyDate({ data, unit: 'M', plus, minus }).month();
}
function navigateGrid(code, data, disableWeekends, type) {
    if (type === 'date')
        return navDate(code, data, disableWeekends);
    return navList(code, data, type);
}
function navDate(code, data, disableWeekend) {
    const date = getDayjsObject(data);
    const { space, enter, next, down, previous, upwards, pageDown, pageUp, end, home } = getCode(code);
    if (space || enter)
        return date;
    if (next || down)
        return date.add(next ? 1 : 7, 'day');
    if (previous || upwards)
        return date.subtract(previous ? 1 : 7, 'day');
    if (pageDown)
        return date.add(1, 'month');
    if (pageUp)
        return date.subtract(1, 'month');
    const day = date.get('day');
    const endDay = disableWeekend ? 5 : 7;
    const startDay = day === 0 ? -6 : 1;
    if (end && day !== 0)
        return date.set('day', endDay);
    if (home && day !== 1)
        return date.set('day', startDay);
    return date;
}
function navList(key, data, type) {
    const date = getDayjsObject(data);
    const enter = key.match(/^(Enter|Space)$/);
    if (enter)
        return date;
    // Add one day
    const next = key === 'ArrowRight';
    // Minus one day
    const previous = key === 'ArrowLeft';
    // Add one week
    const down = key === 'ArrowDown';
    // Minus one week
    const upwards = key === 'ArrowUp';
    const setNumber = next || previous ? 1 : 3;
    const { years, months } = date.toObject();
    const dateValue = type === 'year' ? years : months;
    const oppositeType = type === 'year' ? 'month' : 'year';
    if (next || down)
        return date.set(type, dateValue + setNumber).set(oppositeType, data[oppositeType]);
    if (previous || upwards)
        return date.set(type, dateValue - setNumber).set(oppositeType, data[oppositeType]);
    return date;
}
function getGrid(year, month) {
    const allDays = [];
    const grid = [];
    const date = dayjs().set('year', year).set('month', month);
    const numberOfDays = date.daysInMonth();
    for (let i = 0; numberOfDays > i; i++) {
        const day = date.set('date', i);
        const week = day.week();
        allDays.push({
            week,
            day: day.day() + 1,
            date: i + 1,
        });
    }
    const weeks = [...new Set(allDays.map(({ week }) => week))];
    weeks.forEach((week, index) => {
        const list = allDays.filter(day => day.week === week);
        if (index === 0 && list.length !== 7) {
            const numberOfDaysOutsideWeek = 7 - list.length;
            for (let i = 0; numberOfDaysOutsideWeek > i; i++) {
                list.unshift({ week, blank: true });
            }
        }
        if (index + 1 === weeks.length && list.length !== 7) {
            const numberOfDaysOutsideWeek = 7 - list.length;
            for (let i = 0; numberOfDaysOutsideWeek > i; i++) {
                list.push({ week, blank: true });
            }
        }
        grid.push({ week: week, list });
    });
    return grid;
}
function getCode(code) {
    const enter = code === 'Enter';
    const space = code === 'Space';
    // Add/sub one day
    const next = code === 'ArrowRight';
    const previous = code === 'ArrowLeft';
    // Add/sub one week
    const down = code === 'ArrowDown';
    const upwards = code === 'ArrowUp';
    // Add/sub one month
    const pageDown = code === 'PageDown';
    const pageUp = code === 'PageUp';
    // Go the first/last day of the week
    const end = code === 'End';
    const home = code === 'Home';
    return {
        enter,
        space,
        next,
        previous,
        down,
        upwards,
        pageDown,
        pageUp,
        end,
        home,
    };
}

const pnDatePickerCss = () => `${index.transformTag("pn-date-picker")}{position:relative;display:block}${index.transformTag("pn-date-picker")} .pn-date-picker{width:100%;display:flex;flex-wrap:wrap;gap:0.25em;container-type:inline-size}@container (max-width: 24em){${index.transformTag("pn-date-picker")} .pn-date-picker .pn-date-picker-container{flex:1 1 20em}${index.transformTag("pn-date-picker")} .pn-date-picker .pn-date-picker-range-icon{display:none}}${index.transformTag("pn-date-picker")} .pn-date-picker-container{display:block;flex:1 1 11em}${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-label{color:#a70707}${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input{border-color:#a70707}${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:hover{border-color:#500715}${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:focus-visible{background-color:#ffffff;border-color:#a70707;outline-color:#a70707}${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:-webkit-autofill,${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:-webkit-autofill:hover,${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:-webkit-autofill:focus,${index.transformTag("pn-date-picker")} .pn-date-picker-container[data-error]>.pn-date-picker-field .pn-date-picker-input:-webkit-autofill:active{-webkit-box-shadow:0 0 0 10em #fef7f6 inset;-webkit-text-fill-color:#2d2013}${index.transformTag("pn-date-picker")} .pn-date-picker-label{cursor:pointer;display:flex;justify-content:space-between;align-items:flex-end;font-weight:400;color:#2d2013;margin:0 0 0.25em 0;gap:0.5em;-webkit-tap-highlight-color:transparent;transition-property:color, transform;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-date-picker")} .pn-date-picker-label{transition-duration:0s;transition-delay:0s}}${index.transformTag("pn-date-picker")} .pn-date-picker-label[data-compact]{position:absolute;top:1.5625em;left:calc(var(--pn-input-offset-left, 0px) + 0.75em + 0.0625em);margin:0;pointer-events:none;align-items:center;height:1.5em;max-width:calc(100% - (var(--pn-input-offset-left, 0px) + 0.75em) - (var(--pn-input-offset-right, 0px) + 0.75em));transform:translateY(-50%) scale(1) translateZ(0);transform-origin:0 0;transition-delay:0.2s}${index.transformTag("pn-date-picker")} .pn-date-picker-label[data-compact]>span{font-size:1em;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;line-height:1.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-label>span{font-size:0.875em}${index.transformTag("pn-date-picker")} .pn-date-picker-field{position:relative;display:flex}${index.transformTag("pn-date-picker")} .pn-date-picker-input{color:#2d2013;background-color:#ffffff;border:0.0625em solid #969087;border-radius:0.5em;padding:0.75em;font-family:inherit;font-size:1em;font-weight:500;line-height:1.5em;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}${index.transformTag("pn-date-picker")} .pn-date-picker-input:-webkit-autofill,${index.transformTag("pn-date-picker")} .pn-date-picker-input:-webkit-autofill:hover,${index.transformTag("pn-date-picker")} .pn-date-picker-input:-webkit-autofill:focus,${index.transformTag("pn-date-picker")} .pn-date-picker-input:-webkit-autofill:active{-webkit-box-shadow:0 0 0 10em #e0f8ff inset;-webkit-text-fill-color:#2d2013}${index.transformTag("pn-date-picker")} .pn-date-picker-input{outline:0.2rem solid transparent;outline-offset:0.2rem}${index.transformTag("pn-date-picker")} .pn-date-picker-input:focus-visible{outline-color:#005d92;background-color:#ffffff;border-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-input{transition-property:outline-color, background-color, border-color, color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-date-picker")} .pn-date-picker-input{transition-duration:0s;transition-delay:0s}}${index.transformTag("pn-date-picker")} .pn-date-picker-input[data-compact]{text-align:left;padding-top:1.125em;padding-bottom:0.375em;max-width:unset}${index.transformTag("pn-date-picker")} .pn-date-picker-input[data-compact]::placeholder{color:transparent}${index.transformTag("pn-date-picker")} .pn-date-picker-input[data-compact]:focus+.pn-date-picker-label,${index.transformTag("pn-date-picker")} .pn-date-picker-input[data-compact]:not(:placeholder-shown)+.pn-date-picker-label{transform:translateY(-85%) scale(0.75);transition-delay:0s}${index.transformTag("pn-date-picker")} .pn-date-picker-input::placeholder{color:#5e554a;font-weight:normal}${index.transformTag("pn-date-picker")} .pn-date-picker-input:hover{border-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-input:disabled{color:#5e554a;background-color:#f3f2f2;border-color:#f3f2f2}${index.transformTag("pn-date-picker")} .pn-date-picker-input{padding-right:3em;flex:auto;width:100%}${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-calendar-picker-indicator{visibility:hidden;inline-size:0}${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-textfield-decoration-container,${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-search-cancel-button,${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-inner-spin-button,${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-outer-spin-button,${index.transformTag("pn-date-picker")} .pn-date-picker-input::-webkit-search-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}${index.transformTag("pn-date-picker")} .pn-date-picker-input[data-active]{border-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-input:read-only{border-color:#ffffff}${index.transformTag("pn-date-picker")} .pn-date-picker-range-icon{width:1.5em;margin-bottom:0.8125em;align-self:end}${index.transformTag("pn-date-picker")} .pn-date-picker-helpertext,${index.transformTag("pn-date-picker")} .pn-date-picker-error{color:#5e554a;font-size:0.875em;font-weight:400;margin:0.25em 0 0 0;display:flex;flex-direction:column;gap:0.25em;text-align:left}${index.transformTag("pn-date-picker")} .pn-date-picker-helpertext[hidden],${index.transformTag("pn-date-picker")} .pn-date-picker-error[hidden]{display:none}${index.transformTag("pn-date-picker")} .pn-date-picker-error{color:#a70707}${index.transformTag("pn-date-picker")} .pn-date-picker-toggle{position:absolute;top:0.5em;right:0.5em;border-radius:50%}${index.transformTag("pn-date-picker")} .pn-date-picker-button{cursor:pointer;font-size:1em;background-color:transparent;border:0.0625em solid #969087;border-color:transparent;padding:0.25em;margin:0;flex:auto;border-radius:3em}${index.transformTag("pn-date-picker")} .pn-date-picker-button:first-child,${index.transformTag("pn-date-picker")} .pn-date-picker-button:last-child{flex:0 0 auto}${index.transformTag("pn-date-picker")} .pn-date-picker-button{transition-property:outline-color, background-color, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-date-picker")} .pn-date-picker-button{transition-duration:0s;transition-delay:0s}}${index.transformTag("pn-date-picker")} .pn-date-picker-button{outline:0.2rem solid transparent;outline-offset:0.2rem}${index.transformTag("pn-date-picker")} .pn-date-picker-button:focus{background-color:#ffffff;outline-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-button:hover{background-color:#e0f8ff}${index.transformTag("pn-date-picker")} .pn-date-picker-button[data-active],${index.transformTag("pn-date-picker")} .pn-date-picker-button[data-range]{background-color:#e0f8ff;border-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-button:disabled{cursor:not-allowed}${index.transformTag("pn-date-picker")} .pn-date-picker-button:disabled:hover{background-color:transparent}${index.transformTag("pn-date-picker")} .pn-date-picker-month{text-transform:capitalize}${index.transformTag("pn-date-picker")} .pn-date-picker-month[data-full]{display:none}@media (min-width: 25em){${index.transformTag("pn-date-picker")} .pn-date-picker-month[data-full]{display:inline}}${index.transformTag("pn-date-picker")} .pn-date-picker-month[data-abbr]{display:inline}@media (min-width: 25em){${index.transformTag("pn-date-picker")} .pn-date-picker-month[data-abbr]{display:none}}${index.transformTag("pn-date-picker")} .pn-date-picker-sr-only{position:absolute;height:1px;width:1px;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);margin:-1px;white-space:nowrap}${index.transformTag("pn-date-picker")} .pn-date-picker{}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar{position:absolute;z-index:4;top:calc(100% + 0.5em);left:var(--pn-calendar-offset-left);width:clamp(100%, 95vw, 20em);max-width:20em;text-align:center;border-radius:0.5em;background-color:#ffffff;overflow:hidden;visibility:hidden;box-shadow:0 0.25em 0.5em rgba(0, 0, 0, 0.1)}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar[data-range]{max-width:unset}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar[data-open],${index.transformTag("pn-date-picker")} .pn-date-picker-calendar[data-moving]{visibility:visible}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar[data-direction=top]{top:unset;bottom:calc(100% + 0.5em);transform-origin:bottom left}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar ${index.transformTag("pn-button")}[hidden]{display:none}${index.transformTag("pn-date-picker")} .pn-date-picker-calendar ${index.transformTag("pn-button")} span{text-transform:capitalize}${index.transformTag("pn-date-picker")} .pn-date-picker-wrapper{padding:0.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-title{margin:0.5em auto 0;font-size:0.875em;font-weight:500;color:#2d2013}${index.transformTag("pn-date-picker")} .pn-date-picker-nav{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:1em}${index.transformTag("pn-date-picker")} .pn-date-picker-table{width:100%;table-layout:fixed;border-spacing:0;border:0;margin:0 0 0.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-th{font-size:0.75em;font-weight:500;color:#5e554a;padding:0.25em;border:0;text-transform:capitalize}${index.transformTag("pn-date-picker")} .pn-date-picker-td{cursor:pointer;position:relative;padding:0.25em;outline:0;border:0;line-height:0;width:2em;height:2em;-webkit-tap-highlight-color:transparent}${index.transformTag("pn-date-picker")} .pn-date-picker-td-text{position:relative;display:block;line-height:1.5em;border-radius:0.5em;color:#2d2013;padding:0.25em;transition-property:color, background-color, outline-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-date-picker")} .pn-date-picker-td-text{transition-duration:0s;transition-delay:0s}}${index.transformTag("pn-date-picker")} .pn-date-picker-td-text{outline:0.2rem solid transparent;outline-offset:0.2rem}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-blank]{cursor:auto}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-blank] .pn-date-picker-td-text{background-color:transparent}${index.transformTag("pn-date-picker")} .pn-date-picker-td-week{font-size:0.75em;color:#5e554a;display:block}${index.transformTag("pn-date-picker")} .pn-date-picker-td:before{content:"";position:absolute;left:0;top:0.25em;height:calc(100% - 0.5em);width:100%;background-color:transparent;border:0.0625em solid transparent;border-radius:0.5em;transition-property:border-color, background-color, width, transform, left;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}@media (prefers-reduced-motion: reduce){${index.transformTag("pn-date-picker")} .pn-date-picker-td:before{transition-duration:0s;transition-delay:0s}}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-disabled=true]{cursor:not-allowed;pointer-events:none}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-disabled=true]>.pn-date-picker-td-text{color:#5e554a;background-color:#f3f2f2}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-disabled=true]:focus>.pn-date-picker-td-text{outline-color:#a70707}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-disabled=true]:hover>.pn-date-picker-td-text,${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-disabled=true]:focus>.pn-date-picker-td-text{background-color:#f3f2f2}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true] .pn-date-picker-td-text{font-weight:500}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true]:before{border-color:#005d92;background-color:#effbff}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][data-single]:before{width:2em;left:50%;transform:translateX(-50%)}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][data-range]:before{border-radius:0;border-left-width:0;border-right-width:0}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][data-range-from]:before{border-radius:0.5em 0 0 0.5em;border-right-width:0;border-left-width:0.0625em}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][data-range-to]:before{border-radius:0 0.5em 0.5em 0;border-right-width:0.0625em;border-left-width:0}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][aria-disabled=true]:before{border-color:#a70707;background-color:#fdefee}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][aria-disabled=true]>.pn-date-picker-td-text{background-color:unset}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=true][aria-disabled=true]:focus>.pn-date-picker-td-text{background-color:#f3f2f2}${index.transformTag("pn-date-picker")} .pn-date-picker-td[aria-selected=false]:hover>.pn-date-picker-td-text{background-color:#e0f8ff}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-today]>.pn-date-picker-td-text{font-weight:500}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-today]>.pn-date-picker-td-text::after{content:"";position:absolute;bottom:0.25em;left:calc(50% - 0.125em);height:0.25em;width:0.25em;background-color:#005d92;border-radius:50%}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-today]>.pn-date-picker-td-text:after{bottom:0.15em}${index.transformTag("pn-date-picker")} .pn-date-picker-td[data-active][data-today]>.pn-date-picker-td-text:after{background-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker-td:focus-visible>.pn-date-picker-td-text{outline-color:#005d92}${index.transformTag("pn-date-picker")} .pn-date-picker{}${index.transformTag("pn-date-picker")} .pn-date-picker-list{margin:0 0 1em;padding:0;list-style:none;display:grid;grid-template-columns:repeat(3, 1fr);grid-gap:0.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-item>.pn-date-picker-button{display:block;width:100%;border-radius:0.5em;padding:0.5em 0.25em}${index.transformTag("pn-date-picker")} .pn-date-picker-item>.pn-date-picker-button[data-today]{position:relative;font-weight:500}${index.transformTag("pn-date-picker")} .pn-date-picker-item>.pn-date-picker-button[data-today]::after{content:"";position:absolute;bottom:0.25em;left:calc(50% - 0.125em);height:0.25em;width:0.25em;background-color:#005d92;border-radius:50%}${index.transformTag("pn-date-picker")} .pn-date-picker-chips>[slot=chips]{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:0.5em;margin-bottom:0.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-chips>[slot=chips]:empty{display:none}${index.transformTag("pn-date-picker")} .pn-date-picker-bottom{display:flex;justify-content:flex-end;gap:0.5em}${index.transformTag("pn-date-picker")} .pn-date-picker-bottom[hidden]{display:none}`;

const PnDatePicker = class extends index.Mixin(index$1.animateHeightFactory) {
    constructor(hostRef) {
        super();
        index.registerInstance(this, hostRef);
        this.dateselection = index.createEvent(this, "dateselection");
        this.dateSelection = index.createEvent(this, "dateSelection");
        this.dateInvalid = index.createEvent(this, "dateInvalid");
        this.toggleCalendar = index.createEvent(this, "toggleCalendar");
        this.currentView = index.createEvent(this, "currentView");
    }
    id = `pn-date-picker-${index$2.uuidv4()}`;
    idFrom = `${this.id}-from`;
    idTo = `${this.id}-to`;
    idFromButton = `${this.id}-from-button`;
    idToButton = `${this.id}-to-button`;
    idHelper = `${this.id}-helper`;
    idError = `${this.id}-error`;
    idCalendar = `${this.id}-calendar`;
    calendarElement;
    today = getToday();
    separators = [];
    separatorRegex = /[^a-zA-Z\d\s:]/g;
    listMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    listWeek = [1, 2, 3, 4, 5, 6, 0];
    get hostElement() { return index.getElement(this); }
    open = false;
    openUp = false;
    selectingTo = false;
    grid;
    viewYearStart = null;
    dateViewYear;
    dateViewMonth;
    dateViewDate;
    showHelperSlot;
    showErrorSlot;
    /** Set a label for the from date. */
    labelFrom;
    /** Set a label for the to date. @see {@link range} */
    labelTo;
    /** Provide a helpertext for the date input. */
    helpertext;
    /** Set a predefined value for the from date. @see {@link format} */
    start = '';
    /**
     * Set a predefined value for the from date.
     *
     * @see {@link range}
     * @see {@link format}
     */
    end = '';
    /**
     * Set the date format of the value.
     *
     * While you can set any date value from the Dayjs documentation,
     * we strongly recommend you pick a simple format that you can also type manually.
     *
     * @since v7.6.0
     * @see {@link https://day.js.org/docs/en/display/format Day.js format documentation.}
     */
    format = 'YYYY-MM-DD';
    /** Set the date picker label as compact. If used, the `placeholder` will no longer be displayed. @since v7.21.0 */
    compact = false;
    /** Manually set language; this will be inherited from the topbar. */
    language = null;
    /** Set a custom ID for the calendar. @since v7.6.0 @category HTML attributes */
    dateId = this.id;
    /** HTML input name @since v7.6.0 @category HTML attributes */
    name;
    /**
     * Placeholder for the input field (defaults to the format prop).
     * @see {@link format}
     * @category HTML attributes
     **/
    placeholder = this.format;
    /**
     * Placeholder for end date (defaults to the format prop).
     * @see {@link format}
     * @category HTML attributes
     **/
    endPlaceholder = this.format;
    /** Set the input `autocomplete` attribute. @category HTML attributes */
    autocomplete;
    /** Set the input `list` attribute for the first date input. @since v7.6.0 @category HTML attributes */
    list;
    /** Set the input `list` attribute for the second date input. @since v7.6.0 @category HTML attributes */
    listEnd;
    /** Set the HTML pattern prop on the input elements. Make sure it matches the format. @since v7.6.0 @category HTML attributes */
    pattern;
    /** Allow the selection of a date range. @category Features */
    range = false;
    /**
     * Set a limit on how many days one may select.
     * By default, you can select an unlimited range.
     *
     * @todo Create a range limit function.
     * @see {@link range}
     *
     * @category Features
     * @hide true
     **/
    rangeLimit;
    /** The calendar grid is shown as default. You can set either `months` or `years` as your first choice. @since v7.6.0 @category Features */
    view = CALENDAR;
    /** Make the calendar open upwards by default. Opens downwards if there is not enough space. @since v7.6.0 @category Features */
    calendarUp = false;
    /** Show weekend numbers to the left of the calendar grid. @since v7.6.0 @category Features */
    weekNumbers = false;
    /** Disable the automatic insertion of separators when typing in the input. @since v7.6.0 @category Features */
    disableTypeAhead = false;
    /** Remove the option to select dates on weekends. @category Features */
    disableWeekends = false;
    /**
     * Individual dates you want to disable. Use a comma separated string.
     *
     * Remember to use the same format that you have in the `format` prop.
     * @see {@link format}
     * @example "YYYY-MM-DD,YYYY-MM-DD"
     * @category Features
     **/
    disabledDates;
    /** If you use a format with an unknown length, disable the max length. @category Features */
    disableMaxLength = false;
    /** Set the date picker as required. @category State */
    required = false;
    /** Set the date picker as readonly. @since v7.6.0 @category State */
    readonly = false;
    /** Set the date picker as disabled. @since v7.6.0 @category State */
    disabled = false;
    /** Set an error message for the date picker. Overwrites the helpertext if used at the same time. @since v7.6.0 @category Validation */
    error;
    /** Trigger the invalid state without an error message. @since v7.6.0 @category Validation */
    invalid = false;
    /**
     * Earliest date possible, this will determine how many years back the date picker will show.
     *
     * Remember to use the same format that you have in the `format` prop.
     * @see {@link format}
     * @example "2024-05-25"
     * @category Min/max date
     **/
    minDate = null;
    watchMin() {
        if (this.minDate === null)
            return;
        if (!validateDate(this.minDate, this.format))
            this.minDate = null;
    }
    /**
     * Latest date possible, this will determine how many years forward the date picker will show.
     *
     * Remember to use the same format that you have in the `format` prop.
     * @see {@link format}
     * @example "2024-06-25"
     * @category Min/max date
     **/
    maxDate = null;
    watchMax() {
        if (this.maxDate === null)
            return;
        if (!validateDate(this.maxDate, this.format))
            this.maxDate = null;
    }
    watchValue() {
        if (!validateDate(this.start, this.format))
            return this.dateInvalid.emit({ start: this.start });
        const { year, month, date } = getDateObject(this.start, this.format);
        this.setViewYear({ year });
        this.setViewMonth({ month });
        this.setViewDate({ date });
        if (this.range && isAfter(this.start, this.end, this.format, 'date')) {
            this.end = '';
        }
        this.emitSelection();
    }
    watchValueTo() {
        if (!this.range)
            return;
        if (!validateDate(this.end, this.format))
            return this.dateInvalid.emit({ end: this.end });
        const date = getDate(this.end, this.format);
        this.setViewYear({ year: date.year() });
        this.setViewMonth({ month: date.month() });
        this.setViewDate({ date: date.date() });
        if (isAfter(this.start, this.end, this.format, 'date')) {
            const value = this.start;
            this.start = this.end;
            this.end = value;
        }
        this.emitSelection();
    }
    handleFormat() {
        this.separators.length = 0;
        this.format
            .split('')
            .forEach((item, index) => this.separatorRegex.exec(item) && this.separators.push({ name: item, index }));
    }
    watchId() {
        this.idFrom = `${this.dateId}-from`;
        this.idTo = `${this.dateId}-to`;
        this.idFromButton = `${this.id}-from-button`;
        this.idToButton = `${this.id}-to-button`;
        this.idHelper = `${this.dateId}-helper`;
        this.idError = `${this.dateId}-error`;
        this.idCalendar = `${this.dateId}-calendar`;
    }
    watchView() {
        const data = this.getCurrentDateObject();
        if (validateDate(data, this.format))
            this.updateGrid();
    }
    watchOpen() {
        this.toggleCalendar.emit(this.open);
        this.dropdownHandler();
        if (this.open)
            this.addGlobalEventListeners();
        else
            return this.removeGlobalEventListeners();
        this.calendarElement.style.removeProperty('--pn-calendar-offset-left');
        this.openUp = this.calendarUp;
        requestAnimationFrame(() => {
            const rectHost = this.getRect(this.hostElement);
            const { scrollHeight } = this.calendarElement;
            const { innerHeight, innerWidth } = window;
            const offsetTop = index$2.getTotalHeightOffset();
            const spaceUpwards = rectHost.y - offsetTop;
            const spaceDownwards = innerHeight - rectHost.bottom;
            const fitUpwards = spaceUpwards > scrollHeight;
            const fitDownwards = spaceDownwards > scrollHeight;
            const openTop = (this.openUp && (fitUpwards || spaceUpwards > spaceDownwards)) || (!fitDownwards && fitUpwards);
            this.openUp = openTop;
            // Calc horizontal positioning - center calendar relative to host element
            const rectCal = this.getRect(this.calendarElement);
            const menuWidth = index$2.getMenuWidth();
            // Calculate center position: host center minus half of calendar width
            const hostCenterX = rectHost.x + rectHost.width / 2;
            const calendarHalfWidth = rectCal.width / 2;
            const idealCenterOffset = hostCenterX - calendarHalfWidth - rectCal.x;
            // Check boundaries, accounting for menu width on the left
            const calendarLeftEdge = rectCal.x + idealCenterOffset;
            const calendarRightEdge = calendarLeftEdge + rectCal.width;
            const leftBoundary = menuWidth + 16; // Menu width + buffer
            let finalOffset = idealCenterOffset;
            // Adjust if calendar would go beyond left edge of viewport or over the menu
            if (calendarLeftEdge < leftBoundary) {
                finalOffset = leftBoundary - rectCal.x;
            }
            // Adjust if calendar would go beyond right edge of viewport
            else if (calendarRightEdge > innerWidth - 16) {
                finalOffset = innerWidth - 16 - rectCal.width - rectCal.x;
            }
            this.calendarElement.style.setProperty('--pn-calendar-offset-left', `${Math.floor(finalOffset)}px`);
        });
    }
    handleMessage() {
        this.checkSlottedHelper();
        this.checkSlottedError();
    }
    handleView() {
        this.currentView.emit(this.view);
    }
    /**
     * Use the new `dateSelection`. Its here for compatibility. Will be removed in v8.
     * @deprecated Use the new `dateSelection`. Will be removed in v8.
     **/
    dateselection;
    /**
     * Emits on valid date selection. Either if the user selects a date in the calendar or writes it manually.
     * @since v7.6.0
     */
    dateSelection;
    emitSelection() {
        const data = {
            start: this.start,
        };
        if (this.range) {
            const days = getDiff(this.start, this.end, this.format);
            data.end = this.end;
            data.days = typeof days === 'number' ? days + 1 : null;
        }
        this.dateSelection.emit(data);
        this.dateselection.emit(data);
    }
    /** Emitted when an invalid value is set. This can only be done if the user writes in the input itself. @since v7.6.0 */
    dateInvalid;
    /** Emitted when the calendar is toggled. @since v7.6.0 */
    toggleCalendar;
    /** Emmitted when you select a new view. @since v7.6.0 */
    currentView;
    /**
     * If the select is open and you resize the window.
     * Remove all css props and disable the animations entierly.
     **/
    handleResize() {
        if (!this.open)
            return;
        this.toggleGrid(false);
    }
    async componentWillLoad() {
        this.watchMin();
        this.watchMax();
        this.watchId();
        this.handleFormat();
        this.handleMessage();
        const valid = validateDate(this.start || this.end, this.format);
        const data = valid && getDateObject(this.start || this.end, this.format);
        const { year, month, date } = getDateObject(this.today);
        this.setViewDate({ date: data.date || date });
        this.setViewMonth({ month: data.month || month });
        this.setViewYear({ year: data.year || year });
        if (this.language === null)
            await index$2.awaitTopbar(this.hostElement);
    }
    dropdownHandler() {
        if (this.open)
            this.openDropdown(this.calendarElement);
        else
            this.closeDropdown(this.calendarElement);
    }
    globalEvents = (event) => {
        const target = event.target;
        const isWithinCalendar = target?.closest(this.hostElement.localName);
        if (!isWithinCalendar)
            this.toggleGrid(false);
    };
    addGlobalEventListeners() {
        const root = this.hostElement.getRootNode();
        root.addEventListener('click', this.globalEvents);
    }
    removeGlobalEventListeners() {
        const root = this.hostElement.getRootNode();
        root.removeEventListener('click', this.globalEvents);
    }
    translate(prop) {
        return translations?.[prop?.toUpperCase()]?.[this.language || index$2.en] || prop?.toUpperCase();
    }
    translateDateText(customDate, format) {
        return getReadableDate({ ...this.getCurrentDateObject(), ...customDate }, this.language, format);
    }
    getRect(element) {
        return element.getBoundingClientRect();
    }
    toggleGrid(state, selecting) {
        this.open = state ?? !this.open;
        this.selectingTo = selecting;
    }
    hasHelperText() {
        return this.helpertext?.length > 0 || this.showHelperSlot;
    }
    /** If any `error` text is present, either via prop/slot. */
    hasErrorMessage() {
        return this.error?.length > 0 || this.showErrorSlot;
    }
    /** If any `error` is active, either via the prop `invalid` or `error` prop/slot. */
    hasError() {
        return this.hasErrorMessage() || this.invalid || this.showErrorSlot;
    }
    checkSlottedHelper() {
        const slottedHelper = this.hostElement.querySelector('[slot=helpertext]')?.textContent;
        this.showHelperSlot = !!slottedHelper?.length;
    }
    checkSlottedError() {
        const slottedError = this.hostElement.querySelector('[slot=error]')?.textContent;
        this.showErrorSlot = !!slottedError?.length;
    }
    viewingCalendar() {
        return this.view === CALENDAR;
    }
    viewingMonth() {
        return this.view === MONTHS;
    }
    viewingYears() {
        return this.view === YEARS;
    }
    viewType() {
        return this.viewingCalendar() ? 'date' : this.viewingMonth() ? 'month' : 'year';
    }
    isBeforeMax(data) {
        if (this.maxDate)
            return isBefore(data, this.maxDate, this.format, this.viewType());
        return true;
    }
    isAfterMin(data) {
        if (this.minDate)
            return isAfter(data, this.minDate, this.format, this.viewType());
        return true;
    }
    isDisabledWeekend(day) {
        if (!this.viewingCalendar())
            return false;
        return this.disableWeekends ? day >= 6 : false;
    }
    isDisabledDate(data) {
        if (!this.disabledDates?.length || !this.viewingCalendar())
            return false;
        const list = this.disabledDates.split(',');
        return !!list.find(disabledDate => selectedDate(disabledDate, data, this.format, this.viewType()));
    }
    isDisabled(data) {
        const isAfterMaxDate = !this.isBeforeMax(data);
        const isBeforeMinDate = !this.isAfterMin(data);
        const weekendDisable = this.viewingCalendar() && this.isDisabledWeekend(data.day);
        const manualDisable = this.isDisabledDate(data);
        const disabled = isAfterMaxDate || isBeforeMinDate || weekendDisable || manualDisable;
        return {
            disabled,
            manualDisable,
            weekendDisable,
            minMaxDisable: isAfterMaxDate || isBeforeMinDate,
        };
    }
    updateGrid() {
        this.grid = getGrid(this.dateViewYear, this.dateViewMonth);
    }
    getCurrentViewDate(data = this.getCurrentDateObject()) {
        return getReadableDate(data, this.language, 'MMMM YYYY');
    }
    isSelected(data, to = false) {
        const value = to ? this.end : this.start;
        return selectedDate(value, this.getCurrentDateObject(data), this.format, this.viewType());
    }
    isToday(data) {
        return selectedDate(this.today.format(this.format), this.getCurrentDateObject(data), this.format, this.viewType());
    }
    getCurrentDateObject({ year = this.dateViewYear, month = this.dateViewMonth, date = this.dateViewDate, day, } = {}) {
        return {
            year,
            month,
            date,
            day,
        };
    }
    /** Handle keyboard navigation in the calendar grid. */
    calendarKeyboardNavigation(event, data, disabled = false) {
        const validCodes = [
            'Enter',
            'Space',
            'ArrowRight',
            'ArrowLeft',
            'ArrowUp',
            'ArrowDown',
            'Home',
            'End',
            'PageDown',
            'PageUp',
            'Escape',
        ];
        if (!validCodes.includes(event.code))
            return;
        event.preventDefault();
        if (event.code === 'Escape')
            return this.toggleGrid(false);
        const select = !disabled && event.code.match(/^(Enter|Space)$/);
        if (select && this.viewingYears())
            return this.setViewYear({ year: data.year, reset: true });
        if (select && this.viewingMonth())
            return this.setViewMonth({ month: data.month, grid: true, reset: true });
        if (select && this.viewingCalendar())
            return this.setValue(data.date);
        const goToDate = this.navDirection(event, data);
        if (!goToDate)
            return;
        const { year, month, date } = goToDate;
        this.setViewYear({ year });
        this.setViewMonth({ month, grid: true });
        this.setViewDate({ date });
        this.resetFocus();
    }
    navDirection(event, data) {
        const { code } = event;
        const nextDate = navigateGrid(code, data, this.disableWeekends, this.viewType());
        const date = getDateObject(nextDate);
        return date;
    }
    getYearGrid() {
        const list = [];
        let oldestInList = this.viewYearStart - 7;
        for (let i = 0; 15 > i; i++) {
            list.push(oldestInList++);
        }
        return list;
    }
    /** Defaults to the calendar view. */
    setView(view) {
        this.view = view;
        requestAnimationFrame(() => this.focusCalendar());
    }
    setNavView(data) {
        if (this.viewingYears())
            return this.setViewYear({ ...data, grid: true });
        return this.setViewMonth(data);
    }
    setViewYear({ year = this.dateViewYear, minus = false, plus = false, reset = false, grid = false, }) {
        const nextYear = setYear({ year, minus, plus });
        const start = this.viewYearStart;
        const max = start + 7;
        const min = start - 7;
        if (grid) {
            const minusVal = this.viewYearStart - 15;
            const plusVal = this.viewYearStart + 15;
            this.viewYearStart = minus ? minusVal : plusVal;
            this.dateViewYear = this.viewYearStart;
        }
        else
            this.dateViewYear = nextYear;
        if (start === null || nextYear > max || min > nextYear)
            this.viewYearStart = nextYear;
        if (reset)
            this.setView(CALENDAR);
    }
    setViewMonth({ month = this.dateViewMonth, minus = false, plus = false, reset = false, grid = false, }) {
        const nextMonth = setMonth({ month, minus, plus });
        this.dateViewMonth = nextMonth;
        if (!grid && month === 0 && minus)
            this.setViewYear({ minus: true });
        if (!grid && month === 11 && plus)
            this.setViewYear({ plus: true });
        if (reset)
            this.setView(CALENDAR);
    }
    setViewDate({ date }) {
        this.dateViewDate = date;
    }
    handleSeparator(event) {
        let value = event.target.value;
        const foundSeparator = this.separators.find(({ index }) => index === value.length);
        if (foundSeparator?.name) {
            value += foundSeparator.name;
        }
        return value;
    }
    inputHandler(event, to = false) {
        const propName = to ? 'end' : 'start';
        const value = this.disableTypeAhead ? event.target.value : this.handleSeparator(event);
        this[propName] = value;
    }
    setValue(date) {
        const value = getReadableDate(this.getCurrentDateObject({ date }), this.language, this.format);
        if (this.selectingTo)
            this.end = value;
        else
            this.start = value;
        this.setViewDate({ date });
        if (!this.range || this.selectingTo) {
            this.toggleGrid(false);
            this.focusToggleCalendarButton();
        }
        if (this.range && !this.selectingTo)
            this.selectingTo = true;
    }
    getDayAttributes(dateObject, blank) {
        const data = this.getCurrentDateObject(dateObject);
        const { disabled } = this.isDisabled(data);
        if (blank)
            return { 'data-blank': true };
        function capitalize(text) {
            return text.charAt(0).toUpperCase() + text.slice(1);
        }
        const type = this.viewType();
        const value = data[type];
        const disabledProp = type !== 'date' ? 'disabled' : 'aria-disabled';
        const selectedProp = type !== 'date' ? 'aria-pressed' : 'aria-selected';
        const selectedFrom = this.isSelected(data);
        const selectedTo = this.isSelected(data, true);
        const selected = selectedFrom || selectedTo;
        const after = this.range && isAfter(data, this.start, this.format, this.viewType());
        const before = this.range && isBefore(data, this.end, this.format, this.viewType());
        const isBetween = after && before;
        const isDisabled = disabled && (type === 'date' || !selected);
        const tabbable = this[`dateView${capitalize(type)}`] === value;
        const props = {
            'onKeyDown': (e) => this.calendarKeyboardNavigation(e, data, isDisabled),
            'tabindex': tabbable ? '0' : '-1',
            [selectedProp]: (selected || isBetween)?.toString(),
            'aria-current': this.isToday(data) ? 'date' : null,
            'data-active': isDisabled ? null : selected,
            'data-today': this.isToday(data),
            'data-option': 'true',
            [`data-${type}`]: value,
            [disabledProp]: isDisabled ? 'true' : null,
        };
        const singleDate = selectedDate(this.start, this.end, this.format, 'date');
        if (this.range && !singleDate) {
            props['data-range'] = isBetween;
            props['data-range-from'] = selectedFrom && this.end !== '';
            props['data-range-to'] = selectedTo && this.start !== '';
        }
        else {
            props['data-single'] = true;
        }
        if (this.viewingCalendar())
            props.onClick = () => this.setValue(data.date);
        if (this.viewingMonth())
            props.onClick = () => this.setViewMonth({ month: data.month, reset: true });
        if (this.viewingYears())
            props.onClick = () => this.setViewYear({ year: data.year, reset: true });
        if (isDisabled)
            delete props.onClick;
        return props;
    }
    /** Focus the button toggling the calendar. Handles the start/from date on its own. */
    focusToggleCalendarButton() {
        requestAnimationFrame(() => {
            const id = this.range ? this.idToButton : this.idFromButton;
            this.hostElement.querySelector(`#${id}`).focus({ preventScroll: true });
        });
    }
    focusCalendar() {
        requestAnimationFrame(() => {
            const element = this.calendarTabElement({ first: true, grid: true });
            element?.focus({ preventScroll: true });
        });
    }
    resetFocus() {
        if (this.open)
            return this.focusCalendar();
        else
            this.focusToggleCalendarButton();
    }
    handleButtonBlur(event) {
        if (event.code === 'Escape') {
            event.preventDefault();
            event.stopImmediatePropagation();
        }
        if (this.open && event.key === 'Tab')
            return this.focusCalendar();
    }
    /**
     * This function queries all tabbable elements inside the calendar popup.
     * Since we allow slotted content it important that we have a function that takes all elements into account.
     * With the `first` and `grid` argument, you can decide which one you want to get.
     * There are fallbacks so you should never get an empty list of elements.
     */
    calendarTabElement({ first, grid }) {
        const focusableElements = ':is(input, select, button:not([tabindex="-1"]), td[tabindex="0"])';
        const elements = this.calendarElement.querySelectorAll(focusableElements);
        const list = Array.from(elements).filter(({ localName, offsetParent }) => focusableElements.includes(localName) && offsetParent !== null);
        const gridEl = list.find(({ dataset, tabIndex }) => dataset.option && tabIndex === 0);
        if (grid && gridEl)
            return gridEl;
        if (first)
            return list.shift();
        else
            return list.pop();
    }
    /**
     * We need to listen to the `Esc` and `Tab` key for the entire calendar popup.
     * Regardless if you focus the grid, the nav buttons or slotted content,
     * the popup will close if you press `Esc`. We also need to reset the focus when the user tabs.
     */
    handleCalendarTabEsc(event) {
        const target = event.target;
        const tabElement = this.calendarTabElement({ first: event.shiftKey });
        event.stopImmediatePropagation();
        if (event.code === 'Escape') {
            event.preventDefault();
            this.toggleGrid(false);
            this.focusToggleCalendarButton();
            return;
        }
        if (event.code === 'Tab' && target.isEqualNode(tabElement)) {
            event.preventDefault();
            this.calendarTabElement({ first: !event.shiftKey }).focus({ preventScroll: true });
        }
    }
    ariaDescribedby() {
        const list = [];
        if (this.hasErrorMessage())
            list.push(this.idError);
        else if (this.hasHelperText())
            list.push(this.idHelper);
        return list.length ? list.join(' ') : null;
    }
    /** Renders the date calendar grid.  */
    renderDateGrid() {
        return (index.h("table", { role: "grid", class: "pn-date-picker-table", "aria-multiselectable": this.range ? 'true' : null }, index.h("caption", { class: "pn-date-picker-sr-only", key: this.getCurrentViewDate() }, this.getCurrentViewDate()), index.h("thead", { class: "pn-date-picker-thead" }, index.h("tr", { class: "pn-date-picker-tr" }, this.weekNumbers && index.h("th", { class: "pn-date-picker-th", scope: "col", "aria-hidden": "true" }), this.listWeek.map(index$1 => (index.h("th", { class: "pn-date-picker-th", scope: "col", abbr: this.translateDateText({ day: index$1 }, 'dddd') }, this.translateDateText({ day: index$1 }, 'ddd')))))), index.h("tbody", { class: "pn-date-picker-tbody" }, this.grid?.map(({ week, list }) => (index.h("tr", { key: `${this.dateViewYear}-${week}`, class: "pn-date-picker-tr" }, this.weekNumbers && (index.h("td", { class: "pn-date-picker-td", "data-blank": true, "data-week": true, title: `${this.translate('WEEK_NAME')} ${week}`, "aria-hidden": "true" }, index.h("span", { class: "pn-date-picker-td-week" }, week))), list.map(({ day, date, blank }) => (index.h("td", { key: `${this.dateViewYear}-${this.dateViewMonth}-${date}`, class: "pn-date-picker-td", ...this.getDayAttributes({ date, day }, blank) }, index.h("span", { class: "pn-date-picker-td-text" }, date))))))))));
    }
    /** Renders the month calendar grid.  */
    renderMonthGrid() {
        return (index.h("ul", { class: "pn-date-picker-list" }, this.listMonths.map(month => (index.h("li", { key: month, class: "pn-date-picker-item", "data-item": "month" }, index.h("button", { type: "button", class: "pn-date-picker-button", ...this.getDayAttributes({ month }, false) }, index.h("span", { class: "pn-date-picker-month", "data-full": true }, this.translateDateText({ month }, 'MMMM')), index.h("span", { class: "pn-date-picker-month", "data-abbr": true }, this.translateDateText({ month }, 'MMM'))))))));
    }
    /** Renders the year calendar grid.  */
    renderYearGrid() {
        return (index.h("ul", { class: "pn-date-picker-list" }, this.getYearGrid()?.map(year => (index.h("li", { key: year, class: "pn-date-picker-item", "data-item": "year" }, index.h("button", { type: "button", class: "pn-date-picker-button", ...this.getDayAttributes({ year }, false) }, index.h("span", null, year)))))));
    }
    renderLabel(to = false) {
        const id = to ? this.idTo : this.idFrom;
        const label = to ? this.labelTo : this.labelFrom;
        return (index.h("label", { class: "pn-date-picker-label", htmlFor: id, "data-compact": this.compact }, index.h("span", null, label)));
    }
    renderInput({ to = false } = {}) {
        const id = to ? this.idTo : this.idFrom;
        const idButton = to ? this.idToButton : this.idFromButton;
        const value = to ? this.end : this.start;
        const placeholder = to ? this.endPlaceholder : this.placeholder;
        const list = to ? this.listEnd : this.list;
        const editing = this.open ? (this.selectingTo ? to : !to) : false;
        const defaultText = this.translate('SELECT_DATE');
        const textProp = this.range ? (to ? 'END_' : 'START_') : '';
        const dateText = this.translate(`SELECTED_${textProp}DATE`);
        let textButton = defaultText;
        if (value) {
            textButton += `, ${dateText.replace('{date}', value)}`;
        }
        const showButton = !(this.disabled || this.readonly);
        return (index.h("div", { class: "pn-date-picker-container", "data-error": this.hasError() }, !this.compact && this.renderLabel(to), index.h("div", { class: "pn-date-picker-field" }, index.h("input", { type: "text", id: id, class: "pn-date-picker-input", name: this.name, placeholder: this.compact ? ' ' : placeholder, autocomplete: this.autocomplete, maxlength: this.disableMaxLength ? null : this.format.length, list: list, pattern: this.pattern, value: value, disabled: this.disabled, required: this.required, readonly: this.readonly, "aria-describedby": this.ariaDescribedby(), "aria-invalid": this.hasError()?.toString(), "data-active": editing, "data-compact": this.compact, onInput: e => this.inputHandler(e, to) }), this.compact && this.renderLabel(to), showButton && (index.h("pn-button", { class: "pn-date-picker-toggle", buttonId: idButton, icon: calendar, iconOnly: true, appearance: "light", arialabel: textButton, ariaexpanded: this.open.toString(), ariacontrols: this.idCalendar, "data-active": this.open, "data-input": true, small: true, onPnClick: () => this.toggleGrid(null, to), onKeyDown: e => this.handleButtonBlur(e) })))));
    }
    render() {
        return (index.h(index.Host, { key: '0485d508d1df7d71009ab2c22096384928750697' }, index.h("div", { key: '31514c4b9c216ca227ac91c90e82846992df283c', class: "pn-date-picker" }, this.renderInput(), this.range && (index.h("div", { key: '2d924b59e6f7e41364413935b08640db0aa1622e', class: "pn-date-picker-range-icon test" }, index.h("pn-icon", { key: '51ec54178bbf69c66fe17228017aeb8985e551fc', icon: arrow_right.arrow_right }))), this.range && this.renderInput({ to: this.range })), index.h("div", { key: '16d60d86b8d9c01b7732a3c7b773d1157eedbd2b', id: this.idCalendar, class: "pn-date-picker-calendar", role: "dialog", "aria-label": this.translate('CALENDAR_NAVIGATION'), "data-open": this.open, "data-direction": this.openUp ? 'top' : 'bottom', "data-range": this.range, style: { height: '0px' }, ref: el => (this.calendarElement = el), onKeyDown: e => this.handleCalendarTabEsc(e) }, index.h("div", { key: '703d253840d5e9943750469c9495c3151b85f08c', class: "pn-date-picker-wrapper" }, index.h("nav", { key: 'e25723946681d630dffeeddbf814b3a720c9685c', class: "pn-date-picker-nav", "aria-labelledby": this.idCalendar }, index.h("pn-button", { key: '9dec68c96c3ab4f8ca0c29783cd1e693e43281e1', hidden: this.viewingMonth(), small: true, appearance: "light", arialabel: this.translate(`PREVIOUS_${this.viewType().toUpperCase()}`), icon: arrow_left.arrow_left, iconOnly: true, onPnClick: () => this.setNavView({ minus: true }) }), index.h("pn-button", { key: '33dfc7f288f489eb814f27f61869793bf718fb6a', hidden: !this.viewingCalendar(), small: true, appearance: "light", onPnClick: () => this.setView(MONTHS) }, index.h("span", { key: '67b029ff5dae525732dc78d1be4a3c706848078c', class: "pn-date-picker-month", "data-full": true }, this.translateDateText({ date: 1 }, 'MMMM')), index.h("span", { key: '82b2346a120e52d3f55d40eae85d191673c4e906', class: "pn-date-picker-month", "data-abbr": true }, this.translateDateText({ date: 1 }, 'MMM'))), index.h("h2", { key: '64c4b74c742c62370e8fe74b7ffd0c8e10c8c8d7', hidden: this.viewingCalendar(), class: "pn-date-picker-title" }, this.translate(`SELECT_${this.viewType().toUpperCase()}`)), index.h("pn-button", { key: '065dcdbccfaf4f4b3eeae1bba9772a8bce804b66', hidden: !this.viewingCalendar(), small: true, appearance: "light", onPnClick: () => this.setView(YEARS) }, index.h("span", { key: '2c0b032610650aa43701a3f52052defad495569d' }, this.dateViewYear)), index.h("pn-button", { key: 'feb54d3c95595a39aa93eb2c74c7582a82b3031a', hidden: this.viewingMonth(), small: true, appearance: "light", arialabel: this.translate(`NEXT_${this.viewType().toUpperCase()}`), icon: arrow_right.arrow_right, iconOnly: true, onPnClick: () => this.setNavView({ plus: true }) })), this.viewingYears() && this.renderYearGrid(), this.viewingMonth() && this.renderMonthGrid(), this.viewingCalendar() && this.renderDateGrid(), index.h("aside", { key: '1d1aa223f4314d714db6e994a7f87f3f0004f472', class: "pn-date-picker-chips" }, index.h("slot", { key: '1239efd56b8aa01558c9671e3a1c198af8cdec28', name: "chips" })), index.h("nav", { key: '0410b4a1a92b1ccb56dee901be8df49933301142', class: "pn-date-picker-bottom", hidden: this.viewingCalendar() }, index.h("pn-button", { key: 'ec803a3af2c22f05f1416e0f62424b3341256d0f', appearance: "light", variant: "outlined", small: true, icon: pn_return, onPnClick: () => this.setView(CALENDAR) }, index.h("span", { key: '76b1889719347c417b5366bc511f48604aad35e1' }, this.translate('GO_CALENDAR')))))), index.h("p", { key: 'efb966a5373f0a1b0e300999af60a1f8b9194429', id: this.idHelper, class: "pn-date-picker-helpertext", hidden: !this.hasHelperText() || this.hasError() }, index.h("span", { key: 'cf169a86e1a4c9ca46d835a536971306dba5224f' }, this.helpertext), index.h("slot", { key: '858470af2c9febb68a7beffa3014485d91297893', name: "helpertext" })), index.h("p", { key: '219d57d13eebcb6d6621fe8e1a717fedcc39e641', id: this.idError, class: "pn-date-picker-error", role: "alert", hidden: !this.hasErrorMessage() }, index.h("span", { key: '92b84f913d27642f9487f6316040f95478a75373' }, this.error), index.h("slot", { key: '31a3de009f3b54f775f558ae6a9aa17ebb2bbc88', name: "error" }))));
    }
    static get watchers() { return {
        "minDate": [{
                "watchMin": 0
            }],
        "maxDate": [{
                "watchMax": 0
            }],
        "start": [{
                "watchValue": 0
            }],
        "end": [{
                "watchValueTo": 0
            }],
        "format": [{
                "handleFormat": 0
            }],
        "id": [{
                "watchId": 0
            }],
        "dateViewYear": [{
                "watchView": 0
            }],
        "dateViewMonth": [{
                "watchView": 0
            }],
        "dateViewDate": [{
                "watchView": 0
            }],
        "open": [{
                "watchOpen": 0
            }],
        "helpertext": [{
                "handleMessage": 0
            }],
        "error": [{
                "handleMessage": 0
            }],
        "view": [{
                "handleView": 0
            }]
    }; }
};
PnDatePicker.style = pnDatePickerCss();

exports.pn_date_picker = PnDatePicker;
