"use strict";const e=require("../../../../common/vendor.js");require("../../../adapter-vue.js");const t=require("../../../utils/env.js"),a=e.defineComponent({__name:"date-table",props:{type:{type:String,default:"range"},currentPanelDate:{type:e.dayjs_minExports.Dayjs,default:()=>e.dayjs()},date:{type:e.dayjs_minExports.Dayjs,default:null},startDate:{type:e.dayjs_minExports.Dayjs,default:null},endDate:{type:e.dayjs_minExports.Dayjs,default:null}},emits:["pick"],setup(a,{emit:l}){const n=a,d=l,r=e.getCurrentInstance(),u=e.ref([[],[],[],[],[],[]]),s=e.ref(e.dayjs(n.currentPanelDate||null)),o=e.ref(e.dayjs(n.date||null)),i=e.ref(e.dayjs(n.startDate||null)),v=e.ref(e.dayjs(n.endDate||null)),c=e.computed((()=>e.dayjs.weekdaysShort())),y=e.computed((()=>c.value.map((e=>e.substring(1))))),p=e.computed((()=>{var e;const t=null==(e=s.value)?void 0:e.startOf("month");return null==t?void 0:t.subtract((null==t?void 0:t.day())||7,"day")})),f=e.computed((()=>{var e,t,a,l,d;const r=u.value,c=y.value.length,f=null==(e=s.value)?void 0:e.startOf("month"),m=(null==f?void 0:f.day())||7,D=null==f?void 0:f.daysInMonth();let Y=1;for(let s=0;s<u.value.length;s++)for(let e=0;e<c;e++){const u=null==(t=p.value)?void 0:t.add(Y,"day"),c=null==u?void 0:u.date(),y="single"===n.type&&(null==u?void 0:u.format("YYYY-MM-DD"))===(null==(a=o.value)?void 0:a.format("YYYY-MM-DD")),f="range"===n.type&&(null==u?void 0:u.format("YYYY-MM-DD"))===(null==(l=i.value)?void 0:l.format("YYYY-MM-DD")),j="range"===n.type&&(null==u?void 0:u.format("YYYY-MM-DD"))===(null==(d=v.value)?void 0:d.format("YYYY-MM-DD")),g=(null==u?void 0:u.isSameOrBefore(v.value,"day"))&&(null==u?void 0:u.isSameOrAfter(i.value,"day"));let M="normal";Y<m?M="prev-month":Y-m>=D&&(M="next-month"),r[s][e]={type:M,date:u,text:c,isSelected:y||f||j,isSelectedStart:f,isSelectedEnd:j,isInRange:g},Y++}return r}));return e.watch((()=>[n.currentPanelDate,n.date,n.startDate,n.endDate]),(()=>{s.value=e.dayjs(n.currentPanelDate||null),o.value=e.dayjs(n.date||null),i.value=e.dayjs(n.startDate||null),v.value=e.dayjs(n.endDate||null),e.nextTick$1((()=>{var e;null==(e=null==r?void 0:r.proxy)||e.$forceUpdate()}))}),{deep:!0,immediate:!0}),(a,l)=>({a:e.f(e.unref(y),((t,a,l)=>({a:e.t(e.unref(e.Wt).t(`time.${t}`)),b:t,c:t+""}))),b:e.f(e.unref(f),((t,a,l)=>({a:e.f(t,((t,a,l)=>({a:e.t(t.text),b:e.n(t.isSelected&&"selected"),c:e.n(t.isSelectedStart&&"selected-start"),d:e.n(t.isSelectedEnd&&"selected-end"),e:e.n(t.isInRange&&"range"),f:e.o$1((e=>{var a;"normal"===(null==(a=t)?void 0:a.type)&&d("pick",a)}),a),g:a,h:e.n(t.type)}))),b:a}))),c:e.n(!e.unref(t.isPC)&&"tui-date-table-h5")})}}),l=e._export_sfc(a,[["__scopeId","data-v-f07c449d"]]);wx.createComponent(l);
