import * as React from 'react';

import { cx, css } from '@neliosoft/inlexa/css';

export type StatusGraphicProps = {
	readonly className?: string;
	readonly type?: 'success' | 'error';
};

const STYLE = css( { width: '150px' } );

export const StatusGraphic = ( {
	className,
	type = 'success',
}: StatusGraphicProps ): JSX.Element => (
	<svg
		className={ cx( STYLE, className ) }
		aria-hidden="true"
		focusable="false"
		role="img"
		xmlns="http://www.w3.org/2000/svg"
		viewBox="0 0 53 53"
	>
		<path
			className={ css( { fill: 'currentColor' } ) }
			d={ 'success' === type ? SUCCESS_PATH : ERROR_PATH }
		/>
	</svg>
);

const SUCCESS_PATH =
	'm 26.4778,5.04866 c -4.9881,-0.015 -9.2374,2.454 -12.131,6.91804 -1.7049,2.63 -2.9544,5.949 -3.683,9.874 l -5.874,-4.489 c 0.097,-0.257 0.1524,-0.534 0.1524,-0.824 0,-1.298 -1.0667,-2.365 -2.3652,-2.365 -1.2985,0 -2.3652,1.067 -2.3652,2.365 0,1.299 1.0667,2.365 2.3652,2.365 0.5315,0 1.023,-0.18 1.4195,-0.481 l 6.4224,4.907 c -0.3434,2.34 -0.5149,4.873 -0.492,7.597 v 11.901 h 5.8136 c -0.5609,0.648 -0.9033,1.489 -0.9033,2.408 0,2.029 1.658,3.688 3.6871,3.688 2.0291,0 3.6876,-1.659 3.6876,-3.688 0,-0.919 -0.3424,-1.76 -0.9033,-2.408 h 10.309 c -0.561,0.648 -0.9039,1.489 -0.9039,2.408 0,2.029 1.6586,3.688 3.6877,3.688 2.0291,0 3.6876,-1.659 3.6876,-3.688 0,-0.919 -0.3428,-1.76 -0.9038,-2.408 h 5.8143 v -11.906 c 0,-2.706 -0.142,-5.22 -0.428,-7.542 l 6.488,-4.958 c 0.397,0.301 0.888,0.482 1.42,0.482 1.298,0 2.365,-1.066 2.365,-2.365 0,-1.298 -1.067,-2.365 -2.365,-2.365 -1.298,0 -2.365,1.067 -2.365,2.365 0,0.29 0.055,0.567 0.152,0.824 l -5.905,4.514 c -0.618,-3.926 -1.694,-7.24 -3.2865,-9.875 C 36.377,7.52666 32.1327,5.06666 26.4778,5.04866 Z m -0.004,1.325 c 5.2852,0.016 8.9705,2.168 11.4685,6.30104 2.4982,4.133 3.7352,10.314 3.7352,18.236 v 5.32 H 11.2493 v -5.322 -0.004 c -0.0663,-7.872 1.5094,-14.055 4.207,-18.217 2.6976,-4.16104 6.4599,-6.32804 11.0174,-6.31404 z m -5.4844,4.74 c -2.3892,0 -4.6061,1.75904 -5.5097,3.84704 -0.9877,2.283 -0.0575,4.904 0.912,6.885 0.1571,0.321 0.3591,0.738 0.662,1.115 0.3029,0.378 0.7689,0.768 1.3968,0.768 h 0.4196 7.5918 7.5939 0.4201 c 0.6279,0 1.0933,-0.388 1.3963,-0.766 0.303,-0.377 0.5048,-0.796 0.662,-1.117 0.9695,-1.981 1.8982,-4.602 0.9105,-6.885 -0.9036,-2.088 -3.119,-3.84704 -5.5082,-3.84704 h -0.4372 -5.0374 -5.0348 z m 0,1.32404 h 0.4377 5.0348 5.0374 0.4372 c 1.6908,0 3.6116,1.47 4.2948,3.049 0.7054,1.63 0.0199,3.931 -0.8847,5.779 -0.1513,0.31 -0.3305,0.649 -0.5074,0.87 -0.177,0.22 -0.2896,0.271 -0.3633,0.271 h -0.4201 -7.5939 -7.5918 -0.4196 c -0.0737,0 -0.1864,-0.051 -0.3633,-0.271 -0.1768,-0.221 -0.3565,-0.56 -0.5079,-0.87 -0.9046,-1.848 -1.5901,-4.149 -0.8847,-5.779 0.6833,-1.579 2.604,-3.049 4.2948,-3.049 z m -18.4123,3.047 c 0.5835,0 1.0413,0.46 1.0413,1.043 0,0.584 -0.4578,1.041 -1.0413,1.041 -0.5835,0 -1.0428,-0.457 -1.0428,-1.041 0,-0.583 0.4593,-1.043 1.0428,-1.043 z m 47.9024,0 c 0.584,0 1.043,0.46 1.043,1.043 0,0.584 -0.459,1.041 -1.043,1.041 -0.583,0 -1.043,-0.457 -1.043,-1.041 0,-0.583 0.46,-1.043 1.043,-1.043 z m -30.0689,-0.004 c -0.5145,0.003 -0.9301,0.421 -0.9302,0.936 -2e-4,0.516 0.4186,0.935 0.9354,0.935 0.5167,0 0.9356,-0.419 0.9353,-0.935 0,-0.517 -0.4188,-0.936 -0.9353,-0.936 z m 12.0938,0 c -0.5145,0.003 -0.9301,0.421 -0.9301,0.936 -3e-4,0.516 0.4185,0.935 0.9353,0.935 0.517,10e-4 0.9361,-0.418 0.9359,-0.935 -1e-4,-0.517 -0.4191,-0.936 -0.9359,-0.936 z m -2.3078,2.824 c -1.6546,1.316 -2.9904,1.732 -4.1507,1.653 -1.1602,-0.08 -2.2239,-0.674 -3.2794,-1.627 l -0.8862,0.982 c 1.1824,1.068 2.5224,1.857 4.0757,1.963 1.5533,0.107 3.2408,-0.486 5.0648,-1.936 z m -3.6975,8.465 c -0.9771,0 -1.8544,0.43 -2.4582,1.109 -0.1517,0.15 -0.278,0.324 -0.3762,0.516 -0.2895,0.489 -0.4584,1.058 -0.4584,1.666 0,1.815 1.4782,3.291 3.2928,3.291 1.8146,0 3.2913,-1.476 3.2913,-3.291 0,-1.814 -1.4767,-3.291 -3.2913,-3.291 z m 0,0.53 c 1.5287,0 2.7616,1.233 2.7616,2.761 0,1.529 -1.2329,2.762 -2.7616,2.762 -1.4212,0 -2.587,-1.067 -2.744,-2.445 0.3568,0.563 0.9836,0.939 1.6971,0.939 1.107,0 2.0097,-0.903 2.0097,-2.01 0,-0.941 -0.6536,-1.733 -1.5297,-1.949 0.183,-0.038 0.3725,-0.058 0.5669,-0.058 z m -1.0469,0.527 c 0.6992,0 1.2798,0.479 1.4371,1.128 -0.2119,-0.196 -0.4924,-0.32 -0.802,-0.32 -0.6535,0 -1.1896,0.537 -1.1896,1.19 0,0.395 0.1976,0.743 0.4966,0.96 -0.7938,-0.031 -1.4227,-0.676 -1.4227,-1.478 0,-0.238 0.0576,-0.462 0.1566,-0.661 0.0839,-0.14 0.1787,-0.273 0.2853,-0.396 0.2667,-0.262 0.6327,-0.423 1.0387,-0.423 z m 0.6351,1.338 c 0.3674,0 0.6578,0.293 0.6578,0.66 0,0.367 -0.2904,0.658 -0.6578,0.658 -0.3675,0 -0.6605,-0.291 -0.6605,-0.658 0,-0.367 0.293,-0.66 0.6605,-0.66 z m -14.8379,8.388 h 30.4281 v 3.942 H 11.2493 Z m 1.2754,1.285 v 1.325 h 27.8767 v -1.325 z m 5.9996,4.022 c 1.3142,0 2.3653,1.051 2.3653,2.365 0,1.314 -1.0511,2.365 -2.3653,2.365 -1.3141,0 -2.3652,-1.051 -2.3652,-2.365 0,-1.314 1.0511,-2.365 2.3652,-2.365 z m 15.8771,0 c 1.3141,0 2.3652,1.051 2.3652,2.365 0,1.314 -1.0511,2.365 -2.3652,2.365 -1.3142,0 -2.3653,-1.051 -2.3653,-2.365 0,-1.314 1.0511,-2.365 2.3653,-2.365 z m -15.8771,1.228 c -0.6279,0 -1.1369,0.509 -1.1369,1.137 10e-5,0.627 0.5091,1.136 1.1369,1.136 0.6279,0 1.1369,-0.509 1.1369,-1.136 0,-0.628 -0.509,-1.137 -1.1369,-1.137 z m 15.8771,0 c -0.6279,0 -1.1369,0.509 -1.1369,1.137 0,0.627 0.509,1.136 1.1369,1.136 0.6278,0 1.1368,-0.509 1.1369,-1.136 0,-0.628 -0.509,-1.137 -1.1369,-1.137 z';

