const e=require("../../_util/classNames.js"),t=require("../../_util/omit.js"),n=require("../locale/en_US.js"),r=require("../../locale/LocaleReceiver.js"),i=require("../../config-provider/hooks/useConfigInject.js"),a=require("../../_util/statusUtils.js"),o=require("../../form/FormItemContext.js"),s=require("../../space/Compact.js"),c=require("../../vc-picker/RangePicker.js"),l=require("../style/index.js"),u=require("../util.js"),d=require("./props.js"),f=require("./index.js");let p=require("vue"),m=require("@antsoo-lib/icons");function h(h,g){return(0,p.defineComponent)({compatConfig:{MODE:3},name:`ARangePicker`,inheritAttrs:!1,props:{...d.commonProps(),...d.rangePickerProps(),...g},slots:Object,setup(d,{expose:g,slots:_,attrs:v,emit:y}){let b=d,x=o.useInjectFormItemContext(),S=o.FormItemInputContext.useInject(),{prefixCls:C,direction:w,getPopupContainer:T,size:E,rootPrefixCls:D,disabled:O}=i.default(`picker`,b),{compactSize:k,compactItemClassnames:A}=s.useCompactItemContext(C,w),j=(0,p.computed)(()=>k.value||E.value),[M,N]=l.default(C),P=(0,p.ref)();g({focus:()=>{P.value?.focus()},blur:()=>{P.value?.blur()}});let F=e=>b.valueFormat?h.toString(e,b.valueFormat):e,I=(e,t)=>{let n=F(e);y(`update:value`,n),y(`change`,n,t),x.onFieldChange()},L=e=>{y(`update:open`,e),y(`openChange`,e)},R=e=>{y(`focus`,e)},z=e=>{y(`blur`,e),x.onFieldBlur()},B=(e,t)=>{y(`panelChange`,F(e),t)},V=e=>{y(`ok`,F(e))},H=(e,t,n)=>{y(`calendarChange`,F(e),t,n)},[U]=r.useLocaleReceiver(`DatePicker`,n.default),W=(0,p.computed)(()=>b.value&&b.valueFormat?h.toDate(b.value,b.valueFormat):b.value),G=(0,p.computed)(()=>b.defaultValue&&b.valueFormat?h.toDate(b.defaultValue,b.valueFormat):b.defaultValue),K=(0,p.computed)(()=>b.defaultPickerValue&&b.valueFormat?h.toDate(b.defaultPickerValue,b.valueFormat):b.defaultPickerValue);return()=>{let n={...U.value,...b.locale},r={...b,...v},{prefixCls:i,bordered:o=!0,placeholder:s,suffixIcon:l=_.suffixIcon?.(),picker:d=`date`,transitionName:g,allowClear:y=!0,dateRender:E=_.dateRender,renderExtraFooter:k=_.renderExtraFooter,separator:F=_.separator?.(),clearIcon:q=_.clearIcon?.(),id:J=x.id.value,...Y}=r;delete Y[`onUpdate:value`],delete Y[`onUpdate:open`];let{format:X,showTime:Z}=r,Q={};Q={...Q,...Z?f.getTimeProps({format:X,picker:d,...Z}):{},...d===`time`?f.getTimeProps({format:X,...t.default(Y,[`disabledTime`]),picker:d}):{}};let $=C.value,ee=(0,p.createVNode)(p.Fragment,null,[l||(d===`time`?(0,p.createVNode)(m.ClockCircleOutlined,null,null):(0,p.createVNode)(m.CalendarOutlined,null,null)),S.hasFeedback&&S.feedbackIcon]);return M((0,p.createVNode)(c.default,{dateRender:E,renderExtraFooter:k,separator:F||(0,p.createVNode)(`span`,{"aria-label":`to`,class:`${$}-separator`},[(0,p.createVNode)(m.SwapRightOutlined,null,null)]),ref:P,dropdownAlign:u.transPlacement2DropdownAlign(w.value,b.placement),placeholder:u.getRangePlaceholder(n,d,s),suffixIcon:ee,clearIcon:q||(0,p.createVNode)(m.CloseCircleFilled,null,null),allowClear:y,transitionName:g||`${D.value}-slide-up`,...Y,...Q,disabled:O.value,id:J,value:W.value,defaultValue:G.value,defaultPickerValue:K.value,picker:d,class:e.default({[`${$}-${j.value}`]:j.value,[`${$}-borderless`]:!o},a.getStatusClassNames($,a.getMergedStatus(S.status,b.status),S.hasFeedback),v.class,N.value,A.value),locale:n.lang,prefixCls:$,getPopupContainer:v.getCalendarContainer||T.value,generateConfig:h,prevIcon:_.prevIcon?.()||(0,p.createVNode)(`span`,{class:`${$}-prev-icon`},null),nextIcon:_.nextIcon?.()||(0,p.createVNode)(`span`,{class:`${$}-next-icon`},null),superPrevIcon:_.superPrevIcon?.()||(0,p.createVNode)(`span`,{class:`${$}-super-prev-icon`},null),superNextIcon:_.superNextIcon?.()||(0,p.createVNode)(`span`,{class:`${$}-super-next-icon`},null),components:f.Components,direction:w.value,dropdownClassName:e.default(N.value,b.popupClassName,b.dropdownClassName),onChange:I,onOpenChange:L,onFocus:R,onBlur:z,onPanelChange:B,onOk:V,onCalendarChange:H},null))}}})}exports.default=h;