Make me a ppt for my clinic of general surgery on mesenteric ischemia based on standard surgical textbooks

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

mkdir -p /home/daytona/workspace/mesenteric-ischemia-ppt && ls /home/daytona/wor…

Writing File

~/mesenteric-ischemia-ppt/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Mesenteric Ischemia";
pres.author = "General Surgery Clinic";

// ─── THEME PALETTE ───────────────────────────────────────────────────────────
const C = {
  darkBg:    "0D1B2A",   // deep navy – title / section headers
  midBg:     "1B3A5C",   // steel blue
  accent:    "E63946",   // urgent red (ischemia, warnings)
  accentAlt: "F4A261",   // amber (caution / secondary)
  white:     "FFFFFF",
  lightGray: "E8EDF2",
  textDark:  "0D1B2A",
  textMid:   "1B3A5C",
  green:     "2A9D8F",   // revascularisation / positive
  slate:     "457B9D",
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function addSectionBadge(slide, label) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: C.accent } });
  slide.addText(label, {
    x: 0.35, y: 0.12, w: 4, h: 0.35,
    fontSize: 9, bold: true, color: C.accent, charSpacing: 2,
  });
}

function addSlideTitle(slide, title, subtitle) {
  slide.addText(title, {
    x: 0.35, y: 0.52, w: 9.3, h: 0.7,
    fontSize: 28, bold: true, color: C.textDark, fontFace: "Calibri",
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.35, y: 1.22, w: 9.3, h: 0.35,
      fontSize: 13, color: C.slate, fontFace: "Calibri", italic: true,
    });
  }
}

function bulletList(slide, items, opts = {}) {
  const {
    x = 0.4, y = 1.6, w = 9.2, h = 3.6,
    fontSize = 13.5, color = C.textDark, indent = 0,
    bold = false,
  } = opts;
  const textArr = items.map((item, i) => ({
    text: item,
    options: {
      bullet: { indent: 15 + indent * 15 },
      breakLine: i < items.length - 1,
      fontSize, color, bold,
      fontFace: "Calibri",
    },
  }));
  slide.addText(textArr, { x, y, w, h, valign: "top" });
}

function addFooter(slide, src) {
  slide.addText(`Source: ${src}`, {
    x: 0.3, y: 5.3, w: 9.4, h: 0.25,
    fontSize: 8, color: "888888", italic: true, align: "right",
  });
}

// ─── SLIDE 1 – TITLE ─────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.darkBg };

  // Accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  s.addShape(pres.ShapeType.rect, { x: 0.18, y: 0, w: 9.82, h: 5.625, fill: { color: C.darkBg } });

  s.addText("MESENTERIC\nISCHEMIA", {
    x: 0.5, y: 0.85, w: 9, h: 2.2,
    fontSize: 52, bold: true, color: C.white, fontFace: "Calibri",
    lineSpacingMultiple: 1.1,
  });
  s.addText("A Surgical Perspective", {
    x: 0.5, y: 3.1, w: 9, h: 0.5,
    fontSize: 20, color: C.accentAlt, fontFace: "Calibri", italic: true,
  });
  s.addShape(pres.ShapeType.rect, { x: 0.5, y: 3.7, w: 3.5, h: 0.04, fill: { color: C.accent } });
  s.addText("General Surgery Clinic  ·  2026", {
    x: 0.5, y: 3.82, w: 9, h: 0.35,
    fontSize: 11, color: "AAAAAA", fontFace: "Calibri",
  });
  s.addText("Based on: Schwartz's Principles of Surgery (11e) · Sabiston Textbook of Surgery · Current Surgical Therapy (14e)", {
    x: 0.5, y: 5.15, w: 9.2, h: 0.35,
    fontSize: 9, color: "777777", fontFace: "Calibri", italic: true,
  });
}

// ─── SLIDE 2 – OVERVIEW / OUTLINE ────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.lightGray };
  addSectionBadge(s, "OVERVIEW");
  addSlideTitle(s, "What We Will Cover");

  const topics = [
    "Definition & Epidemiology",
    "Classification & Pathophysiology",
    "Anatomy of Mesenteric Circulation",
    "Clinical Presentation",
    "Diagnosis — Imaging & Labs",
    "Management — Acute Mesenteric Ischemia",
    "Management — Chronic Mesenteric Ischemia",
    "Management — Mesenteric Venous Thrombosis",
    "Surgical Techniques (Open & Endovascular)",
    "Second-Look Laparotomy",
    "Outcomes & Prognosis",
  ];
  bulletList(s, topics, { y: 1.55, fontSize: 14 });
  addFooter(s, "Schwartz 11e, Sabiston, Current Surgical Therapy 14e");
}

// ─── SLIDE 3 – EPIDEMIOLOGY ───────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "EPIDEMIOLOGY");
  addSlideTitle(s, "Epidemiology", "Rare but highly morbid — requires high index of suspicion");

  // Left column
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.55, w: 4.6, h: 3.7, fill: { color: C.lightGray }, line: { color: C.lightGray } });
  s.addText("Incidence & Burden", {
    x: 0.5, y: 1.6, w: 4.3, h: 0.4,
    fontSize: 13, bold: true, color: C.midBg,
  });
  bulletList(s, [
    "< 1 per 100,000 hospital admissions (US)",
    "0.1–1 per 1,000 hospitalizations overall",
    "< 2% of all GI disorder admissions",
    "Primarily a disease of the elderly (median age 74)",
    "Incidence nearly doubles per 5-year interval above age 70",
    "3× higher in females than males",
  ], { x: 0.5, y: 2.0, w: 4.3, h: 3.0, fontSize: 12 });

  // Right column
  s.addShape(pres.ShapeType.rect, { x: 5.2, y: 1.55, w: 4.45, h: 3.7, fill: { color: "FFF3E0" }, line: { color: C.accentAlt } });
  s.addText("Mortality", {
    x: 5.35, y: 1.6, w: 4.1, h: 0.4,
    fontSize: 13, bold: true, color: C.accent,
  });
  bulletList(s, [
    "Mortality > 50% when diagnosed early",
    "Mortality > 70% in ICU-admitted patients",
    "Overall mortality 17–21% in those requiring intervention",
    "Open repair mortality declined: 43% → 33% (1999–2010)",
    "Endovascular mortality declined: 20% → 15%",
  ], { x: 5.35, y: 2.0, w: 4.1, h: 3.0, fontSize: 12, color: C.textDark });
  addFooter(s, "Sabiston Textbook of Surgery, Schwartz's Principles of Surgery 11e");
}

// ─── SLIDE 4 – CLASSIFICATION ─────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "CLASSIFICATION");
  addSlideTitle(s, "Classification of Mesenteric Ischemia");

  // Two big boxes
  const boxes = [
    { x: 0.35, label: "ACUTE", color: C.accent, items: [
      "Arterial Embolism  (40–50% of cases — most common)",
      "Arterial Thrombosis (superimposed on atherosclerosis)",
      "Nonocclusive MI (NOMI) — vasospasm in critically ill",
      "Mesenteric Venous Thrombosis (MVT) — 5–15%",
    ]},
    { x: 5.2, label: "CHRONIC", color: C.green, items: [
      "Atherosclerotic stenosis ≥ 2 visceral arteries",
      "Insidious onset — collaterals develop",
      "Postprandial pain → 'food fear' → weight loss",
      "Rarely leads to intestinal infarction",
      "May precede acute catastrophe",
    ]},
  ];

  boxes.forEach(b => {
    s.addShape(pres.ShapeType.rect, { x: b.x, y: 1.5, w: 4.5, h: 3.85,
      fill: { color: C.lightGray }, line: { color: b.color, pt: 2 } });
    s.addText(b.label, {
      x: b.x + 0.15, y: 1.55, w: 4.2, h: 0.45,
      fontSize: 16, bold: true, color: b.color, charSpacing: 2,
    });
    bulletList(s, b.items, { x: b.x + 0.15, y: 2.05, w: 4.2, h: 3.1, fontSize: 12.5 });
  });
  addFooter(s, "Schwartz 11e p.318–344; Current Surgical Therapy 14e");
}

// ─── SLIDE 5 – ANATOMY ────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "ANATOMY");
  addSlideTitle(s, "Mesenteric Arterial Anatomy", "Key for understanding ischemia patterns");

  s.addText("Superior Mesenteric Artery (SMA)", {
    x: 0.35, y: 1.6, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.midBg,
  });
  bulletList(s, [
    "2nd branch of abdominal aorta — oblique angle favors thromboembolic lodging",
    "Branches: inferior pancreaticoduodenal, middle colic, right colic, ileocolic, jejunal/ileal branches",
    "Tapers just beyond first jejunal branches — emboli typically lodge proximally",
    "~50% of emboli lodge just distal to middle colic artery; ~15% at SMA origin",
    "Emboli proximal to middle colic → classic ischemia pattern, sparing first jejunal loops & right colon",
  ], { x: 0.35, y: 1.98, w: 9.3, h: 1.8, fontSize: 12.5 });

  s.addText("Collateral Circulation — Clinically Critical", {
    x: 0.35, y: 3.8, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.green,
  });
  bulletList(s, [
    "Celiac ↔ SMA: pancreaticoduodenal arcade",
    "SMA ↔ IMA: marginal artery of Drummond, arc of Riolan",
    "Extensive collaterals explain why ≥2 vessel involvement needed for chronic ischemia symptoms",
    "~20% of adults >65 have asymptomatic visceral artery stenosis/occlusion",
  ], { x: 0.35, y: 4.18, w: 9.3, h: 1.3, fontSize: 12.5 });
  addFooter(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ─── SLIDE 6 – PATHOPHYSIOLOGY ────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "PATHOPHYSIOLOGY");
  addSlideTitle(s, "Pathophysiology of AMI", "Time is bowel — ischemia → infarction within hours");

  // Timeline bar
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.55, w: 9.3, h: 0.5,
    fill: { color: C.midBg }, line: { color: C.midBg } });
  s.addText("ISCHEMIA TIMELINE", {
    x: 0.35, y: 1.55, w: 9.3, h: 0.5,
    fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle",
  });

  const timeline = [
    { x: 0.35, w: 2.3, label: "0–3 hrs", detail: "Mucosal sloughing begins", color: C.accentAlt },
    { x: 2.85, w: 2.3, label: "3–6 hrs", detail: "Full-thickness ischemia", color: "E07B3A" },
    { x: 5.35, w: 2.3, label: "> 6 hrs", detail: "Full-thickness INFARCTION", color: C.accent },
    { x: 7.85, w: 1.8, label: "Late", detail: "Peritonitis, death", color: "8B0000" },
  ];
  timeline.forEach(t => {
    s.addShape(pres.ShapeType.rect, { x: t.x, y: 2.1, w: t.w - 0.05, h: 1.2,
      fill: { color: t.color }, line: { color: t.color } });
    s.addText([
      { text: t.label + "\n", options: { bold: true, fontSize: 13, color: C.white, breakLine: true } },
      { text: t.detail, options: { fontSize: 11, color: C.white } },
    ], { x: t.x + 0.05, y: 2.15, w: t.w - 0.15, h: 1.1, valign: "middle", align: "center" });
  });

  s.addText("Etiology & Mechanisms", {
    x: 0.35, y: 3.45, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.midBg,
  });
  bulletList(s, [
    "Embolism: cardiac source (AF, LV thrombus, valvular disease, endocarditis) — 68% have simultaneous emboli in other beds",
    "Thrombosis: superimposed on proximal atherosclerotic plaques at vessel origins",
    "NOMI: vasospasm from low-flow states — vasopressors, post-cardiac surgery, hemodialysis",
    "MVT: hypercoagulable states, portal HTN, intra-abdominal infection, trauma, OCP use",
  ], { x: 0.35, y: 3.83, w: 9.3, h: 1.55, fontSize: 12.5 });
  addFooter(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 7 – CLINICAL PRESENTATION ─────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "CLINICAL PRESENTATION");
  addSlideTitle(s, "Clinical Presentation");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.55, w: 4.55, h: 3.75,
    fill: { color: "FFF0F0" }, line: { color: C.accent, pt: 2 } });
  s.addText("Acute MI", {
    x: 0.5, y: 1.6, w: 4.2, h: 0.4,
    fontSize: 14, bold: true, color: C.accent,
  });
  bulletList(s, [
    "Pain OUT OF PROPORTION to examination (hallmark)",
    "Sudden-onset severe periumbilical pain",
    "Colicky, mid-abdominal",
    "Nausea, vomiting, diarrhea",
    "Paucity of physical findings early",
    "Late: abdominal distension, bloody stools, peritonitis",
    "Associated: AF, recent MI, PVD, mechanical valve, thromboembolic history",
  ], { x: 0.5, y: 2.0, w: 4.2, h: 3.1, fontSize: 12 });

  s.addShape(pres.ShapeType.rect, { x: 5.15, y: 1.55, w: 4.5, h: 3.75,
    fill: { color: "F0F7F0" }, line: { color: C.green, pt: 2 } });
  s.addText("Chronic MI", {
    x: 5.3, y: 1.6, w: 4.15, h: 0.4,
    fontSize: 14, bold: true, color: C.green,
  });
  bulletList(s, [
    "Postprandial pain (intestinal angina)",
    "Characteristic 'food fear' — aversion to eating",
    "Progressive weight loss",
    "Often misdiagnosed as malignancy",
    "Prolonged workup before correct diagnosis",
    "MVT: often asymptomatic (incidental on imaging)",
    "MVT portal HTN: esophagogastric varices, splenomegaly, hypersplenism",
  ], { x: 5.3, y: 2.0, w: 4.15, h: 3.1, fontSize: 12 });

  addFooter(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 8 – RISK FACTORS ───────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "RISK FACTORS");
  addSlideTitle(s, "Risk Factors & High-Risk Patients", "AMI should be assumed until proven otherwise in these patients");

  const categories = [
    { label: "Embolic Risk", color: C.accent, items: ["Atrial fibrillation / flutter", "Mechanical heart valves", "Recent MI + mural thrombus", "Low EF / heart failure", "Valvular disease, endocarditis", "Aortic aneurysm with mural thrombus"] },
    { label: "Thrombotic Risk", color: C.midBg, items: ["Atherosclerotic PVD", "Prior mesenteric ischemia", "Hypercoagulable states", "Thrombophilias (Factor V Leiden, etc.)"] },
    { label: "NOMI Risk", color: C.accentAlt, items: ["Critical illness / sepsis / shock", "Post-cardiac surgery", "Hemodialysis patients", "High-dose vasopressors", "Low cardiac output states"] },
  ];

  categories.forEach((c, i) => {
    const x = 0.35 + i * 3.2;
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 3.8,
      fill: { color: C.lightGray }, line: { color: c.color, pt: 2.5 } });
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 0.5,
      fill: { color: c.color }, line: { color: c.color } });
    s.addText(c.label, {
      x: x + 0.1, y: 1.58, w: 2.9, h: 0.44,
      fontSize: 13, bold: true, color: C.white, valign: "middle",
    });
    bulletList(s, c.items, { x: x + 0.1, y: 2.1, w: 2.9, h: 3.1, fontSize: 11.5 });
  });
  addFooter(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 9 – DIAGNOSIS ──────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "DIAGNOSIS");
  addSlideTitle(s, "Diagnosis", "Gold standard: CT Angiography");

  s.addText("Laboratory Studies", { x: 0.35, y: 1.55, w: 4.5, h: 0.38, fontSize: 14, bold: true, color: C.midBg });
  bulletList(s, [
    "Lactate: highly elevated = widespread injury; normal/mild elevation has POOR negative predictive value",
    "WBC: leukocytosis (often > 15,000)",
    "Metabolic acidosis, elevated D-dimer",
    "LFTs, amylase may be elevated",
    "⚠ No lab can rule out AMI",
  ], { x: 0.35, y: 1.93, w: 4.5, h: 2.0, fontSize: 12 });

  s.addText("CT Angiography — Gold Standard", { x: 0.35, y: 3.95, w: 4.5, h: 0.38, fontSize: 14, bold: true, color: C.green });
  bulletList(s, [
    "Specificity > 97% for: pneumatosis intestinalis, SMA/celiac occlusion, arterial embolism, SMV/portal venous gas, focal bowel wall non-enhancement",
    "Allows revascularization planning",
    "Triaging open vs. endovascular approach",
  ], { x: 0.35, y: 4.33, w: 4.5, h: 1.1, fontSize: 12 });

  s.addShape(pres.ShapeType.rect, { x: 5.1, y: 1.55, w: 4.55, h: 3.8,
    fill: { color: "FFF3E0" }, line: { color: C.accent, pt: 2 } });
  s.addText("CT Findings with >97% Specificity", {
    x: 5.25, y: 1.6, w: 4.2, h: 0.4,
    fontSize: 13, bold: true, color: C.accent,
  });
  const findings = [
    "Pneumatosis intestinalis",
    "Portal / SMV venous gas",
    "SMA or celiac artery occlusion",
    "Arterial embolism (filling defect)",
    "Focal bowel wall non-enhancement",
    "Bowel wall thickening / stranding",
    "Mesenteric fat stranding",
    "Absent bowel wall enhancement",
  ];
  bulletList(s, findings, { x: 5.25, y: 2.05, w: 4.2, h: 3.1, fontSize: 12.5 });
  addFooter(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 10 – MANAGEMENT AMI OVERVIEW ──────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "MANAGEMENT — AMI");
  addSlideTitle(s, "Management of Acute Mesenteric Ischemia", "The Four R's Framework");

  // The 4 Rs
  const Rs = [
    { r: "Resuscitation", color: C.midBg, desc: "IV fluids, NGT decompression, IV heparin, broad-spectrum antibiotics, ICU monitoring" },
    { r: "Revascularization", color: C.green, desc: "Priority over bowel resection. Open embolectomy/bypass vs. endovascular (PTCA/stenting/thrombolysis)" },
    { r: "Resection", color: C.accent, desc: "Only frankly necrotic or perforated bowel — damage control fashion. Preserve maximal bowel length" },
    { r: "Reassessment", color: C.accentAlt, desc: "Second-look laparotomy 24–48 hrs post-revascularization to assess questionable viability" },
  ];
  Rs.forEach((r, i) => {
    const x = 0.35 + i * 2.35;
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 2.25, h: 3.8,
      fill: { color: C.lightGray }, line: { color: r.color, pt: 2.5 } });
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 2.25, h: 0.7,
      fill: { color: r.color }, line: { color: r.color } });
    s.addText(r.r, {
      x: x + 0.07, y: 1.57, w: 2.1, h: 0.65,
      fontSize: 14, bold: true, color: C.white, valign: "middle", align: "center",
    });
    s.addText(r.desc, {
      x: x + 0.1, y: 2.3, w: 2.05, h: 2.9,
      fontSize: 11.5, color: C.textDark, valign: "top", fontFace: "Calibri",
    });
  });

  s.addText("⚠  Peritonitis = Emergent Laparotomy — Do NOT delay for imaging", {
    x: 0.35, y: 5.2, w: 9.3, h: 0.3,
    fontSize: 11.5, bold: true, color: C.accent, align: "center",
  });
  addFooter(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 11 – OPEN SURGICAL TECHNIQUES ─────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "SURGICAL TECHNIQUE — OPEN");
  addSlideTitle(s, "Open Surgical Approaches", "Gold standard: open midline laparotomy + revascularization");

  s.addText("SMA Exposure", {
    x: 0.35, y: 1.55, w: 9.3, h: 0.38,
    fontSize: 13, bold: true, color: C.midBg,
  });
  bulletList(s, [
    "Colon reflected cephalad, small bowel to patient's right — exposes root of mesentery",
    "Transverse incision through transverse colon mesentery with careful dissection through perivascular lymphatics",
    "Intraoperative Doppler to localize loss of signal and extent of occlusion",
    "Proximal SMA: divide ligament of Treitz, free duodenum from pancreas, retract right",
  ], { x: 0.35, y: 1.93, w: 9.3, h: 1.3, fontSize: 12 });

  s.addText("Open Embolectomy (for embolic AMI)", {
    x: 0.35, y: 3.25, w: 9.3, h: 0.38,
    fontSize: 13, bold: true, color: C.accent,
  });
  bulletList(s, [
    "Heparinize → proximal & distal control of SMA and branches",
    "Transverse arteriotomy proximal to embolus",
    "2 or 3-French balloon catheter passed antegrade to extract embolus",
    "Smaller catheters for 'showered' distal clot",
    "Primary closure with polypropylene suture on return of pulsatile flow",
  ], { x: 0.35, y: 3.63, w: 4.5, h: 1.75, fontSize: 12 });

  s.addText("Open Bypass (for thrombotic AMI / AOD)", {
    x: 4.95, y: 3.25, w: 4.7, h: 0.38,
    fontSize: 13, bold: true, color: C.green,
  });
  bulletList(s, [
    "Antegrade from supraceliac aorta OR retrograde from infrarenal aorta / common iliac",
    "Conduit: PTFE, Dacron, or autologous saphenous vein",
    "PTFE preferred in contaminated abdomen (less harvest time)",
    "Omental pedicle flap over synthetic graft in contamination",
    "Temporary abdominal closure → 2nd look in 24–48 hrs",
  ], { x: 4.95, y: 3.63, w: 4.7, h: 1.75, fontSize: 12 });
  addFooter(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 12 – ENDOVASCULAR ─────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "ENDOVASCULAR");
  addSlideTitle(s, "Endovascular Management of AMI", "For select patients without peritonitis");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.55, w: 9.3, h: 0.55,
    fill: { color: C.midBg } });
  s.addText("Patient Selection: No peritonitis · No signs of bowel necrosis · Diagnosed early · Endovascular expertise available", {
    x: 0.5, y: 1.58, w: 9.0, h: 0.48,
    fontSize: 11.5, color: C.white, bold: true, valign: "middle",
  });

  s.addText("Endovascular Options", { x: 0.35, y: 2.2, w: 9.3, h: 0.38, fontSize: 14, bold: true, color: C.midBg });
  bulletList(s, [
    "Pharmacomechanical embolectomy",
    "Percutaneous transluminal angioplasty (PTA)",
    "Intraarterial thrombolysis",
    "Stenting (primary or adjunctive)",
  ], { x: 0.35, y: 2.58, w: 4.5, h: 1.6, fontSize: 13 });

  s.addText("Outcomes vs. Open", { x: 5.0, y: 2.2, w: 4.6, h: 0.38, fontSize: 14, bold: true, color: C.green });
  bulletList(s, [
    "Reduced hospital stay",
    "Reduced need for postoperative parenteral nutrition",
    "No high-quality RCT evidence favoring one approach",
    "Choice depends on surgeon expertise and facility capability",
    "Always ensure laparotomy available if bowel viability uncertain",
  ], { x: 5.0, y: 2.58, w: 4.6, h: 1.6, fontSize: 12.5 });

  s.addText("NOMI Treatment", { x: 0.35, y: 4.2, w: 4.5, h: 0.38, fontSize: 13, bold: true, color: C.accentAlt });
  bulletList(s, [
    "Primarily nonsurgical",
    "Intra-arterial papaverine infusion",
    "Correct underlying shock / vasopressors",
    "Laparotomy if peritonitis develops",
  ], { x: 0.35, y: 4.58, w: 4.5, h: 0.9, fontSize: 12 });

  s.addText("MVT Treatment", { x: 5.0, y: 4.2, w: 4.6, h: 0.38, fontSize: 13, bold: true, color: C.midBg });
  bulletList(s, [
    "Anticoagulation (heparin → warfarin/DOAC) is primary therapy",
    "Catheter-directed thrombolysis in select cases",
    "Laparotomy + bowel resection if peritonitis",
    "Screen for hypercoagulable state",
  ], { x: 5.0, y: 4.58, w: 4.6, h: 0.9, fontSize: 12 });
  addFooter(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ─── SLIDE 13 – SECOND LOOK ───────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "SECOND-LOOK LAPAROTOMY");
  addSlideTitle(s, "Second-Look Laparotomy", "The cornerstone of bowel preservation after revascularization");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.55, w: 9.3, h: 3.8,
    fill: { color: C.lightGray }, line: { color: C.midBg, pt: 1.5 } });

  bulletList(s, [
    "Performed 24–48 hours after initial revascularization",
    "Allows segments with 'questionable viability' to recover — preserves maximum bowel length",
    "Only frankly necrotic or perforated bowel resected at first operation",
    "Bowel left in discontinuity at first operation to avoid anastomosis in ischemic tissue",
    "Temporary abdominal closure (VAC/Bogota bag) placed at end of initial operation",
    "In patients treated endovascularly: laparoscopic bowel assessment by skilled surgeon is an option",
    "Aggressive early resection of marginally viable bowel leads to short bowel syndrome — AVOID",
  ], { x: 0.5, y: 1.65, w: 9.0, h: 3.6, fontSize: 13 });

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 5.15, w: 9.3, h: 0.38,
    fill: { color: C.accent } });
  s.addText("Principle: REVASCULARIZE FIRST → Reassess viability → Resect only dead bowel → Second look → Definitive closure", {
    x: 0.5, y: 5.17, w: 9.0, h: 0.34,
    fontSize: 11, color: C.white, bold: true, align: "center",
  });
  addFooter(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 14 – CHRONIC MESENTERIC ISCHEMIA ──────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "CHRONIC MESENTERIC ISCHEMIA");
  addSlideTitle(s, "Chronic Mesenteric Ischemia (CMI)", "Usually atherosclerotic; requires ≥ 2 vessel stenosis");

  s.addText("Etiology", { x: 0.35, y: 1.55, w: 4.5, h: 0.38, fontSize: 13, bold: true, color: C.midBg });
  bulletList(s, [
    "Atherosclerosis (most common) — aortic disease 'spillover' into visceral origins",
    "Median arcuate ligament compression (celiac axis)",
    "Fibromuscular dysplasia, segmental arterial mediolysis",
    "Arteritis: Takayasu, giant cell, polyarteritis nodosa, Behçet's",
    "Requires ≥ 2 vessel involvement; IMA involvement alone rarely symptomatic",
  ], { x: 0.35, y: 1.93, w: 4.5, h: 1.9, fontSize: 12 });

  s.addText("Goals of Treatment", { x: 5.1, y: 1.55, w: 4.6, h: 0.38, fontSize: 13, bold: true, color: C.green });
  bulletList(s, [
    "1. Restore normal nutrition — durable symptom relief",
    "2. Prevent intestinal infarction",
    "Requires accurate diagnosis, disease extent assessment, optimal reconstruction selection",
  ], { x: 5.1, y: 1.93, w: 4.6, h: 1.3, fontSize: 12.5 });

  s.addText("Endovascular Revascularization", { x: 0.35, y: 3.9, w: 4.5, h: 0.38, fontSize: 13, bold: true, color: C.midBg });
  bulletList(s, [
    "PTA + stenting: preferred for focal ostial lesions",
    "Less morbidity, shorter recovery vs. open",
    "Higher re-stenosis rate — close surveillance required",
    "Suitable for high-risk surgical patients",
  ], { x: 0.35, y: 4.28, w: 4.5, h: 1.2, fontSize: 12 });

  s.addText("Open Surgical Revascularization", { x: 5.1, y: 3.9, w: 4.6, h: 0.38, fontSize: 13, bold: true, color: C.accent });
  bulletList(s, [
    "Antegrade aortovisceral bypass: durable, preferred for diffuse disease",
    "Retrograde bypass from iliac artery: for poor supraceliac aorta",
    "Better long-term patency than endovascular",
    "Higher perioperative morbidity — reserve for fit patients",
  ], { x: 5.1, y: 4.28, w: 4.6, h: 1.2, fontSize: 12 });
  addFooter(s, "Current Surgical Therapy 14e — Linda M. Reilly MD; Sabiston Textbook of Surgery");
}

