
---
export { Props } from './Props';

let {
	size,
	title,
	color,
	width = size,
	height = size,
	type,
	fill = 'none',
	stroke = 'none',
	...props
} = {
	'fill-rule': 'evenodd',
	'title': 'Fatrows',
	'viewBox': '0 0 24 24',
	...Astro.props
}

const styleDictionary = { 
  'bold': '<path d="M19.9 13.5H4.1c-1.5 0-2.1.64-2.1 2.23v4.04C2 21.36 2.6 22 4.1 22h15.8c1.5 0 2.1-.64 2.1-2.23v-4.04c0-1.59-.6-2.23-2.1-2.23ZM12.9 2H4.1C2.6 2 2 2.64 2 4.23v4.04c0 1.59.6 2.23 2.1 2.23h8.8c1.5 0 2.1-.64 2.1-2.23V4.23C15 2.64 14.4 2 12.9 2Z" />',
  'broken': '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M22 15.73c0-1.59-.6-2.23-2.1-2.23H4.1c-1.5 0-2.1.64-2.1 2.23v4.04C2 21.36 2.6 22 4.1 22h15.8c1.5 0 2.1-.64 2.1-2.23M2 8.27c0 1.59.6 2.23 2.1 2.23h8.8c1.5 0 2.1-.64 2.1-2.23V4.23C15 2.64 14.4 2 12.9 2H4.1C2.6 2 2 2.64 2 4.23" />',
  'bulk': '<path d="M19.9 13.5H4.1c-1.5 0-2.1.64-2.1 2.23v4.04C2 21.36 2.6 22 4.1 22h15.8c1.5 0 2.1-.64 2.1-2.23v-4.04c0-1.59-.6-2.23-2.1-2.23Z" /><path d="M12.9 2H4.1C2.6 2 2 2.64 2 4.23v4.04c0 1.59.6 2.23 2.1 2.23h8.8c1.5 0 2.1-.64 2.1-2.23V4.23C15 2.64 14.4 2 12.9 2Z" opacity=".4" />',
  'linear': '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.9 13.5H4.1c-1.5 0-2.1.64-2.1 2.23v4.04C2 21.36 2.6 22 4.1 22h15.8c1.5 0 2.1-.64 2.1-2.23v-4.04c0-1.59-.6-2.23-2.1-2.23ZM12.9 2H4.1C2.6 2 2 2.64 2 4.23v4.04c0 1.59.6 2.23 2.1 2.23h8.8c1.5 0 2.1-.64 2.1-2.23V4.23C15 2.64 14.4 2 12.9 2Z" />',
  'outline': '<path d="M19.9 22.75H4.1c-1.92 0-2.85-.98-2.85-2.98v-4.04c0-2.01.93-2.98 2.85-2.98h15.8c1.92 0 2.85.98 2.85 2.98v4.04c0 2-.93 2.98-2.85 2.98Zm-15.8-8.5c-1.01 0-1.35.21-1.35 1.48v4.04c0 1.27.34 1.48 1.35 1.48h15.8c1.01 0 1.35-.21 1.35-1.48v-4.04c0-1.27-.34-1.48-1.35-1.48H4.1ZM12.9 11.25H4.1c-1.92 0-2.85-.98-2.85-2.98V4.23c0-2.01.93-2.98 2.85-2.98h8.8c1.92 0 2.85.98 2.85 2.98v4.04c0 2-.93 2.98-2.85 2.98Zm-8.8-8.5c-1.01 0-1.35.21-1.35 1.48v4.04c0 1.27.34 1.48 1.35 1.48h8.8c1.01 0 1.35-.21 1.35-1.48V4.23c0-1.27-.34-1.48-1.35-1.48H4.1Z" />',
  'twotone': '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.9 13.5H4.1c-1.5 0-2.1.64-2.1 2.23v4.04C2 21.36 2.6 22 4.1 22h15.8c1.5 0 2.1-.64 2.1-2.23v-4.04c0-1.59-.6-2.23-2.1-2.23Z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12.9 2H4.1C2.6 2 2 2.64 2 4.23v4.04c0 1.59.6 2.23 2.1 2.23h8.8c1.5 0 2.1-.64 2.1-2.23V4.23C15 2.64 14.4 2 12.9 2Z" opacity=".4" />'
}

switch (type) {
  case 'bold':
  case 'bulk':
  case 'outline':
    fill = color;
    break;
  case 'broken':
  case 'linear':
  case 'twotone':
    stroke = color;
    break;
  default:
    stroke = color;
    break;
}

const toAttributeSize = (size: number) => String(size).replace(/(?<=[0-9])x$/, 'em');
if (!size) {
  size = '24px';
  width = size;
  height = size;
}
size = toAttributeSize(size);
width = toAttributeSize(width);
height = toAttributeSize(height);
let svg = '<title>Fatrows</title>';
svg += styleDictionary[type] ? styleDictionary[type] : styleDictionary['linear'];
---
<svg set:html={svg} width={width} height={height} fill={fill} stroke={stroke} {...props}></svg>
