define(["require","exports","tslib","react","prop-types","comments2/components/sticker_component/sticker_button","comments2/components/sticker_component/stickers"],(function(e,t,n,o,i,c,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),o=n.__importStar(o),i=n.__importStar(i);var s=(function(e){function t(){var t=e.apply(this,arguments)||this;return t.ref=o.createRef(),t.state={popoverVisible:!1},t.onStickerSelected=function(e,n,o){t.setState({popoverVisible:!1}),t.props.onStickerSelected(e,n,o)},t.handleButtonClicked=function(){t.setState({popoverVisible:!t.state.popoverVisible})},t.handleDocumentEvt=function(e){var n=t.ref.current,o=e.target;t.state.popoverVisible&&n&&!n.contains(o)&&t.setState({popoverVisible:!1})},t}return n.__extends(t,e),Object.defineProperty(t.prototype,"intl",{get:function(){return this.context.localization.intl},enumerable:!0,configurable:!0}),t.prototype.componentDidMount=function(){document.addEventListener("click",this.handleDocumentEvt),document.addEventListener("focusin",this.handleDocumentEvt)},t.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentEvt),document.removeEventListener("focusin",this.handleDocumentEvt)},t.prototype.render=function(){var e=this.state.popoverVisible,t=this.props.stickerPacks;return t.length>0?o.createElement("div",{className:"sc-sticker-component",ref:this.ref},o.createElement(c.StickerButton,{label:this.intl.formatMessage({id:"UaYQ_",defaultMessage:"Sticker menu"}),isActive:e,onClick:this.handleButtonClicked}),e?o.createElement(r.Stickers,{stickerPacks:t,onStickerSelected:this.onStickerSelected}):null):null},t})(o.Component);t.StickerComponent=s,s.contextTypes={localization:i.object}})); //# sourceMappingURL=sticker_component.min.js-vfly0Aqpy.map