describe all details on moisturizers in a ppt with diagrams

Checking Date & Time
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Searching Images

skin moisturizer mechanism layers hydration diagram

Reading File
Searching Images

moisturizer ingredients emollient humectant occlusive cosmetic formulation

Reading File
Searching Images

stratum corneum skin barrier structure ceramide lipid bilayer

Reading File
Searching Images

types of moisturizer lotion cream ointment gel formulation comparison

Reading File
Running Command

ls -la /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/moisturizers-ppt

Running Command

mkdir -p /home/daytona/workspace/moisturizers-ppt && echo "Done"

Writing File

~/moisturizers-ppt/build.js

const pptxgen = require("pptxgenjs");

// ─── Fetch images ─────────────────────────────────────────────────────────────
const { execSync } = require("child_process");

const imageUrls = [
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_a2de77728d03cbeca9e8770fc1f014aa891450b443c440f1d344374b04c14860.jpg",  // TEWL / stratum corneum hydration
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_587e7a3ccf41d18068c66e383542b6a3b9673bcd75e5f9f70475bc33eaf44c17.jpg",  // Infant vs adult TEWL
  "https://cdn.orris.care/cdss_images/e6941ec9c2389acc849bd882c99698ff633be692c3e282b2e692497d3af7f676.png",           // Stearic vs oleic acid
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_009bd26791d505f0fb284655ee740367abac87446bdcc28494ce3c331b379828.jpg",  // Liposome / skin penetration
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_6f7f01862e0b574e0c4bc47e059a6a1fc710cf6f43531ef945d9add18adf9b3f.jpg",  // Ceramide in SC
];

console.log("Fetching images...");
let images = [];
try {
  const raw = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  images = JSON.parse(raw);
} catch (e) {
  console.error("Image fetch error:", e.message);
  images = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}
console.log("Images fetched:", images.map(i => i.error || "OK"));

// ─── Color Palette ─────────────────────────────────────────────────────────────
const C = {
  bg:       "0F2A44",  // deep navy (dominant)
  bg2:      "162F4A",  // slightly lighter navy
  accent:   "00B4D8",  // sky blue
  accent2:  "48CAE4",  // lighter blue
  gold:     "F6C90E",  // golden yellow accent
  white:    "FFFFFF",
  light:    "D9EAF7",  // soft text
  gray:     "8FA8C0",
  teal:     "0096C7",
  darktext: "0A1628",
  green:    "2EC4B6",
  red:      "FF6B6B",
  orange:   "FF9F1C",
};

// ─── Helper ────────────────────────────────────────────────────────────────────
function addSlide(pres) { return pres.addSlide(); }

function slideHeader(slide, text, sub) {
  // accent bar top
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: C.accent } });
  slide.addText(text, {
    x: 0.5, y: 0.15, w: 9, h: 0.65,
    fontSize: 28, bold: true, color: C.white, fontFace: "Calibri", margin: 0
  });
  if (sub) {
    slide.addText(sub, {
      x: 0.5, y: 0.82, w: 9, h: 0.38,
      fontSize: 13, color: C.accent, fontFace: "Calibri", italic: true, margin: 0
    });
  }
  slide.addShape(pres.ShapeType.line, {
    x: 0.5, y: 1.22, w: 9, h: 0,
    line: { color: C.accent, width: 1.5 }
  });
}

function bg(slide) {
  slide.background = { color: C.bg };
}

// ─── Presentation ──────────────────────────────────────────────────────────────
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Moisturizers – A Complete Guide";