// ─── SLIDE 15 – MVT ───────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "MESENTERIC VENOUS THROMBOSIS");
  addSlideTitle(s, "Mesenteric Venous Thrombosis (MVT)");

  s.addText("Epidemiology & Classification", { x: 0.35, y: 1.55, w: 4.5, h: 0.38, fontSize: 13, bold: true, color: C.midBg });
  bulletList(s, [
    "5–15% of acute mesenteric ischemia cases",
    "Superior mesenteric vein involved in 95% of cases",
    "Primary MVT: no identifiable etiology",
    "Secondary MVT: identifiable cause (see below)",
  ], { x: 0.35, y: 1.93, w: 4.5, h: 1.3, fontSize: 12 });

  s.addText("Secondary MVT Causes", { x: 5.1, y: 1.55, w: 4.6, h: 0.38, fontSize: 13, bold: true, color: C.accent });
  bulletList(s, [
    "Heritable coagulopathies (Factor V Leiden, antithrombin III deficiency, protein C/S deficiency)",
    "Acquired coagulation disorders",
    "Portal hypertension / liver cirrhosis",
    "Intra-abdominal infection, appendicitis, pancreatitis",
    "Abdominal trauma or surgery",
    "Oral contraceptive pills",
  ], { x: 5.1, y: 1.93, w: 4.6, h: 2.3, fontSize: 12 });

  s.addText("Management", { x: 0.35, y: 3.25, w: 4.5, h: 0.38, fontSize: 13, bold: true, color: C.green });
  bulletList(s, [
    "Anticoagulation: immediate heparin, then warfarin or DOAC (6 months minimum)",
    "Catheter-directed thrombolysis in selected patients",
    "Treat underlying cause",
    "Laparotomy + bowel resection if peritonitis or infarction",
    "Chronic MVT: often asymptomatic — manage complications (variceal bleeding)",
  ], { x: 0.35, y: 3.63, w: 9.3, h: 1.7, fontSize: 12 });
  addFooter(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ─── SLIDE 16 – OUTCOMES ─────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  addSectionBadge(s, "OUTCOMES");
  addSlideTitle(s, "Outcomes & Prognosis");

  const stats = [
    { val: ">50%", label: "Mortality\n(early diagnosis)", color: C.accent },
    { val: ">70%", label: "Mortality\n(ICU admission)", color: "8B0000" },
    { val: "17–21%", label: "Overall mortality\n(requiring intervention)", color: C.accentAlt },
    { val: "33%", label: "Open repair\nmortality (2010)", color: C.midBg },
    { val: "15%", label: "Endovascular\nmortality (2010)", color: C.green },
  ];

  stats.forEach((st, i) => {
    const x = 0.35 + i * 1.88;
    s.addShape(pres.ShapeType.rect, { x, y: 1.55, w: 1.78, h: 1.5,
      fill: { color: st.color }, line: { color: st.color } });
    s.addText(st.val, {
      x: x + 0.05, y: 1.6, w: 1.68, h: 0.7,
      fontSize: 26, bold: true, color: C.white, align: "center", valign: "middle",
    });
    s.addText(st.label, {
      x: x + 0.05, y: 2.3, w: 1.68, h: 0.7,
      fontSize: 10, color: C.white, align: "center", valign: "top",
    });
  });

  s.addText("Key Prognostic Factors", { x: 0.35, y: 3.25, w: 9.3, h: 0.38, fontSize: 14, bold: true, color: C.midBg });
  bulletList(s, [
    "Time to diagnosis is the single most important determinant of survival",
    "Presence of peritonitis at presentation dramatically worsens prognosis",
    "Bowel viability at revascularization determines extent of resection",
    "Short bowel syndrome: risk increases with each centimetre of bowel resected",
    "Post-AMI: survivors require long-term anticoagulation, nutrition support, surveillance imaging",
    "CMI after revascularization: endovascular has higher re-intervention rates; open has better long-term patency",
  ], { x: 0.35, y: 3.63, w: 9.3, h: 1.7, fontSize: 12.5 });
  addFooter(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e; Schwartz 11e");
}

// ─── SLIDE 17 – KEY MESSAGES / SUMMARY ───────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.darkBg };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });

  s.addText("KEY MESSAGES", {
    x: 0.4, y: 0.2, w: 9.3, h: 0.5,
    fontSize: 11, bold: true, color: C.accent, charSpacing: 3,
  });
  s.addText("Mesenteric Ischemia — Take-Aways", {
    x: 0.4, y: 0.7, w: 9.3, h: 0.6,
    fontSize: 24, bold: true, color: C.white,
  });

  const msgs = [
    { num: "01", text: "Pain out of proportion to examination is the hallmark of AMI — maintain a HIGH index of suspicion.", color: C.accent },
    { num: "02", text: "No lab test can exclude AMI. CT angiography is the gold standard (specificity > 97% for key findings).", color: C.accentAlt },
    { num: "03", text: "Peritonitis = emergent laparotomy. Do NOT delay for imaging.", color: C.accent },
    { num: "04", text: "REVASCULARIZE FIRST — only resect frankly necrotic bowel. Second-look in 24–48 hrs preserves bowel.", color: C.green },
    { num: "05", text: "Embolism: open embolectomy. Thrombosis: bypass. NOMI: papaverine + treat cause. MVT: anticoagulate.", color: C.accentAlt },
    { num: "06", text: "CMI requires ≥2 vessel disease; early elective revascularization prevents acute catastrophe.", color: C.green },
  ];

  msgs.forEach((m, i) => {
    const y = 1.42 + i * 0.66;
    s.addShape(pres.ShapeType.rect, { x: 0.4, y, w: 0.55, h: 0.52, fill: { color: m.color }, line: { color: m.color } });
    s.addText(m.num, { x: 0.4, y, w: 0.55, h: 0.52, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(m.text, { x: 1.05, y: y + 0.04, w: 8.5, h: 0.44, fontSize: 12, color: C.white, valign: "middle" });
  });
}

// ─── WRITE FILE ───────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surgery.pptx" })
  .then(() => console.log("✅ Done: /home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surgery.pptx"))
  .catch(e => { console.error("❌", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/mesenteric-ischemia-ppt && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surge…

Your presentation is ready:

Mesenteric Ischemia Surgery

Presentation · PPTX


Here is what the deck contains — 17 slides built directly from Schwartz's Principles of Surgery (11e), Sabiston Textbook of Surgery, and Current Surgical Therapy (14e):
#Slide
1Title slide — deep navy with red accent
2Outline — 11 topics covered
3Epidemiology — incidence, mortality stats (side-by-side comparison panel)
4Classification — Acute vs. Chronic (color-coded dual columns)
5Anatomy — SMA branches, collateral circulation, clinical relevance
6Pathophysiology — timeline visual (0–3 hrs, 3–6 hrs, >6 hrs, late); embolism vs. thrombosis vs. NOMI vs. MVT mechanisms
7Clinical Presentation — Acute vs. Chronic panels, hallmark signs
8Risk Factors — 3 category boxes (embolic, thrombotic, NOMI)
9Diagnosis — Labs (lactate caveat), CT findings >97% specificity
10Management AMI — The Four R's (Resuscitation, Revascularization, Resection, Reassessment)
11Open Surgical Techniques — SMA exposure, embolectomy, antegrade/retrograde bypass
12Endovascular Management — patient selection, options, NOMI vs. MVT treatment
13Second-Look Laparotomy — rationale, timing, bowel preservation principle
14Chronic Mesenteric Ischemia — etiology, endovascular vs. open revascularization
15Mesenteric Venous Thrombosis — classification, causes, anticoagulation
16Outcomes — stat boxes (mortality figures), prognostic factors
17Key Messages — 6 numbered take-aways on dark background
The color scheme uses deep navy (background) + urgent red (acute findings/warnings) + teal-green (revascularization/positive outcomes) + amber (caution), specifically chosen for a surgical/emergency medicine feel.

This is a very good ppt but need more lengthy as i have to present it for 45 mins

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Writing File

~/mesenteric-ischemia-ppt/build_v2.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Mesenteric Ischemia — General Surgery Clinic";
pres.author = "General Surgery Clinic";

// ─── THEME ───────────────────────────────────────────────────────────────────
const C = {
  darkBg:   "0D1B2A",
  midBg:    "1B3A5C",
  accent:   "E63946",
  amber:    "F4A261",
  white:    "FFFFFF",
  lgray:    "E8EDF2",
  mgray:    "D0D8E4",
  textDark: "0D1B2A",
  slate:    "457B9D",
  green:    "2A9D8F",
  purple:   "6C3483",
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────
function topBar(slide, accentColor) {
  accentColor = accentColor || C.accent;
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.07, fill: { color: accentColor } });
}

function sectionTag(slide, text, color) {
  color = color || C.accent;
  slide.addText(text.toUpperCase(), {
    x: 0.35, y: 0.13, w: 5, h: 0.3,
    fontSize: 8.5, bold: true, color: color, charSpacing: 2.5, fontFace: "Calibri",
  });
}

function slideTitle(slide, title, sub) {
  slide.addText(title, {
    x: 0.35, y: 0.47, w: 9.3, h: 0.68,
    fontSize: 27, bold: true, color: C.textDark, fontFace: "Calibri",
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.35, y: 1.15, w: 9.3, h: 0.33,
      fontSize: 12.5, color: C.slate, italic: true, fontFace: "Calibri",
    });
  }
}

function bullets(slide, items, opts) {
  opts = opts || {};
  const x       = opts.x       !== undefined ? opts.x       : 0.4;
  const y       = opts.y       !== undefined ? opts.y       : 1.6;
  const w       = opts.w       !== undefined ? opts.w       : 9.2;
  const h       = opts.h       !== undefined ? opts.h       : 3.6;
  const fs      = opts.fontSize !== undefined ? opts.fontSize : 13;
  const color   = opts.color   || C.textDark;
  const indent  = opts.indent  || 0;
  const bold    = opts.bold    || false;
  const arr = items.map((t, i) => ({
    text: t,
    options: {
      bullet: { indent: 12 + indent * 14 },
      breakLine: i < items.length - 1,
      fontSize: fs, color, bold, fontFace: "Calibri",
    },
  }));
  slide.addText(arr, { x, y, w, h, valign: "top" });
}

function footer(slide, src) {
  slide.addText("Source: " + src, {
    x: 0.3, y: 5.3, w: 9.4, h: 0.22,
    fontSize: 7.5, color: "999999", italic: true, align: "right", fontFace: "Calibri",
  });
}

function sectionDivider(slide, label, sub) {
  slide.background = { color: C.midBg };
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.15, h: 5.625, fill: { color: C.accent } });
  slide.addShape(pres.ShapeType.rect, { x: 0.15, y: 2.35, w: 9.85, h: 0.04, fill: { color: C.amber } });
  slide.addText(label, {
    x: 0.45, y: 1.5, w: 9.2, h: 0.8,
    fontSize: 36, bold: true, color: C.white, fontFace: "Calibri",
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.45, y: 2.5, w: 9.2, h: 0.5,
      fontSize: 15, color: C.amber, fontFace: "Calibri", italic: true,
    });
  }
}

