Topic: make presentation for "Treatment plan for heart failure"

Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Searching PubMed

"heart failure" AND "treatment" AND "guidelines"

Finding Sources
Searching PubMed

"heart failure" AND "pharmacological treatment"

Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Running Command

mkdir -p /home/daytona/workspace/heart-failure-pptx && ls /home/daytona/workspace/heart-failure-pptx/

Make it for Indian medical student of final year

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Writing File

~/heart-failure-pptx/hf_presentation.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Treatment Plan for Heart Failure";
pres.author = "Final Year MBBS";

// ─── COLOR PALETTE ────────────────────────────────────────────────
const DARK_BG   = "0D1F3C";   // deep navy (dominant ~65%)
const MID_BG    = "1A3560";   // mid navy for content slides
const CARD_BG   = "112B52";   // slightly lighter card
const ACCENT    = "E8A020";   // amber/gold accent
const ACCENT2   = "3FBBE8";   // sky blue
const WHITE     = "FFFFFF";
const LIGHT_TXT = "C8D8F0";
const MUTED     = "8AAAD4";
const GREEN     = "27AE60";
const RED       = "E74C3C";
const YELLOW    = "F1C40F";

// ─── HELPER: section header bar ──────────────────────────────────
function addHeaderBar(slide, title, sub) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: DARK_BG } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 1.0, w: 10, h: 0.06, fill: { color: ACCENT } });
  slide.addText(title, { x: 0.3, y: 0.08, w: 7.5, h: 0.5, fontSize: 20, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
  if (sub) {
    slide.addText(sub, { x: 0.3, y: 0.6, w: 9, h: 0.35, fontSize: 11, color: ACCENT, fontFace: "Calibri", italic: true, margin: 0 });
  }
  // slide number placeholder area
  slide.addText("", { x: 9.3, y: 0.05, w: 0.6, h: 0.4 });
}

// ─── HELPER: content slide background ────────────────────────────
function setContentBg(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: MID_BG } });
}

// ─── HELPER: bullet list ─────────────────────────────────────────
function makeBullets(items, opts = {}) {
  return items.map((item, i) => {
    const isLast = i === items.length - 1;
    if (typeof item === "string") {
      return { text: item, options: { bullet: { code: "2022" }, color: opts.color || LIGHT_TXT, fontSize: opts.fontSize || 14, fontFace: "Calibri", breakLine: !isLast } };
    }
    // object with indent
    return { text: item.text, options: { bullet: { code: "25B8", indent: item.indent || 20 }, color: item.color || opts.subColor || MUTED, fontSize: opts.subFontSize || 12, fontFace: "Calibri", breakLine: !isLast } };
  });
}

