{"version":3,"file":"utils-82346768.js","sources":["../src/components/Payment/Utils/utils.ts"],"sourcesContent":["\r\nexport const IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';\r\nexport const IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';\r\nexport const IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';\r\n\r\ntype AddImageProcessOptions = {\r\n small?: boolean;\r\n large?: boolean;\r\n custom?: boolean;\r\n width?: string;\r\n height?: string;\r\n}\r\n\r\nexport function addImageProcess(url: string, options: AddImageProcessOptions = { width: '36px', height: '36px' }) {\r\n // 防止重复添加导致的url不正确\r\n if (url && url.indexOf('x-oss-process') > -1) {\r\n return url;\r\n }\r\n if (options.small) {\r\n return url + IMAGE_PROCESS_SMALL;\r\n }\r\n if (options.large) {\r\n return url + IMAGE_PROCESS_LARGE;\r\n }\r\n if (options.custom) {\r\n return `${url}?x-oss-process=image/resize,limit_0,m_fill,w_${options.width},h_${options.height}`;\r\n }\r\n return url + IMAGE_PROCESS;\r\n}\r\n\r\nexport function formatMoney(input: any, fuzz = 2) {\r\n if (isNaN(+input)) {\r\n return input;\r\n }\r\n return (+input).toFixed(fuzz);\r\n}\r\n\r\ntype classSize = 'small'|'normal'|'large';\r\n\r\nexport function exportStyleSizeClass(styles: any, size: classSize) {\r\n return {\r\n [styles[size]]: true,\r\n }\r\n}"],"names":["IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","addImageProcess","url","options","width","height","indexOf","small","large","custom","formatMoney","input","fuzz","isNaN","toFixed","exportStyleSizeClass","styles","size"],"mappings":";;;;AACO,IAAMA,aAAa,GAAG,mCAAtB;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AACP,AAAO,IAAMC,mBAAmB,GAAG,mCAA5B;AAUP,AAAO,SAASC,eAAT,CAAyBC,GAAzB,EAA2G;MAArEC,OAAqE,uEAAnC;IAAEC,KAAK,EAAE,MAAT;IAAiBC,MAAM,EAAE;GAAU;;;MAE5GH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAY,eAAZ,IAA+B,CAAC,CAA3C,EAA8C;WACrCJ,GAAP;;;MAEEC,OAAO,CAACI,KAAZ,EAAmB;WACVL,GAAG,GAAGH,mBAAb;;;MAEEI,OAAO,CAACK,KAAZ,EAAmB;WACVN,GAAG,GAAGF,mBAAb;;;MAEEG,OAAO,CAACM,MAAZ,EAAoB;qBACRP,GAAV,0DAA6DC,OAAO,CAACC,KAArE,gBAAgFD,OAAO,CAACE,MAAxF;;;SAEKH,GAAG,GAAGJ,aAAb;;AAGF,AAAO,SAASY,WAAT,CAAqBC,KAArB,EAA2C;MAAVC,IAAU,uEAAH,CAAG;;MAC5CC,KAAK,CAAC,CAACF,KAAF,CAAT,EAAmB;WACVA,KAAP;;;SAEK,CAAC,CAACA,KAAF,EAASG,OAAT,CAAiBF,IAAjB,CAAP;;AAKF,AAAO,SAASG,oBAAT,CAA8BC,MAA9B,EAA2CC,IAA3C,EAA4D;8CAE9DD,MAAM,CAACC,IAAD,CADT,EACkB,IADlB;;;;;;;"}