/*! For license information please see dll.KeyControls.js.LICENSE.txt */
(window.webpackJsonp_name_hash_=window.webpackJsonp_name_hash_||[]).push([[49],{1004:function(e,n,t){"use strict";t.r(n);var o=t(13),r=t.n(o),c=t(12),a=t.n(c),i=t(7),s=t.n(i),u=t(14),p=t.n(u),f=t(15),d=t.n(f),v=t(8),l=t.n(v),y=t(5),m=t.n(y),h=t(0),g=t(29),k=t.n(g),w=t(1),D=t.n(w),E=t(23),L=t.n(E),K=t(84),R=t.n(K),_=t(134),b=t.n(_),j=t(19);function C(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,o=l()(e);if(n){var r=l()(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return d()(this,t)}}var O=L()("isle:key-controls"),P=function(e){p()(t,e);var n=C(t);function t(e){var o;return r()(this,t),o=n.call(this,e),m()(s()(o),"addListeners",(function(){var e=R()(o.props.actions);if(O("Add keydown event listeners for ".concat(o.props.container?"container":"document",": ").concat(e.join(", "))),o.props.container)try{k.a.findDOMNode(o.props.container).addEventListener("keydown",o.triggerEvent)}catch(e){O(e.message)}else document.addEventListener("keydown",o.triggerDocEvent)})),m()(s()(o),"removeListeners",(function(e){var n=R()(o.props.actions);if(O("Remove keydown event listeners for ".concat(e?"container":"document",": ").concat(n.join(", "))),e)try{k.a.findDOMNode(e).removeEventListener("keydown",o.triggerEvent)}catch(e){O(e.message)}document.removeEventListener("keydown",o.triggerDocEvent)})),m()(s()(o),"triggerEvent",(function(e){var n=e.key;O("Received key press for container: ".concat(n));var t=o.props.actions[n],r=e.ctrlKey||e.shiftKey||e.altKey||e.metaKey;document.activeElement===o.props.container&&!r&&b()(t)&&(e.preventDefault(),e.stopPropagation(),t(e))})),m()(s()(o),"triggerDocEvent",(function(e){var n=e.key,t=e.ctrlKey||e.shiftKey||e.altKey||e.metaKey;O("Received key press for document: ".concat(n));var r=o.props.actions[n];!t&&b()(r)&&(e.preventDefault(),e.stopPropagation(),r(e))})),o}return a()(t,[{key:"componentDidMount",value:function(){O("Component has mounted..."),this.addListeners()}},{key:"componentDidUpdate",value:function(e){this.props.container!==e.container&&(O("Container has changed, re-attach event listeners..."),this.removeListeners(e.container),this.addListeners())}},{key:"componentWillUnmount",value:function(){O("Component has unmounted..."),this.removeListeners()}},{key:"render",value:function(){return null}}]),t}(h.Component);P.defaultProps={actions:{},container:null},P.propTypes={actions:D.a.objectOf(D.a.func),container:D.a.oneOfType([D.a.object,D.a.element])},P.contextType=j.default,n.default=P}}]);