// ─── HELPER: info card ───────────────────────────────────────────
function addCard(slide, x, y, w, h, title, lines, titleColor, bgColor) {
  slide.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill: { color: bgColor || CARD_BG }, line: { color: ACCENT, width: 1.2 }, rectRadius: 0.08 });
  if (title) {
    slide.addText(title, { x: x + 0.1, y: y + 0.08, w: w - 0.2, h: 0.32, fontSize: 12, bold: true, color: titleColor || ACCENT, fontFace: "Calibri", margin: 0 });
  }
  if (lines && lines.length) {
    const bulletItems = lines.map((l, i) => ({
      text: l, options: { bullet: { code: "2022" }, color: LIGHT_TXT, fontSize: 11, fontFace: "Calibri", breakLine: i < lines.length - 1 }
    }));
    slide.addText(bulletItems, { x: x + 0.15, y: y + (title ? 0.42 : 0.12), w: w - 0.25, h: h - (title ? 0.55 : 0.22), valign: "top" });
  }
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE SLIDE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DARK_BG } });
  // decorative left stripe
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: ACCENT } });
  // bottom bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.9, w: 10, h: 0.725, fill: { color: "091729" } });

  s.addText("TREATMENT PLAN FOR", { x: 0.5, y: 1.0, w: 9, h: 0.5, fontSize: 20, color: ACCENT2, fontFace: "Calibri", bold: false, charSpacing: 4, align: "center" });
  s.addText("HEART FAILURE", { x: 0.5, y: 1.5, w: 9, h: 1.0, fontSize: 46, bold: true, color: WHITE, fontFace: "Calibri", align: "center" });

  s.addShape(pres.ShapeType.rect, { x: 3.5, y: 2.65, w: 3, h: 0.06, fill: { color: ACCENT } });

  s.addText("Evidence-Based Approach for Final Year MBBS", { x: 0.5, y: 2.85, w: 9, h: 0.45, fontSize: 15, color: LIGHT_TXT, fontFace: "Calibri", italic: true, align: "center" });
  s.addText("Based on: Braunwald's Heart Disease | Goldman-Cecil Medicine | Goodman & Gilman's Pharmacology", {
    x: 0.5, y: 4.88, w: 9, h: 0.35, fontSize: 9.5, color: MUTED, fontFace: "Calibri", align: "center"
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 2 – OUTLINE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Presentation Outline", "What we will cover today");

  const topics = [
    "Definition & Epidemiology",
    "Pathophysiology & Neurohormonal Activation",
    "Aetiology & Precipitating Factors",
    "Clinical Features & NYHA Classification",
    "Diagnosis: ECG, Echo, BNP, CXR",
    "ACC/AHA Staging System",
    "Goals of Treatment",
    "Non-Pharmacological Management",
    "Pharmacological Management — HFrEF",
    "The Four Pillars (GDMT)",
    "Additional Drug Therapies",
    "Management of HFpEF",
    "Acute / Decompensated Heart Failure",
    "Device Therapy: ICD, CRT",
    "Advanced Heart Failure & Transplant",
    "Monitoring & Follow-up",
    "Key Exam Points",
  ];

  // Two columns
  const col1 = topics.slice(0, 9);
  const col2 = topics.slice(9);

  const bullets1 = col1.map((t, i) => ({
    text: `${i + 1}.  ${t}`,
    options: { bullet: false, color: LIGHT_TXT, fontSize: 12.5, fontFace: "Calibri", breakLine: i < col1.length - 1 }
  }));
  const bullets2 = col2.map((t, i) => ({
    text: `${i + 10}.  ${t}`,
    options: { bullet: false, color: LIGHT_TXT, fontSize: 12.5, fontFace: "Calibri", breakLine: i < col2.length - 1 }
  }));

  s.addText(bullets1, { x: 0.35, y: 1.2, w: 4.5, h: 4.1, valign: "top" });
  s.addText(bullets2, { x: 5.1, y: 1.2, w: 4.5, h: 4.1, valign: "top" });
  // divider
  s.addShape(pres.ShapeType.rect, { x: 4.95, y: 1.2, w: 0.04, h: 4.1, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 3 – DEFINITION & EPIDEMIOLOGY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Definition & Epidemiology");

  s.addText("Definition", { x: 0.35, y: 1.15, w: 9, h: 0.35, fontSize: 14, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
  s.addShape(pres.ShapeType.roundRect, { x: 0.35, y: 1.55, w: 9.3, h: 0.85, fill: { color: CARD_BG }, line: { color: ACCENT2, width: 1 }, rectRadius: 0.07 });
  s.addText(
    "Heart failure is a clinical syndrome in which the heart fails to meet the metabolic requirements of the body at normal filling pressures, resulting in dyspnoea, fatigue, and/or fluid retention.",
    { x: 0.55, y: 1.6, w: 9.0, h: 0.75, fontSize: 13, color: WHITE, fontFace: "Calibri", italic: false }
  );

  s.addText("Epidemiology", { x: 0.35, y: 2.55, w: 9, h: 0.35, fontSize: 14, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });

  // stat boxes
  const stats = [
    { val: "26M+", label: "Affected globally" },
    { val: "~10M", label: "Estimated in India" },
    { val: "50%", label: "5-yr mortality" },
    { val: "25%", label: "30-day readmission" },
  ];
  stats.forEach((st, i) => {
    const x = 0.35 + i * 2.4;
    s.addShape(pres.ShapeType.roundRect, { x, y: 2.98, w: 2.1, h: 1.18, fill: { color: CARD_BG }, line: { color: ACCENT, width: 1.2 }, rectRadius: 0.1 });
    s.addText(st.val, { x, y: 3.05, w: 2.1, h: 0.55, fontSize: 24, bold: true, color: ACCENT, fontFace: "Calibri", align: "center" });
    s.addText(st.label, { x, y: 3.6, w: 2.1, h: 0.45, fontSize: 11, color: LIGHT_TXT, fontFace: "Calibri", align: "center" });
  });

  s.addText([
    { text: "India: ", options: { bold: true, color: ACCENT2, fontSize: 12, fontFace: "Calibri" } },
    { text: "Rheumatic heart disease remains a leading cause in younger patients (unlike the West). Ischaemic heart disease and hypertension dominate in adults >40 years.", options: { color: LIGHT_TXT, fontSize: 12, fontFace: "Calibri" } }
  ], { x: 0.35, y: 4.25, w: 9.3, h: 0.7, valign: "middle" });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 4 – PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Pathophysiology", "Neurohormonal Activation & LV Remodelling");

  // Central box
  s.addShape(pres.ShapeType.roundRect, { x: 3.7, y: 1.8, w: 2.6, h: 0.8, fill: { color: RED + "CC" }, line: { color: RED, width: 1 }, rectRadius: 0.1 });
  s.addText("Cardiac Injury\n(MI, HTN, Valvular)", { x: 3.7, y: 1.82, w: 2.6, h: 0.76, fontSize: 11, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle" });

  // Arrow down
  s.addShape(pres.ShapeType.rect, { x: 4.96, y: 2.62, w: 0.08, h: 0.35, fill: { color: ACCENT } });

  // LV Remodelling box
  s.addShape(pres.ShapeType.roundRect, { x: 3.7, y: 2.98, w: 2.6, h: 0.65, fill: { color: CARD_BG }, line: { color: ACCENT, width: 1.2 }, rectRadius: 0.08 });
  s.addText("↓ Cardiac Output → LV Remodelling", { x: 3.7, y: 2.98, w: 2.6, h: 0.65, fontSize: 11, bold: true, color: ACCENT, fontFace: "Calibri", align: "center", valign: "middle" });

  // Left branch: RAAS
  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 2.1, w: 2.8, h: 2.35, fill: { color: CARD_BG }, line: { color: ACCENT2, width: 1 }, rectRadius: 0.08 });
  s.addText("RAAS Activation", { x: 0.3, y: 2.15, w: 2.8, h: 0.3, fontSize: 12, bold: true, color: ACCENT2, fontFace: "Calibri", align: "center" });
  s.addText(makeBullets([
    "↑ Angiotensin II",
    "Vasoconstriction",
    "↑ Aldosterone",
    "Na+ & H2O retention",
    "Myocyte apoptosis",
    "Ventricular fibrosis",
  ], { fontSize: 11 }), { x: 0.4, y: 2.5, w: 2.6, h: 1.85, valign: "top" });

  // Right branch: SNS
  s.addShape(pres.ShapeType.roundRect, { x: 6.9, y: 2.1, w: 2.8, h: 2.35, fill: { color: CARD_BG }, line: { color: YELLOW, width: 1 }, rectRadius: 0.08 });
  s.addText("SNS Activation", { x: 6.9, y: 2.15, w: 2.8, h: 0.3, fontSize: 12, bold: true, color: YELLOW, fontFace: "Calibri", align: "center" });
  s.addText(makeBullets([
    "↑ Norepinephrine",
    "Tachycardia",
    "↑ Cardiac afterload",
    "β-receptor downregulation",
    "Myocyte toxicity",
    "Arrhythmias",
  ], { fontSize: 11 }), { x: 7.0, y: 2.5, w: 2.6, h: 1.85, valign: "top" });

  // Connecting lines (drawn as thin rectangles)
  s.addShape(pres.ShapeType.rect, { x: 3.1, y: 2.22, w: 0.62, h: 0.05, fill: { color: ACCENT2 } });
  s.addShape(pres.ShapeType.rect, { x: 6.3, y: 2.22, w: 0.62, h: 0.05, fill: { color: YELLOW } });

  s.addText("Both pathways drive adverse cardiac remodelling → progressive pump failure", {
    x: 0.3, y: 4.65, w: 9.4, h: 0.4, fontSize: 11.5, color: MUTED, fontFace: "Calibri", italic: true, align: "center"
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 5 – AETIOLOGY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Aetiology of Heart Failure", "Common causes in Indian clinical practice");

  const causes = [
    { title: "Ischaemic Heart Disease", color: RED, items: ["Coronary artery disease", "Acute MI / post-MI LV dysfunction", "Most common cause in adults >40 yrs"] },
    { title: "Hypertensive Heart Disease", color: ACCENT, items: ["Pressure overload → LV hypertrophy", "Diastolic dysfunction common", "Increasing prevalence in India"] },
    { title: "Valvular Heart Disease", color: ACCENT2, items: ["Rheumatic mitral/aortic disease", "Dominant in younger Indians", "Volume & pressure overload"] },
    { title: "Cardiomyopathies", color: GREEN, items: ["Dilated (idiopathic, alcohol, viral)", "Hypertrophic (HOCM)", "Peripartum cardiomyopathy"] },
    { title: "Other Causes", color: YELLOW, items: ["Anaemia (hookworm — India)", "Thyrotoxicosis, beriberi", "Congenital heart disease, COPD"] },
  ];

  causes.forEach((c, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.2;
    const y = 1.25 + row * 2.1;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 3.0, h: 1.95, fill: { color: CARD_BG }, line: { color: c.color, width: 1.5 }, rectRadius: 0.1 });
    s.addText(c.title, { x: x + 0.1, y: y + 0.08, w: 2.8, h: 0.32, fontSize: 11.5, bold: true, color: c.color, fontFace: "Calibri", margin: 0 });
    s.addText(makeBullets(c.items, { fontSize: 11 }), { x: x + 0.1, y: y + 0.44, w: 2.8, h: 1.4, valign: "top" });
  });

  s.addText("Precipitants: Infection (pneumonia), AF, PE, medication non-compliance, anaemia, renal failure, high salt intake", {
    x: 0.3, y: 5.22, w: 9.4, h: 0.3, fontSize: 10.5, color: MUTED, fontFace: "Calibri", italic: true
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 6 – CLASSIFICATION: NYHA & ACC/AHA
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Classification Systems", "NYHA Functional Classes & ACC/AHA Stages");

  // NYHA table
  s.addText("NYHA Functional Classification", { x: 0.3, y: 1.15, w: 4.6, h: 0.35, fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
  const nyha = [
    { cls: "I", desc: "No limitation; ordinary activity does not cause symptoms", col: GREEN },
    { cls: "II", desc: "Slight limitation; comfortable at rest but ordinary activity causes symptoms", col: YELLOW },
    { cls: "III", desc: "Marked limitation; less-than-ordinary activity causes symptoms", col: ACCENT },
    { cls: "IV", desc: "Symptoms at rest; inability to carry out any activity without discomfort", col: RED },
  ];
  nyha.forEach((row, i) => {
    const y = 1.58 + i * 0.9;
    s.addShape(pres.ShapeType.roundRect, { x: 0.3, y, w: 4.6, h: 0.82, fill: { color: CARD_BG }, line: { color: row.col, width: 1 }, rectRadius: 0.07 });
    s.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 0.58, h: 0.82, fill: { color: row.col + "55" } });
    s.addText(`Class\n${row.cls}`, { x: 0.3, y, w: 0.58, h: 0.82, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(row.desc, { x: 1.0, y: y + 0.08, w: 3.8, h: 0.66, fontSize: 11.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "middle" });
  });

  // ACC/AHA
  s.addText("ACC/AHA Staging (A–D)", { x: 5.25, y: 1.15, w: 4.4, h: 0.35, fontSize: 13, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0 });
  const aha = [
    { stage: "A", desc: "At risk; no structural heart disease (HTN, DM, family Hx)", col: GREEN },
    { stage: "B", desc: "Structural heart disease; no symptoms of HF", col: YELLOW },
    { stage: "C", desc: "Structural heart disease; prior or current HF symptoms", col: ACCENT },
    { stage: "D", desc: "Refractory HF; advanced interventions required", col: RED },
  ];
  aha.forEach((row, i) => {
    const y = 1.58 + i * 0.9;
    s.addShape(pres.ShapeType.roundRect, { x: 5.25, y, w: 4.4, h: 0.82, fill: { color: CARD_BG }, line: { color: row.col, width: 1 }, rectRadius: 0.07 });
    s.addShape(pres.ShapeType.rect, { x: 5.25, y, w: 0.62, h: 0.82, fill: { color: row.col + "55" } });
    s.addText(`Stage\n${row.stage}`, { x: 5.25, y, w: 0.62, h: 0.82, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(row.desc, { x: 6.0, y: y + 0.08, w: 3.5, h: 0.66, fontSize: 11.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "middle" });
  });

  // divider
  s.addShape(pres.ShapeType.rect, { x: 5.1, y: 1.1, w: 0.04, h: 4.4, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 7 – DIAGNOSIS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Diagnosis of Heart Failure", "Investigations: ECG | Echo | BNP | CXR");

  const cards = [
    {
      title: "Echocardiography (Gold Standard)",
      col: ACCENT2,
      lines: [
        "LVEF: HFrEF <40%, HFmrEF 41-49%, HFpEF ≥50%",
        "LV dimensions, wall motion abnormalities",
        "Valvular pathology, pericardial effusion",
        "Estimated filling pressures (E/e' ratio)",
      ],
    },
    {
      title: "Biomarkers",
      col: ACCENT,
      lines: [
        "BNP >100 pg/mL or NT-proBNP >300 pg/mL: supports HF",
        "Excludes HF if BNP <35 pg/mL",
        "Useful for monitoring and prognosis",
        "Elevated in AF, PE, renal failure (false positive)",
      ],
    },
    {
      title: "Chest X-Ray",
      col: GREEN,
      lines: [
        "Cardiomegaly: cardiothoracic ratio >0.5",
        "Upper lobe blood diversion (ULBD)",
        "Kerley B lines (interstitial oedema)",
        "Bat-wing pattern (alveolar oedema)",
      ],
    },
    {
      title: "ECG",
      col: YELLOW,
      lines: [
        "LVH, LBBB (suggests ischaemic/dilated CMP)",
        "Q waves: prior MI",
        "AF: common trigger/consequence",
        "Normal ECG has high negative predictive value",
      ],
    },
    {
      title: "Blood Tests",
      col: RED,
      lines: [
        "FBC (anaemia), RFT (CKD), LFTs",
        "Thyroid function (thyrotoxicosis)",
        "Serum electrolytes (K+, Na+)",
        "Fasting glucose / HbA1c",
      ],
    },
    {
      title: "Additional",
      col: MUTED,
      lines: [
        "Cardiac MRI: myocarditis, infiltrative disease",
        "Coronary angiography if ischaemia suspected",
        "6-minute walk test (functional capacity)",
        "Endomyocardial biopsy: rarely indicated",
      ],
    },
  ];

  cards.forEach((c, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.2 + col * 3.28;
    const y = 1.2 + row * 2.05;
    addCard(s, x, y, 3.1, 1.9, c.title, c.lines, c.col);
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 8 – GOALS OF TREATMENT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Goals of Treatment", "A three-pronged approach");

  const goals = [
    {
      num: "01",
      title: "Improve Symptoms & Quality of Life",
      color: ACCENT2,
      bullets: [
        "Relieve dyspnoea, oedema, and fatigue",
        "Improve exercise tolerance (NYHA class)",
        "Prevent hospitalisations",
      ],
    },
    {
      num: "02",
      title: "Slow Disease Progression",
      color: ACCENT,
      bullets: [
        "Reverse or prevent LV remodelling",
        "Neurohormonal blockade (RAAS + SNS)",
        "Optimise guideline-directed medical therapy",
      ],
    },
    {
      num: "03",
      title: "Reduce Mortality",
      color: GREEN,
      bullets: [
        "Mortality benefit proven for: ACEi/ARB/ARNI, β-blockers, MRA, SGLT2i",
        "ICD for sudden cardiac death prevention",
        "CRT for dyssynchrony",
      ],
    },
  ];

  goals.forEach((g, i) => {
    const x = 0.3 + i * 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.25, w: 3.1, h: 4.0, fill: { color: CARD_BG }, line: { color: g.color, width: 1.5 }, rectRadius: 0.1 });
    s.addText(g.num, { x, y: 1.35, w: 3.1, h: 0.7, fontSize: 36, bold: true, color: g.color + "40", fontFace: "Calibri", align: "center" });
    s.addText(g.title, { x: x + 0.15, y: 2.1, w: 2.8, h: 0.55, fontSize: 13, bold: true, color: g.color, fontFace: "Calibri", align: "center" });
    s.addShape(pres.ShapeType.rect, { x: x + 0.5, y: 2.7, w: 2.1, h: 0.04, fill: { color: g.color } });
    s.addText(makeBullets(g.bullets, { fontSize: 12 }), { x: x + 0.15, y: 2.82, w: 2.8, h: 2.1, valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 9 – NON-PHARMACOLOGICAL MANAGEMENT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Non-Pharmacological Management", "Lifestyle modifications — equally important as drugs");

  const items = [
    { icon: "🧂", title: "Salt Restriction", body: "< 2–3 g sodium/day. Avoid high-salt Indian foods: pickles, papadums, processed snacks." },
    { icon: "💧", title: "Fluid Restriction", body: "< 1.5–2 L/day in severe HF (NYHA III–IV). Daily weight monitoring; report >2 kg gain in 2 days." },
    { icon: "🏃", title: "Exercise & Cardiac Rehab", body: "Supervised aerobic exercise in stable HF (NYHA I–III). Improves VO2 max, QoL, and hospital admissions (HF-ACTION trial)." },
    { icon: "🚭", title: "Smoking & Alcohol Cessation", body: "Alcohol cardiomyopathy: abstinence may partially reverse LV dysfunction. Smoking worsens ischaemia." },
    { icon: "💊", title: "Medication Compliance", body: "Major cause of decompensation in India. Patient education, pill organisers, family support essential." },
    { icon: "💉", title: "Vaccinations", body: "Annual influenza vaccine. Pneumococcal vaccine. Reduces hospitalisation risk." },
    { icon: "⚖️", title: "Weight Management", body: "Treat obesity (BMI > 30). However, avoid rapid weight loss in cardiac cachexia." },
    { icon: "🛏️", title: "Sleep & Breathing", body: "Screen for obstructive sleep apnoea. CPAP therapy improves BP and LV function." },
  ];

  items.forEach((item, i) => {
    const col = i % 4;
    const row = Math.floor(i / 4);
    const x = 0.2 + col * 2.45;
    const y = 1.22 + row * 2.1;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 2.3, h: 1.95, fill: { color: CARD_BG }, line: { color: ACCENT, width: 0.8 }, rectRadius: 0.08 });
    s.addText(item.icon + " " + item.title, { x: x + 0.1, y: y + 0.08, w: 2.1, h: 0.35, fontSize: 11.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
    s.addText(item.body, { x: x + 0.1, y: y + 0.46, w: 2.1, h: 1.38, fontSize: 10.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 10 – OVERVIEW: PHARMACOLOGICAL APPROACH
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Pharmacological Management — Overview", "HFrEF vs HFpEF strategies differ significantly");

  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.18, w: 4.5, h: 4.0, fill: { color: CARD_BG }, line: { color: ACCENT, width: 1.5 }, rectRadius: 0.1 });
  s.addText("HFrEF (EF < 40%)", { x: 0.3, y: 1.25, w: 4.5, h: 0.4, fontSize: 15, bold: true, color: ACCENT, fontFace: "Calibri", align: "center" });
  s.addText("Evidence-based mortality-reducing therapy:", { x: 0.5, y: 1.72, w: 4.1, h: 0.3, fontSize: 11.5, color: ACCENT2, fontFace: "Calibri", italic: true });
  s.addText(makeBullets([
    "ACE inhibitor / ARB / ARNI (sacubitril-valsartan)",
    "Beta-blocker (bisoprolol, carvedilol, metoprolol)",
    "Mineralocorticoid receptor antagonist (spironolactone)",
    "SGLT2 inhibitor (dapagliflozin / empagliflozin)",
    "Loop diuretics for symptom relief (furosemide)",
    "Ivabradine (if HR ≥70, sinus rhythm)",
    "Hydralazine + nitrate (if ACEi/ARB intolerant)",
    "Digoxin (rate control, selected cases)",
  ], { fontSize: 11.5 }), { x: 0.45, y: 2.08, w: 4.2, h: 3.0, valign: "top" });

  s.addShape(pres.ShapeType.roundRect, { x: 5.2, y: 1.18, w: 4.5, h: 4.0, fill: { color: CARD_BG }, line: { color: ACCENT2, width: 1.5 }, rectRadius: 0.1 });
  s.addText("HFpEF (EF ≥ 50%)", { x: 5.2, y: 1.25, w: 4.5, h: 0.4, fontSize: 15, bold: true, color: ACCENT2, fontFace: "Calibri", align: "center" });
  s.addText("Symptom control & risk factor management:", { x: 5.4, y: 1.72, w: 4.1, h: 0.3, fontSize: 11.5, color: ACCENT, fontFace: "Calibri", italic: true });
  s.addText(makeBullets([
    "Diuretics for congestion (furosemide, torasemide)",
    "Treat underlying cause: HTN, AF, CAD, DM",
    "SGLT2 inhibitors — benefit shown (EMPEROR-Preserved)",
    "Spironolactone — marginal benefit (TOPCAT trial)",
    "ARBs (candesartan) — modest benefit",
    "No proven mortality benefit for ACEi or β-blocker",
    "Rate control in AF with beta-blockers/digoxin",
    "Cardiac rehab and exercise training",
  ], { fontSize: 11.5 }), { x: 5.4, y: 2.08, w: 4.1, h: 3.0, valign: "top" });

  // divider
  s.addShape(pres.ShapeType.rect, { x: 5.0, y: 1.18, w: 0.04, h: 4.0, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 11 – THE FOUR PILLARS (GDMT)
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "The Four Pillars of GDMT in HFrEF", "Guideline-Directed Medical Therapy (ACC/AHA 2022)");

  // Central text
  s.addText("Each pillar independently reduces mortality and hospitalisation when added to standard care", {
    x: 0.8, y: 1.12, w: 8.4, h: 0.35, fontSize: 11.5, color: MUTED, fontFace: "Calibri", italic: true, align: "center"
  });

  const pillars = [
    {
      title: "ARNI / ACE-I / ARB",
      subtitle: "Sacubitril-Valsartan preferred",
      color: ACCENT,
      items: ["Sacubitril-valsartan (PARADIGM-HF): ↓ 20% CV death vs enalapril", "Start: Sacubitril 24/26 mg BD; target 97/103 mg BD", "Contraindicated: bilateral RAS, angioedema, with ACEi", "ACEi (enalapril 2.5 → 20 mg BD) if ARNI not available"],
    },
    {
      title: "Beta-Blocker",
      subtitle: "Bisoprolol / Carvedilol / Metoprolol",
      color: ACCENT2,
      items: ["↓ Mortality by 34% (MERIT-HF, CIBIS-II, COPERNICUS)", "Start LOW, go SLOW: bisoprolol 1.25 mg OD → 10 mg OD", "Do NOT start in acute decompensation", "Benefits in all NYHA II–IV regardless of aetiology"],
    },
    {
      title: "MRA",
      subtitle: "Spironolactone / Eplerenone",
      color: GREEN,
      items: ["RALES: spironolactone ↓ 30% mortality in NYHA III–IV", "Spironolactone 25–50 mg OD; monitor K+ and creatinine", "Gynecomastia with spironolactone → switch to eplerenone", "Contraindicated: K+ >5.0 mmol/L, creatinine >220 μmol/L"],
    },
    {
      title: "SGLT2 Inhibitor",
      subtitle: "Dapagliflozin / Empagliflozin",
      color: YELLOW,
      items: ["DAPA-HF: dapagliflozin ↓ worsening HF & CV death by 26%", "Benefits independent of diabetes status", "Mechanism: osmotic diuresis, anti-fibrotic, metabolic effects", "Dapagliflozin 10 mg OD; caution in eGFR <20 ml/min"],
    },
  ];

  pillars.forEach((p, i) => {
    const x = 0.2 + i * 2.43;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.55, w: 2.28, h: 3.8, fill: { color: CARD_BG }, line: { color: p.color, width: 1.5 }, rectRadius: 0.1 });
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 2.28, h: 0.55, fill: { color: p.color + "33" } });
    s.addText(p.title, { x, y: 1.58, w: 2.28, h: 0.3, fontSize: 12, bold: true, color: p.color, fontFace: "Calibri", align: "center" });
    s.addText(p.subtitle, { x, y: 1.88, w: 2.28, h: 0.2, fontSize: 9.5, color: MUTED, fontFace: "Calibri", align: "center", italic: true });
    s.addText(p.items.map((it, ii) => ({ text: it, options: { bullet: { code: "25B8" }, color: LIGHT_TXT, fontSize: 10.5, fontFace: "Calibri", breakLine: ii < p.items.length - 1 } })),
      { x: x + 0.1, y: 2.18, w: 2.08, h: 3.1, valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 12 – DIURETICS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Diuretics in Heart Failure", "Symptom relief — not proven to reduce mortality alone");

  s.addText("LOOP DIURETICS — First-line for fluid overload", { x: 0.3, y: 1.15, w: 9.4, h: 0.38, fontSize: 13.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });

  const loopData = [
    ["Drug", "Starting Dose", "Max Dose", "Key Features"],
    ["Furosemide", "20–40 mg OD/BD", "400–600 mg/day", "First-line; impaired bioavailability in oedema"],
    ["Torasemide", "5–10 mg OD", "200 mg/day", "Better oral bioavailability; preferred in chronic HF"],
    ["Bumetanide", "0.5–1 mg OD", "10 mg/day", "More potent; useful in furosemide resistance"],
  ];

  loopData.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const x = 0.3 + ci * 2.35;
      const y = 1.6 + ri * 0.52;
      s.addShape(pres.ShapeType.rect, {
        x, y, w: 2.35, h: 0.52,
        fill: { color: ri === 0 ? ACCENT + "44" : CARD_BG },
        line: { color: ri === 0 ? ACCENT : MUTED + "55", width: 0.7 }
      });
      s.addText(cell, { x: x + 0.07, y: y + 0.05, w: 2.2, h: 0.42, fontSize: ri === 0 ? 11.5 : 11, bold: ri === 0, color: ri === 0 ? ACCENT : LIGHT_TXT, fontFace: "Calibri", valign: "middle" });
    });
  });

  s.addText("OTHER DIURETICS", { x: 0.3, y: 3.76, w: 9.4, h: 0.35, fontSize: 13, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0 });

  const others = [
    { type: "Thiazides\n(Hydrochlorothiazide,\nMetolazone)", info: "Synergistic with loop diuretics in diuretic resistance (sequential nephron blockade). Monitor K+ and creatinine closely." },
    { type: "Spironolactone\n(MRA, K+-sparing)", info: "25–50 mg OD. Reduces aldosterone escape. Prevents K+ loss. Proven mortality benefit (RALES trial)." },
    { type: "SGLT2 Inhibitors\n(Dapagliflozin)", info: "Osmotic natriuresis. Reduce loop diuretic resistance. Cardio-renal protective beyond diuresis." },
  ];

  others.forEach((o, i) => {
    const x = 0.3 + i * 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y: 4.15, w: 3.1, h: 1.2, fill: { color: CARD_BG }, line: { color: ACCENT2, width: 1 }, rectRadius: 0.08 });
    s.addText(o.type, { x: x + 0.1, y: 4.18, w: 1.2, h: 1.12, fontSize: 10.5, bold: true, color: ACCENT2, fontFace: "Calibri", valign: "middle" });
    s.addText(o.info, { x: x + 1.35, y: 4.18, w: 1.65, h: 1.12, fontSize: 10.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 13 – ACE INHIBITORS & ARNI
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "ACE Inhibitors, ARBs & ARNI", "RAAS Blockade — Cornerstone of HFrEF therapy");

  addCard(s, 0.25, 1.18, 4.5, 2.05, "ACE Inhibitors", [
    "Block conversion of Ang I → Ang II; also prevent bradykinin breakdown",
    "Proven agents: Enalapril 2.5–20 mg BD, Ramipril 2.5–10 mg BD, Lisinopril 5–40 mg OD",
    "CONSENSUS, SOLVD trials: ↓ mortality 16–40%",
    "S/E: Dry cough (bradykinin), hypotension (1st dose), hyperkalaemia, angioedema (rare)",
  ], ACCENT);

  addCard(s, 5.25, 1.18, 4.5, 2.05, "ARBs (if ACEi intolerant)", [
    "Block AT1 receptor; no bradykinin accumulation → no cough",
    "Val-HeFT, CHARM: valsartan, candesartan reduce hospitalisation",
    "Candesartan 4–32 mg OD, Valsartan 40–160 mg BD",
    "Use when ACEi not tolerated due to cough or angioedema",
  ], ACCENT2);

  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 3.32, w: 9.5, h: 0.04, fill: { color: ACCENT } });

  addCard(s, 0.25, 3.42, 9.5, 1.9, "ARNI — Sacubitril/Valsartan (Entresto) ★ Preferred in HFrEF", [
    "Dual mechanism: Sacubitril inhibits neprilysin (↑ natriuretic peptides BNP/ANP) + valsartan blocks AT1",
    "PARADIGM-HF trial: ↓ CV mortality by 20% and HF hospitalisation by 21% vs enalapril",
    "Dose: Start 24/26 mg BD → target 97/103 mg BD. Washout 36h required before starting after ACEi",
    "Contraindications: History of angioedema, NEVER combine with ACEi (risk of angioedema), bilateral RAS",
    "2022 ACC/AHA: Replace ACEi/ARB with ARNI in patients who can tolerate — Class I, Level A evidence",
  ], YELLOW);
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 14 – BETA-BLOCKERS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Beta-Blockers in Heart Failure", "Counter SNS hyperactivation — proven mortality benefit");

  s.addText("Only THREE beta-blockers have proven mortality benefit in HFrEF:", {
    x: 0.3, y: 1.15, w: 9.4, h: 0.3, fontSize: 12.5, color: ACCENT, fontFace: "Calibri", italic: true
  });

  const drugs = [
    { name: "Carvedilol", trial: "COPERNICUS", detail: "Non-selective β + α1 blocker\nStart: 3.125 mg BD\nTarget: 25–50 mg BD\n↓ mortality 35% (severe HF)" },
    { name: "Bisoprolol", trial: "CIBIS-II", detail: "Cardioselective β1\nStart: 1.25 mg OD\nTarget: 10 mg OD\n↓ mortality 34%" },
    { name: "Metoprolol\nSuccinate", trial: "MERIT-HF", detail: "Cardioselective β1 (SR)\nStart: 12.5–25 mg OD\nTarget: 200 mg OD\n↓ mortality 34%" },
  ];

  drugs.forEach((d, i) => {
    const x = 0.3 + i * 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.55, w: 3.05, h: 2.2, fill: { color: CARD_BG }, line: { color: ACCENT2, width: 1.5 }, rectRadius: 0.1 });
    s.addText(d.name, { x, y: 1.6, w: 3.05, h: 0.42, fontSize: 16, bold: true, color: WHITE, fontFace: "Calibri", align: "center" });
    s.addText(`Trial: ${d.trial}`, { x, y: 2.04, w: 3.05, h: 0.28, fontSize: 11, color: ACCENT, fontFace: "Calibri", align: "center", italic: true });
    s.addText(d.detail, { x: x + 0.15, y: 2.36, w: 2.75, h: 1.3, fontSize: 11.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "top" });
  });

  s.addText("Practical Rules for Beta-Blocker Use", { x: 0.3, y: 3.88, w: 9.4, h: 0.32, fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });

  s.addText(makeBullets([
    "Always start LOW, titrate SLOW — double dose every 2 weeks",
    "Do NOT start in acute decompensated HF (fluid overload, wet and cold)",
    "Do NOT stop abruptly — risk of rebound tachycardia and decompensation",
    "Use cautiously in: asthma (prefer bisoprolol), bradycardia, hypotension, severe peripheral vascular disease",
    "Heart rate target: 55–65 bpm at rest in sinus rhythm",
  ], { fontSize: 12 }), { x: 0.3, y: 4.25, w: 9.4, h: 1.2, valign: "top" });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 15 – MRA & SGLT2 INHIBITORS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "MRA & SGLT2 Inhibitors", "Pillars 3 & 4 of GDMT");

  // MRA
  s.addText("Mineralocorticoid Receptor Antagonists (MRA)", { x: 0.3, y: 1.18, w: 4.5, h: 0.35, fontSize: 13, bold: true, color: GREEN, fontFace: "Calibri", margin: 0 });
  addCard(s, 0.3, 1.58, 4.5, 3.7, null, [
    "Spironolactone 25–50 mg OD (start 25 mg, target 50 mg)",
    "Eplerenone 25–50 mg OD (more selective, no gynaecomastia)",
    "RALES trial: spironolactone ↓ mortality by 30% in NYHA III–IV",
    "EPHESUS trial: eplerenone ↓ death after MI with systolic HF",
    "Mechanism: blocks aldosterone at myocardium & kidney → ↓ fibrosis, ↓ K+ loss",
    "MONITOR: K+ every 1–4 weeks after start. Stop if K+ >5.5 mmol/L",
    "Contraindications: K+ >5.0 mmol/L, creatinine >220 μmol/L, concurrent K+-sparing diuretics",
    "S/E of spironolactone: gynaecomastia, menstrual irregularity (switch to eplerenone)",
  ], GREEN);

  // SGLT2
  s.addText("SGLT2 Inhibitors (Gliflozins)", { x: 5.2, y: 1.18, w: 4.5, h: 0.35, fontSize: 13, bold: true, color: YELLOW, fontFace: "Calibri", margin: 0 });
  addCard(s, 5.2, 1.58, 4.5, 3.7, null, [
    "Dapagliflozin 10 mg OD — FDA approved for HFrEF & HFpEF",
    "Empagliflozin 10 mg OD — EMPEROR-Reduced & Preserved trials",
    "DAPA-HF: ↓ worsening HF + CV death by 26% (benefit in diabetics AND non-diabetics)",
    "Mechanism: osmotic natriuresis, anti-fibrotic, ↓ NHE1 exchanger, metabolic benefits",
    "EMPEROR-Preserved: SGLT2i reduce HF hospitalisations in HFpEF",
    "S/E: genital mycotic infections, DKA (rare, hold before surgery)",
    "Caution: eGFR < 20 ml/min; hold before contrast procedures",
    "NOW a STANDARD of care in HFrEF regardless of diabetes status",
  ], YELLOW);

  s.addShape(pres.ShapeType.rect, { x: 5.05, y: 1.18, w: 0.04, h: 4.1, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 16 – ADDITIONAL THERAPIES
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Additional Pharmacological Therapies", "Adjunctive drugs in specific situations");

  const drugs = [
    {
      title: "Ivabradine",
      color: ACCENT2,
      body: [
        "Inhibits I(f) \"funny\" channel in SA node → ↓ HR (sinus rhythm only)",
        "Indication: NYHA II–IV, EF ≤35%, HR ≥70 bpm on max tolerated β-blocker",
        "SHIFT trial: ↓ HF hospitalisations by 26%",
        "Dose: 5 mg BD → 7.5 mg BD. Contraindicated in AF",
        "S/E: Phosphenes (visual disturbances), bradycardia",
      ],
    },
    {
      title: "Hydralazine + ISDN",
      color: ACCENT,
      body: [
        "Venodilator (nitrate) + arteriodilator (hydralazine) = balanced pre/afterload reduction",
        "V-HeFT II: ↓ mortality, inferior to ACEi (enalapril)",
        "Use when: ACEi/ARB/ARNI not tolerated (renal failure, angioedema, bilateral RAS)",
        "Dose: Hydralazine 25–75 mg TDS + ISDN 20–40 mg TDS",
        "S/E: Drug-induced lupus (hydralazine), headache, tolerance (nitrate)",
      ],
    },
    {
      title: "Digoxin",
      color: YELLOW,
      body: [
        "Positive inotrope (inhibits Na+/K+-ATPase) + vagomimetic (↓ HR in AF)",
        "DIG trial: Reduces hospitalisations; no mortality benefit",
        "Indications: AF with rapid ventricular rate in HF; refractory HFrEF",
        "Dose: 0.125–0.25 mg OD. Target level: 0.5–0.9 ng/mL",
        "Toxicity: Nausea, yellow-green vision, AV block, ventricular arrhythmias; danger in hypokalaemia",
      ],
    },
    {
      title: "Vericiguat",
      color: GREEN,
      body: [
        "Soluble guanylate cyclase stimulator → ↑ cGMP → vasodilation",
        "VICTORIA trial: ↓ CV death + HF hospitalisation in worsening HFrEF",
        "Used in high-risk patients with recent HF decompensation",
        "Dose: 2.5 mg OD → target 10 mg OD. Cannot combine with PDE5 inhibitors",
      ],
    },
  ];

  drugs.forEach((d, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.25 + col * 5.0;
    const y = 1.18 + row * 2.18;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 4.75, h: 2.05, fill: { color: CARD_BG }, line: { color: d.color, width: 1.3 }, rectRadius: 0.1 });
    s.addText(d.title, { x: x + 0.12, y: y + 0.08, w: 4.5, h: 0.32, fontSize: 13, bold: true, color: d.color, fontFace: "Calibri", margin: 0 });
    s.addText(d.body.map((l, ii) => ({ text: l, options: { bullet: { code: "2022" }, color: LIGHT_TXT, fontSize: 11, fontFace: "Calibri", breakLine: ii < d.body.length - 1 } })),
      { x: x + 0.15, y: y + 0.44, w: 4.45, h: 1.52, valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 17 – HFpEF MANAGEMENT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Management of HFpEF", "Heart Failure with Preserved Ejection Fraction (EF ≥ 50%)");

  s.addShape(pres.ShapeType.roundRect, { x: 0.3, y: 1.18, w: 9.4, h: 0.75, fill: { color: CARD_BG }, line: { color: RED, width: 1 }, rectRadius: 0.08 });
  s.addText([
    { text: "Key challenge: ", options: { bold: true, color: RED, fontSize: 12.5, fontFace: "Calibri" } },
    { text: "Unlike HFrEF, NO drug has consistently shown mortality benefit in HFpEF. Management focuses on symptom control and treating co-morbidities.", options: { color: LIGHT_TXT, fontSize: 12.5, fontFace: "Calibri" } }
  ], { x: 0.45, y: 1.22, w: 9.1, h: 0.65, valign: "middle" });

  const cols = [
    {
      title: "Diuretics (Symptom Control)",
      color: ACCENT,
      items: [
        "Furosemide / torasemide — reduce congestion",
        "Careful not to over-diurese (↓ preload critical)",
        "Most important for quality of life",
      ],
    },
    {
      title: "Treat Comorbidities",
      color: ACCENT2,
      items: [
        "Hypertension: ACEi/ARB/CCB/thiazide",
        "Atrial fibrillation: rate control (beta-blockers, digoxin)",
        "Diabetes: SGLT2i (EMPEROR-Preserved)",
        "CAD: revascularisation if indicated",
        "Obesity: weight reduction",
      ],
    },
    {
      title: "Emerging Therapies",
      color: GREEN,
      items: [
        "SGLT2i (dapagliflozin/empagliflozin) — ↓ HF hospitalisation (Class IIa)",
        "Spironolactone (TOPCAT) — borderline benefit, use for diuresis",
        "ARB (candesartan) — modest benefit",
        "Finerenone — ongoing trials",
      ],
    },
  ];

  cols.forEach((c, i) => {
    const x = 0.3 + i * 3.25;
    addCard(s, x, 2.05, 3.1, 3.3, c.title, c.items, c.color);
  });

  s.addText("★  REMEMBER: The term 'HFmrEF' (EF 41–49%) — treat similarly to HFrEF; evidence is extrapolated", {
    x: 0.3, y: 5.38, w: 9.4, h: 0.2, fontSize: 10.5, color: ACCENT, fontFace: "Calibri", italic: true
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 18 – ACUTE DECOMPENSATED HEART FAILURE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Acute Decompensated Heart Failure (ADHF)", "Emergency management");

  // Haemodynamic profiles
  s.addText("Haemodynamic Profiles: The 'Wet/Dry & Warm/Cold' Framework", { x: 0.3, y: 1.18, w: 9.4, h: 0.32, fontSize: 12.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });

  const matrix = [
    ["", "WARM (good perfusion)", "COLD (poor perfusion)"],
    ["WET (congested)", "Warm & Wet (most common)\n→ IV diuretics", "Cold & Wet (cardiogenic shock)\n→ Inotropes + diuretics"],
    ["DRY (euvolaemic)", "Warm & Dry (stable)\n→ Optimise oral therapy", "Cold & Dry (low output)\n→ Cautious fluid challenge"],
  ];
  matrix.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const x = 0.3 + ci * 3.15;
      const y = 1.55 + ri * 0.75;
      const isHeader = ri === 0 || ci === 0;
      const isShock = ri === 1 && ci === 2;
      s.addShape(pres.ShapeType.rect, {
        x, y, w: 3.1, h: 0.72,
        fill: { color: isShock ? RED + "44" : isHeader ? ACCENT + "33" : CARD_BG },
        line: { color: ACCENT + "88", width: 0.7 }
      });
      s.addText(cell, { x: x + 0.07, y: y + 0.06, w: 2.96, h: 0.6, fontSize: isHeader ? 11 : 10.5, bold: isHeader, color: isHeader ? ACCENT : LIGHT_TXT, fontFace: "Calibri", valign: "middle", align: isHeader ? "center" : "left" });
    });
  });

  s.addText("Treatment of ADHF (Warm & Wet)", { x: 0.3, y: 3.85, w: 4.5, h: 0.32, fontSize: 13, bold: true, color: ACCENT2, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "Sit patient upright; high-flow O2 / CPAP if SpO2 <94%",
    "IV furosemide 40–80 mg (or 2.5x oral dose); repeat q4–6h PRN",
    "IV GTN (nitroglycerine) if SBP >90 mmHg — reduces preload/afterload",
    "Morphine (cautiously) — anxiolysis, venodilation; risk respiratory depression",
    "Monitor urine output, daily weight, electrolytes, renal function",
  ], { fontSize: 11.5 }), { x: 0.3, y: 4.22, w: 4.5, h: 1.25, valign: "top" });

  s.addText("Cardiogenic Shock (Cold & Wet)", { x: 5.2, y: 3.85, w: 4.5, h: 0.32, fontSize: 13, bold: true, color: RED, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "Inotropes: Dobutamine 2–20 μg/kg/min (β1 agonist)",
    "Noradrenaline if SBP <70 mmHg (vasopressor)",
    "Dopamine at low dose (renal perfusion — limited evidence)",
    "IABP (intra-aortic balloon pump) as bridge",
    "Early coronary angiography if ACS precipitated",
  ], { fontSize: 11.5 }), { x: 5.2, y: 4.22, w: 4.5, h: 1.25, valign: "top" });

  s.addShape(pres.ShapeType.rect, { x: 5.05, y: 3.82, w: 0.04, h: 1.7, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 19 – DEVICE THERAPY: ICD
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Device Therapy — ICD", "Implantable Cardioverter-Defibrillator");

  addCard(s, 0.3, 1.18, 9.4, 1.28, "What is an ICD?", [
    "An ICD continuously monitors heart rhythm and delivers a shock to terminate life-threatening ventricular arrhythmias (VF, VT) that cause sudden cardiac death (SCD).",
    "SCD accounts for ~50% of deaths in HFrEF patients — ICD prevents this.",
  ], ACCENT2);

  s.addText("Indications (Class I — ACC/AHA):", { x: 0.3, y: 2.6, w: 9.4, h: 0.35, fontSize: 13.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "PRIMARY PREVENTION: LVEF ≤35% despite ≥3 months of optimal GDMT, NYHA class II–III, expected survival >1 year",
    "SECONDARY PREVENTION: Survivors of sustained VT/VF not due to a reversible cause",
    "Post-MI: LVEF <35% at ≥40 days after MI, NYHA II–III on GDMT",
    "Non-ischaemic dilated cardiomyopathy: LVEF ≤35% on GDMT for ≥3 months (DEFINITE trial)",
  ], { fontSize: 12 }), { x: 0.3, y: 3.0, w: 9.4, h: 1.25, valign: "top" });

  s.addText("Important Points:", { x: 0.3, y: 4.35, w: 9.4, h: 0.32, fontSize: 13, bold: true, color: RED, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "Wait 40 days post-MI before reassessing EF — early revascularisation/GDMT may improve EF",
    "GDMT must be optimised for ≥3 months before ICD implant (EF may recover)",
    "NOT indicated in NYHA class IV unless bridge to transplant/CRT-D",
    "ICD does NOT improve symptoms or prevent HF progression — it ONLY prevents SCD",
  ], { fontSize: 12 }), { x: 0.3, y: 4.72, w: 9.4, h: 0.85, valign: "top" });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 20 – DEVICE THERAPY: CRT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Device Therapy — CRT", "Cardiac Resynchronisation Therapy");

  addCard(s, 0.3, 1.18, 9.4, 0.95, "Rationale", [
    "In ~30% of HFrEF patients, bundle branch block (especially LBBB) causes dyssynchronous ventricular contraction, worsening pump function. CRT paces both ventricles simultaneously (biventricular pacing) to restore synchrony.",
  ], ACCENT2);

  s.addText("CRT Indications (Class I):", { x: 0.3, y: 2.28, w: 9.4, h: 0.32, fontSize: 13.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "LVEF ≤35% + LBBB + QRS ≥150 ms + NYHA class II–III (ambulatory IV) on GDMT — STRONGEST indication",
    "LVEF ≤35% + LBBB + QRS 120–149 ms — Class IIa recommendation",
    "LVEF ≤35% + non-LBBB + QRS ≥150 ms — Class IIb (less benefit)",
    "Patients requiring >40% ventricular pacing (RV pacing worsens HF)",
  ], { fontSize: 12 }), { x: 0.3, y: 2.65, w: 9.4, h: 1.2, valign: "top" });

  s.addText("CRT Benefits & CRT-D:", { x: 0.3, y: 3.98, w: 4.5, h: 0.32, fontSize: 13, bold: true, color: GREEN, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "↑ LVEF by 5–10%",
    "↓ NYHA class, improved QoL",
    "↓ HF hospitalisation",
    "↓ All-cause mortality (CARE-HF, COMPANION trials)",
    "CRT-D: combines CRT + ICD in one device",
  ], { fontSize: 12 }), { x: 0.3, y: 4.35, w: 4.5, h: 1.05, valign: "top" });

  s.addText("Non-Responders (~30%):", { x: 5.2, y: 3.98, w: 4.5, h: 0.32, fontSize: 13, bold: true, color: RED, fontFace: "Calibri", margin: 0 });
  s.addText(makeBullets([
    "Non-LBBB morphology, narrow QRS",
    "Advanced scar burden (ischaemic aetiology)",
    "Lead placement challenges",
    "Optimize GDMT before declaring non-response",
  ], { fontSize: 12 }), { x: 5.2, y: 4.35, w: 4.5, h: 1.05, valign: "top" });

  s.addShape(pres.ShapeType.rect, { x: 5.05, y: 3.95, w: 0.04, h: 1.45, fill: { color: ACCENT } });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 21 – ADVANCED HF & TRANSPLANT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Advanced Heart Failure (Stage D)", "Refractory HF — Mechanical Support & Transplant");

  const options = [
    {
      title: "Inotropic Therapy",
      color: ACCENT,
      body: "IV dobutamine or milrinone as a bridge or palliative measure in Stage D. Continuous IV inotropes at home — palliative strategy. NOT a long-term solution.",
    },
    {
      title: "Ultrafiltration",
      color: ACCENT2,
      body: "Mechanical fluid removal for diuretic-resistant patients. CARRESS-HF trial: not superior to stepped diuretic therapy but useful in refractory cases.",
    },
    {
      title: "IABP (Intra-Aortic\nBalloon Pump)",
      color: YELLOW,
      body: "Counterpulsation device. Reduces afterload, improves coronary perfusion. Bridge to definitive therapy (LVAD or transplant). Limited by thrombosis risk.",
    },
    {
      title: "LVAD (Left Ventricular\nAssist Device)",
      color: GREEN,
      body: "Mechanical device that pumps blood from LV to aorta. Bridge to transplant (BTT) OR destination therapy (DT) in patients ineligible for transplant. Improves survival in Stage D.",
    },
    {
      title: "Cardiac Transplantation",
      color: RED,
      body: "Gold standard for Stage D HF. Indications: refractory HF (NYHA IV), peak VO2 <12 ml/kg/min. Contraindications: pulmonary HTN, active infection, malignancy, non-compliance.",
    },
    {
      title: "Palliative Care",
      color: MUTED,
      body: "Symptom control, patient/family support in end-stage HF. Hospice involvement, discontinue ICD shocks if requested. Shared decision-making is essential.",
    },
  ];

  options.forEach((o, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.25 + col * 3.28;
    const y = 1.2 + row * 2.1;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 3.1, h: 1.95, fill: { color: CARD_BG }, line: { color: o.color, width: 1.3 }, rectRadius: 0.1 });
    s.addText(o.title, { x: x + 0.1, y: y + 0.08, w: 2.9, h: 0.42, fontSize: 12, bold: true, color: o.color, fontFace: "Calibri" });
    s.addText(o.body, { x: x + 0.12, y: y + 0.54, w: 2.88, h: 1.32, fontSize: 10.5, color: LIGHT_TXT, fontFace: "Calibri", valign: "top" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 22 – MONITORING & FOLLOW-UP
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Monitoring & Follow-Up", "Structured care to prevent decompensation");

  const monItems = [
    { label: "Daily Weight", detail: "Weigh every morning before eating. Gain >2 kg in 2 days = danger sign → increase diuretics or seek care" },
    { label: "Blood Pressure & HR", detail: "Target SBP 90–130 mmHg, HR 55–65 bpm. Hypotension: review diuretic/vasodilator doses" },
    { label: "Renal Function & Electrolytes", detail: "Check 1–2 weeks after starting/changing ACEi, ARNI, MRA. Monitor K+, creatinine. eGFR drop <30% acceptable" },
    { label: "BNP / NT-proBNP", detail: "Trend values. Persistently elevated BNP despite therapy = poor prognosis" },
    { label: "Echocardiogram", detail: "Repeat echo after 3–6 months of GDMT to reassess LVEF before ICD decision" },
    { label: "6-Minute Walk Test", detail: "Objective functional capacity. Distance <300m = poor prognosis" },
    { label: "Fluid & Salt Intake", detail: "Diary of fluid intake (<1.5–2 L/day in severe HF). Dietary counselling for sodium restriction" },
    { label: "Medication Compliance", detail: "Major cause of re-admission in India. Pill boxes, family education, simplify regimens. Avoid NSAIDs." },
  ];

  monItems.forEach((m, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.25 + col * 5.0;
    const y = 1.18 + row * 1.08;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 4.75, h: 1.0, fill: { color: CARD_BG }, line: { color: ACCENT, width: 0.8 }, rectRadius: 0.07 });
    s.addShape(pres.ShapeType.rect, { x, y, w: 1.6, h: 1.0, fill: { color: ACCENT + "22" } });
    s.addText(m.label, { x: x + 0.05, y, w: 1.5, h: 1.0, fontSize: 11, bold: true, color: ACCENT, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(m.detail, { x: x + 1.65, y: y + 0.06, w: 3.0, h: 0.88, fontSize: 11, color: LIGHT_TXT, fontFace: "Calibri", valign: "middle" });
  });

  s.addText("Clinic review: 2 weeks post-discharge, then 1–3 monthly in stable patients", {
    x: 0.3, y: 5.38, w: 9.4, h: 0.2, fontSize: 10.5, color: MUTED, fontFace: "Calibri", italic: true
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 23 – DRUG SUMMARY TABLE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Drug Summary — HFrEF", "Quick reference for exam revision");

  const headers = ["Drug Class", "Agent", "Starting Dose", "Target Dose", "Mortality Benefit"];
  const rows = [
    ["ARNI", "Sacubitril-Valsartan", "24/26 mg BD", "97/103 mg BD", "YES (PARADIGM-HF)"],
    ["ACE Inhibitor", "Enalapril", "2.5 mg BD", "10–20 mg BD", "YES (CONSENSUS/SOLVD)"],
    ["ARB", "Candesartan", "4 mg OD", "32 mg OD", "Hospitalisations"],
    ["Beta-Blocker", "Bisoprolol", "1.25 mg OD", "10 mg OD", "YES (CIBIS-II)"],
    ["Beta-Blocker", "Carvedilol", "3.125 mg BD", "25–50 mg BD", "YES (COPERNICUS)"],
    ["MRA", "Spironolactone", "25 mg OD", "25–50 mg OD", "YES (RALES)"],
    ["MRA", "Eplerenone", "25 mg OD", "50 mg OD", "YES (EPHESUS)"],
    ["SGLT2i", "Dapagliflozin", "10 mg OD", "10 mg OD", "YES (DAPA-HF)"],
    ["Loop Diuretic", "Furosemide", "20–40 mg OD", "As needed", "Symptoms only"],
    ["If-channel", "Ivabradine", "5 mg BD", "7.5 mg BD", "Hospitalisations (SHIFT)"],
  ];

  const colWidths = [1.7, 1.9, 1.6, 1.6, 2.35];
  headers.forEach((h, ci) => {
    const x = 0.25 + colWidths.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.ShapeType.rect, { x, y: 1.15, w: colWidths[ci], h: 0.38, fill: { color: ACCENT + "55" }, line: { color: ACCENT, width: 0.8 } });
    s.addText(h, { x: x + 0.05, y: 1.17, w: colWidths[ci] - 0.1, h: 0.34, fontSize: 11, bold: true, color: ACCENT, fontFace: "Calibri", align: "center" });
  });

  rows.forEach((row, ri) => {
    row.forEach((cell, ci) => {
      const x = 0.25 + colWidths.slice(0, ci).reduce((a, b) => a + b, 0);
      const y = 1.55 + ri * 0.39;
      const isMortality = ci === 4;
      const isYes = cell.startsWith("YES");
      s.addShape(pres.ShapeType.rect, {
        x, y, w: colWidths[ci], h: 0.38,
        fill: { color: ri % 2 === 0 ? CARD_BG : MID_BG },
        line: { color: MUTED + "44", width: 0.5 }
      });
      s.addText(cell, {
        x: x + 0.05, y: y + 0.04, w: colWidths[ci] - 0.1, h: 0.3,
        fontSize: 10.5,
        bold: isMortality && isYes,
        color: isMortality ? (isYes ? GREEN : YELLOW) : LIGHT_TXT,
        fontFace: "Calibri",
        align: ci >= 2 ? "center" : "left"
      });
    });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 24 – KEY EXAM POINTS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Key Exam Points for Final MBBS", "High-yield facts & common viva questions");

  const points = [
    { q: "Which drugs reduce mortality in HFrEF?", a: "ACEi/ARNI, Beta-blockers, MRA (spironolactone), SGLT2 inhibitors (DAPA-HF)" },
    { q: "PARADIGM-HF trial?", a: "Sacubitril-valsartan vs enalapril — 20% ↓ CV mortality; ↓ HF hospitalisation" },
    { q: "RALES trial?", a: "Spironolactone — 30% ↓ mortality in NYHA III–IV HF" },
    { q: "When NOT to start beta-blocker?", a: "Acute decompensated HF, bradycardia, hypotension, acute bronchospasm" },
    { q: "Ivabradine indication?", a: "Sinus rhythm, HR ≥70 bpm, LVEF ≤35%, NYHA II–IV on max beta-blocker" },
    { q: "CRT indication Class I?", a: "LVEF ≤35%, LBBB, QRS ≥150ms, NYHA II–III on GDMT" },
    { q: "ICD primary prevention?", a: "LVEF ≤35% despite ≥3 months GDMT, NYHA II–III, life expectancy >1 year" },
    { q: "HFpEF treatment?", a: "Diuretics for symptoms + treat comorbidities (HTN, AF, DM); SGLT2i show benefit" },
    { q: "Digoxin — DIG trial finding?", a: "↓ Hospitalisations; NO mortality benefit. Toxic in hypokalaemia" },
    { q: "Diuretic resistance management?", a: "Loop + thiazide combination (sequential blockade), IV loop diuretics, add SGLT2i" },
  ];

  points.forEach((p, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.25 + col * 5.0;
    const y = 1.18 + row * 0.86;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 4.75, h: 0.8, fill: { color: CARD_BG }, line: { color: i % 2 === 0 ? ACCENT : ACCENT2, width: 0.8 }, rectRadius: 0.07 });
    s.addText("Q: " + p.q, { x: x + 0.1, y: y + 0.04, w: 4.55, h: 0.28, fontSize: 10.5, bold: true, color: ACCENT, fontFace: "Calibri", margin: 0 });
    s.addText("A: " + p.a, { x: x + 0.1, y: y + 0.36, w: 4.55, h: 0.38, fontSize: 10.5, color: LIGHT_TXT, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 25 – SUMMARY ALGORITHM
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  setContentBg(s);
  addHeaderBar(s, "Treatment Algorithm — HFrEF", "Step-wise approach: Newly diagnosed symptomatic HFrEF");

  const steps = [
    { step: "STEP 1", title: "Start ALL 4 pillars simultaneously or in rapid succession", color: ACCENT, detail: "ARNI (or ACEi/ARB) + Beta-blocker + MRA + SGLT2i — titrate to target doses over weeks to months" },
    { step: "STEP 2", title: "Diuretics for symptomatic congestion", color: ACCENT2, detail: "Furosemide / torasemide — titrate to dry weight. Reduce dose once euvolaemic. Not a long-term survival drug" },
    { step: "STEP 3", title: "Reassess LVEF after 3–6 months of GDMT", color: GREEN, detail: "If LVEF still ≤35% → consider ICD (primary prevention) and/or CRT if QRS ≥130–150ms with LBBB" },
    { step: "STEP 4", title: "Add Ivabradine if HR ≥70 bpm in sinus rhythm", color: YELLOW, detail: "NYHA II–IV, EF ≤35%, on maximally tolerated beta-blocker. NOT a substitute for beta-blocker" },
    { step: "STEP 5", title: "Refractory / Stage D", color: RED, detail: "Consider LVAD, cardiac transplant, continuous IV inotropes, palliative care. Multidisciplinary team decision" },
  ];

  steps.forEach((st, i) => {
    const y = 1.2 + i * 0.83;
    // connector arrow
    if (i < steps.length - 1) {
      s.addShape(pres.ShapeType.rect, { x: 0.72, y: y + 0.72, w: 0.06, h: 0.12, fill: { color: MUTED } });
    }
    s.addShape(pres.ShapeType.roundRect, { x: 0.25, y, w: 9.5, h: 0.78, fill: { color: CARD_BG }, line: { color: st.color, width: 1.3 }, rectRadius: 0.08 });
    s.addShape(pres.ShapeType.rect, { x: 0.25, y, w: 1.05, h: 0.78, fill: { color: st.color + "44" } });
    s.addText(st.step, { x: 0.25, y, w: 1.05, h: 0.78, fontSize: 13, bold: true, color: st.color, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(st.title, { x: 1.4, y: y + 0.05, w: 8.1, h: 0.3, fontSize: 12.5, bold: true, color: WHITE, fontFace: "Calibri", margin: 0 });
    s.addText(st.detail, { x: 1.4, y: y + 0.38, w: 8.1, h: 0.32, fontSize: 10.5, color: LIGHT_TXT, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 26 – THANK YOU
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DARK_BG } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: ACCENT } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.9, w: 10, h: 0.725, fill: { color: "091729" } });

  s.addText("THANK YOU", { x: 0.5, y: 1.2, w: 9, h: 0.9, fontSize: 50, bold: true, color: WHITE, fontFace: "Calibri", align: "center" });
  s.addShape(pres.ShapeType.rect, { x: 3.5, y: 2.18, w: 3, h: 0.06, fill: { color: ACCENT } });

  s.addText("Key References:", { x: 2, y: 2.45, w: 6, h: 0.35, fontSize: 13, bold: true, color: ACCENT, fontFace: "Calibri", align: "center" });
  const refs = [
    "Braunwald's Heart Disease, 12th Edition",
    "Goldman-Cecil Medicine, International Edition",
    "Goodman & Gilman's Pharmacological Basis of Therapeutics",
    "ACC/AHA 2022 Guideline for HF Management",
    "PARADIGM-HF | DAPA-HF | RALES | CIBIS-II | MERIT-HF | COPERNICUS",
  ];
  s.addText(refs.map((r, i) => ({ text: r, options: { bullet: { code: "2022" }, color: LIGHT_TXT, fontSize: 11.5, fontFace: "Calibri", breakLine: i < refs.length - 1 } })),
    { x: 1.5, y: 2.88, w: 7, h: 1.7, valign: "top", align: "center" });

  s.addText("Prepared for Final Year MBBS | June 2026", {
    x: 0.5, y: 4.9, w: 9, h: 0.35, fontSize: 10, color: MUTED, fontFace: "Calibri", align: "center"
  });
}

// ── WRITE FILE ──────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/heart-failure-pptx/Treatment_Plan_Heart_Failure.pptx" })
  .then(() => console.log("SUCCESS: Presentation saved."))
  .catch(e => console.error("ERROR:", e));
Running Command

cd /home/daytona/workspace/heart-failure-pptx && node hf_presentation.js 2>&1

Running Command

cd /home/daytona/workspace/heart-failure-pptx && node -e " const fs = require('fs'); let code = fs.readFileSync('hf_presentation.js', 'utf8'); // Replace all 8-char hex colors (6+alpha suffix) with proper 6-char versions // Pattern: color + '44', '33', '55', '22', '40', 'CC', '88' etc in fill/line contexts // Replace using regex: replace 8-char hex strings in color values code = code.replace(/\"([0-9A-Fa-f]{6})(CC|44|33|55|22|40|88|AA)\"\s*}/g, (m, hex, alpha) => '\"' + hex + '\" }'); code = code.replace(/color:\s*([A-Z_]+)\s*\+\s*\"(CC|44|33|55|22|40|88|AA)\"/g, (m, varname, alpha) => { const alphaMap = { 'CC': 'CC', '44': '44', '33': '33', '55': '55', '22': '22', '40': '40', '88': '88', 'AA': 'AA' }; // We need to blend these - for semi-transparent overlays on dark bg (1A3560), create pre-blended colors return 'color: ' + varname; }); fs.writeFileSync('hf_presentation_fixed.js', code); console.log('done'); "

Running Command

ls -lh /home/daytona/workspace/heart-failure-pptx/Treatment_Plan_Heart_Failure.pptx && echo "File exists and size is OK"

Running Command

cd /home/daytona/workspace/heart-failure-pptx && sed \ -e 's/E74C3CCC/C0392B/g' \ -e 's/E74C3C44/6B2020/g' \ -e 's/E74C3C55/7D2828/g' \ -e 's/27AE6055/1B6B3A/g' \ -e 's/27AE6033/163D24/g' \ -e 's/27AE6044/1B5E33/g' \ -e 's/F1C40F55/8C720A/g' \ -e 's/F1C40F33/5C4A07/g' \ -e 's/F1C40F44/806608/g' \ -e 's/E8A02055/8A5F12/g' \ -e 's/E8A02033/5C3F0C/g' \ -e 's/E8A02044/7A5310/g' \ -e 's/E8A02040/734F0F/g' \ -e 's/E8A02088/B87B18/g' \ -e 's/E8A02022/3D2A08/g' \ -e 's/3FBBE840/2A7D9A/g' \ -e 's/3FBBE833/1F5E73/g' \ -e 's/3FBBE844/2A7A96/g' \ -e 's/8AAAD444/4B6A8A/g' \ -e 's/8AAAD455/516E8C/g' \ hf_presentation.js > hf_clean.js && node hf_clean.js 2>&1 | grep -v "not a valid" | head -5

Running Command

ls -lh /home/daytona/workspace/heart-failure-pptx/Treatment_Plan_Heart_Failure.pptx

Your presentation is ready!

Treatment Plan Heart Failure

Presentation · PPTX


What's inside — 26 slides

#SlideContent
1TitleDeep navy theme with gold accent
2OutlineFull two-column index
3Definition & EpidemiologyIndia-specific context (RHD in young, ~10M affected), stat boxes
4PathophysiologyRAAS vs SNS activation diagram, LV remodelling
5AetiologyIndian causes highlighted (RHD, anaemia/hookworm, peripartum CMP)
6NYHA + ACC/AHA ClassificationSide-by-side colour-coded tables
7DiagnosisEcho, BNP/NT-proBNP, CXR, ECG, blood tests
8Goals of TreatmentSymptoms / disease modification / mortality
9Non-Pharmacological8 cards: salt restriction, fluids, rehab, vaccinations
10Pharmacological OverviewHFrEF vs HFpEF side-by-side
11The Four Pillars (GDMT)ARNI, Beta-blocker, MRA, SGLT2i with key trials
12DiureticsLoop diuretics table + thiazides/SGLT2i
13ACEi / ARB / ARNIPARADIGM-HF, contraindications, 36h washout rule
14Beta-BlockersCarvedilol, Bisoprolol, Metoprolol + Start Low Go Slow rules
15MRA & SGLT2iRALES/EPHESUS + DAPA-HF/EMPEROR trials
16Additional TherapiesIvabradine, Hydralazine+ISDN, Digoxin, Vericiguat
17HFpEF ManagementWhy no proven mortality drug + SGLT2i emerging role
18Acute HF / ADHFWet-Warm-Cold-Dry matrix + inotropes in cardiogenic shock
19ICDIndications, LVEF criteria, primary/secondary prevention
20CRTLBBB + QRS criteria, CRT-D, non-responders
21Stage D / Advanced HFLVAD, transplant, palliative care
22Monitoring & Follow-up8 parameters (weight, K+, BNP, echo)
23Drug Summary TableAll drugs, doses, and trial evidence at a glance
24Key Exam Points10 Q&A pairs for viva/written exam revision
25Treatment AlgorithmStep 1-5 flowchart for newly diagnosed HFrEF
26Thank You + ReferencesBraunwald's, Goldman-Cecil, Goodman & Gilman, ACC/AHA 2022
Sources used: Braunwald's Heart Disease, Goldman-Cecil Medicine, Goodman & Gilman's Pharmacology, Textbook of Family Medicine - all cross-referenced for accuracy.

Give me all the slides of above presentation in downloadable image direct view

Reading File
Running Command

which libreoffice && libreoffice --version

Running Command

mkdir -p /home/daytona/workspace/heart-failure-pptx/slides && libreoffice --headless --convert-to pdf --outdir /home/daytona/workspace/heart-failure-pptx/ /home/daytona/workspace/heart-failure-pptx/Treatment_Plan_Heart_Failure.pptx 2>&1

Running Command

cp /home/daytona/workspace/heart-failure-pptx/Treatment_Plan_Heart_Failure.pptx /tmp/hf_slides.pptx && libreoffice --headless --convert-to pdf --outdir /tmp/ /tmp/hf_slides.pptx 2>&1

Running Command

which pdftoppm && pdftoppm -r 150 /tmp/hf_slides.pdf /home/daytona/workspace/heart-failure-pptx/slides/slide && ls /home/daytona/workspace/heart-failure-pptx/slides/ | head -5 && echo "Total: $(ls /home/daytona/workspace/heart-failure-pptx/slides/ | wc -l) images"

Running Command

cd /home/daytona/workspace/heart-failure-pptx/slides && for f in *.ppm; do convert "$f" "${f%.ppm}.png" && rm "$f"; done && echo "Done: $(ls *.png | wc -l) PNG files" && ls *.png

Running Command

python3 -c "from PIL import Image; print('PIL ok')" 2>&1

Running Command

python3 -c " from PIL import Image import glob, os slides_dir = '/home/daytona/workspace/heart-failure-pptx/slides' ppm_files = sorted(glob.glob(f'{slides_dir}/*.ppm')) for ppm in ppm_files: img = Image.open(ppm) out = ppm.replace('.ppm', '.png') img.save(out, 'PNG') os.remove(ppm) print(f'Converted: {os.path.basename(out)}') print(f'Total: {len(ppm_files)} images converted') "

Running Command

ls /home/daytona/workspace/heart-failure-pptx/slides/ | head -5 && du -sh /home/daytona/workspace/heart-failure-pptx/slides/slide-01.ppm 2>/dev/null || echo "ppm files may be gone"

Running Command

ls /home/daytona/workspace/heart-failure-pptx/slides/*.png 2>/dev/null | wc -l && ls /home/daytona/workspace/heart-failure-pptx/slides/*.ppm 2>/dev/null | wc -l

Running Command

python3 -c " from PIL import Image import glob, os for ppm in glob.glob('/home/daytona/workspace/heart-failure-pptx/slides/*.ppm'): img = Image.open(ppm) out = ppm.replace('.ppm', '.png') img.save(out, 'PNG', optimize=True) os.remove(ppm) print('Done:', os.path.basename(out)) " && echo "All done" && ls /home/daytona/workspace/heart-failure-pptx/slides/*.png | wc -l

Running Command

cd /home/daytona/workspace/heart-failure-pptx && zip -j slides/All_Slides.zip slides/slide-*.png && echo "ZIP done" && ls -lh slides/All_Slides.zip

Running Command

cd /home/daytona/workspace/heart-failure-pptx/slides && zip /home/daytona/workspace/heart-failure-pptx/All_Slides_HF.zip slide-*.png && echo "ZIP done" && ls -lh /home/daytona/workspace/heart-failure-pptx/All_Slides_HF.zip

Running Command

ls -lh /home/daytona/workspace/heart-failure-pptx/slides/slide-01.png && python3 -c " from PIL import Image img = Image.open('/home/daytona/workspace/heart-failure-pptx/slides/slide-01.png') print('Format:', img.format, '| Size:', img.size, '| Mode:', img.mode) img.save('/home/daytona/workspace/heart-failure-pptx/slides/test.png') print('Save OK') "

Running Command

python3 -c " import zipfile, glob, os slides = sorted(glob.glob('/home/daytona/workspace/heart-failure-pptx/slides/slide-*.png')) out_zip = '/home/daytona/workspace/heart-failure-pptx/All_Slides_HF.zip' with zipfile.ZipFile(out_zip, 'w', zipfile.ZIP_DEFLATED) as zf: for s in slides: zf.write(s, os.path.basename(s)) print('Added:', os.path.basename(s)) print('ZIP created:', out_zip) import os print('Size:', round(os.path.getsize(out_zip)/1024), 'KB') "

Running Command

python3 -c " import zipfile, glob, os, shutil slides = sorted(glob.glob('/home/daytona/workspace/heart-failure-pptx/slides/slide-*.png')) tmp_zip = '/tmp/All_Slides_HF.zip' out_zip = '/home/daytona/workspace/heart-failure-pptx/All_Slides_HF.zip' with zipfile.ZipFile(tmp_zip, 'w', zipfile.ZIP_DEFLATED) as zf: for s in slides: zf.write(s, os.path.basename(s)) shutil.copy2(tmp_zip, out_zip) print('Done. Size:', round(os.path.getsize(out_zip)/1024), 'KB') "

Running Command

python3 -c " import zipfile, glob, os, shutil slides = sorted(glob.glob('/home/daytona/workspace/heart-failure-pptx/slides/slide-*.png')) tmp_zip = '/tmp/All_Slides_HF.zip' out_zip = '/home/daytona/workspace/heart-failure-pptx/All_Slides_HF.zip' with zipfile.ZipFile(tmp_zip, 'w', zipfile.ZIP_DEFLATED) as zf: for s in slides: zf.write(s, os.path.basename(s)) shutil.copyfile(tmp_zip, out_zip) print('Done. Size:', round(os.path.getsize(out_zip)/1024), 'KB') "

All 26 slides are ready as PNG images and zipped. Here they all are:

Download All Slides

All Slides HF

Archive · ZIP


Individual Slide Images

Slide 1 — Title
Slide 1
Slide 2 — Outline
Slide 2
Slide 3 — Definition & Epidemiology
Slide 3
Slide 4 — Pathophysiology
Slide 4
Slide 5 — Aetiology
Slide 5
Slide 6 — NYHA & ACC/AHA Classification
Slide 6
Slide 7 — Diagnosis
Slide 7
Slide 8 — Goals of Treatment
Slide 8
Slide 9 — Non-Pharmacological Management
Slide 9
Slide 10 — Pharmacological Overview (HFrEF vs HFpEF)
Slide 10
Slide 11 — The Four Pillars of GDMT
Slide 11
Slide 12 — Diuretics
Slide 12
Slide 13 — ACE Inhibitors, ARBs & ARNI
Slide 13
Slide 14 — Beta-Blockers
Slide 14
Slide 15 — MRA & SGLT2 Inhibitors
Slide 15
Slide 16 — Additional Therapies (Ivabradine, Digoxin, etc.)
Slide 16
Slide 17 — HFpEF Management
Slide 17
Slide 18 — Acute Decompensated Heart Failure
Slide 18
Slide 19 — ICD
Slide 19
Slide 20 — CRT
Slide 20
Slide 21 — Advanced HF & Transplant
Slide 21
Slide 22 — Monitoring & Follow-up
Slide 22
Slide 23 — Drug Summary Table
Slide 23
Slide 24 — Key Exam Points (Q&A)
Slide 24
Slide 25 — Treatment Algorithm
Slide 25
Slide 26 — Thank You & References
Slide 26

All 26 slides are viewable above and downloadable individually or as a

All Slides HF

Archive · ZIP

. The original editable PPTX is also available at

Treatment Plan Heart Failure

Presentation · PPTX

.

Don't zip it just show me here all the slides

Here are all 26 slides displayed directly:

Slide 1 — Title
Slide 1

Slide 2 — Outline
Slide 2

Slide 3 — Definition & Epidemiology
Slide 3

Slide 4 — Pathophysiology
Slide 4

Slide 5 — Aetiology
Slide 5

Slide 6 — NYHA & ACC/AHA Classification
Slide 6

Slide 7 — Diagnosis
Slide 7

Slide 8 — Goals of Treatment
Slide 8

Slide 9 — Non-Pharmacological Management
Slide 9

Slide 10 — Pharmacological Overview (HFrEF vs HFpEF)
Slide 10

Slide 11 — The Four Pillars of GDMT
Slide 11

Slide 12 — Diuretics
Slide 12

Slide 13 — ACE Inhibitors, ARBs & ARNI
Slide 13

Slide 14 — Beta-Blockers
Slide 14

Slide 15 — MRA & SGLT2 Inhibitors
Slide 15

Slide 16 — Additional Therapies
Slide 16

Slide 17 — HFpEF Management
Slide 17

Slide 18 — Acute Decompensated Heart Failure
Slide 18

Slide 19 — ICD
Slide 19

Slide 20 — CRT
Slide 20

Slide 21 — Advanced HF & Transplant
Slide 21

Slide 22 — Monitoring & Follow-up
Slide 22

Slide 23 — Drug Summary Table
Slide 23

Slide 24 — Key Exam Points (Q&A)
Slide 24

Slide 25 — Treatment Algorithm
Slide 25

Slide 26 — Thank You & References
Slide 26

All 26 slides are shown above. You can right-click any image to save it individually, or download the full editable file here:

Treatment Plan Heart Failure

Presentation · PPTX

It shows error give me image

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
I've reached my model call budget. Here are all the slides I've displayed so far (Slides 1-19). The remaining slides 20-26 are already saved and can be accessed directly via these download links:

Slides shown above: 1 through 19 ✅
Remaining slides — click to download individually:
  • slide 20

    Image · PNG

  • slide 21

    Image · PNG

  • slide 22

    Image · PNG

  • slide 23

    Image · PNG

  • slide 24

    Image · PNG

  • slide 25

    Image · PNG

  • slide 26

    Image · PNG

And the full editable file:

Treatment Plan Heart Failure

Presentation · PPTX

Just show me image direct here

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
All 26 slides are now displayed directly above! Here's a quick recap of the complete set:
SlidesTopic
1Title
2Outline
3Definition & Epidemiology
4Pathophysiology (RAAS & SNS)
5Aetiology (Indian context)
6NYHA & ACC/AHA Classification
7Diagnosis (Echo, BNP, CXR, ECG)
8Goals of Treatment
9Non-Pharmacological Management
10Pharmacological Overview (HFrEF vs HFpEF)
11The Four Pillars of GDMT
12Diuretics
13ACEi, ARBs & ARNI
14Beta-Blockers
15MRA & SGLT2 Inhibitors
16Additional Therapies (Ivabradine, Digoxin...)
17HFpEF Management
18Acute Decompensated HF
19ICD
20CRT
21Advanced HF & Transplant
22Monitoring & Follow-up
23Drug Summary Table
24Key Exam Points Q&A
25Treatment Algorithm
26Thank You & References
Download the full PPTX:

Treatment Plan Heart Failure

Presentation · PPTX

This is a shared conversation. Sign in to Orris to start your own chat.