import{__exports as e}from"../../../_virtual/Input.js";import t from"react";import{p as n}from"../../prop-types/index.js";import{c as r}from"../../classnames/index.js";import"./utils.js";import{__exports as o}from"../../../_virtual/utils.js";!function(e){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=s(t),u=s(n),f=s(r),l=o,c=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function s(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,n)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var O={children:u.default.node,type:u.default.string,size:u.default.oneOfType([u.default.number,u.default.string]),bsSize:u.default.string,valid:u.default.bool,invalid:u.default.bool,tag:l.tagPropType,innerRef:u.default.oneOfType([u.default.object,u.default.func,u.default.string]),plaintext:u.default.bool,addon:u.default.bool,className:u.default.string,cssModule:u.default.object},g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(i,e);var t,n,r,o=v(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).getRef=t.getRef.bind(m(t)),t.focus=t.focus.bind(m(t)),t}return t=i,(n=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.cssModule,r=e.type,o=e.bsSize,i=e.valid,u=e.invalid,s=e.tag,y=e.addon,b=e.plaintext,v=e.innerRef,m=d(e,c),h=["switch","radio","checkbox"].indexOf(r)>-1,O="select"===r,g="range"===r,j=s||(O||"textarea"===r?r:"input"),w="form-control";b?(w="".concat(w,"-plaintext"),j=s||"input"):g?w="form-range":O?w="form-select":h&&(w=y?null:"form-check-input"),m.size&&/\D/g.test(m.size)&&((0,l.warnOnce)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=m.size,delete m.size);var _=(0,l.mapToCssModules)((0,f.default)(t,u&&"is-invalid",i&&"is-valid",!!o&&(O?"form-select-".concat(o):"form-control-".concat(o)),w),n);return("input"===j||s&&"function"==typeof s)&&(m.type="switch"===r?"checkbox":r),m.children&&!b&&"select"!==r&&"string"==typeof j&&"select"!==j&&((0,l.warnOnce)('Input with a type of "'.concat(r,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete m.children),a.default.createElement(j,p({},m,{ref:v,className:_,"aria-invalid":u}))}}])&&y(t.prototype,n),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.default.Component);g.propTypes=O,g.defaultProps={type:"text"};var j=g;e.default=j}(e);
//# sourceMappingURL=Input.js.map