function colorBox(slide, x, y, w, h, headerText, items, headerColor, fs) {
  headerColor = headerColor || C.midBg;
  fs = fs || 12;
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color: C.lgray }, line: { color: headerColor, pt: 2 } });
  slide.addShape(pres.ShapeType.rect, { x, y, w, h: 0.45, fill: { color: headerColor } });
  slide.addText(headerText, {
    x: x + 0.1, y: y + 0.03, w: w - 0.2, h: 0.39,
    fontSize: 12.5, bold: true, color: C.white, valign: "middle", fontFace: "Calibri",
  });
  bullets(slide, items, { x: x + 0.12, y: y + 0.5, w: w - 0.22, h: h - 0.58, fontSize: fs });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.darkBg };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  s.addText("MESENTERIC\nISCHEMIA", {
    x: 0.5, y: 0.7, w: 9.2, h: 2.4,
    fontSize: 54, bold: true, color: C.white, fontFace: "Calibri", lineSpacingMultiple: 1.1,
  });
  s.addText("A Comprehensive Surgical Review", {
    x: 0.5, y: 3.15, w: 9.2, h: 0.5,
    fontSize: 20, color: C.amber, italic: true, fontFace: "Calibri",
  });
  s.addShape(pres.ShapeType.rect, { x: 0.5, y: 3.75, w: 4, h: 0.04, fill: { color: C.accent } });
  s.addText("General Surgery Clinic  ·  2026", {
    x: 0.5, y: 3.86, w: 9.2, h: 0.35,
    fontSize: 12, color: "AAAAAA", fontFace: "Calibri",
  });
  s.addText("Based on: Schwartz's Principles of Surgery 11e  ·  Sabiston Textbook of Surgery  ·  Current Surgical Therapy 14e", {
    x: 0.5, y: 5.15, w: 9.2, h: 0.3,
    fontSize: 8.5, color: "777777", italic: true, fontFace: "Calibri",
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.midBg);
  sectionTag(s, "Lecture Outline", C.midBg);
  slideTitle(s, "Topics for Today — 45-Minute Lecture");

  const col1 = [
    "1.  Introduction & Historical Perspective",
    "2.  Epidemiology & Risk Factors",
    "3.  Mesenteric Vascular Anatomy",
    "4.  Classification of Mesenteric Ischemia",
    "5.  Pathophysiology — Embolic AMI",
    "6.  Pathophysiology — Thrombotic AMI",
    "7.  Pathophysiology — NOMI & MVT",
    "8.  Clinical Presentation — Acute",
    "9.  Clinical Presentation — Chronic & MVT",
    "10. Differential Diagnosis",
  ];
  const col2 = [
    "11. Laboratory Investigations",
    "12. Imaging — CT Angiography (Gold Standard)",
    "13. Other Imaging Modalities",
    "14. Initial Resuscitation & Medical Management",
    "15. Surgical Algorithm — Open vs. Endovascular",
    "16. Open Embolectomy",
    "17. Open Bypass — Antegrade & Retrograde",
    "18. Transaortic Endarterectomy",
    "19. Endovascular Management",
    "20. NOMI & MVT Management",
  ];
  const col3 = [
    "21. Second-Look Laparotomy",
    "22. Bowel Viability Assessment",
    "23. Chronic Mesenteric Ischemia — Overview",
    "24. CMI — Endovascular Revascularization",
    "25. CMI — Open Surgical Revascularization",
    "26. CMI — Outcomes & Surveillance",
    "27. Complications & Postoperative Care",
    "28. Short Bowel Syndrome",
    "29. Special Scenarios",
    "30. Key Messages & Summary",
  ];
  [col1, col2, col3].forEach((col, ci) => {
    const x = 0.3 + ci * 3.25;
    col.forEach((item, ri) => {
      s.addText(item, {
        x, y: 1.55 + ri * 0.4, w: 3.2, h: 0.38,
        fontSize: 10.5, color: C.textDark, fontFace: "Calibri",
      });
    });
  });
  footer(s, "Schwartz 11e · Sabiston · Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — SECTION DIVIDER: INTRODUCTION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 1\nIntroduction & Epidemiology", "Understanding the burden of mesenteric ischemia");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — HISTORICAL PERSPECTIVE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Historical Perspective");
  slideTitle(s, "Mesenteric Ischemia — Historical Milestones");

  const events = [
    { year: "1869", event: "First description of mesenteric ischemia by Chienne" },
    { year: "1895", event: "First intestinal resection & reanastomosis — Elliot" },
    { year: "1951", event: "First SMA embolectomy performed — Klass" },
    { year: "1957", event: "First successful embolectomy without bowel resection — Shaw & Maynard" },
    { year: "1980", event: "Endovascular treatment of mesenteric disease introduced — major advance" },
    { year: "2000s", event: "Steady increase in endovascular-first approach; now 70–80% of CMI treated endovascularly" },
    { year: "2010–", event: "Open repair mortality 43%→33%; endovascular mortality 20%→15%" },
  ];
  events.forEach((e, i) => {
    const y = 1.52 + i * 0.55;
    s.addShape(pres.ShapeType.rect, { x: 0.35, y, w: 1.0, h: 0.42, fill: { color: C.midBg } });
    s.addText(e.year, {
      x: 0.35, y, w: 1.0, h: 0.42,
      fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle",
    });
    s.addShape(pres.ShapeType.rect, { x: 1.38, y: y + 0.19, w: 0.25, h: 0.04, fill: { color: C.accent } });
    s.addText(e.event, {
      x: 1.68, y, w: 8.0, h: 0.42,
      fontSize: 12.5, color: C.textDark, valign: "middle", fontFace: "Calibri",
    });
  });
  footer(s, "Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — EPIDEMIOLOGY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Epidemiology");
  slideTitle(s, "Epidemiology", "Rare but catastrophic — recognition is everything");

  colorBox(s, 0.35, 1.52, 4.55, 2.3, "Incidence", [
    "< 1 per 100,000 hospital admissions (USA)",
    "0.1–1 per 1,000 hospitalizations overall",
    "< 2% of all admissions for GI disorders",
    "Median age at presentation: 74 years",
    "Incidence DOUBLES per 5-year interval above age 70",
    "3× higher incidence in females vs. males",
  ], C.midBg, 12);

  colorBox(s, 5.15, 1.52, 4.5, 2.3, "Mortality — Still Very High", [
    "Overall mortality: 17–21% (requiring intervention)",
    "Early diagnosis: > 50% mortality",
    "ICU-admitted patients: > 70% mortality",
    "Thrombotic AMI mortality without intervention: 77%",
    "Embolic AMI mortality without intervention: 54%",
    "NOMI: highest mortality — compounded by critical illness",
  ], C.accent, 12);

  colorBox(s, 0.35, 4.0, 4.55, 1.48, "Trends Over Time (1999–2010)", [
    "Open repair mortality: 43% → 33%",
    "Endovascular mortality: 20% → 15%",
    "Endovascular now predominant treatment (70–80% of CMI)",
  ], C.green, 12);

  colorBox(s, 5.15, 4.0, 4.5, 1.48, "Diagnosis Delay Impact", [
    "Survival drops from 50% → 30% when SMA embolism diagnosed > 24 hrs from onset",
    "Average CMI onset-to-diagnosis delay: > 12 months",
  ], C.amber, 12);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e; Schwartz 11e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — RISK FACTORS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Risk Factors");
  slideTitle(s, "Risk Factors & Patient Profiles");

  const cats = [
    { label: "Embolic AMI", color: C.accent, items: [
      "Atrial fibrillation / flutter",
      "Recent MI with mural thrombus",
      "LV thrombus / low EF / CHF",
      "Valvular disease, endocarditis",
      "Mechanical heart valves",
      "Aortic aneurysm with mural thrombus",
      "Prior thromboembolic events",
      "68% have simultaneous emboli in other vascular beds",
    ]},
    { label: "Thrombotic AMI", color: C.midBg, items: [
      "Atherosclerosis / PVD",
      "Prior chronic mesenteric ischemia",
      "PVD incidence of AMI up to 27%",
      "Hypercoagulable states",
      "Factor V Leiden, APS, antithrombin III deficiency",
      "Protein C/S deficiency",
      "Aortic dissection extending into SMA",
      "In-stent or graft thrombosis",
    ]},
    { label: "NOMI Risk", color: C.amber, items: [
      "Critical illness / systemic sepsis",
      "Post-cardiac surgery (highest risk)",
      "Hemodialysis patients",
      "High-dose vasopressors (epi, norepi, vasopressin)",
      "Severe cardiac failure",
      "Hypovolemic shock",
    ]},
  ];
  cats.forEach((c, i) => {
    const x = 0.3 + i * 3.22;
    colorBox(s, x, 1.5, 3.1, 3.95, c.label, c.items, c.color, 11.5);
  });
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — SECTION DIVIDER: ANATOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 2\nVascular Anatomy", "Understanding collaterals determines treatment strategy");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — SMA ANATOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "Vascular Anatomy", C.green);
  slideTitle(s, "Mesenteric Arterial Anatomy — The SMA");

  s.addText("Superior Mesenteric Artery (SMA)", {
    x: 0.35, y: 1.5, w: 9.3, h: 0.38,
    fontSize: 14.5, bold: true, color: C.midBg,
  });
  bullets(s, [
    "2nd branch of the abdominal aorta — its oblique angle off the aorta means thromboemboli PREFERENTIALLY lodge here",
    "SMA branches (in order): inferior pancreaticoduodenal a., middle colic a., right colic a., ileocolic a., jejunal/ileal branches",
    "SMA tapers just beyond first few jejunal branches → emboli lodge proximally",
    "50% of emboli settle just DISTAL to the middle colic artery origin",
    "15% of emboli lodge AT the SMA origin",
    "Emboli proximal to middle colic a. → classic pattern: spares ascending colon, hepatic flexure, and proximal transverse colon",
    "Thrombotic occlusions occur at the SMA ORIGIN (within 2 cm) — superimposed on atherosclerotic plaques",
  ], { y: 1.88, fontSize: 12.5 });

  s.addText("Celiac Axis & IMA", {
    x: 0.35, y: 4.32, w: 9.3, h: 0.35,
    fontSize: 13, bold: true, color: C.accent,
  });
  bullets(s, [
    "Celiac artery embolism: rare — usually symptomatic only in patients with pre-existing SMA disease",
    "IMA: occlusion alone rarely causes symptoms — rich collateral supply",
  ], { y: 4.67, h: 0.8, fontSize: 12.5 });
  footer(s, "Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — COLLATERAL ANATOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "Vascular Anatomy", C.green);
  slideTitle(s, "Collateral Circulation — Clinical Significance");

  colorBox(s, 0.35, 1.5, 4.55, 2.4, "Major Collateral Pathways", [
    "Celiac ↔ SMA: pancreaticoduodenal arcade (inferior/superior)",
    "SMA ↔ IMA: marginal artery of Drummond",
    "SMA ↔ IMA: arc of Riolan (meandering mesenteric a.)",
    "IMA ↔ internal iliac: hemorrhoidal arteries",
    "Venous: portal, splenic, SMV, IMV with multiple anastomoses",
  ], C.green, 12.5);

  colorBox(s, 5.15, 1.5, 4.5, 2.4, "Why Collaterals Matter", [
    "~20% of adults > 65 years have asymptomatic visceral artery stenosis/occlusion",
    "CMI usually requires ≥ 2 vessel involvement to become symptomatic",
    "Embolic AMI → acute onset, no collaterals → worse prognosis",
    "Thrombotic AMI → more insidious, collaterals provide partial protection",
    "IMA-only disease: virtually never symptomatic in isolation",
  ], C.midBg, 12.5);

  colorBox(s, 0.35, 4.08, 9.3, 1.38, "Venous Drainage", [
    "SMV drains ileocolic, middle colic, right colic veins → joins splenic vein to form portal vein",
    "IMV drains left colon → connects directly with splenic vein",
    "MVT most commonly affects SMV (95%); IMV involvement is rare (< 5–10%)",
  ], C.purple, 12.5);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — SECTION DIVIDER: CLASSIFICATION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 3\nClassification & Pathophysiology", "Four pathways to the same catastrophe");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — CLASSIFICATION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Classification");
  slideTitle(s, "Classification of Mesenteric Ischemia");

  const types = [
    { label: "Arterial Embolism", pct: "40–50%", color: C.accent },
    { label: "Arterial Thrombosis", pct: "20–35%", color: C.midBg },
    { label: "NOMI", pct: "~20%", color: C.amber },
    { label: "Venous Thrombosis", pct: "5–15%", color: C.green },
  ];
  types.forEach((t, i) => {
    const x = 0.3 + i * 2.4;
    s.addShape(pres.ShapeType.rect, { x, y: 1.5, w: 2.25, h: 0.7, fill: { color: t.color } });
    s.addText(t.label, {
      x, y: 1.5, w: 2.25, h: 0.45,
      fontSize: 12, bold: true, color: C.white, align: "center", valign: "bottom",
    });
    s.addText(t.pct + " of AMI", {
      x, y: 1.92, w: 2.25, h: 0.28,
      fontSize: 10, color: C.white, align: "center",
    });
  });

  bullets(s, [
    "ACUTE MESENTERIC ISCHEMIA (AMI): sudden reduction in intestinal blood flow → ischemia → infarction",
    "  · Embolism: abrupt onset, cardiac source, often multiple simultaneous embolic events",
    "  · Thrombosis: usually acute-on-chronic, occurs at vessel origin, larger bowel territory at risk",
    "  · NOMI: vasospasm in critically ill — no mechanical occlusion — systemic low-flow state",
    "  · MVT: impaired venous return, bowel congestion, edema → infarction; ileum/jejunum > colon",
    "",
    "CHRONIC MESENTERIC ISCHEMIA (CMI): insidious postprandial ischemia — collaterals prevent infarction",
    "  · At least 2 of 3 main vessels (celiac, SMA, IMA) must be severely stenosed/occluded",
    "  · Often a precursor to acute catastrophe",
  ], { y: 2.3, fontSize: 12.5 });
  footer(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — PATHOPHYSIOLOGY: ISCHEMIA TIMELINE
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Pathophysiology");
  slideTitle(s, "Pathophysiology — Ischemia Timeline", "Time is bowel — minutes matter");

  const bar = [
    { label: "0 — 3 hrs", detail: "Mucosal sloughing\nBacterial translocation begins", color: C.amber },
    { label: "3 — 6 hrs", detail: "Full-thickness\nischemia develops", color: "E07B3A" },
    { label: "> 6 hrs", detail: "FULL-THICKNESS\nINFARCTION", color: C.accent },
    { label: "Late", detail: "Peritonitis\nSeptic shock\nDeath", color: "7B0000" },
  ];
  bar.forEach((b, i) => {
    const x = 0.35 + i * 2.35;
    s.addShape(pres.ShapeType.rect, { x, y: 1.52, w: 2.2, h: 1.5, fill: { color: b.color } });
    s.addText(b.label + "\n" + b.detail, {
      x: x + 0.05, y: 1.57, w: 2.1, h: 1.4,
      fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle",
    });
  });

  s.addText("Pathophysiological Cascade", {
    x: 0.35, y: 3.18, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.midBg,
  });
  bullets(s, [
    "Reduced intestinal blood flow → mucosal hypoxia → villous tip necrosis first (watershed zone)",
    "Bacterial translocation across damaged mucosa → systemic endotoxemia → SIRS → sepsis",
    "Reperfusion injury: reactive oxygen species (ROS) cause additional damage after revascularization",
    "NOMI specifically: mesenteric vasoconstriction + intestinal hypoxemia + reperfusion injury + increased metabolic demand + infection",
    "MVT: venous congestion → bowel wall edema → transmural infarction (ileum/jejunum preferentially)",
  ], { y: 3.57, h: 1.88, fontSize: 12.5 });
  footer(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — PATHOPHYSIOLOGY EMBOLIC vs THROMBOTIC
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Pathophysiology");
  slideTitle(s, "Embolic vs. Thrombotic AMI — Key Differences");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "Arterial Embolism", [
    "Source: cardiac (AF, ventricular thrombus, valvular disease)",
    "Lodges at SMA: 50% distal to middle colic a., 15% at origin",
    "ABRUPT onset — no collateral protection",
    "Spares proximal jejunum and right colon (proximal to obstruction)",
    "95% have documented cardiac disease",
    "68% have simultaneous emboli in other vascular beds",
    "Mortality without treatment: 54%",
    "Treatment: open embolectomy (gold standard)",
  ], C.accent, 12);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Arterial Thrombosis", [
    "Superimposed on chronic atherosclerotic plaques at vessel ORIGINS",
    "Thrombosis within 2 cm of SMA origin → larger territory at risk",
    "More INSIDIOUS onset — existing collaterals partially protective",
    "May have subacute phase (days-weeks) before acute decompensation",
    "PVD patients: incidence of AMI up to 27%",
    "Acute-on-chronic presentation common",
    "Mortality without treatment: 77% (proximal location = larger bowel territory)",
    "Treatment: open bypass or endovascular recanalization",
  ], C.midBg, 12);
  footer(s, "Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — PATHOPHYSIOLOGY NOMI & MVT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Pathophysiology");
  slideTitle(s, "NOMI & Mesenteric Venous Thrombosis");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "NOMI — Nonocclusive Mesenteric Ischemia", [
    "Accounts for ~20% of AMI cases",
    "Mechanism: mesenteric vasoconstriction → intestinal hypoxemia → reperfusion injury → increased metabolic demand + infection",
    "Key: low-flow state ± pre-existing stenosis — PRIORITIZES cardiac/cerebral perfusion at expense of gut",
    "Vasopressors (epi, norepi, vasopressin) → splanchnic vasoconstriction → NOMI",
    "Highest mortality of all AMI subtypes",
    "Diagnosis: CTA less reliable — mainly a clinical + angiographic diagnosis",
    "Treatment: intraarterial papaverine/vasodilators + treat underlying cause",
    "Surgery only if peritonitis develops",
  ], C.amber, 12);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Mesenteric Venous Thrombosis (MVT)", [
    "9–15% of mesenteric ischemic events",
    "SMV involved in 95% of cases; IMV rare (< 5–10%)",
    "Primary MVT (idiopathic): rare",
    "Secondary MVT (> 90%): hypercoagulable states identified in 60–70%",
    "Secondary causes: trauma, pancreatitis, IBD, portal HTN, CHF, OCP, JAK2 mutation, polycythemia vera, APS, HIT",
    "Bowel congestion → edema → transmural infarction: affects ileum/jejunum > colon",
    "Presentation: acute (70%), subacute, or chronic",
    "Treatment: anticoagulation; surgery for peritonitis/infarction",
  ], C.purple, 12);
  footer(s, "Sabiston Textbook of Surgery; Schwartz 11e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — SECTION DIVIDER: CLINICAL PRESENTATION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 4\nClinical Presentation", "The diagnosis is clinical first, imaging second");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — CLINICAL PRESENTATION AMI
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Clinical Presentation — Acute Mesenteric Ischemia");
  slideTitle(s, "Acute Mesenteric Ischemia — Clinical Features");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.6, fill: { color: C.accent } });
  s.addText("HALLMARK: Pain OUT OF PROPORTION to physical examination findings", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.55,
    fontSize: 15, bold: true, color: C.white, align: "center", valign: "middle",
  });

  colorBox(s, 0.35, 2.22, 4.6, 1.65, "Early Presentation", [
    "Sudden-onset severe periumbilical / mid-abdominal pain",
    "Often colicky in character",
    "Nausea, vomiting, diarrhea",
    "Physical examination: SURPRISINGLY NORMAL (no peritonism)",
    "Patient appears distressed beyond examination findings",
  ], C.midBg, 12);

  colorBox(s, 5.15, 2.22, 4.5, 1.65, "Late Presentation (Infarction)", [
    "Abdominal distension",
    "Peritonism: guarding, rebound tenderness",
    "Bloody stools / PR bleeding",
    "Septic shock: tachycardia, hypotension, fever, altered mental status",
    "Rapid clinical deterioration",
  ], C.accent, 12);

  s.addText("Variation by Etiology", {
    x: 0.35, y: 4.0, w: 9.3, h: 0.38,
    fontSize: 13.5, bold: true, color: C.midBg,
  });
  bullets(s, [
    "Embolic: most ACUTE — abrupt onset, rapid deterioration, often known AF",
    "Thrombotic: more insidious — may have days to weeks of prodrome (subacute ischemia), prior angina equivalent",
    "NOMI: may be painless in ICU patients — sepsis + abdominal distension + multiorgan failure",
    "MVT: gradual onset (hours-days), nausea, vomiting, GI bleeding in 15–50%",
  ], { y: 4.38, h: 1.12, fontSize: 12.5 });
  footer(s, "Sabiston Textbook of Surgery; Schwartz 11e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 — CLINICAL PRESENTATION CHRONIC & MVT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "Clinical Presentation — Chronic & MVT", C.green);
  slideTitle(s, "Chronic Mesenteric Ischemia & MVT — Presentation");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "Chronic Mesenteric Ischemia", [
    "Postprandial abdominal pain (intestinal angina) — 15–30 min after eating",
    "Characteristic 'FOOD FEAR' — patient avoids eating to prevent pain",
    "Progressive, significant weight loss",
    "Often misdiagnosed as malignancy (clinicians led away by weight loss)",
    "3:1 female-to-male ratio — gender bias delays diagnosis",
    "Onset age 50–60 years",
    "Only 1/3 have signs of arterial disease in other beds",
    "Average onset-to-diagnosis delay: > 12 months",
    "Physical: epigastric bruit in some patients",
    "Precursor to acute catastrophe if untreated",
  ], C.green, 12);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Mesenteric Venous Thrombosis — Presentations", [
    "ACUTE MVT (70% of cases):",
    "  · Vague abdominal pain out of proportion to exam",
    "  · Nausea, vomiting",
    "  · GI bleeding in 15–50% of patients",
    "  · Hemodynamic instability if infarction",
    "SUBACUTE MVT:",
    "  · Non-specific symptoms for weeks to months",
    "  · Minimal examination findings",
    "CHRONIC MVT:",
    "  · Often asymptomatic — extensive collateral circulation",
    "  · Portal hypertension: varices, splenomegaly, hypersplenism",
    "  · Ascites, esophagogastric variceal bleeding",
  ], C.purple, 11.5);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 18 — DIFFERENTIAL DIAGNOSIS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Differential Diagnosis");
  slideTitle(s, "Differential Diagnosis of Acute Severe Abdominal Pain");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.midBg } });
  s.addText("⚠  AMI must be actively excluded in any elderly patient with sudden severe abdominal pain + atrial fibrillation or vascular disease", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 11.5, color: C.white, bold: true, valign: "middle", align: "center",
  });

  const diffs = [
    { label: "Surgical Emergencies", items: ["Perforated peptic ulcer", "Ruptured AAA", "Bowel obstruction / volvulus", "Acute appendicitis", "Acute cholecystitis"] },
    { label: "GI / Medical", items: ["Acute pancreatitis", "Diverticulitis", "Inflammatory bowel disease", "Ischemic colitis", "Intestinal obstruction"] },
    { label: "Distinguish from AMI by:", items: ["CTA: look for vascular occlusion", "Plain radiograph: 'thumbprinting' late sign", "Clinical context: AF/MI → AMI", "Peritonitis developing = urgency", "Lab: D-dimer, lactate as adjuncts (not definitive)"] },
  ];
  diffs.forEach((d, i) => {
    colorBox(s, 0.35 + i * 3.22, 2.12, 3.1, 3.3, d.label,
      d.items, i === 2 ? C.green : C.slate, 12);
  });
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 19 — SECTION DIVIDER: DIAGNOSIS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 5\nDiagnosis & Investigations", "A high index of suspicion + CT angiography");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 20 — LABORATORY INVESTIGATIONS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Laboratory Investigations");
  slideTitle(s, "Laboratory Investigations", "Adjuncts only — no single test rules AMI in or out");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.accent } });
  s.addText("CRITICAL: Highly elevated lactate = widespread ischemia. Normal/mildly elevated lactate has POOR negative predictive value — cannot rule out AMI", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 11, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "Standard Labs — Findings in AMI", [
    "WBC: leukocytosis > 15,000 with neutrophilic left shift",
    "Serum lactate: elevated (but may be normal early)",
    "Metabolic acidosis (↑ anion gap)",
    "D-dimer: sensitive but NOT specific (high false-positive rate)",
    "Serum amylase: may be elevated",
    "CK (creatine kinase): elevated with muscle ischemia",
    "Aminotransferases (ALT/AST): may be elevated",
    "Creatinine: AKI common in severe cases",
  ], C.midBg, 12);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Emerging & Specific Markers", [
    "Intestinal fatty acid-binding protein (iFABP):",
    "  · Urinary and plasma forms",
    "  · Specific for intestinal epithelial injury",
    "  · Early detection potential",
    "  · NOT yet in routine clinical practice",
    "Alpha-glutathione S-transferase:",
    "  · Early marker of ischemia",
    "Citrulline: marker of functional enterocyte mass",
    "",
    "⚠ Current practice: no single biomarker is sufficiently sensitive to drive clinical decisions alone",
  ], C.green, 12);
  footer(s, "Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 21 — CT ANGIOGRAPHY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Imaging — CT Angiography");
  slideTitle(s, "CT Angiography — Gold Standard", "Sensitivity 93%, Specificity 96% (Sabiston)");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.green } });
  s.addText("CTA with BIPHASIC acquisition (arterial phase + delayed venous phase) — optimal protocol", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 13, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "CT Findings — Specificity > 97%", [
    "Pneumatosis intestinalis",
    "Portal / superior mesenteric venous gas",
    "SMA or celiac artery occlusion",
    "Arterial embolism (filling defect in SMA)",
    "Focal bowel wall non-enhancement",
    "Absent / reduced bowel wall enhancement",
  ], C.accent, 13);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Additional CTA Findings", [
    "Bowel wall thickening and submucosal edema",
    "Mucosal wall enhancement (early ischemia)",
    "Mesenteric fat stranding",
    "Ascites / peritoneal fluid",
    "Dilated bowel loops / ileus",
    "CTA also assesses for MVT (venous phase)",
    "Guides open vs. endovascular planning",
    "Thin slices (1.25–2.0 mm) recommended",
  ], C.midBg, 12);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 22 — OTHER IMAGING
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Imaging — Other Modalities");
  slideTitle(s, "Other Imaging Modalities");

  const mods = [
    { label: "Plain Radiograph", color: C.slate, items: [
      "Usually unrevealing in early AMI",
      "Late findings: ileus, 'thumbprinting' (submucosal hemorrhage/edema), pneumatosis linearis, portal venous gas",
      "Use as initial screen — never to exclude AMI",
    ]},
    { label: "Duplex Ultrasound", color: C.green, items: [
      "Valuable for CMI — assess SMA and celiac velocity",
      "Hemodynamically significant stenosis thresholds:",
      "  · Celiac: PSV ≥ 200–250 cm/s (≥300 for greater accuracy)",
      "  · SMA: PSV ≥ 275–300 cm/s (≥400 for greater accuracy)",
      "  · EDV ≥ 45–55 cm/s",
      "NOT reliable in acute setting (bowel gas, acute inflammation)",
      "Perform in FASTING state; body habitus limits quality",
    ]},
    { label: "MRA", color: C.purple, items: [
      "High diagnostic accuracy for CMI",
      "Cannot assess calcification",
      "Cannot provide hemodynamic data",
      "Less available than CTA",
      "More time-consuming — NOT first-line for acute",
      "Useful for patients with CKD (no iodinated contrast)",
      "MRA may show median arcuate ligament compression of celiac axis",
    ]},
  ];
  mods.forEach((m, i) => {
    colorBox(s, 0.35 + i * 3.22, 1.5, 3.1, 3.95, m.label, m.items, m.color, 11.5);
  });
  footer(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 23 — SECTION DIVIDER: MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 6\nManagement of Acute Mesenteric Ischemia", "Resuscitate · Revascularize · Reassess");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 24 — INITIAL MANAGEMENT / RESUSCITATION
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Initial Management — Resuscitation");
  slideTitle(s, "Initial Medical Management", "Begin immediately — do not delay surgical planning");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.accent } });
  s.addText("PERITONITIS = EMERGENT LAPAROTOMY — Do NOT delay for imaging", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 14, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "Resuscitation Measures", [
    "IV access + crystalloid fluid resuscitation",
    "Hemodynamic monitoring (A-line, CVP, urinary catheter)",
    "Nasogastric tube decompression",
    "Correct electrolyte abnormalities",
    "Systemic ANTICOAGULATION (IV heparin) — prevents further propagation",
    "Broad-spectrum IV antibiotics (translocation of gut bacteria)",
    "ICU monitoring if hemodynamically unstable",
    "Serial abdominal examinations",
  ], C.midBg, 12);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Vasopressor Considerations", [
    "Avoid vasopressors if at all possible",
    "Vasopressors reduce splanchnic blood flow → worsen ischemia",
    "If vasopressors UNAVOIDABLE (refractory shock):",
    "  · Prefer: dobutamine, milrinone, low-dose dopamine",
    "  · These have LESS splanchnic vasoconstriction",
    "  · Avoid: high-dose norepinephrine, vasopressin if possible",
    "Resuscitation should NOT delay revascularization",
    "Coordinate medical management with surgical planning simultaneously",
  ], C.accent, 12);
  footer(s, "Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 25 — SURGICAL ALGORITHM
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Surgical Decision Making");
  slideTitle(s, "Surgical Algorithm — Open vs. Endovascular", "Based on Olson & Teixeira (Adv Surg 2021)");

  // Flow diagram as colored boxes with arrows
  const steps = [
    { label: "Suspected AMI", color: C.midBg, x: 3.8, y: 1.5, w: 2.5, h: 0.6 },
    { label: "Peritonitis present?", color: C.accent, x: 3.8, y: 2.3, w: 2.5, h: 0.6 },
  ];
  steps.forEach(b => {
    s.addShape(pres.ShapeType.rect, { x: b.x, y: b.y, w: b.w, h: b.h, fill: { color: b.color } });
    s.addText(b.label, { x: b.x, y: b.y, w: b.w, h: b.h, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle" });
  });

  // YES branch
  s.addShape(pres.ShapeType.rect, { x: 0.5, y: 3.15, w: 3.6, h: 0.55, fill: { color: C.accent } });
  s.addText("YES → Emergent Laparotomy", { x: 0.5, y: 3.15, w: 3.6, h: 0.55, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle" });
  bullets(s, [
    "Midline laparotomy",
    "Resect only frankly necrotic bowel",
    "REVASCULARIZE first (SMA embolectomy or bypass)",
    "Temporary abdominal closure",
    "Second-look in 24–48 hrs",
  ], { x: 0.5, y: 3.75, w: 3.6, h: 1.65, fontSize: 12 });

  // NO branch
  s.addShape(pres.ShapeType.rect, { x: 5.85, y: 3.15, w: 3.8, h: 0.55, fill: { color: C.green } });
  s.addText("NO → CT Angiography First", { x: 5.85, y: 3.15, w: 3.8, h: 0.55, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle" });
  bullets(s, [
    "Embolic → open embolectomy OR endovascular",
    "Thrombotic / AOD → open bypass OR endovascular",
    "NOMI → intra-arterial papaverine + treat cause",
    "MVT → anticoagulation ± catheter thrombolysis",
    "No high-quality RCT — expertise-dependent choice",
  ], { x: 5.85, y: 3.75, w: 3.8, h: 1.65, fontSize: 12 });

  // Arrow hint
  s.addText("↓ YES                          ↓ NO", {
    x: 1.5, y: 2.92, w: 7.0, h: 0.25,
    fontSize: 11.5, bold: true, color: C.accent, align: "center",
  });
  footer(s, "Current Surgical Therapy 14e; Olson & Teixeira, Adv Surg 2021");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 26 — OPEN EMBOLECTOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Open Surgical Technique — Embolectomy");
  slideTitle(s, "Open SMA Embolectomy", "Treatment of choice for embolic AMI");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "Step-by-Step Technique", [
    "1. Midline laparotomy",
    "2. Colon reflected cephalad; small bowel to patient's RIGHT",
    "3. Transverse incision through transverse colon mesentery",
    "4. Careful dissection through perivascular lymphatics",
    "5. Intraoperative Doppler to localize occlusion extent",
    "6. For proximal SMA: divide ligament of Treitz, free duodenum from pancreas, retract right",
    "7. Systemic HEPARINIZATION",
    "8. Proximal AND distal control of SMA and branches",
    "9. TRANSVERSE arteriotomy proximal to embolus",
    "10. 2 or 3-French balloon catheter passed ANTEGRADE → extract embolus",
    "11. Smaller catheters for 'showered' distal clot",
    "12. Primary closure with polypropylene suture on return of pulsatile flow",
  ], C.accent, 11.5);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Technical Pearls", [
    "Do NOT start resecting bowel first — REVASCULARIZE FIRST",
    "Diagnostic laparoscopy has limited utility (difficult to assess all bowel surfaces)",
    "Transverse arteriotomy preferred — avoids narrowing on closure",
    "Confirm distal flow with Doppler after embolectomy",
    "Smaller branches (2-3Fr) required for showered emboli to jejunal/ileal branches",
    "Assess bowel viability AFTER revascularization — not before",
    "Place temporary closure (VAC) → plan second look",
    "Contaminated abdomen: consider omental coverage for any synthetic material",
    "PTFE preferred over vein graft in emergent setting (less harvest time)",
  ], C.midBg, 11.5);
  footer(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 27 — OPEN BYPASS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Open Surgical Technique — Bypass");
  slideTitle(s, "Open Mesenteric Bypass", "For thrombotic AMI and atherosclerotic occlusive disease");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "Antegrade Bypass (Supraceliac Aorta)", [
    "Inflow: supraceliac or distal descending thoracic aorta",
    "Preferred when severe aortoiliac disease present distally",
    "Transperitoneal or retroperitoneal approach",
    "Mobilize left lobe of liver laterally; divide left crus",
    "Side-biting Satinsky clamp on supraceliac aorta — avoids total hypoperfusion",
    "Conduit: bifurcated Dacron (12×6 or 14×7 cm for celiac + SMA); PTFE; autologous vein",
    "Proximal anastomosis: end-to-side to supraceliac aorta (3-0 or 4-0 Prolene)",
    "Advantage: less graft kinking; less atherosclerotic burden at supraceliac aorta",
    "Reserved for YOUNGER patients — supraceliac cross-clamping has physiologic stress",
  ], C.midBg, 11.5);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Retrograde Bypass (Infrarenal Aorta / Iliac)", [
    "Inflow: infrarenal aorta or common iliac artery",
    "Preferred when supraceliac aorta is too diseased",
    "C-loop configuration of graft prevents kinking",
    "Conduit: PTFE or Dacron or cryopreserved vein",
    "End-to-side anastomosis to SMA distal to occlusion",
    "Retrograde Open Mesenteric Stenting (ROMS): hybrid technique",
    "  · Retrograde SMA access → antegrade stent deployment",
    "  · Useful when endovascular access from above is impossible",
    "Transaortic Endarterectomy:",
    "  · 'Trapdoor' aortotomy around celiac + SMA orifices",
    "  · Best for short focal ostial lesions",
    "  · Contraindicated if transmural calcification",
  ], C.green, 11.5);
  footer(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 28 — ENDOVASCULAR
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "Endovascular Management", C.green);
  slideTitle(s, "Endovascular Management of AMI", "For carefully selected patients without peritonitis");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.midBg } });
  s.addText("Selection: No peritonitis · No obvious bowel infarction · Diagnosed early · Endovascular expertise available · No AOD requiring extensive reconstruction", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 11, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "Endovascular Techniques", [
    "Pharmacomechanical embolectomy",
    "Percutaneous transluminal angioplasty (PTA)",
    "Intraarterial thrombolysis",
    "Primary stenting (balloon-expandable covered stent preferred)",
    "Aspiration thrombectomy",
    "Access: transfemoral (standard) or transbrachial (better angle for celiac/SMA)",
    "Balloon-expandable covered stent: high radial force, traps plaque, reduces restenosis vs. bare metal",
    "Stent flared 2–3 mm into aorta ('ostial flare') — improves patency",
  ], C.green, 12);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Endovascular vs. Open — Outcomes", [
    "Technical success: endovascular 85–100% vs. open 97–100%",
    "Endovascular: shorter hospital stay, less parenteral nutrition need",
    "No high-quality RCT favoring either approach",
    "Endovascular mortality: ~3–5% vs. open ~10–13% (CMI data)",
    "Endovascular: higher restenosis / reintervention rates",
    "Restenosis up to 40%; reintervention in ~50% of those",
    "Restenosis risk factors: female, small vessel (<6mm), calcification, long lesion, prior intervention",
    "Covered > bare metal stents (may reduce restenosis — RCT ongoing)",
  ], C.midBg, 12);
  footer(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 29 — NOMI & MVT MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Management — NOMI & MVT");
  slideTitle(s, "Management of NOMI and Mesenteric Venous Thrombosis");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "NOMI Management", [
    "PRIMARILY NONSURGICAL",
    "Treat underlying cause:",
    "  · Improve cardiac output",
    "  · Wean vasopressors if possible",
    "  · Fluid resuscitation",
    "Intraarterial vasodilators:",
    "  · Papaverine (standard)",
    "  · Nitroglycerin",
    "  · Prostaglandin analogues",
    "  → Selectively increase splanchnic blood flow",
    "  → Evidence from small case series only",
    "Laparotomy ONLY if peritonitis develops or bowel necrosis suspected",
    "No bowel resection without signs of infarction",
  ], C.amber, 12);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "MVT Management", [
    "ANTICOAGULATION is primary therapy:",
    "  · Immediate IV heparin",
    "  · Transition to warfarin or DOAC",
    "  · Duration: minimum 6 months; indefinite if persistent risk factor",
    "Catheter-directed thrombolysis: selected patients",
    "Treat underlying cause (screen for thrombophilia)",
    "Surgery (laparotomy + bowel resection) if:",
    "  · Peritonitis",
    "  · Bowel infarction confirmed",
    "Chronic MVT complications:",
    "  · Variceal bleeding → endoscopic or TIPS",
    "  · Splenomegaly / hypersplenism → management per extent",
    "Always screen for hypercoagulable state (Factor V Leiden, JAK2, APS, etc.)",
  ], C.purple, 12);
  footer(s, "Schwartz 11e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 30 — SECOND-LOOK LAPAROTOMY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Second-Look Laparotomy");
  slideTitle(s, "Second-Look Laparotomy", "The cornerstone of bowel preservation strategy");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.55, fill: { color: C.midBg } });
  s.addText("PRINCIPLE: Revascularize First → Resect Only Dead Bowel → Temporary Closure → Second Look 24–48 hrs → Definitive Closure", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.5,
    fontSize: 12, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.15, 4.6, 3.25, "First Operation", [
    "Midline laparotomy",
    "REVASCULARIZE first — embolectomy or bypass",
    "Resect ONLY frankly necrotic or perforated bowel",
    "Leave bowel in DISCONTINUITY (no anastomosis in ischemic bowel)",
    "Do NOT aggressively resect questionable segments",
    "Intraoperative Doppler to confirm revascularization success",
    "Temporary abdominal closure device (VAC / Bogota bag)",
  ], C.accent, 12);

  colorBox(s, 5.15, 2.15, 4.5, 3.25, "Second-Look Operation (24–48 hrs)", [
    "Reassess bowel viability after revascularization",
    "Previously questionable segments may RECOVER",
    "Further resection of segments that did not recover",
    "Definitive anastomosis once viability confirmed",
    "Maximizes bowel length preservation",
    "Endovascular approach: laparoscopic bowel assessment option for skilled surgeons",
    "May require multiple re-looks in severe cases",
    "Do NOT close abdomen primarily if bowel viability uncertain",
  ], C.green, 12);
  footer(s, "Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 31 — BOWEL VIABILITY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Bowel Viability Assessment");
  slideTitle(s, "Assessing Bowel Viability Intraoperatively");

  colorBox(s, 0.35, 1.5, 4.6, 2.15, "Clinical Assessment", [
    "Color: pink/red = viable; black/green/gray = necrotic",
    "Peristalsis: present = good sign",
    "Mesenteric arterial pulsation",
    "Bowel wall turgor and thickness",
    "Subserosal hemorrhage = concerning",
  ], C.midBg, 12.5);

  colorBox(s, 5.15, 1.5, 4.5, 2.15, "Adjuncts to Assessment", [
    "Intraoperative Doppler ultrasonography — loss of signal = no flow",
    "IV fluorescein + Wood's lamp — fluorescence = viable",
    "On-table angiography in select cases",
    "Pulse oximetry applied to bowel wall",
  ], C.green, 12.5);

  s.addText("Decision-Making Framework", {
    x: 0.35, y: 3.75, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.accent,
  });
  bullets(s, [
    "RESECT: frankly necrotic bowel (black, non-viable, no Doppler signal, no fluorescein uptake)",
    "PRESERVE: viable bowel and ALL questionable segments at first operation → reassess at second look",
    "RISK: Aggressive early resection leads to short bowel syndrome — devastating, avoid at all costs",
    "ANASTOMOSIS: defer until second look — never anastomose in setting of ischemia at first operation",
    "SHORT BOWEL THRESHOLD: < 100 cm of small bowel remaining = life-threatening short bowel syndrome",
  ], { y: 4.13, h: 1.35, fontSize: 12.5 });
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 32 — SECTION DIVIDER: CMI
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 7\nChronic Mesenteric Ischemia", "Elective revascularization prevents acute catastrophe");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 33 — CMI OVERVIEW
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "Chronic Mesenteric Ischemia", C.green);
  slideTitle(s, "Chronic Mesenteric Ischemia — Overview & Diagnosis");

  colorBox(s, 0.35, 1.5, 4.6, 1.95, "Etiology", [
    "Atherosclerosis (most common) — aortic plaque 'spills' into vessel orifice",
    "FMD, segmental arterial mediolysis, arteritis",
    "Takayasu's, giant cell arteritis, polyarteritis nodosa, Behçet's",
    "Median arcuate ligament compression (celiac axis)",
    "Must involve ≥ 2 of 3 main vessels (celiac, SMA, IMA) for symptoms",
  ], C.green, 12);

  colorBox(s, 5.15, 1.5, 4.5, 1.95, "Goals of Treatment", [
    "1. Durable restoration of normal nutrition",
    "2. Durable protection against visceral infarction",
    "Requires: accurate diagnosis + disease extent assessment + optimal reconstruction selection",
  ], C.midBg, 12.5);

  s.addText("Diagnostic Workup for CMI", {
    x: 0.35, y: 3.55, w: 9.3, h: 0.38,
    fontSize: 14, bold: true, color: C.midBg,
  });
  bullets(s, [
    "Initial CT imaging: exclude malignancy, assess arterial anatomy",
    "Duplex ultrasound (fasting): PSV ≥ 300 cm/s celiac / ≥ 400 cm/s SMA = hemodynamically significant",
    "CTA (1.25–2.0 mm slices, no oral contrast): gold standard for arterial anatomy — degree of collateralization = inferential hemodynamic data",
    "MRA: alternative for CKD patients — excellent anatomy, no hemodynamic data",
    "Causal relationship must be established: exclude other causes (endoscopy, motility studies, malabsorption workup)",
    "Hypoalbuminemia, anemia at presentation → suggests significant malnutrition from prolonged CMI",
  ], { y: 3.93, h: 1.55, fontSize: 12.5 });
  footer(s, "Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 34 — CMI ENDOVASCULAR
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.green);
  sectionTag(s, "CMI — Endovascular Treatment", C.green);
  slideTitle(s, "CMI — Endovascular Revascularization", "First-line treatment for most patients");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.green } });
  s.addText("Endovascular treatment now accounts for 70–80% of CMI revascularizations in the USA", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 13, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "Technique", [
    "Balloon-expandable COVERED stent: treatment of choice",
    "High radial force to push against calcified plaques",
    "Covered stent: traps plaque, prevents distal embolization, limits intimal hyperplasia to distal end only",
    "Stent longer than stenosis; projected 2–3 mm into aorta",
    "'Ostial flare' in aorta — key maneuver for patency",
    "Do NOT oversize stent (risk of vessel injury at aortic junction)",
    "Simple PTA rarely used (poor response with calcified lesions)",
    "Median arcuate ligament: MUST release ligament before stenting — endovascular alone will fail",
    "Access: transfemoral (standard) or transbrachial (better angle into celiac/SMA)",
  ], C.green, 11.5);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Outcomes & Durability", [
    "Technical success: 85–100%",
    "Perioperative mortality: 3–5%",
    "Symptom relief: excellent short-term",
    "Restenosis: up to 40%",
    "Reintervention required in ~50% of those with restenosis",
    "Risk factors for restenosis: female sex, vessel < 6 mm, heavy calcification, long lesion, prior intervention",
    "CMI incidence treated: 1.8 → 5.6 per million (endovascular expanded indications)",
    "Failed endovascular: rescue endovascular has < 20% mortality (vs. redo open: high mortality)",
    "Covered vs. bare metal stents: RCT ongoing — covered may be superior",
  ], C.midBg, 11.5);
  footer(s, "Current Surgical Therapy 14e — Linda M. Reilly MD; Sabiston Textbook of Surgery");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 35 — CMI OPEN SURGERY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "CMI — Open Surgical Treatment");
  slideTitle(s, "CMI — Open Surgical Revascularization", "Superior long-term durability; higher perioperative risk");

  colorBox(s, 0.35, 1.5, 4.6, 3.95, "Surgical Options for CMI", [
    "ANTEGRADE BYPASS (supraceliac aorta inflow):",
    "  · Transperitoneal or retroperitoneal (left lateral decubitus)",
    "  · Bifurcated Dacron (12×6 or 14×7 cm) for celiac + SMA",
    "  · Less graft kinking, less atherosclerotic burden in supraceliac aorta",
    "  · Physiologic stress of supraceliac cross-clamping — younger/fitter patients",
    "RETROGRADE BYPASS (infrarenal aorta / iliac):",
    "  · C-loop configuration prevents kinking",
    "  · PTFE, Dacron, or cryopreserved vein conduit",
    "  · Retrograde open mesenteric stenting (ROMS): hybrid",
    "TRANSAORTIC ENDARTERECTOMY:",
    "  · 'Trapdoor' aortotomy — removes aortic plaque + visceral orifice extensions",
    "  · Best for short focal ostial lesions only",
    "  · Transmural calcification = CONTRAINDICATION",
    "  · Hockey-stick extension if renal arteries also involved',",
  ], C.midBg, 11.5);

  colorBox(s, 5.15, 1.5, 4.5, 3.95, "Open vs. Endovascular — Direct Comparison", [
    "Open technical success: 97–100% vs. endovascular 85–100%",
    "Open perioperative mortality: ~10–13% vs. endovascular 3–5%",
    "MACE: open 16% vs. endovascular 8%",
    "Composite complications: open 20% vs. endovascular 15%",
    "Open: BETTER long-term patency and durability",
    "Endovascular: restenosis up to 40%; reintervention in ~20%",
    "Open mortality improved 20% → 10% over past 2–3 decades",
    "Open reserved for: younger patients, failed endovascular, complex anatomy, good surgical risk",
    "Malnourished/frail CMI patients: endovascular first (lower risk)",
    "Multi-vessel reconstruction: open may be only option for diffuse disease",
  ], C.green, 11.5);
  footer(s, "Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 36 — CMI SURVEILLANCE & COMPLICATIONS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "CMI — Postoperative Care & Surveillance");
  slideTitle(s, "CMI — Postoperative Care, Surveillance & Outcomes");

  colorBox(s, 0.35, 1.5, 4.6, 2.15, "Postoperative Nutrition", [
    "Begin oral feeding as symptoms allow",
    "Nutritional rehabilitation: often prolonged (malnourished patients)",
    "Parenteral nutrition: if bowel cannot be used immediately",
    "Monitor albumin, pre-albumin, weight",
    "Dietitian involvement essential",
  ], C.green, 12.5);

  colorBox(s, 5.15, 1.5, 4.5, 2.15, "Surveillance Protocol", [
    "Duplex ultrasound at 1 month, 6 months, then annually",
    "CTA / MRA if ultrasound shows restenosis",
    "Symptom monitoring: return of postprandial pain = restenosis",
    "Endovascular: higher surveillance frequency (higher restenosis rate)",
  ], C.midBg, 12.5);

  colorBox(s, 0.35, 3.77, 4.6, 1.7, "Postoperative Complications", [
    "Graft thrombosis (early: technical; late: restenosis)",
    "Wound infection / anastomotic leak",
    "Renal failure (contrast nephropathy, aortic cross-clamp)",
    "Cardiac events (high comorbidity burden)",
    "Bowel infarction if revascularization fails",
  ], C.accent, 12);

  colorBox(s, 5.15, 3.77, 4.5, 1.7, "Long-Term Outcomes", [
    "Open surgery: 5-year primary patency ~80–85%",
    "Endovascular: 5-year primary patency ~40–60% (restenosis)",
    "Symptom-free survival: excellent with successful durable revascularization",
    "Failed revascularization → return of CMI → risk of acute event",
  ], C.green, 12);
  footer(s, "Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 37 — SECTION DIVIDER: COMPLICATIONS & SPECIAL SCENARIOS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  sectionDivider(s, "Section 8\nComplications & Special Scenarios", "Short bowel syndrome, dissection, outcomes");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 38 — SHORT BOWEL SYNDROME
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s, C.accent);
  sectionTag(s, "Complication — Short Bowel Syndrome", C.accent);
  slideTitle(s, "Short Bowel Syndrome — The Feared Consequence");

  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.5, w: 9.3, h: 0.5, fill: { color: C.accent } });
  s.addText("< 100–150 cm of remaining small bowel = Short Bowel Syndrome — lifelong parenteral nutrition dependency", {
    x: 0.5, y: 1.52, w: 9.0, h: 0.46,
    fontSize: 12.5, color: C.white, bold: true, valign: "middle", align: "center",
  });

  colorBox(s, 0.35, 2.12, 4.6, 3.3, "Prevention Strategy", [
    "REVASCULARIZE FIRST — before resection",
    "Preserve ALL questionable segments at first operation",
    "Second-look laparotomy at 24–48 hrs allows recovery",
    "Never resect more than absolutely necessary",
    "Repeated re-look operations if viability unclear",
    "High-quality post-revascularization Doppler confirmation",
    "Aggressive early diagnosis to minimize ischemia time",
  ], C.accent, 12.5);

  colorBox(s, 5.15, 2.12, 4.5, 3.3, "Management of Established SBS", [
    "Parenteral nutrition (PN) — long-term home PN",
    "Enteral nutrition to stimulate bowel adaptation",
    "Teduglutide (GLP-2 analogue): promotes intestinal adaptation",
    "Anti-motility agents: loperamide, codeine",
    "Acid suppression (PPIs)",
    "Small bowel transplantation: for PN-dependent SBS with complications",
    "STEP procedure (serial transverse enteroplasty) for dilated bowel",
    "Multidisciplinary care: nutrition team, gastroenterology, surgery",
  ], C.midBg, 12.5);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 39 — SPECIAL SCENARIOS
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Special Scenarios");
  slideTitle(s, "Special Clinical Scenarios");

  colorBox(s, 0.35, 1.5, 4.6, 1.85, "Mesenteric Artery Dissection (SISMAD)", [
    "Spontaneous isolated SMA dissection (SISMAD) — rare (0.06%)",
    "Higher incidence: males, Korean/Japanese/Chinese descent",
    "Location: 1–3 cm from SMA ostium (transition from fixed retropancreatic to mobile mesenteric position)",
    "CTA: assess flap, false lumen, aneurysm, rupture",
    "Asymptomatic: antiplatelet therapy",
    "Mild symptoms: anticoagulation ± observation",
    "Persistent pain / ischemia: endovascular stenting",
  ], C.purple, 11.5);

  colorBox(s, 5.15, 1.5, 4.5, 1.85, "Aortic Dissection + Mesenteric Extension", [
    "Type A or B dissection extending to SMA / celiac origin",
    "True lumen compression → mesenteric ischemia",
    "Management: address underlying dissection (surgical / TEVAR)",
    "Fenestration or stenting of visceral vessels if persistent occlusion",
    "Significant mortality in visceral malperfusion from aortic dissection",
  ], C.accent, 11.5);

  colorBox(s, 0.35, 3.47, 4.6, 2.0, "Ischemic Colitis", [
    "Most common form of intestinal ischemia",
    "Usually involves the watershed areas: splenic flexure, rectosigmoid junction",
    "Typically transient and self-limiting (non-gangrenous)",
    "Causes: post-aortic surgery, low flow states, medications, vasculitis",
    "Management: supportive care; surgery only for gangrene/perforation",
  ], C.amber, 11.5);

  colorBox(s, 5.15, 3.47, 4.5, 2.0, "Post-AMI Follow-up", [
    "Long-term anticoagulation for embolic source",
    "Address underlying cardiac disease (AF ablation/cardioversion)",
    "Statin therapy for atherosclerotic disease",
    "Nutritional rehabilitation (TPN if short gut)",
    "Surveillance imaging at 1 month, 6 months, annually",
    "Psychological support — altered body image/diet",
  ], C.green, 11.5);
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 40 — OUTCOMES SUMMARY
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.white };
  topBar(s);
  sectionTag(s, "Outcomes Summary");
  slideTitle(s, "Outcomes — Comprehensive Summary");

  const stats = [
    { val: "17–21%", label: "Overall AMI\nMortality", color: C.accent },
    { val: "> 70%", label: "Mortality if\nICU-Admitted", color: "7B0000" },
    { val: "77%", label: "Thrombotic AMI\n(untreated)", color: C.accent },
    { val: "54%", label: "Embolic AMI\n(untreated)", color: "B23030" },
    { val: "33%", label: "Open repair\nmortality (2010)", color: C.midBg },
    { val: "15%", label: "Endovascular\nmortality (2010)", color: C.slate },
  ];
  stats.forEach((st, i) => {
    const x = 0.3 + i * 1.6;
    s.addShape(pres.ShapeType.rect, { x, y: 1.5, w: 1.5, h: 1.45, fill: { color: st.color } });
    s.addText(st.val, { x, y: 1.53, w: 1.5, h: 0.7, fontSize: 22, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(st.label, { x, y: 2.22, w: 1.5, h: 0.7, fontSize: 9.5, color: C.white, align: "center", valign: "top" });
  });

  s.addText("Factors That Determine Outcome", { x: 0.35, y: 3.12, w: 9.3, h: 0.38, fontSize: 14, bold: true, color: C.midBg });
  bullets(s, [
    "Time to diagnosis: most critical factor — every hour of delay worsens outcome",
    "Presence of peritonitis at presentation: dramatically worsens prognosis",
    "Bowel viability and extent of resection: risk of short bowel syndrome",
    "Etiology: thrombotic > embolic mortality (larger bowel territory, proximal occlusion)",
    "NOMI: highest mortality — compounds underlying critical illness",
    "CMI: untreated = precursor to acute catastrophe; treated = excellent long-term outcomes",
  ], { y: 3.5, h: 1.95, fontSize: 12.5 });
  footer(s, "Sabiston Textbook of Surgery; Current Surgical Therapy 14e; Schwartz 11e");
}

// ═══════════════════════════════════════════════════════════════════════════════
// SLIDE 41 — KEY MESSAGES
// ═══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.darkBg };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });

  s.addText("KEY MESSAGES", {
    x: 0.45, y: 0.18, w: 9.2, h: 0.4,
    fontSize: 10, bold: true, color: C.accent, charSpacing: 3,
  });
  s.addText("Mesenteric Ischemia — Surgical Take-Aways", {
    x: 0.45, y: 0.58, w: 9.2, h: 0.55,
    fontSize: 22, bold: true, color: C.white,
  });

  const msgs = [
    { n: "01", col: C.accent, t: "PAIN OUT OF PROPORTION to examination = AMI until proven otherwise. High index of suspicion is the first life-saving step." },
    { n: "02", col: C.accent, t: "No laboratory test can exclude AMI. CT angiography (biphasic) is the gold standard — specificity > 97% for key findings." },
    { n: "03", col: C.amber,  t: "PERITONITIS = Emergent laparotomy. Do NOT delay for imaging when peritonism is present." },
    { n: "04", col: C.green,  t: "REVASCULARIZE FIRST. Resect only frankly necrotic bowel. Second-look at 24–48 hrs preserves maximum bowel length." },
    { n: "05", col: C.green,  t: "Embolism → open embolectomy. Thrombosis → bypass. NOMI → papaverine + treat cause. MVT → anticoagulate." },
    { n: "06", col: C.amber,  t: "Vasopressors worsen mesenteric ischemia. Prefer dobutamine/milrinone when hemodynamic support is unavoidable." },
    { n: "07", col: C.green,  t: "CMI requires ≥ 2 vessel disease. Postprandial pain + weight loss + food fear = CMI until excluded. Elective revascularization prevents acute catastrophe." },
    { n: "08", col: C.amber,  t: "Endovascular for CMI is first-line (lower periop risk), but open surgery offers better durability. Lifelong surveillance mandatory." },
  ];
  msgs.forEach((m, i) => {
    const y = 1.22 + i * 0.53;
    s.addShape(pres.ShapeType.rect, { x: 0.45, y, w: 0.5, h: 0.44, fill: { color: m.col } });
    s.addText(m.n, { x: 0.45, y, w: 0.5, h: 0.44, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(m.t, { x: 1.05, y: y + 0.03, w: 8.6, h: 0.4, fontSize: 11.5, color: C.white, valign: "middle", fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════════════════
// WRITE
// ═══════════════════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surgery_v2.pptx" })
  .then(() => console.log("✅ Done: Mesenteric_Ischemia_Surgery_v2.pptx"))
  .catch(e => { console.error("❌", e); process.exit(1); });
!

Failed to create session: unauthorized: authentication failed: Bearer token is invalid

We encountered an error while processing your request. Please try again or reach out to us for help.

Try again

Writing File

~/mesenteric-ischemia-ppt/build_v2.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Mesenteric Ischemia — General Surgery Clinic";
pres.author = "General Surgery Clinic";

const C = {
  darkBg:  "0D1B2A", midBg:   "1B3A5C", accent:  "E63946",
  amber:   "F4A261", white:   "FFFFFF", lgray:   "E8EDF2",
  textDark:"0D1B2A", slate:   "457B9D", green:   "2A9D8F", purple:  "6C3483",
};

// ── helpers ──────────────────────────────────────────────────────────────────
function topBar(s, c){ s.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:0.07,fill:{color:c||C.accent}}); }
function tag(s,t,c){
  s.addText(t.toUpperCase(),{x:0.35,y:0.12,w:6,h:0.3,fontSize:8.5,bold:true,color:c||C.accent,charSpacing:2.5,fontFace:"Calibri"});
}
function ttl(s,t,sub){
  s.addText(t,{x:0.35,y:0.46,w:9.3,h:0.68,fontSize:27,bold:true,color:C.textDark,fontFace:"Calibri"});
  if(sub) s.addText(sub,{x:0.35,y:1.14,w:9.3,h:0.32,fontSize:12,color:C.slate,italic:true,fontFace:"Calibri"});
}
function bul(s,items,o){
  o=o||{}; var x=o.x!==undefined?o.x:0.4,y=o.y!==undefined?o.y:1.55,
    w=o.w!==undefined?o.w:9.2,h=o.h!==undefined?o.h:3.6,
    fs=o.fs||13,col=o.col||C.textDark;
  s.addText(items.map((t,i)=>({text:t,options:{bullet:{indent:12},breakLine:i<items.length-1,fontSize:fs,color:col,fontFace:"Calibri"}})),
    {x,y,w,h,valign:"top"});
}
function cbox(s,x,y,w,h,hdr,items,hc,fs){
  hc=hc||C.midBg; fs=fs||12;
  s.addShape(pres.ShapeType.rect,{x,y,w,h,fill:{color:C.lgray},line:{color:hc,pt:2}});
  s.addShape(pres.ShapeType.rect,{x,y,w,h:0.44,fill:{color:hc}});
  s.addText(hdr,{x:x+0.1,y:y+0.03,w:w-0.2,h:0.38,fontSize:12.5,bold:true,color:C.white,valign:"middle",fontFace:"Calibri"});
  bul(s,items,{x:x+0.12,y:y+0.48,w:w-0.24,h:h-0.55,fs,col:C.textDark});
}
function ftr(s,src){ s.addText("Source: "+src,{x:0.3,y:5.3,w:9.4,h:0.22,fontSize:7.5,color:"999999",italic:true,align:"right",fontFace:"Calibri"}); }
function divider(s,lbl,sub){
  s.background={color:C.midBg};
  s.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.15,h:5.625,fill:{color:C.accent}});
  s.addShape(pres.ShapeType.rect,{x:0.15,y:2.35,w:9.85,h:0.04,fill:{color:C.amber}});
  s.addText(lbl,{x:0.45,y:1.3,w:9.2,h:0.9,fontSize:34,bold:true,color:C.white,fontFace:"Calibri"});
  if(sub) s.addText(sub,{x:0.45,y:2.5,w:9.2,h:0.5,fontSize:15,color:C.amber,italic:true,fontFace:"Calibri"});
}

// ══════════════════════════════════════════════════════════════════════════════
// S1 TITLE
// ══════════════════════════════════════════════════════════════════════════════
{const s=pres.addSlide();
 s.background={color:C.darkBg};
 s.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.18,h:5.625,fill:{color:C.accent}});
 s.addText("MESENTERIC\nISCHEMIA",{x:0.5,y:0.65,w:9.2,h:2.5,fontSize:54,bold:true,color:C.white,fontFace:"Calibri",lineSpacingMultiple:1.1});
 s.addText("A Comprehensive Surgical Review — 45-Minute Lecture",{x:0.5,y:3.2,w:9.2,h:0.48,fontSize:18,color:C.amber,italic:true,fontFace:"Calibri"});
 s.addShape(pres.ShapeType.rect,{x:0.5,y:3.78,w:4,h:0.04,fill:{color:C.accent}});
 s.addText("General Surgery Clinic  ·  2026",{x:0.5,y:3.9,w:9.2,h:0.35,fontSize:12,color:"AAAAAA",fontFace:"Calibri"});
 s.addText("Based on: Schwartz's Principles of Surgery 11e  ·  Sabiston Textbook of Surgery  ·  Current Surgical Therapy 14e",{x:0.5,y:5.15,w:9.2,h:0.3,fontSize:8.5,color:"777777",italic:true,fontFace:"Calibri"});
}

// S2 OUTLINE
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.midBg); tag(s,"Lecture Outline",C.midBg);
 ttl(s,"Topics for Today — 45-Minute Lecture");
 const c1=["1. Introduction & Historical Perspective","2. Epidemiology & Mortality Data","3. Risk Factors by Etiology","4. Vascular Anatomy — SMA & Collaterals","5. Classification of Mesenteric Ischemia","6. Pathophysiology — Ischemia Timeline","7. Embolic vs. Thrombotic AMI","8. NOMI & Mesenteric Venous Thrombosis","9. Clinical Presentation — AMI","10. Clinical Presentation — Chronic & MVT"];
 const c2=["11. Differential Diagnosis","12. Laboratory Investigations","13. CT Angiography — Gold Standard","14. Other Imaging Modalities","15. Initial Resuscitation & Medical Management","16. Surgical Decision Algorithm","17. Open Embolectomy — Step by Step","18. Open Bypass — Antegrade & Retrograde","19. Transaortic Endarterectomy","20. Endovascular Management"];
 const c3=["21. NOMI & MVT Management","22. Second-Look Laparotomy","23. Bowel Viability Assessment","24. Chronic Mesenteric Ischemia Overview","25. CMI — Endovascular Revascularization","26. CMI — Open Surgical Revascularization","27. CMI — Outcomes & Surveillance","28. Short Bowel Syndrome","29. Special Scenarios","30. Key Messages & Summary"];
 [c1,c2,c3].forEach((col,ci)=>{
   col.forEach((item,ri)=>{
     s.addText(item,{x:0.28+ci*3.24,y:1.53+ri*0.4,w:3.18,h:0.38,fontSize:10.5,color:C.textDark,fontFace:"Calibri"});
   });
 });
 ftr(s,"Schwartz 11e · Sabiston · Current Surgical Therapy 14e");
}

