-
Notifications
You must be signed in to change notification settings - Fork 31
/
32375.0ea096bd.iframe.bundle.js
1 lines (1 loc) · 50.8 KB
/
32375.0ea096bd.iframe.bundle.js
1
"use strict";(globalThis.webpackChunkmetamask_crx=globalThis.webpackChunkmetamask_crx||[]).push([[32375],{"./ui/components/ui/page-container/page-container-footer/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>PageContainerFooter});var react=__webpack_require__("./node_modules/react/index.js"),prop_types=__webpack_require__("./node_modules/prop-types/index.js"),prop_types_default=__webpack_require__.n(prop_types),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),ui_button=__webpack_require__("./ui/components/ui/button/index.js");function _assert_this_initialized(self){if(void 0===self)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _get_prototype_of(o){return(_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_set_prototype_of(subClass,superClass)}function _possible_constructor_return(self,call){return call&&("object"===_type_of(call)||"function"==typeof call)?call:_assert_this_initialized(self)}function _set_prototype_of(o,p){return(_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function _type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _create_super(Derived){var hasNativeReflectConstruct=_is_native_reflect_construct();return function _createSuperInternal(){var result,Super=_get_prototype_of(Derived);return result=hasNativeReflectConstruct?Reflect.construct(Super,arguments,_get_prototype_of(this).constructor):Super.apply(this,arguments),_possible_constructor_return(this,result)}}var PageContainerFooter=function(Component){_inherits(PageContainerFooter,Component);var _super=_create_super(PageContainerFooter);function PageContainerFooter(){return _class_call_check(this,PageContainerFooter),_super.apply(this,arguments)}return _create_class(PageContainerFooter,[{key:"render",value:function render(){var _this_props=this.props,children=_this_props.children,onCancel=_this_props.onCancel,cancelText=_this_props.cancelText,onSubmit=_this_props.onSubmit,submitText=_this_props.submitText,disabled=_this_props.disabled,submitButtonType=_this_props.submitButtonType,hideCancel=_this_props.hideCancel,cancelButtonType=_this_props.cancelButtonType,_this_props_buttonSizeLarge=_this_props.buttonSizeLarge,buttonSizeLarge=void 0!==_this_props_buttonSizeLarge&&_this_props_buttonSizeLarge,footerClassName=_this_props.footerClassName,footerButtonClassName=_this_props.footerButtonClassName;return react.createElement("div",{className:classnames_default()("page-container__footer",footerClassName)},react.createElement("footer",null,!hideCancel&&react.createElement(ui_button.A,{type:cancelButtonType||"secondary",large:buttonSizeLarge,className:classnames_default()("page-container__footer-button","page-container__footer-button__cancel",footerButtonClassName),onClick:function(e){return onCancel(e)},"data-testid":"page-container-footer-cancel"},cancelText||this.context.t("cancel")),react.createElement(ui_button.A,{type:submitButtonType||"primary",large:buttonSizeLarge,className:classnames_default()("page-container__footer-button",footerButtonClassName),disabled:disabled,onClick:function(e){return onSubmit(e)},"data-testid":"page-container-footer-next"},submitText||this.context.t("next"))),children&&react.createElement("div",{className:"page-container__footer-secondary"},children))}}]),PageContainerFooter}(react.Component);_define_property(PageContainerFooter,"propTypes",{children:prop_types_default().node,onCancel:prop_types_default().func,cancelText:prop_types_default().string,cancelButtonType:prop_types_default().string,onSubmit:prop_types_default().func,submitText:prop_types_default().string,disabled:prop_types_default().bool,submitButtonType:prop_types_default().string,hideCancel:prop_types_default().bool,buttonSizeLarge:prop_types_default().bool,footerClassName:prop_types_default().string,footerButtonClassName:prop_types_default().string}),_define_property(PageContainerFooter,"contextTypes",{t:prop_types_default().func}),PageContainerFooter.__docgenInfo={description:"",methods:[],displayName:"PageContainerFooter",props:{children:{description:"",type:{name:"node"},required:!1},onCancel:{description:"",type:{name:"func"},required:!1},cancelText:{description:"",type:{name:"string"},required:!1},cancelButtonType:{description:"",type:{name:"string"},required:!1},onSubmit:{description:"",type:{name:"func"},required:!1},submitText:{description:"",type:{name:"string"},required:!1},disabled:{description:"",type:{name:"bool"},required:!1},submitButtonType:{description:"",type:{name:"string"},required:!1},hideCancel:{description:"",type:{name:"bool"},required:!1},buttonSizeLarge:{description:"",type:{name:"bool"},required:!1},footerClassName:{description:"",type:{name:"string"},required:!1},footerButtonClassName:{description:"",type:{name:"string"},required:!1}},context:{t:{type:{name:"func"},required:!1}}}},"./ui/pages/settings/contact-list-tab/contact-list-tab.component.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>ContactListTab});var react=__webpack_require__("./node_modules/react/index.js"),prop_types=__webpack_require__("./node_modules/prop-types/index.js"),prop_types_default=__webpack_require__.n(prop_types),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),contact_list=__webpack_require__("./ui/components/app/contact-list/index.js"),routes=__webpack_require__("./ui/helpers/constants/routes.ts"),settings_search=__webpack_require__("./ui/helpers/utils/settings-search.js"),component_library=__webpack_require__("./ui/components/component-library/index.ts"),design_system=__webpack_require__("./ui/helpers/constants/design-system.ts"),redux=__webpack_require__("./node_modules/redux/es/redux.js"),es=__webpack_require__("./node_modules/react-redux/es/index.js"),react_router=__webpack_require__("./node_modules/react-router-dom/node_modules/react-router/esm/react-router.js"),selectors=__webpack_require__("./ui/selectors/index.js"),networks=__webpack_require__("./shared/modules/selectors/networks.ts"),actions=__webpack_require__("./ui/__mocks__/actions.js"),button_component=__webpack_require__("./ui/components/ui/button/button.component.js"),text_field=__webpack_require__("./ui/components/ui/text-field/index.js"),page_container_footer=__webpack_require__("./ui/components/ui/page-container/page-container-footer/index.js"),hexstring_utils=__webpack_require__("./shared/modules/hexstring-utils.ts"),utils=__webpack_require__("./ui/components/app/contact-list/utils.ts");function _assert_this_initialized(self){if(void 0===self)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _class_call_check(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _create_class(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _get_prototype_of(o){return(_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_set_prototype_of(subClass,superClass)}function _possible_constructor_return(self,call){return call&&("object"===_type_of(call)||"function"==typeof call)?call:_assert_this_initialized(self)}function _set_prototype_of(o,p){return(_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function _type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}function _is_native_reflect_construct(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _create_super(Derived){var hasNativeReflectConstruct=_is_native_reflect_construct();return function _createSuperInternal(){var result,Super=_get_prototype_of(Derived);return result=hasNativeReflectConstruct?Reflect.construct(Super,arguments,_get_prototype_of(this).constructor):Super.apply(this,arguments),_possible_constructor_return(this,result)}}function _ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}}var EditContact=function(PureComponent){_inherits(EditContact,PureComponent);var _super=_create_super(EditContact);function EditContact(){var _this;return _class_call_check(this,EditContact),_this=_super.apply(this,arguments),_define_property(_assert_this_initialized(_this),"state",{newName:_this.props.name,newAddress:_this.props.address,newMemo:_this.props.memo,nameError:"",addressError:""}),_define_property(_assert_this_initialized(_this),"validateName",function(newName){if(newName===_this.props.name)return!0;var _this_props=_this.props,addressBook=_this_props.addressBook,internalAccounts=_this_props.internalAccounts;return!(0,utils.WB)(addressBook,internalAccounts,newName)}),_define_property(_assert_this_initialized(_this),"handleNameChange",function(e){var newName=e.target.value,isValidName=_this.validateName(newName);_this.setState({nameError:isValidName?null:_this.context.t("nameAlreadyInUse")}),_this.setState({newName:newName})}),_this}return _create_class(EditContact,[{key:"render",value:function render(){var _this=this,t=this.context.t,_this_props=this.props,address=_this_props.address,addToAddressBook=_this_props.addToAddressBook,chainId=_this_props.chainId,history=_this_props.history,listRoute=_this_props.listRoute,memo=_this_props.memo,name=_this_props.name,removeFromAddressBook=_this_props.removeFromAddressBook,viewRoute=_this_props.viewRoute;if(!address)return react.createElement(react_router.rd,{to:{pathname:listRoute}});var _this1=this;return react.createElement("div",{className:"settings-page__content-row address-book__edit-contact"},react.createElement(component_library.az,{className:"settings-page__header address-book__header--edit",paddingLeft:6,paddingRight:6,width:design_system.Zf.Full,alignItems:design_system.k2.center},react.createElement(component_library.az,{display:design_system.nl.Flex,alignItems:design_system.k2.center,style:{overflow:"hidden"},paddingRight:2},react.createElement(component_library.vs,{size:component_library.oG.Lg,address:address}),react.createElement(component_library.EY,{className:"address-book__header__name",variant:design_system.J3.bodyLgMedium,marginInlineStart:4,style:{overflow:"hidden"},ellipsis:!0},name||address)),react.createElement(component_library.az,{className:"settings-page__address-book-button"},react.createElement(button_component.A,{type:"link",onClick:_async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,removeFromAddressBook(chainId,address)];case 1:return _state.sent(),history.push(listRoute),[2]}})}),style:{display:"contents"}},t("deleteContact")))),react.createElement("div",{className:"address-book__edit-contact__content"},react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label"},t("userName")),react.createElement(text_field.A,{type:"text",id:"nickname",placeholder:this.context.t("addAlias"),value:this.state.newName,onChange:this.handleNameChange,fullWidth:!0,margin:"dense",error:this.state.nameError})),react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label"},t("ethereumPublicAddress")),react.createElement(text_field.A,{type:"text",id:"address",value:this.state.newAddress,error:this.state.addressError,onChange:function(e){return _this.setState({newAddress:e.target.value})},fullWidth:!0,multiline:!0,rows:4,margin:"dense",classes:{inputMultiline:"address-book__view-contact__address__text-area",inputRoot:"address-book__view-contact__address"}})),react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label--capitalized"},t("memo")),react.createElement(text_field.A,{type:"text",id:"memo",placeholder:memo,value:this.state.newMemo,onChange:function(e){return _this.setState({newMemo:e.target.value})},fullWidth:!0,margin:"dense",multiline:!0,rows:3,classes:{inputMultiline:"address-book__view-contact__text-area",inputRoot:"address-book__view-contact__text-area-wrapper"}}))),react.createElement(page_container_footer.A,{cancelText:this.context.t("cancel"),onSubmit:_async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:if(!(""!==_this1.state.newAddress&&_this1.state.newAddress!==address))return[3,5];if(!(!(0,hexstring_utils.Ex)(_this1.state.newAddress)&&(0,hexstring_utils.Cv)(_this1.state.newAddress,{mixedCaseUseChecksum:!0})))return[3,3];return[4,removeFromAddressBook(chainId,address)];case 1:return _state.sent(),[4,addToAddressBook(_this1.state.newAddress,_this1.state.newName||name,_this1.state.newMemo||memo)];case 2:return _state.sent(),history.push(listRoute),[3,4];case 3:_this1.setState({addressError:_this1.context.t("invalidAddress")}),_state.label=4;case 4:return[3,7];case 5:return[4,addToAddressBook(address,_this1.state.newName||name,_this1.state.newMemo||memo)];case 6:_state.sent(),history.push(listRoute),_state.label=7;case 7:return[2]}})}),onCancel:function(){history.push("".concat(viewRoute,"/").concat(address))},submitText:this.context.t("save"),disabled:!!(this.state.newName===name&&this.state.newAddress===address&&this.state.newMemo===memo||!this.state.newName.trim()||this.state.nameError)}))}}]),EditContact}(react.PureComponent);_define_property(EditContact,"contextTypes",{t:prop_types_default().func}),_define_property(EditContact,"propTypes",{addressBook:prop_types_default().array,internalAccounts:prop_types_default().array,addToAddressBook:prop_types_default().func,removeFromAddressBook:prop_types_default().func,history:prop_types_default().object,name:prop_types_default().string,address:prop_types_default().string,chainId:prop_types_default().string,memo:prop_types_default().string,viewRoute:prop_types_default().string,listRoute:prop_types_default().string}),_define_property(EditContact,"defaultProps",{name:"",memo:""}),EditContact.__docgenInfo={description:"",methods:[{name:"validateName",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null},{name:"handleNameChange",docblock:null,modifiers:[],params:[{name:"e",optional:!1,type:null}],returns:null}],displayName:"EditContact",props:{name:{defaultValue:{value:"''",computed:!1},description:"",type:{name:"string"},required:!1},memo:{defaultValue:{value:"''",computed:!1},description:"",type:{name:"string"},required:!1},addressBook:{description:"",type:{name:"array"},required:!1},internalAccounts:{description:"",type:{name:"array"},required:!1},addToAddressBook:{description:"",type:{name:"func"},required:!1},removeFromAddressBook:{description:"",type:{name:"func"},required:!1},history:{description:"",type:{name:"object"},required:!1},address:{description:"",type:{name:"string"},required:!1},chainId:{description:"",type:{name:"string"},required:!1},viewRoute:{description:"",type:{name:"string"},required:!1},listRoute:{description:"",type:{name:"string"},required:!1}},context:{t:{type:{name:"func"},required:!1}}};let edit_contact_container=(0,redux.compose)(react_router.y,(0,es.Ng)(function(state,ownProps){var _getInternalAccountByAddress,pathNameTail=ownProps.location.pathname.match(RegExp("[^/]+$","u"))[0],address=pathNameTail.includes("0x")?pathNameTail.toLowerCase():ownProps.match.params.id,contact=(0,selectors.AF5)(state,address),memo=(contact||{}).memo,name=(null==contact?void 0:contact.name)||(null===(_getInternalAccountByAddress=(0,selectors.wV5)(state,address))||void 0===_getInternalAccountByAddress?void 0:_getInternalAccountByAddress.metadata.name),chainId=(0,networks.Iv)(state).chainId;return{address:contact?address:null,addressBook:(0,selectors.U$O)(state),internalAccounts:(0,selectors.atg)(state),chainId:chainId,name:name,memo:memo,viewRoute:routes.bI,listRoute:routes._3}},function(dispatch){return{addToAddressBook:function(recipient,nickname,memo){return dispatch((0,actions.addToAddressBook)(recipient,nickname,memo))},removeFromAddressBook:function(chainId,addressToRemove){return dispatch((0,actions.removeFromAddressBook)(chainId,addressToRemove))}}}))(EditContact);EditContact.__docgenInfo={description:"",methods:[{name:"validateName",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null},{name:"handleNameChange",docblock:null,modifiers:[],params:[{name:"e",optional:!1,type:null}],returns:null}],displayName:"EditContact",props:{name:{defaultValue:{value:"''",computed:!1},description:"",type:{name:"string"},required:!1},memo:{defaultValue:{value:"''",computed:!1},description:"",type:{name:"string"},required:!1},addressBook:{description:"",type:{name:"array"},required:!1},internalAccounts:{description:"",type:{name:"array"},required:!1},addToAddressBook:{description:"",type:{name:"func"},required:!1},removeFromAddressBook:{description:"",type:{name:"func"},required:!1},history:{description:"",type:{name:"object"},required:!1},address:{description:"",type:{name:"string"},required:!1},chainId:{description:"",type:{name:"string"},required:!1},viewRoute:{description:"",type:{name:"string"},required:!1},listRoute:{description:"",type:{name:"string"},required:!1}},context:{t:{type:{name:"func"},required:!1}}};var app=__webpack_require__("./ui/ducks/app/app.ts"),domains=__webpack_require__("./ui/ducks/domains.js"),lodash=__webpack_require__("./node_modules/lodash/lodash.js"),util=__webpack_require__("./ui/helpers/utils/util.js"),domain_input=__webpack_require__("./ui/pages/confirmations/send/send-content/add-recipient/domain-input.js"),send_constants=__webpack_require__("./ui/pages/confirmations/send/send.constants.js"),components=__webpack_require__("./ui/components/multichain/pages/send/components/index.ts");function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function add_contact_component_assert_this_initialized(self){if(void 0===self)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function add_contact_component_asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function add_contact_component_async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){add_contact_component_asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){add_contact_component_asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function add_contact_component_class_call_check(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function add_contact_component_defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function add_contact_component_create_class(Constructor,protoProps,staticProps){return protoProps&&add_contact_component_defineProperties(Constructor.prototype,protoProps),staticProps&&add_contact_component_defineProperties(Constructor,staticProps),Constructor}function add_contact_component_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function add_contact_component_get_prototype_of(o){return(add_contact_component_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function add_contact_component_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&add_contact_component_set_prototype_of(subClass,superClass)}function _iterable_to_array(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _non_iterable_spread(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function add_contact_component_possible_constructor_return(self,call){return call&&("object"===add_contact_component_type_of(call)||"function"==typeof call)?call:add_contact_component_assert_this_initialized(self)}function add_contact_component_set_prototype_of(o,p){return(add_contact_component_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function add_contact_component_type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}function _unsupported_iterable_to_array(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if("Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}}function add_contact_component_is_native_reflect_construct(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function add_contact_component_create_super(Derived){var hasNativeReflectConstruct=add_contact_component_is_native_reflect_construct();return function _createSuperInternal(){var result,Super=add_contact_component_get_prototype_of(Derived);return result=hasNativeReflectConstruct?Reflect.construct(Super,arguments,add_contact_component_get_prototype_of(this).constructor):Super.apply(this,arguments),add_contact_component_possible_constructor_return(this,result)}}function add_contact_component_ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}}var AddContact=function(PureComponent){add_contact_component_inherits(AddContact,PureComponent);var _super=add_contact_component_create_super(AddContact);function AddContact(props){var _this;return add_contact_component_class_call_check(this,AddContact),add_contact_component_define_property(add_contact_component_assert_this_initialized(_this=_super.call(this,props)),"state",{newName:"",selectedAddress:"",addressInputError:"",nameInputError:"",input:""}),add_contact_component_define_property(add_contact_component_assert_this_initialized(_this),"validate",function(input){var valid=!(0,hexstring_utils.Ex)(input)&&(0,hexstring_utils.Cv)(input,{mixedCaseUseChecksum:!0});(0,util.Es)(input)||valid?_this.setState({addressInputError:null}):_this.setState({addressInputError:send_constants._p})}),add_contact_component_define_property(add_contact_component_assert_this_initialized(_this),"onChange",function(input){_this.setState({input:input}),_this.dValidate(input)}),add_contact_component_define_property(add_contact_component_assert_this_initialized(_this),"validateName",function(newName){var _this_props=_this.props,addressBook=_this_props.addressBook,internalAccounts=_this_props.internalAccounts;return!(0,utils.WB)(addressBook,internalAccounts,newName)}),add_contact_component_define_property(add_contact_component_assert_this_initialized(_this),"handleNameChange",function(newName){var isValidName=_this.validateName(newName);_this.setState({nameInputError:isValidName?null:_this.context.t("nameAlreadyInUse")}),_this.setState({newName:newName})}),_this.dValidate=(0,lodash.debounce)(_this.validate,500),_this}return add_contact_component_create_class(AddContact,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(nextProps.qrCodeData&&"address"===nextProps.qrCodeData.type){var domainResolutions=this.props.domainResolutions,scannedAddress=nextProps.qrCodeData.values.address.toLowerCase();_to_consumable_array(domainResolutions.map(function(param){return param.resolvedAddress})).concat([this.state.ethAddress]).map(function(address){return address.toLowerCase()}).some(function(address){return address===scannedAddress})||(this.setState({input:scannedAddress}),this.validate(scannedAddress),this.props.qrCodeDetected(null))}}},{key:"renderInput",value:function renderInput(){var _this=this;return react.createElement(domain_input.A,{scanQrCode:function(_){_this.props.scanQrCode()},onChange:this.onChange,onPaste:function(input){_this.setState({input:input}),_this.validate(input)},onReset:function(){_this.props.resetDomainResolution(),_this.setState({input:"",selectedAddress:""})},userInput:this.state.selectedAddress||this.state.input})}},{key:"render",value:function render(){var _this=this,t=this.context.t,_this_props=this.props,history=_this_props.history,addToAddressBook=_this_props.addToAddressBook,domainError=_this_props.domainError,domainResolutions=_this_props.domainResolutions,addressError=domainError||this.state.addressInputError,newAddress=this.state.selectedAddress||this.state.input,validAddress=!(0,hexstring_utils.Ex)(newAddress)&&(0,hexstring_utils.Cv)(newAddress,{mixedCaseUseChecksum:!0}),_this1=this;return react.createElement("div",{className:"settings-page__content-row address-book__add-contact"},react.createElement("div",{className:"address-book__add-contact__content"},react.createElement("div",{className:"address-book__view-contact__group address-book__add-contact__content__username"},react.createElement("div",{className:"address-book__view-contact__group__label"},t("userName")),react.createElement(text_field.A,{type:"text",id:"nickname",placeholder:this.context.t("addAlias"),value:this.state.newName,onChange:function(e){return _this.handleNameChange(e.target.value)},fullWidth:!0,margin:"dense",error:this.state.nameInputError})),react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label"},t("ethereumPublicAddress")),this.renderInput(),react.createElement("div",{className:"address-book__view-contact__group__".concat((null==domainResolutions?void 0:domainResolutions.length)===1?"single-":"","resolution-list")},null==domainResolutions?void 0:domainResolutions.map(function(resolution){var resolvedAddress=resolution.resolvedAddress,resolvingSnap=resolution.resolvingSnap,addressBookEntryName=resolution.addressBookEntryName,protocol=resolution.protocol,domainName=resolution.domainName;return react.createElement(components.lE,{key:"".concat(resolvedAddress).concat(resolvingSnap).concat(protocol),address:resolvedAddress,domainName:null!=addressBookEntryName?addressBookEntryName:domainName,onClick:function(){_this.handleNameChange(domainName),_this.setState({input:resolvedAddress}),_this.props.resetDomainResolution()},protocol:protocol,resolvingSnap:resolvingSnap})})),addressError&&react.createElement("div",{className:"address-book__add-contact__error"},t(addressError)))),react.createElement(page_container_footer.A,{cancelText:this.context.t("cancel"),disabled:!!(this.state.addressInputError||this.state.nameInputError||!validAddress||!this.state.newName.trim()),onSubmit:add_contact_component_async_to_generator(function(){return add_contact_component_ts_generator(this,function(_state){switch(_state.label){case 0:return[4,addToAddressBook(newAddress,_this1.state.newName)];case 1:return _state.sent(),history.push(routes._3),[2]}})}),onCancel:function(){history.push(routes._3)},submitText:this.context.t("save")}))}}]),AddContact}(react.PureComponent);add_contact_component_define_property(AddContact,"contextTypes",{t:prop_types_default().func}),add_contact_component_define_property(AddContact,"propTypes",{addressBook:prop_types_default().array,internalAccounts:prop_types_default().array,addToAddressBook:prop_types_default().func,history:prop_types_default().object,scanQrCode:prop_types_default().func,qrCodeData:prop_types_default().object,qrCodeDetected:prop_types_default().func,domainResolutions:prop_types_default().arrayOf(prop_types_default().object),domainError:prop_types_default().string,resetDomainResolution:prop_types_default().func}),AddContact.__docgenInfo={description:"",methods:[{name:"validate",docblock:null,modifiers:[],params:[{name:"input",optional:!1,type:null}],returns:null},{name:"onChange",docblock:null,modifiers:[],params:[{name:"input",optional:!1,type:null}],returns:null},{name:"renderInput",docblock:null,modifiers:[],params:[],returns:null},{name:"validateName",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null},{name:"handleNameChange",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null}],displayName:"AddContact",props:{addressBook:{description:"",type:{name:"array"},required:!1},internalAccounts:{description:"",type:{name:"array"},required:!1},addToAddressBook:{description:"",type:{name:"func"},required:!1},history:{description:"",type:{name:"object"},required:!1},scanQrCode:{description:"",type:{name:"func"},required:!1},qrCodeData:{description:"",type:{name:"object"},required:!1},qrCodeDetected:{description:"",type:{name:"func"},required:!1},domainResolutions:{description:"",type:{name:"arrayOf",value:{name:"object"}},required:!1},domainError:{description:"",type:{name:"string"},required:!1},resetDomainResolution:{description:"",type:{name:"func"},required:!1}},context:{t:{type:{name:"func"},required:!1}}};let add_contact_container=(0,redux.compose)(react_router.y,(0,es.Ng)(function(state){return{addressBook:(0,selectors.U$O)(state),internalAccounts:(0,selectors.atg)(state),qrCodeData:(0,app.nB)(state),domainError:(0,domains.fw)(state),domainResolutions:(0,domains.oE)(state)}},function(dispatch){return{addToAddressBook:function(recipient,nickname){return dispatch((0,actions.addToAddressBook)(recipient,nickname))},scanQrCode:function(){return dispatch((0,actions.showQrScanner)())},qrCodeDetected:function(data){return dispatch((0,actions.qrCodeDetected)(data))},resetDomainResolution:function(){return dispatch((0,domains.Ae)())}}}))(AddContact);AddContact.__docgenInfo={description:"",methods:[{name:"validate",docblock:null,modifiers:[],params:[{name:"input",optional:!1,type:null}],returns:null},{name:"onChange",docblock:null,modifiers:[],params:[{name:"input",optional:!1,type:null}],returns:null},{name:"renderInput",docblock:null,modifiers:[],params:[],returns:null},{name:"validateName",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null},{name:"handleNameChange",docblock:null,modifiers:[],params:[{name:"newName",optional:!1,type:null}],returns:null}],displayName:"AddContact",props:{addressBook:{description:"",type:{name:"array"},required:!1},internalAccounts:{description:"",type:{name:"array"},required:!1},addToAddressBook:{description:"",type:{name:"func"},required:!1},history:{description:"",type:{name:"object"},required:!1},scanQrCode:{description:"",type:{name:"func"},required:!1},qrCodeData:{description:"",type:{name:"object"},required:!1},qrCodeDetected:{description:"",type:{name:"func"},required:!1},domainResolutions:{description:"",type:{name:"arrayOf",value:{name:"object"}},required:!1},domainError:{description:"",type:{name:"string"},required:!1},resetDomainResolution:{description:"",type:{name:"func"},required:!1}},context:{t:{type:{name:"func"},required:!1}}};var tooltip=__webpack_require__("./ui/components/ui/tooltip/index.js"),useI18nContext=__webpack_require__("./ui/hooks/useI18nContext.js"),useCopyToClipboard=__webpack_require__("./ui/hooks/useCopyToClipboard.js");function view_contact_component_array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes(arr){if(Array.isArray(arr))return arr}function _iterable_to_array_limit(arr,i){var _s,_e,_i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(arr,i){return _array_with_holes(arr)||_iterable_to_array_limit(arr,i)||view_contact_component_unsupported_iterable_to_array(arr,i)||_non_iterable_rest()}function view_contact_component_unsupported_iterable_to_array(o,minLen){if(o){if("string"==typeof o)return view_contact_component_array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if("Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return view_contact_component_array_like_to_array(o,minLen)}}function quadSplit(address){return"0x".concat(address.slice(2).match(RegExp(".{1,4}","gu")).join(""))}function ViewContact(param){var history=param.history,name=param.name,address=param.address,checkSummedAddress=param.checkSummedAddress,memo=param.memo,editRoute=param.editRoute,listRoute=param.listRoute,t=(0,useI18nContext.P)(),_useCopyToClipboard=_sliced_to_array((0,useCopyToClipboard.C)(),2),copied=_useCopyToClipboard[0],handleCopy=_useCopyToClipboard[1];return address?react.createElement("div",{className:"settings-page__content-row"},react.createElement("div",{className:"settings-page__content-item"},react.createElement(component_library.az,{className:"settings-page__header address-book__header",paddingLeft:6,paddingRight:6},react.createElement(component_library.vs,{size:component_library.oG.Lg,address:address}),react.createElement(component_library.EY,{className:"address-book__header__name",variant:design_system.J3.bodyLgMedium,marginInlineStart:4,style:{overflow:"hidden"},ellipsis:!0},name||address)),react.createElement("div",{className:"address-book__view-contact__group"},react.createElement(button_component.A,{type:"secondary",onClick:function(){history.push("".concat(editRoute,"/").concat(address))}},t("edit"))),react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label"},t("ethereumPublicAddress")),react.createElement("div",{className:"address-book__view-contact__group__value"},react.createElement("div",{className:"address-book__view-contact__group__static-address"},quadSplit(checkSummedAddress)),react.createElement(tooltip.A,{position:"bottom",title:t(copied?"copiedExclamation":"copyToClipboard")},react.createElement(component_library.a2,{ariaLabel:"copy",className:"address-book__view-contact__group__static-address--copy-icon",onClick:function(){handleCopy(checkSummedAddress)},iconName:copied?component_library.$M.CopySuccess:component_library.$M.Copy,size:component_library.f3.Lg,color:design_system.Li.primaryDefault})))),memo.length>0?react.createElement("div",{className:"address-book__view-contact__group"},react.createElement("div",{className:"address-book__view-contact__group__label--capitalized"},t("memo")),react.createElement("div",{className:"address-book__view-contact__group__static-address"},memo)):null)):react.createElement(react_router.rd,{to:{pathname:listRoute}})}ViewContact.propTypes={name:prop_types_default().string,address:prop_types_default().string,history:prop_types_default().object,checkSummedAddress:prop_types_default().string,memo:prop_types_default().string,editRoute:prop_types_default().string,listRoute:prop_types_default().string.isRequired};let view_contact_component=react.memo(ViewContact);ViewContact.__docgenInfo={description:"",methods:[],displayName:"ViewContact",props:{name:{description:"",type:{name:"string"},required:!1},address:{description:"",type:{name:"string"},required:!1},history:{description:"",type:{name:"object"},required:!1},checkSummedAddress:{description:"",type:{name:"string"},required:!1},memo:{description:"",type:{name:"string"},required:!1},editRoute:{description:"",type:{name:"string"},required:!1},listRoute:{description:"",type:{name:"string"},required:!0}}};let view_contact_container=(0,redux.compose)(react_router.y,(0,es.Ng)(function(state,ownProps){var pathNameTail=ownProps.location.pathname.match(RegExp("[^/]+$","u"))[0],address=pathNameTail.includes("0x")?pathNameTail.toLowerCase():ownProps.match.params.id,internalAccount=(0,selectors.wV5)(state,address),contact=(0,selectors.AF5)(state,address),memo=(contact||{}).memo;return{name:(null==contact?void 0:contact.name)||internalAccount.metadata.name,address:contact?address:null,checkSummedAddress:(0,hexstring_utils.sX)(address),memo:memo,editRoute:routes.WJ,listRoute:routes._3}}))(view_contact_component);function contact_list_tab_component_assert_this_initialized(self){if(void 0===self)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function contact_list_tab_component_class_call_check(instance,Constructor){if(!(instance instanceof Constructor))throw TypeError("Cannot call a class as a function")}function contact_list_tab_component_defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function contact_list_tab_component_create_class(Constructor,protoProps,staticProps){return protoProps&&contact_list_tab_component_defineProperties(Constructor.prototype,protoProps),staticProps&&contact_list_tab_component_defineProperties(Constructor,staticProps),Constructor}function contact_list_tab_component_define_property(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function contact_list_tab_component_get_prototype_of(o){return(contact_list_tab_component_get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function contact_list_tab_component_inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&contact_list_tab_component_set_prototype_of(subClass,superClass)}function contact_list_tab_component_possible_constructor_return(self,call){return call&&("object"===contact_list_tab_component_type_of(call)||"function"==typeof call)?call:contact_list_tab_component_assert_this_initialized(self)}function contact_list_tab_component_set_prototype_of(o,p){return(contact_list_tab_component_set_prototype_of=Object.setPrototypeOf||function setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function contact_list_tab_component_type_of(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj}function contact_list_tab_component_is_native_reflect_construct(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function contact_list_tab_component_create_super(Derived){var hasNativeReflectConstruct=contact_list_tab_component_is_native_reflect_construct();return function _createSuperInternal(){var result,Super=contact_list_tab_component_get_prototype_of(Derived);return result=hasNativeReflectConstruct?Reflect.construct(Super,arguments,contact_list_tab_component_get_prototype_of(this).constructor):Super.apply(this,arguments),contact_list_tab_component_possible_constructor_return(this,result)}}view_contact_component.__docgenInfo={description:"",methods:[],displayName:"ViewContact",props:{name:{description:"",type:{name:"string"},required:!1},address:{description:"",type:{name:"string"},required:!1},history:{description:"",type:{name:"object"},required:!1},checkSummedAddress:{description:"",type:{name:"string"},required:!1},memo:{description:"",type:{name:"string"},required:!1},editRoute:{description:"",type:{name:"string"},required:!1},listRoute:{description:"",type:{name:"string"},required:!0}}};var ContactListTab=function(Component){contact_list_tab_component_inherits(ContactListTab,Component);var _super=contact_list_tab_component_create_super(ContactListTab);function ContactListTab(){var _this;return contact_list_tab_component_class_call_check(this,ContactListTab),_this=_super.apply(this,arguments),contact_list_tab_component_define_property(contact_list_tab_component_assert_this_initialized(_this),"settingsRefs",Array((0,settings_search.FF)(_this.context.t,_this.context.t("contacts"))).fill(void 0).map(function(){return react.createRef()})),_this}return contact_list_tab_component_create_class(ContactListTab,[{key:"componentDidUpdate",value:function componentDidUpdate(){var t=this.context.t;(0,settings_search.K8)(t,t("contacts"),this.settingsRefs)}},{key:"componentDidMount",value:function componentDidMount(){var t=this.context.t;(0,settings_search.K8)(t,t("contacts"),this.settingsRefs)}},{key:"renderAddresses",value:function renderAddresses(){var _this_props=this.props,addressBook=_this_props.addressBook,internalAccounts=_this_props.internalAccounts,history=_this_props.history,selectedAddress=_this_props.selectedAddress,contacts=addressBook.filter(function(param){return!!param.name}),nonContacts=addressBook.filter(function(param){return!param.name}),t=this.context.t;return addressBook.length?react.createElement("div",null,react.createElement(contact_list.A,{addressBook:addressBook,internalAccounts:internalAccounts,searchForContacts:function(){return contacts},searchForRecents:function(){return nonContacts},selectRecipient:function(address){history.push("".concat(routes.bI,"/").concat(address))},selectedAddress:selectedAddress})):react.createElement("div",{className:"address-book__container"},react.createElement("div",null,react.createElement(component_library.In,{name:component_library.$M.Book,color:design_system.Li.iconMuted,className:"address-book__icon",size:component_library.lK.Xl}),react.createElement("h4",{className:"address-book__title"},t("buildContactList")),react.createElement("p",{className:"address-book__sub-title"},t("addFriendsAndAddresses")),react.createElement("button",{className:"address-book__link",onClick:function(){history.push(routes.Ni)}},"+ ",t("addContact"))))}},{key:"renderAddButton",value:function renderAddButton(){var _this_props=this.props,history=_this_props.history,viewingContact=_this_props.viewingContact,editingContact=_this_props.editingContact;return react.createElement(component_library.$$,{className:classnames_default()("address-book-add-button__button",{"address-book-add-button__button--hidden":viewingContact||editingContact}),onClick:function(){history.push(routes.Ni)},margin:4,size:design_system.or.LG},this.context.t("addContact"))}},{key:"renderContactContent",value:function renderContactContent(){var _this_props=this.props,viewingContact=_this_props.viewingContact,editingContact=_this_props.editingContact,addingContact=_this_props.addingContact,ContactContentComponent=null;return viewingContact?ContactContentComponent=view_contact_container:editingContact?ContactContentComponent=edit_contact_container:addingContact&&(ContactContentComponent=add_contact_container),ContactContentComponent&&react.createElement("div",{className:"address-book-contact-content"},react.createElement(ContactContentComponent,null))}},{key:"renderAddressBookContent",value:function renderAddressBookContent(){return this.props.hideAddressBook?null:react.createElement("div",{ref:this.settingsRefs[0],className:"address-book"},this.renderAddresses())}},{key:"render",value:function render(){var _this_props=this.props,addingContact=_this_props.addingContact,addressBook=_this_props.addressBook,currentPath=_this_props.currentPath;return react.createElement("div",{className:"address-book-wrapper"},this.renderAddressBookContent(),this.renderContactContent(),currentPath===routes._3&&!addingContact&&addressBook.length>0?this.renderAddButton():null)}}]),ContactListTab}(react.Component);contact_list_tab_component_define_property(ContactListTab,"contextTypes",{t:prop_types_default().func}),contact_list_tab_component_define_property(ContactListTab,"propTypes",{addressBook:prop_types_default().array,internalAccounts:prop_types_default().array,history:prop_types_default().object,selectedAddress:prop_types_default().string,viewingContact:prop_types_default().bool,editingContact:prop_types_default().bool,addingContact:prop_types_default().bool,hideAddressBook:prop_types_default().bool,currentPath:prop_types_default().string}),ContactListTab.__docgenInfo={description:"",methods:[{name:"renderAddresses",docblock:null,modifiers:[],params:[],returns:null},{name:"renderAddButton",docblock:null,modifiers:[],params:[],returns:null},{name:"renderContactContent",docblock:null,modifiers:[],params:[],returns:null},{name:"renderAddressBookContent",docblock:null,modifiers:[],params:[],returns:null}],displayName:"ContactListTab",props:{addressBook:{description:"",type:{name:"array"},required:!1},internalAccounts:{description:"",type:{name:"array"},required:!1},history:{description:"",type:{name:"object"},required:!1},selectedAddress:{description:"",type:{name:"string"},required:!1},viewingContact:{description:"",type:{name:"bool"},required:!1},editingContact:{description:"",type:{name:"bool"},required:!1},addingContact:{description:"",type:{name:"bool"},required:!1},hideAddressBook:{description:"",type:{name:"bool"},required:!1},currentPath:{description:"",type:{name:"string"},required:!1}},context:{t:{type:{name:"func"},required:!1}}}}}]);