timepicker-ui 4.0.0 → 4.0.2
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.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var Pe=(a,e)=>{for(var t in e)ue(a,t,{get:e[t],enumerable:!0})},Ne=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xe(e))!Oe.call(a,n)&&n!==t&&ue(a,n,{get:()=>e[n],enumerable:!(i=De(e,n))||i.enumerable});return a};var Re=a=>Ne(ue({},"__esModule",{value:!0}),a);var Ue={};Pe(Ue,{EventEmitter:()=>$,TimepickerUI:()=>ce,default:()=>We});module.exports=Re(Ue);var A=()=>typeof window>"u",v=()=>typeof document<"u";var J=class{state;constructor(e,t,i,n){this.state={degreesHours:null,degreesMinutes:null,options:t,element:e,instanceId:i,isMobileView:!1,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isInitialized:!1,customId:n,eventHandlersRegistered:!1,isDestroyed:!1}}get degreesHours(){return this.state.degreesHours}get degreesMinutes(){return this.state.degreesMinutes}get options(){return this.state.options}get element(){return this.state.element}get instanceId(){return this.state.instanceId}get isMobileView(){return this.state.isMobileView}get isTouchMouseMove(){return this.state.isTouchMouseMove}get disabledTime(){return this.state.disabledTime}get cloned(){return this.state.cloned}get isModalRemove(){return this.state.isModalRemove}get isInitialized(){return this.state.isInitialized}get customId(){return this.state.customId}get eventHandlersRegistered(){return this.state.eventHandlersRegistered}get isDestroyed(){return this.state.isDestroyed}setDegreesHours(e){this.state={...this.state,degreesHours:e}}setDegreesMinutes(e){this.state={...this.state,degreesMinutes:e}}setOptions(e){this.state={...this.state,options:e}}setIsMobileView(e){this.state={...this.state,isMobileView:e}}setIsTouchMouseMove(e){this.state={...this.state,isTouchMouseMove:e}}setDisabledTime(e){this.state={...this.state,disabledTime:e}}setCloned(e){this.state={...this.state,cloned:e}}setIsModalRemove(e){this.state={...this.state,isModalRemove:e}}setIsInitialized(e){this.state={...this.state,isInitialized:e}}setEventHandlersRegistered(e){this.state={...this.state,eventHandlersRegistered:e}}setIsDestroyed(e){this.state={...this.state,isDestroyed:e}}updateOptions(e){this.state={...this.state,options:{...this.state.options,clock:{...this.state.options.clock,...e.clock||{}},ui:{...this.state.options.ui,...e.ui||{}},labels:{...this.state.options.labels,...e.labels||{}},behavior:{...this.state.options.behavior,...e.behavior||{}},callbacks:{...this.state.options.callbacks,...e.callbacks||{}}}}}reset(){this.state={...this.state,degreesHours:null,degreesMinutes:null,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isInitialized:!1,isDestroyed:!0,eventHandlersRegistered:!1}}getModalElement(){return v()===!1?null:document.querySelector(`[data-owner-id="${this.state.instanceId}"]`)}getInput(){return this.state.element?.querySelector("input")}getClockFace(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-clock-face.mobile"):e.querySelector(".tp-ui-clock-face:not(.mobile)"):null}getClockHand(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-clock-hand"):e.querySelector(".tp-ui-clock-hand:not(.mobile)"):null}getCircle(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-circle-hand"):e.querySelector(".tp-ui-circle-hand:not(.mobile)"):null}getTipsWrapper(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper"):e.querySelector(".tp-ui-tips-wrapper:not(.mobile)"):null}getTipsWrapperFor24h(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h"):e.querySelector(".tp-ui-tips-wrapper-24h:not(.mobile)"):null}getMinutes(){return this.getModalElement()?.querySelector(".tp-ui-minutes")||null}getHour(){return this.getModalElement()?.querySelector(".tp-ui-hour")||null}getAM(){return this.getModalElement()?.querySelector(".tp-ui-am")||null}getPM(){return this.getModalElement()?.querySelector(".tp-ui-pm")||null}getHourText(){return this.getModalElement()?.querySelector(".tp-ui-hour-text")||null}getMinutesText(){return this.getModalElement()?.querySelector(".tp-ui-minute-text")||null}getHeader(){return this.getModalElement()?.querySelector(".tp-ui-header")||null}getInputWrappers(){return this.getModalElement()?.querySelectorAll(".tp-ui-input-wrapper")||null}getDots(){return this.getModalElement()?.querySelector(".tp-ui-dots")||null}getMinutesTips(){return this.getModalElement()?.querySelector(".tp-ui-minutes-time")||null}getHourTips(){return this.getModalElement()?.querySelector(".tp-ui-hour-time-12")||null}getAllValueTips(){let e=this.getModalElement();return e?[...e.querySelectorAll(".tp-ui-value-tips"),...e.querySelectorAll(".tp-ui-value-tips-24h")]:[]}getOpenElementData(){let e=this.state.element?.querySelectorAll("[data-open]");if(e?.length>0){let t=[];return e.forEach(({dataset:i})=>t.push(i.open??"")),[...new Set(t)]}return null}getOpenElement(){let e=this.getInput(),t=this.getOpenElementData();return t===null?(e?.setAttribute("data-open","tp-ui-input"),[e]):t.map(i=>this.state.element?.querySelectorAll(`[data-open='${i}']`))[0]??""}getCancelButton(){return this.getModalElement()?.querySelector(".tp-ui-cancel-btn")||null}getOkButton(){return this.getModalElement()?.querySelector(".tp-ui-ok-btn")||null}getActiveTypeMode(){return this.getModalElement()?.querySelector(".tp-ui-type-mode.active")||null}getKeyboardClockIcon(){return this.getModalElement()?.querySelector(".tp-ui-keyboard-icon-wrapper")||null}getFooter(){return this.getModalElement()?.querySelector(".tp-ui-footer")||null}getWrapper(){return this.getModalElement()?.querySelector(".tp-ui-wrapper")||null}};var k={DEFAULT_DELAY:300,MODAL_ANIMATION:150,SCROLLBAR_RESTORE:400,MODAL_REMOVE:300,CLOCK_ANIMATION:600,TIPS_ANIMATION:401,MOBILE_TOGGLE:450,CLOCK_SCALE_DELAY:150};var F=class{core;emitter;timeouts=[];constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("animation:clock",()=>{this.handleAnimationSwitchTipsMode()})}runWithAnimation(e,t=k.MODAL_ANIMATION){if(this.core.options.ui.animation){let i=setTimeout(e,t);this.timeouts.push(i)}else e()}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}setAnimationToOpen(){this.clearAllTimeouts(),this.core.getModalElement()?.classList.add("opacity"),this.runWithAnimation(()=>{this.core.getModalElement()?.classList.add("show")})}removeAnimationToClose(){this.clearAllTimeouts(),this.core.getModalElement()&&this.runWithAnimation(()=>{let t=this.core.getModalElement();t?.classList.remove("show"),t?.classList.remove("opacity")})}handleAnimationClock(){this.core.options.ui.animation&&this.runWithAnimation(()=>{this.core.getClockFace()?.classList.add("tp-ui-clock-animation");let t=setTimeout(()=>{this.core.getClockFace()?.classList.remove("tp-ui-clock-animation")},k.CLOCK_ANIMATION);this.timeouts.push(t)})}handleAnimationSwitchTipsMode(){let e=this.core.getClockHand();if(!e)return;e.classList.add("tp-ui-tips-animation");let t=setTimeout(()=>{this.core.getClockHand()?.classList.remove("tp-ui-tips-animation")},k.TIPS_ANIMATION);this.timeouts.push(t)}destroy(){this.clearAllTimeouts()}};var Ee=()=>{if(v()===!1)return 0;let a=document.createElement("div");a.className="tp-ui-measure",document.body.appendChild(a);let e=a.getBoundingClientRect().width-a.clientWidth;return document.body.removeChild(a),e};var be=(a,e)=>a?a.classList.contains(e):!1,_=(a,e)=>Array.from({length:Number(e)-Number(a)+1},(t,i)=>Number(a)+i),Q=(a,e)=>Array.from({length:Number(e)-Number(a)+1},(t,i)=>Number(e)-i).reverse();var de=(a="")=>{let e=a.replace(/(AM|PM|am|pm)/,r=>` ${r}`),t=new Date(`September 20, 2000 ${e}`),i=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");return`${i}:${n}`},me=a=>{let[e,t]=a.split(":");return`${e.padStart(2,"0")}:${t.padStart(2,"0")}`},ee=(a,e)=>{if(a.length<2)return!1;let t=a.map(i=>{let[n,r]=i.trim().split("-"),s,o;if(e==="12h"){if(!/\s?(AM|PM|am|pm)\s?$/.test(n.trim())||!/\s?(AM|PM|am|pm)\s?$/.test(r.trim()))throw new Error(`Invalid 12h format: "${i}"`);s=de(n.trim()),o=de(r.trim())}else{if(/\s?(AM|PM|am|pm)\s?/.test(n.trim())||/\s?(AM|PM|am|pm)\s?/.test(r.trim()))throw new Error(`Invalid 24h format: "${i}"`);s=me(n.trim()),o=me(r.trim())}return{start:s,end:o,original:i}});for(let i=0;i<t.length;i++)for(let n=i+1;n<t.length;n++){let r=t[i],s=t[n];if(r.start<=s.end&&r.end>=s.start||s.start<=r.end&&s.end>=r.start)throw new Error(`Overlapping intervals: "${r.original}" and "${s.original}"`)}return!1},Te=()=>typeof window<"u"&&window.crypto&&typeof window.crypto.randomUUID=="function"?window.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)});var ye='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M160-200q-33 0-56.5-23.5T80-280v-400q0-33 23.5-56.5T160-760h640q33 0 56.5 23.5T880-680v400q0 33-23.5 56.5T800-200H160Zm0-80h640v-400H160v400Zm160-40h320v-80H320v80ZM200-440h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM200-560h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM160-280v-400 400Z"/></svg>';var Me='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"/></svg>';var ke=["00","13","14","15","16","17","18","19","20","21","22","23"],pe=["12","1","2","3","4","5","6","7","8","9","10","11"],B=["00","05","10","15","20","25","30","35","40","45","50","55"],Ce=(a,e)=>{let{ui:{iconTemplate:t,enableSwitchIcon:i,animation:n,theme:r,mobile:s,editable:o,iconTemplateMobile:u},labels:{time:l,mobileTime:d,am:m,pm:p,cancel:E,ok:T,mobileMinute:w,mobileHour:C},clock:{type:y}}=a,c=s?"mobile":"",f=`<button aria-label="Keyboard" type="button" class="tp-ui-keyboard-icon">${t||ye}</button>`,g=u||`<button aria-label="Clock" type="button" class="tp-ui-keyboard-icon">${u||Me}</button>`;return`<div class="tp-ui-modal normalize ${c}" data-theme="${r}" role="dialog" aria-modal="true" aria-labelledby="tp-ui-label-${e}" data-owner-id="${e}" style='transition:${n?"opacity 0.15s linear":"none"}'><div class="tp-ui-wrapper ${c}" tabindex="0"><div class="tp-ui-select-time ${c}" id="tp-ui-label-${e}">${c?d:l}</div><div class="tp-ui-header ${c}"><div class="tp-ui-wrapper-time ${c} ${y==="24h"?"tp-ui-wrapper-time-24h":""}" role="group" aria-label="${c?d:l}"><div class="tp-ui-input-wrapper ${c}"><div class="tp-ui-input-ripple-wrapper ${c}" data-md3-ripple><input name="hour" ${!o&&!c?"readonly":""} class="tp-ui-hour ${c}" tabindex="0" type="number" min="0" max="${y==="12h"?"12":"23"}" aria-label="${c?C:"Hour"}" role="spinbutton" aria-valuenow="12"></div><div class="tp-ui-hour-text ${c}">${C}</div></div><div class="tp-ui-dots ${c}" aria-hidden="true"><span></span><span></span></div><div class="tp-ui-input-wrapper ${c}"><div class="tp-ui-input-ripple-wrapper ${c}" data-md3-ripple><input name="minutes" ${!o&&!c?"readonly":""} class="tp-ui-minutes ${c}" tabindex="0" type="number" min="0" max="59" aria-label="${c?w:"Minute"}" role="spinbutton" aria-valuenow="0"></div><div class="tp-ui-minute-text ${c}">${w}</div></div></div>${y!=="24h"?`<div class="tp-ui-wrapper-type-time ${c}" role="group" aria-label="Period"><div class="tp-ui-type-mode tp-ui-am ${c?"mobile":"tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${m}" aria-pressed="false" data-type="AM">${m}</div><div class="tp-ui-type-mode tp-ui-pm ${c?"mobile":"tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${p}" aria-pressed="false" data-type="PM">${p}</div></div>`:""}</div><div class="tp-ui-mobile-clock-wrapper ${c}"><div class="tp-ui-body ${c}"><div class="tp-ui-clock-face ${c}" role="group" aria-label="Clock"><div class="tp-ui-dot ${c}" aria-hidden="true"></div><div class="tp-ui-clock-hand ${c}" aria-hidden="true"><div class="tp-ui-circle-hand ${c}"></div></div><div class="tp-ui-tips-wrapper ${c}" role="listbox" aria-label="Time"></div>${y==="24h"?`<div class="tp-ui-tips-wrapper-24h ${c}" role="listbox" aria-label="24h"></div>`:""}</div></div></div><div class="tp-ui-footer ${c}" ${c?'data-view="mobile"':""}>${i?`<div class="tp-ui-keyboard-icon-wrapper ${c}" tabindex="0" role="button" aria-pressed="false" aria-label="Toggle" data-view="desktop">${c?g:f}</div>`:""}<div class="tp-ui-wrapper-btn ${c}"><div class="tp-ui-cancel-btn ${c}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${E}">${E}</div><div class="tp-ui-ok-btn ${c}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${T}">${T}</div></div></div></div><div class="timepicker-announcer sr-only" role="status" aria-live="polite" aria-atomic="true"></div></div>`};var W=class{core;emitter;timeouts=[];originalOverflow;originalPaddingRight;constructor(e,t){this.core=e,this.emitter=t}runWithTimeout(e,t=k.DEFAULT_DELAY){let i=setTimeout(e,t);this.timeouts.push(i)}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}clearExistingModal(){if(v()===!1)return;let e=document.querySelector(".tp-ui-modal");e&&e.remove()}setModalTemplate(){if(v()===!1)return;this.clearExistingModal();let e=Ce(this.core.options,this.core.instanceId);if(this.core.options.ui.inline?.enabled){let i=document.getElementById(this.core.options.ui.inline.containerId);if(!i)return;i.innerHTML="",i.insertAdjacentHTML("beforeend",e);let n=i.querySelector(".tp-ui-modal");if(n){n.classList.add("tp-ui--inline");let{showButtons:r}=this.core.options.ui.inline;(r===!1||r===void 0)&&n.querySelectorAll(".tp-ui-wrapper-btn, .tp-ui-wrapper-btn.mobile").forEach(s=>s.style.display="none")}return}let{appendModalSelector:t}=this.core.options.ui;t?document.querySelector(t)?.insertAdjacentHTML("beforeend",e):document.body.insertAdjacentHTML("beforeend",e)}setScrollbarOrNot(){v()!==!1&&(this.core.options.ui.inline?.enabled||(this.core.options.ui.enableScrollbar?this.runWithTimeout(()=>{A()||this.runWithTimeout(()=>{typeof document<"u"&&(document.body.style.overflowY=this.originalOverflow||"",document.body.style.paddingRight=this.originalPaddingRight||"")},k.SCROLLBAR_RESTORE)},400):(this.originalOverflow=document.body.style.overflowY,this.originalPaddingRight=document.body.style.paddingRight,document.body.style.paddingRight=`${Ee()}px`,document.body.style.overflowY="hidden")))}removeBackdrop(){if(this.core.options.ui.inline?.enabled||this.core.options.ui.backdrop)return;let e=this.core.getModalElement(),t=this.core.getOpenElement();e?.classList.add("removed"),t.forEach(i=>i?.classList.add("disabled"))}setNormalizeClass(){let e=this.core.getModalElement();if(!e)return;e.classList.add("tp-ui-normalize"),e.querySelectorAll(":scope > div").forEach(i=>i.classList.add("tp-ui-normalize"))}setShowClassToBackdrop(){if(this.core.options.ui.inline?.enabled){this.core.getModalElement()?.classList.add("show"),this.setInitialFocus();return}this.core.options.ui.backdrop&&this.runWithTimeout(()=>{this.core.getModalElement()?.classList.add("show"),this.setInitialFocus()},k.MODAL_ANIMATION)}setInitialFocus(){if(!this.core.options.behavior.focusTrap)return;let e=this.core.getWrapper();e&&typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{e.focus()})}setFlexEndToFooterIfNoKeyboardIcon(){let e=this.core.getFooter();!this.core.options.ui.enableSwitchIcon&&e&&(e.style.justifyContent="flex-end")}destroy(){this.clearAllTimeouts(),!A()&&!this.core.options.ui.inline?.enabled&&(document.body.style.overflowY=this.originalOverflow||"",document.body.style.paddingRight=this.originalPaddingRight||""),this.clearExistingModal()}};var H=(a,e,t,i)=>{let n={hour:"12",minutes:"00",type:e==="24h"?void 0:"PM"};if(!a)return n;let r=a.value.trim();if(!t&&!r)return n;if(typeof t=="boolean"&&t){let w=new Date,[C,y]=w.toLocaleTimeString().split(":"),c=C.padStart(2,"0");if(/[a-z]/i.test(y)&&e==="12h"){let[f,g]=y.split(" ");return{hour:c,minutes:f,type:g}}return{hour:c,minutes:y,type:void 0}}if(typeof t=="object"){let{time:w,locales:C,preventClockType:y}=t,c=w??new Date;if(y&&i){let[h,b]=new Date(c).toLocaleTimeString().split(":");if(/[a-z]/i.test(b)){let[L,D]=b.split(" ");return{hour:h,minutes:L,type:D}}return{hour:h.padStart(2,"0"),minutes:b,type:void 0}}let f=new Date(c).toLocaleTimeString(C||"en-US",{hour:"2-digit",minute:"2-digit",hour12:e==="12h"}),[g,M]=f.split(":");if(e==="12h"&&/[a-z]/i.test(M)){let h=M.trim().split(" "),b=h[0],L=h[1]||"AM";return{hour:g,minutes:b,type:L}}return{hour:g,minutes:M.replace(/\D/g,""),type:void 0}}let[s,o]=r.split(" "),[u="",l=""]=s.split(":"),d=u.replace(/\D/g,""),m=l.replace(/\D/g,""),p={hour:d.padStart(2,"0"),minutes:m.padStart(2,"0"),type:e==="12h"?o:void 0};if(d.length>2||m.length>2)return{...p,error:"Invalid input: too many digits.",currentHour:u,currentMin:l};if(/[a-z]/i.test(s))return{...p,error:"Input contains invalid letters."};if(r.includes(" ")&&(!o||r.length>8||o!=="AM"&&o!=="PM"))return{...p,error:"Invalid AM/PM format or length.",currentLength:r.length,currentType:o};let E=Number(d),T=Number(m);if(e==="12h"){if(E<1||E>12||T<0||T>59||o!=="AM"&&o!=="PM")return{...p,error:"Invalid 12h time.",currentHour:E,currentMin:T,currentType:o}}else if(E<0||E>23||T<0||T>59)return{...p,error:"Invalid 24h time.",currentHour:E,currentMin:T};return p},he=(a,e,t)=>{let i=Number(a);if(Number.isNaN(i))return!1;switch(e){case"hour":return t==="24h"?i>=0&&i<=23:i>0&&i<=12;case"minutes":return i>=0&&i<=59;default:return}};var Le=a=>{if(!a)return;let{disabledTime:e,type:t}=a.clock;if(!e||!Object.keys(e).length)return;let{hours:i,minutes:n,interval:r}=e;if(r){delete e.hours,delete e.minutes;let s=Array.isArray(r)?r:[r];if(!t)throw new Error("clockType required for interval");return ee(s,t),{value:s.map(l=>{let[d,m]=l.trim().split("-"),{hour:p,minutes:E,type:T}=H({value:d.trim()},t),{hour:w,minutes:C,type:y}=H({value:m.trim()},t),c=_(p,w).map(h=>Number(h)===0?"00":String(Number(h))),f=[],g=Number(E),M=Number(C);if(y===T)return g>0&&M<=0?(f.push(c[0],c[c.length-1]),c=c.slice(1,-1)):M<59&&M>0&&g<=0?(f.push(void 0,c[c.length-1]),c=c.slice(0,-1)):M>0&&g>0?(f.push(c[0],c[c.length-1]),c=c.slice(1,-1)):M===0&&g===0&&(f.push(void 0,c[c.length-1]),c.pop()),{removedStartedHour:f[0]!==void 0&&Number(f[0])<=9?`0${f[0]}`:f[0],removedEndHour:f[1]!==void 0&&Number(f[1])<=9?`0${f[1]}`:f[1],rangeArrHour:c,startMinutes:_(E,59).map(h=>Number(h)<=9?`0${h}`:`${h}`),endMinutes:Q(0,C).map(h=>Number(h)<=9?`0${h}`:`${h}`),startType:T,endType:y};{let h=_(p,12).map(String),b=Q(1,w).map(String),L=[],D=[];return g>0&&M<=0?(D.push(b[b.length-1]),L.push(h[0]),b.pop(),h.shift()):M<59&&M>0&&g<=0?(L.push(h[0]),D.push(b[b.length-1]),b.pop()):M>0&&g>0?(D.push(b[b.length-1]),L.push(h[0]),b.pop(),h.shift()):M===0&&g===0&&(D.push(b[b.length-1]),L.push(h[0]),b.pop()),{startType:T,endType:y,amHours:h,pmHours:b,removedAmHour:L[0]&&Number(L[0])<=9?`0${L[0]}`:L[0],removedPmHour:D[0]&&Number(D[0])<=9?`0${D[0]}`:D[0],startMinutes:Number(E)===0?[]:_(E,59).map(O=>Number(O)<=9?`0${O}`:`${O}`),endMinutes:Q(0,C).map(O=>Number(O)<=9?`0${O}`:`${O}`)}}}).reduce((l,d)=>(Object.entries(d).forEach(([m,p])=>{Array.isArray(p)?l[m]=Array.isArray(l[m])?[...l[m],...p]:[...p]:l[m]=p}),l),{isInterval:!0,clockType:t,intervals:s})}}return i?.forEach(s=>{if(t==="12h"&&Number(s)>12)throw new Error("The disabled hours value has to be less than 13");if(t==="24h"&&Number(s)>23)throw new Error("The disabled hours value has to be less than 24")}),n?.forEach(s=>{if(Number(s)>59)throw new Error("The disabled minutes value has to be less than 60")}),{value:{hours:i?.map(s=>s==="00"||Number(s)===0?`0${Number(s)}`:`${Number(s)}`),minutes:n?.map(s=>Number(s)<=9?`0${s}`:`${s}`)}}},ve=(a,e,t,i)=>{if(a){if(Array.isArray(a)&&a.length>0)return!a.map(r=>he(r,e,t)).some(r=>r===!1);if(typeof a=="string"||typeof a=="number"){let n=he(a,e,t),r=i?.map(Number).includes(Number(a));return!!(n&&!r)}}};var fe="tp-ui",qe="mousedown mouseup mousemove mouseleave mouseover",Fe="touchstart touchmove touchend",Ae=`${qe} ${Fe}`,P="active";var U=class{core;emitter;isAnimating=!1;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("switch:view",()=>{this.toggleMobileClockFace()})}isCurrentTimeEnabled(e){let t=this.core.options.clock.currentTime;return typeof t=="boolean"?t:!!t?.[e]}preventClockTypeByCurrentTime(){if(!this.isCurrentTimeEnabled("preventClockType"))return;let e=this.core.getInput();if(!e)return;let{currentTime:t,clockType:i}={currentTime:this.core.options.clock.currentTime,clockType:this.core.options.clock.type},{type:n}=H(e,i,t,!0);this.core.updateOptions({clock:{type:n?"12h":"24h"}})}updateInputValueWithCurrentTimeOnStart(){if(!this.isCurrentTimeEnabled("updateInput"))return;let e=this.core.getInput();if(!e)return;let{hour:t,minutes:i,type:n}=H(e,this.core.options.clock.type,this.core.options.clock.currentTime);e.value=n?`${t}:${i} ${n}`:`${t}:${i}`}checkMobileOption(){this.core.setIsMobileView(!!this.core.options.ui.mobile),this.core.options.ui.mobile&&this.core.updateOptions({ui:{editable:!0}})}getDisableTime(){let e=Le(this.core.options);this.core.setDisabledTime(e||null)}getInputValueOnOpenAndSet(){let e=this.core.getInput();if(!e)return;let t=H(e,this.core.options.clock.type,this.core.options.clock.currentTime),i=this.core.getHour(),n=this.core.getMinutes(),r=this.core.getActiveTypeMode(),s=this.core.getAM();if(t===void 0){i&&(i.value="12"),n&&(n.value="00");let E={hour:i?.value||"12",minutes:n?.value||"00",type:r?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit("open",E),this.core.options.clock.type!=="24h"&&s&&s.classList.add(P);return}let[o,u,l]=e.value.split(":").join(" ").split(" ");e.value.length===0&&(o=t.hour,u=t.minutes,l=t.type),i&&(i.value=o.padStart(2,"0")),n&&(n.value=u.padStart(2,"0"));let m=this.core.getModalElement()?.querySelector(`[data-type='${l}']`);this.core.options.clock.type!=="24h"&&m&&m.classList.add(P);let p={...t,type:r?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit("open",p)}getInputValue(e,t,i){return H(e,t,i)}toggleMobileClockFace(){if(this.isAnimating)return;let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(".tp-ui-wrapper"),i=this.core.getKeyboardClockIcon(),n=e.querySelector(".tp-ui-mobile-clock-wrapper"),r=e.querySelectorAll("*"),s=e.querySelector(".tp-ui-select-time"),o=this.core.getHour(),u=this.core.getMinutes(),l=this.core.getClockFace();if(!t)return;let d=t.classList.contains("expanded"),m=this.core.isMobileView;d?this.collapseClockFace(t,n,r,i,s,o,u,l,m):this.expandClockFace(t,n,r,i,s,o,u,l)}collapseClockFace(e,t,i,n,r,s,o,u,l){this.isAnimating=!0,this.switchView(r,n,s,o,!0),i.forEach(d=>{d!==t&&d!==e&&d!==r&&(d.classList.remove("expanded"),l&&d.classList.add("mobile"))}),r&&(r.classList.remove("expanded"),l&&r.classList.add("mobile")),typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>{t?.classList.remove("expanded"),l&&t?.classList.add("mobile"),e?.classList.remove("expanded"),l&&e?.classList.add("mobile"),l?u?.classList.remove("scale-in"):u?.classList.add("scale-in"),setTimeout(()=>{this.isAnimating=!1},k.MOBILE_TOGGLE)}):this.isAnimating=!1,n?.setAttribute("aria-label","Show clock face"),n?.setAttribute("aria-pressed","false")}expandClockFace(e,t,i,n,r,s,o,u){this.isAnimating=!0,o?.classList.contains("active")&&o?this.emitter.emit("select:minute",{minutes:o.value}):s&&this.emitter.emit("select:hour",{hour:s.value}),i.forEach(d=>{d!==t&&d!==e&&d!==r&&(d.classList.remove("mobile"),d.classList.add("expanded"))}),r&&(r.classList.remove("mobile"),r.classList.add("expanded")),this.switchView(r,n,s,o,!1),typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>{e.classList.remove("mobile"),e.classList.add("expanded"),requestAnimationFrame(()=>{t&&(t.classList.remove("mobile"),t.classList.add("expanded")),u&&u.classList.remove("scale-in"),setTimeout(()=>{u&&u.classList.add("scale-in")},k.CLOCK_SCALE_DELAY),setTimeout(()=>{this.isAnimating=!1},k.MOBILE_TOGGLE)})}):this.isAnimating=!1,n?.setAttribute("aria-label","Hide clock face"),n?.setAttribute("aria-pressed","true")}switchView(e,t,i,n,r){r?(e?.classList.remove("mobile"),t?.classList.remove("mobile"),i?.classList.remove("mobile"),n?.classList.remove("mobile"),this.updateClockFaceAccessibility(!1)):(e?.classList.add("mobile"),t?.classList.add("mobile"),i?.classList.add("mobile"),n?.classList.add("mobile"),this.updateClockFaceAccessibility(!0))}updateClockFaceAccessibility(e){let t=this.core.getClockFace();if(!t)return;let i=t.querySelector(".tp-ui-tips-wrapper"),n=t.querySelector(".tp-ui-tips-wrapper-24h"),r=t.querySelectorAll(".tp-ui-tip");e?(t.setAttribute("aria-hidden","true"),i?.setAttribute("aria-hidden","true"),n?.setAttribute("aria-hidden","true"),r.forEach(s=>{s.setAttribute("tabindex","-1"),s.setAttribute("aria-hidden","true")})):(t.removeAttribute("aria-hidden"),i?.removeAttribute("aria-hidden"),n?.removeAttribute("aria-hidden"),r.forEach(s=>{s.setAttribute("tabindex","0"),s.removeAttribute("aria-hidden")}))}destroy(){}};var z=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setTheme(){let e=this.core.getModalElement();if(!e)return;let{theme:t}=this.core.options.ui;t&&e.setAttribute("data-theme",t)}setInputClassToInputElement(){let e=this.core.getInput();e&&(be(e,"tp-ui-input")||e.classList.add("tp-ui-input"))}setDataOpenToInputIfDoesntExistInWrapper(){let e=this.core.getOpenElementData(),t=this.core.getInput();e===null&&t&&t.setAttribute("data-open","tp-ui-input")}setClassTopOpenElement(){let e=this.core.getOpenElement();for(let t of e)t&&t.classList.add("tp-ui-open-element")}setTimepickerClassToElement(){let e=this.core.element;if(!e)return;e.classList.add(fe);let t=this.core.options.ui.cssClass;t&&t!==fe&&e.classList.add(t)}destroy(){let e=this.core.getModalElement();e&&e.removeAttribute("data-theme")}};var N=class a extends Error{constructor(t,i){super(`[TimepickerUI] ${t}`);this.code=i;this.name="TimepickerError",Object.setPrototypeOf(this,a.prototype)}},te={ELEMENT_NOT_FOUND:"ELEMENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",NO_INPUT_ELEMENT:"NO_INPUT_ELEMENT",INSTANCE_DESTROYED:"INSTANCE_DESTROYED",NOT_INITIALIZED:"NOT_INITIALIZED",INVALID_TIME_FORMAT:"INVALID_TIME_FORMAT",INLINE_CONFIG_ERROR:"INLINE_CONFIG_ERROR",CONTAINER_NOT_FOUND:"CONTAINER_NOT_FOUND",SSR_ENVIRONMENT:"SSR_ENVIRONMENT"};var K=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setErrorHandler(){let e=this.core.getInput();if(!e)return!0;let{error:t,currentHour:i,currentMin:n,currentType:r,currentLength:s}=H(e,this.core.options.clock.type);if(this.removeErrorHandler(),t){if(v()===!1)return!1;let o=document.createElement("div");o.classList.add("tp-ui-invalid-text"),o.innerHTML="<b>Invalid Time Format</b>",e.classList.add("tp-ui-invalid-format"),e.nextElementSibling?.classList.contains("tp-ui-invalid-text")||e.after(o);let u={error:t,rejectedHour:void 0,rejectedMinute:void 0,inputHour:i,inputMinute:n,inputType:r,inputLength:s};return this.emitter.emit("error",u),!1}return!0}removeErrorHandler(){let e=this.core.getInput();if(!e)return;e.classList.remove("tp-ui-invalid-format");let t=e.nextElementSibling;t?.classList.contains("tp-ui-invalid-text")&&t.remove()}checkDisabledValuesOnStart(){if(!this.core.options.clock.disabledTime)return;let{disabledTime:e,type:t}=this.core.options.clock;if(e.interval){if(!t)throw new N("clockType is required when using disabledTime.interval",te.INVALID_PARAMETER);let o=Array.isArray(e.interval)?e.interval:[e.interval];try{ee(o,t)}catch(u){throw new N(`Invalid disabledTime.interval: ${u.message}`,te.INVALID_PARAMETER)}return}let{hours:i,minutes:n}=e,r=i?ve(i,"hour",t):!0,s=n?ve(n,"minutes",t):!0;if(!r||!s)throw new N("Invalid hours or minutes in disabledTime option",te.INVALID_PARAMETER)}destroy(){this.removeErrorHandler()}};var Z=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnClick(){let e=this.core.getOpenElement();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("show",{})};e.forEach(i=>{i.addEventListener("click",t),this.cleanupHandlers.push(()=>i.removeEventListener("click",t))})}handleOpenOnEnterFocus(){let e=this.core.getInput();if(!e)return;let t=i=>{i.key==="Enter"&&!this.core.isDestroyed&&this.emitter.emit("show",{})};e.addEventListener("keydown",t),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",t))}handleCancelButton(){let e=this.core.getCancelButton();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("cancel",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleOkButton(){let e=this.core.getOkButton();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getHour(),n=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit("confirm",{hour:i?.value,minutes:n?.value,type:r?.textContent||void 0})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleBackdropClick(){let e=this.core.getModalElement();if(!e)return;let t=i=>{this.core.isDestroyed||i.target===e&&this.emitter.emit("cancel",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleEscClick(){if(v()===!1)return;let e=t=>{this.core.isDestroyed||t.key==="Escape"&&this.emitter.emit("cancel",{})};document.addEventListener("keydown",e),this.cleanupHandlers.push(()=>document.removeEventListener("keydown",e))}handleAmClick(){let e=this.core.getAM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getPM();e.classList.add("active"),i?.classList.remove("active"),this.emitter.emit("select:am",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handlePmClick(){let e=this.core.getPM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getAM();e.classList.add("active"),i?.classList.remove("active"),this.emitter.emit("select:pm",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleHourEvents(){let e=this.core.getHour();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add("active"),this.core.getMinutes()?.classList.remove("active"),this.emitter.emit("select:hour",{hour:e.value})};if(e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t)),this.core.options.ui.editable){let i=e.value,n=()=>{this.core.isDestroyed||e.value!==i&&(i=e.value,this.emitter.emit("animation:clock",{}),this.emitter.emit("select:hour",{hour:e.value}))};e.addEventListener("blur",n),this.cleanupHandlers.push(()=>e.removeEventListener("blur",n))}}handleMinutesEvents(){let e=this.core.getMinutes();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add("active"),this.core.getHour()?.classList.remove("active"),this.emitter.emit("select:minute",{minutes:e.value})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleKeyboardInput(){let e=this.core.getHour(),t=this.core.getMinutes();if(e){let i=n=>{if(this.core.isDestroyed||n.key!=="ArrowUp"&&n.key!=="ArrowDown")return;n.preventDefault();let r=parseInt(e.value)||0,s=parseInt(e.getAttribute("max")||"23"),o=parseInt(e.getAttribute("min")||"0"),u=this.core.options.clock.type==="12h",l;n.key==="ArrowUp"?u?l=r>=12?1:r+1:l=r>=s?0:r+1:u?l=r<=1?12:r-1:l=r<=0?s:r-1,e.value=l.toString().padStart(2,"0"),this.emitter.emit("animation:clock",{}),this.emitter.emit("select:hour",{hour:e.value})};e.addEventListener("keydown",i),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",i))}if(t){let i=n=>{if(this.core.isDestroyed||n.key!=="ArrowUp"&&n.key!=="ArrowDown")return;n.preventDefault();let r=parseInt(t.value)||0,s=59,o=0,u;n.key==="ArrowUp"?u=r>=s?o:r+1:u=r<=o?s:r-1,t.value=u.toString().padStart(2,"0"),this.emitter.emit("animation:clock",{}),this.emitter.emit("select:minute",{minutes:t.value})};t.addEventListener("keydown",i),this.cleanupHandlers.push(()=>t.removeEventListener("keydown",i))}}focusTrapHandler(){if(v()===!1)return;let e=this.core.getWrapper();if(!e)return;let t=i=>{if(this.core.isDestroyed||i.key!=="Tab")return;let n=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),r=n[0],s=n[n.length-1];i.shiftKey&&document.activeElement===r?(s?.focus(),i.preventDefault()):!i.shiftKey&&document.activeElement===s&&(r?.focus(),i.preventDefault())};e.addEventListener("keydown",t),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",t))}handleMoveHand(){if(v()===!1)return;let e=t=>{this.core.isDestroyed||t.preventDefault()};document.addEventListener("mousedown",e,!1),document.addEventListener("touchstart",e,{passive:!1}),this.cleanupHandlers.push(()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)})}handleSwitchViewButton(){let e=this.core.getKeyboardClockIcon();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("switch:view",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}};var S=class{static angleToIndex(e,t,i){let n=Math.round(e/30)%12;if(t==="24h")if(i){let r=n+12;return r===12?0:r}else return n===0?12:n;return n===0?12:n}static indexToValue(e,t,i){if(t==="24h")return e.toString().padStart(2,"0");let n=e;return n===0&&(n=12),n>12&&(n=n-12),n.toString().padStart(2,"0")}static indexToAngle(e,t){return t==="24h"?e>=12?(e-12)%12*30:e%12*30:(e===0?12:e)%12*30}static isDisabled(e,t,i){return i?i.isInterval&&i.intervals&&i.clockType?this.isDisabledByInterval(e,t,i):i.hours?i.hours.some(n=>String(n)===e||Number(n)===Number(e)||n===e):!1:!1}static isDisabledByInterval(e,t,i){if(!i.intervals)return!1;for(let n=0;n<60;n++){let r=n.toString().padStart(2,"0");if(!this.isTimeInIntervals(e,r,t,i.intervals,i.clockType))return!1}return!0}static isTimeInIntervals(e,t,i,n,r){let s=r==="12h"?`${e}:${t} ${i}`:`${e}:${t}`;for(let o of n){let[u,l]=o.split("-").map(d=>d.trim());if(this.isTimeBetween(s,u,l,r))return!0}return!1}static isTimeBetween(e,t,i,n){let r=this.timeToMinutes(e,n),s=this.timeToMinutes(t,n),o=this.timeToMinutes(i,n);return r>=s&&r<=o}static timeToMinutes(e,t){if(t==="12h"){let i=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!i)return 0;let n=parseInt(i[1]),r=parseInt(i[2]),s=i[3].toUpperCase();return s==="PM"&&n!==12&&(n+=12),s==="AM"&&n===12&&(n=0),n*60+r}else{let[i,n]=e.split(":").map(Number);return i*60+n}}static findNearestValid(e,t,i,n,r){let s=t==="24h"?23:12;for(let o=0;o<=s;o++){let u=o===0?[e]:[e+o,e-o];for(let l of u){let d=l;d<0&&(d+=s+1),d>s&&(d=d%(s+1));let m=this.indexToValue(d,t,i);if(!this.isDisabled(m,i,n))return d}}return e}};var I=class{static angleToIndex(e){return Math.round(e/6)%60}static indexToValue(e){return e.toString().padStart(2,"0")}static indexToAngle(e){return e%60*6}static isDisabled(e,t,i,n,r){return n?n.isInterval&&n.intervals?this.isDisabledByInterval(e,t,i,n,r):n.minutes?n.minutes.some(s=>String(s)===e||Number(s)===Number(e)||s===e):!1:!1}static isDisabledByInterval(e,t,i,n,r){if(!n.intervals)return!1;let s=r==="12h"?`${t}:${e} ${i}`:`${t}:${e}`;for(let o of n.intervals){let[u,l]=o.split("-").map(d=>d.trim());if(this.isTimeBetween(s,u,l,r))return!0}return!1}static isTimeBetween(e,t,i,n){let r=this.timeToMinutes(e,n),s=this.timeToMinutes(t,n),o=this.timeToMinutes(i,n);return r>=s&&r<=o}static timeToMinutes(e,t){if(t==="12h"){let i=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!i)return 0;let n=parseInt(i[1]),r=parseInt(i[2]),s=i[3].toUpperCase();return s==="PM"&&n!==12&&(n+=12),s==="AM"&&n===12&&(n=0),n*60+r}else{let[i,n]=e.split(":").map(Number);return i*60+n}}static findNearestValid(e,t,i,n,r){for(let s=0;s<60;s++){let o=s===0?[e]:[e+s,e-s];for(let u of o){let l=u;l<0&&(l+=60),l>=60&&(l=l%60);let d=this.indexToValue(l);if(!this.isDisabled(d,t,i,n,r))return l}}return e}};var x=class{static normalizeAngle(e){let t=e%360;return t<0&&(t+=360),t}static calculateRawAngle(e,t){let i=e.x-t.x,n=e.y-t.y,s=Math.atan2(n,i)*180/Math.PI+90;return this.normalizeAngle(s)}static snapToIncrement(e,t){let i=Math.round(e/t)*t;return this.normalizeAngle(i)}static calculateDistance(e,t){let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)}static isInnerCircle(e,t){return e<t*.6}static calculateShortestPath(e,t){let i=this.normalizeAngle(e),r=this.normalizeAngle(t)-i,s=r>=0?r:r+360,o=r<=0?r:r-360,u=Math.abs(s)<Math.abs(o)?s:o;return e+u}};var ie=class{config;currentAngle=0;tipsCache=new Map;cachedDimensions=new Map;constructor(e){this.config=e}getCachedDimensions(e){let t=this.cachedDimensions.get(e);if(!t){let i=(e.offsetWidth-32)/2,n=(e.offsetHeight-32)/2,r=i-9;t={width:i,height:n,radius:r},this.cachedDimensions.set(e,t)}return t}setHandAngle(e){if(Math.abs(this.currentAngle-e)<.1)return;let t=x.calculateShortestPath(this.currentAngle,e);this.currentAngle=t,this.config.clockHand.style.transform=`rotateZ(${t}deg)`}setActiveValue(e){let t=[this.config.tipsWrapper];this.config.tipsWrapperFor24h&&t.push(this.config.tipsWrapperFor24h),t.forEach(i=>{i.querySelectorAll(".tp-ui-value-tips, .tp-ui-value-tips-24h").forEach(r=>{let s=r;s.textContent===e||Number(s.textContent)===Number(e)?(s.classList.add("active"),s.setAttribute("aria-selected","true")):(s.classList.remove("active"),s.setAttribute("aria-selected","false"))})})}renderTips(e,t,i,n,r,s=!0,o,u="",l="12"){if(v()===!1)return;let d=o||this.config.tipsWrapper;s&&(d.innerHTML="",this.tipsCache.clear());let{width:m,height:p,radius:E}=this.getCachedDimensions(d),T=document.createDocumentFragment(),w=`${t}-${this.config.theme||"default"}`;e.forEach((C,y)=>{let c=`${w}-${C}`,f=this.tipsCache.get(c);f||(f=this.createTip(C,t,r),this.tipsCache.set(c,f));let{wrapper:g,tip:M}=f;this.updateTipState(g,M,C,i,n,r,u,l);let h=y*(360/e.length)*(Math.PI/180);g.style.left=`${m+Math.sin(h)*E}px`,g.style.bottom=`${p+Math.cos(h)*E}px`,T.appendChild(g)}),d.appendChild(T)}createTip(e,t,i){if(v()===!1){let o={};return{wrapper:o,tip:o}}let n=document.createElement("span"),r=document.createElement("span");r.textContent=e,r.setAttribute("role","option"),r.setAttribute("aria-selected","false"),r.tabIndex=0;let s=i==="24h"&&t.includes("24")?"tp-ui-value-tips-24h":"tp-ui-value-tips";return r.classList.add(s),n.classList.add(t),this.config.theme&&(n.classList.add(this.config.theme),r.classList.add(this.config.theme)),n.appendChild(r),{wrapper:n,tip:r}}updateTipState(e,t,i,n,r,s,o,u){e.classList.remove("tp-ui-tips-disabled"),t.classList.remove("tp-ui-tips-disabled"),t.removeAttribute("aria-disabled"),t.tabIndex=0,this.checkIfDisabled(i,n,r,s,o,u)&&(e.classList.add("tp-ui-tips-disabled"),t.classList.add("tp-ui-tips-disabled"),t.setAttribute("aria-disabled","true"),t.tabIndex=-1)}checkIfDisabled(e,t,i,n,r,s){return i?t==="hours"?S.isDisabled(e,r,i):t==="minutes"?I.isDisabled(e,s,r,i,n):!1:!1}setCircleSize(e){e?this.config.circle.classList.remove("small-circle"):this.config.circle.classList.add("small-circle")}setCircle24hMode(e){e?(this.config.circle.classList.add("tp-ui-circle-hand-24h"),this.config.clockHand.classList.add("tp-ui-clock-hand-24h")):(this.config.circle.classList.remove("tp-ui-circle-hand-24h"),this.config.clockHand.classList.remove("tp-ui-clock-hand-24h"))}destroy(){this.tipsCache.clear(),this.cachedDimensions.clear(),this.config.tipsWrapper.innerHTML=""}};var Y=class{static processPointerInput(e){let t=x.calculateRawAngle(e.pointerPosition,e.clockCenter);return e.mode==="hours"?this.processHours(t,e):this.processMinutes(t,e)}static processHours(e,t){let i=t.incrementHours*30,n=x.snapToIncrement(e,i),r=x.calculateDistance(t.pointerPosition,t.clockCenter),s=t.clockType==="24h"&&x.isInnerCircle(r,t.clockRadius),o=S.angleToIndex(n,t.clockType,s),u=S.indexToValue(o,t.clockType,t.amPm),l=S.isDisabled(u,t.amPm,t.disabledTime);l&&(o=S.findNearestValid(o,t.clockType,t.amPm,t.disabledTime,s));let d=S.indexToValue(o,t.clockType,t.amPm);return{angle:S.indexToAngle(o,t.clockType),value:d,index:o,isValid:!l,isInnerCircle:t.clockType==="24h"?s:void 0}}static processMinutes(e,t){let i=t.incrementMinutes*6,n=x.snapToIncrement(e,i),r=I.angleToIndex(n),s=I.indexToValue(r),o=t.currentHour||"00",u=I.isDisabled(s,o,t.amPm,t.disabledTime,t.clockType);u&&(r=I.findNearestValid(r,o,t.amPm,t.disabledTime,t.clockType));let l=I.indexToValue(r);return{angle:I.indexToAngle(r),value:l,index:r,isValid:!u}}static valueToAngle(e,t,i){let n=parseInt(e,10);return t==="hours"?S.indexToAngle(n,i):I.indexToAngle(n)}};var ne=class{state;renderer;clockType;disabledTime;incrementHours;incrementMinutes;isDragging=!1;callbacks;constructor(e,t,i,n,r=1,s=1,o={}){this.renderer=e,this.state={...t},this.clockType=i,this.disabledTime=n,this.incrementHours=r,this.incrementMinutes=s,this.callbacks=o}handlePointerMove(e,t,i){this.isDragging=!0;let n={pointerPosition:e,clockCenter:t,clockRadius:i,mode:this.state.mode,clockType:this.clockType,amPm:this.state.amPm,disabledTime:this.disabledTime,incrementHours:this.incrementHours,incrementMinutes:this.incrementMinutes,currentHour:this.state.hour},r=Y.processPointerInput(n);r.isValid&&(this.state.mode==="hours"?(this.state.hour=r.value,this.state.hourAngle=r.angle,this.clockType==="24h"&&r.isInnerCircle!==void 0&&(this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(r.isInnerCircle)),this.callbacks.onHourChange&&this.callbacks.onHourChange(r.value)):(this.state.minute=r.value,this.state.minuteAngle=r.angle,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1),this.callbacks.onMinuteChange&&this.callbacks.onMinuteChange(r.value)),this.renderer.setHandAngle(r.angle),this.renderer.setActiveValue(r.value))}handlePointerUp(){this.isDragging=!1}switchMode(e){let t=this.state.mode===e;this.state.mode=e;let i=e==="hours"?this.state.hourAngle:this.state.minuteAngle,n=e==="hours"?this.state.hour:this.state.minute;if(e==="hours"&&this.clockType==="24h"){let r=parseInt(n,10),s=r===0||r>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(s)}else this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.renderer.setHandAngle(i),this.renderer.setActiveValue(n)}setValue(e,t){let i=Y.valueToAngle(t,e,this.clockType);if(e==="hours")if(this.state.hour=t,this.state.hourAngle=i,this.clockType==="24h"){let n=parseInt(t,10),r=n===0||n>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(r)}else this.renderer.setCircle24hMode(!1);else this.state.minute=t,this.state.minuteAngle=i,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.state.mode===e&&(this.renderer.setHandAngle(i),this.renderer.setActiveValue(t))}setAmPm(e){this.state.amPm=e}getState(){return{...this.state}}getHour(){return this.state.hour}getMinute(){return this.state.minute}getAmPm(){return this.state.amPm}updateDisabledTime(e){this.disabledTime=e}destroy(){this.renderer.destroy()}};var re=class{controller;clockFace;isActive=!1;config;cachedRect=null;cachedCenter=null;cachedRadius=null;constructor(e,t,i={}){this.controller=e,this.clockFace=t,this.config=i}attach(){this.clockFace.addEventListener("mousedown",this.handlePointerDown),this.clockFace.addEventListener("touchstart",this.handlePointerDown,{passive:!1})}detach(){this.clockFace.removeEventListener("mousedown",this.handlePointerDown),this.clockFace.removeEventListener("touchstart",this.handlePointerDown),this.removeGlobalListeners()}handlePointerDown=e=>{if(A())return;let t=e.target;t&&t.classList&&t.classList.contains("tp-ui-tips-disabled")||(e.preventDefault(),this.isActive=!0,this.cachedRect=this.clockFace.getBoundingClientRect(),this.cachedCenter=this.getClockCenter(),this.cachedRadius=this.getClockRadius(),this.processPointerEvent(e),document.addEventListener("mousemove",this.handlePointerMove),document.addEventListener("touchmove",this.handlePointerMove,{passive:!1}),document.addEventListener("mouseup",this.handlePointerUp),document.addEventListener("touchend",this.handlePointerUp))};handlePointerMove=e=>{if(!this.isActive)return;let t=this.getTargetElement(e);t&&t.classList&&t.classList.contains("tp-ui-tips-disabled")||(e.preventDefault(),this.processPointerEvent(e))};handlePointerUp=()=>{if(!this.isActive)return;this.isActive=!1,this.cachedRect=null,this.cachedCenter=null,this.cachedRadius=null,this.controller.handlePointerUp(),this.removeGlobalListeners();let{autoSwitchToMinutes:e,isMobileView:t,hourElement:i,minutesElement:n}=this.config;e&&i?.classList.contains("active")&&!t&&(n?.click(),n?.focus())};processPointerEvent(e){let t=this.getPointerPosition(e),i=this.cachedCenter||this.getClockCenter(),n=this.cachedRadius||this.getClockRadius();this.controller.handlePointerMove(t,i,n)}getPointerPosition(e){let t=this.cachedRect||this.clockFace.getBoundingClientRect();if(e instanceof TouchEvent){let i=e.touches[0]||e.changedTouches[0];return{x:i.clientX-t.left,y:i.clientY-t.top}}else return{x:e.clientX-t.left,y:e.clientY-t.top}}getTargetElement(e){if(e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(t&&!A())return document.elementFromPoint(t.clientX,t.clientY)}return e.target}getClockCenter(){let e=this.clockFace.offsetWidth,t=this.clockFace.offsetHeight;return{x:e/2,y:t/2}}getClockRadius(){return this.clockFace.offsetWidth/2}removeGlobalListeners(){v()!==!1&&(document.removeEventListener("mousemove",this.handlePointerMove),document.removeEventListener("touchmove",this.handlePointerMove),document.removeEventListener("mouseup",this.handlePointerUp),document.removeEventListener("touchend",this.handlePointerUp))}};var G=class{renderer;controller;dragHandlers;clockType;disabledTime;tipsWrapper;tipsWrapperFor24h;constructor(e){this.clockType=e.clockType,this.disabledTime=e.disabledTime,this.tipsWrapper=e.tipsWrapper,this.tipsWrapperFor24h=e.tipsWrapperFor24h;let t={clockFace:e.clockFace,tipsWrapper:e.tipsWrapper,tipsWrapperFor24h:e.tipsWrapperFor24h,clockHand:e.clockHand,circle:e.circle,theme:e.theme};this.renderer=new ie(t);let i={hour:e.initialHour,minute:e.initialMinute,amPm:e.initialAmPm,hourAngle:this.calculateInitialAngle("hours",e.initialHour),minuteAngle:this.calculateInitialAngle("minutes",e.initialMinute),mode:"hours"},n={onHourChange:e.onHourChange,onMinuteChange:e.onMinuteChange};this.controller=new ne(this.renderer,i,e.clockType,e.disabledTime,e.incrementHours||1,e.incrementMinutes||1,n),this.dragHandlers=new re(this.controller,e.clockFace,e.dragConfig||{})}initialize(){this.dragHandlers.attach(),this.switchToHours()}switchToHours(){this.controller.switchMode("hours"),this.clockType==="24h"&&this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.remove("none"),this.renderHourTips();let e=this.controller.getState();this.renderer.setActiveValue(e.hour)}switchToMinutes(){this.controller.switchMode("minutes"),this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.add("none"),this.renderMinuteTips();let e=this.controller.getState();this.renderer.setActiveValue(e.minute)}setHour(e){this.controller.setValue("hours",e)}setMinute(e){this.controller.setValue("minutes",e)}setAmPm(e){this.controller.setAmPm(e);let t=this.controller.getState();t.mode==="hours"?(this.renderHourTips(),this.renderer.setHandAngle(t.hourAngle),this.renderer.setActiveValue(t.hour)):(this.renderMinuteTips(),this.renderer.setHandAngle(t.minuteAngle),this.renderer.setActiveValue(t.minute))}getHour(){return this.controller.getHour()}getMinute(){return this.controller.getMinute()}getAmPm(){return this.controller.getAmPm()}updateDisabledTime(e){this.controller.updateDisabledTime(e),this.controller.getState().mode==="hours"?this.renderHourTips():this.renderMinuteTips()}renderHourTips(){let t=this.controller.getState().amPm;this.clockType==="24h"?(this.renderer.renderTips(pe,"tp-ui-hour-time-12","hours",this.disabledTime,this.clockType,!0,this.tipsWrapper,t),this.tipsWrapperFor24h&&this.renderer.renderTips(ke,"tp-ui-hour-time-24","hours",this.disabledTime,this.clockType,!0,this.tipsWrapperFor24h,t)):this.renderer.renderTips(pe,"tp-ui-hour-time-12","hours",this.disabledTime,this.clockType,!0,void 0,t)}renderMinuteTips(){let e=this.controller.getState(),t=e.amPm,i=e.hour;this.renderer.renderTips(B,"tp-ui-minutes-time","minutes",this.disabledTime,this.clockType,!0,void 0,t,i)}calculateInitialAngle(e,t){let i=parseInt(t,10);return e==="hours"?i%12*30:i*6}destroy(){this.dragHandlers.detach(),this.controller.destroy()}};var j=class{core;emitter;clockSystem=null;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("select:hour",({hour:e})=>{this.emitter.emit("animation:clock",{}),this.setHoursToClock(e||null)}),this.emitter.on("select:minute",({minutes:e})=>{this.emitter.emit("animation:clock",{}),this.setMinutesToClock(e||null)}),this.emitter.on("select:am",()=>{this.updateAmPm()}),this.emitter.on("select:pm",()=>{this.updateAmPm()})}initializeClockSystem(){let e=this.core.getClockFace(),t=this.core.getClockHand(),i=this.core.getCircle();if(!e||!t||!i)return;let n=this.core.options.clock.type==="24h",r=this.core.getTipsWrapper();if(!r)return;let s=this.core.getHour(),o=this.core.getMinutes(),u={clockFace:e,tipsWrapper:r,tipsWrapperFor24h:n&&this.core.getTipsWrapperFor24h()||void 0,clockHand:t,circle:i,clockType:this.core.options.clock.type||"12h",disabledTime:this.convertDisabledTime(),initialHour:s?.value||"12",initialMinute:o?.value||"00",initialAmPm:this.getAmPmValue(),theme:this.core.options.ui.theme,incrementHours:this.core.options.clock.incrementHours||1,incrementMinutes:this.core.options.clock.incrementMinutes||1,timepicker:null,dragConfig:{autoSwitchToMinutes:this.core.options.clock.autoSwitchToMinutes,isMobileView:this.core.isMobileView,hourElement:s,minutesElement:o},onHourChange:l=>{let d=this.core.getHour();d&&(d.value=l)},onMinuteChange:l=>{let d=this.core.getMinutes();d&&(d.value=l)}};this.clockSystem=new G(u),this.clockSystem.initialize()}convertDisabledTime(){let e=this.core.disabledTime?.value;if(!e)return null;let t;return e.intervals&&(t=Array.isArray(e.intervals)?e.intervals:[e.intervals]),{hours:e.hours,minutes:e.minutes,isInterval:e.isInterval,intervals:t,clockType:e.clockType}}getAmPmValue(){if(this.core.options.clock.type==="24h")return"";let e=this.core.getActiveTypeMode();if(e){let i=e.textContent?.trim();if(i==="AM"||i==="PM")return i}return this.core.getAM()?.classList.contains("active")?"AM":"PM"}destroyClockSystem(){this.clockSystem&&(this.clockSystem.destroy(),this.clockSystem=null)}removeCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e?.classList.remove("tp-ui-circle-hand-24h"),t?.classList.remove("tp-ui-clock-hand-24h")}setCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e&&e.classList.add("tp-ui-circle-hand-24h"),t&&t.classList.add("tp-ui-clock-hand-24h")}setOnStartCSSClassesIfClockType24h(){if(this.core.options.clock.type==="24h"){let e=this.core.getInput();if(!e)return;let t;e.value.length>0&&(t=e.value.split(":")[0]),t&&(Number(t)>12||Number(t)===0)&&this.setCircleClockClasses24h()}}setBgColorToCircleWithMinutesTips=()=>{let e=this.core.getMinutes(),t=this.core.getCircle();if(!(!e||!t)&&e.value&&B.includes(e.value)){let i=getComputedStyle(t).getPropertyValue("--timepicker-primary").trim();i&&(t.style.backgroundColor=i),t.classList.remove("small-circle")}};removeBgColorToCirleWithMinutesTips=()=>{let e=this.core.getMinutes(),t=this.core.getCircle();!e||!t||e.value&&B.includes(e.value)||(t.style.backgroundColor="",t.classList.add("small-circle"))};setClassActiveToHourOnOpen=()=>{if(this.core.options.ui.mobile||this.core.isMobileView)return;this.core.getHour()?.classList.add(P)};setMinutesToClock=e=>{this.clockSystem&&(this.removeBgColorToCirleWithMinutesTips(),e&&this.clockSystem.setMinute(e),this.clockSystem.switchToMinutes())};setHoursToClock=e=>{this.clockSystem&&(e&&this.clockSystem.setHour(e),this.clockSystem.switchToHours())};setTransformToCircleWithSwitchesHour=e=>{!this.clockSystem||!e||this.clockSystem.setHour(e)};setTransformToCircleWithSwitchesMinutes=e=>{!this.clockSystem||!e||this.clockSystem.setMinute(e)};updateAmPm=()=>{if(!this.clockSystem||this.core.options.clock.type==="24h")return;let e=this.getAmPmValue();e!==""&&this.clockSystem.setAmPm(e)};toggleClassActiveToValueTips=e=>{if(this.clockSystem)return;let t=this.core.getAllValueTips();if(!t)return;let i=t.find(n=>Number(n.innerText)===Number(e));t.forEach(n=>{n.classList.remove(P),n.setAttribute("aria-selected","false")}),i!==void 0&&(i.classList.add(P),i.setAttribute("aria-selected","true"))};destroy(){this.destroyClockSystem()}};var se=class{animation;modal;config;theme;validation;events;clock;constructor(e,t){this.animation=new F(e,t),this.modal=new W(e,t),this.config=new U(e,t),this.theme=new z(e,t),this.validation=new K(e,t),this.events=new Z(e,t),this.clock=new j(e,t)}destroy(){this.animation.destroy(),this.modal.destroy(),this.config.destroy(),this.theme.destroy(),this.validation.destroy(),this.events.destroy(),this.clock.destroy()}};var oe="is-rippling",ae="ripple-hold",R=null;function _e(a){let e=a.target,t=e.hasAttribute("data-md3-ripple")?e:e.closest("[data-md3-ripple]");if(!t||a.button!==0&&a.pointerType==="mouse")return;let i=t.getBoundingClientRect(),r=Math.max(i.width,i.height)*2,s=a.clientX-i.left,o=a.clientY-i.top;t.style.setProperty("--ripple-size",`${r}px`),t.style.setProperty("--ripple-x",`${s}px`),t.style.setProperty("--ripple-y",`${o}px`),t.classList.remove(oe,ae),t.offsetWidth,t.classList.add(oe,ae),t._rippleHold=!0,R=t}function He(a){let e=a.target,i=(e.hasAttribute("data-md3-ripple")?e:e.closest("[data-md3-ripple]"))||R;i&&(i._rippleHold=!1,i.classList.remove(ae),setTimeout(()=>{i.classList.remove(oe),R===i&&(R=null)},1e3))}function Be(a){let e=a.currentTarget;!e||!e._rippleHold||(e._rippleHold=!1,e.classList.remove(ae),setTimeout(()=>{e.classList.remove(oe),R===e&&(R=null)},1e3))}function Se(a){if(v()===!1)return;let e=a||document;e.addEventListener("pointerdown",_e),e.addEventListener("pointerup",He),e.addEventListener("pointercancel",He),e.querySelectorAll("[data-md3-ripple]").forEach(i=>{i.addEventListener("mouseleave",Be)})}var Ie=(a,e)=>{let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{a(...i)},e)}};var le=class{core;managers;emitter;eventsClickMobileHandler=()=>{};mutliEventsMoveHandler=()=>{};constructor(e,t,i){this.core=e,this.managers=t,this.emitter=i}init(){if(!this.core.isDestroyed&&!this.core.isInitialized){try{this.managers.config.updateInputValueWithCurrentTimeOnStart(),this.managers.validation.checkDisabledValuesOnStart()}catch{this.core.setIsDestroyed(!0);return}this.managers.theme.setTimepickerClassToElement(),this.managers.theme.setInputClassToInputElement(),this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(),this.managers.theme.setClassTopOpenElement(),this.managers.config.getDisableTime(),this.core.options.ui.inline?.enabled||this.managers.events.handleOpenOnClick(),this.managers.events.handleOpenOnEnterFocus(),this.setupCallbackBridge(),this.core.setIsInitialized(!0)}}setupCallbackBridge(){let{callbacks:e}=this.core.options;e.onOpen&&this.emitter.on("open",e.onOpen),e.onCancel&&this.emitter.on("cancel",e.onCancel),e.onConfirm&&this.emitter.on("confirm",e.onConfirm),e.onUpdate&&this.emitter.on("update",e.onUpdate),e.onSelectHour&&this.emitter.on("select:hour",e.onSelectHour),e.onSelectMinute&&this.emitter.on("select:minute",e.onSelectMinute),e.onSelectAM&&this.emitter.on("select:am",e.onSelectAM),e.onSelectPM&&this.emitter.on("select:pm",e.onSelectPM),e.onError&&this.emitter.on("error",e.onError)}mount(){this.core.isDestroyed||(this.core.isInitialized||this.init(),this.eventsBundle())}unmount(e){let t=Ie((...i)=>{if(i.length>2||!this.core.getModalElement())return;let[n]=i.filter(o=>typeof o=="boolean"),[r]=i.filter(o=>typeof o=="function");this.core.setIsMobileView(!!this.core.options.ui.mobile),n&&this.core.getOkButton()?.click(),this.core.setIsTouchMouseMove(!1),this.removeEventListeners(),this.managers.animation.removeAnimationToClose(),this.core.getOpenElement().forEach(o=>o?.classList.remove("disabled")),setTimeout(()=>{typeof document<"u"&&(document.body.style.overflowY="",document.body.style.paddingRight="")},k.SCROLLBAR_RESTORE),setTimeout(()=>{let o=this.core.getInput();this.core.options.behavior.focusInputAfterClose&&o?.focus();let u=this.core.getModalElement();u!==null&&(u.remove(),this.core.setIsModalRemove(!0))},k.MODAL_REMOVE),r&&r()},this.core.options.behavior.delayHandler||k.DEFAULT_DELAY);e?t(e):t()}destroy(e){if(this.core.isDestroyed)return;let t=typeof e=="function"?{callback:e}:e||{},{keepInputValue:i=!1,callback:n}=t,r=this.core.getInput(),s=i?r?.value:null;this.removeEventListeners(),this.core.getModalElement()?.remove(),this.core.getOpenElement()?.forEach(m=>{m&&(m.classList.remove("disabled","active","tp-ui-open-element"),m.classList.remove("basic","crane-straight","crane","m2","m3-green"))}),r&&(r.classList.remove("tp-ui-invalid-format","invalid-value","error","active","tp-ui-input"),r.removeAttribute("data-open"),r.removeAttribute("data-owner-id"),i&&s&&(r.value=s));let l=this.core.element;l&&(l.classList.remove("basic","crane-straight","crane","m2","m3-green"),l.classList.remove("error","active","disabled"),l.removeAttribute("data-owner-id"),l.removeAttribute("data-open"),this.core.options.ui.cssClass&&l.classList.remove(this.core.options.ui.cssClass)),l?.querySelectorAll(".tp-ui-invalid-text")?.forEach(m=>m.remove()),this.mutliEventsMoveHandler=()=>{},this.eventsClickMobileHandler=()=>{},this.core.reset(),this.managers.destroy(),this.emitter.clear(),A()||(document.body.style.overflowY="",document.body.style.paddingRight=""),n&&n()}eventsBundle(){if(this.core.isDestroyed||!this.core.isModalRemove)return;if(this.managers.validation.setErrorHandler(),this.managers.validation.removeErrorHandler(),!this.core.options.ui.inline?.enabled){let i=this.core.getOpenElement(),n=this.core.getInput();i.forEach(r=>r?.classList.add("disabled")),n?.blur()}if(this.managers.modal.setScrollbarOrNot(),this.managers.modal.setModalTemplate(),this.managers.modal.setNormalizeClass(),this.managers.modal.removeBackdrop(),this.core.isMobileView)this.managers.config.updateClockFaceAccessibility(!0);else{let i=this.core.getModalElement(),n=i?.querySelector(".tp-ui-mobile-clock-wrapper"),r=i?.querySelector(".tp-ui-wrapper"),s=i?.querySelectorAll("*");n?.classList.add("expanded"),r?.classList.add("expanded"),s?.forEach(o=>{!o.classList.contains("tp-ui-select-time")&&!o.classList.contains("tp-ui-mobile-clock-wrapper")&&!o.classList.contains("tp-ui-wrapper")&&o.classList.add("expanded")})}this.managers.modal.setFlexEndToFooterIfNoKeyboardIcon(),setTimeout(()=>{this.managers.theme.setTheme();let i=this.core.getWrapper();i&&this.core.options.ui.cssClass&&i.classList.add(this.core.options.ui.cssClass)},0),this.managers.animation.setAnimationToOpen(),this.managers.config.getInputValueOnOpenAndSet(),this.managers.clock.initializeClockSystem(),this.managers.clock.setOnStartCSSClassesIfClockType24h(),this.managers.clock.setClassActiveToHourOnOpen(),this.managers.events.handleCancelButton(),this.managers.events.handleOkButton(),this.managers.events.handleHourEvents(),this.managers.events.handleMinutesEvents(),this.managers.events.handleKeyboardInput(),this.core.options.ui.enableSwitchIcon&&this.managers.events.handleSwitchViewButton(),this.core.options.clock.type!=="24h"&&(this.managers.events.handleAmClick(),this.managers.events.handlePmClick()),this.core.options.behavior.focusTrap&&this.managers.events.focusTrapHandler(),this.core.options.ui.inline?.enabled||(this.managers.events.handleEscClick(),this.managers.events.handleBackdropClick());let e=this.core.getModalElement();e&&Se(e);let t=this.core.getClockFace();t&&typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{t?.classList.add("scale-in")})}),this.managers.modal.setShowClassToBackdrop()}removeEventListeners(){if(v()===!1)return;Ae.split(" ").forEach(t=>{document.removeEventListener(t,this.mutliEventsMoveHandler,!1)}),document.removeEventListener("mousedown",this.eventsClickMobileHandler)}};var $=class{events=new Map;on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}once(e,t){let i=n=>{t(n),this.off(e,i)};this.on(e,i)}off(e,t){t?this.events.get(e)?.delete(t):this.events.delete(e)}emit(e,t){this.events.get(e)?.forEach(i=>{i(t)})}clear(){this.events.clear()}hasListeners(e){return(this.events.get(e)?.size??0)>0}};var V={clock:{type:"12h",incrementHours:1,incrementMinutes:1,autoSwitchToMinutes:!1,disabledTime:void 0,currentTime:void 0},ui:{theme:"basic",animation:!0,backdrop:!0,mobile:!1,enableSwitchIcon:!1,editable:!1,enableScrollbar:!1,cssClass:void 0,appendModalSelector:"",iconTemplate:"",iconTemplateMobile:"",inline:void 0},labels:{am:"AM",pm:"PM",ok:"OK",cancel:"Cancel",time:"Select time",mobileTime:"Enter Time",mobileHour:"Hour",mobileMinute:"Minute"},behavior:{focusInputAfterClose:!1,focusTrap:!0,delayHandler:300,id:void 0},callbacks:{onOpen:void 0,onCancel:void 0,onConfirm:void 0,onUpdate:void 0,onSelectHour:void 0,onSelectMinute:void 0,onSelectAM:void 0,onSelectPM:void 0,onError:void 0}};function ge(a={}){return{clock:{...V.clock,...a.clock||{}},ui:{...V.ui,...a.ui||{}},labels:{...V.labels,...a.labels||{}},behavior:{...V.behavior,...a.behavior||{}},callbacks:{...V.callbacks,...a.callbacks||{}}}}var we=a=>a.replace(/[^0-9:APMapm\s]/g,"");var q=new Map,X=class{core;managers;lifecycle;emitter;constructor(e,t){if(A())throw new Error("TimepickerUI requires browser environment");let i=this.resolveInputElement(e);if(!i)throw new Error("Input element not found");let n=t?.behavior?.id,r=n||`tp-ui-${Te()}`,s=this.createWrapperElement(i),o=ge(t||{});if(o.ui.inline?.enabled&&typeof t?.behavior?.focusTrap>"u"&&(o.behavior.focusTrap=!1),o.ui.inline?.enabled){if(!o.ui.inline.containerId)throw new Error("inline.containerId is required when inline mode is enabled");if(!A()&&!document.getElementById(o.ui.inline.containerId))throw new Error(`Container element with id "${o.ui.inline.containerId}" not found`)}this.emitter=new $,this.core=new J(s,o,r,n);let u=this.core.getInput();if(u){let l=H(u,o.clock.type),d=Number(l.hour)*30,m=Number(l.minutes)*6;this.core.setDegreesHours(d),this.core.setDegreesMinutes(m)}this.managers=new se(this.core,this.emitter),this.lifecycle=new le(this.core,this.managers,this.emitter),this.managers.config.checkMobileOption(),this.managers.config.preventClockTypeByCurrentTime(),this.setupInternalEventListeners(),q.set(this.core.instanceId,this)}setupInternalEventListeners(){this.emitter.on("show",()=>{this.core.isDestroyed||this.lifecycle.mount()}),this.emitter.on("cancel",()=>{this.core.isDestroyed||this.lifecycle.unmount()}),this.emitter.on("confirm",e=>{if(!this.core.isDestroyed){let t=this.core.getInput();if(t&&e.hour&&e.minutes){let i=e.type?` ${e.type}`:"";t.value=`${e.hour}:${e.minutes}${i}`}this.lifecycle.unmount()}})}create(){this.lifecycle.init(),this.core.options.ui.inline?.enabled&&this.lifecycle.mount()}open(e){this.lifecycle.mount(),e&&e()}close(e,t){this.lifecycle.unmount(e?t:void 0),!e&&t&&t()}destroy(e){q.delete(this.core.instanceId),this.lifecycle.destroy(e)}update(e,t){this.core.isDestroyed||(this.core.updateOptions(e.options),this.managers.config.checkMobileOption(),e.create&&this.create(),t&&t())}getValue(){if(this.core.isDestroyed)return{hour:"",minutes:"",type:void 0,time:"",degreesHours:null,degreesMinutes:null};let e=this.core.getHour(),t=this.core.getMinutes(),i=this.core.getActiveTypeMode(),n=e?.value||"12",r=t?.value||"00",s=this.core.options.clock.type==="24h"?void 0:i?.textContent||"AM",o="";return this.core.options.clock.type==="24h"?o=`${n.padStart(2,"0")}:${r.padStart(2,"0")}`:o=`${n}:${r.padStart(2,"0")} ${s}`,{hour:n,minutes:r,type:s,time:o,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes}}setValue(e,t=!0){if(this.core.isDestroyed||!e||typeof e!="string")return;this.core.isInitialized||this.create();let i=we(e.trim()),n="12",r="00",s="AM";try{if(this.core.options.clock.type==="24h"){let p=i.match(/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/);if(!p)throw new Error("Invalid 24h format. Expected HH:MM");n=p[1].padStart(2,"0"),r=p[2]}else{let p=i.match(/^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i);if(!p)throw new Error("Invalid 12h format. Expected HH:MM AM/PM");n=p[1],r=p[2],s=p[3].toUpperCase()}let o=this.core.getHour(),u=this.core.getMinutes(),l=this.core.getAM(),d=this.core.getPM();if(o&&(o.value=n,o.setAttribute("aria-valuenow",n),this.core.setDegreesHours(Number(n)*30)),u&&(u.value=r,u.setAttribute("aria-valuenow",r),this.core.setDegreesMinutes(Number(r)*6)),this.core.options.clock.type!=="24h"&&l&&d&&(s==="AM"?(l.classList.add("active"),d.classList.remove("active")):(d.classList.add("active"),l.classList.remove("active"))),t){let p=this.core.getInput();p&&(p.value=i)}let m=this.core.getClockHand();m&&(m.style.transform=`rotateZ(${this.core.degreesHours||0}deg)`)}catch{return}}getElement(){return this.core.element}get instanceId(){return this.core.instanceId}get options(){return this.core.options}get isInitialized(){return this.core.isInitialized}get isDestroyed(){return this.core.isDestroyed}get hour(){return this.core.getHour()}get minutes(){return this.core.getMinutes()}get okButton(){return this.core.getOkButton()}get cancelButton(){return this.core.getCancelButton()}get clockHand(){return this.core.getClockHand()}on(e,t){this.core.isDestroyed||this.emitter.on(e,t)}once(e,t){this.core.isDestroyed||this.emitter.once(e,t)}off(e,t){this.core.isDestroyed||this.emitter.off(e,t)}resolveInputElement(e){if(v()===!1)return null;let t=null;if(typeof e=="string"){if(t=document.querySelector(e),!t)return null}else if(e instanceof HTMLElement)t=e;else return null;return t.tagName==="INPUT"?t:t.querySelector("input")}createWrapperElement(e){if(v()===!1)return e;let t=e.parentElement;if(e.tagName==="INPUT"&&!t?.classList.contains("tp-ui")){let i=document.createElement("div");return i.className="tp-ui",e.parentNode?.insertBefore(i,e),i.appendChild(e),i}return t&&!t.classList.contains("tp-ui")&&t.classList.add("tp-ui"),t||e}static getById(e){return q.get(e)}static getAllInstances(){return Array.from(q.values())}static isAvailable(e){return A()?!1:typeof e=="string"?document.querySelector(e)!==null:e instanceof HTMLElement?document.contains(e):!1}static destroyAll(){Array.from(q.values()).forEach(t=>t.destroy()),q.clear()}};var ce=X;var We=ce;0&&(module.exports={EventEmitter,TimepickerUI});
|
|
1
|
+
"use strict";var ue=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var Pe=(a,e)=>{for(var t in e)ue(a,t,{get:e[t],enumerable:!0})},Ne=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xe(e))!Oe.call(a,n)&&n!==t&&ue(a,n,{get:()=>e[n],enumerable:!(i=De(e,n))||i.enumerable});return a};var Re=a=>Ne(ue({},"__esModule",{value:!0}),a);var Ue={};Pe(Ue,{EventEmitter:()=>$,TimepickerUI:()=>ce,default:()=>We});module.exports=Re(Ue);var A=()=>typeof window>"u",v=()=>typeof document<"u";var J=class{state;constructor(e,t,i,n){this.state={degreesHours:null,degreesMinutes:null,options:t,element:e,instanceId:i,isMobileView:!1,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isInitialized:!1,customId:n,eventHandlersRegistered:!1,isDestroyed:!1}}get degreesHours(){return this.state.degreesHours}get degreesMinutes(){return this.state.degreesMinutes}get options(){return this.state.options}get element(){return this.state.element}get instanceId(){return this.state.instanceId}get isMobileView(){return this.state.isMobileView}get isTouchMouseMove(){return this.state.isTouchMouseMove}get disabledTime(){return this.state.disabledTime}get cloned(){return this.state.cloned}get isModalRemove(){return this.state.isModalRemove}get isInitialized(){return this.state.isInitialized}get customId(){return this.state.customId}get eventHandlersRegistered(){return this.state.eventHandlersRegistered}get isDestroyed(){return this.state.isDestroyed}setDegreesHours(e){this.state={...this.state,degreesHours:e}}setDegreesMinutes(e){this.state={...this.state,degreesMinutes:e}}setOptions(e){this.state={...this.state,options:e}}setIsMobileView(e){this.state={...this.state,isMobileView:e}}setIsTouchMouseMove(e){this.state={...this.state,isTouchMouseMove:e}}setDisabledTime(e){this.state={...this.state,disabledTime:e}}setCloned(e){this.state={...this.state,cloned:e}}setIsModalRemove(e){this.state={...this.state,isModalRemove:e}}setIsInitialized(e){this.state={...this.state,isInitialized:e}}setEventHandlersRegistered(e){this.state={...this.state,eventHandlersRegistered:e}}setIsDestroyed(e){this.state={...this.state,isDestroyed:e}}updateOptions(e){this.state={...this.state,options:{...this.state.options,clock:{...this.state.options.clock,...e.clock||{}},ui:{...this.state.options.ui,...e.ui||{}},labels:{...this.state.options.labels,...e.labels||{}},behavior:{...this.state.options.behavior,...e.behavior||{}},callbacks:{...this.state.options.callbacks,...e.callbacks||{}}}}}reset(){this.state={...this.state,degreesHours:null,degreesMinutes:null,isTouchMouseMove:!1,disabledTime:null,cloned:null,isModalRemove:!0,isInitialized:!1,isDestroyed:!0,eventHandlersRegistered:!1}}getModalElement(){return v()===!1?null:document.querySelector(`[data-owner-id="${this.state.instanceId}"]`)}getInput(){return this.state.element?.querySelector("input")}getClockFace(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-clock-face.mobile"):e.querySelector(".tp-ui-clock-face:not(.mobile)"):null}getClockHand(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-clock-hand"):e.querySelector(".tp-ui-clock-hand:not(.mobile)"):null}getCircle(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-circle-hand"):e.querySelector(".tp-ui-circle-hand:not(.mobile)"):null}getTipsWrapper(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper"):e.querySelector(".tp-ui-tips-wrapper:not(.mobile)"):null}getTipsWrapperFor24h(){let e=this.getModalElement();return e?this.state.isMobileView?e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h"):e.querySelector(".tp-ui-tips-wrapper-24h:not(.mobile)"):null}getMinutes(){return this.getModalElement()?.querySelector(".tp-ui-minutes")||null}getHour(){return this.getModalElement()?.querySelector(".tp-ui-hour")||null}getAM(){return this.getModalElement()?.querySelector(".tp-ui-am")||null}getPM(){return this.getModalElement()?.querySelector(".tp-ui-pm")||null}getHourText(){return this.getModalElement()?.querySelector(".tp-ui-hour-text")||null}getMinutesText(){return this.getModalElement()?.querySelector(".tp-ui-minute-text")||null}getHeader(){return this.getModalElement()?.querySelector(".tp-ui-header")||null}getInputWrappers(){return this.getModalElement()?.querySelectorAll(".tp-ui-input-wrapper")||null}getDots(){return this.getModalElement()?.querySelector(".tp-ui-dots")||null}getMinutesTips(){return this.getModalElement()?.querySelector(".tp-ui-minutes-time")||null}getHourTips(){return this.getModalElement()?.querySelector(".tp-ui-hour-time-12")||null}getAllValueTips(){let e=this.getModalElement();return e?[...e.querySelectorAll(".tp-ui-value-tips"),...e.querySelectorAll(".tp-ui-value-tips-24h")]:[]}getOpenElementData(){let e=this.state.element?.querySelectorAll("[data-open]");if(e?.length>0){let t=[];return e.forEach(({dataset:i})=>t.push(i.open??"")),[...new Set(t)]}return null}getOpenElement(){let e=this.getInput(),t=this.getOpenElementData();return t===null?(e?.setAttribute("data-open","tp-ui-input"),[e]):t.map(i=>this.state.element?.querySelectorAll(`[data-open='${i}']`))[0]??""}getCancelButton(){return this.getModalElement()?.querySelector(".tp-ui-cancel-btn")||null}getOkButton(){return this.getModalElement()?.querySelector(".tp-ui-ok-btn")||null}getActiveTypeMode(){return this.getModalElement()?.querySelector(".tp-ui-type-mode.active")||null}getKeyboardClockIcon(){return this.getModalElement()?.querySelector(".tp-ui-keyboard-icon-wrapper")||null}getFooter(){return this.getModalElement()?.querySelector(".tp-ui-footer")||null}getWrapper(){return this.getModalElement()?.querySelector(".tp-ui-wrapper")||null}};var k={DEFAULT_DELAY:300,MODAL_ANIMATION:150,SCROLLBAR_RESTORE:400,MODAL_REMOVE:300,CLOCK_ANIMATION:600,TIPS_ANIMATION:401,MOBILE_TOGGLE:450,CLOCK_SCALE_DELAY:150};var F=class{core;emitter;timeouts=[];constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("animation:clock",()=>{this.handleAnimationSwitchTipsMode()})}runWithAnimation(e,t=k.MODAL_ANIMATION){if(this.core.options.ui.animation){let i=setTimeout(e,t);this.timeouts.push(i)}else e()}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}setAnimationToOpen(){this.clearAllTimeouts(),this.core.getModalElement()?.classList.add("opacity"),this.runWithAnimation(()=>{this.core.getModalElement()?.classList.add("show")})}removeAnimationToClose(){this.clearAllTimeouts(),this.core.getModalElement()&&this.runWithAnimation(()=>{let t=this.core.getModalElement();t?.classList.remove("show"),t?.classList.remove("opacity")})}handleAnimationClock(){this.core.options.ui.animation&&this.runWithAnimation(()=>{this.core.getClockFace()?.classList.add("tp-ui-clock-animation");let t=setTimeout(()=>{this.core.getClockFace()?.classList.remove("tp-ui-clock-animation")},k.CLOCK_ANIMATION);this.timeouts.push(t)})}handleAnimationSwitchTipsMode(){let e=this.core.getClockHand();if(!e)return;e.classList.add("tp-ui-tips-animation");let t=setTimeout(()=>{this.core.getClockHand()?.classList.remove("tp-ui-tips-animation")},k.TIPS_ANIMATION);this.timeouts.push(t)}destroy(){this.clearAllTimeouts()}};var Ee=()=>{if(v()===!1)return 0;let a=document.createElement("div");a.className="tp-ui-measure",document.body.appendChild(a);let e=a.getBoundingClientRect().width-a.clientWidth;return document.body.removeChild(a),e};var be=(a,e)=>a?a.classList.contains(e):!1,_=(a,e)=>Array.from({length:Number(e)-Number(a)+1},(t,i)=>Number(a)+i),Q=(a,e)=>Array.from({length:Number(e)-Number(a)+1},(t,i)=>Number(e)-i).reverse();var de=(a="")=>{let e=a.replace(/(AM|PM|am|pm)/,r=>` ${r}`),t=new Date(`September 20, 2000 ${e}`),i=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");return`${i}:${n}`},me=a=>{let[e,t]=a.split(":");return`${e.padStart(2,"0")}:${t.padStart(2,"0")}`},ee=(a,e)=>{if(a.length<2)return!1;let t=a.map(i=>{let[n,r]=i.trim().split("-"),s,o;if(e==="12h"){if(!/\s?(AM|PM|am|pm)\s?$/.test(n.trim())||!/\s?(AM|PM|am|pm)\s?$/.test(r.trim()))throw new Error(`Invalid 12h format: "${i}"`);s=de(n.trim()),o=de(r.trim())}else{if(/\s?(AM|PM|am|pm)\s?/.test(n.trim())||/\s?(AM|PM|am|pm)\s?/.test(r.trim()))throw new Error(`Invalid 24h format: "${i}"`);s=me(n.trim()),o=me(r.trim())}return{start:s,end:o,original:i}});for(let i=0;i<t.length;i++)for(let n=i+1;n<t.length;n++){let r=t[i],s=t[n];if(r.start<=s.end&&r.end>=s.start||s.start<=r.end&&s.end>=r.start)throw new Error(`Overlapping intervals: "${r.original}" and "${s.original}"`)}return!1},Te=()=>typeof window<"u"&&window.crypto&&typeof window.crypto.randomUUID=="function"?window.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)});var ye='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M160-200q-33 0-56.5-23.5T80-280v-400q0-33 23.5-56.5T160-760h640q33 0 56.5 23.5T880-680v400q0 33-23.5 56.5T800-200H160Zm0-80h640v-400H160v400Zm160-40h320v-80H320v80ZM200-440h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM200-560h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80Zm120 0h80v-80h-80v80ZM160-280v-400 400Z"/></svg>';var Me='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"/></svg>';var ke=["00","13","14","15","16","17","18","19","20","21","22","23"],pe=["12","1","2","3","4","5","6","7","8","9","10","11"],B=["00","05","10","15","20","25","30","35","40","45","50","55"],Ce=(a,e)=>{let{ui:{iconTemplate:t,enableSwitchIcon:i,animation:n,theme:r,mobile:s,editable:o,iconTemplateMobile:u},labels:{time:l,mobileTime:d,am:m,pm:p,cancel:E,ok:T,mobileMinute:w,mobileHour:C},clock:{type:y}}=a,c=s?"mobile":"",f=`<button aria-label="Keyboard" type="button" class="tp-ui-keyboard-icon">${t||ye}</button>`,g=u||`<button aria-label="Clock" type="button" class="tp-ui-keyboard-icon">${u||Me}</button>`;return`<div class="tp-ui-modal normalize ${c}" data-theme="${r}" role="dialog" aria-modal="true" aria-labelledby="tp-ui-label-${e}" data-owner-id="${e}" style='transition:${n?"opacity 0.15s linear":"none"}'><div class="tp-ui-wrapper ${c}" tabindex="0"><div class="tp-ui-select-time ${c}" id="tp-ui-label-${e}">${c?d:l}</div><div class="tp-ui-header ${c}"><div class="tp-ui-wrapper-time ${c} ${y==="24h"?"tp-ui-wrapper-time-24h":""}" role="group" aria-label="${c?d:l}"><div class="tp-ui-input-wrapper ${c}"><div class="tp-ui-input-ripple-wrapper ${c}" data-md3-ripple><input name="hour" ${!o&&!c?"readonly":""} class="tp-ui-hour ${c}" tabindex="0" type="number" min="0" max="${y==="12h"?"12":"23"}" aria-label="${c?C:"Hour"}" role="spinbutton" aria-valuenow="12"></div><div class="tp-ui-hour-text ${c}">${C}</div></div><div class="tp-ui-dots ${c}" aria-hidden="true"><span></span><span></span></div><div class="tp-ui-input-wrapper ${c}"><div class="tp-ui-input-ripple-wrapper ${c}" data-md3-ripple><input name="minutes" ${!o&&!c?"readonly":""} class="tp-ui-minutes ${c}" tabindex="0" type="number" min="0" max="59" aria-label="${c?w:"Minute"}" role="spinbutton" aria-valuenow="0"></div><div class="tp-ui-minute-text ${c}">${w}</div></div></div>${y!=="24h"?`<div class="tp-ui-wrapper-type-time ${c}" role="group" aria-label="Period"><div class="tp-ui-type-mode tp-ui-am ${c?"mobile":"tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${m}" aria-pressed="false" data-type="AM">${m}</div><div class="tp-ui-type-mode tp-ui-pm ${c?"mobile":"tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${p}" aria-pressed="false" data-type="PM">${p}</div></div>`:""}</div><div class="tp-ui-mobile-clock-wrapper ${c}"><div class="tp-ui-body ${c}"><div class="tp-ui-clock-face ${c}" role="group" aria-label="Clock"><div class="tp-ui-dot ${c}" aria-hidden="true"></div><div class="tp-ui-clock-hand ${c}" aria-hidden="true"><div class="tp-ui-circle-hand ${c}"></div></div><div class="tp-ui-tips-wrapper ${c}" role="listbox" aria-label="Time"></div>${y==="24h"?`<div class="tp-ui-tips-wrapper-24h ${c}" role="listbox" aria-label="24h"></div>`:""}</div></div></div><div class="tp-ui-footer ${c}" ${c?'data-view="mobile"':""}>${i?`<div class="tp-ui-keyboard-icon-wrapper ${c}" tabindex="0" role="button" aria-pressed="false" aria-label="Toggle" data-view="desktop">${c?g:f}</div>`:""}<div class="tp-ui-wrapper-btn ${c}"><div class="tp-ui-cancel-btn ${c}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${E}">${E}</div><div class="tp-ui-ok-btn ${c}" data-md3-ripple tabindex="0" role="button" aria-pressed="false" aria-label="${T}">${T}</div></div></div></div><div class="timepicker-announcer sr-only" role="status" aria-live="polite" aria-atomic="true"></div></div>`};var W=class{core;emitter;timeouts=[];originalOverflow;originalPaddingRight;constructor(e,t){this.core=e,this.emitter=t}runWithTimeout(e,t=k.DEFAULT_DELAY){let i=setTimeout(e,t);this.timeouts.push(i)}clearAllTimeouts(){this.timeouts.forEach(clearTimeout),this.timeouts=[]}clearExistingModal(){if(v()===!1)return;let e=document.querySelector(".tp-ui-modal");e&&e.remove()}setModalTemplate(){if(v()===!1)return;this.clearExistingModal();let e=Ce(this.core.options,this.core.instanceId);if(this.core.options.ui.inline?.enabled){let i=document.getElementById(this.core.options.ui.inline.containerId);if(!i)return;i.innerHTML="",i.insertAdjacentHTML("beforeend",e);let n=i.querySelector(".tp-ui-modal");if(n){n.classList.add("tp-ui--inline");let{showButtons:r}=this.core.options.ui.inline;(r===!1||r===void 0)&&n.querySelectorAll(".tp-ui-wrapper-btn, .tp-ui-wrapper-btn.mobile").forEach(s=>s.style.display="none")}return}let{appendModalSelector:t}=this.core.options.ui;t?document.querySelector(t)?.insertAdjacentHTML("beforeend",e):document.body.insertAdjacentHTML("beforeend",e)}setScrollbarOrNot(){v()!==!1&&(this.core.options.ui.inline?.enabled||(this.core.options.ui.enableScrollbar?this.runWithTimeout(()=>{A()||this.runWithTimeout(()=>{typeof document<"u"&&(document.body.style.overflowY=this.originalOverflow||"",document.body.style.paddingRight=this.originalPaddingRight||"")},k.SCROLLBAR_RESTORE)},400):(this.originalOverflow=document.body.style.overflowY,this.originalPaddingRight=document.body.style.paddingRight,document.body.style.paddingRight=`${Ee()}px`,document.body.style.overflowY="hidden")))}removeBackdrop(){if(this.core.options.ui.inline?.enabled||this.core.options.ui.backdrop)return;let e=this.core.getModalElement(),t=this.core.getOpenElement();e?.classList.add("removed"),t.forEach(i=>i?.classList.add("disabled"))}setNormalizeClass(){let e=this.core.getModalElement();if(!e)return;e.classList.add("tp-ui-normalize"),e.querySelectorAll(":scope > div").forEach(i=>i.classList.add("tp-ui-normalize"))}setShowClassToBackdrop(){if(this.core.options.ui.inline?.enabled){this.core.getModalElement()?.classList.add("show"),this.setInitialFocus();return}this.core.options.ui.backdrop&&this.runWithTimeout(()=>{this.core.getModalElement()?.classList.add("show"),this.setInitialFocus()},k.MODAL_ANIMATION)}setInitialFocus(){if(!this.core.options.behavior.focusTrap)return;let e=this.core.getWrapper();e&&typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{e.focus()})}setFlexEndToFooterIfNoKeyboardIcon(){let e=this.core.getFooter();!this.core.options.ui.enableSwitchIcon&&e&&(e.style.justifyContent="flex-end")}destroy(){this.clearAllTimeouts(),!A()&&!this.core.options.ui.inline?.enabled&&(document.body.style.overflowY=this.originalOverflow||"",document.body.style.paddingRight=this.originalPaddingRight||""),this.clearExistingModal()}};var H=(a,e,t,i)=>{let n={hour:"12",minutes:"00",type:e==="24h"?void 0:"PM"};if(!a)return n;let r=a.value.trim();if(!t&&!r)return n;if(typeof t=="boolean"&&t){let w=new Date,[C,y]=w.toLocaleTimeString().split(":"),c=C.padStart(2,"0");if(/[a-z]/i.test(y)&&e==="12h"){let[f,g]=y.split(" ");return{hour:c,minutes:f,type:g}}return{hour:c,minutes:y,type:void 0}}if(typeof t=="object"){let{time:w,locales:C,preventClockType:y}=t,c=w??new Date;if(y&&i){let[h,b]=new Date(c).toLocaleTimeString().split(":");if(/[a-z]/i.test(b)){let[L,D]=b.split(" ");return{hour:h,minutes:L,type:D}}return{hour:h.padStart(2,"0"),minutes:b,type:void 0}}let f=new Date(c).toLocaleTimeString(C||"en-US",{hour:"2-digit",minute:"2-digit",hour12:e==="12h"}),[g,M]=f.split(":");if(e==="12h"&&/[a-z]/i.test(M)){let h=M.trim().split(" "),b=h[0],L=h[1]||"AM";return{hour:g,minutes:b,type:L}}return{hour:g,minutes:M.replace(/\D/g,""),type:void 0}}let[s,o]=r.split(" "),[u="",l=""]=s.split(":"),d=u.replace(/\D/g,""),m=l.replace(/\D/g,""),p={hour:d.padStart(2,"0"),minutes:m.padStart(2,"0"),type:e==="12h"?o:void 0};if(d.length>2||m.length>2)return{...p,error:"Invalid input: too many digits.",currentHour:u,currentMin:l};if(/[a-z]/i.test(s))return{...p,error:"Input contains invalid letters."};if(r.includes(" ")&&(!o||r.length>8||o!=="AM"&&o!=="PM"))return{...p,error:"Invalid AM/PM format or length.",currentLength:r.length,currentType:o};let E=Number(d),T=Number(m);if(e==="12h"){if(E<1||E>12||T<0||T>59||o!=="AM"&&o!=="PM")return{...p,error:"Invalid 12h time.",currentHour:E,currentMin:T,currentType:o}}else if(E<0||E>23||T<0||T>59)return{...p,error:"Invalid 24h time.",currentHour:E,currentMin:T};return p},he=(a,e,t)=>{let i=Number(a);if(Number.isNaN(i))return!1;switch(e){case"hour":return t==="24h"?i>=0&&i<=23:i>0&&i<=12;case"minutes":return i>=0&&i<=59;default:return}};var Le=a=>{if(!a)return;let{disabledTime:e,type:t}=a.clock;if(!e||!Object.keys(e).length)return;let{hours:i,minutes:n,interval:r}=e;if(r){delete e.hours,delete e.minutes;let s=Array.isArray(r)?r:[r];if(!t)throw new Error("clockType required for interval");return ee(s,t),{value:s.map(l=>{let[d,m]=l.trim().split("-"),{hour:p,minutes:E,type:T}=H({value:d.trim()},t),{hour:w,minutes:C,type:y}=H({value:m.trim()},t),c=_(p,w).map(h=>Number(h)===0?"00":String(Number(h))),f=[],g=Number(E),M=Number(C);if(y===T)return g>0&&M<=0?(f.push(c[0],c[c.length-1]),c=c.slice(1,-1)):M<59&&M>0&&g<=0?(f.push(void 0,c[c.length-1]),c=c.slice(0,-1)):M>0&&g>0?(f.push(c[0],c[c.length-1]),c=c.slice(1,-1)):M===0&&g===0&&(f.push(void 0,c[c.length-1]),c.pop()),{removedStartedHour:f[0]!==void 0&&Number(f[0])<=9?`0${f[0]}`:f[0],removedEndHour:f[1]!==void 0&&Number(f[1])<=9?`0${f[1]}`:f[1],rangeArrHour:c,startMinutes:_(E,59).map(h=>Number(h)<=9?`0${h}`:`${h}`),endMinutes:Q(0,C).map(h=>Number(h)<=9?`0${h}`:`${h}`),startType:T,endType:y};{let h=_(p,12).map(String),b=Q(1,w).map(String),L=[],D=[];return g>0&&M<=0?(D.push(b[b.length-1]),L.push(h[0]),b.pop(),h.shift()):M<59&&M>0&&g<=0?(L.push(h[0]),D.push(b[b.length-1]),b.pop()):M>0&&g>0?(D.push(b[b.length-1]),L.push(h[0]),b.pop(),h.shift()):M===0&&g===0&&(D.push(b[b.length-1]),L.push(h[0]),b.pop()),{startType:T,endType:y,amHours:h,pmHours:b,removedAmHour:L[0]&&Number(L[0])<=9?`0${L[0]}`:L[0],removedPmHour:D[0]&&Number(D[0])<=9?`0${D[0]}`:D[0],startMinutes:Number(E)===0?[]:_(E,59).map(O=>Number(O)<=9?`0${O}`:`${O}`),endMinutes:Q(0,C).map(O=>Number(O)<=9?`0${O}`:`${O}`)}}}).reduce((l,d)=>(Object.entries(d).forEach(([m,p])=>{Array.isArray(p)?l[m]=Array.isArray(l[m])?[...l[m],...p]:[...p]:l[m]=p}),l),{isInterval:!0,clockType:t,intervals:s})}}return i?.forEach(s=>{if(t==="12h"&&Number(s)>12)throw new Error("The disabled hours value has to be less than 13");if(t==="24h"&&Number(s)>23)throw new Error("The disabled hours value has to be less than 24")}),n?.forEach(s=>{if(Number(s)>59)throw new Error("The disabled minutes value has to be less than 60")}),{value:{hours:i?.map(s=>s==="00"||Number(s)===0?`0${Number(s)}`:`${Number(s)}`),minutes:n?.map(s=>Number(s)<=9?`0${s}`:`${s}`)}}},ve=(a,e,t,i)=>{if(a){if(Array.isArray(a)&&a.length>0)return!a.map(r=>he(r,e,t)).some(r=>r===!1);if(typeof a=="string"||typeof a=="number"){let n=he(a,e,t),r=i?.map(Number).includes(Number(a));return!!(n&&!r)}}};var fe="tp-ui",qe="mousedown mouseup mousemove mouseleave mouseover",Fe="touchstart touchmove touchend",Ae=`${qe} ${Fe}`,P="active";var U=class{core;emitter;isAnimating=!1;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("switch:view",()=>{this.toggleMobileClockFace()})}isCurrentTimeEnabled(e){let t=this.core.options.clock.currentTime;return typeof t=="boolean"?t:!!t?.[e]}preventClockTypeByCurrentTime(){if(!this.isCurrentTimeEnabled("preventClockType"))return;let e=this.core.getInput();if(!e)return;let{currentTime:t,clockType:i}={currentTime:this.core.options.clock.currentTime,clockType:this.core.options.clock.type},{type:n}=H(e,i,t,!0);this.core.updateOptions({clock:{type:n?"12h":"24h"}})}updateInputValueWithCurrentTimeOnStart(){if(!this.isCurrentTimeEnabled("updateInput"))return;let e=this.core.getInput();if(!e)return;let{hour:t,minutes:i,type:n}=H(e,this.core.options.clock.type,this.core.options.clock.currentTime);e.value=n?`${t}:${i} ${n}`:`${t}:${i}`}checkMobileOption(){this.core.setIsMobileView(!!this.core.options.ui.mobile),this.core.options.ui.mobile&&this.core.updateOptions({ui:{editable:!0}})}getDisableTime(){let e=Le(this.core.options);this.core.setDisabledTime(e||null)}getInputValueOnOpenAndSet(){let e=this.core.getInput();if(!e)return;let t=H(e,this.core.options.clock.type,this.core.options.clock.currentTime),i=this.core.getHour(),n=this.core.getMinutes(),r=this.core.getActiveTypeMode(),s=this.core.getAM();if(t===void 0){i&&(i.value="12"),n&&(n.value="00");let E={hour:i?.value||"12",minutes:n?.value||"00",type:r?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit("open",E),this.core.options.clock.type!=="24h"&&s&&s.classList.add(P);return}let[o,u,l]=e.value.split(":").join(" ").split(" ");e.value.length===0&&(o=t.hour,u=t.minutes,l=t.type),i&&(i.value=o.padStart(2,"0")),n&&(n.value=u.padStart(2,"0"));let m=this.core.getModalElement()?.querySelector(`[data-type='${l}']`);this.core.options.clock.type!=="24h"&&m&&m.classList.add(P);let p={...t,type:r?.dataset.type,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes};this.emitter.emit("open",p)}getInputValue(e,t,i){return H(e,t,i)}toggleMobileClockFace(){if(this.isAnimating)return;let e=this.core.getModalElement();if(!e)return;let t=e.querySelector(".tp-ui-wrapper"),i=this.core.getKeyboardClockIcon(),n=e.querySelector(".tp-ui-mobile-clock-wrapper"),r=e.querySelectorAll("*"),s=e.querySelector(".tp-ui-select-time"),o=this.core.getHour(),u=this.core.getMinutes(),l=this.core.getClockFace();if(!t)return;let d=t.classList.contains("expanded"),m=this.core.isMobileView;d?this.collapseClockFace(t,n,r,i,s,o,u,l,m):this.expandClockFace(t,n,r,i,s,o,u,l)}collapseClockFace(e,t,i,n,r,s,o,u,l){this.isAnimating=!0,this.switchView(r,n,s,o,!0),i.forEach(d=>{d!==t&&d!==e&&d!==r&&(d.classList.remove("expanded"),l&&d.classList.add("mobile"))}),r&&(r.classList.remove("expanded"),l&&r.classList.add("mobile")),typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>{t?.classList.remove("expanded"),l&&t?.classList.add("mobile"),e?.classList.remove("expanded"),l&&e?.classList.add("mobile"),l?u?.classList.remove("scale-in"):u?.classList.add("scale-in"),setTimeout(()=>{this.isAnimating=!1},k.MOBILE_TOGGLE)}):this.isAnimating=!1,n?.setAttribute("aria-label","Show clock face"),n?.setAttribute("aria-pressed","false")}expandClockFace(e,t,i,n,r,s,o,u){this.isAnimating=!0,o?.classList.contains("active")&&o?this.emitter.emit("select:minute",{minutes:o.value}):s&&this.emitter.emit("select:hour",{hour:s.value}),i.forEach(d=>{d!==t&&d!==e&&d!==r&&(d.classList.remove("mobile"),d.classList.add("expanded"))}),r&&(r.classList.remove("mobile"),r.classList.add("expanded")),this.switchView(r,n,s,o,!1),typeof requestAnimationFrame<"u"?requestAnimationFrame(()=>{e.classList.remove("mobile"),e.classList.add("expanded"),requestAnimationFrame(()=>{t&&(t.classList.remove("mobile"),t.classList.add("expanded")),u&&u.classList.remove("scale-in"),setTimeout(()=>{u&&u.classList.add("scale-in")},k.CLOCK_SCALE_DELAY),setTimeout(()=>{this.isAnimating=!1},k.MOBILE_TOGGLE)})}):this.isAnimating=!1,n?.setAttribute("aria-label","Hide clock face"),n?.setAttribute("aria-pressed","true")}switchView(e,t,i,n,r){r?(e?.classList.remove("mobile"),t?.classList.remove("mobile"),i?.classList.remove("mobile"),n?.classList.remove("mobile"),this.updateClockFaceAccessibility(!1)):(e?.classList.add("mobile"),t?.classList.add("mobile"),i?.classList.add("mobile"),n?.classList.add("mobile"),this.updateClockFaceAccessibility(!0))}updateClockFaceAccessibility(e){let t=this.core.getClockFace();if(!t)return;let i=t.querySelector(".tp-ui-tips-wrapper"),n=t.querySelector(".tp-ui-tips-wrapper-24h"),r=t.querySelectorAll(".tp-ui-tip");e?(t.setAttribute("aria-hidden","true"),i?.setAttribute("aria-hidden","true"),n?.setAttribute("aria-hidden","true"),r.forEach(s=>{s.setAttribute("tabindex","-1"),s.setAttribute("aria-hidden","true")})):(t.removeAttribute("aria-hidden"),i?.removeAttribute("aria-hidden"),n?.removeAttribute("aria-hidden"),r.forEach(s=>{s.setAttribute("tabindex","0"),s.removeAttribute("aria-hidden")}))}destroy(){}};var z=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setTheme(){let e=this.core.getModalElement();if(!e)return;let{theme:t}=this.core.options.ui;t&&e.setAttribute("data-theme",t)}setInputClassToInputElement(){let e=this.core.getInput();e&&(be(e,"tp-ui-input")||e.classList.add("tp-ui-input"))}setDataOpenToInputIfDoesntExistInWrapper(){let e=this.core.getOpenElementData(),t=this.core.getInput();e===null&&t&&t.setAttribute("data-open","tp-ui-input")}setClassTopOpenElement(){let e=this.core.getOpenElement();for(let t of e)t&&t.classList.add("tp-ui-open-element")}setTimepickerClassToElement(){let e=this.core.element;if(!e)return;e.classList.add(fe);let t=this.core.options.ui.cssClass;t&&t!==fe&&e.classList.add(t)}destroy(){let e=this.core.getModalElement();e&&e.removeAttribute("data-theme")}};var N=class a extends Error{constructor(t,i){super(`[TimepickerUI] ${t}`);this.code=i;this.name="TimepickerError",Object.setPrototypeOf(this,a.prototype)}},te={ELEMENT_NOT_FOUND:"ELEMENT_NOT_FOUND",INVALID_PARAMETER:"INVALID_PARAMETER",NO_INPUT_ELEMENT:"NO_INPUT_ELEMENT",INSTANCE_DESTROYED:"INSTANCE_DESTROYED",NOT_INITIALIZED:"NOT_INITIALIZED",INVALID_TIME_FORMAT:"INVALID_TIME_FORMAT",INLINE_CONFIG_ERROR:"INLINE_CONFIG_ERROR",CONTAINER_NOT_FOUND:"CONTAINER_NOT_FOUND",SSR_ENVIRONMENT:"SSR_ENVIRONMENT"};var K=class{core;emitter;constructor(e,t){this.core=e,this.emitter=t}setErrorHandler(){let e=this.core.getInput();if(!e)return!0;let{error:t,currentHour:i,currentMin:n,currentType:r,currentLength:s}=H(e,this.core.options.clock.type);if(this.removeErrorHandler(),t){if(v()===!1)return!1;let o=document.createElement("div");o.classList.add("tp-ui-invalid-text"),o.innerHTML="<b>Invalid Time Format</b>",e.classList.add("tp-ui-invalid-format"),e.nextElementSibling?.classList.contains("tp-ui-invalid-text")||e.after(o);let u={error:t,rejectedHour:void 0,rejectedMinute:void 0,inputHour:i,inputMinute:n,inputType:r,inputLength:s};return this.emitter.emit("error",u),!1}return!0}removeErrorHandler(){let e=this.core.getInput();if(!e)return;e.classList.remove("tp-ui-invalid-format");let t=e.nextElementSibling;t?.classList.contains("tp-ui-invalid-text")&&t.remove()}checkDisabledValuesOnStart(){if(!this.core.options.clock.disabledTime)return;let{disabledTime:e,type:t}=this.core.options.clock;if(e.interval){if(!t)throw new N("clockType is required when using disabledTime.interval",te.INVALID_PARAMETER);let o=Array.isArray(e.interval)?e.interval:[e.interval];try{ee(o,t)}catch(u){throw new N(`Invalid disabledTime.interval: ${u.message}`,te.INVALID_PARAMETER)}return}let{hours:i,minutes:n}=e,r=i?ve(i,"hour",t):!0,s=n?ve(n,"minutes",t):!0;if(!r||!s)throw new N("Invalid hours or minutes in disabledTime option",te.INVALID_PARAMETER)}destroy(){this.removeErrorHandler()}};var Z=class{core;emitter;cleanupHandlers=[];constructor(e,t){this.core=e,this.emitter=t}handleOpenOnClick(){let e=this.core.getOpenElement();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("show",{})};e.forEach(i=>{i.addEventListener("click",t),this.cleanupHandlers.push(()=>i.removeEventListener("click",t))})}handleOpenOnEnterFocus(){let e=this.core.getInput();if(!e)return;let t=i=>{i.key==="Enter"&&!this.core.isDestroyed&&this.emitter.emit("show",{})};e.addEventListener("keydown",t),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",t))}handleCancelButton(){let e=this.core.getCancelButton();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("cancel",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleOkButton(){let e=this.core.getOkButton();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getHour(),n=this.core.getMinutes(),r=this.core.getActiveTypeMode();this.emitter.emit("confirm",{hour:i?.value,minutes:n?.value,type:r?.textContent||void 0})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleBackdropClick(){let e=this.core.getModalElement();if(!e)return;let t=i=>{this.core.isDestroyed||i.target===e&&this.emitter.emit("cancel",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleEscClick(){if(v()===!1)return;let e=t=>{this.core.isDestroyed||t.key==="Escape"&&this.emitter.emit("cancel",{})};document.addEventListener("keydown",e),this.cleanupHandlers.push(()=>document.removeEventListener("keydown",e))}handleAmClick(){let e=this.core.getAM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getPM();e.classList.add("active"),i?.classList.remove("active"),this.emitter.emit("select:am",{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit("update",{hour:n?.value,minutes:r?.value,type:"AM"})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handlePmClick(){let e=this.core.getPM();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;let i=this.core.getAM();e.classList.add("active"),i?.classList.remove("active"),this.emitter.emit("select:pm",{});let n=this.core.getHour(),r=this.core.getMinutes();this.emitter.emit("update",{hour:n?.value,minutes:r?.value,type:"PM"})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleHourEvents(){let e=this.core.getHour();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add("active");let i=this.core.getMinutes();i?.classList.remove("active"),this.emitter.emit("select:hour",{hour:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:e.value,minutes:i?.value,type:n?.textContent||void 0})};if(e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t)),this.core.options.ui.editable){let i=e.value,n=()=>{if(!this.core.isDestroyed&&e.value!==i){i=e.value,this.emitter.emit("animation:clock",{}),this.emitter.emit("select:hour",{hour:e.value});let r=this.core.getMinutes(),s=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:e.value,minutes:r?.value,type:s?.textContent||void 0})}};e.addEventListener("blur",n),this.cleanupHandlers.push(()=>e.removeEventListener("blur",n))}}handleMinutesEvents(){let e=this.core.getMinutes();if(!e)return;let t=()=>{if(this.core.isDestroyed)return;e.classList.add("active");let i=this.core.getHour();i?.classList.remove("active"),this.emitter.emit("select:minute",{minutes:e.value});let n=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:i?.value,minutes:e.value,type:n?.textContent||void 0})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}handleKeyboardInput(){let e=this.core.getHour(),t=this.core.getMinutes();if(e){let i=n=>{if(this.core.isDestroyed||n.key!=="ArrowUp"&&n.key!=="ArrowDown")return;n.preventDefault();let r=parseInt(e.value)||0,s=parseInt(e.getAttribute("max")||"23"),o=parseInt(e.getAttribute("min")||"0"),u=this.core.options.clock.type==="12h",l;n.key==="ArrowUp"?u?l=r>=12?1:r+1:l=r>=s?0:r+1:u?l=r<=1?12:r-1:l=r<=0?s:r-1,e.value=l.toString().padStart(2,"0"),this.emitter.emit("animation:clock",{}),this.emitter.emit("select:hour",{hour:e.value});let d=this.core.getMinutes(),m=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:e.value,minutes:d?.value,type:m?.textContent||void 0})};e.addEventListener("keydown",i),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",i))}if(t){let i=n=>{if(this.core.isDestroyed||n.key!=="ArrowUp"&&n.key!=="ArrowDown")return;n.preventDefault();let r=parseInt(t.value)||0,s=59,o=0,u;n.key==="ArrowUp"?u=r>=s?o:r+1:u=r<=o?s:r-1,t.value=u.toString().padStart(2,"0"),this.emitter.emit("animation:clock",{}),this.emitter.emit("select:minute",{minutes:t.value});let l=this.core.getHour(),d=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:l?.value,minutes:t.value,type:d?.textContent||void 0})};t.addEventListener("keydown",i),this.cleanupHandlers.push(()=>t.removeEventListener("keydown",i))}}focusTrapHandler(){if(v()===!1)return;let e=this.core.getWrapper();if(!e)return;let t=i=>{if(this.core.isDestroyed||i.key!=="Tab")return;let n=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),r=n[0],s=n[n.length-1];i.shiftKey&&document.activeElement===r?(s?.focus(),i.preventDefault()):!i.shiftKey&&document.activeElement===s&&(r?.focus(),i.preventDefault())};e.addEventListener("keydown",t),this.cleanupHandlers.push(()=>e.removeEventListener("keydown",t))}handleMoveHand(){if(v()===!1)return;let e=t=>{this.core.isDestroyed||t.preventDefault()};document.addEventListener("mousedown",e,!1),document.addEventListener("touchstart",e,{passive:!1}),this.cleanupHandlers.push(()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)})}handleSwitchViewButton(){let e=this.core.getKeyboardClockIcon();if(!e)return;let t=()=>{this.core.isDestroyed||this.emitter.emit("switch:view",{})};e.addEventListener("click",t),this.cleanupHandlers.push(()=>e.removeEventListener("click",t))}destroy(){this.cleanupHandlers.forEach(e=>e()),this.cleanupHandlers=[]}};var S=class{static angleToIndex(e,t,i){let n=Math.round(e/30)%12;if(t==="24h")if(i){let r=n+12;return r===12?0:r}else return n===0?12:n;return n===0?12:n}static indexToValue(e,t,i){if(t==="24h")return e.toString().padStart(2,"0");let n=e;return n===0&&(n=12),n>12&&(n=n-12),n.toString().padStart(2,"0")}static indexToAngle(e,t){return t==="24h"?e>=12?(e-12)%12*30:e%12*30:(e===0?12:e)%12*30}static isDisabled(e,t,i){return i?i.isInterval&&i.intervals&&i.clockType?this.isDisabledByInterval(e,t,i):i.hours?i.hours.some(n=>String(n)===e||Number(n)===Number(e)||n===e):!1:!1}static isDisabledByInterval(e,t,i){if(!i.intervals)return!1;for(let n=0;n<60;n++){let r=n.toString().padStart(2,"0");if(!this.isTimeInIntervals(e,r,t,i.intervals,i.clockType))return!1}return!0}static isTimeInIntervals(e,t,i,n,r){let s=r==="12h"?`${e}:${t} ${i}`:`${e}:${t}`;for(let o of n){let[u,l]=o.split("-").map(d=>d.trim());if(this.isTimeBetween(s,u,l,r))return!0}return!1}static isTimeBetween(e,t,i,n){let r=this.timeToMinutes(e,n),s=this.timeToMinutes(t,n),o=this.timeToMinutes(i,n);return r>=s&&r<=o}static timeToMinutes(e,t){if(t==="12h"){let i=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!i)return 0;let n=parseInt(i[1]),r=parseInt(i[2]),s=i[3].toUpperCase();return s==="PM"&&n!==12&&(n+=12),s==="AM"&&n===12&&(n=0),n*60+r}else{let[i,n]=e.split(":").map(Number);return i*60+n}}static findNearestValid(e,t,i,n,r){let s=t==="24h"?23:12;for(let o=0;o<=s;o++){let u=o===0?[e]:[e+o,e-o];for(let l of u){let d=l;d<0&&(d+=s+1),d>s&&(d=d%(s+1));let m=this.indexToValue(d,t,i);if(!this.isDisabled(m,i,n))return d}}return e}};var I=class{static angleToIndex(e){return Math.round(e/6)%60}static indexToValue(e){return e.toString().padStart(2,"0")}static indexToAngle(e){return e%60*6}static isDisabled(e,t,i,n,r){return n?n.isInterval&&n.intervals?this.isDisabledByInterval(e,t,i,n,r):n.minutes?n.minutes.some(s=>String(s)===e||Number(s)===Number(e)||s===e):!1:!1}static isDisabledByInterval(e,t,i,n,r){if(!n.intervals)return!1;let s=r==="12h"?`${t}:${e} ${i}`:`${t}:${e}`;for(let o of n.intervals){let[u,l]=o.split("-").map(d=>d.trim());if(this.isTimeBetween(s,u,l,r))return!0}return!1}static isTimeBetween(e,t,i,n){let r=this.timeToMinutes(e,n),s=this.timeToMinutes(t,n),o=this.timeToMinutes(i,n);return r>=s&&r<=o}static timeToMinutes(e,t){if(t==="12h"){let i=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!i)return 0;let n=parseInt(i[1]),r=parseInt(i[2]),s=i[3].toUpperCase();return s==="PM"&&n!==12&&(n+=12),s==="AM"&&n===12&&(n=0),n*60+r}else{let[i,n]=e.split(":").map(Number);return i*60+n}}static findNearestValid(e,t,i,n,r){for(let s=0;s<60;s++){let o=s===0?[e]:[e+s,e-s];for(let u of o){let l=u;l<0&&(l+=60),l>=60&&(l=l%60);let d=this.indexToValue(l);if(!this.isDisabled(d,t,i,n,r))return l}}return e}};var x=class{static normalizeAngle(e){let t=e%360;return t<0&&(t+=360),t}static calculateRawAngle(e,t){let i=e.x-t.x,n=e.y-t.y,s=Math.atan2(n,i)*180/Math.PI+90;return this.normalizeAngle(s)}static snapToIncrement(e,t){let i=Math.round(e/t)*t;return this.normalizeAngle(i)}static calculateDistance(e,t){let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)}static isInnerCircle(e,t){return e<t*.6}static calculateShortestPath(e,t){let i=this.normalizeAngle(e),r=this.normalizeAngle(t)-i,s=r>=0?r:r+360,o=r<=0?r:r-360,u=Math.abs(s)<Math.abs(o)?s:o;return e+u}};var ie=class{config;currentAngle=0;tipsCache=new Map;cachedDimensions=new Map;constructor(e){this.config=e}getCachedDimensions(e){let t=this.cachedDimensions.get(e);if(!t){let i=(e.offsetWidth-32)/2,n=(e.offsetHeight-32)/2,r=i-9;t={width:i,height:n,radius:r},this.cachedDimensions.set(e,t)}return t}setHandAngle(e){if(Math.abs(this.currentAngle-e)<.1)return;let t=x.calculateShortestPath(this.currentAngle,e);this.currentAngle=t,this.config.clockHand.style.transform=`rotateZ(${t}deg)`}setActiveValue(e){let t=[this.config.tipsWrapper];this.config.tipsWrapperFor24h&&t.push(this.config.tipsWrapperFor24h),t.forEach(i=>{i.querySelectorAll(".tp-ui-value-tips, .tp-ui-value-tips-24h").forEach(r=>{let s=r;s.textContent===e||Number(s.textContent)===Number(e)?(s.classList.add("active"),s.setAttribute("aria-selected","true")):(s.classList.remove("active"),s.setAttribute("aria-selected","false"))})})}renderTips(e,t,i,n,r,s=!0,o,u="",l="12"){if(v()===!1)return;let d=o||this.config.tipsWrapper;s&&(d.innerHTML="",this.tipsCache.clear());let{width:m,height:p,radius:E}=this.getCachedDimensions(d),T=document.createDocumentFragment(),w=`${t}-${this.config.theme||"default"}`;e.forEach((C,y)=>{let c=`${w}-${C}`,f=this.tipsCache.get(c);f||(f=this.createTip(C,t,r),this.tipsCache.set(c,f));let{wrapper:g,tip:M}=f;this.updateTipState(g,M,C,i,n,r,u,l);let h=y*(360/e.length)*(Math.PI/180);g.style.left=`${m+Math.sin(h)*E}px`,g.style.bottom=`${p+Math.cos(h)*E}px`,T.appendChild(g)}),d.appendChild(T)}createTip(e,t,i){if(v()===!1){let o={};return{wrapper:o,tip:o}}let n=document.createElement("span"),r=document.createElement("span");r.textContent=e,r.setAttribute("role","option"),r.setAttribute("aria-selected","false"),r.tabIndex=0;let s=i==="24h"&&t.includes("24")?"tp-ui-value-tips-24h":"tp-ui-value-tips";return r.classList.add(s),n.classList.add(t),this.config.theme&&(n.classList.add(this.config.theme),r.classList.add(this.config.theme)),n.appendChild(r),{wrapper:n,tip:r}}updateTipState(e,t,i,n,r,s,o,u){e.classList.remove("tp-ui-tips-disabled"),t.classList.remove("tp-ui-tips-disabled"),t.removeAttribute("aria-disabled"),t.tabIndex=0,this.checkIfDisabled(i,n,r,s,o,u)&&(e.classList.add("tp-ui-tips-disabled"),t.classList.add("tp-ui-tips-disabled"),t.setAttribute("aria-disabled","true"),t.tabIndex=-1)}checkIfDisabled(e,t,i,n,r,s){return i?t==="hours"?S.isDisabled(e,r,i):t==="minutes"?I.isDisabled(e,s,r,i,n):!1:!1}setCircleSize(e){e?this.config.circle.classList.remove("small-circle"):this.config.circle.classList.add("small-circle")}setCircle24hMode(e){e?(this.config.circle.classList.add("tp-ui-circle-hand-24h"),this.config.clockHand.classList.add("tp-ui-clock-hand-24h")):(this.config.circle.classList.remove("tp-ui-circle-hand-24h"),this.config.clockHand.classList.remove("tp-ui-clock-hand-24h"))}destroy(){this.tipsCache.clear(),this.cachedDimensions.clear(),this.config.tipsWrapper.innerHTML=""}};var Y=class{static processPointerInput(e){let t=x.calculateRawAngle(e.pointerPosition,e.clockCenter);return e.mode==="hours"?this.processHours(t,e):this.processMinutes(t,e)}static processHours(e,t){let i=t.incrementHours*30,n=x.snapToIncrement(e,i),r=x.calculateDistance(t.pointerPosition,t.clockCenter),s=t.clockType==="24h"&&x.isInnerCircle(r,t.clockRadius),o=S.angleToIndex(n,t.clockType,s),u=S.indexToValue(o,t.clockType,t.amPm),l=S.isDisabled(u,t.amPm,t.disabledTime);l&&(o=S.findNearestValid(o,t.clockType,t.amPm,t.disabledTime,s));let d=S.indexToValue(o,t.clockType,t.amPm);return{angle:S.indexToAngle(o,t.clockType),value:d,index:o,isValid:!l,isInnerCircle:t.clockType==="24h"?s:void 0}}static processMinutes(e,t){let i=t.incrementMinutes*6,n=x.snapToIncrement(e,i),r=I.angleToIndex(n),s=I.indexToValue(r),o=t.currentHour||"00",u=I.isDisabled(s,o,t.amPm,t.disabledTime,t.clockType);u&&(r=I.findNearestValid(r,o,t.amPm,t.disabledTime,t.clockType));let l=I.indexToValue(r);return{angle:I.indexToAngle(r),value:l,index:r,isValid:!u}}static valueToAngle(e,t,i){let n=parseInt(e,10);return t==="hours"?S.indexToAngle(n,i):I.indexToAngle(n)}};var ne=class{state;renderer;clockType;disabledTime;incrementHours;incrementMinutes;isDragging=!1;callbacks;constructor(e,t,i,n,r=1,s=1,o={}){this.renderer=e,this.state={...t},this.clockType=i,this.disabledTime=n,this.incrementHours=r,this.incrementMinutes=s,this.callbacks=o}handlePointerMove(e,t,i){this.isDragging=!0;let n={pointerPosition:e,clockCenter:t,clockRadius:i,mode:this.state.mode,clockType:this.clockType,amPm:this.state.amPm,disabledTime:this.disabledTime,incrementHours:this.incrementHours,incrementMinutes:this.incrementMinutes,currentHour:this.state.hour},r=Y.processPointerInput(n);r.isValid&&(this.state.mode==="hours"?(this.state.hour=r.value,this.state.hourAngle=r.angle,this.clockType==="24h"&&r.isInnerCircle!==void 0&&(this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(r.isInnerCircle)),this.callbacks.onHourChange&&this.callbacks.onHourChange(r.value)):(this.state.minute=r.value,this.state.minuteAngle=r.angle,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1),this.callbacks.onMinuteChange&&this.callbacks.onMinuteChange(r.value)),this.renderer.setHandAngle(r.angle),this.renderer.setActiveValue(r.value))}handlePointerUp(){this.isDragging=!1}switchMode(e){let t=this.state.mode===e;this.state.mode=e;let i=e==="hours"?this.state.hourAngle:this.state.minuteAngle,n=e==="hours"?this.state.hour:this.state.minute;if(e==="hours"&&this.clockType==="24h"){let r=parseInt(n,10),s=r===0||r>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(s)}else this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.renderer.setHandAngle(i),this.renderer.setActiveValue(n)}setValue(e,t){let i=Y.valueToAngle(t,e,this.clockType);if(e==="hours")if(this.state.hour=t,this.state.hourAngle=i,this.clockType==="24h"){let n=parseInt(t,10),r=n===0||n>=13;this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(r)}else this.renderer.setCircle24hMode(!1);else this.state.minute=t,this.state.minuteAngle=i,this.renderer.setCircleSize(!0),this.renderer.setCircle24hMode(!1);this.state.mode===e&&(this.renderer.setHandAngle(i),this.renderer.setActiveValue(t))}setAmPm(e){this.state.amPm=e}getState(){return{...this.state}}getHour(){return this.state.hour}getMinute(){return this.state.minute}getAmPm(){return this.state.amPm}updateDisabledTime(e){this.disabledTime=e}destroy(){this.renderer.destroy()}};var re=class{controller;clockFace;isActive=!1;config;cachedRect=null;cachedCenter=null;cachedRadius=null;constructor(e,t,i={}){this.controller=e,this.clockFace=t,this.config=i}attach(){this.clockFace.addEventListener("mousedown",this.handlePointerDown),this.clockFace.addEventListener("touchstart",this.handlePointerDown,{passive:!1})}detach(){this.clockFace.removeEventListener("mousedown",this.handlePointerDown),this.clockFace.removeEventListener("touchstart",this.handlePointerDown),this.removeGlobalListeners()}handlePointerDown=e=>{if(A())return;let t=e.target;t&&t.classList&&t.classList.contains("tp-ui-tips-disabled")||(e.preventDefault(),this.isActive=!0,this.cachedRect=this.clockFace.getBoundingClientRect(),this.cachedCenter=this.getClockCenter(),this.cachedRadius=this.getClockRadius(),this.processPointerEvent(e),document.addEventListener("mousemove",this.handlePointerMove),document.addEventListener("touchmove",this.handlePointerMove,{passive:!1}),document.addEventListener("mouseup",this.handlePointerUp),document.addEventListener("touchend",this.handlePointerUp))};handlePointerMove=e=>{if(!this.isActive)return;let t=this.getTargetElement(e);t&&t.classList&&t.classList.contains("tp-ui-tips-disabled")||(e.preventDefault(),this.processPointerEvent(e))};handlePointerUp=()=>{if(!this.isActive)return;this.isActive=!1,this.cachedRect=null,this.cachedCenter=null,this.cachedRadius=null,this.controller.handlePointerUp(),this.removeGlobalListeners();let{autoSwitchToMinutes:e,isMobileView:t,hourElement:i,minutesElement:n}=this.config;e&&i?.classList.contains("active")&&!t&&(n?.click(),n?.focus())};processPointerEvent(e){let t=this.getPointerPosition(e),i=this.cachedCenter||this.getClockCenter(),n=this.cachedRadius||this.getClockRadius();this.controller.handlePointerMove(t,i,n)}getPointerPosition(e){let t=this.cachedRect||this.clockFace.getBoundingClientRect();if("touches"in e){let i=e.touches[0]||e.changedTouches[0];return{x:i.clientX-t.left,y:i.clientY-t.top}}else return{x:e.clientX-t.left,y:e.clientY-t.top}}getTargetElement(e){if("touches"in e){let t=e.touches[0]||e.changedTouches[0];if(t&&!A())return document.elementFromPoint(t.clientX,t.clientY)}return e.target}getClockCenter(){let e=this.clockFace.offsetWidth,t=this.clockFace.offsetHeight;return{x:e/2,y:t/2}}getClockRadius(){return this.clockFace.offsetWidth/2}removeGlobalListeners(){v()!==!1&&(document.removeEventListener("mousemove",this.handlePointerMove),document.removeEventListener("touchmove",this.handlePointerMove),document.removeEventListener("mouseup",this.handlePointerUp),document.removeEventListener("touchend",this.handlePointerUp))}};var G=class{renderer;controller;dragHandlers;clockType;disabledTime;tipsWrapper;tipsWrapperFor24h;constructor(e){this.clockType=e.clockType,this.disabledTime=e.disabledTime,this.tipsWrapper=e.tipsWrapper,this.tipsWrapperFor24h=e.tipsWrapperFor24h;let t={clockFace:e.clockFace,tipsWrapper:e.tipsWrapper,tipsWrapperFor24h:e.tipsWrapperFor24h,clockHand:e.clockHand,circle:e.circle,theme:e.theme};this.renderer=new ie(t);let i={hour:e.initialHour,minute:e.initialMinute,amPm:e.initialAmPm,hourAngle:this.calculateInitialAngle("hours",e.initialHour),minuteAngle:this.calculateInitialAngle("minutes",e.initialMinute),mode:"hours"},n={onHourChange:e.onHourChange,onMinuteChange:e.onMinuteChange};this.controller=new ne(this.renderer,i,e.clockType,e.disabledTime,e.incrementHours||1,e.incrementMinutes||1,n),this.dragHandlers=new re(this.controller,e.clockFace,e.dragConfig||{})}initialize(){this.dragHandlers.attach(),this.switchToHours()}switchToHours(){this.controller.switchMode("hours"),this.clockType==="24h"&&this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.remove("none"),this.renderHourTips();let e=this.controller.getState();this.renderer.setActiveValue(e.hour)}switchToMinutes(){this.controller.switchMode("minutes"),this.tipsWrapperFor24h&&this.tipsWrapperFor24h.classList.add("none"),this.renderMinuteTips();let e=this.controller.getState();this.renderer.setActiveValue(e.minute)}setHour(e){this.controller.setValue("hours",e)}setMinute(e){this.controller.setValue("minutes",e)}setAmPm(e){this.controller.setAmPm(e);let t=this.controller.getState();t.mode==="hours"?(this.renderHourTips(),this.renderer.setHandAngle(t.hourAngle),this.renderer.setActiveValue(t.hour)):(this.renderMinuteTips(),this.renderer.setHandAngle(t.minuteAngle),this.renderer.setActiveValue(t.minute))}getHour(){return this.controller.getHour()}getMinute(){return this.controller.getMinute()}getAmPm(){return this.controller.getAmPm()}updateDisabledTime(e){this.controller.updateDisabledTime(e),this.controller.getState().mode==="hours"?this.renderHourTips():this.renderMinuteTips()}renderHourTips(){let t=this.controller.getState().amPm;this.clockType==="24h"?(this.renderer.renderTips(pe,"tp-ui-hour-time-12","hours",this.disabledTime,this.clockType,!0,this.tipsWrapper,t),this.tipsWrapperFor24h&&this.renderer.renderTips(ke,"tp-ui-hour-time-24","hours",this.disabledTime,this.clockType,!0,this.tipsWrapperFor24h,t)):this.renderer.renderTips(pe,"tp-ui-hour-time-12","hours",this.disabledTime,this.clockType,!0,void 0,t)}renderMinuteTips(){let e=this.controller.getState(),t=e.amPm,i=e.hour;this.renderer.renderTips(B,"tp-ui-minutes-time","minutes",this.disabledTime,this.clockType,!0,void 0,t,i)}calculateInitialAngle(e,t){let i=parseInt(t,10);return e==="hours"?i%12*30:i*6}destroy(){this.dragHandlers.detach(),this.controller.destroy()}};var j=class{core;emitter;clockSystem=null;constructor(e,t){this.core=e,this.emitter=t,this.setupEventListeners()}setupEventListeners(){this.emitter.on("select:hour",({hour:e})=>{this.emitter.emit("animation:clock",{}),this.setHoursToClock(e||null)}),this.emitter.on("select:minute",({minutes:e})=>{this.emitter.emit("animation:clock",{}),this.setMinutesToClock(e||null)}),this.emitter.on("select:am",()=>{this.updateAmPm()}),this.emitter.on("select:pm",()=>{this.updateAmPm()})}initializeClockSystem(){let e=this.core.getClockFace(),t=this.core.getClockHand(),i=this.core.getCircle();if(!e||!t||!i)return;let n=this.core.options.clock.type==="24h",r=this.core.getTipsWrapper();if(!r)return;let s=this.core.getHour(),o=this.core.getMinutes(),u={clockFace:e,tipsWrapper:r,tipsWrapperFor24h:n&&this.core.getTipsWrapperFor24h()||void 0,clockHand:t,circle:i,clockType:this.core.options.clock.type||"12h",disabledTime:this.convertDisabledTime(),initialHour:s?.value||"12",initialMinute:o?.value||"00",initialAmPm:this.getAmPmValue(),theme:this.core.options.ui.theme,incrementHours:this.core.options.clock.incrementHours||1,incrementMinutes:this.core.options.clock.incrementMinutes||1,timepicker:null,dragConfig:{autoSwitchToMinutes:this.core.options.clock.autoSwitchToMinutes,isMobileView:this.core.isMobileView,hourElement:s,minutesElement:o},onHourChange:l=>{let d=this.core.getHour();d&&(d.value=l);let m=this.core.getMinutes(),p=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:l,minutes:m?.value,type:p?.textContent||void 0})},onMinuteChange:l=>{let d=this.core.getMinutes();d&&(d.value=l);let m=this.core.getHour(),p=this.core.getActiveTypeMode();this.emitter.emit("update",{hour:m?.value,minutes:l,type:p?.textContent||void 0})}};this.clockSystem=new G(u),this.clockSystem.initialize()}convertDisabledTime(){let e=this.core.disabledTime?.value;if(!e)return null;let t;return e.intervals&&(t=Array.isArray(e.intervals)?e.intervals:[e.intervals]),{hours:e.hours,minutes:e.minutes,isInterval:e.isInterval,intervals:t,clockType:e.clockType}}getAmPmValue(){if(this.core.options.clock.type==="24h")return"";let e=this.core.getActiveTypeMode();if(e){let i=e.textContent?.trim();if(i==="AM"||i==="PM")return i}return this.core.getAM()?.classList.contains("active")?"AM":"PM"}destroyClockSystem(){this.clockSystem&&(this.clockSystem.destroy(),this.clockSystem=null)}removeCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e?.classList.remove("tp-ui-circle-hand-24h"),t?.classList.remove("tp-ui-clock-hand-24h")}setCircleClockClasses24h(){let e=this.core.getCircle(),t=this.core.getClockHand();e&&e.classList.add("tp-ui-circle-hand-24h"),t&&t.classList.add("tp-ui-clock-hand-24h")}setOnStartCSSClassesIfClockType24h(){if(this.core.options.clock.type==="24h"){let e=this.core.getInput();if(!e)return;let t;e.value.length>0&&(t=e.value.split(":")[0]),t&&(Number(t)>12||Number(t)===0)&&this.setCircleClockClasses24h()}}setBgColorToCircleWithMinutesTips=()=>{let e=this.core.getMinutes(),t=this.core.getCircle();if(!(!e||!t)&&e.value&&B.includes(e.value)){let i=getComputedStyle(t).getPropertyValue("--timepicker-primary").trim();i&&(t.style.backgroundColor=i),t.classList.remove("small-circle")}};removeBgColorToCirleWithMinutesTips=()=>{let e=this.core.getMinutes(),t=this.core.getCircle();!e||!t||e.value&&B.includes(e.value)||(t.style.backgroundColor="",t.classList.add("small-circle"))};setClassActiveToHourOnOpen=()=>{if(this.core.options.ui.mobile||this.core.isMobileView)return;this.core.getHour()?.classList.add(P)};setMinutesToClock=e=>{this.clockSystem&&(this.removeBgColorToCirleWithMinutesTips(),e&&this.clockSystem.setMinute(e),this.clockSystem.switchToMinutes())};setHoursToClock=e=>{this.clockSystem&&(e&&this.clockSystem.setHour(e),this.clockSystem.switchToHours())};setTransformToCircleWithSwitchesHour=e=>{!this.clockSystem||!e||this.clockSystem.setHour(e)};setTransformToCircleWithSwitchesMinutes=e=>{!this.clockSystem||!e||this.clockSystem.setMinute(e)};updateAmPm=()=>{if(!this.clockSystem||this.core.options.clock.type==="24h")return;let e=this.getAmPmValue();e!==""&&this.clockSystem.setAmPm(e)};toggleClassActiveToValueTips=e=>{if(this.clockSystem)return;let t=this.core.getAllValueTips();if(!t)return;let i=t.find(n=>Number(n.innerText)===Number(e));t.forEach(n=>{n.classList.remove(P),n.setAttribute("aria-selected","false")}),i!==void 0&&(i.classList.add(P),i.setAttribute("aria-selected","true"))};destroy(){this.destroyClockSystem()}};var se=class{animation;modal;config;theme;validation;events;clock;constructor(e,t){this.animation=new F(e,t),this.modal=new W(e,t),this.config=new U(e,t),this.theme=new z(e,t),this.validation=new K(e,t),this.events=new Z(e,t),this.clock=new j(e,t)}destroy(){this.animation.destroy(),this.modal.destroy(),this.config.destroy(),this.theme.destroy(),this.validation.destroy(),this.events.destroy(),this.clock.destroy()}};var oe="is-rippling",ae="ripple-hold",R=null;function _e(a){let e=a.target,t=e.hasAttribute("data-md3-ripple")?e:e.closest("[data-md3-ripple]");if(!t||a.button!==0&&a.pointerType==="mouse")return;let i=t.getBoundingClientRect(),r=Math.max(i.width,i.height)*2,s=a.clientX-i.left,o=a.clientY-i.top;t.style.setProperty("--ripple-size",`${r}px`),t.style.setProperty("--ripple-x",`${s}px`),t.style.setProperty("--ripple-y",`${o}px`),t.classList.remove(oe,ae),t.offsetWidth,t.classList.add(oe,ae),t._rippleHold=!0,R=t}function He(a){let e=a.target,i=(e.hasAttribute("data-md3-ripple")?e:e.closest("[data-md3-ripple]"))||R;i&&(i._rippleHold=!1,i.classList.remove(ae),setTimeout(()=>{i.classList.remove(oe),R===i&&(R=null)},1e3))}function Be(a){let e=a.currentTarget;!e||!e._rippleHold||(e._rippleHold=!1,e.classList.remove(ae),setTimeout(()=>{e.classList.remove(oe),R===e&&(R=null)},1e3))}function Se(a){if(v()===!1)return;let e=a||document;e.addEventListener("pointerdown",_e),e.addEventListener("pointerup",He),e.addEventListener("pointercancel",He),e.querySelectorAll("[data-md3-ripple]").forEach(i=>{i.addEventListener("mouseleave",Be)})}var Ie=(a,e)=>{let t;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{a(...i)},e)}};var le=class{core;managers;emitter;eventsClickMobileHandler=()=>{};mutliEventsMoveHandler=()=>{};constructor(e,t,i){this.core=e,this.managers=t,this.emitter=i}init(){if(!this.core.isDestroyed&&!this.core.isInitialized){try{this.managers.config.updateInputValueWithCurrentTimeOnStart(),this.managers.validation.checkDisabledValuesOnStart()}catch{this.core.setIsDestroyed(!0);return}this.managers.theme.setTimepickerClassToElement(),this.managers.theme.setInputClassToInputElement(),this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(),this.managers.theme.setClassTopOpenElement(),this.managers.config.getDisableTime(),this.core.options.ui.inline?.enabled||this.managers.events.handleOpenOnClick(),this.managers.events.handleOpenOnEnterFocus(),this.setupCallbackBridge(),this.core.setIsInitialized(!0)}}setupCallbackBridge(){let{callbacks:e}=this.core.options;e.onOpen&&this.emitter.on("open",e.onOpen),e.onCancel&&this.emitter.on("cancel",e.onCancel),e.onConfirm&&this.emitter.on("confirm",e.onConfirm),e.onUpdate&&this.emitter.on("update",e.onUpdate),e.onSelectHour&&this.emitter.on("select:hour",e.onSelectHour),e.onSelectMinute&&this.emitter.on("select:minute",e.onSelectMinute),e.onSelectAM&&this.emitter.on("select:am",e.onSelectAM),e.onSelectPM&&this.emitter.on("select:pm",e.onSelectPM),e.onError&&this.emitter.on("error",e.onError)}mount(){this.core.isDestroyed||(this.core.isInitialized||this.init(),this.eventsBundle())}unmount(e){let t=Ie((...i)=>{if(i.length>2||!this.core.getModalElement())return;let[n]=i.filter(o=>typeof o=="boolean"),[r]=i.filter(o=>typeof o=="function");this.core.setIsMobileView(!!this.core.options.ui.mobile),n&&this.core.getOkButton()?.click(),this.core.setIsTouchMouseMove(!1),this.removeEventListeners(),this.managers.animation.removeAnimationToClose(),this.core.getOpenElement().forEach(o=>o?.classList.remove("disabled")),setTimeout(()=>{typeof document<"u"&&(document.body.style.overflowY="",document.body.style.paddingRight="")},k.SCROLLBAR_RESTORE),setTimeout(()=>{let o=this.core.getInput();this.core.options.behavior.focusInputAfterClose&&o?.focus();let u=this.core.getModalElement();u!==null&&(u.remove(),this.core.setIsModalRemove(!0))},k.MODAL_REMOVE),r&&r()},this.core.options.behavior.delayHandler||k.DEFAULT_DELAY);e?t(e):t()}destroy(e){if(this.core.isDestroyed)return;let t=typeof e=="function"?{callback:e}:e||{},{keepInputValue:i=!1,callback:n}=t,r=this.core.getInput(),s=i?r?.value:null;this.removeEventListeners(),this.core.getModalElement()?.remove(),this.core.getOpenElement()?.forEach(m=>{m&&(m.classList.remove("disabled","active","tp-ui-open-element"),m.classList.remove("basic","crane-straight","crane","m2","m3-green"))}),r&&(r.classList.remove("tp-ui-invalid-format","invalid-value","error","active","tp-ui-input"),r.removeAttribute("data-open"),r.removeAttribute("data-owner-id"),i&&s&&(r.value=s));let l=this.core.element;l&&(l.classList.remove("basic","crane-straight","crane","m2","m3-green"),l.classList.remove("error","active","disabled"),l.removeAttribute("data-owner-id"),l.removeAttribute("data-open"),this.core.options.ui.cssClass&&l.classList.remove(this.core.options.ui.cssClass)),l?.querySelectorAll(".tp-ui-invalid-text")?.forEach(m=>m.remove()),this.mutliEventsMoveHandler=()=>{},this.eventsClickMobileHandler=()=>{},this.core.reset(),this.managers.destroy(),this.emitter.clear(),A()||(document.body.style.overflowY="",document.body.style.paddingRight=""),n&&n()}eventsBundle(){if(this.core.isDestroyed||!this.core.isModalRemove)return;if(this.managers.validation.setErrorHandler(),this.managers.validation.removeErrorHandler(),!this.core.options.ui.inline?.enabled){let i=this.core.getOpenElement(),n=this.core.getInput();i.forEach(r=>r?.classList.add("disabled")),n?.blur()}if(this.managers.modal.setScrollbarOrNot(),this.managers.modal.setModalTemplate(),this.managers.modal.setNormalizeClass(),this.managers.modal.removeBackdrop(),this.core.isMobileView)this.managers.config.updateClockFaceAccessibility(!0);else{let i=this.core.getModalElement(),n=i?.querySelector(".tp-ui-mobile-clock-wrapper"),r=i?.querySelector(".tp-ui-wrapper"),s=i?.querySelectorAll("*");n?.classList.add("expanded"),r?.classList.add("expanded"),s?.forEach(o=>{!o.classList.contains("tp-ui-select-time")&&!o.classList.contains("tp-ui-mobile-clock-wrapper")&&!o.classList.contains("tp-ui-wrapper")&&o.classList.add("expanded")})}this.managers.modal.setFlexEndToFooterIfNoKeyboardIcon(),setTimeout(()=>{this.managers.theme.setTheme();let i=this.core.getWrapper();i&&this.core.options.ui.cssClass&&i.classList.add(this.core.options.ui.cssClass)},0),this.managers.animation.setAnimationToOpen(),this.managers.config.getInputValueOnOpenAndSet(),this.managers.clock.initializeClockSystem(),this.managers.clock.setOnStartCSSClassesIfClockType24h(),this.managers.clock.setClassActiveToHourOnOpen(),this.managers.events.handleCancelButton(),this.managers.events.handleOkButton(),this.managers.events.handleHourEvents(),this.managers.events.handleMinutesEvents(),this.managers.events.handleKeyboardInput(),this.core.options.ui.enableSwitchIcon&&this.managers.events.handleSwitchViewButton(),this.core.options.clock.type!=="24h"&&(this.managers.events.handleAmClick(),this.managers.events.handlePmClick()),this.core.options.behavior.focusTrap&&this.managers.events.focusTrapHandler(),this.core.options.ui.inline?.enabled||(this.managers.events.handleEscClick(),this.managers.events.handleBackdropClick());let e=this.core.getModalElement();e&&Se(e);let t=this.core.getClockFace();t&&typeof requestAnimationFrame<"u"&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{t?.classList.add("scale-in")})}),this.managers.modal.setShowClassToBackdrop()}removeEventListeners(){if(v()===!1)return;Ae.split(" ").forEach(t=>{document.removeEventListener(t,this.mutliEventsMoveHandler,!1)}),document.removeEventListener("mousedown",this.eventsClickMobileHandler)}};var $=class{events=new Map;on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}once(e,t){let i=n=>{t(n),this.off(e,i)};this.on(e,i)}off(e,t){t?this.events.get(e)?.delete(t):this.events.delete(e)}emit(e,t){this.events.get(e)?.forEach(i=>{i(t)})}clear(){this.events.clear()}hasListeners(e){return(this.events.get(e)?.size??0)>0}};var V={clock:{type:"12h",incrementHours:1,incrementMinutes:1,autoSwitchToMinutes:!1,disabledTime:void 0,currentTime:void 0},ui:{theme:"basic",animation:!0,backdrop:!0,mobile:!1,enableSwitchIcon:!1,editable:!1,enableScrollbar:!1,cssClass:void 0,appendModalSelector:"",iconTemplate:"",iconTemplateMobile:"",inline:void 0},labels:{am:"AM",pm:"PM",ok:"OK",cancel:"Cancel",time:"Select time",mobileTime:"Enter Time",mobileHour:"Hour",mobileMinute:"Minute"},behavior:{focusInputAfterClose:!1,focusTrap:!0,delayHandler:300,id:void 0},callbacks:{onOpen:void 0,onCancel:void 0,onConfirm:void 0,onUpdate:void 0,onSelectHour:void 0,onSelectMinute:void 0,onSelectAM:void 0,onSelectPM:void 0,onError:void 0}};function ge(a={}){return{clock:{...V.clock,...a.clock||{}},ui:{...V.ui,...a.ui||{}},labels:{...V.labels,...a.labels||{}},behavior:{...V.behavior,...a.behavior||{}},callbacks:{...V.callbacks,...a.callbacks||{}}}}var we=a=>a.replace(/[^0-9:APMapm\s]/g,"");var q=new Map,X=class{core;managers;lifecycle;emitter;constructor(e,t){if(A())throw new Error("TimepickerUI requires browser environment");let i=this.resolveInputElement(e);if(!i)throw new Error("Input element not found");let n=t?.behavior?.id,r=n||`tp-ui-${Te()}`,s=this.createWrapperElement(i),o=ge(t||{});if(o.ui.inline?.enabled&&typeof t?.behavior?.focusTrap>"u"&&(o.behavior.focusTrap=!1),o.ui.inline?.enabled){if(!o.ui.inline.containerId)throw new Error("inline.containerId is required when inline mode is enabled");if(!A()&&!document.getElementById(o.ui.inline.containerId))throw new Error(`Container element with id "${o.ui.inline.containerId}" not found`)}this.emitter=new $,this.core=new J(s,o,r,n);let u=this.core.getInput();if(u){let l=H(u,o.clock.type),d=Number(l.hour)*30,m=Number(l.minutes)*6;this.core.setDegreesHours(d),this.core.setDegreesMinutes(m)}this.managers=new se(this.core,this.emitter),this.lifecycle=new le(this.core,this.managers,this.emitter),this.managers.config.checkMobileOption(),this.managers.config.preventClockTypeByCurrentTime(),this.setupInternalEventListeners(),q.set(this.core.instanceId,this)}setupInternalEventListeners(){this.emitter.on("show",()=>{this.core.isDestroyed||this.lifecycle.mount()}),this.emitter.on("cancel",()=>{this.core.isDestroyed||this.lifecycle.unmount()}),this.emitter.on("confirm",e=>{if(!this.core.isDestroyed){let t=this.core.getInput();if(t&&e.hour&&e.minutes){let i=e.type?` ${e.type}`:"";t.value=`${e.hour}:${e.minutes}${i}`}this.lifecycle.unmount()}})}create(){this.lifecycle.init(),this.core.options.ui.inline?.enabled&&this.lifecycle.mount()}open(e){this.lifecycle.mount(),e&&e()}close(e,t){this.lifecycle.unmount(e?t:void 0),!e&&t&&t()}destroy(e){q.delete(this.core.instanceId),this.lifecycle.destroy(e)}update(e,t){this.core.isDestroyed||(this.core.updateOptions(e.options),this.managers.config.checkMobileOption(),e.create&&this.create(),t&&t())}getValue(){if(this.core.isDestroyed)return{hour:"",minutes:"",type:void 0,time:"",degreesHours:null,degreesMinutes:null};let e=this.core.getHour(),t=this.core.getMinutes(),i=this.core.getActiveTypeMode(),n=e?.value||"12",r=t?.value||"00",s=this.core.options.clock.type==="24h"?void 0:i?.textContent||"AM",o="";return this.core.options.clock.type==="24h"?o=`${n.padStart(2,"0")}:${r.padStart(2,"0")}`:o=`${n}:${r.padStart(2,"0")} ${s}`,{hour:n,minutes:r,type:s,time:o,degreesHours:this.core.degreesHours,degreesMinutes:this.core.degreesMinutes}}setValue(e,t=!0){if(this.core.isDestroyed||!e||typeof e!="string")return;this.core.isInitialized||this.create();let i=we(e.trim()),n="12",r="00",s="AM";try{if(this.core.options.clock.type==="24h"){let p=i.match(/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/);if(!p)throw new Error("Invalid 24h format. Expected HH:MM");n=p[1].padStart(2,"0"),r=p[2]}else{let p=i.match(/^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i);if(!p)throw new Error("Invalid 12h format. Expected HH:MM AM/PM");n=p[1],r=p[2],s=p[3].toUpperCase()}let o=this.core.getHour(),u=this.core.getMinutes(),l=this.core.getAM(),d=this.core.getPM();if(o&&(o.value=n,o.setAttribute("aria-valuenow",n),this.core.setDegreesHours(Number(n)*30)),u&&(u.value=r,u.setAttribute("aria-valuenow",r),this.core.setDegreesMinutes(Number(r)*6)),this.core.options.clock.type!=="24h"&&l&&d&&(s==="AM"?(l.classList.add("active"),d.classList.remove("active")):(d.classList.add("active"),l.classList.remove("active"))),t){let p=this.core.getInput();p&&(p.value=i)}let m=this.core.getClockHand();m&&(m.style.transform=`rotateZ(${this.core.degreesHours||0}deg)`)}catch{return}}getElement(){return this.core.element}get instanceId(){return this.core.instanceId}get options(){return this.core.options}get isInitialized(){return this.core.isInitialized}get isDestroyed(){return this.core.isDestroyed}get hour(){return this.core.getHour()}get minutes(){return this.core.getMinutes()}get okButton(){return this.core.getOkButton()}get cancelButton(){return this.core.getCancelButton()}get clockHand(){return this.core.getClockHand()}on(e,t){this.core.isDestroyed||this.emitter.on(e,t)}once(e,t){this.core.isDestroyed||this.emitter.once(e,t)}off(e,t){this.core.isDestroyed||this.emitter.off(e,t)}resolveInputElement(e){if(v()===!1)return null;let t=null;if(typeof e=="string"){if(t=document.querySelector(e),!t)return null}else if(e instanceof HTMLElement)t=e;else return null;return t.tagName==="INPUT"?t:t.querySelector("input")}createWrapperElement(e){if(v()===!1)return e;let t=e.parentElement;if(e.tagName==="INPUT"&&!t?.classList.contains("tp-ui")){let i=document.createElement("div");return i.className="tp-ui",e.parentNode?.insertBefore(i,e),i.appendChild(e),i}return t&&!t.classList.contains("tp-ui")&&t.classList.add("tp-ui"),t||e}static getById(e){return q.get(e)}static getAllInstances(){return Array.from(q.values())}static isAvailable(e){return A()?!1:typeof e=="string"?document.querySelector(e)!==null:e instanceof HTMLElement?document.contains(e):!1}static destroyAll(){Array.from(q.values()).forEach(t=>t.destroy()),q.clear()}};var ce=X;var We=ce;0&&(module.exports={EventEmitter,TimepickerUI});
|
package/dist/index.d.cts
CHANGED
|
@@ -25,8 +25,8 @@ type HideEventData = Record<string, never>;
|
|
|
25
25
|
|
|
26
26
|
/** Payload for real-time updates */
|
|
27
27
|
type UpdateEventData = {
|
|
28
|
-
hour
|
|
29
|
-
minutes
|
|
28
|
+
hour?: string;
|
|
29
|
+
minutes?: string;
|
|
30
30
|
type?: string;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -479,47 +479,47 @@ interface CallbacksOptions {
|
|
|
479
479
|
/**
|
|
480
480
|
* @description Triggered when timepicker opens
|
|
481
481
|
*/
|
|
482
|
-
onOpen?: TimepickerEventCallback
|
|
482
|
+
onOpen?: TimepickerEventCallback<OpenEventData>;
|
|
483
483
|
|
|
484
484
|
/**
|
|
485
485
|
* @description Triggered when user cancels
|
|
486
486
|
*/
|
|
487
|
-
onCancel?: TimepickerEventCallback
|
|
487
|
+
onCancel?: TimepickerEventCallback<CancelEventData>;
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
490
|
* @description Triggered when user confirms time
|
|
491
491
|
*/
|
|
492
|
-
onConfirm?: TimepickerEventCallback
|
|
492
|
+
onConfirm?: TimepickerEventCallback<ConfirmEventData>;
|
|
493
493
|
|
|
494
494
|
/**
|
|
495
495
|
* @description Triggered during interaction (real-time)
|
|
496
496
|
*/
|
|
497
|
-
onUpdate?: TimepickerEventCallback
|
|
497
|
+
onUpdate?: TimepickerEventCallback<UpdateEventData>;
|
|
498
498
|
|
|
499
499
|
/**
|
|
500
500
|
* @description Triggered when hour mode is selected
|
|
501
501
|
*/
|
|
502
|
-
onSelectHour?: TimepickerEventCallback
|
|
502
|
+
onSelectHour?: TimepickerEventCallback<SelectHourEventData>;
|
|
503
503
|
|
|
504
504
|
/**
|
|
505
505
|
* @description Triggered when minute mode is selected
|
|
506
506
|
*/
|
|
507
|
-
onSelectMinute?: TimepickerEventCallback
|
|
507
|
+
onSelectMinute?: TimepickerEventCallback<SelectMinuteEventData>;
|
|
508
508
|
|
|
509
509
|
/**
|
|
510
510
|
* @description Triggered when AM is selected
|
|
511
511
|
*/
|
|
512
|
-
onSelectAM?: TimepickerEventCallback
|
|
512
|
+
onSelectAM?: TimepickerEventCallback<SelectAMEventData>;
|
|
513
513
|
|
|
514
514
|
/**
|
|
515
515
|
* @description Triggered when PM is selected
|
|
516
516
|
*/
|
|
517
|
-
onSelectPM?: TimepickerEventCallback
|
|
517
|
+
onSelectPM?: TimepickerEventCallback<SelectPMEventData>;
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
520
|
* @description Triggered on invalid time format
|
|
521
521
|
*/
|
|
522
|
-
onError?: TimepickerEventCallback
|
|
522
|
+
onError?: TimepickerEventCallback<ErrorEventData>;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
/**
|
|
@@ -582,4 +582,4 @@ declare class TimepickerUI {
|
|
|
582
582
|
static destroyAll(): void;
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
export { type CancelEventData, type ConfirmEventData, type ErrorEventData, EventEmitter, type HideEventData, type OpenEventData, type OptionTypes, type SelectAMEventData, type SelectHourEventData, type SelectMinuteEventData, type SelectPMEventData, type ShowEventData, type SwitchViewEventData, TimepickerUI, type UpdateEventData, TimepickerUI as default };
|
|
585
|
+
export { type BehaviorOptions, type CallbacksOptions, type CancelEventData, type ClockOptions, type ConfirmEventData, type ErrorEventData, EventEmitter, type HideEventData, type LabelsOptions, type OpenEventData, type OptionTypes, type SelectAMEventData, type SelectHourEventData, type SelectMinuteEventData, type SelectPMEventData, type ShowEventData, type SwitchViewEventData, type TimepickerOptions, TimepickerUI, type UIOptions, type UpdateEventData, TimepickerUI as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ type HideEventData = Record<string, never>;
|
|
|
25
25
|
|
|
26
26
|
/** Payload for real-time updates */
|
|
27
27
|
type UpdateEventData = {
|
|
28
|
-
hour
|
|
29
|
-
minutes
|
|
28
|
+
hour?: string;
|
|
29
|
+
minutes?: string;
|
|
30
30
|
type?: string;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -479,47 +479,47 @@ interface CallbacksOptions {
|
|
|
479
479
|
/**
|
|
480
480
|
* @description Triggered when timepicker opens
|
|
481
481
|
*/
|
|
482
|
-
onOpen?: TimepickerEventCallback
|
|
482
|
+
onOpen?: TimepickerEventCallback<OpenEventData>;
|
|
483
483
|
|
|
484
484
|
/**
|
|
485
485
|
* @description Triggered when user cancels
|
|
486
486
|
*/
|
|
487
|
-
onCancel?: TimepickerEventCallback
|
|
487
|
+
onCancel?: TimepickerEventCallback<CancelEventData>;
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
490
|
* @description Triggered when user confirms time
|
|
491
491
|
*/
|
|
492
|
-
onConfirm?: TimepickerEventCallback
|
|
492
|
+
onConfirm?: TimepickerEventCallback<ConfirmEventData>;
|
|
493
493
|
|
|
494
494
|
/**
|
|
495
495
|
* @description Triggered during interaction (real-time)
|
|
496
496
|
*/
|
|
497
|
-
onUpdate?: TimepickerEventCallback
|
|
497
|
+
onUpdate?: TimepickerEventCallback<UpdateEventData>;
|
|
498
498
|
|
|
499
499
|
/**
|
|
500
500
|
* @description Triggered when hour mode is selected
|
|
501
501
|
*/
|
|
502
|
-
onSelectHour?: TimepickerEventCallback
|
|
502
|
+
onSelectHour?: TimepickerEventCallback<SelectHourEventData>;
|
|
503
503
|
|
|
504
504
|
/**
|
|
505
505
|
* @description Triggered when minute mode is selected
|
|
506
506
|
*/
|
|
507
|
-
onSelectMinute?: TimepickerEventCallback
|
|
507
|
+
onSelectMinute?: TimepickerEventCallback<SelectMinuteEventData>;
|
|
508
508
|
|
|
509
509
|
/**
|
|
510
510
|
* @description Triggered when AM is selected
|
|
511
511
|
*/
|
|
512
|
-
onSelectAM?: TimepickerEventCallback
|
|
512
|
+
onSelectAM?: TimepickerEventCallback<SelectAMEventData>;
|
|
513
513
|
|
|
514
514
|
/**
|
|
515
515
|
* @description Triggered when PM is selected
|
|
516
516
|
*/
|
|
517
|
-
onSelectPM?: TimepickerEventCallback
|
|
517
|
+
onSelectPM?: TimepickerEventCallback<SelectPMEventData>;
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
520
|
* @description Triggered on invalid time format
|
|
521
521
|
*/
|
|
522
|
-
onError?: TimepickerEventCallback
|
|
522
|
+
onError?: TimepickerEventCallback<ErrorEventData>;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
/**
|
|
@@ -582,4 +582,4 @@ declare class TimepickerUI {
|
|
|
582
582
|
static destroyAll(): void;
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
export { type CancelEventData, type ConfirmEventData, type ErrorEventData, EventEmitter, type HideEventData, type OpenEventData, type OptionTypes, type SelectAMEventData, type SelectHourEventData, type SelectMinuteEventData, type SelectPMEventData, type ShowEventData, type SwitchViewEventData, TimepickerUI, type UpdateEventData, TimepickerUI as default };
|
|
585
|
+
export { type BehaviorOptions, type CallbacksOptions, type CancelEventData, type ClockOptions, type ConfirmEventData, type ErrorEventData, EventEmitter, type HideEventData, type LabelsOptions, type OpenEventData, type OptionTypes, type SelectAMEventData, type SelectHourEventData, type SelectMinuteEventData, type SelectPMEventData, type ShowEventData, type SwitchViewEventData, type TimepickerOptions, TimepickerUI, type UIOptions, type UpdateEventData, TimepickerUI as default };
|