"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),r=require("primereact/keyfilter"),o=require("primereact/tooltip");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(t);function l(){return l=Object.assign||function(t){for(var e=1;e0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&null!=this.elementRef.current.value&&this.elementRef.current.value.toString().length>0}},{key:"onKeyPress",value:function(t){this.props.onKeyPress&&this.props.onKeyPress(t),this.props.keyfilter&&r.KeyFilter.onKeyPress(t,this.props.keyfilter,this.props.validateOnly)}},{key:"onInput",value:function(t){var o=!0;this.props.keyfilter&&this.props.validateOnly&&(o=r.KeyFilter.validate(t,this.props.keyfilter)),this.props.onInput&&this.props.onInput(t,o),this.props.onChange||(t.target.value.length>0?e.DomHandler.addClass(t.target,"p-filled"):e.DomHandler.removeClass(t.target,"p-filled"))}},{key:"updateForwardRef",value:function(){var t=this.props.forwardRef;t&&("function"==typeof t?t(this.elementRef.current):t.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(v({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=e.classNames("p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled()},this.props.className),r=e.ObjectUtils.findDiffKeys(this.props,g.defaultProps);return i.default.createElement("input",l({ref:this.elementRef},r,{className:t,onInput:this.onInput,onKeyPress:this.onKeyPress}))}}])&&s(d.prototype,b),m&&s(d,m),Object.defineProperty(d,"prototype",{writable:!1}),g}();d(m,"defaultProps",{keyfilter:null,validateOnly:!1,tooltip:null,tooltipOptions:null,onInput:null,onKeyPress:null,forwardRef:null}),exports.InputText=i.default.forwardRef((function(t,e){return i.default.createElement(m,l({forwardRef:e},t))}));