// ══════════════════════════════════════════════════════════════
// SLIDE 1 – Title Slide
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: C.bg };

  // large decorative circle
  slide.addShape(pres.ShapeType.ellipse, {
    x: 7.2, y: -0.8, w: 4, h: 4,
    fill: { color: C.accent, transparency: 80 }, line: { color: C.accent, width: 0 }
  });
  slide.addShape(pres.ShapeType.ellipse, {
    x: 7.8, y: -0.3, w: 2.5, h: 2.5,
    fill: { color: C.gold, transparency: 75 }, line: { color: C.gold, width: 0 }
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.accent } });

  slide.addText("MOISTURIZERS", {
    x: 0.5, y: 1.0, w: 9, h: 1.1,
    fontSize: 54, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 4
  });
  slide.addText("A Complete Clinical & Cosmetic Guide", {
    x: 0.5, y: 2.15, w: 8, h: 0.55,
    fontSize: 20, color: C.accent, fontFace: "Calibri", italic: true
  });

  slide.addShape(pres.ShapeType.rect, { x: 0.5, y: 2.9, w: 4.5, h: 0.04, fill: { color: C.gold } });

  const topics = [
    "Skin Barrier & TEWL", "Types & Formulations", "Active Ingredients",
    "Mechanism of Action", "Clinical Indications", "Selection & Application"
  ];
  const cols = 3, rows = 2, bw = 2.8, bh = 0.55, bx0 = 0.5, by0 = 3.2, gap = 0.2;
  topics.forEach((t, i) => {
    const col = i % cols, row = Math.floor(i / cols);
    const bx = bx0 + col * (bw + gap);
    const by = by0 + row * (bh + 0.12);
    slide.addShape(pres.ShapeType.rect, {
      x: bx, y: by, w: bw, h: bh,
      fill: { color: C.accent, transparency: 78 },
      line: { color: C.accent, width: 1 }, rectRadius: 0.08
    });
    slide.addText(t, {
      x: bx + 0.1, y: by, w: bw - 0.2, h: bh,
      fontSize: 11.5, color: C.white, fontFace: "Calibri", align: "center", valign: "middle"
    });
  });

  slide.addText("Sources: Fitzpatrick's Dermatology 9e · Dermatology 2-Volume Set 5e", {
    x: 0.5, y: 5.2, w: 9, h: 0.3,
    fontSize: 9, color: C.gray, fontFace: "Calibri", italic: true
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 2 – What is a Moisturizer?
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "What is a Moisturizer?", "Definition, Purpose & Classification");

  const defText = `A moisturizer is a topical formulation designed to improve skin hydration, restore barrier integrity, and reduce transepidermal water loss (TEWL). They are among the most widely used topical preparations in both cosmetic and clinical dermatology.`;
  slide.addShape(pres.ShapeType.rect, {
    x: 0.4, y: 1.35, w: 9.2, h: 1.05,
    fill: { color: C.accent, transparency: 85 }, line: { color: C.accent, width: 1 }
  });
  slide.addText(defText, {
    x: 0.6, y: 1.38, w: 8.8, h: 1.0,
    fontSize: 12.5, color: C.light, fontFace: "Calibri", valign: "middle"
  });

  const categories = [
    { label: "Emollients", icon: "💧", color: C.teal, desc: "Smooth & soften skin by filling gaps between corneocytes" },
    { label: "Occlusives", icon: "🛡️", color: C.accent2, desc: "Form a physical barrier on skin surface to reduce TEWL" },
    { label: "Humectants", icon: "🌊", color: C.gold, desc: "Attract water from atmosphere or deeper skin layers" },
    { label: "Barrier Repair", icon: "🔧", color: C.green, desc: "Restore the lipid matrix: ceramides, fatty acids, cholesterol (1:1:1)" },
  ];

  categories.forEach((cat, i) => {
    const x = 0.4 + i * 2.3;
    slide.addShape(pres.ShapeType.rect, {
      x, y: 2.6, w: 2.15, h: 2.6,
      fill: { color: cat.color, transparency: 80 },
      line: { color: cat.color, width: 2 }, rectRadius: 0.1
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y: 2.6, w: 2.15, h: 0.6,
      fill: { color: cat.color, transparency: 30 },
      line: { color: cat.color, width: 0 }, rectRadius: 0.0
    });
    slide.addText(cat.icon + "  " + cat.label, {
      x: x + 0.08, y: 2.62, w: 2.0, h: 0.55,
      fontSize: 13.5, bold: true, color: C.darktext, fontFace: "Calibri", valign: "middle"
    });
    slide.addText(cat.desc, {
      x: x + 0.1, y: 3.25, w: 1.95, h: 1.85,
      fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top"
    });
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 3 – Skin Barrier & TEWL (with diagram)
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Skin Barrier & Transepidermal Water Loss (TEWL)", "Understanding the physiology moisturizers target");

  // left text
  const points = [
    { bold: "Stratum Corneum (SC)", text: " — the outermost skin layer acts as the primary barrier, arranged in a 'bricks-and-mortar' pattern of corneocytes in a lipid matrix." },
    { bold: "TEWL", text: " — water diffuses upward through the SC and evaporates from the skin surface. Elevated TEWL indicates a compromised barrier." },
    { bold: "Lipid Matrix", text: " — ceramides, free fatty acids, and cholesterol in a 1:1:1 molar ratio maintain barrier integrity." },
    { bold: "NMF", text: " — Natural Moisturising Factor (amino acids, urea, PCA) within corneocytes retains water." },
    { bold: "AQP3", text: " — Aquaporin-3 channels in the epidermis regulate water transport; glycerin traverses these channels for lasting hydration." },
  ];
  const richPoints = points.map((p, i) => [
    { text: `${i + 1}. `, options: { bold: true, color: C.gold, fontSize: 12, breakLine: false } },
    { text: p.bold, options: { bold: true, color: C.accent, fontSize: 12, breakLine: false } },
    { text: p.text + "\n", options: { color: C.light, fontSize: 12 } },
  ]).flat();

  slide.addText(richPoints, {
    x: 0.4, y: 1.35, w: 5.2, h: 4.1,
    fontFace: "Calibri", valign: "top"
  });

  // right image – TEWL / stratum corneum
  if (images[0] && images[0].base64) {
    slide.addImage({ data: images[0].base64, x: 5.85, y: 1.3, w: 3.8, h: 2.9 });
    slide.addText("Stratum corneum water diffusion gradient & TEWL", {
      x: 5.85, y: 4.22, w: 3.8, h: 0.35,
      fontSize: 9, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
    });
  }
  // small stearic/oleic acid image
  if (images[2] && images[2].base64) {
    slide.addImage({ data: images[2].base64, x: 5.85, y: 4.6, w: 3.8, h: 0.85 });
    slide.addText("Stearic acid (straight) vs Oleic acid (kinked) lipid packing in SC", {
      x: 5.85, y: 5.47, w: 3.8, h: 0.2,
      fontSize: 8, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
    });
  }

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 4 – Types of Moisturizer Formulations
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Types of Moisturizer Formulations", "Ointments · Creams · Lotions · Serums · Gels");

  const types = [
    {
      name: "Ointments",
      eg: "e.g. Petrolatum, Aquaphor",
      color: C.gold,
      props: ["Highest lipid content", "Strongest occlusive barrier", "Typically preservative-free", "Best for severely dry skin", "Less cosmetically acceptable (greasy)"]
    },
    {
      name: "Creams",
      eg: "e.g. Eucerin, CeraVe cream",
      color: C.accent,
      props: ["Oil-in-water or W/O emulsions", "Good occlusive + emollient", "Cosmetically acceptable", "May contain preservatives", "Suitable for moderate xerosis"]
    },
    {
      name: "Lotions",
      eg: "e.g. Cetaphil, Lubriderm",
      color: C.green,
      props: ["High water content", "Light, non-greasy feel", "Easier to spread", "Less occlusive", "Not ideal for severe dry skin"]
    },
    {
      name: "Serums / Gels",
      eg: "e.g. HA serums, Aloe gel",
      color: C.accent2,
      props: ["Lightweight, water-based", "High humectant content", "Good for oily/acne-prone skin", "Less occlusive", "Often contain actives (HA, niacinamide)"]
    },
  ];

  types.forEach((t, i) => {
    const x = 0.3 + i * 2.38;
    const y = 1.4;
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 2.2, h: 3.9,
      fill: { color: t.color, transparency: 82 },
      line: { color: t.color, width: 2 }, rectRadius: 0.12
    });
    // header bar
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 2.2, h: 0.72,
      fill: { color: t.color, transparency: 35 },
      line: { color: t.color, width: 0 }, rectRadius: 0.12
    });
    slide.addText(t.name, {
      x: x + 0.08, y: y + 0.05, w: 2.05, h: 0.4,
      fontSize: 15, bold: true, color: C.darktext, fontFace: "Calibri", align: "center", valign: "middle"
    });
    slide.addText(t.eg, {
      x: x + 0.06, y: y + 0.43, w: 2.1, h: 0.3,
      fontSize: 9.5, color: C.darktext, fontFace: "Calibri", italic: true, align: "center"
    });

    const bullets = t.props.map((p, pi) => ({
      text: p,
      options: { bullet: pi < t.props.length - 1 ? { indent: 12 } : { indent: 12 }, breakLine: true, color: C.white, fontSize: 10.5, fontFace: "Calibri" }
    }));
    slide.addText(bullets, {
      x: x + 0.1, y: y + 0.78, w: 2.0, h: 3.0,
      fontFace: "Calibri", valign: "top"
    });
  });

  // bottom note
  slide.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 5.3, w: 9.4, h: 0.28,
    fill: { color: C.teal, transparency: 75 }, line: { color: C.teal, width: 1 }
  });
  slide.addText("💡  Ointments > Creams > Lotions in occlusive strength. For AD, ointments or thick creams are preferred. Oily/acne-prone: gels or serums.", {
    x: 0.4, y: 5.31, w: 9.2, h: 0.26,
    fontSize: 10, color: C.light, fontFace: "Calibri", italic: true
  });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 5 – Mechanism of Action (with diagram)
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Mechanisms of Action", "How moisturizers hydrate and protect the skin");

  // 3 mechanism boxes with arrows
  const mechs = [
    {
      title: "① OCCLUSION",
      color: C.accent2,
      text: "Forms a physical film on the skin surface.\n\nReduces TEWL by coating the SC (petrolatum = 170× more effective than olive oil).\n\nEffective only while present; TEWL returns after removal.\n\n⚠ >40% reduction in TEWL can cause maceration."
    },
    {
      title: "② HUMECTANCY",
      color: C.gold,
      text: "Hygroscopic molecules (glycerin, hyaluronic acid, urea) absorb water from the environment or deeper dermis.\n\nBest when humidity >80%.\n\nIn low humidity, may worsen dryness — must combine with occlusives.\n\nCause slight SC swelling → perception of fewer wrinkles."
    },
    {
      title: "③ BARRIER REPAIR",
      color: C.green,
      text: "Delivers physiological lipids (ceramides, fatty acids, cholesterol) in 1:1:1 molar ratio to restore the lamellar lipid bilayer.\n\nGlycerol traverses AQP3 channels → longer-lasting hydration.\n\nPseudoceramides in MLE formulations mimic the 3D barrier structure.\n\nOnly this class corrects underlying barrier defects."
    },
  ];

  mechs.forEach((m, i) => {
    const x = 0.28 + i * 3.18;
    slide.addShape(pres.ShapeType.rect, {
      x, y: 1.35, w: 2.95, h: 3.9,
      fill: { color: m.color, transparency: 80 },
      line: { color: m.color, width: 2 }, rectRadius: 0.1
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y: 1.35, w: 2.95, h: 0.55,
      fill: { color: m.color, transparency: 30 }, line: { color: m.color, width: 0 }
    });
    slide.addText(m.title, {
      x: x + 0.06, y: 1.38, w: 2.83, h: 0.5,
      fontSize: 14, bold: true, color: C.darktext, fontFace: "Calibri", align: "center", valign: "middle"
    });
    slide.addText(m.text, {
      x: x + 0.1, y: 1.98, w: 2.75, h: 3.2,
      fontSize: 11, color: C.white, fontFace: "Calibri", valign: "top"
    });

    // arrow between boxes
    if (i < 2) {
      slide.addShape(pres.ShapeType.rect, {
        x: x + 3.02, y: 3.1, w: 0.1, h: 0.28,
        fill: { color: C.white, transparency: 60 }, line: { color: C.white, width: 0 }
      });
    }
  });

  // image: liposome/skin penetration
  if (images[3] && images[3].base64) {
    slide.addImage({ data: images[3].base64, x: 0.28, y: 5.0, w: 4.5, h: 0.6 });
  }
  slide.addText("Lipid nanocarriers enhance skin penetration of barrier-repair actives", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.22,
    fontSize: 9, color: C.gray, fontFace: "Calibri", italic: true
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 6 – Key Ingredients
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Key Active Ingredients", "Occlusives · Humectants · Emollients · Anti-inflammatories");

  const cols = [
    {
      title: "OCCLUSIVES",
      color: C.accent2,
      items: ["Petrolatum", "Paraffin wax", "Dimethicone (silicone)", "Squalene", "Lanolin", "Beeswax", "Grape-seed oil", "Soybean oil", "Propylene glycol"]
    },
    {
      title: "HUMECTANTS",
      color: C.gold,
      items: ["Glycerin (also barrier repair via AQP3)", "Sodium hyaluronate / HA", "Urea", "Sorbitol", "α-Hydroxy acids (lactic, glycolic)", "Propylene glycol", "Sugars", "Heparan sulfate analog"]
    },
    {
      title: "EMOLLIENTS",
      color: C.green,
      items: ["Ceramides", "Free fatty acids", "Cholesterol", "Shea butter", "Jojoba oil", "Isopropyl myristate*", "Dimethicone", "*Comedogenic — avoid in acne"]
    },
    {
      title: "ANTI-INFLAM.",
      color: C.red,
      items: ["Aloe vera", "Colloidal oatmeal", "Niacinamide", "Green tea extract", "Chamomile", "Argan oil", "Licorice extract", "Bisabolol", "Feverfew"]
    },
  ];

  cols.forEach((col, i) => {
    const x = 0.3 + i * 2.38;
    slide.addShape(pres.ShapeType.rect, {
      x, y: 1.35, w: 2.2, h: 3.95,
      fill: { color: col.color, transparency: 82 },
      line: { color: col.color, width: 2 }, rectRadius: 0.1
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y: 1.35, w: 2.2, h: 0.55,
      fill: { color: col.color, transparency: 30 }, line: { color: col.color, width: 0 }
    });
    slide.addText(col.title, {
      x: x + 0.05, y: 1.37, w: 2.1, h: 0.5,
      fontSize: 12.5, bold: true, color: C.darktext, fontFace: "Calibri", align: "center", valign: "middle"
    });
    const bullets = col.items.map((item, j) => ({
      text: (item.startsWith("*") ? item : "• " + item),
      options: {
        breakLine: true,
        color: item.startsWith("*") ? C.red : C.light,
        fontSize: 10.5, fontFace: "Calibri",
        italic: item.startsWith("*")
      }
    }));
    slide.addText(bullets, {
      x: x + 0.1, y: 1.95, w: 2.0, h: 3.2,
      fontFace: "Calibri", valign: "top"
    });
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 7 – Ceramides & Barrier Repair (with diagram)
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Ceramides & Barrier Repair", "The lipid trio restoring skin integrity");

  // text left
  const leftPoints = [
    { h: "Ceramides in the SC:", t: "Ceramides are the dominant lipids in the stratum corneum's lamellar bodies. They form the mortar between corneocyte bricks." },
    { h: "The 1:1:1 Ratio:", t: "Optimal barrier function requires ceramides : cholesterol : free fatty acids in a 1:1:1 molar ratio. Deviation causes barrier disruption." },
    { h: "Pseudoceramides:", t: "Modern barrier repair formulations use pseudoceramides in a multilamellar emulsion (MLE) that mimics the skin's natural 3D lamellar structure." },
    { h: "Exogenous Ceramide:", t: "Topically applied ceramide is primarily localised to the superficial SC and furrows, with limited penetration to deeper layers." },
    { h: "Clinical Use:", t: "Ceramide-containing moisturizers are first-line for atopic dermatitis, eczema, ichthyosis, and barrier-deficient skin." },
  ];
  const richLeft = leftPoints.map(p => [
    { text: p.h + "  ", options: { bold: true, color: C.accent, fontSize: 12, breakLine: false } },
    { text: p.t + "\n\n", options: { color: C.light, fontSize: 11.5, breakLine: false } }
  ]).flat();
  slide.addText(richLeft, {
    x: 0.4, y: 1.35, w: 5.0, h: 4.1, fontFace: "Calibri", valign: "top"
  });

  // right image – ceramide in SC
  if (images[4] && images[4].base64) {
    slide.addImage({ data: images[4].base64, x: 5.7, y: 1.32, w: 4.0, h: 3.1 });
    slide.addText("Exogenous ceramide distribution in stratum corneum (ToF-SIMS imaging)", {
      x: 5.7, y: 4.45, w: 4.0, h: 0.3,
      fontSize: 8.5, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
    });
  }

  slide.addShape(pres.ShapeType.rect, {
    x: 0.4, y: 4.85, w: 9.2, h: 0.55,
    fill: { color: C.teal, transparency: 75 }, line: { color: C.teal, width: 1 }
  });
  slide.addText("💡 Barrier repair moisturizers are the ONLY class that corrects underlying barrier defects. Humectants and occlusives provide only temporary relief.", {
    x: 0.55, y: 4.88, w: 9.0, h: 0.48,
    fontSize: 11, color: C.light, fontFace: "Calibri", italic: true, valign: "middle"
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 8 – Clinical Indications & Skin Type Selection
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Clinical Indications & Skin Type Selection", "Matching the right moisturizer to patient needs");

  const table = [
    ["Skin / Condition", "Recommended Type", "Key Ingredients", "Avoid"],
    ["Dry skin", "Barrier repair cream/ointment", "Ceramides, FA, cholesterol (1:1:1)", "Harsh surfactants"],
    ["Oily skin", "Lightweight lotion / serum", "Hyaluronic acid, heparan sulfate", "Heavy creams, oils"],
    ["Atopic dermatitis", "Thick cream or ointment", "Ceramides, petrolatum, colloidal oatmeal", "Fragrances, food allergens"],
    ["Acne-prone skin", "Non-comedogenic lotion/gel", "HA, niacinamide, glycerin", "Isopropyl myristate, coconut oil"],
    ["Rosacea", "Antiinflammatory moisturizer", "Argan oil, chamomile, niacinamide, green tea", "Alcohol, low-pH acids"],
    ["Post-procedure / peels", "Petrolatum / thick emollient", "Petrolatum (Aquaphor)", "Fragrances, actives"],
    ["Sensitive / stinging skin", "Hypoallergenic, fragrance-free", "Bisabolol, chamomile, colloidal oatmeal", "Glycolic acid, SLS, urea"],
  ];

  const colW = [2.1, 2.3, 2.8, 2.3];
  const rowH = Array(table.length).fill(0.54);
  rowH[0] = 0.48;

  slide.addTable(table.map((row, ri) =>
    row.map((cell, ci) => ({
      text: cell,
      options: {
        bold: ri === 0,
        color: ri === 0 ? C.darktext : C.light,
        fontSize: ri === 0 ? 11 : 10.5,
        fill: ri === 0
          ? { color: C.accent }
          : ci === 3
            ? { color: C.red, transparency: 80 }
            : ri % 2 === 0
              ? { color: C.bg2 }
              : { color: C.bg },
        fontFace: "Calibri",
        align: ci === 0 ? "left" : "left",
        valign: "middle",
        margin: [0, 6, 0, 6]
      }
    }))
  ), {
    x: 0.28, y: 1.35,
    w: 9.44,
    colW,
    rowH
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 9 – Application Tips & Dosing
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Application Tips & Dosing Guidelines", "Maximising efficacy in clinical practice");

  const tips = [
    {
      num: "01",
      title: "Apply to Damp Skin",
      color: C.accent,
      text: "Apply immediately after bathing/washing while skin is slightly damp to trap moisture in the stratum corneum ('soak and seal' method)."
    },
    {
      num: "02",
      title: "Frequency",
      color: C.gold,
      text: "Apply at least 2–3× daily. For AD: weekly use of 150–200 g in young children; 250–500 g in older children/adults recommended."
    },
    {
      num: "03",
      title: "Layering Order",
      color: C.green,
      text: "Water-based → humectant → emollient → occlusive. For medications: apply drug first, then moisturizer on top 15–30 min later."
    },
    {
      num: "04",
      title: "Avoid Irritants",
      color: C.accent2,
      text: "Choose fragrance-free, dye-free, and food-allergen-free formulations. Introduce products one at a time to identify reactions."
    },
    {
      num: "05",
      title: "Season & Climate",
      color: C.orange,
      text: "In low humidity: avoid pure humectants alone (can draw water from dermis). In cold weather: use richer occlusive-dominant creams."
    },
    {
      num: "06",
      title: "Avoid Over-Occlusion",
      color: C.red,
      text: "Reducing TEWL by >40% can cause maceration and increase bacterial colonisation. Do not over-apply occlusive agents."
    },
  ];

  tips.forEach((tip, i) => {
    const col = i % 3, row = Math.floor(i / 3);
    const x = 0.3 + col * 3.18;
    const y = 1.38 + row * 2.0;
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 3.0, h: 1.75,
      fill: { color: tip.color, transparency: 84 },
      line: { color: tip.color, width: 1.5 }, rectRadius: 0.1
    });
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 0.5, h: 1.75,
      fill: { color: tip.color, transparency: 40 }, line: { color: tip.color, width: 0 }
    });
    slide.addText(tip.num, {
      x: x + 0.02, y: y + 0.52, w: 0.47, h: 0.6,
      fontSize: 20, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle"
    });
    slide.addText(tip.title, {
      x: x + 0.56, y: y + 0.05, w: 2.35, h: 0.38,
      fontSize: 12.5, bold: true, color: C.light, fontFace: "Calibri", valign: "middle"
    });
    slide.addText(tip.text, {
      x: x + 0.56, y: y + 0.43, w: 2.38, h: 1.22,
      fontSize: 10, color: C.light, fontFace: "Calibri", valign: "top"
    });
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 10 – Adverse Effects & Special Considerations
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  bg(slide);
  slideHeader(slide, "Adverse Effects & Special Considerations", "Safety, comedogenicity, and sensitive skin subtypes");

  const leftTitle = "Common Adverse Effects";
  const leftItems = [
    "Contact dermatitis — fragrances and preservatives most common allergens (~10% of patch-tested patients)",
    "Comedogenicity — isopropyl myristate, isopropyl palmitate, and coconut oil can block pores",
    "Stinging/burning — glycolic acid, lactic acid, propylene glycol, urea, benzoic acid common culprits",
    "Maceration — excessive occlusion (>40% TEWL reduction) promotes bacterial growth",
    "Rebound dryness — humectants in low humidity draw water from dermis, worsening dryness",
  ];

  const rightTitle = "Sensitive Skin Subtypes";
  const rightItems = [
    { sub: "Rosacea type:", t: " Avoid low-pH acids; use antiinflammatory ingredients (niacinamide, argan oil, green tea). Introduce retinoids slowly." },
    { sub: "Stinging type:", t: " Avoid retinoids, α-hydroxy acids, SLS, propylene glycol. Use bland, fragrance-free products." },
    { sub: "Allergic/Irritant type:", t: " Use hypoallergenic lines; introduce one product per week; patch test new products." },
    { sub: "Acne-prone:", t: " Non-comedogenic labelling required; avoid heavy oils; HA or niacinamide-based moisturizers." },
  ];

  // left box
  slide.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 1.35, w: 4.5, h: 4.1,
    fill: { color: C.red, transparency: 85 }, line: { color: C.red, width: 1.5 }
  });
  slide.addShape(pres.ShapeType.rect, {
    x: 0.3, y: 1.35, w: 4.5, h: 0.48,
    fill: { color: C.red, transparency: 40 }, line: { color: C.red, width: 0 }
  });
  slide.addText("⚠  " + leftTitle, {
    x: 0.38, y: 1.37, w: 4.34, h: 0.45,
    fontSize: 13, bold: true, color: C.darktext, fontFace: "Calibri", valign: "middle"
  });
  const leftBullets = leftItems.map((item, i) => ({
    text: "• " + item,
    options: { breakLine: true, color: C.light, fontSize: 11, fontFace: "Calibri" }
  }));
  slide.addText(leftBullets, {
    x: 0.42, y: 1.88, w: 4.28, h: 3.48,
    fontFace: "Calibri", valign: "top"
  });

  // right box
  slide.addShape(pres.ShapeType.rect, {
    x: 5.1, y: 1.35, w: 4.6, h: 4.1,
    fill: { color: C.orange, transparency: 85 }, line: { color: C.orange, width: 1.5 }
  });
  slide.addShape(pres.ShapeType.rect, {
    x: 5.1, y: 1.35, w: 4.6, h: 0.48,
    fill: { color: C.orange, transparency: 40 }, line: { color: C.orange, width: 0 }
  });
  slide.addText("⚡  " + rightTitle, {
    x: 5.18, y: 1.37, w: 4.44, h: 0.45,
    fontSize: 13, bold: true, color: C.darktext, fontFace: "Calibri", valign: "middle"
  });
  const rightRich = rightItems.map(item => [
    { text: item.sub, options: { bold: true, color: C.gold, fontSize: 11.5, breakLine: false } },
    { text: item.t + "\n\n", options: { color: C.light, fontSize: 11, breakLine: false } },
  ]).flat();
  slide.addText(rightRich, {
    x: 5.18, y: 1.88, w: 4.44, h: 3.48,
    fontFace: "Calibri", valign: "top"
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.accent } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 11 – Summary & Key Takeaways
// ══════════════════════════════════════════════════════════════
{
  const slide = pres.addSlide();
  slide.background = { color: C.bg };

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: C.gold } });

  slide.addText("KEY TAKEAWAYS", {
    x: 0.5, y: 0.18, w: 9, h: 0.65,
    fontSize: 30, bold: true, color: C.gold, fontFace: "Calibri", charSpacing: 3
  });
  slide.addShape(pres.ShapeType.rect, { x: 0.5, y: 0.85, w: 4.0, h: 0.04, fill: { color: C.accent } });

  const takeaways = [
    { icon: "🔬", text: "Moisturizers work via 3 main mechanisms: occlusion, humectancy, and barrier repair — each with distinct molecular actions." },
    { icon: "🏆", text: "Barrier repair moisturizers (ceramides 1:1:1) are the only class that corrects underlying SC lipid defects — not just temporary fixes." },
    { icon: "💧", text: "Humectants (HA, glycerin, urea) draw water into skin but must be combined with occlusives in low-humidity conditions." },
    { icon: "🛡️", text: "Petrolatum is the gold standard occlusive, with water vapour resistance 170× that of olive oil." },
    { icon: "🎯", text: "Select formulation by skin type: ointments for severe dry/AD; creams for moderate xerosis; gels/serums for oily/acne-prone." },
    { icon: "⚠️", text: "Fragrance, preservatives, isopropyl myristate, and coconut oil are common culprits in allergic and comedogenic reactions." },
    { icon: "📋", text: "For AD, weekly doses of 150–500 g recommended. Apply immediately post-bathing (soak-and-seal)." },
    { icon: "🌿", text: "Anti-inflammatory ingredients (niacinamide, colloidal oatmeal, green tea) are important adjuncts for sensitive and rosacea-prone skin." },
  ];

  takeaways.forEach((t, i) => {
    const col = i % 2, row = Math.floor(i / 2);
    const x = 0.3 + col * 4.9;
    const y = 1.05 + row * 1.1;
    slide.addShape(pres.ShapeType.rect, {
      x, y, w: 4.6, h: 0.95,
      fill: { color: i % 4 < 2 ? C.accent : C.gold, transparency: 88 },
      line: { color: i % 4 < 2 ? C.accent : C.gold, width: 1 }, rectRadius: 0.08
    });
    slide.addText(t.icon, {
      x: x + 0.06, y: y + 0.01, w: 0.5, h: 0.93,
      fontSize: 18, align: "center", valign: "middle"
    });
    slide.addText(t.text, {
      x: x + 0.58, y: y + 0.05, w: 3.94, h: 0.85,
      fontSize: 10.5, color: C.light, fontFace: "Calibri", valign: "middle"
    });
  });

  slide.addShape(pres.ShapeType.rect, { x: 0, y: 5.55, w: 10, h: 0.075, fill: { color: C.gold } });
  slide.addText("Sources: Fitzpatrick's Dermatology 9e · Dermatology 2-Volume Set 5e · Pfenninger & Fowler's Primary Care", {
    x: 0.3, y: 5.36, w: 9.4, h: 0.2,
    fontSize: 8.5, color: C.gray, fontFace: "Calibri", italic: true, align: "center"
  });
}

// ─── Write file ────────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/moisturizers-ppt/Moisturizers_Complete_Guide.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("PPTX saved to: " + outPath);
}).catch(err => {
  console.error("Error writing PPTX:", err);
  process.exit(1);
});
Running Command

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

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.