const ERROR_PATH =
	'm 26.37781,5.04972 c -4.988,-0.015 -9.239,2.454 -12.133,6.91798 -2.074,3.2 -3.477,7.417 -4.082,12.513 l -0.049,-0.021 -3.1449905,7.638 c -0.274,-0.028 -0.556,-0.009 -0.837,0.066 -1.25381,0.336 -2.00841,1.642 -1.67231,2.897 0.336,1.254 1.64231,2.008 2.89731,1.672 1.254,-0.336 2.008,-1.643 1.672,-2.897 -0.138,-0.514 -0.44,-0.942 -0.833,-1.247 l 1.6630083,-4.036 c -0.026001,0.773 -0.041001,1.558 -0.034001,2.364 v 11.901 h 5.8129822 c -0.56,0.647 -0.903,1.487 -0.903,2.406 0,2.029 1.661,3.69 3.69,3.69 2.029,0 3.687,-1.661 3.687,-3.69 0,-0.919 -0.342,-1.759 -0.902,-2.406 h 10.304 c -0.56,0.647 -0.902,1.487 -0.902,2.406 0,2.029 1.659,3.69 3.688,3.69 2.029,0 3.689,-1.661 3.689,-3.69 0,-0.919 -0.342,-1.759 -0.903,-2.406 h 5.813 v -11.906 c 0,-0.779 -0.015,-1.537 -0.038,-2.284 l 1.631,3.961 c -0.393,0.305 -0.695,0.733 -0.833,1.247 -0.336,1.254 0.419,2.561 1.673,2.897 1.254,0.336 2.56,-0.418 2.897,-1.672 0.336,-1.255 -0.418,-2.561 -1.673,-2.897 -0.28,-0.075 -0.562,-0.094 -0.836,-0.066 l -3.121,-7.578 c -0.51,-5.107 -1.684,-9.321 -3.624,-12.53 -2.698,-4.46398 -6.942,-6.92198 -12.596999,-6.93998 z m -0.006,1.323 c 5.285,0.016 8.973,2.169 11.471,6.30198 2.498,4.133 3.732,10.315 3.732,18.237 v 5.32 h -30.426 v -5.325 l -0.002,-0.001 c -0.066,-7.873 1.512,-14.058 4.209,-18.219 2.698,-4.16198 6.458,-6.32898 11.016,-6.31398 z m -5.484,4.74198 c -2.39,0 -4.605,1.759 -5.509,3.847 -0.987,2.283 -0.059,4.904 0.911,6.885 0.157,0.321 0.361,0.737 0.664,1.115 0.303,0.378 0.766,0.768 1.394,0.768 h 0.422 7.592 7.592 0.42 c 0.627,0 1.093,-0.39 1.396,-0.768 0.303,-0.378 0.507,-0.794 0.664,-1.115 0.97,-1.981 1.898,-4.602 0.91,-6.885 -0.903,-2.088 -3.12,-3.847 -5.509,-3.847 h -0.438 -5.035 -5.037 z m 0,1.322 h 0.437 5.037 5.035 0.438 c 1.69,0 3.611,1.472 4.295,3.051 0.705,1.63 0.019,3.929 -0.885,5.777 -0.152,0.309 -0.329,0.649 -0.506,0.869 -0.177,0.221 -0.292,0.274 -0.365,0.274 h -0.42 l -7.592,-0.002 -7.592,0.002 h -0.422 c -0.074,0 -0.186,-0.053 -0.363,-0.274 -0.177,-0.22 -0.355,-0.559 -0.506,-0.869 -0.905,-1.848 -1.59,-4.147 -0.885,-5.777 0.684,-1.579 2.603,-3.051 4.294,-3.051 z m -0.469,2.282 -0.935,0.935 0.955,0.954 -0.955,0.954 0.935,0.934 0.955,-0.953 0.954,0.953 0.935,-0.934 -0.954,-0.954 0.954,-0.954 -0.935,-0.935 -0.954,0.954 z m 9.951,0 -0.936,0.935 0.955,0.954 -0.955,0.954 0.936,0.934 0.954,-0.953 0.954,0.953 0.936,-0.934 -0.955,-0.954 0.955,-0.954 -0.936,-0.935 -0.954,0.954 z m -6.201,4.947 v 1.323 h 4.386 v -1.323 z m 2.228,7.103 c -1.024,0 -1.94,0.47 -2.544,1.206 -0.111,0.124 -0.206,0.261 -0.283,0.41 -0.293,0.491 -0.464,1.063 -0.464,1.675 0,1.815 1.477,3.293 3.291,3.293 1.815,0 3.291,-1.478 3.291,-3.293 0,-1.815 -1.476,-3.291 -3.291,-3.291 z m 0,0.529 c 1.529,0 2.762,1.233 2.762,2.762 0,1.529 -1.233,2.764 -2.762,2.764 -1.42,0 -2.584,-1.067 -2.742,-2.445 0.357,0.563 0.984,0.939 1.697,0.939 1.107,0 2.01,-0.903 2.01,-2.01 0,-0.943 -0.656,-1.736 -1.535,-1.951 0.184,-0.038 0.375,-0.059 0.57,-0.059 z m -1.045,0.528 c 0.7,0 1.28,0.48 1.438,1.13 -0.213,-0.197 -0.495,-0.32 -0.805,-0.32 -0.654,0 -1.189,0.534 -1.189,1.188 0,0.395 0.198,0.745 0.497,0.962 -0.793,-0.032 -1.423,-0.677 -1.423,-1.478 0,-0.238 0.057,-0.462 0.156,-0.661 0.083,-0.139 0.177,-0.27 0.282,-0.392 0.267,-0.265 0.636,-0.429 1.044,-0.429 z m 0.633,1.339 c 0.367,0 0.66,0.291 0.66,0.659 0,0.367 -0.293,0.66 -0.66,0.66 -0.368,0 -0.66,-0.293 -0.66,-0.66 0,-0.368 0.292,-0.659 0.66,-0.659 z m -19.2999905,4.241 c 0.487,-0.031 0.935,0.279 1.067,0.773 0.151,0.563 -0.174,1.126 -0.737,1.277 -0.564,0.151 -1.1269,-0.174 -1.2779,-0.738 -0.151,-0.564 0.1738,-1.126 0.7379,-1.277 0.07,-0.019 0.14,-0.03 0.21,-0.035 z m 39.3179905,0 c 0.07,0.005 0.141,0.016 0.211,0.035 0.564,0.151 0.889,0.713 0.738,1.277 -0.151,0.564 -0.714,0.889 -1.278,0.738 -0.563,-0.151 -0.888,-0.714 -0.737,-1.277 0.132,-0.494 0.579,-0.804 1.066,-0.773 z m -34.854,4.148 h 30.426 v 3.939 h -30.426 z m 1.276,1.285 v 1.323 h 27.874 v -1.323 z m 6,4.02 c 1.314,0 2.365,1.051 2.365,2.365 0,1.314 -1.051,2.365 -2.365,2.365 -1.314,0 -2.368,-1.051 -2.368,-2.365 0,-1.314 1.054,-2.365 2.368,-2.365 z m 15.875,0 c 1.314,0 2.367,1.051 2.367,2.365 0,1.314 -1.053,2.365 -2.367,2.365 -1.314,0 -2.366,-1.051 -2.366,-2.365 0,-1.314 1.052,-2.365 2.366,-2.365 z m -15.876,1.229 c -0.628,0 -1.137,0.509 -1.137,1.137 0,0.628 0.509,1.137 1.137,1.137 0.628,0 1.137,-0.509 1.137,-1.137 0,-0.628 -0.509,-1.137 -1.137,-1.137 z m 15.876,0 c -0.628,0 -1.137,0.509 -1.137,1.137 0,0.628 0.509,1.137 1.137,1.137 0.628,0 1.137,-0.509 1.137,-1.137 0,-0.628 -0.509,-1.137 -1.137,-1.137 z';
