-
Notifications
You must be signed in to change notification settings - Fork 13
/
account.084a56f4d09ea7614b79.js
1 lines (1 loc) · 363 KB
/
account.084a56f4d09ea7614b79.js
1
(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[644],{87276:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>ti});var a=s(96540),n=s(99429),i=s(55840),o=s(74248),r=s(14644),l=s(12569),c=s(72342),d=s(9476),h=s(18636),m=s(9404),p=s.n(m),u=s(188),g=s(24180),_=s(64741),b=s(5556),y=s.n(b),f=s(54625),E=s(80849),v=s.n(E),A=s(44352),w=s(72181),C=s(96366),k=s(40702),S=s(87040),x=s(10658),N=s.n(x),M=s(8080),I=s(1951),P=s(49585),B=s(46128),T=s(48287).Buffer;class O extends a.Component{static propTypes={asset_to_issue:l.A.ChainAsset.isRequired};constructor(e){super(e),this.state={amount:e.amount,to:e.to,to_id:null,memo:""}}onAmountChanged({amount:e}){this.setState({amount:e})}onToAccountChanged(e){let t=e?{to:e.get("name"),to_id:e.get("id")}:{to_id:null};this.setState(t)}onToChanged(e){this.setState({to:e,to_id:null})}onSubmit(){this.props.hideModal();let{asset_to_issue:e}=this.props,t=S.A.get_asset_precision(e.get("precision")),s=this.state.amount.toString().replace(/,/g,"");s*=t,M.A.issue_asset(this.state.to_id,e.get("issuer"),e.get("id"),s,this.state.memo?new T(this.state.memo,"utf-8"):this.state.memo).catch((e=>{console.log("issue error caught here:",e),B.Notification.error({message:N().translate("notifications.asset_issue_failure")})})),this.setState({amount:0,to:"",to_id:null,memo:""})}onMemoChanged(e){this.setState({memo:e.target.value})}render(){let e=this.props.asset_to_issue.get("id"),t=1,s=[a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.onSubmit.bind(this,this.state.to,this.state.amount),disabled:!this.state.to_id||!this.state.amount},N().translate("modal.issue.submit")),a.createElement(B.Button,{key:"cancel",onClick:this.props.hideModal},N().translate("cancel"))];return a.createElement(B.Modal,{title:N().translate("modal.issue.submit"),visible:this.props.visible,onCancel:this.props.hideModal,footer:s},a.createElement("form",{className:"grid-block vertical full-width-content"},a.createElement("div",{className:"grid-container "},a.createElement("div",{className:"content-block"},a.createElement(I.A,{label:"modal.issue.to",accountName:this.state.to,onAccountChanged:this.onToAccountChanged.bind(this),typeahead:!0,onChange:this.onToChanged.bind(this),account:this.state.to,tabIndex:t++})),a.createElement("div",{className:"content-block"},a.createElement(P.A,{label:"modal.issue.amount",amount:this.state.amount,onChange:this.onAmountChanged.bind(this),asset:e,assets:[e],tabIndex:t++})),a.createElement("div",{className:"content-block"},a.createElement("label",null,a.createElement(v(),{component:"span",content:"transfer.memo"})," ","(",a.createElement(v(),{content:"transfer.optional"}),")"),a.createElement("textarea",{rows:"3",value:this.state.memo,tabIndex:t++,onChange:this.onMemoChanged.bind(this)})))))}}const F=(0,c.A)(O);var L=s(64143),R=s(60819),q=s(23654),V=s(36234);class D extends a.Component{static defaultProps={symbol:"",name:"",description:"",max_supply:0,precision:0};static propTypes={symbol:y().string.isRequired};constructor(e){super(e),this.state={isIssueAssetModalVisible:!1,create:{symbol:"",name:"",description:"",max_supply:1e15,precision:4},issue:{amount:0,to:"",to_id:"",asset_id:"",symbol:""},errors:{symbol:null},isValid:!1,searchTerm:""},this._searchAccounts=(0,_.A)(this._searchAccounts,150),this.showIssueAssetModal=this.showIssueAssetModal.bind(this),this.hideIssueAssetModal=this.hideIssueAssetModal.bind(this)}showIssueAssetModal(){this.setState({isIssueAssetModalVisible:!0})}hideIssueAssetModal(){this.setState({isIssueAssetModalVisible:!1})}_checkAssets(e,t){if(this.props.account.get("assets").size)return;let s=e.sort(((e,t)=>e.symbol>t.symbol?1:e.symbol<t.symbol?-1:0)).last();0===e.size||t?(A.A.getAssetList.defer("A",100),this.setState({assetsFetched:100})):e.size>=this.state.assetsFetched&&(A.A.getAssetList.defer(s.symbol,100),this.setState({assetsFetched:this.state.assetsFetched+99}))}UNSAFE_componentWillReceiveProps(e){this._checkAssets(e.assets)}UNSAFE_componentWillMount(){this._checkAssets(this.props.assets,!0)}_onIssueInput(e,t){let s=t.target.id,{issue:a}=this.state;if("to"===s){this._searchAccounts(t.target.value),a.to=t.target.value;let e=this.props.searchAccounts.findEntry((e=>e===t.target.value));a.to_id=e?e[0]:null}else a[e]=t.target.value;this.setState({issue:a})}_searchAccounts(e){n.A.accountSearch(e)}_issueButtonClick(e,t,s){s.preventDefault();let{issue:a}=this.state;a.asset_id=e,a.symbol=t,this.setState({issue:a}),this.showIssueAssetModal()}_editButtonClick(e,t,s){s.preventDefault(),this.props.history.push(`/account/${t}/update-asset/${e}`)}_createButtonClick(e){this.props.history.push(`/account/${e}/create-asset`)}render(){let{account:e,account_name:t,assets:s,assetsList:n}=this.props,i=!0;if(!e)return a.createElement(k.A,{type:"circle"});if(e.notFound&&(i=!1),!i)return a.createElement("div",{className:"grid-block"},a.createElement("h5",null,a.createElement(v(),{component:"h5",content:"account.errors.not_found",name:t})));n.length&&(s=s.clear(),n.forEach((e=>{e&&(s=s.set(e.get("id"),e.toJS()))})));let o=s.filter((t=>t.issuer===e.get("id"))).sort(((e,t)=>parseInt(e.id.substring(4,e.id.length),10)-parseInt(t.id.substring(4,t.id.length),10))).map((e=>{let s=L.A.parseDescription(e.options.description),n=s.short_name?s.short_name:s.main;n.length>100&&(n=n.substr(0,100)+"...");const i=this.props.getDynamicObject(e.dynamic_asset_data_id);return a.createElement("tr",{key:e.symbol},a.createElement("td",{style:{textAlign:"left"}},a.createElement(f.N_,{to:`/asset/${e.symbol}`},e.symbol)),a.createElement("td",{style:{textAlign:"left"}},"bitasset"in e?e.bitasset.is_prediction_market?a.createElement(v(),{content:"account.user_issued_assets.pm"}):a.createElement(v(),{content:"account.user_issued_assets.mpa"}):"User Issued Asset"),a.createElement("td",{style:{textAlign:"right"}},i?a.createElement(C.A,{hide_asset:!0,amount:parseInt(i.get("current_supply"),10),asset:e.id}):null),a.createElement("td",{style:{textAlign:"right"}},a.createElement(C.A,{hide_asset:!0,amount:parseInt(e.options.max_supply,10),asset:e.id})),a.createElement("td",null,e.bitasset_data_id?null:a.createElement("a",{onClick:this._issueButtonClick.bind(this,e.id,e.symbol)},a.createElement(V.A,{name:"cross-circle",className:"rotate45"}))),a.createElement("td",null,a.createElement("a",{onClick:this._editButtonClick.bind(this,e.symbol,t)},a.createElement(V.A,{name:"dashboard"}))))})).toArray();return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{segmented:!1,setting:"issuedAssetsTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding"},a.createElement(q.o,{title:"account.user_issued_assets.issued_assets"},a.createElement("div",{className:"content-block"},a.createElement("table",{className:"table dashboard-table"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{textAlign:"left"}},a.createElement(v(),{content:"account.user_issued_assets.symbol"})),a.createElement("th",{style:{textAlign:"left"}},a.createElement(v(),{content:"explorer.asset.summary.asset_type"})),a.createElement(v(),{component:"th",content:"markets.supply",style:{textAlign:"right"}}),a.createElement("th",{style:{textAlign:"right"}},a.createElement(v(),{content:"account.user_issued_assets.max_supply"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(v(),{content:"transaction.trxTypes.asset_issue"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(v(),{content:"transaction.trxTypes.asset_update"})))),a.createElement("tbody",null,o))),a.createElement("div",{className:"content-block"},a.createElement("button",{className:"button",onClick:this._createButtonClick.bind(this,t)},a.createElement(v(),{content:"transaction.trxTypes.asset_create"})))))),a.createElement(F,{visible:this.state.isIssueAssetModalVisible,hideModal:this.hideIssueAssetModal,showModal:this.showIssueAssetModal,asset_to_issue:this.state.issue.asset_id})))}}D=(0,R.A)(D,{propNames:["assetsList"],asList:!0,withDynamic:!0});const j=(0,d.N)(D,{listenTo:()=>[w.A],getProps(e){let t=(0,m.Map)(),s=(0,m.List)();return e.account.get("assets",[]).size?e.account.get("assets",[]).forEach((e=>{s=s.push(e)})):t=w.A.getState().assets,{assets:t,assetsList:s}}});var U=s(72090),W=s(91001),z=s(27584),K=s(66897),J=s(74806),H=s(17071),G=s(78740),Z=s(15286),Q=s.n(Z),Y=s(49074),X=s(62716),$=s(2999),ee=s(46863),te=s(61594),se=s.n(te);s(28690),s(77408),Y.A.createActions(class{createPool(e,t,s,a,n,i,o,r,l){console.log("create pool:",t,"flags:",s,"isBitAsset:",i,"bitasset_opts:",r);let c=$.A.new_transaction(),d=S.A.get_asset_precision(t.precision);se().config({DECIMAL_PLACES:t.precision});let h=new(se())(t.max_supply).times(d).toString(),m=new(se())(t.max_market_fee||0).times(d).toString(),p=S.A.get_asset_precision(U.ChainStore.getAsset(n.base.asset_id).get("precision")),u={fee:{amount:0,asset_id:0},issuer:e,symbol:t.symbol,precision:parseInt(t.precision,10),common_options:{max_supply:h,market_fee_percent:100*t.market_fee_percent||0,max_market_fee:m,issuer_permissions:a,flags:s,core_exchange_rate:{base:{amount:n.base.amount*p,asset_id:n.base.asset_id},quote:{amount:n.quote.amount*d,asset_id:"1.3.1"}},whitelist_authorities:[],blacklist_authorities:[],whitelist_markets:[],blacklist_markets:[],description:l,extensions:{reward_percent:100*t.reward_percent||0,whitelist_market_fee_sharing:[]}},is_prediction_market:o,extensions:null};return i&&(u.bitasset_opts=r),c.add_type_operation("asset_create",u),e=>ee.A.process_transaction(c,null,!0).then((t=>{e(!0)})).catch((t=>{console.log("----- createAsset error -----\x3e",t),e(!1)}))}create_liquidity_pool(e,t,s,a,n,i){}});var ae=s(41321);function ne(e,t=!1,s,a){if(!e&&""!==e)return;let n=e.toUpperCase();n.startsWith("BIT")&&n.length>=6&&(n=e.substr(3,n.length-1)),s(n,10,t),a({lookupQuote:n})}function ie({searchAssets:e,marketPickerAsset:t},{inputValue:s,lookupQuote:a},n,i){n({activeSearch:!0});let o=0,r=[];e.size&&s&&s.length>2&&e.filter((e=>{try{if(e.options.description){let t=JSON.parse(e.options.description);if("visible"in t&&!t.visible)return!1}}catch(e){}return-1!==e.symbol.indexOf(a)})).forEach((e=>{if(o>100)return;o++;let t=re(e.issuer),s=e.symbol;r.push([s,{id:e.id,quote:e.symbol,base:"",issuerId:e.issuer,issuer:t}])}));const l=function(e,t){return t.startsWith("BIT")&&t.length>=6&&(t=t.substr(3,t.length-1)),e.sort((([,e],[,s])=>{const a=oe(e),n=oe(s);if(a.asset!==n.asset){if(a.asset===t)return-1;if(n.asset===t)return 1;if(a.asset>n.asset)return-1;if(a.asset<n.asset)return 1}if(a.isCommittee^n.isCommittee){if(a.isCommittee)return-1;if(n.isCommittee)return 1}const i=(0,ae.DC)(e.quote),o=(0,ae.DC)(s.quote);return i&&!o?-1:o&&!i||a.gateway>n.gateway?1:a.gateway<n.gateway?-1:0}))}(r,s);i(l)}function oe(e){const t={},s=e.quote;if(-1!==s.indexOf(".")){const[e,a]=s.split(".");t.gateway=e,t.asset=a}else t.asset=s;return"1.2.0"===e.issuerId&&(t.isCommittee=!0),t}function re(e){let t=U.ChainStore.getObject(e,!1,!1);return t?t.get("name"):void 0}class le extends a.Component{static propTypes={itemSelect:y().func,itemLabel:y().string,itemData:y().object,marketPickerAsset:y().string};onClick(e){this.props.itemSelect(this.props.itemData)}render(){const{itemData:e,marketPickerAsset:t}=this.props,{onClose:s}=this.props;return a.createElement("li",{key:this.props.key,style:{height:20,cursor:"pointer"},onClick:this.onClick.bind(this)},this.props.itemLabel)}}class ce extends a.Component{constructor(e){super(e),this.state=this._getInitialState(),this.onCreatePool=this.onCreatePool.bind(this),this.onCancel=this.onCancel.bind(this),this.onClose=this.onClose.bind(this),this.onPoolNameChange=this.onPoolNameChange.bind(this),this.onAssetASearch=this.onAssetASearch.bind(this),this.onAssetBSearch=this.onAssetBSearch.bind(this),this.onSetAssetAArray=this.onSetAssetAArray.bind(this),this.onSetAssetBArray=this.onSetAssetBArray.bind(this),this.onSetPoolName=this.onSetPoolName.bind(this),this.onSetAssetA=this.onSetAssetA.bind(this),this.onSetAssetB=this.onSetAssetB.bind(this),this.setState=this.setState.bind(this),this.onSetTakerFee=this.onSetTakerFee.bind(this),this.onSetUnstackFee=this.onSetUnstackFee.bind(this),this.getAssetList=(0,_.A)(A.A.getAssetList.defer,150),this.getAssetsByIssuer=(0,_.A)(A.A.getAssetsByIssuer.defer,150),this._checkAndUpdateMarketList=this._checkAndUpdateMarketList.bind(this)}_getInitialState(){return{poolName:null,filterAssetA:null,filterAssetB:null,lookupQuote:null,keyString:null,poolNameArray:[],assetsAArray:[],assetsBArray:[],assetsA:null,assetsB:null,takerFee:0,unstakeFee:0,marketsList:[],searchPoolName:!1,searchAssetA:!1,searchAssetB:!1,showAlertChangeAssetA:!1,showAlertChangeAssetB:!1,showAlertChangeTrankerFee:!1,showAlertChangeUnstakeFee:!1,showAlertInputPool:!1,showAlertInputAssetA:!1,showAlertInputAssetB:!1,showAlertInputTrankerFee:!1,showAlertInputUnstakeFee:!1}}initialState(){return{marketsList:[],assetsAArray:[],assetsBArray:[],searchAssetA:!1,searchAssetB:!1,lookupQuote:null,inputValue:""}}initAlertState(){return{showAlertChangeAssetA:!1,showAlertChangeAssetB:!1,showAlertChangeTrankerFee:!1,showAlertChangeUnstakeFee:!1,showAlertInputAssetA:!1,showAlertInputAssetB:!1,showAlertInputTrankerFee:!1,showAlertInputUnstakeFee:!1,showAlertInputPool:!1}}componentWillReceiveProps(e){e.marketPickerAsset!==this.props.marketPickerAsset&&console.log("componentWillReceiveProps is invoked."),e.searchList!==this.props.searchList&&(this.state.searchAssetA?ie({searchAssets:this.props.searchList,marketPickerAsset:this.props.marketPickerAsset},{inputValue:this.state.filterAssetA,lookupQuote:this.state.lookupQuote},this.setState,this._checkAndUpdateMarketList):this.state.searchAssetB?ie({searchAssets:this.props.searchList,marketPickerAsset:this.props.marketPickerAsset},{inputValue:this.state.filterAssetB,lookupQuote:this.state.lookupQuote},this.setState,this._checkAndUpdateMarketList):this.state.searchPoolName&&ie({searchAssets:this.props.searchList,marketPickerAsset:this.props.marketPickerAsset},{inputValue:this.state.poolName,lookupQuote:this.state.lookupQuote},this.setState,this._checkAndUpdateMarketList))}shouldComponentUpdate(e,t){return e.visible!==this.props.visible||e.marketPickerAsset!==this.props.marketPickerAsset||e.searchList!==this.props.searchList||t.marketsList!==this.state.marketsList||!S.A.are_equal_shallow(t,this.state)}componentWillUnmount(){this.intervalId&&clearInterval(this.intervalId)}_checkAndUpdateMarketList(e){clearInterval(this.intervalId),console.log("CreatePooModal marketsList: ",e),this.intervalId=setInterval((()=>{let t=0;for(let[,s]of e)s.issuer||(s.issuer=re(s.issuerId),s.issuer||t++);t||(clearInterval(this.intervalId),this.state.searchPoolName?this.setState({poolNameArray:e,activeSearch:!1}):this.state.searchAssetA?this.setState({assetsAArray:e,activeSearch:!1}):this.state.searchAssetB&&this.setState({assetsBArray:e,activeSearch:!1}))}),300)}onCancel(){this.props.hideModal(),this.setState(this._getInitialState()),this.onClose()}onClose(){this.setState(this._getInitialState())}onCreatePool(){this.state.poolName?this.state.assetsA?this.state.assetsB?this.state.takerFee?this.state.unstakeFee?(this.state.assetsA&&this.state.assetsB&&this.state.takerFee&&this.state.unstakeFee&&(Number(this.state.assetsA[1].id.replace("1.3.",""))>Number(this.state.assetsB[1].id.replace("1.3.",""))?(console.log(this.state.assetsB[1].quote,this.state.assetsA[1].quote),M.A.liquidityPoolCreate(this.props.account,this.state.assetsB[1].quote,this.state.assetsA[1].quote,this.state.poolName,100*this.state.takerFee,100*this.state.unstakeFee),this.props.hideModal()):(console.log(this.state.assetsA[1].quote,this.state.assetsB[1].quote),M.A.liquidityPoolCreate(this.props.account,this.state.assetsA[1].quote,this.state.assetsB[1].quote,this.state.poolName,100*this.state.takerFee,100*this.state.unstakeFee),this.props.hideModal())),this.onCancel()):this.setState({showAlertInputUnstakeFee:!0}):this.setState({showAlertInputTrankerFee:!0}):this.setState({showAlertInputAssetB:!0}):this.setState({showAlertInputAssetA:!0}):this.setState({showAlertInputPool:!0})}onPoolNameChange(e,t){this.setState(this.initAlertState());let s=t.target.value.trim().toUpperCase();if(U.ChainValidation.is_valid_symbol_error(s,!0))return void this.setState({poolName:s,poolNameArray:[],searchPoolName:!1});this.setState({poolName:s,marketsList:[],searchPoolName:!0}),this.state.poolName!==s&&this.timer&&clearTimeout(this.timer);let a=this.props.account.get("name"),n=[...this.props.account.get("assets")];this.props.account.keys(),this.timer=setTimeout((()=>{!function(e,t,s,a=!1,n,i){(e||""===e)&&(n(e,10,s,a),i({lookupQuote:t}))}(a,s,n[0],e,this.getAssetsByIssuer,this.setState)}),1500)}onAssetASearch(e,t){this.setState(this.initAlertState());let s=t.target.value.trim().toUpperCase();U.ChainValidation.is_valid_symbol_error(s,!0)?this.setState({filterAssetA:s,activeSearch:!1,marketsList:[]},(()=>{this.onSetAssetAArray()})):(this.setState({filterAssetA:s,activeSearch:!0,marketsList:[],searchAssetA:!0,searchAssetB:!1}),this.state.filterAssetA!==s&&this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{ne(s,e,this.getAssetList,this.setState)}),1500))}onAssetBSearch(e,t){this.setState(this.initAlertState());let s=t.target.value.trim().toUpperCase();U.ChainValidation.is_valid_symbol_error(s,!0)?this.setState({filterAssetB:s,activeSearch:!1,marketsList:[]},(()=>{this.onSetAssetAArray()})):(this.setState({filterAssetB:s,activeSearch:!0,marketsList:[],searchAssetA:!1,searchAssetB:!0}),this.state.filterAssetB!==s&&this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{ne(s,e,this.getAssetList,this.setState)}),1500))}onSetAssetAArray(){}onSetAssetBArray(){}onSetPoolName(e){this.setState({poolName:e,searchPoolName:!1})}onSetAssetA(e){this.setState(this.initialState()),console.log("onSetAssetA ",e),console.log("takerFee: ",this.state.takerFee),this.setState({assetsA:e,activeSearch:!1,filterAssetA:e[0]})}onSetAssetB(e){this.setState(this.initialState()),console.log("onSetAssetB ",e),this.setState({assetsB:e,activeSearch:!1,filterAssetB:e[0]})}onSetTakerFee(e){this.setState(this.initAlertState()),this.setState({takerFee:e.target.value})}onFormatTakerFee(e){const t=this.state.takerFee;this.setState({takerFee:parseFloat(t).toFixed(2)})}onSetUnstackFee(e){this.setState(this.initAlertState()),this.setState({unstakeFee:e.target.value})}onFormatUnstackFee(e){const t=this.state.unstakeFee;this.setState({unstakeFee:parseFloat(t).toFixed(2)})}render(){const e=[];return e.push(a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.onCreatePool},N().translate("account.liquidity_pools.create_pool"))),a.createElement(B.Modal,{visible:this.props.visible,onCancel:this.onCancel,footer:e},a.createElement("div",{className:""},a.createElement("div",{style:{margin:"0 0"}},a.createElement(v(),{component:"h3",content:"account.liquidity_pools.create_pool"})),a.createElement("form",{className:"full-width",style:{margin:"0 1rem"},onSubmit:this.onCreatePool,noValidate:!0},a.createElement("div",{className:"form-group inputAddon small-12"},a.createElement("div",{id:"filter"},a.createElement(B.Form.Item,null,a.createElement(B.Input,{type:"text",ref:"marketPicker_input",value:this.state.poolName,onChange:this.onPoolNameChange.bind(this,!1),placeholder:N().translate("account.liquidity_pools.pool_name"),maxLength:"16",addonAfter:a.createElement(B.Icon,{type:"search"})}),this.state.showAlertInputPool?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_request_input_pool"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null)),this.state.searchPoolName&&a.createElement("div",{className:"results"},this.state.poolNameArray.map(((e,t)=>a.createElement(le,{key:t,tabIndex:t+100,itemLabel:e[0],itemData:e[0],itemSelect:this.onSetPoolName}))))),a.createElement("div",{className:"form-group inputAddon small-12"},a.createElement("div",{id:"assetAfilter"},a.createElement(B.Form.Item,null,a.createElement(B.Input,{type:"text",ref:"marketPicker_input",value:this.state.filterAssetA,onChange:this.onAssetASearch.bind(this,!0),placeholder:N().translate("account.liquidity_pools.asset_a"),maxLength:"16",addonAfter:a.createElement(B.Icon,{type:"search"})}),this.state.showAlertChangeAssetA?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_asset_a"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null,this.state.showAlertInputAssetA?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_request_input_asset_a"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null)),this.state.searchAssetA&&a.createElement("div",{className:"results"},this.state.assetsAArray.map(((e,t)=>a.createElement(le,{key:t,tabIndex:t+100,itemLabel:e[0],itemData:e,itemSelect:this.onSetAssetA}))))),a.createElement("div",{className:"form-group inputAddon small-12"},a.createElement("div",{id:"assetAfilter"},a.createElement(B.Form.Item,null,a.createElement(B.Input,{type:"text",ref:"marketPicker_input",value:this.state.filterAssetB,onChange:this.onAssetBSearch.bind(this,!0),placeholder:N().translate("account.liquidity_pools.asset_b"),maxLength:"16",addonAfter:a.createElement(B.Icon,{type:"search"})}),this.state.showAlertChangeAssetB?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_asset_b"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null,this.state.showAlertInputAssetB?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_request_input_asset_b"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null)),this.state.searchAssetB&&a.createElement("div",{className:"results"},this.state.assetsBArray.map(((e,t)=>a.createElement(le,{key:t,tabIndex:t+100,itemLabel:e[0],itemData:e,itemSelect:this.onSetAssetB}))))),a.createElement("div",{className:"form-group inputAddon small-12"},a.createElement(B.Input,{placeholder:N().translate("account.liquidity_pools.taker_fee")+" %",type:"number",style:{width:"70%"},autoComplete:"off",value:this.state.takerFee,onChange:this.onSetTakerFee.bind(this),onBlur:this.onFormatTakerFee.bind(this),addonAfter:"Taker Fee %",maxLength:"16"}),this.state.showAlertChangeTrankerFee?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_taker_fee"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null,this.state.showAlertInputTrankerFee?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_request_input_taker_fee"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null),a.createElement("div",{className:"form-group inputAddon small-12"},a.createElement(B.Input,{placeholder:N().translate("account.liquidity_pools.unstake_fee")+" %",type:"number",style:{width:"70%"},autoComplete:"off",value:this.state.unstakeFee,onChange:this.onSetUnstackFee.bind(this),onBlur:this.onFormatUnstackFee.bind(this),addonAfter:"Unstake Fee %",maxLength:"16"}),this.state.showAlertChangeUnstakeFee?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_unstack_fee"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null,this.state.showAlertInputUnstakeFee?a.createElement(B.Alert,{message:N().translate("account.liquidity_pools.alert_request_input_unstack_fee"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}):null),a.createElement("div",{className:"form-group"}))))}}ce.propTypes={modalId:y().string.isRequired,keyValue:y().string},ce.defaultProps={modalId:"qr_code_password_modal"};const de=ce;var he=s(50548);s(45014);class me extends a.Component{static propTypes={pool:l.A.ChainLiquidityPool.isRequired};constructor(e){super(e),this.state={isModalVisible:e.isModalVisible},this.hideModal=this.hideModal.bind(this),this.onSubmit=this.onSubmit.bind(this)}componentWillReceiveProps(e){console.log("DeletePoolModal: ")}hideModal(){this.props.onHideModal()}onSubmit(){this.props.onDeletePool(this.props.pool)}render(){return a.createElement(B.Modal,{visible:this.state.isModalVisible,id:"pool_delete_modal",overlay:!0,onCancel:this.hideModal,footer:[a.createElement(B.Button,{key:"send",onClick:this.onSubmit.bind(this)},N().translate("poolmart.liquidity_pools.delete_pool")),a.createElement(B.Button,{key:"Cancel",onClick:this.hideModal,style:{marginLeft:"20px"}},a.createElement(v(),{component:"span",content:"transfer.cancel"}))]},a.createElement("div",null,a.createElement(B.Row,null,a.createElement(B.Col,{span:24},N().translate("poolmart.liquidity_pools.confirm_delete_pool")))))}}const pe=me;class ue extends a.Component{static propTypes={defaultAsset:l.A.ChainAsset.isRequired};static defaultProps={defaultAsset:"1.3.0"};constructor(e){super(e),this.state={filterAssetA:this.props.defaultAsset?this.props.defaultAsset.get("symbol"):null,filterAssetB:null,filterShareAsset:null,start:"1.19.0",limit:10,total:0,isExchangeModalVisible:!1,isStakeModalVisible:!1,selectedPool:null,isCreatePoolModalVisible:!1,isDeletePoolModalVisible:!1},this.showCreatePoolModal=this.showCreatePoolModal.bind(this),this.hideCreatePoolModal=this.hideCreatePoolModal.bind(this),this.timer=null}componentDidMount(){this._getLiquidityPools()}componentWillReceiveProps(e){if(e.liquidityPools!==this.props.liquidityPools){const{liquidityPools:t}=e;t.size>0&&t.last().id!==this.props.lastPoolId&&this.setState({start:t.last().id},(()=>this._getLiquidityPools()))}}_getLiquidityPools(){this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{J.A.getLiquidityPoolsAccount.defer(this.props.account_name)}),500)}_resetLiquidityPools(){this.setState({start:"1.19.0",lastPoolId:null,total:0}),J.A.resetLiquidityPools()}_onFilterAssetA(e){e.target.value?this.setState({filterAssetA:e.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterAssetA:""}),this._resetLiquidityPools())}_onFilterAssetB(e){e.target.value?this.setState({filterAssetB:e.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterAssetB:""}),this._resetLiquidityPools())}_onFilterShareAsset(e){e.target.value?this.setState({filterAssetA:null,filterAssetB:null,filterShareAsset:e.target.value.toUpperCase()},(()=>{this._getLiquidityPools(),this._resetLiquidityPools()})):(this.setState({filterShareAsset:""}),this._resetLiquidityPools())}_handleRowsChange(e){this.setState({limit:parseInt(e,10),start:"1.19.0"},(()=>{this._resetLiquidityPools(),this._getLiquidityPools()}))}_showExchangeModal(e){this.setState({isExchangeModalVisible:!0,selectedPool:e})}_hideExchangeModal(){this.setState({isExchangeModalVisible:!1,selectedPool:null})}_showStakeModal(e){this.setState({isStakeModalVisible:!0,selectedPool:e})}_hideStakeModal(){this.setState({isStakeModalVisible:!1,selectedPool:null})}_createButtonClick(e){this.showCreatePoolModal()}showCreatePoolModal(){this.setState({isCreatePoolModalVisible:!0})}hideCreatePoolModal(){this.setState({isCreatePoolModalVisible:!1})}_showDeleteModal(e){this.setState({isDeletePoolModalVisible:!0,selectedPool:e})}_hideDeleteModal(e){this.setState({isDeletePoolModalVisible:!1,selectedPool:e})}_deletePool(e){console.log("_deletePool invoked.");const{account:t}=this.props,s=this.state.selectedPool;this.setState({isDeletePoolModalVisible:!1}),M.A.liquidityPoolDelete(t,s.id).then((()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{J.A.getLiquidityPoolsAccount.defer(this.props.account_name)}),500)}))}render(){const e=[{key:"id",dataIndex:"id",title:N().translate("poolmart.liquidity_pools.pool_id"),sorter:(e,t)=>e.id.split(".")[2]-t.id.split(".")[2]},{key:"share_asset_str",dataIndex:"share_asset_str",title:N().translate("poolmart.liquidity_pools.share_asset"),render:e=>e?a.createElement(f.N_,{to:`/asset/${e}`},a.createElement(W.A,{name:e})):null,sorter:(e,t)=>e.share_asset_str>t.share_asset_str?1:e.share_asset_str<t.share_asset_str?-1:0},{key:"asset_a_str",dataIndex:"asset_a_str",title:N().translate("poolmart.liquidity_pools.asset_a"),render:e=>e?a.createElement(f.N_,{to:`/asset/${e}`},a.createElement(W.A,{name:e})):null,sorter:(e,t)=>e.asset_a_str>t.asset_a_str?1:e.asset_a_str<t.asset_a_str?-1:0},{key:"asset_a_qty",dataIndex:"asset_a_qty",title:N().translate("poolmart.liquidity_pools.asset_a_qty"),sorter:(e,t)=>e.asset_a_qty-t.asset_a_qty},{key:"asset_b_str",dataIndex:"asset_b_str",title:N().translate("poolmart.liquidity_pools.asset_b"),render:e=>e?a.createElement(f.N_,{to:`/asset/${e}`},a.createElement(W.A,{name:e})):null,sorter:(e,t)=>e.asset_b_str>t.asset_b_str?1:e.asset_b_str<t.asset_b_str?-1:0},{key:"asset_b_qty",dataIndex:"asset_b_qty",title:N().translate("poolmart.liquidity_pools.asset_b_qty"),sorter:(e,t)=>e.asset_b_qty-t.asset_b_qty},{key:"taker_fee_percent",dataIndex:"taker_fee_percent_str",title:N().translate("poolmart.liquidity_pools.taker_fee_percent")},{key:"withdrawal_fee_percent",dataIndex:"withdrawal_fee_percent_str",title:N().translate("poolmart.liquidity_pools.withdrawal_fee_percent")},{key:"exchange",title:N().translate("poolmart.liquidity_pools.exchange"),render:e=>a.createElement("a",{onClick:()=>this._showExchangeModal(e)},a.createElement(V.A,{name:"poolmart"}))},{key:"stake_unstake",title:N().translate("poolmart.liquidity_pools.stake_unstake"),render:e=>a.createElement("a",{onClick:()=>this._showStakeModal(e)},a.createElement(V.A,{name:"deposit"}))},{key:"delete_pool",title:N().translate("poolmart.liquidity_pools.delete_pool"),render:e=>a.createElement("a",{onClick:()=>this._showDeleteModal(e)},a.createElement(V.A,{name:"delete"}))}];let{account:t,account_name:s,assets:n,assetsList:i}=this.props;i.length&&(n=n.clear(),i.forEach((e=>{e&&(n=n.set(e.get("id"),e.toJS()))})));const o=[];return this.props.liquidityPools.forEach((e=>{const t=e;t.share_asset_str=e.share_asset_obj?e.share_asset_obj.get("symbol"):e.share_asset,t.asset_a_str=e.asset_a_obj?e.asset_a_obj.get("symbol"):e.asset_a,t.asset_b_str=e.asset_b_obj?e.asset_b_obj.get("symbol"):e.asset_b,t.asset_a_qty=e.asset_a_obj?e.balance_a/Math.pow(10,e.asset_a_obj.get("precision")):0,t.asset_b_qty=e.asset_b_obj?e.balance_b/Math.pow(10,e.asset_b_obj.get("precision")):0,t.taker_fee_percent_str=e.taker_fee_percent/100+"%",t.withdrawal_fee_percent_str=e.withdrawal_fee_percent/100+"%",o.push(t)})),a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{segmented:!1,setting:"issuedAssetsTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding"},a.createElement(q.o,{title:"account.liquidity_pools.liquidity_pools"},a.createElement("div",{className:"grid-block vertical"},a.createElement("div",{className:"grid-content no-padding"},a.createElement(z.A,{placeholder:N().translate("poolmart.liquidity_pools.asset_a"),value:this.state.filterAssetA,onChange:this._onFilterAssetA.bind(this),style:{width:"200px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(z.A,{placeholder:N().translate("poolmart.liquidity_pools.asset_b"),value:this.state.filterAssetB,onChange:this._onFilterAssetB.bind(this),style:{width:"200px",marginLeft:"20px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(z.A,{placeholder:N().translate("poolmart.liquidity_pools.share_asset"),value:this.state.filterShareAsset,onChange:this._onFilterShareAsset.bind(this),style:{width:"200px",marginLeft:"20px",marginBottom:"12px",marginTop:"4px"}}),a.createElement(B.Select,{style:{width:"150px",marginLeft:"24px",marginTop:"4px"},value:this.state.limit,onChange:this._handleRowsChange.bind(this)},a.createElement(B.Select.Option,{key:"10"},"10 rows"),a.createElement(B.Select.Option,{key:"25"},"25 rows"),a.createElement(B.Select.Option,{key:"50"},"50 rows"),a.createElement(B.Select.Option,{key:"100"},"100 rows"))),a.createElement("div",{className:"grid-content no-padding"},a.createElement(B.Table,{columns:e,rowKey:"id",dataSource:o,pagination:{pageSize:this.state.limit,total:o.length}})),a.createElement("div",{className:"content-block"},a.createElement("button",{className:"button",onClick:this._createButtonClick.bind(this,this.props.account_name)},a.createElement(v(),{content:"account.liquidity_pools.create_pool"}))),this.state.isExchangeModalVisible&&a.createElement(H.A,{isModalVisible:this.state.isExchangeModalVisible,onHideModal:this._hideExchangeModal.bind(this),pool:this.state.selectedPool.share_asset}),this.state.isStakeModalVisible&&a.createElement(G.A,{isModalVisible:this.state.isStakeModalVisible,onHideModal:this._hideStakeModal.bind(this),pool:this.state.selectedPool.share_asset}),this.state.isDeletePoolModalVisible&&a.createElement(pe,{isModalVisible:this.state.isDeletePoolModalVisible,onHideModal:this._hideDeleteModal.bind(this),onDeletePool:this._deletePool.bind(this),pool:this.state.selectedPool.share_asset}),a.createElement(de,{showModal:this.showCreatePoolModal,hideModal:this.hideCreatePoolModal,visible:this.state.isCreatePoolModalVisible,account:this.props.account,assetsList:i,searchList:this.props.assets,name:this.props.account_name})))))}}ue=(0,c.A)(ue,{show_loader:!0});class ge extends a.Component{render(){return a.createElement(ue,this.props)}}const _e=(0,d.N)(ge,{listenTo:()=>[K.A,w.A],getProps(e){let t=(0,m.Map)(),s=(0,m.List)();return e.account.get("assets",[]).size&&e.account.get("assets",[]).forEach((e=>{s=s.push(e)})),K.A.getState().liquidityPools,t=w.A.getState().assets,{liquidityPools:K.A.getState().liquidityPools,liquidityPoolsLoading:K.A.getState().liquidityPoolsLoading,lastPoolId:K.A.getState().lastPoolId,assets:t,assetsList:s}}});var be=s(32485),ye=s.n(be),fe=s(81428),Ee=s(57763),ve=s(93711),Ae=s.n(ve),we=s(15483);let Ce=new(se())(Ae().GRAPHENE_MAX_SHARE_SUPPLY);class ke extends a.Component{static propTypes={backingAsset:l.A.ChainAsset.isRequired,isUpdate:y().bool};static defaultProps={isUpdate:!1};constructor(e){super(e),this.state={backingAsset:e.backingAsset.get("symbol"),error:null}}_onInputBackingAsset(e){this.props.disableBackingAssetChange?this.props.disabledBackingAssetChangeCallback():this.setState({backingAsset:e.toUpperCase(),error:null})}_onFoundBackingAsset(e){if(e){let t=e.get("bitasset")&&U.ChainStore.getAsset(e.getIn(["bitasset","options","short_backing_asset"])),s=t&&t.get("bitasset")&&U.ChainStore.getAsset(t.getIn(["bitasset","options","short_backing_asset"]));s&&"1.3.0"!==s?(this.setState({error:N().translate("account.user_issued_assets.error_too_deep")}),this.props.onUpdate("invalid",!0)):e.getIn(["bitasset","is_prediction_market"])?(this.setState({error:N().translate("account.user_issued_assets.error_invalid")}),this.props.onUpdate("invalid",!0)):this.props.isPredictionMarket&&e.get("precision")!==parseInt(this.props.assetPrecision,10)?(this.setState({error:N().translate("account.user_issued_assets.error_precision",{asset:this.props.assetSymbol})}),this.props.onUpdate("invalid",!0)):(this.props.onUpdate("short_backing_asset",e.get("id")),this.props.onUpdate("invalid",!1))}else this.props.onUpdate("invalid",!0)}render(){let{bitasset_opts:e}=this.props,{error:t}=this.state;return a.createElement("div",{className:"small-12 grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.feed_lifetime_sec"}),a.createElement("input",{type:"number",value:e.feed_lifetime_sec/60,onChange:this.props.onUpdate.bind(this,"feed_lifetime_sec")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.minimum_feeds"}),a.createElement("input",{type:"number",value:e.minimum_feeds,onChange:this.props.onUpdate.bind(this,"minimum_feeds")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.force_settlement_delay_sec"}),a.createElement("input",{type:"number",value:e.force_settlement_delay_sec/60,onChange:this.props.onUpdate.bind(this,"force_settlement_delay_sec")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.force_settlement_offset_percent"}),a.createElement("input",{type:"number",value:e.force_settlement_offset_percent/Ae().GRAPHENE_1_PERCENT,onChange:this.props.onUpdate.bind(this,"force_settlement_offset_percent")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.maximum_force_settlement_volume"}),a.createElement("input",{type:"number",value:e.maximum_force_settlement_volume/Ae().GRAPHENE_1_PERCENT,onChange:this.props.onUpdate.bind(this,"maximum_force_settlement_volume")})),a.createElement("div",{className:"grid-block no-margin small-12"},a.createElement(Ee.A,{label:"account.user_issued_assets.backing",onChange:this._onInputBackingAsset.bind(this),asset:this.state.backingAsset,assetInput:this.state.backingAsset,tabIndex:1,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundBackingAsset.bind(this)}),t?a.createElement("div",{className:"content-block has-error"},t):null))}}ke=(0,c.A)(ke);class Se extends a.Component{static propTypes={core:l.A.ChainAsset.isRequired,globalObject:l.A.ChainObject.isRequired};static defaultProps={globalObject:"2.0.0",core:"1.3.0"};constructor(e){super(e),this.state=this.resetState(e)}resetState(e){let t=!1,{flagBooleans:s,permissionBooleans:a}=(S.A.get_asset_precision(4),S.A.get_asset_precision(e.core.get("precision")),this._getPermissions({isBitAsset:t}));return U.ChainStore.getAsset("1.3.0").get("symbol"),{update:{symbol:"",precision:4,max_supply:1e5,max_market_fee:0,market_fee_percent:0,description:{main:""},reward_percent:0,taker_fee_percent:0},errors:{max_supply:null},isValid:!0,flagBooleans:s,permissionBooleans:a,isBitAsset:t,is_prediction_market:!1,core_exchange_rate:{quote:{asset_id:null,amount:1},base:{asset_id:"1.3.0",amount:1}},bitasset_opts:{feed_lifetime_sec:86400,minimum_feeds:7,force_settlement_delay_sec:86400,force_settlement_offset_percent:1*Ae().GRAPHENE_1_PERCENT,maximum_force_settlement_volume:20*Ae().GRAPHENE_1_PERCENT,short_backing_asset:"1.3.0"},marketInput:""}}_getPermissions(e){return{flagBooleans:L.A.getFlagBooleans(0,e.isBitAsset),permissionBooleans:L.A.getFlagBooleans("all",e.isBitAsset)}}_createAsset(e){e.preventDefault();let{update:t,flagBooleans:s,permissionBooleans:a,core_exchange_rate:n,isBitAsset:i,is_prediction_market:o,bitasset_opts:r}=this.state,{account:l}=this.props,c=L.A.getFlags(s,i),d=L.A.getPermissions(a,i);this.state.marketInput!==t.description.market&&(t.description.market="");let h=JSON.stringify(t.description);A.A.createAsset(l.get("id"),t,c,d,n,i,o,r,h).then((e=>{console.log("... AssetActions.createAsset(account_id, update)",l.get("id"),t,c,d)}))}_hasChanged(){return!S.A.are_equal_shallow(this.state,this.resetState(this.props))}_reset(e){e.preventDefault(),this.setState(this.resetState(this.props))}_forcePositive(e){return parseFloat(e)<0?"0":e}_onUpdateDescription(e,t){let{update:s}=this.state,a=!0;switch(e){case"condition":if(t.target.value.length>60)return void(a=!1);s.description[e]=t.target.value;break;case"short_name":if(t.target.value.length>32)return void(a=!1);s.description[e]=t.target.value;break;case"market":s.description[e]=t;break;case"visible":s.description[e]=!s.description[e];break;default:s.description[e]=t.target.value}a&&(this.forceUpdate(),this._validateEditFields(s))}onChangeBitAssetOpts(e,t){let{bitasset_opts:s,errors:a}=this.state;switch(e){case"force_settlement_offset_percent":case"maximum_force_settlement_volume":s[e]=parseFloat(t.target.value)*Ae().GRAPHENE_1_PERCENT;break;case"minimum_feeds":s[e]=parseInt(t.target.value,10);break;case"feed_lifetime_sec":case"force_settlement_delay_sec":console.log(t.target.value,parseInt(60*parseFloat(t.target.value),10)),s[e]=parseInt(60*parseFloat(t.target.value),10);break;case"short_backing_asset":s[e]=t;break;case"invalid":a.invalid_bitasset=t;break;default:s[e]=t.target.value}let n=!a.symbol&&!a.max_supply&&!a.invalid_bitasset;this.setState({isValid:n,errors:a})}_onUpdateInput(e,t){let{update:s,errors:a}=this.state,n=!1,i=S.A.get_asset_precision(this.state.update.precision);const o=t.target,r=o.selectionStart,l=o.value;switch(e){case"market_fee_percent":case"reward_percent":case"taker_fee_percent":case"precision":s[e]=this._forcePositive(o.value);break;case"max_market_fee":if(new(se())(l).times(i).gt(Ce))return a.max_market_fee="The number you tried to enter is too large",this.setState({errors:a});o.value=S.A.limitByPrecision(o.value,this.state.update.precision),s[e]=o.value;break;case"max_supply":n=!0,new RegExp(/[[:digit:]]/).test(o.value)||(o.value=o.value.replace(/[^0-9.]/g,"")),"."==o.value.charAt(0)&&(o.value="0."),o.value.charAt(o.value.length)!=o.value.search(".")&&o.value.substr(1),o.value=S.A.limitByPrecision(o.value,this.state.update.precision),s[e]=o.value;break;case"symbol":n=!0;const t=o.value.toUpperCase();let r=new RegExp("^[.A-Z0-9]+$");if(""!==t&&!r.test(t))break;U.ChainStore.getAsset(t),s[e]=this._forcePositive(t);break;default:s[e]=o.value}this.setState({update:s},(()=>{if(n){const t=r-(l.length-s[e].length);o.setSelectionRange(t,t)}})),this._validateEditFields(s)}_validateEditFields(e){let{errors:t}=this.state;t.max_supply=null,t.symbol=U.ChainValidation.is_valid_symbol_error(e.symbol),U.ChainStore.getAsset(e.symbol)&&(t.symbol=N().translate("account.user_issued_assets.exists"));try{t.max_supply=e.max_supply<=0?N().translate("account.user_issued_assets.max_positive"):new(se())(e.max_supply).times(Math.pow(10,e.precision)).gt(Ce)?N().translate("account.user_issued_assets.too_large"):null}catch(e){console.log("err:",e),t.max_supply=N().translate("account.user_issued_assets.too_large")}let s=!t.symbol&&!t.max_supply&&!t.invalid_bitasset;this.setState({isValid:s,errors:t})}_onFlagChange(e){let t=this.state.flagBooleans;t[e]=!t[e],this.setState({flagBooleans:t})}_onPermissionChange(e){let t=this.state.permissionBooleans;t[e]=!t[e],this.setState({permissionBooleans:t})}_onInputCoreAsset(e,t){"quote"===e?this.setState({quoteAssetInput:t}):"base"===e&&this.setState({baseAssetInput:t})}_onFoundCoreAsset(e,t){if(t){let s=this.state.core_exchange_rate;s[e].asset_id=t.get("id"),this.setState({core_exchange_rate:s}),this._validateEditFields({max_supply:this.state.max_supply,core_exchange_rate:s})}}_onInputMarket(e){this.setState({marketInput:e})}_onFoundMarketAsset(e){e&&this._onUpdateDescription("market",e.get("symbol"))}_onCoreRateChange(e,t){let s,a;if("quote"===e)s=S.A.limitByPrecision(t.target.value,this.state.update.precision),a=null;else{if(!t||!("amount"in t))return;s=""==t.amount?"0":S.A.limitByPrecision(t.amount.toString().replace(/,/g,""),this.props.core.get("precision")),a=t.asset.get("id")}let{core_exchange_rate:n}=this.state;n[e]={amount:s,asset_id:a},this.forceUpdate()}_onToggleBitAsset(){let{update:e}=this.state;this.state.isBitAsset=!this.state.isBitAsset,this.state.isBitAsset||(this.state.is_prediction_market=!1);let{flagBooleans:t,permissionBooleans:s}=this._getPermissions(this.state);this.state.flagBooleans=t,this.state.permissionBooleans=s,this.forceUpdate()}_onTogglePM(){this.state.is_prediction_market=!this.state.is_prediction_market,this.state.update.precision=this.props.core.get("precision"),this.state.core_exchange_rate.base.asset_id=this.props.core.get("id"),this.forceUpdate()}render(){let{globalObject:e,core:t}=this.props,{errors:s,isValid:n,update:i,flagBooleans:o,permissionBooleans:r,core_exchange_rate:l,is_prediction_market:c,isBitAsset:d,bitasset_opts:h}=this.state,m=i.symbol.length,p="N/A";3===m?p=a.createElement(C.A,{amount:(0,we.lE)("asset_create",["symbol3"],e),asset:"1.3.0"}):4===m?p=a.createElement(C.A,{amount:(0,we.lE)("asset_create",["symbol4"],e),asset:"1.3.0"}):m>4&&(p=a.createElement(C.A,{amount:(0,we.lE)("asset_create",["long_symbol"],e),asset:"1.3.0"}));let u=[],g=(e,t,s)=>a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(v(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none",textAlign:"right"}},a.createElement(B.Switch,{checked:s,onChange:t})))));for(let e in r)r[e]&&"charge_market_fee"!==e&&u.push(g(e,this._onFlagChange.bind(this,e),o[e]));u.push(g("visible",this._onUpdateDescription.bind(this,"visible"),!i.description.visible&&!1===i.description.visible));let _=[];for(let e in r)_.push(a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(v(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(B.Switch,{checked:r[e],onChange:this._onPermissionChange.bind(this,e)}))))));const b=a.createElement("div",null,a.createElement("button",{className:"button",onClick:this._reset.bind(this),value:N().translate("account.perm.reset")},a.createElement(v(),{content:"account.perm.reset"})),a.createElement("button",{className:ye()("button",{disabled:!n}),onClick:this._createAsset.bind(this)},a.createElement(v(),{content:"header.create_asset"})));return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement("div",{className:"tabs-header"},a.createElement("h3",null,a.createElement(v(),{content:"header.create_asset"}))),a.createElement(q.t,{setting:"createAssetTab",className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",contentClass:"grid-block shrink small-vertical medium-horizontal padding",segmented:!1,actionButtons:b},a.createElement(q.o,{title:"account.user_issued_assets.primary"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.symbol"}),a.createElement("input",{type:"text",value:i.symbol,onChange:this._onUpdateInput.bind(this,"symbol")})),s.symbol?a.createElement("p",{className:"grid-content has-error"},s.symbol):null,a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.max_supply"})," ",i.symbol?a.createElement("span",null,"(",i.symbol,")"):null,a.createElement("input",{type:"text",value:i.max_supply,onChange:this._onUpdateInput.bind(this,"max_supply")})),s.max_supply?a.createElement("p",{className:"grid-content has-error"},s.max_supply):null,a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.decimals"}),a.createElement("input",{min:"0",max:"8",step:"1",type:"range",value:i.precision,onChange:this._onUpdateInput.bind(this,"precision")})),a.createElement("p",null,i.precision),a.createElement("div",{style:{marginBottom:10},className:"txtlabel cancel"},a.createElement(v(),{content:"account.user_issued_assets.precision_warning"})),a.createElement("table",{className:"table",style:{width:"inherit"}},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none"}},a.createElement(v(),{content:"account.user_issued_assets.mpa"}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(B.Switch,{checked:d,onChange:this._onToggleBitAsset.bind(this)}))))),d?a.createElement("table",{className:"table",style:{width:"inherit"}},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none"}},a.createElement(v(),{content:"account.user_issued_assets.pm"}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(B.Switch,{checked:c,onChange:this._onTogglePM.bind(this)}))))):null,a.createElement(v(),{component:"h3",content:"account.user_issued_assets.core_exchange_rate"}),a.createElement("label",null,a.createElement("div",{className:"grid-block no-margin"},s.quote_asset?a.createElement("p",{className:"grid-content has-error"},s.quote_asset):null,s.base_asset?a.createElement("p",{className:"grid-content has-error"},s.base_asset):null,a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement("div",{className:"amount-selector",style:{width:"100%",paddingRight:"10px"}},a.createElement(v(),{component:"label",content:"account.user_issued_assets.quote"}),a.createElement("div",{className:"inline-label"},a.createElement("input",{type:"text",placeholder:"0.0",onChange:this._onCoreRateChange.bind(this,"quote"),value:l.quote.amount})))),a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.A,{label:"account.user_issued_assets.base",amount:l.base.amount,onChange:this._onCoreRateChange.bind(this,"base"),asset:l.base.asset_id,assets:[l.base.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingLeft:"10px"}}))),a.createElement("div",null,a.createElement("h5",null,a.createElement(v(),{content:"exchange.price"}),a.createElement("span",null,":"," ",S.A.format_number(S.A.get_asset_price(l.quote.amount*S.A.get_asset_precision(i.precision),{precision:i.precision},l.base.amount*S.A.get_asset_precision(t),t),2+(parseInt(i.precision,10)||8))),a.createElement("span",null," ",i.symbol,"/",t.get("symbol"))))),a.createElement("div",null,a.createElement(v(),{content:"account.user_issued_assets.cer_warning_1",component:"label",className:"has-error"}),a.createElement(v(),{content:"account.user_issued_assets.cer_warning_2",component:"p"})),a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",p))),a.createElement(q.o,{title:"account.user_issued_assets.description"},a.createElement("div",{className:"small-12 grid-content"},a.createElement(v(),{component:"label",content:"account.user_issued_assets.description"}),a.createElement("label",null,a.createElement("textarea",{style:{height:"7rem"},rows:"1",value:i.description.main,onChange:this._onUpdateDescription.bind(this,"main")})),a.createElement(v(),{component:"label",content:"account.user_issued_assets.short"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:i.description.short_name,onChange:this._onUpdateDescription.bind(this,"short_name")})),a.createElement(v(),{component:"label",content:"account.user_issued_assets.market"}),a.createElement(Ee.A,{label:"account.user_issued_assets.name",onChange:this._onInputMarket.bind(this),asset:this.state.marketInput,assetInput:this.state.marketInput,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundMarketAsset.bind(this)}),c?a.createElement("div",null,a.createElement(v(),{component:"h3",content:"account.user_issued_assets.condition"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:i.description.condition,onChange:this._onUpdateDescription.bind(this,"condition")})),a.createElement(v(),{component:"h3",content:"account.user_issued_assets.expiry"}),a.createElement("label",null,a.createElement("input",{type:"date",value:i.description.expiry,onChange:this._onUpdateDescription.bind(this,"expiry")}))):null)),d?a.createElement(q.o,{title:"account.user_issued_assets.bitasset_opts"},a.createElement(ke,{bitasset_opts:h,onUpdate:this.onChangeBitAssetOpts.bind(this),backingAsset:h.short_backing_asset,assetPrecision:i.precision,assetSymbol:i.symbol,isPredictionMarket:c})):null,a.createElement(q.o,{title:"account.permissions"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("div",{style:{maxWidth:800}},a.createElement(fe.A,{path:"components/AccountAssetCreate",section:"permissions"})),_)),a.createElement(q.o,{title:"account.user_issued_assets.flags"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("div",{style:{maxWidth:800}},a.createElement(fe.A,{path:"components/AccountAssetCreate",section:"flags"})),r.charge_market_fee?a.createElement("div",null,a.createElement("h3",null,a.createElement(v(),{component:"span",content:"account.user_issued_assets.market_fee",style:{paddingRight:"20px"}}),a.createElement(B.Switch,{checked:o.charge_market_fee,onChange:this._onFlagChange.bind(this,"charge_market_fee")})),a.createElement("div",{className:ye()({disabled:!o.charge_market_fee}),style:{marginTop:"10px",marginLeft:"30px"}},a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.taker_fee_percent"})," ","(%)",a.createElement("input",{type:"number",value:i.taker_fee_percent,onChange:this._onUpdateInput.bind(this,"taker_fee_percent")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.market_fee"})," ","(%)",a.createElement("input",{type:"number",value:i.market_fee_percent,onChange:this._onUpdateInput.bind(this,"market_fee_percent")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.max_market_fee"})," ","(",i.symbol,")",a.createElement("input",{type:"number",value:i.max_market_fee,onChange:this._onUpdateInput.bind(this,"max_market_fee")})),a.createElement("div",{className:ye()({disabled:!(i.market_fee_percent>0)})},a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.reward_percent"})," ","(%)",a.createElement("input",{type:"number",value:i.reward_percent,onChange:this._onUpdateInput.bind(this,"reward_percent")}))),s.max_market_fee?a.createElement("p",{className:"grid-content has-error"},s.max_market_fee):null)):null,a.createElement("h3",null,a.createElement(v(),{content:"account.user_issued_assets.flags"})),u))))))}}Se=(0,c.A)(Se);class xe extends a.Component{static propTypes={globalObject:l.A.ChainObject.isRequired,opType:y().string,options:y().array};static defaultProps={globalObject:"2.0.0",options:[]};getFee(){return(0,we.lE)(this.props.opType,this.props.options,this.props.globalObject)}render(){let{opType:e,options:t,globalObject:s}=this.props;if(!e||!t||!s)return null;let n=(0,we.lE)(e,t,s);return a.createElement(C.A,{amount:n,asset:"1.3.0"})}}const Ne=(0,c.A)(xe);var Me=s(32853),Ie=s(63024),Pe=s(24873),Be=s(84259);class Te extends a.Component{constructor(e){super(),this.state={listType:e.assetWhiteListType,accountTable:-1===e.assetWhiteListType.indexOf("markets"),listTypes:["whitelist_authorities","blacklist_authorities","whitelist_markets","blacklist_markets","whitelist_market_fee_sharing"],assetInput:null,asset_id:null}}renderAccountTables(){const{listType:e}=this.state;let t=!1,s="explorer.asset.whitelist.enable_flag";return"whitelist_market_fee_sharing"===e?this.props.marketFeeEnabled||(t=!0,s="explorer.asset.whitelist.market_fee_enable_flag"):t=!this.props.whiteListEnabled,t?a.createElement("div",null,a.createElement(v(),{className:"txtlabel cancel",component:"p",content:s})):a.createElement("div",null,a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(v(),{content:"explorer.account.title"})),a.createElement("th",null,a.createElement(v(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props[e].map((t=>a.createElement("tr",{key:t},a.createElement("td",null,a.createElement(Ie.A,{account:t})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,e,"remove",t)},a.createElement(V.A,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(I.A,{label:`account.whitelist.${e}`,accountName:this.props.authority_name,account:this.props.authority_name,onChange:this.props.onAccountNameChanged.bind(this,"authority_name"),onAccountChanged:this.props.onAccountChanged.bind(this,"new_authority_id"),error:null,tabIndex:1,action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,e,"add",this.props.new_authority_id)})))}_onAssetChange(e){this.setState({assetInput:e})}_onAssetFound(e){this.setState({asset_id:e?e.get("id"):null})}renderMarketTable(){const{listType:e}=this.state;return a.createElement("div",null,a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(v(),{content:"explorer.asset.title"})),a.createElement("th",null,a.createElement(v(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props[e].map((t=>a.createElement("tr",{key:t},a.createElement("td",null,a.createElement(Pe.A,{asset:t})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,e,"remove",t)},a.createElement(V.A,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(Ee.A,{label:`explorer.asset.whitelist.${e}`,onChange:this._onAssetChange.bind(this),asset:this.state.assetInput,assetInput:this.state.assetInput,tabIndex:1,style:{width:"100%"},onFound:this._onAssetFound.bind(this),action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,e,"add",this.state.asset_id)})))}_onSwitchType(e){this.setState({listType:e,accountTable:-1===e.indexOf("markets")}),Be.A.changeViewSetting({assetWhiteListType:e})}render(){const{accountTable:e,listType:t}=this.state,s=this.state.listTypes.indexOf(this.state.listType);return a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("div",null,a.createElement("div",{className:"header-selector",style:{paddingBottom:"2rem"}},a.createElement("div",{className:"selector"},this.state.listTypes.map(((e,t)=>a.createElement("div",{key:e,className:ye()("inline-block",{inactive:s!==t}),onClick:this._onSwitchType.bind(this,e)},a.createElement(v(),{content:`explorer.asset.whitelist.${e}`})))))),e?this.renderAccountTables():this.renderMarketTable(),this.props.children))}}const Oe=(0,d.N)(Te,{listenTo:()=>[o.A],getProps:()=>({assetWhiteListType:o.A.getState().viewSettings.get("assetWhiteListType","whitelist_authorities")})});class Fe extends a.Component{constructor(e){super(e),this.state={producer_name:null}}onAccountChanged(e){this.setState({new_producer_id:e?e.get("id"):null})}onAccountNameChanged(e){this.setState({producer_name:e})}render(){const{witnessFed:e,committeeFed:t}=this.props;return e||t?a.createElement("div",{className:"grid-content small-12 large-8 large-offset-2"},a.createElement(v(),{component:"p",content:"account.user_issued_assets.feed_not_allowed_1",className:"has-error"}),a.createElement(v(),{component:"p",content:"account.user_issued_assets.feed_not_allowed_2"})):a.createElement("div",{className:"grid-content small-12 large-8 large-offset-2"},a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null),a.createElement("th",{style:{textAlign:"left"}},a.createElement(v(),{content:"explorer.account.title"})),a.createElement("th",null,a.createElement(v(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props.producers.map(((e,t)=>a.createElement("tr",{key:e},a.createElement("td",{style:{textAlign:"left"}},"#",t+1),a.createElement("td",{style:{textAlign:"left"}},a.createElement(Ie.A,{account:e})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,"remove",e)},a.createElement(V.A,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(I.A,{label:"account.user_issued_assets.add_feed",accountName:this.state.producer_name,account:this.state.producer_name,onChange:this.onAccountNameChanged.bind(this),onAccountChanged:this.onAccountChanged.bind(this),error:null,tabIndex:1,action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,"add",this.state.new_producer_id)})))}}function Le(){return Le=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Le.apply(this,arguments)}let Re=new(se())(Ae().GRAPHENE_MAX_SHARE_SUPPLY);const qe=()=>{B.Notification.error({message:N().translate("account.user_issued_assets.invalid_backing_asset_change")})};class Ve extends a.Component{static propTypes={globalObject:l.A.ChainObject.isRequired};static defaultProps={globalObject:"2.0.0"};constructor(e){super(e),this.state=this.resetState(e),this.showAssetUpdateConfirmationModal=this.showAssetUpdateConfirmationModal.bind(this),this.hideAssetUpdateConfirmationModal=this.hideAssetUpdateConfirmationModal.bind(this)}_openConfirm(){this.showAssetUpdateConfirmationModal()}_cancelConfirm(){this.hideAssetUpdateConfirmationModal()}resetState(e){let t=e.asset.toJS(),s=void 0!==t.bitasset_data_id,a=S.A.get_asset_precision(t.precision),n=S.A.get_asset_precision(e.core.get("precision")),i=new(se())(t.options.max_market_fee).div(a).toString(),o=new(se())(t.options.max_supply).div(a).toString(),r=t.options.core_exchange_rate;r.quote.amount=r.quote.asset_id===t.id?new(se())(r.quote.amount).div(a).toString():new(se())(r.quote.amount).div(n).toString(),r.base.amount=r.base.asset_id===t.id?new(se())(r.base.amount).div(a).toString():new(se())(r.base.amount).div(n).toString();let l=L.A.getFlagBooleans(t.options.flags,s),c=L.A.getFlagBooleans(t.options.issuer_permissions,s);t.options.market_fee_percent/=100,null!==t.options.extensions&&null!==t.options.extensions.reward_percent&&(t.options.extensions.reward_percent/=100),null!==t.options.extensions&&null!==t.options.extensions.taker_fee_percent&&(t.options.extensions.taker_fee_percent/=100);let d=U.ChainStore.getAsset(r.quote.asset_id).get("symbol"),h=U.ChainStore.getAsset(r.base.asset_id).get("symbol"),m=e.asset.getIn(["options","extensions","whitelist_market_fee_sharing"]),p=e.asset.getIn(["options","extensions","reward_percent"]),u=e.asset.getIn(["options","extensions","taker_fee_percent"]);return{isAssetUpdateConfirmationModalVisible:!1,update:{max_supply:o,max_market_fee:i,reward_percent:void 0===p?void 0:t.options.extensions.reward_percent,taker_fee_percent:void 0===u?void 0:t.options.extensions.taker_fee_percent,market_fee_percent:t.options.market_fee_percent,description:L.A.parseDescription(t.options.description)},core_exchange_rate:r,issuer:t.issuer,new_issuer_account_id:null,new_funder_account:e.account.get("id"),asset_to_update:t.id,errors:{max_supply:null},new_authority_id:null,authority_name:null,isValid:!0,flagBooleans:l,permissionBooleans:c,isBitAsset:s,coreRateQuoteAssetName:d,quoteAssetInput:d,coreRateBaseAssetName:h,baseAssetInput:h,claimFeesAmount:0,bitasset_opts:s?t.bitasset.options:null,original_bitasset_opts:s?e.asset.getIn(["bitasset","options"]).toJS():null,marketInput:"",whitelist_authorities:e.asset.getIn(["options","whitelist_authorities"]),blacklist_authorities:e.asset.getIn(["options","blacklist_authorities"]),whitelist_markets:e.asset.getIn(["options","whitelist_markets"]),whitelist_market_fee_sharing:m,blacklist_markets:e.asset.getIn(["options","blacklist_markets"]),maxFeedProducers:e.globalObject.getIn(["parameters","maximum_asset_feed_publishers"]),feedProducers:s?e.asset.getIn(["bitasset","feeds"],[]).map((e=>e.first())):null,originalFeedProducers:s?e.asset.getIn(["bitasset","feeds"],[]).map((e=>e.first())):null}}hideAssetUpdateConfirmationModal(){this.setState({isAssetUpdateConfirmationModalVisible:!1})}showAssetUpdateConfirmationModal(){this.setState({isAssetUpdateConfirmationModalVisible:!0})}assetChanged(){let e=this.state,t=this.resetState(this.props);return JSON.stringify(e.update)!==JSON.stringify(t.update)||JSON.stringify(e.core_exchange_rate)!==JSON.stringify(t.core_exchange_rate)||null!==e.new_issuer_account_id&&e.new_issuer_account_id!==e.issuer||JSON.stringify(e.flagBooleans)!==JSON.stringify(t.flagBooleans)||JSON.stringify(e.permissionBooleans)!==JSON.stringify(t.permissionBooleans)||JSON.stringify(e.whitelist_authorities)!==JSON.stringify(t.whitelist_authorities)||JSON.stringify(e.blacklist_authorities)!==JSON.stringify(t.blacklist_authorities)||JSON.stringify(e.whitelist_markets)!==JSON.stringify(t.whitelist_markets)||JSON.stringify(e.blacklist_markets)!==JSON.stringify(t.blacklist_markets)||JSON.stringify(e.whitelist_market_fee_sharing)!==JSON.stringify(t.whitelist_market_fee_sharing)}tabChanged(e){let t=this.tabsChanged();return!!t[e]&&t[e]}tabsChanged(){let e=this.state,t=this.resetState(this.props),s=[];return e.update.max_supply===t.update.max_supply&&e.core_exchange_rate.base.amount===t.core_exchange_rate.base.amount&&e.core_exchange_rate.quote.amount===t.core_exchange_rate.quote.amount||(s[0]=!0),JSON.stringify(e.whitelist_authorities)===JSON.stringify(t.whitelist_authorities)&&JSON.stringify(e.blacklist_authorities)===JSON.stringify(t.blacklist_authorities)&&JSON.stringify(e.whitelist_markets)===JSON.stringify(t.whitelist_markets)&&JSON.stringify(e.blacklist_markets)===JSON.stringify(t.blacklist_markets)&&JSON.stringify(e.whitelist_market_fee_sharing)===JSON.stringify(t.whitelist_market_fee_sharing)||(s[1]=!0),e.update.description.main===t.update.description.main&&e.update.description.short_name===t.update.description.short_name&&e.update.description.market===t.update.description.market||(s[2]=!0),JSON.stringify(e.bitasset_opts)!==JSON.stringify(t.original_bitasset_opts)&&(s[3]=!0),JSON.stringify(e.permissionBooleans)!==JSON.stringify(t.permissionBooleans)&&(s[4]=!0),JSON.stringify(e.flagBooleans)===JSON.stringify(t.flagBooleans)&&e.update.market_fee_percent===t.update.market_fee_percent&&e.update.max_market_fee===t.update.max_market_fee&&e.update.reward_percent===t.update.reward_percent&&e.update.taker_fee_percent===t.update.taker_fee_percent||(s[5]=!0),JSON.stringify(e.feedProducers)!==JSON.stringify(t.originalFeedProducers)&&(s[6]=!0),s}pageChanged(){let{isBitAsset:e,bitasset_opts:t,original_bitasset_opts:s,feedProducers:a,originalFeedProducers:n}=this.state;return this.assetChanged()||e&&(JSON.stringify(t)!==JSON.stringify(s)||!S.A.are_equal_shallow(a.toJS(),n.toJS()))}_updateAsset(e){e.preventDefault(),this.hideAssetUpdateConfirmationModal();let{update:t,issuer:s,new_issuer_account_id:a,core_exchange_rate:n,flagBooleans:i,permissionBooleans:o,isBitAsset:r,bitasset_opts:l,original_bitasset_opts:c,feedProducers:d,originalFeedProducers:h}=this.state,m=L.A.getFlags(i);128&this.props.asset.getIn(["options","flags"])&&!(128&this.props.asset.getIn(["options","issuer_permissions"]))&&(m+=128);let p=L.A.getPermissions(o,r);this.state.marketInput!==t.description.market&&(t.description.market="");let u=JSON.stringify(t.description),g={whitelist_authorities:this.state.whitelist_authorities,blacklist_authorities:this.state.blacklist_authorities,whitelist_markets:this.state.whitelist_markets,blacklist_markets:this.state.blacklist_markets,whitelist_market_fee_sharing:this.state.whitelist_market_fee_sharing},_=r?d.toJS():null,b=r?h.toJS():null;A.A.updateAsset(s,a,t,n,this.props.asset,m,p,r,l,c,u,g,_,b,this.assetChanged()).then((()=>{console.log("... AssetActions.updateAsset(account_id, update)",s,a,this.props.asset.get("id"),t),setTimeout((()=>{U.ChainStore.getAsset(this.props.asset.get("id")),this.setState(this.resetState(this.props))}),3e3)}))}_reset(e){e.preventDefault(),this.setState(this.resetState(this.props))}_forcePositive(e){return parseFloat(e)<0?"0":e}_onUpdateDescription(e,t){let{update:s}=this.state,a=!0;switch(e){case"condition":if(t.target.value.length>60)return void(a=!1);s.description[e]=t.target.value;break;case"short_name":if(t.target.value.length>32)return void(a=!1);s.description[e]=t.target.value;break;case"market":s.description[e]=t;break;case"visible":s.description[e]=!s.description[e];break;default:s.description[e]=t.target.value}a&&(this.forceUpdate(),this._validateEditFields(s))}onChangeBitAssetOpts(e,t){let{bitasset_opts:s}=this.state;switch(e){case"force_settlement_offset_percent":case"maximum_force_settlement_volume":s[e]=parseFloat(t.target.value)*Ae().GRAPHENE_1_PERCENT;break;case"feed_lifetime_sec":case"force_settlement_delay_sec":console.log(t.target.value,parseInt(60*parseFloat(t.target.value),10)),s[e]=parseInt(60*parseFloat(t.target.value),10);break;case"short_backing_asset":s[e]=t;break;case"minimum_feeds":s[e]=parseInt(t.target.value,10)}this.forceUpdate()}_onUpdateInput(e,t){let{update:s}=this.state,a=!0,n=S.A.get_asset_precision(this.props.asset.get("precision"));switch(e){case"market_fee_percent":case"reward_percent":case"taker_fee_percent":s[e]=this._forcePositive(t.target.value);break;case"max_market_fee":let i=t.amount.replace(/,/g,"");if(new(se())(i).times(n).gt(Re))return a=!1,this.setState({errors:{max_market_fee:"The number you tried to enter is too large"}});s[e]=S.A.limitByPrecision(i,this.props.asset.get("precision"));break;case"max_supply":let o=t.amount.replace(/,/g,"");s[e]=S.A.limitByPrecision(o,this.props.asset.get("precision"));break;default:s[e]=t.target.value}a&&(this.setState({update:s}),this._validateEditFields(s))}_validateEditFields(e){let t=e.core_exchange_rate,s=e.feedProducers?e.feedProducers:this.state.feedProducers,a=this.state.flagBooleans,{asset:n,core:i}=this.props,o={max_supply:null,quote_asset:null,base_asset:null,max_feed_producer:null,conflict_producer:null,invalid_market_pair:null};const r=this.props.asset.get("precision");try{o.max_supply=e.max_supply<=0?N().translate("account.user_issued_assets.max_positive"):new(se())(parseInt(e.max_supply,10)).times(Math.pow(10,r)).gt(Re)?N().translate("account.user_issued_assets.too_large"):null}catch(e){console.log("err:",e),o.max_supply=N().translate("account.user_issued_assets.too_large")}t&&(t.quote.asset_id!==n.get("id")&&t.base.asset_id!==n.get("id")&&(o.quote_asset=N().translate("account.user_issued_assets.need_asset",{name:n.get("symbol")})),t.quote.asset_id!==i.get("id")&&t.base.asset_id!==i.get("id")&&(o.base_asset=N().translate("account.user_issued_assets.need_asset",{name:i.get("symbol")}))),s&&s.size>this.state.maxFeedProducers&&(o.max_feed_producer=N().translate("account.user_issued_assets.too_many_feed",{max:this.state.maxFeedProducers})),a.committee_fed_asset&&a.witness_fed_asset&&(o.conflict_producer=N().translate("account.user_issued_assets.conflict_feed")),this.state.marketInput==this.props.asset.get("symbol")&&(o.invalid_market_pair=N().translate("account.user_issued_assets.invalid_market_pair"));let l=!(o.invalid_market_pair||o.max_supply||o.base_asset||o.quote_asset||o.max_feed_producer||o.conflict_producer);this.setState({isValid:l,errors:o})}_onCoreRateChange(e,t){t.amount=""==t.amount?"0":t.amount.replace(/,/g,""),t.amount=S.A.limitByPrecision(t.amount,t.asset.get("precision"));let{core_exchange_rate:s}=this.state;s[e]={amount:t.amount,asset_id:t.asset.get("id")},this.forceUpdate()}onAccountChanged(e,t){this.setState({[e]:t?t.get("id"):null})}onAccountNameChanged(e,t){this.setState({[e]:t})}_onInputCoreAsset(e,t){"quote"===e?this.setState({quoteAssetInput:t}):"base"===e&&this.setState({baseAssetInput:t})}_onFoundCoreAsset(e,t){if(t){let s=this.state.core_exchange_rate;s[e].asset_id=t.get("id"),this.setState({core_exchange_rate:s}),this._validateEditFields({max_supply:this.state.max_supply,core_exchange_rate:s})}}_onInputMarket(e){this.setState({marketInput:e})}_onFoundMarketAsset(e){e&&this._onUpdateDescription("market",e.get("symbol"))}_onFlagChange(e){let t=this.state.flagBooleans;t[e]=!t[e],this.setState({flagBooleans:t}),this._validateEditFields({})}_getCurrentSupply(){const{asset:e,getDynamicObject:t}=this.props;return t&&t(e.get("dynamic_asset_data_id")).get("current_supply")}_onPermissionChange(e){const{isBitAsset:t,permissionBooleans:s}=this.state,a=!L.A.getFlagBooleans(this.props.asset.getIn(["options","issuer_permissions"]),t)[e];if(this._getCurrentSupply()>0&&a)return void B.Notification.error({message:N().translate("account.user_issued_assets.invalid_permissions_change")});let n=s;n[e]=!n[e],this.setState({permissionBooleans:n})}_onClaimInput(e){this.setState({claimFeesAmount:e.amount})}onChangeList(e,t="add",s){let a=this.state[e];void 0===a&&(a=new(p().List)([])),"add"!==t||a.includes(s)?"remove"===t&&a.includes(s)&&(a=a.remove(a.indexOf(s))):a=a.push(s),this.setState({[e]:a})}onChangeFeedProducerList(e="add",t){let s=this.state.feedProducers;"add"!==e||s.includes(t)?"remove"===e&&s.includes(t)&&(s=s.remove(s.indexOf(t))):s=s.push(t),this.setState({feedProducers:s}),this._validateEditFields({feedProducers:s})}render(){let{asset:e}=this.props,{errors:t,isValid:s,update:n,core_exchange_rate:i,flagBooleans:o,permissionBooleans:r,claimFeesAmount:l,isBitAsset:c,bitasset_opts:d}=this.state,h=e.get("symbol"),m="N/A";m=a.createElement(Ne,{opType:"asset_update"});let u=U.ChainStore.getAsset(i.quote.asset_id),g=S.A.get_asset_precision(u.get("precision")),_=U.ChainStore.getAsset(i.base.asset_id),b=S.A.get_asset_precision(_.get("precision")),y=parseFloat(i.quote.amount)*g,f=parseFloat(i.base.amount)*b,E=L.A.getFlagBooleans(e.getIn(["options","issuer_permissions"]),void 0!==e.get("bitasset")),A=[],w=(e,t,s)=>a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(v(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none",textAlign:"right"}},a.createElement(B.Switch,{checked:s,onChange:t})))));for(let e in E)E[e]&&"charge_market_fee"!==e&&A.push(w(e,this._onFlagChange.bind(this,e),o[e]));A.push(w("visible",this._onUpdateDescription.bind(this,"visible"),!n.description.visible&&!1===n.description.visible));let C=[];for(let e in E)C.push(a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(v(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(B.Switch,{checked:r[e],onChange:this._onPermissionChange.bind(this,e)}))))));let k=0;this.tabsChanged().forEach((function(){k++}));let x=a.createElement("div",null,a.createElement("button",{className:ye()("button",{disabled:!s||!this.pageChanged()}),style:{width:"9rem"},onClick:k>1?this._openConfirm.bind(this):this._updateAsset.bind(this)},k>1?a.createElement(v(),{content:"account.perm.save_all"}):a.createElement(v(),{content:"account.perm.save"})),a.createElement("button",{className:ye()("button primary hollow",{disabled:!this.pageChanged()}),onClick:this._reset.bind(this)},a.createElement(v(),{content:"account.perm.reset"}))),M=!1;"1.3.0"!==u.get("id")&&"1.3.0"!==_.get("id")||u.get("id")!==e.get("id")&&_.get("id")!==e.get("id")||(M=!0);let I=e.getIn(["bitasset","is_prediction_market"]),T=L.A.parseDescription(this.props.asset.toJS().options.description);return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement("div",{className:"tabs-header"},a.createElement("h3",null,a.createElement(v(),{content:"header.update_asset"}),":"," ",h)),a.createElement(q.t,{setting:"updateAssetTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"grid-block padding-top shrink small-vertical medium-horizontal",segmented:!1,actionButtons:x,onChangeTab:e=>{this.setState({activeTab:e})}},a.createElement(q.o,{title:"account.user_issued_assets.primary",updatedTab:this.tabChanged(0)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.precision"}),a.createElement("span",null,": ",e.get("precision"))),a.createElement("br",null),a.createElement("label",null,a.createElement(P.A,{label:"account.user_issued_assets.max_supply",amount:n.max_supply,onChange:this._onUpdateInput.bind(this,"max_supply"),asset:e.get("id"),assets:[e.get("id")],placeholder:"0.0",tabIndex:1})),t.max_supply?a.createElement("p",{className:"grid-content has-error"},t.max_supply):null,a.createElement(v(),{component:"h3",content:"account.user_issued_assets.core_exchange_rate"}),a.createElement("label",null,a.createElement("div",{className:"grid-block no-margin"},M?null:a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(Ee.A,{label:"account.user_issued_assets.quote_name",onChange:this._onInputCoreAsset.bind(this,"quote"),asset:this.state.quoteAssetInput,assetInput:this.state.quoteAssetInput,tabIndex:1,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundCoreAsset.bind(this,"quote")})),M?null:a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(Ee.A,{label:"account.user_issued_assets.base_name",onChange:this._onInputCoreAsset.bind(this,"base"),asset:this.state.baseAssetInput,assetInput:this.state.baseAssetInput,tabIndex:1,style:{width:"100%",paddingLeft:"10px"},onFound:this._onFoundCoreAsset.bind(this,"base")})),t.quote_asset?a.createElement("p",{className:"grid-content has-error"},t.quote_asset):null,t.base_asset?a.createElement("p",{className:"grid-content has-error"},t.base_asset):null,a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.A,{label:"account.user_issued_assets.quote",amount:i.quote.amount,onChange:this._onCoreRateChange.bind(this,"quote"),asset:i.quote.asset_id,assets:[i.quote.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingRight:"10px"}})),a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.A,{label:"account.user_issued_assets.base",amount:i.base.amount,onChange:this._onCoreRateChange.bind(this,"base"),asset:i.base.asset_id,assets:[i.base.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingLeft:"10px"}}))),a.createElement("div",null,a.createElement("h5",null,a.createElement(v(),{content:"exchange.price"}),":"," ",a.createElement(Me.A,{style:{fontWeight:"bold"},quote_amount:y,quote_asset:i.quote.asset_id,base_asset:i.base.asset_id,base_amount:f})))),a.createElement("div",null,a.createElement(v(),{content:"account.user_issued_assets.cer_warning_1",component:"label",className:"has-error"}),a.createElement(v(),{content:"account.user_issued_assets.cer_warning_2",component:"p"})),a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(q.o,{title:"account.whitelist.title",updatedTab:this.tabChanged(1)},a.createElement(Oe,{whiteListEnabled:o.white_list,marketFeeEnabled:o.charge_market_fee,whitelist_authorities:this.state.whitelist_authorities,blacklist_authorities:this.state.blacklist_authorities,whitelist_markets:this.state.whitelist_markets,whitelist_market_fee_sharing:void 0===this.state.whitelist_market_fee_sharing?new(p().List)([]):this.state.whitelist_market_fee_sharing,blacklist_markets:this.state.blacklist_markets,new_authority_id:this.state.new_authority_id,authority_name:this.state.authority_name,onAccountNameChanged:this.onAccountNameChanged.bind(this),onAccountChanged:this.onAccountChanged.bind(this),onChangeList:this.onChangeList.bind(this)},a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(q.o,{title:"account.user_issued_assets.description",updatedTab:this.tabChanged(2)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("label",null,a.createElement("textarea",{style:{height:"7rem"},rows:"1",value:n.description.main||"",onChange:this._onUpdateDescription.bind(this,"main")})),a.createElement(v(),{component:"h3",content:"account.user_issued_assets.short"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:n.description.short_name||"",onChange:this._onUpdateDescription.bind(this,"short_name")})),a.createElement(v(),{component:"h3",content:"account.user_issued_assets.market"}),a.createElement(Ee.A,{label:"account.user_issued_assets.name",onChange:this._onInputMarket.bind(this),placeholder:T.market,asset:this.state.marketInput,assetInput:this.state.marketInput,style:{width:"100%",paddingRight:"10px",paddingBottom:"20px"},onFound:this._onFoundMarketAsset.bind(this)}),t.invalid_market_pair?a.createElement("p",{className:"grid-content has-error"},t.invalid_market_pair):null,I?a.createElement("div",null,a.createElement(v(),{component:"h3",content:"account.user_issued_assets.condition"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:n.description.condition,onChange:this._onUpdateDescription.bind(this,"condition")})),a.createElement(v(),{component:"h3",content:"account.user_issued_assets.expiry"}),a.createElement("label",null,a.createElement("input",{type:"date",value:n.description.expiry,onChange:this._onUpdateDescription.bind(this,"expiry")}))):null,a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),c?a.createElement(q.o,{title:"account.user_issued_assets.bitasset_opts",updatedTab:this.tabChanged(3)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement(ke,{bitasset_opts:d,onUpdate:this.onChangeBitAssetOpts.bind(this),backingAsset:d.short_backing_asset,assetPrecision:e.get("precision"),assetSymbol:e.get("symbol"),disableBackingAssetChange:this._getCurrentSupply()>0,disabledBackingAssetChangeCallback:qe}),a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m))):null,a.createElement(q.o,{title:"account.permissions",updatedTab:this.tabChanged(4)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement(fe.A,{path:"components/AccountAssetCreate",section:"permissions"}),a.createElement("p",{className:"grid-content has-error"},a.createElement(v(),{content:"account.user_issued_assets.perm_warning"})),C,a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(q.o,{title:"account.user_issued_assets.flags",updatedTab:this.tabChanged(5)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement(fe.A,{path:"components/AccountAssetCreate",section:"flags"}),E.charge_market_fee?a.createElement("div",null,a.createElement("h3",null,a.createElement(v(),{component:"span",content:"account.user_issued_assets.market_fee",style:{paddingRight:"20px"}}),a.createElement(B.Switch,{checked:o.charge_market_fee,onChange:this._onFlagChange.bind(this,"charge_market_fee")})),a.createElement("div",{className:ye()({disabled:!o.charge_market_fee}),style:{marginTop:"10px",marginLeft:"30px"}},a.createElement("label",null,a.createElement(B.Tooltip,{title:N().translate("account.user_issued_assets.taker_fee_percent_tooltip")},a.createElement(v(),{content:"account.user_issued_assets.taker_fee_percent"})," ","(%)"),a.createElement("input",{type:"number",value:n.taker_fee_percent,onChange:this._onUpdateInput.bind(this,"taker_fee_percent")})),a.createElement("label",null,a.createElement(v(),{content:"account.user_issued_assets.market_fee"})," ","(%)",a.createElement("input",{type:"number",value:n.market_fee_percent,onChange:this._onUpdateInput.bind(this,"market_fee_percent")})),a.createElement("label",null,a.createElement(P.A,{label:"account.user_issued_assets.max_market_fee",amount:n.max_market_fee,onChange:this._onUpdateInput.bind(this,"max_market_fee"),asset:e.get("id"),assets:[e.get("id")],placeholder:"0.0",tabIndex:1})),a.createElement("div",null,a.createElement("label",null,a.createElement(B.Tooltip,{title:N().translate("account.user_issued_assets.reward_percent_tooltip")},a.createElement(v(),{content:"account.user_issued_assets.reward_percent"})," ","(%)"),a.createElement("input",{type:"number",value:n.reward_percent,onChange:this._onUpdateInput.bind(this,"reward_percent")}))),t.max_market_fee?a.createElement("p",{className:"grid-content has-error"},t.max_market_fee):null)):null,a.createElement("h3",null,a.createElement(v(),{content:"account.user_issued_assets.flags"})),A,a.createElement("p",null,a.createElement(v(),{content:"account.user_issued_assets.approx_fee"}),": ",m),t.conflict_producer?a.createElement("p",{className:"grid-content has-error"},t.conflict_producer):null)),c?a.createElement(q.o,{title:"account.user_issued_assets.feed_producers",updatedTab:this.tabChanged(6)},a.createElement(Fe,{asset:this.props.asset,account:this.props.account,witnessFed:o.witness_fed_asset,committeeFed:o.committee_fed_asset,producers:this.state.feedProducers,onChangeList:this.onChangeFeedProducerList.bind(this)}),t.max_feed_producer?a.createElement("p",{className:"grid-content has-error large-8 large-offset-2",style:{marginTop:"20px"}},t.max_feed_producer):null):null))),a.createElement(De,Le({visible:this.state.isAssetUpdateConfirmationModalVisible,hideModal:this.hideAssetUpdateConfirmationModal,showModal:this.showAssetUpdateConfirmationModal,tabsChanged:this.tabsChanged(),_cancelConfirm:this._cancelConfirm.bind(this),_updateAsset:this._updateAsset.bind(this)},this.props)))}}Ve=(0,c.A)(Ve),Ve=(0,R.A)(Ve,{propNames:["asset","core"],defaultProps:{core:"1.3.0"},withDynamic:!0});class De extends a.Component{constructor(){super()}render(){let{tabsChanged:e}=this.props;const t=[a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.props._updateAsset},N().translate("global.confirm")),a.createElement(B.Button,{key:"cancel",onClick:this.props.hideModal},N().translate("global.cancel"))];return a.createElement(B.Modal,{visible:this.props.visible,footer:t,onCancel:this.props.hideModal,title:N().translate("account.confirm_asset_modal.header")},a.createElement(v(),{content:"account.confirm_asset_modal.are_you_sure",component:"div",style:{paddingBottom:"1rem"}}),a.createElement("div",null,a.createElement("ul",null,e[0]?a.createElement("li",null,a.createElement(v(),{content:"account.user_issued_assets.primary"})):null,e[1]?a.createElement("li",null,a.createElement(v(),{content:"account.whitelist.title"})):null,e[2]?a.createElement("li",null,a.createElement(v(),{content:"account.user_issued_assets.description"})):null,e[3]?a.createElement("li",null,a.createElement(v(),{content:"account.user_issued_assets.bitasset_opts"})):null,e[4]?a.createElement("li",null,a.createElement(v(),{content:"account.permissions"})):null,e[5]?a.createElement("li",null,a.createElement(v(),{content:"account.user_issued_assets.flags"})):null,e[6]?a.createElement("li",null,a.createElement(v(),{content:"account.user_issued_assets.feed_producers"})):null)))}}class je extends a.Component{render(){let e=this.props.match.params.asset.toUpperCase();return a.createElement(Ve,Le({asset:e},this.props))}}const Ue=(0,g.y)(je);class We extends a.Component{static propTypes={stat_object:l.A.ChainObject.isRequired};render(){let e=this.props.stat_object.toJS();return this.props.plainText?a.createElement(C.A,{amount:parseFloat(e.lifetime_fees_paid),asset:"1.3.0"}):a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.fees_paid"})," "),a.createElement("td",null,a.createElement(C.A,{amount:parseFloat(e.lifetime_fees_paid),asset:"1.3.0"}))))}}const ze=(0,c.A)(We);var Ke=s(32382),Je=s(45964),He=s(18450);class Ge extends a.Component{constructor(e){super(e),this.state={referralsIndex:[],referralsCount:null,errorLoading:null}}static propTypes={account:l.A.ChainAccount.isRequired,gprops:l.A.ChainObject.isRequired,dprops:l.A.ChainObject.isRequired,core_asset:l.A.ChainAsset.isRequired};static defaultProps={gprops:"2.0.0",dprops:"2.1.0",core_asset:"1.3.0"};componentDidMount(){this._getReferrals(0,!0)}componentDidUpdate(e,t){e.account!==this.props.account&&this._getReferrals(0,!0)}async _getReferrals(e=0,t=!1){let{myHiddenAccounts:s,myActiveAccounts:a}=this.props,{referralsIndex:n,referralsCount:i}=this.state;if(0==He.NY.ES_WRAPPER_LIST.length)return;const o=He.NY.ES_WRAPPER_LIST[0].url;t&&(i=null,n=[]);try{if(!i){let e=await fetch(o+"/referrer_count?account_id="+this.props.account.get("id"));if(!e.ok)throw new Error("Could not reach referrer_count endpoint on ES wrapper"+o);this.setState({referralsCount:await e.json()})}let t=await fetch(o+"/all_referrers?account_id="+this.props.account.get("id")+"&page="+e);if(!t.ok)throw new Error("Could not reach all_referrers endpoint on ES wrapper"+o);let s=await t.json(),a=[];s.map((e=>{a.push(e.account_id)})),a.forEach((e=>{(0,U.FetchChain)("getAccount",e).then((e=>{let t=(e=e.toJS()).network_fee_percentage/100,s=e.lifetime_referrer_fee_percentage/100,a=(100-t-s)*e.referrer_rewards_percentage/1e4,i=100-a-s-t;n.push({id:e.id,name:e.name,lifetime_ref:{name:e.lifetime_referrer_name,value:s},registrar_ref:{name:e.registrar_name,value:i},affiliate_ref:{name:e.referrer_name,value:a},network:t,statistics:e.statistics,membership_expiration:null}),this.setState({referralsIndex:n})}))}))}catch(e){console.error(e),this.setState({errorLoading:!0})}}onPaginationChange(e){this._getReferrals(e-1)}render(){if(0==He.NY.ES_WRAPPER_LIST.length)return null;let e=this.props.account.toJS(),t=U.ChainStore.getAccount(e.lifetime_referrer,!1);t&&(e.lifetime_referrer_name=t.get("name"));let s=U.ChainStore.getAccount(e.referrer,!1);s&&(e.referrer_name=s.get("name"));let n=U.ChainStore.getAccount(e.registrar,!1);n&&(e.registrar_name=n.get("name"));let i=this.state.referralsIndex,o=[{key:"name",title:"Name",render:e=>a.createElement("span",null,a.createElement(f.N_,{to:`/account/${e.name}`},e.name))},{key:"statistics",title:a.createElement(v(),{content:"account.member.fees_paid"}),render:e=>a.createElement(ze,{plainText:!0,stat_object:e.statistics})},{key:"network",title:a.createElement(v(),{content:"account.member.network_percentage"}),render:e=>a.createElement("span",null,e.network,"%")},{key:"lifetime_ref",title:a.createElement(v(),{content:"account.member.lifetime_referrer"}),render:e=>a.createElement("span",null,e.lifetime_ref.value,"% (",a.createElement(f.N_,{to:`/account/${e.lifetime_ref.name}`},e.lifetime_ref.name),")")},{key:"registrar_ref",title:a.createElement(v(),{content:"account.member.registrar"}),render:e=>a.createElement("span",null,e.registrar_ref.value,"% (",a.createElement(f.N_,{to:`/account/${e.registrar_ref.name}`},e.registrar_ref.name),")")},{key:"affiliate_ref",title:a.createElement(v(),{content:"account.member.referrer"}),render:e=>a.createElement("span",null,e.affiliate_ref.value,"% (",a.createElement(f.N_,{to:`/account/${e.affiliate_ref.name}`},e.affiliate_ref.name),")")}];return this.state.errorLoading?a.createElement(v(),{content:"errors.loading_from_es"}):a.createElement(B.Table,{rowKey:"accountReferrals",columns:o,dataSource:i,pagination:{pageSize:Number(20),total:this.state.referralsCount<=this.state.referralsIndex.length?this.state.referralsIndex.length:this.state.referralsIndex.length+20,onChange:this.onPaginationChange.bind(this),showTotal:()=>a.createElement(v(),{content:"account.member.total_ref",total:this.state.referralsCount})}})}}Ge=(0,c.A)(Ge);const Ze=Ge=(0,d.N)(Ge,{listenTo:()=>[i.A],getProps:()=>({myActiveAccounts:i.A.getState().myActiveAccounts,myHiddenAccounts:i.A.getState().myHiddenAccounts})});class Qe extends a.Component{constructor(e){super(e)}static propTypes={account:l.A.ChainAccount.isRequired,gprops:l.A.ChainObject.isRequired,dprops:l.A.ChainObject.isRequired,core_asset:l.A.ChainAsset.isRequired};static defaultProps={gprops:"2.0.0",dprops:"2.1.0",core_asset:"1.3.0"};upgradeAccount(e,t,s){s.preventDefault(),n.A.upgradeAccount(e,t)}UNSAFE_componentWillMount(){h.A.getFinalFeeAsset(this.props.account,"account_upgrade")}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this.setState({referralsIndex:[]})}render(){let{gprops:e,dprops:t,core_asset:s}=this.props,n=this.props.account.toJS(),i=U.ChainStore.getAccount(n.lifetime_referrer,!1);i&&(n.lifetime_referrer_name=i.get("name"));let o=U.ChainStore.getAccount(n.referrer,!1);o&&(n.referrer_name=o.get("name"));let r=U.ChainStore.getAccount(n.registrar,!1);r&&(n.registrar_name=r.get("name"));let l=n.name,c=n.network_fee_percentage/100,d=n.lifetime_referrer_fee_percentage/100,h=(100-c-d)*n.referrer_rewards_percentage/1e4,m=100-h-d-c,p=e.getIn(["parameters","current_fees","parameters",8,1,"membership_lifetime_fee"])*e.getIn(["parameters","current_fees","scale"])/1e4,u=U.ChainStore.getAccountMemberStatus(this.props.account),g="account.member."+u,_=null;"annual"===u&&(_=a.createElement("span",null,"(",a.createElement(v(),{content:"account.member.expires"})," ",a.createElement(Ke.A,{time:n.membership_expiration_date}),")"));let b=n.membership_expiration_date;return"1969-12-31T23:59:59"===b?b="Never":"1970-01-01T00:00:00"===b&&(b="N/A"),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{segmented:!1,setting:"membershipTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding"},a.createElement(q.o,{title:"account.member.membership"},a.createElement("h3",null,a.createElement(v(),{content:g})," ",_),a.createElement("div",{className:"content-block no-margin"},a.createElement("div",{className:"no-margin grid-block vertical large-horizontal"},a.createElement("div",{className:"grid-block large-12"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-block"},"lifetime"===u?a.createElement("div",{className:"small-12 large-6",style:{paddingRight:10}},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.lifetime_title"})),a.createElement(v(),{component:"p",content:"account.member.referral_info",feesCashback:100-c}),a.createElement(v(),{component:"h4",content:"account.member.referral_link"}),a.createElement(v(),{component:"p",content:"account.member.referral_text",wallet_name:(0,Je.vj)()}),a.createElement("h5",null,(0,Je.ju)()+`/?r=${n.name}`))):a.createElement("div",{className:"small-12 large-6",style:{paddingRight:"10px !important"}},a.createElement(fe.A,{path:"components/AccountMembership",section:"lifetime",feesCashback:100-c,price:{amount:p,asset:s}}),a.createElement("br",null),a.createElement(B.Button,{type:"primary",onClick:this.upgradeAccount.bind(this,n.id,!0)},a.createElement(v(),{content:"account.member.upgrade_lifetime"}))," "," ",null),a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.fee_allocation"})),a.createElement("table",{className:"table key-value-table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.network_percentage"})),a.createElement("td",null,c,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.lifetime_referrer"})," "," (",a.createElement(f.N_,{to:`/account/${n.lifetime_referrer_name}`},n.lifetime_referrer_name),")"),a.createElement("td",null,d,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.registrar"})," "," (",a.createElement(f.N_,{to:`/account/${n.registrar_name}`},n.registrar_name),")"),a.createElement("td",null,m,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.referrer"})," "," (",a.createElement(f.N_,{to:`/account/${n.referrer_name}`},n.referrer_name),")"),a.createElement("td",null,h,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(v(),{content:"account.member.membership_expiration"})," "),a.createElement("td",null,b))))),a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.fees_cashback"})),a.createElement("table",{className:"table key-value-table"},a.createElement(ze,{stat_object:n.statistics})))))))),a.createElement("div",{className:"grid-block large-12"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-block"},a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.fee_pending"})),a.createElement(v(),{component:"p",content:"account.member.fee_pending_text",account:l,maintenanceInterval:e.getIn(["parameters","maintenance_interval"]),nextMaintenanceTime:t.get("next_maintenance_time")})),a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.fee_vesting"})),a.createElement(v(),{component:"p",content:"account.member.fee_vesting_text",account:l,vestingThresholdAmount:e.getIn(["parameters","cashback_vesting_threshold"])/Math.pow(10,s.get("precision")),vestingThresholdAsset:s.get("symbol"),vestingPeriod:e.getIn(["parameters","cashback_vesting_period_seconds"])/60/60/24}))),a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.fee_division"})),a.createElement(v(),{component:"p",content:"account.member.fee_division_text.paragraph_1",account:l,fee_share_network:c,fee_share_ltm:d,fee_share_affiliate:h,fee_share_registrar:m}),a.createElement(v(),{component:"p",content:"account.member.fee_division_text.paragraph_2",account:l,fee_share_network:c,fee_share_ltm:d,fee_share_affiliate:h,fee_share_registrar:m}),a.createElement(f.N_,{to:`/account/${l}/vesting`},a.createElement(v(),{component:"p",content:"account.member.fee_division_text.paragraph_3"})))))))))),"lifetime"==u&&He.NY.ES_WRAPPER_LIST.length>0?a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(v(),{content:"account.member.ref_distribution"})),a.createElement(Ze,{account:l})):null)))))}}const Ye=Qe=(0,c.A)(Qe);var Xe=s(32795),$e=s(72257);class et extends a.Component{constructor(e){super(e),this.state={vesting_balances:[],searchTerm:"",loading:!1,error:!1},this.onSearch=this.onSearch.bind(this),this.retrieveVestingBalances=this.retrieveVestingBalances.bind(this)}UNSAFE_componentWillMount(){this.retrieveVestingBalances.call(this,this.props.account.get("id"))}componentDidUpdate(e){let t=e.account.get("id"),s=this.props.account.get("id");s!==t&&this.retrieveVestingBalances.call(this,s)}retrieveVestingBalances(e){this.setState({loading:!0}),e=e||this.props.account.get("id"),X.Apis.instance().db_api().exec("get_vesting_balances",[e]).then((e=>{this.mapVestingBalances(e),this.setState({loading:!1})})).catch((e=>{console.log("error:",e),this.setState({loading:!1,error:!0})}))}mapVestingBalances(e){if(!e)return null;let t=e.filter((e=>e.balance.amount&&e.balance.asset_id));t=t.map((e=>{let t,s,a=0,n=0,i=0,o=0,r=!0,l=!0;if(e)if(s=e.balance.amount,t=U.ChainStore.getAsset(e.balance.asset_id),e.policy&&2!==e.policy[0]){let c=Math.floor(new Date(e.policy[1].start_claim+"Z").getTime()/1e3),d=Math.floor((new Date).getTime()/1e3);if(c>0){r=!1;let t=d-c,s=e.policy[1].vesting_seconds;t<s?(l=!1,n=parseFloat(t/86400).toFixed(2),i=parseFloat(s/86400).toFixed(2),o=(i-n).toFixed(2),a=0):a=1}else{let r=Math.floor(new Date(e.policy[1].coin_seconds_earned_last_update+"Z").getTime()/1e3),l=parseFloat(e.policy[1].coin_seconds_earned)+s*(d-r),c=e.policy[1].vesting_seconds;a=0===c?1:l/(c*s),a=a>1?1:a,n=S.A.format_number(S.A.get_asset_amount(l/86400,t),0),i=S.A.format_number(S.A.get_asset_amount(e.balance.amount*c/86400,t),0),o=S.A.format_number(c*(1-a)/86400||0,2)}}else l&&(a=1);return{key:e.id,vestingId:e.id,vestingType:e.balance_type,vestingBalance:{amount:e.balance.amount,asset:e.balance.asset_id},coinDaysRequired:{days_required:i,isCoinDays:r},coinDaysEarned:{days_earned:n,isCoinDays:r},coinDaysRemaining:{days_remaining:o,isCoinDays:r},availablePercent:a,canClaim:l,vb:e}})),this.setState({vesting_balances:t})}getHeader(){return[{title:"#",dataIndex:"vestingId",align:"left",defaultSortOrder:"ascend",sorter:(e,t)=>e.vestingId>t.vestingId?1:e.vestingId<t.vestingId?-1:0},{title:a.createElement(v(),{content:"account.member.balance_type"}),dataIndex:"vestingType",align:"left",sorter:(e,t)=>e.vestingType>t.vestingType?1:e.vestingType<t.vestingType?-1:0,render:e=>a.createElement("span",null,a.createElement(v(),{content:"account.vesting.type."+e}))},{title:a.createElement(v(),{content:"account.member.cashback"}),dataIndex:"vestingBalance",align:"left",render:e=>a.createElement(C.A,{amount:e.amount,asset:e.asset})},{title:a.createElement(v(),{content:"account.member.required"}),dataIndex:"coinDaysRequired",align:"left",render:e=>e.days_required?a.createElement("span",null,e.days_required," ",a.createElement(v(),{content:e.isCoinDays?"account.member.coindays":"account.member.days"})):null},{title:a.createElement(v(),{content:"account.member.earned"}),dataIndex:"coinDaysEarned",align:"left",render:e=>e.days_earned?a.createElement("span",null,e.days_earned," ",a.createElement(v(),{content:e.isCoinDays?"account.member.coindays":"account.member.days"})):null},{title:a.createElement(v(),{content:"account.member.remaining"}),dataIndex:"coinDaysRemaining",align:"left",render:e=>e.days_remaining?a.createElement("span",null,e.days_remaining," ",a.createElement(v(),{content:"account.member.days"})):null},{title:a.createElement(v(),{content:"account.member.available"}),dataIndex:"availablePercent",align:"left",render:e=>e?a.createElement("span",null,(100*e).toFixed(2),"%"):null},{title:a.createElement(v(),{content:"account.member.action"}),align:"center",render:e=>e.canClaim?a.createElement(B.Button,{onClick:()=>this.onClaim(e),type:"secondary"},a.createElement(v(),{content:"account.member.claim"})):null}]}onClaim({vb:e}){const t=this.props.account.get("id");Xe.A.claimVestingBalance(t,e,!1).then((()=>{this.retrieveVestingBalances()}))}onSearch(e){this.setState({searchTerm:e.target.value||""})}render(){const e=this.getHeader();let t=this.state.vesting_balances.filter((e=>-1!==`${e.vestingId}\0${e.vestingType}`.toUpperCase().indexOf(this.state.searchTerm.toUpperCase())));return a.createElement("div",{className:"grid-content vertical"},a.createElement(v(),{component:"h1",content:"account.vesting.title"}),a.createElement(v(),{content:"account.vesting.explain",component:"p"}),a.createElement("div",{className:"header-selector padding"},a.createElement(z.A,{onChange:this.onSearch.bind(this),value:this.state.searchTerm,autoComplete:"off",placeholder:N().translate("exchange.filter")}),this.state.error&&a.createElement(v(),{className:"header-selector--error",content:"errors.loading_from_blockchain"})),a.createElement("div",null,a.createElement($e.A,{loading:this.state.loading,rows:t,header:e,pageSize:10})))}}const tt=et;var st=s(10516),at=s(14670),nt=s(51579),it=s(20149);class ot extends a.Component{constructor(e){super(e),this.state=this._getInitialState(),this.onPasswordEnter=this.onPasswordEnter.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onCancel=this.onCancel.bind(this),this.onClose=this.onClose.bind(this)}_getInitialState(){return{isShowQrcode:!1,keyString:null}}onCancel(){this.props.hideModal(),this.onClose()}onClose(){this.refs.password_input&&(this.refs.password_input.value=""),this.setState(this._getInitialState())}onPasswordEnter(e){e.preventDefault();let t=this.refs.password_input.value,s=this.props.keyValue;if(null!=t&&""!=t){if(void 0!==s&&null!=s&&""!=s){let e=U.Aes.fromSeed(t).encryptToHex(s);this.setState({isShowQrcode:!0,keyString:e})}}else this.setState({isShowQrcode:!0,keyString:s})}onKeyDown(e){13===e.keyCode&&this.onPasswordEnter(e)}render(){let e=null;this.state.isShowQrcode&&(e={textAlign:"center"});const t=[];return this.state.isShowQrcode||t.push(a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.onPasswordEnter},N().translate("modal.ok"))),t.push(a.createElement(B.Button,{key:"cancel",onClick:this.onCancel},N().translate("cancel"))),a.createElement(B.Modal,{visible:this.props.visible,onCancel:this.onCancel,footer:t},a.createElement("div",{className:"text-center"},a.createElement("div",{style:{margin:"1.5rem 0"}},a.createElement(v(),{component:"h4",content:"modal.qrcode.title"})),a.createElement("form",{className:"full-width",style:{margin:"0 3.5rem"},onSubmit:this.onPasswordEnter,noValidate:!0},a.createElement("div",{className:"form-group"},this.state.isShowQrcode?a.createElement("section",{style:e},a.createElement("span",{style:{background:"#fff",padding:".75rem",display:"inline-block"}},a.createElement(Q(),{size:256,value:this.state.keyString}))):a.createElement("section",null,a.createElement("label",{className:"left-label"},a.createElement(v(),{unsafe:!0,content:"modal.qrcode.input_message"})),a.createElement("input",{name:"password",type:"text",onFocus:()=>{this.refs.password_input.setAttribute("type","password")},ref:"password_input",autoComplete:"off",onKeyDown:this.onKeyDown}))))))}}ot.propTypes={modalId:y().string.isRequired,keyValue:y().string},ot.defaultProps={modalId:"qr_code_password_modal"};const rt=ot;class lt extends a.Component{static propTypes={pubkey:y().string.isRequired};constructor(){super(),this.state=this._getInitialState(),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this),this.showQrModal=this.showQrModal.bind(this),this.hideQrModal=this.hideQrModal.bind(this),this.onClose=this.onClose.bind(this)}_getInitialState(){return{isModalVisible:!1,isQrModalVisible:!1,wif:null}}reset(){this.setState(this._getInitialState())}hideModal(){this.setState({isModalVisible:!1})}showModal(){this.setState({isModalVisible:!0})}hideQrModal(){this.setState({isQrModalVisible:!1})}showQrModal(){this.setState({isQrModalVisible:!0})}render(){var e="key_view_modal"+this.props.pubkey,t=it.A.getState().keys;if(!t.has(this.props.pubkey))return a.createElement("span",null,this.props.children);var s=t.get(this.props.pubkey);const n=[a.createElement(B.Button,{key:"cancel",onClick:this.onClose},N().translate("transfer.close"))];return a.createElement("span",null,a.createElement("a",{onClick:this.onOpen.bind(this)},this.props.children),a.createElement(B.Modal,{visible:this.state.isModalVisible,title:N().translate("account.perm.key_viewer"),ref:e,id:e,onCancel:this.onClose,footer:n},a.createElement("div",{className:"grid-block vertical"},a.createElement("div",{className:"content-block"},a.createElement("div",{className:"grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.perm.public"})),this.props.pubkey),a.createElement("br",null),a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.perm.private"})),a.createElement("div",null,this.state.wif?a.createElement("span",null,a.createElement("p",{style:{fontWeight:600}},this.state.wif),a.createElement("div",{className:"button-group"},a.createElement("div",{className:"button",onClick:this.onHide.bind(this)},"hide"),a.createElement("div",{className:"clickable",onClick:this.showQrModal},a.createElement("img",{style:{height:50},src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QoLBzEKr7oFDgAAIABJREFUeNq9fXmYXVWV71p773PuvVUVSAL2o40KmjCEgiSEVFUSAiRR6U9Bwan9tPG1OPLk2bQTaQd89rOfooJD80RBUfTz4RPnVpx9bZuEzIHMAaICraIiZKjpnrP3Xuv9se5dtetU1U1SiveP+m5uztln77XXtH9rOPjWt751y5YtzrkQQpZlIQRjjDGGiOB4PsxsjIkxjoyMbNmyhZkBABHlf4nIGNPX19fT0+O9995v2rQpvRcR5Rr5rrfLP/VKItq7d+/VV19tjAGAPM9DCMyc5/ncuXM//elPy4179ux54xvfWK/XiUjWJU/pPH9rbQgBAJQC8mhmjjEODAy4bdu2rV+/Xn6NMSKizDud4rF8ZHSZ9+joaKPRkAGNMTJUWZbbt2+31nrv0ykKlWUE/V1ukQ2T+cgFiHjo0KFt27Z57+VHWaG1ttlsxhittcw8ODh4zz336MR0qDzP06dPJJbuUIxRZyKTQUSnU0nvkWUfF7F09BBCvV6X7/J4mXGe50RUYVjdGyGZ8pE8XcmnXxDRGNNsNnVVwgsxRiGZ/g4AzjkdWTfsWJZQobLOygh10l2Vx0/jY4yR+SFiCCHGGGMU6lRIL49LJ2etFUKkgsnM3nsdR4aSnRDKKhWMMYcOHdIHOefku0wmxigD6uZN/MjTZUD5yO7qjiKikbHkV6GiPIOP8yO3K6Gdc9Zaa22WZTKPPM9VlFSCAMB7X6vVdELOOUTMsuzss88GgCzLZBxZSQhBuIOIGo1GX1+fEDHGuG/fvnSzRT7yPO/v75cZeu/Lspxq/rorIQQZcGhoSMbUa5xMSNSkiqtz7njFUJlfNbGKmLU2xijKoiKGwtf6Vy8wxsyYMUNuF8WvnJvnuQw4OjqqkiKqUDZG9kDYVigrukz5cdL5V5hOGPbIkSOqsIwxTqiYXic8fLwKPtWFKkcVXSCLnHhL5Ue5RamWqggiKopCZVnkS9aZZZkaKL1ApqG0Vqp1sIk6iOyfEFekzaRaUK47qpXt8CRlHNFBkyopXbyqM/lF1bPcqOJQUXYiLHLlyMiIXiwjqJirdVYpUbJ2mLxogImMYoyx1o55E8LM6YZ3/lRYWr/rbug/RdlX3BGdligXdVxE8RHR5z73uSzLRIUtWLBAx1yxYoWMFkK47777ZObOOSWrem3yFO+9PnfTpk1TLUc0IyL29fWJUkpdxTGd9WR/KhZduS/lLN18nZ+QTHZVLIA6bsqbqon0u4wwUa6Pa7YVsRhTUE82pYSh1PmUL7KZ+stE56uyYDFBYmGFHMIv6iLIIMKGcv00dIgq8qn0tXmyiSXP1s1XaRKFolqywho6b71S6SJKXSRUr1RJ9N6L1P/pM6/ok78EsVQp1Go18R7UysinKAphhJRwHZhU2WdkZOSee+7Rwc8991xx65xzqQE9Xsue0qhy41+Is1Kekm0XfklVe2V++r8VudBxurq61MtBxO7ubvmvoiimYc0nEjT1Qv5yOit1GlSRy+anB2YlxMSjiRybU59DbbeMmVrbPM//FJ3VaeP/AtZQ6aKnqFSFjx1Tk4Oh+Maqs9QRVYMoBqurq0tdBIWV5OxSYcNjF8aUtSscOh3OEke8glV1dvZSRKEyJ/HgJ4rh4sWLVWDVeiLixo0bL7zwQgWFjooaHaOyT7EzdWv/DJyVrqGCQx0LZx0jJ2ZZpkBNyon1el3tpvpcuiXq7oqva4xRZK0zSKfjpMeMytLctGUq3fOjmjD5e1SyKjuo5lY8T72qoihkPQpsioJT5i3LUqFBEWE5Y3c+xumYuhzxQo6JWFORQDlf/JqjqlL1sPTGzqdZuSyEMDw8rFCvc857L6c84ZQU85LP8PCwzFncfbUSWZbJJIWCHbZW2HNwcFDuTV25oxBrKlGfqKo6L16vd86NjIyIgBzVKgHAvn37lIsXLFhw3333idz19vYqgdJTt2xeyshyLBUaiR+7bNmyzuuStYQQJp4ipslZFZC+8+J1wQpadRZbPdwdOXJE/ICyLOv1uopJrVar6GAhop6H1O+VQ1Ke54pVTHXoUz4VwU/PBn8GnSVzOkadVbn3qFYpna5Em1J0xXsvroOqcEVBlNbiOsjBSHScTniqOYjjVoHX/wwefIoWHIvzUkEpjxpkkxkL1i7+p/hZcrsKsnq2qd8r85Fly152dXUp4NFhtxRfVdFzzvX09Iy7aNWqVRUf51j2v4PY1mo1USiKdqrzIu7iRGcvBf51AuJnyTg7duww7U05d+ECHwMzx+jvWb9WWXvhwoXq9G7atCm1/ROduOP9OOdWrlxpFEVVn2UaQcP0uFAURQhBxEcRD3WanHNydlMWSO1UigurBy+IqJDXWtvV1WWNsKrLs7oAEhKMkaiSkr5er6e70gGAPyoTyLBG5D/d2GnDygrIOucErdYQVqpKxLTL3og2ybJMNHSK0lRg28xlFcsrke0KDi6EE93UbDbTcOT0FpXiqO7gwYOpEtGNnUZ0R2ght3vv5QGyAPHuxN9RJkoJquqvBeA6J0sV859lWRliltWIwuGDh2IIzrksy2yWi2ir/hZTIGMKb+oJtHJKOy4FTUQHDx5EsRdijysw5vESS7ZdpViEQiiVenf6T+9jltlEhNl7v2XLNg2JHzlyRDDlPM8HBpYZA0VR1GrCYgxgjhw58sAD+/M8HxkZmT179rx583Q/hFjNZlMMgrLk9EJ83vs8z1E34c8FLaaHNRWZtWvXilopy/Lss8+eMWMGMWaZQ4RI0RobyYsmwraBVn4RP4sBKEZrkSmgMQCGGQGRYgwh1Gq19GAEAAww2hxt1BsMDAAISEyIaACnvTpMcV6Vwc5AwhRjRZFE2duhoaG77rrrK1/5yo9//FOhYJ7nzWZTNtkYc/6S/he84AVXXXXVnDl/TUwx+sxlPvjcTVi2RGuADTBD/MC//Mt3v/tdtBbBRobcZUVRCP+q64uIz7v0+b29vZdffrkGe2KMeZbj8ftJY6Sg9kfPENOI3UsAfLQ5yOx//ZuHXvqyK4wFQDAWJoYPWs9Gi8YBmKXLl+27fz9xHC1GiKOi7OlMZH7eF8z+da/9rwiABowBMGMpLhoebqk/BOMsILzs5X978PAhYg4UI09vaa0pQX9/fyUW3dnVcpD1zj+HmQP5yJL9wUwcikPM5fXvfg8AIIKoUYO5WpM0+IqIFiCzDsCYrAts7Y3//R+bkT1zJCbmZrPJHJkjM4fQoplnH0bpmte8yBpwCHUE42am3tP4g5cxxunfO7/81cDsmYk9M0dPzEzMgWMZCiYW1mPmtWvX6vIlXjmW69DV1aVjKyLRwcmOEJ/ylKeIQjFowAAAMZHN6osXLLpv195arVEUo8ZZFo8HuK+v77nPfa44FkT005/+dOvWrcEXIQZrbfRNNO7WT/7vdT9fu337VrRQFr5eqwFA2Szyes1aJAKG4ME3cnFKoF53ZTNQCJVjnSIctSwrysIAGgNE8MpXvGJ4tPmqv7/SGEYAY0WviQ/sUjdAbhe6a+5U67N69eo07iQOZGcxXr58ufctWaHofTnCsTnv1DkZQmZzAAcGAeHZz7nke9//sdj+iSy9e/ful7/8ZQjQlVsEQLSu1nPK0+cG5sBclG3fMqjoRM+eA1991eUtcUP42C13qrRKBEywmo0bN77rnWsa9byWOxk8r3Wjaxx4+NEg1xPHGCNTYBYeUydGUxKNMcuXLx+XKXTxxRdXDpCdw/fG4cBA39hK2DM3L1x+ngWo2xqCA3A9M078fz/79xDZB05dapmNOCtl8MzxoV/sP23OUxyAFRG3XQMrVgbmIjIJlYmZAlPwvvBccuDXXvl8RMzrNQDz/o/ekaq2siyTjYkc/Esuv6yROVEJYGqrLrnMMweKvmzG6Ik5EkdiVWUhhB07dqjTd84551SJlToUqZqf9AMIS5f2hxA4cvSByb/33W/PDCBA7moA2V8/9dQ/PPZ4SVGmImvQAfWfgTlGT36E/fAFSxZ059aiQ5ODyT904ycCs2+rqhhK0V+jNMKB33L1y1sQALr/8dEvCKumzCsIJ1Ng9hzL8xeeU3c2z3MAB7b26BMj8mhmT8whMkVm4jVr1ogMLlq0SBIpJqp5I7iPeqFCXXUjJkmgMJYIrLFgCDk++utff+ADNwYCBihDnDV79oO/+MXsk2cDBQAyCIq3qFLIsoyIENgYgy6LxOvu2XjKKacAB6ASmNasecfhI8MRUDSnsVZcOIcOAgyPDAmDi24ty1JObEVRiKoVVCsSMQEgfu72z8YQfVkCEMS4cdN2knMikdgFNABI9XpdDkZyxkyTvMZBNJXjzsSI7ngElWtZ3mwOAxNmeO2116I1AIBZDgg/X7eOgYjJWRNjCUBi/iSpTASwZd0BY2QAZ/MGZNnP/uM/LEJN3NJI1113nbMABoghBAJs62PD9Sw3yBQiAGdWWKaFdggs04I6rItEALBg8aIsw66aQyAAuu++vRSF+Gn0hCrhyDQ3cYxYgsaKQVFCdggfGbBEUK/XAPmJxx77+rf+LQRicBzDG6+55oyz5jXqGSISk7Nj2QmyJImzt3wWZmMtAxBgCPTUpz/tmmvewBGAIyDeftttPjAxMIJ1jhlBrAZiCMG0Y9tEAZIkWM2xISIGtM6R9wBw3sJziyI4BAQYGhpBCwRs2qgpM8vpQ1hECDIpu4zL9tYg+5g3NG5EAADKOQwPA3oosls+doOzmQMACGC6P3zTTQbZcHSMljPgVjJuZX9agwNCJARCJrTO2Ox97/ufooktRIT4ma98N+NmACAA5BIRS4hgAZwNDE5svzUa5kmZAhENAHNhsgawa8e7awYoy2xgYITIDAwWAGgMfUfEtWvXimwpviSfgYEBk+Z5p7lbim2l6fNEBD64Wj1yBAvf+Ma3yuAZwLr88he/pOasBQQAppbgdDozoT7RGjQA0N3dGOg7p21q8Gt3fQXQUtsXijE6cHJUtBaNzYCNgr+CzAjPtpL/mAw0KBwBsHv27rSmzraIkC1c0OuEzuLKIqABAGw0GgJMpjCWhiattY1Gw3TOGUwLH9LsfotZeeSJfff/J4DJrI2RX//611oDDGPIkSxzyjMXMBhmljkBANh6dvnllwG0VMnPf/pDQOsQkAkArLEGAAgQDUUoyxLQMKPiPCoHLbgVgSIb2/PQLzY0R2qem4EMYL6s/zxhv/ZSQU7Waapqmgc85gZIHnyadZfmRlWSbzT3sCQGgK2bN4h3xIyA+UUrlqfPOJYjavpQ0ZLPee5qC0RM1uUwOvy7Px7G1iYjAEQKLdgaENEaY9OET0gqMmQTEBGweNd17wcogDOwpndJ/zPmzERg4DaR2uqoLEtNPtdjX5oHD62TaJIKkSauVMJzLeeewToHjLt3b/XRABIRnXzas7rqxjAARTkTHhUIkSsMCpIFzAjMZ83vtQAGTYzBONjzwC8BwLQ4lJxxgC2eyPOcoo+hFEnUmpukIMIgFnd+8Utf/9b32QABQ6x9+MMfRAAD7GxOkcVgyapvuOGGI0eOiL2W+C4R7dmzp+o6TBqkmYqznEUwBhB//9uHIxhAQOBnnXGmITCYhnCOGh0Yz30GmV02Y5YFcJkBRi5H//N3f7TQZl4iHtttKotRAGqM54U0wEMB3v+B66989Zvy7oYnAAyve8ObL1k5EKMHMAAGUBSsEMsIz8oZQ1hMY5fqUTupLKhAo2kIU3V8i6xEzTIA46O/fUigOiSeefJJDICgUU8wRm7sAIABMyGKr2AZLYABcCd2ZwebEYyzBIOj5RiohMjAwGAzY42NFOs1e+D+PRs2bBDtLvF9Y8wDDzywfv36Oz7/mZGRwEhDw7Wsy/3N6hd/4uPvdQwkW8ggVqUSixa4TbPn06CJMcZphcZUWSVCKVV1BiCr5QAwNHwYwIADDnDCzBPboSpqsQwfBUFEAAALEAGIARAtAEbPM2ee8NhvHofMGoJmIcQitA6BI4QMIcYYKRoAX8Q7brv1i5++MVXGCvk7BMQcnOE4/L73fmrNmqstBPCMmSGGGME5YAaDQj3UkK2WmSGiFOGNBQk3bdpUyTHTUGiadaaAHKIJcRTIFUgAkEOtsIBNZGgVaJVlCQiMR1HzRIJ7QaCIgMxABNYZ9l5QHwvQ3d0NzEyi4AwCC4GFKXIECM0xuQMGBEAbAgGYgFnXjJPf8Y63HRp8Ys2aq1sbaBHBGITMtUZsiWSbP2KMa9eubTQaAi4sWLAg9Q1dyodpKYB+EaRYAf/ABMQQY6PelWeuLIYB4fDBx8VyhxD1/IHGMMcpFZcBQAg+uiwPxMaARYLgDw0NGWsgxgDQ090FKA4mMIPFdpCRyVosI4PJiYpWhIVaxX/W2RDC7JNOueVTn3zpS64QkSnKop7XiL2BrAN8rABMxUMQp9epA0VEgmSlxX1iUNWsil9Syyw4+9Snneb9RgCT1+HXDz1EDIjWOIHiRMF3ygFBBCJyWQZgrAEfPLN3GR8ZIXYZoPEMp845JfEzEIABwGUZgwkRnIUVq56zesUCIBZ1s3nzxu/823djCM7CE4899qq/e8mtn/6bH/7ge2iplteCB5dR55wBEUD5m6Y0id/r9u3b9/jjj0sYbuHChYr8CSsJjbZv3y5kbsX+iQHo6afNM0CAObP/5YP7GYEiW4vel3luseWg89ReFgmGaQzECIjsHD70wO4SgMXuYXb6M0+NAA4MACFihOioVaDCjMZlqy953vve8XpisihcjAD0T29/x003fdyY6Ev695/85LLnv+TuH36dCGwGDNzBQpdlaa096aSTFi5cWKvVarWaJj5ba8844wwYGBiQpBxNXVU8q1JqpIGGpQN9HMPPfvLtOkLN1MEAQPejfzwyOFpGJgHORQ16X0wVAgjkiYJAXEVJzDE0H//eN28Xmwim5mb8VWAuSIA5z8yeS/Z8zWuvQLQADkz2z5/4QmQKFFtoH8fm6CCTv/3WWxCh0egGcADuIx/5lA9MXPpYHjU2IV5bBeAVspju7m6tkqnIoFaXpmIMBh0wIPf1r2AGZAQEC/R/7/pavZ5xy3UBHB+Cn0wMbTvVC2wmpSnuhz/4KYJFZGvw/P5llluBDwhtFARbyfFoDDCHEBDQokgQee9r9a4Y6TVveP11b/9vzdHCGAIM7/yndz36+8eK6NFkHUJeGlFPk7xUwROREUqpX5omM8pfyYfSMltgOShxV8/ss8+cE5kBwUC87bO3h7YuTAORU7ukaE1G0QMSAEQmzBqf/9ydLZc9lle++iqITZZjEfIYjYENMHAEpkZeK4tCwZksqwEYBgPgPvi/bjj9WXMyZwAxxKFLL73U2a4OyU7GGFXZac556naZFNZQVJOINm/evGHDhu3bt+/fv3/+/PlLliy54IILLrjgAjDGMABiUfrXv/Yq1zqN8L4dO3bu3BMpapFN56wVjiCQFmLL+H79K18tPAASMhHTi150udBRWFRdWSICJrmrKJridreML4APZJ0LkdE1vvntL3sfgCyg371n1+dvv4v46GkNlRyp9HAOK1eurKTJT5U/1U57dsuXXcTEVI6ODj0uoAxCDpift2TZaGDPXDI3y1Fmz1SkiH4K8HtmHyWUVzI3mctTTp5lAWytDuguu+IlxOwDE7OPgUjUhw+R3/yaKyS2g2Cu//jnp9Q9xMzxTa9+KQJ0AQD0mKzn9yPEHCn6EIKEKUIIzJFjmQY+UsU9DoPvnLFXqaQxxlhniEPwEV1W757xxte92jlAiIh479atH7vpY+JC5Vk9RgY06tBWKgYsgDMIAL4sgfEt//APTzxxkBFiGcCYG264QfgJAZyxiPa4UxMQIDRv/tyXZtVhBFzdlBT4NVe+MpIhcNbaGALqQaV97hcdouJVHbQzZ4kuS2kMCEv6+9pb533zsEMwCNZmYnq+ffcPPHNJHChOzAQQW0NEzLE5Oszkmcsv3XE7ihZDB1h71WveEJgLX5IYuJHRFmMdD2cFZt8cJC6/8KmbAEzNALguQPez9ZuGi0DMRDQyPMgchec1yzCFWyqfKZNnent7TzjhBAAYHh7etWvX4OAgEfX09Cw679zzzjuvLCjLDRDYrHb33d+89NIXxeidyVyeXX7pZV+88/+88hV/K9HqNP1M82iZGZhqeQYAN97w4Xe/+3rB9YBh5sl/ddttt8o2C4xTq4SFj5W1CGs9GIdedfU//uvNt2zb+6scRjy6573gikOP/zYCOMRGVxcwhwiI8PvfPfrII49o0a0IxIwZM/TE04mzlJtE649Fh7iITMQcvMh2ydxc8/Y316zJTSvDwbr6ylXP/ePjh6mt6dJcD2Gu0Bx+cN/uhb1n1Z1FgFqtkde6AbI9+x8OzJ4pchniaKQilL4dBD0OziKOgZmpJOZf7d3mnHFyejeNa697z6gfm5oor+uuu64SrM/zvK+v71h1lmSjaQ5Eq6gFDBBTAOPAOUfMAPaGj3z0yitfGYmNAWOAol+/fu3JJ8164QuvuOOOO/bu3avyX5bltm3bbr755sV9S86Yf87+Bw+UgVxWKwpflsWO3bvnn/mMUAYjRDcO2NjMwXQyHI0FKinDWD79rEVv+PuXm8zmBkxmPvGRDz388MMhsgDbEkA84YQTpGuLwqST9GLpwFlqAdPshxhKJiZiYiaOkUNbyMuP3/ghZzF3rYvzei3FSzUzU8+G2mnGufzU0+bdf+Bhzxxa8WcmotHRUXXNp8FZTMJcftQHLg/Va5mcb11WO7N3gSTtUMv2xfe+970aoNX46bJly46Js9atW7dx48atW7fu2rUrRaZ++eAvt2zeKuSNFBHQOgcMwHzt296ye/fOufOe6YwFgFAWEsJJGyuNtY6QI6Zk70R++OGHvvHNr/sA1kKkVpSlXq8TME2Lr4ACgbEERXR1W3LW/dlb/pXRNDITfHH/vn233voZAAgMzhmg2EZNgkKhk9SwXXTRRWnFiLBJ6tNPzM1dvHhxNdMs+e598cMffv/Zz17lsrGYQBo91EolQepdO+wAprZwyfKDR0Ylkab0LW5q+WLEZTHKXL7uqldiCzzM3vfBj3Vws6g1pUAUIhXM/vzFCwABrRHn8A9/fCxITgbT9ddfr417dMlLly4dZw0llATjuzBV+kRVMt3T+ra0ME6QL+fcRRdddMkllwDAj370o02btuzdu/dXv/qVbECWZX19ffPmzbvkkuc8bc6cvr7z9+y5HwEYyFnYsXXLSSed9PVvfO2Flz7POQmAsLU2xBIYszxnCmvWvPMNV18TyQSwzzj1tCkZi4mIMtuqPkdwAHT33Xf/6pHfGGPKshwDFRA0mT5FDSY5fqxevVrjiJwYL72n0g3GGDMwMDA6OjppcmVZtjJevC/ky/g0oNZR3ntfFEWMPobm2992bWunEa3NrKsDuDddc20rH4hJNl98Lopehm3BFfHoaY9ERBTaU/I+tn13ij4GsezE/J73vKdSjiGZaOM46/TTTy/LsizLQ4cOaaMFa+3555+f6uO0r1xfX1+atq6+Rft03gq3yAPUOAjaoxPK8xyAKPJHbrxx1apVV7zgCmKG6CNEALjlkzd/5zvfXrfhnlNOOcUaEwEsQKDoTAYERIwWECgz1LlWq51G3soMLssyz+ut2ESSuCy/CAKqNZ+T5HxMzMxTVyh1jlImkhiHlJ2k7pj6vul3oZE+Qsdsd7OKMTRjaP7u1w8/8+lPdQAAJs/r7WiVu+NLX24GDsyRA3FszYJa/OLDaAeeknnKE4W52kmqraVpXQIzizWs1D1VdJZJs9W1wEP7e02sDxJmEQw6TWLS4J0mH4zlaCTYhvZTkZBtWQZjMzTuv8x56i8ffvhlL3sxAJVlExGNtYjw6iv/7tkrV40MNSlEBCPujXKEs3nn8pgELLIxcrNZwvgmZzp/TQZJeapaIy0+p1bITkz+rhT0TKzLa38n76Mo+HaHMFspINDKV+ccUEtIGZAgxDJkzt1511fvbKeMSa2A4M4hkHNS6KNWxYUg+MmUcUmKMTLJ1nrvXZbV2qUWmpmkG6k1bFoRqsDWGLH27t176NAh6X2SBlNTcCflrBjjzJkzzzrrrEr9u8Y7tNpEVpi2+xrnkSAyE7bIx1leR5A8Wi91T1LThczAxlkDDKJjrMUQAxA45yjClHgEs7HWoB13OIVxRZ5CR1msODRZlp1wwglz586Vy6SV3thnxYoVlRLKzmH3tO/ZpEV8abOLFJnRDJyJI0xsulkRJfmrmJx+0lsWLVokmiiEsH79eu13IEm0or/Wrl2rK01T8yu52JyAEKkRb0XKFLpKY6udC75Vso5a+at5pGkNvmq09MexfBXTSj4QXFz+aiwvxZG0DHliHwi5sdFoqFEWPZvGBCskU99dvcj0MqOPl3KhSnX1pA3ZpJxQmeio9f/GGNGmaVHOuCBIkjymRiDPc8mZ0h5uabqdaBblYqnVShvhaRfX9GCr9bWpAtWOcJC0VEnT/nRrnWbL5Hm+cOHCPM8nPxYlOksD1/rXGLNu3bpJr1+wYIH0H5LOKJroUunPptO48MILpZPf8PDw3r17hR0ajcb8+fMhaYIiBvcPf/jDAw88UOmgV5bljBkzlixZIlpv3rx5WgIp/qBo7jzPL7zwQlHkRVFIbFRbwAkTSPdNGX/WrFlw8cUXKwnFJ2o7JpN/JtZKaBvaSXVWmlMum59WCFWYJc0L27Fjh2h6AEhP/22glUMIO3fuVEkcGBiooOZSd98+sXpm3rBhg4r5qlWrNEFfa6oBYMmSJfqgLVu2QLuP3sDAgEvL1CZqzUlDIAp4KlMctbMsjG/5WommaN2xyLgQd2hoqFUhNN7mpJMcHBxMu1bD+P47mnKQ9mtRB2h4eFi742nerPpPojFED4gf09XVZVJ9UelEMOlHSVOWpZ5yOseXlLHTnnyqNer1ujKL+ofSE6WS0pkGPmTDFKSW85NSTTZGRpPEhVRWVNgSAAAGi0lEQVS1yZakiQpSWSzcJDXxyg0y51aJHkzR9Xnz5s2TOg3qEBCRSEfnGuGNGzcK73R3d/f29tbrdc2U0y8iHTLU3r17Dx48mOf5gQMHFi1aJC1v58yZs23bNslFkLvEYtx3333aXvXgwYP33nuvKCaxntKjW4UmhLBnzx7t9TM0NLR9+3ahzoEDBxYsWCAe9Zw5c/bv3z8yMkJEBw4cSBMwjyluOJV8pQqis5+lajVt+aDaJC201z07//zzVQdt27atcvKYWJwFEzrJVqrd0hbiFdu6ZMkSndvmzZtTjaR/V65c+aR3ZktFQ/suaIRNjFpqYVVsU+9EEKEErgDtuZyufFyoPTlpac/o1JdMp6fz0RYOk4rLk04sFRwFDlPnKFWRaSWU5mJUWqqkFaQV9VrJG06746V5oROLBaW6P6W4NDefWBvypDdIlP0UG7d79+7BwUEhRH9/vxhBY4xgZ7KSjRs3lmWZZdnhw4d37tzZbDadcw8++OCiRYvErT106ND999+vO5G+EkA3YNasWWeccUZ6NhJH9IknntBO6GkV3GOPPbZz586yLEdGRn7729+ec845YgdGRkZ27dp1rBHpP11nTVQTlWcp6qR8pFVReq+g/vLZs2dPxTvT1Cj5kue5WB61sCJZMcatW7dW/I+Kk2GM6e/vV8fw3nvv/YvqrNSGqkylCLfYbFUx9Xq9LMvKqz4UBdGMfrXo6TlJdFZZllo1m7qBFcgl9QEkRCjgkiLsIQSJJP7ldFbaLjhtJ5civymckEY6lRCNRkOP1uJApOiuSLoM7pyTwkP1wjTRTKDdiWcGOepqtCLtjT6h88CTr7PUIe7r64N208IdO3boOxCWLl1aMfnMPGPGjHPPPVfuFQUkpJk5c+a5557b3d2drk3eYbF//37xRYeHh7dv3y4EmjVr1llnnSUSeuKJJy5evFiUetq7SFOQnXNnn3228mDV5V61alXlKCN71QHYUt83zWaahi5Ta6UnuLTwbPny5fK7nhYrXyr/u23btkoqmvxzYGBgqsSYdD4TowREpGdJa+3FF19slC6VFxp0AB4qR7zOPf86q7NKiV5abyt4gPayVQBW0xP1bKSYn0JMqX+nAYEOQGYlg3Ri6+AWF2uHz/TSChqXeuG686p0p9eaSsOUqcKKMcqCBbQTH0KWKm6X9tiC9ksr5AAg/6Xd7tJWd5U1T7T4+r3SAFqvh3ZHfTdp93RjzJIlS9SOVPpcyv2HDx/WDmHH+64sADjzzDNnzpwpHVd37twpYddZs2bJgrMsO3LkyO7du8W0dXd3L1y4UN9YsmvXrjzPRSbkJOi9P3DggAaZ6vX6GWec0dXVVRTF/PnzhXnT0odJ+asiWIg4e/Zs8QGzLDv99NNh1apVAjNpJ2JFi1KRTk9zFQ1yLH7WpDiXfqnA+SmviaD19/crLrZu3brJOwElH4n3pXwkkXoh/URgLlXWqQKVu8Yw+PSFHCkgN/H1JtWmne3I4DTelZWCpemrwFIUVFEzsffp4UPP3np4qlgefbGUOCLSKgzajfZSEVGhmQhwV5xVKZ7J0hCpJn9PVdOlb4CqFPpMz6uotHytsJvIuD5C27Zqs0AxNbVaTb6oNdBGi5LMJ+GSSY97KXUq3Z+FyzSwhIhOnFcR6fvvv//gwYOaV5MqyIluhEYiBCOfBhqhYTsdSpWr6J1FixYVRYGIc+fO3b59u0z1kUcekdoaY8zQ0NCePXtEzc2ePXvu3LnyEr/TTjtN8C9jTE9PT29vr1BheHh49+7dijHos5xzixYtSskkNB0dHd2+fbsQoaenB1avXj2pppg2xqDsnQKbaRbJRAgfxveOlL9Lly5VGRckMs0Ok3u3bt2qYpXmJQgmJQOed955qnTknRcw4S0olYwzVVvy3j+5bOnSpW7iy7umfaypvJFv0hdPTBVPrUTCK+9tCO0+WaqY5H9Tf3iqF+mJ3ql0R0yNTxpDqQAS6VSzLHOpIKgfMO2mrjLjZrMp8HGqCwTxkP44aRxfGgGmTo22OSmKQpD1sX4S1koSWnp4lKH0eo1Oaj9Z8dfSh6YaXU3ZxFWri9cC4yR7WWHfNCB4XMTSd44NDg6KWpUR+vv7G40GEY2MjKRd4NRLFt0k75xTQF2aTmqudXd394oVK4QEvb296ql3dXUtX75cFLz+Lnj/8uXLRX/19vZqw4aenp5ly5al4ShZsrSrm9g2uVarLVu2TDasv7///wMCmdZm6AM8jAAAAABJRU5ErkJggg=="})))):a.createElement("span",null,a.createElement("div",{className:"button",onClick:this.onShow.bind(this)},a.createElement(v(),{content:"account.perm.show"}))))),a.createElement("br",null),a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.perm.brain"})),null==s.brainkey_sequence?"Non-deterministic":s.brainkey_sequence),a.createElement("br",null),s.import_account_names&&s.import_account_names.length?a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(v(),{content:"account.perm.from"})),s.import_account_names.join(", "),a.createElement("br",null)):null))),a.createElement(rt,{showModal:this.showQrModal,hideModal:this.hideQrModal,visible:this.state.isQrModalVisible,keyValue:this.state.wif}))}onOpen(){this.showModal()}onClose(){this.reset(),this.hideModal()}onShow(){nt.A.unlock().then((()=>{var e=ee.A.getPrivateKey(this.props.pubkey);this.setState({wif:e.toWif()})})).catch((()=>{}))}onHide(){this.setState({wif:null})}}var ct=s(64624);class dt extends a.Component{static propTypes={account:y().object,pubkey:y().string,address:y().string,onRemoveItem:y().func.isRequired,weights:y().object};shouldComponentUpdate(e){return!S.A.are_equal_shallow(e,this.props)}_lookUpPubKeyForAddress(e){return ct.A.getState().addresses.get(e)}render(){let e,t,s,n="_accounts",i=this.props.pubkey;const o=it.A.getState().keys;let r=!1;return this.props.account?(e=this.props.account.get("name"),t=this.props.account.get("id"),s=a.createElement(f.N_,{to:`/account/${e}/permissions`},e)):i?(e=t=i,s=a.createElement(lt,{pubkey:i},i),n="_keys",r=o.has(i)):this.props.address&&(i=this._lookUpPubKeyForAddress(this.props.address),t=this.props.address,s=i?a.createElement(lt,{pubkey:i},i):this.props.address,n="_addresses",r=o.has(i)),a.createElement("tr",{key:e},a.createElement("td",null,this.props.account?a.createElement(at.A,{size:{height:30,width:30},account:e}):i?a.createElement("div",{className:"account-image"},a.createElement(lt,{pubkey:i},a.createElement(V.A,{name:"key",title:"icons.key",size:"4x"}))):null),a.createElement("td",{className:(r?"my-key":"")+" pub-key"},s),a.createElement("td",null,this.props.weights[t]),a.createElement("td",null,a.createElement("button",{className:"button",onClick:this.props.onRemoveItem.bind(this,t,n)},a.createElement(v(),{content:"account.votes.remove_witness"}))))}}class ht extends a.Component{static propTypes={accounts:l.A.ChainObjectsList,onAddItem:y().func.isRequired,onRemoveItem:y().func.isRequired,validateAccount:y().func,label:y().string.isRequired,placeholder:y().string,tabIndex:y().number,weights:y().object};constructor(e){super(e),this.state={selected_item:null,item_name_input:"",weight_input:"",error:null},this.onItemChange=this.onItemChange.bind(this),this.onItemAccountChange=this.onItemAccountChange.bind(this),this.onAddItem=this.onAddItem.bind(this)}onItemChange(e){this.setState({item_name_input:e})}onItemAccountChange(e){if(this.setState({selected_item:e,error:null}),e&&this.props.validateAccount){let t=this.props.validateAccount(e);if(null===t)return;"string"==typeof t?this.setState({error:t}):t.then((e=>this.setState({error:e})))}}onWeightChanged(e){let t=e.target.value.trim();this.setState({weight_input:parseInt(t)})}onAddItem(e){if(!e)return;this.setState({selected_item:null,item_name_input:"",weight_input:"",error:null});let t="string"==typeof e?e:e.get("id");this.props.onAddItem(t,this.state.weight_input)}onWeightKeyDown(e){13===e.keyCode&&this.state.weight_input&&this.state.selected_item&&this.onAddItem(this.state.selected_item)}render(){var e=0;let t=this.props.accounts.filter((e=>!!e)).sort(((e,t)=>e.get("name")>t.get("name")?1:e.get("name")<t.get("name")?-1:0)).map((t=>a.createElement(dt,{key:e++,account:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),s=this.props.keys.map((t=>a.createElement(dt,{key:e++,pubkey:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),n=this.props.addresses.map((t=>a.createElement(dt,{key:e++,address:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),i=this.state.error;!i&&this.state.selected_item&&-1!==this.props.accounts.indexOf(this.state.selected_item)&&(i=N().translate("account.perm.warning3")),!i&&this.state.item_name_input&&-1!==this.props.keys.indexOf(this.state.item_name_input)&&(i=N().translate("account.perm.warning4"));let o=["10%","70%","30%","10%"];return a.createElement("div",null,a.createElement(I.A,{label:this.props.label,error:i,placeholder:this.props.placeholder,account:this.state.item_name_input,accountName:this.state.item_name_input,onChange:this.onItemChange,onAccountChanged:this.onItemAccountChange,onAction:this.onAddItem,action_label:"account.votes.add_witness",tabIndex:this.props.tabIndex,allowPubKey:!0,disableActionButton:!this.state.weight_input,allowUppercase:!0},a.createElement("input",{value:this.state.weight_input,onChange:this.onWeightChanged.bind(this),className:"weight-input",type:"number",autoComplete:"off",placeholder:N().translate("account.perm.weight"),onKeyDown:this.onWeightKeyDown.bind(this),tabIndex:this.props.tabIndex+1})),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement("table",{className:"table"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{width:o[0]}}),a.createElement("th",{style:{width:o[1]}},a.createElement(v(),{content:"account.perm.acct_or_key"})),a.createElement("th",{style:{width:o[2]}},a.createElement(v(),{content:"account.perm.weight"})),a.createElement("th",{style:{width:o[3]}},a.createElement(v(),{content:"account.perm.action"})))),a.createElement("tbody",null,t,s,n))))}}const mt=(0,c.A)(ht,{autosubscribe:!1});var pt=s(29952);class ut extends a.Component{constructor(){super(),this.state={validPassword:!1,pass:null,generatedPassword:"P"+U.key.get_random_key().toWif().toString()}}onSubmit(){}onPasswordChange(e){let{valid:t}=e,s=this.props.account.get("name");const a=t?ee.A.generateKeyFromPassword(s,"active",e.value).pubKey:null,n=t?ee.A.generateKeyFromPassword(s,"owner",e.value).pubKey:null,i=t?ee.A.generateKeyFromPassword(s,"memo",e.value).pubKey:null;this.setState({validPassword:e.valid,pass:e.value}),this.props.onSetPasswordKeys({active:a,owner:n,memo:i})}checkKeyUse(e,t){return!!e&&("memo"===t?e===this.props.memoKey:this.props[`${t}Keys`].reduce(((t,s)=>s===e||t),!1))}_onUseKey(e,t=!1){if(t)this.props["active"===e?"onRemoveActive":"onRemoveOwner"](this.props[e],"_keys");else if(this.props[e]){const t={active:this.props.account.getIn(["active","weight_threshold"]),owner:this.props.account.getIn(["owner","weight_threshold"])};console.log("key",this.props[e],"weights",t,"weight of role:",t[e]),this.props["active"===e?"onAddActive":"owner"===e?"onAddOwner":"onSetMemo"](this.props[e],t[e])}}render(){let e=this.checkKeyUse(this.props.active&&this.props.active,"active"),t=this.checkKeyUse(this.props.owner&&this.props.owner,"owner"),s=this.checkKeyUse(this.props.memo&&this.props.memo,"memo"),n=N().translate("account.perm.use_text"),i=N().translate("account.perm.remove_text");return a.createElement("div",null,a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(v(),{content:"account.perm.password_model_1"})),a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(v(),{content:"wallet.password_model_1"})),a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(v(),{unsafe:!0,content:"wallet.password_model_2"})),a.createElement("div",{className:"divider"}),a.createElement("form",{style:{maxWidth:"40rem"},onSubmit:this.onSubmit.bind(this),noValidate:!0},a.createElement("label",{className:"left-label"},a.createElement(v(),{content:"wallet.generated"})),a.createElement("p",null,this.state.generatedPassword),a.createElement("p",{style:{fontWeight:"bold"}},a.createElement(v(),{content:"account.perm.password_model_2"})),a.createElement(pt.A,{ref:"password",confirmation:!0,onChange:this.onPasswordChange.bind(this),noLabel:!0,passwordLength:12,checkStrength:!0})),a.createElement("table",{className:"table"},a.createElement("tbody",null,a.createElement("tr",{className:e?"in-use":""},a.createElement("td",null,a.createElement(v(),{content:"account.perm.new_active"}),":"),a.createElement("td",null,this.props.active),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",onClick:this._onUseKey.bind(this,"active",e)},e?i:n))),a.createElement("tr",{className:t?"in-use":""},a.createElement("td",null,a.createElement(v(),{content:"account.perm.new_owner"}),":"),a.createElement("td",null,this.props.owner),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",onClick:this._onUseKey.bind(this,"owner",t)},t?i:n))),a.createElement("tr",{className:s?"in-use":""},a.createElement("td",null,a.createElement(v(),{content:"account.perm.new_memo"}),":"),a.createElement("td",null,this.props.memo),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",style:{visibility:s?"hidden":""},onClick:this._onUseKey.bind(this,"memo",s)},n))))),s?a.createElement("p",{style:{maxWidth:"800px",paddingTop:10},className:"has-error"},a.createElement(v(),{content:"account.perm.memo_warning"})):null)}}class gt extends a.Component{static propTypes={label:y().string.isRequired,value:y().string,error:y().string,placeholder:y().string,onChange:y().func,onAction:y().func,tabIndex:y().number,disableActionButton:y().bool};constructor(e){super(e)}isValidPubKey(e){return!!U.PublicKey.fromPublicKeyString(e)}onInputChanged(e){let t=e.target.value.trim();this.props.onChange(t)}onKeyDown(e){13===e.keyCode&&this.onAction(e)}onAction(e){e.preventDefault(),this.props.onAction&&this.state.valid&&!this.props.disableActionButton&&this.props.onAction(e)}render(){let e=this.props.error;e||!this.props.value||this.isValidPubKey(this.props.value)||(e="Not a valid public key");let t=ye()("button",{disabled:e||this.props.disableActionButton});const s=it.A.getState().keys,n=this.isValidPubKey(this.props.value)&&s.has(this.props.value);return a.createElement("div",{className:"pubkey-input no-overflow"},a.createElement("div",{className:"content-area"},a.createElement("div",{className:"header-area"},!e&&this.props.value&&this.isValidPubKey(this.props.value)?a.createElement("label",{className:"right-label"},a.createElement(v(),{content:"account.perm.valid_pub"})):null,a.createElement(v(),{className:"left-label",component:"label",content:this.props.label})),a.createElement("div",{className:"input-area"},a.createElement("span",{className:"inline-label"},a.createElement("div",{className:"account-image"},a.createElement(lt,{pubkey:this.props.value},a.createElement(V.A,{name:"key",title:"icons.key",size:"4x"}))),a.createElement("input",{type:"text",className:n?"my-key":"",value:this.props.value,placeholder:this.props.placeholder||counterpart.translate("account.public_key"),ref:"user_input",onChange:this.onInputChanged.bind(this),onKeyDown:this.onKeyDown.bind(this),tabIndex:this.props.tabIndex}),this.props.onAction?a.createElement("button",{className:t,onClick:this.onAction.bind(this)},a.createElement(v(),{content:this.props.action_label})):null)),a.createElement("div",{className:"error-area has-error"},a.createElement("span",null,e))))}}const _t=gt;var bt=s(1282);class yt extends a.Component{constructor(e){super(e),this.state={},this.onPublish=this.onPublish.bind(this),this.onReset=this.onReset.bind(this)}UNSAFE_componentWillMount(){this.updateAccountData(this.props.account),h.A.getFinalFeeAsset(this.props.account,"account_update")}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this.updateAccountData(e.account)}permissionsFromImmutableObj(e){let t=e.get("weight_threshold"),s=e.get("account_auths"),a=e.get("key_auths"),n=e.get("address_auths"),i=s.map((e=>e.get(0))),o=a.map((e=>e.get(0))),r=n.map((e=>e.get(0))),l=s.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),{});return l=a.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),l),l=n.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),l),{threshold:t,accounts:i,keys:o,addresses:r,weights:l}}permissionsToJson(e,t,s,a,n){let i={weight_threshold:e};return i.account_auths=t.sort(S.A.sortID).map((e=>[e,n[e]])).toJS(),i.key_auths=s.sort(S.A.sortID).map((e=>[e,n[e]])).toJS(),i.address_auths=a.sort(S.A.sortID).map((e=>[e,n[e]])).toJS(),i}updateAccountData(e){let t=this.permissionsFromImmutableObj(e.get("active")),s=this.permissionsFromImmutableObj(e.get("owner")),a=e.get("options").get("memo_key"),n={active_accounts:t.accounts,active_keys:t.keys,active_addresses:t.addresses,owner_accounts:s.accounts,owner_keys:s.keys,owner_addresses:s.addresses,active_weights:t.weights,owner_weights:s.weights,active_threshold:t.threshold,owner_threshold:s.threshold,memo_key:a,prev_active_accounts:t.accounts,prev_active_keys:t.keys,prev_active_addresses:t.addresses,prev_owner_accounts:s.accounts,prev_owner_keys:s.keys,prev_owner_addresses:s.addresses,prev_active_weights:t.weights,prev_owner_weights:s.weights,prev_active_threshold:t.threshold,prev_owner_threshold:s.threshold,prev_memo_key:a};this.setState(n)}isChanged(){let e=this.state;return e.active_accounts!==e.prev_active_accounts||e.active_keys!==e.prev_active_keys||e.active_addresses!==e.prev_active_addresses||e.owner_accounts!==e.prev_owner_accounts||e.owner_keys!==e.prev_owner_keys||e.owner_addresses!==e.prev_owner_addresses||e.active_threshold!==e.prev_active_threshold||e.owner_threshold!==e.prev_owner_threshold||e.memo_key!==e.prev_memo_key}didChange(e,t=this.state){if("memo"===e)return t.memo_key!==t.prev_memo_key;let s=!1;return["_keys","_active_addresses","_accounts","_threshold"].forEach((a=>{let n=e+a;t[n]!==t["prev_"+n]&&(s=!0)})),s}onPublish(){let e=this.state,t=this.props.account.toJS();t.fee={amount:0,asset_id:h.A.getFinalFeeAsset(t.id,"account_update")};let s={account:t.id};if(this.didChange("active")&&(s.active=this.permissionsToJson(e.active_threshold,e.active_accounts,e.active_keys,e.active_addresses,e.active_weights)),this.didChange("owner")&&(s.owner=this.permissionsToJson(e.owner_threshold,e.owner_accounts,e.owner_keys,e.owner_addresses,e.owner_weights)),this.didChange("owner")&&0===e.owner_keys.size&&0===e.owner_addresses.size&&1===e.owner_accounts.size&&e.owner_accounts.first()===t.id)return B.Notification.warning({message:N().translate("notifications.account_permissions_update_warning")});e.memo_key&&this.didChange("memo")&&this.isValidPubKey(e.memo_key)&&(s.new_options=this.props.account.get("options").toJS(),s.new_options.memo_key=e.memo_key),M.A.updateAccount(s)}isValidPubKey(e){return!!U.PublicKey.fromPublicKeyString(e)}onReset(){let e=this.state;this.setState({active_accounts:e.prev_active_accounts,active_keys:e.prev_active_keys,active_addresses:e.prev_active_addresses,owner_accounts:e.prev_owner_accounts,owner_keys:e.prev_owner_keys,owner_addresses:e.prev_owner_addresses,active_weights:e.prev_active_weights,owner_weights:e.prev_owner_weights,active_threshold:e.prev_active_threshold,owner_threshold:e.prev_owner_threshold,memo_key:e.prev_memo_key})}onAddItem(e,t,s){let a={},n=e+(S.A.is_object_id(t)?"_accounts":"_keys");a[n]=this.state[n].push(t),this.state[e+"_weights"][t]=s,this.setState(a)}onRemoveItem(e,t,s){console.log("onRemoveItem",e,t,s);let a={},n=e+s;a[n]=this.state[n].filter((e=>e!==t)),this.setState(a)}onThresholdChanged(e,t){let s=parseInt(t.target.value.trim()),a={};a[e]=s,this.setState(a)}validateAccount(e,t){return null}sumUpWeights(e,t,s,a){let n=e.reduce(((e,t)=>e+a[t]),0);return n=t.reduce(((e,t)=>e+a[t]),n),s.reduce(((e,t)=>e+a[t]),n)}onMemoKeyChanged(e){this.setState({memo_key:e})}onSetPasswordKeys(e,t=["active","owner","memo"]){let s={};t.forEach((t=>{s[`password_${t}`]=e[t]})),this.setState(s)}onPdfCreate(){(0,st.u)(this.props.account)}render(){let e,t,{active_accounts:s,active_keys:n,active_addresses:i,active_weights:o}=this.state,{owner_accounts:r,owner_keys:l,owner_addresses:c,owner_weights:d}=this.state,h=this.state.active_threshold>0?this.state.active_threshold:0,m=this.sumUpWeights(s,n,i,o);this.didChange("active")&&m<h&&(e=N().translate("account.perm.warning1",{weights_total:m,threshold:h})),h=this.state.owner_threshold>0?this.state.owner_threshold:0,m=this.sumUpWeights(r,l,c,d),this.didChange("owner")&&m<h&&(t=N().translate("account.perm.warning2",{weights_total:m,threshold:h}));let u="button"+(!e&&!t&&this.isChanged()&&this.isValidPubKey(this.state.memo_key)?"":" disabled"),g="button"+(this.isChanged()?"":" disabled"),_=p().Set();return _=_.add(this.props.account.get("id")),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{defaultActiveTab:1,segmented:!1,setting:"permissionsTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding",actionButtons:a.createElement("div",{className:"action-buttons"},a.createElement("button",{className:g,onClick:this.onReset,tabIndex:8},a.createElement(v(),{content:"account.perm.reset"})),a.createElement("button",{className:u,onClick:this.onPublish,tabIndex:9},a.createElement(v(),{content:"account.perm.publish"})),a.createElement("button",{className:"button",style:{marginLeft:10},"data-tip":N().translate("account.perm.create_paperwallet_private_hint"),onClick:()=>{this.onPdfCreate()},tabIndex:10},a.createElement(v(),{content:"account.perm.create_paperwallet"})))},a.createElement(q.o,{title:"account.perm.active"},a.createElement(fe.A,{path:"components/AccountPermActive"}),a.createElement("form",{className:"threshold"},a.createElement("label",{className:"horizontal"},a.createElement(v(),{content:"account.perm.threshold"})," "," ",a.createElement("input",{type:"number",placeholder:"0",size:"5",value:this.state.active_threshold,onChange:this.onThresholdChanged.bind(this,"active_threshold"),autoComplete:"off",tabIndex:1}))),a.createElement(mt,{label:"account.perm.add_permission_label",accounts:s,keys:n,weights:o,addresses:i,validateAccount:this.validateAccount.bind(this,"active"),onAddItem:this.onAddItem.bind(this,"active"),onRemoveItem:this.onRemoveItem.bind(this,"active"),placeholder:N().translate("account.perm.account_name_or_key"),tabIndex:2}),a.createElement("br",null),e?a.createElement("div",{className:"content-block has-error"},e):null),a.createElement(q.o,{title:"account.perm.owner"},a.createElement(fe.A,{path:"components/AccountPermOwner"}),a.createElement("form",{className:"threshold"},a.createElement("label",{className:"horizontal"},a.createElement(v(),{content:"account.perm.threshold"})," "," ",a.createElement("input",{type:"number",placeholder:"0",size:"5",value:this.state.owner_threshold,onChange:this.onThresholdChanged.bind(this,"owner_threshold"),autoComplete:"off",tabIndex:4}))),a.createElement(mt,{label:"account.perm.add_permission_label",accounts:r,keys:l,weights:d,addresses:c,validateAccount:this.validateAccount.bind(this,"owner"),onAddItem:this.onAddItem.bind(this,"owner"),onRemoveItem:this.onRemoveItem.bind(this,"owner"),placeholder:N().translate("account.perm.account_name_or_key"),tabIndex:5}),a.createElement("br",null),t?a.createElement("div",{className:"content-block has-error"},t):null),a.createElement(q.o,{title:"account.perm.memo_key"},a.createElement(fe.A,{style:{maxWidth:"800px"},path:"components/AccountPermMemo"}),a.createElement(_t,{ref:"memo_key",value:this.state.memo_key,label:"account.perm.memo_public_key",placeholder:"Public Key",onChange:this.onMemoKeyChanged.bind(this),tabIndex:7})),a.createElement(q.o,{title:"account.perm.password_model"},a.createElement(ut,{active:this.state.password_active,owner:this.state.password_owner,memo:this.state.password_memo,onSetPasswordKeys:this.onSetPasswordKeys.bind(this),account:this.props.account,activeKeys:this.state.active_keys,ownerKeys:this.state.owner_keys,memoKey:this.state.memo_key,onAddActive:this.onAddItem.bind(this,"active"),onRemoveActive:this.onRemoveItem.bind(this,"active"),onAddOwner:this.onAddItem.bind(this,"owner"),onRemoveOwner:this.onRemoveItem.bind(this,"owner"),onSetMemo:this.onMemoKeyChanged.bind(this)}))),a.createElement("div",{className:"tab-content",style:{padding:10}},a.createElement("div",{className:"divider"}),a.createElement(bt.$,{accountsList:_,limit:25,compactView:!1,filter:"account_update",style:{paddingBottom:"2rem"}})))))}}const ft=yt,Et="-----BEGIN BITSHARES SIGNED MESSAGE-----",vt="-----BEGIN META-----",At="-----BEGIN SIGNATURE-----",wt="-----END BITSHARES SIGNED MESSAGE-----",Ct="account",kt="memokey",St="block",xt="timestamp",Nt=Y.A.createActions(class{parseMessage(e){let t,s,a,n,i,o,r,l;try{t=e.split(Et)[1],s=t.split(vt),t=s[0].replace(/^\n|\n$/g,""),a=s[1].split(At),s=a[0].trim(),a=a[1].split(wt)[0].trim(),n=t+"\n"+s}catch(e){throw new Error(N().translate("account.signedmessages.invalidformat"))}if(s)try{i=s.split(Ct+"="),i=i[1].split("\n")[0].trim(),o=s.split(kt+"="),o=o[1].split("\n")[0].trim(),r=s.split(St+"="),r=r[1].split("\n")[0].trim(),l=s.split(xt+"="),l=l[1].split("\n")[0].trim()}catch(e){throw new Error(N().translate("account.signedmessages.invalidformat"))}return{content:t,meta:{account:i,key:o,block:r,timestamp:l},signed:n,signature:a}}verifyMemo(e){let t;if(t="string"==typeof e||e instanceof String?this.parseMessage(e):e,null==U.ChainStore.getAccount(t.meta.account))throw new Error(N().translate("account.signedmessages.invaliduser"));let s=!1;try{s=U.Signature.fromHex(t.signature).verifyBuffer(t.signed,U.PublicKey.fromPublicKeyString(t.meta.key))}catch(e){throw new Error(N().translate("account.signedmessages.errorverifying"))}if(!s)throw new Error(N().translate("account.signedmessages.invalidsignature"));return t}signMessage(e,t){return new Promise(((s,a)=>{nt.A.unlock().then((()=>{try{let n,i=e.get("options").get("memo_key");if(/111111111111111111111/.test(i)&&(i=null),t&&i&&(n=ee.A.getPrivateKey(i),!n))throw new Error(N().translate("account.signedmessages.invalidkey"));let o=U.ChainStore.getObject("2.1.0").get("last_irreversible_block_num"),r=new Date,l=Ct+"="+e.get("name")+"\n"+kt+"="+i+"\n"+St+"="+o+"\n"+xt+"="+r.toUTCString(),c=t+"\n"+l;setTimeout((()=>{try{let e=U.Signature.signBuffer(c,n,i),a=Et+"\n"+t+"\n"+vt+"\n"+l+"\n"+At+"\n"+e.toHex()+"\n"+wt;s(a)}catch(e){a(e)}}),0)}catch(e){a(e)}})).catch((e=>{a(e)}))}))}});class Mt extends a.Component{static defaultProps={noVerification:!1};constructor(e){super(e),this.state={message:this.props.message,messageParsed:null,showRawMessage:!1,noVerification:this.props.noVerification,verified:null,notification:null}}_verifyMessage(e){this.setState({message:e,messageParsed:null,verified:null});let t=null;try{t=Nt.parseMessage(e),this.setState({verified:null,messageParsed:t}),this.state.noVerification||(this.setState({verified:null,notification:N().translate("account.signedmessages.verifying")}),setTimeout((()=>{try{Nt.verifyMemo(t),this.setState({verified:!0,notification:""})}catch(e){this._warning(e.message),this.setState({verified:!1})}}),0))}catch(e){this._warning(e.message)}}UNSAFE_componentWillMount(){this._verifyMessage(this.state.message)}UNSAFE_componentWillReceiveProps(e){let t=e.message;null!=t&&null!=t&&t==this.state.message||this._verifyMessage(t)}_warning(e){this.setState({notification:e})}_toggleRawMessage(){this.setState({showRawMessage:!this.state.showRawMessage})}render(){let e,t;null!=this.state.messageParsed&&(null==this.state.verified?(t="#FFF",e="Unverified message from "+this.state.messageParsed.meta.account):this.state.verified?(t="#FFF",e="Verified message from "+this.state.messageParsed.meta.account):(t="#F00",e="Refuted message, indicated sender "+this.state.messageParsed.meta.account));let s=null!=this.props.message&&""!=this.props.message,n=this.state.notification&&""!=this.state.notification;return a.createElement("div",{style:{color:"gray",margin:"10px 10px"}},null!=this.state.messageParsed&&a.createElement("fieldset",{style:{borderColor:t}},a.createElement("legend",{style:{color:"white",weight:"bold"}},e),a.createElement("pre",{style:{position:"relative",width:"100%",display:"table"}},this.state.messageParsed.content,n&&a.createElement("div",{style:{textAlign:"center",display:"table-cell",verticalAlign:"middle",position:"absolute",width:"calc(100% - 30px)",height:"calc(100% + 15px)",top:"0px",right:"30px",backgroundColor:"rgba(50,50,50,0.5)"},id:"overlay"},this.state.notification)),a.createElement("span",{style:{fontSize:"small",float:"right"}},"Signed on ",this.state.messageParsed.meta.timestamp," "," ",a.createElement("button",{className:"button",type:"button",style:{fontSize:"small",float:"right",padding:"0px 0px",background:"#777"},onClick:this._toggleRawMessage.bind(this)},"🔍")),this.state.showRawMessage&&a.createElement("br",null),this.state.showRawMessage&&a.createElement("br",null),this.state.showRawMessage&&a.createElement("div",{style:{overflow:"auto",width:"calc(100%)",maxWidth:"1000px"}},a.createElement("pre",null,this.state.message))),s&&null==this.state.messageParsed&&a.createElement("fieldset",{style:{borderColor:"#F00"}},a.createElement("legend",{style:{color:"red",weight:"bold"},className:"error"},"Error while parsing message, please check syntax from message below"),a.createElement("pre",null,this.props.message)))}}const It=Mt;class Pt extends a.Component{static propTypes={account:l.A.ChainAccount.isRequired};constructor(e){super(e),this.state={tabsm_memo_key:this.props.account.get("options").get("memo_key"),tabsm_popup:"",tabsm_message_text:"",tabsm_message_signed:"",tabvm_popup:"",tabvm_message_signed:"",tabvm_verified:null,tabvm_message_signed_and_verified:null,tabvm_flag_verifyonchange:!1}}_tabSMSignAction(e){e.preventDefault();try{let e=this.props.account.get("options").get("memo_key");if(this.state.tabsm_memo_key!==e)throw Error(N().translate("account.signedmessages.keymismatch"));this.state.tabsm_message_text&&(this._tabSMPopMessage(N().translate("account.signedmessages.signing"),0),Nt.signMessage(this.props.account,this.state.tabsm_message_text).then((e=>{this.setState({tabsm_message_signed:e,tabsm_popup:""})})).catch((e=>{this._tabSMPopMessage(e.message),this.setState({tabsm_message_signed:null})})))}catch(e){this._tabSMPopMessage(e.message),this.setState({tabsm_message_signed:null})}}_tabSMHandleChange(e){this.setState({tabsm_message_text:e.target.value})}_tabSMHandleChangeKey(e){this.setState({tabsm_memo_key:e})}_tabSMCopyToClipBoard(e){if(""!==e.target.value){e.target.focus(),e.target.select();try{var t=document.execCommand("copy");this._tabSMPopMessage(t?N().translate("account.signedmessages.copysuccessful"):N().translate("account.signedmessages.copyunsuccessful"))}catch(e){this._tabSMPopMessage(N().translate("account.signedmessages.copyunsuccessful"))}}}_tabSMPopMessage(e,t=3e3){this.setState({tabsm_popup:e}),""!==e&&t>0&&setTimeout((()=>{this.setState({tabsm_popup:""})}),t)}_tabVMAction(e){e.preventDefault(),this.setState({tabvm_message_signed_and_verified:null,tabvm_verified:!1}),this.state.tabvm_message_signed&&(this._tabVMPopMessage(N().translate("account.signedmessages.verifying"),0),setTimeout((()=>{try{let e=Nt.verifyMemo(this.state.tabvm_message_signed);this.setState({tabvm_message_signed_and_verified:e,tabvm_verified:!0,tabvm_popup:""})}catch(e){this._tabVMPopMessage(e.message),this.setState({tabvm_message_signed_and_verified:null,tabvm_verified:!1})}}),0))}_tabVMHandleChange(e){this.setState({tabvm_message_signed:e.target.value,tabvm_verified:!1,tabvm_message_signed_and_verified:null}),this.state.tabvm_flag_verifyonchange&&this._tabVMAction(e)}_tabVMPopMessage(e,t=3e3){this.setState({tabvm_popup:e}),""!==e&&t>0&&setTimeout((()=>{this.setState({tabvm_popup:""})}),t)}_tabVMToggleVerifyOnChange(){this.setState({tabvm_flag_verifyonchange:!this.state.tabvm_flag_verifyonchange})}render(){return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",setting:"accountSignedMessagesTab",contentClass:"grid-content shrink small-vertical medium-horizontal padding",segmented:!1},a.createElement(q.o,{title:"account.signedmessages.signmessage"},a.createElement("div",{className:"grid-content",style:{overflowX:"hidden"}},a.createElement("div",{className:"content-block no-margin"},a.createElement("h3",null,a.createElement(v(),{content:"account.signedmessages.signmessage"}))),a.createElement(_t,{ref:"memo_key",value:this.state.tabsm_memo_key,label:"account.perm.memo_public_key",placeholder:"Public Key",tabIndex:7,onChange:this._tabSMHandleChangeKey.bind(this),disableActionButton:!0}),a.createElement("br",null),a.createElement("textarea",{rows:"10",value:this.state.tabsm_message_text,onChange:this._tabSMHandleChange.bind(this),placeholder:N().translate("account.signedmessages.entermessage")}),a.createElement("span",null,a.createElement("button",{className:"button",onClick:this._tabSMSignAction.bind(this)},a.createElement(v(),{content:"account.signedmessages.sign"})),a.createElement("div",{style:{color:"gray"}},this.state.tabsm_popup)),a.createElement("br",null),a.createElement("br",null),a.createElement("textarea",{rows:"14",value:this.state.tabsm_message_signed,style:{editable:!1},placeholder:N().translate("account.signedmessages.automaticcreation"),onClick:this._tabSMCopyToClipBoard.bind(this)}))),a.createElement(q.o,{title:"account.signedmessages.verifymessage"},a.createElement("div",{className:"grid-content",style:{overflowX:"hidden"}},a.createElement("div",{className:"content-block no-margin"},a.createElement("h3",null,a.createElement(v(),{content:"account.signedmessages.verifymessage"})),a.createElement("div",{style:{float:"right",marginTop:"0.1em",marginBottom:"0.5em"}},a.createElement("table",null,a.createElement("tr",null,a.createElement("td",null,a.createElement("label",{style:{marginBottom:0,marginRight:"0.5rem"}},a.createElement(v(),{content:"account.signedmessages.verifyonchange"}))),a.createElement("td",null,a.createElement(B.Switch,{checked:this.state.tabvm_flag_verifyonchange,onChange:this._tabVMToggleVerifyOnChange.bind(this)})))))),a.createElement("textarea",{rows:"10",value:this.state.tabvm_message_signed,onChange:this._tabVMHandleChange.bind(this),placeholder:N().translate("account.signedmessages.entermessage")}),a.createElement("span",null,a.createElement("button",{className:"button",onClick:this._tabVMAction.bind(this)},a.createElement(v(),{content:"account.signedmessages.verify"})),a.createElement("text",{style:{color:"gray"}},this.state.tabvm_popup),null!==this.state.tabvm_verified&&a.createElement("div",{style:{float:"right"}},"Message is:",a.createElement("div",{style:{backgroundColor:this.state.tabvm_verified?"green":"red"}},a.createElement("label",null,this.state.tabvm_verified?"verified":"not verified"))),(this.state.tabvm_verified&&null!==this.state.tabvm_message_signed_and_verified||this.state.tabvm_flag_verifyonchange)&&a.createElement("div",null,a.createElement("br",null),a.createElement(It,{message:this.state.tabvm_message_signed})))))))))}}const Bt=Pt=(0,c.A)(Pt);var Tt=s(27960),Ot=s.n(Tt);class Ft extends a.Component{static propTypes={account:l.A.ChainAccount.isRequired};static defaultProps={tempComponent:"tr"};render(){let{account:e,onRemove:t}=this.props;return a.createElement("tr",null,a.createElement("td",null,this.props.index),a.createElement("td",null,e.get("id")),a.createElement("td",null,a.createElement(Ie.A,{account:e.get("id")})),t?a.createElement("td",null,a.createElement("button",{onClick:t.bind(this,e.get("id")),className:"button outline"},"Remove")):null)}}Ft=(0,c.A)(Ft);class Lt extends a.Component{_onRemove(e,t,s){if(t){let s=this.props.getCurrentState(t),a=$.A.new_transaction();a.add_type_operation("account_whitelist",{fee:{amount:0,asset_id:U.ChainStore.assets_by_symbol.get(this.props.settings.get("fee_asset"))||"1.3.0"},authorizing_account:this.props.account.get("id"),account_to_list:t,new_listing:s-Ot().account_listing[e]}),ee.A.process_transaction(a,null,!0)}}render(){let{removeButton:e,white:t,list:s}=this.props,n=s.map(((s,n)=>a.createElement(Ft,{key:s,onRemove:e?this._onRemove.bind(this,t?"white_listed":"black_listed"):null,account:s,index:n+1}))).toArray(),i=!0;return n.length||(i=!1,n.push(a.createElement("tr",{key:"empty"},a.createElement("td",{style:{padding:"1rem 0"},colSpan:e?4:3},a.createElement(v(),{content:this.props.emptyText,account:this.props.account.get("name")}))))),a.createElement("table",{className:"table compact dashboard-table"},i?a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"#"),a.createElement("th",null,a.createElement(v(),{content:"account.id"})),a.createElement("th",null,a.createElement(v(),{content:"account.name"})),e?a.createElement("th",null):null)):null,a.createElement("tbody",null,n))}}Lt=(0,d.N)(Lt,{listenTo:()=>[o.A],getProps:()=>({settings:o.A.getState().settings})});class Rt extends a.Component{constructor(e){super(e),this.state={accountName:"",accountToList:null}}_getCurrentState(e){let{account:t}=this.props,s=t.get("whitelisted_accounts")||p().List(),a=t.get("blacklisted_accounts")||p().List(),n=Ot().account_listing.no_listing;return s.includes(e)&&(n+=Ot().account_listing.white_listed),a.includes(e)&&(n+=Ot().account_listing.black_listed),n}_onAdd(e,t){let{accountToList:s}=this.state,{account:a}=this.props,n=this._getCurrentState(s);if(s){let t=$.A.new_transaction();t.add_type_operation("account_whitelist",{fee:{amount:0,asset_id:"1.3.0"},authorizing_account:a.get("id"),account_to_list:s,new_listing:n+Ot().account_listing[e]}),ee.A.process_transaction(t,null,!0)}}_onAccountFound(e){console.log("accountFound:",e),this.setState({accountName:e?e.get("name"):null,accountToList:e?e.get("id"):null})}_onAccountChanged(e){console.log("account changed:",e),this.setState({accountName:e,accountToList:null})}render(){let{account:e}=this.props,{accountName:t}=this.state;return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",setting:"whitelistTab",contentClass:"grid-content shrink small-vertical medium-horizontal no-padding",segmented:!1},a.createElement(q.o,{title:"account.whitelist.title"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(Lt,{emptyText:"account.whitelist.empty",account:e,getCurrentState:this._getCurrentState.bind(this),list:e.get("whitelisted_accounts")||p().List(),removeButton:!0,white:!0})),e.get("whitelisted_accounts")?null:a.createElement("p",{className:"has-error"},"Please note, whitelisting is not working yet due to unresolved backend issue."),a.createElement("div",{style:{padding:"2rem 0"}},a.createElement(I.A,{label:"account.whitelist.add",accountName:t,onAccountChanged:this._onAccountFound.bind(this),onChange:this._onAccountChanged.bind(this),account:t,tabIndex:2,onAction:this._onAdd.bind(this,"white_listed"),action_label:"account.perm.confirm_add",white:!1,typeahead:!0})))),a.createElement(q.o,{title:"account.whitelist.black"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(Lt,{emptyText:"account.whitelist.empty_black",account:e,getCurrentState:this._getCurrentState.bind(this),list:e.get("blacklisted_accounts"),removeButton:!0})),a.createElement("div",{style:{padding:"2rem 1rem"}},a.createElement(I.A,{label:"account.whitelist.add_black",accountName:t,onAccountChanged:this._onAccountFound.bind(this),onChange:this._onAccountChanged.bind(this),account:t,tabIndex:2,onAction:this._onAdd.bind(this,"black_listed"),action_label:"account.perm.confirm_add",typeahead:!0})))),a.createElement(q.o,{title:"account.whitelist.white_by"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(Lt,{emptyText:"account.whitelist.empty_white_by",account:e,list:e.get("whitelisting_accounts")})))),a.createElement(q.o,{title:"account.whitelist.black_by"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(Lt,{emptyText:"account.whitelist.empty_black_by",account:e,list:e.get("blacklisting_accounts")}))))))))}}const qt=Rt;function Vt(e,t){let s,a="",n=0;return"witness"===e?s=U.ChainStore.getWitnessById(t.get("id")):"committee"===e&&(s=U.ChainStore.getCommitteeMemberById(t.get("id"))),a=s?s.get("url"):a,a=S.A.sanitize(a),n=s?s.get("total_votes"):n,{url:a,votes:n,id:s.get("id")}}class Dt extends a.Component{static propTypes={items:l.A.ChainObjectsList,onAddItem:y().func.isRequired,onRemoveItem:y().func.isRequired,validateAccount:y().func,label:y().string.isRequired,placeholder:y().string,tabIndex:y().number,action:y().string,filterSearch:y().string};static defaultProps={action:"remove",filterSearch:null};constructor(e){super(e),this.state={selected_item:null,item_name_input:"",error:null},this.onItemChange=this.onItemChange.bind(this),this.onItemAccountChange=this.onItemAccountChange.bind(this),this.onAddItem=this.onAddItem.bind(this)}onItemChange(e){this.setState({item_name_input:e})}onItemAccountChange(e){if(this.setState({selected_item:e,error:null}),e&&this.props.validateAccount){let t=this.props.validateAccount(e);if(null===t)return;"string"==typeof t?this.setState({error:t}):t.then((e=>this.setState({error:e})))}}onAddItem(e){e&&(this.setState({selected_item:null,item_name_input:"",error:null}),this.props.onAddItem(e.get("id")))}getHeader(){let e=["10%","20%","40%","20%","10%"];return[{title:"#",dataIndex:"num",align:"right",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(v(),{content:"account.votes.name"}),dataIndex:"name",align:"left",sorter:(e,t)=>e.key>t.key?1:e.key<t.key?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[1],whiteSpace:"nowrap"}},a.createElement(Ie.A,{account:t}))},{title:a.createElement(v(),{content:"account.votes.about"}),dataIndex:"about",render:t=>a.createElement("span",{style:{maxWidth:e[2],whiteSpace:"nowrap"}},a.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},a.createElement(V.A,{name:"share",title:"icons.share"})))},{title:a.createElement(v(),{content:"account.votes.votes"}),dataIndex:"votes",sorter:(e,t)=>e.votes-t.votes,render:t=>a.createElement("span",{style:{maxWidth:e[3],whiteSpace:"nowrap"}},a.createElement(C.A,{amount:t,asset:"1.3.0",decimalOffset:5,hide_asset:!0}))},{title:a.createElement(v(),{content:"account.votes.status.title"}),dataIndex:"title",sorter:(e,t)=>e.title>t.title?1:e.title<t.title?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[4],whiteSpace:"nowrap"}},a.createElement(v(),{content:t}))},{title:a.createElement(v(),{content:"account.votes.supported"}),dataIndex:"supported",align:"center",sorter:(e,t)=>e.supported.translate>t.supported.translate?1:e.supported.translate<t.supported.translate?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[0],whiteSpace:"nowrap"},className:t.proxy?"":"clickable",onClick:t.proxy?()=>{}:t.onAction.bind(this,t.item_id)},a.createElement(v(),{content:t.translate}))},{title:a.createElement(v(),{content:"account.votes.toggle"}),dataIndex:"toggle",render:t=>a.createElement("span",{style:{maxWidth:e[5],whiteSpace:"nowrap"},className:t.proxy?"":"clickable",onClick:t.proxy?()=>{}:t.onAction.bind(this,t.item_id)},t.proxy?a.createElement(V.A,{name:"locked",title:"icons.locked.action"}):a.createElement(V.A,{name:t.isSupported?"checkmark-circle":"minus-circle",title:t.isSupported?"icons.checkmark_circle.yes":"icons.minus_circle.no"}))}]}_decideRowClassName(e,t){return e.toggle.isSupported?"":"unsupported"}render(){if(!this.props.items)return null;const e=this.getHeader();let t=this.props.items.filter((e=>!(!e||this.props.filterSearch&&-1===e.get("name").indexOf(this.props.filterSearch)&&-1===e.get("id").indexOf(this.props.filterSearch)))).sort(((e,t)=>{let{votes:s}=Vt(this.props.type,e),{votes:a}=Vt(this.props.type,t);return s!==a?parseInt(a,10)-parseInt(s,10):e.get("name")>t.get("name")?1:e.get("name")<t.get("name")?-1:0})).map(((e,t)=>{let s=this.props.supported&&this.props.supported.includes(e.get("id"))?"remove":"add",a=this.props.active.includes(Vt(this.props.type,e).id);return(e=>{let{account:t,type:s,action:a,isActive:n,idx:i,proxy:o,onAction:r,key:l}=e,c=t.get("id"),{url:d,votes:h}=Vt(s,t),m=d&&d.length>0&&-1===d.indexOf("http")?"http://"+d:d;const p="remove"===a;return{key:l,num:i+1,name:t.get("id"),about:m&&-1!==m.indexOf(".")?m:null,votes:h,title:"account.votes."+(n?"active_short":"inactive"),supported:{translate:"settings."+(p?"yes":"no"),proxy:o,item_id:c,onAction:r},toggle:{proxy:o,isSupported:p,item_id:c,onAction:r}}})({idx:t,key:e.get("name"),account:e,type:this.props.type,onAction:"add"===s?this.props.onAddItem:this.props.onRemoveItem,isSelected:-1!==this.props.items.indexOf(e),action:s,isActive:a,proxy:this.props.proxy})})),s=this.state.error;return!s&&this.state.selected_item&&-1!==this.props.items.indexOf(this.state.selected_item)&&(s=N().translate("account.votes.already")),a.createElement("div",null,t.length?a.createElement($e.A,{className:"table dashboard-table table-hover",rowClassName:this._decideRowClassName.bind(this),rows:t,header:e,pageSize:20,label:"utility.total_x_assets",leftPadding:"1.5rem"}):null)}}const jt=(0,c.A)(Dt);class Ut extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e)}getInitialState(e){return{witnessAccount:e.account,witnessObject:null,signingKey:"",url:""}}shouldComponentUpdate(e,t){return this.state.url!==t.visible||this.props.visible!==e.visible||this.state.signingKey!==t.signingKey||this.state.witnessAccount!==t.witnessAccount||this.props.updateOrCreate!==e.updateOrCreate}componentDidUpdate(e){let t=e.account.get("id");this.props.account.get("id")===t&&null!=this.state.witnessObject||U.ChainStore.fetchWitnessByAccount(this.props.account.get("id")).then((e=>{null==e?(this.props.hideModal(),this.setState({witnessObject:{}})):this.setState({witnessObject:e,url:e.get("url"),signingKey:e.get("signing_key"),witness_id:e.get("id")})}))}onAddWitness(){const{witnessAccount:e,signingKey:t,url:s}=this.state;e&&t&&(this.props.updateOrCreate?n.A.updateWitness({account:e,url:this.state.url,signingKey:this.state.signingKey,witness_id:this.state.witnessObject.get("id")}):n.A.createWitness({account:e,url:s,signingKey:t})),this.props.hideModal()}onChangeCommittee(e){this.setState({witnessAccount:e})}onMemoKeyChanged(e){this.setState({signingKey:e.target.value})}onUrlChanged(e){this.setState({url:S.A.sanitize(e.target.value.toLowerCase())})}isValidPubKey=e=>!U.PublicKey.fromPublicKeyString(e);render(){const{witnessAccount:e,signingKey:t,url:s}=this.state;return a.createElement(B.Modal,{title:N().translate("modal.witness.create_witness"),onCancel:this.props.hideModal,visible:this.props.visible,footer:[a.createElement(B.Button,{key:"submit",type:"primary",onClick:this.onAddWitness.bind(this)},N().translate("modal.witness.confirm")),a.createElement(B.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.props.hideModal},N().translate("modal.cancel"))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(I.A,{label:"modal.witness.witness_account",accountName:e&&e.get("name")||account.get("name"),account:e,onAccountChanged:this.onChangeCommittee.bind(this),size:35,typeahead:!0}),a.createElement(v(),{content:"modal.witness.text",unsafe:!0,component:"p"}),a.createElement(B.Form.Item,{label:N().translate("modal.witness.url")},a.createElement(B.Input,{value:s,onChange:this.onUrlChanged.bind(this),placeholder:N().translate("modal.witness.web_example")})),a.createElement(B.Form.Item,{label:N().translate("modal.witness.public_signing_key")},this.isValidPubKey(t)?a.createElement("label",{className:"right-label",style:{marginTop:"-30px",position:"static"}},a.createElement(v(),{content:"modal.witness.invalid_key"})):null,a.createElement(B.Input,{addonBefore:a.createElement(V.A,{name:"key",title:"icons.key",size:"1x"}),value:t,onChange:this.onMemoKeyChanged.bind(this),placeholder:N().translate("modal.witness.enter_public_signing_key")}))))}}const Wt=Ut;class zt extends a.Component{constructor(e){super(e),this.state={showCreateWitnessModal:!1}}render(){const e=()=>{this.setState({showCreateWitnessModalUpdate:!1,showCreateWitnessModal:!this.state.showCreateWitnessModal})},t=this.props.onFilterChange,s=this.props.validateAccountHandler,n=this.props.addWitnessHandler,i=this.props.removeWitnessHandler,{showCreateWitnessModal:o,showCreateWitnessModalUpdate:r}=this.state,{all_witnesses:l,proxy_witnesses:c,witnesses:d,proxy_account_id:h,hasProxy:m,globalObject:p,filterSearch:u,account:g}=this.props;return a.createElement("div",null,a.createElement("div",{className:ye()("content-block")},a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(B.Button,{onClick:e},a.createElement(v(),{content:"account.votes.join_witnesses"})),a.createElement(B.Button,{style:{marginLeft:"8px"},onClick:()=>{this.setState({showCreateWitnessModalUpdate:!0,showCreateWitnessModal:!this.state.showCreateWitnessModal})}},a.createElement(v(),{content:"account.votes.update_witness"}))),a.createElement("div",{className:"selector inline-block"},a.createElement(z.A,{placeholder:N().translate("explorer.witnesses.filter_by_name"),value:u,onChange:t}))),a.createElement(jt,{type:"witness",label:"account.votes.add_witness_label",items:l,validateAccount:s,onAddItem:n,onRemoveItem:i,tabIndex:m?-1:2,supported:m?c:d,active:p.get("active_witnesses"),proxy:h,filterSearch:u})),a.createElement(Wt,{visible:o,account:g,updateOrCreate:r,hideModal:e}))}}class Kt extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e)}getInitialState(){return{committeeAccount:this.props.account,url:""}}shouldComponentUpdate(e,t){return this.props.visible!==e.visible||this.state.url!==t.url||this.state.committeeAccount!==t.committeeAccount}onAddComittee(){const{committeeAccount:e,url:t}=this.state;e&&t&&n.A.createCommittee({account:e,url:t}),this.props.hideModal()}onChangeCommittee(e){this.setState({committeeAccount:e})}onUrlChanged(e){this.setState({url:S.A.sanitize(e.target.value.toLowerCase())})}onClose(){this.props.hideModal(),this.setState(this.getInitialState(this.props))}render(){const{url:e,committeeAccount:t}=this.state;return a.createElement(B.Modal,{title:N().translate("modal.committee.create_committee"),visible:this.props.visible,onCancel:this.props.hideModal,footer:[a.createElement(B.Button,{key:"submit",type:"primary",onClick:this.onAddComittee.bind(this)},N().translate("modal.committee.confirm")),a.createElement(B.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.onClose.bind(this)},N().translate("modal.cancel"))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(I.A,{label:"modal.committee.from",accountName:t&&t.get("name")||account.get("name"),account:t||account,onAccountChanged:this.onChangeCommittee.bind(this),size:35,typeahead:!0}),a.createElement(v(),{content:"modal.committee.text",unsafe:!0,component:"p"}),a.createElement(B.Form.Item,{label:N().translate("modal.committee.url")},a.createElement(B.Input,{value:e,onChange:this.onUrlChanged.bind(this),placeholder:N().translate("modal.committee.web_example")}))))}}const Jt=Kt;class Ht extends a.Component{constructor(e){super(e),this.state={showCreateCommitteeModal:!1}}render(){const e=()=>{console.log("show committee modal"),this.setState({showCreateCommitteeModal:!this.state.showCreateCommitteeModal})},t=this.props.onFilterChange,s=this.props.validateAccountHandler,n=this.props.addCommitteeHandler,i=this.props.removeCommitteeHandler,{showCreateCommitteeModal:o}=this.state,{all_committee:r,proxy_committee:l,committee:c,proxy_account_id:d,hasProxy:h,globalObject:m,filterSearch:p,account:u}=this.props;return a.createElement("div",null,a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(B.Button,{onClick:e},a.createElement(v(),{content:"account.votes.join_committee"}))),a.createElement("div",{className:"selector inline-block"},a.createElement(z.A,{placeholder:N().translate("explorer.witnesses.filter_by_name"),value:p,onChange:t}))),a.createElement("div",{className:ye()("content-block")},a.createElement(jt,{type:"committee",label:"account.votes.add_committee_label",items:r,validateAccount:s,onAddItem:n,onRemoveItem:i,tabIndex:h?-1:3,supported:h?l:c,active:m.get("active_committee_members"),proxy:d,filterSearch:p})),a.createElement(Jt,{visible:o,account:u,hideModal:e}))}}var Gt=s(37554),Zt=s(96644),Qt=s.n(Zt);const Yt=["1.14.114","1.14.107"];class Xt extends a.Component{constructor(e){super(e)}onApprove(e){let t=[],s=[];e.vote_ids.has(e.worker.get("vote_against"))&&s.push(e.worker.get("vote_against")),e.vote_ids.has(e.worker.get("vote_for"))||t.push(e.worker.get("vote_for")),this.props.onChangeVotes(t,s)}onReject(e){let t=[];e.vote_ids.has(e.worker.get("vote_against"))&&t.push(e.worker.get("vote_against")),e.vote_ids.has(e.worker.get("vote_for"))&&t.push(e.worker.get("vote_for")),this.props.onChangeVotes([],t)}getHeader(e,t){return[2===e?null:{title:a.createElement(v(),{component:"span",content:"account.votes.line",style:{whiteSpace:"nowrap"}}),dataIndex:"line",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",paddingRight:10,paddingLeft:0,whiteSpace:"nowrap"}},e||N().translate("account.votes.expired"))},{title:a.createElement(v(),{content:"account.user_issued_assets.id",style:{whiteSpace:"nowrap"}}),dataIndex:"assets_id",align:"center",sorter:(e,t)=>e.assets_id>t.assets_id?1:e.assets_id<t.assets_id?-1:0,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(v(),{content:"account.user_issued_assets.description",style:{whiteSpace:"nowrap"}}),dataIndex:"description",align:"left",sorter:(e,t)=>e.description.name>t.description.name?1:e.description.name<t.description.name?-1:0,render:e=>a.createElement("span",null,a.createElement("div",{className:"inline-block",style:{paddingRight:5,position:"relative",top:-1,whiteSpace:"nowrap"}},a.createElement("a",{style:{visibility:e.url&&-1!==e.url.indexOf(".")?"visible":"hidden"},href:S.A.sanitize(e.url),target:"_blank",rel:"noopener noreferrer"},a.createElement(V.A,{name:"share",size:"2x",title:"icons.share"}))),a.createElement("div",{className:"inline-block"},e.name,a.createElement("br",null),a.createElement(Ie.A,{account:e.worker_account,maxDisplayAccountNameLength:null})))},{className:"column-hide-small",title:a.createElement(v(),{content:"account.votes.total_votes",style:{whiteSpace:"nowrap"}}),dataIndex:"total_votes",align:"right",sorter:(e,t)=>e.total_votes-t.total_votes,render:e=>a.createElement(C.A,{amount:e,asset:"1.3.0",decimalOffset:5,hide_asset:!0,style:{whiteSpace:"nowrap"}})},0===e?{title:a.createElement(v(),{content:"account.votes.missing",style:{whiteSpace:"nowrap"}}),dataIndex:"missing",align:"right",sorter:(e,t)=>e.missing-t.missing,render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"}},a.createElement(C.A,{amount:Math.max(0,e),asset:"1.3.0",hide_asset:!0,decimalOffset:5}))}:null,{title:a.createElement(v(),{content:"explorer.workers.period",style:{whiteSpace:"nowrap"}}),dataIndex:"period",align:"right",sorter:(e,t)=>new Date(e.period.startDate)-new Date(t.period.startDate),render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e.startDate," - ",e.endDate)},2===e||0===e?null:{title:a.createElement(v(),{content:"account.votes.funding",style:{whiteSpace:"nowrap"}}),dataIndex:"funding",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"},className:"hide-column-small"},e.isExpired?"-":S.A.format_number(e.fundedPercent,2)+"%")},2===e||0===e?null:{title:a.createElement("span",null,a.createElement(v(),{content:"explorer.witnesses.budget",style:{whiteSpace:"nowrap"}}),a.createElement("div",{style:{paddingTop:5,fontSize:"0.8rem"}},"(",a.createElement(W.A,{name:t}),")")),dataIndex:"budget",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"}},e.rest<=0?e.isExpired?"-":"0.00":a.createElement(Gt.Rq,{hide_asset:!0,fromAsset:"1.3.0",toAsset:e.preferredUnit,amount:e.rest}))},{className:"column-hide-small",title:a.createElement("span",null,a.createElement(v(),{content:"account.votes.daily_pay",style:{whiteSpace:"nowrap"}}),a.createElement("div",{style:{paddingTop:5,fontSize:"0.8rem"}},"(",a.createElement(W.A,{name:t}),")")),dataIndex:"daily_pay",align:"right",sorter:(e,t)=>e.daily_pay.daily_pay-t.daily_pay.daily_pay,render:e=>a.createElement("span",{className:e.proxy?"":"clickable",style:{whiteSpace:"nowrap"},onClick:e.proxy?()=>{}:this[e.approvalState?"onReject":"onApprove"].bind(this,e)},a.createElement(Gt.Rq,{hide_asset:!0,fromAsset:"1.3.0",toAsset:e.preferredUnit,amount:e.daily_pay,style:{whiteSpace:"nowrap"}}))},{className:"column-hide-small",title:a.createElement(v(),{content:"account.votes.toggle",style:{whiteSpace:"nowrap"}}),dataIndex:"toggle",align:"right",render:e=>a.createElement("span",{className:e.proxy?"":"clickable",style:{whiteSpace:"nowrap"},onClick:e.proxy?()=>{}:this[e.approvalState?"onReject":"onApprove"].bind(this,e)},e.proxy?a.createElement(V.A,{name:"locked",title:"icons.locked.action"}):a.createElement(V.A,{name:e.approvalState?"checkmark-circle":"minus-circle",title:e.approvalState?"icons.checkmark_circle.approved":"icons.minus_circle.disapproved"}))}].filter((e=>e))}getData(e,t=0){let{hasProxy:s,proxy_vote_ids:a,vote_ids:n}=this.props;return n=s?a:n,t=t||0,e.map(((e,a)=>{let i=e.worker.toJS();const o=a+1;let r=i.total_votes_for-i.total_votes_against,l=!!n.has(i.vote_for)||!n.has(i.vote_against)&&null,c=0;i.daily_pay<e.rest?c=100:e.rest>0&&(c=e.rest/i.daily_pay*100);let d=N().localize(new Date(i.work_begin_date+"Z"),{type:"date",format:"short_custom"}),h=N().localize(new Date(i.work_end_date+"Z"),{type:"date",format:"short_custom"}),m=new Date,p=new Date(i.work_end_date+"Z")<=m,u=new Date(i.work_begin_date+"Z")<=m,g=!p&&r<t||!u,_=!!e.poll;return{key:i.id,line:!_&&p||p?null:o,assets_id:i.id,description:i,total_votes:r,missing:t-r,period:{startDate:d,endDate:h},funding:_||!p&&!g?{isExpired:p,fundedPercent:c}:null,daily_pay:{preferredUnit:e.preferredUnit,daily_pay:i.daily_pay,proxy:s,approvalState:l,worker:e.worker,vote_ids:n},budget:_||!p&&!g?{rest:e.rest,isExpired:p,preferredUnit:e.preferredUnit,rest:e.rest}:null,toggle:{proxy:s,approvalState:l,worker:e.worker,vote_ids:n}}}))}_getMappedWorkers(e,t,s){let a,n=new Date,i=t;return{mappedWorkers:e.sort(((e,t)=>this._getTotalVotes(t)-this._getTotalVotes(e))).map((e=>{e.isOngoing=new Date(e.get("work_end_date")+"Z")>n&&new Date(e.get("work_begin_date")+"Z")<=n,e.isUpcoming=new Date(e.get("work_begin_date")+"Z")>n,e.isExpired=new Date(e.get("work_end_date")+"Z")<=n;let t=parseInt(e.get("daily_pay"),10);return e.votes=e.get("total_votes_for")-e.get("total_votes_against"),i>0&&e.isOngoing?(e.active=!0,i-=t,i<=0&&!a&&(a=e.votes),e.remainingPayout=i+t):(e.active=!1,e.remainingPayout=0),e})).filter((e=>{const t=e.get("name").toLowerCase();return e&&-1!==t.indexOf(s)})).sort(((e,t)=>e.isExpired!==t.isExpired?e.isExpired?1:-1:this._getTotalVotes(t)-this._getTotalVotes(e))),voteThreshold:a}}_getTotalVotes(e){return parseInt(e.get("total_votes_for"),10)-parseInt(e.get("total_votes_against"),10)}_decideRowClassName(e,t){return e.toggle.approvalState?"":"unsupported"}render(){let{workerTableIndex:e,preferredUnit:t,setWorkersLength:s,workerBudget:n,hideLegacyProposals:i,getWorkerArray:o,filterSearch:r}=this.props;const l=this.getHeader(e,t);let c=o(),{mappedWorkers:d,voteThreshold:h}=this._getMappedWorkers(c,n,r),m=d.filter((e=>{let t=e.get("name").toLowerCase();return t.includes("bsip")||t.includes("poll")})).map((e=>({preferredUnit:t,rest:e.remainingPayout,poll:!0,worker:e}))).filter((e=>!!e));d=d.filter((e=>{let t=e.get("name").toLowerCase();return!t.includes("bsip")&&!t.includes("poll")}));let p=d.filter((e=>e.isOngoing)),u=d.filter((e=>e.active&&e.isOngoing)).map((e=>({preferredUnit:t,rest:e.remainingPayout,worker:e}))).filter((e=>!!e)),g=d.filter((e=>!e.active&&!e.isExpired&&((e,t)=>{if(!i)return!0;let s=t.some((t=>{const s=Qt().compareTwoStrings(e.get("name"),t.get("name"))>.8,a=t.get("id")===e.get("id"),n=t.get("id").substr(5,t.get("id").length)>e.get("id").substr(5,t.get("id").length);return s&&!a&&n}));const a=new Date,n=e.get("total_votes_for")-e.get("total_votes_against")<2e12,o=new Date(e.get("work_begin_date")+"Z")<=new Date(a.setMonth(a.getMonth()-2)),r=Yt.includes(e.get("id"));return!((s||o)&&n||r)})(e,p))).map((e=>({preferredUnit:t,rest:0,worker:e}))),_=c.filter((e=>e.isExpired)).map((e=>({preferredUnit:t,rest:0,worker:e})));setTimeout((()=>{s(g.length,u.length,m.length,_.length,h)}),250);const b=0===e?g:1===e?u:2===e?_:m;return a.createElement($e.A,{className:"table dashboard-table table-hover",rowClassName:this._decideRowClassName.bind(this),rows:this.getData(b,h),header:l,pageSize:50,label:"utility.total_x_assets",leftPadding:"1.5rem"})}}const $t=(0,c.A)(Xt);class es extends a.Component{constructor(e){super(e),this.state={newWorkersLength:null,activeWorkersLength:null,pollsLength:null,expiredWorkersLength:null,voteThreshold:null,workerTableIndex:e.viewSettings.get("workerTableIndex",1)}}shouldComponentUpdate(e,t){return t.newWorkersLength!==this.state.newWorkersLength||t.activeWorkersLength!==this.state.activeWorkersLength||t.pollsLength!==this.state.pollsLength||t.expiredWorkersLength!==this.state.expiredWorkersLength||t.voteThreshold!==this.state.voteThreshold||e.workerTableIndex!==this.state.workerTableIndex}render(){const{vote_ids:e,proxy_vote_ids:t,hideLegacy:s,preferredUnit:n,globalObject:i,totalBudget:o,workerBudget:r,hideLegacyProposals:l,hasProxy:c,filterSearch:d,onFilterChange:h,onChangeVotes:m,getWorkerArray:p}=this.props,{workerTableIndex:u,newWorkersLength:g,activeWorkersLength:_,pollsLength:b,expiredWorkersLength:y,voteThreshold:E}=this.state;return a.createElement("div",null,a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(B.Button,null,a.createElement(f.N_,{to:"/create-worker"},a.createElement(v(),{content:"account.votes.create_worker"})))),a.createElement("div",{className:"selector inline-block"},a.createElement(z.A,{placeholder:N().translate("explorer.witnesses.filter_by_name"),value:d,onChange:h}),a.createElement(B.Radio.Group,{defaultValue:1,onChange:e=>{this.setState({workerTableIndex:e.target.value})}},a.createElement(B.Radio,{value:0},N().translate("account.votes.new",{count:g})),a.createElement(B.Radio,{value:1},N().translate("account.votes.active",{count:_})),b?a.createElement(B.Radio,{value:3},N().translate("account.votes.polls",{count:b})):null,y?a.createElement(B.Radio,{value:2},a.createElement(v(),{content:"account.votes.expired"})):null)),s,a.createElement("br",null),a.createElement("br",null),a.createElement(B.Row,null,a.createElement(B.Col,{span:3},a.createElement(v(),{content:"account.votes.threshold"})," (",a.createElement(W.A,{name:n}),")"),a.createElement(B.Col,{span:3,style:{marginLeft:"10px"}},a.createElement(C.A,{decimalOffset:4,hide_asset:!0,amount:E,asset:"1.3.0"}))),a.createElement(B.Row,null,a.createElement(B.Col,{span:3},a.createElement(v(),{content:"account.votes.total_budget"})," (",a.createElement(W.A,{name:n}),")"),a.createElement(B.Col,{span:3,style:{marginLeft:"10px"}},i?a.createElement(Gt.Rq,{hide_asset:!0,fromAsset:"1.3.0",toAsset:n,amount:o}):null))),a.createElement($t,{workerTableIndex:u,preferredUnit:n,setWorkersLength:(e,t,s,a,n)=>{e===this.state.newWorkersLength&&t===this.state.activeWorkersLength&&s===this.state.pollsLength&&a===this.state.expiredWorkersLength&&n===this.state.voteThreshold||this.setState({newWorkersLength:e,activeWorkersLength:t,pollsLength:s,expiredWorkersLength:a,voteThreshold:n})},workerBudget:r,hideLegacyProposals:l,hasProxy:c,proxy_vote_ids:t,vote_ids:e,onChangeVotes:m,getWorkerArray:p,filterSearch:d}))}}var ts=s(89247),ss=s(24609);class as extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e),this.onSubmit=this.onSubmit.bind(this)}UNSAFE_componentWillReceiveProps(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState(this.getInitialState(e))}getInitialState(e){return{targetType:null,amount:0,amountAsset:new ss.Vd({amount:0,asset_id:e.asset.get("id"),precision:e.asset.get("precision")})}}onAmountChanged({amount:e,asset:t}){this.state.amountAsset.setAmount({real:e}),this.setState({amount:e,asset:t})}onTargetTypeChanged(e){this.setState({targetType:e})}canSubmit(){return this.state.targetType&&this.state.amountAsset.hasAmount()}onSubmit(){M.A.createTicket(this.props.account,this.state.amountAsset.asset_id,this.state.amountAsset.getAmount(),this.state.targetType).then((()=>{this.state.amountAsset.setAmount({sats:0}),this.setState({amount:0,numberOfPeriods:1})})),this.props.hideModal()}_getUnlockPeriod(){return this.state.targetType?{0:0,1:180,2:360,3:720,4:1/0}[this.state.targetType]:0}render(){let e=this.props.asset.get("id"),t=this.props.account&&this.props.account.get("balances",[]).size&&this.props.account.getIn(["balances",e])?U.ChainStore.getObject(this.props.account.getIn(["balances",e])):null;return t=t?t.get("balance"):0,a.createElement(B.Modal,{visible:this.props.visible,onCancel:this.props.hideModal,title:N().translate("modal.create_lock.title"),footer:[a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.onSubmit,disabled:!this.canSubmit()},N().translate("modal.create_lock.submit")),a.createElement(B.Button,{onClick:this.props.hideModal,key:"cancel"},N().translate("cancel"))]},a.createElement(B.Alert,{message:N().translate("modal.create_lock.warning_message",{lock_days:this._getUnlockPeriod()}),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}),a.createElement(B.Form,{layout:"vertical"},a.createElement(he.A,{label:"modal.create_lock.amount",amount:this.state.amount,onChange:this.onAmountChanged.bind(this),asset:e,assets:[e],display_balance:a.createElement("div",{onClick:()=>{this.state.amountAsset.setAmount({sats:t}),this.setState({amount:this.state.amountAsset.getAmount({real:!0})})}},a.createElement(ts.A,{balance:this.props.account.getIn(["balances",e])})),tabIndex:1}),a.createElement(B.Form.Item,{label:N().translate("modal.create_lock.targetType"),validateStatus:this.state.targetType?"":"warning",help:this.state.targetType?"":N().translate("modal.create_lock.type_warning")},a.createElement(B.Tooltip,{placement:"top",title:N().translate("tooltip.create_lock_periods")},a.createElement(B.Select,{value:this.state.targetType,onChange:this.onTargetTypeChanged.bind(this)},Object.keys(U.ChainTypes.ticket_type).map((e=>0!=U.ChainTypes.ticket_type[e]?a.createElement(B.Select.Option,{key:U.ChainTypes.ticket_type[e]},U.ChainTypes.ticket_type[e]+": "+N().translate("operation.ticket_types."+e)):null)))))))}}const ns=as=(0,R.A)(as,{propNames:["asset"]});function is(){return is=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},is.apply(this,arguments)}const os="witnesses",rs="committee";class ls extends a.Component{static propTypes={initialBudget:l.A.ChainObject.isRequired,globalObject:l.A.ChainObject.isRequired,proxy:l.A.ChainAccount.isRequired};static defaultProps={globalObject:"2.0.0"};constructor(e){super(e);const t=e.proxy.get("id"),s=e.proxy.get("name"),a="string"==typeof e.account?e.account:e.account.get("name");this.state={proxy_account_id:"1.2.5"===t?"":t,prev_proxy_account_id:"1.2.5"===t?"":t,current_proxy_input:"1.2.5"===t?"":s,witnesses:null,committee:null,vote_ids:p().Set(),proxy_vote_ids:p().Set(),lastBudgetObject:e.initialBudget.get("id"),all_witnesses:p().List(),all_committee:p().List(),hideLegacyProposals:!0,filterSearch:"",isCreateLockModalVisible:!1,isCreateLockModalVisibleBefore:!1,tabs:[{name:"witnesses",link:"/account/"+a+"/voting/witnesses",translate:"explorer.witnesses.title",content:zt},{name:"committee",link:"/account/"+a+"/voting/committee",translate:"explorer.committee_members.title",content:Ht},{name:"workers",link:"/account/"+a+"/voting/workers",translate:"account.votes.workers_short",content:es}]},this.onProxyAccountFound=this.onProxyAccountFound.bind(this),this.onPublish=this.onPublish.bind(this),this.onReset=this.onReset.bind(this),this._getVoteObjects=this._getVoteObjects.bind(this),this.showCreateLockModal=this.showCreateLockModal.bind(this),this.hideCreateLockModal=this.hideCreateLockModal.bind(this)}UNSAFE_componentWillMount(){h.A.getFinalFeeAsset(this.props.account,"account_update"),U.ChainStore.fetchAllWorkers(),this.getBudgetObject()}componentDidMount(){this.updateAccountData(this.props),this._getVoteObjects(),this._getVoteObjects("committee")}shouldComponentUpdate(e,t){return t.isCreateLockModalVisible!=this.state.isCreateLockModalVisible||e.location.pathname!==this.props.location.pathname||t.prev_proxy_account_id!==this.state.prev_proxy_account_id||t.hideLegacyProposals!==this.state.hideLegacyProposals||t.vote_ids.size!==this.state.vote_ids.size||t.current_proxy_input!==this.state.current_proxy_input||t.filterSearch!==this.state.filterSearch||t.witnesses!==this.state.witnesses||t.committee!==this.state.committee}UNSAFE_componentWillReceiveProps(e){if(e.account!==this.props.account){const t=e.proxy.get("id");let s={proxy_account_id:"1.2.5"===t?"":t};this.setState({prev_proxy_account_id:s.proxy_account_id}),this.updateAccountData(e,s)}this.getBudgetObject()}updateAccountData({account:e},t=this.state){let{proxy_account_id:s}=t;const a=U.ChainStore.getAccount(s);let n=e.get("options"),i=a?a.get("options"):null,o=a?a.get("name"):"";"1.2.5"===s&&(s="",o="");let r=n.get("votes").toArray(),l=p().Set(r);U.ChainStore.getObjectsByVoteIds(r);let c=null,d=p().Set([]);if("1.2.5"!==s&&i){let e=i.get("votes").toArray();d=p().Set(e),U.ChainStore.getObjectsByVoteIds(e),c=(0,U.FetchChainObjects)(U.ChainStore.getObjectByVoteID,e,1e4)}Promise.all([(0,U.FetchChainObjects)(U.ChainStore.getObjectByVoteID,r,1e4),c]).then((e=>{const[t,a]=e;function n(e){let t=new(p().List),s=new(p().List),a=new(p().Set);return e.forEach((e=>{let a=e.get("committee_member_account");a?s=s.push(a):(a=e.get("worker_account"))||(a=e.get("witness_account"))&&(t=t.push(a))})),{witnesses:t,committee:s,workers:a}}let{witnesses:i,committee:r,workers:c}=n(t),{witnesses:h,committee:m,workers:u}=n(a||[]),g={proxy_account_id:s,current_proxy_input:o,witnesses:i,committee:r,workers:c,proxy_witnesses:h,proxy_committee:m,proxy_workers:u,vote_ids:l,proxy_vote_ids:d,prev_witnesses:i,prev_committee:r,prev_workers:c,prev_vote_ids:l};this.setState(g)}))}isChanged(e=this.state){return e.proxy_account_id!==e.prev_proxy_account_id||e.witnesses!==e.prev_witnesses||e.committee!==e.prev_committee||!p().is(e.vote_ids,e.prev_vote_ids)}_getVoteObjects(e=os,t){let s=this.state[`all_${e}`];const a=e===os;let n;if(t)n=parseInt(t[t.length-1].split(".")[2],10);else{t=[];const e=this.props.globalObject.get(a?"active_witnesses":"active_committee_members").sort(((e,t)=>parseInt(e.split(".")[2],10)-parseInt(t.split(".")[2],10))).last()||`1.${a?"6":"5"}.1`;n=parseInt(e.split(".")[2],10);for(var i=1;i<=n+10;i++)t.push(`1.${a?"6":"5"}.${i}`)}(0,U.FetchChainObjects)(U.ChainStore.getObject,t,5e3,{}).then((i=>{if(this.state[`all_${e}`]=s.concat(p().List(i.filter((e=>!!e)).map((e=>e.get(a?"witness_account":"committee_member_account"))))),i[i.length-1]){t=[];for(var o=n+11;o<=n+20;o++)t.push(`1.${a?"6":"5"}.${o}`);return this._getVoteObjects(e,t)}this.forceUpdate()}))}onRemoveProxy=()=>{this.publish(null)};onPublish(){this.publish(this.state.proxy_account_id)}onCreateTicket(){M.A.createTicket(this.props.account,"1.3.0",1e5)}publish(e){let t=this.props.account.toJS(),s={account:t.id},a={memo_key:t.options.memo_key};a.voting_account=e||"1.2.5",a.num_witness=this.state.witnesses.size,a.num_committee=this.state.committee.size,s.new_options=a,s.fee={amount:0,asset_id:h.A.getFinalFeeAsset(t.id,"account_update")};let{vote_ids:n}=this.state,i=this._getWorkerArray(),o=new Date;function r(e,t){return e.includes(t)&&(e=e.delete(t)),e}i.forEach((e=>{e&&(new Date(e.get("work_end_date"))<=o&&(n=r(n,e.get("vote_for"))),n=r(n,e.get("vote_against")))})),(0,U.FetchChainObjects)(U.ChainStore.getWitnessById,this.state.witnesses.toArray(),4e3).then((e=>{let t=e.map((e=>e.get("vote_id")));return Promise.all([Promise.resolve(t),(0,U.FetchChainObjects)(U.ChainStore.getCommitteeMemberById,this.state.committee.toArray(),4e3)])})).then((e=>{s.new_options.votes=e[0].concat(e[1].map((e=>e.get("vote_id")))).concat(n.filter((e=>"2"===e.split(":")[0])).toArray()).sort(((e,t)=>{let s=e.split(":"),a=t.split(":");return parseInt(s[1],10)-parseInt(a[1],10)})),M.A.updateAccount(s)}))}_getWorkerArray(){let e=[];return U.ChainStore.workers.forEach((t=>{let s=U.ChainStore.getObject(t,!1,!1);s&&e.push(s)})),e}onReset(){let e=this.state;this.refs.voting_proxy&&this.refs.voting_proxy.refs.bound_component&&this.refs.voting_proxy.refs.bound_component.onResetProxy(),this.setState({proxy_account_id:e.prev_proxy_account_id,current_proxy_input:e.prev_proxy_input,witnesses:e.prev_witnesses,committee:e.prev_committee,workers:e.prev_workers,vote_ids:e.prev_vote_ids},(()=>{this.updateAccountData(this.props)}))}onAddItem(e,t){let s={};s[e]=this.state[e].push(t),this.setState(s)}onRemoveItem(e,t){let s={};s[e]=this.state[e].filter((e=>e!==t)),this.setState(s)}onChangeVotes(e,t){let s={};s.vote_ids=this.state.vote_ids,e.length&&e.forEach((e=>{s.vote_ids=s.vote_ids.add(e)})),t&&t.forEach((e=>{s.vote_ids=s.vote_ids.delete(e)})),this.setState(s)}validateAccount(e,t){return t?e===os?(0,U.FetchChainObjects)(U.ChainStore.getWitnessById,[t.get("id")],3e3).then((e=>e[0]?null:"Not a witness")):"committee"===e?(0,U.FetchChainObjects)(U.ChainStore.getCommitteeMemberById,[t.get("id")],3e3).then((e=>e[0]?null:"Not a committee member")):null:null}onProxyChange(e){let t=U.ChainStore.getAccount(e);(!t||t&&t.get("id")!==this.state.proxy_account_id)&&this.setState({proxy_account_id:"",proxy_witnesses:p().Set(),proxy_committee:p().Set(),proxy_workers:p().Set()}),this.setState({current_proxy_input:e})}onProxyAccountFound(e){const t=e?e.get("id"):"";this.state.proxy_account_id!==t&&this.setState({proxy_account_id:t},(()=>{this.updateAccountData(this.props)}))}onClearProxy(){this.setState({proxy_account_id:""})}getBudgetObject(){let e,{lastBudgetObject:t}=this.state;e=U.ChainStore.getObject(t);let s=parseInt(t.split(".")[2],10);if(e){let a=e.get("time");/Z$/.test(a)||(a+="Z");let n=new Date,i=s+Math.floor((n-new Date(a).getTime())/1e3/60/60)-1;if(s>=i)return;let r="2.13."+Math.max(s,i),l=parseInt(r.split(".")[2],10);(0,U.FetchChainObjects)(U.ChainStore.getObject,[r],void 0,{}).then((e=>{let[s]=e;null===s?"2.13."+(l-1)!=t&&this.setState({lastBudgetObject:"2.13."+(l-1)},this.getBudgetObject):(o.A.setLastBudgetObject(r),this.setState({lastBudgetObject:r}))}))}else{let e="2.13."+(s-1);(0,U.FetchChainObjects)(U.ChainStore.getObject,[e],void 0,{}).then((t=>{let[a]=t;null===a?this.setState({lastBudgetObject:"2.13."+(s-2)},this.getBudgetObject):(o.A.setLastBudgetObject(e),this.setState({lastBudgetObject:e}))}))}}handleFilterChange(e){this.setState({filterSearch:e.target.value||""})}render(){const{prev_proxy_account_id:e,hideLegacyProposals:t,filterSearch:s,all_witnesses:n,proxy_witnesses:i,witnesses:o,all_committee:r,proxy_committee:l,committee:c,vote_ids:d,proxy_vote_ids:h,proxy_account_id:m}=this.state,p=!!e,u=this.props.settings.get("unit")||"1.3.0",g=!!m,{globalObject:_,account:b}=this.props,{totalBudget:y,workerBudget:f}=this._getBudgets(_),E=this._getActionButtons(),A=this._getProxyInput(p),w=this._getHideLegacyOptions(),C=this.handleFilterChange.bind(this),k=this.validateAccount.bind(this,os),S=this.onAddItem.bind(this,os),x=this.onRemoveItem.bind(this,os),M=this.onChangeVotes.bind(this),I=this._getWorkerArray.bind(this),P=this.onAddItem.bind(this,rs),T=this.onRemoveItem.bind(this,rs),O=a.createElement(B.Tooltip,{title:N().translate("account.votes.cast_votes_through_one_operation"),mouseEnterDelay:.5},a.createElement("div",{style:{float:"right"}},a.createElement(B.Button,{type:"primary",onClick:this.showCreateLockModal},a.createElement(v(),{content:"voting.increase_voting_power"}))));return a.createElement("div",{className:"main-content grid-content"},a.createElement("div",{className:"voting"},a.createElement("div",{className:"padding"},a.createElement("div",null,a.createElement(v(),{content:"voting.title",component:"h1"}),a.createElement(v(),{content:"voting.description",component:"p"})),a.createElement("div",{className:"ticket-row"},O,a.createElement(v(),{content:"voting.ticket_explanation",component:"p"})),a.createElement("div",{className:"proxy-row"},A,E)),a.createElement(B.Tabs,{activeKey:this.props.location.pathname,animated:!1,style:{display:"table",height:"100%",width:"100%"},onChange:e=>{this.props.history.push(e)}},this.state.tabs.map((e=>{const p=e.content;return a.createElement(B.Tabs.TabPane,{key:e.link,tab:N().translate(e.translate)},a.createElement(p,{all_witnesses:n,proxy_witnesses:i,witnesses:o,proxy_account_id:m,onFilterChange:C,validateAccountHandler:k,addWitnessHandler:S,removeWitnessHandler:x,hasProxy:g,globalObject:_,filterSearch:s,account:b,all_committee:r,proxy_committee:l,committee:c,addCommitteeHandler:P,removeCommitteeHandler:T,vote_ids:d,proxy_vote_ids:h,hideLegacy:w,preferredUnit:u,totalBudget:y,workerBudget:f,hideLegacyProposals:t,onChangeVotes:M,getWorkerArray:I,viewSettings:this.props.viewSettings}))})))),(this.state.isCreateLockModalVisible||this.state.isCreateLockModalVisibleBefore)&&a.createElement(ns,{visible:this.state.isCreateLockModalVisible,hideModal:this.hideCreateLockModal,asset:"1.3.0",account:this.props.account}))}showCreateLockModal(){this.setState({isCreateLockModalVisible:!0,isCreateLockModalVisibleBefore:!0})}hideCreateLockModal(){this.setState({isCreateLockModalVisible:!1})}_getBudgets(e){let t;this.state.lastBudgetObject&&(t=U.ChainStore.getObject(this.state.lastBudgetObject));let s=0,a=e?parseInt(e.getIn(["parameters","worker_budget_per_day"]),10):0;return t&&(a=Math.min(24*t.getIn(["record","worker_budget"]),a),s=Math.min(24*t.getIn(["record","worker_budget"]),a)),{totalBudget:s,workerBudget:a}}_getProxyInput(e){return a.createElement(a.Fragment,null,a.createElement(I.A,{label:"account.votes.proxy_short",style:{width:"50%",maxWidth:250,display:"inline-block"},account:this.state.current_proxy_input,accountName:this.state.current_proxy_input,onChange:this.onProxyChange.bind(this),onAccountChanged:this.onProxyAccountFound,tabIndex:1,placeholder:N().translate("account.votes.set_proxy"),tooltip:N().translate(this.state.proxy_account_id?"tooltip.proxy_remove":"tooltip.proxy_search"),hideImage:!0},a.createElement("span",{style:{paddingLeft:5,position:"relative",top:9}},a.createElement(f.N_,{to:"/help/voting"},a.createElement(V.A,{name:"question-circle",title:"icons.question_circle",size:"1x"})))),e&&a.createElement(B.Button,{style:{marginLeft:"1rem"},onClick:this.onRemoveProxy,tabIndex:9},a.createElement(v(),{content:"account.perm.remove_proxy"})))}_getHideLegacyOptions(){return a.createElement("div",{className:"inline-block",style:{marginLeft:"0.5em"},onClick:()=>{this.setState({hideLegacyProposals:!this.state.hideLegacyProposals})}},a.createElement(B.Tooltip,{title:N().translate("tooltip.legacy_explanation")},a.createElement(B.Switch,{style:{marginRight:6,marginTop:-3},checked:this.state.hideLegacyProposals}),a.createElement(v(),{content:"account.votes.hide_legacy_proposals"})))}_getActionButtons(){return a.createElement(B.Tooltip,{title:N().translate("account.votes.cast_votes_through_one_operation"),mouseEnterDelay:.5},a.createElement("div",{style:{float:"right"}},a.createElement(B.Button,{type:"primary",onClick:this.onPublish,tabIndex:4,disabled:!this.isChanged()||void 0},a.createElement(v(),{content:"account.votes.publish"})),a.createElement(B.Button,{style:{marginLeft:"8px"},onClick:this.onReset,tabIndex:8},a.createElement(v(),{content:"account.perm.reset"}))))}}ls=(0,c.A)(ls);const cs=(0,g.y)((e=>{let t={};if(e.initialBudget||(t.initialBudget=o.A.getLastBudgetObject()),!e.account){let e=i.A.getState().currentAccount||i.A.getState().passwordAccount;e=e&&"null"!==e?e:"committee-account",t.account=e}if(!e.proxy){const s=U.ChainStore.getAccount(e.account);let a=null;if(!s)throw"Account must be loaded";a=s.getIn(["options","voting_account"]),t.proxy=a}return a.createElement(ls,is({},e,t))}));var ds=s(3145),hs=s(35277);const ms={textAlign:"right"},ps={textAlign:"left"};class us extends a.Component{static propTypes={object:l.A.ChainObject,debtAsset:l.A.ChainAsset.isRequired,collateralAsset:l.A.ChainAsset.isRequired};static defaultProps={tempComponent:"tr"};constructor(e){super(e);let t=null!=e.object;this.state={isBorrowModalVisible:!1,modalRef:"cp_modal_"+(t?this.props.object.getIn(["call_price","quote","asset_id"]):this.props.debtAsset.get("id")),hasOrder:t}}showBorrowModal(){this.setState({isBorrowModalVisible:!0})}hideBorrowModal(){this.setState({isBorrowModalVisible:!1})}_onUpdatePosition(e){e.preventDefault(),this.refs[this.state.modalRef].show()}_getFeedPrice(){return this.props?1/S.A.get_asset_price(L.A.extractRawFeedPrice(this.props.debtAsset).getIn(["quote","amount"]),this.props.collateralAsset,L.A.extractRawFeedPrice(this.props.debtAsset).getIn(["base","amount"]),this.props.debtAsset):1}_onClosePosition(e){e.preventDefault();let t=$.A.new_transaction();t.add_type_operation("call_order_update",{fee:{amount:0,asset_id:0},funding_account:this.props.object.get("borrower"),delta_collateral:{amount:-this.props.object.get("collateral"),asset_id:this.props.object.getIn(["call_price","base","asset_id"])},delta_debt:{amount:-this.props.object.get("debt"),asset_id:this.props.object.getIn(["call_price","quote","asset_id"])}}),ee.A.process_transaction(t,null,!0)}_getBalance(){let e=this.props.account,t=null;t=null!=this.props.object?this.props.object.getIn(["call_price","quote","asset_id"]):this.props.debtAsset.get("id");let s=e.get("balances"),a=0;return s&&s.forEach(((e,s)=>{if(s==t){let t=U.ChainStore.getObject(e);a=t.get("balance")}})),a}_getCollateralRatio(){const e=this.props.object.toJS();return S.A.get_asset_amount(e.collateral,this.props.collateralAsset)/(S.A.get_asset_amount(e.debt,this.props.debtAsset)/this._getFeedPrice())}_getMR(){return this.props.debtAsset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"])/1e3}_getStatusClass(){let e=this._getCollateralRatio();const t=this._getMR();return isNaN(e)?null:e<t?"danger":e<t+.5?"warning":""}_getCRTip(){const e=this._getStatusClass(),t=this._getMR();return e&&""!==e?"danger"===e?N().translate("tooltip.cr_danger",{mr:t}):"warning"===e?N().translate("tooltip.cr_warning",{mr:t}):null:null}_getTargetCollateralRatio(){const e=this.props.object&&this.props.object.toJS();return e&&!isNaN(e.target_collateral_ratio)?e.target_collateral_ratio/1e3:0}render(){let{debtAsset:e,collateralAsset:t,object:s}=this.props,n=null!=s;const i=this._getBalance();let o=n?s.toJS():null,{isBitAsset:r}=S.A.replaceName(this.props.debtAsset),l=e.get("bitasset")&&e.getIn(["bitasset","is_prediction_market"]),c=this.props.debtAsset.getIn(["bitasset","settlement_fund"]),d=this.props.debtAsset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"]),h=c>0;const p=n?o.call_price.quote.asset_id:e.get("id"),u=n?o.debt:0,g=n?o.collateral:0,_=n?o.call_price.base.asset_id:t.get("id"),b=this._getTargetCollateralRatio();return a.createElement("tr",{className:"margin-row"},a.createElement("td",{style:ps},a.createElement(f.N_,{to:`/asset/${e.get("symbol")}`},a.createElement(W.A,{noTip:!0,name:e.get("symbol")}))),a.createElement("td",{style:ms},a.createElement(C.A,{amount:i,asset:p,hide_asset:!0})),a.createElement("td",{style:ms},a.createElement(C.A,{amount:u,asset:p,hide_asset:!0})),a.createElement("td",{style:ms,className:"column-hide-medium"},a.createElement(C.A,{decimalOffset:3,amount:g,asset:_})),n?a.createElement("td",{"data-place":"bottom","data-tip":this._getCRTip(),className:"center-content "+this._getStatusClass()},l?"1:1":S.A.format_number(this._getCollateralRatio(),2)):a.createElement("td",null),a.createElement("td",null,b&&!l?S.A.format_number(b,2):null),a.createElement("td",{style:ms},n?a.createElement(ds.A,{noTip:!0,balances:(0,m.List)(),debt:{[e.get("id")]:o.debt},collateral:{[t.get("id")]:parseInt(o.collateral,10)},hide_asset:!0}):null),a.createElement("td",{style:ms,className:"column-hide-small"},n?l?"-":a.createElement(Me.A,{base_amount:g,base_asset:t.get("id"),quote_amount:u*(d/1e3),quote_asset:e.get("id"),hide_symbols:!0}):null),a.createElement("td",{style:ms,className:"column-hide-small"},n?l?"1":a.createElement(Me.A,{base_amount:L.A.extractRawFeedPrice(e).getIn(["base","amount"]),base_asset:o.call_price.quote.asset_id,quote_amount:L.A.extractRawFeedPrice(e).getIn(["quote","amount"]),quote_asset:o.call_price.base.asset_id,hide_symbols:!0}):null),a.createElement("td",{className:"center-content column-hide-small",style:ps},n?a.createElement(Me.A,{base_amount:o.call_price.base.amount,base_asset:o.call_price.base.asset_id,quote_amount:o.call_price.quote.amount,quote_asset:o.call_price.quote.asset_id,hide_value:!0}):null),a.createElement("td",{style:{textAlign:"center"}},a.createElement(f.N_,{to:`/market/${e.get("symbol")}_${t.get("symbol")}`},a.createElement(V.A,{name:"trade",title:"icons.trade.trade",className:"icon-14px",style:{marginRight:5}}))),a.createElement("td",null,h?a.createElement(B.Tooltip,{placement:"left",title:N().translate("tooltip.borrow_disabled",{asset:r?`bit${e.get("symbol")}`:`${e.get("symbol")}`})},a.createElement("div",{style:{paddingBottom:5}},a.createElement(B.Icon,{type:"question-circle"}))):a.createElement(B.Tooltip,{placement:"left",title:N().translate("tooltip.update_position")},a.createElement("div",{style:{paddingBottom:5}},a.createElement("a",{onClick:this._onUpdatePosition.bind(this)},a.createElement(V.A,{name:"adjust",title:"icons.adjust",className:"icon-14px rotate90"}))))),a.createElement("td",null,n?a.createElement("div",{"data-place":"left","data-tip":N().translate("tooltip.close_position",{amount:S.A.get_asset_amount(o.debt,this.props.debtAsset),asset:e.get("symbol")}),style:{paddingBottom:5}},a.createElement("a",{onClick:this._onClosePosition.bind(this)},a.createElement(V.A,{name:"cross-circle",title:"icons.cross_circle.close_position",className:"icon-14px"}))):null,e?a.createElement(hs.A,{visible:this.state.isBorrowModalVisible,showModal:this.showBorrowModal.bind(this),hideModal:this.hideBorrowModal.bind(this),ref:this.state.modalRef,modalId:this.state.modalRef,quoteAssetObj:p,backingAssetObj:e.getIn(["bitasset","options","short_backing_asset"]),accountObj:this.props.account}):null))}}const gs=us=(0,c.A)(us);var _s=s(16e3);function bs(){return bs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},bs.apply(this,arguments)}const ys={textAlign:"right"},fs={textAlign:"left"};class Es extends a.Component{static propTypes={callOrders:l.A.ChainObjectsList};constructor(e){super(e),this.state={assetsPropsCount:0,ordersJson:""}}static getDerivedStateFromProps(e,t){const s=JSON.stringify(e.callOrders);if(null==t||t.assetsPropsCount!=e.bitAssets.length||t.ordersJson!=s){let t=new Array,a={},n=0;return e.bitAssets.forEach((e=>{a[e.get("id")]=n++,t.push({asset:e,has_margin_order:!1})})),e.callOrders.length>0&&e.callOrders.forEach((e=>{if(e){let s=e.getIn(["call_price","quote","asset_id"]);if(null==a[s]){let i=U.ChainStore.getObject(s);void 0!==i&&(a[s]=n++,t.push({asset:i,has_margin_order:!0,order:e}))}else t[a[s]].has_margin_order=!0,t[a[s]].order=e}})),{assetsPropsCount:e.bitAssets.length,assets:t,ordersJson:s}}return t}render(){let{account:e}=this.props,t=this.state.assets.sort(((e,t)=>{if(e.has_margin_order&&t.has_margin_order)return t.order.get("debt")-e.order.get("debt");if(e.has_margin_order||t.has_margin_order)return e.has_margin_order?-1:1;{let s=S.A.replaceName(e.asset),a=S.A.replaceName(t.asset),n=(null!=s.prefix?s.prefix:"")+s.name,i=(null!=a.prefix?a.prefix:"")+a.name;return n.localeCompare(i)}})).map((t=>{let s,n,i=null;if(t.has_margin_order){let e=t.order;s=e.getIn(["call_price","quote","asset_id"]),n=e.getIn(["call_price","base","asset_id"]),i=e.get("id")}else s=t.asset.get("id"),n=t.asset.getIn(["bitasset","options","short_backing_asset"]);return a.createElement(gs,bs({key:t.asset.get("id"),object:i,account:e,debtAsset:s,collateralAsset:n},this.props))}));return a.createElement("tbody",null,t)}}Es=(0,c.A)(Es),Es=(0,R.A)(Es,{propNames:["bitAssets"],defaultProps:{bitAssets:["1.3.113","1.3.120","1.3.121","1.3.1325","1.3.105","1.3.106","1.3.103"]},asList:!0});const vs=({callOrders:e,account:t,className:s,children:n,preferredUnit:i})=>a.createElement("table",{className:"table table-hover "+s},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:fs},a.createElement(v(),{content:"explorer.asset.title"})),a.createElement("th",{style:ys},a.createElement(v(),{content:"exchange.balance"})),a.createElement("th",{style:ys},a.createElement(v(),{content:"transaction.borrow_amount"})),a.createElement("th",{style:ys,className:"column-hide-medium"},a.createElement(v(),{content:"transaction.collateral"})),a.createElement("th",null,a.createElement(B.Popover,{placement:"top",title:N().translate("header.collateral_ratio"),content:N().translate("tooltip.coll_ratio")},a.createElement(v(),{content:"borrow.coll_ratio"}))),a.createElement("th",null,a.createElement(B.Popover,{placement:"top",content:a.createElement("div",{style:{width:"600px"}},N().translate("borrow.target_collateral_ratio_explanation")),title:N().translate("borrow.target_collateral_ratio")},a.createElement(v(),{content:"borrow.target_collateral_ratio_short"}))),a.createElement("th",{style:ys},a.createElement(_s.A,{noLink:!0,string:"account.total",keys:[{type:"asset",value:i,arg:"asset"}]})),a.createElement("th",{style:ys,className:"column-hide-small"},a.createElement(B.Popover,{placement:"top",content:N().translate("tooltip.call_price")},a.createElement(v(),{content:"exchange.call"}))),a.createElement("th",{style:ys,className:"column-hide-small"},a.createElement(B.Popover,{placement:"top",content:N().translate("tooltip.feed_price")},a.createElement(v(),{content:"exchange.feed_price"}))),a.createElement("th",{className:"column-hide-small",style:fs},a.createElement(v(),{content:"explorer.assets.units"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(v(),{content:"exchange.market"})),a.createElement("th",null,a.createElement(v(),{content:"borrow.adjust_short"})),a.createElement("th",null,a.createElement(v(),{content:"transfer.close"})))),a.createElement(Es,{account:t,callOrders:p().List(e)}),a.createElement("tbody",null,n));var As=s(62623),ws=s(81088),Cs=s(20903);let ks=function(e){this.id=e.toJS?e.get(0):e[0],this.weight=e.toJS?e.get(1):e[1],this.isAvailable=e=>e.includes?e.includes(this.id):-1!==e.indexOf(this)};const Ss={AccountPermission:function(e,t,s){this.id=e.get("id"),this.weight=t,this.threshold=e.getIn([s,"weight_threshold"]),this.accounts=[],this.keys=e.getIn([s,"key_auths"]).map((e=>new ks(e))).toArray(),this.isAvailable=e=>e.includes?e.includes(this.id):-1!==e.indexOf(this),this._sumWeights=e=>{if(this.isNested()||this.isMultiSig()){let t=this.accounts.reduce(((t,s)=>t+(s._sumWeights(e)?s.weight:0)),0);return Math.floor(t/this.threshold)}return this.isAvailable(e)?this.weight:0},this.getStatus=(e,t)=>{if(this.isNested()){let s=this.accounts.reduce(((t,s)=>t+s._sumWeights(e)),0);return this.keys.length&&(s+=this.sumKeys(t)),s}{let s=this._sumWeights(e);return this.isMultiSig()&&(s+=this.sumKeys(t)),s}},this.sumKeys=e=>this.keys.reduce(((t,s)=>t+(s.isAvailable(e)?s.weight:0)),0),this.isNested=()=>this.accounts.length>0,this.isMultiSig=()=>this.keys.reduce(((e,t)=>e||t.weight<this.threshold),!1),this.getMissingSigs=e=>{let t=[],s=[];return this.isNested()?s=this.accounts.reduce(((t,s)=>t.concat(s.getMissingSigs(e))),[]):this.isAvailable(e)||t.push(this.id),t.concat(s)},this.getMissingKeys=e=>{let t=[],s=[];return this.keys.length&&(this.isNested()||this.isMultiSig())&&this.keys.forEach((s=>{s.isAvailable(e)||t.push(s.id)})),this.isNested()&&(s=this.accounts.reduce(((t,s)=>t.concat(s.getMissingKeys(e))),[])),t.concat(s)}},listToIDs:function(e){let t=[];return e.forEach((e=>{e&&t.push(e.get?e.get("id"):e)})),t},unravel:function(e,t,s=0){if(s<3){let a=U.ChainStore.getAccount(e.id);a&&a.getIn([t,"account_auths"]).size&&a.getIn([t,"account_auths"]).forEach((a=>{let n=U.ChainStore.getAccount(a.get(0));n&&e.accounts.push(this.unravel(new this.AccountPermission(n,a.get(1),t),t,s+1))}))}return e},unnest:function(e,t){let s=[];return e.forEach((e=>{let a=U.ChainStore.getAccount(e);if(!a)return;let n=this.unravel(new this.AccountPermission(a,null,t),t);s.push(n)})),s},flatten_auths:(e,t=p().List())=>e.size?(e.forEach((e=>{t.includes(e.get(0))||(t=t.push(e.get(0)))})),t):t};class xs extends a.Component{render(){const{className:e,children:t,dataTip:s,content:n}=this.props;return a.createElement(B.Tooltip,{title:s&&s.trim()||N().translate(n)},a.createElement("span",{className:"tooltip "+e},t))}}const Ns=()=>a.createElement(xs,{className:"error appended",content:"explorer.proposals.authority_depth_warning"},"/!\\"),Ms=()=>a.createElement(xs,{className:"error appended",content:"explorer.proposals.children_authority_depth_warning"},"/!\\"),Is=()=>a.createElement(xs,{className:"warning",content:"explorer.proposals.pending_approval"},a.createElement(v(),{content:"explorer.proposals.pending"})),Ps=()=>a.createElement(xs,{className:"warning",content:"explorer.proposals.pending_review"},a.createElement(v(),{content:"explorer.proposals.review"})),Bs=({reason:e})=>a.createElement(xs,{className:"error",dataTip:e,content:"explorer.proposals.no_reason_available_switch_node"},a.createElement(v(),{content:"explorer.proposals.failed"})),Ts=({onToggle:e,expanded:t})=>a.createElement("a",{className:"expand-button",onClick:e},"[",t?"-":"+","]"),Os=({approved:e})=>e?a.createElement(V.A,{name:"checkmark-circle",size:"1x",className:"success",title:"icons.checkmark_circle.operation_succeed"}):a.createElement(V.A,{name:"cross-circle",size:"1x",className:"error",title:"icons.cross_circle.operation_failed"}),Fs=({available:e,permission:t,weight:s,level:n})=>a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(Os,{approved:t.isAvailable(e)}),t.id.substr(0,20-4*n),"..."),a.createElement("td",null,s))),Ls=(e,t,s=0)=>s>e||!(!t.isNested()&&!t.isMultiSig())&&t.accounts.some((t=>Ls(e,t,s+1))),Rs=(e,t,s)=>e.isNested()||e.isMultiSig()?((e,t,s)=>e.accounts.reduce(((e,a)=>e+(Rs(a,t,s)?a.weight:0)),0)+e.keys.reduce(((e,t)=>e+(t.isAvailable(s)?t.weight:0)),0))(e,t,s)>=e.threshold:e.isAvailable(t),qs=(e,t,s)=>e&&e.threshold>10?`${S.A.get_percentage(e.getStatus(t,s),e.threshold)} / 100%`:`${e.getStatus(t,s)} / ${e.threshold}`,Vs=(e,t)=>t&&t>10?S.A.get_percentage(e,t):e;function Ds(){return Ds=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ds.apply(this,arguments)}class js extends a.Component{constructor(e){super(e),this.state={expanded:!!e.expanded}}static propTypes={account:l.A.ChainAccount.isRequired,accounts:l.A.ChainAccountsList,level:y().number.isRequired};static defaultProps={level:0};handleExpandToggle=()=>{this.setState({expanded:!this.state.expanded})};render(){const{account:e,available:t,availableKeys:s,permission:n,threshold:i,level:o,maxAuthorityDepth:r,hideRoot:l}=this.props,{expanded:c}=this.state,d=Rs(n,t,s),h=n.isNested(),m=n.isMultiSig(),p=Vs(n.weight,i)||1,u=qs(n,t,s),g=o>=r,_=h||m?a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(Os,{approved:d}),a.createElement(Ie.A,{subpage:"permissions",account:e.get("id")})),a.createElement("td",null,c?a.createElement("span",{className:d?"success-text":""},p):p&&`${p&&2===p.length?" ":""}${p} `,a.createElement(Ts,{onToggle:this.handleExpandToggle,expanded:c}),c&&a.createElement("span",{className:"appended"},"(",u,")"),g?a.createElement(Ns,null):Ls(r,n,o)&&!c&&a.createElement(Ms,null))):a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(Os,{approved:d}),a.createElement(Ie.A,{subpage:"permissions",account:e.get("id")})),a.createElement("td",null,!h&&p?`${p&&2===p.length?" ":""}${p} `:null)),b=[];return(h||m)&&c&&(n.accounts.forEach((e=>{b.push(a.createElement(Us,{key:e.id,account:e.id,accounts:e.accounts,permission:e,available:t,availableKeys:s,threshold:n.threshold,level:o+1,maxAuthorityDepth:r}))})),n.keys.length&&n.keys.forEach((e=>b.push(a.createElement(Fs,{key:e.id,permission:e,available:s,level:o+(l?0:1),weight:Vs(e.weight,i)}))))),b.length>0?a.createElement("tbody",null,l||_,a.createElement("tr",null,a.createElement("td",{colSpan:"3",className:"heading-perm"},a.createElement("div",{className:l?"":"table-container"},a.createElement("table",null,b)),c&&0===o&&a.createElement("div",{className:"spacer"})))):a.createElement("tbody",null,_)}}const Us=(0,c.A)(js);class Ws extends a.Component{static propTypes={required:l.A.ChainAccountsList,available:l.A.ChainAccountsList};static defaultProps={type:"active",added:null,removed:null};constructor(e){super(e),this.state={requiredPermissions:[],expanded:e.expanded},this._updateState=this._updateState.bind(this)}UNSAFE_componentWillMount(){this._updateState(),U.ChainStore.subscribe(this._updateState)}componentWillUnmount(){U.ChainStore.unsubscribe(this._updateState)}_updateState(){let e=Ss.listToIDs(this.props.required),t=Ss.listToIDs(this.props.available);this.setState({requiredPermissions:Ss.unnest(e,this.props.type),required:e,available:t})}handleExpandToggle=()=>this.setState({expanded:!this.state.expanded});render(){let{type:e,added:t,removed:s,availableKeys:n,globalObject:i,reviewPeriodTime:o,noFail:r,failReason:l}=this.props,{requiredPermissions:c,required:d,available:h,expanded:m}=this.state;h=(0,Cs.A)(h),n=n.toJS(),t&&(h.push(t),n.push(t)),s&&(-1!==h.indexOf(s)&&h.splice(h.indexOf(s),1),-1!==n.indexOf(s)&&n.splice(n.indexOf(s),1));const p=c.reduce(((e,t)=>e+(Rs(t,h,n)?1:0)),0),u=c.length,g=p===u,_=g&&!o&&!r,b=g&&o,y=i.get("parameters").get("max_authority_depth"),f=1===c.length,E=f?c[0]:null,v=!f&&`${p} / ${u}`,A=c.map((e=>a.createElement(Us,{key:e.id,account:e.id,accounts:e.accounts,permission:e,available:h,availableKeys:n,expanded:this.props.expanded||f,level:0,maxAuthorityDepth:y,hideRoot:f})));return a.createElement("div",{className:"nested-approval-state"},a.createElement("div",{className:"root-status"},_?a.createElement(Bs,{reason:l}):b?a.createElement(Ps,null):a.createElement(Is,null)," ",E?E.threshold>1&&qs(E,h,n):a.createElement("span",null,"(",v,")"),(!E||E.isMultiSig()||E.isNested())&&a.createElement(Ts,{onToggle:this.handleExpandToggle,expanded:m}),!m&&c.some((e=>Ls(y,e,0)))&&a.createElement(Ms,null)),m&&a.createElement("table",null,A))}}Ws=(0,c.A)(Ws);class zs extends a.Component{static propTypes={proposal:l.A.ChainObject.isRequired,type:y().string.isRequired,globalObject:l.A.ChainObject.isRequired};static defaultProps={type:"active",added:null,globalObject:"2.0.0"};render(){let{proposal:e,type:t}=this.props,s=e.get(`available_${t}_approvals`),n=e.get("available_key_approvals"),i=e.get(`required_${t}_approvals`),o=e.get("fail_reason")||" ";return a.createElement(Ws,Ds({},this.props,{required:i,available:s,availableKeys:n,reviewPeriodTime:e.get("review_period_time"),failReason:o}))}}const Ks=(0,c.A)(zs);function Js(){return Js=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Js.apply(this,arguments)}const Hs=(e,t,s)=>{let a=[];e.forEach((e=>{a=a.concat(e.getMissingSigs(t))}));let n=[];return e.forEach((e=>{n=n.concat(e.getMissingKeys(s))})),[a,n]};class Gs extends a.Component{static propTypes={accounts:l.A.ChainAccountsList};constructor(e){super(),this.state={active:null,key:null,owner:null,payee:null}}onActiveAccount(e,t,s,a){let n={};t[a]?(n.key=a,n[s]=null):a?(n[s]=e[a],n.key=null):(n[s]=null,n.key=null),this.setState(n)}_onProposalAction(e){let t=e.toJS(),{active:s,key:a,owner:n,payee:i}=this.state;const o=i||s;if("delete"===this.props.action){const e=$.A.new_transaction();e.add_type_operation("proposal_delete",{fee_paying_account:o||this.props.account.get("id"),proposal:t.id,using_owner_authority:!1}),ee.A.process_transaction(e,null,!0)}else{let e={fee_paying_account:o,proposal:t.id,active_approvals_to_add:[],active_approvals_to_remove:[],owner_approvals_to_add:[],owner_approvals_to_remove:[],key_approvals_to_add:[],key_approvals_to_remove:[]},s="approve"===this.props.action,a=[];["active","owner","key"].forEach((n=>{let i=this.state[n];if(i){let o=-1!==t[`available_${n}_approvals`].indexOf(i);(s&&!o||!s&&o)&&("approve"===this.props.action?(e[`${n}_approvals_to_add`]=[i],"key"===n&&a.push(i)):"reject"===this.props.action&&(e[`${n}_approvals_to_remove`]=[i],"key"===n&&a.push(i)))}}));var r=$.A.new_transaction();r.add_type_operation("proposal_update",e),ee.A.process_transaction(r,null,!0,a)}this.props.hideModal()}onChangePayee(e){let t=U.ChainStore.getAccount(e);t&&this.setState({payee:t.get("id")})}onCancel(){this.props.hideModal()}render(){let{proposal:e,type:t}=this.props,s=[],n={},o="approve"===this.props.action;this.props.accounts.length&&this.props.accounts.forEach((a=>{(o?a&&!e.get(`available_${t}_approvals`).includes(a.get("id")):a&&e.get(`available_${t}_approvals`).includes(a.get("id")))&&(n[a.get("name")]=a.get("id"),s.push(a.get("name")))}));let r=[],l={};this.props.keys.length&&this.props.keys.forEach((t=>{let s=i.A.isMyKey(t),a=e.get("available_key_approvals").includes(t);(s&&o&&!a||s&&!o&&a)&&(l[t]=!0,r.push(t))}));let c=i.A.getMyAccounts(),d=[a.createElement(B.Button,{key:"submit",type:"primary",onClick:this._onProposalAction.bind(this,e)},N().translate(`proposal.${this.props.action}`)),a.createElement(B.Button,{key:"cancel",onClick:this.onCancel.bind(this)},N().translate("account.perm.cancel"))];return a.createElement(B.Modal,{visible:this.props.visible,title:N().translate(`modal.proposals.actions.${this.props.action}`),footer:d,onCancel:this.props.hideModal},a.createElement("div",{className:"grid-block vertical"},a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},a.createElement("div",{className:"grid-container"},a.createElement("div",{className:"content-block",style:{paddingRight:"20%"}},a.createElement(Ks,{expanded:!0,proposal:e.get("id"),type:t,added:o?this.state.key?this.state.key:this.state[t]||null:null,removed:o?null:this.state.key?this.state.key:this.state[t]||null,noFail:!0})),a.createElement("div",{className:"content-block full-width-content"},a.createElement("div",{className:"full-width-content form-group"},a.createElement(v(),{content:"modal.proposals.pay_with",component:"label"}),a.createElement(ws.A,{account_names:c,onChange:this.onChangePayee.bind(this),selected:1===c.length?c:null})),"delete"!==this.props.action&&(s.length||r.length)?a.createElement("div",{className:"full-width-content form-group"},a.createElement(v(),{content:"modal.proposals.approval_"+(o?"add":"remove"),component:"label"}),a.createElement(ws.A,{account_names:s.concat(r),onChange:this.onActiveAccount.bind(this,n,l,t)})):null,null)))))}}Gs=(0,c.A)(Gs);class Zs extends a.Component{static propTypes={account:l.A.ChainAccount.isRequired,proposal:l.A.ChainObject.isRequired};constructor(){super(),this._updateState=this._updateState.bind(this)}UNSAFE_componentWillMount(){this._updateState(),U.ChainStore.subscribe(this._updateState)}componentWillUnmount(){U.ChainStore.unsubscribe(this._updateState)}_updateState(){let{proposal:e,account:t}=this.props,s=e.get("required_active_approvals").size?"active":"owner",a=Ss.listToIDs(e.get(`required_${s}_approvals`)),n=Ss.listToIDs(e.get(`available_${s}_approvals`)),i=Ss.listToIDs(e.get("available_key_approvals"));this.setState({requiredPermissions:Ss.unnest(a,s),available:n,availableKeys:i,type:s})}render(){let{action:e}=this.props,{requiredPermissions:t,available:s,availableKeys:n,type:i}=this.state;const[o,r]=Hs(t,s,n);return a.createElement(Gs,Js({},this.props,{type:i,accounts:"approve"===e?o:s,keys:"approve"===e?r:n}))}}Zs=(0,c.A)(Zs);class Qs extends a.Component{render(){return this.props.account&&this.props.proposal&&this.props.action?a.createElement(Zs,this.props):null}}var Ys=s(41654);const{operations:Xs}=U.ChainTypes,$s=Object.keys(Xs);class ea extends a.Component{static propTypes={account:l.A.ChainAccount.isRequired};constructor(){super(),this.state={isModalVisible:!1,modal:{action:null,proposalId:null,accountId:null},visibleId:""},this._proposals=[],this._loading=!1,this.forceUpdate=this.forceUpdate.bind(this),this._isScam=this._isScam.bind(this),this._isUnknown=this._isUnknown.bind(this),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this)}componentDidMount(){U.ChainStore.subscribe(this.forceUpdate)}_setProposals(){this._loading=!0;let e=this.props.account;if(e.get("proposals").size){let t=[];e.get("proposals").forEach((s=>{let a=U.ChainStore.getObject(s);if(a){let s=a.get("proposed_transaction").get("operations");t.push({operations:s,account:e,proposal:a})}})),t=t.sort(((e,t)=>S.A.sortID(e.proposal.get("id"),t.proposal.get("id"),!0))),t.forEach((e=>{let t=e.proposal.get("required_active_approvals").size?"active":"owner";const s=Ss.listToIDs(e.proposal.get(`required_${t}_approvals`));e.requiredPermissions=Ss.unnest(s,t)})),this._proposals=t,this._loading=!1}}componentWillUnmount(){U.ChainStore.unsubscribe(this.forceUpdate)}showModal({action:e,proposalId:t,accountId:s}){this.setState({isModalVisible:!0,modal:{action:e,proposalId:t,accountId:s}})}hideModal(){this.setState({isModalVisible:!1,modal:{action:null,proposalId:null,accountId:null}})}_onApproveModal(e,t,s){this.showModal({action:s,proposalId:e,accountId:t})}_canReject(e){return e.available_active_approvals.length||e.available_owner_approvals.length||e.available_key_approvals.length}_isScam(e){let t=!1,s=[];e.operations.forEach((e=>{6==e.get(0)?(s.push(e.getIn([1,"active","account_auths",0,0])),s.push(e.getIn([1,"owner","account_auths",0,0]))):s.push(e.getIn([1,"to"]))}));let a=e.proposal.get("proposer");return s.push(a),s.forEach((e=>{h.A.isKnownScammer(e)&&(t=!0),this.props.account.get("blacklisted_accounts").some((t=>t===e))&&(t=!0)})),t}_isUnknown(e){let t=!0,s=[];e.operations.forEach((e=>{6==e.get(0)?(s.push(e.getIn([1,"active","account_auths",0,0])),s.push(e.getIn([1,"owner","account_auths",0,0]))):s.push(e.getIn([1,"to"]))}));let a=e.proposal.get("proposer");return s.push(a),s.forEach((e=>{this.props.account.get("whitelisted_accounts").some((t=>t===e))&&(t=!1),i.A.getState().starredAccounts.some((t=>{let s=U.ChainStore.getAccount(t,!1);return!!s&&s.get("id")==e}))&&(t=!1),i.A.getState().accountContacts.some((t=>{let s=U.ChainStore.getAccount(t,!1);return!!s&&s.get("id")==e}))&&(t=!1)})),t}openJSONModal(e){this.setState({visibleId:e})}closeJSONModal=()=>{this.setState({visibleId:""})};render(){let{account:e}=this.props;if(!e)return null;(e.get("proposals").size>0&&0==this._proposals.length||this._proposals.length>0&&e!==this._proposals[0].account&&!this._loading)&&this._setProposals();let t=this._proposals.reduce(((e,t,s)=>{const n=t.proposal.get("id"),o=t.proposal.get("proposer"),r=t.proposal.get("expiration_time"),l=N().translate("transaction.trxTypes"),c=t.operations&&t.operations.toJS(),d=c.length>1?N().translate("transaction.operations"):l[$s[c[0]&&c[0][0]]];let h=t.operations.map(((e,s)=>a.createElement(As.A,{key:t.proposal.get("id")+"_operation_"+s,expiration:r,index:s,op:e.toJS(),inverted:!1,hideFee:!0,hideOpLabel:!0,hideExpiration:!0,hideDate:!0,proposal:!0,id:n,proposer:o,collapsed:!1}))).toArray(),m=this._canReject(t.proposal.toJS()),p=t.proposal.get("id"),u=t.proposal.get("required_active_approvals").size?"active":"owner";e.push(a.createElement("tr",{key:`${p}_id`},a.createElement("td",{colSpan:"4",className:"proposal"+(0===s?" first":"")},a.createElement(As.g,{id:n,expiration:r,openJSONModal:()=>this.openJSONModal(n)}),a.createElement(Ys.A,{visible:this.state.visibleId===n,operation:c.length>1?c:c[0]&&c[0][1],title:d||"",hideModal:this.closeJSONModal}))));const g=Ss.listToIDs(t.proposal.get(`available_${u}_approvals`)),_=Ss.listToIDs(t.proposal.get("available_key_approvals"));let b=t.requiredPermissions;const[y,f]=Hs(b,g,_),E=[];y.length&&y.forEach((e=>{e&&!t.proposal.get(`available_${u}_approvals`).includes(e)&&E.push(e)}));const A=[];f.length&&f.forEach((e=>{i.A.isMyKey(e)&&!t.proposal.get("available_key_approvals").includes(e)&&A.push(e)}));const w=E.length+A.length>0;let C=this._isScam(t),k=this._isUnknown(t);return e.push(a.createElement("tr",{className:"top-left-align",key:`${p}_content`},a.createElement("td",null,h),a.createElement("td",null,b.map(((e,t)=>a.createElement("div",{className:"list-item",key:`${p}_approver_${t}`},a.createElement(Ie.A,{subpage:"permissions",account:e.id}))))),a.createElement("td",null,a.createElement(Ks,{proposal:t.proposal.get("id"),type:u})),a.createElement("td",{className:"approval-buttons"},C&&a.createElement(B.Tooltip,{title:N().translate("tooltip.propose_scam")},a.createElement("div",{className:"tooltip has-error scam-error"},"SCAM ATTEMPT")),this.props.hideFishingProposals&&!C&&k&&a.createElement(B.Tooltip,{title:N().translate("tooltip.propose_unknown")},a.createElement("div",{className:"tooltip has-error scam-error"},"UNKNOWN SOURCE")),!C&&(!k||!this.props.hideFishingProposals)&&a.createElement("button",{onClick:w?this._onApproveModal.bind(this,p,t.account.get("id"),"approve"):()=>{},className:"button primary hollow"+(w?"":" hidden")},a.createElement("span",null,a.createElement(v(),{content:"proposal.approve"}))),m?a.createElement("button",{onClick:this._onApproveModal.bind(this,p,t.account.get("id"),"reject"),className:"button primary hollow"},a.createElement(v(),{content:"proposal.reject"})):null,a.createElement("button",{onClick:this._onApproveModal.bind(this,p,t.account.get("id"),"delete"),className:"button primary hollow"},a.createElement(v(),{content:"proposal.delete"}))))),e.push(a.createElement("tr",{key:`${p}_separator`},a.createElement("td",{colSpan:"4"},a.createElement("hr",null)))),e}),[]);return a.createElement("div",null,a.createElement("table",{className:"table proposals compact "+this.props.className},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(v(),{content:"proposal.proposals"})),a.createElement("th",null,a.createElement(v(),{content:"proposal.approvers"})),a.createElement("th",null,a.createElement(v(),{content:"proposal.status"})),a.createElement("th",null,a.createElement(v(),{content:"proposal.action"})))),a.createElement("tbody",null,t)),a.createElement(Qs,{ref:"modal",visible:this.state.isModalVisible,hideModal:this.hideModal,showModal:this.showModal,account:this.state&&this.state.modal.accountId,proposal:this.state&&this.state.modal.proposalId,action:this.state&&this.state.modal.action}))}}const ta=(0,c.A)(ea);var sa=s(65124);const aa=function(e,t){for(var s,a=-1,n=e.length;++a<n;){var i=t(e[a]);void 0!==i&&(s=void 0===s?i:s+i)}return s},na=function(e,t){return function(e,t){var s=null==e?0:e.length;return s?aa(e,t)/s:NaN}(e,(0,sa.A)(t,2))},ia=function(e,t){return e&&e.length?aa(e,(0,sa.A)(t,2)):0};var oa=s(52528);const ra=function(e,t,s,a){for(var n=-1,i=null==e?0:e.length;++n<i;){var o=e[n];t(a,o,s(o),e)}return a};var la=s(21888);const ca=function(e,t,s,a){return(0,la.A)(e,(function(e,n,i){t(a,e,s(e),i)})),a};var da=s(92049);var ha=Object.prototype.hasOwnProperty;const ma=(pa=function(e,t,s){ha.call(e,s)?e[s].push(t):(0,oa.A)(e,s,[t])},function(e,t){var s=(0,da.A)(e)?ra:ca,a=ua?ua():{};return s(e,pa,(0,sa.A)(t,2),a)});var pa,ua,ga=s(36247),_a=s(88587);class ba extends a.Component{render(){let{base:e,quote:t,order:s}=this.props;const n=s.isBid();let i=n?"value positive":"value negative",o=n?"value negative":"value positive";return a.createElement(v(),{content:n?"exchange.buy_description":"exchange.sell_description",baseAsset:S.A.format_number(s[n?"amountToReceive":"amountForSale"]().getAmount({real:!0}),e.get("precision"),!1),quoteAsset:S.A.format_number(s[n?"amountForSale":"amountToReceive"]().getAmount({real:!0}),t.get("precision"),!1),baseName:a.createElement(W.A,{noTip:!0,customClass:i,name:t.get("symbol")}),quoteName:a.createElement(W.A,{noTip:!0,customClass:o,name:e.get("symbol")})})}}const ya=ba;var fa=s(40961);function Ea(){return Ea=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ea.apply(this,arguments)}class va extends a.Component{constructor(e){super(e),this.state={isCollapsed:e.isCollapsed||!1,isCollapseAnimationCompleted:e.isCollapsed||!1}}componentDidMount(){let e=fa.findDOMNode(this).querySelector(".ant-table-tbody"),t=()=>{this.setState({isCollapseAnimationCompleted:this.state.isCollapsed})};e.addEventListener("animationend",t),e.addEventListener("webkitAnimationEnd",t),e.addEventListener("oAnimationEnd",t),e.addEventListener("MSAnimationEnd",t)}render(){return a.createElement(B.Table,Ea({},this.props,{onHeaderRow:(e,t)=>{let s={},a=this.props.onHeaderRow;return a&&(s=a(e,t)),s.onClick=s=>{let n=s.target.getAttribute("class");if((!n||!n.includes("ant-checkbox-input"))&&(this.setState({isCollapsed:!this.state.isCollapsed}),this.setState({isCollapseAnimationCompleted:!1}),a)){let n=a(e,t);n.onClick&&n.onClick(s)}},s},className:`collapsible-table ${this.state.isCollapsed?"collapsible-table-collapsed":"collapsible-table-uncollapsed"}\n ${this.state.isCollapseAnimationCompleted?"collapsible-table-collapsed-animation-completed":null}`}))}}const Aa=va;var wa=s(31267),Ca=s(58586);class ka extends a.Component{constructor(e){super(),this.statsInterval=null;const{marketName:t}=_a.A.getMarketName(e.base,e.quote);this.state={marketName:t}}_checkStats(e={close:{}},t={close:{}}){return e.volumeBase!==t.volumeBase||!S.A.are_equal_shallow(e.close&&e.close.base,t.close&&t.close.base)||!S.A.are_equal_shallow(e.close&&e.close.quote,t.close&&t.close.quote)}shouldComponentUpdate(e){return this._checkStats(e.allMarketStats.get(this.state.marketName),this.props.allMarketStats.get(this.state.marketName))||e.base.get("id")!==this.props.base.get("id")||e.quote.get("id")!==this.props.quote.get("id")}componentWillUnmount(){this.statsInterval&&this.statsInterval()}}class Sa extends ka{constructor(e){super(e)}shouldComponentUpdate(e){return super.shouldComponentUpdate(e)}render(){let{allMarketStats:e}=this.props;const{marketName:t}=this.state,s=e.get(t);let n=s&&s.price?s.price:null;return a.createElement("span",{className:ye()("",this.props.className)},n?a.createElement(Me.A,{base_amount:n.base.amount,base_asset:n.base.asset_id,quote_amount:n.quote.amount,quote_asset:n.quote.asset_id,force_direction:this.props.force_direction,hide_symbols:this.props.hide_symbols}):"n/a")}}Sa=(0,R.A)(Sa,{propNames:["quote","base"]});class xa extends a.Component{render(){return a.createElement(Sa,this.props)}}xa=(0,d.N)(xa,{listenTo:()=>[Ca.A],getProps:()=>({allMarketStats:Ca.A.getState().allMarketStats})});class Na extends a.Component{constructor(e){super(e),this.state={selectedOrders:[],filterValue:"",areAssetsGrouped:e.viewSettings.get("accountOrdersGrouppedByAsset")}}_getFilteredOrders(e){let{filterValue:t}=this.state;return(("settle"!==e?this.props.account.get("orders"):this.props.settleOrders)||[]).filter((e=>{let s=U.ChainStore.getObject(e).toJS(),a=U.ChainStore.getAsset(s.sell_price.base.asset_id),n=U.ChainStore.getAsset(s.sell_price.quote.asset_id),i=a.get("symbol").toLowerCase(),o=n.get("symbol").toLowerCase();return i.indexOf(t)>-1||o.indexOf(t)>-1}))}_getDataSource(e,t){let s=[];const a="settle"===t;return e.forEach((e=>{let t=null,n=null,i=null,o=null,r=null,l=null,c=null;if(a?(t=U.ChainStore.getObject(e).toJS(),n=U.ChainStore.getAsset(t.balance.asset_id),i=U.ChainStore.getAsset(n.getIn(["bitasset","options","short_backing_asset"]))):(t=U.ChainStore.getObject(e).toJS(),n=U.ChainStore.getAsset(t.sell_price.base.asset_id),i=U.ChainStore.getAsset(t.sell_price.quote.asset_id)),n&&i){let e={[n.get("id")]:{precision:n.get("precision")},[i.get("id")]:{precision:i.get("precision")}};const{marketName:d}=_a.A.getMarketName(n,i),h=this.props.marketDirections.get(d);let m=h?i.get("id"):n.get("id"),p=h?n.get("id"):i.get("id");if(a){const t=L.A.extractRawFeedPrice(n);o=n.getIn(["bitasset","current_feed","maximum_short_squeeze_ratio"]),r=n.getIn(["bitasset","options","extensions","margin_call_fee_ratio"]),l=new ss.sA({priceObject:t,market_base:p,sqr:o,mcfr:r,assets:e}),c=n.getIn(["bitasset","options"])}let u=a?new ss.YU(t,e,p,l,c):new ss.qw(t,e,m),g=U.ChainStore.getAsset(p),_=U.ChainStore.getAsset(m),b=u.isBid(),y={key:t.id,order:u,isBid:b,quote:_,base:g,marketName:d,marketDirection:h,preferredUnit:this.props.settings?this.props.settings.get("unit"):"1.3.0",quoteColor:b?"value positive":"value negative",baseColor:b?"value negative":"value positive"};a&&(y={...y,settlement_date:t.settlement_date,feed_price:l}),s.push(y)}})),s.sort(((e,t)=>e.order.getPrice()-t.order.getPrice())),s.sort(((e,t)=>e.marketName>t.marketName?1:e.marketName<t.marketName?-1:e.marketDirection?1:-1)),s}_getColumns(e,t,s){let n,i,o,r,l,c,d,h,m,p,u=(e,t)=>({onClick:this.onFlip.bind(this,e.marketName)});const g="settle"===s;let _=e=>e.order[e.isBid?"amountToReceive":"amountForSale"]().getAmount({real:!0}),b=e=>S.A.format_number(e,n.base.get("precision"),!1),y=e=>e.order[e.isBid?"amountForSale":"amountToReceive"]().getAmount({real:!0}),E=e=>S.A.format_number(e,n.quote.get("precision"),!1),A=e=>a.createElement(xa,{base:e.base.get("id"),quote:e.quote.get("id"),force_direction:e.base.get("symbol"),hide_symbols:!0,hide_asset:!0});if(e){n=t[0],i=N().translate("exchange."+(g?"settlement_of":n.isBid?"buy":"sell")),o=N().translate("transaction.for"),r=b(ia(t,_)),l=E(ia(t,y));let e=n.isBid?"value positive":"value negative",s=n.isBid?"value negative":"value positive";c=a.createElement(W.A,{noTip:!0,customClass:e,name:n.quote.get("symbol")}),d=a.createElement(W.A,{noTip:!0,customClass:s,name:n.base.get("symbol")}),h=na(t,(e=>{let t=e.order.sellPrice().toReal(!0);return e.marketDirection?1/t:t}));let u=Math.min(8,n.order.sellPrice()[n.isBid?"base":"quote"].precision);h=a.createElement(wa.Gr,{value:h,minimumFractionDigits:Math.max(2,u),maximumFractionDigits:Math.max(2,u)}),m=A(n);let f=ia(t,(e=>e.order.amountForSale().getAmount()));p=a.createElement("div",null,a.createElement(Gt.Rq,{hide_asset:!0,amount:f,fromAsset:n.order.amountForSale().asset_id,noDecimals:!0,toAsset:n.preferredUnit})," ",a.createElement(W.A,{name:n.preferredUnit}))}return[{key:"trade",title:N().translate("account.trade"),align:"center",render:e=>a.createElement(f.N_,{to:`/market/${e.quote.get("symbol")}_${e.base.get("symbol")}`,onClick:()=>ga.A.switchMarket()},a.createElement(B.Icon,{type:"bar-chart"}))},{key:"orderID",title:N().translate("transaction.order_id"),render:e=>"#"+e.order.id.substring(4)},...e?[{key:"operation",title:i,render:e=>i,onCell:u,className:"clickable groupColumn"},...g?[{key:"quoteAsset",title:l,render:e=>E(y(e)),className:"clickable groupColumn"},{key:"baseName",title:c,render:e=>c,className:"clickable groupColumn"}]:[{key:"baseAsset",title:r,render:e=>b(_(e)),onCell:u,className:"clickable groupColumn"},{key:"baseName",title:c,render:e=>c,onCell:u,className:"clickable groupColumn"},{key:"for",title:o,render:e=>o,onCell:u,className:"clickable groupColumn"},{key:"quoteAsset",title:l,render:e=>E(y(e)),onCell:u,className:"clickable groupColumn"},{key:"quoteName",title:d,render:e=>d,onCell:u,className:"clickable groupColumn"}]]:[{key:"description",title:N().translate("exchange.description"),render:e=>g?a.createElement(v(),{content:"exchange.settlement_description",quoteAsset:S.A.format_number(e.order.for_sale.getAmount({real:!0}),e.quote.get("precision"),!1),quoteName:a.createElement(W.A,{noTip:!0,customClass:e.quoteColor,name:e.quote.get("symbol")})}):a.createElement(ya,e),onCell:u,className:"clickable"}],{key:"price",title:e?a.createElement("div",null,a.createElement(v(),{content:"account.average_price"}),a.createElement("br",null),h):N().translate("exchange.price"),align:e?"right":"left",render:e=>a.createElement(Me.A,{base_amount:e.order.sellPrice().base.amount,base_asset:e.order.sellPrice().base.asset_id,quote_amount:e.order.sellPrice().quote.amount,quote_asset:e.order.sellPrice().quote.asset_id,force_direction:e.base.get("symbol"),hide_symbols:!0}),onCell:u,className:"clickable"},{key:"marketPrice",title:e?a.createElement("div",null,a.createElement(v(),{content:"exchange.price_market"}),a.createElement("br",null),m):N().translate("exchange.price_market"),align:e?"right":"left",render:A,onCell:u,className:"clickable"},g&&!e?{key:"settlement_date",title:e?a.createElement("div",null,a.createElement(v(),{content:"exchange.settlement_date"}),a.createElement("br",null),m):N().translate("exchange.settlement_date"),align:e?"right":"left",render:e=>a.createElement("span",null,e.settlement_date),onCell:u,className:"clickable"}:{},{key:"value",title:e?a.createElement("div",null,a.createElement(v(),{content:"exchange.value"}),a.createElement("br",null),p):N().translate("exchange.value"),align:"right",render:e=>a.createElement("div",null,a.createElement(Gt.Rq,{hide_asset:!0,amount:e.order.amountForSale().getAmount(),fromAsset:e.order.amountForSale().asset_id,noDecimals:!0,toAsset:e.preferredUnit})," ",a.createElement(W.A,{name:e.preferredUnit})),onCell:u,className:"clickable"}]}_renderSettleOrdersTable(){const{account:e}=this.props,{filterValue:t}=this.state;let s=e.get("settle_orders");t&&(s=this._getFilteredOrders.call(this,"settle"));let n=this._getDataSource(s,"settle"),i={hideOnSinglePage:!0,pageSize:20,showTotal:(e,t)=>N().translate("utility.total_x_items",{count:e})},o=this._getColumns(!1,n,"settle");return a.createElement(B.Table,{columns:o,dataSource:n,pagination:i,footer:()=>a.createElement("span",null," ")})}_renderOrdersTable(){const{account:e}=this.props,{filterValue:t,areAssetsGrouped:s}=this.state;let n=e.get("orders");t&&(n=this._getFilteredOrders.call(this));const i=this._getDataSource(n);let o={hideOnSinglePage:!0,pageSize:20,showTotal:(e,t)=>N().translate("utility.total_x_items",{count:e})},r=()=>this.props.children,l=this.props.isMyAccount?{onChange:(e,t)=>{this.setState({selectedOrders:e})},selectedRowKeys:this.state.selectedOrders}:null,c=[];if(s){let e=ma(i,(e=>e.marketName+"_"+(e.marketDirection?e.base.get("id"):e.quote.get("id"))));for(let[t,n]of Object.entries(e)){let e;n[0].settlement_date&&(e="settle");let i=this._getColumns(s,n,e);c.push(a.createElement("div",{className:"grid-wrapper",key:t},a.createElement(Aa,{columns:i,dataSource:n,rowSelection:l,pagination:o,isCollapsed:!0})))}}else{let e=this._getColumns(s,i);c.push(a.createElement("div",{className:"grid-wrapper",key:"ungroupedTable"},a.createElement(B.Table,{columns:e,dataSource:i,rowSelection:l,pagination:o,footer:r})))}return c}_getSelectedOrders(e){let t=this.props.account.get("orders").toArray().filter((t=>-1!=e.indexOf(t)));return(0,U.FetchChain)("getObject",t)}_cancelLimitOrders(){this._getSelectedOrders(this.state.selectedOrders).then((e=>{let t=e.toJS().map((e=>e.sell_price.base.asset_id));ga.A.cancelLimitOrders(this.props.account.get("id"),this.state.selectedOrders,t).then((()=>{this.resetSelected()})).catch((e=>{console.log("cancel orders error:",e)}))}))}onFlip(e){let t={};t[e]=!this.props.marketDirections.get(e),Be.A.changeMarketDirection(t)}setFilterValue(e){this.setState({filterValue:e.target.value.toLowerCase()})}resetSelected(){this.setState({selectedOrders:[]})}cancelSelected(){this._cancelLimitOrders.call(this)}render(){const{account:e}=this.props,{selectedOrders:t}=this.state,s=this._renderOrdersTable(),n=this._renderSettleOrdersTable(),i=[s];let o=e.get("settle_orders").size;return a.createElement("div",{className:"grid-content no-overflow no-padding",style:{paddingBottom:15}},a.createElement("div",{className:"header-selector",style:{display:"inline-block",width:"100%"}},a.createElement("div",{className:"filter-block"},a.createElement("div",{className:"filter"},a.createElement(B.Input,{type:"text",placeholder:N().translate("account.filter_orders"),onChange:this.setFilterValue.bind(this),addonAfter:a.createElement(B.Icon,{type:"search"})})),a.createElement("div",{className:"group-by"},a.createElement(B.Switch,{onChange:(e,t)=>{Be.A.changeViewSetting({accountOrdersGrouppedByAsset:e}),this.setState({areAssetsGrouped:e})},checked:this.state.areAssetsGrouped})," ",a.createElement(v(),{content:"account.group_by_asset"}))),t.length?a.createElement("span",{className:"action-buttons"},a.createElement(B.Button,{key:"submit",type:"primary",onClick:this.cancelSelected.bind(this)},a.createElement(v(),{content:"account.cancel_orders"}))," ",a.createElement(B.Button,{key:"cancel",type:"secondary",onClick:this.resetSelected.bind(this)},a.createElement(v(),{content:"account.reset_orders"}))):null),a.createElement("div",null,o>0&&a.createElement("div",{className:"header-selector"},a.createElement(v(),{content:"account.market_orders"})),i),o>0&&a.createElement("div",{className:"grid-wrapper",key:"settleGroupedTable"},a.createElement("div",{className:"header-selector"},a.createElement(v(),{content:"account.settle_orders"})),n))}}const Ma=Na=(0,d.N)(Na,{listenTo:()=>[o.A],getProps:()=>({marketDirections:o.A.getState().marketDirections,viewSettings:o.A.getState().viewSettings})});let Ia={};var Pa=s(22520),Ba=s(58921),Ta=s.n(Ba),Oa=s(59048),Fa=s.n(Oa),La=s(16370),Ra=s.n(La),qa=s(57127);function Va(){return Va=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Va.apply(this,arguments)}Fa()(Ta().Highcharts),Ra()(Ta().Highcharts);class Da extends a.Component{static propTypes={assets:l.A.ChainAssetsList,preferredAsset:l.A.ChainAsset.isRequired};static defaultProps={assets:[],preferredAsset:"1.3.0"};render(){let{balanceObjects:e,core_asset:t,marketStats:s,preferredAsset:n,history:i}=this.props,o=null;if(e&&e.length>0){let a=0;o=e.forEach((e=>{if(!e)return;let i="string"==typeof e?U.ChainStore.getObject(e):e,o=i.get("asset_type"),r=U.ChainStore.getAsset(o);if(!r||!n)return;let l=Number(i.get("balance"));const c=_a.A.convertValue(l,n,r,s,t);if(!c)return;const d=S.A.get_asset_precision(n.get("precision"));a+=c/d})),o=e.map(((e,i)=>{if(!e)return null;let o="string"==typeof e?U.ChainStore.getObject(e):e,r=o.get("asset_type"),l=U.ChainStore.getAsset(r);if(!l)return null;let c=Number(o.get("balance"));const d=_a.A.convertValue(c,n,l,s,t);if(!d)return null;const h=d/S.A.get_asset_precision(n.get("precision")),m=h/a*100;if(m<.5)return null;if(h<1)return null;const p=l.get("symbol");return{symbol:p,name:`${p} (${0===a?0:m.toFixed(2)}%)`,value:h,color:Ta().Highcharts.getOptions().colors[i]}})).filter((e=>!!e))}o&&1===o.length&&0===o[0].value&&(o=null);let r={chart:{backgroundColor:"rgba(255, 0, 0, 0)",height:250,spacingLeft:0,spacingRight:0,spacingBottom:0},credits:{enabled:!1},legend:{enabled:!1},plotOptions:{treemap:{animation:!1,tooltip:{pointFormatter:function(){return`<b>${this.name}</b>: ${Ta().Highcharts.numberFormat(this.value,0)} ${n.get("symbol")}`}}},series:{cursor:"pointer",point:{events:{click:function(){const e=`/asset/${this.symbol}`;i.push(e)}}}}},series:[{type:"treemap",levels:[{level:1,layoutAlgorithm:"sliceAndDice",dataLabels:{enabled:!0,align:"center",verticalAlign:"middle"}}],data:o}],title:{text:null}};return a.createElement(ja,{accountBalances:o,config:r})}}function ja({accountBalances:e,config:t}){return a.createElement("div",{className:"account-treemap"},a.createElement("div",{className:"account-treemap--legend"},e&&e.map((({name:e,symbol:t,color:s},n)=>a.createElement(f.N_,{key:n,to:`/asset/${t}`},a.createElement("div",{className:"legend-item"},a.createElement("div",{className:"legend-square",style:{backgroundColor:s}}),e))))),a.createElement(Ta(),{config:t}))}Da=(0,c.A)(Da);class Ua extends a.Component{static propTypes={balanceObjects:l.A.ChainObjectsList,core_asset:l.A.ChainAsset.isRequired};static defaultProps={balanceObjects:[],core_asset:"1.3.0"};render(){let e=this.props.balanceObjects.filter((e=>!!e)).map((e=>e.get("asset_type")));return a.createElement(Da,Va({preferredAsset:this.props.settings.get("unit","1.3.0"),assets:e},this.props))}}Ua=(0,c.A)(Ua);class Wa extends a.Component{render(){return a.createElement(qa.A,{stores:[o.A,Ca.A],inject:{marketStats:()=>Ca.A.getState().allMarketStats,settings:()=>o.A.getState().settings}},a.createElement(Ua,Va({},this.props,{ref:this.props.refCallback})))}}const za=(0,g.y)(Wa);var Ka=s(83599);function Ja(){return Ja=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ja.apply(this,arguments)}class Ha extends ka{static defaultProps={fullPrecision:!1,noDecimals:!1,hide_asset:!1};constructor(e){super(e)}shouldComponentUpdate(e){return super.shouldComponentUpdate(e)||e.base!==this.props.base}getValue(){let{marketStats:e}=this.props;return e&&e.change?e.change:0}render(){let e=this.getValue(),t=0===parseFloat(e)?"":parseFloat(e)<0?"change-down":"change-up",s=a.createElement(wa.Gr,{style:"decimal",value:e,minimumFractionDigits:2,maximumFractionDigits:2});return isNaN(parseFloat(e))?a.createElement("span",{className:"value "+t},"-"):a.createElement("span",{className:"value "+t},s,"%")}}Ha=(0,R.A)(Ha,{propNames:["quote","base"],defaultProps:{quote:"1.3.0"}});class Ga extends a.Component{render(){let{refCallback:e,...t}=this.props;return a.createElement(Ha,Ja({},t,{ref:e}))}}Ga=(0,d.N)(Ga,{listenTo:()=>[Ca.A],getProps:e=>({marketStats:Ca.A.getState().allMarketStats.get(e.marketId),allMarketStats:Ca.A.getState().allMarketStats})});var Za=s(47729);function Qa(){return Qa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Qa.apply(this,arguments)}const Ya=function(e,t,s=null,a=null,n=!1){try{return _a.A.getFinalPrice(s||U.ChainStore.getAsset("1.3.0"),e,t||U.ChainStore.getAsset("1.3.0"),a||Ca.A.getState().allMarketStats,n)}catch(e){console.log(e)}};class Xa extends Za.A{static defaultProps={forceDirection:!0};shouldComponentUpdate(e,t){return super.shouldComponentUpdate(e)||e.base_amount!==this.props.base_amount||e.quote_amount!==this.props.quote_amount||e.decimals!==this.props.decimals||!S.A.are_equal_shallow(e.pulsate,this.props.pulsate)||!S.A.are_equal_shallow(t,this.state)}render(){const{coreAsset:e,fromAsset:t,toAsset:s,allMarketStats:n,forceDirection:i,...o}=this.props,r=Ya(s,t,e,n);return 1===r?a.createElement("span",null,"1.00"):r?a.createElement(Me.A,Qa({force_direction:!!i&&s.get("symbol"),base_amount:r.base.amount,base_asset:r.base.asset_id,quote_amount:r.quote.amount,quote_asset:r.quote.asset_id},o)):a.createElement("span",null,"--")}}Xa=(0,R.A)(Xa,{propNames:["toAsset","fromAsset","coreAsset"],defaultProps:{toAsset:"1.3.0",coreAsset:"1.3.0"}});class $a extends a.Component{render(){return a.createElement(qa.A,{stores:[o.A,Ca.A],inject:{toAsset:()=>this.props.toAsset||o.A.getState().settings.get("unit","1.3.0"),allMarketStats:()=>Ca.A.getState().allMarketStats}},a.createElement(Xa,Qa({},this.props,{ref:this.props.refCallback})))}}var en=s(39744),tn=s(53615);function sn(){return sn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},sn.apply(this,arguments)}class an extends a.Component{static propTypes={duration:y().number.isRequired,offIcon:y().string.isRequired,onIcon:y().string.isRequired,title:y().string.isRequired};componentDidMount(){const{duration:e}=this.props;this.interval=setInterval(this.tick,e)}componentWillUnmount(){this.interval&&clearInterval(this.interval)}tick=()=>{const{onIcon:e,offIcon:t}=this.props,{name:s=e}=this.state||{};this.setState({name:s===e?t:e})};render(){const{onIcon:e,rest:t}=this.props,{name:s=e}=this.state||{},{title:n}=this.props;return a.createElement(V.A,sn({name:s,title:n},t))}}var nn=s(73282),on=s(85551),rn=s(60432),ln=s(15255),cn=s(50582),dn=s(54392),hn=s.n(dn);class mn extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e),this.onSubmit=this.onSubmit.bind(this)}UNSAFE_componentWillReceiveProps(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState(this.getInitialState(e))}getInitialState(e){return{amount:0,amountAsset:new ss.Vd({amount:0,asset_id:e.asset.get("id"),precision:e.asset.get("precision")})}}onAmountChanged({amount:e,asset:t}){this.state.amountAsset.setAmount({real:e}),this.setState({amount:e,asset:t})}onSubmit(){A.A.reserveAsset(this.state.amountAsset.getAmount(),this.props.asset.get("id"),this.props.account.get("id")).then((()=>{this.state.amountAsset.setAmount({sats:0}),this.setState({amount:0})})),this.props.hideModal()}render(){let e=this.props.asset.get("id"),t=this.props.account&&this.props.account.get("balances",[]).size&&this.props.account.getIn(["balances",e])?U.ChainStore.getObject(this.props.account.getIn(["balances",e])):null;return t?a.createElement(B.Modal,{visible:this.props.visible,onCancel:this.props.hideModal,title:N().translate("modal.reserve.title"),footer:[a.createElement(B.Button,{type:"primary",key:"submit",onClick:this.onSubmit},N().translate("modal.reserve.submit")),a.createElement(B.Button,{onClick:this.props.hideModal,key:"cancel"},N().translate("cancel"))]},a.createElement(B.Alert,{message:N().translate("modal.reserve.warning_message"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}),a.createElement(B.Form,{layout:"vertical"},a.createElement(he.A,{label:"modal.reserve.amount",amount:this.state.amount,onChange:this.onAmountChanged.bind(this),asset:e,assets:[e],display_balance:a.createElement("div",{onClick:()=>{this.state.amountAsset.setAmount({sats:t.get("balance")}),this.setState({amount:this.state.amountAsset.getAmount({real:!0})})}},a.createElement(ts.A,{balance:this.props.account.getIn(["balances",e])})),tabIndex:1}))):null}}const pn=mn=(0,R.A)(mn,{propNames:["asset"]});function un(){return un=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},un.apply(this,arguments)}const{Option:gn}=B.Select;class _n extends a.Component{static propTypes={viewSettingsKey:y().string,viewSettings:y().object,allowCustomization:y().bool};static defaultProps={viewSettingsKey:null,viewSettings:null,allowCustomization:!1};constructor(e){super(e),this.state={columnSelector:"default",isDropDownOpen:!1},this._columnSelectorChange=this._columnSelectorChange.bind(this),this.isColumnChecked=this.isColumnChecked.bind(this)}_getViewSettingsKey(){return"columns_"+this.props.viewSettingsKey}_getEnabledColumns(){return this.props.viewSettings.get(this._getViewSettingsKey())||{}}_getCustomizableColumns(e){return e.filter((e=>this._isColumnCustomizable(e).customizable))}modHeader(e){return this.props.allowCustomization?e.filter((e=>!this._isColumnCustomizable(e)||this.isColumnChecked(e))):e}_columnCheckboxChange(e){let t=this._getEnabledColumns();t[e]=!this.isColumnChecked(e),Be.A.changeViewSetting({[this._getViewSettingsKey()]:t})}_isColumnCustomizable(e){return e.dataIndex?{customizable:null==e.customizable||e.customizable,default:null==e.customizable||"boolean"==typeof e.customizable||e.customizable.default}:{customizable:!1,default:!1}}isColumnChecked(e){return"string"==typeof e&&(e={dataIndex:e,customizable:!0}),null==this._getEnabledColumns()[e.dataIndex]?this._isColumnCustomizable(e).default:this._getEnabledColumns()[e.dataIndex]}_renderEnabledColumnsSelector(){let{header:e}=this.props;return a.createElement("div",{className:"customizable-column--selector"},a.createElement(B.Select,{defaultValue:this.state.columnSelector,value:this.state.columnSelector,onChange:this._columnSelectorChange,dropdownClassName:"customizable-column--selector--dropdown",onDropdownVisibleChange:e=>{this.setState({isDropDownOpen:e})}},a.createElement(gn,{className:"customizable-column--selector--option",value:"default"},!this.state.isDropDownOpen&&a.createElement(B.Icon,{type:"setting"}),this.state.isDropDownOpen&&N().translate("customizable_table.customize_the_columns")),this._getCustomizableColumns(e).map(((e,t)=>a.createElement(gn,{key:t,className:"customizable-column--selector--option",value:e.dataIndex,disabled:!0},a.createElement(B.Checkbox,{checked:this.isColumnChecked(e),onChange:this._columnCheckboxChange.bind(this,e.dataIndex)},e.title))))))}_columnSelectorChange(){this.setState({columnSelector:"default"})}render(){let{header:e,...t}=this.props;return e=this.modHeader(e),a.createElement("div",null,this.props.allowCustomization&&a.createElement("div",{style:{position:"relative"}},this._renderEnabledColumnsSelector()),a.createElement($e.A,un({},t,{header:e})),this.props.children)}}const bn=_n=(0,d.N)(_n,{listenTo:()=>[o.A],getProps:e=>e.viewSettings?{}:{viewSettings:o.A.getState().viewSettings}});class yn extends a.Component{constructor(e){super(e),this.state={isBridgeModalVisible:!1,isSettleModalVisible:!1,isBorrowModalVisible:!1,isDepositModalVisible:!1,isWithdrawModalVisible:!1,isBurnModalVisible:!1,isBridgeModalVisibleBefore:!1,isSettleModalVisibleBefore:!1,isBorrowModalVisibleBefore:!1,isDepositModalVisibleBefore:!1,isWithdrawModalVisibleBefore:!1,isBurnModalVisibleBefore:!1,borrow:null,settleAsset:"1.3.0",depositAsset:null,withdrawAsset:null,bridgeAsset:null,allRefsAssigned:!1,portfolioSort:e.viewSettings.get("portfolioSort","value"),portfolioSortDirection:e.viewSettings.get("portfolioSortDirection","descend")},this.changeRefs={};for(let e in this.sortFunctions)this.sortFunctions[e]=this.sortFunctions[e].bind(this);this._checkRefAssignments=this._checkRefAssignments.bind(this),this.showSettleModal=this.showSettleModal.bind(this),this.hideSettleModal=this.hideSettleModal.bind(this),this.showDepositModal=this.showDepositModal.bind(this),this.hideDepositModal=this.hideDepositModal.bind(this),this.showWithdrawModal=this.showWithdrawModal.bind(this),this.hideWithdrawModal=this.hideWithdrawModal.bind(this),this.showBorrowModal=this.showBorrowModal.bind(this),this.hideBorrowModal=this.hideBorrowModal.bind(this),this.showBurnModal=this.showBurnModal.bind(this),this.hideBurnModal=this.hideBurnModal.bind(this),this.showBridgeModal=this.showBridgeModal.bind(this),this.hideBridgeModal=this.hideBridgeModal.bind(this),this.toggleSortOrder=this.toggleSortOrder.bind(this)}UNSAFE_componentWillMount(){this.refCheckInterval=setInterval(this._checkRefAssignments)}componentWillUnmount(){clearInterval(this.refCheckInterval)}_checkRefAssignments(){if(!this.state.allRefsAssigned){const e=["changeRefs"].reduce(((e,t)=>void 0===e?!!Object.keys(this[t]).length:!!Object.keys(this[t]).length&&e),void 0);e&&(clearInterval(this.refCheckInterval),this.setState({allRefsAssigned:e}))}}shouldComponentUpdate(e,t){return!S.A.are_equal_shallow(t,this.state)||!S.A.are_equal_shallow(e.backedCoins,this.props.backedCoins)||!S.A.are_equal_shallow(e.balances,this.props.balances)||!S.A.are_equal_shallow(e.balanceList,this.props.balanceList)||!S.A.are_equal_shallow(e.optionalAssets,this.props.optionalAssets)||e.account!==this.props.account||e.visible!==this.props.visible||e.settings!==this.props.settings||e.hiddenAssets!==this.props.hiddenAssets||e.allMarketStats.reduce(((e,t,s)=>S.A.check_market_stats(t,this.props.allMarketStats.get(s))||e),!1)}showBridgeModal(){this.setState({isBridgeModalVisible:!0,isBridgeModalVisibleBefore:!0})}hideBridgeModal(){this.setState({isBridgeModalVisible:!1})}showWithdrawModal(){this.setState({isWithdrawModalVisible:!0,isWithdrawModalVisibleBefore:!0})}hideWithdrawModal(){this.setState({isWithdrawModalVisible:!1})}showBurnModal(){this.setState({isBurnModalVisible:!0,isBurnModalVisibleBefore:!0})}hideBurnModal(){this.setState({isBurnModalVisible:!1})}showSettleModal(){this.setState({isSettleModalVisible:!0,isSettleModalVisibleBefore:!0})}hideSettleModal(){this.setState({isSettleModalVisible:!1})}showDepositModal(){this.setState({isDepositModalVisible:!0,isDepositModalVisibleBefore:!0})}hideDepositModal(){this.setState({isDepositModalVisible:!1})}showBorrowModal(e,t,s){this.setState({isBorrowModalVisible:!0,isBorrowModalVisibleBefore:!0,borrow:{quoteAsset:e,backingAsset:t,account:s}})}hideBorrowModal(){this.setState({borrow:null,isBorrowModalVisible:!1})}sortFunctions={byKey:function(e,t){return e.key>t.key},byInCollateral:function(e,t){return this.sortFunctions.byTypedValue(e,t,this._sumCollateralBalances(e.inCollateral),this._sumCollateralBalances(t.inCollateral))},byBalance:function(e,t){return this.sortFunctions.byTypedValue(e,t,(0,Gt.et)(e.balance).amount,(0,Gt.et)(t.balance).amount)},byVestingBalance:function(e,t){return this.sortFunctions.byTypedValue(e,t,this._sumVestingBalances(e.inVesting),this._sumVestingBalances(t.inVesting))},byInOrders:function(e,t){return this.sortFunctions.byTypedValue(e,t,e.inOrders,t.inOrders)},byTypedValue(e,t,s,a){return s=S.A.convert_satoshi_to_typed(s,e.asset),a=S.A.convert_satoshi_to_typed(a,t.asset),s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},byEquivalentPrice:function(e,t){let s=Ya(e.asset,e.adds.preferredAsset,this.props.coreAsset,null,!0),a=Ya(t.asset,t.adds.preferredAsset,this.props.coreAsset,null,!0);return s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},totalValue:function(e,t){let s=(0,Gt.a2)(e.value,e.adds.preferredAsset,e.adds.asset,!1),a=(0,Gt.a2)(t.value,t.adds.preferredAsset,t.adds.asset,!1);return s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},changeValue:function(e,t){let s=this.changeRefs[e.key],a=this.changeRefs[t.key];return s&&a?("NaN"!=parseFloat(s)?parseFloat(s):s)-("NaN"!=parseFloat(a)?parseFloat(a):a):!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)}};triggerSend(e){this.setState({send_asset:e},(()=>{this.send_modal&&this.send_modal.show()}))}_onSettleAsset(e,t){t.preventDefault(),this.setState({settleAsset:e}),this.showSettleModal()}_hideAsset(e,t){Be.A.hideAsset(e,t)}_burnAsset(e,t){t.preventDefault(),this.setState({reserve:e}),this.showBurnModal()}_showDepositModal(e,t){t.preventDefault(),this.setState({depositAsset:e},(()=>{this.showDepositModal()}))}_showDepositWithdraw(e,t,s,a){a.preventDefault(),this.setState({["bridge_modal"===e?"bridgeAsset":"deposit_modal"===e?"depositAsset":"withdrawAsset"]:t,fiatModal:s},(()=>"bridge_modal"===e?(this.showBridgeModal(),!0):"deposit_modal"===e?(this.showDepositModal(),!0):void this.showWithdrawModal()))}_getSeparator(e){return e?a.createElement("span",null," | "):null}_renderBuy=(e,t,s,n,i)=>{if("BTS"===e&&i<=1e6)return a.createElement("span",null,a.createElement("a",{onClick:this._showDepositWithdraw.bind(this,"bridge_modal",s,!1)},a.createElement(an,{onIcon:"dollar",offIcon:"dollar-green",title:"icons.dollar.buy",duration:1e3,className:"icon-14px"})));{let e=this._showDepositWithdraw.bind(this,"bridge_modal",s,!1),i=a.createElement("span",null,a.createElement(V.A,{style:{cursor:this.props.isMyAccount?"pointer":"help"},name:"dollar",title:"icons.dollar.buy",className:"icon-14px",onClick:this.props.isMyAccount?e:null}));return t&&this.props.isMyAccount?i:t&&!this.props.isMyAccount?a.createElement(B.Tooltip,{title:N().translate("tooltip.login_required")},i):n}};_renderGatewayAction=(e,t,s,n)=>{let i="deposit"==e?this._showDepositModal.bind(this,s):this._showDepositWithdraw.bind(this,"withdraw_modal_new",s,!1),o="deposit"==e?`icons.${e}.${e}`:`icons.${e}`,r=a.createElement("span",null,a.createElement(V.A,{style:{cursor:this.props.isMyAccount?"pointer":"help"},name:e,title:o,className:"icon-14x",onClick:this.props.isMyAccount?i:null}));return t&&this.props.isMyAccount?r:t&&!this.props.isMyAccount?a.createElement(B.Tooltip,{title:N().translate("tooltip.login_required")},r):n};toggleSortOrder(e,t,s){Be.A.changeViewSetting({portfolioSortDirection:s.order,portfolioSort:s.columnKey})}getHeader(e){let{settings:t}=this.props,{shownAssets:s}=this.state;const n=t.get("unit")||this.props.core_asset.get("symbol"),i=t.get("showAssetPercent",!1);let o=[{title:a.createElement(v(),{content:"account.asset"}),dataIndex:"asset",align:"left",customizable:!1,sorter:this.sortFunctions.byKey,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(Pe.A,{asset:e.get("id")}))},{title:a.createElement(v(),{content:"account.qty"}),dataIndex:"balance",align:"right",customizable:!1,sorter:this.sortFunctions.byBalance,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(ts.A,{balance:e.get("id"),hide_asset:!0}))},{className:"column-hide-small",title:a.createElement(v(),{content:"account.inOrders"}),dataIndex:"inOrders",align:"right",sorter:this.sortFunctions.byInOrders,render:(e,t)=>e?a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(C.A,{amount:e,asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement(v(),{content:"account.inVestingBalances"}),dataIndex:"inVesting",align:"right",sorter:this.sortFunctions.byVestingBalance,render:(e,t)=>e&&0!=e.length?a.createElement("span",{style:{whiteSpace:"noWrap"}},a.createElement(C.A,{amount:this._sumVestingBalances(e),asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement(v(),{content:"account.inCollateral"}),dataIndex:"inCollateral",align:"right",sorter:this.sortFunctions.byInCollateral,render:(e,t)=>e&&0!=e.length?a.createElement("span",{style:{whiteSpace:"noWrap"}},a.createElement(C.A,{amount:this._sumCollateralBalances(e),asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(v(),{content:"exchange.price"})," (",a.createElement(W.A,{name:n,noTip:!0}),")"),dataIndex:"price",align:"right",sorter:this.sortFunctions.byEquivalentPrice,render:(e,t)=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement($a,{fromAsset:t.asset.get("id"),pulsate:{reverse:!0,fill:"forwards"},hide_symbols:!0}))},{className:"column-hide-small",title:a.createElement(v(),{content:"account.hour_24_short"}),dataIndex:"hour24",align:"right",sorter:this.sortFunctions.changeValue,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-small",title:a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(_s.A,{noLink:!0,string:"account.eq_value_header",keys:[{type:"asset",value:n,arg:"asset"}],noTip:!0})),dataIndex:"value",align:"right",customizable:!1,sorter:this.sortFunctions.totalValue,defaultSortOrder:"descend",render:(e,t)=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(Gt.tB,{balance:t.adds.balanceObject.get("id"),satoshis:e,toAsset:n,hide_asset:!0}))},{title:a.createElement(v(),{content:"account.percent"}),dataIndex:"percent",align:"right",customizable:{default:i},render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(v(),{content:"header.payments"}),dataIndex:"payments",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"exchange.buy"}),customizable:e.buy?void 0:{default:!1},dataIndex:"buy",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:e.depositOnlyBTS?a.createElement(a.Fragment,null,a.createElement(B.Tooltip,{title:N().translate("external_service_provider.expect_more")},a.createElement(v(),{content:"modal.deposit.submit"})," ",a.createElement(B.Icon,{type:"question-circle"}))):a.createElement(v(),{content:"modal.deposit.submit"}),customizable:e.deposit?void 0:{default:!1},dataIndex:"deposit",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"modal.withdraw.submit"}),customizable:e.withdraw?void 0:{default:!1},dataIndex:"withdraw",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"account.trade"}),dataIndex:"trade",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"exchange.borrow_short"}),dataIndex:"borrow",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"account.settle"}),dataIndex:"settle",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"modal.reserve.submit"}),dataIndex:"burn",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(v(),{content:"active"==s?"exchange.hide":"account.perm.show"}),dataIndex:"hide",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)}];return o.forEach((e=>{e.dataIndex==this.state.portfolioSort&&(e.defaultSortOrder=this.state.portfolioSortDirection)})),o}_sumCollateralBalances(e){if(!e||0==e.length)return 0;let t=0;return e.forEach((e=>{t+=+e.get("collateral")})),t}_sumVestingBalances(e){if(!e||0==e.length)return 0;let t=0;return e.forEach((e=>{t+=(0,Gt.et)(e).amount})),t}_renderBalances(e,t,s){const{coreSymbol:n,preferredUnit:i,settings:o,hiddenAssets:r,orders:l}=this.props,c=(e,t)=>{let s=e&&e.has("bitasset_data_id"),n=!!(s&&e.getIn(["bitasset","settlement_fund"])>0);return{isBitAsset:s,borrowLink:!s||n?null:a.createElement("a",{onClick:()=>{en.A.hide(),this.showBorrowModal(e.get("id"),e.getIn(["bitasset","options","short_backing_asset"]),t)}},a.createElement(V.A,{name:"dollar",title:"icons.dollar.borrow",className:"icon-14px"}))}};let d=[];const h="-";return(e||[]).forEach((e=>{let t=U.ChainStore.getObject(e);if(!t)return;let s,o,m,p=t.get("asset_type"),u=U.ChainStore.getObject(p);if(!u)return;let g="";const _=u.get("symbol"),b="1.3.0"!==u.get("id"),y=i!==n;let{market:E}=L.A.parseDescription(u.getIn(["options","description"]));g=u.get("symbol"),-1===g.indexOf("OPEN.")||E||(E="USD");let v=E||i;b&&v===g&&(v=n),s=b?a.createElement(f.N_,{to:`/market/${u.get("symbol")}_${v}`,onClick:()=>ga.A.switchMarket()},a.createElement(V.A,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):y?a.createElement(f.N_,{to:`/market/${u.get("symbol")}_${i}`,onClick:()=>ga.A.switchMarket()},a.createElement(V.A,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):h,m=a.createElement("a",{onClick:this.triggerSend.bind(this,u.get("id"))},a.createElement(V.A,{name:"transfer",title:"icons.transfer",className:"icon-14px"}));let{isBitAsset:A,borrowLink:w}=c(u,this.props.account);const C=!r.includes(p),k=!!t.get("balance");let x=[];this.props.account.get("vesting_balances").forEach((e=>{let t=U.ChainStore.getObject(e);t.getIn(["balance","asset_id"])===u.get("id")&&+t.getIn(["balance","amount"])>0&&x.push(t)}));let M=[];(this.props.callOrders||[]).forEach((e=>{let t=U.ChainStore.getObject(e);t.getIn(["call_price","base","asset_id"])===u.get("id")&&+t.get("collateral")>0&&M.push(t)}));const I=(0,ae.KE)(u.get("symbol"),this.props.backedCoins),P=I&&I.depositAllowed||"BTS"==u.get("symbol"),T=I&&I.withdrawalAllowed&&k&&0!=t.get("balance"),O=!!this.props.bridgeCoins.get(g);let F,R=u&&u.getIn(["bitasset","options"])?u.getIn(["bitasset","options"]).toJS():null,q=R&&R.short_backing_asset?U.ChainStore.getAsset(R.short_backing_asset):null,{isBitAsset:D}=S.A.replaceName(u),{isBitAsset:j}=S.A.replaceName(q);if(A){const e=u.get("bitasset").get("settlement_fund")>0,t=u.getIn(["bitasset","is_prediction_market"]);F=e?"tooltip.global_settle":t?"tooltip.settle_market_prediction":"tooltip.settle",o=t&&!e?a.createElement(B.Icon,{type:"question-circle"}):a.createElement("a",{onClick:this._onSettleAsset.bind(this,u.get("id"))},a.createElement(V.A,{name:"settle",title:"icons.settle",className:"icon-14px"}))}let W=U.ChainStore.getAsset(i),z=u.get("symbol")+"_"+i,K=this.props.allMarketStats.get(z);this.changeRefs[u.get("symbol")]=K&&K.change?K.change:0;const J=(0,Gt.et)(t).amount+(l[u.get("id")]?l[u.get("id")]:0)+this._sumVestingBalances(x);d.push({key:u.get("symbol"),adds:{balanceObject:t,preferredAsset:W,asset:u},asset:u,balance:t,price:"dummy",inOrders:l[u.get("id")],inVesting:x,inCollateral:M,hour24:a.createElement(Ga,{base:u.get("id"),quote:i,marketId:z,hide_symbols:!0}),value:J,percent:k?a.createElement(ts.A,{balance:e,asPercentage:!0}):null,payments:m,buy:this._renderBuy(u.get("symbol"),O,_,h,t.get("balance")),deposit:this._renderGatewayAction("deposit",P,_,h),withdraw:this._renderGatewayAction("withdraw",T,_,h),trade:s,borrow:A&&w?a.createElement(B.Tooltip,{title:N().translate("tooltip.borrow",{asset:D?"bit"+g:g})},w):A&&!w?a.createElement(B.Tooltip,{title:N().translate("tooltip.borrow_disabled",{asset:D?"bit"+g:g})},a.createElement(B.Icon,{type:"question-circle"})):h,settle:A&&q?a.createElement(B.Tooltip,{placement:"bottom",title:N().translate(F,{asset:D?"bit"+g:g,backingAsset:j?"bit"+q.get("symbol"):q.get("symbol"),settleDelay:R.force_settlement_delay_sec/3600})},a.createElement("div",{className:"inline-block"},o)):h,burn:A?null:a.createElement("a",{style:{marginRight:0},onClick:this._burnAsset.bind(this,u.get("id"))},a.createElement(V.A,{name:"fire",className:"icon-14px"})),hide:a.createElement(B.Tooltip,{placement:"bottom",title:N().translate("tooltip."+(C?"hide_asset":"show_asset"))},a.createElement("a",{style:{marginRight:0},className:C?"order-cancel":"action-plus",onClick:this._hideAsset.bind(this,p,C)},a.createElement(V.A,{name:C?"cross-circle":"plus-circle",title:C?"icons.cross_circle.hide_asset":"icons.plus_circle.show_asset",className:"icon-14px"})))})})),t&&t.filter((e=>{let t=!1;this.props.backedCoins.get("OPEN",[]).forEach((s=>{s&&s.symbol===e&&(t=!0)})),this.props.bridgeCoins.get(e)&&(t=!0);let s=!0;return d.forEach((t=>{t.key===e&&(s=!1)})),s&&t})).forEach((e=>{let t=U.ChainStore.getAsset(e);if(t&&this.props.isMyAccount){const i=!r.includes(t.get("id")),o=t.get("symbol").split("."),l=!!this.props.backedCoins.get("OPEN",[]).find((e=>e.backingCoinType===o[1]))||!!this.props.backedCoins.get("RUDEX",[]).find((e=>e.backingCoin===o[1]))||"BTS"==t.get("symbol"),m=!!this.props.bridgeCoins.get(t.get("symbol")),p="1.3.0"!==t.get("id");let{market:u}=L.A.parseDescription(t.getIn(["options","description"]));-1===t.get("symbol").indexOf("OPEN.")||u||(u="USD");let g=u||n,_=p?a.createElement(f.N_,{to:`/market/${t.get("symbol")}_${g}`,onClick:()=>ga.A.switchMarket()},a.createElement(V.A,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):h,{isBitAsset:b,borrowLink:y}=c(t,this.props.account);(i&&s||!i&&!s)&&d.push({key:t.get("symbol"),asset:t,balance:h,price:h,hour24:h,value:h,percent:h,payments:h,buy:m&&this.props.isMyAccount?a.createElement("span",null,a.createElement("a",{onClick:this._showDepositWithdraw.bind(this,"bridge_modal",e,!1)},a.createElement(V.A,{name:"dollar",title:"icons.dollar.buy",className:"icon-14px"}))):h,deposit:l&&this.props.isMyAccount?a.createElement("span",null,a.createElement(V.A,{style:{cursor:"pointer"},name:"deposit",title:"icons.deposit.deposit",className:"icon-14x",onClick:this._showDepositModal.bind(this,t.get("symbol"))})):h,withdraw:h,trade:_,borrow:b?a.createElement(B.Tooltip,{placement:"bottom",title:N().translate("tooltip.borrow",{asset:t.get("symbol")})},a.createElement("div",{className:"inline-block"},y)):h,settle:h,burn:h,hide:a.createElement(B.Tooltip,{placement:"bottom",title:N().translate("tooltip."+(i?"hide_asset":"show_asset"))},a.createElement("a",{style:{marginRight:0},className:i?"order-cancel":"action-plus",onClick:this._hideAsset.bind(this,t.get("id"),i)},a.createElement(V.A,{name:i?"cross-circle":"plus-circle",title:i?"icons.cross_circle.hide_asset":"icons.plus_circle.show_asset",className:"icon-14px"})))})}})),d}_renderSendModal(){return a.createElement(nn.A,{id:"send_modal_portfolio",refCallback:e=>{e&&(this.send_modal=e)},from_name:this.props.account.get("name"),asset_id:this.state.send_asset||"1.3.0"})}_renderBorrowModal(){return this.state.borrow&&this.state.borrow.quoteAsset&&this.state.borrow.backingAsset&&this.state.borrow.account&&this.state.isBorrowModalVisibleBefore?a.createElement(hs.A,{visible:this.state.isBorrowModalVisible,showModal:this.showBorrowModal,hideModal:this.hideBorrowModal,accountObj:this.state.borrow&&this.state.borrow.account,quoteAssetObj:this.state.borrow&&this.state.borrow.quoteAsset,backingAssetObj:this.state.borrow&&this.state.borrow.backingAsset}):null}_renderSettleModal(){return a.createElement(on.A,{visible:this.state.isSettleModalVisible,hideModal:this.hideSettleModal,showModal:this.showSettleModal,asset:this.state.settleAsset,account:this.props.account})}render(){const e=this.props.bridgeCoins.get(this.state.bridgeAsset)||null,t=this._renderBalances(this.props.balanceList,this.props.optionalAssets,this.props.visible),s={};return t.forEach((e=>{e.buy&&"-"!==e.buy&&(s.buy=!0),e.deposit&&"-"!==e.deposit&&"BTS"==e.key&&tn.A.anyAllowed()&&(s.depositOnlyBTS="BTS"==e.key&&!s.deposit,s.deposit=!0),e.withdraw&&"-"!==e.withdraw&&(s.withdraw=!0)})),a.createElement("div",null,a.createElement(bn,{className:"table dashboard-table table-hover",rows:t,header:this.getHeader(s),label:"utility.total_x_assets",extraRow:this.props.extraRow,viewSettingsKey:"portfolioColumns",allowCustomization:!0,toggleSortOrder:this.toggleSortOrder},this._renderSendModal(),(this.state.isSettleModalVisible||this.state.isSettleModalVisibleBefore)&&this._renderSettleModal(),this._renderBorrowModal(),(this.state.isWithdrawModalVisible||this.state.isWithdrawModalVisibleBefore)&&a.createElement(cn.A,{hideModal:this.hideWithdrawModal,visible:this.state.isWithdrawModalVisible,backedCoins:this.props.backedCoins,initialSymbol:this.state.withdrawAsset}),(this.state.isDepositModalVisible||this.state.isDepositModalVisibleBefore)&&a.createElement(rn.A,{visible:this.state.isDepositModalVisible,showModal:this.showDepositModal,hideModal:this.hideDepositModal,asset:this.state.depositAsset,account:this.props.account.get("name"),backedCoins:this.props.backedCoins}),(this.state.isBridgeModalVisible||this.state.isBridgeModalVisibleBefore)&&a.createElement(ln.A,{visible:this.state.isBridgeModalVisible,showModal:this.showBridgeModal,hideModal:this.hideBridgeModal,action:"deposit",account:this.props.account.get("name"),sender:this.props.account.get("id"),asset:this.state.bridgeAsset,balances:this.props.balances,bridges:e,isDown:this.props.gatewayDown.get("TRADE")}),(this.state.isBurnModalVisible||this.state.isBurnModalVisibleBefore)&&a.createElement(pn,{visible:this.state.isBurnModalVisible,hideModal:this.hideBurnModal,asset:this.state.reserve,account:this.props.account,onClose:()=>{hn().publish("reserve_asset","close")}})))}}yn=(0,d.N)(yn,{listenTo:()=>[o.A,tn.A,Ca.A],getProps:()=>({settings:o.A.getState().settings,viewSettings:o.A.getState().viewSettings,backedCoins:tn.A.getState().backedCoins,bridgeCoins:tn.A.getState().bridgeCoins,gatewayDown:tn.A.getState().down,allMarketStats:Ca.A.getState().allMarketStats})});const fn=yn=(0,Ka.Ay)(yn,50,{leading:!1});var En=s(84181),vn=s(95093),An=s.n(vn);function wn(){return wn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},wn.apply(this,arguments)}var Cn={lang:wn({placeholder:"请选择日期",rangePlaceholder:["开始日期","结束日期"]},{today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"}),timePickerLocale:wn({},{placeholder:"请选择时间"})};Cn.lang.ok="确 定";const kn=Cn;var Sn=s(41643);function xn(){return xn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},xn.apply(this,arguments)}const Nn=()=>new ss.Vd({amount:0,asset_id:"1.3.0"});class Mn extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this)}getInitialState(e){return{createOfferError:null,showModal:0,account:e.account,amount:"",asset_id:null,asset:null,error:null,feeAmount:Nn(),maxAmount:!1,balanceError:!1,pawn_assets:[],pawnInput:null,pawn_asset:null,pawn_price:null,whitelist:[],whitelist_name:"",whitelist_account:null,whitelist_amount:"",rate:"",repay_period:null,validity_period:null}}showModal(e=1){this.setState({showModal:e})}hideModal(){this.setState({showModal:0})}onAmountChanged({amount:e,asset:t}){t&&("object"!=typeof t&&(t=U.ChainStore.getAsset(t)),this.setState({amount:e,asset:t,asset_id:t.get("id"),error:null,maxAmount:!1},this._checkBalance))}onFeeChanged(e){e&&this.setState({feeAmount:e,error:null},this._checkBalance)}_setTotal(e,t){const{feeAmount:s}=this.state;let a=U.ChainStore.getObject(t),n=U.ChainStore.getObject(e);if(a){let e=new ss.Vd({amount:a.get("balance"),asset_id:n.get("id"),precision:n.get("precision")});s.asset_id===e.asset_id&&e.minus(s),this.setState({maxAmount:!0,amount:e.getAmount({real:!0})},this._checkBalance)}}_checkBalance(){const{feeAmount:e,amount:t,account:s,asset:a}=this.state;if(!a||!s)return;const n=s.getIn(["balances",a.get("id")]),i=s.getIn(["balances",e.asset_id]);if(!a||!s)return;if(!n)return this.setState({balanceError:!0});let o=U.ChainStore.getObject(n),r=i?U.ChainStore.getObject(i):null;if(r&&0!==r.get("balance")||this.setState({feeAmount:Nn()}),!o||!e)return;if(!t)return this.setState({balanceError:!1});const l=(0,we.rT)(t,a,e,o);null!==l&&this.setState({balanceError:!l})}_getAvailableAssets(e=this.state){const{account:t}=e;let s=[];if(!t||!t.get("balances"))return{asset_types:s};let a=t.get("balances").toJS();s=Object.keys(a).sort(S.A.sortID);for(let e in a){let t=U.ChainStore.getObject(a[e]);t&&0===t.get("balance")&&s.splice(s.indexOf(e),1)}return{asset_types:s}}_delPawnItem(e){let{pawn_assets:t}=this.state,s=t.findIndex((t=>t.asset_id==e));t.splice(s,1),s>-1&&this.setState({pawn_assets:t})}_addPawnItem(){let{pawn_asset:e,pawn_price:t,pawn_assets:s}=this.state;if(e&&t){"object"!=typeof e&&(e=U.ChainStore.getAsset(e));let a=s.find((t=>t.asset_id===e.get("id")));a?a.setAmount({real:t}):s.push(new ss.Vd({real:t,asset_id:e.get("id"),precision:e.get("precision")})),this.setState({pawn_assets:s,showModal:1})}else this.setState({showModal:1})}_getPawnColumns(){return[{title:N().translate("credit_offer.accepted_pawn"),dataIndex:"pawn_asset",key:"pawn_asset",render:e=>e},{title:N().translate("credit_offer.price"),dataIndex:"price",key:"price",render:e=>e},{title:N().translate("credit_offer.operate"),dataIndex:"pawn_asset_id",key:"operate",render:e=>a.createElement(B.Icon,{type:"close-circle",onClick:()=>this._delPawnItem(e),style:{cursor:"pointer",color:"#00a9e9"}})}]}_getWhitelistColumns(){return[{title:N().translate("credit_offer.whitelist_account"),dataIndex:"account",key:"account",render:e=>e},{title:N().translate("credit_offer.loan_amount"),dataIndex:"amount",key:"amount",render:e=>e},{title:N().translate("credit_offer.operate"),dataIndex:"account",key:"operate",render:e=>a.createElement(B.Icon,{type:"close-circle",onClick:()=>this._delWhitelistItem(e),style:{cursor:"pointer",color:"#00a9e9"}})}]}_getPawnData(){let{pawn_assets:e}=this.state;return e.map((e=>{let t=U.ChainStore.getAsset(e.asset_id).get("symbol");return{key:t,pawn_asset:t,price:e.getAmount({real:!0}),pawn_asset_id:e.asset_id}}))}_getWhitelistData(){let{whitelist:e}=this.state;return e.map((e=>({key:e.account.get("name"),account:e.account.get("name"),amount:e.amount})))}_getAddPawnBtn(){return a.createElement(B.Button,{onClick:()=>this.showModal(2)},a.createElement(B.Icon,{type:"plus-circle"})," ",a.createElement(v(),{component:"span",content:"credit_offer.add_pawn"}))}_getAddWhitelistBtn(){return a.createElement(B.Button,{onClick:()=>this.showModal(3)},a.createElement(B.Icon,{type:"plus-circle"})," ",a.createElement(v(),{component:"span",content:"credit_offer.add_whitelist"}))}_onRateChange(e){this.setState({rate:e.target.value})}_onMinLoanChange(e){this.setState({min_loan:e.target.value})}_onRepayPeriodChange(e){this.setState({repay_period:e})}_onValidityPeriodChange(e){this.setState({validity_period:e})}_onSubmit(){this.setState({createOfferError:null});let e,{account:t,asset_id:s,amount:a,rate:n,repay_period:i,min_loan:o,validity_period:r,pawn_assets:l,whitelist:c,feeAmount:d}=this.state,h=U.ChainStore.getAsset(s);try{if(parseInt(o)>parseInt(a))throw new Error(N().translate("credit_offer.min_loan_bigger_than_balance",{min:o,balance:a}));e={owner_account:t.get("id"),asset_type:s,balance:new ss.Vd({real:a,asset_id:s,precision:h.get("precision")}).getAmount(),fee_rate:parseFloat(n)*Sn.g_/100,max_duration_seconds:i,min_deal_amount:new ss.Vd({real:o,asset_id:s,precision:h.get("precision")}).getAmount(),auto_disable_time:r,acceptable_collateral:l.map((e=>{let t=U.ChainStore.getAsset(e.asset_id),a=new ss.gm({base:new ss.Vd({asset_id:s,precision:h.get("precision")}),quote:new ss.Vd({asset_id:e.asset_id,precision:t.get("precision")}),real:1/e.getAmount({real:!0})});return[e.asset_id,a.toObject()]})),acceptable_borrowers:c.map((e=>[e.account.get("id"),new ss.Vd({real:e.amount,asset_id:s,precision:h.get("precision")}).getAmount()])),fee_asset:d},Sn.Ay.create(e).then((()=>{this.hideModal()})).catch((e=>{console.error(e),this.setState({createOfferError:e.toString()})}))}catch(e){return void(e.toString().indexOf("overflow")>=0?this.setState({createOfferError:N().translate("credit_offer.number_is_to_big")}):this.setState({createOfferError:e.toString()}))}}_renderCreateModal(){let{asset:e,asset_id:t,amount:s,account:n,feeAmount:i,balanceError:o,pawn_assets:r,whitelist:l,rate:c,min_loan:d,repay_period:h,validity_period:m}=this.state,{asset_types:p}=this._getAvailableAssets(),u=0,g=null;const _=0==r.length||!s||!e||!c||!d||!h||!m||o;if(n&&n.get("balances")){let t=n.get("balances").toJS(),s=o?"has-error":"";if(1===p.length&&(e=U.ChainStore.getAsset(p[0])),p.length>0){let n=e?e.get("id"):p[0];g=a.createElement("span",null,a.createElement(v(),{component:"span",content:"transfer.available"}),":"," ",a.createElement("span",{className:s,style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._setTotal.bind(this,n,t[n],i.getAmount({real:!0}),i.asset_id)},a.createElement(ts.A,{balance:t[n]})))}else g=a.createElement("span",null,a.createElement("span",{className:s},a.createElement(v(),{content:"transfer.errors.noFunds"})))}return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.create"),visible:1===this.state.showModal,id:this.props.id,overlay:!0,onCancel:this.hideModal,footer:[a.createElement(B.Button,{key:"send",disabled:_,onClick:this._onSubmit.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this.hideModal},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement("div",{className:"grid-block vertical no-overflow"},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(he.A,{label:"transfer.amount",amount:s,onChange:this.onAmountChanged.bind(this),asset:p.length>0&&e?e.get("id"):t||p[0],assets:p,display_balance:g,tabIndex:u++,allowNaN:!0}),a.createElement("div",{className:"content-block",style:{marginBottom:0}},a.createElement("div",{className:"grid-wrapper",style:{marginBottom:0}},a.createElement(B.Table,{columns:this._getPawnColumns(),dataSource:this._getPawnData(),pagination:!1,locale:{emptyText:this._getAddPawnBtn()},className:"modal-table"}))),r.length>0?a.createElement("div",{className:"content-block",style:{textAlign:"center"}},this._getAddPawnBtn()):null,a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 medium-6 withdraw-fee-selector",style:{paddingRight:5}},a.createElement("label",{className:"left-label"},a.createElement(v(),{content:"credit_offer.fee_rate"})),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement(B.Tooltip,{placement:"top",title:N().translate("credit_offer.tip_fee_rate")},a.createElement(B.Input,{type:"number",value:c,onChange:this._onRateChange.bind(this)})))),a.createElement("div",{className:"small-12 medium-6 ant-form-item-label withdraw-fee-selector"},a.createElement("label",{className:"amount-selector-field--label",style:{marginBottom:"13px"}},a.createElement(v(),{content:"credit_offer.repay_period"})),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(B.Select,{value:h,onChange:this._onRepayPeriodChange.bind(this)},Sn.Vt.map(((e,t)=>a.createElement(B.Select.Option,{key:e,value:e},N().translate("credit_offer.list_repay_period.period_"+t)))))))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 medium-6 withdraw-fee-selector",style:{paddingRight:5}},a.createElement("label",{className:"left-label"},a.createElement(v(),{content:"credit_offer.min_borrow"})),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement(B.Input,{type:"number",value:d,onChange:this._onMinLoanChange.bind(this)}))),a.createElement("div",{className:"small-12 medium-6 ant-form-item-label withdraw-fee-selector"},a.createElement("label",{className:"amount-selector-field--label",style:{marginBottom:"13px"}},a.createElement(v(),{content:"credit_offer.validity_period"})),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(B.DatePicker,{className:"text-cursor",placeholder:N().translate("credit_offer.plh_select_validity_period"),locale:"zh"==this.props.currentLocale?kn:null,style:{width:"100%"},showTime:!0,value:m,onChange:this._onValidityPeriodChange.bind(this),disabledDate:e=>e<An()().add(-1,"days")||e>An()().add(380,"days")})))),a.createElement("div",{className:"content-block",style:{marginBottom:0}},a.createElement("div",{className:"grid-wrapper",style:{marginBottom:0}},a.createElement(B.Table,{columns:this._getWhitelistColumns(),dataSource:this._getWhitelistData(),pagination:!1,locale:{emptyText:this._getAddWhitelistBtn()},className:"modal-table"}))),l.length>0?a.createElement("div",{className:"content-block",style:{textAlign:"center"}},this._getAddWhitelistBtn()):null,a.createElement(En.A,{account:n,transaction:{type:"credit_offer_create",options:["price_per_kbyte"],data:{type:"memo",content:null}},onChange:this.onFeeChanged.bind(this),tabIndex:u++}),this.state.createOfferError&&a.createElement(B.Alert,{message:this.state.createOfferError,type:"warning"}))))}_onInputPawn(e){this.setState({pawnInput:e})}_onFoundPawnAsset(e){e&&this.setState({pawn_asset:e})}_onPwanPriceChanged(e){this.setState({pawn_price:e.target.value})}_onHideAddPawnModal(){this.showModal(1)}_renderAddPawnModal(){let{pawn_price:e,showModal:t,pawnInput:s}=this.state;return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.title_add_pawn"),visible:2===t,id:this.props.id,overlay:!0,onCancel:this._onHideAddPawnModal.bind(this),footer:[a.createElement(B.Button,{key:"send",disabled:!e||e<=0||!s,onClick:this._addPawnItem.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this._onHideAddPawnModal.bind(this)},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(Ee.A,{inputClass:"ant-input",label:"account.user_issued_assets.name",onChange:this._onInputPawn.bind(this),asset:s,assetInput:s,style:{width:"100%"},onFound:this._onFoundPawnAsset.bind(this)}),a.createElement(B.Form.Item,{label:N().translate("credit_offer.pawn_amount"),style:{marginTop:"40px"}},a.createElement(B.Tooltip,{placement:"top",title:N().translate("credit_offer.tip_pawn_amount")},a.createElement(B.Input,{style:{marginBottom:0},value:e,type:"number",onChange:this._onPwanPriceChanged.bind(this)})))))}_onHideWhitelistModal(){this.showModal(1)}_addWhitelistItem(){let{whitelist:e,whitelist_account:t,whitelist_amount:s}=this.state;if(!t||!s)return void this.showModal(1);let a={account:t,amount:s};e.push(a),this.setState({whitelist:e},(()=>this.showModal(1)))}_delWhitelistItem(e){let{whitelist:t}=this.state,s=t.findIndex((t=>t.account.get("name")==e));t.splice(s,1),s>-1&&this.setState({whitelist:t})}_whitelistChanged(e){this.setState({whitelist_name:e})}_onWhitelistAccountChanged(e){this.setState({whitelist_account:e})}_onWhitelistAmountChanged({amount:e,asset:t}){t&&("object"!=typeof t&&(t=U.ChainStore.getAsset(t)),this.setState({whitelist_amount:e}))}_renderAddWhitelistModal(){let{showModal:e,whitelist_name:t,whitelist_account:s,whitelist_amount:n,asset:i,asset_id:o}=this.state;return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.title_add_whitelist"),visible:3===e,id:this.props.id,overlay:!0,onCancel:this._onHideWhitelistModal.bind(this),footer:[a.createElement(B.Button,{key:"send",onClick:this._addWhitelistItem.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this._onHideWhitelistModal.bind(this)},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(I.A,{label:"credit_offer.account",accountName:t,account:s,onChange:this._whitelistChanged.bind(this),onAccountChanged:this._onWhitelistAccountChanged.bind(this),typeahead:!0,includeMyActiveAccounts:!1,noForm:!0}),a.createElement(he.A,{label:"credit_offer.loan_amount",amount:n,onChange:this._onWhitelistAmountChanged.bind(this),asset:o})))}render(){switch(this.state.showModal){case 1:return this._renderCreateModal();case 2:return this._renderAddPawnModal();case 3:return this._renderAddWhitelistModal();default:return null}}}class In extends a.Component{render(){return a.createElement(Mn,xn({},this.props,{ref:this.props.refCallback}))}}const Pn=In=(0,d.N)(In,{listenTo:()=>[i.A,o.A],getProps:e=>({currentAccount:i.A.getState().currentAccount,passwordAccount:i.A.getState().passwordAccount,currentLocale:o.A.getState().settings.get("locale")})});var Bn=s(90184);function Tn(){return Tn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Tn.apply(this,arguments)}const On=()=>new ss.Vd({amount:0,asset_id:"1.3.0"});class Fn extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e),this.initModal=this.initModal.bind(this),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this)}getInitialState(e){return{submitErr:null,showModal:0,account:e.account,amount:"",asset_id:null,asset:null,error:null,feeAmount:On(),maxAmount:!1,balanceError:!1,pawn_assets:[],pawnInput:null,pawn_asset:null,pawn_price:null,whitelist:[],whitelist_name:"",whitelist_account:null,whitelist_amount:"",rate:"",repay_period:null,validity_period:null}}getDataState(e){let t=U.ChainStore.getAsset(e.asset_type).get("precision"),s=new ss.Vd({amount:e.current_balance,asset_id:e.asset_type,precision:t}),a=new ss.Vd({amount:e.total_balance,asset_id:e.asset_type,precision:t}),n=e.acceptable_collateral.map((e=>{let t=U.ChainStore.getAsset(e[1].base.asset_id).get("precision"),s=U.ChainStore.getAsset(e[1].quote.asset_id).get("precision"),a=new ss.gm({base:new ss.Vd({asset_id:e[1].base.asset_id,amount:e[1].base.amount,precision:t}),quote:new ss.Vd({asset_id:e[1].quote.asset_id,amount:e[1].quote.amount,precision:s})});return new ss.Vd({real:1/a.toReal(),asset_id:e[0],precision:U.ChainStore.getAsset(e[0]).get("precision")})})),i=e.acceptable_borrowers.map((s=>({account:s[0],amount:new ss.Vd({amount:s[1],asset_id:e.asset_type,precision:t}).getAmount({real:!0})})));return{showModal:0,offer_id:e.id,account:U.ChainStore.getAccount(e.owner_account,!1),amount:s.getAmount({real:!0}),balanceAmount:s.getAmount({real:!0}),totalBalanceAmount:a.getAmount({real:!0}),asset_id:e.asset_type,asset:null,error:null,feeAmount:On(),maxAmount:!1,balanceError:!1,pawnInput:null,pawn_asset:null,pawn_price:null,pawn_assets:n,whitelist:i,whitelist_name:"",whitelist_account:null,whitelist_amount:"",rate:parseFloat(e.fee_rate)/Sn.g_*100,repay_period:e.max_duration_seconds,validity_period:An()(e.auto_disable_time),min_loan:new ss.Vd({amount:e.min_deal_amount,asset_id:e.asset_type,precision:t}).getAmount({real:!0})}}showModal(e=1){this.setState({showModal:e})}initModal(e,t=1){let s=this.getDataState(e);s.showModal=t,this.setState(s)}hideModal(){this.setState({showModal:0})}onAmountChanged({amount:e,asset:t}){t&&("object"!=typeof t&&(t=U.ChainStore.getAsset(t)),this.setState({amount:e,asset:t,asset_id:t.get("id"),error:null,maxAmount:!1},this._checkBalance))}onFeeChanged(e){e&&this.setState({feeAmount:e,error:null},this._checkBalance)}_setTotal(e,t){const{feeAmount:s}=this.state;let a=U.ChainStore.getObject(t),n=U.ChainStore.getObject(e);if(a){let e=new ss.Vd({amount:a.get("balance"),asset_id:n.get("id"),precision:n.get("precision")});s.asset_id===e.asset_id&&e.minus(s),this.setState({maxAmount:!0,amount:e.getAmount({real:!0})},this._checkBalance)}}_checkBalance(){const{feeAmount:e,amount:t,account:s,asset:a}=this.state;if(!a||!s)return;const n=s.getIn(["balances",a.get("id")]),i=s.getIn(["balances",e.asset_id]);if(!a||!s)return;if(!n)return this.setState({balanceError:!0});let o=U.ChainStore.getObject(n),r=i?U.ChainStore.getObject(i):null;if(r&&0!==r.get("balance")||this.setState({feeAmount:On()}),!o||!e)return;if(!t)return this.setState({balanceError:!1});const l=(0,we.rT)(t-this.state.balanceAmount,a,e,o);null!==l&&this.setState({balanceError:!l})}_getAvailableAssets(e=this.state){const{account:t}=e;let s=[];if(!t||!t.get("balances"))return{asset_types:s};let a=t.get("balances").toJS();s=Object.keys(a).sort(S.A.sortID);for(let e in a){let t=U.ChainStore.getObject(a[e]);t&&0===t.get("balance")&&s.splice(s.indexOf(e),1)}return{asset_types:s}}_delPawnItem(e){let{pawn_assets:t}=this.state,s=t.findIndex((t=>t.asset_id==e));t.splice(s,1),s>-1&&this.setState({pawn_assets:t})}_addPawnItem(){let{pawn_asset:e,pawn_price:t,pawn_assets:s}=this.state;if(e&&t){"object"!=typeof e&&(e=U.ChainStore.getAsset(e));let a=s.find((t=>t.asset_id===e.get("id")));a?a.setAmount({real:t}):s.push(new ss.Vd({real:t,asset_id:e.get("id"),precision:e.get("precision")})),this.setState({pawn_assets:s,showModal:1})}else this.setState({showModal:1})}_getPawnColumns(){return[{title:N().translate("credit_offer.accepted_pawn"),dataIndex:"pawn_asset",key:"pawn_asset",render:e=>e},{title:N().translate("credit_offer.price"),dataIndex:"price",key:"price",render:e=>e},{title:N().translate("credit_offer.operate"),dataIndex:"pawn_asset_id",key:"operate",render:e=>a.createElement(B.Icon,{type:"close-circle",onClick:()=>this._delPawnItem(e),style:{cursor:"pointer",color:"#00a9e9"}})}]}_getWhitelistColumns(){return[{title:N().translate("credit_offer.whitelist_account"),dataIndex:"account",key:"account",render:e=>a.createElement(Bn.A,{account:e})},{title:N().translate("credit_offer.loan_amount"),dataIndex:"amount",key:"amount",render:e=>e},{title:N().translate("credit_offer.operate"),dataIndex:"account",key:"operate",render:e=>a.createElement(B.Icon,{type:"close-circle",onClick:()=>this._delWhitelistItem(e),style:{cursor:"pointer",color:"#00a9e9"}})}]}_getPawnData(){let{pawn_assets:e}=this.state;return e.map((e=>{let t=U.ChainStore.getAsset(e.asset_id).get("symbol");return{key:t,pawn_asset:t,price:e.getAmount({real:!0}),pawn_asset_id:e.asset_id}}))}_getWhitelistData(){let{whitelist:e}=this.state;return e.map((e=>({key:e.account,account:e.account,amount:e.amount})))}_getAddPawnBtn(){return a.createElement(B.Button,{onClick:()=>this.showModal(2)},a.createElement(B.Icon,{type:"plus-circle"})," ",a.createElement(v(),{component:"span",content:"credit_offer.add_pawn"}))}_getAddWhitelistBtn(){return a.createElement(B.Button,{onClick:()=>this.showModal(3)},a.createElement(B.Icon,{type:"plus-circle"})," ",a.createElement(v(),{component:"span",content:"credit_offer.add_whitelist"}))}_onRateChange(e){this.setState({rate:e.target.value})}_onMinLoanChange(e){this.setState({min_loan:e.target.value})}_onRepayPeriodChange(e){this.setState({repay_period:e})}_onValidityPeriodChange(e){this.setState({validity_period:e})}_onSubmit(){let e,{account:t,asset_id:s,amount:a,rate:n,repay_period:i,min_loan:o,validity_period:r,pawn_assets:l,whitelist:c,feeAmount:d,offer_id:h,balanceAmount:m,totalBalanceAmount:p}=this.state;this.setState({submitErr:null});try{const u=p+(parseInt(a)-parseInt(m));if(parseInt(o)>u)throw new Error(N().translate("credit_offer.min_loan_bigger_than_balance",{min:o,balance:u.toFixed(4)}));let g=U.ChainStore.getAsset(s).get("precision");e={owner_account:t.get("id"),offer_id:h,delta_amount:new ss.Vd({real:parseInt(a)-parseInt(m),asset_id:s,precision:g}),fee_rate:parseFloat(n)*Sn.g_/100,max_duration_seconds:i,min_deal_amount:new ss.Vd({real:o,asset_id:s,precision:g}).getAmount(),enabled:!0,auto_disable_time:r,acceptable_collateral:l.map((e=>{let t=U.ChainStore.getAsset(e.asset_id).get("precision"),a=new ss.gm({base:new ss.Vd({asset_id:s,precision:g}),quote:new ss.Vd({asset_id:e.asset_id,precision:t}),real:1/e.getAmount({real:!0})});return[e.asset_id,a.toObject()]})),acceptable_borrowers:c.map((e=>[e.account.get?e.account.get("id"):e.account,new ss.Vd({real:e.amount,asset_id:s,precision:g}).getAmount()])),fee_asset:d},0===e.delta_amount.getAmount({real:!0})&&delete e.delta_amount,Sn.Ay.update(e).then((()=>{this.hideModal()})).catch((e=>{console.error(e)}))}catch(e){e.toString().indexOf("overflow")>=0?this.setState({submitErr:N().translate("credit_offer.number_is_to_big")}):this.setState({submitErr:e.toString()})}}_renderEditModal(){let{asset:e,asset_id:t,amount:s,account:n,feeAmount:i,balanceError:o,pawn_assets:r,whitelist:l,rate:c,min_loan:d,repay_period:h,validity_period:m}=this.state,p=0,u=null;const g=0==r.length||!s||!e||!c||!d||!h||!m||o;if(n&&n.get("balances")){let s=n.get("balances").toJS(),r=o?"has-error":"";t&&!e&&(e=U.ChainStore.getAsset(t)),u=a.createElement("span",null,a.createElement(v(),{component:"span",content:"transfer.available"}),":"," ",a.createElement("span",{className:r,style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._setTotal.bind(this,t,s[t],i.getAmount({real:!0}),i.asset_id)},a.createElement(ts.A,{balance:s[t]})))}return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.edit"),visible:1===this.state.showModal,id:this.props.id,overlay:!0,onCancel:this.hideModal,footer:[a.createElement(B.Button,{key:"send",disabled:g,onClick:this._onSubmit.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this.hideModal},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement("div",{className:"grid-block vertical no-overflow"},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(he.A,{label:"credit_offer.current_available_balance",amount:s,onChange:this.onAmountChanged.bind(this),asset:t,display_balance:u,tabIndex:p++,allowNaN:!0}),a.createElement("div",{className:"content-block",style:{marginBottom:0}},a.createElement("div",{className:"grid-wrapper",style:{marginBottom:0}},a.createElement(B.Table,{columns:this._getPawnColumns(),dataSource:this._getPawnData(),pagination:!1,locale:{emptyText:this._getAddPawnBtn()},className:"modal-table"}))),r.length>0?a.createElement("div",{className:"content-block",style:{textAlign:"center"}},this._getAddPawnBtn()):null,a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 medium-6 withdraw-fee-selector",style:{paddingRight:5}},a.createElement("label",{className:"left-label"},a.createElement(v(),{content:"credit_offer.fee_rate"})),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement(B.Tooltip,{placement:"top",title:N().translate("credit_offer.tip_fee_rate")},a.createElement(B.Input,{type:"number",value:c,onChange:this._onRateChange.bind(this)})))),a.createElement("div",{className:"small-12 medium-6 ant-form-item-label withdraw-fee-selector"},a.createElement("label",{className:"amount-selector-field--label",style:{marginBottom:"13px"}},a.createElement(v(),{content:"credit_offer.repay_period"})),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(B.Select,{value:h,onChange:this._onRepayPeriodChange.bind(this)},Sn.Vt.map(((e,t)=>a.createElement(B.Select.Option,{key:e,value:e},N().translate("credit_offer.list_repay_period.period_"+t)))))))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 medium-6 withdraw-fee-selector",style:{paddingRight:5}},a.createElement("label",{className:"left-label"},a.createElement(v(),{content:"credit_offer.min_borrow"})),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement(B.Input,{type:"number",value:d,onChange:this._onMinLoanChange.bind(this)}))),a.createElement("div",{className:"small-12 medium-6 ant-form-item-label withdraw-fee-selector"},a.createElement("label",{className:"amount-selector-field--label",style:{marginBottom:"13px"}},a.createElement(v(),{content:"credit_offer.validity_period"})),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(B.DatePicker,{className:"text-cursor",placeholder:N().translate("credit_offer.plh_select_validity_period"),locale:"zh"==this.props.currentLocale?kn:null,style:{width:"100%"},showTime:!0,value:m,onChange:this._onValidityPeriodChange.bind(this),disabledDate:e=>e<An()().add(-1,"days")||e>An()().add(380,"days")})))),a.createElement("div",{className:"content-block",style:{marginBottom:0}},a.createElement("div",{className:"grid-wrapper",style:{marginBottom:0}},a.createElement(B.Table,{columns:this._getWhitelistColumns(),dataSource:this._getWhitelistData(),pagination:!1,locale:{emptyText:this._getAddWhitelistBtn()},className:"modal-table"}))),l.length>0?a.createElement("div",{className:"content-block",style:{textAlign:"center"}},this._getAddWhitelistBtn()):null,a.createElement(En.A,{account:n,transaction:{type:"credit_offer_create",options:["price_per_kbyte"],data:{type:"memo",content:null}},onChange:this.onFeeChanged.bind(this),tabIndex:p++}))),this.state.submitErr&&a.createElement(B.Alert,{message:this.state.submitErr,type:"warning"}))}_onInputPawn(e){this.setState({pawnInput:e})}_onFoundPawnAsset(e){e&&this.setState({pawn_asset:e})}_onPwanPriceChanged(e){this.setState({pawn_price:e.target.value})}_onHideAddPawnModal(){this.showModal(1)}_renderAddPawnModal(){let{pawn_price:e,showModal:t,pawnInput:s}=this.state;return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.title_add_pawn"),visible:2===t,id:this.props.id,overlay:!0,onCancel:this._onHideAddPawnModal.bind(this),footer:[a.createElement(B.Button,{key:"send",disabled:!e||e<=0||!s,onClick:this._addPawnItem.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this._onHideAddPawnModal.bind(this)},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(Ee.A,{inputClass:"ant-input",label:"account.user_issued_assets.name",onChange:this._onInputPawn.bind(this),asset:s,assetInput:s,style:{width:"100%"},onFound:this._onFoundPawnAsset.bind(this)}),a.createElement(B.Form.Item,{label:N().translate("credit_offer.pawn_amount"),style:{marginTop:"40px"}},a.createElement(B.Tooltip,{placement:"top",title:N().translate("credit_offer.tip_pawn_amount")},a.createElement(B.Input,{style:{marginBottom:0},value:e,type:"number",onChange:this._onPwanPriceChanged.bind(this)})))))}_onHideWhitelistModal(){this.showModal(1)}_addWhitelistItem(){let{whitelist:e,whitelist_account:t,whitelist_amount:s}=this.state;if(!t||!s)return void this.showModal(1);let a={account:t.get("id"),amount:s};e.push(a),this.setState({whitelist:e},(()=>this.showModal(1)))}_delWhitelistItem(e){let{whitelist:t}=this.state,s=t.findIndex((t=>t.account==e));t.splice(s,1),s>-1&&this.setState({whitelist:t})}_whitelistChanged(e){this.setState({whitelist_name:e})}_onWhitelistAccountChanged(e){this.setState({whitelist_account:e})}_onWhitelistAmountChanged({amount:e,asset:t}){t&&("object"!=typeof t&&(t=U.ChainStore.getAsset(t)),this.setState({whitelist_amount:e}))}_renderAddWhitelistModal(){let{showModal:e,whitelist_name:t,whitelist_account:s,whitelist_amount:n,asset:i,asset_id:o}=this.state;return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.title_add_whitelist"),visible:3===e,id:this.props.id,overlay:!0,onCancel:this._onHideWhitelistModal.bind(this),footer:[a.createElement(B.Button,{key:"send",onClick:this._addWhitelistItem.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this._onHideWhitelistModal.bind(this)},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(I.A,{label:"credit_offer.account",accountName:t,account:s,onChange:this._whitelistChanged.bind(this),onAccountChanged:this._onWhitelistAccountChanged.bind(this),typeahead:!0,includeMyActiveAccounts:!1,noForm:!0}),a.createElement(he.A,{label:"credit_offer.loan_amount",amount:n,onChange:this._onWhitelistAmountChanged.bind(this),asset:o})))}render(){switch(this.state.showModal){case 1:return this._renderEditModal();case 2:return this._renderAddPawnModal();case 3:return this._renderAddWhitelistModal();default:return null}}}class Ln extends a.Component{render(){return a.createElement(Fn,Tn({},this.props,{ref:this.props.refCallback}))}}const Rn=Ln=(0,d.N)(Ln,{listenTo:()=>[i.A,o.A],getProps:e=>({currentAccount:i.A.getState().currentAccount,passwordAccount:i.A.getState().passwordAccount,currentLocale:o.A.getState().settings.get("locale")})});var qn=s(96218),Vn=s(92646);class Dn extends a.Component{constructor(e){super(),this.showCreateModal=this.showCreateModal.bind(this),this._getColumns=this._getColumns.bind(this)}componentDidMount(){this._loadList(!0)}_loadList(e=!1){Sn.Ay.getCreditOffersByOwner({name_or_id:this.props.account.get("id"),flag:!!e&&"first"})}showCreateModal(){this.create_modal&&this.create_modal.showModal()}showEditModal(e){this.edit_modal&&this.edit_modal.initModal(e)}_showCreateButton(){let{currentAccount:e,passwordAccount:t,account:s}=this.props,n=s.get("name");return n===e||n===t?a.createElement("div",{className:"generic-bordered-box"},a.createElement("div",{className:"header-selector"},a.createElement("div",{className:"filter inline-block"},a.createElement(B.Button,{style:{marginRight:"30px"},onClick:this.showCreateModal},a.createElement(v(),{content:"credit_offer.create"}))))):null}_getColumns(){let e=[{title:"ID",dataIndex:"id"},{title:N().translate("credit_offer.asset"),dataIndex:"asset_type",render:e=>a.createElement(Pe.A,{asset:e})},{title:N().translate("credit_offer.total_amount"),dataIndex:"total_balance",align:"right",render:(e,t)=>a.createElement(C.A,{amount:e,asset:t.asset_type,hide_asset:!0,trimZero:!0})},{title:N().translate("credit_offer.available_amount"),dataIndex:"current_balance",align:"right",render:(e,t)=>a.createElement(C.A,{amount:e,asset:t.asset_type,hide_asset:!0,trimZero:!0})},{title:N().translate("credit_offer.min_borrow"),dataIndex:"min_deal_amount",align:"right",render:(e,t)=>a.createElement(C.A,{amount:e,asset:t.asset_type,hide_asset:!0,trimZero:!0})},{title:N().translate("credit_offer.fee_rate"),dataIndex:"fee_rate",align:"right",render:e=>`${S.A.format_number(parseFloat(e)/parseFloat(Sn.g_)*100,2,!1)}%`},{title:N().translate("credit_offer.repay_period"),dataIndex:"max_duration_seconds",render:e=>(0,Sn.EA)(e,this.props.locale)},{title:N().translate("credit_offer.validity_period"),dataIndex:"auto_disable_time",render:e=>An().utc(e).local().format("YYYY-MM-DD HH:mm:ss")},{title:N().translate("credit_offer.mortgage_assets"),dataIndex:"acceptable_collateral",render:e=>e.map((e=>a.createElement("div",{key:e[0]},a.createElement(Pe.A,{asset:e[0]}))))},{title:N().translate("credit_offer.status"),dataIndex:"enabled",render:e=>{let t="label "+(e?"success":"info");return a.createElement("span",{className:t},e?N().translate("credit_offer.active"):N().translate("credit_offer.closed"))}}],{account:t,currentAccount:s}=this.props;return t.get("name")==s&&e.push({title:N().translate("credit_offer.operate"),key:"action",render:(e,t)=>a.createElement("span",{style:{fontSize:20}},a.createElement(B.Tooltip,{title:N().translate("credit_offer.operate_edit")},a.createElement(B.Icon,{type:"edit",style:{cursor:"pointer",marginRight:"20px"},onClick:()=>{this.showEditModal(t)}})),a.createElement(B.Tooltip,{title:t.enabled?N().translate("credit_offer.closed"):N().translate("credit_offer.active")},a.createElement(B.Icon,{type:t.enabled?"poweroff":"reload",style:{cursor:"pointer",marginRight:"20px"},onClick:()=>{Sn.Ay.disabled({owner_account:t.owner_account,offer_id:t.id,enabled:!t.enabled})}})),a.createElement(B.Tooltip,{title:N().translate("credit_offer.operate_delete")},a.createElement(B.Icon,{type:"delete",style:{cursor:"pointer"},onClick:()=>Sn.Ay.delete({owner_account:t.owner_account,offer_id:t.id})})))}),e}render(){let{listByOwner:e}=this.props;return a.createElement("div",{className:"grid-content no-overflow no-padding"},a.createElement(Pn,{id:"credit_offer_create_modal",refCallback:e=>{e&&(this.create_modal=e)},account:this.props.account}),a.createElement(Rn,{id:"credit_offer_edit_modal",account:this.props.account,refCallback:e=>{e&&(this.edit_modal=e)}}),this._showCreateButton(),a.createElement("div",{className:"generic-bordered-box"},a.createElement("div",{className:"grid-wrapper"},a.createElement(B.Table,{rowKey:"id",columns:this._getColumns(),dataSource:e,pagination:{hideOnSinglePage:!0,pageSize:10}}))))}}const jn=Dn=(0,d.N)(Dn,{listenTo:()=>[i.A,qn.A,Vn.A],getProps:e=>({currentAccount:i.A.getState().currentAccount,passwordAccount:i.A.getState().passwordAccount,listByOwner:qn.A.getState().listByOwner,locale:Vn.A.getState().currentLocale})}),Un=()=>new ss.Vd({amount:0,asset_id:"1.3.0"});class Wn extends a.Component{constructor(e){super(),this.state={dealId:null,showModal:!1,debtAsset:null,debtAmount:null,amount:null,feeAmount:Un(),maxAmount:!1,balanceError:!1,collateralAmount:0,collateralAsset:null,feeRate:null},this._renderRepayModal=this._renderRepayModal.bind(this),this.showRepayModal=this.showRepayModal.bind(this),this.hideRepayModal=this.hideRepayModal.bind(this),this._getColumns=this._getColumns.bind(this)}componentDidMount(){Sn.Ay.getCreditDealsByBorrower({name_or_id:this.props.account.get("id"),flag:"first"})}_renderRepayModal(){let{account:e}=this.props,{debtAmount:t,debtAsset:s,amount:n,feeAmount:i,balanceError:o,asset:r}=this.state,l=null;const c=!n||!r||o;if(e&&e.get("balances")){let t=e.get("balances").toJS(),n=o?"has-error":"";l=t[s]?a.createElement("span",null,a.createElement(v(),{component:"span",content:"transfer.available"}),":"," ",a.createElement("span",{className:n,style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._setTotal.bind(this,s,t[s],i.getAmount({real:!0}),i.asset_id)},a.createElement(ts.A,{balance:t[s],trimZero:!0}))):a.createElement("span",null,a.createElement("span",{className:n},a.createElement(v(),{content:"transfer.errors.noFunds"})))}return a.createElement(B.Modal,{wrapClassName:"modal--transaction-confirm",title:N().translate("credit_offer.repay"),visible:this.state.showModal,id:"modal-repay",overlay:!0,onCancel:this.hideRepayModal,footer:[a.createElement(B.Button,{key:"send",disabled:c,onClick:this._onSubmit.bind(this)},a.createElement(v(),{content:"wallet.submit"})),a.createElement(B.Button,{key:"Cancel",onClick:this.hideRepayModal},a.createElement(v(),{content:"wallet.cancel"}))]},a.createElement("div",{className:"grid-block vertical no-overflow"},a.createElement(B.Form,{className:"full-width",layout:"vertical"},a.createElement(B.Form.Item,{label:N().translate("credit_offer.my_debt"),labelCol:{span:8},wrapperCol:{span:16},colon:!1},a.createElement("div",{style:{textAlign:"right",width:"100%",color:"#e3745b"}},a.createElement(C.A,{amount:t,asset:s,trimZero:!0}))),a.createElement(he.A,{label:"transfer.amount",amount:n,asset:s,display_balance:l,onChange:this._onAmountChanged.bind(this),allowNaN:!0}),a.createElement(B.Form.Item,{label:N().translate("credit_offer.redemption_collateral"),labelCol:{span:8},wrapperCol:{span:16},colon:!1},a.createElement("div",{style:{textAlign:"right",width:"100%",color:"#7ed321"}},this._renderCollateral())),a.createElement(B.Form.Item,{label:N().translate("credit_offer.estimated_fee"),labelCol:{span:8},wrapperCol:{span:16},colon:!1},a.createElement("div",{style:{textAlign:"right",width:"100%",color:"#7ed321"}},this._renderFeeRate())),a.createElement(B.Form.Item,{label:N().translate("credit_offer.total_to_repay"),labelCol:{span:8},wrapperCol:{span:16},colon:!1},a.createElement("div",{style:{textAlign:"right",width:"100%",color:"#7ed321"}},this._renderTotalAmount())),a.createElement(En.A,{account:e,transaction:{type:"credit_deal_repay"},onChange:this.onFeeChanged.bind(this)}))))}_renderCollateral(){let{debtAmount:e,collateralAmount:t,collateralAsset:s,asset:n,amount:i}=this.state;if(n){let o=new ss.Vd({asset_id:n.get("id"),real:i,precision:n.get("precision")}),r=0;return r=o.getAmount()>e?t:i<=0?0:parseInt(parseFloat(o.getAmount())/parseFloat(e)*t),a.createElement(C.A,{amount:r,asset:s,trimZero:!0})}return a.createElement(C.A,{amount:0,asset:s,trimZero:!0})}_renderTotalAmount(){let{feeRate:e,debtAsset:t,debtAmount:s,amount:n,asset:i}=this.state,o=parseFloat(e)/Sn.g_;if(i){let e=new ss.Vd({asset_id:i.get("id"),real:n,precision:i.get("precision")}),r=o*s*(parseFloat(e.getAmount())/s)/S.A.get_asset_precision(i.get("precision"))+e.getAmount({real:!0});return a.createElement("span",null,a.createElement(C.A,{exact_amount:!0,amount:r,asset:t,trimZero:!0}))}C.A}_renderFeeRate(){let{feeRate:e,debtAsset:t,debtAmount:s,amount:n,asset:i}=this.state,o=parseFloat(e)/Sn.g_;if(i){let e=new ss.Vd({asset_id:i.get("id"),real:n,precision:i.get("precision")}),r=o*s*(parseFloat(e.getAmount())/s);return a.createElement("span",null,a.createElement(C.A,{amount:r,asset:t,trimZero:!0})," ",`(${100*o}%)`)}C.A}_onAmountChanged({amount:e,asset:t}){t&&("object"!=typeof t&&(t=U.ChainStore.getAsset(t)),this.setState({amount:e,asset:t,error:null,maxAmount:!1},this._checkBalance))}_setTotal(e,t){const{feeAmount:s,debtAmount:a}=this.state;let n=U.ChainStore.getObject(t),i=U.ChainStore.getObject(e);if(n){let t=new ss.Vd({amount:n.get("balance"),asset_id:i.get("id"),precision:i.get("precision")});s.asset_id===t.asset_id&&t.minus(s);const o=t.getAmount()>a?new ss.Vd({amount:a,asset_id:e,precision:i.get("precision")}):t;this.setState({maxAmount:!0,amount:o.getAmount({real:!0})},this._checkBalance)}}_checkBalance(){const{feeAmount:e,amount:t,account:s,debtAsset:a}=this.state;if(!a||!s)return;const n=s.getIn(["balances",a]),i=s.getIn(["balances",e.asset_id]);if(!n)return this.setState({balanceError:!0});let o=U.ChainStore.getObject(n),r=i?U.ChainStore.getObject(i):null;if(r&&0!==r.get("balance")||this.setState({feeAmount:Un()}),!o||!e)return;if(!t)return this.setState({balanceError:!1});const l=U.ChainStore.getAsset(a),c=(0,we.rT)(t,l,e,o);null!==c&&this.setState({balanceError:!c})}onFeeChanged(e){e&&this.setState({feeAmount:e,error:null},this._checkBalance)}hideRepayModal(){this.setState({showModal:!1})}showRepayModal(e){this.setState({showModal:!0,debtAmount:e.debt_amount,debtAsset:e.debt_asset,collateralAmount:e.collateral_amount,collateralAsset:e.collateral_asset,feeRate:e.fee_rate,dealId:e.id})}_onSubmit(){let{feeRate:e,debtAmount:t,amount:s,asset:a,dealId:n,feeAmount:i}=this.state,{account:o}=this.props,r=parseFloat(e)/Sn.g_,l=new ss.Vd({asset_id:a.get("id"),real:s,precision:a.get("precision")}),c=l.getAmount(),d=parseFloat(c)/t,h=Math.ceil(r*t*d),m={account:o,deal_id:n,repay_amount:new ss.Vd({amount:c,asset_id:l.asset_id,precision:a.get("precision")}),credit_fee:new ss.Vd({amount:h,asset_id:l.asset_id,precision:a.get("precision")}),fee_asset:i};Sn.Ay.repay(m).then((()=>{this.hideRepayModal()})).catch((e=>{console.error(e)}))}_getColumns(){let e=[{title:"ID",dataIndex:"id"},{title:N().translate("credit_offer.credit_right_account"),dataIndex:"offer_owner",render:e=>a.createElement(Ie.A,{account:e})},{title:N().translate("credit_offer.debt"),align:"right",dataIndex:"debt_asset",render:(e,t)=>a.createElement(C.A,{asset:e,amount:t.debt_amount,trimZero:!0})},{title:N().translate("credit_offer.fee_rate"),align:"right",render:(e,t)=>a.createElement(C.A,{asset:t.debt_asset,amount:parseFloat(t.fee_rate)/Sn.g_*t.debt_amount,trimZero:!0})},{title:N().translate("credit_offer.mortgage_assets"),align:"right",render:(e,t)=>a.createElement(C.A,{asset:t.collateral_asset,amount:t.collateral_amount,trimZero:!0})},{title:N().translate("credit_offer.repay_period"),dataIndex:"latest_repay_time",render:e=>An().utc(e).local().format("YYYY-MM-DD HH:mm:ss")}],{account:t,currentAccount:s}=this.props;return t.get("name")==s&&e.push({title:N().translate("credit_offer.repay"),render:(e,t)=>a.createElement("span",{style:{fontSize:20}},a.createElement(B.Tooltip,{title:N().translate("credit_offer.repay")},a.createElement(B.Icon,{type:"dollar",style:{cursor:"pointer"},onClick:()=>{this.showRepayModal(t)}})))}),e}render(){let{dealsByBorrower:e}=this.props;return a.createElement("div",{className:"grid-content no-overflow no-padding"},a.createElement("div",{className:"generic-bordered-box"},a.createElement("div",{className:"grid-wrapper"},a.createElement(B.Table,{rowKey:"id",columns:this._getColumns(),dataSource:e,pagination:{hideOnSinglePage:!0,pageSize:10}}),this._renderRepayModal())))}}const zn=Wn=(0,d.N)(Wn,{listenTo:()=>[i.A,qn.A],getProps:e=>({currentAccount:i.A.getState().currentAccount,passwordAccount:i.A.getState().passwordAccount,dealsByBorrower:qn.A.getState().dealsByBorrower})});class Kn extends a.Component{constructor(e){super()}componentDidMount(){Sn.Ay.getCreditDealsByOfferOwner({name_or_id:this.props.account.get("id"),flag:"first"})}_getColumns(){return[{title:"ID",dataIndex:"id"},{title:N().translate("credit_offer.credit_debt_account"),dataIndex:"borrower",render:e=>a.createElement(Ie.A,{account:e})},{title:N().translate("credit_offer.debt"),dataIndex:"debt_asset",align:"right",render:(e,t)=>a.createElement(C.A,{asset:e,amount:t.debt_amount,trimZero:!0})},{title:N().translate("credit_offer.fee_rate"),align:"right",render:(e,t)=>a.createElement(C.A,{asset:t.debt_asset,amount:parseFloat(t.fee_rate)/Sn.g_*t.debt_amount,trimZero:!0})},{title:N().translate("credit_offer.mortgage_assets"),align:"right",render:(e,t)=>a.createElement(C.A,{asset:t.collateral_asset,amount:t.collateral_amount,trimZero:!0})},{title:N().translate("credit_offer.repay_period"),dataIndex:"latest_repay_time",render:e=>An().utc(e).local().format("YYYY-MM-DD HH:mm:ss")}]}render(){let{dealsByOfferOwner:e}=this.props;return a.createElement("div",{className:"grid-content no-overflow no-padding"},a.createElement("div",{className:"generic-bordered-box"},a.createElement("div",{className:"grid-wrapper"},a.createElement(B.Table,{rowKey:"id",columns:this._getColumns(),dataSource:e,pagination:{hideOnSinglePage:!0,pageSize:10}}))))}}const Jn=Kn=(0,d.N)(Kn,{listenTo:()=>[i.A,qn.A],getProps:e=>({currentAccount:i.A.getState().currentAccount,passwordAccount:i.A.getState().passwordAccount,dealsByOfferOwner:qn.A.getState().dealsByOfferOwner})});class Hn extends a.Component{render(){return a.createElement(q.t,{defaultActiveTab:0,className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block"},a.createElement(q.o,{title:N().translate("credit_offer.credit_offers")},a.createElement(jn,{account:this.props.account})),a.createElement(q.o,{title:N().translate("credit_offer.credit_rights")},a.createElement(Jn,{account:this.props.account})),a.createElement(q.o,{title:N().translate("credit_offer.credit_debts")},a.createElement(zn,{account:this.props.account})))}}const Gn=Hn=(0,d.N)(Hn,{});function Zn(){return Zn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Zn.apply(this,arguments)}class Qn extends a.Component{constructor(e){super(e),this.state={shownAssets:e.viewSettings.get("shownAssets","active"),alwaysShowAssets:["BTS"],hideFishingProposals:!0,question1:!1,question2:!1,question3:!1},this._handleFilterInput=this._handleFilterInput.bind(this)}_handleFilterInput(e){this.setState({filterValue:e.target.value})}UNSAFE_componentWillMount(){this._checkMarginStatus()}_checkMarginStatus(e=this.props){(function(e){if(!e||e&&!e.get("call_orders",[]).size)return Promise.resolve(null);const t=e.get("name")+JSON.stringify(e.get("call_orders"));return Ia[t]?Ia[t].result?Promise.resolve(Ia[t].result):new Promise(((e,s)=>{Ia[t].queue.push({res:e,rej:s})})):new Promise(((s,a)=>{Ia[t]={queue:[{res:s,rej:a}],result:null},(0,U.FetchChain)("getObject",e.get("call_orders").toArray()).then((e=>{let s=[];e.forEach((e=>{let t=e.getIn(["call_price","base","asset_id"]),a=e.getIn(["call_price","quote","asset_id"]);-1===s.indexOf(t)&&s.push(t),-1===s.indexOf(a)&&s.push(a)})),(0,U.FetchChain)("getAsset",s,6e3).then((s=>{let a={};s.forEach((e=>{a[e.get("id")]=e.toJS()}));let n={};e.forEach((e=>{let t=a[e.getIn(["call_price","quote","asset_id"])],s=a[e.getIn(["call_price","base","asset_id"])],i=L.A.extractRawFeedPrice(t);if(i.base.asset_id===i.quote.asset_id)n[t.id]={ratio:null};else{let i=new ss.Vd({amount:e.get("collateral"),asset_id:s.id,precision:s.precision}),o=new ss.Vd({amount:e.get("debt"),asset_id:t.id,precision:t.precision}),r=t.bitasset.current_feed.maintenance_collateral_ratio/1e3,l=new ss.sA({priceObject:L.A.extractRawFeedPrice(t),market_base:L.A.extractRawFeedPrice(t).quote.asset_id,sqr:t.bitasset.current_feed.maximum_short_squeeze_ratio,mcfr:t.bitasset.options.extensions.margin_call_fee_ratio,assets:a}),c={ratio:i.getAmount({real:!0})/(o.getAmount({real:!0})/l.toReal())};if(isNaN(c.ratio))return null;c.ratio<r?c.statusClass="danger":c.ratio<r+.5?c.statusClass="warning":c.statusClass=null,n[t.id]=c}})),Ia[t].queue.forEach((e=>{e.res(n)})),Ia[t]={result:n},setTimeout((()=>{delete Ia[t]}),6e4)}))})).catch((()=>{Ia[t].queue.forEach((e=>{e.rej()}))}))}))})(e.account).then((e=>{let t=null;for(let s in e)t=e[s].statusClass||t;this.setState({globalMarginStatus:t})}))}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this._checkMarginStatus(e)}shouldComponentUpdate(e,t){return!S.A.are_equal_shallow(e.balances,this.props.balances)||e.account!==this.props.account||e.isMyAccount!==this.props.isMyAccount||e.settings!==this.props.settings||e.hiddenAssets!==this.props.hiddenAssets||!S.A.are_equal_shallow(t,this.state)||this.state.filterValue!==t.filterValue||this.state.enabledColumns!==t.enabledColumns}_changeShownAssets(e="active"){this.setState({shownAssets:e}),Be.A.changeViewSetting({shownAssets:e})}_toggleHideProposal(){this.setState({hideFishingProposals:!this.state.hideFishingProposals})}_toggleQ1(){this.setState({question1:!this.state.question1})}_toggleQ2(){this.setState({question2:!this.state.question2})}_toggleQ3(){this.setState({question3:!this.state.question3})}_showProposals(){Be.A.changeSetting({setting:"showProposedTx",value:!0})}render(){let{account:e,hiddenAssets:t,settings:s,orders:n}=this.props,{shownAssets:i}=this.state;if(!e)return null;const o=s.get("unit")?s.get("unit"):this.props.core_asset.get("symbol");let r,l,c=[],d={},h={};U.ChainStore.requestAllDataForAccount(e.toJS().id,"balance"),e.toJS&&e.has("call_orders")&&(c=e.get("call_orders").toJS());let m=e.get("balances"),u=p().List(),g=p().List();c.forEach((e=>{let t=U.ChainStore.getObject(e);if(t){let e=t.getIn(["call_price","base","asset_id"]);d[e]?d[e]+=parseInt(t.get("collateral"),10):d[e]=parseInt(t.get("collateral"),10);let s=t.getIn(["call_price","quote","asset_id"]);h[s]?h[s]+=parseInt(t.get("debt"),10):h[s]=parseInt(t.get("debt"),10)}})),m&&(m=m.filter(((e,t)=>{let s=U.ChainStore.getObject(e);return!(s&&!s.get("balance")&&!n[t])})),m.forEach(((e,s)=>{const a=U.ChainStore.getAsset(s);let n="",i="";if(this.state.filterValue){i=this.state.filterValue?String(this.state.filterValue).toLowerCase():"",n=a.get("symbol").toLowerCase();let{isBitAsset:e}=S.A.replaceName(a);e&&(n="bit"+n)}t.includes(s)&&n.includes(i)?g=g.push(e):n.includes(i)&&(u=u.push(e))})));let _=a.createElement(ds.A,{noTip:!0,balances:g,hide_asset:!0}),b=a.createElement(ds.A,{noTip:!0,balances:u,hide_asset:!0}),y=a.createElement(ds.A,{noTip:!0,balances:p().List(),openOrders:n,hide_asset:!0}),f=a.createElement(ds.A,{noTip:!0,balances:p().List(),debt:h,collateral:d,hide_asset:!0}),E=a.createElement(ds.A,{noTip:!0,balances:p().List(),debt:h,hide_asset:!0}),A=a.createElement(ds.A,{noTip:!0,balances:p().List(),collateral:d,hide_asset:!0});const w=a.createElement(_s.A,{noLink:!0,string:"account.total",keys:[{type:"asset",value:o,arg:"asset"}]}),C=a.createElement("span",{key:"portfolio",className:"total-value"},w,": ",b),k=a.createElement("span",{key:"portfolio",className:"total-value"},w,": ",_);return r=a.createElement(fn,{balanceList:u,optionalAssets:this.state.filterValue?null:this.state.alwaysShowAssets,visible:!0,preferredUnit:o,coreAsset:this.props.core_asset,coreSymbol:this.props.core_asset.get("symbol"),hiddenAssets:t,orders:n,account:this.props.account,isMyAccount:this.props.isMyAccount,balances:this.props.balances,extraRow:C,viewSettings:this.props.viewSettings,callOrders:c}),l=a.createElement(fn,{balanceList:g,optionalAssets:this.state.filterValue?null:this.state.alwaysShowAsset,visible:!1,preferredUnit:o,coreSymbol:this.props.core_asset.get("symbol"),settings:s,hiddenAssets:t,orders:n,account:this.props.account,isMyAccount:this.props.isMyAccount,balances:this.props.balances,extraRow:k,viewSettings:this.props.viewSettings,enabledColumns:this.state.enabledColumns}),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(q.t,{defaultActiveTab:0,segmented:!1,setting:"overviewTab",className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block"},a.createElement(q.o,{title:"account.portfolio",subText:b},a.createElement("div",{className:"header-selector"},a.createElement("div",{className:"filter inline-block"},a.createElement(z.A,{value:this.state.filterValue,onChange:this._handleFilterInput})),a.createElement("div",{className:"selector inline-block",style:{position:"relative",top:"8px"}},a.createElement("div",{className:ye()("inline-block",{inactive:"active"!=i}),onClick:"active"!=i?this._changeShownAssets.bind(this,"active"):()=>{}},a.createElement(v(),{content:"account.hide_hidden"})),g.size?a.createElement("div",{className:ye()("inline-block",{inactive:"hidden"!=i}),onClick:"hidden"!=i?this._changeShownAssets.bind(this,"hidden"):()=>{}},a.createElement(v(),{content:"account.show_hidden"})):null,a.createElement("div",{className:ye()("inline-block",{inactive:"visual"!=i}),onClick:"visual"!=i?this._changeShownAssets.bind(this,"visual"):()=>{}},a.createElement(v(),{content:"account.show_visual"})))),"visual"!=i?"hidden"===i&&g.size?l:r:a.createElement(za,{balanceObjects:u})),a.createElement(q.o,{title:"account.open_orders",subText:y},a.createElement(Ma,this.props,a.createElement("div",{className:"total-value"},a.createElement("span",{className:"text"},w),a.createElement("span",{className:"value"},y)))),a.createElement(q.o,{title:"account.collaterals",subText:a.createElement("span",{className:this.state.globalMarginStatus},f)},a.createElement("div",{className:"content-block"},a.createElement("div",{className:"generic-bordered-box"},a.createElement(vs,{preferredUnit:o,className:"dashboard-table",callOrders:c,account:e},a.createElement("tr",{className:"total-value"},a.createElement("td",null,w),a.createElement("td",null),a.createElement("td",null,E),a.createElement("td",{className:"column-hide-medium"},A),a.createElement("td",null),a.createElement("td",null,f),a.createElement("td",{className:"column-hide-small"}),a.createElement("td",{className:"column-hide-small"}),a.createElement("td",{colSpan:"5"})))))),a.createElement(q.o,{title:"account.credit_offer",subText:" "},a.createElement(Gn,{account:this.props.account})),a.createElement(q.o,{title:"account.activity",subText:" "},a.createElement(bt.$,{accountsList:p().fromJS([e.get("id")]),compactView:!1,showMore:!0,fullHeight:!0,limit:100,showFilters:!0,dashboard:!0})),e.get("proposals")&&e.get("proposals").size&&a.createElement(q.o,{title:"explorer.proposals.title",subText:String(e.get("proposals")?e.get("proposals").size:0)},this.props.settings.get("showProposedTx")&&a.createElement("div",{onClick:this._toggleHideProposal.bind(this),style:{cursor:"pointer"}},a.createElement(B.Tooltip,{title:N().translate("tooltip.propose_unhide"),placement:"bottom"},a.createElement(B.Switch,{style:{margin:16},checked:this.state.hideFishingProposals,onChange:this._toggleHideProposal.bind(this)}),a.createElement(v(),{content:"account.deactivate_suspicious_proposals"}))),this.props.settings.get("showProposedTx")&&a.createElement(ta,{className:"dashboard-table",account:e,hideFishingProposals:this.state.hideFishingProposals}),!this.props.settings.get("showProposedTx")&&a.createElement("div",{className:"padding"},a.createElement("div",null,a.createElement(v(),{content:"account.proposed_transactions.advanced_feature"}),":"),a.createElement("br",null),a.createElement("br",null),a.createElement("div",null,a.createElement(v(),{content:"account.proposed_transactions.question1"}),a.createElement(B.Switch,{style:{margin:16},checked:this.state.question1,onChange:this._toggleQ1.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),this.state.question1&&a.createElement("div",null,a.createElement(v(),{content:"account.proposed_transactions.question2"}),a.createElement(B.Switch,{style:{margin:16},checked:this.state.question2,onChange:this._toggleQ2.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),this.state.question2&&a.createElement("div",null,a.createElement(v(),{content:"account.proposed_transactions.question3"}),a.createElement(B.Switch,{style:{margin:16},checked:this.state.question3,onChange:this._toggleQ3.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),a.createElement("br",null),this.state.question3&&a.createElement("div",{style:{marginTop:16,marginBottom:16}},a.createElement(v(),{content:"account.proposed_transactions.answered_no"}),a.createElement(B.Button,{style:{marginLeft:16},onClick:this._showProposals.bind(this)},a.createElement(v(),{content:"account.proposed_transactions.show_me_proposals"})))))))))}}Qn=(0,R.A)(Qn,{propNames:["core_asset"]});class Yn extends a.Component{render(){return a.createElement(Pa.A,Zn({},this.props,{wrap:Qn}))}}function Xn(){return Xn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Xn.apply(this,arguments)}class $n extends a.Component{static propTypes={account:l.A.ChainAccount.isRequired};constructor(e){super(e)}componentDidMount(){this.props.account&&(n.A.setCurrentAccount.defer(this.props.account.get("name")),h.A.getPossibleFees(this.props.account,"transfer"))}UNSAFE_componentWillReceiveProps(e){if(e.account){const t=e.account.get("name"),s=this.props.account&&this.props.account.get("name");this.props.account&&t===s||(n.A.setCurrentAccount.defer(t),h.A.getPossibleFees(e.account,"transfer"))}}componentDidUpdate(e){const{currentAccount:t,history:s,location:a}=this.props;if(e.currentAccount!==t&&t){let e=a.pathname.split("/");e[2]=t,s.push(e.join("/"))}}render(){let{myActiveAccounts:e,searchAccounts:t,settings:s,wallet_locked:n,account:o,hiddenAssets:r}=this.props;if(!o)return a.createElement(u.A,null);let l=this.props.account.get("name"),c={account_name:l,myActiveAccounts:e,searchAccounts:t,settings:s,wallet_locked:n,account:o,isMyAccount:i.A.isMyAccount(o),hiddenAssets:r,contained:!0,balances:o.get("balances",(0,m.List)()).toList(),orders:o.get("orders",(0,m.List)()).toList(),viewSettings:this.props.viewSettings,proxy:o.getIn(["options","voting_account"]),history:this.props.history};return a.createElement(g.dO,null,a.createElement(g.qh,{path:`/account/${l}`,exact:!0,render:()=>a.createElement(Yn,c)}),a.createElement(g.rd,{from:`/account/${l}/overview`,to:`/account/${l}`}),a.createElement(g.qh,{path:`/account/${l}/assets`,exact:!0,render:()=>a.createElement(j,c)}),a.createElement(g.qh,{path:`/account/${l}/pools`,exact:!0,render:()=>a.createElement(_e,c)}),a.createElement(g.qh,{path:`/account/${l}/create-asset`,exact:!0,render:()=>a.createElement(Se,c)}),a.createElement(g.qh,{path:`/account/${l}/update-asset/:asset`,exact:!0,render:()=>a.createElement(Ue,c)}),a.createElement(g.qh,{path:`/account/${l}/member-stats`,exact:!0,render:()=>a.createElement(Ye,c)}),a.createElement(g.qh,{path:`/account/${l}/vesting`,exact:!0,render:()=>a.createElement(tt,c)}),a.createElement(g.qh,{path:`/account/${l}/permissions`,exact:!0,render:()=>a.createElement(ft,c)}),a.createElement(g.qh,{path:`/account/${l}/voting/:tab`,render:()=>a.createElement(cs,c)}),a.createElement(g.rd,{from:`/account/${l}/voting`,to:`/account/${l}/voting/witnesses`}),a.createElement(g.qh,{path:`/account/${l}/whitelist`,exact:!0,render:()=>a.createElement(qt,c)}),a.createElement(g.qh,{path:`/account/${l}/signedmessages`,exact:!0,render:()=>a.createElement(Bt,c)}))}}$n=(0,c.A)($n,{show_loader:!0});class ei extends a.Component{render(){let e=this.props.match.params.account_name;return a.createElement($n,Xn({},this.props,{account:e}))}}const ti=(0,d.N)(ei,{listenTo:()=>[i.A,o.A,r.A],getProps:()=>({myActiveAccounts:i.A.getState().myActiveAccounts,searchAccounts:i.A.getState().searchAccounts,currentAccount:i.A.getState().currentAccount||i.A.getState().passwordAccount,settings:o.A.getState().settings,hiddenAssets:o.A.getState().hiddenAssets,wallet_locked:r.A.getState().locked,viewSettings:o.A.getState().viewSettings})})},90184:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var a=s(96540),n=s(12569),i=s(72342);class o extends a.Component{static propTypes={account:n.A.ChainObject.isRequired};static defaultProps={autosubscribe:!1};render(){return this.props.account?a.createElement("span",null,this.props.account.get("name")):null}}const r=(0,i.A)(o)},49585:(e,t,s)=>{"use strict";s.d(t,{A:()=>f});var a=s(96540),n=s(80849),i=s.n(n),o=s(96366),r=s(62611),l=s(9404),c=s.n(l),d=s(10658),h=s.n(d),m=s(60819),p=s(87040),u=s(5556),g=s.n(u),_=s(6356);class b extends a.Component{static propTypes={value:g().string,onChange:g().func,scroll_length:g().number};shouldComponentUpdate(e){return!p.A.are_equal_shallow(e.assets,this.props.assets)||e.value!==this.props.value||e.scroll_length!==this.props.scroll_length}render(){return this.props.assets.length?a.createElement(r.A,{entries:this.props.assets.map((e=>e&&e.get("symbol"))).filter((e=>!!e)),values:this.props.assets.reduce(((e,t)=>(t&&t.get("symbol")&&(e[t.get("symbol")]=t),e)),{}),singleEntry:this.props.assets[0]?a.createElement(o.A,{asset:this.props.assets[0].get("id"),amount:0,hide_amount:!0}):null,value:this.props.value,onChange:this.props.onChange,scroll_length:this.props.scroll_length}):null}}b=(0,m.A)(b,{asList:!0});class y extends _.x{static propTypes={label:g().string,assets:g().array,amount:g().any,placeholder:g().string,onChange:g().func,tabIndex:g().number,error:g().string,scroll_length:g().number};static defaultProps={disabled:!1,tabIndex:0};componentDidMount(){this.onAssetChange(this.props.asset)}formatAmount(e){return e||(e=""),"number"==typeof e&&(e=e.toString()),e.trim().replace(/,/g,"")}_onChange(e){this.props.onChange&&this.props.onChange({amount:this.getNumericEventValue(e),asset:this.props.asset})}onAssetChange(e){this.props.onChange&&this.props.onChange({amount:this.props.amount,asset:e})}render(){let e=this.props.error?h().translate(this.props.error):this.formatAmount(this.props.amount);return a.createElement("div",{className:"amount-selector",style:this.props.style},a.createElement("label",{className:"right-label"},this.props.display_balance),a.createElement(i(),{className:"left-label",component:"label",content:this.props.label}),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{disabled:this.props.disabled,type:"text",value:e||"",placeholder:this.props.placeholder,onChange:this._onChange.bind(this),tabIndex:this.props.tabIndex,onPaste:this.props.onPaste||this.onPaste.bind(this),onKeyPress:this.onKeyPress.bind(this)}),a.createElement("div",{className:"form-label select floating-dropdown"},this.props.isPrice?a.createElement("div",{className:"dropdown-wrapper inactive"},a.createElement("div",null,this.props.asset.get("symbol"),"/",this.props.base)):a.createElement(b,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:c().List(this.props.assets),onChange:this.onAssetChange.bind(this),scroll_length:this.props.scroll_length}))))}}const f=y=(0,m.A)(y)},57763:(e,t,s)=>{"use strict";s.d(t,{A:()=>A});var a=s(96540),n=s(80849),i=s.n(n),o=s(72090),r=s(12569),l=s(72342),c=s(10658),d=s.n(c),h=s(62611),m=s(96366),p=s(9404),u=s.n(p),g=s(32485),_=s.n(g),b=s(60819),y=s(5556),f=s.n(y);class E extends a.Component{static propTypes={value:f().string,onChange:f().func};render(){return 0!==this.props.assets.length&&this.props.value?a.createElement(h.A,{entries:this.props.assets.map((e=>e&&e.get("symbol"))).filter((e=>!!e)),values:this.props.assets.reduce(((e,t)=>(t&&t.get("symbol")&&(e[t.get("symbol")]=t),e)),{}),singleEntry:this.props.assets[0]?a.createElement(m.A,{asset:this.props.assets[0].get("id"),amount:0,hide_amount:!0}):null,value:"",onChange:this.props.onChange}):null}}E=(0,b.A)(E,{asList:!0});class v extends a.Component{static propTypes={label:f().string,error:f().string,placeholder:f().string,onChange:f().func,onFound:f().func,assetInput:f().string,asset:r.A.ChainAsset,tabIndex:f().number,disableActionButton:f().bool};static defaultProps={disabled:!1};getAsset(){return this.props.asset}getError(e=this.props.assetInput){let t=this.props.error;return t||!e||this.getNameType(e)||(t=d().translate("explorer.asset.invalid",{name:e})),t}getNameType(e){return e?o.ChainValidation.is_valid_symbol_error(e,!0)?null:"symbol":null}onInputChanged(e){let t=e.target.value.trim().substr(0,16).toUpperCase();this.props.onChange&&t!==this.props.assetInput&&this.props.onChange(t)}onKeyDown(e){13===e.keyCode&&(this.onFound(e),this.onAction(e))}componentDidMount(){this.props.onFound&&this.props.asset&&this.props.onFound(this.props.asset)}UNSAFE_componentWillReceiveProps(e){this.props.onFound&&e.asset!==this.props.asset&&this.props.onFound(e.asset)}onFound(e){e.preventDefault(),!this.props.onFound||this.getError()||this.props.disableActionButton||this.props.asset&&this.props.onFound(this.props.asset)}onAssetSelect(e){e&&(this.props.onFound(e),this.props.onChange(e.get("symbol")))}onAction(e){e.preventDefault(),!this.props.onAction||this.getError()||this.props.disableActionButton||this.props.asset&&this.props.onAction(this.props.asset)}render(){let e,{disabled:t,noLabel:s}=this.props,n=this.getError();t||(this.props.asset?e=this.props.asset.get("symbol"):!n&&this.props.assetInput&&(n=d().translate("explorer.asset.not_found",{name:this.props.assetInput})));let o=_()("button",{disabled:!this.props.asset||n||this.props.disableActionButton});return a.createElement("div",{className:"asset-selector",style:this.props.style},a.createElement("div",null,a.createElement("div",{className:"header-area"},n||s?null:a.createElement("label",{className:"right-label"}," ",a.createElement("span",null,e)),a.createElement(i(),{component:"label",content:this.props.label})),a.createElement("div",{className:"input-area"},a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{className:this.props.inputClass,style:this.props.inputStyle,disabled:this.props.disabled,type:"text",value:this.props.assetInput||"",placeholder:this.props.placeholder||d().translate("explorer.assets.symbol"),ref:"user_input",onChange:this.onInputChanged.bind(this),onKeyDown:this.onKeyDown.bind(this),tabIndex:this.props.tabIndex}),a.createElement("div",{className:"form-label select floating-dropdown"},this.props.asset?a.createElement(E,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:u().List(this.props.assets),onChange:this.onAssetSelect.bind(this)}):null),this.props.children,this.props.onAction?a.createElement("button",{className:o,onClick:this.onAction.bind(this)},a.createElement(i(),{content:this.props.action_label})):null)),a.createElement("div",{className:"error-area",style:{paddingBottom:"10px"}},a.createElement("span",{style:{wordBreak:"break-all"}},n))))}}const A=(0,l.A)(v)},23654:(e,t,s)=>{"use strict";s.d(t,{o:()=>u,t:()=>g});var a=s(96540),n=s(5556),i=s.n(n),o=s(32485),r=s.n(o),l=s(9476),c=s(84259),d=s(74248),h=s(10658),m=s.n(h),p=s(24180);class u extends a.Component{static propTypes={changeTab:i().func,isActive:i().bool.isRequired,index:i().number.isRequired,className:i().string,isLinkTo:i().string,subText:i().oneOfType([i().object,i().string])};static defaultProps={isActive:!1,index:0,className:"",isLinkTo:"",subText:null};render(){let{isActive:e,index:t,changeTab:s,title:n,className:i,updatedTab:o,disabled:l,subText:c}=this.props,d=r()({"is-active":e},i);return"string"==typeof n&&n.indexOf(".")>0&&(n=m().translate(n)),this.props.collapsed?("string"==typeof c&&(c=c.trim()),"span"===n.type&&(n=n.props.children[2]),a.createElement("option",{value:t,"data-is-link-to":this.props.isLinkTo},n,o?"*":"",c&&" (",c&&c,c&&")")):a.createElement("li",{className:d,onClick:l?null:s.bind(this,t,this.props.isLinkTo)},a.createElement("a",null,a.createElement("span",{className:"tab-title"},n,o?"*":""),c&&a.createElement("div",{className:"tab-subtext"},c)))}}class g extends a.Component{static propTypes={setting:i().string,defaultActiveTab:i().number,segmented:i().bool};static defaultProps={active:0,defaultActiveTab:0,segmented:!0,contentClass:"",style:{}};constructor(e){super(),this.state={activeTab:e.setting?e.viewSettings.get(e.setting,e.defaultActiveTab):e.defaultActiveTab,width:window.innerWidth},this._setDimensions=this._setDimensions.bind(this)}componentDidMount(){this._setDimensions(),window.addEventListener("resize",this._setDimensions,{capture:!1,passive:!0})}UNSAFE_componentWillReceiveProps(e){let t=e.viewSettings.get(e.setting);t!==this.props.viewSettings.get(this.props.setting)&&this.setState({activeTab:t})}componentWillUnmount(){window.removeEventListener("resize",this._setDimensions)}_setDimensions(){let e=window.innerWidth;e!==this.state.width&&this.setState({width:e})}_changeTab(e,t){e!==this.state.activeTab&&(""!==t&&this.props.history.push(t),this.props.setting&&c.A.changeViewSetting({[this.props.setting]:e}),this.setState({activeTab:e}),this.props.onChangeTab&&this.props.onChangeTab(e))}render(){let{children:e,contentClass:t,tabsClass:s,style:n,segmented:i}=this.props;const o=this.state.width<900&&a.Children.count(e)>2;let l=null,c=a.Children.map(e,((e,t)=>{if(!e)return null;if(o&&e.props.disabled)return null;let s=t===this.state.activeTab;return s&&(l=e.props.children),a.cloneElement(e,{collapsed:o,isActive:s,changeTab:this._changeTab.bind(this),index:t})})).filter((e=>null!==e));return l||(l=c[0].props.children),a.createElement("div",{className:r()(this.props.actionButtons?"with-buttons":"",this.props.className)},a.createElement("div",{className:"service-selector"},a.createElement("ul",{style:n,className:r()("button-group no-margin",s,{segmented:i})},o?a.createElement("li",{style:{paddingLeft:10,paddingRight:10,minWidth:"15rem"}},a.createElement("select",{value:this.state.activeTab,style:{marginTop:10,marginBottom:10},className:"bts-select",onChange:e=>{let t=parseInt(e.target.value,10);this._changeTab(t,e.target[t].attributes["data-is-link-to"].value)}},c)):c,this.props.actionButtons?a.createElement("li",{className:"tabs-action-buttons"},this.props.actionButtons):null)),a.createElement("div",{className:r()("tab-content",t)},l))}}g=(0,l.N)(g,{listenTo:()=>[d.A],getProps:()=>({viewSettings:d.A.getState().viewSettings})}),g=(0,p.y)(g)},16370:(e,t,s)=>{var a,n;n=function(e){!function(e){var t,s=e.addEvent,a=e.Axis,n=e.Chart,i=e.color,o=e.each,r=e.extend,l=e.isNumber,c=e.Legend,d=e.LegendSymbolMixin,h=e.noop,m=e.merge,p=e.pick;e.ColorAxis||(t=e.ColorAxis=function(){this.init.apply(this,arguments)},r(t.prototype,a.prototype),r(t.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},width:.01,color:"#999999"},labels:{overflow:"justify",rotation:0},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},keepProps:["legendGroup","legendItemHeight","legendItemWidth","legendItem","legendSymbol"].concat(a.prototype.keepProps),init:function(e,t){var s,n="vertical"!==e.options.legend.layout;this.coll="colorAxis",s=m(this.defaultColorAxisOptions,{side:n?2:1,reversed:!n},t,{opposite:!n,showEmpty:!1,title:null,visible:e.options.legend.enabled}),a.prototype.init.call(this,e,s),t.dataClasses&&this.initDataClasses(t),this.initStops(),this.horiz=n,this.zoomEnabled=!1,this.defaultLegendLength=200},initDataClasses:function(e){var t,s=this.chart,a=0,n=s.options.chart.colorCount,r=this.options,l=e.dataClasses.length;this.dataClasses=t=[],this.legendItems=[],o(e.dataClasses,(function(e,o){e=m(e),t.push(e),e.color||("category"===r.dataClassColor?(o=s.options.colors,n=o.length,e.color=o[a],e.colorIndex=a,++a===n&&(a=0)):e.color=i(r.minColor).tweenTo(i(r.maxColor),2>l?.5:o/(l-1)))}))},setTickPositions:function(){if(!this.dataClasses)return a.prototype.setTickPositions.call(this)},initStops:function(){this.stops=this.options.stops||[[0,this.options.minColor],[1,this.options.maxColor]],o(this.stops,(function(e){e.color=i(e[1])}))},setOptions:function(e){a.prototype.setOptions.call(this,e),this.options.crosshair=this.options.marker},setAxisSize:function(){var e,t,s=this.legendSymbol,a=this.chart,n=a.options.legend||{};s?(this.left=n=s.attr("x"),this.top=e=s.attr("y"),this.width=t=s.attr("width"),this.height=s=s.attr("height"),this.right=a.chartWidth-n-t,this.bottom=a.chartHeight-e-s,this.len=this.horiz?t:s,this.pos=this.horiz?n:e):this.len=(this.horiz?n.symbolWidth:n.symbolHeight)||this.defaultLegendLength},normalizedValue:function(e){return this.isLog&&(e=this.val2lin(e)),1-(this.max-e)/(this.max-this.min||1)},toColor:function(e,t){var s,a,n,i,o=this.stops,r=this.dataClasses;if(r){for(i=r.length;i--;)if(s=(n=r[i]).from,o=n.to,(void 0===s||e>=s)&&(void 0===o||e<=o)){a=n.color,t&&(t.dataClass=i,t.colorIndex=n.colorIndex);break}}else{for(e=this.normalizedValue(e),i=o.length;i--&&!(e>o[i][0]););s=o[i]||o[i+1],e=1-((o=o[i+1]||s)[0]-e)/(o[0]-s[0]||1),a=s.color.tweenTo(o.color,e)}return a},getOffset:function(){var e=this.legendGroup,t=this.chart.axisOffset[this.side];e&&(this.axisParent=e,a.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]=t)},setLegendColor:function(){var e,t=this.reversed;e=t?1:0,t=t?0:1,e=this.horiz?[e,0,t,0]:[0,t,0,e],this.legendColor={linearGradient:{x1:e[0],y1:e[1],x2:e[2],y2:e[3]},stops:this.stops}},drawLegendSymbol:function(e,t){var s=e.padding,a=e.options,n=this.horiz,i=p(a.symbolWidth,n?this.defaultLegendLength:12),o=p(a.symbolHeight,n?12:this.defaultLegendLength),r=p(a.labelPadding,n?16:30);a=p(a.itemDistance,10),this.setLegendColor(),t.legendSymbol=this.chart.renderer.rect(0,e.baseline-11,i,o).attr({zIndex:1}).add(t.legendGroup),this.legendItemWidth=i+s+(n?a:r),this.legendItemHeight=o+s+(n?r:0)},setState:function(e){o(this.series,(function(t){t.setState(e)}))},visible:!0,setVisible:h,getSeriesExtremes:function(){var e=this.series,t=e.length;for(this.dataMin=1/0,this.dataMax=-1/0;t--;)e[t].getExtremes(),void 0!==e[t].valueMin&&(this.dataMin=Math.min(this.dataMin,e[t].valueMin),this.dataMax=Math.max(this.dataMax,e[t].valueMax))},drawCrosshair:function(e,t){var s,n=t&&t.plotX,i=t&&t.plotY,o=this.pos,r=this.len;t&&((s=this.toPixels(t[t.series.colorKey]))<o?s=o-2:s>o+r&&(s=o+r+2),t.plotX=s,t.plotY=this.len-s,a.prototype.drawCrosshair.call(this,e,t),t.plotX=n,t.plotY=i,this.cross&&!this.cross.addedToColorAxis&&this.legendGroup&&(this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup),this.cross.addedToColorAxis=!0,this.cross.attr({fill:this.crosshair.color})))},getPlotLinePath:function(e,t,s,n,i){return l(i)?this.horiz?["M",i-4,this.top-6,"L",i+4,this.top-6,i,this.top,"Z"]:["M",this.left,i,"L",this.left-6,i+6,this.left-6,i-6,"Z"]:a.prototype.getPlotLinePath.call(this,e,t,s,n)},update:function(e,t){var s=this.chart,n=s.legend;o(this.series,(function(e){e.isDirtyData=!0})),e.dataClasses&&n.allItems&&(o(n.allItems,(function(e){e.isDataClass&&e.legendGroup&&e.legendGroup.destroy()})),s.isDirtyLegend=!0),s.options[this.coll]=m(this.userOptions,e),a.prototype.update.call(this,e,t),this.legendItem&&(this.setLegendColor(),n.colorizeItem(this,!0))},remove:function(){this.legendItem&&this.chart.legend.destroyItem(this),a.prototype.remove.call(this)},getDataClassLegendSymbols:function(){var t,s=this,a=this.chart,n=this.legendItems,i=a.options.legend,l=i.valueDecimals,c=i.valueSuffix||"";return n.length||o(this.dataClasses,(function(i,m){var p=!0,u=i.from,g=i.to;t="",void 0===u?t="< ":void 0===g&&(t="> "),void 0!==u&&(t+=e.numberFormat(u,l)+c),void 0!==u&&void 0!==g&&(t+=" - "),void 0!==g&&(t+=e.numberFormat(g,l)+c),n.push(r({chart:a,name:t,options:{},drawLegendSymbol:d.drawRectangle,visible:!0,setState:h,isDataClass:!0,setVisible:function(){p=this.visible=!p,o(s.series,(function(e){o(e.points,(function(e){e.dataClass===m&&e.setVisible(p)}))})),a.legend.colorizeItem(this,p)}},i))})),n},name:""}),o(["fill","stroke"],(function(t){e.Fx.prototype[t+"Setter"]=function(){this.elem.attr(t,i(this.start).tweenTo(i(this.end),this.pos),null,!0)}})),s(n,"afterGetAxes",(function(){var e=this.options.colorAxis;this.colorAxis=[],e&&new t(this,e)})),s(c,"afterGetAllItems",(function(t){var s=[],a=this.chart.colorAxis[0];for(a&&a.options&&a.options.showInLegend&&(a.options.dataClasses?s=a.getDataClassLegendSymbols():s.push(a),o(a.series,(function(s){e.erase(t.allItems,s)}))),a=s.length;a--;)t.allItems.unshift(s[a])})),s(c,"afterColorizeItem",(function(e){e.visible&&e.item.legendColor&&e.item.legendSymbol.attr({fill:e.item.legendColor})})),s(c,"afterUpdate",(function(e,t,s){this.chart.colorAxis[0]&&this.chart.colorAxis[0].update({},s)})))}(e),function(e){var t=e.defined,s=e.each,a=e.noop,n=e.seriesTypes;e.colorPointMixin={isValid:function(){return null!==this.value&&1/0!==this.value&&-1/0!==this.value},setVisible:function(e){var t=this,a=e?"show":"hide";t.visible=!!e,s(["graphic","dataLabel"],(function(e){t[e]&&t[e][a]()}))},setState:function(t){e.Point.prototype.setState.call(this,t),this.graphic&&this.graphic.attr({zIndex:"hover"===t?1:0})}},e.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:a,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:n.column.prototype.pointAttribs,translateColors:function(){var e=this,t=this.options.nullColor,a=this.colorAxis,n=this.colorKey;s(this.data,(function(s){var i=s[n];(i=s.options.color||(s.isNull?t:a&&void 0!==i?a.toColor(i,s):s.color||e.color))&&(s.color=i)}))},colorAttribs:function(e){var s={};return t(e.color)&&(s[this.colorProp||"fill"]=e.color),s}}}(e),function(e){var t=e.colorPointMixin,s=e.each,a=e.merge,n=e.noop,i=e.pick,o=e.Series,r=e.seriesType,l=e.seriesTypes;r("heatmap","scatter",{animation:!1,borderWidth:0,nullColor:"#f7f7f7",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{hover:{halo:!1,brightness:.2}}},a(e.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var e;l.scatter.prototype.init.apply(this,arguments),(e=this.options).pointRange=i(e.pointRange,e.colsize||1),this.yAxis.axisPointRange=e.rowsize||1},translate:function(){var e=this.options,t=this.xAxis,a=this.yAxis,n=e.pointPadding||0,o=function(e,t,s){return Math.min(Math.max(t,e),s)};this.generatePoints(),s(this.points,(function(s){var r=(e.colsize||1)/2,l=(e.rowsize||1)/2,c=o(Math.round(t.len-t.translate(s.x-r,0,1,0,1)),-t.len,2*t.len),d=(r=o(Math.round(t.len-t.translate(s.x+r,0,1,0,1)),-t.len,2*t.len),o(Math.round(a.translate(s.y-l,0,1,0,1)),-a.len,2*a.len)),h=(l=o(Math.round(a.translate(s.y+l,0,1,0,1)),-a.len,2*a.len),i(s.pointPadding,n));s.plotX=s.clientX=(c+r)/2,s.plotY=(d+l)/2,s.shapeType="rect",s.shapeArgs={x:Math.min(c,r)+h,y:Math.min(d,l)+h,width:Math.abs(r-c)-2*h,height:Math.abs(l-d)-2*h}})),this.translateColors()},drawPoints:function(){l.column.prototype.drawPoints.call(this),s(this.points,(function(e){e.graphic.attr(this.colorAttribs(e))}),this)},animate:n,getBox:n,drawLegendSymbol:e.LegendSymbolMixin.drawRectangle,alignDataLabel:l.column.prototype.alignDataLabel,getExtremes:function(){o.prototype.getExtremes.call(this,this.valueData),this.valueMin=this.dataMin,this.valueMax=this.dataMax,o.prototype.getExtremes.call(this)}}),e.extend({haloPath:function(e){if(!e)return[];var t=this.shapeArgs;return["M",t.x-e,t.y-e,"L",t.x-e,t.y+t.height+e,t.x+t.width+e,t.y+t.height+e,t.x+t.width+e,t.y-e,"Z"]}},t))}(e)},e.exports?e.exports=n:void 0===(a=function(){return n}.call(t,s,t,e))||(e.exports=a)},59048:(e,t,s)=>{var a,n;n=function(e){var t=function(e){var t=e.each,s=e.extend,a=e.isArray,n=e.isObject,i=e.isNumber,o=e.merge,r=e.pick,l=e.reduce;return{getColor:function(t,s){var a,n,i,o,l=s.index,c=s.mapOptionsToLevel,d=s.parentColor,h=s.parentColorIndex,m=s.series,p=s.colors,u=s.siblings,g=m.points;return t&&(g=g[t.i],t=c[t.level]||{},(a=g&&t.colorByPoint)&&(i=g.index%(p?p.length:m.chart.options.chart.colorCount),n=p&&p[i]),p=g&&g.options.color,a=t&&t.color,(c=d)&&(c=(c=t&&t.colorVariation)&&"brightness"===c.key?e.color(d).brighten(l/u*c.to).get():d),a=r(p,a,n,c,m.color),o=r(g&&g.options.colorIndex,t&&t.colorIndex,i,h,s.colorIndex)),{color:a,colorIndex:o}},getLevelOptions:function(e){var t,r,c,d,h=null;if(n(e))for(h={},c=i(e.from)?e.from:1,d=e.levels,r={},t=n(e.defaults)?e.defaults:{},a(d)&&(r=l(d,(function(e,a){var r,l;return n(a)&&i(a.level)&&(r="boolean"==typeof(l=o({},a)).levelIsConstant?l.levelIsConstant:t.levelIsConstant,delete l.levelIsConstant,delete l.level,a=a.level+(r?0:c-1),n(e[a])?s(e[a],l):e[a]=l),e}),{})),d=i(e.to)?e.to:1,e=0;e<=d;e++)h[e]=o({},t,n(r[e])?r[e]:{});return h},setTreeValues:function e(a,n){var i=n.before,o=n.idRoot,l=n.mapIdToNode[o],c=n.points[a.i],d=c&&c.options||{},h=0,m=[];return s(a,{levelDynamic:a.level-("boolean"!=typeof n.levelIsConstant||n.levelIsConstant?0:l.level),name:r(c&&c.name,""),visible:o===a.id||"boolean"==typeof n.visible&&n.visible}),"function"==typeof i&&(a=i(a,n)),t(a.children,(function(t,i){var o=s({},n);s(o,{index:i,siblings:a.children.length,visible:a.visible}),t=e(t,o),m.push(t),t.visible&&(h+=t.val)})),a.visible=0<h||a.visible,i=r(d.value,h),s(a,{children:m,childrenTotal:h,isLeaf:a.visible&&!h,val:i}),a},updateRootId:function(e){var t;return n(e)&&(t=n(e.options)?e.options:{},t=r(e.rootNode,t.rootId,""),n(e.userOptions)&&(e.userOptions.rootId=t),e.rootNode=t),t}}}(e);!function(e,t){var s=e.seriesType,a=e.seriesTypes,n=e.map,i=e.merge,o=e.extend,r=e.noop,l=e.each,c=t.getColor,d=t.getLevelOptions,h=e.grep,m=e.isArray,p=e.isNumber,u=e.isObject,g=e.isString,_=e.pick,b=e.Series,y=e.stableSort,f=e.Color,E=e.reduce,v=function(e,t,s){s=s||this,!1!==(e=t.call(s,e))&&v(e,t,s)},A=t.updateRootId;s("treemap","scatter",{showInLegend:!1,marker:!1,colorByPoint:!1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,opacity:.15,states:{hover:{borderColor:"#999999",brightness:a.heatmap?0:.1,halo:!1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],directTouch:!0,optionalAxis:"colorAxis",getSymbol:r,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(t,s){t=m(t)?t:[];var a=m(s)?s:[];return s=E(t,(function(e,t,s){return void 0===e[t=_(t.parent,"")]&&(e[t]=[]),e[t].push(s),e}),{"":[]}),function(t,s,a){a=a||this,e.objectEach(t,(function(e,n){s.call(a,e,n,t)}))}(s,(function(t,s,n){""!==s&&-1===e.inArray(s,a)&&(l(t,(function(e){n[""].push(e)})),delete n[s])})),s},getTree:function(){var e=n(this.data,(function(e){return e.id}));return e=this.getListOfParents(this.data,e),this.nodeMap=[],this.buildNode("",-1,0,e,null)},init:function(t,s){var a=e.colorSeriesMixin;e.colorSeriesMixin&&(this.translateColors=a.translateColors,this.colorAttribs=a.colorAttribs,this.axisTypes=a.axisTypes),b.prototype.init.call(this,t,s),this.options.allowDrillToNode&&e.addEvent(this,"click",this.onClickDrillToNode)},buildNode:function(e,t,s,a,n){var i,o=this,r=[],c=o.points[t],d=0;return l(a[e]||[],(function(t){i=o.buildNode(o.points[t].id,t,s+1,a,e),d=Math.max(i.height+1,d),r.push(i)})),t={id:e,i:t,children:r,height:d,level:s,parent:n,visible:!1},o.nodeMap[t.id]=t,c&&(c.node=t),t},setTreeValues:function(e){var t,s=this,a=s.options,n=s.nodeMap[s.rootNode],i=(a="boolean"!=typeof a.levelIsConstant||a.levelIsConstant,0),r=[],c=s.points[e.i];return l(e.children,(function(e){e=s.setTreeValues(e),r.push(e),e.ignore||(i+=e.val)})),y(r,(function(e,t){return e.sortIndex-t.sortIndex})),t=_(c&&c.options.value,i),c&&(c.value=t),o(e,{children:r,childrenTotal:i,ignore:!(_(c&&c.visible,!0)&&0<t),isLeaf:e.visible&&!i,levelDynamic:e.level-(a?0:n.level),name:_(c&&c.name,""),sortIndex:_(c&&c.sortIndex,-t),val:t}),e},calculateChildrenAreas:function(e,t){var s,a=this,n=a.options,o=a.mapOptionsToLevel[e.level+1],r=_(a[o&&o.layoutAlgorithm]&&o.layoutAlgorithm,n.layoutAlgorithm),c=n.alternateStartingDirection;e=h(e.children,(function(e){return!e.ignore})),o&&o.layoutStartingDirection&&(t.direction="vertical"===o.layoutStartingDirection?0:1),s=a[r](t,e),l(e,(function(e,n){n=s[n],e.values=i(n,{val:e.childrenTotal,direction:c?1-t.direction:t.direction}),e.pointValues=i(n,{x:n.x/a.axisRatio,width:n.width/a.axisRatio}),e.children.length&&a.calculateChildrenAreas(e,e.values)}))},setPointValues:function(){var e=this,t=e.xAxis,s=e.yAxis;l(e.points,(function(a){var n,i,o,r=a.node,l=r.pointValues;o=(e.pointAttribs(a)["stroke-width"]||0)%2/2,l&&r.visible?(r=Math.round(t.translate(l.x,0,0,0,1))-o,n=Math.round(t.translate(l.x+l.width,0,0,0,1))-o,i=Math.round(s.translate(l.y,0,0,0,1))-o,l=Math.round(s.translate(l.y+l.height,0,0,0,1))-o,a.shapeType="rect",a.shapeArgs={x:Math.min(r,n),y:Math.min(i,l),width:Math.abs(n-r),height:Math.abs(l-i)},a.plotX=a.shapeArgs.x+a.shapeArgs.width/2,a.plotY=a.shapeArgs.y+a.shapeArgs.height/2):(delete a.plotX,delete a.plotY)}))},setColorRecursive:function(e,t,s,a,n){var i,o=this,r=(r=o&&o.chart)&&r.options&&r.options.colors;e&&(i=c(e,{colors:r,index:a,mapOptionsToLevel:o.mapOptionsToLevel,parentColor:t,parentColorIndex:s,series:o,siblings:n}),(t=o.points[e.i])&&(t.color=i.color,t.colorIndex=i.colorIndex),l(e.children||[],(function(t,s){o.setColorRecursive(t,i.color,i.colorIndex,s,e.children.length)})))},algorithmGroup:function(e,t,s,a){this.height=e,this.width=t,this.plot=a,this.startDirection=this.direction=s,this.lH=this.nH=this.lW=this.nW=this.total=0,this.elArr=[],this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(e,t){return Math.max(e/t,t/e)}},this.addElement=function(e){this.lP.total=this.elArr[this.elArr.length-1],this.total+=e,0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH)),this.elArr.push(e)},this.reset=function(){this.lW=this.nW=0,this.elArr=[],this.total=0}},algorithmCalcPoints:function(e,t,s,a){var n,i,o,r,c,d=s.lW,h=s.lH,m=s.plot,p=0,u=s.elArr.length-1;t?(d=s.nW,h=s.nH):c=s.elArr[s.elArr.length-1],l(s.elArr,(function(e){(t||p<u)&&(0===s.direction?(n=m.x,i=m.y,r=e/(o=d)):(n=m.x,i=m.y,o=e/(r=h)),a.push({x:n,y:i,width:o,height:r}),0===s.direction?m.y+=r:m.x+=o),p+=1})),s.reset(),0===s.direction?s.width-=d:s.height-=h,m.y=m.parent.y+(m.parent.height-s.height),m.x=m.parent.x+(m.parent.width-s.width),e&&(s.direction=1-s.direction),t||s.addElement(c)},algorithmLowAspectRatio:function(e,t,s){var a,n=[],i=this,o={x:t.x,y:t.y,parent:t},r=0,c=s.length-1,d=new this.algorithmGroup(t.height,t.width,t.direction,o);return l(s,(function(s){a=s.val/t.val*t.height*t.width,d.addElement(a),d.lP.nR>d.lP.lR&&i.algorithmCalcPoints(e,!1,d,n,o),r===c&&i.algorithmCalcPoints(e,!0,d,n,o),r+=1})),n},algorithmFill:function(e,t,s){var a,n,i,o,r,c=[],d=t.direction,h=t.x,m=t.y,p=t.width,u=t.height;return l(s,(function(s){a=s.val/t.val*t.height*t.width,n=h,i=m,0===d?(p-=o=a/(r=u),h+=o):(u-=r=a/(o=p),m+=r),c.push({x:n,y:i,width:o,height:r}),e&&(d=1-d)})),c},strip:function(e,t){return this.algorithmLowAspectRatio(!1,e,t)},squarified:function(e,t){return this.algorithmLowAspectRatio(!0,e,t)},sliceAndDice:function(e,t){return this.algorithmFill(!0,e,t)},stripes:function(e,t){return this.algorithmFill(!1,e,t)},translate:function(){var e,t,s=this,a=s.options,n=A(s);b.prototype.translate.call(s),t=s.tree=s.getTree(),e=s.nodeMap[n],s.mapOptionsToLevel=d({from:e.level+1,levels:a.levels,to:t.height,defaults:{levelIsConstant:s.options.levelIsConstant,colorByPoint:a.colorByPoint}}),""===n||e&&e.children.length||(s.drillToNode("",!1),n=s.rootNode,e=s.nodeMap[n]),v(s.nodeMap[s.rootNode],(function(e){var t=!1,a=e.parent;return e.visible=!0,(a||""===a)&&(t=s.nodeMap[a]),t})),v(s.nodeMap[s.rootNode].children,(function(e){var t=!1;return l(e,(function(e){e.visible=!0,e.children.length&&(t=(t||[]).concat(e.children))})),t})),s.setTreeValues(t),s.axisRatio=s.xAxis.len/s.yAxis.len,s.nodeMap[""].pointValues=n={x:0,y:0,width:100,height:100},s.nodeMap[""].values=n=i(n,{width:n.width*s.axisRatio,direction:"vertical"===a.layoutStartingDirection?0:1,val:t.val}),s.calculateChildrenAreas(t,n),s.colorAxis?s.translateColors():a.colorByPoint||s.setColorRecursive(s.tree),a.allowDrillToNode&&(a=e.pointValues,s.xAxis.setExtremes(a.x,a.x+a.width,!1),s.yAxis.setExtremes(a.y,a.y+a.height,!1),s.xAxis.setScale(),s.yAxis.setScale()),s.setPointValues()},drawDataLabels:function(){var e,t,s=this,a=s.mapOptionsToLevel,n=h(s.points,(function(e){return e.node.visible}));l(n,(function(n){t=a[n.node.level],e={style:{}},n.node.isLeaf||(e.enabled=!1),t&&t.dataLabels&&(e=i(e,t.dataLabels),s._hasPointLabels=!0),n.shapeArgs&&(e.style.width=n.shapeArgs.width,n.dataLabel&&n.dataLabel.css({width:n.shapeArgs.width+"px"})),n.dlOptions=i(e,n.options.dataLabels)})),b.prototype.drawDataLabels.call(this)},alignDataLabel:function(e){a.column.prototype.alignDataLabel.apply(this,arguments),e.dataLabel&&e.dataLabel.attr({zIndex:(e.node.zIndex||0)+1})},pointAttribs:function(e,t){var s=u(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},a=e&&s[e.node.level]||{},n=(s=this.options,t&&s.states[t]||{}),i=e&&e.getClassName()||"";return e={stroke:e&&e.borderColor||a.borderColor||n.borderColor||s.borderColor,"stroke-width":_(e&&e.borderWidth,a.borderWidth,n.borderWidth,s.borderWidth),dashstyle:e&&e.borderDashStyle||a.borderDashStyle||n.borderDashStyle||s.borderDashStyle,fill:e&&e.color||this.color},-1!==i.indexOf("highcharts-above-level")?(e.fill="none",e["stroke-width"]=0):-1!==i.indexOf("highcharts-internal-node-interactive")?(t=_(n.opacity,s.opacity),e.fill=f(e.fill).setOpacity(t).get(),e.cursor="pointer"):-1!==i.indexOf("highcharts-internal-node")?e.fill="none":t&&(e.fill=f(e.fill).brighten(n.brightness).get()),e},drawPoints:function(){var e=this,t=h(e.points,(function(e){return e.node.visible}));l(t,(function(t){var s="level-group-"+t.node.levelDynamic;e[s]||(e[s]=e.chart.renderer.g(s).attr({zIndex:1e3-t.node.levelDynamic}).add(e.group)),t.group=e[s]})),a.column.prototype.drawPoints.call(this),e.options.allowDrillToNode&&l(t,(function(t){t.graphic&&(t.drillId=e.options.interactByLeaf?e.drillToByLeaf(t):e.drillToByGroup(t))}))},onClickDrillToNode:function(e){var t=(e=e.point)&&e.drillId;g(t)&&(e.setState(""),this.drillToNode(t))},drillToByGroup:function(e){var t=!1;return 1!=e.node.level-this.nodeMap[this.rootNode].level||e.node.isLeaf||(t=e.id),t},drillToByLeaf:function(e){var t=!1;if(e.node.parent!==this.rootNode&&e.node.isLeaf)for(e=e.node;!t;)(e=this.nodeMap[e.parent]).parent===this.rootNode&&(t=e.id);return t},drillUp:function(){var e=this.nodeMap[this.rootNode];e&&g(e.parent)&&this.drillToNode(e.parent)},drillToNode:function(e,t){var s=this.nodeMap[e];this.idPreviousRoot=this.rootNode,this.rootNode=e,""===e?this.drillUpButton=this.drillUpButton.destroy():this.showDrillUpButton(s&&s.name||e),this.isDirty=!0,_(t,!0)&&this.chart.redraw()},showDrillUpButton:function(e){var t=this;e=e||"< Back";var s,a,n=t.options.drillUpButton;n.text&&(e=n.text),this.drillUpButton?(this.drillUpButton.placed=!1,this.drillUpButton.attr({text:e}).align()):(a=(s=n.theme)&&s.states,this.drillUpButton=this.chart.renderer.button(e,null,null,(function(){t.drillUp()}),s,a&&a.hover,a&&a.select).addClass("highcharts-drillup-button").attr({align:n.position.align,zIndex:7}).add().align(n.position,!1,n.relativeTo||"plotBox"))},buildKDTree:r,drawLegendSymbol:e.LegendSymbolMixin.drawRectangle,getExtremes:function(){b.prototype.getExtremes.call(this,this.colorValueData),this.valueMin=this.dataMin,this.valueMax=this.dataMax,b.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var t={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};b.prototype.bindAxes.call(this),e.extend(this.yAxis.options,t),e.extend(this.xAxis.options,t)},utils:{recursive:v,reduce:E}},{getClassName:function(){var t=e.Point.prototype.getClassName.call(this),s=this.series,a=s.options;return this.node.level<=s.nodeMap[s.rootNode].level?t+=" highcharts-above-level":this.node.isLeaf||_(a.interactByLeaf,!a.allowDrillToNode)?this.node.isLeaf||(t+=" highcharts-internal-node"):t+=" highcharts-internal-node-interactive",t},isValid:function(){return this.id||p(this.value)},setState:function(t){e.Point.prototype.setState.call(this,t),this.graphic&&this.graphic.attr({zIndex:"hover"===t?1:0})},setVisible:a.pie.prototype.pointClass.prototype.setVisible})}(e,t)},e.exports?e.exports=n:void 0===(a=function(){return n}.call(t,s,t,e))||(e.exports=a)},96644:e=>{function t(e,t){if(!e.length&&!t.length)return 1;if(!e.length||!t.length)return 0;if(e.toUpperCase()===t.toUpperCase())return 1;if(1===e.length&&1===t.length)return 0;const s=n(e),a=n(t),i=s.length+a.length;let o=0;return s.forEach((e=>{for(let t,s=0;t=a[s];s++)if(e===t){o++,a.splice(s,1);break}})),2*o/i}function s(e){return Array.isArray(e)?e.reduce(((e,t)=>e.concat(s(t))),[]):[e]}function a(e){const t=[];for(let s=0,a=e.length-1;s<a;s++)t[s]=e.substring(s,s+2);return t}function n(e){return s(e.toUpperCase().split(" ").map(a))}e.exports={compareTwoStrings:t,findBestMatch:function(e,s){if(!function(e,t){return"string"==typeof e&&!!Array.isArray(t)&&!!t.length&&!t.find((e=>"string"!=typeof e))}(e,s))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const a=s.map((s=>({target:s,rating:t(e,s)})));return{ratings:a,bestMatch:Array.from(a).sort(((e,t)=>t.rating-e.rating))[0]}}}}}]);