// S3 DIVIDER — INTRODUCTION
{const s=pres.addSlide(); divider(s,"Section 1 — Introduction & Epidemiology","Understanding the clinical burden of mesenteric ischemia");}

// S4 HISTORICAL MILESTONES
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Historical Perspective");
 ttl(s,"Historical Milestones");
 const ev=[
   {yr:"1869",ev:"First description of mesenteric ischemia — Chienne"},
   {yr:"1895",ev:"First intestinal resection and reanastomosis — Elliot"},
   {yr:"1951",ev:"First SMA embolectomy — Klass"},
   {yr:"1957",ev:"First successful embolectomy without bowel resection — Shaw & Maynard"},
   {yr:"1980",ev:"Endovascular treatment of mesenteric disease introduced — major paradigm shift"},
   {yr:"2000s",ev:"Endovascular becomes predominant — 70–80% of CMI treated endovascularly"},
   {yr:"2010+",ev:"Open mortality 43%→33%; endovascular mortality 20%→15% — continued improvement"},
 ];
 ev.forEach((e,i)=>{
   const y=1.52+i*0.56;
   s.addShape(pres.ShapeType.rect,{x:0.35,y,w:0.95,h:0.44,fill:{color:C.midBg}});
   s.addText(e.yr,{x:0.35,y,w:0.95,h:0.44,fontSize:11,bold:true,color:C.white,align:"center",valign:"middle"});
   s.addShape(pres.ShapeType.rect,{x:1.33,y:y+0.2,w:0.22,h:0.04,fill:{color:C.accent}});
   s.addText(e.ev,{x:1.6,y,w:8.05,h:0.44,fontSize:12.5,color:C.textDark,valign:"middle",fontFace:"Calibri"});
 });
 ftr(s,"Sabiston Textbook of Surgery");
}

