--- import { getMessages } from '../../i18n/messages.ts'; interface Props { locale: string; /** Unique per diagram on the page; prefixes ids inside the SVG. */ uid: string; } const { locale, uid } = Astro.props; const t = getMessages(locale); const arrowV = `${uid}-apw-arrow-v`; const arrowA = `${uid}-apw-arrow-a`; // Labels too long for one line in the label column are split in two. function twoLines(label: string): [string, string] { const words = label.split(' '); const split = Math.ceil(words.length / 2); return [words.slice(0, split).join(' '), words.slice(split).join(' ')]; } const windowLines = twoLines(t['diagram.label.aortopulmonary-window']); const valveLines = twoLines(t['diagram.label.two-separate-valves']); const lungFlowLines = twoLines(t['diagram.label.much-blood-to-lungs']); const lvLines = twoLines(t['diagram.label.lv-dilated']); // The heart is drawn in its own coordinates and shifted right by 150, as in the truncus diagram; // labels sit in the free column on the left. Vessels are tubes: a wide stroke in the wall colour // under a narrower one in the blood colour. The pulmonary trunk leaves the right ventricle and the // aorta the left one, each through its own valve; just above the valves the two vessels lie side // by side, so their walls touch and form one shared wall at x = 160 (Минздрав 730_2, 1.1). const vessel = { // The pulmonary trunk ends in a rounded top (round line cap) where its two branches leave it. pulmonaryTrunk: 'M120,190 V158 C120,140 138,138 138,124 V84', // With the defect the pulmonary artery is dilated (Минздрав 730_2, 1.6), so the tube is wider; // its centre moves left so that the shared wall stays at x = 160. pulmonaryTrunkWide: 'M120,190 V158 C120,140 134,138 134,124 V84', pulmonaryBranches: ['M138,74 L112,26', 'M138,74 L70,46'], aorta: 'M200,190 V158 C200,140 182,138 182,124 V0', }; const flow = { toLungsUp: 'M120,222 V158 C120,140 138,138 138,124 V74 L114,32', toLungsLeft: 'M120,222 V158 C120,140 138,138 138,124 V74 L76,48', toLungsUpWide: 'M120,222 V158 C120,140 134,138 134,124 V74 L114,32', toLungsLeftWide: 'M120,222 V158 C120,140 134,138 134,124 V74 L76,48', toAorta: 'M200,222 V158 C200,140 182,138 182,124 V10', // Type I window: blood from the aorta crosses the shared wall into the pulmonary artery. shunt: 'M192,109 L130,109', }; --- {vessel.pulmonaryBranches.map((d) => ( ))} {vessel.pulmonaryBranches.map((d) => ( ))} {t['diagram.label.rv']} {t['diagram.label.lv']} {lvLines[0]} {lvLines[1]} {t['diagram.label.aorta']} {t['diagram.label.septum']} {lungFlowLines[0]} {lungFlowLines[1]} {windowLines[0]} {windowLines[1]} {t['diagram.label.pulmonaryArtery']} {valveLines[0]} {valveLines[1]}