text: (this.webpackJsonp=this.webpackJsonp||[]).push([[13],{2016:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(2),o=a.n(i),r=a(35),l=a(2022),c=a(9),u=a.n(c),p=a(5),d=a.n(p),m=a(125),h=a(16),_=a(1),f=a.n(_),y=a(283),g=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var E=function(e){function t(){return w(this,t),v(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return b(t,s.a.Component),g(t,[{key:"shouldComponentUpdate",value:function(e){return!h.a.are_equal_shallow(e.assets,this.props.assets)||e.value!==this.props.value||e.scroll_length!==this.props.scroll_length}},{key:"render",value:function(){return this.props.assets.length?s.a.createElement(l.a,{entries:this.props.assets.map(function(e){return e&&e.get("symbol")}).filter(function(e){return!!e}),values:this.props.assets.reduce(function(e,t){return t&&t.get("symbol")&&(e[t.get("symbol")]=t),e},{}),singleEntry:this.props.assets[0]?s.a.createElement(r.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}}]),t}();E.propTypes={value:f.a.string,onChange:f.a.func,scroll_length:f.a.number},E=Object(m.a)(E,{asList:!0});var k=function(e){function t(){return w(this,t),v(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return b(t,y["a"]),g(t,[{key:"componentDidMount",value:function(){this.onAssetChange(this.props.asset)}},{key:"formatAmount",value:function(e){return e||(e=""),"number"==typeof e&&(e=e.toString()),e.trim().replace(/,/g,"")}},{key:"_onChange",value:function(e){this.props.onChange&&this.props.onChange({amount:this.getNumericEventValue(e),asset:this.props.asset})}},{key:"onAssetChange",value:function(e){this.props.onChange&&this.props.onChange({amount:this.props.amount,asset:e})}},{key:"render",value:function(){var e=this.props.error?d.a.translate(this.props.error):this.formatAmount(this.props.amount);return s.a.createElement("div",{className:"amount-selector",style:this.props.style},s.a.createElement("label",{className:"right-label"},this.props.display_balance),s.a.createElement(o.a,{className:"left-label",component:"label",content:this.props.label}),s.a.createElement("div",{className:"inline-label input-wrapper"},s.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)}),s.a.createElement("div",{className:"form-label select floating-dropdown"},this.props.isPrice?s.a.createElement("div",{className:"dropdown-wrapper inactive"},s.a.createElement("div",null,this.props.asset.get("symbol"),"/",this.props.base)):s.a.createElement(E,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:u.a.List(this.props.assets),onChange:this.onAssetChange.bind(this),scroll_length:this.props.scroll_length}))))}}]),t}();k.propTypes={label:f.a.string,assets:f.a.array,amount:f.a.any,placeholder:f.a.string,onChange:f.a.func,tabIndex:f.a.number,error:f.a.string,scroll_length:f.a.number},k.defaultProps={disabled:!1,tabIndex:0},k=Object(m.a)(k),t.a=k},2022:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(16),o=a(1),r=a.n(o),l=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);e.scroll_length;var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={active:!1},a.listener=!1,a.onBodyClick=a.onBodyClick.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),l(t,[{key:"componentDidMount",value:function(){this._setListener()}},{key:"shouldComponentUpdate",value:function(e,t){return!i.a.are_equal_shallow(e.entries,this.props.entries)||!i.a.are_equal_shallow(t,this.state)||e.value!==this.props.value}},{key:"_setListener",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props).entries.length>1&&!this.listener&&(this.listener=!0,document.body.addEventListener("click",this.onBodyClick,{capture:!1,passive:!0}))}},{key:"_removeListener",value:function(){document.body.removeEventListener("click",this.onBodyClick),this.listener=!1}},{key:"componentWillReceiveProps",value:function(e){1===e.entries.length?this._removeListener():e.entries.length>1&&this._setListener(e)}},{key:"componentWillUnmount",value:function(){this._removeListener()}},{key:"onBodyClick",value:function(e){var t=e.target,a=!1;do{if(t.classList&&t.classList.contains("dropdown")&&t.id===this.props.id){a=!0;break}}while(t=t.parentNode);a?e.stopPropagation():this.setState({active:!1})}},{key:"onChange",value:function(e,t){t.preventDefault(),t.stopPropagation(),this.props.onChange(e),this.setState({active:!1})}},{key:"_toggleDropdown",value:function(){this.setState({active:!this.state.active})}},{key:"render",value:function(){var e=this,t=this.props,a=t.entries,n=t.value,i=this.state.active;if(0===a.length)return null;if(1==a.length)return s.a.createElement("div",{className:"dropdown-wrapper inactive"+(this.props.upperCase?" upper-case":"")},s.a.createElement("div",null,this.props.singleEntry?this.props.singleEntry:a[0]));var o=a.map(function(t){return s.a.createElement("li",{className:e.props.upperCase?"upper-case":"",key:t,onClick:e.onChange.bind(e,e.props.values[t])},s.a.createElement("span",null,t))});return s.a.createElement("div",{onClick:this._toggleDropdown.bind(this),className:"dropdown-wrapper"+(i?" active":"")+(this.props.upperCase?" upper-case":"")},s.a.createElement("div",{style:{paddingRight:15}},n||s.a.createElement("span",{className:"hidden"},"A")),s.a.createElement("ul",{className:"dropdown",style:{overflow:a.length>this.props.scroll_length?"auto":"hidden"}},o))}}]),t}();c.propTypes={scroll_length:r.a.number},c.defaultProps={scroll_length:9},t.a=c},2035:function(e,t,a){"use strict";var n=a(0),s=a.n(n),i=a(97),o=a(44),r=a(48),l=a(369),c=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),c(t,[{key:"render",value:function(){var e=this.props.asset.get("id"),t=this.props.account.getIn(["balances",e]);return t?s.a.createElement(l.a,{balance:t,replace:this.props.replace}):s.a.createElement("span",null,"0 ",s.a.createElement(i.a,{name:this.props.asset.get("symbol"),replace:this.props.replace}))}}]),t}();u.propTypes={account:o.a.ChainAccount.isRequired,asset:o.a.ChainAsset.isRequired},u.defaultProps={autosubscribe:!1},t.a=Object(r.a)(u)},2092:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(0),i=a.n(s),o=a(2),r=a.n(o),l=a(44),c=a(48),u=a(16),p=a(369),d=a(5),m=a.n(d),h=a(2016),_=a(41),f=a(83),y=a(6),g=a(210),w=a(39),v=a(4),b=a(1),E=a.n(b),k=a(30),C=a(21),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={isConfirmationModalVisible:!1,withdraw_amount:t.props.amount_to_withdraw,withdraw_address:f.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:f.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:y.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t.showConfirmationModal=t.showConfirmationModal.bind(t),t.hideConfirmationModal=t.hideConfirmationModal.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),S(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},feeAmount:new w.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(g.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(g.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),u.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=f.a.get(this.props.output_wallet_type)[e];f.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(f.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(g.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=void 0!==this.props.gateFee?parseFloat(String.prototype.replace.call(this.props.gateFee,/,/g,"")):0,r=new w.a({asset_id:n.get("id"),precision:n.get("precision"),real:i}),l=new w.a({asset_id:n.get("id"),precision:n.get("precision"),real:0});void 0!==this.props.balance&&(l=r.clone(this.props.balance.get("balance")));var c=new w.a({asset_id:n.get("id"),precision:n.get("precision"),real:o});r.plus(c),l.lt(r)&&(r=l),_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),r.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=u.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state,r=o.feeAmount,l=o.fee_asset_id;_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,r?r.asset_id:l)}},{key:"onDropDownList",value:function(){f.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new w.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(u.a.sortID),s){var o=y.ChainStore.getObject(i),r=y.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new w.i({base:new w.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new w.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=f.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),c=null,u=null,d=null;this.state.options_is_valid&&(u=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),d=i.a.createElement(v.Modal,{closable:!1,footer:[i.a.createElement(v.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},m.a.translate("modal.confirmation.accept")),i.a.createElement(v.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},m.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},i.a.createElement("label",null,i.a.createElement(r.a,{content:"modal.confirmation.title"})))));var _=1,y=null;this.props.output_supports_memos&&(y=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(r.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:_++,onChange:this.onMemoChanged.bind(this)})));var g=this._getAvailableAssets().fee_asset_types;if(l.length>0){var w=this.props.asset.get("id");if(w){var b=o[w];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(r.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},b?i.a.createElement(p.a,{balance:o[w]}):0))}else s="No funds"}else s="No funds";var E=this.state.error||this.state.balanceError||!this.state.withdraw_amount;return i.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement(h.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.insufficient"})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(h.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:g,tabIndex:_++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},u),c),y,i.a.createElement("div",null,i.a.createElement(v.Button,{type:"primary",disabled:E,onClick:this.onSubmit.bind(this)},m.a.translate("modal.withdraw.submit")),i.a.createElement(v.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},m.a.translate("account.perm.cancel"))),d))}}]),a}();A.propTypes={account:l.a.ChainAccount.isRequired,issuer:l.a.ChainAccount.isRequired,asset:l.a.ChainAsset.isRequired,output_coin_name:E.a.string.isRequired,output_coin_symbol:E.a.string.isRequired,output_coin_type:E.a.string.isRequired,url:E.a.string,output_wallet_type:E.a.string,output_supports_memos:E.a.bool.isRequired,amount_to_withdraw:E.a.string,balance:l.a.ChainObject},t.a=Object(c.a)(Object(k.a)(A,{listenTo:function(){return[C.a]},getProps:function(e){return{fee_asset_symbol:C.a.getState().settings.get("fee_asset")}}}))}).call(this,a(124).Buffer)},2093:function(e,t,a){"use strict";a.d(t,"b",function(){return o}),a.d(t,"c",function(){return r}),a.d(t,"a",function(){return l});var n=a(58),s=a(46),i=new n.a("");function o(e){var t=e.inputCoinType,a=e.outputCoinType,n=e.outputAddress,i=e.url,o=void 0===i?s.i.BASE:i,r=e.stateCallback,l={inputCoinType:t,outputCoinType:a,outputAddress:n},c=JSON.stringify(l);fetch(o+s.i.NEW_DEPOSIT_ADDRESS,{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:c}).then(function(e){e.json().then(function(e){var t={address:e.inputAddress||"unknown",memo:e.inputMemo,error:e.error||null};r&&r(t)},function(e){r&&r({address:"unknown",memo:null})})},function(e){r&&r({address:"unknown",memo:null})}).catch(function(e){console.log("fetch error:",e)})}function r(e){var t=e.url,a=void 0===t?s.i.BASE:t,n=e.walletType,i=e.newAddress;return i?fetch(a+"/wallets/"+n+"/check-address",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({address:i})}).then(function(e){return e.json().then(function(e){return e.isValid})}).catch(function(e){console.log("validate error:",e)}):new Promise(function(e){return e()})}var l={has:function(e){return i.has("history_address_"+e)},set:function(e){var t=e.wallet,a=e.addresses;i.set("history_address_"+t,a)},get:function(e){return i.get("history_address_"+e,[])},setLast:function(e){var t=e.wallet,a=e.address;i.set("history_address_last_"+t,a)},getLast:function(e){return i.get("history_address_last_"+e,"")}}},2120:function(e,t,a){"use strict";a.d(t,"b",function(){return o}),a.d(t,"c",function(){return r}),a.d(t,"a",function(){return l});var n=a(58),s=a(46),i=new n.a("");function o(e){var t=e.walletType,a=e.inputCoinType,n=e.outputCoinType,i=e.outputAddress,o=e.url,r=void 0===o?s.k.BASE:o,l=e.stateCallback,c={inputCoinType:a,outputCoinType:n,outputAddress:i},u=JSON.stringify(c);fetch(r+"/wallets/"+t+"/new-deposit-address",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:u}).then(function(e){e.json().then(function(e){var t={address:e.inputAddress||"unknown",memo:e.inputMemo,error:e.error||null};l&&l(t)},function(e){l&&l({address:"unknown",memo:null})})},function(e){l&&l({address:"unknown",memo:null})}).catch(function(e){console.log("fetch error:",e)})}function r(e){var t=e.url,a=void 0===t?s.k.BASE:t,n=e.walletType,i=e.newAddress;return i?fetch(a+"/wallets/"+n+"/check-address",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({address:i})}).then(function(e){return e.json().then(function(e){return e.isValid})}).catch(function(e){console.log("validate error:",e)}):new Promise(function(e){return e()})}var l={has:function(e){return i.has("history_address_"+e)},set:function(e){var t=e.wallet,a=e.addresses;i.set("history_address_"+t,a)},get:function(e){return i.get("history_address_"+e,[])},setLast:function(e){var t=e.wallet,a=e.address;i.set("history_address_last_"+t,a)},getLast:function(e){return i.get("history_address_last_"+e,"")}}},2199:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(5),i=a.n(s),o=a(0),r=a.n(o),l=a(2),c=a.n(l),u=a(44),p=a(48),d=a(2035),m=a(2092),h=a(600),_=a(16),f=a(41),y=a(76),g=a(46),w=a(210),v=a(39),b=a(83),E=a(1),k=a.n(E),C=a(4),S=a(2200),A=a.n(S),O=a(58),N=a(2203),x=a(21),T=a(6),j=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,s=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(n=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{!n&&r.return&&r.return()}finally{if(s)throw i}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),M=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function I(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function D(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var F=new O.a("__oauthBlocktrades__"),R=new O.a("oidc.user:https://blocktrades.us/:10ecf048-b982-467b-9965-0b0926330869"),W=window.location.protocol+"//"+window.location.host+"/deposit-withdraw",q="https://blocktrades.us/",L="10ecf048-b982-467b-9965-0b0926330869",U=W,V="offline openid email profile create_new_mappings view_client_transaction_history view_price_estimates",H=function(t){function a(e){B(this,a);var t=P(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={error:null,conversion_memo:null,feeStatus:{}},t._updateFee=Object(n.a)(t._updateFee.bind(t),150),t._checkFeeStatus=t._checkFeeStatus.bind(t),t._checkBalance=t._checkBalance.bind(t),t}return D(a,r.a.Component),M(a,[{key:"_getFeeID",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=this._getCurrentBalance(e),a=e.account.get("balances"),n=T.ChainStore.assets_by_symbol.get(x.a.getState().settings.get("fee_asset"))||"1.3.0";return a.has(n)?n:t?t.get("asset_type"):"1.3.0"}},{key:"componentWillMount",value:function(){this._updateFee()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){e.amount.equals(this.props.amount)&&e.account_id===this.props.account_id||this._updateFee()}},{key:"_updateFee",value:function(){var e=this,t=this._getFeeID(),a=null;!0===this.props.is_user_authorized&&(a=R.get("").access_token),Object(b.i)(this.props,a).then(function(a){Object(w.b)({accountID:e.props.account_id,feeID:t,options:["price_per_kbyte"],data:{type:"memo",content:a.inputMemo}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted?e._checkFeeStatus():e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkFeeStatus)}).catch(function(t){e._checkFeeStatus()})})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.account;if(t){var a=Object.keys(this.props.account.get("balances").toJS());a.length||(a=["1.3.0"]);var n={},s=[],i=null;!0===this.props.is_user_authorized&&(i=R.get("").access_token),Object(b.i)(this.props,i).then(function(i){a.forEach(function(e){s.push(Object(w.b)({accountID:t.get("id"),feeID:e,options:["price_per_kbyte"],data:{type:"memo",content:i.inputMemo}}))}),Promise.all(s).then(function(t){e.unMounted||(a.forEach(function(e,a){n[e]=t[a]}),_.a.are_equal_shallow(e.state.feeStatus,n)||e.setState({feeStatus:n}),e._checkBalance())}).catch(function(e){console.error(e)})})}}},{key:"_getCurrentBalance",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props).balance}},{key:"_checkBalance",value:function(){var e=this.state.feeAmount,t=this.props,a=t.asset,n=t.amount,s=this._getCurrentBalance();if(s&&e){var i=Object(w.a)(n.getAmount({real:!0}),a,e,s);if(null!==i)return this.setState({balanceError:!i}),i}}},{key:"onTrxIncluded",value:function(e){e.included&&e.broadcasted_transaction?(y.a.unlisten(this.onTrxIncluded),y.a.reset()):e.closed&&(y.a.unlisten(this.onTrxIncluded),y.a.reset())}},{key:"onConvert",value:function(){var t=this,a=this.props,n=a.input_coin_type,s=a.output_coin_type,i=a.amount,o=this.state.balanceError,r=null;!0===this.props.is_user_authorized&&(r=R.get("").access_token),Object(b.i)(this.props,r).then(function(a){if(a.inputCoinType!=n||a.outputCoinType!=s)throw new Error("unexpected reply from initiate-trade");n!=a.inputCoinType||s!=a.outputCoinType||o||(t.setState({conversion_memo:a.inputMemo}),t.setState({error:null}),f.a.transfer(t.props.account_id,"1.2.32567",i.getAmount(),t.props.asset.get("id"),a.inputMemo?new e(a.inputMemo,"utf-8"):"",null,t._getFeeID()).then(function(){y.a.unlisten(t.onTrxIncluded),y.a.listen(t.onTrxIncluded)}).catch(function(e){var a=e.message?e.message.split("\n")[1]:null;console.log("error: ",e,a),t.setState({error:a})}))}).catch(function(){t.setState({conversion_memo:null})})}},{key:"render",value:function(){var e="button disabled";return Object.keys(this.props.account_balances.toJS()).includes(this.props.asset.get("id"))&&!this.state.balanceError&&this.state.hasBalance&&this.props.amount.getAmount()>0&&(e="button"),r.a.createElement("span",null,r.a.createElement("button",{className:e,onClick:this.onConvert.bind(this)},r.a.createElement(c.a,{content:""}),r.a.createElement(c.a,{content:"gateway.convert_now"})),this.state.balanceError?r.a.createElement("div",{style:{paddingTop:15},className:"has-error"},r.a.createElement(c.a,{content:"transfer.errors.insufficient"})):null)}}]),a}();H.propTypes={balance:u.a.ChainObject,input_coin_type:k.a.string.isRequired,output_coin_type:k.a.string.isRequired,account_name:k.a.string.isRequired,account_id:k.a.string.isRequired,url:k.a.string.isRequired},H=Object(p.a)(H);var J=function(e){function t(){return B(this,t),P(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,r.a.Component),M(t,[{key:"render",value:function(){var e=r.a.createElement(H,{asset:this.props.asset,account:this.props.account,input_coin_type:this.props.input_coin_type,is_user_authorized:this.props.is_user_authorized,output_coin_type:this.props.output_coin_type,account_name:this.props.account_name,amount:new v.a({real:this.props.amount,asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")}),account_id:this.props.account_id,account_balances:this.props.account_balances,url:this.props.url,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return r.a.createElement("span",null,e)}}]),t}();J.propTypes={asset:u.a.ChainAsset.isRequired,input_coin_type:k.a.string.isRequired,output_coin_type:k.a.string.isRequired,account_name:k.a.string.isRequired,account_id:k.a.string.isRequired,url:k.a.string.isRequired},J=Object(p.a)(J);var z=function(e){function t(){return B(this,t),P(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,r.a.Component),M(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){this.props.showModal()}},{key:"render",value:function(){var e="button disabled";return Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))&&this.props.amount_to_withdraw&&!(this.props.amount_to_withdraw.indexOf(" ")>=0)&&!isNaN(this.props.amount_to_withdraw)&&this.props.amount_to_withdraw>0&&this.props.amount_to_withdraw<=this.props.balance.toJS().balance/_.a.get_asset_precision(this.props.asset.get("precision"))&&(e="button"),r.a.createElement("span",null,r.a.createElement("span",null,r.a.createElement("button",{className:e,onClick:this.onWithdraw.bind(this)},r.a.createElement(c.a,{content:""}),r.a.createElement(c.a,{content:"gateway.withdraw_now"})," ")),r.a.createElement(C.Modal,{closable:!1,onCancel:this.props.hideModal,title:i.a.translate("gateway.withdraw_coin",{coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}),footer:null,visible:this.props.visible,overlay:!0},r.a.createElement(m.a,{hideModal:this.props.hideModal,key:""+this.props.key,account:this.props.account.get("name"),issuer:this.props.issuer,asset:this.props.asset.get("id"),output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,url:this.props.url,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]})))}}]),t}();z.propTypes={balance:u.a.ChainObject,url:k.a.string.isRequired},z=Object(p.a)(z);var X=function(e){function t(){return B(this,t),P(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,r.a.Component),M(t,[{key:"render",value:function(){var e=r.a.createElement(z,{visible:this.props.visible,hideModal:this.props.hideModal,showModal:this.props.showModal,key:this.props.key,account:this.props.account,issuer:this.props.issuer,asset:this.props.asset,output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,url:this.props.url,gateway:this.props.gateway,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return r.a.createElement("span",null,e)}}]),t}();X.propTypes={account:u.a.ChainAccount.isRequired,asset:u.a.ChainAsset.isRequired,output_coin_type:k.a.string.isRequired,url:k.a.string.isRequired},X=Object(p.a)(X);var G=function(e){function t(e){B(this,t);var a=P(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));a.refresh_interval=12e4,a.deposit_address_cache=new h.a,a.coin_info_request_states={request_in_progress:0,request_complete:1,request_failed:2},a.estimation_directions={output_from_input:0,input_from_output:1};var n=!1;return!0===F.get("is_refresh_token")&&(n=!0),a.manager=new N.UserManager({authority:q,client_id:L,redirect_uri:U,response_type:"code",scope:V,loadUserInfo:!0,automaticSilentRenew:n,userStore:new N.WebStorageStateStore({store:window.localStorage}),post_logout_redirect_uri:W}),a.state={isModalVisible:!1,coin_symbol:"btc",key_for_withdrawal_dialog:"btc",supports_output_memos:"",url:g.b.BASE,error:null,isUserAuthorized:!1,retrievingDataFromOauthApi:!0,deposit_input_coin_type:null,deposit_output_coin_type:null,input_address_and_memo:null,deposit_estimated_input_amount:a.props.initial_deposit_estimated_input_amount||"1.0",deposit_estimated_output_amount:null,deposit_limit:null,deposit_error:null,failed_calculate_deposit:null,withdraw_input_coin_type:null,withdraw_output_coin_type:null,withdraw_estimated_input_amount:a.props.initial_withdraw_estimated_input_amount||"1.0",withdraw_estimated_output_amount:null,withdraw_limit:null,withdraw_error:null,failed_calculate_withdraw:null,conversion_input_coin_type:null,conversion_output_coin_type:null,conversion_estimated_input_amount:a.props.initial_conversion_estimated_input_amount||"1.0",conversion_estimated_output_amount:null,conversion_limit:null,conversion_error:null,failed_calculate_conversion:null,coin_info_request_state:a.coin_info_request_states.request_in_progress,input_address_requests_in_progress:{},deposit_estimate_direction:a.estimation_directions.output_from_input,deposit_limit_cache:{},deposit_limit_requests_in_progress:{},coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null,conversion_memo:null,announcements:[]},a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),a}return D(t,r.a.Component),M(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"urlConnection",value:function(e,t){var a=this;this.setState({url:e});var n=fetch(e+"/announcements/enabled/trade",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});if(Promise.resolve(n).then(function(e){e.sort(function(e,t){return e.priority<t.priority?-1:e.priority>t.priority?1:0}),a.setState({announcements:e,coin_info_request_state:a.coin_info_request_states.request_complete})}).catch(function(){a.setState({announcements:[],coin_info_request_state:t})}),!1!==this.state.isUserAuthorized){var s={Accept:"application/json"};this.state.isUserAuthorized&&(s={Accept:"application/json",Authorization:"Bearer "+R.get("").access_token});var i=fetch(e+"/coins",{method:"get",headers:s}).then(function(e){return e.json()}),o=fetch(e+"/wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),r=fetch(e+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),l=fetch(e+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([i,o,r,l]).then(function(e){var t=j(e,4),n=t[0],s=(t[1],t[2]),i=t[3],o={};n.forEach(function(e){return o[e.coinType]=e});var r={},l={},c={};s.forEach(function(e){var t=o[e.inputCoinType],a=o[e.outputCoinType];t.backingCoinType!=e.outputCoinType&&a&&a.backingCoinType!=e.inputCoinType&&t&&(0==t.restricted&&0==a.restricted||1==t.restricted&&1==t.authorized||1==a.restricted&&1==a.authorized)&&-1!=i.indexOf(t.walletType)&&-1!=i.indexOf(a.walletType)&&("bitshares"!=t.walletType&&"bitshares"==a.walletType?(r[e.inputCoinType]=r[e.inputCoinType]||[],r[e.inputCoinType].push(e.outputCoinType)):"bitshares"==t.walletType&&"bitshares"!=a.walletType?(l[e.inputCoinType]=l[e.inputCoinType]||[],l[e.inputCoinType].push(e.outputCoinType)):"bitshares"==t.walletType&&"bitshares"==a.walletType&&(c[e.inputCoinType]=c[e.inputCoinType]||[],c[e.inputCoinType].push(e.outputCoinType)))});var u=null,p=null,d=Object.keys(r);if(d.forEach(function(e){r[e].sort()}),d.length){u=a.props.initial_deposit_input_coin_type&&a.props.initial_deposit_input_coin_type in r?a.props.initial_deposit_input_coin_type:d[0];var m=r[u];p=a.props.initial_deposit_output_coin_type&&-1!=m.indexOf(a.props.initial_deposit_output_coin_type)?a.props.initial_deposit_output_coin_type:m[0]}var h=null,_=null,f=null,y=null,g=Object.keys(l);if(g.forEach(function(e){l[e].sort()}),g.length){h=a.props.initial_withdraw_input_coin_type&&a.props.initial_withdraw_input_coin_type in l?a.props.initial_withdraw_input_coin_type:g[0];var w=l[h];_=a.props.initial_withdraw_output_coin_type&&-1!=w.indexOf(a.props.initial_withdraw_output_coin_type)?a.props.initial_withdraw_output_coin_type:w[0]}var v=Object.keys(c);if(v.forEach(function(e){c[e].sort()}),v.length){f=a.props.initial_conversion_input_coin_type&&a.props.initial_conversion_input_coin_type in c?a.props.initial_conversion_input_coin_type:v[0];var b=c[f];y=a.props.initial_conversion_output_coin_type&&-1!=b.indexOf(a.props.initial_conversion_output_coin_type)?a.props.initial_conversion_output_coin_type:b[0]}var E=a.getCachedOrGeneratedInputAddress(u,p),k=a.getCachedOrFreshDepositLimit("deposit",u,p),C=a.getAndUpdateOutputEstimate("deposit",u,p,a.state.deposit_estimated_input_amount),S=a.getAndUpdateOutputEstimate("withdraw",h,_,a.state.withdraw_estimated_input_amount),A=a.getCachedOrFreshDepositLimit("withdraw",h,_),O=a.getAndUpdateOutputEstimate("conversion",f,y,a.state.conversion_estimated_input_amount),N=a.getCachedOrFreshDepositLimit("conversion",f,y);a.unMounted||a.setState({coin_info_request_state:a.coin_info_request_states.request_complete,coins_by_type:o,allowed_mappings_for_deposit:r,allowed_mappings_for_withdraw:l,allowed_mappings_for_conversion:c,deposit_input_coin_type:u,deposit_output_coin_type:p,input_address_and_memo:E,deposit_limit:k,deposit_estimated_output_amount:C,deposit_estimate_direction:a.estimation_directions.output_from_input,withdraw_input_coin_type:h,withdraw_output_coin_type:_,withdraw_limit:A,withdraw_estimated_output_amount:S,conversion_input_coin_type:f,conversion_output_coin_type:y,conversion_limit:N,conversion_estimated_output_amount:O,withdraw_estimate_direction:a.estimation_directions.output_from_input,conversion_estimate_direction:a.estimation_directions.output_from_input,supports_output_memos:o.btc.supportsOutputMemos})}).catch(function(e){a.setState({coin_info_request_state:t,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null})})}}},{key:"updateEstimates",value:function(){if(this.state.deposit_input_coin_type&&this.state.deposit_output_coin_type){var e=this.getCachedOrGeneratedInputAddress(this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),t=this.getCachedOrFreshDepositLimit("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),a=this.state.deposit_estimated_input_amount,n=this.state.deposit_estimated_output_amount;this.state.deposit_estimate_direction==this.estimation_directions.output_from_input?n=this.getAndUpdateOutputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,a):a=this.getAndUpdateInputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,n);var s=this.getCachedOrFreshDepositLimit("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type),i=this.state.withdraw_estimated_input_amount,o=this.state.withdraw_estimated_output_amount;this.state.withdraw_estimate_direction==this.estimation_directions.output_from_input?o=this.getAndUpdateOutputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,i):i=this.getAndUpdateinputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,o);var r=this.getCachedOrFreshDepositLimit("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type),l=this.state.conversion_estimated_input_amount,c=this.state.conversion_estimated_output_amount;this.state.conversion_estimate_direction==this.estimation_directions.output_from_input?c=this.getAndUpdateOutputEstimate("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type,l):l=this.getAndUpdateinputEstimate("conversion",this.state.conversion_input_coin_type,this.state.conversion_output_coin_type,c),this.setState({input_address_and_memo:e,deposit_limit:t,deposit_estimated_input_amount:a,deposit_estimated_output_amount:n,withdraw_limit:s,withdraw_estimated_input_amount:i,withdraw_estimated_output_amount:o,conversion_limit:r,conversion_estimated_input_amount:l,conversion_estimated_output_amount:c,key_for_withdrawal_dialog:i})}}},{key:"handlingOauthUser",value:function(){var e=this;this.manager.getUser().then(function(t){t?(!0===e.manager.settings.automaticSilentRenew?e.manager.signinSilent().then(function(){e.setState({isUserAuthorized:!0,retrievingDataFromOauthApi:!1}),e.urlConnectionInit()}).catch(function(){e.setState({isUserAuthorized:!1,retrievingDataFromOauthApi:!1}),e.manager.removeUser(),F.set("is_refresh_token",!1),e.urlConnectionInit()}):(e.setState({isUserAuthorized:!0,retrievingDataFromOauthApi:!1}),e.urlConnectionInit()),e.manager.events.addAccessTokenExpired(function(){e.unMounted||e.removeOauthUser()}),e.manager.events.addSilentRenewError(function(){e.unMounted||e.removeOauthUser()})):(e.setState({isUserAuthorized:!1,retrievingDataFromOauthApi:!1}),e.urlConnectionInit())})}},{key:"removeOauthUser",value:function(){!1===this.manager.settings.automaticSilentRenew&&(this.setState({isUserAuthorized:!1,retrievingDataFromOauthApi:!1}),this.manager.removeUser(),F.set("is_refresh_token",!1))}},{key:"componentWillMount",value:function(){var e=this;A.a.parse(this.props.params.search).code?(this.setState({isUserAuthorized:!0}),this.manager.signinRedirectCallback().then(function(t){var a=!1;void 0!==t.refresh_token?(a=!0,F.set("is_refresh_token",!0)):F.set("is_refresh_token",!1),e.manager=new N.UserManager({authority:q,client_id:L,redirect_uri:U,response_type:"code",scope:V,loadUserInfo:!0,automaticSilentRenew:a,userStore:new N.WebStorageStateStore({store:window.localStorage}),post_logout_redirect_uri:W}),e.setState({retrievingDataFromOauthApi:!1}),e.manager.events.addAccessTokenExpired(function(){e.unMounted||e.removeOauthUser()}),e.manager.events.addSilentRenewError(function(){e.unMounted||e.removeOauthUser()}),e.urlConnectionInit()}).catch(function(){e.handlingOauthUser()})):this.handlingOauthUser();try{this.manager.signoutRedirectCallback(location.href)}catch(e){}}},{key:"componentDidMount",value:function(){this.update_timer=setInterval(this.updateEstimates.bind(this),this.refresh_interval)}},{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer),this.unMounted=!0}},{key:"urlConnectionInit",value:function(){var e=this,t=this.state.url;this.urlConnection(t,0);var a={Accept:"application/json"};this.state.isUserAuthorized&&(a={Accept:"application/json",Authorization:"Bearer "+R.get("").access_token});var n=fetch(t+"/coins",{method:"get",headers:a}).then(function(e){return e.json()});Promise.all([n]).then(function(e){var t={};j(e,1)[0].forEach(function(e){return t[e.coinType]=e})}).catch(function(){e.urlConnection("https://api.blocktrades.info/v2",2),e.setState({coin_info_request_state:0,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,allowed_mappings_for_conversion:null})})}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.props.account.get("name");return this.deposit_address_cache.getCachedInputAddress(this.props.gateway,n,e,t)}},{key:"cacheInputAddress",value:function(e,t,a,n){var s=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,s,e,t,a,n)}},{key:"getCachedOrGeneratedInputAddress",value:function(e,t){var a=this,n=this.getCachedInputAddress(e,t);if(n)return n;if(this.state.input_address_requests_in_progress[e]=this.state.input_address_requests_in_progress[e]||{},this.state.input_address_requests_in_progress[e][t])return null;var s=JSON.stringify({inputCoinType:e,outputCoinType:t,outputAddress:this.props.account.get("name")});this.state.input_address_requests_in_progress[e][t]=!0;var i={Accept:"application/json"};return this.state.isUserAuthorized&&(i={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+R.get("").access_token}),fetch(this.state.url+"/simple-api/initiate-trade",{method:"post",headers:i,body:s}).then(function(n){n.json().then(function(n){if(console.assert(n.inputCoinType==e,"unexpected reply from initiate-trade"),console.assert(n.outputCoinType==t,"unexpected reply from initiate-trade"),n.inputCoinType!=e||n.outputCoinType!=t)throw Error("unexpected reply from initiate-trade");a.cacheInputAddress(n.inputCoinType,n.outputCoinType,n.inputAddress,n.inputMemo),delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==n.inputCoinType&&a.state.deposit_output_coin_type==n.outputCoinType&&a.setState({input_address_and_memo:{address:n.inputAddress,memo:n.inputMemo}})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})}),null}},{key:"makeState",value:function(e){for(var t="",a="abcdefghijklmnopqrstuvwxyz0123456789",n=a.length,s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*n));return t}},{key:"getCachedDepositLimit",value:function(e,t){if(this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]){var a=this.state.deposit_limit_cache[e][t];if(new Date-a.timestamp<this.refresh_interval)return a;delete this.state.deposit_limit_cache[e][t]}return null}},{key:"cacheDepositLimit",value:function(e,t,a){a.timestamp=new Date,this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]=a}},{key:"getCachedOrFreshDepositLimit",value:function(e,t,a){var n=this,s=this.getCachedDepositLimit(t,a);if(s)return s;this.state.deposit_limit_requests_in_progress[t]=this.state.input_address_requests_in_progress[t]||{},this.state.deposit_limit_requests_in_progress[t][a]=!0;var i={"Content-Type":"application/x-www-form-urlencoded"};this.state.isUserAuthorized&&(i={"Content-Type":"application/x-www-form-urlencoded",Authorization:"Bearer "+R.get("").access_token});var o=this.state.url+"/deposit-limits?inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(o,{method:"get",headers:i}).then(function(e){return e.json()}).then(function(s){if(!n.unMounted){if(console.assert(s.inputCoinType==t&&s.outputCoinType==a,"unexpected reply from deposit-limits"),s.inputCoinType!=t||s.outputCoinType!=a)throw Error("unexpected reply from deposit-limits");var i={timestamp:new Date,limit:s.depositLimit};n.cacheDepositLimit(t,a,i),delete n.state.deposit_limit_requests_in_progress[t][a],n.state[e+"_input_coin_type"]==t&&n.state[e+"_output_coin_type"]==a&&n.setState(I({},e+"_limit",i))}},function(e){delete n.state.deposit_limit_requests_in_progress[t][a]}),null}},{key:"getAndUpdateOutputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null}),"conversion"==e&&this.setState({failed_calculate_conversion:null});var i={Accept:"application/json"};this.state.isUserAuthorized&&(i={Accept:"application/json",Authorization:"Bearer "+R.get("").access_token});var o=this.state.url+"/estimate-output-amount?inputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(o,{method:"get",headers:i}).then(function(e){return e.json()}).then(function(i){if(!s.unMounted)if(i.error){if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input){var o=i.error.message;"deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"}),"conversion"==e&&s.setState({failed_calculate_conversion:"Failed to calculate"});o.startsWith("Internal Server Error: ")&&(o=o.substr("Internal Server Error: ".length)),s.setState(I({},e+"_error",o))}}else{var r;if(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.inputAmount==n,"unexpected reply from estimate-output-amount"),i.inputCoinType!=t||i.outputCoinType!=a||i.inputAmount!=n)throw Error("unexpected reply from estimate-output-amount");s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input&&s.setState((I(r={},e+"_estimated_output_amount",i.outputAmount),I(r,e+"_error",null),r))}},function(e){}),null}}},{key:"getAndUpdateInputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null}),"conversion"==e&&this.setState({failed_calculate_conversion:null});var i={Accept:"application/json"};this.state.isUserAuthorized&&(i={Accept:"application/json",Authorization:"Bearer "+R.get("").access_token});var o=this.state.url+"/estimate-input-amount?outputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(o,{method:"get",headers:i}).then(function(e){return e.json()}).then(function(i){var o;s.unMounted||(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n,"unexpected reply from estimate-input-amount"),i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n||("deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"}),"conversion"==e&&s.setState({failed_calculate_conversion:"Failed to calculate"})),s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_output_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.input_from_output&&s.setState((I(o={},e+"_estimated_input_amount",i.inputAmount),I(o,"key_for_withdrawal_dialog",i.inputAmount),o)))},function(e){}),null}}},{key:"onInputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((I(a={},e+"_estimated_input_amount",n),I(a,e+"_estimated_output_amount",s),I(a,e+"_estimate_direction",this.estimation_directions.output_from_input),I(a,"key_for_withdrawal_dialog",n),a))}},{key:"onOutputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((I(a={},e+"_estimated_output_amount",n),I(a,e+"_estimated_input_amount",s),I(a,e+"_estimate_direction",this.estimation_directions.input_from_output),a))}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onInputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state["allowed_mappings_for_"+e][o],l=r[0];-1!=r.indexOf(this.state[e+"_output_coin_type"])&&(l=this.state[e+"_output_coin_type"]);var c=this.state.input_address_and_memo;"deposit"==e&&(c=this.getCachedOrGeneratedInputAddress(o,l));var u=this.getCachedOrFreshDepositLimit(e,o,l);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,o,l,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,o,l,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),"withdraw"==e&&r.forEach(function(e){l===e&&n.setState({coin_symbol:o+"input",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos})}),this.setState((I(a={},e+"_input_coin_type",o),I(a,e+"_output_coin_type",l),I(a,"input_address_and_memo",c),I(a,e+"_limit",u),I(a,e+i,s),I(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"onOutputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type];"withdraw"==e&&r.forEach(function(e){o===e&&n.setState({coin_symbol:o+"output",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos,key_for_withdrawal_dialog:o})});var l=this.state.input_address_and_memo;"deposit"==e&&(l=this.getCachedOrGeneratedInputAddress(this.state[e+"_input_coin_type"],o));var c=this.getCachedOrFreshDepositLimit(e,this.state[e+"_input_coin_type"],o);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),this.setState((I(a={},e+"_output_coin_type",o),I(a,"input_address_and_memo",l),I(a,e+"_limit",c),I(a,e+i,s),I(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"registerBlocktradesAccount",value:function(){window.location.assign("https://blocktrades.us/register")}},{key:"signin",value:function(){this.manager.signinRedirect()}},{key:"onLogout",value:function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,a){return function n(s,i){try{var o=t[s](i),r=o.value}catch(e){return void a(e)}if(!o.done)return Promise.resolve(r).then(function(e){n("next",e)},function(e){n("throw",e)});e(r)}("next")})}}(regeneratorRuntime.mark(function e(){var t,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.manager.getUser();case 3:return t=e.sent,a=t.id_token,e.next=7,this.manager.signoutRedirect({id_token_hint:a,state:"logout",post_logout_redirect_uri:W});case 7:e.sent,e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(0),e.t0;case 13:case"end":return e.stop()}},e,this,[[0,10]])}));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this;if(!this.props.account||!this.props.issuer_account||!this.props.gateway)return r.a.createElement("div",null);var t=void 0,a=void 0,n=void 0,s=void 0,i=void 0,o=void 0,l=void 0;if(this.state.coin_info_request_state==this.coin_info_request_states.request_failed)return r.a.createElement("div",null,r.a.createElement("p",null,"Error connecting to blocktrades.us, please try again later"));if(this.state.coin_info_request_state==this.coin_info_request_states.never_requested||this.state.coin_info_request_state==this.coin_info_request_states.request_in_progress||this.state.retrievingDataFromOauthApi)return r.a.createElement("div",null,r.a.createElement("p",null,"Retrieving current trade data from blocktrades.us"));var u=null,p=r.a.createElement(c.a,{content:"gateway.calc"});null!=this.state.failed_calculate_deposit&&(p=this.state.failed_calculate_deposit);var m=r.a.createElement(c.a,{content:"gateway.calc"});null!=this.state.failed_calculate_withdraw&&(m=this.state.failed_calculate_withdraw);var h=r.a.createElement(c.a,{content:"gateway.calc"});null!=this.state.failed_calculate_conversion&&(h=this.state.failed_calculate_conversion);var f=this.state.isUserAuthorized;if(f&&this.state.allowed_mappings_for_conversion&&this.state.allowed_mappings_for_deposit&&this.state.allowed_mappings_for_withdraw){if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_deposit).length>0){var y=[];Object.keys(this.state.allowed_mappings_for_deposit).sort().forEach(function(t){y.push(r.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].symbol))});var g=r.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.deposit_input_coin_type||"",onChange:this.onInputCoinTypeChanged.bind(this,"deposit")},y),w=[];this.state.allowed_mappings_for_deposit[this.state.deposit_input_coin_type].forEach(function(t){w.push(r.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].walletSymbol))});var v=r.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.deposit_output_coin_type||"",onChange:this.onOutputCoinTypeChanged.bind(this,"deposit")},w),b=this.state.input_address_and_memo?this.state.input_address_and_memo:{address:"unknown",memo:null},E=this.state.deposit_estimated_input_amount,k=this.state.deposit_estimated_output_amount,C=E?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:E||"",onChange:this.onInputAmountChanged.bind(this,"deposit")}):p,S=k?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:k||"",onChange:this.onOutputAmountChanged.bind(this,"deposit")}):p,A=r.a.createElement("span",null,"updating");this.state.deposit_limit&&(A=this.state.deposit_limit.limit?r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("span",{className:"deposit-limit"},r.a.createElement(c.a,{content:"gateway.limit",amount:_.a.format_number(this.state.deposit_limit.limit,8),symbol:this.state.coins_by_type[this.state.deposit_input_coin_type].walletSymbol}))):null);var O=null;this.state.deposit_error&&(O=r.a.createElement("div",null,this.state.deposit_error)),n=r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.deposit"})),r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.balance"})),r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.deposit_to",asset:this.state.deposit_input_coin_type}))));var N=null;N=b.memo?r.a.createElement(c.a,{unsafe:!0,content:"gateway.address_with_memo",address:b.address,memo:b.memo}):r.a.createElement("span",null,b.address),a=r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,g),r.a.createElement("div",null,C)),"→",r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,v),r.a.createElement("div",null,S)),r.a.createElement("div",null,O))),r.a.createElement("td",null,r.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.deposit_output_coin_type].walletSymbol})),r.a.createElement("td",null,N,r.a.createElement("br",null),A)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_withdraw).length>0){this.state.coins_by_type[this.state.withdraw_input_coin_type].symbol;u=this.state.withdraw_estimated_input_amount;var x=[];Object.keys(this.state.allowed_mappings_for_withdraw).sort().forEach(function(t){x.push(r.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var T=r.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.withdraw_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"withdraw")},x),j=[];this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type].forEach(function(t){j.push(r.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var M=r.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.withdraw_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"withdraw")},j),I=this.state.withdraw_estimated_input_amount,B=I?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:I||"",onChange:this.onInputAmountChanged.bind(this,"withdraw")}):m,P=this.state.withdraw_estimated_output_amount,D=P?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:P||"",onChange:this.onOutputAmountChanged.bind(this,"withdraw")}):m,F=r.a.createElement(X,{visible:this.state.isModalVisible,hideModal:this.hideModal,showModal:this.showModal,key:this.state.key_for_withdrawal_dialog,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol,output_coin_name:this.state.coins_by_type[this.state.withdraw_output_coin_type].name,output_coin_symbol:this.state.coins_by_type[this.state.withdraw_output_coin_type].symbol,output_coin_type:this.state.withdraw_output_coin_type,output_supports_memos:this.state.supports_output_memos,amount_to_withdraw:u,url:this.state.url,gateway:this.props.gateway,output_wallet_type:this.state.coins_by_type[this.state.withdraw_output_coin_type].walletType}),R=null;this.state.withdraw_error&&(R=r.a.createElement("div",null,this.state.withdraw_error));var W=r.a.createElement("span",null,"...");this.state.withdraw_limit&&(W=this.state.withdraw_limit.limit?r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("span",{className:"deposit-limit"},r.a.createElement(c.a,{content:"gateway.limit",amount:_.a.format_number(this.state.withdraw_limit.limit,8),symbol:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol}))):r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("span",{className:"deposit-limit"},"no limit"))),i=r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.withdraw"})),r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.balance"})),r.a.createElement("th",null))),s=r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,T),r.a.createElement("div",null,B)),"→",r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,M),r.a.createElement("div",null,D)),r.a.createElement("div",null,R))),r.a.createElement("td",null,r.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol})),r.a.createElement("td",null,F,r.a.createElement("br",null),W)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_conversion).length>0){var q=[];Object.keys(this.state.allowed_mappings_for_conversion).sort().forEach(function(t){q.push(r.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var L=r.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.conversion_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"conversion")},q),U=[];this.state.allowed_mappings_for_conversion[this.state.conversion_input_coin_type].forEach(function(t){U.push(r.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var V=r.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.conversion_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"conversion")},U),H=this.state.conversion_estimated_input_amount,z=H?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:H||"",onChange:this.onInputAmountChanged.bind(this,"conversion")}):h,G=this.state.conversion_estimated_output_amount,K=G?r.a.createElement("input",{style:{width:"11rem"},type:"text",value:G||"",onChange:this.onOutputAmountChanged.bind(this,"conversion")}):h,Q=r.a.createElement(J,{asset:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol,account:this.props.account,is_user_authorized:this.state.isUserAuthorized,input_coin_type:this.state.conversion_input_coin_type,output_coin_type:this.state.conversion_output_coin_type,account_name:this.props.account.get("name"),amount:this.state.conversion_estimated_input_amount,account_id:this.props.account.get("id"),account_balances:this.props.account.get("balances"),url:this.state.url}),Y=null;this.state.conversion_error&&(Y=r.a.createElement("div",null,this.state.conversion_error));var Z=r.a.createElement("span",null,"...");this.state.conversion_limit&&(Z=this.state.conversion_limit.limit?r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("span",{className:"deposit-limit"},r.a.createElement(c.a,{content:"gateway.limit",amount:_.a.format_number(this.state.conversion_limit.limit,8),symbol:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol}))):r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("span",{className:"deposit-limit"},"no limit"))),l=r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.convert"})),r.a.createElement("th",null,r.a.createElement(c.a,{content:"gateway.balance"})),r.a.createElement("th",null))),o=r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,r.a.createElement("div",{className:"blocktrades-bridge"},r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,L),r.a.createElement("div",null,z)),"→",r.a.createElement("div",{className:"inline-block"},r.a.createElement("div",null,V),r.a.createElement("div",null,K)),r.a.createElement("div",null,Y))),r.a.createElement("td",null,r.a.createElement(d.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.conversion_input_coin_type].walletSymbol})),r.a.createElement("td",null,Q,r.a.createElement("br",null),Z)))}}this.state.announcements.length>0&&(t=r.a.createElement("div",{className:"blocktrades-announcements-container"},this.state.announcements.map(function(e,t){var a="txtann info";return 10===e.status?a="txtann error":20===e.status?a="txtann warning":30===e.status?a="txtann success":40===e.status&&(a="txtann info"),1===e.format&&e.message.replace(/\r\n|\r|\n/g,"<br />"),r.a.createElement("div",{className:"blocktrades-announcements "+a,key:t},e.message)},this)));return r.a.createElement("div",null,r.a.createElement("div",{style:{paddingBottom:15}},r.a.createElement(c.a,{component:"h5",content:"gateway.bridge_text"})),t,f?r.a.createElement("div",null,r.a.createElement("span",{style:{float:"right"}},r.a.createElement("button",{className:"button",onClick:this.onLogout.bind(this)},r.a.createElement(c.a,{content:""}),r.a.createElement(c.a,{content:"gateway.logout_now"})," ")),r.a.createElement("table",{className:"table"},n,a,i,s,l,o)):r.a.createElement("div",{style:{paddingTop:15}},r.a.createElement("div",{onClick:this.registerBlocktradesAccount.bind(this),className:"button"},"Register BlockTrades Account"),r.a.createElement("div",{onClick:this.signin.bind(this),className:"button"},"Sign in")))}}]),t}();G.propTypes={url:k.a.string,gateway:k.a.string,account:u.a.ChainAccount,issuer_account:u.a.ChainAccount,initial_deposit_input_coin_type:k.a.string,initial_deposit_output_coin_type:k.a.string,initial_deposit_estimated_input_amount:k.a.string,initial_withdraw_input_coin_type:k.a.string,initial_withdraw_output_coin_type:k.a.string,initial_withdraw_estimated_input_amount:k.a.string,initial_conversion_input_coin_type:k.a.string,initial_conversion_output_coin_type:k.a.string,initial_conversion_estimated_input_amount:k.a.string},t.a=Object(p.a)(G)}).call(this,a(124).Buffer)},2204:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(0),i=a.n(s),o=a(2),r=a.n(o),l=a(44),c=a(48),u=a(16),p=a(369),d=a(5),m=a.n(d),h=a(2016),_=a(41),f=a(83),y=a(30),g=a(21),w=a(6),v=a(210),b=a(39),E=a(4),k=a(1),C=a.n(k),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={isConfirmationModalVisible:!1,withdraw_amount:t.props.amount_to_withdraw,withdraw_address:f.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:f.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:w.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t.showConfirmationModal=t.showConfirmationModal.bind(t),t.hideConfirmationModal=t.hideConfirmationModal.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),S(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},feeAmount:new b.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(v.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(v.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),u.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=f.a.get(this.props.output_wallet_type)[e];f.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(f.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(v.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state,i=s.feeAmount,o=s.fee_asset_id,r=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),l=void 0!==this.props.gateFee?parseFloat(String.prototype.replace.call(this.props.gateFee,/,/g,"")):0,c=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:r}),u=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:0});void 0!==this.props.balance&&(u=c.clone(this.props.balance.get("balance")));var p=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:l});c.plus(p),u.lt(c)&&(c=u),_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),c.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,i?i.asset_id:o),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=u.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state,r=o.feeAmount,l=o.fee_asset_id;_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,r?r.asset_id:l)}},{key:"onDropDownList",value:function(){f.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new b.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(u.a.sortID),s){var o=w.ChainStore.getObject(i),r=w.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new b.i({base:new b.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new b.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=f.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),c=(this.getWithdrawModalId(),null),u=null,d=null;this.state.options_is_valid&&(u=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),d=i.a.createElement(E.Modal,{closable:!1,footer:[i.a.createElement(E.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},m.a.translate("modal.confirmation.accept")),i.a.createElement(E.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},m.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},i.a.createElement("label",null,i.a.createElement(r.a,{content:"modal.confirmation.title"})))));var _=1,y=null;this.props.output_supports_memos&&(y=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(r.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:_++,onChange:this.onMemoChanged.bind(this)})));var g=this._getAvailableAssets().fee_asset_types;if(l.length>0){var w=this.props.asset.get("id");if(w){var v=o[w];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(r.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},v?i.a.createElement(p.a,{balance:o[w]}):0))}else s="No funds"}else s="No funds";var b=this.state.error||this.state.balanceError||!this.state.withdraw_amount;return i.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement(h.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.insufficient"})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(h.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:g,tabIndex:_++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},u),c),y,i.a.createElement("div",null,i.a.createElement(E.Button,{type:"primary",disabled:b,onClick:this.onSubmit.bind(this)},m.a.translate("modal.withdraw.submit")),i.a.createElement(E.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},m.a.translate("account.perm.cancel"))),d))}}]),a}();A.propTypes={account:l.a.ChainAccount.isRequired,issuer:l.a.ChainAccount.isRequired,asset:l.a.ChainAsset.isRequired,output_coin_name:C.a.string.isRequired,output_coin_symbol:C.a.string.isRequired,output_coin_type:C.a.string.isRequired,url:C.a.string,output_wallet_type:C.a.string,output_supports_memos:C.a.bool.isRequired,amount_to_withdraw:C.a.string,balance:l.a.ChainObject},t.a=Object(c.a)(Object(y.a)(A,{listenTo:function(){return[g.a]},getProps:function(e){return{fee_asset_symbol:g.a.getState().settings.get("fee_asset")}}}))}).call(this,a(124).Buffer)},2205:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(0),i=a.n(s),o=a(2),r=a.n(o),l=a(44),c=a(48),u=a(16),p=a(369),d=a(5),m=a.n(d),h=a(2016),_=a(41),f=a(2093),y=a(30),g=a(21),w=a(6),v=a(210),b=a(39),E=a(1),k=a.n(E),C=a(4),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={isConfirmationModalVisible:!1,withdraw_amount:t.props.amount_to_withdraw,withdraw_address:f.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:f.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:w.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._checkMinAmount=t._checkMinAmount.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t.showConfirmationModal=t.showConfirmationModal.bind(t),t.hideConfirmationModal=t.hideConfirmationModal.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),S(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},feeAmount:new b.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(v.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(v.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),u.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},function(){this._checkBalance,this._checkMinAmount()})}},{key:"onSelectChanged",value:function(e){var t=f.a.get(this.props.output_wallet_type)[e];f.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(f.c)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(v.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"_checkMinAmount",value:function(){var e=this.state.withdraw_amount;if(null!==e){var t=e<this.props.min_amount/u.a.get_asset_precision(this.props.asset_precision);return console.log("X",e,this.props.min_amount/u.a.get_asset_precision(this.props.asset_precision)),this.setState({minAmountError:t}),t}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state,i=s.feeAmount,o=s.fee_asset_id,r=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),l=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:r});_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),l.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,i?i.asset_id:o),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=u.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state,r=o.feeAmount,l=o.fee_asset_id;_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,r?r.asset_id:l)}},{key:"onDropDownList",value:function(){f.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new b.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(u.a.sortID),s){var o=w.ChainStore.getObject(i),r=w.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new b.i({base:new b.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new b.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=f.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),c=(this.getWithdrawModalId(),null),d=null,_=null;this.state.options_is_valid&&(d=i.a.createElement("div",{className:n.length?"rudex-options":"rudex-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),_=i.a.createElement(C.Modal,{closable:!1,footer:[i.a.createElement(C.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},m.a.translate("modal.confirmation.accept")),i.a.createElement(C.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},m.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},i.a.createElement("label",null,i.a.createElement(r.a,{content:"modal.confirmation.title"})))));var y=1,g=null;this.props.output_supports_memos&&(g=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(r.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:y++,onChange:this.onMemoChanged.bind(this)})));var w=this._getAvailableAssets().fee_asset_types;if(l.length>0){var v=this.props.asset.get("id");if(v){var b=o[v];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(r.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},b?i.a.createElement(p.a,{balance:o[v]}):0))}else s="No funds"}else s="No funds";return i.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:"0px"}},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement(h.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.insufficient"})):null,this.state.minAmountError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.rudex.min_amount_error"})):null,i.a.createElement("p",{className:"no-margin",style:{paddingTop:10}},i.a.createElement("b",null,i.a.createElement(r.a,{content:"gateway.rudex.min_amount",minAmount:u.a.format_number(this.props.min_amount/u.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1),symbol:this.props.output_coin_symbol})))),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(h.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:w,tabIndex:y++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"rudex-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"rudex-position-options"},d),c),g,i.a.createElement("div",null,i.a.createElement(C.Button,{disabled:this.state.error||this.state.balanceError||this.state.minAmountError,type:"primary",onClick:this.onSubmit.bind(this)},m.a.translate("modal.withdraw.submit")),i.a.createElement(C.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},m.a.translate("account.perm.cancel"))),_))}}]),a}();A.propTypes={account:l.a.ChainAccount.isRequired,issuer:l.a.ChainAccount.isRequired,asset:l.a.ChainAsset.isRequired,output_coin_name:k.a.string.isRequired,output_coin_symbol:k.a.string.isRequired,output_coin_type:k.a.string.isRequired,url:k.a.string,output_wallet_type:k.a.string,output_supports_memos:k.a.bool.isRequired,amount_to_withdraw:k.a.string,balance:l.a.ChainObject,min_amount:k.a.number,gateFee:k.a.number},t.a=Object(c.a)(Object(y.a)(A,{listenTo:function(){return[g.a]},getProps:function(e){return{fee_asset_symbol:g.a.getState().settings.get("fee_asset")}}}))}).call(this,a(124).Buffer)},2206:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(0),i=a.n(s),o=a(2),r=a.n(o),l=a(44),c=a(48),u=a(16),p=a(369),d=a(5),m=a.n(d),h=a(2016),_=a(41),f=a(83),y=a(30),g=a(21),w=a(6),v=a(210),b=a(39),E=a(4),k=a(1),C=a.n(k),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={isConfirmationModalVisible:!1,withdraw_amount:t.props.amount_to_withdraw,withdraw_address:f.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:f.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:w.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t.showConfirmationModal=t.showConfirmationModal.bind(t),t.hideConfirmationModal=t.hideConfirmationModal.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),S(a,[{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},fee_asset_id:"1.3.0",feeAmount:new b.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(v.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(v.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),u.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=f.a.get(this.props.output_wallet_type)[e];f.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(f.m)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(v.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state.feeAmount,i=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),o=void 0!==this.props.gateFee?parseFloat(String.prototype.replace.call(this.props.gateFee,/,/g,"")):0,r=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:i}),l=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:0});void 0!==this.props.balance&&(l=r.clone(this.props.balance.get("balance")));var c=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:o});r.plus(c),l.lt(r)&&(r=l),_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),r.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,s?s.asset_id:"1.3.0"),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=u.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state.feeAmount;_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,o?o.asset_id:"1.3.0")}},{key:"onDropDownList",value:function(){f.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new b.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(u.a.sortID),s){var o=w.ChainStore.getObject(i),r=w.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new b.i({base:new b.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new b.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=f.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),c=(this.getWithdrawModalId(),null),u=null,d=null;this.state.options_is_valid&&(u=i.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),d=i.a.createElement(E.Modal,{closable:!1,footer:[i.a.createElement(E.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},m.a.translate("modal.confirmation.accept")),i.a.createElement(E.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},m.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},i.a.createElement("label",null,i.a.createElement(r.a,{content:"modal.confirmation.title"})))));var _=1,y=null;this.props.output_supports_memos&&(y=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(r.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:_++,onChange:this.onMemoChanged.bind(this)})));var g=this._getAvailableAssets().fee_asset_types;if(l.length>0){var w=this.props.asset.get("id");if(w){var v=o[w];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(r.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},v?i.a.createElement(p.a,{balance:o[w]}):0))}else s="No funds"}else s="No funds";var b=this.state.error||this.state.balanceError||!this.state.withdraw_amount;return i.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement(h.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.insufficient"})):null),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(h.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:g,tabIndex:_++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"blocktrades-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"blocktrades-position-options"},u),c),y,i.a.createElement("div",null,i.a.createElement(E.Button,{type:"primary",disabled:b,onClick:this.onSubmit.bind(this)},m.a.translate("modal.withdraw.submit")),i.a.createElement(E.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},m.a.translate("account.perm.cancel"))),d))}}]),a}();A.propTypes={account:l.a.ChainAccount.isRequired,issuer:l.a.ChainAccount.isRequired,asset:l.a.ChainAsset.isRequired,output_coin_name:C.a.string.isRequired,output_coin_symbol:C.a.string.isRequired,output_coin_type:C.a.string.isRequired,url:C.a.string,output_wallet_type:C.a.string,output_supports_memos:C.a.bool.isRequired,amount_to_withdraw:C.a.string,balance:l.a.ChainObject},t.a=Object(c.a)(Object(y.a)(A,{listenTo:function(){return[g.a]},getProps:function(e){return{fee_asset_symbol:g.a.getState().settings.get("fee_asset")}}}))}).call(this,a(124).Buffer)},2229:function(e,t){},2230:function(e,t){},2288:function(e,t,a){"use strict";(function(e){var n=a(2018),s=a(0),i=a.n(s),o=a(2),r=a.n(o),l=a(44),c=a(48),u=a(16),p=a(369),d=a(5),m=a.n(d),h=a(2016),_=a(41),f=a(2120),y=a(30),g=a(21),w=a(6),v=a(210),b=a(39),E=a(4),k=a(1),C=a.n(k),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(t){function a(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,e));return t.state={isConfirmationModalVisible:!1,withdraw_amount:t.props.amount_to_withdraw,withdraw_address:f.a.getLast(e.output_wallet_type),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,confirmation_is_valid:!1,withdraw_address_selected:f.a.getLast(e.output_wallet_type),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,from_account:e.account,fee_asset_id:w.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{}},t._validateAddress(t.state.withdraw_address,e),t._checkBalance=t._checkBalance.bind(t),t._checkMinAmount=t._checkMinAmount.bind(t),t._updateFee=Object(n.a)(t._updateFee.bind(t),250),t.showConfirmationModal=t.showConfirmationModal.bind(t),t.hideConfirmationModal=t.hideConfirmationModal.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(a,i.a.Component),S(a,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},feeAmount:new b.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(v.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(v.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_type+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),u.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},function(){this._checkBalance,this._checkMinAmount()})}},{key:"onSelectChanged",value:function(e){var t=f.a.get(this.props.output_wallet_type)[e];f.a.setLast({wallet:this.props.output_wallet_type,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(f.c)({url:a.url,walletType:a.output_wallet_type,newAddress:e}).then(function(a){t.state.withdraw_address===e&&t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:a})})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance;if(i&&t){var o=Object(v.a)(a,s,t,i);if(null!==o)return this.setState({balanceError:!o}),o}}},{key:"_checkMinAmount",value:function(){var e=this.state.withdraw_amount;if(null!==e){var t=e<this.props.min_amount/u.a.get_asset_precision(this.props.asset_precision);return this.setState({minAmountError:t}),t}}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=this.state,i=s.feeAmount,o=s.fee_asset_id,r=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),l=new b.a({asset_id:n.get("id"),precision:n.get("precision"),real:r});_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),l.getAmount(),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,i?i.asset_id:o),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),f.a.has(this.props.output_wallet_type)){var t=f.a.get(this.props.output_wallet_type);-1==t.indexOf(this.state.withdraw_address)&&(t.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:t}))}else{var a=[];a.push(this.state.withdraw_address),f.a.set({wallet:this.props.output_wallet_type,addresses:a})}f.a.setLast({wallet:this.props.output_wallet_type,address:this.state.withdraw_address});var n=this.props.asset,s=u.a.get_asset_precision(n.get("precision")),i=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),o=this.state,r=o.feeAmount,l=o.fee_asset_id;_.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(i*s,10),n.get("id"),this.props.output_coin_type+":"+this.state.withdraw_address+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,r?r.asset_id:l)}},{key:"onDropDownList",value:function(){f.a.has(this.props.output_wallet_type)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new b.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(u.a.sortID),s){var o=w.ChainStore.getObject(i),r=w.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var l=!1;try{l=new b.i({base:new b.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new b.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){l=!1}"1.3.0"===o.get("id")||l||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=f.a.get(this.props.output_wallet_type),s=null,o=this.props.account.get("balances").toJS(),l=Object.keys(o),c=(this.getWithdrawModalId(),null),d=null,_=null;this.state.options_is_valid&&(d=i.a.createElement("div",{className:n.length?"rudex-options":"rudex-disabled-options"},n.map(function(e,t){return i.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(c=i.a.createElement("div",{className:"has-error",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_type})),_=i.a.createElement(E.Modal,{closable:!1,footer:[i.a.createElement(E.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},m.a.translate("modal.confirmation.accept")),i.a.createElement(E.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},m.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},i.a.createElement("label",null,i.a.createElement(r.a,{content:"modal.confirmation.title"})))));var y=1,g=null;this.props.output_supports_memos&&(g=i.a.createElement("div",{className:"content-block"},i.a.createElement("label",null,i.a.createElement(r.a,{component:"span",content:"transfer.memo"})),i.a.createElement("textarea",{rows:"3",value:a,tabIndex:y++,onChange:this.onMemoChanged.bind(this)})));var w=this._getAvailableAssets().fee_asset_types;if(l.length>0){var v=this.props.asset.get("id");if(v){var b=o[v];s=i.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},i.a.createElement(r.a,{component:"span",content:"transfer.available"})," : ",i.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},b?i.a.createElement(p.a,{balance:o[v]}):0))}else s="No funds"}else s="No funds";var k=u.a.format_number(this.props.min_amount/u.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1),C=this.props.withdraw_fee?u.a.format_number(this.props.withdraw_fee/u.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1):null;return i.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},i.a.createElement("div",{className:"grid-container"},i.a.createElement("div",{className:"content-block"},i.a.createElement(h.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:s}),this.state.empty_withdraw_value?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.insufficient"})):null,this.state.minAmountError?i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"gateway.xbtsx.min_amount_error"})):null,i.a.createElement("p",{className:"no-margin",style:{paddingTop:10}},i.a.createElement("b",null,i.a.createElement(r.a,{content:"gateway.xbtsx.min_amount",minAmount:k,symbol:this.props.output_coin_symbol})))),this.state.feeAmount?i.a.createElement("div",{className:"content-block gate_fee"},i.a.createElement(h.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:w,tabIndex:y++}),this.state.hasBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:i.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},i.a.createElement(r.a,{content:"transfer.errors.noPoolBalance"}))):null,C?i.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{content:"gateway.fee"})),i.a.createElement("div",{className:"inline-label input-wrapper"},i.a.createElement("input",{type:"text",disabled:!0,value:C}),i.a.createElement("div",{className:"form-label select floating-dropdown"},i.a.createElement("div",{className:"dropdown-wrapper inactive"},i.a.createElement("div",null,this.props.output_coin_symbol))))):null,i.a.createElement("div",{className:"content-block"},i.a.createElement("label",{className:"left-label"},i.a.createElement(r.a,{component:"span",content:"modal.withdraw.address"})),i.a.createElement("div",{className:"rudex-select-dropdown"},i.a.createElement("div",{className:"inline-label"},i.a.createElement("input",{type:"text",spellcheck:"false",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),i.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),i.a.createElement("div",{className:"rudex-position-options"},d),c),g,i.a.createElement("div",null,i.a.createElement(E.Button,{type:"primary",disabled:this.state.error||this.state.balanceError||this.state.minAmountError,onClick:this.onSubmit.bind(this)},m.a.translate("modal.withdraw.submit")),i.a.createElement(E.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},m.a.translate("account.perm.cancel"))),_))}}]),a}();A.propTypes={account:l.a.ChainAccount.isRequired,issuer:l.a.ChainAccount.isRequired,asset:l.a.ChainAsset.isRequired,output_coin_name:C.a.string.isRequired,output_coin_symbol:C.a.string.isRequired,output_coin_type:C.a.string.isRequired,url:C.a.string,output_wallet_type:C.a.string,output_supports_memos:C.a.bool.isRequired,amount_to_withdraw:C.a.string,balance:l.a.ChainObject,min_amount:C.a.number,withdraw_fee:C.a.number},t.a=Object(c.a)(Object(y.a)(A,{listenTo:function(){return[g.a]},getProps:function(e){return{fee_asset_symbol:g.a.getState().settings.get("fee_asset")}}}),{keep_updating:!0})}).call(this,a(124).Buffer)},2331:function(e,t,a){"use strict";a.r(t);var n=a(0),s=a.n(n),i=a(30),o=a(102),r=a(106),l=a(16),c=a(2),u=a.n(c),p=a(44),d=a(48),m=a(6),h=a(2092),_=a(2035),f=a(97),y=a(126),g=a(83),w=a(46),v=a(40),b=a(11),E=a.n(b),k=a(1),C=a.n(k),S=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var A=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a._handleCopy=a._handleCopy.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),S(t,[{key:"componentDidMount",value:function(){this.childRef&&(this.node=E.a.findDOMNode(this.childRef)),this.node&&this.node.addEventListener&&this.node.addEventListener("copy",this._handleCopy)}},{key:"componentWillUnmount",value:function(){this.node&&this.node.removeEventListener&&this.node.removeEventListener("copy",this._handleCopy)}},{key:"_handleCopy",value:function(e){!1!==this.props.disableCopy&&(this.props.replaceCopyText&&e.clipboardData.setData("text/plain",this.props.replaceCopyText),e.preventDefault())}},{key:"render",value:function(){var e=this;return s.a.createElement("span",{ref:function(t){return e.childRef=t}},this.props.children)}}]),t}();A.propTypes={disableCopy:C.a.bool,replaceCopyText:C.a.string};var O=A,N=a(5),x=a.n(N),T=a(2072),j=a.n(T),M=a(4),I=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var B=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n={blocktrades:w.b.BASE,openledger:w.h.BASE};return a.state={isModalVisible:!1,receive_address:null,url:e.url||n[e.gateway],loading:!1,emptyAddressDeposit:!1},a.addDepositAddress=a.addDepositAddress.bind(a),a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),I(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),url:this.state.url,stateCallback:this.addDepositAddress}}},{key:"componentWillMount",value:function(){Object(g.j)({coin:this.props.receive_coin_type,account:this.props.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"componentWillReceiveProps",value:function(e){e.account!==this.props.account&&Object(g.j)({coin:e.receive_coin_type,account:e.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"addDepositAddress",value:function(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e}),this.setState({loading:!1}),this.setState({receive_address:e})}},{key:"requestDepositAddressLoad",value:function(){this.setState({loading:!0,emptyAddressDeposit:!1}),Object(g.l)(this._getDepositObject())}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"render",value:function(){var e="deposit"===this.props.action,t=s.a.createElement(v.a,null);if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return t;var a=this.props.account.get("balances"),n=this.props.gateFee;this.props.receive_asset.get("symbol");if(this.props.deprecated_in_favor_of){var i=!1,o=a.get(this.props.receive_asset.get("id"));if(o){var r=m.ChainStore.getObject(o);if(r)0!=r.get("balance")&&(i=!0)}if(!i)return t}var l=this.state.receive_address,c=this.state.emptyAddressDeposit,p=this.state.loading;if(!l)return s.a.createElement("div",{style:{margin:"3rem"}},s.a.createElement(v.a,{type:"three-bounce"}));var d=this.getWithdrawModalId(),g=null,w=null,b=null,E="",k=void 0;if(this.props.deposit_account){g=s.a.createElement("span",null,this.props.deposit_account),w=this.props.deposit_account,E=this.props.receive_coin_type+":"+this.props.account.get("name"),b=s.a.createElement("span",null,E);var C=this.props.deposit_coin_type+":"}else{w=l&&l.address||"",l.memo?(k=l.memo,E=l.address,g=s.a.createElement("span",null,l.address),b=s.a.createElement("span",null,l.memo)):(E=l.address,g=s.a.createElement("span",null,l.address));C=""}return!this.props.isAvailable||e&&!this.props.deposit_account&&!l||l&&"unknown"===l.address?s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"})):e?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"fz_12 left-label"},s.a.createElement(u.a,{content:"gateway.deposit_notice_delay"})),s.a.createElement("div",null,c?s.a.createElement(u.a,{content:"gateway.please_generate_address"}):s.a.createElement(O,{replaceCopyText:x.a.translate("gateway.use_copy_button")},g),s.a.createElement("div",null,b&&s.a.createElement("span",null,"memo: ",b)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},g?s.a.createElement(j.a,{text:w},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"gateway.copy_address"}))):null,k?s.a.createElement(j.a,{text:k},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"gateway.copy_memo"}))):null,s.a.createElement("button",{className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this)},p?s.a.createElement(v.a,{type:"circle"}):null,s.a.createElement(u.a,{content:"gateway.generate_new"}))),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset})))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(M.Modal,{onCancel:this.hideModal,title:x.a.translate("gateway.withdraw_coin",{coin:this.props.deposit_asset_name,symbol:this.props.deposit_asset}),footer:null,visible:this.state.isModalVisible,id:d,overlay:!0},s.a.createElement(h.a,{hideModal:this.hideModal,showModal:this.showModal,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),url:this.state.url,output_coin_name:this.props.deposit_asset_name,gateFee:n,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:C,modal_id:d,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]})))}}]),t}();B.propTypes={url:C.a.string,gateway:C.a.string,deposit_coin_type:C.a.string,deposit_asset_name:C.a.string,deposit_account:C.a.string,receive_coin_type:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:C.a.string,deposit_wallet_type:C.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:C.a.string,action:C.a.string,supports_output_memos:C.a.bool.isRequired},B.defaultProps={autosubscribe:!1};var P=Object(d.a)(B),D=a(21),F=a(22),R=a(2037),W=a(9),q=a.n(W),L=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var U=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),L(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_"+e.provider+"_"+t.action,null),n=null;return"blocktrades"==e.provider&&"deposit"==t.action&&(n="BTC"),"openledger"==e.provider&&"deposit"==t.action&&(n="BTC"),"blocktrades"==e.provider&&"withdraw"==t.action&&(n="TRADE.BTC"),"openledger"==e.provider&&"withdraw"==t.action&&(n="OPEN.BTC"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,F.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),F.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=t.provider,o=this.state,r=o.activeCoin,l=o.action;if(!a.length)return s.a.createElement(v.a,null);var c=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===l?e.depositAllowed:e.withdrawalAllowed)}),p=c.map(function(e){var t="deposit"===l?e.backingCoinType.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),d=c.filter(function(e){return"deposit"===l?e.backingCoinType.toUpperCase()===r:e.symbol===r})[0];d||(d=c[0]);var m={blocktrades:{name:"blocktrades",id:"1.2.32567",support:"support@blocktrades.us"},openledger:{name:d.intermediateAccount,id:"1.2.96397",support:"https://dex.openledger.io"}}[i],h="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+l}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:r},p))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),d?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(P,{key:i+"."+d.symbol,gateway:i,issuer_account:m.name,account:n,deposit_asset:d.backingCoinType.toUpperCase(),deposit_asset_name:d.name,deposit_coin_type:d.backingCoinType.toLowerCase(),deposit_account:d.depositAccount,deposit_wallet_type:d.walletType,gateFee:d.gateFee,receive_asset:d.symbol,receive_coin_type:d.symbol.toLowerCase(),supports_output_memos:d.supportsMemos,isAvailable:d.isAvailable,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:(-1===m.support.indexOf("@")?"":"mailto:")+m.support,rel:"noopener noreferrer",className:-1===m.support.indexOf("@")?"external-link":""},m.support))),d&&d.symbol?s.a.createElement(R.b,{asset:d.symbol,fromAccount:h?m.id:this.props.account.get("id"),to:h?this.props.account.get("id"):m.id},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(R.a,{accountsList:q.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),V=Object(i.a)(U,{listenTo:function(){return[D.a]},getProps:function(){return{viewSettings:D.a.getState().viewSettings}}}),H=a(20),J=a(886),z=a(880),X=a.n(z),G=a(147),K=a.n(G),Q=a(369),Y=a(2016),Z=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var $=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={deposit_amount:null,deposit_info:null,deposit_error:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Z(t,[{key:"onDepositAmountChange",value:function(e){var t=e.amount;e.asset;this.setState({deposit_amount:t})}},{key:"onSubmitDeposit",value:function(){var e=this,t=this.props.receive_asset,a=(l.a.get_asset_precision(t.get("precision")),this.state.deposit_amount.replace(/,/g,""));console.log("deposit_amount: ",a);var n={jsonrpc:"2.0",method:"getDepositAccount",params:{bitsharesAccountName:this.props.account.get("name"),currency:this.props.deposit_asset,amount:a},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(n))}).then(function(e){return e.json()}).then(function(t){"result"in t?e.setState({deposit_info:t.result}):"error"in json_reponse&&"message"in t.error?e.setState({deposit_error:t.error.message}):e.setState({deposit_error:"Unable to approve deposit, please contact OpenLedger or try again later"})}).catch(function(t){e.setState({deposit_error:"Unable to approve deposit, please contact OpenLedger or try again later"})})}},{key:"onClose",value:function(){this.setState({deposit_amount:null,deposit_info:null,deposit_error:null}),K.a.publish(this.props.modal_id,"close")}},{key:"render",value:function(){if(this.state.deposit_error)return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Error")),s.a.createElement("div",{className:"content-block"},s.a.createElement("p",null,this.state.deposit_error)),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:"Close"}))));if(this.state.deposit_info){if("link"in this.state.deposit_info)return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Information")),s.a.createElement("div",{className:"content-block"},s.a.createElement("p",null,"Click"," ",s.a.createElement("a",{href:this.state.deposit_info.link,rel:"noopener noreferrer",target:"_blank"},"here")," ","for deposit instructions")),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:"Close"}))));var e=[];for(var t in this.state.deposit_info)this.state.deposit_info.hasOwnProperty(t)&&e.push(s.a.createElement("tr",null,s.a.createElement("td",null,t),s.a.createElement("td",null,this.state.deposit_info[t])));return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit Information")),s.a.createElement("div",{className:"content-block"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,e))),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onClose.bind(this),value:x.a.translate("account.perm.cancel")}))))}return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Deposit ",this.props.deposit_asset)),s.a.createElement("div",{className:"content-block"},s.a.createElement(Y.a,{label:"modal.deposit.amount",amount:this.state.deposit_amount,asset:this.props.receive_asset.get("id"),assets:[this.props.receive_asset.get("id")],placeholder:"0.0",onChange:this.onDepositAmountChange.bind(this),display_balance:null})),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmitDeposit.bind(this),value:x.a.translate("modal.deposit.submit")}),s.a.createElement("input",{type:"submit",className:" button",onClick:this.onClose.bind(this),value:x.a.translate("account.perm.cancel")}))))}}]),t}();$.propTypes={account:p.a.ChainAccount.isRequired,issuer_account:p.a.ChainAccount.isRequired,deposit_asset:C.a.string,receive_asset:p.a.ChainAsset.isRequired,rpc_url:C.a.string};var ee=Object(d.a)($),te=a(41),ae=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var ne=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={withdraw_amount:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ae(t,[{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;e.asset;this.setState({withdraw_amount:t})}},{key:"onSubmit",value:function(){var e=this,t=this.props.receive_asset,a=l.a.get_asset_precision(t.get("precision")),n=this.state.withdraw_amount.replace(/,/g,""),s={jsonrpc:"2.0",method:"getMemoForFiatWithdrawal",params:{bitsharesAccountName:this.props.account.get("name"),currency:this.props.deposit_asset,amount:n},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(s))}).then(function(e){return e.json()}).then(function(s){if(!("result"in s))throw"error"in s&&"message"in s.error?json_repsonse.error.message:"Unable to approve withdrawal, please contact OpenLedger or try again later";te.a.transfer(e.props.account.get("id"),e.props.issuer_account.get("id"),parseInt(n*a,10),t.get("id"),s.result)}).catch(function(e){alert(e)})}},{key:"render",value:function(){var e=null,t=this.props.account.get("balances").toJS();if(Object.keys(t).length>0){var a=this.props.receive_asset.get("id");e=a?s.a.createElement("span",null,s.a.createElement(u.a,{component:"span",content:"transfer.available"}),":"," ",s.a.createElement(Q.a,{balance:t[a]})):"No funds"}else e="No funds";return s.a.createElement("form",{className:"grid-block vertical full-width-content"},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement("h3",null,"Withdraw ",this.props.deposit_asset)),s.a.createElement("div",{className:"content-block"},s.a.createElement(Y.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.receive_asset.get("id"),assets:[this.props.receive_asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:e})),s.a.createElement("div",{className:"content-block"},s.a.createElement("input",{type:"submit",className:"button",onClick:this.onSubmit.bind(this),value:x.a.translate("modal.withdraw.submit")}),s.a.createElement(X.a,{close:this.props.modal_id},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"account.perm.cancel"}))))))}}]),t}();ne.propTypes={account:p.a.ChainAccount.isRequired,issuer_account:p.a.ChainAccount.isRequired,deposit_asset:C.a.string,receive_asset:p.a.ChainAsset.isRequired,rpc_url:C.a.string};var se=Object(d.a)(ne),ie=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function le(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var ce=function(e){function t(e){oe(this,t);var a=re(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={},a}return le(t,s.a.Component),ie(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_fiat_openledger_"+this.props.receive_asset.get("symbol")}},{key:"getDepositModalId",value:function(){return"deposit_fiat_openledger_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){K.a.publish(this.getWithdrawModalId(),"open")}},{key:"onDeposit",value:function(){K.a.publish(this.getDepositModalId(),"open")}},{key:"render",value:function(){if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return s.a.createElement("tr",{style:{display:"none"}},s.a.createElement("td",null),s.a.createElement("td",null),s.a.createElement("td",null),s.a.createElement("td",null));H.a.getWallet();var e=this.props.account.get("balances"),t=(this.props.receive_asset.get("symbol"),e.toJS());if(Object.keys(t).length>0){var a=this.props.receive_asset.get("id");a&&s.a.createElement("span",null,s.a.createElement(u.a,{component:"span",content:"transfer.available"}),":"," ",s.a.createElement(Q.a,{balance:t[a]}))}var n=this.getDepositModalId(),i=this.getWithdrawModalId(),o=null;o=this.props.deposit_allowed?s.a.createElement("td",null,s.a.createElement("button",{className:"button outline",onClick:this.onDeposit.bind(this)}," ",s.a.createElement(u.a,{content:"gateway.deposit"})," "),s.a.createElement(J.a,{id:n,overlay:!0},s.a.createElement(X.a,{close:n},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(ee,{account:this.props.account.get("name"),issuer_account:this.props.issuer_account.get("name"),receive_asset:this.props.receive_asset.get("symbol"),rpc_url:this.props.rpc_url,deposit_asset:this.props.deposit_asset,modal_id:n})))):s.a.createElement("td",null,"Click"," ",s.a.createElement("a",{href:"https://openledger.info/v/",rel:"noopener noreferrer",target:"_blank",className:"external-link"},"here")," ","to register for deposits of ",this.props.deposit_asset);var r=null;return r=this.props.withdraw_allowed?s.a.createElement("td",null,s.a.createElement("button",{className:"button outline",onClick:this.onWithdraw.bind(this)}," ",s.a.createElement(u.a,{content:"gateway.withdraw"})," "),s.a.createElement(J.a,{id:i,overlay:!0},s.a.createElement(X.a,{close:i},s.a.createElement("a",{href:"#",className:"close-button"},"×")),s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(se,{account:this.props.account.get("name"),issuer_account:this.props.issuer_account.get("name"),receive_asset:this.props.receive_asset.get("symbol"),rpc_url:this.props.rpc_url,deposit_asset:this.props.deposit_asset,modal_id:i})))):s.a.createElement("td",null,"Click"," ",s.a.createElement("a",{href:"https://openledger.info/v/",rel:"noopener noreferrer",target:"_blank",className:"external-link"},"here")," ","to register for withdrawals of ",this.props.deposit_asset),s.a.createElement("tr",null,s.a.createElement("td",null,this.props.deposit_asset),o,s.a.createElement("td",null,s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol")})),r)}}]),t}();ce.propTypes={url:C.a.string,gateway:C.a.string,deposit_coin_type:C.a.string,deposit_asset_name:C.a.string,deposit_account:C.a.string,receive_coin_type:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:C.a.string,receive_asset:p.a.ChainAsset,deposit_allowed:C.a.bool,withdraw_allowed:C.a.bool},ce=Object(d.a)(ce);var ue=function(e){function t(e){oe(this,t);var a=re(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));a.state={allowedFiatCurrencies:{deposit:[],withdraw:[]}};var n={jsonrpc:"2.0",id:1,method:"isValidatedForFiat",params:{bitsharesAccountName:a.props.account.get("name")}};return fetch(a.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(n))}).then(function(e){return e.json()}).then(function(e){"result"in e&&a.setState({allowedFiatCurrencies:e.result})}).catch(function(e){a.setState({allowedFiatCurrencies:{deposit:[],withdraw:[]}})}),a}return le(t,s.a.Component),ie(t,[{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer)}},{key:"render",value:function(){return this.props.account&&this.props.issuer_account,s.a.createElement("div",null)}}]),t}();ue.propTypes={rpc_url:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount};var pe=ue=Object(d.a)(ue),de=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var me=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={current_status:"never_loaded",withdrawals:null,deposits:null,error:null},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),de(t,[{key:"onShowOpenLedgerTransactionHistory",value:function(){var e=this,t={jsonrpc:"2.0",method:"getRequestsList",params:{bitsharesAccountName:this.props.account.get("name")},id:1};fetch(this.props.rpc_url,{method:"POST",headers:new Headers({Accept:"application/json","content-type":"application/x-www-form-urlencoded"}),body:"rq="+encodeURIComponent(JSON.stringify(t))}).then(function(e){return e.json()}).then(function(t){if(!("result"in t))throw"error"in t&&"message"in t.error?json_repsonse.error.message:"Unexpected response";e.setState({current_status:"loaded",withdrawals:t.result.withdrawals,deposits:t.result.deposits,error:null})}).catch(function(t){e.setState({current_status:"error",withdrawals:null,deposits:null,error:"Error getting transaction history: "+t})})}},{key:"render",value:function(){if(!this.props.account)return null;var e=null;if("loaded"===this.state.current_status){var t=[];if(this.state.withdrawals.length){for(var a=0;a<this.state.withdrawals.length;++a)t.push(s.a.createElement("tr",null,s.a.createElement("td",null,this.state.withdrawals[a].amount," ",this.state.withdrawals[a].currency),s.a.createElement("td",null,this.state.withdrawals[a].status)));e=s.a.createElement("table",{className:"table"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.withdraw_amount"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.status"})))),s.a.createElement("tbody",null,t))}else e=s.a.createElement(u.a,{component:"p",content:"openledger.withdraw_none"})}var n=null;if("loaded"===this.state.current_status)if(this.state.deposits.length){var i=[];for(a=0;a<this.state.deposits.length;++a)i.push(s.a.createElement("tr",null,s.a.createElement("td",null,this.state.deposits[a].amount," ",this.state.deposits[a].currency),s.a.createElement("td",null,s.a.createElement("a",{href:this.state.deposits[a].link,rel:"noopener noreferrer",target:"_blank"},"link")),s.a.createElement("td",null,this.state.deposits[a].status)));n=s.a.createElement("table",{className:"table"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.deposit_amount"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.deposit_details"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"openledger.status"})))),s.a.createElement("tbody",null,i))}else n=s.a.createElement(u.a,{component:"p",content:"openledger.deposit_none"});var o=null;if("error"===this.state.current_status)o=s.a.createElement("div",{className:"content-block"},s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this)},s.a.createElement(u.a,{content:"openledger.retry"})),s.a.createElement("p",null,this.state.error));else if("loading"===this.state.current_status)o=s.a.createElement("div",{className:"content-block"},s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this),disabled:"true"},s.a.createElement(u.a,{content:"openledger.show_transaction_history"})),s.a.createElement(u.a,{component:"p",content:"openledger.loading"}));else{var r="never_loaded"===this.state.current_status?s.a.createElement(u.a,{content:"openledger.show_transaction_history"}):s.a.createElement(u.a,{content:"openledger.refresh_transaction_history"});o=s.a.createElement("div",{className:"content-block"},s.a.createElement("br",null),s.a.createElement(u.a,{component:"h4",content:"openledger.header_transaction_history"}),s.a.createElement("button",{className:"button outline",onClick:this.onShowOpenLedgerTransactionHistory.bind(this)},r),e,n)}return o}}]),t}();me.propTypes={rpc_url:C.a.string,account:p.a.ChainAccount};var he=Object(d.a)(me),_e=a(2199),fe=a(2204),ye=a(58),ge=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var we=new ye.a("__bts__"),ve=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_citadel_address_cache_version_string="2"}return ge(e,[{key:"getIndexForDepositKeyInExchange",value:function(e,t,a){return[this.current_citadel_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a,n){var s=H.a.getWallet(),i=this.getIndexForDepositKeyInExchange(t,a,n);if(s){s.deposit_keys=s.deposit_keys||{},s.deposit_keys[e]=s.deposit_keys[e]||{},s.deposit_keys[e][i]=s.deposit_keys[e][i]||[];var o=s.deposit_keys[e][i].length;return o?s.deposit_keys[e][i][o-1]:null}var r=we.get("deposit_keys",{});r[e]=r[e]||{},r[e][i]=r[e][i]||[];var l=r[e][i].length;return l?r[e][i][l-1]:null}},{key:"cacheInputAddress",value:function(e,t,a,n,s,i){if(s){var o=H.a.getWallet(),r=this.getIndexForDepositKeyInExchange(t,a,n);if(o)delete o.deposit_keys.undefined,Object.keys(o.deposit_keys||{}).forEach(function(e){for(var t in o.deposit_keys[e])if(o.deposit_keys[e][t]&&o.deposit_keys[e][t].length)for(var a=o.deposit_keys[e][t].length-1;a>=0;a--)o.deposit_keys[e][t][a]&&"unknown"===o.deposit_keys[e][t][a].address&&o.deposit_keys[e][t].splice(a,1)}),o.deposit_keys=o.deposit_keys||{},o.deposit_keys[e]=o.deposit_keys[e]||{},o.deposit_keys[e][r]=o.deposit_keys[e][r]||[],o.deposit_keys[e][r].push({address:s,memo:i}),H.a._updateWallet();else{var l=we.get("deposit_keys",{});l[e]=l[e]||{},l[e][r]=l[e][r]||[],l[e][r].push({address:s,memo:i}),we.set("deposit_keys",l)}}}}]),e}(),be=(a(76),a(210)),Ee=a(39),ke=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,s=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(n=(o=r.next()).done)&&(a.push(o.value),!t||a.length!==t);n=!0);}catch(e){s=!0,i=e}finally{try{!n&&r.return&&r.return()}finally{if(s)throw i}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Ce=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function Se(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function Ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oe(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Ne(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var xe=function(e){function t(){return Ae(this,t),Oe(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Ne(t,s.a.Component),Ce(t,[{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){this.props.showModal()}},{key:"render",value:function(){var e=this.getWithdrawModalId(),t="button disabled";return Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))&&this.props.amount_to_withdraw&&!(this.props.amount_to_withdraw.indexOf(" ")>=0)&&!isNaN(this.props.amount_to_withdraw)&&this.props.amount_to_withdraw>0&&this.props.amount_to_withdraw<=this.props.balance.toJS().balance/l.a.get_asset_precision(this.props.asset.get("precision"))&&(t="button"),s.a.createElement("span",null,s.a.createElement("span",null,s.a.createElement("button",{className:t,onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:""}),s.a.createElement(u.a,{content:"gateway.withdraw_now"})," ")),s.a.createElement(M.Modal,{title:x.a.translate("gateway.withdraw_coin",{coin:this.props.output_coin_name,symbol:this.props.output_coin_symbol}),visible:this.props.visible,onCancel:this.props.hideModal,footer:null},s.a.createElement(fe.a,{showModal:this.props.showModal,hideModal:this.props.hideModal,key:""+this.props.key,account:this.props.account.get("name"),issuer:this.props.issuer,asset:this.props.asset.get("id"),output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,modal_id:e,url:this.props.url,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]})))}}]),t}();xe.propTypes={balance:p.a.ChainObject,url:C.a.string.isRequired},xe=Object(d.a)(xe);var Te=function(e){function t(){return Ae(this,t),Oe(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Ne(t,s.a.Component),Ce(t,[{key:"render",value:function(){var e=s.a.createElement(xe,{showModal:this.props.showModal,hideModal:this.props.hideModal,visible:this.props.visible,key:this.props.key,account:this.props.account,issuer:this.props.issuer,asset:this.props.asset,output_coin_name:this.props.output_coin_name,output_coin_symbol:this.props.output_coin_symbol,output_coin_type:this.props.output_coin_type,output_supports_memos:this.props.output_supports_memos,amount_to_withdraw:this.props.amount_to_withdraw,url:this.props.url,gateway:this.props.gateway,output_wallet_type:this.props.output_wallet_type,balance:this.props.account.get("balances").toJS()[this.props.asset.get("id")]});return s.a.createElement("span",null,e)}}]),t}();Te.propTypes={account:p.a.ChainAccount.isRequired,asset:p.a.ChainAsset.isRequired,output_coin_type:C.a.string.isRequired,url:C.a.string.isRequired},Te=Object(d.a)(Te);var je=function(e){function t(e){Ae(this,t);var a=Oe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.refresh_interval=12e4,a.deposit_address_cache=new ve,a.coin_info_request_states={request_in_progress:0,request_complete:1,request_failed:2},a.estimation_directions={output_from_input:0,input_from_output:1},a.state={isModalVisible:!1,coin_symbol:"xmr",key_for_withdrawal_dialog:"xmr",supports_output_memos:"",url:w.c.BASE,error:null,deposit_input_coin_type:null,deposit_output_coin_type:null,input_address_and_memo:null,deposit_estimated_input_amount:a.props.initial_deposit_estimated_input_amount||"1.0",deposit_estimated_output_amount:null,deposit_limit:null,deposit_error:null,failed_calculate_deposit:null,withdraw_input_coin_type:null,withdraw_output_coin_type:null,withdraw_estimated_input_amount:a.props.initial_withdraw_estimated_input_amount||"1.0",withdraw_estimated_output_amount:null,withdraw_limit:null,withdraw_error:null,failed_calculate_withdraw:null,coin_info_request_state:a.coin_info_request_states.request_in_progress,input_address_requests_in_progress:{},deposit_estimate_direction:a.estimation_directions.output_from_input,deposit_limit_cache:{},deposit_limit_requests_in_progress:{},coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null,announcements:[]},a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),a}return Ne(t,s.a.Component),Ce(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"urlConnection",value:function(e,t){var a=this;this.setState({url:e});var n=fetch(e+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),s=fetch(e+"/wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),i=fetch(e+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),o=fetch(e+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([n,s,i,o]).then(function(e){var t=ke(e,4),n=t[0],s=(t[1],t[2]),i=t[3],o={};n.forEach(function(e){return o[e.coinType]=e});var r={},l={};s.forEach(function(e){var t=o[e.inputCoinType],a=o[e.outputCoinType];(t.backingCoinType!=e.outputCoinType||a.backingCoinType!=e.inputCoinType&&0==t.restricted&&0==a.restricted)&&-1!=i.indexOf(t.walletType)&&-1!=i.indexOf(a.walletType)&&("bitshares2"!=t.walletType&&"bitshares2"==a.walletType?(r[e.inputCoinType]=r[e.inputCoinType]||[],r[e.inputCoinType].push(e.outputCoinType)):(l[e.inputCoinType]=l[e.inputCoinType]||[],l[e.inputCoinType].push(e.outputCoinType)))});var c=null,u=null,p=Object.keys(r);if(p.forEach(function(e){r[e].sort()}),p.length){c=a.props.initial_deposit_input_coin_type&&a.props.initial_deposit_input_coin_type in r?a.props.initial_deposit_input_coin_type:p[0];var d=r[c];u=a.props.initial_deposit_output_coin_type&&-1!=d.indexOf(a.props.initial_deposit_output_coin_type)?a.props.initial_deposit_output_coin_type:d[0]}var m=null,h=null,_=Object.keys(l);if(_.forEach(function(e){l[e].sort()}),_.length){m=a.props.initial_withdraw_input_coin_type&&a.props.initial_withdraw_input_coin_type in l?a.props.initial_withdraw_input_coin_type:_[0];var f=l[m];h=a.props.initial_withdraw_output_coin_type&&-1!=f.indexOf(a.props.initial_withdraw_output_coin_type)?a.props.initial_withdraw_output_coin_type:f[0]}var y=a.getCachedOrGeneratedInputAddress(c,u),g=a.getCachedOrFreshDepositLimit("deposit",c,u),w=a.getAndUpdateOutputEstimate("deposit",c,u,a.state.deposit_estimated_input_amount),v=a.getAndUpdateOutputEstimate("withdraw",m,h,a.state.withdraw_estimated_input_amount),b=a.getCachedOrFreshDepositLimit("withdraw",m,h);a.unMounted||a.setState({coin_info_request_state:a.coin_info_request_states.request_complete,coins_by_type:o,allowed_mappings_for_deposit:r,allowed_mappings_for_withdraw:l,deposit_input_coin_type:c,deposit_output_coin_type:u,input_address_and_memo:y,deposit_limit:g,deposit_estimated_output_amount:w,deposit_estimate_direction:a.estimation_directions.output_from_input,withdraw_input_coin_type:m,withdraw_output_coin_type:h,withdraw_limit:b,withdraw_estimated_output_amount:v,withdraw_estimate_direction:a.estimation_directions.output_from_input,supports_output_memos:o.xmr.supportsOutputMemos})}).catch(function(e){a.setState({coin_info_request_state:t,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null})})}},{key:"updateEstimates",value:function(){if(this.state.deposit_input_coin_type&&this.state.deposit_output_coin_type){var e=this.getCachedOrGeneratedInputAddress(this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),t=this.getCachedOrFreshDepositLimit("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type),a=this.state.deposit_estimated_input_amount,n=this.state.deposit_estimated_output_amount;this.state.deposit_estimate_direction==this.estimation_directions.output_from_input?n=this.getAndUpdateOutputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,a):a=this.getAndUpdateInputEstimate("deposit",this.state.deposit_input_coin_type,this.state.deposit_output_coin_type,n);var s=this.getCachedOrFreshDepositLimit("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type),i=this.state.withdraw_estimated_input_amount,o=this.state.withdraw_estimated_output_amount;this.state.withdraw_estimate_direction==this.estimation_directions.output_from_input?o=this.getAndUpdateOutputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,i):i=this.getAndUpdateinputEstimate("withdraw",this.state.withdraw_input_coin_type,this.state.withdraw_output_coin_type,o),this.setState({input_address_and_memo:e,deposit_limit:t,deposit_estimated_input_amount:a,deposit_estimated_output_amount:n,withdraw_limit:s,withdraw_estimated_input_amount:i,withdraw_estimated_output_amount:o,key_for_withdrawal_dialog:i})}}},{key:"componentWillMount",value:function(){var e=this,t=this.state.url;this.urlConnection(t,0);var a=fetch(t+"/coins",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),n=fetch(t+"/trading-pairs",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}),s=fetch(t+"/active-wallets",{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()});Promise.all([a,n,s]).then(function(e){var t=ke(e,3),a=t[0],n=t[1],s=t[2],i={};a.forEach(function(e){return i[e.coinType]=e}),n.forEach(function(e){var t=i[e.inputCoinType],a=i[e.outputCoinType];t.backingCoinType!=e.outputCoinType&&a.backingCoinType!=e.inputCoinType&&-1!=s.indexOf(t.walletType)&&s.indexOf(a.walletType)})}).catch(function(t){e.urlConnection("https://citadel.li/trade",2),e.setState({coin_info_request_state:0,coins_by_type:null,allowed_mappings_for_deposit:null,allowed_mappings_for_withdraw:null})})}},{key:"componentDidMount",value:function(){this.update_timer=setInterval(this.updateEstimates.bind(this),this.refresh_interval)}},{key:"componentWillUnmount",value:function(){clearInterval(this.update_timer),this.unMounted=!0}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.props.account.get("name");return this.deposit_address_cache.getCachedInputAddress(this.props.gateway,n,e,t)}},{key:"cacheInputAddress",value:function(e,t,a,n){var s=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,s,e,t,a,n)}},{key:"getCachedOrGeneratedInputAddress",value:function(e,t){var a=this,n=this.getCachedInputAddress(e,t);if(n)return n;if(this.state.input_address_requests_in_progress[e]=this.state.input_address_requests_in_progress[e]||{},this.state.input_address_requests_in_progress[e][t])return null;var s=JSON.stringify({inputCoinType:e,outputCoinType:t,outputAddress:this.props.account.get("name")});return this.state.input_address_requests_in_progress[e][t]=!0,fetch(this.state.url+"/simple-api/initiate-trade",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:s}).then(function(n){n.json().then(function(n){if(console.assert(n.inputCoinType==e,"unexpected reply from initiate-trade"),console.assert(n.outputCoinType==t,"unexpected reply from initiate-trade"),n.inputCoinType!=e||n.outputCoinType!=t)throw Error("unexpected reply from initiate-trade");a.cacheInputAddress(n.inputCoinType,n.outputCoinType,n.inputAddress,n.inputMemo),delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==n.inputCoinType&&a.state.deposit_output_coin_type==n.outputCoinType&&a.setState({input_address_and_memo:{address:n.inputAddress,memo:n.inputMemo}})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})})},function(n){delete a.state.input_address_requests_in_progress[e][t],a.state.deposit_input_coin_type==e&&a.state.deposit_output_coin_type==t&&a.setState({input_address_and_memo:{address:"error generating address",memo:null}})}),null}},{key:"getCachedDepositLimit",value:function(e,t){if(this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]){var a=this.state.deposit_limit_cache[e][t];if(new Date-a.timestamp<this.refresh_interval)return a;delete this.state.deposit_limit_cache[e][t]}return null}},{key:"cacheDepositLimit",value:function(e,t,a){a.timestamp=new Date,this.state.deposit_limit_cache[e]=this.state.deposit_limit_cache[e]||{},this.state.deposit_limit_cache[e][t]=a}},{key:"getCachedOrFreshDepositLimit",value:function(e,t,a){var n=this,s=this.getCachedDepositLimit(t,a);if(s)return s;this.state.deposit_limit_requests_in_progress[t]=this.state.input_address_requests_in_progress[t]||{},this.state.deposit_limit_requests_in_progress[t][a]=!0;var i=this.state.url+"/deposit-limits?inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(s){if(!n.unMounted){if(console.assert(s.inputCoinType==t&&s.outputCoinType==a,"unexpected reply from deposit-limits"),s.inputCoinType!=t||s.outputCoinType!=a)throw Error("unexpected reply from deposit-limits");var i={timestamp:new Date,limit:s.depositLimit};n.cacheDepositLimit(t,a,i),delete n.state.deposit_limit_requests_in_progress[t][a],n.state[e+"_input_coin_type"]==t&&n.state[e+"_output_coin_type"]==a&&n.setState(Se({},e+"_limit",i))}},function(e){delete n.state.deposit_limit_requests_in_progress[t][a]}),null}},{key:"getAndUpdateOutputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null});var i=this.state.url+"/estimate-output-amount?inputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){if(!s.unMounted)if(i.error){if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input){var o=i.error.message;"deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"});o.startsWith("Internal Server Error: ")&&(o=o.substr("Internal Server Error: ".length)),s.setState(Se({},e+"_error",o))}}else{var r,l;if(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.inputAmount==n,"unexpected reply from estimate-output-amount"),i.inputCoinType!=t||i.outputCoinType!=a||i.inputAmount!=n)s.setState((Se(r={},e+"_estimated_output_amount",i.outputAmount),Se(r,e+"_error",null),r));if(s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_input_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.output_from_input)s.setState((Se(l={},e+"_estimated_output_amount",i.outputAmount),Se(l,e+"_error",null),l))}},function(e){}),null}}},{key:"getAndUpdateInputEstimate",value:function(e,t,a,n){var s=this;if(!this.unMounted){"deposit"==e&&this.setState({failed_calculate_deposit:null}),"withdraw"==e&&this.setState({failed_calculate_withdraw:null});var i=this.state.url+"/estimate-input-amount?outputAmount="+encodeURIComponent(n)+"&inputCoinType="+encodeURIComponent(t)+"&outputCoinType="+encodeURIComponent(a);return fetch(i,{method:"get",headers:new Headers({Accept:"application/json"})}).then(function(e){return e.json()}).then(function(i){var o;s.unMounted||(console.assert(i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n,"unexpected reply from estimate-input-amount"),i.inputCoinType==t&&i.outputCoinType==a&&i.outputAmount==n||("deposit"==e&&s.setState({failed_calculate_deposit:"Failed to calculate"}),"withdraw"==e&&s.setState({failed_calculate_withdraw:"Failed to calculate"})),s.state[e+"_input_coin_type"]==t&&s.state[e+"_output_coin_type"]==a&&s.state[e+"_estimated_output_amount"]==n&&s.state[e+"_estimate_direction"]==s.estimation_directions.input_from_output&&s.setState((Se(o={},e+"_estimated_input_amount",i.inputAmount),Se(o,"key_for_withdrawal_dialog",i.inputAmount),o)))},function(e){}),null}}},{key:"onInputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((Se(a={},e+"_estimated_input_amount",n),Se(a,e+"_estimated_output_amount",s),Se(a,e+"_estimate_direction",this.estimation_directions.output_from_input),Se(a,"key_for_withdrawal_dialog",n),a))}},{key:"onOutputAmountChanged",value:function(e,t){var a,n=t.target.value;""==n&&(n="0");var s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],this.state[e+"_output_coin_type"],n);this.setState((Se(a={},e+"_estimated_output_amount",n),Se(a,e+"_estimated_input_amount",s),Se(a,e+"_estimate_direction",this.estimation_directions.input_from_output),a))}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.gateway+"_bridge"}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"onInputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state["allowed_mappings_for_"+e][o],l=r[0];-1!=r.indexOf(this.state[e+"_output_coin_type"])&&(l=this.state[e+"_output_coin_type"]);var c=this.state.input_address_and_memo;"deposit"==e&&(c=this.getCachedOrGeneratedInputAddress(o,l));var u=this.getCachedOrFreshDepositLimit(e,o,l);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,o,l,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,o,l,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),"withdraw"==e&&r.forEach(function(e){l===e&&n.setState({coin_symbol:o+"input",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos})}),this.setState((Se(a={},e+"_input_coin_type",o),Se(a,e+"_output_coin_type",l),Se(a,"input_address_and_memo",c),Se(a,e+"_limit",u),Se(a,e+i,s),Se(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"onOutputCoinTypeChanged",value:function(e,t){var a,n=this,s=null,i="_estimated_output_amount",o=t.target.value,r=this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type];"withdraw"==e&&r.forEach(function(e){o===e&&n.setState({coin_symbol:o+"output",supports_output_memos:n.state.coins_by_type[e].supportsOutputMemos,key_for_withdrawal_dialog:o})});var l=this.state.input_address_and_memo;"deposit"==e&&(l=this.getCachedOrGeneratedInputAddress(this.state[e+"_input_coin_type"],o));var c=this.getCachedOrFreshDepositLimit(e,this.state[e+"_input_coin_type"],o);this.state[e+"_estimated_input_amount"]?s=this.getAndUpdateOutputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_input_amount"]):(s=this.getAndUpdateInputEstimate(e,this.state[e+"_input_coin_type"],o,this.state[e+"_estimated_output_amount"]),i="_estimated_input_amount"),this.setState((Se(a={},e+"_output_coin_type",o),Se(a,"input_address_and_memo",l),Se(a,e+"_limit",c),Se(a,e+i,s),Se(a,e+"_estimate_direction",this.estimation_directions.output_from_input),a))}},{key:"render",value:function(){var e=this;if(!this.props.account||!this.props.issuer_account||!this.props.gateway)return s.a.createElement("div",null);var t=void 0,a=void 0,n=void 0,i=void 0,o=void 0;if(this.state.coin_info_request_state==this.coin_info_request_states.request_failed)return s.a.createElement("div",null,s.a.createElement("p",null,"Error connecting to citadel.li, please try again later"));if(this.state.coin_info_request_state==this.coin_info_request_states.never_requested||this.state.coin_info_request_state==this.coin_info_request_states.request_in_progress)return s.a.createElement("div",null,s.a.createElement("p",null,"Retrieving current trade data from citadel.li"));var r=null,c=s.a.createElement(u.a,{content:"gateway.calc"});null!=this.state.failed_calculate_deposit&&(c=this.state.failed_calculate_deposit);var p=s.a.createElement(u.a,{content:"gateway.calc"});null!=this.state.failed_calculate_withdraw&&(p=this.state.failed_calculate_withdraw);s.a.createElement(u.a,{content:"gateway.calc"});if(null!=this.state.failed_calculate_conversion&&this.state.failed_calculate_conversion,Object.getOwnPropertyNames(this.state.allowed_mappings_for_deposit).length>0){var d=[];Object.keys(this.state.allowed_mappings_for_deposit).sort().forEach(function(t){d.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].symbol))});var m=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.deposit_input_coin_type||"",onChange:this.onInputCoinTypeChanged.bind(this,"deposit")},d),h=[];this.state.allowed_mappings_for_deposit[this.state.deposit_input_coin_type].forEach(function(t){h.push(s.a.createElement("option",{key:t,value:t||""},e.state.coins_by_type[t].walletSymbol))});var f=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.deposit_output_coin_type||"",onChange:this.onOutputCoinTypeChanged.bind(this,"deposit")},h),y=this.state.input_address_and_memo?this.state.input_address_and_memo:{address:"unknown",memo:null},g=this.state.deposit_estimated_input_amount,w=this.state.deposit_estimated_output_amount,v=g?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:g||"",onChange:this.onInputAmountChanged.bind(this,"deposit")}):c,b=w?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:w||"",onChange:this.onOutputAmountChanged.bind(this,"deposit")}):c,E=s.a.createElement("span",null,"updating");this.state.deposit_limit&&(E=this.state.deposit_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(u.a,{content:"gateway.limit",amount:l.a.format_number(this.state.deposit_limit.limit,8),symbol:this.state.coins_by_type[this.state.deposit_input_coin_type].walletSymbol}))):null);var k=null;this.state.deposit_error&&(k=s.a.createElement("div",null,this.state.deposit_error)),n=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.deposit"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.balance"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.state.deposit_input_coin_type}))));var C=null;C=y.memo?s.a.createElement(u.a,{unsafe:!0,content:"gateway.address_with_memo",address:y.address,memo:y.memo}):s.a.createElement("span",null,y.address),a=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge",style:{display:"flex",alignItems:"center"}},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,m),s.a.createElement("div",null,v)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,f),s.a.createElement("div",null,b)),s.a.createElement("div",null,k))),s.a.createElement("td",null,s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.deposit_output_coin_type].walletSymbol})),s.a.createElement("td",{style:{wordBreak:"break-all"}},C,s.a.createElement("br",null),E)))}if(Object.getOwnPropertyNames(this.state.allowed_mappings_for_withdraw).length>0){this.getWithdrawModalId();this.state.coins_by_type[this.state.withdraw_input_coin_type].symbol;r=this.state.withdraw_estimated_input_amount;var S=[];Object.keys(this.state.allowed_mappings_for_withdraw).sort().forEach(function(t){S.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].walletSymbol))});var A=s.a.createElement("select",{style:{width:"11rem"},className:"native-coin-types",value:this.state.withdraw_input_coin_type,onChange:this.onInputCoinTypeChanged.bind(this,"withdraw")},S),O=[];this.state.allowed_mappings_for_withdraw[this.state.withdraw_input_coin_type].forEach(function(t){O.push(s.a.createElement("option",{key:t,value:t},e.state.coins_by_type[t].symbol))});var N=s.a.createElement("select",{style:{width:"11rem"},className:"external-coin-types",value:this.state.withdraw_output_coin_type,onChange:this.onOutputCoinTypeChanged.bind(this,"withdraw")},O),x=this.state.withdraw_estimated_input_amount,T=x?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:x||"",onChange:this.onInputAmountChanged.bind(this,"withdraw")}):p,j=this.state.withdraw_estimated_output_amount,M=j?s.a.createElement("input",{style:{width:"11rem"},type:"text",value:j||"",onChange:this.onOutputAmountChanged.bind(this,"withdraw")}):p,I=s.a.createElement(Te,{showModal:this.showModal,hideModal:this.hideModal,visible:this.state.isModalVisible,key:this.state.key_for_withdrawal_dialog,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol,output_coin_name:this.state.coins_by_type[this.state.withdraw_output_coin_type].name,output_coin_symbol:this.state.coins_by_type[this.state.withdraw_output_coin_type].symbol,output_coin_type:this.state.withdraw_output_coin_type,output_supports_memos:this.state.supports_output_memos,amount_to_withdraw:r,url:this.state.url,gateway:this.props.gateway,output_wallet_type:this.state.coins_by_type[this.state.withdraw_output_coin_type].walletType}),B=null;this.state.withdraw_error&&(B=s.a.createElement("div",null,this.state.withdraw_error));var P=s.a.createElement("span",null,"...");this.state.withdraw_limit&&(P=this.state.withdraw_limit.limit?s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},s.a.createElement(u.a,{content:"gateway.limit",amount:l.a.format_number(this.state.withdraw_limit.limit,8),symbol:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol}))):s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("span",{className:"deposit-limit"},"no limit"))),o=s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.withdraw"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.balance"})),s.a.createElement("th",null))),i=s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement("div",{className:"blocktrades-bridge"},s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,A),s.a.createElement("div",null,T)),"→",s.a.createElement("div",{className:"inline-block"},s.a.createElement("div",null,N),s.a.createElement("div",null,M)),s.a.createElement("div",null,B))),s.a.createElement("td",null,s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.state.coins_by_type[this.state.withdraw_input_coin_type].walletSymbol})),s.a.createElement("td",null,I,s.a.createElement("br",null),P)))}return this.state.announcements.length>0&&(t=s.a.createElement("div",{className:"blocktrades-announcements-container"},this.state.announcements.map(function(e,t){var a="txtann info";return 10===e.status?a="txtann error":20===e.status?a="txtann warning":30===e.status?a="txtann success":40===e.status&&(a="txtann info"),1===e.format&&e.message.replace(/\r\n|\r|\n/g,"<br />"),s.a.createElement("div",{className:"blocktrades-announcements "+a,key:t},e.message)},this))),s.a.createElement("div",null,s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement(u.a,{component:"h5",content:"gateway.bridge_text"})),t,s.a.createElement("table",{className:"table"},n,a,o,i))}}]),t}();je.propTypes={url:C.a.string,gateway:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,initial_deposit_input_coin_type:C.a.string,initial_deposit_output_coin_type:C.a.string,initial_deposit_estimated_input_amount:C.a.string,initial_withdraw_input_coin_type:C.a.string,initial_withdraw_output_coin_type:C.a.string,initial_withdraw_estimated_input_amount:C.a.string};var Me=Object(d.a)(je),Ie=a(591),Be=a(23),Pe=a(2205),De=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Fe=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_rudex_address_cache_version_string="1"}return De(e,[{key:"getIndexForDepositKeyInExchange",value:function(e,t,a){return[this.current_rudex_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a,n){var s=H.a.getWallet();if(!s)return null;s.deposit_keys=s.deposit_keys||{},s.deposit_keys[e]=s.deposit_keys[e]||{};var i=this.getIndexForDepositKeyInExchange(t,a,n);s.deposit_keys[e][i]=s.deposit_keys[e][i]||[];var o=s.deposit_keys[e][i].length;return o?s.deposit_keys[e][i][o-1]:null}},{key:"cacheInputAddress",value:function(e,t,a,n,s,i){var o=H.a.getWallet();if(!o)return null;o.deposit_keys=o.deposit_keys||{},o.deposit_keys[e]=o.deposit_keys[e]||{};var r=this.getIndexForDepositKeyInExchange(t,a,n);o.deposit_keys[e][r]=o.deposit_keys[e][r]||[],o.deposit_keys[e][r].push({address:s,memo:i}),H.a._updateWallet()}}]),e}(),Re=a(2093),We=a(88),qe=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Le=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.deposit_address_cache=new Fe,a.state={isModalVisible:!1,receive_address:null},a.addDepositAddress=a.addDepositAddress.bind(a),a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),qe(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),stateCallback:this.addDepositAddress}}},{key:"addDepositAddress",value:function(e){var t=this.props.account.get("name");this.deposit_address_cache.cacheInputAddress(this.props.gateway,t,this.props.deposit_coin_type,this.props.receive_coin_type,e.address,e.memo),this.setState({account_name:t}),this.setState({receive_address:e})}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"render",value:function(){var e=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return e;var t=this.props.account.get("balances");if(this.props.deprecated_in_favor_of){var a=!1,n=t.get(this.props.receive_asset.get("id"));if(n){var i=m.ChainStore.getObject(n);if(i)0!=i.get("balance")&&(a=!0)}if(!a)return e}var o=this.state.receive_address;if(!o){var r=this.props.account.get("name");o=this.deposit_address_cache.getCachedInputAddress(this.props.gateway,r,this.props.deposit_coin_type,this.props.receive_coin_type)}var c=null;this.props.confirmations&&this.props.confirmations.type&&("irreversible"===this.props.confirmations.type?c=s.a.createElement(u.a,{content:"gateway.gateway_deposit.confirmations.last_irreversible"}):"blocks"===this.props.confirmations.type&&this.props.confirmations.value&&(c=s.a.createElement(u.a,{content:"gateway.gateway_deposit.confirmations.n_blocks",blocks:this.props.confirmations.value})));var p=this.getWithdrawModalId(),d=null,h=null,g="",w=void 0,v=void 0;if(We.b.RUDEX.simpleAssetGateway&&this.props.deposit_account)d=s.a.createElement("span",null,this.props.deposit_account),g=this.props.deposit_account,w=this.props.memoType&&"btsid"===this.props.memoType?We.b.RUDEX.fixedMemo.prepend_btsid+this.props.account.get("id").replace("1.2.","")+We.b.RUDEX.fixedMemo.append:We.b.RUDEX.fixedMemo.prepend_default+this.props.account.get("name")+We.b.RUDEX.fixedMemo.append,h=s.a.createElement("span",null,w),v=this.props.deposit_coin_type+":";else{if(!o&&!this.props.supportsMemos)return Object(Re.b)(this._getDepositObject()),e;o.memo?(w=o.memo,g=o.address,d=s.a.createElement("span",null,o.address),h=s.a.createElement("span",null,o.memo)):(g=o.address,d=s.a.createElement("span",null,o.address)),v=""}return"deposit"===this.props.action?s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"left-label"},s.a.createElement("b",null,s.a.createElement(u.a,{content:"gateway.rudex.min_amount",minAmount:l.a.format_number(this.props.min_amount/l.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1),symbol:this.props.deposit_coin_type}))),c?s.a.createElement("span",null,"(",s.a.createElement("i",null,c),")"):null,s.a.createElement("div",{style:{padding:"10px 0",fontSize:"1.1rem"}},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,"ADDRESS:"," ",s.a.createElement("b",null,s.a.createElement(O,{replaceCopyText:x.a.translate("gateway.use_copy_button")},d)))),h?s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(O,{replaceCopyText:x.a.translate("gateway.use_copy_button")},"MEMO: ",s.a.createElement("b",null,h)))):null)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},d?s.a.createElement(j.a,{text:g},s.a.createElement("div",{className:"button"},"Copy address")):null,w?s.a.createElement(j.a,{text:w},s.a.createElement("div",{className:"button"},"Copy memo")):null)))):s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(M.Modal,{onCancel:this.hideModal,title:x.a.translate("gateway.withdraw_coin",{coin:this.props.deposit_asset_name,symbol:this.props.deposit_asset}),footer:null,visible:this.state.isModalVisible},s.a.createElement(Pe.a,{hideModal:this.hideModal,showModal:this.showModal,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),output_coin_name:this.props.deposit_asset_name,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:v,modal_id:p,min_amount:this.props.min_amount,gateFee:this.props.gateFee,asset_precision:this.props.asset_precision,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]})))}}]),t}();Le.propTypes={gateway:C.a.string,deposit_coin_type:C.a.string,deposit_asset_name:C.a.string,deposit_account:C.a.string,receive_coin_type:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:C.a.string,deposit_wallet_type:C.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:C.a.string,action:C.a.string,supports_output_memos:C.a.bool.isRequired,memoType:C.a.string,min_amount:C.a.number,gateFee:C.a.number,confirmations:C.a.object,asset_precision:C.a.number};var Ue=Object(d.a)(Le),Ve=(a(3),function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}());var He=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={activeCoin:a._getActiveCoin(e,{action:"deposit"}),action:e.viewSettings.get("rudexAction","deposit")},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ve(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_rudex_"+t.action,null),n=null;return"deposit"==t.action&&(n="PPY"),"withdraw"==t.action&&(n="PPY"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_rudex_"+this.state.action]=e.target.value,F.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),F.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},"rudexAction",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=this.state,o=i.activeCoin,r=i.action;if(!a.length)return s.a.createElement(v.a,null);var l=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===r?e.depositAllowed:e.withdrawalAllowed)}),c=l.map(function(e){var t="deposit"===r?e.backingCoin.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),p=l.filter(function(e){return"deposit"===r?e.backingCoin.toUpperCase()===o:e.symbol===o})[0];p||(p=l[0]);var d="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+r}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:o},c))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),p?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(Ue,{key:""+p.symbol,gateway:p.gatewayWallet,issuer_account:p.issuer,account:n,deposit_asset:p.backingCoin.toUpperCase(),deposit_asset_name:p.name,deposit_coin_type:p.backingCoin.toLowerCase(),deposit_account:p.gatewayWallet,deposit_wallet_type:p.walletType,receive_asset:p.symbol,receive_coin_type:p.symbol.toLowerCase(),supports_output_memos:p.supportsMemos,memoType:p.memoType,min_amount:p.minAmount,gateFee:p.gateFee,asset_precision:p.precision,confirmations:p.confirmations,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.rudex.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:"https://rudex.freshdesk.com",target:"_blank",rel:"noopener noreferrer",className:"external-link"},"https://rudex.freshdesk.com"))),p&&p.symbol?s.a.createElement(R.b,{asset:p.symbol,fromAccount:d?p.issuerId:this.props.account.get("id"),to:d?this.props.account.get("id"):p.issuerId},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(R.a,{accountsList:q.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),Je=Object(i.a)(He,{listenTo:function(){return[D.a]},getProps:function(){return{viewSettings:D.a.getState().viewSettings}}}),ze=a(154),Xe=a(374),Ge=a(2206);new ye.a("");function Ke(e){var t=e.coin,a=e.account,n=e.stateCallback,s={coin:t,account:a},i=JSON.stringify(s);fetch(w.a.BASE+"/simple-api/get-last-address",{method:"POST",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:i}).then(function(e){e.json().then(function(e){var t={address:e.address,memo:e.memo||null,error:e.error||null,loading:!1};n&&n(t)},function(e){console.log("error: ",e),n&&n({address:e.message,memo:null})})},function(e){console.log("error: ",e),n&&n({address:e.message,memo:null})}).catch(function(e){console.log("fetch error:",e)})}var Qe={};var Ye=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Ze=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={isModalVisible:!1,receive_address:null,url:e.url||w.a.BASE,loading:!1,emptyAddressDeposit:!1},a.addDepositAddress=a.addDepositAddress.bind(a),a._copy=a._copy.bind(a),a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),document.addEventListener("copy",a._copy),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ye(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",x.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),url:this.state.url,stateCallback:this.addDepositAddress}}},{key:"componentWillMount",value:function(){Ke({coin:this.props.receive_coin_type,account:this.props.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"componentWillReceiveProps",value:function(e){e.account!==this.props.account&&Ke({coin:e.receive_coin_type,account:e.account.get("name"),stateCallback:this.addDepositAddress})}},{key:"addDepositAddress",value:function(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e}),this.setState({loading:!1}),this.setState({receive_address:e})}},{key:"requestDepositAddressLoad",value:function(){this.setState({loading:!0,emptyAddressDeposit:!1}),function(e){var t=e.inputCoinType,a=e.outputCoinType,n=e.outputAddress,s=e.url,i=void 0===s?w.a.BASE:s,o=e.stateCallback,r=e.selectedGateway,l=(We.b[r],{inputCoinType:t,outputCoinType:a,outputAddress:n}),c=JSON.stringify(l);Qe[c]||(Qe[c]=!0,fetch(i+"/simple-api/initiate-trade",{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:c}).then(function(e){e.json().then(function(e){delete Qe[c];var t={address:e.inputAddress||"unknown",memo:e.inputMemo,error:e.error||null};o&&o(t)},function(e){console.log("error: ",e),delete Qe[c],o&&o(null)})},function(e){console.log("error: ",e),delete Qe[c],o&&o(null)}).catch(function(e){console.log("fetch error:",e),delete Qe[c]}))}(this._getDepositObject())}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e="deposit"===this.props.action,t=s.a.createElement(v.a,null);if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return t;var a=this.props.account.get("balances"),n=this.props.gateFee;this.props.receive_asset.get("symbol");if(this.props.deprecated_in_favor_of){var i=!1,o=a.get(this.props.receive_asset.get("id"));if(o){var r=m.ChainStore.getObject(o);if(r)0!=r.get("balance")&&(i=!0)}if(!i)return t}var l=this.state.receive_address,c=this.state.emptyAddressDeposit,p=this.state.loading;if(!l)return s.a.createElement("div",{style:{margin:"3rem"}},s.a.createElement(v.a,{type:"three-bounce"}));var d=this.getWithdrawModalId(),h=null,g=null,w="",b=void 0;if(this.props.deposit_account){h=s.a.createElement("span",null,this.props.deposit_account),w=this.props.receive_coin_type+":"+this.props.account.get("name"),g=s.a.createElement("span",null,w);var E=this.props.deposit_coin_type+":"}else{l.memo?(b=l.memo,w=l.address,h=s.a.createElement("span",null,l.address),g=s.a.createElement("span",null,l.memo)):(w=l.address,h=s.a.createElement("span",null,l.address));E=""}return!this.props.isAvailable||e&&!this.props.deposit_account&&!l||l&&"unknown"===l.address?s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"})):e?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"fz_12 left-label"},s.a.createElement(u.a,{content:"gateway.deposit_notice_delay"})),s.a.createElement("div",null,c?s.a.createElement(u.a,{content:"gateway.please_generate_address"}):h,s.a.createElement("div",null,g&&s.a.createElement("span",null,"memo: ",g)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},h?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,w)},s.a.createElement(u.a,{content:"gateway.copy_address"})):null,b?s.a.createElement("div",{className:"button",onClick:this.toClipboard.bind(this,b)},s.a.createElement(u.a,{content:"gateway.copy_memo"})):null,s.a.createElement("button",{className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this)},p?s.a.createElement(v.a,{type:"circle"}):null,s.a.createElement(u.a,{content:"gateway.generate_new"}))),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:2*this.props.gateFee,coin:this.props.deposit_asset})))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(M.Modal,{onCancel:this.hideModal,title:x.a.translate("gateway.withdraw_coin",{coin:this.props.deposit_asset_name,symbol:this.props.deposit_asset}),footer:null,visible:this.state.isModalVisible,id:d,overlay:!0},s.a.createElement(Ge.a,{hideModal:this.hideModal,showModal:this.showModal,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),url:this.state.url,output_coin_name:this.props.deposit_asset_name,gateFee:n,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:E,modal_id:d,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]})))}}]),t}();Ze.propTypes={url:C.a.string,gateway:C.a.string,deposit_coin_type:C.a.string,deposit_asset_name:C.a.string,deposit_account:C.a.string,receive_coin_type:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:C.a.string,deposit_wallet_type:C.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:C.a.string,action:C.a.string,supports_output_memos:C.a.bool.isRequired},Ze.defaultProps={autosubscribe:!1};var $e=Object(d.a)(Ze),et=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var tt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={activeCoin:a._getActiveCoin(e,{action:n}),action:n},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),et(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_"+e.provider+"_"+t.action,null),n=null;return"deposit"==t.action&&(n="BTC"),"withdraw"==t.action&&(n="SPARKDEX.BTC"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,F.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),F.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=t.provider,o=this.state,r=o.activeCoin,l=o.action;if(!a.length)return s.a.createElement(v.a,null);var c=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===l?e.depositAllowed:e.withdrawalAllowed)}),p=c.map(function(e){var t="deposit"===l?e.backingCoinType.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),d=c.filter(function(e){return"deposit"===l?e.backingCoinType.toUpperCase()===r:e.symbol===r})[0];d||(d=c[0]);var m={bitspark:{name:d.intermediateAccount,id:"1.2.1070206",support:"info@bitspark.io"}}[i],h="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+l}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:r},p))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===l?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),d?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement($e,{key:i+"."+d.symbol,gateway:i,issuer_account:m.name,account:n,deposit_asset:d.backingCoinType.toUpperCase(),deposit_asset_name:d.name,deposit_coin_type:d.backingCoinType.toLowerCase(),deposit_account:d.depositAccount,deposit_wallet_type:d.walletType,gateFee:d.gateFee,receive_asset:d.symbol,receive_coin_type:d.symbol.toLowerCase(),supports_output_memos:d.supportsMemos,isAvailable:d.isAvailable,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.bitspark.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:(-1===m.support.indexOf("@")?"":"mailto:")+m.support,rel:"noopener noreferrer"},m.support))),d&&d.symbol?s.a.createElement(R.b,{asset:d.symbol,fromAccount:h?m.id:this.props.account.get("id"),to:h?this.props.account.get("id"):m.id},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(R.a,{accountsList:q.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),at=Object(i.a)(tt,{listenTo:function(){return[D.a]},getProps:function(){return{viewSettings:D.a.getState().viewSettings}}}),nt=new ye.a(""),st={},it=1e4;function ot(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;return 1==t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.DEPOSIT_RECORD_LIST,t)}(e,a):2==t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.WITHDRAW_RECORD_LIST,t)}(e,a):new Promise(function(e){return e()})}function rt(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;return-1==a?lt(e,t,it):0==a?function(e,t){e.requestChannel||(e.requestChannel=0);e.version||(e.version="1.0");e.timestamp||(e.timestamp=(new Date).getTime());e.outerChannel||(e.outerChannel="Bitshares");var a=JSON.stringify(e);if(st[a])return;st[a]=!0,new Promise(function(e,n){fetch(t,{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:a}).then(function(t){t.json().then(function(t){delete st[a],0!==t.code&&(console.log(t),n({code:t.code,message:t.message})),e(t.data)}).catch(function(e){delete st[a],n({code:-1,message:e.message})})})})}(e,t):lt(e,t,a)}function lt(e,t,a){e.requestChannel||(e.requestChannel=0),e.version||(e.version="1.0"),e.timestamp||(e.timestamp=(new Date).getTime()),e.outerChannel||(e.outerChannel="Bitshares");var n=JSON.stringify(e);if(!st[n])return st[n]=!0,Promise.race([new Promise(function(e,a){fetch(t,{method:"post",headers:new Headers({Accept:"application/json","Content-Type":"application/json"}),body:n}).then(function(t){t.json().then(function(t){delete st[n],0!==t.code&&(console.log(t),a({code:t.code,message:t.message})),e(t.data)}).catch(function(e){delete st[n],a({code:-1,message:e.message})})})}),new Promise(function(e,t){setTimeout(function(){t({code:-2,message:"Request timeout."})},a)})])}var ct={has:function(e){return nt.has("gdex_history_address_"+e)},set:function(e){var t=e.wallet,a=e.addresses;nt.set("gdex_history_address_"+t,a)},get:function(e){return nt.get("gdex_history_address_"+e,[])},setLast:function(e){var t=e.wallet,a=e.address;nt.set("gdex_history_address_last_"+t,a)},getLast:function(e){return nt.get("gdex_history_address_last_"+e,"")}},ut=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var pt=new ye.a("__gdex__user_"),dt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_gdex_address_cache_version_string="1",this.day=86400}return ut(e,[{key:"getUserInfo",value:function(e){var t=pt.get(e,null);if(!t)return null;var a=Math.floor((new Date).getTime()/1e3);return Math.abs(t.ctime-a)>this.day?(pt.remove(e),null):t}},{key:"cacheUserInfo",value:function(e,t,a){var n=pt.get(e,{});n!={}&&(n={user_id:t,status:a,ctime:Math.floor((new Date).getTime()/1e3)},pt.set(e,n))}},{key:"delUserInfo",value:function(e){pt.has(e)&&pt.del(e)}},{key:"getIndexForDepositKey",value:function(e,t,a){return[this.current_gdex_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a){var n=this.getIndexForDepositKey(e,t,a),s=pt.get("deposit_keys",{})[n]||null;if(s){if(s.address){var i=Math.floor((new Date).getTime()/1e3);return Math.abs(s.ctime-i)>this.day?(this.clearInputAddress(e,t,a),null):s}return null}}},{key:"cacheInputAddress",value:function(e,t,a,n,s){var i=this.getIndexForDepositKey(e,t,a),o=pt.get("deposit_keys",{});o[i]={address:n,memo:s,ctime:Math.floor((new Date).getTime()/1e3)},pt.set("deposit_keys",o)}},{key:"clearInputAddress",value:function(e,t,a){var n=this.getIndexForDepositKey(e,t,a),s=pt.get("deposit_keys",null);s&&s[n]&&(s[n]={address:null,memo:null,ctime:null},pt.set("deposit_keys",s))}}]),e}(),mt=a(594),ht=a.n(mt),_t=a(2018),ft=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var yt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={isConfirmationModalVisible:!1,withdraw_amount:a.props.amount_to_withdraw,withdraw_address:ct.getLast(e.output_coin_name),withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null,options_is_valid:!1,withdraw_address_selected:ct.getLast(e.output_coin_name),memo:"",withdraw_address_first:!0,empty_withdraw_value:!1,below_minumum_withdraw_value:!1,precision_error:!1,memo_error:!1,memo_length_error:!1,from_account:e.account,fee_asset_id:m.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",feeStatus:{},withdraw_address_error_code:null,withdraw_address_error_message:null},a._validateAddress(a.state.withdraw_address,e),a._checkBalance=a._checkBalance.bind(a),a._updateFee=Object(_t.a)(a._updateFee.bind(a),250),a.showConfirmationModal=a.showConfirmationModal.bind(a),a.hideConfirmationModal=a.hideConfirmationModal.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),ft(t,[{key:"componentWillMount",value:function(){this._updateFee(),this._checkFeeStatus()}},{key:"componentWillUnmount",value:function(){this.unMounted=!0}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.output_coin_name!=this.props.output_coin_name&&this.setState({withdraw_address:ct.getLast(e.output_coin_name),withdraw_address_selected:ct.getLast(e.output_coin_name)}),e.account!==this.state.from_account&&e.account!==this.props.account&&this.setState({from_account:e.account,feeStatus:{},feeAmount:new Ee.a({amount:0})},function(){t._updateFee(),t._checkFeeStatus()})}},{key:"showConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!0})}},{key:"hideConfirmationModal",value:function(){this.setState({isConfirmationModalVisible:!1})}},{key:"_assembleMemo",value:function(){var e=this,t=this.props.memo_rule,a="";try{if(t)return t.split(";").forEach(function(t){switch(t[0]){case"C":a+=t.slice(2);break;case"D":a+=e.state.withdraw_address;break;case"B":a+=t.slice(2);break;case"S":a+=e.state.memo}}),a.length>100?(this.setState({memo_length_error:!0}),null):(this.setState({memo_length_error:!1}),this.setState({memo_error:!1}),a)}catch(e){console.log(e)}return this.setState({memo_error:!0}),null}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.fee_asset_id,n=t.from_account,s=this._getAvailableAssets(t).fee_asset_types;if(1===s.length&&s[0]!==a&&(a=s[0]),!n)return null;Object(be.b)({accountID:n.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:this._assembleMemo()}}).then(function(t){var a=t.fee,n=t.hasBalance,s=t.hasPoolBalance;e.unMounted||e.setState({feeAmount:a,hasBalance:n,hasPoolBalance:s,error:!n||!s},e._checkBalance)})}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,a=t.from_account;if(a){var n=this._getAvailableAssets(t).fee_asset_types,s={},i=[];n.forEach(function(n){i.push(Object(be.b)({accountID:a.get("id"),feeID:n,options:["price_per_kbyte"],data:{type:"memo",content:e.props.output_coin_name+":"+t.withdraw_address+(t.memo?":"+t.memo:"")}}))}),Promise.all(i).then(function(a){n.forEach(function(e,t){s[e]=a[t]}),l.a.are_equal_shallow(t.feeStatus,s)||e.setState({feeStatus:s}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"onWithdrawAmountChange",value:function(e){var t=e.amount;this.setState({withdraw_amount:t,empty_withdraw_value:void 0!==t&&!parseFloat(t)},this._checkBalance)}},{key:"onSelectChanged",value:function(e){var t=ct.get(this.props.output_coin_symbol)[e];ct.setLast({wallet:this.props.output_coin_symbol,address:t}),this.setState({withdraw_address_selected:t,options_is_valid:!1,withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"onWithdrawAddressChanged",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address:t,withdraw_address_check_in_progress:!0,withdraw_address_selected:t,withdraw_address_is_valid:null},this._updateFee),this._validateAddress(t)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.address?rt(e,w.f.BASE+w.f.CHECK_WITHDRAY_ADDRESS,t):new Promise(function(e){return e()})})({assetId:a.output_coin_id,assetName:a.output_coin_name,address:e}).then(function(e){t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:e.valid,withdraw_address_error_code:null,withdraw_address_error_message:null})}).catch(function(e){var a=e.message;e.code<0&&(a="System error: please try again later"),t.setState({withdraw_address_check_in_progress:!1,withdraw_address_is_valid:null,withdraw_address_error_code:e.code,withdraw_address_error_message:a})})}},{key:"_checkPrecision",value:function(){var e=this.state.withdraw_amount,t=this.props.output_coin_precision;"undefined"!==t&&("string"!=typeof e&&(e=e.toString()),-1!==(e=e.trim()).indexOf(".")&&e.length-e.indexOf(".")-1>t?this.setState({precision_error:!0}):this.setState({precision_error:!1}))}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.withdraw_amount,n=this.props,s=n.asset,i=n.balance,o=n.minWithdrawAmount;if(i){if(t){var r=Object(be.a)(a,s,t,i);if(null!==r){if(this.setState({balanceError:!r}),"string"==typeof a&&(a=parseFloat(String.prototype.replace.call(a,/,/g,""))),"string"==typeof o&&(o=parseFloat(String.prototype.replace.call(o,/,/g,""))),!(a<o))return this.setState({below_minumum_withdraw_value:!1}),this._checkPrecision(),r;this.setState({below_minumum_withdraw_value:!0})}}}else this.setState({balanceError:!0})}},{key:"onSubmit",value:function(){if(!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&null!==this.state.withdraw_amount)if(this.state.withdraw_address_is_valid)if(parseFloat(this.state.withdraw_amount)>0){if(ct.has(this.props.output_coin_symbol)){var e=ct.get(this.props.output_coin_symbol);-1==e.indexOf(this.state.withdraw_address)&&(e.push(this.state.withdraw_address),ct.set({wallet:this.props.output_coin_symbol,addresses:e}))}else{var t=[];t.push(this.state.withdraw_address),ct.set({wallet:this.props.output_coin_symbol,addresses:t})}ct.setLast({wallet:this.props.output_coin_symbol,address:this.state.withdraw_address});var a=this.props.asset,n=this.state,s=n.feeAmount,i=n.fee_asset_id,o=parseFloat(String.prototype.replace.call(this.state.withdraw_amount,/,/g,"")),r=new Ee.a({asset_id:a.get("id"),precision:a.get("precision"),real:o});te.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),r.getAmount(),a.get("id"),this._assembleMemo(),null,s?s.asset_id:i),this.setState({empty_withdraw_value:!1})}else this.setState({empty_withdraw_value:!0});else this.showConfirmationModal()}},{key:"onSubmitConfirmation",value:function(){if(this.hideConfirmationModal(),ct.has(this.props.output_coin_symbol)){var e=ct.get(this.props.output_coin_symbol);-1==e.indexOf(this.state.withdraw_address)&&(e.push(this.state.withdraw_address),ct.set({wallet:this.props.output_coin_symbol,addresses:e}))}else{var t=[];t.push(this.state.withdraw_address),ct.set({wallet:this.props.output_coin_symbol,addresses:t})}ct.setLast({wallet:this.props.output_coin_symbol,address:this.state.withdraw_address});var a=this.props.asset,n=l.a.get_asset_precision(a.get("precision")),s=String.prototype.replace.call(this.state.withdraw_amount,/,/g,""),i=this.state,o=i.feeAmount,r=i.fee_asset_id;te.a.transfer(this.props.account.get("id"),this.props.issuer.get("id"),parseInt(s*n,10),a.get("id"),this._assembleMemo(),null,o?o.asset_id:r)}},{key:"onDropDownList",value:function(){ct.has(this.props.output_coin_symbol)&&(!1===this.state.options_is_valid&&(this.setState({options_is_valid:!0}),this.setState({withdraw_address_first:!1})),!0===this.state.options_is_valid&&this.setState({options_is_valid:!1}))}},{key:"getWithdrawModalId",value:function(){return"confirmation"}},{key:"onAccountBalance",value:function(){var e=this.state.feeAmount;if(Object.keys(this.props.account.get("balances").toJS()).includes(this.props.asset.get("id"))){var t=new Ee.a({amount:this.props.balance.get("balance"),asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});t.asset_id===e.asset_id&&t.minus(e),this.setState({withdraw_amount:t.getAmount({real:!0}),empty_withdraw_value:!1},this._checkBalance)}}},{key:"setNestedRef",value:function(e){this.nestedRef=e}},{key:"onFeeChanged",value:function(e){var t=e.asset;this.setState({fee_asset_id:t.get("id")},this._updateFee)}},{key:"_getAvailableAssets",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=e.from_account,a=e.feeStatus;var n=[];if(!t||!t.get("balances"))return{fee_asset_types:n};var s=e.from_account.get("balances").toJS();for(var i in n=Object.keys(s).sort(l.a.sortID),s){var o=m.ChainStore.getObject(i),r=m.ChainStore.getObject(s[i]);if(r&&0===r.get("balance")&&-1!==n.indexOf(i)&&n.splice(n.indexOf(i),1),o){var c=!1;try{c=new Ee.i({base:new Ee.a(o.getIn(["options","core_exchange_rate","base"]).toJS()),quote:new Ee.a(o.getIn(["options","core_exchange_rate","quote"]).toJS())}).isValid()}catch(e){c=!1}"1.3.0"===o.get("id")||c||n.splice(n.indexOf(i),1)}}return{fee_asset_types:n=n.filter(function(e){return function(e){return void 0===a[e]||a[e]&&a[e].hasPoolBalance}(e)&&function(e){return void 0===a[e]||a[e]&&a[e].hasBalance}(e)})}}},{key:"render",value:function(){var e=this.state,t=e.withdraw_address_selected,a=e.memo,n=ct.get(this.props.output_coin_symbol),i=null,o=this.props.account.get("balances").toJS(),r=Object.keys(o),l=(this.getWithdrawModalId(),null),c=null,p=null;this.state.options_is_valid&&(c=s.a.createElement("div",{className:n.length?"blocktrades-options":"blocktrades-disabled-options"},n.map(function(e,t){return s.a.createElement("a",{key:t,onClick:this.onSelectChanged.bind(this,t)},e)},this))),!this.state.withdraw_address_check_in_progress&&this.state.withdraw_address&&this.state.withdraw_address.length&&(this.state.withdraw_address_is_valid||(l=this.state.withdraw_address_error_code?s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},this.state.withdraw_address_error_code,":"," ",this.state.withdraw_address_error_message):s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},s.a.createElement(u.a,{content:"gateway.valid_address",coin_type:this.props.output_coin_name})),p=s.a.createElement(M.Modal,{closable:!1,footer:[s.a.createElement(M.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},x.a.translate("modal.confirmation.accept")),s.a.createElement(M.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.hideConfirmationModal},x.a.translate("modal.confirmation.cancel"))],visible:this.state.isConfirmationModalVisible,onCancel:this.hideConfirmationModal},s.a.createElement("label",null,s.a.createElement(u.a,{content:"modal.confirmation.title"})))));var d=1,m=null;this.props.output_supports_memos&&(m=s.a.createElement("div",{className:"content-block"},s.a.createElement("label",null,s.a.createElement(u.a,{component:"span",content:"transfer.memo"})),s.a.createElement("textarea",{rows:"3",value:a,tabIndex:d++,onChange:this.onMemoChanged.bind(this)}),this.state.memo_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.memo_error"})):null,this.state.memo_length_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.memo_length_error"})):null));var h=this._getAvailableAssets().fee_asset_types;if(r.length>0){var _=this.props.asset.get("id");if(_){var f=o[_];i=s.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},s.a.createElement(u.a,{component:"span",content:"transfer.available"})," : ",s.a.createElement("span",{className:"set-cursor",onClick:this.onAccountBalance.bind(this)},f?s.a.createElement(Q.a,{balance:o[_]}):0))}else i="No funds"}else i="No funds";var y=this.state.below_minumum_withdraw_value||this.state.memo_error||this.state.memo_length_error||this.state.error||this.state.balanceError||this.state.precision_error;return s.a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:"0"}},s.a.createElement("div",{className:"grid-container"},s.a.createElement("div",{className:"content-block"},s.a.createElement(Y.a,{label:"modal.withdraw.amount",amount:this.state.withdraw_amount,asset:this.props.asset.get("id"),assets:[this.props.asset.get("id")],placeholder:"0.0",onChange:this.onWithdrawAmountChange.bind(this),display_balance:i}),this.state.empty_withdraw_value?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.valid"})):null,this.state.balanceError?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.insufficient"})):null,this.state.below_minumum_withdraw_value?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.minimum_amount",amount:this.props.minWithdrawAmount,symbol:this.props.asset.get("symbol")})):null,this.state.precision_error?s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.precision",precision:this.props.output_coin_precision})):null),this.state.feeAmount?s.a.createElement("div",{className:"content-block gate_fee"},s.a.createElement(Y.a,{refCallback:this.setNestedRef.bind(this),disabled:!0,amount:this.state.feeAmount.getAmount({real:!0}),onChange:this.onFeeChanged.bind(this),asset:this.state.feeAmount.asset_id,assets:h,tabIndex:d++}),this.state.hasBalance?null:s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.noFeeBalance"})),this.state.hasPoolBalance?null:s.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},s.a.createElement(u.a,{content:"transfer.errors.noPoolBalance"}))):null,this.props.gateFee?s.a.createElement("div",{className:"amount-selector right-selector",style:{paddingBottom:20}},s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.fee"})),s.a.createElement("div",{className:"inline-label input-wrapper"},s.a.createElement("input",{type:"text",disabled:!0,value:this.props.gateFee}),s.a.createElement("div",{className:"form-label select floating-dropdown"},s.a.createElement("div",{className:"dropdown-wrapper inactive"},s.a.createElement("div",null,this.props.output_coin_symbol))))):null,s.a.createElement("div",{className:"content-block"},s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{component:"span",content:"modal.withdraw.address"})),s.a.createElement("div",{className:"blocktrades-select-dropdown"},s.a.createElement("div",{className:"inline-label"},s.a.createElement("input",{type:"text",value:t,tabIndex:"4",onChange:this.onWithdrawAddressChanged.bind(this),autoComplete:"off"}),s.a.createElement("span",{onClick:this.onDropDownList.bind(this)},"▼"))),s.a.createElement("div",{className:"blocktrades-position-options"},c),l),m,s.a.createElement("div",null,s.a.createElement(M.Button,{type:"primary",disabled:y,onClick:this.onSubmit.bind(this)},x.a.translate("modal.withdraw.submit")),s.a.createElement(M.Button,{onClick:this.props.hideModal,style:{marginLeft:"8px"}},x.a.translate("account.perm.cancel"))),p))}}]),t}();yt.propTypes={account:p.a.ChainAccount.isRequired,issuer:p.a.ChainAccount.isRequired,asset:p.a.ChainAsset.isRequired,memo_rule:C.a.string.isRequired,balance:p.a.ChainObject,output_supports_memos:C.a.bool.isRequired};var gt=Object(d.a)(Object(i.a)(yt,{listenTo:function(){return[D.a]},getProps:function(e){return{fee_asset_symbol:D.a.getState().settings.get("fee_asset")}}})),wt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Et(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var kt=function(e){function t(){vt(this,t);var e=bt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={isQrModalVisible:!1,isModalVisible:!1,receive_address:null,isAvailable:!0,qrcode:""},e.deposit_address_cache=new dt,e._copy=e._copy.bind(e),document.addEventListener("copy",e._copy),e.showQrModal=e.showQrModal.bind(e),e.hideQrModal=e.hideQrModal.bind(e),e.showModal=e.showModal.bind(e),e.hideModal=e.hideModal.bind(e),e}return Et(t,s.a.Component),wt(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"showQrModal",value:function(){this.setState({isQrModalVisible:!0})}},{key:"hideQrModal",value:function(){this.setState({isQrModalVisible:!1})}},{key:"getDepositAddress",value:function(){this._getDepositAddress(this.props.user_id,this.props.account.get("name"),this.props.coin,this.props.action)}},{key:"_getDepositAddress",value:function(e,t,a,n){if("deposit"==n){var s=this.deposit_address_cache.getCachedInputAddress(t,a.outerSymbol,a.innerSymbol);if(s&&s!=this.state.receive_address)this.setState({receive_address:s});else{var i=this;(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.GET_DEPOSIT_ADDRESS,t)})({btsAssetId:a.innerAssetId,outAssetId:a.outerAssetId,uid:e,userAccount:t}).then(function(e){if(e.address&&e.address.address){var n={address:e.address.address,memo:e.address.memo};i.deposit_address_cache.cacheInputAddress(t,a.outerSymbol,a.innerSymbol,n.address,n.memo),i.setState({receive_address:n})}else i.setState({receive_address:null})}).catch(function(e){i.setState({receive_address:null}),console.log(e)})}}}},{key:"componentWillMount",value:function(){this.getDepositAddress()}},{key:"componentWillReceiveProps",value:function(e){e.user_id===this.props.user_id&&e.action===this.props.action&&e.coin==this.props.coin||this._getDepositAddress(e.user_id,e.account.get("name"),e.coin,e.action)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("copy",this._copy)}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.coin.innerSymbol}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"onShowQrcode",value:function(e){var t=this;this.setState({qrcode:e},function(){t.showQrModal()})}},{key:"_copy",value:function(e){try{this.state.clipboardText?e.clipboardData.setData("text/plain",this.state.clipboardText):e.clipboardData.setData("text/plain",x.a.translate("gateway.use_copy_button").toUpperCase()),e.preventDefault()}catch(e){console.error(e)}}},{key:"toClipboard",value:function(e){try{this.setState({clipboardText:e},function(){document.execCommand("copy")})}catch(e){console.error(e)}}},{key:"render",value:function(){var e=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.coin)return e;var t=this.props,a=t.coin,n=t.btsCoin;if(!n)return e;var i=this.state.receive_address,o=this.state.qrcode,r=this.getWithdrawModalId(),l=null,c="",p="",d=a.outerSymbol+":";"deposit"===this.props.action&&(i&&(l=s.a.createElement("span",null,i.address),c=i.address,i.memo&&(s.a.createElement("span",null,i.memo),p=i.memo)),d="");var m=null,h=this.props.account.get("balances");return h&&(m=h.toJS()[n.get("id")]),"deposit"===this.props.action?s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},a.outerSymbol)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:a.innerSymbol,replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:a.innerSymbol,replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:a.outerSymbol}),":"),s.a.createElement("p",{style:{color:"red"}},s.a.createElement(u.a,{content:"gateway.deposit_warning",asset:a.outerSymbol})),p?s.a.createElement("p",{style:{color:"red"}},s.a.createElement(u.a,{content:"gateway.deposit_warning_memo",asset:a.outerSymbol})):null,s.a.createElement("div",null,s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.address"}),":"),s.a.createElement("td",null,l),s.a.createElement("td",null,s.a.createElement("div",{style:{width:"125px"},className:"button",onClick:this.toClipboard.bind(this,c)},s.a.createElement(u.a,{content:"transfer.copy_address"}))),s.a.createElement("td",null,s.a.createElement("div",{className:"button",onClick:this.onShowQrcode.bind(this,c)},s.a.createElement(u.a,{content:"modal.qrcode.label"})))),p?s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.memo"}),":"),s.a.createElement("td",null,p),s.a.createElement("td",null,s.a.createElement("div",{style:{width:"125px"},className:"button",onClick:this.toClipboard.bind(this,p)},s.a.createElement(u.a,{content:"transfer.copy_memo"}))),s.a.createElement("td",null,s.a.createElement("div",{className:"button",onClick:this.onShowQrcode.bind(this,p)},s.a.createElement(u.a,{content:"modal.qrcode.label"})))):null)),s.a.createElement(M.Modal,{footer:[s.a.createElement(M.Button,{key:"close",type:"primary",onClick:this.hideQrModal},x.a.translate("modal.close"))],visible:this.state.isQrModalVisible,onCancel:this.hideQrModal},s.a.createElement(Ct,{text:o}))))):s.a.createElement("div",{className:"Blocktrades__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:a.innerSymbol,replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},a.outerSymbol)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:a.innerSymbol,replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(M.Modal,{onCancel:this.hideModal,title:x.a.translate("gateway.withdraw_coin",{coin:a.outerAssetName,symbol:a.outerSymbol}),footer:null,visible:this.state.isModalVisible},s.a.createElement(gt,{hideModal:this.hideModal,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:a.innerSymbol,output_coin_name:a.outerAssetName,gateFee:a.gateFee,output_coin_id:a.outerAssetId,output_coin_symbol:a.outerSymbol,output_supports_memos:1==a.needMemo,minWithdrawAmount:a.minTransactionAmount,output_coin_precision:a.relationPrecision,memo_prefix:d,memo_rule:this.props.memo_rule,modal_id:r,balance:m})))}}]),t}();kt.propTypes={account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,gateway:C.a.string,btsCoin:p.a.ChainAsset,memo_rule:C.a.string},kt.defaultProps={autosubscribe:!1};var Ct=function(e){function t(e){return vt(this,t),bt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return Et(t,s.a.Component),wt(t,[{key:"render",value:function(){var e=this.props.text;return s.a.createElement("div",{className:"small-12",style:{textAlign:"center"}},s.a.createElement(ht.a,{size:200,value:e}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("label",{style:{textTransform:"none"}},e))}}]),t}(),St=Object(d.a)(kt),At=a(34),Ot=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Nt={1:"confirming",2:"waiting",3:"transfering",4:"success",5:"fail"},xt={1:"confirming",2:"auditing",3:"audited",4:"refused",5:"transfering",6:"success",7:"fail"},Tt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={headerHeight:85,pageNum:0,totalNum:0,nextPageEnabled:!1,allData:{},historyStatusType:1==e.recordType?"deposit_history_status":"withdraw_history_status",historyStatusValue:1==e.recordType?Nt:xt},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ot(t,[{key:"componentWillMount",value:function(){this.getTransactionHistory()}},{key:"componentWillReceiveProps",value:function(e){this.props.recordType==e.recordType&&this.props.assetId==e.assetId&&this.props.assetName==e.assetName&&this.props.userId==e.userId&&this.props.userAccount==e.userAccount||this._getTransactionHistory(e.userId,e.assetId,e.assetName,e.recordType,e.userAccount,!0)}},{key:"shouldComponentUpdate",value:function(e,t){return!l.a.are_equal_shallow(this.props.userId,e.userId)||(this.state.allData!=t.allData||this.state.pageNum!=t.pageNum)}},{key:"_getTransactionHistory",value:function(e,t,a,n,s){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=this.props.pageSize,r=this.state,l=r.pageNum,c=r.allData,u=r.historyStatusValue,p=r.historyStatusType;1==i?(l=1,c={},p=1==n?"deposit_history_status":"withdraw_history_status",u=1==n?Nt:xt):l+=1;var d=this;ot({uid:e,assetId:t,pageNum:l,pageSize:o,userAccount:s},n).then(function(e){e.records&&(e.records.forEach(function(e){c[e.txid]={txid:e.txid,amount:e.amount,time:e.ctime,unixtime:Date.parse(e.ctime),status:["gateway",p,u[e.status]].join("."),failReason:e.failReason,assetName:a}}),d.setState({totalNum:e.total,nextPageEnabled:e.total>l*o,allData:c,pageNum:l,historyStatusType:p,historyStatusValue:u}))}).catch(function(){d.setState({totalNum:0,nextPageEnabled:!1,allData:{},pageNum:0})})}},{key:"getTransactionHistory",value:function(){var e=this.props,t=e.userId,a=e.assetId,n=e.assetName,s=e.recordType,i=e.userAccount;this._getTransactionHistory(t,a,n,s,i,!1)}},{key:"render",value:function(){var e=this.props,t=e.assetName,a=e.compactView,n=e.style,i=e.maxHeight,o=this.state,r=o.headerHeight,l=o.allData,c=[];Object.keys(l).forEach(function(e){c.push(l[e])}),c.sort(function(e,t){return t.unixtime-e.unixtime}),(n=n||{}).width="100%",n.height="100%",l.length;var p=c.length?c.map(function(e){return s.a.createElement("tr",{key:e.txid},s.a.createElement("td",{style:{textAlign:"left"},className:"left-td column-hide-tiny"},s.a.createElement(u.a,{content:e.status})),s.a.createElement("td",{style:{padding:"8px 5px",textAlign:"left",fontSize:14}},s.a.createElement(u.a,{content:"gateway.transaction_history_info",amount:e.amount,assetName:t,txid:e.txid})),s.a.createElement("td",null,e.time))}):[s.a.createElement("tr",{key:"no_recent"},s.a.createElement("td",{colSpan:a?"2":"3"},s.a.createElement(u.a,{content:"operation.no_recent"})))];return p.push(s.a.createElement("tr",{className:"total-value",key:"total_value"},s.a.createElement("td",{className:"column-hide-tiny"}),s.a.createElement("td",null),s.a.createElement("td",{style:{textAlign:"center"}}," ",this.state.nextPageEnabled?s.a.createElement("a",{onClick:this.getTransactionHistory.bind(this)},s.a.createElement(At.a,{name:"chevron-down",title:"icons.chevron_down.transactions",className:"icon-14px"})):null))),s.a.createElement("div",{className:"recent-transactions no-overflow",style:n},s.a.createElement("div",{className:"generic-bordered-box"},this.props.dashboard?null:s.a.createElement("div",{ref:"header"},s.a.createElement("div",{className:"block-content-header"},s.a.createElement("span",null,this.props.title?this.props.title:s.a.createElement(u.a,{content:"account.recent"})))),s.a.createElement("div",{className:"box-content grid-block no-margin",style:this.props.fullHeight?null:{maxHeight:i-r},ref:"transactions"},s.a.createElement("table",{className:"table"+(a?" compact":"")+(this.props.dashboard?" dashboard-table":"")},s.a.createElement("thead",null,s.a.createElement("tr",{key:"history_header"},s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.status"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.info"})),s.a.createElement("th",null,s.a.createElement(u.a,{content:"gateway.time"})))),s.a.createElement("tbody",null,p)))))}}]),t}();Tt.propTypes={compactView:C.a.bool,maxHeight:C.a.number,fullHeight:C.a.bool,userId:C.a.number,assetId:C.a.number,assetName:C.a.string,recordType:C.a.number,userAccount:C.a.string},Tt.defaultProps={maxHeight:500,fullHeight:!1,pageSize:10};var jt=Tt,Mt=a(2033),It=a.n(Mt),Bt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Pt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={locale:e.settings.get("locale","en")},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Bt(t,[{key:"componentDidMount",value:function(){if(this.refs.agreement){var e=this.refs.agreement;It.a.initialize(e)}}},{key:"componentDidUpdate",value:function(){if(this.refs.agreement){var e=this.refs.agreement;It.a.update(e)}}},{key:"_getAgreement",value:function(e){switch(e){case"zh":case"cn":return s.a.createElement("div",{className:"container",ref:"agreement",style:{height:"500px",overflow:"auto",position:"relative"}},s.a.createElement("h2",{style:{textAlign:"center"}},"用户服务协议"),s.a.createElement("p",null,"OBSIDIAN TECHNOLOGY CO. PTE. LTD. 是一家根据新加坡共和国法律成立的公司，GDEX是由该公司运营的比特股网关(以下称“GDEX”或“本网关”)，主访问入口为https://www.gdex.io，GDEX是一个在比特股平台为用户提供数字资产充提服务（以下称“该服务”或“服务”）的平台。为了本协议表述之方便，公司和该网关在本协议中合称使用“我们”或其他第一人称称呼。使用该服务的自然人或其他主体均为本网关的用户，本协议为表述之便利，以下使用“您”或其他第二人称。我们和您在本协议中合称为“双方”，我们或您单称为“一方”。"),s.a.createElement("p",null,"重要提示："),s.a.createElement("p",null,"我们在此特别提醒您："),s.a.createElement("p",null," ","1. 数字资产本身不由任何金融机构或公司或本网关发行；"),s.a.createElement("p",null," ","2. 数字资产市场是全新的、未经确认的，而且可能不会增长；"),s.a.createElement("p",null," ","3. 数字资产主要由投机者大量使用，零售和商业市场使用相对较少，数字资产交易存在极高风险，其全天不间断交易，没有涨跌限制，价格容易受庄家、全球政府政策的影响而大幅波动；"),s.a.createElement("p",null," ","4. 因各国法律、法规和规范性文件的制定或者修改，数字资产交易随时可能被暂停或被禁止。"),s.a.createElement("p",null,"数字资产交易有极高风险，并不适合绝大部分人士。您了解和理解此投资有可能导致部分损失或全部损失，所以您应该以能承受的损失程度来决定投资的金额。您了解和理解数字资产会产生衍生风险，所以如有任何疑问，建议先寻求理财顾问的协助。此外，除了上述提及过的风险以外，还会有未能预测的风险存在。您应慎重考虑并用清晰的判断能力去评估自己的财政状况及上述各项风险而作出任何买卖数字资产的决定，并承担由此产生的全部损失，我们对此不承担任何责任。"),s.a.createElement("p",null,"敬告您："),s.a.createElement("p",null,"1.您了解比特股是基于区块链的去中心化交易平台，其基础账号服务和交易撮合服务都由比特股平台提供。亦有其它机构或个人在比特股平台上发行资产及／或提供服务。您了解本网关仅作为您向比特股平台充提数字资产的工具。本网关只对自身发行的交易代币资产（名称以GDEX.为前缀）负责，不对比特股上其它机构或个人发行的资产负责，本网关不参与您的任何交易，您应自行谨慎判断确定相关数字资产及/或信息的真实性、合法性和有效性，并自行承担因此产生的责任与损失。"),s.a.createElement("p",null," ","2. 比特股去中心化交易系统存有风险，包括但不限于软件，硬件和互联网链结的失败，用户账户系统的安全风险等。由于我们不能控制互联网以及比特股平台的可靠性和可用性，我们不会对上述风险造成的用户损失承担任何责任。"),s.a.createElement("p",null," ","3. 禁止使用本网关从事洗钱、走私、商业贿赂等一切非法交易活动，若发现此类事件，本网关将采取各种可使用之手段，包括但不限于中止提供服务，通知相关权力机关等，我们不承担由此产生的所有责任并保留向相关人士追究责任的权利。"),s.a.createElement("p",null,"一、总则"),s.a.createElement("p",null," ","1.1 您在使用本网关提供的服务之前，应仔细阅读本协议，如有不理解之处或其他必要，请咨询专业律师。如您不同意本协议及/或随时对其的修改，请您立即停止使用本网关提供的服务。使用本网关的任何服务即表示您已了解并完全同意本协议各项内容，包括本网关对本协议随时所做的任何修改。"),s.a.createElement("p",null," ","1.2 使用本网关提供的服务和功能，您将被视为已阅读，理解并："),s.a.createElement("p",null," 1.2.1 接受本协议所有条款及条件的约束。"),s.a.createElement("p",null," ","1.2.2 您确认您已年满21周岁或根据不同的可适用的法律规定的具有可订立合同的法定年龄，并有充分的能力接受这些条款，并订立交易，使用本网关进行数字资产交易。"),s.a.createElement("p",null," ","1.2.3 您保证交易中涉及到的属于您的数字资产均为合法取得并所有。"),s.a.createElement("p",null," ","1.2.4 您同意您为您自身的交易或非交易行为承担全部责任和任何收益或亏损。"),s.a.createElement("p",null," ","1.2.5 您同意遵守任何有关法律的规定，就税务目的而言，包括报告任何交易利润。"),s.a.createElement("p",null," ","1.2.6 本协议只是就您与我们之间达成的权利义务关系进行约束，而并不涉及本网关用户之间或其他网关和您之间因数字资产交易而产生的法律关系及法律纠纷。"),s.a.createElement("p",null,"二、协议修订"),s.a.createElement("p",null,"我们保留不时修订本协议、并以公示的方式进行公告、不再单独通知您的权利，变更后的协议会在本协议首页标注变更时间，一经在公布，立即自动生效。您应不时浏览及关注本协议的更新变更时间及更新内容，如您不同意相关变更，应当立即停止使用本网关服务；您继续使用本网关服务，即表示您接受并同意经修订的协议的约束。"),s.a.createElement("p",null,"三、服务"),s.a.createElement("p",null,"本网关只为您提供向比特股平台冲入和提取数字资产的服务，本网关并不作为买家或卖家参与买卖数字资产行为本身；本网关不提供任何国家法定货币充入和提取的相关服务。"),s.a.createElement("p",null," 3.1 服务内容"),s.a.createElement("p",null," ","3.1.1 您有权通过本网关向比特股平台冲入或提取数字资产。"),s.a.createElement("p",null," 3.1.2 本网关承诺为您提供的其他服务。"),s.a.createElement("p",null," 3.2.服务规则"),s.a.createElement("p",null," 您承诺遵守下列本网关服务规则："),s.a.createElement("p",null," ","3.2.1 您应当遵守法律法规、规章、及政策要求的规定，保证账户中所有数字资产来源的合法性，不得在本网关或利用本网关服务从事非法或其他损害本网关或第三方权益的活动，如发送或接收任何违法、违规、侵犯他人权益的信息，发送或接收传销材料或存在其他危害的信息或言论，未经本网关授权使用或伪造本网关电子邮件题头信息等。"),s.a.createElement("p",null," ","3.2.2 您在使用本网关服务之前应充分了解比特股账号的使用常识，做好相应账号的备份及密码保存工作，对于比特股账户安全问题造成的损失，本网关不承担任何责任。"),s.a.createElement("p",null," ","3.2.3 您在使用本网关提供的服务过程中，所产生的应纳税赋，以及一切硬件、软件、服务及其它方面的费用，均由您独自承担。"),s.a.createElement("p",null," ","3.2.4 您应当遵守本网关不时发布和更新的本协议以及其他服务条款和操作规则，有权随时终止使用本网关提供的服务。"),s.a.createElement("p",null,"四、本网关的权利和义务"),s.a.createElement("p",null,"4.1 本网关有权在发现本网关上显示的任何信息存在明显错误时，对信息予以更正。"),s.a.createElement("p",null,"4.2 本网关保留随时修改、中止或终止本网关服务的权利，本网关行使修改或中止服务的权利不需事先告知您；本网关终止本网关一项或多项服务的，终止自本网关在网关上发布终止公告之日生效。"),s.a.createElement("p",null," ","4.3 本网关应当采取必要的技术手段和管理措施保障本网关的正常运行。"),s.a.createElement("p",null,"五、赔偿"),s.a.createElement("p",null," ","5.1 在任何情况下，我们对您的直接损害的赔偿责任均不会超过您从使用本网关服务产生的为期三（ 3）个月的总费用。"),s.a.createElement("p",null,"六、寻求禁令救济的权利"),s.a.createElement("p",null,"我们和您均承认普通法对违约或可能违约情况的救济措施是可能是不足以弥补我们遭受的全部损失的，故非违约方有权在违约或可能违约情况下寻求禁令救济以及普通法或衡平法允许的其他所有的补救措施。"),s.a.createElement("p",null,"七、责任限制与免责"),s.a.createElement("p",null," ","7.1 您了解并同意，在任何情况下，我们不就以下各事项承担责任："),s.a.createElement("p",null," 7.1.1 收入的损失；"),s.a.createElement("p",null," 7.1.2 交易利润或合同损失；"),s.a.createElement("p",null," 7.1.3 业务中断"),s.a.createElement("p",null," 7.1.4 预期可节省的货币的损失；"),s.a.createElement("p",null," 7.1.5 信息的损失；"),s.a.createElement("p",null," 7.1.6 机会、商誉或声誉的损失；"),s.a.createElement("p",null," 7.1.7 数据的损坏或损失；"),s.a.createElement("p",null," 7.1.8 购买替代产品或服务的成本；"),s.a.createElement("p",null," ","7.1.9 任何由于侵权（包括过失）、违约或其他任何原因产生的间接的、特殊的或附带性的损失或损害，不论这种损失或损害是否可以为我们合理预见；不论我们是否事先被告知存在此种损 失或损害的可能性。"),s.a.createElement("p",null," ","7.2 您了解并同意，我们不对因下述任一情况而导致您的任何损害赔偿承担责任："),s.a.createElement("p",null," ","7.2.1 我们有合理的理由认为您的具体交易事项可能存在重大违法或违约情形。"),s.a.createElement("p",null," ","7.2.2 我们有合理的理由认为您在本网关的行为涉嫌违法或不当。"),s.a.createElement("p",null," ","7.2.3 通过本网关服务购买或获取任何数据、信息或进行交易等行为或替代行为产生的费用及损失。"),s.a.createElement("p",null," 7.2.4 您对本网关服务的误解。"),s.a.createElement("p",null," ","7.2.5 任何非因我们的原因而引起的与本网关提供的服务有关的其它损失。"),s.a.createElement("p",null," ","7.3 我们对由于信息网络设备维护、信息网络连接故障、电脑、通讯或其他系统的故障、电力故障、天气原因、意外事故、罢工、劳动争议、暴乱、起义、骚乱、生产力或生产资料不足、火灾、洪水、风暴、爆炸、战争、银行或其他合作方原因、数字资产市场崩溃、政府行为、 司法或行政机关的命令、其他不在我们可控范围内或我们无能力控制的行为或第三方的原因而造成的不能服务或延迟服务，以及造成的您的损失，我们不承担任何责任。"),s.a.createElement("p",null," ","7.4 我们不能保证本网关包含的全部信息、程序、文本等完全安全，不受任何病毒、木马等恶意程序的干扰和破坏，故您登陆、使用本网关任何服务或下载及使用该下载的任何程序、信息、数据等均是您个人的决定并自行承担风险及可能产生的损失。"),s.a.createElement("p",null," ","7.5 我们对本网关中链接的任何第三方网关的任何信息、产品及业务及其他任何形式的不属于我们的主体的内容等不做任何保证和承诺，您如果使用第三方网关提供的任何服务、信息及产品等均为您个人决定且承担由此产生的一切责任。"),s.a.createElement("p",null," ","7.6 我们对于您使用本网关服务不做任何明示或暗示的保证，包括但不限于本网关提供服务的适用性、没有错误或疏漏、持续性、准确性、可靠性、适用于某一特定用途。同时，我们也不对本网关提供的服务所涉及的技术及信息的有效性、准确性、正确性、可靠性、质量、稳定、完整和及时性作出任何承诺和保证。是否登陆或使用本网关提供的服务是您个人的决定且自行承担风险及可能产生的损失。我们对于数字资产的市场、价值及价格等不做任何明示或暗示的保证，您理解并了解数字资产市场是不稳定的，价格和价值随时会大幅波动或崩盘，交易数字资产是您个人的自由选择及决定且自行承担风险及可能产生的损失。"),s.a.createElement("p",null," ","7.7 本协议中规定的我们的保证和承诺是由我们就本协议和本网关提供的服务的唯一保证和陈述，并取代任何其他途径和方式产生的保证和承诺，无论是书面的或口头的，明示的或暗示的。所有这些保证和陈述仅仅代表我们自身的承诺和保证，并不保证任何第三方遵守本协议中的保证和承诺。"),s.a.createElement("p",null," ","7.8 我们并不放弃本协议中未提及的在法律适用的最大范围内我们享有的限制、免除或抵销我们损害赔偿责任的任何权利。"),s.a.createElement("p",null," ","7.9 使用本网关服务即表示认可我们按照本协议中规定的规则进行的任何操作，产生的任何风险均由您承担。"),s.a.createElement("p",null,"八、知识产权"),s.a.createElement("p",null," ","8.1 本网关所包含的全部智力成果包括但不限于网关标志、数据库、网关设计、文字和图表、软件、照片、录像、音乐、声音及其前述组合，软件编译、相关源代码和软件 (包括小应用程序和脚本) 的知识产权权利均归本网关所有。您不得为商业目的复制、更改、拷贝、发送或使用前述任何材料或内容。"),s.a.createElement("p",null," ","8.2 本网关名称中包含的所有权利 (包括但不限于商誉和商标、标志) 均归公司所有。"),s.a.createElement("p",null," ","8.3 您接受本协议即视为您主动将其在本网关发表的任何形式的信息的著作权， 包括但不限于：复制权、发行权、出租权、展览权、表演权、放映权、广播权、信息网络传播权、摄制权、改编权、翻译权、汇编权 以及应当由著作权人享有的其他可转让权利无偿独家转让给本网关所有，本网关有权利就任何主体侵权单独提起诉讼并获得全部赔偿。 本协议效力及于您在本网关发布的任何受著作权法保护的作品内容， 无论该内容形成于本协议签订前还是本协议签订后。"),s.a.createElement("p",null," ","8.4 您在使用本网关服务过程中不得非法使用或处分本网关或他人的知识产权权利。您不得将已发表于本网关的信息以任何形式发布或授权其它网关（及媒体）使用。"),s.a.createElement("p",null," ","8.5 您使用本网关提供的任何服务均不视为我们向您转让任何知识产权。"),s.a.createElement("p",null,"九、可分割性"),s.a.createElement("p",null,"如本协议中的任何条款被任何有管辖权的法院认定为不可执行的，无效的或非法的，并不影响本协议的其余条款的效力。"),s.a.createElement("p",null,"十、非代理关系"),s.a.createElement("p",null,"本协议中的任何规定均不可被认为创造了、暗示了或以其他方式将我们视为您的代理人、受托人或其他代表人，本协议有其他规定的除外。"),s.a.createElement("p",null,"十一、弃权"),s.a.createElement("p",null,"我们或您任何一方对追究本协议约定的违约责任或其他责任的弃权并不能认定或解释为对其他违约责任的弃权；未行使任何权利或救济不得以任何方式被解释为对该等权利或救济的放弃。"),s.a.createElement("p",null,"十二、标题"),s.a.createElement("p",null,"所有标题仅供协议表述方便，并不用于扩大或限制该协议条款的内容或范围。"),s.a.createElement("p",null,"十三、适用法律"),s.a.createElement("p",null,"本协议全部内容均为根据新加坡共和国法律订立的合同，其成立、解释、内容及执行均适用新加坡共和国相关法律规定；任何因或与本协议约定的服务有关而产生的索赔或诉讼，都应依照新加坡共和国的法律进行管辖并加以解释和执行。为避免疑义，这一条款明确适用于任何针对我们的侵权索赔。任何针对我们或者是和我们有关的索赔或诉讼的管辖法院或诉讼地均在新加坡共和国。您无条件地获得在新加坡共和国法院进行诉讼和上诉的排他性的管辖权。您也无条件地同意与本协议款有关的争议或问题或产生的任何索赔请求和诉讼的发生地或法院均排他性得在新加坡共和国。不方便法院的原则不适用于根据本服务条款的选择的法院。"),s.a.createElement("p",null,"十四、协议的生效和解释"),s.a.createElement("p",null,"14.1 本协议于您点击本网关注册页面的同意注册并完成注册程序、获得本网关账号和密码时生效，对本网关和您均具有约束力。"),s.a.createElement("p",null,"14.2 本协议的最终解释权归本网关所有。"));default:return s.a.createElement("div",{className:"container",ref:"agreement",style:{height:"500px",overflow:"auto",position:"relative"}},s.a.createElement("h2",{style:{textAlign:"center"}},"Service Agreement"),s.a.createElement("p",null,"OBSIDIAN TECHNOLOGY CO. PTE. LTD. (hereinafter referred to as the 'Company') is a company incorporated under the laws in Singapore Republic, GDEX (hereinafter referred to as 'GDEX' or 'the Gateway') is a cryptocurrency gateway to Bitshares which is operated by the company. The main access point for GDEX is https://gdex.io, GDEX is a gateway that provide cryptocurrency deposit and withdraw service (hereinafter referred to as 'the Service') to/from Bitshares. For the convenience of wording in this Agreement, the Company and the Gateway are referred to as 'We' or other applicable forms of first person pronouns in this Agreement. All natural persons or other subjects who use the Service shall be users of the Gateway. For the convenience of wording in this Agreement, the users are referred to as 'You' or any other applicable forms of the second-person pronouns. For the convenience of wording in this Agreement, you and us are collectively referred to as 'both parties', and individually as 'one party'."),s.a.createElement("p",null,"Important reminder:"),s.a.createElement("p",null,"We hereby remind you that:"),s.a.createElement("p",null,"1. The digital assets themselves are not offered by any financial institution, corporation or the Gateway;"),s.a.createElement("p",null,"2. The digital asset market is new and unconfirmed, and will not necessarily expand;"),s.a.createElement("p",null,"3. Digital assets are primarily used by speculators, and are used relatively less on retail and commercial markets; digital asset transactions are highly risky, due to the fact that they are traded throughout 24-hour a day without limits on the rise or fall in price, and market makers and global government policies may cause major fluctuations in their prices;"),s.a.createElement("p",null,"4. Digital asset transactions may be suspended or prohibited at any time due to the enactment or modification of national laws, regulations and regulatory documents. Digital assets trading is highly risky and therefore not suitable for the vast majority of people. You acknowledge and understand that investment in digital assets may result in partial or total loss of your investment and therefore you are advised to decide the amount of your investment on the basis of your loss-bearing capacity. You acknowledge and understand that digital assets may generate derivative risks. Therefore, if you have any doubt, you are advised to seek assistance from a financial adviser first. Furthermore, aside from the above-mentioned risks, there may also be unpredictable risks. Therefore, you are advised to carefully consider and use clear judgment to assess your financial position and the abovementioned risks before making any decisions on buying and selling digital assets; any and all losses arising therefrom will be borne by you and we shall not be held liable in any manner whatsoever."),s.a.createElement("p",null,"5. You understand that Bitshares is a decentralized exchange based on blockchain, the basic account service and the trade processing service are provided by Bitshares, there are also other institutions or single persons that issue assets and/or provide service on Bitshares. You understand that the Gateway is only used for you to deposit/withdraw cryptocurrency to/from Bitshares. The Gateway only undertake the due obligations for the availability of own issued assets (with 'GDEX.' as prefix of the name), do not undertake the due obligations for the account service and the trade processing service provided by Bitshares, do not undertake the due obligations for availability of the assets issued by other institutions or single persons."," "),s.a.createElement("p",null,"6. There are risk in both Internet and Bitshares, include but not limit to failure for software, hardware to connect to Internet, security risk for Bitshares accounting system. As the availability and reliability of Internet and Bitshares are not under our control, we do not undertake obligations for the loss caused by the risks mentioned above."),s.a.createElement("p",null,"7.it is prohibited to use the Gateway for money laundering, smuggling, bribery，if any user are found relevant to these actions, the Gateway will take various actions, include but not limited to terminating the Service to the user, informing relevant authority."))}}},{key:"render",value:function(){var e=this.props.locale;return this._getAgreement(e)}}]),t}();Pt.propTypes={locale:C.a.string};var Dt=Object(i.a)(Pt,{listenTo:function(){return[D.a]},getProps:function(){return{settings:D.a.getState().settings}}}),Ft=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Rt=new(a(2207))("-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCH+QtHPKcWxdL25xL4pCuu16tKh6yPx/TFnd/8\ncSt2TC+sPuYsD0h/sy4VKNxhBb7F7U/TLXjMxNcSfPVPjPM3X2LvOlmU9LOEcJGrmlmOOiyO/kws\nyKKOhR4UyZ1NghhfHjuyDBj6V8fCL+xBZTJWsh/X61Z0wLCwOzXcQCsNJwIDAQAB\n-----END PUBLIC KEY-----"),Wt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this)),n=e.viewSettings.get(e.provider+"Action","deposit");return a.state={isAgreementVisible:!1,coins:null,activeCoinInfo:a._getActiveCoinInfo(e,{action:n}),action:n,down:!1,isAvailable:!0,user_info:null,isAgree:!1,agreeChecked:!0,agreeNotice:!1,locale:e.viewSettings.get("locale"),intermediate:null,memo_rule:null},a.user_info_cache=new dt,a.showAgreement=a.showAgreement.bind(a),a.hideAgreement=a.hideAgreement.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Ft(t,[{key:"showAgreement",value:function(){this.setState({isAgreementVisible:!0})}},{key:"hideAgreement",value:function(){this.setState({isAgreementVisible:!1})}},{key:"_getActiveCoinInfo",value:function(e,t){var a=e.viewSettings.get("activeCoin_"+e.provider+"_"+t.action,null),n=e.viewSettings.get("activeCoinId_"+e.provider,null),s=null;s="deposit"==t.action?"BTC":"GDEX.BTC";var i=a||s,o=n||1002;return this._getWithdrawRule(o),{name:i,id:o}}},{key:"_transformCoin",value:function(e){var t=[];try{e.filter(function(e){return 0!=e.status}).forEach(function(e){var a={};1==e.type?(a.innerAssetId=e.assetId,a.innerAssetName=e.assetName,a.innerSymbol=e.assetSymbol,a.outerAssetId=e.relationId,a.outerAssetName=e.relationSymbol,a.outerSymbol=e.relationSymbol,a.status=e.withdrawStatus,a.gateFee=e.withdrawFees,a.needMemo=e.needMemo,a.minTransactionAmount=e.minWithdrawAmount,a.type=e.type,a.relationPrecision=e.relationPrecision):2==e.type?(a.innerAssetId=e.relationId,a.innerAssetName=e.relationSymbol,a.innerSymbol=e.relationSymbol,a.outerAssetId=e.assetId,a.outerAssetName=e.assetName,a.outerSymbol=e.assetSymbol,a.status=e.depositStatus,a.gateFee=e.depositFees,a.needMemo=e.needMemo,a.minTransactionAmount=e.minDepositAmount,a.type=e.type,a.relationPrecision=e.relationPrecision):a=null,a&&t.push(a)})}catch(e){console.log("Transform coin failed: ",e)}return t}},{key:"_getUserInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e||(e=this.props.account.get("name")),t||(t=this.state.isAgree),t){var a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.GET_USER_INFO,t)}({userAccount:e,isAgree:t}),n=this;a.then(function(t){var a=t.user;n.setState({isAgree:!0,user_info:{user_id:a.uid,status:a.status}}),0==a.status&&a.agreeAgreement?n.user_info_cache.cacheUserInfo(e,a.uid,a.status):n.user_info_cache.delUserInfo(e)}),a.catch(function(e){console.log("Exception in fetching user info: "+e)})}}},{key:"_getCoins",value:function(){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.requestType||(e.requestType=0),e.assetType||(e.assetType=0),e.version||(e.version="1.1"),rt(e,w.f.BASE+w.f.ASSET_LIST,t)}({userAccount:this.props.account.get("name")}),t=this;e.then(function(e){var a=t._transformCoin(e.assets);t.setState({isAvailable:!0,coins:a})},function(e){console.log("fail"+e)}),e.catch(function(e){console.log(e),t.setState({isAvailable:!1})})}},{key:"_checkIsAgree",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e=this.props.account.get("name"));var t=this.user_info_cache.getUserInfo(e);if(t)this.setState({user_info:t,isAgree:!0});else{var a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.USER_AGREEMENT,t)}({userAccount:e}),n=this;a.then(function(t){t.agree?(n.setState({isAgree:!0}),n._getUserInfo(e,!0)):n.setState({isAgree:!1})},function(e){console.log("fail"+e)}),a.catch(function(e){console.log(e),n.setState({isAvailable:!1})})}}},{key:"componentWillMount",value:function(){this._checkIsAgree(),this._getCoins()}},{key:"_getWithdrawAssetId",value:function(e){var t=1,a="innerSymbol";return"deposit"==this.state.action&&(t=2,a="outerSymbol"),this.state.coins.filter(function(n){return n.type==t&&n[a]==e})[0].innerAssetId}},{key:"onSelectCoin",value:function(e){var t=this.state.activeCoinInfo;t.name=e.target.value;var a=this._getWithdrawAssetId(e.target.value);t.id=a,this.setState({activeCoinInfo:t}),this._getWithdrawRule(a);var n={};n["activeCoin_"+this.props.provider+"_"+this.state.action]=e.target.value,n["activeCoinId_"+this.props.provider]=a,F.a.changeViewSetting(n)}},{key:"_getWithdrawRule",value:function(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return rt(e,w.f.BASE+w.f.WITHDRAW_RULE,t)}({assetId:e}),a=this;t.then(function(e){var t=Rt.decryptPublic(e.transferToAccount,"utf-8");a.setState({intermediate:t,memo_rule:e.memoRule})},function(e){console.log("fail"+e),a.setState({intermediate:null})}),t.catch(function(e){console.log(e),a.setState({intermediate:null})})}},{key:"changeAction",value:function(e){var t=this._getActiveCoinInfo(this.props,{action:e});this.setState({action:e,activeCoinInfo:t}),F.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},this.props.provider+"Action",e))}},{key:"componentWillReceiveProps",value:function(e){this.props.account!=e.account&&this._checkIsAgree(e.account.get("name"))}},{key:"_updateCheck",value:function(){this.setState({agreeChecked:!this.state.agreeChecked}),this.setState({agreeNotice:!1})}},{key:"_showUserAgreement",value:function(){this.showAgreement()}},{key:"_registerUser",value:function(){this.state.agreeChecked?this._getUserInfo(null,!0):this.setState({agreeNotice:!0})}},{key:"render",value:function(){var e=this.props.account,t=this.state,a=t.coins,n=t.activeCoinInfo,i=t.action,o=t.isAvailable,r=t.user_info,l=t.isAgree,c=t.agreeChecked,p=t.agreeNotice,d=t.intermediate,m=t.memo_rule,h="https://support.gdex.io/",_="602573197",f="https://t.me/GDEXer",y=s.a.createElement("div",null,s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement(u.a,{content:"gateway.support_gdex"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("p",null,"Help:"," ",s.a.createElement("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"external-link"},h)),s.a.createElement("p",null,"QQ:"," ",s.a.createElement("a",{target:"_blank",href:"//shang.qq.com/wpa/qunwpa?idkey=5d192c325146762cf5a9256038fed9faef4fcace21a36882854354dd1d599f11",rel:"noopener noreferrer"},_)),s.a.createElement("p",null,"Telegram:"," ",s.a.createElement("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"external-link"},f)));if(!l)return s.a.createElement("div",null,s.a.createElement("span",null,s.a.createElement("input",{type:"checkbox",style:{marginRight:"10px"},checked:c,onChange:this._updateCheck.bind(this)}),s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.hint"}),s.a.createElement("a",{onClick:this._showUserAgreement.bind(this)}," ",s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.name"}))),p?s.a.createElement("div",{className:"has-error",style:{paddingTop:10}},s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.notice"})):null,s.a.createElement("div",{className:"buttonGroup"},s.a.createElement("span",{style:{marginTop:"20px"},onClick:this._registerUser.bind(this),className:" button"},s.a.createElement(u.a,{className:"txtlabel",content:"gateway.agreement.register"}))),s.a.createElement(M.Modal,{footer:[s.a.createElement(M.Button,{type:"primary",key:"close",onClick:this.hideAgreement},x.a.translate("modal.close"))],visible:this.state.isAgreementVisible,onCancel:this.hideAgreement},s.a.createElement("br",null),s.a.createElement("div",{className:"grid-block vertical"},s.a.createElement(Dt,{onCancel:this.hideAgreement,locale:this.props.settings.get("locale","en")}))),y);if(!a&&o)return s.a.createElement(v.a,null);if(!o)return s.a.createElement("div",null,s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"h4"}));var g=null,w=null,b=null;"deposit"==i?(w="outerAssetId",g="outerSymbol",b=2):(w="innerAssetId",g="innerSymbol",b=1);var E=(a=a.filter(function(e){return e.type==b})).map(function(e){return s.a.createElement("option",{value:e[g],key:e[g]},e[g])}).filter(function(e){return null!==e}),k=a.filter(function(e){return e[g]==n.name})[0],C=null;return k&&0==k.status?r?0!=r.status&&(C=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.frozen",account:e.get("name"),component:"h4"}))):C=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.user_unavailable",component:"h4"})):C=s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.asset_unavailable",asset:n.name,component:"h4"})),s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+i}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:n.name},E))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===i?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===i?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),C||s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(St,{account:e,coin:k,issuer_account:d,user_id:r.user_id,action:this.state.action,gateway:"gdex",btsCoin:k.innerSymbol,memo_rule:m})),s.a.createElement(jt,{userId:r.user_id,userAccount:e.get("name"),assetId:k[w],assetName:k[g],compactView:!0,fullHeight:!0,recordType:"deposit"==i?1:2,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+this.state.action})})),y)}}]),t}(),qt=Object(i.a)(Wt,{listenTo:function(){return[D.a]},getProps:function(){return{viewSettings:D.a.getState().viewSettings,settings:D.a.getState().settings}}}),Lt=a(2288),Ut=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Vt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.current_xbtsx_address_cache_version_string="1"}return Ut(e,[{key:"getIndexForDepositKeyInExchange",value:function(e,t,a){return[this.current_xbtsx_address_cache_version_string,e,t,a].reduce(function(e,t){return e.concat("[",t,"]")},"")}},{key:"getCachedInputAddress",value:function(e,t,a,n){var s=H.a.getWallet();if(!s)return null;s.deposit_keys=s.deposit_keys||{},s.deposit_keys[e]=s.deposit_keys[e]||{};var i=this.getIndexForDepositKeyInExchange(t,a,n);s.deposit_keys[e][i]=s.deposit_keys[e][i]||[];var o=s.deposit_keys[e][i].length;return o?s.deposit_keys[e][i][o-1]:null}},{key:"cacheInputAddress",value:function(e,t,a,n,s,i){var o=H.a.getWallet();if(!o)return null;o.deposit_keys=o.deposit_keys||{},o.deposit_keys[e]=o.deposit_keys[e]||{};var r=this.getIndexForDepositKeyInExchange(t,a,n);o.deposit_keys[e][r]=o.deposit_keys[e][r]||[],o.deposit_keys[e][r].push({address:s,memo:i}),H.a._updateWallet()}}]),e}(),Ht=a(2120),Jt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var zt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.deposit_address_cache=new Vt,a.state={isModalVisible:!1,account_name:null,receive_address:null},a.addDepositAddress=a.addDepositAddress.bind(a),a.showModal=a.showModal.bind(a),a.hideModal=a.hideModal.bind(a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Jt(t,[{key:"showModal",value:function(){this.setState({isModalVisible:!0})}},{key:"hideModal",value:function(){this.setState({isModalVisible:!1})}},{key:"_getDepositObject",value:function(){return{walletType:this.props.deposit_wallet_type,inputCoinType:this.props.deposit_coin_type,outputCoinType:this.props.receive_coin_type,outputAddress:this.props.account.get("name"),stateCallback:this.addDepositAddress}}},{key:"addDepositAddress",value:function(e){var t=this.props.account.get("name");this.setState({account_name:t}),this.setState({receive_address:e})}},{key:"getWithdrawModalId",value:function(){return"withdraw_asset_"+this.props.issuer_account.get("name")+"_"+this.props.receive_asset.get("symbol")}},{key:"onWithdraw",value:function(){this.showModal()}},{key:"render",value:function(){var e=s.a.createElement("div",{style:{display:"none",minHeight:150}});if(!this.props.account||!this.props.issuer_account||!this.props.receive_asset)return e;var t=this.props.account.get("balances");if(this.props.deprecated_in_favor_of){var a=!1,n=t.get(this.props.receive_asset.get("id"));if(n){var i=m.ChainStore.getObject(n);if(i)0!=i.get("balance")&&(a=!0)}if(!a)return e}var o=null;if(this.state.account_name===this.props.account.get("name")&&(o=this.state.receive_address),!o)this.props.account.get("name");if(!o)return Object(Ht.b)(this._getDepositObject()),e;var r=this.getWithdrawModalId(),c=null,p=null,d="",h="sth:"+o.address+"?vendorField="+this.props.account.get("name"),g=!1;"STH"===this.props.deposit_asset&&(g=!0);var w=void 0;if(this.props.deposit_account){c=s.a.createElement("span",null,this.props.deposit_account),d=this.props.deposit_account,w="dex:"+this.props.account.get("name"),p=s.a.createElement("span",null,w);var v=this.props.deposit_coin_type+":"}else{o.memo?(w=o.memo,d=o.address,c=s.a.createElement("span",null,o.address),p=s.a.createElement("span",null,o.memo)):(d=o.address,c=s.a.createElement("span",null,o.address));v=""}var b=l.a.format_number(this.props.min_amount/l.a.get_asset_precision(this.props.asset_precision),this.props.asset_precision,!1);return"deposit"===this.props.action?s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_deposit"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.your_account"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1})))))),w?null:s.a.createElement("div",{className:"QR"},s.a.createElement(ht.a,{size:128,value:d}))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.deposit_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.deposit_to",asset:this.props.deposit_asset}),":"),s.a.createElement("label",{className:"left-label"},s.a.createElement("b",null,s.a.createElement(u.a,{content:"gateway.xbtsx.min_amount",minAmount:b,symbol:this.props.deposit_coin_type}))),s.a.createElement("div",{style:{padding:"10px 0",fontSize:"1.1rem"}},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{style:{textTransform:"uppercase"},content:"gateway.address"}),":"," ",s.a.createElement(O,{replaceCopyText:x.a.translate("gateway.use_copy_button")},s.a.createElement("b",null,c)))),p?s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{style:{textTransform:"uppercase"},content:"gateway.memo"}),":"," ",s.a.createElement(O,{replaceCopyText:x.a.translate("gateway.use_copy_button")},s.a.createElement("b",null," ",p," ")))):null)),s.a.createElement("div",{className:"button-group",style:{paddingTop:10}},c?s.a.createElement(j.a,{text:d},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"gateway.copy_address"}))):null,w?s.a.createElement(j.a,{text:w},s.a.createElement("div",{className:"button"},s.a.createElement(u.a,{content:"gateway.copy_memo"}))):null,g?s.a.createElement("a",{className:"button",href:h},s.a.createElement(u.a,{content:"gateway.deposit_from_wallet"})," ",this.props.deposit_asset):null),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_amount",minDeposit:b,coin:this.props.deposit_asset}),s.a.createElement(u.a,{className:"has-error fz_14",component:"p",content:"gateway.min_deposit_warning_asset",minDeposit:b,coin:this.props.deposit_asset})))):s.a.createElement("div",{className:"rudex__gateway grid-block no-padding no-margin"},s.a.createElement("div",{className:"small-12 medium-5"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_summary"}),s.a.createElement("div",{className:"small-12 medium-10"},s.a.createElement("table",{className:"table"},s.a.createElement("tbody",null,s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_withdraw"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(f.a,{name:this.props.receive_asset.get("symbol"),replace:!1}))),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.asset_to_receive"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},this.props.deposit_asset)),s.a.createElement("tr",null,s.a.createElement(u.a,{component:"td",content:"gateway.intermediate"}),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(y.a,{account:this.props.issuer_account.get("id")}))),s.a.createElement("tr",null,s.a.createElement("td",null,s.a.createElement(u.a,{content:"gateway.balance"}),":"),s.a.createElement("td",{style:{fontWeight:"bold",color:"#049cce",textAlign:"right"}},s.a.createElement(_.a,{account:this.props.account.get("name"),asset:this.props.receive_asset.get("symbol"),replace:!1}))))))),s.a.createElement("div",{className:"small-12 medium-7"},s.a.createElement(u.a,{component:"h4",content:"gateway.withdraw_inst"}),s.a.createElement("label",{className:"left-label"},s.a.createElement(u.a,{content:"gateway.withdraw_to",asset:this.props.deposit_asset}),":"),s.a.createElement("div",{className:"button-group",style:{paddingTop:20}},s.a.createElement("button",{className:"button success",style:{fontSize:"1.3rem"},onClick:this.onWithdraw.bind(this)},s.a.createElement(u.a,{content:"gateway.withdraw_now"})," "))),s.a.createElement(M.Modal,{onCancel:this.hideModal,title:x.a.translate("gateway.withdraw_coin",{coin:this.props.deposit_asset_name,symbol:this.props.deposit_asset}),footer:null,visible:this.state.isModalVisible,id:r,overlay:!0},s.a.createElement(Lt.a,{hideModal:this.hideModal,showModal:this.showModal,account:this.props.account.get("name"),issuer:this.props.issuer_account.get("name"),asset:this.props.receive_asset.get("symbol"),output_coin_name:this.props.deposit_asset_name,output_coin_symbol:this.props.deposit_asset,output_coin_type:this.props.deposit_coin_type,output_wallet_type:this.props.deposit_wallet_type,output_supports_memos:this.props.supports_output_memos,memo_prefix:v,modal_id:r,min_amount:this.props.min_amount,withdraw_fee:this.props.withdraw_fee,asset_precision:this.props.asset_precision,balance:this.props.account.get("balances").toJS()[this.props.receive_asset.get("id")]})))}}]),t}();zt.propTypes={gateway:C.a.string,deposit_coin_type:C.a.string,deposit_asset_name:C.a.string,deposit_account:C.a.string,receive_coin_type:C.a.string,account:p.a.ChainAccount,issuer_account:p.a.ChainAccount,deposit_asset:C.a.string,deposit_wallet_type:C.a.string,receive_asset:p.a.ChainAsset,deprecated_in_favor_of:p.a.ChainAsset,deprecated_message:C.a.string,action:C.a.string,supports_output_memos:C.a.bool.isRequired,min_amount:C.a.number,deposit_fee:C.a.number,withdraw_fee:C.a.number,asset_precision:C.a.number};var Xt=Object(d.a)(zt,{keep_updating:!0}),Gt=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();var Kt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={activeCoin:a._getActiveCoin(e,{action:"deposit"}),action:e.viewSettings.get("xbtsxAction","deposit")},a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s.a.Component),Gt(t,[{key:"_getActiveCoin",value:function(e,t){var a=e.viewSettings.get("activeCoin_xbtsx_"+t.action,null),n=null;return"deposit"==t.action&&(n="PPY"),"withdraw"==t.action&&(n="PPY"),a||n}},{key:"componentWillReceiveProps",value:function(e){e.provider!==this.props.provider&&this.setState({activeCoin:this._getActiveCoin(e,this.state.action)})}},{key:"onSelectCoin",value:function(e){this.setState({activeCoin:e.target.value});var t={};t["activeCoin_xbtsx_"+this.state.action]=e.target.value,F.a.changeViewSetting(t)}},{key:"changeAction",value:function(e){var t=this._getActiveCoin(this.props,{action:e});this.setState({action:e,activeCoin:t}),F.a.changeViewSetting(function(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}({},"xbtsxAction",e))}},{key:"render",value:function(){var e=this,t=this.props,a=t.coins,n=t.account,i=this.state,o=i.activeCoin,r=i.action;if(!a.length)return s.a.createElement(v.a,null);var l=a.filter(function(e){return!(!e||!e.symbol)&&("deposit"===r?e.depositAllowed:e.withdrawalAllowed)}),c=l.map(function(e){var t="deposit"===r?e.backingCoin.toUpperCase():e.symbol;return s.a.createElement("option",{value:t,key:e.symbol},t)}).filter(function(e){return null!==e}),p=l.filter(function(e){return"deposit"===r?e.backingCoin.toUpperCase()===o:e.symbol===o})[0];p||(p=l[0]);var d="deposit"===this.state.action;return s.a.createElement("div",{style:this.props.style},s.a.createElement("div",{className:"grid-block no-margin vertical medium-horizontal no-padding"},s.a.createElement("div",{className:"medium-4"},s.a.createElement("div",null,s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.choose_"+r}),":"," "),s.a.createElement("select",{className:"external-coin-types bts-select",onChange:this.onSelectCoin.bind(this),value:o},c))),s.a.createElement("div",{className:"medium-6 medium-offset-1"},s.a.createElement("label",{style:{minHeight:"2rem"},className:"left-label"},s.a.createElement(u.a,{content:"gateway.gateway_text"}),":"),s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{className:"deposit"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"deposit")},s.a.createElement(u.a,{content:"gateway.deposit"}))),s.a.createElement("li",{className:"withdraw"===r?"is-active":""},s.a.createElement("a",{onClick:this.changeAction.bind(this,"withdraw")},s.a.createElement(u.a,{content:"gateway.withdraw"}))))))),p?s.a.createElement("div",null,s.a.createElement("div",{style:{marginBottom:15}},s.a.createElement(Xt,{key:""+p.symbol,gateway:p.gatewayWallet,issuer_account:p.issuer,account:n,deposit_asset:p.backingCoin.toUpperCase(),deposit_asset_name:p.name,deposit_coin_type:p.backingCoin.toLowerCase(),deposit_account:p.gatewayWallet,deposit_wallet_type:p.walletType,receive_asset:p.symbol,receive_coin_type:p.symbol.toLowerCase(),supports_output_memos:p.memoSupport,min_amount:p.minAmount,asset_precision:p.precision,action:this.state.action}),s.a.createElement("label",{className:"left-label"},"Support"),s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.xbtsx.support_block"}),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("a",{href:"https://t.me/xbtsio",target:"_blank",rel:"noopener noreferrer",className:"external-link"},"https://t.me/xbtsio"))),p&&p.symbol?s.a.createElement(R.b,{asset:p.symbol,fromAccount:d?p.issuerId:this.props.account.get("id"),to:d?this.props.account.get("id"):p.issuerId},function(t){var a=t.asset,n=t.to,i=t.fromAccount;return s.a.createElement(R.a,{accountsList:q.a.List([e.props.account.get("id")]),limit:10,compactView:!0,fullHeight:!0,filter:"transfer",title:s.a.createElement(u.a,{content:"gateway.recent_"+e.state.action}),customFilter:{fields:["to","from","asset_id"],values:{to:n.get("id"),from:i.get("id"),asset_id:a.get("id")}}})}):null):null)}}]),t}(),Qt=Object(i.a)(Kt,{listenTo:function(){return[D.a]},getProps:function(){return{viewSettings:D.a.getState().viewSettings}}}),Yt=a(618),Zt=a(612),$t=a(27),ea=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();function ta(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aa(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function na(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var sa=function(e){function t(e){ta(this,t);var a=aa(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={olService:e.viewSettings.get("olService","gateway"),rudexService:e.viewSettings.get("rudexService","gateway"),bitsparkService:e.viewSettings.get("bitsparkService","gateway"),xbtsxService:e.viewSettings.get("xbtsxService","gateway"),btService:e.viewSettings.get("btService","bridge"),citadelService:e.viewSettings.get("citadelService","bridge"),metaService:e.viewSettings.get("metaService","bridge"),activeService:e.viewSettings.get("activeService",0)},a}return na(t,s.a.Component),ea(t,[{key:"shouldComponentUpdate",value:function(e,t){return e.account!==this.props.account||e.servicesDown!==this.props.servicesDown||!l.a.are_equal_shallow(e.blockTradesBackedCoins,this.props.blockTradesBackedCoins)||!l.a.are_equal_shallow(e.openLedgerBackedCoins,this.props.openLedgerBackedCoins)||!l.a.are_equal_shallow(e.citadelBackedCoins,this.props.citadelBackedCoins)||t.olService!==this.state.olService||t.rudexService!==this.state.rudexService||t.bitsparkService!==this.state.bitsparkService||t.xbtsxService!==this.state.xbtsxService||t.btService!==this.state.btService||t.citadelService!==this.state.citadelService||t.metaService!==this.state.metaService||t.activeService!==this.state.activeService}},{key:"componentWillMount",value:function(){o.a.getFinalFeeAsset(this.props.account,"transfer")}},{key:"toggleOLService",value:function(e){this.setState({olService:e}),F.a.changeViewSetting({olService:e})}},{key:"toggleRuDEXService",value:function(e){this.setState({rudexService:e}),F.a.changeViewSetting({rudexService:e})}},{key:"toggleXbtsxService",value:function(e){this.setState({xbtsxService:e}),F.a.changeViewSetting({xbtsxService:e})}},{key:"toggleBitSparkService",value:function(e){this.setState({bitsparkService:e}),F.a.changeViewSetting({bitsparkService:e})}},{key:"toggleBTService",value:function(e){this.setState({btService:e}),F.a.changeViewSetting({btService:e})}},{key:"toggleCitadelService",value:function(e){this.setState({citadelService:e}),F.a.changeViewSetting({citadelService:e})}},{key:"toggleMetaService",value:function(e){this.setState({metaService:e}),F.a.changeViewSetting({metaService:e})}},{key:"onSetService",value:function(e){this.setState({activeService:parseInt(e.target.value)}),F.a.changeViewSetting({activeService:parseInt(e.target.value)})}},{key:"renderServices",value:function(e,t,a,n){var i=[],o=this.props.account,r=this.state,l=r.olService,c=r.btService,p=r.rudexService,d=r.bitsparkService,m=r.xbtsxService,h=r.citadelService;return i.push({name:"Openledger (OPEN.X)",identifier:"OPEN",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleOLService.bind(this,"gateway"),className:"gateway"===l?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))),s.a.createElement("li",{onClick:this.toggleOLService.bind(this,"fiat"),className:"fiat"===l?"is-active":""},s.a.createElement(u.a,{component:"a",content:"gateway.fiat"})))),"gateway"===l&&e.length?s.a.createElement(V,{account:o,coins:e,provider:"openledger"}):null,"fiat"===l?s.a.createElement("div",null,s.a.createElement("div",{style:{paddingBottom:15}},s.a.createElement(u.a,{component:"h5",content:"gateway.fiat_text",unsafe:!0})),s.a.createElement(pe,{rpc_url:w.h.RPC_URL,account:o,issuer_account:"openledger-fiat"}),s.a.createElement(he,{rpc_url:w.h.RPC_URL,account:o})):null)}),i.push({name:"RuDEX (RUDEX.X)",identifier:"RUDEX",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleRuDEXService.bind(this,"gateway"),className:"gateway"===p?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))),s.a.createElement("li",{onClick:this.toggleRuDEXService.bind(this,"fiat"),className:"fiat"===p?"is-active":""},s.a.createElement("a",null,"Fiat")))),"gateway"===p&&t.length?s.a.createElement(Je,{account:o,coins:t}):null,"fiat"===p?s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.rudex.coming_soon"})):null)}),i.push({name:"BitSpark (SPARKDEX.X)",identifier:"SPARKDEX",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleBitSparkService.bind(this,"gateway"),className:"gateway"===d?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))))),"gateway"===d&&a.length?s.a.createElement(at,{account:o,coins:a,provider:"bitspark"}):null)}),i.push({name:"XBTS (XBTSX.X)",identifier:"XBTSX",template:s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleXbtsxService.bind(this,"gateway"),className:"gateway"===m?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.gateway"}))),s.a.createElement("li",{onClick:this.toggleXbtsxService.bind(this,"fiat"),className:"fiat"===m?"is-active":""},s.a.createElement("a",null,"Fiat")))),"gateway"===m&&n.length?s.a.createElement(Qt,{account:o,coins:n}):null,"fiat"===m?s.a.createElement("div",null,s.a.createElement(u.a,{content:"gateway.xbtsx.coming_soon"})):null)}),i.push({name:"BlockTrades",identifier:"TRADE",template:s.a.createElement("div",null,s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleBTService.bind(this,"bridge"),className:"bridge"===c?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.bridge"}))))),s.a.createElement(_e.a,{gateway:"blocktrades",issuer_account:"blocktrades",account:o,initial_deposit_input_coin_type:"btc",initial_deposit_output_coin_type:"bts",initial_deposit_estimated_input_amount:"1.0",initial_withdraw_input_coin_type:"bts",initial_withdraw_output_coin_type:"btc",initial_withdraw_estimated_input_amount:"100000",initial_conversion_input_coin_type:"bts",initial_conversion_output_coin_type:"bitbtc",initial_conversion_estimated_input_amount:"1000",params:this.props.location})),s.a.createElement("div",{className:"content-block"}))}),i.push({name:"Citadel",identifier:"CITADEL",template:s.a.createElement("div",null,s.a.createElement("div",{className:"content-block"},s.a.createElement("div",{className:"service-selector",style:{marginBottom:"2rem"}},s.a.createElement("ul",{className:"button-group segmented no-margin"},s.a.createElement("li",{onClick:this.toggleCitadelService.bind(this,"bridge"),className:"bridge"===h?"is-active":""},s.a.createElement("a",null,s.a.createElement(u.a,{content:"gateway.bridge"}))))),s.a.createElement(Me,{gateway:"citadel",issuer_account:"citadel-wallet",account:o,initial_deposit_input_coin_type:"xmr",initial_deposit_output_coin_type:"citadel.monero",initial_deposit_estimated_input_amount:"1.0",initial_withdraw_input_coin_type:"citadel.monero",initial_withdraw_output_coin_type:"xmr",initial_withdraw_estimated_input_amount:"1.0"})),s.a.createElement("div",{className:"content-block"}))}),i.push({name:"GDEX",identifier:"GDEX",template:s.a.createElement("div",null,s.a.createElement(qt,{account:o,provider:"gdex"}))}),i}},{key:"render",value:function(){var e=this,t=this.props,a=t.account,n=t.servicesDown,i=this.state.activeService,o=this.props.openLedgerBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),r=this.props.rudexBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),l=this.props.bitsparkBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),c=this.props.xbtsxBackedCoins.map(function(e){return e}).sort(function(e,t){return e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0}),p=this.renderServices(o,r,l,c),d=[],m=p.map(function(e,t){return d.push(e.identifier),s.a.createElement("option",{key:t,value:t},e.name)}),h=d[i],_=n.get(h);return s.a.createElement("div",{className:this.props.contained?"grid-content":"grid-container"},s.a.createElement("div",{className:this.props.contained?"":"grid-content",style:{paddingTop:"2rem"}},s.a.createElement("div",{className:"grid-block vertical medium-horizontal no-margin no-padding"},s.a.createElement("div",{style:{paddingBottom:"1rem"}},s.a.createElement(Yt.a,{ref:"deposit_modal",modalId:"deposit_modal_new",account:this.props.currentAccount,backedCoins:this.props.backedCoins}),s.a.createElement(Zt.a,{ref:"withdraw_modal",modalId:"withdraw_modal_new",backedCoins:this.props.backedCoins}),s.a.createElement($t.a,{string:"gateway.phase_out_warning",keys:[{arg:"deposit_modal_link",value:s.a.createElement("a",{onClick:function(){e.refs.deposit_modal&&e.refs.deposit_modal.show()}},s.a.createElement(u.a,{content:"modal.deposit.submit"}))},{arg:"withdraw_modal_link",value:s.a.createElement("a",{onClick:function(){e.refs.withdraw_modal&&e.refs.withdraw_modal.show()}},s.a.createElement(u.a,{content:"modal.withdraw.submit"}))}]}))),s.a.createElement(u.a,{content:"gateway.title",component:"h2"}),s.a.createElement("div",{className:"grid-block vertical medium-horizontal no-margin no-padding"},s.a.createElement("div",{className:"medium-6 show-for-medium"},s.a.createElement(Ie.a,{path:"components/DepositWithdraw",section:"deposit-short"})),s.a.createElement("div",{className:"medium-5 medium-offset-1"},s.a.createElement(Ie.a,{account:a.get("name"),path:"components/DepositWithdraw",section:"receive"}))),s.a.createElement("div",null,s.a.createElement("div",{className:"grid-block vertical medium-horizontal no-margin no-padding"},s.a.createElement("div",{className:"medium-6 small-order-2 medium-order-1"},s.a.createElement(u.a,{component:"label",className:"left-label",content:"gateway.service"}),s.a.createElement("select",{onChange:this.onSetService.bind(this),className:"bts-select",value:i},m),_?s.a.createElement(u.a,{style:{color:"red",marginBottom:"1em",display:"block"},content:"gateway.unavailable_"+h}):null),s.a.createElement("div",{className:"medium-5 medium-offset-1 small-order-1 medium-order-2",style:{paddingBottom:20}},s.a.createElement(u.a,{component:"label",className:"left-label",content:"gateway.your_account"}),s.a.createElement("div",{className:"inline-label"},s.a.createElement(Xe.a,{size:{height:40,width:40},account:a.get("name"),custom_image:null}),s.a.createElement("input",{type:"text",value:a.get("name"),placeholder:null,disabled:!0,onChange:function(){},onKeyDown:function(){},tabIndex:1}))))),s.a.createElement("div",{className:"grid-content no-padding",style:{paddingTop:15}},_?null:i&&p[i]?p[i].template:p[0].template)))}}]),t}();sa.propTypes={account:p.a.ChainAccount.isRequired,contained:C.a.bool},sa.defaultProps={contained:!1},sa=Object(d.a)(sa);var ia=function(e){function t(){return ta(this,t),aa(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return na(t,s.a.Component),ea(t,[{key:"componentWillMount",value:function(){Object(r.g)()}},{key:"render",value:function(){return s.a.createElement(sa,this.props)}}]),t}();t.default=Object(i.a)(ia,{listenTo:function(){return[Be.a,D.a,ze.a]},getProps:function(){return{currentAccount:Be.a.getState().currentAccount||Be.a.getState().passwordAccount,account:Be.a.getState().currentAccount,viewSettings:D.a.getState().viewSettings,backedCoins:ze.a.getState().backedCoins,openLedgerBackedCoins:ze.a.getState().backedCoins.get("OPEN",[]),rudexBackedCoins:ze.a.getState().backedCoins.get("RUDEX",[]),bitsparkBackedCoins:ze.a.getState().backedCoins.get("SPARKDEX",[]),blockTradesBackedCoins:ze.a.getState().backedCoins.get("TRADE",[]),citadelBackedCoins:ze.a.getState().backedCoins.get("CITADEL",[]),xbtsxBackedCoins:ze.a.getState().backedCoins.get("XBTSX",[]),servicesDown:ze.a.getState().down||{}}}})}}]);
  //# sourceMappingURL=deposit-withdraw.js.map