this.primereact=this.primereact||{},this.primereact.chips=function(t,e,n,r){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=o(e);function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&this.removeItem(t,n.length-1);break;case 13:e&&e.trim().length&&(!this.props.max||this.props.max>n.length)&&this.addItem(t,e,!0);break;default:this.isMaxedOut()?t.preventDefault():this.props.separator&&","===this.props.separator&&188===t.which&&this.addItem(t,e,!0)}}},{key:"updateInput",value:function(t,e,n){this.props.onChange&&this.props.onChange({originalEvent:t,value:e,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e}}),this.inputRef.current.value="",n&&t.preventDefault()}},{key:"onPaste",value:function(t){var e=this;if(this.props.separator){var n=(t.clipboardData||window.clipboardData).getData("Text");if(n){var r=this.props.value||[],o=n.split(this.props.separator);o=o.filter((function(t){return(e.props.allowDuplicate||-1===r.indexOf(t))&&t.trim().length})),r=[].concat(c(r),c(o)),this.updateInput(t,r,!0)}}}},{key:"onFocus",value:function(t){var e=this;t.persist(),this.setState({focused:!0},(function(){e.props.onFocus&&e.props.onFocus(t)}))}},{key:"onBlur",value:function(t){var e=this;t.persist(),this.setState({focused:!1},(function(){e.props.onBlur&&e.props.onBlur(t)}))}},{key:"isMaxedOut",value:function(){return this.props.max&&this.props.value&&this.props.max===this.props.value.length}},{key:"isFilled",value:function(){return this.props.value&&this.props.value.length||this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length}},{key:"isRemovable",value:function(t,e){return n.ObjectUtils.getPropValue(this.props.removable,{value:t,index:e,props:this.props})}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){var e=this.props.value&&t.value&&t.value.length===this.props.value.length;this.props.tooltip&&(t.tooltip!==this.props.tooltip||t.tooltipOptions!==this.props.tooltipOptions?this.tooltip?this.tooltip.update(k({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip():!e&&this.tooltip&&(this.tooltip.deactivate(),this.tooltip.activate()))}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=r.tip({target:this.inputRef.current,targetContainer:this.listElement,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderRemoveIcon",value:function(t,e){var n=this;return this.props.disabled||this.props.readOnly||!this.isRemovable(t,e)?null:i.default.createElement("span",{className:"p-chips-token-icon pi pi-times-circle",onClick:function(t){return n.removeItem(t,e)}})}},{key:"renderItem",value:function(t,e){var n=this.props.itemTemplate?this.props.itemTemplate(t):t,r=this.renderRemoveIcon(t,e);return i.default.createElement("li",{key:e,className:"p-chips-token p-highlight"},i.default.createElement("span",{className:"p-chips-token-label"},n),r)}},{key:"renderInputElement",value:function(){return i.default.createElement("li",{className:"p-chips-input-token"},i.default.createElement("input",{ref:this.inputRef,placeholder:this.props.placeholder,type:"text",name:this.props.name,disabled:this.props.disabled||this.isMaxedOut(),onKeyDown:this.onKeyDown,onPaste:this.onPaste,onFocus:this.onFocus,onBlur:this.onBlur,"aria-labelledby":this.props.ariaLabelledBy,readOnly:this.props.readOnly}))}},{key:"renderItems",value:function(){var t=this;return this.props.value?this.props.value.map((function(e,n){return t.renderItem(e,n)})):null}},{key:"renderList",value:function(){var t=this,e=n.classNames("p-inputtext p-chips-multiple-container",{"p-disabled":this.props.disabled,"p-focus":this.state.focused}),r=this.renderItems(),o=this.renderInputElement();return i.default.createElement("ul",{ref:function(e){return t.listElement=e},className:e,onClick:this.onWrapperClick},r,o)}},{key:"render",value:function(){var t=this,e=n.classNames("p-chips p-component p-inputwrapper",this.props.className,{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused}),r=this.renderList();return i.default.createElement("div",{ref:function(e){return t.element=e},id:this.props.id,className:e,style:this.props.style},r)}}])&&h(s.prototype,l),a&&h(s,a),Object.defineProperty(s,"prototype",{writable:!1}),v}(e.Component);return O(j,"defaultProps",{id:null,inputRef:null,name:null,placeholder:null,value:null,max:null,disabled:null,readOnly:!1,removable:!0,style:null,className:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,separator:null,allowDuplicate:!0,itemTemplate:null,onAdd:null,onRemove:null,onChange:null,onFocus:null,onBlur:null}),t.Chips=j,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.tooltip);