import{s as e,_ as r}from"./style-inject.es-f40f6556.js";import{Select as n}from"@transferwise/components";import t from"prop-types";import c from"react";import{useIntl as a}from"react-intl";import{g as o,a as i}from"./currencies-e242ca53.js";var s={"tw-select":"cc_tw-select_3804785543",twSelect:"cc_tw-select_3804785543"};function l(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?l(Object(t),!0).forEach(function(n){r(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function p(e,r){return e.currency.localeCompare(r.currency)}function f(e){return{currency:e.code,value:e.code,label:e.code,note:e.name}}function b(e,r,n){return function(e){return e?e.map(o).filter(function(e){return void 0!==e}):i()}(n).map(function(e){return{code:e.code,name:r({id:e.nameTranslationKey})}}).filter(function(r){return"".concat(r.code," ").concat(r.name).toLowerCase().includes(e.toLowerCase())}).map(f).sort(p)}function d(e,r){var n=o(e);if(n&&n.code&&n.nameTranslationKey)return f({code:n.code,name:r({id:n.nameTranslationKey})})}e(".cc_tw-select_3804785543 a{text-decoration:none}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9jb21tb24vQ3VycmVuY3lTZWxlY3Rvci5tb2R1bGUubGVzcyIsIkN1cnJlbmN5U2VsZWN0b3IubW9kdWxlLmxlc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMkJBQ0Usb0JDQ0YiLCJmaWxlIjoiQ3VycmVuY3lTZWxlY3Rvci5tb2R1bGUubGVzcyJ9 */");var y=function(e){var r=e.type,t=e.currencyCode,o=e.style,i=e.search,l=e.onSelectChange,p=e.onSearchChange,f=e.availableCurrencies,y=e.disabled,m=a().formatMessage;return c.createElement(n,{classNames:u(u({},o),s),selected:t?d(t,m):null,onChange:l(r),onSearchChange:p,searchValue:i,options:b(i,m,f),searchPlaceholder:m({id:"search-currency"}),placeholder:m({id:"search-currency"}),disabled:y})};y.propTypes={type:t.string.isRequired,currencyCode:t.string.isRequired,style:t.shape({}).isRequired,search:t.string,onSelectChange:t.func,onSearchChange:t.func,availableCurrencies:t.arrayOf(t.string),disabled:t.bool},y.defaultProps={search:"",onSelectChange:function(){},onSearchChange:function(){},availableCurrencies:null,disabled:!1};export{y as C};
//# sourceMappingURL=CurrencySelector-ca77202c.js.map
