forms-reactive
Version:
Reactive Form Web Component
8 lines • 49 kB
JavaScript
import{r as t,c as e,w as i,h as n,H as a,e as o}from"./p-3e1171f6.js";import{startFocusVisible as r}from"./p-731476bf.js";import{r as s,b as d,g as l}from"./p-c1432a35.js";import{b as c,p as h}from"./p-8613551a.js";import{i as p}from"./p-15a24f88.js";import{c as m}from"./p-100c2286.js";import{i as u,b as f,h as b,m as g,e as y}from"./p-6a27012a.js";import{g as x}from"./p-9c83f640.js";import{g as w,a as v,i as k,b as j,c as O,d as C,e as P,v as $,f as z,h as D,j as V,k as T,l as A,m as S,n as E,o as I,p as W,q as M,r as R,s as F,w as L,t as B,u as H,x as q,y as G,z as Y,A as N,B as K,C as U,D as Z,E as J,F as Q,G as _,H as X,I as tt,J as et,K as it,L as nt,M as at,N as ot,O as rt,P as st,Q as dt,R as lt}from"./p-3fa630be.js";
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/const ct=(t,e,i)=>{if(e&&e.year>t){return true}if(i&&i.year<t){return true}return false};const ht=(t,e,i,n)=>{if(t.day===null){return true}if(n!==undefined&&!n.includes(t.day)){return true}if(e&&k(t,e)){return true}if(i&&j(t,i)){return true}return false};const pt=(t,e,i,n,a,o,r)=>{const s=Array.isArray(i)?i:[i];const d=s.find((t=>O(e,t)))!==undefined;const l=O(e,n);const c=ht(e,a,o,r);return{disabled:c,isActive:d,isToday:l,ariaSelected:d?"true":null,ariaLabel:w(t,l,e),text:e.day!=null?v(t,e):null}};const mt=(t,{minParts:e,maxParts:i})=>{if(ct(t.year,e,i)){return true}if(e&&k(t,e)||i&&j(t,i)){return true}return false};const ut=(t,e,i)=>{const n=Object.assign(Object.assign({},C(t)),{day:null});return mt(n,{minParts:e,maxParts:i})};const ft=(t,e)=>{const i=Object.assign(Object.assign({},P(t)),{day:null});return mt(i,{maxParts:e})};const bt=(t,e,i)=>{if(Array.isArray(t)){const i=e.split("T")[0];const n=t.find((t=>t.date===i));if(n){return{textColor:n.textColor,backgroundColor:n.backgroundColor}}}else{try{return t(e)}catch(t){c("Exception thrown from provided `highlightedDates` callback. Please check your function and try again.",i,t)}}return undefined};
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/const gt=(t,e)=>{var i,n,a,o;if(((i=e===null||e===void 0?void 0:e.date)===null||i===void 0?void 0:i.timeZone)||((n=e===null||e===void 0?void 0:e.date)===null||n===void 0?void 0:n.timeZoneName)||((a=e===null||e===void 0?void 0:e.time)===null||a===void 0?void 0:a.timeZone)||((o=e===null||e===void 0?void 0:e.time)===null||o===void 0?void 0:o.timeZoneName)){h('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".',t)}};const yt=(t,e,i)=>{if(!i)return;switch(e){case"date":case"month-year":case"month":case"year":if(i.date===undefined){h(`Datetime: The '${e}' presentation requires a date object in formatOptions.`,t)}break;case"time":if(i.time===undefined){h(`Datetime: The 'time' presentation requires a time object in formatOptions.`,t)}break;case"date-time":case"time-date":if(i.date===undefined&&i.time===undefined){h(`Datetime: The '${e}' presentation requires either a date or time object (or both) in formatOptions.`,t)}break}};const xt=':host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:flex;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:flex}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:flex;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:flex;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:flex;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:inline-flex;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-light, #f4f5f8);--background-rgb:var(--ion-color-light-rgb, 244, 245, 248);--title-color:var(--ion-color-step-600, var(--ion-text-color-step-400, #666666))}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc));font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}.calendar-month-year-toggle{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;min-height:44px;font-size:min(1rem, 25.6px);font-weight:600}.calendar-month-year-toggle.ion-focused::after{opacity:0.15}.calendar-month-year-toggle #toggle-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:10px}:host .calendar-action-buttons .calendar-month-year-toggle ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, var(--ion-text-color-step-700, #b3b3b3));font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2);font-size:min(1.375rem, 35.2px)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, var(--ion-background-color-step-200, #cccccc))}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:flex;align-items:center;justify-content:space-between}:host .datetime-action-buttons{width:100%}';const wt=xt;const vt=':host{display:flex;flex-flow:column;background:var(--background);overflow:hidden}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{order:3;text-align:end}:host .wheel-order-year-first .month-column{order:2;text-align:end}:host .wheel-order-year-first .year-column{order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:flex;flex:1 1 auto;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:flex}:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:flex;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:flex}:host .calendar-action-buttons{display:flex;justify-content:space-between}:host .calendar-action-buttons ion-button{--background:transparent}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:flex;flex-grow:1;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:flex;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:flex;position:relative;align-items:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:flex;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:flex;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:flex;border:none;background:var(--ion-color-step-300, var(--ion-background-color-step-300, #edeef0));color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons .calendar-month-year-toggle{color:var(--ion-color-base)}.calendar-month-year{min-width:0}.calendar-month-year-toggle{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;position:relative;border:0;outline:none;background:transparent;cursor:pointer;z-index:1}.calendar-month-year-toggle::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:opacity 15ms linear, background-color 15ms linear;z-index:-1}.calendar-month-year-toggle.ion-focused::after{background:currentColor}.calendar-month-year-toggle:disabled{opacity:0.3;pointer-events:none}.calendar-month-year-toggle ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0;flex-shrink:0}.calendar-month-year-toggle #toggle-wrapper{display:inline-flex;align-items:center}ion-picker{--highlight-background:var(--wheel-highlight-background);--highlight-border-radius:var(--wheel-highlight-border-radius);--fade-background-rgb:var(--wheel-fade-background-rgb)}:host{--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #ffffff));--title-color:var(--ion-color-contrast)}:host .datetime-header{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:20px;padding-bottom:20px;background:var(--ion-color-base);color:var(--title-color)}:host .datetime-header .datetime-title{font-size:0.75rem;text-transform:uppercase}:host .datetime-header .datetime-selected-date{margin-top:30px;font-size:2.125rem}:host .calendar-action-buttons ion-button{--color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}.calendar-month-year-toggle{-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:12px;padding-bottom:12px;min-height:48px;background:transparent;color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959));z-index:1}.calendar-month-year-toggle.ion-focused::after{opacity:0.04}.calendar-month-year-toggle ion-ripple-effect{color:currentColor}@media (any-hover: hover){.calendar-month-year-toggle.ion-activatable:not(.ion-focused):hover::after{background:currentColor;opacity:0.04}}:host .calendar-days-of-week{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:0px;padding-bottom:0px;color:var(--ion-color-step-500, var(--ion-text-color-step-500, gray));font-size:0.875rem;line-height:36px}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:4px;padding-bottom:4px;grid-template-rows:repeat(6, 1fr)}:host .calendar-day{width:42px;min-width:42px;height:42px;font-size:0.875rem}:host .calendar-day.calendar-day-today{border:1px solid var(--ion-color-base);color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-contrast)}.calendar-day.calendar-day-active{border:1px solid var(--ion-color-base);background:var(--ion-color-base)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}:host .time-header{color:var(--ion-color-step-650, var(--ion-text-color-step-350, #595959))}:host(.datetime-presentation-month) .datetime-year,:host(.datetime-presentation-year) .datetime-year,:host(.datetime-presentation-month-year) .datetime-year{margin-top:20px;margin-bottom:20px}:host .datetime-buttons{-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px;padding-top:10px;padding-bottom:10px;display:flex;align-items:center;justify-content:flex-end}';const kt=vt;const jt=class{constructor(n){t(this,n);this.ionCancel=e(this,"ionCancel",7);this.ionChange=e(this,"ionChange",7);this.ionValueChange=e(this,"ionValueChange",7);this.ionFocus=e(this,"ionFocus",7);this.ionBlur=e(this,"ionBlur",7);this.ionStyle=e(this,"ionStyle",7);this.ionRender=e(this,"ionRender",7);this.inputId=`ion-dt-${Ot++}`;this.prevPresentation=null;this.warnIfIncorrectValueUsage=()=>{const{multiple:t,value:e}=this;if(!t&&Array.isArray(e)){h(`ion-datetime was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".\n\n Value Passed: [${e.map((t=>`'${t}'`)).join(", ")}]\n`,this.el)}};this.setValue=t=>{this.value=t;this.ionChange.emit({value:t})};this.getActivePartsWithFallback=()=>{var t;const{defaultParts:e}=this;return(t=this.getActivePart())!==null&&t!==void 0?t:e};this.getActivePart=()=>{const{activeParts:t}=this;return Array.isArray(t)?t[0]:t};this.closeParentOverlay=t=>{const e=this.el.closest("ion-modal, ion-popover");if(e){e.dismiss(undefined,t)}};this.setWorkingParts=t=>{this.workingParts=Object.assign({},t)};this.setActiveParts=(t,e=false)=>{if(this.readonly){return}const{multiple:i,minParts:n,maxParts:a,activeParts:o}=this;const r=$(t,n,a);this.setWorkingParts(r);if(i){const t=Array.isArray(o)?o:[o];if(e){this.activeParts=t.filter((t=>!O(t,r)))}else{this.activeParts=[...t,r]}}else{this.activeParts=Object.assign({},r)}const s=this.el.querySelector('[slot="buttons"]')!==null;if(s||this.showDefaultButtons){return}this.confirm()};this.initializeKeyboardListeners=()=>{const t=this.calendarBodyRef;if(!t){return}const e=this.el.shadowRoot;const i=t.querySelector(".calendar-month:nth-of-type(2)");const n=e=>{var n;const a=e[0];if(((n=a.oldValue)===null||n===void 0?void 0:n.includes("ion-focused"))||!t.classList.contains("ion-focused")){return}this.focusWorkingDay(i)};const a=new MutationObserver(n);a.observe(t,{attributeFilter:["class"],attributeOldValue:true});this.destroyKeyboardMO=()=>{a===null||a===void 0?void 0:a.disconnect()};t.addEventListener("keydown",(t=>{const n=e.activeElement;if(!n||!n.classList.contains("calendar-day")){return}const a=z(n);let o;switch(t.key){case"ArrowDown":t.preventDefault();o=W(a);break;case"ArrowUp":t.preventDefault();o=I(a);break;case"ArrowRight":t.preventDefault();o=E(a);break;case"ArrowLeft":t.preventDefault();o=S(a);break;case"Home":t.preventDefault();o=A(a);break;case"End":t.preventDefault();o=T(a);break;case"PageUp":t.preventDefault();o=t.shiftKey?V(a):C(a);break;case"PageDown":t.preventDefault();o=t.shiftKey?D(a):P(a);break;default:return}if(ht(o,this.minParts,this.maxParts)){return}this.setWorkingParts(Object.assign(Object.assign({},this.workingParts),o));requestAnimationFrame((()=>this.focusWorkingDay(i)))}))};this.focusWorkingDay=t=>{const e=t.querySelectorAll(".calendar-day-padding");const{day:i}=this.workingParts;if(i===null){return}const n=t.querySelector(`.calendar-day-wrapper:nth-of-type(${e.length+i}) .calendar-day`);if(n){n.focus()}};this.processMinParts=()=>{const{min:t,defaultParts:e}=this;if(t===undefined){this.minParts=undefined;return}this.minParts=M(t,e)};this.processMaxParts=()=>{const{max:t,defaultParts:e}=this;if(t===undefined){this.maxParts=undefined;return}this.maxParts=R(t,e)};this.initializeCalendarListener=()=>{const t=this.calendarBodyRef;if(!t){return}const e=t.querySelectorAll(".calendar-month");const n=e[0];const a=e[1];const o=e[2];const r=x(this);const s=r==="ios"&&typeof navigator!=="undefined"&&navigator.maxTouchPoints>1;i((()=>{t.scrollLeft=n.clientWidth*(p(this.el)?-1:1);const e=e=>{const i=t.getBoundingClientRect();const a=p(this.el)?t.scrollLeft>=-2:t.scrollLeft<=2;const r=a?n:o;const s=r.getBoundingClientRect();if(Math.abs(s.x-i.x)>2)return;const{forceRenderDate:d}=this;if(d!==undefined){return{month:d.month,year:d.year,day:d.day}}if(r===n){return C(e)}else if(r===o){return P(e)}else{return}};const r=()=>{if(s){t.style.removeProperty("pointer-events");l=false}const n=e(this.workingParts);if(!n)return;const{month:o,day:r,year:d}=n;if(mt({month:o,year:d,day:null},{minParts:Object.assign(Object.assign({},this.minParts),{day:null}),maxParts:Object.assign(Object.assign({},this.maxParts),{day:null})})){return}t.style.setProperty("overflow","hidden");i((()=>{this.setWorkingParts(Object.assign(Object.assign({},this.workingParts),{month:o,day:r,year:d}));t.scrollLeft=a.clientWidth*(p(this.el)?-1:1);t.style.removeProperty("overflow");if(this.resolveForceDateScrolling){this.resolveForceDateScrolling()}}))};let d;let l=false;const c=()=>{if(d){clearTimeout(d)}if(!l&&s){t.style.setProperty("pointer-events","none");l=true}d=setTimeout(r,50)};t.addEventListener("scroll",c);this.destroyCalendarListener=()=>{t.removeEventListener("scroll",c)}}))};this.destroyInteractionListeners=()=>{const{destroyCalendarListener:t,destroyKeyboardMO:e}=this;if(t!==undefined){t()}if(e!==undefined){e()}};this.processValue=t=>{const e=t!==null&&t!==undefined&&t!==""&&(!Array.isArray(t)||t.length>0);const i=e?F(t):this.defaultParts;const{minParts:n,maxParts:a,workingParts:o,el:r}=this;this.warnIfIncorrectValueUsage();if(!i){return}if(e){L(i,n,a)}const s=Array.isArray(i)?i[0]:i;const d=st(s,n,a);const{month:l,day:c,year:h,hour:p,minute:m}=d;const u=dt(p);if(e){if(Array.isArray(i)){this.activeParts=[...i]}else{this.activeParts={month:l,day:c,year:h,hour:p,minute:m,ampm:u}}}else{this.activeParts=[]}const f=l!==undefined&&l!==o.month||h!==undefined&&h!==o.year;const b=r.classList.contains("datetime-ready");const{isGridStyle:g,showMonthAndYear:y}=this;let x=true;if(Array.isArray(i)){const t=i[0].month;for(const e of i){if(e.month!==t){x=false;break}}}if(x){if(g&&f&&b&&!y){this.animateToDate(d)}else{this.setWorkingParts({month:l,day:c,year:h,hour:p,minute:m,ampm:u})}}};this.animateToDate=async t=>{const{workingParts:e}=this;this.forceRenderDate=t;const i=new Promise((t=>{this.resolveForceDateScrolling=t}));const n=k(t,e);n?this.prevMonth():this.nextMonth();await i;this.resolveForceDateScrolling=undefined;this.forceRenderDate=undefined};this.onFocus=()=>{this.ionFocus.emit()};this.onBlur=()=>{this.ionBlur.emit()};this.hasValue=()=>this.value!=null;this.nextMonth=()=>{const t=this.calendarBodyRef;if(!t){return}const e=t.querySelector(".calendar-month:last-of-type");if(!e){return}const i=e.offsetWidth*2;t.scrollTo({top:0,left:i*(p(this.el)?-1:1),behavior:"smooth"})};this.prevMonth=()=>{const t=this.calendarBodyRef;if(!t){return}const e=t.querySelector(".calendar-month:first-of-type");if(!e){return}t.scrollTo({top:0,left:0,behavior:"smooth"})};this.toggleMonthAndYearView=()=>{this.showMonthAndYear=!this.showMonthAndYear};this.showMonthAndYear=false;this.activeParts=[];this.workingParts={month:5,day:28,year:2021,hour:13,minute:52,ampm:"pm"};this.isTimePopoverOpen=false;this.forceRenderDate=undefined;this.color="primary";this.name=this.inputId;this.disabled=false;this.formatOptions=undefined;this.readonly=false;this.isDateEnabled=undefined;this.min=undefined;this.max=undefined;this.presentation="date-time";this.cancelText="Cancel";this.doneText="Done";this.clearText="Clear";this.yearValues=undefined;this.monthValues=undefined;this.dayValues=undefined;this.hourValues=undefined;this.minuteValues=undefined;this.locale="default";this.firstDayOfWeek=0;this.titleSelectedDatesFormatter=undefined;this.multiple=false;this.highlightedDates=undefined;this.value=undefined;this.showDefaultTitle=false;this.showDefaultButtons=false;this.showClearButton=false;this.showDefaultTimeLabel=true;this.hourCycle=undefined;this.size="fixed";this.preferWheel=false}formatOptionsChanged(){const{el:t,formatOptions:e,presentation:i}=this;yt(t,i,e);gt(t,e)}disabledChanged(){this.emitStyle()}minChanged(){this.processMinParts()}maxChanged(){this.processMaxParts()}presentationChanged(){const{el:t,formatOptions:e,presentation:i}=this;yt(t,i,e)}get isGridStyle(){const{presentation:t,preferWheel:e}=this;const i=t==="date"||t==="date-time"||t==="time-date";return i&&!e}yearValuesChanged(){this.parsedYearValues=B(this.yearValues)}monthValuesChanged(){this.parsedMonthValues=B(this.monthValues)}dayValuesChanged(){this.parsedDayValues=B(this.dayValues)}hourValuesChanged(){this.parsedHourValues=B(this.hourValues)}minuteValuesChanged(){this.parsedMinuteValues=B(this.minuteValues)}async valueChanged(){const{value:t}=this;if(this.hasValue()){this.processValue(t)}this.emitStyle();this.ionValueChange.emit({value:t})}async confirm(t=false){const{isCalendarPicker:e,activeParts:i,preferWheel:n,workingParts:a}=this;if(i!==undefined||!e){const t=Array.isArray(i);if(t&&i.length===0){if(n){this.setValue(H(a))}else{this.setValue(undefined)}}else{this.setValue(H(i))}}if(t){this.closeParentOverlay(Pt)}}async reset(t){this.processValue(t)}async cancel(t=false){this.ionCancel.emit();if(t){this.closeParentOverlay(Ct)}}get isCalendarPicker(){const{presentation:t}=this;return t==="date"||t==="date-time"||t==="time-date"}connectedCallback(){this.clearFocusVisible=r(this.el).destroy}disconnectedCallback(){if(this.clearFocusVisible){this.clearFocusVisible();this.clearFocusVisible=undefined}}initializeListeners(){this.initializeCalendarListener();this.initializeKeyboardListeners()}componentDidLoad(){const{el:t,intersectionTrackerRef:e}=this;const n=t=>{const e=t[0];if(!e.isIntersecting){return}this.initializeListeners();i((()=>{this.el.classList.add("datetime-ready")}))};const a=new IntersectionObserver(n,{threshold:.01,root:t});s((()=>a===null||a===void 0?void 0:a.observe(e)));const o=t=>{const e=t[0];if(e.isIntersecting){return}this.destroyInteractionListeners();this.showMonthAndYear=false;i((()=>{this.el.classList.remove("datetime-ready")}))};const r=new IntersectionObserver(o,{threshold:0,root:t});s((()=>r===null||r===void 0?void 0:r.observe(e)));const d=l(this.el);d.addEventListener("ionFocus",(t=>t.stopPropagation()));d.addEventListener("ionBlur",(t=>t.stopPropagation()))}componentDidRender(){const{presentation:t,prevPresentation:e,calendarBodyRef:i,minParts:n,preferWheel:a,forceRenderDate:o}=this;const r=!a&&["date-time","time-date","date"].includes(t);if(n!==undefined&&r&&i){const t=i.querySelector(".calendar-month:nth-of-type(1)");if(t&&o===undefined){i.scrollLeft=t.clientWidth*(p(this.el)?-1:1)}}if(e===null){this.prevPresentation=t;return}if(t===e){return}this.prevPresentation=t;this.destroyInteractionListeners();this.initializeListeners();this.showMonthAndYear=false;s((()=>{this.ionRender.emit()}))}componentWillLoad(){const{el:t,formatOptions:e,highlightedDates:i,multiple:n,presentation:a,preferWheel:o}=this;if(n){if(a!=="date"){h('Multiple date selection is only supported for presentation="date".',t)}if(o){h('Multiple date selection is not supported with preferWheel="true".',t)}}if(i!==undefined){if(a!=="date"&&a!=="date-time"&&a!=="time-date"){h("The highlightedDates property is only supported with the date, date-time, and time-date presentations.",t)}if(o){h('The highlightedDates property is not supported with preferWheel="true".',t)}}if(e){yt(t,a,e);gt(t,e)}const r=this.parsedHourValues=B(this.hourValues);const s=this.parsedMinuteValues=B(this.minuteValues);const d=this.parsedMonthValues=B(this.monthValues);const l=this.parsedYearValues=B(this.yearValues);const c=this.parsedDayValues=B(this.dayValues);const p=this.todayParts=F(q());this.processMinParts();this.processMaxParts();this.defaultParts=G({refParts:p,monthValues:d,dayValues:c,yearValues:l,hourValues:r,minuteValues:s,minParts:this.minParts,maxParts:this.maxParts});this.processValue(this.value);this.emitStyle()}emitStyle(){this.ionStyle.emit({interactive:true,datetime:true,"interactive-disabled":this.disabled})}renderFooter(){const{disabled:t,readonly:e,showDefaultButtons:i,showClearButton:a}=this;const o=t||e;const r=this.el.querySelector('[slot="buttons"]')!==null;if(!r&&!i&&!a){return}const s=()=>{this.reset();this.setValue(undefined)};return n("div",{class:"datetime-footer"},n("div",{class:"datetime-buttons"},n("div",{class:{["datetime-action-buttons"]:true,["has-clear-button"]:this.showClearButton}},n("slot",{name:"buttons"},n("ion-buttons",null,i&&n("ion-button",{id:"cancel-button",color:this.color,onClick:()=>this.cancel(true),disabled:o},this.cancelText),n("div",{class:"datetime-action-buttons-container"},a&&n("ion-button",{id:"clear-button",color:this.color,onClick:()=>s(),disabled:o},this.clearText),i&&n("ion-button",{id:"confirm-button",color:this.color,onClick:()=>this.confirm(true),disabled:o},this.doneText)))))))}renderWheelPicker(t=this.presentation){const e=t==="time-date"?[this.renderTimePickerColumns(t),this.renderDatePickerColumns(t)]:[this.renderDatePickerColumns(t),this.renderTimePickerColumns(t)];return n("ion-picker",null,e)}renderDatePickerColumns(t){return t==="date-time"||t==="time-date"?this.renderCombinedDatePickerColumn():this.renderIndividualDatePickerColumns(t)}renderCombinedDatePickerColumn(){const{defaultParts:t,disabled:e,workingParts:i,locale:a,minParts:o,maxParts:r,todayParts:s,isDateEnabled:d}=this;const l=this.getActivePartsWithFallback();const h=Y(i);const p=h[h.length-1];h[0].day=1;p.day=N(p.month,p.year);const m=o!==undefined&&j(o,h[0])?o:h[0];const u=r!==undefined&&k(r,p)?r:p;const f=K(a,s,m,u,this.parsedDayValues,this.parsedMonthValues);let b=f.items;const g=f.parts;if(d){b=b.map(((t,e)=>{const i=g[e];let n;try{n=!d(H(i))}catch(t){c("Exception thrown from provided `isDateEnabled` function. Please check your function and try again.",t)}return Object.assign(Object.assign({},t),{disabled:n})}))}const y=i.day!==null?`${i.year}-${i.month}-${i.day}`:`${t.year}-${t.month}-${t.day}`;return n("ion-picker-column",{"aria-label":"Select a date",class:"date-column",color:this.color,disabled:e,value:y,onIonChange:t=>{const{value:e}=t.detail;const n=g.find((({month:t,day:i,year:n})=>e===`${n}-${t}-${i}`));this.setWorkingParts(Object.assign(Object.assign({},i),n));this.setActiveParts(Object.assign(Object.assign({},l),n));t.stopPropagation()}},b.map((t=>n("ion-picker-column-option",{part:t.value===y?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderIndividualDatePickerColumns(t){const{workingParts:e,isDateEnabled:i}=this;const n=t!=="year"&&t!=="time";const a=n?U(this.locale,e,this.minParts,this.maxParts,this.parsedMonthValues):[];const o=t==="date";let r=o?Z(this.locale,e,this.minParts,this.maxParts,this.parsedDayValues):[];if(i){r=r.map((t=>{const{value:n}=t;const a=typeof n==="string"?parseInt(n):n;const o={month:e.month,day:a,year:e.year};let r;try{r=!i(H(o))}catch(t){c("Exception thrown from provided `isDateEnabled` function. Please check your function and try again.",t)}return Object.assign(Object.assign({},t),{disabled:r})}))}const s=t!=="month"&&t!=="time";const d=s?J(this.locale,this.defaultParts,this.minParts,this.maxParts,this.parsedYearValues):[];const l=Q(this.locale,{month:"numeric",day:"numeric"});let h=[];if(l){h=[this.renderMonthPickerColumn(a),this.renderDayPickerColumn(r),this.renderYearPickerColumn(d)]}else{h=[this.renderDayPickerColumn(r),this.renderMonthPickerColumn(a),this.renderYearPickerColumn(d)]}return h}renderDayPickerColumn(t){var e;if(t.length===0){return[]}const{disabled:i,workingParts:a}=this;const o=this.getActivePartsWithFallback();const r=(e=a.day!==null?a.day:this.defaultParts.day)!==null&&e!==void 0?e:undefined;return n("ion-picker-column",{"aria-label":"Select a day",class:"day-column",color:this.color,disabled:i,value:r,onIonChange:t=>{this.setWorkingParts(Object.assign(Object.assign({},a),{day:t.detail.value}));this.setActiveParts(Object.assign(Object.assign({},o),{day:t.detail.value}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===r?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderMonthPickerColumn(t){if(t.length===0){return[]}const{disabled:e,workingParts:i}=this;const a=this.getActivePartsWithFallback();return n("ion-picker-column",{"aria-label":"Select a month",class:"month-column",color:this.color,disabled:e,value:i.month,onIonChange:t=>{this.setWorkingParts(Object.assign(Object.assign({},i),{month:t.detail.value}));this.setActiveParts(Object.assign(Object.assign({},a),{month:t.detail.value}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===i.month?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderYearPickerColumn(t){if(t.length===0){return[]}const{disabled:e,workingParts:i}=this;const a=this.getActivePartsWithFallback();return n("ion-picker-column",{"aria-label":"Select a year",class:"year-column",color:this.color,disabled:e,value:i.year,onIonChange:t=>{this.setWorkingParts(Object.assign(Object.assign({},i),{year:t.detail.value}));this.setActiveParts(Object.assign(Object.assign({},a),{year:t.detail.value}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===i.year?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderTimePickerColumns(t){if(["date","month","month-year","year"].includes(t)){return[]}const e=this.getActivePart();const i=e!==undefined;const{hoursData:n,minutesData:a,dayPeriodData:o}=_(this.locale,this.workingParts,this.hourCycle,i?this.minParts:undefined,i?this.maxParts:undefined,this.parsedHourValues,this.parsedMinuteValues);return[this.renderHourPickerColumn(n),this.renderMinutePickerColumn(a),this.renderDayPeriodPickerColumn(o)]}renderHourPickerColumn(t){const{disabled:e,workingParts:i}=this;if(t.length===0)return[];const a=this.getActivePartsWithFallback();return n("ion-picker-column",{"aria-label":"Select an hour",color:this.color,disabled:e,value:a.hour,numericInput:true,onIonChange:t=>{this.setWorkingParts(Object.assign(Object.assign({},i),{hour:t.detail.value}));this.setActiveParts(Object.assign(Object.assign({},a),{hour:t.detail.value}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===a.hour?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderMinutePickerColumn(t){const{disabled:e,workingParts:i}=this;if(t.length===0)return[];const a=this.getActivePartsWithFallback();return n("ion-picker-column",{"aria-label":"Select a minute",color:this.color,disabled:e,value:a.minute,numericInput:true,onIonChange:t=>{this.setWorkingParts(Object.assign(Object.assign({},i),{minute:t.detail.value}));this.setActiveParts(Object.assign(Object.assign({},a),{minute:t.detail.value}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===a.minute?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderDayPeriodPickerColumn(t){const{disabled:e,workingParts:i}=this;if(t.length===0){return[]}const a=this.getActivePartsWithFallback();const o=X(this.locale);return n("ion-picker-column",{"aria-label":"Select a day period",style:o?{order:"-1"}:{},color:this.color,disabled:e,value:a.ampm,onIonChange:t=>{const e=lt(i,t.detail.value);this.setWorkingParts(Object.assign(Object.assign({},i),{ampm:t.detail.value,hour:e}));this.setActiveParts(Object.assign(Object.assign({},a),{ampm:t.detail.value,hour:e}));t.stopPropagation()}},t.map((t=>n("ion-picker-column-option",{part:t.value===a.ampm?`${$t} ${zt}`:$t,key:t.value,disabled:t.disabled,value:t.value},t.text))))}renderWheelView(t){const{locale:e}=this;const i=Q(e);const a=i?"month-first":"year-first";return n("div",{class:{[`wheel-order-${a}`]:true}},this.renderWheelPicker(t))}renderCalendarHeader(t){const{disabled:e}=this;const i=t==="ios"?b:g;const a=t==="ios"?f:y;const o=e||ut(this.workingParts,this.minParts,this.maxParts);const r=e||ft(this.workingParts,this.maxParts);const s=this.el.getAttribute("dir")||undefined;return n("div",{class:"calendar-header"},n("div",{class:"calendar-action-buttons"},n("div",{class:"calendar-month-year"},n("button",{class:{"calendar-month-year-toggle":true,"ion-activatable":true,"ion-focusable":true},part:"month-year-button",disabled:e,"aria-label":this.showMonthAndYear?"Hide year picker":"Show year picker",onClick:()=>this.toggleMonthAndYearView()},n("span",{id:"toggle-wrapper"},et(this.locale,this.workingParts),n("ion-icon",{"aria-hidden":"true",icon:this.showMonthAndYear?i:a,lazy:false,flipRtl:true})),t==="md"&&n("ion-ripple-effect",null))),n("div",{class:"calendar-next-prev"},n("ion-buttons",null,n("ion-button",{"aria-label":"Previous month",disabled:o,onClick:()=>this.prevMonth()},n("ion-icon",{dir:s,"aria-hidden":"true",slot:"icon-only",icon:u,lazy:false,flipRtl:true})),n("ion-button",{"aria-label":"Next month",disabled:r,onClick:()=>this.nextMonth()},n("ion-icon",{dir:s,"aria-hidden":"true",slot:"icon-only",icon:f,lazy:false,flipRtl:true}))))),n("div",{class:"calendar-days-of-week","aria-hidden":"true"},tt(this.locale,t,this.firstDayOfWeek%7).map((t=>n("div",{class:"day-of-week"},t)))))}renderMonth(t,e){const{disabled:i,readonly:a}=this;const o=this.parsedYearValues===undefined||this.parsedYearValues.includes(e);const r=this.parsedMonthValues===undefined||this.parsedMonthValues.includes(t);const s=!o||!r;const d=i||a;const l=i||mt({month:t,year:e,day:null},{minParts:Object.assign(Object.assign({},this.minParts),{day:null}),maxParts:Object.assign(Object.assign({},this.maxParts),{day:null})});const h=this.workingParts.month===t&&this.workingParts.year===e;const p=this.getActivePartsWithFallback();return n("div",{"aria-hidden":!h?"true":null,class:{"calendar-month":true,"calendar-month-disabled":!h&&l}},n("div",{class:"calendar-month-grid"},it(t,e,this.firstDayOfWeek%7).map(((i,a)=>{const{day:o,dayOfWeek:r}=i;const{el:l,highlightedDates:h,isDateEnabled:m,multiple:u}=this;const f={month:t,day:o,year:e};const b=o===null;const{isActive:g,isToday:y,ariaLabel:x,ariaSelected:w,disabled:v,text:k}=pt(this.locale,f,this.activeParts,this.todayParts,this.minParts,this.maxParts,this.parsedDayValues);const j=H(f);let O=s||v;if(!O&&m!==undefined){try{O=!m(j)}catch(t){c("Exception thrown from provided `isDateEnabled` function. Please check your function and try again.",l,t)}}const C=O&&d;const P=O||d;let $=undefined;if(h!==undefined&&!g&&o!==null){$=bt(h,j,l)}let z=undefined;if(!b){z=`calendar-day${g?" active":""}${y?" today":""}${O?" disabled":""}`}return n("div",{class:"calendar-day-wrapper"},n("button",{ref:t=>{if(t){t.style.setProperty("color",`${$?$.textColor:""}`,"important");t.style.setProperty("background-color",`${$?$.backgroundColor:""}`,"important")}},tabindex:"-1","data-day":o,"data-month":t,"data-year":e,"data-index":a,"data-day-of-week":r,disabled:P,class:{"calendar-day-padding":b,"calendar-day":true,"calendar-day-active":g,"calendar-day-constrained":C,"calendar-day-today":y},part:z,"aria-hidden":b?"true":null,"aria-selected":w,"aria-label":x,onClick:()=>{if(b){return}this.setWorkingParts(Object.assign(Object.assign({},this.workingParts),{month:t,day:o,year:e}));if(u){this.setActiveParts({month:t,day:o,year:e},g)}else{this.setActiveParts(Object.assign(Object.assign({},p),{month:t,day:o,year:e}))}}},k))}))))}renderCalendarBody(){return n("div",{class:"calendar-body ion-focusable",ref:t=>this.calendarBodyRef=t,tabindex:"0"},Y(this.workingParts,this.forceRenderDate).map((({month:t,year:e})=>this.renderMonth(t,e))))}renderCalendar(t){return n("div",{class:"datetime-calendar",key:"datetime-calendar"},this.renderCalendarHeader(t),this.renderCalendarBody())}renderTimeLabel(){const t=this.el.querySelector('[slot="time-label"]')!==null;if(!t&&!this.showDefaultTimeLabel){return}return n("slot",{name:"time-label"},"Time")}renderTimeOverlay(){const{disabled:t,hourCycle:e,isTimePopoverOpen:i,locale:a,formatOptions:o}=this;const r=nt(a,e);const s=this.getActivePartsWithFallback();return[n("div",{class:"time-header"},this.renderTimeLabel()),n("button",{class:{"time-body":true,"time-body-active":i},part:`time-button${i?" active":""}`,"aria-expanded":"false","aria-haspopup":"true",disabled:t,onClick:async t=>{const{popoverRef:e}=this;if(e){this.isTimePopoverOpen=true;e.present(new CustomEvent("ionShadowTarget",{detail:{ionShadowTarget:t.target}}));await e.onWillDismiss();this.isTimePopoverOpen=false}}},at(a,s,r,o===null||o===void 0?void 0:o.time)),n("ion-popover",{alignment:"center",translucent:true,overlayIndex:1,arrow:false,onWillPresent:t=>{const e=t.target.querySelectorAll("ion-picker-column");e.forEach((t=>t.scrollActiveItemIntoView()))},style:{"--offset-y":"-10px","--min-width":"fit-content"},keyboardEvents:true,ref:t=>this.popoverRef=t},this.renderWheelPicker("time"))]}getHeaderSelectedDateText(){var t;const{activeParts:e,formatOptions:i,multiple:n,titleSelectedDatesFormatter:a}=this;const o=Array.isArray(e);let r;if(n&&o&&e.length!==1){r=`${e.length} days`;if(a!==undefined){try{r=a(H(e))}catch(t){c("Exception in provided `titleSelectedDatesFormatter`: ",t)}}}else{r=ot(this.locale,this.getActivePartsWithFallback(),(t=i===null||i===void 0?void 0:i.date)!==null&&t!==void 0?t:{weekday:"short",month:"short",day:"numeric"})}return r}renderHeader(t=true){const e=this.el.querySelector('[slot="title"]')!==null;if(!e&&!this.showDefaultTitle){return}return n("div",{class:"datetime-header"},n("div",{class:"datetime-title"},n("slot",{name:"title"},"Select Date")),t&&n("div",{class:"datetime-selected-date"},this.getHeaderSelectedDateText()))}renderTime(){const{presentation:t}=this;const e=t==="time";return n("div",{class:"datetime-time"},e?this.renderWheelPicker():this.renderTimeOverlay())}renderCalendarViewMonthYearPicker(){return n("div",{class:"datetime-year"},this.renderWheelView("month-year"))}renderDatetime(t){const{presentation:e,preferWheel:i}=this;const n=e==="date"||e==="date-time"||e==="time-date";if(i&&n){return[this.renderHeader(false),this.renderWheelView(),this.renderFooter()]}switch(e){case"date-time":return[this.renderHeader(),this.renderCalendar(t),this.renderCalendarViewMonthYearPicker(),this.renderTime(),this.renderFooter()];case"time-date":return[this.renderHeader(),this.renderTime(),this.renderCalendar(t),this.renderCalendarViewMonthYearPicker(),this.renderFooter()];case"time":return[this.renderHeader(false),this.renderTime(),this.renderFooter()];case"month":case"month-year":case"year":return[this.renderHeader(false),this.renderWheelView(),this.renderFooter()];default:return[this.renderHeader(),this.renderCalendar(t),this.renderCalendarViewMonthYearPicker(),this.renderFooter()]}}render(){const{name:t,value:e,disabled:i,el:o,color:r,readonly:s,showMonthAndYear:l,preferWheel:c,presentation:h,size:p,isGridStyle:u}=this;const f=x(this);const b=h==="year"||h==="month"||h==="month-year";const g=l||b;const y=l&&!b;const w=h==="date"||h==="date-time"||h==="time-date";const v=w&&c;d(true,o,t,rt(e),i);return n(a,{key:"7afbb1a7e6c78389b4588999779e5c90e010e85d","aria-disabled":i?"true":null,onFocus:this.onFocus,onBlur:this.onBlur,class:Object.assign({},m(r,{[f]:true,["datetime-readonly"]:s,["datetime-disabled"]:i,"show-month-and-year":g,"month-year-picker-open":y,[`datetime-presentation-${h}`]:true,[`datetime-size-${p}`]:true,[`datetime-prefer-wheel`]:v,[`datetime-grid`]:u}))},n("div",{key:"297c458d4d17154cb297e2ef5926505bcb2d1fce",class:"intersection-tracker",ref:t=>this.intersectionTrackerRef=t}),this.renderDatetime(f))}get el(){return o(this)}static get watchers(){return{formatOptions:["formatOptionsChanged"],disabled:["disabledChanged"],min:["minChanged"],max:["maxChanged"],presentation:["presentationChanged"],yearValues:["yearValuesChanged"],monthValues:["monthValuesChanged"],dayValues:["dayValuesChanged"],hourValues:["hourValuesChanged"],minuteValues:["minuteValuesChanged"],value:["valueChanged"]}}};let Ot=0;const Ct="datetime-cancel";const Pt="datetime-confirm";const $t="wheel-item";const zt=`active`;jt.style={ios:wt,md:kt};export{jt as ion_datetime};
//# sourceMappingURL=p-d390d8a4.entry.js.map