@pglejzer/datepicker-ui 0.0.1 → 1.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
+ import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,U as v,V as y,W as b,_ as x,b as S,c as C,d as w,f as T,g as ee,h as te,i as ne,j as E,k as re,l as ie,m as D,n as ae,o as oe,p as O,r as se,s as k,t as ce,u as le,v as ue,w as de,x as fe,y as pe,z as A}from"./shared.js";function j(e){queueMicrotask(()=>{throw e})}var me=class{store={};on(e,t,n){let r=this.listenersOf(e),i={handler:t},a=()=>{r.delete(i),n?.removeEventListener(`abort`,a)};return n?.aborted||(r.add(i),n?.addEventListener(`abort`,a,{once:!0})),a}once(e,t){let n=this.on(e,e=>{n(),t(e)});return n}off(e,t){let n=this.store[e];if(n){if(!t)n.clear();else for(let e of n)e.handler===t&&n.delete(e)}}emit(e,t){let n=this.store[e];if(!n)return;let r=[];for(let e of[...n])if(n.has(e))try{e.handler(t)}catch(e){r.push(e)}r.length>0&&j(r[0])}listenerCount(e){return this.store[e]?.size??0}clear(){this.store={}}listenersOf(e){let t=this.store[e];if(t)return t;let n=/* @__PURE__ */ new Set;return this.store[e]=n,n}};function he(e){let t=[...e].sort(f);return t.filter((e,n)=>n===0||f(t[n-1],e)!==0)}function M(e){switch(e){case`single`:return{mode:e,date:null};case`range`:return{mode:e,start:null,end:null};default:return{mode:e,dates:[]}}}function N(e){switch(e.mode){case`single`:return e.date?[e.date]:[];case`range`:return[e.start,e.end].filter(e=>e!==null);default:return e.dates}}function P(e){return N(e).length===0}function ge(e){return e.mode!==`range`||e.start===null==(e.end===null)}function _e(e,t){return e===null||t===null?e===t:f(e,t)===0}function ve(e,t){if(e.mode!==t.mode)return!1;let n=N(e),r=N(t);return n.length===r.length?e.mode===`range`&&t.mode===`range`?_e(e.start,t.start)&&_e(e.end,t.end):n.every((e,t)=>f(e,r[t])===0):!1}function ye(e,t){return N(e).some(e=>A(e,t))}function be(e,t){return e.mode!==`range`||e.start===null||e.end===null||f(e.start,e.end)>=0?null:A(e.start,t)?`start`:A(e.end,t)?`end`:f(t,e.start)>0&&f(t,e.end)<0?`in-range`:null}function F(e){return N(e).at(0)??null}function xe(e,t){let n={};if((e.calendar||t.calendar)&&(n.calendar={...e.calendar,...t.calendar}),e.ui||t.ui){let r={...e.ui,...t.ui};(e.ui?.inline||t.ui?.inline)&&(r.inline={...e.ui?.inline,...t.ui?.inline}),(e.ui?.yearRange||t.ui?.yearRange)&&(r.yearRange={...e.ui?.yearRange,...t.ui?.yearRange}),n.ui=r}return(e.labels||t.labels)&&(n.labels={...e.labels,...t.labels}),(e.behavior||t.behavior)&&(n.behavior={...e.behavior,...t.behavior}),(e.callbacks||t.callbacks)&&(n.callbacks={...e.callbacks,...t.callbacks}),n}const Se=new Set(`AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN IS JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW`.split(` `)),Ce=new Set(`AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.split(` `)),we=/* @__PURE__ */ new Set([`MV`]),Te=/* @__PURE__ */ new Map,Ee=/* @__PURE__ */ new Map;function I(e,t){let n=Ee.get(t);if(n)return n.format(e);let r=new Intl.NumberFormat(t,{useGrouping:!1});return Ee.set(t,r),r.format(e)}function L(e,t){let n=`${e}|${JSON.stringify(t)}`,r=Te.get(n);if(r)return r;let i=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return Te.set(n,i),i}function R(e,t,n){let r=new Date(Date.UTC(2e3,0,1,12));return r.setUTCFullYear(e,t-1,n),r}function De(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;case 6:return 6;default:return null}}function Oe(e){if(!(`getWeekInfo`in e))return null;let t=Reflect.get(e,`getWeekInfo`);if(typeof t!=`function`)return null;let n=Reflect.apply(t,e,[]);if(typeof n!=`object`||!n||!(`firstDay`in n))return null;let r=n.firstDay;return typeof r==`number`?De(r===7?0:r):null}function ke(e){return e===void 0?1:Se.has(e)?0:Ce.has(e)?6:we.has(e)?5:1}function Ae(e){try{let t=new Intl.Locale(e),n=Oe(t);return n===null?ke(t.maximize().region):n}catch{return 1}}function je(e){try{return Intl.getCanonicalLocales(e).length>0}catch{return!1}}const Me=e=>{let t=e?.trim();return!t||!je(t)?null:t};function Ne(e){let t=Me(e);if(t!==null)return t;if(ue()){let e=Me(document.documentElement.lang);if(e!==null)return e}if(typeof navigator<`u`){let e=Me(navigator.language);if(e!==null)return e}return`en-US`}function z(e,t){let n=L(e,{month:t});return Array.from({length:12},(e,t)=>n.format(R(2024,t+1,1)))}function Pe(e,t){let n=L(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(R(2024,1,7+t)))}function Fe(e,t){return L(t,{weekday:`short`,month:`short`,day:`numeric`}).format(R(e.year,e.month,e.day))}function Ie(e,t){return L(t,{month:`short`,day:`numeric`}).format(R(e.year,e.month,e.day))}function Le(e,t,n){return L(n,{month:`short`,day:`numeric`}).formatRange(R(e.year,e.month,e.day),R(t.year,t.month,t.day))}function Re(e,t){return L(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}).format(R(e.year,e.month,e.day))}function B(e,t){return L(t,{month:`long`,year:`numeric`}).format(R(e.year,e.month,1))}function ze(e,t,n){return e.year===t.year&&e.month===t.month?B(e,n):L(n,{month:`long`,year:`numeric`}).formatRange(R(e.year,e.month,1),R(t.year,t.month,1))}function Be(e,t,n,r){switch(t){case`day`:return r===`headline`?Fe(e,n):Re(e,n);case`month`:return B(e,n);default:return I(e.year,n)}}function Ve(e,t){switch(t){case`sunday`:return 0;case`monday`:return 1;case`saturday`:return 6;default:return Ae(e)}}const V={title:`Select date`,monthTitle:`Select month`,yearTitle:`Select year`,noDate:`No date selected`,confirm:`OK`,cancel:`Cancel`,today:`Today`,clear:`Clear`,openCalendar:`Choose date`,previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Previous year`,nextYear:`Next year`,chooseMonth:`Choose month`,chooseYear:`Choose year`,weekNumber:`Week`,invalidDate:`Enter a valid date`,unavailableDate:`This date is not available`,rangeTitle:`Select dates`,rangeStart:`Start`,rangeEnd:`End`,multipleSelected:`{count} selected`,save:`Save`,close:`Close`,switchToInput:`Switch to text input`,switchToCalendar:`Switch to calendar`,dateField:`Date`,startDateField:`Start date`,endDateField:`End date`,invalidRange:`End date must be on or after the start date`,beforeMinDate:`Enter a date on or after {date}`,afterMaxDate:`Enter a date on or before {date}`,presets:`Presets`,pageUpKey:`Page Up`,pageDownKey:`Page Down`,shiftKey:`Shift`,hintDay:`dd`,hintMonth:`mm`,hintYear:`yyyy`},H={calendar:{weekStart:`auto`,mode:`single`,precision:`day`,months:1,pageBy:`view`,presets:[]},ui:{displayMode:`auto`,inline:{enabled:!1},format:`auto`,theme:`basic`,colorScheme:`auto`,weekNumbers:!1,outsideDays:!1,fixedWeeks:!1,yearRange:{before:100,after:20},todayButton:!1,clearButton:!1,animation:!0,allowPageScroll:!1,fullscreen:!0,cssClass:``,swipe:!0,viewSwitch:!0,initialView:`calendar`,mask:!1,startView:`day`},labels:V,behavior:{closeOnSelect:!1,closeOnCancel:!0,commitOnChange:!1,ignoreOutsideClick:!1,returnFocus:!0}};function He(e,t){return e instanceof Date?e:typeof e!=`string`||e===`today`&&!t?null:e}function Ue(e,t,n,r){if(e===void 0)return null;let i=He(e,t),a=i===null?null:b(i);return a===null&&r.push({option:n,value:e}),a}function We(e,t,n){return e===void 0?null:Array.isArray(e)?e.map(e=>Ue(e,!1,t,n)).filter(e=>e!==null):(n.push({option:t,value:e}),null)}function U(e,t,n,r,i){if(e===void 0)return n;let a=t(e);return a===void 0?(i.push({option:r,value:e}),n):a}const W=e=>typeof e==`boolean`?e:void 0,Ge=e=>typeof e==`string`?e:void 0,Ke=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,qe=e=>typeof e==`number`&&Number.isInteger(e)&&e>=1?e:void 0,Je=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},Ye=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},Xe=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.entries(e),n={};for(let[e,r]of t){if(typeof r!=`string`)return;n[e]=r}return t.length>0?n:void 0},Ze=e=>typeof HTMLElement<`u`&&e instanceof HTMLElement||typeof e==`string`&&e.length>0?e:void 0;function G(e){return t=>e.find(e=>e===t)}function Qe(e){return t=>typeof t==`string`&&n(t,e)?t:void 0}const $e=G([`auto`,`docked`,`modal`]),et=G([`auto`,`light`,`dark`]),tt=G([`auto`,`sunday`,`monday`,`saturday`]),nt=G([`single`,`range`,`multiple`]),rt=G([`calendar`,`input`]),it=G([`day`,`month`,`year`]),at=G([`month`,`view`]),ot=G([`day`,`month`,`year`]),st=G([`basic`,`m3-green`,`crane`,`crane-straight`,`m2`,`glassmorphic`,`pastel`,`ai`,`cyberpunk`,`blueprint`]);function ct(e){return e in V}function lt(e,t){let n={...V};for(let r of Object.keys(V))ct(r)&&r!==`multipleSelected`&&(n[r]=U(e?.[r],Ge,V[r],`labels.${r}`,t));return n.multipleSelected=U(e?.multipleSelected,Xe,V.multipleSelected,`labels.multipleSelected`,t),n}function ut(e,t){return e===void 0||e===!0?600:e===!1?0:U(e,qe,600,`ui.fullscreen`,t)}function dt(e,t){return e===void 0||e===!1?!1:e===!0?{selectable:!0}:typeof e==`object`&&e?{selectable:U(Reflect.get(e,`selectable`),W,!0,`ui.outsideDays.selectable`,t)}:(t.push({option:`ui.outsideDays`,value:e}),!1)}function ft(e,t){return e===void 0||e===!1?!1:e===!0?{clearInput:!0}:typeof e==`object`&&e?{clearInput:U(Reflect.get(e,`clearInput`),W,!0,`ui.clearButton.clearInput`,t)}:(t.push({option:`ui.clearButton`,value:e}),!1)}const pt=`calendar.range.presets`;function mt(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`label`),n=Reflect.get(e,`value`);return typeof t!=`string`||t===``?null:typeof n==`function`?{label:t,value:()=>Reflect.apply(n,void 0,[])}:typeof n==`object`&&n?{label:t,value:()=>n}:null}function ht(e,t){if(e===void 0)return H.calendar.presets;if(!Array.isArray(e))return t.push({option:pt,value:e}),H.calendar.presets;let n=e,r=[];for(let e of n){let n=mt(e);n===null?t.push({option:pt,value:e}):r.push(n)}return r}function gt(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6}function _t(e,t){let n=e?.trim();n&&!je(n)&&t.push({option:`calendar.locale`,value:e})}function vt(e,t){if(e===void 0)return[];if(!Array.isArray(e))return t.push({option:`calendar.disabledWeekdays`,value:e}),[];let n=e,r=[];for(let e of n)gt(e)?r.includes(e)||r.push(e):t.push({option:`calendar.disabledWeekdays`,value:e});return r}function yt(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`className`),n=Reflect.get(e,`badge`),r=Reflect.get(e,`label`);return{...typeof t==`string`?{className:t}:{},...typeof n==`boolean`?{badge:n}:{},...typeof r==`string`?{label:r}:{}}}function bt(e){return typeof e==`string`||typeof Node<`u`&&e instanceof Node?e:null}function xt(e){return e===null?null:t=>{try{return bt(e(t))}catch(e){return j(e),null}}}function St(e){return e===null?null:t=>{try{let n=e(t);return typeof n!=`string`||n.length===0?null:n}catch(e){return j(e),null}}}function Ct(e,t,n){let r=H.calendar,i=U(e,it,r.precision,`calendar.precision`,n);return i!==`day`&&t!==`single`?(n.push({option:`calendar.precision`,value:e}),r.precision):i}function wt(e,t){let n=U(e?.range?.minLength,qe,null,`calendar.range.minLength`,t),r=U(e?.range?.maxLength,qe,null,`calendar.range.maxLength`,t),i=U(e?.multiple?.max,qe,null,`calendar.multiple.max`,t);return n!==null&&r!==null&&n>r?(t.push({option:`calendar.range`,value:e?.range}),{minLength:n,maxLength:null,multipleMax:i}):{minLength:n,maxLength:r,multipleMax:i}}function Tt(e,t){let n=H.calendar;_t(e?.locale,t);let r=Ne(e?.locale),i=U(e?.weekStart,tt,n.weekStart,`calendar.weekStart`,t),a=U(e?.isDateDisabled,Je,null,`calendar.isDateDisabled`,t),o=U(e?.decorateDate,Je,null,`calendar.decorateDate`,t),s=U(e?.renderDate,Je,null,`calendar.renderDate`,t),c=U(e?.validate,Ye,null,`calendar.validate`,t),l=U(e?.mode,nt,n.mode,`calendar.mode`,t);return{locale:r,weekStart:Ve(r,i),minDate:Ue(e?.minDate,!0,`calendar.minDate`,t),maxDate:Ue(e?.maxDate,!0,`calendar.maxDate`,t),disabledDates:We(e?.disabledDates,`calendar.disabledDates`,t)??[],enabledDates:We(e?.enabledDates,`calendar.enabledDates`,t),mode:l,precision:Ct(e?.precision,l,t),months:U(e?.months,qe,n.months,`calendar.months`,t),pageBy:U(e?.pageBy,at,n.pageBy,`calendar.pageBy`,t),limits:wt(e,t),presets:ht(e?.range?.presets,t),isDateDisabled:a===null?null:e=>!!a(e),disabledWeekdays:vt(e?.disabledWeekdays,t),decorateDate:o===null?null:e=>yt(o(e)),renderDate:xt(s),validate:St(c)}}function Et(e){let t=[],n=H,r=e?.calendar,i=e?.ui,a=e?.behavior,o=(e,n,r,i)=>U(e,n,r,i,t),s=Tt(r,t),{locale:c,precision:l}=s,u=o(i?.format,Qe(l),n.ui.format,`ui.format`),d=o(i?.footer,W,!1,`ui.footer`),f=a?.id;return{...s,displayMode:o(i?.displayMode,$e,n.ui.displayMode,`ui.displayMode`),inline:{enabled:o(i?.inline?.enabled,W,n.ui.inline.enabled,`ui.inline.enabled`),container:o(i?.inline?.container,Ze,null,`ui.inline.container`)},pattern:de(u,c,l),theme:o(i?.theme,st,n.ui.theme,`ui.theme`),colorScheme:o(i?.colorScheme,et,n.ui.colorScheme,`ui.colorScheme`),toggleButton:o(i?.toggleButton,Ze,null,`ui.toggleButton`),endInput:o(i?.endInput,Ze,null,`ui.endInput`),weekNumbers:o(i?.weekNumbers,W,n.ui.weekNumbers,`ui.weekNumbers`),outsideDays:dt(i?.outsideDays,t),fixedWeeks:o(i?.fixedWeeks,W,n.ui.fixedWeeks,`ui.fixedWeeks`),yearRange:{before:o(i?.yearRange?.before,Ke,n.ui.yearRange.before,`ui.yearRange.before`),after:o(i?.yearRange?.after,Ke,n.ui.yearRange.after,`ui.yearRange.after`)},todayButton:o(i?.todayButton,W,n.ui.todayButton,`ui.todayButton`),clearButton:ft(i?.clearButton,t),footerExplicit:typeof i?.footer==`boolean`?d:null,animation:o(i?.animation,W,n.ui.animation,`ui.animation`),allowPageScroll:o(i?.allowPageScroll,W,n.ui.allowPageScroll,`ui.allowPageScroll`),fullscreenBelow:ut(i?.fullscreen,t),cssClass:o(i?.cssClass,Ge,n.ui.cssClass,`ui.cssClass`),appendTo:o(i?.appendTo,Ze,null,`ui.appendTo`),swipe:o(i?.swipe,W,n.ui.swipe,`ui.swipe`),viewSwitch:o(i?.viewSwitch,W,n.ui.viewSwitch,`ui.viewSwitch`),initialView:o(i?.initialView,rt,n.ui.initialView,`ui.initialView`),mask:o(i?.mask,W,n.ui.mask,`ui.mask`),startView:o(i?.startView,ot,n.ui.startView,`ui.startView`),labels:lt(e?.labels,t),behavior:{closeOnSelect:o(a?.closeOnSelect,W,n.behavior.closeOnSelect,`behavior.closeOnSelect`),closeOnCancel:o(a?.closeOnCancel,W,n.behavior.closeOnCancel,`behavior.closeOnCancel`),commitOnChange:o(a?.commitOnChange,W,n.behavior.commitOnChange,`behavior.commitOnChange`),ignoreOutsideClick:o(a?.ignoreOutsideClick,W,n.behavior.ignoreOutsideClick,`behavior.ignoreOutsideClick`),returnFocus:o(a?.returnFocus,W,n.behavior.returnFocus,`behavior.returnFocus`),id:typeof f==`string`&&f.length>0?f:null},callbacks:{...e?.callbacks},issues:t}}const Dt=/[^\w-]/g;let Ot=0;function kt(e){return e.replace(Dt,`-`)}function At(e){return{year:e.year,month:e.month}}var jt=class{input;host;createdHost;instanceId;events=new me;raw;resolved;currentValue;currentDraft;currentView;currentFocus;currentPanel;currentMode=null;currentLayout={months:1,presets:`none`};currentActiveEnd=`start`;currentEndInput=null;activeEndControlled=!1;constructor(e,t,n,r){this.input=e,this.host=t,this.createdHost=n,this.raw=xe({},r??{}),this.resolved=Et(this.raw),Ot+=1;let i=this.resolved.behavior.id;this.instanceId=i===null?`${l}${String(Ot)}`:kt(i),this.currentPanel=_(this.resolved.precision),this.currentValue=M(this.resolved.mode),this.currentDraft=this.currentValue;let a=o();this.currentFocus=a,this.currentView=At(a)}get options(){return this.resolved}get rawOptions(){return this.raw}setOptions(e){this.raw=xe(this.raw,e),this.resolved=Et(this.raw),this.events.emit(`change:options`,{})}get value(){return this.currentValue}setValue(e){this.currentValue=e,this.events.emit(`change:value`,{value:e})}get draft(){return this.currentDraft}setDraft(e){this.currentDraft=e,this.events.emit(`change:draft`,{draft:e})}get view(){return this.currentView}setView(e,t,n){let r=At(e);this.currentView=r,this.events.emit(`change:view`,{view:r,delta:t,source:n})}get focus(){return this.currentFocus}setFocus(e){this.currentFocus=e,this.events.emit(`change:focus`,{focus:e})}get panel(){return this.currentPanel}setPanel(e){e!==this.currentPanel&&(this.currentPanel=e,this.events.emit(`change:panel`,{panel:e}))}get mode(){return this.currentMode}setMode(e){this.currentMode=e}get layout(){return this.currentLayout}setLayout(e){this.currentLayout=e}get activeEnd(){return this.currentActiveEnd}setActiveEnd(e){e!==this.currentActiveEnd&&(this.currentActiveEnd=e,this.events.emit(`change:active-end`,{end:e}))}controlActiveEnd(){this.activeEndControlled=!0}get followsActiveEnd(){return this.currentEndInput!==null||this.activeEndControlled}get endInput(){return this.currentEndInput}setEndInput(e){this.currentEndInput=e}resetSession(){let e=F(this.currentValue)??o(),t=At(e);this.setPanel(_(this.resolved.precision)),this.setDraft(this.currentValue),this.setView(t,y(this.currentView,t),`api`),this.setFocus(e)}};const Mt=`dp-ui`,Nt=[`class`,`name`,`aria-invalid`,`aria-describedby`];function Pt(e){return typeof e==`string`?document.querySelector(e):e}function Ft(e){return e instanceof HTMLInputElement?e:e?.querySelector(`input`)??null}function It(e){let t=document.createElement(`div`);return t.className=Mt,e.before(t),t.append(e),t}function Lt(e){if(!ue())throw Error(`DatepickerUI needs a document`);let t=Pt(e),n=Ft(t);if(n===null)throw Error(`DatepickerUI could not find an input element`);let r=n.parentElement;return r!==null&&(t!==n||r.classList.contains(Mt))?{input:n,host:r,createdHost:!1}:{input:n,host:It(n),createdHost:!0}}function Rt(e){let{input:t,host:n,createdHost:r}=e,i=/* @__PURE__ */ new Map;for(let e of Nt)i.set(e,t.getAttribute(e));let a=n.classList.contains(Mt);return n.classList.add(Mt),{target:{input:t,host:n,createdHost:r},hostHadClass:a,inputAttributes:i}}function zt(e){let{input:t,host:n,createdHost:r}=e.target;for(let[n,r]of e.inputAttributes)r===null?t.removeAttribute(n):t.setAttribute(n,r);r?t.parentNode===n?n.replaceWith(t):n.remove():e.hostHadClass||n.classList.remove(Mt)}function Bt(e,t,n,r){let i=y(e,t);return i>=0&&i<n?e:r===`month`?i<0?t:d(t,-(n-1)):d(e,Math.floor(i/n)*n)}function Vt(e,t,n){let r={year:t.year,month:t.month,day:Math.min(n,u(t))},{minDate:i,maxDate:a}=e.core.options;return i!==null&&f(r,i)<0?i:a!==null&&f(r,a)>0?a:r}function Ht(e,t,n){let{core:r,managers:i}=e,a=i.validation.clampView(t),o=y(r.view,a);return o!==0&&(r.setView(a,o,n),r.setFocus(Vt(e,a,r.focus.day))),a}function K(e,t,n){let{core:r,managers:i}=e,a={year:t.year,month:t.month},{months:o}=r.layout,s=i.validation.clampView(Bt(r.view,a,o,r.options.pageBy)),c=y(s,a);if(c<0||c>=o)return;let l=y(r.view,s);l!==0&&r.setView(s,l,n),r.setFocus(t)}const Ut=/^(\d{4})-(\d{2})$/,Wt=/^\d{4}$/;function Gt(e,t){switch(t){case`day`:return e;case`month`:return{year:e.year,month:e.month,day:1};default:return{year:e.year,month:1,day:1}}}function Kt(e,t){let n=v(e);switch(t){case`day`:return n;case`month`:return n.slice(0,7);default:return n.slice(0,4)}}function qt(e,t){let n=h(e);if(n!==null||t===`day`)return n===null?null:Gt(n,t);if(t===`month`){let t=Ut.exec(e);return t?m(Number(t[1]),Number(t[2]),1):null}return Wt.test(e)?m(Number(e),1,1):null}function Jt(e,t){return{...e,order:e.order.filter(e=>e===`year`||t===`month`&&e===`month`)}}function q(e,t,n){return n===`day`?S(e,t):S(e,Jt(t,n))}function Yt(e,t,n){return fe(t===`day`?e:Jt(e,t),n)}function Xt(e,t,n){if(n===`day`)return x(e,t);let{order:r}=Jt(t,n),i=te(e);if(i?.length!==r.length)return null;let a=1,o=null;for(let[e,t]of r.entries()){let n=i[e]??``;if(t===`year`)o=ee(n);else if(n.length>2)return null;else a=Number(n)}return o===null?null:m(o,a,1)}function Zt(e,t,n){let r=c(e,t)+1;return n.minLength!==null&&r<n.minLength?!1:n.maxLength===null||r<=n.maxLength}function Qt(e,t,n,r){let i=r;if(t.maxLength!==null){let n=E(e,t.maxLength-1);i=f(n,r)<0?n:r}for(let t=E(e,1);f(t,i)<=0;t=E(t,1))if(n(t))return t;return null}function $t(e,t,n,r){if(e.mode===`multiple`){let{multipleMax:n}=t,{dates:r}=e;return t=>n!==null&&r.length>=n&&!ye(e,t)}if(e.mode!==`range`||e.start===null||e.end!==null)return()=>!1;let{start:i}=e,a=null,o=!1;return e=>f(e,i)<0?!1:f(e,r)>0||!Zt(i,e,t)||(o||=(a=Qt(i,t,n,r),!0),a!==null&&f(e,a)>=0)}function en(e,t,n,r){if(!Zt(e,t,n))return`range-length`;for(let n=e;f(n,t)<=0;n=E(n,1)){let e=r(n);if(e!==null)return e}return null}function tn(e,t){for(let n of e){let e=t(n);if(e!==null)return e}return null}function nn(e,t,n){switch(e.mode){case`single`:return e.date===null?null:n(e.date);case`range`:return e.start!==null&&e.end!==null?en(e.start,e.end,t,n):e.start===null?null:n(e.start);default:return t.multipleMax!==null&&e.dates.length>t.multipleMax?`multiple-max`:tn(e.dates,n)}}function rn(e,t,n){return nn(e,t,e=>n(e)?`disabled`:null)===null}function an(e,t,n){return e.some(e=>f(e,t)===0)?e.filter(e=>f(e,t)!==0):n.multipleMax!==null&&e.length>=n.multipleMax?null:he([...e,t])}function on(e){return e.mode===`range`&&e.start!==null&&e.end===null?`end`:`start`}function sn(e,t){return e.mode===`range`?t===`start`?{mode:`range`,start:null,end:null}:{mode:`range`,start:e.start,end:null}:e}function cn(e,t,n,r){switch(e.mode){case`single`:return{mode:`single`,date:t};case`range`:return r===`start`||e.start===null||f(t,e.start)<0?{mode:`range`,start:t,end:null}:{mode:`range`,start:e.start,end:t};default:{let r=an(e.dates,t,n);return r===null?e:{mode:`multiple`,dates:r}}}}var ln=class{context;session;values;constructor(e,t,n){this.context=e,this.session=t,this.values=n}isOpen(){return this.session.active}select(e){let{core:t,managers:n}=this.context,r=Gt(e,t.options.precision),i=t.followsActiveEnd?t.activeEnd:on(t.draft);if(!this.session.active||!n.validation.isSelectable(r,sn(t.draft,i)))return;K(this.context,r,`button`);let a=cn(t.draft,r,t.options.limits,i);t.setDraft(a),t.setActiveEnd(on(a)),this.announce(a,r),this.isOpen()&&this.autoCommit(a)}selectRange(e,t){let{core:n,managers:r}=this.context,{mode:i,limits:a}=n.options;if(!this.session.active||i!==`range`)return;let o={mode:`range`,start:e,end:t};nn(o,a,e=>r.validation.unavailableReason(e))===null&&(n.setDraft(o),n.setActiveEnd(`start`),K(this.context,e,`api`),this.emitRangeEnd(e,t),this.isOpen()&&this.autoCommit(o))}typeDraft(e){let{core:t,managers:n}=this.context,{mode:r,limits:i}=t.options,a=e.mode===r&&rn(e,i,e=>n.validation.isDisabled(e));if(!this.session.active||!a)return;t.setDraft(e);let o=F(e);o!==null&&K(this.context,o,`api`)}announce(e,t){let{emitter:n}=this.context,{describe:r}=this.values;n.emit(`select:day`,{value:r(t),selected:ye(e,t)}),e.mode===`range`&&(e.start===null||e.end===null?n.emit(`range:start`,{value:r(t)}):this.emitRangeEnd(e.start,e.end))}emitRangeEnd(e,t){let{describe:n}=this.values;this.context.emitter.emit(`range:end`,{start:n(e),end:n(t)})}autoCommit(e){if(e.mode===`range`&&e.end===null)return;let{closeOnSelect:t,commitOnChange:n}=this.context.core.options.behavior,r=t&&e.mode!==`multiple`;(r||n)&&this.values.commit(!0),r&&this.session.close()}},un=class{context;session;values;selector;constructor(e,t,n){this.context=e,this.session=t,this.values=n,this.selector=new ln(e,t,n)}isOpen(){return this.session.active}select(e){this.selector.select(e)}selectRange(e,t){this.selector.selectRange(e,t)}typeDraft(e){this.selector.typeDraft(e)}focusDate(e){this.session.active&&K(this.context,e,`keyboard`)}navigate(e,t){this.session.active&&Ht(this.context,d(this.context.core.view,e),t)}page(e,t){let{core:n}=this.context,r=n.options.pageBy===`view`?n.layout.months:1;this.navigate(e*r,t)}jumpTo(e,t){if(!this.session.active)return;let{core:n}=this.context,r=n.panel,i=Ht(this.context,e,t);t===`menu`&&(n.setPanel(_(n.options.precision)),this.announcePick(r,i))}showPanel(e){this.session.active&&this.context.core.setPanel(e)}confirm(){this.session.active&&ge(this.context.core.draft)&&(this.values.commit(!1),this.session.close())}cancel(e){if(!this.session.active)return;let{core:t,emitter:n}=this.context;n.emit(`cancel`,{reason:e}),this.isOpen()&&((t.options.behavior.closeOnCancel||e!==`button`)&&t.mode!==`inline`?this.session.close():t.setDraft(t.value))}today(){if(!this.session.active)return;let{core:e,managers:t}=this.context,n=o();t.validation.isSelectable(n,e.draft)?this.select(n):K(this.context,n,`button`)}clear(){if(!this.session.active)return;let{core:e}=this.context;e.setDraft(M(e.options.mode));let{clearButton:t}=e.options;t!==!1&&t.clearInput&&(this.values.commit(!1),this.session.close())}announcePick(e,t){let{emitter:n}=this.context;e===`month-menu`||e===`month-grid`?n.emit(`select:month`,{year:t.year,month:t.month}):(e===`year-menu`||e===`year-grid`)&&n.emit(`select:year`,{year:t.year})}},dn=class{context;subscriptions=[];constructor(e){this.context=e}bind(){for(let e of this.subscriptions)e();this.subscriptions=[];let{callbacks:e}=this.context.core.options;this.add(`open`,e.onOpen),this.add(`close`,e.onClose),this.add(`cancel`,e.onCancel),this.add(`confirm`,e.onConfirm),this.add(`update`,e.onUpdate),this.add(`error`,e.onError),this.add(`select:day`,e.onSelectDay),this.add(`select:month`,e.onSelectMonth),this.add(`select:year`,e.onSelectYear),this.add(`range:start`,e.onRangeStart),this.add(`range:end`,e.onRangeEnd),this.add(`navigate`,e.onNavigate)}add(e,t){t!==void 0&&this.subscriptions.push(this.context.emitter.on(e,t))}};const fn=[`class`,`name`,`aria-invalid`];function pn(e){let{core:t,emitter:n}=e,{endInput:r,mode:i}=t.options;if(i!==`range`||r===null)return null;let a=O(r,t.host);return a instanceof HTMLInputElement&&a!==t.input?a:(n.emit(`error`,{code:`invalid-option`,message:`ui.endInput does not match an input element`,option:`ui.endInput`}),null)}function mn(e){let t=/* @__PURE__ */ new Map;for(let n of fn)t.set(n,e.getAttribute(n));return()=>{for(let[n,r]of t)r===null?e.removeAttribute(n):e.setAttribute(n,r)}}const hn=[`calendar`,`ui`,`labels`,`behavior`,`callbacks`];function gn(e){let t=[];for(let n of hn){let r=e[n];if(r!==void 0)for(let e of Object.keys(r))t.push(`${n}.${e}`)}return t}function _n(e,t){return e.some(e=>t.option===e||t.option.startsWith(`${e}.`))}function vn(e,t){for(let n of t)e.emitter.emit(`error`,{code:`invalid-option`,message:`Invalid value for option ${n.option}`,option:n.option})}var yn=class{context;session;callbacks;triggers;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r}apply(e){let{core:t,emitter:n,status:r}=this.context;if(r.destroyed)return;let i=t.options;t.setOptions(e),t.options.mode!==i.mode&&this.resetSelection(),r.created&&this.reapply(i,e),n.emit(`update`,{options:e})}resetSelection(){let{core:e,managers:t,status:n}=this.context,r=M(e.options.mode);e.setValue(r),e.setDraft(r),n.created&&(t.input.write(r),t.form.sync())}reapply(e,t){let{core:n,managers:r}=this.context;this.callbacks.bind(),r.theme.applyHost(),this.triggers.bind(),P(n.value)||r.input.write(n.value),r.triggers.updateLabel(),this.refreshSurface(e);let i=gn(t);vn(this.context,n.options.issues.filter(e=>_n(i,e)))}refreshSurface(e){let{core:t,managers:n}=this.context,r=t.options;if(r.inline.enabled!==e.inline.enabled||r.inline.enabled&&r.inline.container!==e.inline.container){this.session.end(),r.inline.enabled&&this.session.mountInline();return}let i=t.mode;if(!this.session.active||i===null)return;let a=i===`inline`||r.displayMode===e.displayMode?i:this.session.pickMode();this.session.syncLayout(a),this.session.clampView(),a===i&&r.mode===e.mode?n.display.update():this.session.remount(a)}},bn=class{context;session;callbacks;triggers;controller=new AbortController;hostSnapshot;restoreEndInput=null;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r,this.hostSnapshot=Rt(e.core)}create(){let{core:e,managers:t,status:n}=this.context;if(n.created||n.destroyed)return;n.created=!0;let r=this.controller.signal;this.callbacks.bind(),t.theme.applyHost();let i=pn(this.context);e.setEndInput(i),i!==null&&(this.restoreEndInput=mn(i));let a=P(e.value)?t.input.readInitial():e.value;e.setValue(a),P(a)||t.input.write(a),t.form.bind(r),t.form.sync(),t.input.bind(r),this.triggers.bind(),t.triggers.updateLabel(),e.events.on(`change:value`,()=>{t.triggers.updateLabel()},r),e.options.inline.enabled&&this.session.mountInline(),vn(this.context,e.options.issues)}destroy(e){let{core:t,emitter:n,managers:r,status:i}=this.context;i.destroyed||(i.destroyed=!0,this.session.teardown(),this.triggers.release(),this.controller.abort(),r.destroy(),e||(t.input.value=``,t.endInput!==null&&(t.endInput.value=``)),this.restoreEndInput?.(),this.restoreEndInput=null,t.setEndInput(null),zt(this.hostSnapshot),t.events.clear(),n.clear())}},xn=class{tail=Promise.resolve();pending=0;stopped=!1;run(e){let t=async()=>{this.stopped||await e()},n=this.pending===0?t():this.tail.then(t);this.pending+=1;let r=n.catch(j).finally(()=>{--this.pending});return this.tail=r,r}stop(){this.stopped=!0}};function Sn(e){return e<0?-1:+(e>0)}var Cn=class{context;queue=new xn;controller=null;phase=`closed`;sessionId=0;closing=Promise.resolve();openedFrom=`start`;constructor(e){this.context=e}get active(){return this.phase===`open`}open(e,t=`start`){let{core:n,emitter:r,managers:i,status:a}=this.context;if(!a.created||a.destroyed||n.options.inline.enabled)return;if(this.phase===`open`){n.setActiveEnd(t);return}if(e!==`api`&&n.input.disabled)return;let o=this.pickMode();this.openedFrom=t,n.setActiveEnd(t),this.begin(o),i.triggers.setExpanded(!0),r.emit(`open`,{mode:o})}mountInline(){let{core:e,emitter:t}=this.context;O(e.options.inline.container)===null?t.emit(`error`,{code:`invalid-option`,message:`ui.inline.container does not match an element`,option:`ui.inline.container`}):(this.begin(`inline`),t.emit(`open`,{mode:`inline`}))}close(){return this.context.core.mode===`inline`?Promise.resolve():this.end()}end(){if(this.phase===`closing`)return this.closing;if(this.phase!==`open`)return Promise.resolve();let{core:e,emitter:t,managers:n}=this.context,r=e.mode,i=this.sessionId;this.phase=`closing`,this.stopListening(),n.triggers.setExpanded(!1);let a=this.queue.run(()=>n.display.unmount()).then(()=>{this.finish(i,r)});return this.closing=a,t.emit(`close`,{}),a}syncLayout(e){let{core:t}=this.context,n=t.options,r=window.innerWidth;if(e===`inline`){let e=O(n.inline.container)?.clientWidth??0;r=e>0?e:r}t.setLayout(p({months:n.months,precision:n.precision,mode:n.mode,surface:e,fullscreen:i(n.mode,e,window.innerWidth,n.fullscreenBelow),width:r,weekNumbers:n.weekNumbers,presets:n.presets.length}))}remount(t){let{core:n,managers:r}=this.context;this.syncLayout(t),n.setMode(t);let{mode:i,precision:a}=n.options;n.panel===`input`&&!e(i,t,a)&&n.setPanel(_(a)),this.queue.run(()=>r.display.unmount()),this.queue.run(()=>r.display.mount(t))}pickMode(){let{displayMode:e}=this.context.core.options;return r(e,!1,window.innerWidth,window.innerHeight)}clampView(){Ht(this.context,this.context.core.view,`api`)}teardown(){this.phase=`closed`,this.stopListening(),this.queue.stop()}begin(t){let{core:n,managers:r}=this.context;this.stopListening();let i=new AbortController;this.controller=i,this.sessionId+=1,this.phase=`open`,n.resetSession();let{initialView:a,mode:o,precision:s,startView:c}=n.options;a===`input`&&e(o,t,s)?n.setPanel(`input`):s===`day`&&o!==`range`&&c!==`day`&&n.setPanel(re(c,t)),this.syncLayout(t),this.clampView(),n.setMode(t),n.events.on(`change:view`,e=>{this.forwardNavigation(e)},i.signal),this.queue.run(()=>r.display.mount(t))}stopListening(){this.controller?.abort(),this.controller=null}finish(e,t){this.sessionId===e&&this.phase===`closing`&&(this.phase=`closed`,this.context.core.setMode(null),this.returnFocus(t))}returnFocus(e){let{core:t}=this.context;if(!t.options.behavior.returnFocus)return;let n=document.activeElement;(e===`modal`||n===null||n===document.body)&&((this.openedFrom===`end`?t.endInput:null)??t.input).focus({preventScroll:!0})}forwardNavigation(e){e.source!==`api`&&this.context.emitter.emit(`navigate`,{year:e.view.year,month:e.view.month,direction:Sn(e.delta),source:e.source})}},wn=class{context;scope=null;constructor(e){this.context=e}bind(){this.release();let{core:e,managers:t}=this.context;if(e.options.inline.enabled)return;let n=new AbortController;this.scope=n,t.triggers.bind(n.signal)}release(){this.scope?.abort(),this.scope=null}};function Tn(e,t){if(P(e))return null;switch(e.mode){case`single`:return e.date?t(e.date):null;case`range`:return e.start===null||e.end===null?null:{start:t(e.start),end:t(e.end)};default:return N(e).map(t)}}function En(e,t){if(typeof e==`string`)return qt(e,t);if(e instanceof Date){let n=b(e);return n===null?null:Gt(n,t)}return null}function Dn(e){if(!(`start`in e&&`end`in e))return null;let t=En(e.start,`day`),n=En(e.end,`day`);return t===null||n===null||f(t,n)>0?null:{mode:`range`,start:t,end:n}}function On(e){let t=[];for(let n of e){let e=En(n,`day`);if(e===null)return null;t.push(e)}return{mode:`multiple`,dates:he(t)}}function kn(e,t,n){if(e===null)return M(t);if(t===`multiple`)return Array.isArray(e)?On(e):null;if(t===`single`){let r=En(e,n);return r===null?null:{mode:t,date:r}}return typeof e==`object`&&!Array.isArray(e)&&!(e instanceof Date)?Dn(e):null}const An=[`start`,`end`];var jn=class{context;session;constructor(e,t){this.context=e,this.session=t}describe=e=>{let{pattern:t,precision:n}=this.context.core.options;return{value:Kt(e,n),date:s(e),formatted:q(e,t,n)}};get(){return this.present(this.context.core.value)}set(e){let{core:t,emitter:n,managers:r,status:i}=this.context;if(i.destroyed)return;let a=kn(e,t.options.mode,t.options.precision);a===null?n.emit(`error`,{code:`invalid-date`,message:`setValue() received a value that is not a valid date for calendar.mode`,input:typeof e==`string`?e:void 0}):(t.setValue(a),r.input.write(a),i.created&&r.form.sync(),this.follow(),this.validate(a))}setActiveEnd(e){let{core:t,status:n}=this.context,r=An;!n.destroyed&&t.options.mode===`range`&&r.includes(e)&&(t.controlActiveEnd(),t.setActiveEnd(e))}applyTyped(e){let{core:t,emitter:n,managers:r}=this.context,i=!ve(t.value,e);t.setValue(e),r.form.sync(),this.follow(),i&&n.emit(`confirm`,{value:this.present(e),autoCommit:!0}),this.validate(e)}commit(e){let{core:t,emitter:n,managers:r}=this.context,i=t.draft;t.setValue(i),r.input.write(i),r.form.sync(),r.form.dispatchCommit(),n.emit(`confirm`,{value:this.present(i),autoCommit:e}),this.validate(i)}validate(e){let{core:t,managers:n}=this.context,{validate:r}=t.options;if(r===null)return;let i=r(this.present(e));i!==null&&n.input.markInvalid(i)}present(e){return Tn(e,this.describe)}follow(){if(!this.session.active)return;let{core:e}=this.context,t=e.value;e.setDraft(t);let n=F(t);n!==null&&K(this.context,n,`api`)}},Mn=class{status={created:!1,destroyed:!1};session;values;actions;instance;updates;constructor(e,t,n){let r={core:e,emitter:t,managers:n,status:this.status},i=new dn(r),a=new wn(r);this.session=new Cn(r),this.values=new jn(r,this.session),this.actions=new un(r,this.session,this.values),this.instance=new bn(r,this.session,i,a),this.updates=new yn(r,this.session,i,a),n.connect(this)}get created(){return this.status.created}get destroyed(){return this.status.destroyed}create(){this.instance.create()}open(e,t){this.session.open(e,t)}close(){return this.session.close()}destroy(e){this.instance.destroy(e)}setOptions(e){this.updates.apply(e)}getValue(){return this.values.get()}setValue(e){this.values.set(e)}setActiveEnd(e){this.values.setActiveEnd(e)}applyTyped(e){this.values.applyTyped(e)}select(e){this.actions.select(e)}selectRange(e,t){this.actions.selectRange(e,t)}typeDraft(e){this.actions.typeDraft(e)}focusDate(e){this.actions.focusDate(e)}navigate(e,t){this.actions.navigate(e,t)}page(e,t){this.actions.page(e,t)}jumpTo(e,t){this.actions.jumpTo(e,t)}showPanel(e){this.actions.showPanel(e)}confirm(){this.actions.confirm()}cancel(e){this.actions.cancel(e)}today(){this.actions.today()}clear(){this.actions.clear()}};const Nn=`dp-ui--pointer`,Pn=[`Shift`,`Control`,`Alt`,`Meta`];function Fn(){return pe()||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function In(e){return e?Fn()?`reduced`:`full`:`none`}function Ln(e,t){e.textContent=``,e.textContent=t}function Rn(e){let t=e.ownerDocument,n=()=>{e.classList.add(Nn)},r=t=>{Pn.includes(t.key)||e.classList.remove(Nn)};return e.addEventListener(`pointerdown`,n,!0),t.addEventListener(`keydown`,r,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`keydown`,r,!0)}}const zn=e=>e.toLowerCase().replace(/_/g,`-`);function Bn(e,t){Object.entries(C).forEach(([n,r])=>{e.style.setProperty(`--dp-ui-motion-${zn(n)}`,`${String(t?r:0)}ms`)}),Object.entries(oe).forEach(([t,n])=>{e.style.setProperty(`--dp-ui-easing-${zn(t)}`,n)})}const Vn=` – `,Hn=/\s*[–—]\s*|\s+-\s+/,Un=/[,;]/;function Wn(e,t,n){return N(e).map(e=>q(e,t,n)).join(e.mode===`range`?Vn:`, `)}function Gn(e,t){let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function Kn(e){if(e?.length!==2)return null;let[t,n]=e;return f(t,n)>0?null:{mode:`range`,start:t,end:n}}function qn(e,t,n,r,i){switch(t){case`single`:{let r=n(e);return r===null?null:{mode:t,date:r}}case`range`:return Kn(Gn(e.split(r),n));default:{let r=Gn(e.split(i).filter(e=>e.trim()!==``),n);return r===null?null:{mode:t,dates:he(r)}}}}function Jn(e,t,n,r){let i=e.trim();return i===``?M(t):qn(i,t,e=>Xt(e.trim(),n,r),Hn,Un)}function Yn(e,t){return e.mode===`range`?e.start===null||e.end===null?``:`${Kt(e.start,t)}/${Kt(e.end,t)}`:N(e).map(e=>Kt(e,t)).join(`,`)}function Xn(e,t,n){let r=e.trim();return r===``?M(t):qn(r,t,e=>qt(e.trim(),n),/\//,/,/)}function Zn(e,t,n){if(t===`range`)return e.rangeTitle;switch(n){case`month`:return e.monthTitle;case`year`:return e.yearTitle;case`day`:return e.title}}const Qn=/* @__PURE__ */ new Map,$n=/* @__PURE__ */ new Map;function er(e){let t=Qn.get(e);if(t)return t;let n=new Intl.PluralRules(e);return Qn.set(e,n),n}function tr(e){let t=$n.get(e);if(t)return t;let n=new Intl.NumberFormat(e);return $n.set(e,n),n}function nr(e,t,n){return(typeof e==`string`?e:e[er(n).select(t)]??e.other??Object.values(e).at(0)??``).replaceAll(`{count}`,tr(n).format(t))}function rr(e,t,n,r,i){switch(e.mode){case`single`:return e.date?Be(e.date,i,n,`headline`):r.noDate;case`range`:{if(t===`input`&&e.start&&e.end)return Le(e.start,e.end,n);let i=e.start?Ie(e.start,n):r.rangeStart,a=e.end?Ie(e.end,n):r.rangeEnd;return`${i}${Vn}${a}`}default:return e.dates.length===0?r.noDate:nr(r.multipleSelected,e.dates.length,n)}}const ir=`dp-ui--ripple-pressed`,ar=`dp-ui--ripple-active`,or=e=>e.getAttribute(`aria-disabled`)===`true`||e instanceof HTMLButtonElement&&e.disabled;function sr(e,t,n){let r=e=>e instanceof Element?e.closest(t):null,i=e=>{r(e.target)?.classList.remove(ir)};e.addEventListener(`pointerdown`,t=>{let a=r(t.target);if(!a||!e.contains(a)||or(a)||t.pointerType===`mouse`&&t.button!==0)return;a.classList.remove(ar);let{left:o,top:s,width:c,height:l}=a.getBoundingClientRect();a.style.setProperty(`--dp-ui-ripple-x`,`${String(t.clientX-o)}px`),a.style.setProperty(`--dp-ui-ripple-y`,`${String(t.clientY-s)}px`),a.style.setProperty(`--dp-ui-ripple-size`,`${String(Math.max(c,l)*2)}px`),a.style.setProperty(`--dp-ui-ripple-duration`,`${String(C.RIPPLE)}ms`),a.classList.add(ir),a.addEventListener(`pointerleave`,i,{once:!0,signal:n}),Fn()||(requestAnimationFrame(()=>{a.classList.add(ar)}),window.setTimeout(()=>{a.classList.remove(ar)},C.RIPPLE))},{signal:n}),e.addEventListener(`pointerup`,i,{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n})}const J={calendar:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Z"/></svg>`,pencil:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>`,arrowDropDown:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M480-360 280-560h400L480-360Z"/></svg>`,keyboardArrowLeft:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"/></svg>`,keyboardArrowRight:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>`,check:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg>`},cr=e=>{let t=t=>`${e.shiftKey}+${t}`;return{previousMonth:{keys:`PageUp`,display:e.pageUpKey},nextMonth:{keys:`PageDown`,display:e.pageDownKey},previousYear:{keys:`Shift+PageUp`,display:t(e.pageUpKey)},nextYear:{keys:`Shift+PageDown`,display:t(e.pageDownKey)},chooseMonth:{keys:`Shift+M`,display:t(`M`)},chooseYear:{keys:`Shift+Y`,display:t(`Y`)}}},Y=(e,t)=>`dp-ui-${e.replace(/[^\w-]/g,`-`)}-${t}`,lr=(e,t,n)=>{n!==void 0&&(e.setAttribute(`title`,`${t} (${n.display})`),e.setAttribute(`aria-keyshortcuts`,n.keys))},ur=(e,t)=>{let n=T(`span`);n.innerHTML=e;let r=n.firstElementChild;return r===null?null:(r.setAttribute(`class`,t),r.setAttribute(`aria-hidden`,`true`),r)},X=(e,t,n,r)=>{let i=w(`dp-ui__icon-button dp-ui__icon-button--${e}`,t,n);return i.firstElementChild?.setAttribute(`aria-hidden`,`true`),lr(i,t,r),i},dr=(e,t,n)=>{let r=T(`button`,`dp-ui__menu-button dp-ui__menu-button--${e}`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":n.controls});lr(r,n.name,n.shortcut);let i=T(`span`,`dp-ui__menu-button-label`);r.append(i);let a=ur(J.arrowDropDown,`dp-ui__menu-button-icon`);a!==null&&r.append(a);let o=(e,t=e)=>{i.textContent=e,r.setAttribute(`aria-label`,`${n.name}, ${t}`)};return o(t),{button:r,label:i,setText:o}},fr=(e,t)=>w(`dp-ui__text-button dp-ui__text-button--${e}`,t),pr=(e,t)=>{let n=X(`switch-view`,e.switchToInput,J.pencil);return{button:n,setInputView:r=>{n.innerHTML=r?J.calendar:J.pencil,n.firstElementChild?.setAttribute(`aria-hidden`,`true`),r?n.setAttribute(`aria-controls`,t):n.removeAttribute(`aria-controls`),n.setAttribute(`aria-label`,r?e.switchToCalendar:e.switchToInput)}}},mr=(e,t)=>{e.querySelectorAll(`.dp-ui__text-button--confirm, .dp-ui__text-button--save`).forEach(e=>{e.disabled=!t})},hr=e=>{let{labels:t}=e,n=T(`div`,`dp-ui__actions`);n.hidden=!e.visible;let r=T(`div`,`dp-ui__actions-start`);e.todayButton&&r.append(fr(`today`,t.today)),e.clearButton&&r.append(fr(`clear`,t.clear));let i=T(`div`,`dp-ui__actions-end`);return i.append(fr(`cancel`,t.cancel),fr(`confirm`,t.confirm)),n.append(r,i),n},gr=[[`dp-ui__icon-button--prev-month`,{kind:`page`,direction:-1}],[`dp-ui__icon-button--next-month`,{kind:`page`,direction:1}],[`dp-ui__icon-button--prev-year`,{kind:`navigate`,delta:-12}],[`dp-ui__icon-button--next-year`,{kind:`navigate`,delta:12}],[`dp-ui__menu-button--month`,{kind:`panel`,panel:`month-menu`}],[`dp-ui__menu-button--year`,{kind:`panel`,panel:`year-menu`}],[`dp-ui__menu-button--year-grid`,{kind:`panel`,panel:`year-grid`}],[`dp-ui__text-button--today`,{kind:`today`}],[`dp-ui__text-button--clear`,{kind:`clear`}],[`dp-ui__text-button--cancel`,{kind:`cancel`}],[`dp-ui__text-button--confirm`,{kind:`confirm`}],[`dp-ui__text-button--save`,{kind:`confirm`}],[`dp-ui__icon-button--close`,{kind:`cancel`}],[`dp-ui__icon-button--switch-view`,{kind:`switch`}]],_r=e=>gr.find(([t])=>e.classList.contains(t)),vr=e=>_r(e)?.[0]??null,yr=(e,t)=>{let{actions:n}=t;switch(e.kind){case`navigate`:n.navigate(e.delta,`button`);return;case`page`:n.page(e.direction,`button`);return;case`panel`:n.showPanel(t.panel()===e.panel?t.home:e.panel);return;case`switch`:n.showPanel(t.panel()===`input`?t.home:`input`);return;case`today`:n.today();return;case`clear`:n.clear();return;case`cancel`:n.cancel(`button`);return;case`confirm`:n.confirm()}},br=(e,t,n)=>{e.addEventListener(`click`,e=>{let{target:t}=e,r=t instanceof Element?t.closest(`button`):null;if(r!==null){let e=_r(r);e&&yr(e[1],n);return}let i=n.cellAt(t);i!==null&&n.actions.select(i.date)},{signal:t})},xr=`dp-ui__container--menu-open`,Sr=`dp-ui__container--input`,Cr=`--dp-ui-visible-months`,wr=e=>e.closest(`.dp-ui__container`),Tr=(e,t)=>e!==t&&e!==`days`&&e!==`input`,Er=(e,t)=>{let n=t>1;e.classList.toggle(`dp-ui__container--multi-month`,n),n?e.style.setProperty(Cr,String(t)):e.style.removeProperty(Cr)},Dr=(e,t,n)=>{let r=t===`input`;e.classList.toggle(Sr,r),Er(e,r?1:n)},Or=(e,t)=>{let n=T(`div`,`dp-ui__navigation-group dp-ui__navigation-group--${e}`);return n.append(...t),n},kr=e=>{let{labels:t}=e,n=cr(t),r=z(e.locale,`short`),i=z(e.locale,`long`),a=dr(`month`,``,{name:t.chooseMonth,controls:Y(e.instanceId,`month-menu`),shortcut:n.chooseMonth}),o=dr(`year`,``,{name:t.chooseYear,controls:Y(e.instanceId,`year-menu`),shortcut:n.chooseYear}),s=T(`div`,`dp-ui__header dp-ui__header--docked`),c=Or(`month`,[X(`prev-month`,t.previousMonth,J.keyboardArrowLeft,n.previousMonth),a.button,X(`next-month`,t.nextMonth,J.keyboardArrowRight,n.nextMonth)]);c.hidden=e.groups!==`both`,s.hidden=e.groups===`none`,s.append(c,Or(`year`,[X(`prev-year`,t.previousYear,J.keyboardArrowLeft,n.previousYear),o.button,X(`next-year`,t.nextYear,J.keyboardArrowRight,n.nextYear)]));let l=t=>{a.setText(r[t.month-1]??``,i[t.month-1]??``),o.setText(I(t.year,e.locale))},u=e=>{a.button.setAttribute(`aria-expanded`,String(e===`month-menu`)),o.button.setAttribute(`aria-expanded`,String(e===`year-menu`)),a.button.disabled=e===`year-menu`,o.button.disabled=e===`month-menu`};return l(e.view),u(e.home),{element:s,setView:l,setPanel:u}},Ar=`dp-ui__headline--fading-out`,jr=(e,t)=>{let n=T(`div`,`dp-ui__headline`);n.textContent=e;let r=null,i=null,a=()=>{i!==null&&clearTimeout(i),i=null,r=null,n.classList.remove(Ar)},o=()=>{let e=r;a(),e!==null&&(n.textContent=e)};return{element:n,setText:e=>{e!==(r??n.textContent)&&(t?(r=e,n.classList.add(Ar),i??=setTimeout(o,C.HEADLINE_FADE)):(a(),n.textContent=e))},destroy:a}},Mr=e=>{let{labels:t,switchView:n}=e,r=T(`div`,`dp-ui__header dp-ui__header--modal`),i=T(`div`,`dp-ui__supporting-text`);i.textContent=e.title;let a=jr(e.text,e.animate);r.append(i,a.element);let o=n===null?null:pr(t,n.panelId);return o!==null&&r.append(o.button),{element:r,setText:e=>{a.setText(e)},setInputView:e=>{o?.setInputView(e)},destroy:()=>{a.destroy()}}},Nr=(e,t,n,r)=>{let i=cr(n),a=T(`div`,`dp-ui__navigation`);return a.append(dr(`year-grid`,B(e,t),{name:n.chooseYear,controls:Y(r,`year-grid`),shortcut:i.chooseYear}).button,X(`prev-month`,n.previousMonth,J.keyboardArrowLeft,i.previousMonth),X(`next-month`,n.nextMonth,J.keyboardArrowRight,i.nextMonth)),a},Pr=(e,t,n,r)=>{let i=T(`div`,`dp-ui__navigation dp-ui__navigation--month-grid`),a=cr(n);return i.append(dr(`year-grid`,I(e.year,t),{name:n.chooseYear,controls:Y(r,`year-grid`),shortcut:a.chooseYear}).button,X(`prev-year`,n.previousYear,J.keyboardArrowLeft,a.previousYear),X(`next-year`,n.nextYear,J.keyboardArrowRight,a.nextYear)),i},Fr=(e,t,n,r)=>{let i=T(`div`,`dp-ui__navigation dp-ui__navigation--year-grid`),{button:a}=dr(`year-grid`,B(e,t),{name:n.chooseYear,controls:Y(r,`year-grid`)});return a.setAttribute(`aria-expanded`,`true`),i.append(a),i},Ir=e=>{let{decorateDate:t}=e.options;return t===null?()=>null:e=>{try{return t(s(e))??null}catch(e){return j(e),null}}},Lr=e=>{let{renderDate:t}=e.options;return t===null?()=>null:e=>t(s(e))},Rr=(e,t,n)=>{let{options:r}=e;return{locale:r.locale,weekStart:r.weekStart,weekNumbers:r.weekNumbers,showOutside:n,outsideSelectable:r.outsideDays!==!1&&r.outsideDays.selectable,labels:{weekNumber:r.labels.weekNumber},rangeLabels:{start:r.labels.rangeStart,end:r.labels.rangeEnd},headingVisible:!1,weekdaysVisible:!0,multiselectable:e.draft.mode!==`single`,rangeRole:()=>null,decorate:Ir(e),content:Lr(e),isSelected:t=>ye(e.draft,t),isDisabled:n=>!t.isSelectable(n,e.followsActiveEnd?sn(e.draft,e.activeEnd):e.draft),today:o(),focus:e.focus}},zr=(e,t,n)=>{let r=e.layout.months>1,i=n===`docked`&&!r&&e.options.outsideDays!==!1,a=Rr(e,t,i);return r?{...a,headingVisible:!0}:a},Br=(e,t)=>ze(t,d(t,e.layout.months-1),e.options.locale),Z=e=>rr(e.draft,e.panel===`input`?`input`:`calendar`,e.options.locale,e.options.labels,e.options.precision),Vr={days:null,input:null,"month-menu":`.dp-ui__menu-button--month`,"year-menu":`.dp-ui__menu-button--year`,"year-grid":`.dp-ui__menu-button--year-grid`,"month-grid":null},Hr=e=>{switch(e){case`day`:return`both`;case`month`:return`year`;case`year`:return`none`}},Ur=e=>Vr[e],Wr=(t,n,r)=>{let{locale:i,labels:a,animation:o,viewSwitch:s,mode:c,precision:l}=t.options;if(n===`modal`){let n=s&&e(c,r,l),i=Mr({labels:a,title:Zn(a,c,l),animate:o,text:Z(t),switchView:n?{panelId:Y(t.instanceId,`input`)}:null});return i.setInputView(t.panel===`input`),{element:i.element,docked:null,modal:i}}let u=kr({instanceId:t.instanceId,locale:i,labels:a,view:t.view,groups:Hr(l),home:_(l)});return{element:u.element,docked:u,modal:null}},Gr=(e,t)=>{let n=d(e,t);return{year:n.year,month:n.month,day:Math.min(e.day,u(n))}},Kr=(e,t,n,r)=>{let i=t?12:1;switch(e){case`ArrowLeft`:return E(n,r?1:-1);case`ArrowRight`:return E(n,r?-1:1);case`ArrowUp`:return E(n,-7);case`ArrowDown`:return E(n,7);case`Home`:return{year:n.year,month:n.month,day:1};case`End`:return{...n,day:u(n)};case`PageUp`:return Gr(n,-i);case`PageDown`:return Gr(n,i);default:return null}},qr=e=>e.ctrlKey||e.altKey||e.metaKey,Jr=(e,t)=>{let n=e.toLowerCase();return t===`modal`?n===`y`?`year-grid`:null:n===`m`?`month-menu`:n===`y`?`year-menu`:null},Yr=e=>{let{panel:t}=e.core;return e.layout===`docked`?e.home===`days`&&t===`days`:e.layout===`modal`&&t===e.home&&e.home!==`year-grid`},Xr=(e,t)=>{let{panel:n}=t.core;n!==t.home&&n!==`input`&&(e.preventDefault(),e.stopPropagation(),t.actions.showPanel(t.home))},Zr=(e,t)=>{if(!e.shiftKey||!Yr(t))return!1;let n=Jr(e.key,t.layout);return n!==null&&(e.preventDefault(),t.actions.showPanel(n),!0)},Qr=(e,t,n)=>{e.preventDefault(),e.key===`Enter`&&n.layout===`modal`&&n.core.options.mode===`single`&&ye(n.core.draft,t.date)?n.actions.confirm():n.actions.select(t.date)},$r=(e,t,n)=>{if(e.key===`Enter`||e.key===` `){Qr(e,t,n);return}let r=Kr(e.key,e.shiftKey,t.date,n.isRtl());r!==null&&(e.preventDefault(),n.actions.focusDate(r))},ei=(e,t,n)=>{e.addEventListener(`keydown`,e=>{if(e.defaultPrevented)return;if(e.key===`Escape`){Xr(e,n);return}if(qr(e)||Zr(e,n))return;let t=n.cellAt(e.target);t!==null&&$r(e,t,n)},{signal:t})},ti=`dp-ui__ghost`,ni=e=>Array.from(e.querySelectorAll(`*`)).filter(e=>e.closest(`.${ti}`)===null),ri=(e,t,n)=>{e.querySelectorAll(`.${ti}`).forEach(e=>{e.remove()}),e.removeAttribute(`popover`),e.removeAttribute(`style`),e.classList.remove(`dp-ui__container--morphing`),e.classList.add(ti),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``),e.removeAttribute(`id`),e.removeAttribute(`name`),e.querySelectorAll(`[id], [name]`).forEach(e=>{e.removeAttribute(`id`),e.removeAttribute(`name`)}),e.style.setProperty(`inline-size`,`${String(t)}px`),e.style.setProperty(`block-size`,`${String(n)}px`)},ii=(e,t)=>{let n=Array.from(t.querySelectorAll(`*`));return ni(e).flatMap((e,t)=>{let r=n.at(t);return r===void 0||e.scrollTop===0&&e.scrollLeft===0?[]:[{live:e,copy:r,top:e.scrollTop,left:e.scrollLeft}]})},ai=({live:e,copy:t})=>{let n=e.getBoundingClientRect(),r=Array.from(t.children);Array.from(e.children).forEach((e,t)=>{let i=r.at(t),a=e.getBoundingClientRect();i===void 0||a.bottom>n.top&&a.top<n.bottom||(i.replaceChildren(),i instanceof HTMLElement&&i.style.setProperty(`block-size`,`${String(a.height)}px`))})},oi=(e,t,n)=>{let r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return null;ri(r,t,n);let i=ii(e,r);i.forEach(ai);let a=null,o=()=>{if(a!==null){let e=a;a=null,e.cancel()}r.remove()};return{show:()=>{e.append(r),i.forEach(({copy:e,top:t,left:n})=>{e.scrollTop=t,e.scrollLeft=n}),typeof r.animate==`function`?(a=r.animate([{opacity:1},{opacity:0}],{duration:C.VIEW_SWITCH_FADE_OUT,easing:`linear`,fill:`forwards`}),a.finished.then(o,o)):o()},remove:o}},si=`dp-ui__container--morphing`,ci=/* @__PURE__ */ new WeakMap,li=e=>{let t=e.getBoundingClientRect();return{width:t.width,height:t.height,radius:getComputedStyle(e).borderRadius}},ui=(e,t)=>{if(t===null)return null;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:getComputedStyle(t).direction===`rtl`?n.right-r.right:r.left-n.left,y:r.top-n.top,height:r.height}},di=e=>({width:`${String(e.width)}px`,height:`${String(e.height)}px`,borderRadius:e.radius}),fi=(e,t,n)=>{if(n.height===0)return;let r=getComputedStyle(e).direction===`rtl`,i=(t.x-n.x)*(r?-1:1),a=t.y-n.y,o=t.height/n.height;if(i===0&&a===0&&o===1)return;let s=r?`top right`:`top left`;e.animate([{transform:`translate(${String(i)}px, ${String(a)}px) scale(${String(o)})`,transformOrigin:s},{transform:`none`,transformOrigin:s}],{duration:C.VIEW_SWITCH,easing:oe.EMPHASIZED})},pi=(e,t,n)=>{if(n===`none`||typeof e.animate!=`function`)return t(),null;if(n===`reduced`){let n=li(e),r=oi(e,n.width,n.height);return t(),r?.show(),null}let r=e.querySelector(`.dp-ui__headline`),i=li(e),a=ui(e,r),o=oi(e,i.width,i.height);t();let s=li(e),c=ui(e,r);e.classList.add(si);let l=e.animate([di(i),di(s)],{duration:C.VIEW_SWITCH,easing:oe.EMPHASIZED});ci.set(e,l),o?.show(),r!==null&&a!==null&&c!==null&&fi(r,a,c);let u=()=>{o?.remove(),ci.get(e)===l&&(ci.delete(e),e.classList.remove(si))};return l.finished.then(u,u),l};function mi(e){let t=e.describedById??`${e.id}-supporting`,n=T(`div`,`dp-ui__text-field`),r=T(`input`,`dp-ui__text-field-input`,{id:e.id,type:`text`,inputmode:`numeric`,autocomplete:`off`,placeholder:e.placeholder,tabindex:`0`,"aria-invalid":`false`,"aria-describedby":t});r.value=e.value;let i=T(`label`,`dp-ui__text-field-label`,{for:e.id});i.textContent=e.label;let a=T(`div`,`dp-ui__text-field-supporting`,{id:t,"aria-live":`polite`});return a.textContent=e.hint,n.append(r,i,a),{element:n,input:r,getValue:()=>r.value,setValue:e=>{r.value=e},setError:t=>{let i=t!==null;n.classList.toggle(`dp-ui__text-field--error`,i),r.setAttribute(`aria-invalid`,i?`true`:`false`);let o=t??e.hint;a.textContent!==o&&(a.textContent=o)}}}function hi(e){return e.mode===`single`?e.date:null}function gi(e){return e.mode===`single`?e.date===null:e.mode===`range`?e.start===null:e.dates.length===0}function _i(e){let{instanceId:t,draft:n,pattern:r,labels:i,rules:a}=e,o=T(`div`,`dp-ui__input-panel`,{"data-panel":`input`,id:Y(t,`input`)}),s=fe(r,g(i)),c=(e,n,i)=>mi({id:`${t}-input-${e}`,label:n,placeholder:s,hint:s,value:i?S(i,r):``}),l=n.mode===`range`,u=c(l?`start`:`date`,l?i.startDateField:i.dateField,n.mode===`range`?n.start:hi(n)),d=l?c(`end`,i.endDateField,n.end):null,p=d?[u,d]:[u],m=t=>{let n=t.getValue().trim();if(n===``)return t.setError(null),{date:null,failed:!1};let o=x(n,r);if(o===null)return t.setError(i.invalidDate),{date:null,failed:!0};let s=a.unavailableReason(o);return s===null?(t.setError(null),t.setValue(S(o,r)),{date:o,failed:!1}):(t.setError(e.messageFor(s)),{date:null,failed:!0})},h=()=>{let e=m(u);if(!d)return e.failed?null:{mode:`single`,date:e.date};let t=m(d),n=t.date,r=e.failed||t.failed;return e.date&&n&&f(n,e.date)<0&&(d.setError(i.invalidRange),n=null,r=!0),r?null:{mode:`range`,start:e.date,end:n}},_=t=>{let n=nn(t,e.limits,e=>a.unavailableReason(e));return n===null||((d??u).setError(e.messageFor(n)),!1)};return p.forEach(t=>{t.input.addEventListener(`change`,()=>{let t=h();t&&_(t)&&e.onDraft(t)}),t.input.addEventListener(`keydown`,t=>{if(t.key!==`Enter`)return;t.preventDefault();let n=h();n&&_(n)&&ge(n)&&!gi(n)&&(e.onDraft(n),e.onSubmit())})}),o.append(...p.map(e=>e.element)),o}function vi(e,t){let{labels:n,minDate:r,maxDate:i,pattern:a,precision:o}=t;return e===`min`&&r!==null?n.beforeMinDate.replace(`{date}`,q(r,a,o)):e===`max`&&i!==null?n.afterMaxDate.replace(`{date}`,q(i,a,o)):e===`range-length`?n.invalidRange:n.unavailableDate}const yi=e=>{let{core:t,actions:n,rules:r}=e,{pattern:i,labels:a,limits:o}=t.options;return[_i({instanceId:t.instanceId,draft:t.draft,pattern:i,labels:a,rules:r,limits:o,messageFor:e=>vi(e,t.options),onDraft:e=>{n.typeDraft(e)},onSubmit:()=>{n.confirm()}})]},bi=`dp-ui__pager--dragging`,xi=e=>e instanceof Element&&e.closest(`button`)!==null,Si=(e,t)=>{e.push(t),e.length>k.VELOCITY_SAMPLES&&e.shift()},Ci=e=>{let t=e.at(0),n=e.at(-1);return!t||!n?0:(n.x-t.x)/Math.max(k.MIN_SAMPLE_SPAN_MS,n.t-t.t)},wi=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},Ti=(e,t)=>{e.hasPointerCapture(t)&&e.releasePointerCapture(t)},Ei=(e,t,n)=>{let r=null,i=null,a=t=>{t.controller.abort(),r===t&&(r=null),t.dragging&&(e.classList.remove(bi),Ti(e,t.pointerId))},o=()=>{i?.abort();let t=new AbortController;i=t,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t.abort()},{capture:!0,signal:t.signal}),requestAnimationFrame(()=>{t.abort()})},s=t=>{n.onBegin(),t.dragging=!0,t.width=n.pageWidth(),wi(e,t.pointerId),e.classList.add(bi)},c=(e,t)=>{if(t.pointerId!==e.pointerId)return;let r=t.clientX-e.startX;if(!e.dragging){if(Math.abs(r)<=k.DRAG_START_PX)return;s(e)}e.lastX=t.clientX,Si(e.samples,{x:t.clientX,t:t.timeStamp}),n.onMove(r,e.width)},l=(e,t,r)=>{t.pointerId===e.pointerId&&(a(e),e.dragging&&(r?n.onAbort():(o(),Si(e.samples,{x:e.lastX,t:t.timeStamp}),n.onRelease({dx:e.lastX-e.startX,velocity:Ci(e.samples),width:e.width}))))};e.addEventListener(`pointerdown`,t=>{if(t.button!==0||!t.isPrimary||xi(t.target))return;let i=r;i&&(a(i),i.dragging&&n.onAbort());let o=new AbortController,s={pointerId:t.pointerId,startX:t.clientX,samples:[{x:t.clientX,t:t.timeStamp}],controller:o,lastX:t.clientX,width:0,dragging:!1};r=s;let u=e.ownerDocument,d={signal:o.signal};u.addEventListener(`pointermove`,e=>{c(s,e)},d),u.addEventListener(`pointerup`,e=>{l(s,e,!1)},d),u.addEventListener(`pointercancel`,e=>{l(s,e,!0)},d)},{signal:t});let u=()=>{r&&a(r)};return{isDragging:()=>r?.dragging===!0,cancel:u,dispose:()=>{u(),i?.abort(),i=null}}},Di=(e,t)=>e.year===t.year&&e.month===t.month,Oi=(e,t,n)=>{let r=null,i=e=>{let n=t(e);return n.classList.add(`dp-ui__page`),{view:e,element:n}},a=e=>{r?.forEach((t,n)=>{t.element.toggleAttribute(`inert`,n!==e)})},o=(e,t,n)=>{let r=e[t];if(Di(r.view,n))return e;let a=i(n);return r.element.replaceWith(a.element),t===0?[a,e[1],e[2]]:[e[0],e[1],a]};return{show:t=>{let o=[i(d(t,-n)),i(t),i(d(t,n))];e.replaceChildren(...o.map(e=>e.element)),r=o,a(1)},centerView:()=>r?.[1].view??null,reveal:(e,t)=>{r&&(r=o(r,e,t),a(e))},recenter:e=>{if(!r)return;let t=r[e],o=i(d(t.view,-n)),s=i(d(t.view,n));r.forEach((t,n)=>{n!==e&&t.element.remove()}),t.element.before(o.element),t.element.after(s.element),r=[o,t,s],a(1)},clear:()=>{r=null}}},ki=(e,t,n)=>{if(t<-k.FLICK_VELOCITY)return 1;if(t>k.FLICK_VELOCITY)return-1;let r=n*k.COMMIT_FRACTION;return e<-r?1:e>r?-1:0},Ai=(e,t,n,r)=>{let i=ki(e,t,n);return!r||i===0?i:i===1?-1:1},ji=(e,t)=>{let n=null,r=null,i=()=>typeof e.animate==`function`,a=()=>{let e=r;r=null,e?.cancel()},o=()=>{a();let e=n;e&&(n=null,e.complete(),e.animation.cancel())},s=()=>{a();let e=n;n=null,e?.animation.cancel()},c=()=>{let t=e.animate([{opacity:0},{opacity:1}],{duration:C.REDUCED_FADE,easing:`linear`});r=t;let n=()=>{r===t&&(r=null)};t.finished.then(n,n)};return{run:(r,s,l)=>{a();let u=In(t);if(r===s||u===`none`||!i()){l();return}if(u===`reduced`){l(),c();return}let d=e.animate([{transform:r},{transform:s}],{duration:C.PAGER_SETTLE,easing:oe.EMPHASIZED,fill:`forwards`}),f={animation:d,complete:l};n=f,d.finished.then(()=>{n===f&&o()},()=>void 0)},finish:o,cancel:s}},Mi=(e,t)=>Math.min(t,Math.max(-t,e)),Ni=(e,t)=>e.deltaMode===0?e.deltaX:Math.sign(e.deltaX)*t,Pi=(e,t,n)=>{let r=null,i=0,a=()=>{r=null;let e=i;i=0,n.onSettle(e,n.pageWidth())};return e.addEventListener(`wheel`,e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY)||n.isBlocked())return;e.preventDefault();let t=n.pageWidth();r===null?n.onBegin():clearTimeout(r),i-=Ni(e,t),n.onMove(Mi(i,t),t),r=setTimeout(a,C.WHEEL_SETTLE)},{passive:!1,signal:t}),{cancel:()=>{r!==null&&clearTimeout(r),r=null,i=0}}},Fi=`dp-ui__pager--swipe`,Ii=`--dp-ui-pager-height`;var Li=class{viewport;options;track;controller=new AbortController;previousTouchAction;strip;animator;drag=null;wheel=null;offset=0;revision=0;constructor(e,t){this.viewport=e,this.options=t,this.previousTouchAction=e.style.touchAction,this.track=T(`div`,`dp-ui__pager-track`),this.strip=Oi(this.track,e=>t.renderPage(e),t.step??1),this.animator=ji(this.track,t.animate),e.classList.add(`dp-ui__pager`),e.append(this.track),t.swipe&&this.enableSwipe()}show(e){this.destroyed||(this.revision+=1,this.animator.cancel(),this.cancelGestures(),this.strip.show(e),this.rest(),this.fitHeight(e))}slide(e,t){if(this.destroyed)return;this.finish(),this.cancelGestures();let n=this.strip.centerView();if(!n){this.show(e);return}if(this.revision+=1,Di(n,e)){this.settle();return}let r=t===1?2:0;this.strip.reveal(r,e),this.fitHeight(e);let i=this.pageWidth(),a=this.transformFor(1,this.offset,i);this.offset=0,this.animator.run(a,this.transformFor(r,0,i),()=>{this.strip.recenter(r),this.rest()})}finish(){this.animator.finish()}destroy(){this.destroyed||(this.controller.abort(),this.cancelGestures(),this.drag?.dispose(),this.animator.cancel(),this.track.remove(),this.strip.clear(),this.viewport.style.removeProperty(Ii),this.viewport.classList.remove(Fi,bi),this.options.swipe&&(this.viewport.style.touchAction=this.previousTouchAction))}get destroyed(){return this.controller.signal.aborted}enableSwipe(){let{signal:e}=this.controller;this.viewport.style.touchAction=`pan-y`,this.viewport.classList.add(Fi),this.drag=Ei(this.viewport,e,{pageWidth:()=>this.pageWidth(),onBegin:()=>{this.finish(),this.wheel?.cancel()},onMove:(e,t)=>{this.setOffset(e,t)},onRelease:({dx:e,velocity:t,width:n})=>{this.release(Ai(e,t,n,this.options.rtl),`drag`)},onAbort:()=>{this.settle()}}),this.wheel=Pi(this.viewport,e,{pageWidth:()=>this.pageWidth(),isBlocked:()=>this.drag?.isDragging()===!0,onBegin:()=>{this.finish()},onMove:(e,t)=>{this.setOffset(e,t)},onSettle:(e,t)=>{this.release(Ai(e,0,t,this.options.rtl),`wheel`)}})}cancelGestures(){this.drag?.cancel(),this.wheel?.cancel()}release(e,t){if(e===0){this.settle();return}let n=this.revision;this.options.onCommit(e,t),this.revision===n&&!this.destroyed&&this.settle()}settle(){this.finish();let e=this.pageWidth(),t=this.transformFor(1,this.offset,e);this.offset=0,this.animator.run(t,this.transformFor(1,0,e),()=>{this.rest()})}fitHeight(e){this.options.fitHeight&&!this.viewport.hidden&&this.viewport.style.setProperty(Ii,`${String(this.options.pageHeight(e))}px`)}rest(){this.offset=0,this.track.style.removeProperty(`transform`),this.viewport.scrollLeft!==0&&(this.viewport.scrollLeft=0)}setOffset(e,t){this.offset=e,this.track.style.transform=this.transformFor(1,e,t)}transformFor(e,t,n){let r=this.options.rtl?1:-1;return`translateX(${String(r*e*n+t)}px)`}pageWidth(){let e=this.viewport.clientWidth;return e>0?e:360}};const Ri=`dp-ui__date`,zi=`dp-ui__date--outside-month`,Bi=`data-decoration-label`,Vi=`data-content-label`,Hi=`dp-ui__date-content`,Ui=`dp-ui__date--has-content`,Wi=`:scope > .${Hi}`,Gi=(e,t,n)=>n.isDisabled(e)||t&&!n.outsideSelectable,Ki=(e,t,n,r)=>[[`dp-ui__date--selected`,r.isSelected(e)],[`dp-ui__date--range-start`,n===`start`],[`dp-ui__date--range-end`,n===`end`],[`dp-ui__date--in-range`,n===`in-range`],[`dp-ui__date--today`,A(e,r.today)],[`dp-ui__date--disabled`,Gi(e,t,r)],[zi,t]],qi=e=>{e.querySelector(Wi)?.remove(),e.classList.remove(Ui),e.removeAttribute(Vi)},Ji=(e,t,n)=>{let r=n.content(t);if(r===null){qi(e);return}let i=e.querySelector(Wi),a=(typeof r==`string`?r:r.textContent??``).trim();if(typeof r!=`string`||i===null||i.childElementCount!==0||i.textContent!==r){let t=T(`span`,Hi);typeof r==`string`?t.textContent=r:t.appendChild(r),i===null?e.querySelector(`.dp-ui__date-indicator`)?.after(t):i.replaceWith(t)}e.classList.add(Ui),a===``?e.removeAttribute(Vi):e.setAttribute(Vi,a)},Yi=(e,t)=>e===`start`?t.rangeLabels.start:e===`end`?t.rangeLabels.end:null,Xi=(e,t,n,r,i)=>[Re(e,i.locale),Yi(t,i),n,r].filter(e=>e!==null&&e!==``).join(`, `),Zi=(e,t,n,r)=>{let i=r.rangeRole(t);Ji(e,t,r),Ki(t,n,i,r).forEach(([t,n])=>e.classList.toggle(t,n)),e.setAttribute(`aria-selected`,String(r.isSelected(t)||i!==null)),e.setAttribute(`aria-label`,Xi(t,i,e.getAttribute(Bi),e.getAttribute(Vi),r)),A(t,r.today)?e.setAttribute(`aria-current`,`date`):e.removeAttribute(`aria-current`),Gi(t,n,r)?e.setAttribute(`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`);let a=!n&&A(t,r.focus);e.setAttribute(`tabindex`,a?`0`:`-1`)},Qi=(e,t)=>{if(t===null)return;let n=(t.className??``).split(/\s+/).filter(Boolean);e.classList.add(...n),t.label&&e.setAttribute(Bi,t.label),t.badge===!0&&e.appendChild(T(`span`,`dp-ui__date-badge`,{"aria-hidden":`true`}))},$i=(e,t)=>{if(!e.inMonth&&!t.showOutside)return T(`td`,`${Ri} dp-ui__date--empty`);let n=T(`td`,Ri,{role:`gridcell`,"data-date":v(e.date)}),r=T(`span`,`dp-ui__date-indicator`);return r.textContent=I(e.date.day,t.locale),n.appendChild(r),Qi(n,t.decorate(e.date)),Zi(n,e.date,!e.inMonth,t),n},ea=`dp-ui__visually-hidden`,ta=e=>{let t=T(`thead`),n=T(`tr`,e.weekdaysVisible?`dp-ui__weekdays`:`dp-ui__weekdays ${ea}`);if(e.weekNumbers){let t=T(`th`,`dp-ui__week-number-header`,{scope:`col`});t.textContent=e.labels.weekNumber,n.appendChild(t)}let r=Pe(e.locale,`narrow`),i=Pe(e.locale,`long`);for(let t=0;t<7;t++){let a=(e.weekStart+t)%7,o=i[a]??``,s=T(`th`,`dp-ui__weekday`,{role:`columnheader`,scope:`col`,abbr:o,title:o});s.textContent=r[a]??``,n.appendChild(s)}return t.appendChild(n),t},na=(e,t)=>{let n=T(`table`,`dp-ui__month-grid`,{role:`grid`});t.multiselectable===!0&&n.setAttribute(`aria-multiselectable`,`true`);let r=T(`caption`,t.headingVisible?`dp-ui__month-subhead`:`dp-ui__month-heading ${ea}`);r.textContent=B(e.view,t.locale),n.appendChild(r),n.appendChild(ta(t));let i=T(`tbody`);return e.weeks.forEach((n,r)=>{let a=T(`tr`,`dp-ui__week`);if(t.weekNumbers){let n=T(`th`,`dp-ui__week-number`,{scope:`row`}),i=e.weekNumbers.at(r);n.textContent=i===void 0?``:I(i,t.locale),a.appendChild(n)}n.forEach(e=>a.appendChild($i(e,t))),i.appendChild(a)}),n.appendChild(i),n},ra=(e,t)=>{e.querySelectorAll(`td[data-date]`).forEach(e=>{let n=h(e.dataset.date??``);n!==null&&Zi(e,n,e.classList.contains(zi),t)})},ia=(e,n,r)=>{let i={year:e.year,month:e.month,day:1},o=(a(i)-n+7)%7,s=r?6:Math.ceil((o+u(e))/7),c=E(i,-o),l=(4-n+7)%7,d=[],f=[];for(let n=0;n<s;n++){let r=E(c,n*7),i=[];for(let t=0;t<7;t++){let n=E(r,t);i.push({date:n,inMonth:n.year===e.year&&n.month===e.month})}d.push(i),f.push(t(E(r,l)))}return{view:e,weeks:d,weekNumbers:f}},aa=`table.dp-ui__month-grid`,oa=e=>{let{core:t,layout:n,gridContext:r}=e,{months:i}=t.layout,{showOutside:a,outsideSelectable:o,headingVisible:s}=r(),c=n===`modal`||a||t.options.fixedWeeks,l=n===`docked`,u=T(`div`,void 0,{"data-panel":`days`}),f=e=>ia(e,t.options.weekStart,c),p=e=>Array.from({length:i},(t,n)=>d(e,n)),m=e=>{let t=r();if(i===1)return na(f(e),t);let n=T(`div`,`dp-ui__months`);return n.append(...p(e).map(e=>na(f(e),t))),n},g=e=>{let r=T(`div`);if(n===`modal`){let{locale:n,labels:i}=t.options;r.append(Nr(e,n,i,t.instanceId))}return r.append(m(e)),r},_=e=>Math.max(...p(e).map(e=>f(e).weeks.length)),v=e=>{let t=_(e),n=u.querySelector(aa),r=n?.tHead?.getBoundingClientRect().height??0,i=(n?.tBodies.item(0)?.rows.item(0))?.getBoundingClientRect().height??0,a=s?n?.caption?.getBoundingClientRect().height??0:0;return r>0&&i>0?a+r+i*t:(t+(s?2:1))*48},y=new Li(u,{rtl:e.rtl,swipe:t.options.swipe,animate:t.options.animation,fitHeight:l,step:t.options.pageBy===`view`?i:1,renderPage:g,pageHeight:v,onCommit:(t,n)=>{e.onCommit(t,n)}}),b=()=>u.ownerDocument.activeElement,x=e=>{if(!(e instanceof Element))return null;let t=e.closest(`td.dp-ui__date[data-date]`);if(t===null||!u.contains(t)||t.classList.contains(`dp-ui__date--outside-month`)&&!o)return null;let n=h(t.getAttribute(`data-date`)??``);return n===null?null:{element:t,date:n}},S=()=>x(b())!==null,C=e=>u.querySelector(`.dp-ui__page:not([inert])`)?.querySelector(e)??null,w=e=>{let t=C(`td.dp-ui__date[tabindex="0"]`);return t!==null||!e?t:C(`td.dp-ui__date[data-date]:not(.dp-ui__date--outside-month)`)},ee=e=>{w(e)?.focus({preventScroll:!0})},te=()=>{let e=b();return e===null||!u.contains(e)?null:{buttonClass:vr(e)}},ne=e=>{let{buttonClass:t}=e;((t===null?null:C(`.${t}`))??w(!0))?.focus({preventScroll:!0})},E=e=>{let t=te();e(),t!==null&&ne(t)};return{element:u,present:(e,t)=>{E(()=>{t===0?y.show(e):y.slide(e,t>0?1:-1)})},finish:()=>{y.finish()},refresh:()=>{let e=r();u.querySelectorAll(aa).forEach(t=>{ra(t,e)})},refit:()=>{if(!l||u.hidden)return;let e=`${String(v(t.view))}px`;u.style.getPropertyValue(`--dp-ui-pager-height`)!==e&&E(()=>{y.show(t.view)})},cellAt:x,focusCell:ee,cellHasFocus:S,find:C,destroy:()=>{y.destroy()}}},sa=e=>{let t=document.createElement(`div`);t.className=e.className,t.setAttribute(`role`,`listbox`),t.setAttribute(`aria-label`,e.label);let n=[],r=e.focused>=0&&e.focused<e.items.length?e.focused:0,i=(e,r)=>{let i=n.at(Math.max(0,Math.min(n.length-1,r)));i&&(n.at(e)?.setAttribute(`tabindex`,`-1`),i.setAttribute(`tabindex`,`0`),i.focus({preventScroll:!0}),D(t,i,`nearest`))},a=e=>{let n=getComputedStyle(t).direction===`rtl`?-1:1;switch(e){case`ArrowRight`:return n;case`ArrowLeft`:return-n;case`ArrowDown`:return 3;case`ArrowUp`:return-3;default:return null}};return e.items.forEach((o,s)=>{let c=document.createElement(`button`);c.type=`button`,c.className=e.itemClass,c.setAttribute(`role`,`option`),c.setAttribute(`aria-selected`,o.selected?`true`:`false`),c.setAttribute(`aria-label`,o.name),c.setAttribute(`tabindex`,s===r?`0`:`-1`),o.selected&&c.classList.add(`${e.itemClass}--selected`),o.current&&c.classList.add(`${e.itemClass}--current`),o.disabled&&c.setAttribute(`aria-disabled`,`true`),c.textContent=o.label;let l=()=>{o.disabled||o.onPick()};c.addEventListener(`click`,l),c.addEventListener(`keydown`,e=>{let t=a(e.key);t===null?e.key===`Home`?(e.preventDefault(),i(s,0)):e.key===`End`?(e.preventDefault(),i(s,n.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l()):(e.preventDefault(),i(s,s+t))}),n.push(c),t.appendChild(c)}),requestAnimationFrame(()=>{let i=t.querySelector(`.${e.itemClass}--selected`)??n.at(r);i&&D(t,i,`center`)}),t},ca=e=>{let t=z(e.locale,`short`),n=z(e.locale,`long`),r=I(e.year,e.locale);return sa({className:`dp-ui__month-selection`,itemClass:`dp-ui__month-selection-item`,label:e.label,focused:e.focused-1,items:t.map((t,i)=>{let a=i+1;return{label:t,name:`${n[i]??t} ${r}`,selected:a===e.selected,current:e.current.year===e.year&&e.current.month===a,disabled:e.isDisabled(a),onPick:()=>{e.onPick(a)}}})})},la=e=>{let t=e.querySelector(`.dp-ui__menu-item--selected`);t&&D(e,t,`center`)},ua=(e,t,n)=>{let r=e.at(Math.max(0,Math.min(e.length-1,n))),i=e.at(t);r&&(i?.setAttribute(`tabindex`,`-1`),r.setAttribute(`tabindex`,`0`),r.focus({preventScroll:!0}),r.parentElement&&D(r.parentElement,r,`nearest`))},da=(e,t,n)=>{let r=document.createElement(`ul`);r.className=`dp-ui__menu dp-ui__menu--${e}`,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-label`,t);let i=n.some(e=>e.selected),a=n.map((e,t)=>{let n=document.createElement(`li`);n.className=`dp-ui__menu-item`,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,e.selected?`true`:`false`);let r=e.selected||!i&&t===0;if(n.setAttribute(`tabindex`,r?`0`:`-1`),e.selected){n.classList.add(`dp-ui__menu-item--selected`);let e=document.createElement(`span`);e.innerHTML=J.check;let t=e.firstElementChild;t&&(t.setAttribute(`class`,`dp-ui__menu-item-icon`),t.setAttribute(`aria-hidden`,`true`),n.appendChild(t))}e.disabled&&n.setAttribute(`aria-disabled`,`true`);let a=document.createElement(`span`);a.className=`dp-ui__menu-item-label`,a.textContent=e.label,n.appendChild(a);let s=()=>{e.disabled||e.onPick()};return n.addEventListener(`click`,s),n.addEventListener(`keydown`,e=>{e.key===`ArrowDown`?(e.preventDefault(),ua(o,t,t+1)):e.key===`ArrowUp`?(e.preventDefault(),ua(o,t,t-1)):e.key===`Home`?(e.preventDefault(),ua(o,t,0)):e.key===`End`?(e.preventDefault(),ua(o,t,o.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}),n}),o=a;return a.forEach(e=>r.appendChild(e)),requestAnimationFrame(()=>{la(r)}),r},fa=e=>{let t=z(e.locale,`long`);return da(`month`,e.label,t.map((t,n)=>{let r=n+1;return{label:t,selected:r===e.view.month,disabled:e.isMonthDisabled({year:e.view.year,month:r}),onPick:()=>{e.onPick(r)}}}))},pa=e=>sa({className:`dp-ui__year-selection`,itemClass:`dp-ui__year-selection-item`,label:e.label,focused:e.years.indexOf(e.focused),items:e.years.map(t=>{let n=I(t,e.locale);return{label:n,name:n,selected:t===e.selected,current:t===e.currentYear,disabled:!1,onPick:()=>{e.onPick(t)}}})}),ma=e=>da(`year`,e.label,e.years.map(t=>({label:I(t,e.locale),selected:t===e.view.year,disabled:!1,onPick:()=>{e.onPick(t)}}))),ha=e=>{let{min:t,max:n}=e.yearBounds(),r=[];for(let e=t;e<=n;e++)r.push(e);return r},ga=(e,t)=>{let n=F(e.draft);return n?.year===t?n.month:null},_a=(e,t,n)=>(e.setAttribute(`data-panel`,t),e.id=Y(n,t),e),va=(e,t)=>{let{core:n,rules:r}=t,{labels:i,locale:a}=n.options,s=n.view,{precision:c}=n.options,l=e=>{t.actions.jumpTo(e,`menu`)},u=e=>{l({year:e,month:n.view.month})};switch(e){case`month-menu`:return[_a(fa({locale:a,view:s,label:i.chooseMonth,isMonthDisabled:e=>r.isMonthDisabled(e),onPick:e=>{l({year:n.view.year,month:e})}}),e,n.instanceId)];case`year-menu`:return[_a(ma({view:s,years:ha(r),label:i.chooseYear,locale:a,onPick:u}),e,n.instanceId)];case`month-grid`:{let u=c===`month`,d=u?ga(n,s.year):s.month,f=_a(ca({year:s.year,selected:d,focused:d??s.month,current:o(),locale:a,label:i.chooseMonth,isDisabled:e=>r.isMonthDisabled({year:n.view.year,month:e}),onPick:e=>{u?t.actions.select({year:n.view.year,month:e,day:1}):l({year:n.view.year,month:e})}}),e,n.instanceId);return t.layout===`docked`?[f]:[Pr(s,a,i,n.instanceId),f]}case`year-grid`:{let l=c===`year`,d=l?F(n.draft)?.year??null:s.year,f=_a(pa({selected:d,focused:d??s.year,years:ha(r),currentYear:o().year,label:i.chooseYear,locale:a,onPick:l?e=>{t.actions.select({year:e,month:1,day:1})}:u}),e,n.instanceId);return t.layout===`docked`||l?[f]:[Fr(s,a,i,n.instanceId),f]}}},ya=`[role="option"]`,ba=e=>{let{root:t,content:n,days:r}=e,i=`days`,a=[],o=null,s=()=>t.ownerDocument.activeElement,c=e=>{e===`days`?r.hidden=!0:(a.forEach(e=>{e.remove()}),a=[])},l=t=>{t===`days`?r.hidden=!1:(a=e.createParts(t),r.after(...a))},u=()=>{let e=o;e!==null&&(o=null,e.complete(),e.animations.forEach(e=>{e.cancel()}))},d=()=>{let e=o;o=null,e?.animations.forEach(e=>{e.cancel()})},f=(t,n,r)=>{let i=e.motion()===`none`?[]:t.filter(e=>!e.hidden&&typeof e.animate==`function`);if(i.length===0){r();return}let a=i.map(e=>e.animate([{opacity:1},{opacity:0}],{duration:n,easing:`linear`,fill:`forwards`})),s={animations:a,complete:r};o=s,Promise.all(a.map(e=>e.finished)).then(()=>{o===s&&u()},()=>void 0)},p=()=>{let e=r.getBoundingClientRect().height;e>0&&n.style.setProperty(`--dp-ui-panel-height`,`${String(e)}px`)},m=n=>{u();let o=i;if(n===o)return;o===`days`&&p();let d=t.contains(s()),m=n===`input`||o===`input`;i=n;let h=()=>{let t=()=>{c(o),l(n),e.onSwitched(n,o,d)};e.swap===void 0?t():e.swap(t,n,o)};m?h():f(o===`days`?[r]:a,C.PANEL_FADE_OUT,h)},h=e=>{d(),e!==i&&(c(i),i=e,l(e))},g=e=>{let t=e.closest(`[role="listbox"]`);return t===null?-1:Array.from(t.querySelectorAll(ya)).indexOf(e)},_=e=>{for(let t of a){let n=e(t);if(n)return n}return null},v=(e,t)=>t>=0?_(e=>Array.from(e.querySelectorAll(ya)).at(t)):e===null?null:_(t=>t.querySelector(`.${e}`));return{current:()=>i,settled:()=>o===null,mount:h,switchTo:m,rebuild:()=>{if(i===`days`||i===`input`||o!==null)return;let e=s(),t=e!==null&&a.some(t=>t.contains(e))?e:null,n=t===null?null:vr(t),r=t===null?-1:g(t),u=a.map(e=>e.scrollTop);c(i),l(i),a.forEach(e=>{e.setAttribute(`data-rebuilt`,``)}),requestAnimationFrame(()=>{a.forEach((e,t)=>{e.scrollTop=u.at(t)??e.scrollTop})}),t!==null&&v(n,r)?.focus({preventScroll:!0})},entry:()=>{for(let e of a){let t=e.querySelector(`[tabindex="0"]`);if(t!==null)return t}return null},destroy:d}},xa=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,layout:o}=e,s=n.options,c=Wr(n,o,a),l=oa({core:n,layout:o,rtl:e.rtl,gridContext:()=>zr(n,i,o),onCommit:(e,t)=>{r.page(e,t)}}),u=T(`div`,`dp-ui__content`);u.append(l.element);let d=ba({root:t,content:u,days:l.element,motion:e.motion,createParts:e=>e===`input`?yi({core:n,actions:r,rules:i}):va(e,{core:n,actions:r,rules:i,layout:o}),swap:(r,i,a)=>{let o=wr(t);o===null||i!==`input`&&a!==`input`?r():pi(o,()=>{r(),Dr(o,i,n.layout.months)},e.motion())},onSwitched:e.onSwitched}),f=hr({labels:s.labels,visible:s.footerExplicit??a!==`inline`,todayButton:s.todayButton,clearButton:s.clearButton!==!1}),p=T(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`});return t.replaceChildren(c.element,u,f,p),{header:c,pages:l,panels:d,liveRegion:p}},Sa=[`.dp-ui__icon-button`,`.dp-ui__menu-button`,`.dp-ui__text-button`,`.dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator`,`.dp-ui__menu-item`,`.dp-ui__year-selection-item`,`.dp-ui__month-selection-item`].join(`, `),Ca=e=>{let{core:t,actions:n,rules:r,mode:i}=e,a=i===`modal`?`modal`:`docked`,o=new AbortController,s=T(`div`,`dp-ui__calendar`),c,l=0,u=()=>s.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,d=()=>wr(s),f=()=>_(t.options.precision),p=e=>c.pages.cellAt(e),m=(e,n=!0)=>{c.header.docked?.setPanel(e);let r=d();r!==null&&(r.classList.toggle(xr,Tr(e,f())),n&&Dr(r,e,t.layout.months))},h=e=>{e===null?c.pages.focusCell(!0):e.focus({preventScroll:!0})},g=e=>{let t=Ur(e);return t===null?null:c.header.element.querySelector(t)??c.pages.find(t)},v=(e,t,n)=>{e===`days`&&c.pages.refit(),n&&h(e===`days`?t===`input`?null:g(t):c.panels.entry())},y=()=>{c=xa({root:s,core:t,actions:n,rules:r,mode:i,layout:a,rtl:u(),motion:()=>In(t.options.animation),onSwitched:v}),c.pages.present(t.view,0),c.panels.mount(t.panel),m(t.panel),c.header.modal?.setInputView(t.panel===`input`),mr(s,ge(t.draft)),cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=0,m(c.panels.current()),c.pages.refit()})},b=()=>{c.panels.destroy(),c.pages.destroy(),c.header.modal?.destroy()},x=()=>{o.signal.aborted||(m(c.panels.current()),c.pages.refit(),h(c.panels.entry()))},S=(e,n,r)=>{c.header.docked?.setView(e);let i=r!==`api`&&c.panels.current()===`days`&&c.panels.settled();c.pages.present(e,i?n:0),c.panels.rebuild(),r!==`api`&&Ln(c.liveRegion,Br(t,e))},C=()=>{let e=c.pages.cellHasFocus();c.pages.refresh(),e&&c.pages.focusCell(!1)},w=e=>{c.pages.finish(),m(e,!1),c.header.modal?.setInputView(e===`input`),c.header.modal?.setText(Z(t)),c.panels.switchTo(e)},ee=()=>{c.pages.refresh(),c.panels.rebuild(),c.header.modal?.setText(Z(t)),mr(s,ge(t.draft)),c.panels.current()===f()&&Ln(c.liveRegion,Z(t))};return y(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{S(e.view,e.delta,e.source)},e),r.on(`change:draft`,ee,e),r.on(`change:focus`,C,e),r.on(`change:panel`,e=>{w(e.panel)},e),br(s,e,{actions:n,panel:()=>t.panel,home:f(),cellAt:p}),ei(s,e,{core:t,actions:n,layout:a,home:f(),cellAt:p,isRtl:u}),sr(s,Sa,e)})(o.signal),{element:s,focusInitial:x,update:()=>{if(o.signal.aborted)return;let e=s.contains(s.ownerDocument.activeElement);b(),y(),e&&x()},destroy:()=>{if(o.signal.aborted)return;o.abort(),cancelAnimationFrame(l),b();let e=d();e!==null&&(e.classList.remove(xr,Sr),Er(e,1)),s.remove()}}},wa=e=>({year:e.year,month:e.month}),Ta=e=>{let t=F(e.draft);return t===null?e.view:wa(t)},Ea=(e,t)=>{let{minDate:n,maxDate:r}=e.options,i=t.yearBounds(),a={year:i.min,month:1},o={year:i.max,month:12},s=n!==null&&y(a,n)>0,c=r!==null&&y(r,o)>0;return{first:s?wa(n):a,last:c?wa(r):o}},Da=(e,t)=>y(t.first,e)<0?t.first:y(e,t.last)<0?t.last:e,Oa=e=>{let t=T(`div`,`dp-ui__top-bar`);return t.append(X(`close`,e.close,J.close),fr(`save`,e.save)),t},ka=e=>{let{labels:t,switchView:n}=e,r=T(`div`,`dp-ui__header dp-ui__header--range`),i=e.fullscreen?Oa(t):null;i!==null&&r.append(i);let a=T(`div`,`dp-ui__header-text`),o=T(`div`,`dp-ui__supporting-text`);o.textContent=t.rangeTitle;let s=jr(e.text,e.animate);a.append(o,s.element),r.append(a);let c=n===null?null:pr(t,n.panelId);return c!==null&&r.append(c.button),{element:r,setText:e=>{s.setText(e)},setInputView:e=>{i!==null&&(i.hidden=e),c?.setInputView(e)},destroy:()=>{s.destroy()}}},Aa=(e,t)=>{let n=T(`div`,`dp-ui__weekdays-bar`,{"aria-hidden":`true`}),r=Pe(e,`narrow`);for(let e=0;e<7;e++){let i=T(`span`,`dp-ui__weekday`);i.textContent=r.at((t+e)%7)??``,n.append(i)}return n},ja=(e,t)=>t===`x`?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight,Ma=(e,t)=>t===`x`?e.clientX:e.clientY,Na=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},Pa=(e,t,n)=>{t===`x`?e.scrollLeft+=n:e.scrollTop+=n},Fa=(e,t,n=`x`,r={})=>{let i=null,a=0,o=0,s=0,c=!1;n===`x`&&e.addEventListener(`wheel`,t=>{ja(e,n)&&(Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(t.preventDefault(),e.scrollLeft+=t.deltaY))},{signal:t,passive:!1}),e.addEventListener(`pointerdown`,t=>{t.pointerType===`mouse`&&t.button===0&&ja(e,n)&&(i=t.pointerId,a=Ma(t,n),o=a,s=0,c=!1)},{signal:t}),e.addEventListener(`pointermove`,t=>{if(t.pointerId!==i)return;let r=Ma(t,n);s=r-a,!(!c&&Math.abs(s)<k.DRAG_START_PX)&&(c||(c=!0,Na(e,t.pointerId)),Pa(e,n,o-r),o=r)},{signal:t}),e.addEventListener(`selectstart`,e=>{i!==null&&e.preventDefault()},{signal:t});let l=t=>{t.pointerId===i&&(i=null,e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId),c&&t.type===`pointerup`&&s!==0&&r.onDragEnd?.(s<0?1:-1))};e.addEventListener(`pointerup`,l,{signal:t}),e.addEventListener(`pointercancel`,l,{signal:t}),e.addEventListener(`click`,e=>{c&&(c=!1,e.stopPropagation(),e.preventDefault())},{signal:t,capture:!0})},Ia=(e,t,n)=>({...Rr(e,t,!1),outsideSelectable:!1,weekNumbers:!1,headingVisible:!0,weekdaysVisible:n,rangeRole:t=>be(e.draft,t)}),La=(e,t,n)=>na(ia(n,e.options.weekStart,!1),Ia(e,t,!1)),Ra=`td.dp-ui__date[data-date]`,za=e=>{let{core:t,rules:n}=e,r=new AbortController,i=T(`div`,`dp-ui__month-list`),a=[],o=null,s=0,c=!1,l=0,u=(t,n)=>Array.from({length:n},(n,r)=>e.render(d(t,r))),f=t=>{if(o===null)return;let n=d(o,a.length),r=y(n,e.bounds().last)+1,s=Math.min(t,r);if(s<=0)return;let c=u(n,s);a.push(...c),i.append(...c)},p=t=>{if(o===null)return;let n=y(e.bounds().first,o),r=Math.min(t,n);if(r<=0)return;let s=d(o,-r),c=u(s,r),l=i.scrollTop,f=i.scrollHeight;o=s,a.unshift(...c),i.prepend(...c),i.scrollTop=l+i.scrollHeight-f},m=t=>{if(o===null)return;let n=Da(t,e.bounds());p(y(n,o)),f(y(d(o,a.length-1),n))},h=e=>{if(o===null)return null;let t=y(o,e);return t<0?null:a.at(t)??null},g=t=>{let n=Da(t,e.bounds());m(n);let r=h(n);if(r===null)return;let a=r.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTop+=a},_=()=>{i.scrollTop<i.clientHeight&&p(6),i.scrollHeight-i.scrollTop-i.clientHeight<i.clientHeight&&f(6)},b=e=>{let t=i.getBoundingClientRect().top,n=a.map(e=>({table:e,top:e.getBoundingClientRect().top-t,height:e.getBoundingClientRect().height})),r=Math.max(n.reduce((e,t,n)=>t.top<=1?n:e,0),0),o=n.at(r);if(o===void 0)return null;let s=o.height>0?Math.max(-o.top,0)/o.height:0,c=n.at(r+1)?.table??o.table;return e===1?s>k.COMMIT_FRACTION?c:o.table:s<1-k.COMMIT_FRACTION?o.table:c},x=()=>{c&&(window.clearTimeout(l),c=!1,_())},S=e=>{x(),_();let n=b(e);if(n===null)return;let r=n.getBoundingClientRect().top-i.getBoundingClientRect().top;In(t.options.animation)===`full`?(c=!0,l=window.setTimeout(x,C.SNAP_SCROLL_FALLBACK),i.scrollTo({top:i.scrollTop+r,behavior:`smooth`})):i.scrollTop+=r},w=e=>{if(!(e instanceof Element))return null;let t=e.closest(Ra);return t!==null&&i.contains(t)?t:null},ee=e=>{m(wa(e));let t=i.querySelector(`${Ra}[data-date="${v(e)}"]`);t!==null&&(t.focus({preventScroll:!0}),D(i,t,`nearest`))},te=()=>{let e=Ia(t,n,!1);a.forEach(t=>{ra(t,e)})},ne=e.bounds(),E=Da(Ta(t),ne),re=Da(d(E,-2),ne),ie=Da(d(E,9),ne),ae=y(re,ie)+1;return ae>0&&(o=re,a.push(...u(re,ae)),i.append(...a)),i.addEventListener(`scroll`,()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,c||_()}))},{passive:!0,signal:r.signal}),i.addEventListener(`scrollend`,x,{signal:r.signal}),Fa(i,r.signal,`y`,{onDragEnd:S}),{element:i,scrollToMonth:g,refresh:te,cellAt:w,focusCell:ee,ensureMonth:m,reveal:g,present:(e,t,n)=>{n===`api`?g(e):m(e)},destroy:()=>{r.abort(),cancelAnimationFrame(s),s=0,window.clearTimeout(l),c=!1}}},Ba=e=>{let t=T(`div`,`dp-ui__navigation dp-ui__navigation--months`),n=cr(e);return t.append(X(`prev-month`,e.previousMonth,J.keyboardArrowLeft,n.previousMonth),X(`next-month`,e.nextMonth,J.keyboardArrowRight,n.nextMonth)),t},Va=e=>{let{core:t,actions:n,rules:r}=e,i=oa({core:t,layout:`docked`,rtl:e.rtl,gridContext:()=>Ia(t,r,!0),onCommit:(e,t)=>{n.page(e,t)}});return{element:i.element,cellAt:e=>i.cellAt(e)?.element??null,focusCell:e=>{let t=i.find(`td.dp-ui__date[data-date][data-date="${v(e)}"]`);t===null?i.focusCell(!0):t.focus({preventScroll:!0})},refresh:()=>{i.refresh()},reveal:()=>{i.refit()},present:(e,t,n)=>{i.present(e,n===`api`?0:t)},destroy:()=>{i.destroy()}}};function Ha(e){let t;try{t=e.value()}catch(e){return j(e),null}let n=kn(t,`range`,`day`);if(n?.mode!==`range`)return null;let{start:r,end:i}=n;return r===null||i===null?null:{start:r,end:i}}const Ua=e=>{let{core:t,actions:n,rules:r,signal:i}=e,{presets:a,labels:o,limits:s}=t.options,c=T(`div`,`dp-ui__presets`,{role:`group`,"aria-label":o.presets}),l=a.map(e=>{let t=T(`button`,`dp-ui__preset`,{type:`button`});return t.textContent=e.label,t}),u=l.map(()=>null);c.append(...l);let d=()=>{a.forEach((e,n)=>{let i=l[n],a=Ha(e);u[n]=a;let o=!1,c=!1;if(a!==null){let e={mode:`range`,...a};o=rn(e,s,e=>r.isDisabled(e)),c=ve(t.draft,e)}i.disabled=!o,i.setAttribute(`aria-pressed`,c?`true`:`false`)})};return c.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`button.dp-ui__preset`),r=l.findIndex(e=>e===t);if(r<0)return;let i=u[r];i!==null&&n.selectRange(i.start,i.end)},{signal:i}),Fa(c,i),d(),{element:c,refresh:d,setHidden:e=>{c.hidden=e}}},Wa=`dp-ui__container--range`,Ga=`dp-ui__container--fullscreen`,Ka=`dp-ui__container--presets`,qa=[Wa,Ka,Ga,Sr],Ja=(e,t)=>e.options.footerExplicit??t!==`inline`,Ya=(e,t)=>{let{core:n,actions:r,rules:i,rtl:a}=e,{labels:o,locale:s,weekStart:c}=n.options;if(n.layout.months>1){let e=Va({core:n,actions:r,rules:i,rtl:a});return t.append(Ba(o),e.element),e}let l=za({core:n,rules:i,render:e=>La(n,i,e),bounds:()=>Ea(n,i)});return t.append(Aa(s,c),l.element),l},Xa=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,fullscreen:o,signal:s}=e,c=n.options,l=ka({labels:c.labels,animate:c.animation,text:Z(n),fullscreen:o,switchView:c.viewSwitch?{panelId:Y(n.instanceId,`input`)}:null}),u=T(`div`,`dp-ui__range`,{"data-panel":`days`}),d=Ya(e,u),f=ba({root:t,content:t,days:u,motion:e.motion,createParts:e=>e===`input`?yi({core:n,actions:r,rules:i}):[],swap:e.swap,onSwitched:e.onSwitched}),p=hr({labels:c.labels,visible:Ja(n,a),todayButton:c.todayButton,clearButton:c.clearButton!==!1}),m=T(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`}),h=n.layout.presets===`none`?null:Ua({core:n,actions:r,rules:i,signal:s}),g=n.layout.presets===`column`;return t.replaceChildren(l.element,...h===null?[]:[h.element],u,p,m),{header:l,days:d,panels:f,liveRegion:m,applyChrome:e=>{let r=e===`input`;l.setInputView(r),l.setText(Z(n)),h?.setHidden(r);let i=wr(t);i!==null&&(i.classList.add(Wa),i.classList.toggle(Ka,g),i.classList.toggle(Ga,o&&!r),Dr(i,e,n.layout.months))},refreshPresets:()=>{h?.refresh()}}},Za=[`.dp-ui__icon-button`,`.dp-ui__text-button`,`.dp-ui__preset`,`.dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator`].join(`, `),Qa=e=>e===`input`?`input`:`days`,$a=e=>{let{core:t,actions:n,rules:r,mode:i,fullscreen:a}=e,o=new AbortController,s=T(`div`,`dp-ui__calendar`),c,l=0,u=null,d=()=>In(t.options.animation),f=()=>s.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,p=e=>{let t=c.days.cellAt(e),n=h(t?.dataset.date??``);return t===null||n===null?null:{element:t,date:n}},m=()=>{let{draft:e,value:n}=t,r=P(e)&&P(n);mr(s,ge(e)&&!r)},g=()=>{c.days.reveal(Ta(t))},_=(e,n,r)=>{e===`days`&&g(),r&&(e===`input`?c.panels.entry()?.focus({preventScroll:!0}):c.days.focusCell(t.focus))},v=(e,t)=>{let n=()=>{c.applyChrome(t),e()};u?.cancel(),u=null;let r=wr(s);r===null?n():u=pi(r,n,d())},y=()=>{c=Xa({root:s,core:t,actions:n,rules:r,mode:i,fullscreen:a,rtl:f(),signal:o.signal,motion:d,swap:v,onSwitched:_}),c.days.present(t.view,0,`api`),c.panels.mount(Qa(t.panel)),c.applyChrome(c.panels.current()),m(),cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=0,c.applyChrome(c.panels.current()),c.panels.current()===`days`&&g()})},b=()=>{u?.cancel(),u=null,c.panels.destroy(),c.days.destroy(),c.header.destroy()},x=()=>{if(o.signal.aborted)return;cancelAnimationFrame(l),l=0;let e=c.panels.current();c.applyChrome(e),e===`input`?c.panels.entry()?.focus({preventScroll:!0}):(g(),c.days.focusCell(t.focus))},S=()=>{c.days.refresh(),c.refreshPresets(),c.header.setText(Z(t)),m(),c.panels.current()===`days`&&Ln(c.liveRegion,Z(t))},C=()=>{let e=p(s.ownerDocument.activeElement)!==null;c.days.refresh(),e&&c.days.focusCell(t.focus)},w=(e,n,r)=>{let i=c.panels.current()===`days`&&c.panels.settled();c.days.present(e,i?n:0,r),r!==`api`&&t.layout.months>1&&Ln(c.liveRegion,Br(t,e))};return y(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{w(e.view,e.delta,e.source)},e),r.on(`change:draft`,S,e),r.on(`change:active-end`,()=>{c.days.refresh()},e),r.on(`change:value`,m,e),r.on(`change:focus`,C,e),r.on(`change:panel`,e=>{c.panels.switchTo(Qa(e.panel))},e),br(s,e,{actions:n,panel:()=>t.panel,home:`days`,cellAt:p}),ei(s,e,{core:t,actions:n,layout:`range`,home:`days`,cellAt:p,isRtl:f}),sr(s,Za,e)})(o.signal),{element:s,focusInitial:x,update:()=>{if(o.signal.aborted)return;let e=s.contains(s.ownerDocument.activeElement);b(),y(),e&&x()},destroy:()=>{if(o.signal.aborted)return;o.abort(),cancelAnimationFrame(l),b();let e=wr(s);e!==null&&(e.classList.remove(...qa),Er(e,1)),s.remove()}}};var eo=class{core;deps;mounted=null;generation=0;constructor(e,t,n){this.core=e,this.deps=n}get surface(){return this.mounted?.host.root??null}async mount(e){this.release();let t=this.createHost(e);if(t===null)return;let{core:n}=this,{options:r}=n,{actions:a,rules:o,theme:s}=this.deps,c=++this.generation;s.applyTo(t.root),Bn(t.root,r.animation);let l=pe()?1/0:window.innerWidth,u={core:n,actions:a,rules:o,mode:e,fullscreen:i(r.mode,e,l,r.fullscreenBelow)},d=r.mode===`range`?$a(u):Ca(u);this.mounted={mode:e,host:t,view:d,stopModality:Rn(t.root),stopSchemeWatch:e===`inline`?le(()=>{s.applyTo(t.root)}):()=>void 0},t.body.append(d.element),await t.open(),c===this.generation&&e!==`inline`&&d.focusInitial()}async unmount(){let e=this.mounted;if(e===null)return;let t=++this.generation;await e.host.close(),t===this.generation&&this.mounted===e&&this.release()}update(){let e=this.mounted;e!==null&&(this.deps.theme.applyTo(e.host.root),Bn(e.host.root,this.core.options.animation),e.view.update())}destroy(){this.generation+=1,this.release()}release(){let e=this.mounted;e!==null&&(this.mounted=null,e.view.destroy(),e.host.destroy(),e.stopModality(),e.stopSchemeWatch())}createHost(e){let{core:t}=this,{options:n}=t,{actions:r}=this.deps,i=Zn(n.labels,n.mode,n.precision);if(e===`inline`){let e=O(n.inline.container);return e===null?null:new se({container:e,label:i})}return e===`modal`?new ne({parent:O(n.appendTo)??t.host,label:i,allowPageScroll:n.allowPageScroll,onCancel:e=>{r.cancel(e)}}):new ae({host:t.host,anchor:t.input,instanceId:t.instanceId,rtl:getComputedStyle(t.input).direction===`rtl`,label:i,ignoreOutsideClick:n.behavior.ignoreOutsideClick,inside:t.endInput===null?[]:[t.endInput],onOutside:()=>{r.cancel(`outside`)},onEscape:()=>{r.cancel(`escape`)}})}},to=class{core;fields=[];initial;constructor(e){this.core=e,this.initial=e.value}bind(e){let{input:t}=this.core;this.initial=this.core.value;let n=this.splitEnd();this.bindField(t,n===null?null:`start`),n!==null&&this.bindField(n,`end`),this.fields.length!==0&&t.form?.addEventListener(`reset`,()=>{setTimeout(()=>{this.handleReset()},0)},{signal:e})}sync(){for(let e of this.fields)e.hidden.value=this.valueOf(e.end)}dispatchCommit(){let{input:e}=this.core;e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}restore(){for(let e of this.fields)e.hidden.remove(),e.input.setAttribute(`name`,e.name);this.fields=[]}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t){let n=e.getAttribute(`name`);n!==null&&n!==``&&(e.removeAttribute(`name`),this.fields.push({input:e,name:n,hidden:this.createHidden(e,n),end:t}))}valueOf(e){let{value:t,options:n}=this.core;if(e===null||t.mode!==`range`)return Yn(t,n.precision);let r=e===`start`?t.start:t.end;return r===null?``:Kt(r,`day`)}createHidden(e,t){let n=e.ownerDocument.createElement(`input`);return n.type=`hidden`,n.name=t,n.classList.add(`dp-ui__form-value`),e.insertAdjacentElement(`afterend`,n),n}writeFields(e){let{core:t}=this,{pattern:n,precision:r}=t.options,i=this.splitEnd();if(i===null||e.mode!==`range`){t.input.value=Wn(e,n,r);return}let a=e=>e===null?``:q(e,n,`day`);t.input.value=a(e.start),i.value=a(e.end)}handleReset(){let{core:e}=this,{mode:t}=e.options,n=this.initial.mode===t?this.initial:M(t);e.setValue(n),this.writeFields(n),this.sync()}};const no=`aria-describedby`,ro=e=>(e.getAttribute(no)??``).split(/\s+/).filter(e=>e!==``);function io(e,t,n,r){let i=T(`span`,`dp-ui__visually-hidden`,{id:n}),a=T(`span`,void 0,{"aria-live":`polite`}),o=T(`span`);return o.textContent=r,i.append(a,` `,o),t.append(i),e.setAttribute(no,[...ro(e),n].join(` `)),{setHint:e=>{o.textContent!==e&&(o.textContent=e)},setError:e=>{let t=e??``;a.textContent!==t&&(a.textContent=t)},destroy:()=>{i.remove();let t=ro(e).filter(e=>e!==n);t.length===0?e.removeAttribute(no):e.setAttribute(no,t.join(` `))}}}const ao=`dp-ui--error`;function oo(e,t,n){e.setAttribute(`aria-invalid`,`true`),t.classList.add(ao),e.setCustomValidity(n)}function so(e,t){e.removeAttribute(`aria-invalid`),t.classList.remove(ao),e.setCustomValidity(``)}function co(e,t,n){let r=e.trim(),i=t.trim();if(r===``&&i===``)return{kind:`empty`};let a=r===``?null:x(r,n);if(r!==``&&a===null)return{kind:`invalid`,field:`start`};let o=i===``?null:x(i,n);return i!==``&&o===null?{kind:`invalid`,field:`end`}:a===null||o===null?{kind:`partial`}:f(a,o)>0?{kind:`reversed`}:{kind:`range`,start:a,end:o}}var lo=class{core;emitter;deps;dirty=!1;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n}get end(){return this.core.options.mode===`range`?this.core.endInput:null}bind(e){let{end:t}=this;if(t!==null)for(let n of[this.core.input,t])n.addEventListener(`blur`,()=>{this.commit()},{signal:e}),n.addEventListener(`input`,()=>{this.dirty=!0,this.applyMask(n)},{signal:e}),n.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){let{end:t}=this;if(t===null)return;let n=e.mode===`range`?e:null;this.core.input.value=this.format(n?.start??null),t.value=this.format(n?.end??null),this.dirty=!1,this.clearError()}readInitial(){let{end:e}=this,t=M(`range`);if(e===null)return t;let n=this.readDate(this.core.input.value),r=this.readDate(e.value);return n===null||r===null||f(n,r)>0?t:{mode:`range`,start:n,end:r}}markInvalid(e){let{end:t}=this;if(t===null)return;let{input:n,host:r}=this.core;oo(n,r,e),oo(t,r,e),this.deps.describe(n,e),this.deps.describe(t,e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})}clearError(){let{end:e}=this;if(e===null)return;let{input:t,host:n}=this.core;so(t,n),so(e,n),this.deps.describe(t,null),this.deps.describe(e,null)}format(e){return e===null?``:q(e,this.core.options.pattern,`day`)}readDate(e){let{pattern:t}=this.core.options,n=Xn(e,`single`,`day`)??Jn(e,`single`,t,`day`);return n?.mode===`single`?n.date:null}applyMask(e){let{options:t}=this.core;if(!t.mask)return;let n=ce(e.value,t.pattern);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}commit(){let{end:e}=this;if(e===null||!this.dirty)return;let{options:t,input:n}=this.core,r=co(n.value,e.value,t.pattern);r.kind!==`partial`&&(r.kind===`empty`?this.settle(M(`range`)):r.kind===`invalid`?this.fail(r.field,`invalid-date`,t.labels.invalidDate):r.kind===`reversed`?this.fail(`end`,`invalid-date`,t.labels.invalidRange):this.commitRange(r.start,r.end))}commitRange(e,t){let{options:n}=this.core,r={mode:`range`,start:e,end:t},i=e=>this.deps.rules.unavailableReason(e),a=nn(r,n.limits,i);if(a===null){this.settle(r);return}let o=i(e)===null?`end`:`start`;this.fail(o,`unavailable-date`,vi(a,n),a)}settle(e){this.write(e),this.deps.onTyped(e)}fail(e,t,n,r){let i=e===`start`?this.core.input:this.end;if(i===null)return;this.clearError(),oo(i,this.core.host,n),this.deps.describe(i,n);let a=i.value;r===void 0?this.emitter.emit(`error`,{code:t,message:n,input:a}):this.emitter.emit(`error`,{code:t,message:n,input:a,reason:r})}},uo=class{core;emitter;deps;split;descriptions=/* @__PURE__ */ new Map;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n,this.split=new lo(e,t,{rules:n.rules,onTyped:e=>{n.onTyped(e)},describe:(e,t)=>{this.describe(e,t)}})}bind(e){if(this.describeFields(e),this.split.end!==null){this.split.bind(e);return}let{input:t}=this.core;t.addEventListener(`blur`,()=>{this.commit()},{signal:e}),t.addEventListener(`input`,()=>{this.applyMask()},{signal:e}),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){this.split.end===null?(this.core.input.value=Wn(e,this.core.options.pattern,this.core.options.precision),this.clearError()):this.split.write(e)}readInitial(){if(this.split.end!==null)return this.split.readInitial();let{mode:e,pattern:t,precision:n}=this.core.options,r=this.core.input.value;return Xn(r,e,n)??Jn(r,e,t,n)??M(e)}evaluate(e){let{mode:t,pattern:n,limits:r,precision:i}=this.core.options,a=Jn(e,t,n,i);if(a===null)return{kind:`invalid`};if(P(a))return{kind:`empty`};let o=nn(a,r,e=>this.deps.rules.unavailableReason(e));return o===null?{kind:`valid`,selection:a}:{kind:`unavailable`,selection:a,reason:o}}markInvalid(e){this.split.end===null?(this.showError(e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})):this.split.markInvalid(e)}destroy(){this.clearError(),this.split.clearError(),this.descriptions.forEach(e=>{e.destroy()}),this.descriptions.clear()}describeFields(e){let{input:t,host:n,instanceId:r}=this.core,{end:i}=this.split,a=()=>{let{pattern:e,precision:t,labels:n}=this.core.options;return Yt(e,t,g(n))},o=[[t,`input-description`]];i!==null&&o.push([i,`end-input-description`]);for(let[e,t]of o){let i=Y(r,t);this.descriptions.set(e,io(e,n,i,a()))}this.core.events.on(`change:options`,()=>{let e=a();this.descriptions.forEach(t=>{t.setHint(e)})},e)}describe(e,t){this.descriptions.get(e)?.setError(t)}applyMask(){let{input:e,options:t}=this.core;if(!t.mask||t.mode!==`single`||t.precision!==`day`)return;let n=ce(e.value,t.pattern);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}commit(){let e=this.core.input.value,t=this.evaluate(e);if(t.kind===`empty`)this.clearError(),this.deps.onTyped(M(this.core.options.mode));else if(t.kind===`valid`)this.write(t.selection),this.deps.onTyped(t.selection);else if(t.kind===`invalid`){let t=this.core.options.labels.invalidDate;this.showError(t),this.emitter.emit(`error`,{code:`invalid-date`,message:t,input:e})}else{let{reason:n}=t,r=vi(n,this.core.options);this.showError(r),this.emitter.emit(`error`,{code:`unavailable-date`,message:r,input:e,reason:n})}}showError(e){oo(this.core.input,this.core.host,e),this.describe(this.core.input,e)}clearError(){so(this.core.input,this.core.host),this.describe(this.core.input,null)}};const fo=`dp-ui__container`,po=/\s+/;function mo(e){return e.split(po).filter(e=>e!==``)}var ho=class{core;tokens=[];constructor(e){this.core=e}applyHost(){this.core.host.setAttribute(`data-theme`,this.core.options.theme)}applyTo(e){let{options:t,input:n}=this.core;e.setAttribute(`data-theme`,t.theme),e.setAttribute(`data-color-scheme`,t.colorScheme===`auto`?ie(this.core.host):t.colorScheme),e.classList.remove(...this.tokens),this.tokens=mo(t.cssClass),e.classList.add(...this.tokens),(e.classList.contains(fo)?e:e.querySelector(`.${fo}`))?.classList.toggle(`dp-ui__container--rtl`,getComputedStyle(n).direction===`rtl`)}destroy(){this.core.host.removeAttribute(`data-theme`),this.tokens=[]}};const go=(e,t,n,r)=>{let i=N(e);return i.length===0?``:e.mode===`multiple`?nr(n,i.length,t):i.map(e=>Be(e,r,t,`long`)).join(Vn)},_o=`dp-ui__input--active`;var vo=class{core;deps;toggle=null;expanded=!1;release=null;constructor(e,t,n){this.core=e,this.deps=n}bind(e){if(this.releaseToggle(),this.core.options.inline.enabled||e.aborted)return;let{input:t}=this.core;this.bindField(t,`start`,e);let n=this.splitEnd();n!==null&&(this.bindField(n,`end`,e),this.core.events.on(`change:active-end`,()=>{this.markActive()},e)),this.bindToggle(e)}setExpanded(e){this.expanded=e,this.toggle?.setAttribute(`aria-expanded`,String(e)),this.markActive()}updateLabel(){if(this.toggle===null)return;let{labels:e,locale:t,precision:n}=this.core.options,r=go(this.core.value,t,e.multipleSelected,n),i=r===``?e.openCalendar:`${e.openCalendar}, ${r}`;this.toggle.setAttribute(`aria-label`,i)}destroy(){this.releaseToggle(),this.core.input.classList.remove(_o),this.core.endInput?.classList.remove(_o)}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t,n){let r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n}),e.addEventListener(`click`,()=>{let n=r;r=!1,(!this.expanded||n)&&this.request(`pointer`,t,e)},{signal:n}),e.addEventListener(`keydown`,n=>{n.altKey&&n.key===`ArrowDown`&&(n.preventDefault(),this.request(`keyboard`,t,e))},{signal:n})}markActive(){let e=this.splitEnd(),{input:t}=this.core;if(e===null){t.classList.remove(_o);return}let n=this.expanded?this.core.activeEnd:null;t.classList.toggle(_o,n===`start`),e.classList.toggle(_o,n===`end`)}request(e,t,n=this.core.input){n.disabled||this.deps.open(e,t)}bindToggle(e){let t=O(this.core.options.toggleButton,this.core.host);if(t===null)return;let n=/* @__PURE__ */ new Map,r=(e,r)=>{n.has(e)||n.set(e,t.getAttribute(e)),t.setAttribute(e,r)};r(`aria-haspopup`,`dialog`),t.tagName!==`BUTTON`&&(r(`role`,`button`),r(`tabindex`,`0`),t.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.request(`toggle`,`start`))},{signal:e})),t.addEventListener(`click`,()=>{this.request(`toggle`,`start`)},{signal:e}),this.toggle=t,r(`aria-expanded`,String(this.expanded)),r(`aria-label`,this.core.options.labels.openCalendar),this.updateLabel();let i=()=>{e.removeEventListener(`abort`,i),n.forEach((e,n)=>{e===null?t.removeAttribute(n):t.setAttribute(n,e)}),this.toggle===t&&(this.toggle=null),this.release===i&&(this.release=null)};this.release=i,e.addEventListener(`abort`,i,{once:!0})}releaseToggle(){this.release?.()}};function Q(e){return e.year*12+e.month-1}var yo=class{core;emitter;lists=null;constructor(e,t){this.core=e,this.emitter=t}isDisabled(e){return this.unavailableReason(e)!==null}unavailableReason(e){switch(this.core.options.precision){case`day`:return this.dayReason(e);case`month`:return this.monthReason(e);case`year`:return this.yearReason(e.year)}}isSelectable(e,t){return!this.isDisabled(e)&&!this.guardFor(t)(e)}isMonthDisabled(e){let t=u(e),n=m(e.year,e.month,1),r=m(e.year,e.month,t);if(n===null||r===null)return!0;let{minDate:i,maxDate:a}=this.core.options,o=this.yearBounds();if(e.year<o.min||e.year>o.max||i!==null&&f(r,i)<0||a!==null&&f(n,a)>0)return!0;for(let n=1;n<=t;n+=1)if(this.dayReason({year:e.year,month:e.month,day:n})===null)return!1;return!0}yearBounds(){let{minDate:e,maxDate:t,yearRange:n}=this.core.options,r=o(),i=r.year-n.before,a=r.year+n.after;return{min:e===null?i:Math.max(i,e.year),max:t===null?a:Math.min(a,t.year)}}clampView(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=r.min*12,a=r.max*12+11;t!==null&&(i=Math.max(i,Q(t))),n!==null&&(a=Math.min(a,Q(n)));let o=this.core.layout.months-1;o>0&&(a=Math.max(i,a-o));let s=Math.min(Math.max(Q(e),i),a),c=Math.floor(s/12);return{year:c,month:s-c*12+1}}destroy(){this.lists=null}monthReason(e){if(!this.isMonthDisabled(e))return null;let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=Q(e),a=r.min*12,o=r.max*12+11;return t!==null&&(a=Math.max(a,Q(t))),n!==null&&(o=Math.min(o,Q(n))),i<a?`min`:i>o?`max`:`disabled`}yearReason(e){let t=this.yearBounds();return e<t.min?`min`:e>t.max?`max`:null}dayReason(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds();if(t!==null&&f(e,t)<0||e.year<r.min)return`min`;if(n!==null&&f(e,n)>0||e.year>r.max)return`max`;let i=this.getLists(),o=v(e);return i.disabled.has(o)||i.enabled!==null&&!i.enabled.has(o)?`disabled`:i.source.disabledWeekdays.includes(a(e))?`weekday`:this.isCallbackDisabled(e,i)?`disabled`:null}isCallbackDisabled(e,t){let{isDateDisabled:n}=t.source;if(n===null)return!1;let r=v(e),i=t.callbackResults.get(r);if(i!==void 0)return i;let a=!1;try{a=n(s(e))}catch(e){j(e)}return t.callbackResults.set(r,a),a}guardFor(e){let t=this.getLists(),n=t.guardDraft;if(t.guard!==null&&n!==null&&ve(n,e))return t.guard;let{maxDate:r,limits:i}=t.source,a={year:this.yearBounds().max,month:12,day:31};r!==null&&f(r,a)<0&&(a=r);let o=$t(e,i,e=>this.isDisabled(e),a);return t.guardDraft=e,t.guard=o,o}getLists(){let e=this.core.options;if(this.lists?.source===e)return this.lists;let t={source:e,disabled:new Set(e.disabledDates.map(v)),enabled:e.enabledDates===null?null:new Set(e.enabledDates.map(v)),callbackResults:/* @__PURE__ */ new Map,guardDraft:null,guard:null};return this.lists=t,t}},bo=class{target=null;select=e=>{this.target?.select(e)};selectRange=(e,t)=>{this.target?.selectRange(e,t)};typeDraft=e=>{this.target?.typeDraft(e)};focusDate=e=>{this.target?.focusDate(e)};navigate=(e,t)=>{this.target?.navigate(e,t)};page=(e,t)=>{this.target?.page(e,t)};jumpTo=(e,t)=>{this.target?.jumpTo(e,t)};showPanel=e=>{this.target?.showPanel(e)};confirm=()=>{this.target?.confirm()};cancel=e=>{this.target?.cancel(e)};today=()=>{this.target?.today()};clear=()=>{this.target?.clear()};open=(e,t)=>{this.target?.open(e,t)};typed=e=>{this.target?.applyTyped(e)};connect(e){this.target=e}},xo=class{validation;theme;display;input;triggers;form;relay=new bo;constructor(e,t){this.validation=new yo(e,t),this.theme=new ho(e),this.display=new eo(e,t,{actions:this.relay,rules:this.validation,theme:this.theme}),this.input=new uo(e,t,{rules:this.validation,onTyped:this.relay.typed}),this.triggers=new vo(e,t,{open:this.relay.open}),this.form=new to(e)}connect(e){this.relay.connect(e)}destroy(){this.relay.connect(null),this.display.destroy(),this.triggers.destroy(),this.input.destroy(),this.form.restore(),this.theme.destroy(),this.validation.destroy()}};const $=/* @__PURE__ */ new Map,So=()=>void 0;var Co=class{core;emitter;lifecycle;constructor(e,t){let n=Lt(e);this.emitter=new me,this.core=new jt(n.input,n.host,n.createdHost,t),this.lifecycle=new Mn(this.core,this.emitter,new xo(this.core,this.emitter)),$.set(this.core.instanceId,this)}create(){this.lifecycle.create()}open(){this.lifecycle.open(`api`)}close(){this.lifecycle.close()}destroy(e){this.lifecycle.destroy(e?.keepInputValue??!1),$.get(this.core.instanceId)===this&&$.delete(this.core.instanceId)}getValue(){return this.lifecycle.getValue()}setValue(e){this.lifecycle.setValue(e)}setActiveEnd(e){this.lifecycle.setActiveEnd(e)}setOptions(e){this.lifecycle.setOptions(e)}getElement(){return this.core.host}on(e,t){return this.lifecycle.destroyed?So:this.emitter.on(e,t)}once(e,t){return this.lifecycle.destroyed?So:this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}get instanceId(){return this.core.instanceId}get options(){return this.core.rawOptions}get isInitialized(){return this.lifecycle.created}get isDestroyed(){return this.lifecycle.destroyed}static getById(e){return $.get(kt(e))}static getAllInstances(){return[...$.values()]}static destroyAll(){for(let e of[...$.values()])e.destroy()}},wo=Co;export{H as DEFAULT_DATEPICKER_OPTIONS,Co as DatepickerUI,me as EventEmitter,wo as default};
@@ -0,0 +1,101 @@
1
+ import { A as SurfaceMode, F as formatHint, I as resolvePattern, L as DatePart, M as FormatPattern, N as HintLetters, P as formatDate, U as PlainDate, j as FormatOption, z as CalendarMode } from "./shared.js";
2
+ //#region src/managers/renderers/SurfaceHost.d.ts
3
+ interface SurfaceHost {
4
+ readonly root: HTMLElement;
5
+ readonly body: HTMLElement;
6
+ open(): Promise<void>;
7
+ close(): Promise<void>;
8
+ destroy(): void;
9
+ }
10
+ export declare function waitForExit(element: HTMLElement): Promise<void>;
11
+ //#endregion
12
+ //#region src/managers/renderers/DialogHost.d.ts
13
+ export declare class DialogHost implements SurfaceHost {
14
+ readonly root: HTMLElement;
15
+ readonly body: HTMLElement;
16
+ private readonly dialog;
17
+ private readonly controller;
18
+ private readonly allowPageScroll;
19
+ private releaseScroll;
20
+ private openPromise;
21
+ private closePromise;
22
+ private pointerStartedOnBackdrop;
23
+ private destroyed;
24
+ constructor(options: {
25
+ parent: HTMLElement;
26
+ label: string;
27
+ allowPageScroll: boolean;
28
+ onCancel(reason: "escape" | "outside"): void;
29
+ });
30
+ open(): Promise<void>;
31
+ close(): Promise<void>;
32
+ destroy(): void;
33
+ private unlock;
34
+ }
35
+ //#endregion
36
+ //#region src/managers/renderers/InlineHost.d.ts
37
+ export declare class InlineHost implements SurfaceHost {
38
+ readonly root: HTMLElement;
39
+ readonly body: HTMLElement;
40
+ constructor(options: {
41
+ container: HTMLElement;
42
+ label: string;
43
+ });
44
+ open(): Promise<void>;
45
+ close(): Promise<void>;
46
+ destroy(): void;
47
+ }
48
+ //#endregion
49
+ //#region src/managers/renderers/PopoverHost.d.ts
50
+ export declare class PopoverHost implements SurfaceHost {
51
+ readonly root: HTMLElement;
52
+ readonly body: HTMLElement;
53
+ private readonly anchor;
54
+ private readonly anchorName;
55
+ private readonly rtl;
56
+ private readonly fallback;
57
+ private readonly controller;
58
+ private stopTracking;
59
+ private restoreAnchor;
60
+ private hasPopover;
61
+ private anchored;
62
+ private openPromise;
63
+ private closePromise;
64
+ private destroyed;
65
+ constructor(options: {
66
+ host: HTMLElement;
67
+ anchor: HTMLElement;
68
+ instanceId: string;
69
+ rtl: boolean;
70
+ label: string;
71
+ inside: readonly HTMLElement[];
72
+ ignoreOutsideClick: boolean;
73
+ onOutside(): void;
74
+ onEscape(): void;
75
+ });
76
+ open(): Promise<void>;
77
+ close(): Promise<void>;
78
+ destroy(): void;
79
+ private endTracking;
80
+ private show;
81
+ private hide;
82
+ private enableFallback;
83
+ private update;
84
+ }
85
+ //#endregion
86
+ //#region src/utils/surface.d.ts
87
+ export declare const resolveSurfaceMode: (option: "auto" | "docked" | "modal", inlineEnabled: boolean, viewportWidth: number, viewportHeight: number) => SurfaceMode;
88
+ export declare const isFullscreenRange: (mode: CalendarMode, surface: SurfaceMode, viewportWidth: number, fullscreenBelow: number) => boolean;
89
+ //#endregion
90
+ //#region src/utils/colorScheme.d.ts
91
+ type Scheme = "light" | "dark";
92
+ export declare function detectColorScheme(from: HTMLElement): Scheme;
93
+ export declare function watchColorScheme(onChange: () => void): () => void;
94
+ //#endregion
95
+ //#region src/utils/date/mask.d.ts
96
+ export declare function maskDateText(text: string, pattern: FormatPattern): string;
97
+ //#endregion
98
+ //#region src/utils/date/parse.d.ts
99
+ export declare function parseDate(text: string, pattern: FormatPattern): PlainDate | null;
100
+ //#endregion
101
+ export { type DatePart, type FormatOption, type FormatPattern, type HintLetters, type PlainDate, type Scheme, type SurfaceHost, type SurfaceMode, formatDate, formatHint, resolvePattern };
@@ -0,0 +1 @@
1
+ export{i as DialogHost,r as InlineHost,n as PopoverHost,l as detectColorScheme,b as formatDate,x as formatHint,E as isFullscreenRange,t as maskDateText,_ as parseDate,w as resolvePattern,D as resolveSurfaceMode,a as waitForExit,u as watchColorScheme}from"./shared.js";