import{u as R}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{u as W}from"./callbackStore-BhxBUA6V.js";import{a as N,u as j}from"./useAppearanceTypography-BBl5RU11.js";import{d as z,e as _,a as E,w as L,f as O,i as U,x as o}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{u as n,r as b}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as k}from"./vendor-vue-shared-DrzsEcag.js";import"./vendor-pinia-BSPefQhS.js";import"./useAppearanceStore-IzenP-G4.js";import"./vendor-axios-xsH4HHeE.js";import"./vendor-vue3-toastify-DBGjcIyK.js";const q={class:"ccb-range-timePicker"},G={class:"ccb-range-timePicker__from"},J={class:"ccb-range-timePicker__input"},K={class:"ccb-range-timePicker__to"},Q={class:"ccb-range-timePicker__input"},it=z({__name:"RangeTime",props:{format:{type:Boolean},minInterval:{},modelValue:{}},emits:["update:modelValue"],setup(I,{emit:M}){var g,v;R(t=>({"6cda526c":n(B),"6d407296":n(D),"6f084f32":n(C),"5fcee40e":n(V),"3cd8a2d4":n(P),"780bb406":n(y),"35a008c3":n(F),"545442ba":n(x)}));const S=W(),{textColor:y,borderColor:C,formFieldsColor:P,borderRadius:V,borderWidth:B,borderStyle:D}=j(),{fieldsBtnFontSize:F,fieldsBtnFontWeight:x}=N(),r=I,A=M,m=t=>{const e=t.match(/(\d+)h/),s=t.match(/(\d+)m/),a=e?parseInt(e[1])*60:0,u=s?parseInt(s[1]):0;return a+u},i=b(((g=r.modelValue)==null?void 0:g.from)||h()),c=b(((v=r.modelValue)==null?void 0:v.to)||h()),T=_(()=>f(i.value)),$=_(()=>f(c.value));E(()=>{r.minInterval&&H(i.value)});const d=t=>{const[e,s]=t.toLowerCase().split(" "),[a,u]=e.split(":").map(Number);let l=a;return s==="pm"&&a!==12?l=a+12:s==="am"&&a===12&&(l=0),{hours:l,minutes:u,seconds:0}};S.add("updateRangeTimePicker",t=>{i.value=d(t.start),c.value=r.minInterval?p(i.value,m(r.minInterval)):d(t.end)});const w=t=>{const e=new Date;return e.setHours(t.hours),e.setMinutes(t.minutes),e.setSeconds(t.seconds||0),e},H=t=>{if(i.value=t,r.minInterval){const e=m(r.minInterval);c.value=p(t,e)}},p=(t,e)=>{const s=w(t);return s.setMinutes(s.getMinutes()+e),{hours:s.getHours(),minutes:s.getMinutes(),seconds:0}};L([i,c],t=>{Array.isArray(t)&&A("update:modelValue",t)});function f(t){const e=t.minutes.toString().padStart(2,"0");if(r.format)return`${t.hours.toString().padStart(2,"0")}:${e}`;const s=t.hours>=12?"PM":"AM";return`${t.hours%12||12}:${e} ${s}`}function h(){const t=new Date;return{hours:t.getHours(),minutes:t.getMinutes(),seconds:0}}return(t,e)=>(U(),O("div",q,[o("div",G,[o("div",J,[e[0]||(e[0]=o("i",{class:"ccb-icon-timepicker-light-clock"},null,-1)),o("span",null,k(T.value),1)])]),e[2]||(e[2]=o("div",{class:"ccb-range-timePicker__separator"},[o("span",null,"to")],-1)),o("div",K,[o("div",Q,[e[1]||(e[1]=o("i",{class:"ccb-icon-timepicker-light-clock"},null,-1)),o("span",null,k($.value),1)])])]))}});export{it as default};
//# sourceMappingURL=RangeTime-nVvKejEx.js.map