// S5 EPIDEMIOLOGY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Epidemiology");
 ttl(s,"Epidemiology","Rare but catastrophic — recognition is everything");
 cbox(s,0.35,1.52,4.55,2.28,"Incidence & Demographics",[
   "< 1 per 100,000 hospital admissions (USA)",
   "0.1–1 per 1,000 hospitalizations overall",
   "< 2% of all GI disorder admissions",
   "Median age at presentation: 74 years",
   "Incidence DOUBLES per 5-year interval above age 70",
   "3× higher incidence in females vs. males",
 ],C.midBg,12);
 cbox(s,5.15,1.52,4.5,2.28,"Mortality — Still Very High",[
   "Overall mortality: 17–21% (requiring intervention)",
   "Early diagnosis: > 50% mortality",
   "ICU-admitted patients: > 70% mortality",
   "Thrombotic AMI without treatment: 77%",
   "Embolic AMI without treatment: 54%",
   "NOMI: highest mortality (underlying critical illness)",
 ],C.accent,12);
 cbox(s,0.35,3.95,4.55,1.52,"Trends (1999–2010)",[
   "Open repair mortality: 43% → 33%",
   "Endovascular mortality: 20% → 15%",
   "Endovascular now 70–80% of CMI procedures",
   "CMI incidence treated: 1.8 → 5.6 per million",
 ],C.green,12);
 cbox(s,5.15,3.95,4.5,1.52,"Diagnosis Delay Impact",[
   "Survival drops 50% → 30% when SMA embolism diagnosed > 24 hrs from onset",
   "CMI average onset-to-diagnosis delay: > 12 months",
   "Timely diagnosis is the single most important determinant of survival",
 ],C.amber,12);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e; Schwartz 11e");
}

