import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{jsxs as n,Fragment as r,jsx as o}from"react/jsx-runtime";import{useCallback as i,useMemo as u}from"react";import s from"classnames";import{TextInputNext as l}from"../../TextInputNext/TextInputNext.js";import{TextInput as p}from"../../TextInput/TextInput.js";import a from"../Autocomplete.scss.js";var f=["inputProps","disabled","InputProps","prefix","loading","status","isNext"];function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?c(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var d=function(e){var c=e.inputProps,d=e.disabled,b=e.InputProps,x=e.prefix,O=e.loading,j=e.status,P=e.isNext,g=t(e,f),v=g.label,y=g.size,h=g.labelPlacement,C=g.elementsClassNames,w=g.readOnly,I=g.placeholder,N=c.onChange,A=c.onBlur,D=c.onFocus,T=c.onMouseDown,B=c.ref,E=c.value,F=i((function(e,t,n){null==N||N(n,e)}),[N]),R=i((function(e,t){null==N||N(t,e)}),[N]),S=i((function(e){if(D(e),T(e),w){var t=e.target;t.selectionStart=t.selectionEnd}}),[D,T,w]),z=(x||b.startAdornment)&&n(r,{children:[x,b.startAdornment]}),k=u((function(){return m(m({},C),{},{input:s(a.input,null==C?void 0:C.input,w&&a.readOnlyInput),prefix:s(a.prefix,null==C?void 0:C.prefix),suffix:s(a.suffix,null==C?void 0:C.suffix),inputContainer:s(a.inputContainer,null==C?void 0:C.inputContainer)})}),[C,w]);return P?o(l,{disabled:d,prefix:z,suffix:b.endAdornment,onBlur:A,onChange:F,onFocus:S,inputRef:B,value:E,inputContainerRef:b.ref,status:O?"loading":j,label:v,size:y,labelPlacement:h,elementsClassNames:k,readOnly:w,placeholder:I}):o(p,m({disabled:d,prefix:z,suffix:b.endAdornment,onBlur:A,onChange:R,onFocus:S,inputRef:B,value:E,ref:b.ref,status:O?"loading":j},g))};export{d as AutocompleteInput};
//# sourceMappingURL=AutocompleteInput.js.map
