text: ;!function(require, directRequire){;"use strict";const tslib_1=require("tslib"),React=require("react"),classNames=require("classnames"),tools=require('./d3976cc01aeebc5b09e11c4135b6bd8d.js'),userActions=require('./9c906d27ca74e18d0deaaa231e71fdfa.js'),windowActions=require('./a8c87029da0fa06e986298d447ab0fe2.js'),Animation=require('./875171e7b864aa58d026d4fa0999fbd1.js'),C=require('./56c390e04c10e91a4aa2a2c19d9a885d.js'),IndependentPopupWindow=require('./eb1fe4da47d7ed10884f8b039b058c5b.js'),locales=require('./common/locales/index.js'),{connect}=require("react-redux"),mapStateToProps=(a)=>{const b=a.user||{};let c=b.accountMap||{};return c[b.openid]&&(c=Object.assign({},c),delete c[b.openid]),{project:a.project.current,accountMap:c,show:a.window.multiAccountBox&&a.window.multiAccountBox.show,theme:a.settings.appearance.theme||"white"}},mapDispatchToProps=(a)=>({userActions:tools.bindActionCreators(userActions,a),setAdditionLogin:tools.bindActionCreators(windowActions.setAdditionLogin,a),setMultiAccountBox:tools.bindActionCreators(windowActions.setMultiAccountBox,a)});let AccountBox=class extends React.Component{constructor(a){super(a),this.onCheck=(a)=>{const b=a.currentTarget,c=b.dataset.openid;if(c){const a=Object.assign({},this.state.currentCheck);a[c]?delete a[c]:a[c]=!0,this.setState({currentCheck:a})}},this.onClose=()=>{this.setState({show:!1}),this.props.setAdditionLogin({show:!1})},this.onConfirm=()=>{if(0<Object.keys(this.state.currentCheck).length){const{appid:a,projectname:b,projectid:c}=this.props.project,d=encodeURIComponent(this.props.project.projectpath);for(const e in this.state.currentCheck){const f=this.props.accountMap[e];IndependentPopupWindow.openMiniProgram({projectid:c,appid:a,projectname:b,projectpath:d,options:{simple:!0,userInfo:f,theme:this.props.theme}})}}this.onClose()},this.onAddClick=(a)=>{a.stopPropagation();const b=this.container.getBoundingClientRect();this.props.setAdditionLogin({show:!0,left:b.right+10,top:b.top})},this.onSelectClick=(a)=>{a.stopPropagation();const b=a.currentTarget,c=b.dataset.openid;if(!c)return;let d=Object.assign({},this.state.currentSelect);a.metaKey||a.ctrlKey?d[c]=!d[c]:d={[c]:!0},this.setState({currentSelect:d})},this.onRemoveClick=()=>{const a=Object.keys(this.state.currentSelect);0<=a.length&&this.props.userActions.removeAccount(a)},this.onAnimationOut=()=>{this.props.setMultiAccountBox({show:!1})},this.state={show:a.show,currentCheck:{},currentSelect:{}}}componentDidMount(){this.props.userActions.checkAccountStatus()}renderUserList(){const a=[],b=[];if(0===Object.keys(this.props.accountMap).length)return React.createElement("div",{className:"account-box-bd"},React.createElement("div",{className:"account-box-empty-desc"},locales.config.ACCOUNT_BOX_EMPTY,React.createElement("a",{onClick:this.onAddClick},locales.config.ACCOUNT_BOX_ADD)));for(const c in this.props.accountMap){const d=this.props.accountMap[c];d.loginStatus===C.LOGIN_STATUS.EXPIRED?b.push(React.createElement("div",{className:classNames({"account-box-account":!0,"account-box-account-selected":this.state.currentSelect[c]}),onClick:this.onSelectClick,"data-openid":c,key:c},React.createElement("div",{className:"account-box-account-avatar"},React.createElement("img",{src:d.headUrl,alt:""})),React.createElement("div",{className:"account-box-account-content"},React.createElement("h3",{className:"account-box-account-name"},d.nickName)),React.createElement("div",{className:"account-box-account-ext",onClick:this.onAddClick},React.createElement("a",null,locales.config.ACCOUNT_BOX_RE_LOGIN)))):a.push(React.createElement("div",{className:classNames({"account-box-account":!0,"account-box-account-selected":this.state.currentSelect[c]}),onClick:this.onSelectClick,"data-openid":c,key:c},React.createElement("div",{className:"account-box-account-avatar"},React.createElement("img",{src:d.headUrl,alt:""})),React.createElement("div",{className:"account-box-account-content"},React.createElement("h3",{className:"account-box-account-name"},d.nickName)),React.createElement("div",{className:"account-box-account-ext",onClick:this.onCheck,"data-openid":c},React.createElement("label",{htmlFor:"",className:"ui-checkbox"},React.createElement("input",{type:"checkbox"}),React.createElement("i",{className:classNames({"ui-icon-checkbox":!0,"ui-icon-checkbox-o":this.state.currentCheck[d.openid]})})))))}return React.createElement("div",{className:"account-box-bd"},a,0<b.length?React.createElement("div",{className:"account-box-account-title"},locales.config.ACCOUNT_BOX_LOGON_EXPIRED):null,b)}render(){return React.createElement(Animation,{show:this.state.show,style:{width:300,marginLeft:-150},inClassName:"ui-animate-pull-down ui-dialog account-box-dialog",outClassName:"ui-animate-pull-up ui-dialog account-box-dialog",onAnimationOut:this.onAnimationOut},React.createElement("div",{className:"ui-dialog-bd",ref:(a)=>{this.container=a}},React.createElement("p",null,locales.config.ACCOUNT_BOX_TITLE),React.createElement("div",{className:"account-box"},React.createElement("div",{className:"account-box-hd"},React.createElement("h3",{className:"account-box-title"},locales.config.ACCOUNT_BOX_TEST_ACCOUNT),React.createElement("span",{className:"account-box-ext"},locales.config.ACCOUNT_BOX_LOGIN)),this.renderUserList(),React.createElement("div",{className:"account-box-ft"},React.createElement("a",{className:"account-box-action",onClick:this.onAddClick},React.createElement("i",{className:"ui-icon-plus"})),React.createElement("a",{className:classNames({"account-box-action":!0,"account-box-action-disabled":0>=Object.keys(this.state.currentSelect).length}),onClick:this.onRemoveClick},React.createElement("i",{className:"ui-icon-minus"}))))),React.createElement("div",{className:"ui-dialog-ft"},React.createElement("div",{className:"ui-dialog-action"},React.createElement("button",{className:"ui-button ui-button-default",onClick:this.onClose},locales.config.CANCEL),React.createElement("button",{className:"ui-button ui-button-primary",onClick:this.onConfirm},locales.config.CONFIRM))))}};AccountBox=tslib_1.__decorate([locales.mixin],AccountBox),module.exports=connect(mapStateToProps,mapDispatchToProps)(AccountBox);
  ;}(require("lazyload"), require);
  