"use strict";function a(b){"@babel/helpers - typeof";return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.TestToolScopes=void 0;var b=h(require("react")),c=require("react-i18next"),d=require("carbon-components-react"),e=f(require("lodash/isEqual"));function f(a){return a&&a.__esModule?a:{default:a}}function g(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(g=function(a){return a?c:b})(a)}function h(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!==a(b)&&"function"!=typeof b)return{default:b};var d=g(c);if(d&&d.has(b))return d.get(b);var e={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in b)if("default"!=h&&Object.prototype.hasOwnProperty.call(b,h)){var i=f?Object.getOwnPropertyDescriptor(b,h):null;i&&(i.get||i.set)?Object.defineProperty(e,h,i):e[h]=b[h]}return e["default"]=b,d&&d.set(b,e),e}function i(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function j(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function k(a,b,c){return b&&j(a.prototype,b),c&&j(a,c),a}function l(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&m(a,b)}function m(a,b){return m=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},m(a,b)}function n(a){var b=q();return function(){var c,d=r(a);if(b){var e=r(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return o(this,c)}}function o(b,c){if(c&&("object"===a(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return p(b)}function p(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function q(){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(a){return!1}}function r(a){return r=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},r(a)}var s=function(a){function c(a){var b;return i(this,c),b=f.call(this,a),b.handleScopeChange=b.handleScopeChange.bind(p(b)),b.state={},b}l(c,a);var f=n(c);return k(c,[{key:"componentDidMount",value:function componentDidMount(){this.configure(this.props)}},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(a){(0,e["default"])(a,this.props)||this.configure(this.props)}},{key:"configure",value:function configure(a){if(a.scopes){for(var b={},c=0;c<a.scopes.length;c++)b[a.scopes[c]]=!1;this.setState(b),a.onChange&&"function"==typeof a.onChange&&a.onChange(b)}}},{key:"handleScopeChange",value:function handleScopeChange(a,b){var c=Object.assign(this.state);"undefined"!=typeof c[a]&&(c[a]=b),this.setState(c),this.props.onChange&&"function"==typeof this.props.onChange&&this.props.onChange(c)}},{key:"render",value:function render(){var a=this,c=this.props,e=c.t,f=c.scopes;return b["default"].createElement("div",{className:"scopesChooser"},b["default"].createElement("div",{className:"labelText"},e("explorer_scopes")),f.map(function(c){return b["default"].createElement(d.Checkbox,{key:c,labelText:c,id:c,checked:!!a.state[c]&&a.state[c],onChange:function onChange(b){return a.handleScopeChange(c,b)}})}))}}]),c}(b.Component);exports.TestToolScopes=s;var t=(0,c.withTranslation)()(s);exports["default"]=t;