import{i as e}from"./rolldown-runtime-BgaNhQyE.js";import{Dr as t,Et as n,Hn as r,Vn as i,Yn as a,Zn as o,ar as s,xr as c,yr as l}from"./jsx-runtime-ADHq9IcL.js";import{t as u}from"./CloseCircleFilled-BARdd-Ff.js";import{g as d}from"./style-Der9vtsK.js";var f=e(t()),p=e=>{let{allowClear:t,clearIcon:r,contextAllowClear:i,contextClearIcon:a,defaultAllowClear:o,componentName:s}=e;return(0,f.useMemo)(()=>t??i??o?{clearIcon:d(n(t)?t?.clearIcon:r,n(i)?i?.clearIcon:a,f.createElement(u,null)),disabled:(n(t)?t?.disabled:void 0)??(n(i)?i?.disabled:void 0)}:!1,[t,r,i,a,o])};function m(e){return!!(e.addonBefore||e.addonAfter)}function h(e){return!!(e.prefix||e.suffix||e.allowClear)}function g(e,t,n){let r=t.cloneNode(!0),i=Object.create(e,{target:{value:r},currentTarget:{value:r}});return r.value=n,typeof t.selectionStart==`number`&&typeof t.selectionEnd==`number`&&(r.selectionStart=t.selectionStart,r.selectionEnd=t.selectionEnd),r.setSelectionRange=(...e)=>{t.setSelectionRange(...e)},i}function _(e,t,n,r){if(!n)return;let i=t;if(t.type===`click`){i=g(t,e,``),n(i);return}if(e.type!==`file`&&r!==void 0){i=g(t,e,r),n(i);return}n(i)}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{inputElement:n,children:r,prefixCls:a,prefix:o,suffix:s,addonBefore:c,addonAfter:l,className:u,style:d,disabled:p,readOnly:g,focused:_,triggerFocus:y,allowClear:b,value:x,handleReset:S,hidden:C,classes:w,classNames:T,dataAttrs:E,styles:D,components:O,onClear:k}=e,A=r??n,j=O?.affixWrapper||`span`,M=O?.groupWrapper||`span`,N=O?.wrapper||`span`,P=O?.groupAddon||`span`,F=(0,f.useRef)(null),I=e=>{F.current?.contains(e.target)&&y?.()},L=h(e),R=(0,f.cloneElement)(A,{value:x,className:i(A.props?.className,!L&&T?.variant)||null}),z=(0,f.useRef)(null);if(f.useImperativeHandle(t,()=>({nativeElement:z.current||F.current})),L){let e=null;if(b){let t=!p&&!g&&x&&!(typeof b==`object`&&b.disabled),n=`${a}-clear-icon`,r=typeof b==`object`&&b?.clearIcon?b.clearIcon:`✖`;e=f.createElement(`button`,{type:`button`,onClick:e=>{S?.(e),k?.()},onMouseDown:e=>e.preventDefault(),className:i(n,{[`${n}-hidden`]:!t,[`${n}-has-suffix`]:!!s},T?.clear),style:D?.clear},r)}let t=`${a}-affix-wrapper`,n=i(t,{[`${a}-disabled`]:p,[`${t}-disabled`]:p,[`${t}-focused`]:_,[`${t}-readonly`]:g,[`${t}-input-with-clear-btn`]:s&&b&&x},w?.affixWrapper,T?.affixWrapper,T?.variant),r=(s||b)&&f.createElement(`span`,{className:i(`${a}-suffix`,T?.suffix),style:D?.suffix},e,s);R=f.createElement(j,v({className:n,style:D?.affixWrapper,onClick:I},E?.affixWrapper,{ref:F}),o&&f.createElement(`span`,{className:i(`${a}-prefix`,T?.prefix),style:D?.prefix},o),R,r)}if(m(e)){let e=`${a}-group`,t=`${e}-addon`,n=`${e}-wrapper`,r=i(`${a}-wrapper`,e,w?.wrapper,T?.wrapper),o=i(n,{[`${n}-disabled`]:p},w?.group,T?.groupWrapper);R=f.createElement(M,{className:o,ref:z},f.createElement(N,{className:r},c&&f.createElement(P,{className:t},c),R,l&&f.createElement(P,{className:t},l)))}return f.cloneElement(R,{className:i(R.props?.className,u)||null,style:{...R.props?.style,...d},hidden:C})});function b(e,t){return f.useMemo(()=>{let n={};t&&(n.show=typeof t==`object`&&t.formatter?t.formatter:!!t),n={...n,...e};let{show:r,...i}=n;return{...i,show:!!r,showFormatter:typeof r==`function`?r:void 0,strategy:i.strategy||(e=>e.length)}},[e,t])}function x({countConfig:e,value:t,maxLength:n}){return f.useMemo(()=>{let r=e.max??n,i=e.strategy(t),a=!!r&&i>r,o=Number(r)>0;return{mergedMax:r,isOutOfRange:a,dataCount:e.show?e.showFormatter?e.showFormatter({value:t,count:i,maxLength:r}):`${i}${o?` / ${r}`:``}`:void 0}},[e,n,t])}function S({countConfig:e,getTarget:t}){let[n,r]=f.useState(null),i=f.useRef(t);return f.useEffect(()=>{i.current=t},[t]),f.useEffect(()=>{n&&(i.current()?.setSelectionRange(...n),r(null))},[n]),f.useCallback((t,n)=>{let a=t;return!n&&e.exceedFormatter&&e.max&&e.strategy(t)>e.max&&(a=e.exceedFormatter(t,{max:e.max}),t!==a&&r([i.current()?.selectionStart||0,i.current()?.selectionEnd||0])),a},[e])}function C(e,t){let[n,r]=l(e,t);return{value:n,setValue:r,formatValue:n==null?``:String(n)}}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{autoComplete:n,onChange:r,onFocus:a,onBlur:c,onPressEnter:l,onKeyDown:u,onKeyUp:d,prefixCls:p=`rc-input`,disabled:m,htmlSize:h,className:g,maxLength:v,suffix:T,showCount:E,count:D,type:O=`text`,classes:k,classNames:A,styles:j,onCompositionStart:M,onCompositionEnd:N,...P}=e,[F,I]=(0,f.useState)(!1),L=(0,f.useRef)(!1),R=(0,f.useRef)(!1),z=(0,f.useRef)(null),B=(0,f.useRef)(null),V=e=>{z.current&&s(z.current,e)},{setValue:H,formatValue:U}=C(e.defaultValue,e.value),W=b(D,E),{isOutOfRange:G,dataCount:K}=x({countConfig:W,value:U,maxLength:v}),q=S({countConfig:W,getTarget:()=>z.current});(0,f.useImperativeHandle)(t,()=>({focus:V,blur:()=>{z.current?.blur()},setSelectionRange:(e,t,n)=>{z.current?.setSelectionRange(e,t,n)},select:()=>{z.current?.select()},input:z.current,nativeElement:B.current?.nativeElement||z.current})),(0,f.useEffect)(()=>{R.current&&=!1,I(e=>e&&m?!1:e)},[m]);let J=(e,t,n)=>{let i=q(t,L.current);n.source===`compositionEnd`&&t===i||(H(i),z.current&&_(z.current,e,r,i))},Y=e=>{J(e,e.target.value,{source:`change`})},X=e=>{L.current=!1,J(e,e.currentTarget.value,{source:`compositionEnd`}),N?.(e)},Z=e=>{l&&e.key===`Enter`&&!R.current&&!e.nativeEvent.isComposing&&(R.current=!0,l(e)),u?.(e)},Q=e=>{e.key===`Enter`&&(R.current=!1),d?.(e)},ee=e=>{I(!0),a?.(e)},te=e=>{R.current&&=!1,I(!1),c?.(e)},ne=e=>{H(``),V(),z.current&&_(z.current,e,r)},re=G&&`${p}-out-of-range`;return f.createElement(y,w({},P,{prefixCls:p,className:i(g,re),handleReset:ne,value:U,focused:F,triggerFocus:V,suffix:T||W.show?f.createElement(f.Fragment,null,W.show&&f.createElement(`span`,{className:i(`${p}-show-count-suffix`,{[`${p}-show-count-has-suffix`]:!!T},A?.count),style:{...j?.count}},K),T):null,disabled:m,classes:k,classNames:A,styles:j,ref:B}),(()=>{let t=o(e,[`prefixCls`,`onPressEnter`,`addonBefore`,`addonAfter`,`prefix`,`suffix`,`allowClear`,`defaultValue`,`showCount`,`count`,`classes`,`htmlSize`,`styles`,`classNames`,`onClear`]);return f.createElement(`input`,w({autoComplete:n},t,{onChange:Y,onFocus:ee,onBlur:te,onKeyDown:Z,onKeyUp:Q,className:i(p,{[`${p}-disabled`]:m},A?.input),style:j?.input,ref:z,size:h,type:O,onCompositionStart:e=>{L.current=!0,M?.(e)},onCompositionEnd:X}))})())}),E=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; pointer-events: none !important; `,D=[`letter-spacing`,`line-height`,`padding-top`,`padding-bottom`,`font-family`,`font-weight`,`font-size`,`font-variant`,`text-rendering`,`text-transform`,`width`,`text-indent`,`padding-left`,`padding-right`,`border-width`,`box-sizing`,`word-break`,`white-space`],O={},k;function A(e,t=!1){let n=e.getAttribute(`id`)||e.getAttribute(`data-reactid`)||e.getAttribute(`name`);if(t&&O[n])return O[n];let r=window.getComputedStyle(e),i=r.getPropertyValue(`box-sizing`)||r.getPropertyValue(`-moz-box-sizing`)||r.getPropertyValue(`-webkit-box-sizing`),a=parseFloat(r.getPropertyValue(`padding-bottom`))+parseFloat(r.getPropertyValue(`padding-top`)),o=parseFloat(r.getPropertyValue(`border-bottom-width`))+parseFloat(r.getPropertyValue(`border-top-width`)),s={sizingStyle:D.map(e=>`${e}:${r.getPropertyValue(e)}`).join(`;`),paddingSize:a,borderSize:o,boxSizing:i};return t&&n&&(O[n]=s),s}function j(e,t=!1,n=null,r=null){k||(k=document.createElement(`textarea`),k.setAttribute(`tab-index`,`-1`),k.setAttribute(`aria-hidden`,`true`),k.setAttribute(`name`,`hiddenTextarea`),document.body.appendChild(k)),e.getAttribute(`wrap`)?k.setAttribute(`wrap`,e.getAttribute(`wrap`)):k.removeAttribute(`wrap`);let{paddingSize:i,borderSize:a,boxSizing:o,sizingStyle:s}=A(e,t);k.setAttribute(`style`,`${s};${E}`),k.value=e.value||e.placeholder||``;let c,l,u,d=k.scrollHeight;if(o===`border-box`?d+=a:o===`content-box`&&(d-=i),n!==null||r!==null){k.value=` `;let e=k.scrollHeight-i;n!==null&&(c=e*n,o===`border-box`&&(c=c+i+a),d=Math.max(c,d)),r!==null&&(l=e*r,o===`border-box`&&(l=l+i+a),u=d>l?void 0:`hidden`,d=Math.min(l,d))}let f={height:d,overflowY:u,resize:`none`};return c&&(f.minHeight=c),l&&(f.maxHeight=l),f}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{prefixCls:n,defaultValue:o,value:s,autoSize:u,onResize:d,className:p,style:m,disabled:h,onChange:g,onInternalAutoSize:_,...v}=e,[y,b]=l(o,s),x=y??``,S=e=>{b(e.target.value),g?.(e)},C=f.useRef(null);f.useImperativeHandle(t,()=>({textArea:C.current}));let[w,T]=f.useMemo(()=>u&&typeof u==`object`?[u.minRows,u.maxRows]:[],[u]),E=!!u,[D,O]=f.useState(F),[k,A]=f.useState(),I=()=>{O(N)};c(()=>{E&&I()},[s,w,T,E]),c(()=>{if(D===N)O(P);else if(D===P){let e=j(C.current,!1,w,T);O(F),A(e)}},[D]);let L=f.useRef(void 0),R=()=>{L.current!==void 0&&a.cancel(L.current)},z=e=>{D===F&&(d?.(e),u&&(R(),L.current=a(()=>{I()})))};f.useEffect(()=>R,[]);let B=E?k:null,V={...m,...B};return(D===N||D===P)&&(V.overflowY=`hidden`,V.overflowX=`hidden`),f.createElement(r,{onResize:z,disabled:!(u||d)},f.createElement(`textarea`,M({},v,{ref:C,style:V,className:i(n,p,{[`${n}-disabled`]:h}),disabled:h,value:x,onChange:S})))});function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let[F,R]=f.useState(!1),z=f.useRef(!1),[B,V]=f.useState(null),H=(0,f.useRef)(null),U=(0,f.useRef)(null),W=()=>U.current?.textArea||null,{setValue:G,formatValue:K}=C(e,t),q=b(m,p),{isOutOfRange:J,dataCount:Y}=x({countConfig:q,value:K,maxLength:s}),X=S({countConfig:q,getTarget:()=>U.current?.textArea||null}),Z=()=>{W()?.focus()};(0,f.useImperativeHandle)(P,()=>({resizableTextArea:U.current,focus:Z,blur:()=>{W()?.blur()},nativeElement:H.current?.nativeElement||W()})),(0,f.useEffect)(()=>{R(e=>!v&&e)},[v]);let Q=(e,t)=>{let n=X(t,z.current);G(n),_(e.currentTarget,e,a,n)},ee=e=>{z.current=!0,c?.(e)},te=e=>{z.current=!1,Q(e,e.currentTarget.value),l?.(e)},ne=e=>{Q(e,e.target.value)},re=e=>{e.key===`Enter`&&k&&!e.nativeEvent.isComposing&&k(e),M?.(e)},ie=e=>{R(!0),n?.(e)},ae=e=>{R(!1),r?.(e)},oe=e=>{G(``),Z();let t=W();t&&_(t,e,a)},$=u;q.show&&($=f.createElement(f.Fragment,null,$,f.createElement(`span`,{className:i(`${d}-data-count`,T?.count),style:E?.count},Y)));let se=e=>{D?.(e),W()?.style.height&&V(!0)},ce=!j&&!p&&!o;return f.createElement(y,{ref:H,value:K,allowClear:o,handleReset:oe,suffix:$,prefixCls:d,classNames:{...T,affixWrapper:i(T?.affixWrapper,{[`${d}-show-count`]:p,[`${d}-textarea-allow-clear`]:o})},disabled:v,focused:F,className:i(h,J&&`${d}-out-of-range`),style:{...g,...B&&!ce?{height:`auto`}:{}},dataAttrs:typeof Y==`string`?{affixWrapper:{"data-count":Y}}:void 0,styles:E,hidden:w,readOnly:A,onClear:O},f.createElement(I,L({},N,{autoSize:j,maxLength:s,onKeyDown:re,onChange:ne,onFocus:ie,onBlur:ae,onCompositionStart:ee,onCompositionEnd:te,className:i(T?.textarea),style:{resize:g?.resize,...E?.textarea},disabled:v,prefixCls:d,onResize:se,ref:U,readOnly:A})))}),z=T;export{R as n,p as r,z as t};