// S6 RISK FACTORS
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Risk Factors");
 ttl(s,"Risk Factors & High-Risk Patient Profiles");
 cbox(s,0.3,1.52,3.1,3.95,"Embolic AMI",[
   "Atrial fibrillation / flutter",
   "Recent MI + mural thrombus",
   "LV thrombus / low EF / CHF",
   "Valvular disease, endocarditis",
   "Mechanical heart valves",
   "Aortic aneurysm with mural thrombus",
   "Prior thromboembolic events",
   "68% have simultaneous emboli elsewhere",
 ],C.accent,12);
 cbox(s,3.6,1.52,3.1,3.95,"Thrombotic AMI",[
   "Atherosclerosis / PVD",
   "Prior chronic mesenteric ischemia",
   "PVD: AMI incidence up to 27%",
   "Hypercoagulable states",
   "Factor V Leiden, APS",
   "Antithrombin III deficiency",
   "Protein C/S deficiency",
   "Aortic dissection → SMA",
   "In-stent/graft thrombosis",
 ],C.midBg,12);
 cbox(s,6.9,1.52,2.8,3.95,"NOMI Risk",[
   "Critical illness / sepsis",
   "Post-cardiac surgery",
   "Hemodialysis patients",
   "High-dose vasopressors",
   "(epi, norepi, vasopressin)",
   "Severe cardiac failure",
   "Hypovolemic shock",
   "Low-flow states",
 ],C.amber,12);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S7 DIVIDER — ANATOMY
{const s=pres.addSlide(); divider(s,"Section 2 — Vascular Anatomy","Collateral anatomy determines presentation, treatment & prognosis");}

// S8 SMA ANATOMY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"Vascular Anatomy",C.green);
 ttl(s,"Mesenteric Arterial Anatomy — The SMA");
 s.addText("Superior Mesenteric Artery",{x:0.35,y:1.5,w:9.3,h:0.38,fontSize:14,bold:true,color:C.midBg,fontFace:"Calibri"});
 bul(s,[
   "2nd branch of abdominal aorta — oblique angle causes thromboemboli to PREFERENTIALLY lodge here",
   "Branches (in order): inferior pancreaticoduodenal a., middle colic a., right colic a., ileocolic a., jejunal/ileal branches",
   "Tapers just beyond first jejunal branches → emboli lodge proximally",
   "50% of emboli settle just DISTAL to middle colic artery; 15% at SMA origin",
   "Emboli proximal to middle colic a. → spares ascending colon, hepatic flexure, proximal transverse colon (classic pattern)",
   "Thrombosis: at SMA ORIGIN (within 2 cm) — superimposed on atherosclerotic plaques",
   "Thrombosis at origin → larger bowel territory at risk → higher mortality (77% untreated)",
 ],{y:1.88,fs:12.5});
 s.addText("Celiac Axis & Inferior Mesenteric Artery",{x:0.35,y:4.28,w:9.3,h:0.35,fontSize:13,bold:true,color:C.accent,fontFace:"Calibri"});
 bul(s,[
   "Celiac embolism: rare — symptomatic usually only in patients with pre-existing SMA disease",
   "IMA: occlusion alone virtually never causes symptoms — rich collateral supply",
 ],{y:4.63,h:0.82,fs:12.5});
 ftr(s,"Sabiston Textbook of Surgery");
}

// S9 COLLATERAL ANATOMY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"Vascular Anatomy — Collaterals",C.green);
 ttl(s,"Collateral Circulation — Clinical Significance");
 cbox(s,0.35,1.52,4.55,2.3,"Major Collateral Pathways",[
   "Celiac ↔ SMA: pancreaticoduodenal arcade (superior & inferior)",
   "SMA ↔ IMA: marginal artery of Drummond",
   "SMA ↔ IMA: arc of Riolan (meandering mesenteric a.)",
   "IMA ↔ internal iliac: hemorrhoidal arteries",
   "Venous: portal, splenic, SMV, IMV with multiple anastomoses",
 ],C.green,12.5);
 cbox(s,5.15,1.52,4.5,2.3,"Why Collaterals Matter Clinically",[
   "~20% of adults > 65 have asymptomatic stenosis/occlusion",
   "CMI: requires ≥ 2 of 3 vessels (celiac, SMA, IMA) to become symptomatic",
   "Embolic AMI: ABRUPT — no collateral protection → worst prognosis",
   "Thrombotic AMI: insidious — collaterals partially protect → delay in presentation",
   "IMA-only disease: virtually never symptomatic in isolation",
 ],C.midBg,12.5);
 cbox(s,0.35,3.97,9.3,1.5,"Venous Drainage",[
   "SMV drains ileocolic, middle colic, right colic veins → joins splenic vein → portal vein",
   "IMV drains left colon → connects directly with splenic vein",
   "MVT: SMV involved 95%; IMV rare (< 5–10%)",
   "Portal hypertension from chronic MVT → esophagogastric varices, splenomegaly, hypersplenism",
 ],C.purple,12.5);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S10 DIVIDER — CLASSIFICATION & PATHOPHYSIOLOGY
{const s=pres.addSlide(); divider(s,"Section 3 — Classification & Pathophysiology","Four pathways to the same catastrophe");}

// S11 CLASSIFICATION
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Classification");
 ttl(s,"Classification of Mesenteric Ischemia");
 const types=[
   {lbl:"Arterial Embolism",pct:"40–50%",col:C.accent},
   {lbl:"Arterial Thrombosis",pct:"20–35%",col:C.midBg},
   {lbl:"NOMI",pct:"~20%",col:C.amber},
   {lbl:"Venous Thrombosis",pct:"5–15%",col:C.green},
 ];
 types.forEach((t,i)=>{
   const x=0.3+i*2.4;
   s.addShape(pres.ShapeType.rect,{x,y:1.52,w:2.25,h:0.7,fill:{color:t.col}});
   s.addText(t.lbl,{x,y:1.52,w:2.25,h:0.44,fontSize:12,bold:true,color:C.white,align:"center",valign:"bottom"});
   s.addText(t.pct+" of AMI",{x,y:1.94,w:2.25,h:0.28,fontSize:10,color:C.white,align:"center"});
 });
 bul(s,[
   "ACUTE MI (AMI): sudden reduction in intestinal blood flow → ischemia → infarction within hours",
   "  · Embolism: abrupt onset, cardiac source, often multiple simultaneous embolic events in other vascular beds",
   "  · Thrombosis: acute-on-chronic, occurs at vessel origin, larger bowel territory at risk, higher mortality",
   "  · NOMI: vasospasm — no mechanical occlusion — systemic low-flow state in ICU patients",
   "  · MVT: impaired venous return → bowel congestion → edema → infarction; ileum/jejunum preferentially",
   "CHRONIC MI (CMI): insidious postprandial ischemia — collaterals prevent infarction but symptom burden is high",
   "  · At least 2 of 3 main vessels (celiac, SMA, IMA) must be severely stenosed/occluded",
   "  · Often a direct precursor to acute catastrophe if untreated",
 ],{y:2.3,fs:12.5});
 ftr(s,"Schwartz 11e; Sabiston Textbook of Surgery");
}

// S12 PATHOPHYSIOLOGY TIMELINE
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Pathophysiology");
 ttl(s,"Pathophysiology — Ischemia Timeline","Time is bowel — minutes matter");
 const bar=[
   {lbl:"0–3 hrs",det:"Mucosal sloughing\nBacterial translocation",col:C.amber},
   {lbl:"3–6 hrs",det:"Full-thickness\nischemia",col:"E07B3A"},
   {lbl:"> 6 hrs",det:"FULL-THICKNESS\nINFARCTION",col:C.accent},
   {lbl:"Late",det:"Peritonitis\nSeptic shock / Death",col:"7B0000"},
 ];
 bar.forEach((b,i)=>{
   const x=0.35+i*2.35;
   s.addShape(pres.ShapeType.rect,{x,y:1.52,w:2.2,h:1.5,fill:{color:b.col}});
   s.addText(b.lbl+"\n"+b.det,{x:x+0.05,y:1.57,w:2.1,h:1.4,fontSize:12,bold:true,color:C.white,align:"center",valign:"middle"});
 });
 s.addText("Pathophysiological Cascade",{x:0.35,y:3.18,w:9.3,h:0.38,fontSize:14,bold:true,color:C.midBg,fontFace:"Calibri"});
 bul(s,[
   "Reduced intestinal blood flow → mucosal hypoxia → villous tip necrosis (watershed zone — most vulnerable)",
   "Bacterial translocation across damaged mucosa → systemic endotoxemia → SIRS → sepsis → multiorgan failure",
   "Reperfusion injury: reactive oxygen species (ROS) cause ADDITIONAL damage after revascularization",
   "NOMI specifically: mesenteric vasoconstriction + intestinal hypoxemia + reperfusion injury + infection",
   "MVT: venous congestion → bowel wall edema → transmural infarction (ileum/jejunum > colon)",
 ],{y:3.57,h:1.9,fs:12.5});
 ftr(s,"Schwartz 11e; Sabiston Textbook of Surgery");
}

// S13 EMBOLIC VS THROMBOTIC
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Pathophysiology — Embolic vs Thrombotic");
 ttl(s,"Embolic vs. Thrombotic AMI — Key Differences");
 cbox(s,0.35,1.52,4.6,3.95,"Arterial Embolism",[
   "Source: cardiac (AF, LV thrombus, valvular disease, endocarditis)",
   "Lodges: 50% distal to middle colic a.; 15% at SMA origin",
   "ABRUPT onset — no collateral protection",
   "Spares proximal jejunum and right colon (proximal to obstruction)",
   "95% have documented cardiac disease",
   "68% have simultaneous emboli in other beds (cerebrovascular, peripheral)",
   "Mortality without treatment: 54%",
   "Treatment: open SMA embolectomy (gold standard)",
   "Celiac embolism: usually only symptomatic with pre-existing SMA disease",
 ],C.accent,12);
 cbox(s,5.15,1.52,4.5,3.95,"Arterial Thrombosis",[
   "Superimposed on chronic atherosclerotic plaques at vessel ORIGINS",
   "Thrombosis within 2 cm of SMA origin → larger bowel territory",
   "More INSIDIOUS onset — existing collaterals partially protective",
   "Subacute phase may last days to weeks before acute decompensation",
   "PVD patients: incidence of AMI up to 27%",
   "Acute-on-chronic presentation is common",
   "Celiac thrombosis: significant in patients with pre-existing SMA disease",
   "Mortality without treatment: 77% (proximal = larger territory = higher)",
   "Treatment: open bypass or endovascular recanalization",
 ],C.midBg,12);
 ftr(s,"Sabiston Textbook of Surgery");
}

// S14 NOMI & MVT PATHOPHYSIOLOGY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Pathophysiology — NOMI & MVT");
 ttl(s,"NOMI & Mesenteric Venous Thrombosis — Pathophysiology");
 cbox(s,0.35,1.52,4.6,3.95,"NOMI — Nonocclusive Mesenteric Ischemia",[
   "~20% of AMI cases; most frequently affects SMA",
   "Mechanism: mesenteric vasoconstriction + intestinal hypoxemia + reperfusion injury + increased metabolic demand + infection",
   "Key: LOW FLOW STATE — body prioritizes cardiac/cerebral perfusion at expense of gut",
   "May occur WITHOUT pre-existing mesenteric stenosis (vasospasm mechanism)",
   "Vasopressors (epi, norepi, vasopressin) → splanchnic vasoconstriction → NOMI",
   "Highest mortality of all AMI subtypes (compounded by underlying illness)",
   "CTA: less reliable for diagnosis in NOMI (no mechanical occlusion)",
   "Treatment: intraarterial papaverine/vasodilators + treat underlying cause",
   "Laparotomy only if peritonitis develops",
 ],C.amber,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"Mesenteric Venous Thrombosis",[
   "9–15% of mesenteric ischemic events",
   "SMV 95%; IMV rare (< 5–10%)",
   "Secondary MVT > 90% of cases; hypercoagulable states: 60–70%",
   "Secondary causes: trauma, pancreatitis, IBD, portal HTN/cirrhosis, CHF, OCP, polycythemia vera, JAK2 V617F mutation, APS, HIT",
   "Venous congestion → bowel wall edema → transmural infarction: ileum/jejunum > colon",
   "Acute (70%): pain OOP to exam, GI bleeding 15–50%, hemodynamic instability if infarction",
   "Subacute: non-specific symptoms weeks-months",
   "Chronic: often asymptomatic; portal hypertension complications",
   "Treatment: anticoagulation; surgery for peritonitis/infarction",
 ],C.purple,11.5);
 ftr(s,"Sabiston Textbook of Surgery; Schwartz 11e");
}

// S15 DIVIDER — CLINICAL PRESENTATION
{const s=pres.addSlide(); divider(s,"Section 4 — Clinical Presentation","The diagnosis is clinical first, imaging second");}

// S16 CLINICAL PRESENTATION AMI
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Clinical Presentation — AMI");
 ttl(s,"Acute Mesenteric Ischemia — Clinical Features");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.55,fill:{color:C.accent}});
 s.addText("HALLMARK: Pain OUT OF PROPORTION to physical examination — THE key diagnostic clue",{x:0.5,y:1.54,w:9.0,h:0.5,fontSize:14,bold:true,color:C.white,align:"center",valign:"middle"});
 cbox(s,0.35,2.18,4.6,1.65,"Early Presentation",[
   "Sudden-onset severe periumbilical/mid-abdominal pain",
   "Often colicky in character",
   "Nausea, vomiting, diarrhea",
   "Physical examination: SURPRISINGLY NORMAL early",
   "Patient distressed beyond what examination shows",
 ],C.midBg,12);
 cbox(s,5.15,2.18,4.5,1.65,"Late Presentation (Infarction)",[
   "Abdominal distension",
   "Peritonism: guarding, rebound tenderness",
   "Bloody stools / PR bleeding",
   "Septic shock: tachycardia, hypotension, fever",
   "Rapid clinical deterioration",
 ],C.accent,12);
 s.addText("Variation by Etiology",{x:0.35,y:3.95,w:9.3,h:0.35,fontSize:13.5,bold:true,color:C.midBg,fontFace:"Calibri"});
 bul(s,[
   "Embolic: most ACUTE — abrupt onset, rapid deterioration, often known AF or recent MI",
   "Thrombotic: more insidious — may have days-weeks prodrome (subacute ischemia), prior 'food pain' history",
   "NOMI: may be painless in sedated ICU patients — sepsis + abdominal distension + multiorgan failure",
   "MVT: gradual onset hours-days, nausea, vomiting, GI bleeding in 15–50%, hemodynamic instability if infarction",
 ],{y:4.3,h:1.2,fs:12.5});
 ftr(s,"Sabiston Textbook of Surgery; Schwartz 11e");
}

