import{s as e,_ as a}from"./style-inject.es-f40f6556.js";import{getRateInAllFormats as t}from"@transferwise/formatting";import r from"prop-types";import n from"react";import{useIntl as i}from"react-intl";var c=function(e,a){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.04;return!!a&&e>=a-a*(t/100)},s={goodExchangeRate:"cc_goodExchangeRate_3804785543","animate-blink":"cc_animate-blink_3804785543",animateBlink:"cc_animate-blink_3804785543",badExchangeRate:"cc_badExchangeRate_3804785543",rateAndIndicator:"cc_rateAndIndicator_3804785543","rateAndIndicator-md":"cc_rateAndIndicator-md_3804785543",rateAndIndicatorMd:"cc_rateAndIndicator-md_3804785543",rate:"cc_rate_3804785543"};function o(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,r)}return t}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}e('.cc_goodExchangeRate_3804785543{display:flex;order:1;margin-left:var(--size-4);animation:cc_animate-blink_3804785543 3s linear infinite alternate}.cc_goodExchangeRate_3804785543:before{content:"";width:var(--size-8);height:var(--size-8);margin-top:-2px;border-radius:100%;background:var(--color-sentiment-positive)}.cc_badExchangeRate_3804785543{display:flex;order:1;margin-left:var(--size-4);animation:cc_animate-blink_3804785543 3s linear infinite alternate}.cc_badExchangeRate_3804785543:before{content:"";width:var(--size-8);height:var(--size-8);margin-top:-2px;border-radius:100%;background:var(--color-sentiment-negative)}.cc_rateAndIndicator_3804785543{display:flex!important;align-items:center}@media (min-width:768px){.cc_rateAndIndicator-md_3804785543{display:flex!important}}.cc_rate_3804785543{font-weight:var(--font-weight-semi-bold)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jb21tb24vRXhjaGFuZ2VSYXRlSW5kaWNhdG9yLm1vZHVsZS5sZXNzIiwic3JjL3Jlc291cmNlcy9zdGF0aWMvbGVzcy9kb3QtYW5pbWF0aW9uLm1vZHVsZS5sZXNzIiwiRXhjaGFuZ2VSYXRlSW5kaWNhdG9yLm1vZHVsZS5sZXNzIiwic3JjL3Jlc291cmNlcy9zdGF0aWMvbGVzcy91dGlsaXRpZXMubW9kdWxlLmxlc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsZ0NDQ0UsWUFBQSxDQUNBLE9BQUEsQ0FDQSx5QkFBQSxDQXVCQSxrRUN6QkYsQ0RJRSx1Q0FDRSxVQUFBLENBQ0EsbUJBQUEsQ0FDQSxvQkFBQSxDQUNBLGVBQUEsQ0FDQSxrQkFBQSxDQUNBLDBDQ0ZKLENGSkEsK0JDSkUsWUFBQSxDQUNBLE9BQUEsQ0FDQSx5QkFBQSxDQXVCQSxrRUNYRixDRFZFLHNDQUNFLFVBQUEsQ0FDQSxtQkFBQSxDQUNBLG9CQUFBLENBQ0EsZUFBQSxDQUNBLGtCQUFBLENBQ0EsMENDWUosQ0ZiQSxnQ0dWRSxzQkFBQSxDQTREQSxrQkRqQ0YsQ0N4QkkseUJBQUEsbUNBQ0Usc0JEMkJKLENBQ0YsQ0ZqQkEsb0JBQ0Usd0NFbUJGIiwiZmlsZSI6IkV4Y2hhbmdlUmF0ZUluZGljYXRvci5tb2R1bGUubGVzcyJ9 */');var d=function(e){var a,r=e.styles,o=e.referenceRate,d=e.rate,Q=e.label,m=e.sourceCurrency,b=e.targetCurrency,g=l(l({},s),r),p=i(),x=p.locale,u=p.formatMessage,E=t(d,m,b,{},x);return n.createElement(n.Fragment,null,n.createElement("span",{className:g.rateAndIndicator,"data-testid":"exchange-rate-indicator"},o&&(c(d,o)?n.createElement("span",{className:g.goodExchangeRate,"aria-label":u({id:"good-exchange-rate"})}):n.createElement("span",{className:g.badExchangeRate,"aria-label":u({id:"bad-exchange-rate"})})),n.createElement("span",{className:g.rate},E?null===(a=E.formats)||void 0===a?void 0:a.equation.calculationInDecimal:null)),Q)};d.propTypes={styles:r.shape({rateAndIndicator:r.string,goodExchangeRate:r.string,badExchangeRate:r.string}),sourceCurrency:r.string.isRequired,targetCurrency:r.string.isRequired,rate:r.number.isRequired,referenceRate:r.number,label:r.element},d.defaultProps={styles:{},referenceRate:void 0,label:void 0};export{d as E,c as i};
//# sourceMappingURL=ExchangeRateIndicator-9bf28f63.js.map
