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