// S17 CHRONIC & MVT PRESENTATION
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"Clinical Presentation — Chronic & MVT",C.green);
 ttl(s,"Chronic Mesenteric Ischemia & MVT — Presentation");
 cbox(s,0.35,1.52,4.6,3.95,"Chronic Mesenteric Ischemia",[
   "Postprandial abdominal pain (intestinal angina) 15–30 min after eating",
   "Characteristic FOOD FEAR — patient avoids eating to prevent pain",
   "Progressive significant weight loss",
   "Often misdiagnosed as malignancy (weight loss misleads clinicians)",
   "3:1 female-to-male ratio — gender bias delays diagnosis",
   "Onset age 50–60 years; younger than typical AMI patient",
   "Only 1/3 have signs of arterial disease in other vascular beds",
   "Average onset-to-diagnosis delay: > 12 months",
   "Physical exam: epigastric bruit in some; often unremarkable",
   "Hypoalbuminemia, anemia from prolonged malnutrition",
   "Untreated: directly precedes acute catastrophe",
 ],C.green,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"Mesenteric Venous Thrombosis — Presentations",[
   "ACUTE MVT (70%):",
   "  · Vague abdominal pain OOP to exam",
   "  · Nausea, vomiting",
   "  · GI bleeding in 15–50%",
   "  · Hemodynamic instability if infarction develops",
   "SUBACUTE MVT:",
   "  · Non-specific symptoms for weeks to months",
   "  · Minimal or no examination findings",
   "CHRONIC MVT:",
   "  · Often completely asymptomatic (extensive collaterals)",
   "  · Portal hypertension: varices, splenomegaly",
   "  · Esophagogastric variceal bleeding",
   "  · Hypersplenism, ascites",
 ],C.purple,11.5);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S18 DIFFERENTIAL DIAGNOSIS
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Differential Diagnosis");
 ttl(s,"Differential Diagnosis of Acute Severe Abdominal Pain");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.midBg}});
 s.addText("In any elderly patient with sudden severe abdominal pain + AF or vascular disease: AMI must be ACTIVELY EXCLUDED",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:11.5,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,3.1,3.3,"Surgical Emergencies",[
   "Perforated peptic ulcer",
   "Ruptured AAA",
   "Bowel obstruction / volvulus",
   "Acute appendicitis",
   "Acute cholecystitis / cholangitis",
   "Sigmoid volvulus",
 ],C.accent,12);
 cbox(s,3.6,2.12,3.1,3.3,"GI / Medical Causes",[
   "Acute pancreatitis",
   "Diverticulitis",
   "Inflammatory bowel disease",
   "Ischemic colitis (SMA vs. watershed)",
   "Intestinal obstruction (adhesions)",
   "Gastroenteritis",
 ],C.slate,12);
 cbox(s,6.9,2.12,2.8,3.3,"Distinguish AMI by:",[
   "CTA: vascular occlusion",
   "Clinical context: AF/MI → AMI",
   "Pain OOP to exam → AMI",
   "Late radiograph: thumbprinting",
   "Lactate: elevated (not specific)",
   "D-dimer: early sensitive marker",
   "Age > 60 + risk factors: AMI first",
 ],C.green,11.5);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S19 DIVIDER — DIAGNOSIS
{const s=pres.addSlide(); divider(s,"Section 5 — Diagnosis & Investigations","CT angiography + high index of suspicion");}

// S20 LABORATORY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Laboratory Investigations");
 ttl(s,"Laboratory Investigations","Adjuncts only — no single test confirms or excludes AMI");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.accent}});
 s.addText("CRITICAL: Highly elevated lactate = widespread ischemia. Normal/mildly elevated lactate has POOR negative predictive value — CANNOT exclude AMI",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:11,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"Standard Labs in AMI",[
   "WBC: leukocytosis > 15,000 with neutrophilic left shift",
   "Serum lactate: elevated (may be normal early)",
   "Metabolic acidosis (elevated anion gap)",
   "D-dimer: sensitive but NOT specific (high false-positive rate)",
   "Serum amylase: may be elevated",
   "CK (creatine kinase): elevated with muscle ischemia",
   "Aminotransferases (ALT/AST): may be elevated",
   "Creatinine: AKI common in severe cases",
   "Haemoconcentration (elevated Hb/Hct): from fluid shifts",
 ],C.midBg,12);
 cbox(s,5.15,2.12,4.5,3.3,"Emerging Biomarkers (Research)",[
   "Intestinal fatty acid-binding protein (iFABP):",
   "  · Urinary and plasma forms",
   "  · Specific for intestinal epithelial injury",
   "  · Shows promise for EARLY detection",
   "  · NOT yet in routine clinical practice",
   "Alpha-glutathione S-transferase: early ischemia marker",
   "Citrulline: marker of functional enterocyte mass",
   "Serum D-lactate: bacterial origin",
   "",
   "⚠  Current practice: treat clinically — imaging drives decision, not biomarkers",
 ],C.green,12);
 ftr(s,"Sabiston Textbook of Surgery");
}

// S21 CTA
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Imaging — CT Angiography");
 ttl(s,"CT Angiography — Gold Standard","Sensitivity 93%, Specificity 96%");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.green}});
 s.addText("BIPHASIC CTA: arterial phase + delayed venous phase — optimal protocol for AMI (evaluates both arteries AND portal/mesenteric veins)",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:12,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"CT Findings with > 97% Specificity",[
   "Pneumatosis intestinalis",
   "Portal venous / superior mesenteric venous gas",
   "SMA or celiac artery occlusion",
   "Arterial embolism (filling defect in SMA)",
   "Focal bowel wall non-enhancement",
 ],C.accent,13);
 cbox(s,5.15,2.12,4.5,3.3,"Additional CTA Findings & Planning",[
   "Bowel wall thickening / submucosal edema",
   "Mucosal wall enhancement (early ischemia)",
   "Mesenteric fat stranding",
   "Ascites / peritoneal fluid",
   "Dilated bowel loops / ileus",
   "Assesses MVT (delayed venous phase)",
   "Guides open vs. endovascular revascularization planning",
   "Thin slices 1.25–2.0 mm recommended; no oral contrast",
   "Plain radiograph: thumbprinting, pneumatosis (LATE, insensitive)",
 ],C.midBg,12);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S22 OTHER IMAGING
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Imaging — Other Modalities");
 ttl(s,"Other Imaging Modalities");
 cbox(s,0.35,1.52,3.0,3.95,"Plain Radiograph",[
   "Usually unrevealing early",
   "Late findings only:",
   "  · Ileus / bowel dilation",
   "  · Thumbprinting (submucosal haemorrhage/edema)",
   "  · Pneumatosis linearis",
   "  · Portal venous gas",
   "Use as initial screen — NEVER to exclude AMI",
   "Low sensitivity — most abnormalities appear very late",
 ],C.slate,12);
 cbox(s,3.5,1.52,3.15,3.95,"Duplex Ultrasound",[
   "Valuable for CMI — assess SMA and celiac velocity",
   "Perform in FASTING state (reduce bowel gas)",
   "Hemodynamically significant stenosis:",
   "  · Celiac PSV ≥ 200–250 cm/s",
   "  · Celiac ≥ 300 cm/s (better accuracy)",
   "  · SMA PSV ≥ 275–300 cm/s",
   "  · SMA ≥ 400 cm/s (better accuracy)",
   "  · EDV ≥ 45–55 cm/s",
   "NOT reliable in ACUTE setting",
   "Body habitus and bowel gas limit quality",
 ],C.green,12);
 cbox(s,6.8,1.52,2.9,3.95,"MRA",[
   "High accuracy for CMI",
   "Cannot assess calcification",
   "No hemodynamic data",
   "Less available than CTA",
   "Slower — not first-line for acute",
   "CKD patients: no iodinated contrast",
   "Can show median arcuate ligament compression of celiac axis",
   "MRA with gadolinium: excellent vessel delineation",
 ],C.purple,12);
 ftr(s,"Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// S23 DIVIDER — MANAGEMENT
{const s=pres.addSlide(); divider(s,"Section 6 — Management of AMI","Resuscitate · Revascularize · Resect · Reassess");}

// S24 INITIAL RESUSCITATION
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Initial Management — Resuscitation");
 ttl(s,"Initial Medical Management","Start immediately — do NOT delay surgical planning");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.accent}});
 s.addText("PERITONITIS = EMERGENT LAPAROTOMY — Do NOT wait for imaging when peritonism is present",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:14,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"Resuscitation Measures",[
   "IV access + crystalloid fluid resuscitation",
   "Hemodynamic monitoring (A-line, CVP, urinary catheter)",
   "Nasogastric tube decompression",
   "Correct electrolyte abnormalities",
   "Systemic ANTICOAGULATION (IV heparin) — prevents thrombus propagation",
   "Broad-spectrum IV antibiotics (bacterial translocation from ischaemic gut)",
   "ICU monitoring if haemodynamically unstable",
   "Serial abdominal examinations",
   "Blood typing & crossmatch",
 ],C.midBg,12);
 cbox(s,5.15,2.12,4.5,3.3,"Vasopressor Considerations",[
   "AVOID vasopressors if at all possible",
   "Vasopressors reduce splanchnic blood flow → worsen ischemia → NOMI",
   "If vasopressors unavoidable (refractory shock):",
   "  · PREFER: dobutamine, milrinone, low-dose dopamine",
   "  · These have less splanchnic vasoconstriction",
   "  · AVOID: high-dose norepinephrine, vasopressin if possible",
   "Resuscitation must NOT delay revascularization",
   "Medical management and surgical planning run SIMULTANEOUSLY",
   "Anticoagulation initiated immediately on diagnosis",
 ],C.accent,12);
 ftr(s,"Sabiston Textbook of Surgery");
}

// S25 SURGICAL ALGORITHM
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Surgical Decision Algorithm");
 ttl(s,"Surgical Decision Algorithm — Open vs. Endovascular");
 // Central question
 s.addShape(pres.ShapeType.rect,{x:3.5,y:1.52,w:3.1,h:0.55,fill:{color:C.midBg}});
 s.addText("Suspected AMI — CTA obtained",{x:3.5,y:1.52,w:3.1,h:0.55,fontSize:11.5,bold:true,color:C.white,align:"center",valign:"middle"});
 s.addShape(pres.ShapeType.rect,{x:3.5,y:2.25,w:3.1,h:0.55,fill:{color:C.accent}});
 s.addText("Peritonitis / Bowel Necrosis?",{x:3.5,y:2.25,w:3.1,h:0.55,fontSize:12,bold:true,color:C.white,align:"center",valign:"middle"});
 s.addText("YES ↙                            ↘ NO",{x:1.5,y:2.95,w:7.1,h:0.28,fontSize:12,bold:true,color:C.accent,align:"center"});
 // YES
 s.addShape(pres.ShapeType.rect,{x:0.35,y:3.3,w:3.8,h:0.5,fill:{color:C.accent}});
 s.addText("Emergent Laparotomy",{x:0.35,y:3.3,w:3.8,h:0.5,fontSize:12.5,bold:true,color:C.white,align:"center",valign:"middle"});
 bul(s,["Midline laparotomy","REVASCULARIZE first (embolectomy or bypass)","Resect frankly necrotic bowel ONLY","Temp abdominal closure","Second-look 24–48 hrs"],{x:0.35,y:3.85,w:3.8,h:1.6,fs:12});
 // NO
 s.addShape(pres.ShapeType.rect,{x:5.9,y:3.3,w:3.75,h:0.5,fill:{color:C.green}});
 s.addText("Consider Endovascular First",{x:5.9,y:3.3,w:3.75,h:0.5,fontSize:12.5,bold:true,color:C.white,align:"center",valign:"middle"});
 bul(s,["Embolic → open embolectomy OR endovascular","Thrombotic/AOD → bypass OR endovascular","NOMI → intra-arterial papaverine + treat cause","MVT → anticoagulation ± catheter thrombolysis","No RCT evidence — expertise-dependent choice"],{x:5.9,y:3.85,w:3.75,h:1.6,fs:12});
 ftr(s,"Current Surgical Therapy 14e; Olson & Teixeira, Adv Surg 2021");
}

// S26 OPEN EMBOLECTOMY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Open Surgical Technique — Embolectomy");
 ttl(s,"Open SMA Embolectomy — Step by Step","Gold standard for embolic AMI");
 cbox(s,0.35,1.52,4.6,3.95,"Operative Steps",[
   "1. Midline laparotomy",
   "2. Colon reflected cephalad; small bowel to patient's RIGHT",
   "3. Transverse incision through transverse colon mesentery",
   "4. Dissect through perivascular lymphatics around SMV",
   "5. Intraoperative Doppler → localize loss of signal",
   "6. Proximal SMA: divide ligament of Treitz; free duodenum from pancreas; retract right to expose SMA origin",
   "7. Systemic HEPARINIZATION (60–80 u/kg; ACT > 250 s)",
   "8. Proximal AND distal control of SMA and its branches",
   "9. TRANSVERSE arteriotomy proximal to embolus",
   "10. 2 or 3-Fr balloon catheter ANTEGRADE → extract embolus",
   "11. Smaller catheters for showered distal clot in jejunal/ileal branches",
   "12. Confirm pulsatile flow + Doppler signal",
   "13. Primary closure with polypropylene suture",
 ],C.accent,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"Technical Pearls",[
   "REVASCULARIZE FIRST — do NOT begin bowel resection",
   "Diagnostic laparoscopy has limited utility (cannot fully assess all bowel surfaces)",
   "Transverse arteriotomy: avoids narrowing on closure",
   "ASSESS BOWEL VIABILITY AFTER revascularization — not before",
   "After embolectomy: temp closure (VAC / Bogota bag)",
   "Second-look planned for 24–48 hrs",
   "Contaminated abdomen + synthetic graft: omental pedicle coverage",
   "PTFE preferred over vein in emergent setting (saves harvest time)",
   "Never anastomose bowel at first operation in AMI",
   "If peritonitis: go straight to OR — do not wait for CTA",
 ],C.midBg,11.5);
 ftr(s,"Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// S27 OPEN BYPASS
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Open Surgical Technique — Bypass");
 ttl(s,"Open Mesenteric Bypass","For thrombotic AMI and atherosclerotic occlusive disease");
 cbox(s,0.35,1.52,4.6,3.95,"Antegrade Bypass (Supraceliac Aorta)",[
   "Inflow: supraceliac or distal descending thoracic aorta",
   "Best when severe aortoiliac disease present distally",
   "Transperitoneal or retroperitoneal approach",
   "Mobilise left liver lobe; divide left crus of diaphragm",
   "Satinsky side-biting clamp on supraceliac aorta — avoids total distal hypoperfusion",
   "60-degree left lateral decubitus for retroperitoneal approach",
   "Conduit: bifurcated Dacron (12×6 or 14×7 cm for celiac+SMA); PTFE; autologous vein",
   "Proximal anastomosis: end-to-side to supraceliac aorta (3-0 or 4-0 Prolene)",
   "Advantage: less graft kinking; supraceliac aorta less atherosclerotic",
   "Physiologic stress of supraceliac cross-clamping: reserve for younger/fitter patients",
 ],C.midBg,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"Retrograde Bypass & Endarterectomy",[
   "RETROGRADE BYPASS (infrarenal aorta / iliac):",
   "  · Preferred when supraceliac aorta diseased",
   "  · C-loop configuration prevents graft kinking",
   "  · PTFE, Dacron, or cryopreserved vein conduit",
   "  · End-to-side to SMA distal to occlusion",
   "RETROGRADE OPEN MESENTERIC STENTING (ROMS):",
   "  · Hybrid technique — retrograde SMA access → antegrade stent deployment",
   "  · Useful when endovascular access from above is impossible",
   "TRANSAORTIC ENDARTERECTOMY:",
   "  · Trapdoor aortotomy → removes aortic plaque + visceral orifice extensions",
   "  · Best for SHORT focal ostial lesions (first 1–2 cm only)',",
   "  · Transmural calcification = CONTRAINDICATION",
   "  · Hockey-stick extension if renal arteries also involved',",
 ],C.green,11.5);
 ftr(s,"Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// S28 ENDOVASCULAR
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"Endovascular Management",C.green);
 ttl(s,"Endovascular Management","Selected patients without peritonitis or bowel necrosis");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.midBg}});
 s.addText("Selection: No peritonitis · No bowel necrosis · Early diagnosis · Endovascular expertise available",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:12,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"Endovascular Techniques",[
   "Pharmacomechanical embolectomy",
   "Percutaneous transluminal angioplasty (PTA)",
   "Intraarterial thrombolysis",
   "Primary stenting (balloon-expandable covered stent preferred)",
   "Aspiration thrombectomy",
   "Access: transfemoral (standard) or transbrachial (better angle for celiac/SMA — aiming sheath helps)",
   "Covered stent: high radial force, traps plaque, limits intimal hyperplasia to distal end only",
   "Ostial flare 2–3 mm into aorta — key maneuver for patency",
   "Do NOT oversize stent (risk of vessel injury at aortic junction)",
 ],C.green,12);
 cbox(s,5.15,2.12,4.5,3.3,"Endovascular vs. Open — Outcomes",[
   "Technical success: endovascular 85–100% vs. open 97–100%",
   "Perioperative mortality: endo 3–5% vs. open 10–13% (CMI data)",
   "MACE: endo 8% vs. open 16%",
   "Composite complications: endo 15% vs. open 20%",
   "Shorter hospital stay; less parenteral nutrition need",
   "BUT: restenosis up to 40% with endovascular",
   "Reintervention in ~50% of those with restenosis",
   "No high-quality RCT — choice depends on expertise",
   "Covered > bare metal stents: RCT ongoing",
 ],C.midBg,12);
 ftr(s,"Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// S29 NOMI & MVT MANAGEMENT
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Management — NOMI & MVT");
 ttl(s,"Management of NOMI and Mesenteric Venous Thrombosis");
 cbox(s,0.35,1.52,4.6,3.95,"NOMI Management",[
   "PRIMARILY NONSURGICAL",
   "1. Treat underlying cause:",
   "  · Improve cardiac output",
   "  · Wean vasopressors gradually",
   "  · Aggressive fluid resuscitation",
   "2. Intraarterial vasodilators (transcatheter):",
   "  · Papaverine (most studied)",
   "  · Nitroglycerin",
   "  · Prostaglandin analogues",
   "  → Selectively increase splanchnic blood flow",
   "  → Evidence from small case series; no large RCT",
   "3. Laparotomy ONLY if peritonitis develops",
   "  · Resect only frankly necrotic bowel",
   "  · No bowel resection without peritonitis or infarction",
 ],C.amber,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"MVT Management",[
   "ANTICOAGULATION is primary therapy:",
   "  · Immediate IV unfractionated heparin",
   "  · Transition to warfarin or DOAC",
   "  · Duration: ≥ 6 months (indefinite if persistent risk factor)",
   "Catheter-directed thrombolysis: selected cases",
   "Treat underlying hypercoagulable state",
   "Screen: Factor V Leiden, JAK2, APS, protein C/S, antithrombin III",
   "Surgery (laparotomy + bowel resection) if:",
   "  · Peritonitis",
   "  · Bowel infarction confirmed",
   "Chronic MVT complications:",
   "  · Variceal bleeding → endoscopic banding / TIPS",
   "  · Splenomegaly / hypersplenism → manage accordingly",
   "  · Portal hypertension management per severity",
 ],C.purple,11.5);
 ftr(s,"Schwartz 11e; Sabiston Textbook of Surgery");
}

// S30 SECOND-LOOK LAPAROTOMY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Second-Look Laparotomy");
 ttl(s,"Second-Look Laparotomy","Cornerstone of bowel preservation strategy");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.midBg}});
 s.addText("PRINCIPLE: Revascularize First → Resect Only Dead Bowel → Temp Closure → Second Look 24–48 hrs → Definitive Closure",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:12,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"First Operation",[
   "Midline laparotomy",
   "REVASCULARIZE FIRST — embolectomy or bypass",
   "Resect ONLY frankly necrotic or perforated bowel",
   "Questionable segments: LEAVE IN PLACE",
   "Leave bowel in DISCONTINUITY (no anastomosis in ischaemic bowel)",
   "Intraoperative Doppler confirms revascularisation",
   "Temporary abdominal closure device (VAC / Bogota bag)",
   "ICU care overnight",
 ],C.accent,12);
 cbox(s,5.15,2.12,4.5,3.3,"Second-Look Operation (24–48 hrs)",[
   "Reassess bowel viability after revascularization",
   "Previously questionable segments may RECOVER",
   "Further resection only of non-recovered segments",
   "Definitive anastomosis once viability confirmed",
   "Maximises bowel length preservation",
   "Endovascular approach: laparoscopic bowel check option for skilled surgeons",
   "May require multiple re-looks in severe cases",
   "Do NOT close abdomen primarily if bowel viability uncertain at 2nd look",
   "Goal: maximum bowel length saved",
 ],C.green,12);
 ftr(s,"Current Surgical Therapy 14e; Sabiston Textbook of Surgery");
}

// S31 BOWEL VIABILITY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Bowel Viability Assessment");
 ttl(s,"Assessing Bowel Viability Intraoperatively");
 cbox(s,0.35,1.52,4.6,2.1,"Clinical Assessment",[
   "Colour: pink/red = viable; black/green/grey = necrotic",
   "Peristalsis: present = good prognostic sign",
   "Mesenteric arterial pulsation",
   "Bowel wall turgor and thickness",
   "Subserosal haemorrhage = concerning",
 ],C.midBg,12.5);
 cbox(s,5.15,1.52,4.5,2.1,"Adjuncts to Assessment",[
   "Intraoperative Doppler: loss of signal = no flow",
   "IV fluorescein + Wood's lamp: fluorescence = viable",
   "On-table angiography in select cases",
   "Pulse oximetry applied to bowel wall",
 ],C.green,12.5);
 s.addText("Decision-Making Framework",{x:0.35,y:3.73,w:9.3,h:0.38,fontSize:14,bold:true,color:C.accent,fontFace:"Calibri"});
 bul(s,[
   "RESECT: frankly necrotic bowel (black, no Doppler signal, no fluorescein uptake, no peristalsis)",
   "PRESERVE: ALL viable and ALL questionable segments at first operation → reassess at second look",
   "RISK: Aggressive early resection → short bowel syndrome → lifelong parenteral nutrition — AVOID at all costs",
   "ANASTOMOSIS: defer until second look — never anastomose ischaemic bowel at first operation",
   "SHORT BOWEL THRESHOLD: < 100–150 cm of remaining small bowel = life-threatening short bowel syndrome",
 ],{y:4.12,h:1.38,fs:12.5});
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S32 DIVIDER — CMI
{const s=pres.addSlide(); divider(s,"Section 7 — Chronic Mesenteric Ischemia","Elective revascularization prevents acute catastrophe");}

// S33 CMI OVERVIEW & DIAGNOSIS
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"Chronic Mesenteric Ischemia",C.green);
 ttl(s,"Chronic Mesenteric Ischemia — Overview & Workup");
 cbox(s,0.35,1.52,4.6,1.9,"Aetiology",[
   "Atherosclerosis (most common) — aortic plaque spills into visceral orifice",
   "FMD, segmental arterial mediolysis (SAM), arteritis",
   "Takayasu, giant cell arteritis, polyarteritis nodosa, Behcet",
   "Median arcuate ligament compression of celiac axis",
   "Requires ≥ 2 of 3 vessels (celiac, SMA, IMA) for symptoms",
 ],C.green,12);
 cbox(s,5.15,1.52,4.5,1.9,"Treatment Goals",[
   "1. Durable restoration of normal nutrition — durable symptom relief",
   "2. Durable protection against visceral infarction",
   "Requires: accurate diagnosis + disease extent + optimal reconstruction",
 ],C.midBg,12.5);
 s.addText("Diagnostic Workup",{x:0.35,y:3.53,w:9.3,h:0.35,fontSize:14,bold:true,color:C.midBg,fontFace:"Calibri"});
 bul(s,[
   "Initial CT: exclude malignancy, assess gross anatomy",
   "Duplex ultrasound (fasting state): PSV ≥ 300 cm/s celiac / ≥ 400 cm/s SMA = hemodynamically significant",
   "CTA (1.25–2.0 mm, no oral contrast): gold standard — degree of collateralization provides inferential hemodynamic data",
   "MRA: alternative for CKD — excellent anatomy, no hemodynamic/calcification data",
   "Establish CAUSAL RELATIONSHIP: exclude other causes (endoscopy, motility studies, malabsorption workup)",
   "Hypoalbuminemia, anaemia: markers of prolonged malnutrition from CMI",
 ],{y:3.9,h:1.58,fs:12.5});
 ftr(s,"Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// S34 CMI ENDOVASCULAR
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"CMI — Endovascular Revascularization",C.green);
 ttl(s,"CMI — Endovascular Revascularization","First-line for most patients — 70–80% of CMI procedures");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.green}});
 s.addText("CMI incidence treated increased from 1.8 → 5.6 per million as endovascular expanded indications",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:12.5,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"Technique",[
   "Balloon-expandable COVERED stent: treatment of choice",
   "High radial force: pushes against calcified plaques",
   "Covered stent: traps plaque, prevents distal embolization",
   "Limits intimal hyperplasia to DISTAL end of stent only",
   "Stent longer than stenosis; projects 2–3 mm into aorta",
   "Ostial flare in aorta: key maneuver — improves patency",
   "Do NOT oversize (risk of vessel injury at aortic junction)",
   "Simple PTA: rarely used (poor response to calcified lesions)",
   "Median arcuate ligament: MUST release ligament first — stenting alone will fail",
   "Transfemoral or transbrachial access",
 ],C.green,12);
 cbox(s,5.15,2.12,4.5,3.3,"Outcomes & Durability",[
   "Technical success: 85–100%",
   "Perioperative mortality: 3–5%",
   "Composite complications: 15%",
   "Excellent short-term symptom relief",
   "Restenosis rate: up to 40%",
   "Reintervention: ~50% of those with restenosis",
   "Risk factors for restenosis: female sex, vessel < 6 mm, heavy calcification, long lesion, prior intervention",
   "Failed endovascular: rescue endovascular < 20% mortality",
   "(vs. redo open surgery: much higher mortality)",
   "Covered vs. bare metal stents: RCT currently ongoing",
 ],C.midBg,12);
 ftr(s,"Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// S35 CMI OPEN SURGERY
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"CMI — Open Surgical Revascularization");
 ttl(s,"CMI — Open Surgical Revascularization","Superior long-term durability; higher perioperative risk");
 cbox(s,0.35,1.52,4.6,3.95,"Surgical Techniques",[
   "ANTEGRADE BYPASS (supraceliac inflow):",
   "  · Bifurcated Dacron 12×6 or 14×7 cm for celiac + SMA",
   "  · Less kinking; less atherosclerotic burden in supraceliac aorta",
   "  · Younger/fitter patients (supraceliac cross-clamp stress)",
   "  · Transperitoneal or retroperitoneal (60-degree LLD position)',",
   "RETROGRADE BYPASS (infrarenal/iliac inflow):",
   "  · C-loop configuration prevents kinking",
   "  · PTFE, Dacron, or cryopreserved vein",
   "  · End-to-side anastomosis to SMA distal to occlusion',",
   "TRANSAORTIC ENDARTERECTOMY:",
   "  · Trapdoor aortotomy + visceral orifice endarterectomy',",
   "  · BEST for short focal ostial lesions (first 1–2 cm)',",
   "  · Transmural calcification: CONTRAINDICATION',",
   "  · Hockey-stick extension if renal artery involvement',",
 ],C.midBg,11.5);
 cbox(s,5.15,1.52,4.5,3.95,"Open vs. Endovascular Direct Comparison",[
   "Open technical success: 97–100%",
   "Endovascular success: 85–100%",
   "Open perioperative mortality: ~10–13%",
   "Endovascular mortality: ~3–5%",
   "MACE: open 16% vs. endo 8%",
   "Composite complications: open 20% vs. endo 15%",
   "Open: BETTER long-term patency",
   "5-year primary patency: open ~80–85% vs. endo ~40–60%",
   "Endovascular: restenosis up to 40%; reintervention ~20%",
   "Open reserved for: younger patients, failed endo, complex anatomy, good surgical risk",
   "Malnourished/frail: endovascular first (lower perioperative risk)",
 ],C.green,11.5);
 ftr(s,"Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// S36 CMI SURVEILLANCE
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.green); tag(s,"CMI — Postoperative Surveillance",C.green);
 ttl(s,"CMI — Postoperative Care, Surveillance & Outcomes");
 cbox(s,0.35,1.52,4.6,2.1,"Postoperative Nutrition",[
   "Begin oral feeding as symptoms allow",
   "Nutritional rehabilitation often prolonged (malnourished patients)",
   "Parenteral/enteral nutrition if bowel cannot be used immediately",
   "Monitor albumin, pre-albumin, weight regularly",
   "Dietitian essential part of team",
 ],C.green,12.5);
 cbox(s,5.15,1.52,4.5,2.1,"Surveillance Protocol",[
   "Duplex ultrasound: 1 month, 6 months, then annually",
   "CTA/MRA if ultrasound suggests restenosis",
   "Symptom monitoring: return of postprandial pain = restenosis until proven otherwise",
   "Endovascular: higher surveillance frequency (higher restenosis rate)",
 ],C.midBg,12.5);
 cbox(s,0.35,3.75,4.6,1.72,"Postoperative Complications",[
   "Graft thrombosis (early: technical; late: restenosis)",
   "Wound infection, anastomotic complications",
   "Renal failure (contrast nephropathy, aortic cross-clamp)",
   "Cardiac events (high comorbidity burden in CMI)",
   "Bowel infarction if revascularisation fails",
 ],C.accent,12);
 cbox(s,5.15,3.75,4.5,1.72,"Long-Term Outcomes",[
   "Open 5-year primary patency: ~80–85%",
   "Endovascular 5-year primary patency: ~40–60%",
   "Symptom-free survival: excellent with durable revascularisation",
   "Failed revascularisation: return of CMI → acute risk",
   "Re-do open surgery: high mortality — endovascular rescue preferred',",
 ],C.green,12);
 ftr(s,"Current Surgical Therapy 14e — Linda M. Reilly MD");
}

// S37 DIVIDER — COMPLICATIONS & SPECIAL
{const s=pres.addSlide(); divider(s,"Section 8 — Complications & Special Scenarios","Short bowel syndrome, dissection, ischemic colitis");}

// S38 SHORT BOWEL SYNDROME
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s,C.accent); tag(s,"Complication — Short Bowel Syndrome",C.accent);
 ttl(s,"Short Bowel Syndrome — The Feared Consequence");
 s.addShape(pres.ShapeType.rect,{x:0.35,y:1.52,w:9.3,h:0.48,fill:{color:C.accent}});
 s.addText("< 100–150 cm of remaining small bowel = Short Bowel Syndrome — lifelong parenteral nutrition dependency",{x:0.5,y:1.54,w:9.0,h:0.44,fontSize:12.5,color:C.white,bold:true,valign:"middle",align:"center"});
 cbox(s,0.35,2.12,4.6,3.3,"Prevention — Surgical Strategy",[
   "REVASCULARIZE FIRST — before any resection",
   "Preserve ALL questionable bowel segments at first operation",
   "Second-look at 24–48 hrs allows recovery of marginal segments",
   "Never resect more than absolutely necessary",
   "Multiple re-looks if viability remains uncertain",
   "High-quality post-revascularization Doppler confirmation",
   "Aggressive early diagnosis to minimise ischemia time",
   "Principle: REVASCULARIZE → PRESERVE → REASSESS",
 ],C.accent,12.5);
 cbox(s,5.15,2.12,4.5,3.3,"Management of Established SBS",[
   "Parenteral nutrition (PN) — long-term home PN",
   "Enteral nutrition: stimulate bowel adaptation even in SBS",
   "Teduglutide (GLP-2 analogue): promotes intestinal adaptation, reduces PN requirements",
   "Anti-motility agents: loperamide, codeine",
   "Acid suppression (PPIs): reduce hypersecretion",
   "Small bowel transplantation: PN-dependent SBS with complications",
   "STEP procedure (serial transverse enteroplasty): dilated bowel",
   "Bianchi procedure: bowel lengthening",
   "Multidisciplinary team: nutrition, GI, surgery",
 ],C.midBg,12.5);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S39 SPECIAL SCENARIOS
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Special Clinical Scenarios");
 ttl(s,"Special Clinical Scenarios");
 cbox(s,0.35,1.52,4.6,1.88,"Spontaneous Isolated SMA Dissection (SISMAD)",[
   "Rare (0.06%); males, East Asian descent (Korean/Japanese/Chinese)",
   "Location: 1–3 cm from SMA ostium (fixed-to-mobile transition point)",
   "CTA: dissection flap, false lumen, aneurysm, rupture assessment",
   "Asymptomatic: antiplatelet therapy | Mild symptoms: anticoagulation | Persistent pain: endovascular stenting",
 ],C.purple,11.5);
 cbox(s,5.15,1.52,4.5,1.88,"Aortic Dissection + Mesenteric Extension",[
   "Type A or B dissection extending to SMA/celiac origin",
   "True lumen compression → mesenteric ischemia",
   "Management: address underlying dissection (surgical / TEVAR)",
   "Fenestration or visceral vessel stenting if persistent occlusion",
 ],C.accent,11.5);
 cbox(s,0.35,3.52,4.6,2.0,"Ischemic Colitis",[
   "Most common form of intestinal ischemia",
   "Watershed areas: splenic flexure, rectosigmoid junction",
   "Usually transient and self-limiting (non-gangrenous form)",
   "Causes: post-aortic surgery, low-flow states, medications, vasculitis",
   "Management: supportive care; surgery for gangrene/perforation only",
 ],C.amber,11.5);
 cbox(s,5.15,3.52,4.5,2.0,"Post-AMI Long-Term Follow-up",[
   "Long-term anticoagulation for embolic source",
   "Address cardiac disease (AF rhythm control/ablation)",
   "Statin therapy for atherosclerotic disease",
   "Nutritional rehabilitation + dietitian follow-up",
   "Surveillance imaging: 1 month, 6 months, annually",
   "Psychological support for altered eating habits",
 ],C.green,11.5);
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e");
}

// S40 OUTCOMES
{const s=pres.addSlide();
 s.background={color:C.white}; topBar(s); tag(s,"Outcomes Summary");
 ttl(s,"Outcomes — Comprehensive Summary");
 const stats=[
   {val:"17–21%",lbl:"Overall AMI\nMortality",col:C.accent},
   {val:"> 70%",lbl:"Mortality if\nICU-Admitted",col:"7B0000"},
   {val:"77%",lbl:"Thrombotic\n(untreated)",col:C.accent},
   {val:"54%",lbl:"Embolic\n(untreated)",col:"B23030"},
   {val:"33%",lbl:"Open Repair\nMortality 2010",col:C.midBg},
   {val:"15%",lbl:"Endovascular\nMortality 2010",col:C.slate},
 ];
 stats.forEach((st,i)=>{
   const x=0.28+i*1.6;
   s.addShape(pres.ShapeType.rect,{x,y:1.52,w:1.5,h:1.45,fill:{color:st.col}});
   s.addText(st.val,{x,y:1.55,w:1.5,h:0.7,fontSize:21,bold:true,color:C.white,align:"center",valign:"middle"});
   s.addText(st.lbl,{x,y:2.24,w:1.5,h:0.7,fontSize:9.5,color:C.white,align:"center",valign:"top"});
 });
 s.addText("Factors That Determine Outcome",{x:0.35,y:3.12,w:9.3,h:0.36,fontSize:14,bold:true,color:C.midBg,fontFace:"Calibri"});
 bul(s,[
   "Time to diagnosis: most critical single factor — every hour of delay worsens survival",
   "Presence of peritonitis at presentation: dramatically worsens prognosis",
   "Bowel viability and extent of resection: risk of short bowel syndrome",
   "Etiology: thrombotic > embolic mortality (proximal location = larger territory)",
   "NOMI: highest mortality — compounds underlying critical illness",
   "CMI: untreated = precursor to acute catastrophe; successfully treated = excellent long-term outcomes",
 ],{y:3.5,h:1.98,fs:12.5});
 ftr(s,"Sabiston Textbook of Surgery; Current Surgical Therapy 14e; Schwartz 11e");
}

// S41 KEY MESSAGES
{const s=pres.addSlide();
 s.background={color:C.darkBg};
 s.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.18,h:5.625,fill:{color:C.accent}});
 s.addText("KEY MESSAGES",{x:0.45,y:0.15,w:9.2,h:0.38,fontSize:10,bold:true,color:C.accent,charSpacing:3});
 s.addText("Mesenteric Ischemia — Surgical Take-Aways",{x:0.45,y:0.55,w:9.2,h:0.55,fontSize:22,bold:true,color:C.white});
 const msgs=[
   {n:"01",c:C.accent, t:"Pain OUT OF PROPORTION to examination = AMI until proven otherwise. High index of suspicion is the first life-saving step."},
   {n:"02",c:C.accent, t:"No laboratory test can exclude AMI. CT angiography biphasic is the gold standard — specificity > 97% for key findings."},
   {n:"03",c:C.amber,  t:"PERITONITIS = Emergent laparotomy. Do NOT delay for imaging when peritonism is present."},
   {n:"04",c:C.green,  t:"REVASCULARIZE FIRST. Resect only frankly necrotic bowel. Second-look at 24–48 hrs preserves maximum bowel length."},
   {n:"05",c:C.green,  t:"Embolism → open embolectomy. Thrombosis → bypass. NOMI → papaverine + treat cause. MVT → anticoagulate."},
   {n:"06",c:C.amber,  t:"Vasopressors worsen mesenteric ischemia. Prefer dobutamine/milrinone when hemodynamic support is unavoidable."},
   {n:"07",c:C.green,  t:"CMI: postprandial pain + food fear + weight loss = CMI until excluded. Requires ≥ 2 vessel disease. Treat electively."},
   {n:"08",c:C.amber,  t:"Endovascular is first-line for CMI (lower periop risk); open surgery gives better durability. Lifelong surveillance mandatory."},
 ];
 msgs.forEach((m,i)=>{
   const y=1.2+i*0.54;
   s.addShape(pres.ShapeType.rect,{x:0.45,y,w:0.5,h:0.44,fill:{color:m.c}});
   s.addText(m.n,{x:0.45,y,w:0.5,h:0.44,fontSize:13,bold:true,color:C.white,align:"center",valign:"middle"});
   s.addText(m.t,{x:1.05,y:y+0.03,w:8.6,h:0.4,fontSize:11.5,color:C.white,valign:"middle",fontFace:"Calibri"});
 });
}

// WRITE
pres.writeFile({fileName:"/home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surgery_v2.pptx"})
  .then(()=>console.log("Done"))
  .catch(e=>{console.error(e);process.exit(1);});
Running Command

cd /home/daytona/workspace/mesenteric-ischemia-ppt && node build_v2.js 2>&1

Running Command

ls -lh /home/daytona/workspace/mesenteric-ischemia-ppt/Mesenteric_Ischemia_Surge…

Here is your expanded presentation:

Mesenteric Ischemia Surgery v2

Presentation · PPTX


The deck has been expanded from 17 to 41 slides, structured across 8 sections with section divider slides. Here is the full breakdown designed for a 45-minute talk:
SectionSlidesApprox. Time
1 — Intro & EpidemiologyS1–S6~6 min
2 — Vascular AnatomyS7–S9~4 min
3 — Classification & PathophysiologyS10–S14~6 min
4 — Clinical PresentationS15–S18~5 min
5 — Diagnosis & InvestigationsS19–S22~5 min
6 — Management of AMIS23–S31~10 min
7 — Chronic Mesenteric IschemiaS32–S36~6 min
8 — Complications & Special ScenariosS37–S41~3 min
New slides added compared to v1:
  • Historical milestones timeline (Chienne 1869 → present)
  • Separate deep-dive slides for embolic vs. thrombotic AMI differences
  • NOMI & MVT pathophysiology in detail
  • Differential diagnosis slide
  • Vasopressor considerations & medical management
  • Step-by-step open SMA embolectomy
  • Open bypass (antegrade + retrograde + endarterectomy) detail
  • Bowel viability assessment methods
  • CMI imaging workup and duplex velocity thresholds
  • CMI surveillance protocol and long-term outcomes
  • Short bowel syndrome prevention and management
  • Special scenarios: SISMAD, aortic dissection, ischemic colitis, post-AMI follow-up
This is a shared conversation. Sign in to Orris to start your own chat.