themed-markdown 0.1.85 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1032,7 +1032,8 @@ function resetFontScale(theme2) {
1032
1032
 
1033
1033
  // industryMarkdown/components/IndustryMarkdownSlide.tsx
1034
1034
  import { defaultSchema } from "hast-util-sanitize";
1035
- import React13, { useRef as useRef7, useEffect as useEffect7, useLayoutEffect, useState as useState9, useMemo as useMemo2, useCallback } from "react";
1035
+ import React13, { useRef as useRef8, useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useState as useState10, useMemo as useMemo3, useCallback as useCallback2 } from "react";
1036
+ import { createPortal as createPortal2 } from "react-dom";
1036
1037
  import ReactMarkdown from "react-markdown";
1037
1038
  import rehypeHighlight from "rehype-highlight";
1038
1039
  import rehypeRaw from "rehype-raw";
@@ -1442,6 +1443,13 @@ function transformImageUrl(src, repositoryInfo) {
1442
1443
  const { owner, repo, branch = "main", basePath = "" } = repositoryInfo;
1443
1444
  let fullPath;
1444
1445
  if (src.startsWith("/")) {
1446
+ const githubWebPathMatch = src.match(/^\/([^/]+)\/([^/]+)\/(raw|blob)\/([^/]+)\/(.+)$/);
1447
+ if (githubWebPathMatch) {
1448
+ const [, srcOwner, srcRepo, , srcBranch, srcPath] = githubWebPathMatch;
1449
+ fullPath = srcPath;
1450
+ const rawUrl2 = `https://raw.githubusercontent.com/${srcOwner}/${srcRepo}/${srcBranch}/${srcPath}`;
1451
+ return rawUrl2;
1452
+ }
1445
1453
  fullPath = src.substring(1);
1446
1454
  } else {
1447
1455
  let cleanPath = src;
@@ -1615,18 +1623,310 @@ function parseSkillMarkdown(content) {
1615
1623
  // industryMarkdown/utils/markdownUtils.ts
1616
1624
  var parseMarkdownChunks2 = parseMarkdownChunks;
1617
1625
 
1626
+ // industryMarkdown/utils/useAnnotations.ts
1627
+ import { useEffect as useEffect2, useLayoutEffect, useMemo, useRef, useState as useState2 } from "react";
1628
+
1629
+ // industryMarkdown/utils/annotationResolver.ts
1630
+ var SKIP_SELECTOR = "script, style, code, pre";
1631
+ function buildTextIndex(root) {
1632
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
1633
+ acceptNode(node) {
1634
+ const parent = node.parentElement;
1635
+ if (!parent)
1636
+ return NodeFilter.FILTER_REJECT;
1637
+ if (parent.closest(SKIP_SELECTOR))
1638
+ return NodeFilter.FILTER_REJECT;
1639
+ if (parent.hasAttribute("data-annotation-marker"))
1640
+ return NodeFilter.FILTER_REJECT;
1641
+ if (!node.nodeValue)
1642
+ return NodeFilter.FILTER_REJECT;
1643
+ return NodeFilter.FILTER_ACCEPT;
1644
+ }
1645
+ });
1646
+ let text = "";
1647
+ const nodes = [];
1648
+ let current = walker.nextNode();
1649
+ while (current) {
1650
+ const value = current.nodeValue ?? "";
1651
+ const start = text.length;
1652
+ text += value;
1653
+ nodes.push({ node: current, start, end: start + value.length });
1654
+ current = walker.nextNode();
1655
+ }
1656
+ return { text, nodes };
1657
+ }
1658
+ function findOffset(index, offset) {
1659
+ for (const entry of index.nodes) {
1660
+ if (offset >= entry.start && offset <= entry.end) {
1661
+ return { node: entry.node, localOffset: offset - entry.start };
1662
+ }
1663
+ }
1664
+ return null;
1665
+ }
1666
+ function resolveTextQuote(root, anchor) {
1667
+ if (!anchor.exact)
1668
+ return null;
1669
+ const index = buildTextIndex(root);
1670
+ const needle = `${anchor.prefix ?? ""}${anchor.exact}${anchor.suffix ?? ""}`;
1671
+ if (!needle)
1672
+ return null;
1673
+ const matchStart = index.text.indexOf(needle);
1674
+ if (matchStart === -1)
1675
+ return null;
1676
+ const exactStart = matchStart + (anchor.prefix?.length ?? 0);
1677
+ const exactEnd = exactStart + anchor.exact.length;
1678
+ const startLoc = findOffset(index, exactStart);
1679
+ const endLoc = findOffset(index, exactEnd);
1680
+ if (!startLoc || !endLoc)
1681
+ return null;
1682
+ const range = document.createRange();
1683
+ range.setStart(startLoc.node, startLoc.localOffset);
1684
+ range.setEnd(endLoc.node, endLoc.localOffset);
1685
+ return range;
1686
+ }
1687
+ function selectionToAnchor(root, selection, contextLength = 32) {
1688
+ if (selection.rangeCount === 0)
1689
+ return null;
1690
+ const range = selection.getRangeAt(0);
1691
+ if (range.collapsed)
1692
+ return null;
1693
+ if (!root.contains(range.commonAncestorContainer))
1694
+ return null;
1695
+ const exact = range.toString();
1696
+ if (!exact.trim())
1697
+ return null;
1698
+ const index = buildTextIndex(root);
1699
+ const startEntry = index.nodes.find((e) => e.node === range.startContainer);
1700
+ const endEntry = index.nodes.find((e) => e.node === range.endContainer);
1701
+ if (!startEntry || !endEntry) {
1702
+ return { exact };
1703
+ }
1704
+ const startOffset = startEntry.start + range.startOffset;
1705
+ const endOffset = endEntry.start + range.endOffset;
1706
+ const prefix = index.text.slice(Math.max(0, startOffset - contextLength), startOffset);
1707
+ const suffix = index.text.slice(endOffset, Math.min(index.text.length, endOffset + contextLength));
1708
+ return { exact, prefix, suffix };
1709
+ }
1710
+
1711
+ // industryMarkdown/utils/useAnnotations.ts
1712
+ var MARKER_CLASS = "industry-md-annotation";
1713
+ var INDICATOR_HOST_CLASS = "industry-md-annotation-indicator";
1714
+ function annotationsSignature(annotations) {
1715
+ return annotations.map((a) => `${a.id}|${a.anchor.exact}|${a.anchor.prefix ?? ""}|${a.anchor.suffix ?? ""}|${a.count ?? ""}`).join("::");
1716
+ }
1717
+ function clearMarkers(root) {
1718
+ const markers = root.querySelectorAll(`.${MARKER_CLASS}`);
1719
+ markers.forEach((marker) => {
1720
+ const parent = marker.parentNode;
1721
+ if (!parent)
1722
+ return;
1723
+ while (marker.firstChild) {
1724
+ parent.insertBefore(marker.firstChild, marker);
1725
+ }
1726
+ parent.removeChild(marker);
1727
+ });
1728
+ const hosts = root.querySelectorAll(`.${INDICATOR_HOST_CLASS}`);
1729
+ hosts.forEach((host) => host.parentNode?.removeChild(host));
1730
+ root.normalize();
1731
+ }
1732
+ function wrapRange(range, annotationId) {
1733
+ const textNodes = [];
1734
+ const walker = document.createTreeWalker(range.commonAncestorContainer, NodeFilter.SHOW_TEXT);
1735
+ let current = walker.nextNode();
1736
+ while (current) {
1737
+ if (range.intersectsNode(current))
1738
+ textNodes.push(current);
1739
+ current = walker.nextNode();
1740
+ }
1741
+ if (range.commonAncestorContainer.nodeType === Node.TEXT_NODE) {
1742
+ textNodes.push(range.commonAncestorContainer);
1743
+ }
1744
+ const markers = [];
1745
+ textNodes.forEach((textNode) => {
1746
+ if (!textNode.parentNode || !textNode.nodeValue)
1747
+ return;
1748
+ const isStart = textNode === range.startContainer;
1749
+ const isEnd = textNode === range.endContainer;
1750
+ const start = isStart ? range.startOffset : 0;
1751
+ const end = isEnd ? range.endOffset : textNode.nodeValue.length;
1752
+ if (start >= end)
1753
+ return;
1754
+ let target = textNode;
1755
+ if (start > 0) {
1756
+ target = target.splitText(start);
1757
+ }
1758
+ if (end - start < target.nodeValue.length) {
1759
+ target.splitText(end - start);
1760
+ }
1761
+ const marker = document.createElement("span");
1762
+ marker.className = MARKER_CLASS;
1763
+ marker.setAttribute("data-annotation-id", annotationId);
1764
+ marker.setAttribute("data-annotation-marker", "true");
1765
+ target.parentNode.insertBefore(marker, target);
1766
+ marker.appendChild(target);
1767
+ markers.push(marker);
1768
+ });
1769
+ return markers;
1770
+ }
1771
+ function useAnnotations({
1772
+ rootRef,
1773
+ annotations,
1774
+ activeAnnotationId,
1775
+ onSelectionChange,
1776
+ onAnnotationClick
1777
+ }) {
1778
+ const [mounts, setMounts] = useState2([]);
1779
+ const signature = useMemo(() => annotationsSignature(annotations ?? []), [annotations]);
1780
+ const annotationsRef = useRef(annotations);
1781
+ annotationsRef.current = annotations;
1782
+ const lastAppliedRef = useRef("");
1783
+ const lastResolvedIdsRef = useRef(new Set);
1784
+ useLayoutEffect(() => {
1785
+ const root = rootRef.current;
1786
+ if (!root)
1787
+ return;
1788
+ const current = annotationsRef.current ?? [];
1789
+ const existingMarkerIds = new Set;
1790
+ root.querySelectorAll(`.${MARKER_CLASS}`).forEach((el) => {
1791
+ const id = el.getAttribute("data-annotation-id");
1792
+ if (id)
1793
+ existingMarkerIds.add(id);
1794
+ });
1795
+ const annotationsChanged = lastAppliedRef.current !== signature;
1796
+ const allResolvedMarkersPresent = Array.from(lastResolvedIdsRef.current).every((id) => existingMarkerIds.has(id));
1797
+ if (!annotationsChanged && allResolvedMarkersPresent) {
1798
+ return;
1799
+ }
1800
+ clearMarkers(root);
1801
+ lastAppliedRef.current = signature;
1802
+ if (current.length === 0) {
1803
+ lastResolvedIdsRef.current = new Set;
1804
+ setMounts((prev) => prev.length === 0 ? prev : []);
1805
+ return;
1806
+ }
1807
+ const next = [];
1808
+ const resolvedIds = new Set;
1809
+ current.forEach((annotation) => {
1810
+ const range = resolveTextQuote(root, annotation.anchor);
1811
+ if (!range) {
1812
+ next.push({ annotation, host: document.createElement("span"), resolved: false });
1813
+ return;
1814
+ }
1815
+ const markers = wrapRange(range, annotation.id);
1816
+ if (markers.length === 0) {
1817
+ next.push({ annotation, host: document.createElement("span"), resolved: false });
1818
+ return;
1819
+ }
1820
+ const last = markers[markers.length - 1];
1821
+ last.classList.add(`${MARKER_CLASS}--last`);
1822
+ if (typeof annotation.count === "number" && annotation.count > 0) {
1823
+ last.setAttribute("data-count", String(annotation.count));
1824
+ }
1825
+ const host = document.createElement("span");
1826
+ host.className = INDICATOR_HOST_CLASS;
1827
+ host.setAttribute("data-annotation-indicator-for", annotation.id);
1828
+ last.parentNode.insertBefore(host, last.nextSibling);
1829
+ next.push({ annotation, host, resolved: true });
1830
+ resolvedIds.add(annotation.id);
1831
+ });
1832
+ lastResolvedIdsRef.current = resolvedIds;
1833
+ setMounts(next);
1834
+ });
1835
+ useEffect2(() => {
1836
+ const root = rootRef.current;
1837
+ if (!root)
1838
+ return;
1839
+ const markers = root.querySelectorAll(`.${MARKER_CLASS}`);
1840
+ markers.forEach((marker) => {
1841
+ const id = marker.getAttribute("data-annotation-id");
1842
+ if (id && id === activeAnnotationId) {
1843
+ marker.setAttribute("data-active", "true");
1844
+ } else {
1845
+ marker.removeAttribute("data-active");
1846
+ }
1847
+ });
1848
+ }, [rootRef, activeAnnotationId, mounts]);
1849
+ useEffect2(() => {
1850
+ if (!onSelectionChange)
1851
+ return;
1852
+ const root = rootRef.current;
1853
+ if (!root)
1854
+ return;
1855
+ const emit = () => {
1856
+ const selection = document.getSelection();
1857
+ if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
1858
+ onSelectionChange(null);
1859
+ return;
1860
+ }
1861
+ const range = selection.getRangeAt(0);
1862
+ if (!root.contains(range.commonAncestorContainer)) {
1863
+ onSelectionChange(null);
1864
+ return;
1865
+ }
1866
+ const anchor = selectionToAnchor(root, selection);
1867
+ if (!anchor) {
1868
+ onSelectionChange(null);
1869
+ return;
1870
+ }
1871
+ onSelectionChange({ anchor, rect: range.getBoundingClientRect() });
1872
+ };
1873
+ const handleMouseUp = () => {
1874
+ window.setTimeout(emit, 0);
1875
+ };
1876
+ const handleKeyUp = (event) => {
1877
+ if (event.key === "Shift" || event.key === "Meta" || event.key === "Control" || event.key === "Alt") {
1878
+ return;
1879
+ }
1880
+ window.setTimeout(emit, 0);
1881
+ };
1882
+ document.addEventListener("mouseup", handleMouseUp);
1883
+ document.addEventListener("keyup", handleKeyUp);
1884
+ return () => {
1885
+ document.removeEventListener("mouseup", handleMouseUp);
1886
+ document.removeEventListener("keyup", handleKeyUp);
1887
+ };
1888
+ }, [rootRef, onSelectionChange]);
1889
+ useEffect2(() => {
1890
+ if (!onAnnotationClick)
1891
+ return;
1892
+ const root = rootRef.current;
1893
+ if (!root)
1894
+ return;
1895
+ const handleClick = (event) => {
1896
+ const selection = document.getSelection();
1897
+ if (selection && !selection.isCollapsed)
1898
+ return;
1899
+ const target = event.target;
1900
+ if (!(target instanceof Element))
1901
+ return;
1902
+ const marker = target.closest(`.${MARKER_CLASS}`);
1903
+ if (!marker)
1904
+ return;
1905
+ const id = marker.getAttribute("data-annotation-id");
1906
+ if (!id)
1907
+ return;
1908
+ onAnnotationClick(id, event);
1909
+ };
1910
+ root.addEventListener("click", handleClick);
1911
+ return () => {
1912
+ root.removeEventListener("click", handleClick);
1913
+ };
1914
+ }, [rootRef, onAnnotationClick]);
1915
+ return mounts;
1916
+ }
1917
+
1618
1918
  // industryMarkdown/components/IndustryHtmlModal.tsx
1619
- import React3, { useState as useState2 } from "react";
1919
+ import React3, { useCallback, useState as useState3 } from "react";
1620
1920
  var useIndustryHtmlModal = () => {
1621
- const [htmlModalOpen, setHtmlModalOpen] = useState2(false);
1622
- const [htmlModalContent, setHtmlModalContent] = useState2("");
1623
- const openHtmlModal = (content) => {
1921
+ const [htmlModalOpen, setHtmlModalOpen] = useState3(false);
1922
+ const [htmlModalContent, setHtmlModalContent] = useState3("");
1923
+ const openHtmlModal = useCallback((content) => {
1624
1924
  setHtmlModalContent(content);
1625
1925
  setHtmlModalOpen(true);
1626
- };
1627
- const closeHtmlModal = () => {
1926
+ }, []);
1927
+ const closeHtmlModal = useCallback(() => {
1628
1928
  setHtmlModalOpen(false);
1629
- };
1929
+ }, []);
1630
1930
  return { htmlModalOpen, htmlModalContent, openHtmlModal, closeHtmlModal };
1631
1931
  };
1632
1932
  function IndustryHtmlModal({ isOpen, onClose, htmlContent, theme: theme2 }) {
@@ -1730,11 +2030,11 @@ function IndustryHtmlModal({ isOpen, onClose, htmlContent, theme: theme2 }) {
1730
2030
 
1731
2031
  // industryMarkdown/components/IndustryLazyMermaidDiagram.tsx
1732
2032
  import { MoveRight } from "lucide-react";
1733
- import React6, { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
2033
+ import React6, { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
1734
2034
 
1735
2035
  // industryMarkdown/components/IndustryMermaidDiagram.tsx
1736
2036
  import { Expand, Copy, Check } from "lucide-react";
1737
- import React5, { useEffect as useEffect2, useRef, useState as useState3 } from "react";
2037
+ import React5, { useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
1738
2038
  var getMermaidSync = () => {
1739
2039
  if (typeof window !== "undefined") {
1740
2040
  const mermaid = window.mermaid;
@@ -1756,12 +2056,12 @@ function IndustryMermaidDiagram({
1756
2056
  onExpandClick
1757
2057
  }) {
1758
2058
  const theme2 = themeOverride ?? theme;
1759
- const [errorDetails, setErrorDetails] = useState3(null);
1760
- const [isIntersecting, setIsIntersecting] = useState3(false);
1761
- const [hasRendered, setHasRendered] = useState3(false);
1762
- const [containerElement, setContainerElement] = useState3(null);
1763
- const [copiedError, setCopiedError] = useState3(false);
1764
- const observerRef = useRef(null);
2059
+ const [errorDetails, setErrorDetails] = useState4(null);
2060
+ const [isIntersecting, setIsIntersecting] = useState4(false);
2061
+ const [hasRendered, setHasRendered] = useState4(false);
2062
+ const [containerElement, setContainerElement] = useState4(null);
2063
+ const [copiedError, setCopiedError] = useState4(false);
2064
+ const observerRef = useRef2(null);
1765
2065
  const containerRef = React5.useCallback((node) => {
1766
2066
  setContainerElement(node);
1767
2067
  if (observerRef.current) {
@@ -1786,14 +2086,14 @@ function IndustryMermaidDiagram({
1786
2086
  observerRef.current.observe(node);
1787
2087
  }
1788
2088
  }, [rootMargin, hasRendered, isModalMode]);
1789
- useEffect2(() => {
2089
+ useEffect3(() => {
1790
2090
  return () => {
1791
2091
  if (observerRef.current) {
1792
2092
  observerRef.current.disconnect();
1793
2093
  }
1794
2094
  };
1795
2095
  }, []);
1796
- useEffect2(() => {
2096
+ useEffect3(() => {
1797
2097
  if (!hasRendered)
1798
2098
  return;
1799
2099
  const renderDiagram = async () => {
@@ -2128,15 +2428,15 @@ function IndustryLazyMermaidDiagram({
2128
2428
  onExpandClick
2129
2429
  }) {
2130
2430
  const theme2 = themeOverride ?? theme;
2131
- const [isIntersecting, setIsIntersecting] = useState4(false);
2132
- const [hasRendered, setHasRendered] = useState4(false);
2133
- const [isMounted, setIsMounted] = useState4(false);
2134
- const [hasError, setHasError] = useState4(false);
2135
- const containerRef = useRef2(null);
2136
- useEffect3(() => {
2431
+ const [isIntersecting, setIsIntersecting] = useState5(false);
2432
+ const [hasRendered, setHasRendered] = useState5(false);
2433
+ const [isMounted, setIsMounted] = useState5(false);
2434
+ const [hasError, setHasError] = useState5(false);
2435
+ const containerRef = useRef3(null);
2436
+ useEffect4(() => {
2137
2437
  setIsMounted(true);
2138
2438
  }, []);
2139
- useEffect3(() => {
2439
+ useEffect4(() => {
2140
2440
  if (!isMounted)
2141
2441
  return;
2142
2442
  if (typeof IntersectionObserver === "undefined") {
@@ -2257,7 +2557,7 @@ function IndustryLazyMermaidDiagram({
2257
2557
 
2258
2558
  // industryMarkdown/components/IndustryMarkdownComponents.tsx
2259
2559
  import { Copy as Copy2, Monitor, FileText, Check as Check2 } from "lucide-react";
2260
- import React9, { useMemo, useState as useState6, useRef as useRef4 } from "react";
2560
+ import React9, { useMemo as useMemo2, useState as useState7, useRef as useRef5 } from "react";
2261
2561
 
2262
2562
  // industryMarkdown/utils/componentUtils.tsx
2263
2563
  import React7 from "react";
@@ -2293,7 +2593,7 @@ var LinkWithLoadingIndicator = ({ href, children, onClick, className }) => {
2293
2593
  };
2294
2594
  // industryMarkdown/components/IndustryBashCommandDropdown.tsx
2295
2595
  import { Play, ChevronDown } from "lucide-react";
2296
- import React8, { useState as useState5, useRef as useRef3, useEffect as useEffect4 } from "react";
2596
+ import React8, { useState as useState6, useRef as useRef4, useEffect as useEffect5 } from "react";
2297
2597
  var IndustryBashCommandDropdown = ({
2298
2598
  commands,
2299
2599
  allCommands,
@@ -2302,11 +2602,11 @@ var IndustryBashCommandDropdown = ({
2302
2602
  slideIdPrefix: _slideIdPrefix,
2303
2603
  theme: themeOverride
2304
2604
  }) => {
2305
- const [isOpen, setIsOpen] = useState5(false);
2306
- const [isRunning, setIsRunning] = useState5(false);
2307
- const dropdownRef = useRef3(null);
2605
+ const [isOpen, setIsOpen] = useState6(false);
2606
+ const [isRunning, setIsRunning] = useState6(false);
2607
+ const dropdownRef = useRef4(null);
2308
2608
  const theme2 = themeOverride ?? theme;
2309
- useEffect4(() => {
2609
+ useEffect5(() => {
2310
2610
  const handleClickOutside = (event) => {
2311
2611
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2312
2612
  setIsOpen(false);
@@ -2425,7 +2725,7 @@ var IndustryBashCommandDropdown = ({
2425
2725
  e.currentTarget.style.backgroundColor = theme2.colors.muted;
2426
2726
  }
2427
2727
  }, "\uD83D\uDE80 Run all (", commands.length, " commands)"), commands.map((cmd, index) => {
2428
- const [isHovered, setIsHovered] = useState5(false);
2728
+ const [isHovered, setIsHovered] = useState6(false);
2429
2729
  return /* @__PURE__ */ React8.createElement("div", {
2430
2730
  key: index,
2431
2731
  style: dropdownItemStyle(isHovered),
@@ -2478,12 +2778,12 @@ var OptimizedMarkdownMedia = React9.memo(({
2478
2778
  theme: theme2,
2479
2779
  ...props
2480
2780
  }) => {
2481
- const transformedSrc = useMemo(() => {
2781
+ const transformedSrc = useMemo2(() => {
2482
2782
  return transformImageUrl(src, repositoryInfo);
2483
2783
  }, [src, repositoryInfo]);
2484
- const [hasErrored, setHasErrored] = useState6(() => failedImageCache.has(transformedSrc));
2485
- const retryCount = useRef4(0);
2486
- const mediaStyle = useMemo(() => ({
2784
+ const [hasErrored, setHasErrored] = useState7(() => failedImageCache.has(transformedSrc));
2785
+ const retryCount = useRef5(0);
2786
+ const mediaStyle = useMemo2(() => ({
2487
2787
  maxWidth: "100%",
2488
2788
  height: "auto",
2489
2789
  display: "block",
@@ -2855,7 +3155,7 @@ var createIndustryMarkdownComponents = ({
2855
3155
  }, children),
2856
3156
  source: ({ srcset, srcSet, ...props }) => {
2857
3157
  const srcsetValue = srcset || srcSet;
2858
- const transformedSrcset = useMemo(() => {
3158
+ const transformedSrcset = useMemo2(() => {
2859
3159
  if (!srcsetValue || !repositoryInfo)
2860
3160
  return srcsetValue;
2861
3161
  return srcsetValue.split(",").map((src) => {
@@ -2877,7 +3177,7 @@ var createIndustryMarkdownComponents = ({
2877
3177
  const codeString = extractTextFromChildren(children);
2878
3178
  const matchLang = /language-(\w+)/.exec(className || "");
2879
3179
  const language = matchLang ? matchLang[1] : null;
2880
- const [copied, setCopied] = useState6(false);
3180
+ const [copied, setCopied] = useState7(false);
2881
3181
  let isInline;
2882
3182
  let isCodeBlock;
2883
3183
  const hasNewlines = codeString.includes(`
@@ -3102,11 +3402,11 @@ var createIndustryMarkdownComponents = ({
3102
3402
  };
3103
3403
 
3104
3404
  // industryMarkdown/components/IndustryMermaidModal.tsx
3105
- import React11, { useEffect as useEffect6, useRef as useRef6 } from "react";
3405
+ import React11, { useEffect as useEffect7, useRef as useRef7 } from "react";
3106
3406
  import { createPortal } from "react-dom";
3107
3407
 
3108
3408
  // industryMarkdown/components/IndustryZoomableMermaidDiagram.tsx
3109
- import React10, { useEffect as useEffect5, useRef as useRef5, useState as useState7 } from "react";
3409
+ import React10, { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
3110
3410
  import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
3111
3411
  function IndustryZoomableMermaidDiagram({
3112
3412
  code,
@@ -3116,13 +3416,13 @@ function IndustryZoomableMermaidDiagram({
3116
3416
  padding = 0.9
3117
3417
  }) {
3118
3418
  const theme2 = themeOverride ?? theme;
3119
- const [calculatedScale, setCalculatedScale] = useState7(1);
3120
- const [hasInitialized, setHasInitialized] = useState7(false);
3121
- const containerRef = useRef5(null);
3122
- const diagramRef = useRef5(null);
3123
- const [isCalculating, setIsCalculating] = useState7(true);
3124
- const transformRef = useRef5(null);
3125
- useEffect5(() => {
3419
+ const [calculatedScale, setCalculatedScale] = useState8(1);
3420
+ const [hasInitialized, setHasInitialized] = useState8(false);
3421
+ const containerRef = useRef6(null);
3422
+ const diagramRef = useRef6(null);
3423
+ const [isCalculating, setIsCalculating] = useState8(true);
3424
+ const transformRef = useRef6(null);
3425
+ useEffect6(() => {
3126
3426
  if (!containerRef.current || !diagramRef.current)
3127
3427
  return;
3128
3428
  const calculateOptimalScale = () => {
@@ -3186,7 +3486,7 @@ function IndustryZoomableMermaidDiagram({
3186
3486
  resizeObserver.disconnect();
3187
3487
  };
3188
3488
  }, [code, fitStrategy, padding]);
3189
- useEffect5(() => {
3489
+ useEffect6(() => {
3190
3490
  if (hasInitialized && transformRef.current) {
3191
3491
  const { centerView } = transformRef.current;
3192
3492
  centerView(calculatedScale, 0, "easeOut");
@@ -3296,8 +3596,8 @@ function IndustryMermaidModal({
3296
3596
  mermaidCode,
3297
3597
  theme: theme2
3298
3598
  }) {
3299
- const modalRef = useRef6(null);
3300
- useEffect6(() => {
3599
+ const modalRef = useRef7(null);
3600
+ useEffect7(() => {
3301
3601
  const handleEscape = (event) => {
3302
3602
  if (event.key === "Escape") {
3303
3603
  onClose();
@@ -3399,7 +3699,7 @@ function IndustryMermaidModal({
3399
3699
  }
3400
3700
 
3401
3701
  // industryMarkdown/components/IndustryPlaceholderModal.tsx
3402
- import React12, { useState as useState8 } from "react";
3702
+ import React12, { useState as useState9 } from "react";
3403
3703
  function IndustryPlaceholderModal({
3404
3704
  isOpen,
3405
3705
  onClose,
@@ -3408,7 +3708,7 @@ function IndustryPlaceholderModal({
3408
3708
  onCopy,
3409
3709
  theme: theme2
3410
3710
  }) {
3411
- const [values, setValues] = useState8({});
3711
+ const [values, setValues] = useState9({});
3412
3712
  if (!isOpen)
3413
3713
  return null;
3414
3714
  const handleSubmit = (e) => {
@@ -3777,6 +4077,54 @@ var highlightOverrides = `
3777
4077
  text-decoration: none !important;
3778
4078
  }
3779
4079
  `;
4080
+ var annotationCSS = `
4081
+ .industry-md-annotation {
4082
+ background-color: var(--industry-md-annotation-bg, rgba(255, 193, 7, 0.22));
4083
+ padding: 0.15em 0.25em;
4084
+ margin: 0 -0.05em;
4085
+ border-radius: 3px;
4086
+ cursor: pointer;
4087
+ /* Re-apply padding/radius on each line fragment when the highlight wraps. */
4088
+ -webkit-box-decoration-break: clone;
4089
+ box-decoration-break: clone;
4090
+ }
4091
+ .industry-md-annotation[data-active="true"] {
4092
+ background-color: var(
4093
+ --industry-md-annotation-active-bg,
4094
+ rgba(255, 193, 7, 0.5)
4095
+ );
4096
+ }
4097
+ .industry-md-annotation--last {
4098
+ position: relative;
4099
+ }
4100
+ .industry-md-annotation--last[data-count]::after {
4101
+ content: attr(data-count);
4102
+ position: absolute;
4103
+ top: -0.85em;
4104
+ right: -0.8em;
4105
+ min-width: 1.1em;
4106
+ height: 1.1em;
4107
+ padding: 0 0.3em;
4108
+ box-sizing: border-box;
4109
+ border-radius: 4px;
4110
+ background-color: var(
4111
+ --industry-md-annotation-badge-bg,
4112
+ rgba(180, 120, 0, 0.95)
4113
+ );
4114
+ color: var(--industry-md-annotation-badge-color, #fff);
4115
+ font-size: 0.65em;
4116
+ font-weight: 600;
4117
+ line-height: 1.1em;
4118
+ text-align: center;
4119
+ pointer-events: none;
4120
+ box-shadow: 0 0 0 1.5px var(--industry-md-annotation-badge-ring, #fff);
4121
+ }
4122
+ .industry-md-annotation-indicator {
4123
+ display: inline;
4124
+ margin-left: 0.25em;
4125
+ vertical-align: baseline;
4126
+ }
4127
+ `;
3780
4128
  var fontTransitionCSS = `
3781
4129
  .markdown-slide * {
3782
4130
  transition: font-size 0.2s ease-in-out;
@@ -3834,6 +4182,12 @@ var injectStyles = () => {
3834
4182
  transitionStyle.textContent = fontTransitionCSS;
3835
4183
  document.head.appendChild(transitionStyle);
3836
4184
  }
4185
+ if (!document.getElementById("markdown-slide-annotations")) {
4186
+ const annotationStyle = document.createElement("style");
4187
+ annotationStyle.id = "markdown-slide-annotations";
4188
+ annotationStyle.textContent = annotationCSS;
4189
+ document.head.appendChild(annotationStyle);
4190
+ }
3837
4191
  stylesInjected = true;
3838
4192
  }
3839
4193
  };
@@ -3863,29 +4217,37 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
3863
4217
  enableKeyboardScrolling = true,
3864
4218
  keyboardScrollConfig,
3865
4219
  repositoryInfo,
3866
- editable = false
4220
+ editable = false,
4221
+ annotations,
4222
+ activeAnnotationId,
4223
+ renderAnnotation,
4224
+ onSelectionChange,
4225
+ onAnnotationClick,
4226
+ annotationStyle
3867
4227
  }) {
3868
- const slideRef = useRef7(null);
3869
- const scrollPositionsRef = useRef7(new Map);
3870
- const [measuredContainerWidth, setMeasuredContainerWidth] = useState9(null);
3871
- let chunks = [];
3872
- try {
3873
- if (typeof content === "string") {
3874
- chunks = parseMarkdownChunks2(content, slideIdPrefix);
3875
- } else {}
3876
- } catch (error) {
3877
- console.error("Error parsing markdown chunks:", error);
3878
- }
3879
- const [checkedItems, setCheckedItems] = useState9({});
4228
+ const slideRef = useRef8(null);
4229
+ const scrollPositionsRef = useRef8(new Map);
4230
+ const [measuredContainerWidth, setMeasuredContainerWidth] = useState10(null);
4231
+ const chunks = useMemo3(() => {
4232
+ if (typeof content !== "string")
4233
+ return [];
4234
+ try {
4235
+ return parseMarkdownChunks2(content, slideIdPrefix);
4236
+ } catch (error) {
4237
+ console.error("Error parsing markdown chunks:", error);
4238
+ return [];
4239
+ }
4240
+ }, [content, slideIdPrefix]);
4241
+ const [checkedItems, setCheckedItems] = useState10({});
3880
4242
  const { htmlModalOpen, htmlModalContent, openHtmlModal, closeHtmlModal } = useIndustryHtmlModal();
3881
- const [mermaidModalOpen, setMermaidModalOpen] = useState9(false);
3882
- const [mermaidModalCode, setMermaidModalCode] = useState9("");
3883
- const [placeholderModalOpen, setPlaceholderModalOpen] = useState9(false);
3884
- const [placeholderModalData, setPlaceholderModalData] = useState9(null);
3885
- useEffect7(() => {
4243
+ const [mermaidModalOpen, setMermaidModalOpen] = useState10(false);
4244
+ const [mermaidModalCode, setMermaidModalCode] = useState10("");
4245
+ const [placeholderModalOpen, setPlaceholderModalOpen] = useState10(false);
4246
+ const [placeholderModalData, setPlaceholderModalData] = useState10(null);
4247
+ useEffect8(() => {
3886
4248
  injectStyles();
3887
4249
  }, []);
3888
- useEffect7(() => {
4250
+ useEffect8(() => {
3889
4251
  if (containerWidth !== undefined) {
3890
4252
  return;
3891
4253
  }
@@ -3944,7 +4306,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
3944
4306
  ...keyboardScrollConfig?.keys
3945
4307
  }
3946
4308
  };
3947
- const handleKeyDown = useCallback((event) => {
4309
+ const handleKeyDown = useCallback2((event) => {
3948
4310
  if (!enableKeyboardScrolling) {
3949
4311
  return;
3950
4312
  }
@@ -4054,7 +4416,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4054
4416
  }, scrollConfig.smoothScroll ? 100 : 0);
4055
4417
  }
4056
4418
  }, [enableKeyboardScrolling, isVisible, slideIndex, scrollConfig]);
4057
- useEffect7(() => {
4419
+ useEffect8(() => {
4058
4420
  if (autoFocusOnVisible && isVisible && slideRef.current) {
4059
4421
  slideRef.current.focus({ preventScroll: true });
4060
4422
  }
@@ -4078,7 +4440,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4078
4440
  setMermaidModalCode("");
4079
4441
  };
4080
4442
  const baseTheme = themeOverride ?? theme;
4081
- const theme2 = useMemo2(() => {
4443
+ const theme2 = useMemo3(() => {
4082
4444
  if (fontSizeScale === 1)
4083
4445
  return baseTheme;
4084
4446
  return {
@@ -4086,7 +4448,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4086
4448
  fontSizes: baseTheme.fontSizes.map((size) => Math.round(size * fontSizeScale))
4087
4449
  };
4088
4450
  }, [baseTheme, fontSizeScale]);
4089
- const calculateSlidePadding = useMemo2(() => {
4451
+ const calculateSlidePadding = useMemo3(() => {
4090
4452
  const effectiveContainerWidth = containerWidth ?? measuredContainerWidth ?? 800;
4091
4453
  const paddingPercentage = 0.03;
4092
4454
  const horizontalPadding = Math.max(5, Math.round(effectiveContainerWidth * paddingPercentage));
@@ -4097,7 +4459,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4097
4459
  };
4098
4460
  return result;
4099
4461
  }, [containerWidth, measuredContainerWidth]);
4100
- const finalPadding = useMemo2(() => {
4462
+ const finalPadding = useMemo3(() => {
4101
4463
  const basePadding = calculateSlidePadding.horizontal;
4102
4464
  const baseVerticalPadding = calculateSlidePadding.vertical;
4103
4465
  const baseHorizontalValue = parseInt(basePadding.replace("px", ""), 10);
@@ -4112,7 +4474,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4112
4474
  const left = baseHorizontalValue + leftExtra;
4113
4475
  return `${top}px ${right}px ${bottom}px ${left}px`;
4114
4476
  }, [calculateSlidePadding.horizontal, calculateSlidePadding.vertical, additionalPadding]);
4115
- useEffect7(() => {
4477
+ useEffect8(() => {
4116
4478
  const slideElement = slideRef.current;
4117
4479
  if (slideElement) {
4118
4480
  const handleScroll = () => {
@@ -4125,13 +4487,13 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4125
4487
  }
4126
4488
  return;
4127
4489
  }, [slideIndex]);
4128
- useLayoutEffect(() => {
4490
+ useLayoutEffect2(() => {
4129
4491
  if (slideRef.current) {
4130
4492
  const savedPosition = scrollPositionsRef.current.get(slideIndex) ?? 0;
4131
4493
  slideRef.current.scrollTop = savedPosition;
4132
4494
  }
4133
4495
  }, [slideIndex]);
4134
- const sanitizeSchema = useMemo2(() => ({
4496
+ const sanitizeSchema = useMemo3(() => ({
4135
4497
  ...defaultSchema,
4136
4498
  tagNames: [...defaultSchema.tagNames || [], "picture", "source", "mark"],
4137
4499
  attributes: {
@@ -4199,7 +4561,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4199
4561
  }
4200
4562
  }), []);
4201
4563
  const rootMargin = isVisible ? "0px" : "100px";
4202
- const getMarkdownComponents = useCallback((chunkIndex) => {
4564
+ const getMarkdownComponents = useCallback2((chunkIndex) => {
4203
4565
  const baseComponents = createIndustryMarkdownComponents({
4204
4566
  theme: theme2,
4205
4567
  slideIdPrefix,
@@ -4251,6 +4613,76 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4251
4613
  searchQuery,
4252
4614
  editable
4253
4615
  ]);
4616
+ const renderedChunks = useMemo3(() => {
4617
+ if (chunks.length === 0) {
4618
+ return /* @__PURE__ */ React13.createElement("div", {
4619
+ style: {
4620
+ padding: theme2.space[4],
4621
+ textAlign: "center",
4622
+ color: theme2.colors.muted,
4623
+ fontSize: theme2.fontSizes[2]
4624
+ }
4625
+ }, "No content to display");
4626
+ }
4627
+ return chunks.map((chunk, index) => {
4628
+ if (chunk.type === "markdown_chunk") {
4629
+ const processedContent = searchQuery ? highlightSearchMatches(chunk.content, searchQuery) : chunk.content;
4630
+ return /* @__PURE__ */ React13.createElement(ReactMarkdown, {
4631
+ key: `${chunk.id}-${JSON.stringify(theme2.colors.accent)}`,
4632
+ remarkPlugins: [remarkGfm],
4633
+ rehypePlugins: [
4634
+ rehypeRaw,
4635
+ [rehypeSanitize, sanitizeSchema],
4636
+ rehypeSlug,
4637
+ rehypeHighlight
4638
+ ],
4639
+ components: getMarkdownComponents(index)
4640
+ }, processedContent);
4641
+ }
4642
+ if (chunk.type === "mermaid_chunk") {
4643
+ const mermaidProps = {
4644
+ id: chunk.id,
4645
+ code: chunk.content,
4646
+ onCopyError: onCopyMermaidError,
4647
+ rootMargin,
4648
+ theme: theme2,
4649
+ onExpandClick: () => openMermaidModal(chunk.content)
4650
+ };
4651
+ if (onShowMermaidInPanel) {
4652
+ mermaidProps.onShowInPanel = onShowMermaidInPanel;
4653
+ }
4654
+ return /* @__PURE__ */ React13.createElement(IndustryLazyMermaidDiagram, {
4655
+ key: chunk.id,
4656
+ ...mermaidProps
4657
+ });
4658
+ }
4659
+ return null;
4660
+ });
4661
+ }, [
4662
+ chunks,
4663
+ content,
4664
+ searchQuery,
4665
+ theme2,
4666
+ sanitizeSchema,
4667
+ getMarkdownComponents,
4668
+ rootMargin,
4669
+ onCopyMermaidError,
4670
+ onShowMermaidInPanel
4671
+ ]);
4672
+ const annotationMounts = useAnnotations({
4673
+ rootRef: slideRef,
4674
+ annotations: annotations ?? [],
4675
+ activeAnnotationId,
4676
+ onSelectionChange,
4677
+ onAnnotationClick
4678
+ });
4679
+ const annotationCSSVars = {};
4680
+ if (annotationStyle?.backgroundColor) {
4681
+ annotationCSSVars["--industry-md-annotation-bg"] = annotationStyle.backgroundColor;
4682
+ }
4683
+ if (annotationStyle?.activeBackgroundColor) {
4684
+ annotationCSSVars["--industry-md-annotation-active-bg"] = annotationStyle.activeBackgroundColor;
4685
+ }
4254
4686
  return /* @__PURE__ */ React13.createElement("div", {
4255
4687
  className: "markdown-slide",
4256
4688
  ref: slideRef,
@@ -4266,7 +4698,8 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4266
4698
  outline: "none",
4267
4699
  border: "2px solid transparent",
4268
4700
  transition: "border-color 0.2s ease",
4269
- boxSizing: "border-box"
4701
+ boxSizing: "border-box",
4702
+ ...annotationCSSVars
4270
4703
  },
4271
4704
  tabIndex: 0,
4272
4705
  onKeyDown: handleKeyDown,
@@ -4275,47 +4708,9 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4275
4708
  slideRef.current.focus();
4276
4709
  }
4277
4710
  }
4278
- }, chunks.length === 0 ? /* @__PURE__ */ React13.createElement("div", {
4279
- style: {
4280
- padding: theme2.space[4],
4281
- textAlign: "center",
4282
- color: theme2.colors.muted,
4283
- fontSize: theme2.fontSizes[2]
4284
- }
4285
- }, "No content to display") : chunks.map((chunk, index) => {
4286
- if (chunk.type === "markdown_chunk") {
4287
- const processedContent = searchQuery ? highlightSearchMatches(chunk.content, searchQuery) : chunk.content;
4288
- return /* @__PURE__ */ React13.createElement(ReactMarkdown, {
4289
- key: `${chunk.id}-${JSON.stringify(theme2.colors.accent)}`,
4290
- remarkPlugins: [remarkGfm],
4291
- rehypePlugins: [
4292
- rehypeRaw,
4293
- [rehypeSanitize, sanitizeSchema],
4294
- rehypeSlug,
4295
- rehypeHighlight
4296
- ],
4297
- components: getMarkdownComponents(index)
4298
- }, processedContent);
4299
- }
4300
- if (chunk.type === "mermaid_chunk") {
4301
- const mermaidProps = {
4302
- id: chunk.id,
4303
- code: chunk.content,
4304
- onCopyError: onCopyMermaidError,
4305
- rootMargin,
4306
- theme: theme2,
4307
- onExpandClick: () => openMermaidModal(chunk.content)
4308
- };
4309
- if (onShowMermaidInPanel) {
4310
- mermaidProps.onShowInPanel = onShowMermaidInPanel;
4311
- }
4312
- return /* @__PURE__ */ React13.createElement(IndustryLazyMermaidDiagram, {
4313
- key: chunk.id,
4314
- ...mermaidProps
4315
- });
4316
- }
4317
- return null;
4318
- }), /* @__PURE__ */ React13.createElement(IndustryHtmlModal, {
4711
+ }, renderedChunks, renderAnnotation && annotationMounts.filter((mount) => mount.resolved).map((mount) => createPortal2(/* @__PURE__ */ React13.createElement(React13.Fragment, {
4712
+ key: mount.annotation.id
4713
+ }, renderAnnotation(mount.annotation)), mount.host)), /* @__PURE__ */ React13.createElement(IndustryHtmlModal, {
4319
4714
  isOpen: htmlModalOpen,
4320
4715
  onClose: closeHtmlModal,
4321
4716
  htmlContent: htmlModalContent,
@@ -4336,7 +4731,7 @@ var IndustryMarkdownSlide = React13.memo(function IndustryMarkdownSlide2({
4336
4731
  });
4337
4732
  // industryMarkdown/components/SlidePresentation.tsx
4338
4733
  import { AnimatedResizableLayout } from "@principal-ade/panels";
4339
- import React17, { useState as useState10, useCallback as useCallback2, useRef as useRef9, useEffect as useEffect9 } from "react";
4734
+ import React17, { useState as useState11, useCallback as useCallback3, useRef as useRef10, useEffect as useEffect10 } from "react";
4340
4735
 
4341
4736
  // industryMarkdown/utils/extractSlideTitles.ts
4342
4737
  function extractSlideTitle2(content, slideIndex) {
@@ -4607,7 +5002,7 @@ var SlideNavigationHeader = ({
4607
5002
 
4608
5003
  // industryMarkdown/components/SlideSearchBar.tsx
4609
5004
  import { Search, X as X2 } from "lucide-react";
4610
- import React16, { useRef as useRef8, useEffect as useEffect8 } from "react";
5005
+ import React16, { useRef as useRef9, useEffect as useEffect9 } from "react";
4611
5006
  var SlideSearchBar = ({
4612
5007
  showSearch,
4613
5008
  searchQuery,
@@ -4621,8 +5016,8 @@ var SlideSearchBar = ({
4621
5016
  onClose,
4622
5017
  onClear
4623
5018
  }) => {
4624
- const searchInputRef = useRef8(null);
4625
- useEffect8(() => {
5019
+ const searchInputRef = useRef9(null);
5020
+ useEffect9(() => {
4626
5021
  if (showSearch && searchInputRef.current) {
4627
5022
  searchInputRef.current.focus();
4628
5023
  }
@@ -4824,8 +5219,8 @@ var SlidePresentation = ({
4824
5219
  fontSizeScale,
4825
5220
  theme: theme2
4826
5221
  }) => {
4827
- const [isMobile, setIsMobile] = useState10(false);
4828
- useEffect9(() => {
5222
+ const [isMobile, setIsMobile] = useState11(false);
5223
+ useEffect10(() => {
4829
5224
  const checkMobile = () => {
4830
5225
  setIsMobile(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768);
4831
5226
  };
@@ -4835,17 +5230,17 @@ var SlidePresentation = ({
4835
5230
  }, []);
4836
5231
  const effectiveTocDisplayMode = isMobile ? "overlay" : tocDisplayMode;
4837
5232
  const defaultTocOpen = initialTocOpen ?? effectiveTocDisplayMode === "sidebar";
4838
- const [currentSlide, setCurrentSlide] = useState10(initialSlide);
4839
- const [isFullscreen, setIsFullscreen] = useState10(false);
4840
- const [showTOC, setShowTOC] = useState10(defaultTocOpen);
4841
- const [showSearch, setShowSearch] = useState10(false);
4842
- const [searchQuery, setSearchQuery] = useState10("");
4843
- const [searchResults, setSearchResults] = useState10([]);
4844
- const [currentSearchResult, setCurrentSearchResult] = useState10(-1);
4845
- const [searchStartSlide, setSearchStartSlide] = useState10(0);
4846
- const containerRef = useRef9(null);
5233
+ const [currentSlide, setCurrentSlide] = useState11(initialSlide);
5234
+ const [isFullscreen, setIsFullscreen] = useState11(false);
5235
+ const [showTOC, setShowTOC] = useState11(defaultTocOpen);
5236
+ const [showSearch, setShowSearch] = useState11(false);
5237
+ const [searchQuery, setSearchQuery] = useState11("");
5238
+ const [searchResults, setSearchResults] = useState11([]);
5239
+ const [currentSearchResult, setCurrentSearchResult] = useState11(-1);
5240
+ const [searchStartSlide, setSearchStartSlide] = useState11(0);
5241
+ const containerRef = useRef10(null);
4847
5242
  const slideTitles = extractAllSlideTitles(slides);
4848
- const navigateToSlide = useCallback2((slideIndex) => {
5243
+ const navigateToSlide = useCallback3((slideIndex) => {
4849
5244
  if (slideIndex >= 0 && slideIndex < slides.length) {
4850
5245
  setCurrentSlide(slideIndex);
4851
5246
  onSlideChange?.(slideIndex);
@@ -4854,7 +5249,7 @@ var SlidePresentation = ({
4854
5249
  }
4855
5250
  }
4856
5251
  }, [slides.length, onSlideChange, effectiveTocDisplayMode]);
4857
- useEffect9(() => {
5252
+ useEffect10(() => {
4858
5253
  if (!searchQuery.trim()) {
4859
5254
  setSearchResults([]);
4860
5255
  setCurrentSearchResult(-1);
@@ -4872,7 +5267,7 @@ var SlidePresentation = ({
4872
5267
  setSearchResults(results);
4873
5268
  setCurrentSearchResult(-1);
4874
5269
  }, [searchQuery, slides]);
4875
- const navigateToSearchResult = useCallback2((resultIndex) => {
5270
+ const navigateToSearchResult = useCallback3((resultIndex) => {
4876
5271
  if (searchResults.length === 0)
4877
5272
  return;
4878
5273
  let newIndex = resultIndex;
@@ -4887,22 +5282,22 @@ var SlidePresentation = ({
4887
5282
  navigateToSlide(targetSlide);
4888
5283
  }
4889
5284
  }, [searchResults, navigateToSlide, currentSlide, currentSearchResult]);
4890
- const closeSearch = useCallback2(() => {
5285
+ const closeSearch = useCallback3(() => {
4891
5286
  setShowSearch(false);
4892
5287
  }, []);
4893
- const clearSearch = useCallback2(() => {
5288
+ const clearSearch = useCallback3(() => {
4894
5289
  setSearchQuery("");
4895
5290
  setSearchResults([]);
4896
5291
  setCurrentSearchResult(-1);
4897
5292
  setSearchStartSlide(0);
4898
5293
  }, []);
4899
- const goToPreviousSlide = useCallback2(() => {
5294
+ const goToPreviousSlide = useCallback3(() => {
4900
5295
  navigateToSlide(currentSlide - 1);
4901
5296
  }, [currentSlide, navigateToSlide]);
4902
- const goToNextSlide = useCallback2(() => {
5297
+ const goToNextSlide = useCallback3(() => {
4903
5298
  navigateToSlide(currentSlide + 1);
4904
5299
  }, [currentSlide, navigateToSlide]);
4905
- const toggleFullscreen = useCallback2(() => {
5300
+ const toggleFullscreen = useCallback3(() => {
4906
5301
  if (!containerRef.current)
4907
5302
  return;
4908
5303
  if (!isFullscreen) {
@@ -4913,7 +5308,7 @@ var SlidePresentation = ({
4913
5308
  setIsFullscreen(false);
4914
5309
  }
4915
5310
  }, [isFullscreen]);
4916
- useEffect9(() => {
5311
+ useEffect10(() => {
4917
5312
  const handleKeyDown = (event) => {
4918
5313
  if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
4919
5314
  if (showSearch && (event.key === "Tab" || event.key === "Enter" || event.key === "Escape")) {} else {
@@ -5031,7 +5426,7 @@ var SlidePresentation = ({
5031
5426
  currentSearchResult,
5032
5427
  tocDisplayMode
5033
5428
  ]);
5034
- useEffect9(() => {
5429
+ useEffect10(() => {
5035
5430
  if (currentSlide >= slides.length && slides.length > 0) {
5036
5431
  setCurrentSlide(slides.length - 1);
5037
5432
  }
@@ -5492,7 +5887,7 @@ var SlidePresentation = ({
5492
5887
  };
5493
5888
  // industryMarkdown/components/SlidePresentationBook.tsx
5494
5889
  import { AnimatedResizableLayout as AnimatedResizableLayout2 } from "@principal-ade/panels";
5495
- import React18, { useState as useState11, useCallback as useCallback3, useRef as useRef10, useEffect as useEffect10 } from "react";
5890
+ import React18, { useState as useState12, useCallback as useCallback4, useRef as useRef11, useEffect as useEffect11 } from "react";
5496
5891
  var SlidePresentationBook = ({
5497
5892
  slides,
5498
5893
  initialSlide = 0,
@@ -5522,8 +5917,8 @@ var SlidePresentationBook = ({
5522
5917
  repositoryInfo,
5523
5918
  width
5524
5919
  }) => {
5525
- const [isMobile, setIsMobile] = useState11(false);
5526
- useEffect10(() => {
5920
+ const [isMobile, setIsMobile] = useState12(false);
5921
+ useEffect11(() => {
5527
5922
  const checkMobile = () => {
5528
5923
  setIsMobile(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent) || window.innerWidth < 768);
5529
5924
  };
@@ -5534,20 +5929,20 @@ var SlidePresentationBook = ({
5534
5929
  const effectiveTocDisplayMode = isMobile && viewMode === "single" ? "overlay" : tocDisplayMode ?? (viewMode === "single" ? "sidebar" : "overlay");
5535
5930
  const defaultTocOpen = initialTocOpen ?? false;
5536
5931
  const adjustedInitialSlide = viewMode === "book" ? Math.floor(initialSlide / 2) * 2 : initialSlide;
5537
- const [currentSlide, setCurrentSlide] = useState11(adjustedInitialSlide);
5538
- const [isFullscreen, setIsFullscreen] = useState11(false);
5539
- const [showTOC, setShowTOC] = useState11(defaultTocOpen);
5540
- const [showSearch, setShowSearch] = useState11(false);
5541
- const [searchQuery, setSearchQuery] = useState11("");
5542
- const [searchResults, setSearchResults] = useState11([]);
5543
- const [currentSearchResult, setCurrentSearchResult] = useState11(-1);
5544
- const [searchStartSlide, setSearchStartSlide] = useState11(0);
5545
- const [collapsedSide, setCollapsedSide] = useState11(null);
5546
- const [lastInteractedSide, setLastInteractedSide] = useState11("left");
5547
- const containerRef = useRef10(null);
5932
+ const [currentSlide, setCurrentSlide] = useState12(adjustedInitialSlide);
5933
+ const [isFullscreen, setIsFullscreen] = useState12(false);
5934
+ const [showTOC, setShowTOC] = useState12(defaultTocOpen);
5935
+ const [showSearch, setShowSearch] = useState12(false);
5936
+ const [searchQuery, setSearchQuery] = useState12("");
5937
+ const [searchResults, setSearchResults] = useState12([]);
5938
+ const [currentSearchResult, setCurrentSearchResult] = useState12(-1);
5939
+ const [searchStartSlide, setSearchStartSlide] = useState12(0);
5940
+ const [collapsedSide, setCollapsedSide] = useState12(null);
5941
+ const [lastInteractedSide, setLastInteractedSide] = useState12("left");
5942
+ const containerRef = useRef11(null);
5548
5943
  const slideTitles = extractAllSlideTitles(slides);
5549
5944
  const stepSize = viewMode === "book" ? 2 : 1;
5550
- const navigateToSlide = useCallback3((slideIndex) => {
5945
+ const navigateToSlide = useCallback4((slideIndex) => {
5551
5946
  const targetSlide = viewMode === "book" ? Math.floor(slideIndex / 2) * 2 : slideIndex;
5552
5947
  if (targetSlide >= 0 && targetSlide < slides.length) {
5553
5948
  setCurrentSlide(targetSlide);
@@ -5557,7 +5952,7 @@ var SlidePresentationBook = ({
5557
5952
  }
5558
5953
  }
5559
5954
  }, [slides.length, onSlideChange, viewMode, effectiveTocDisplayMode]);
5560
- useEffect10(() => {
5955
+ useEffect11(() => {
5561
5956
  if (!searchQuery.trim()) {
5562
5957
  setSearchResults([]);
5563
5958
  setCurrentSearchResult(-1);
@@ -5575,7 +5970,7 @@ var SlidePresentationBook = ({
5575
5970
  setSearchResults(results);
5576
5971
  setCurrentSearchResult(-1);
5577
5972
  }, [searchQuery, slides]);
5578
- const navigateToSearchResult = useCallback3((resultIndex) => {
5973
+ const navigateToSearchResult = useCallback4((resultIndex) => {
5579
5974
  if (searchResults.length === 0)
5580
5975
  return;
5581
5976
  let newIndex = resultIndex;
@@ -5590,22 +5985,22 @@ var SlidePresentationBook = ({
5590
5985
  navigateToSlide(targetSlide);
5591
5986
  }
5592
5987
  }, [searchResults, navigateToSlide, currentSlide, currentSearchResult]);
5593
- const closeSearch = useCallback3(() => {
5988
+ const closeSearch = useCallback4(() => {
5594
5989
  setShowSearch(false);
5595
5990
  }, []);
5596
- const clearSearch = useCallback3(() => {
5991
+ const clearSearch = useCallback4(() => {
5597
5992
  setSearchQuery("");
5598
5993
  setSearchResults([]);
5599
5994
  setCurrentSearchResult(-1);
5600
5995
  setSearchStartSlide(0);
5601
5996
  }, []);
5602
- const goToPreviousSlide = useCallback3(() => {
5997
+ const goToPreviousSlide = useCallback4(() => {
5603
5998
  navigateToSlide(currentSlide - stepSize);
5604
5999
  }, [currentSlide, navigateToSlide, stepSize]);
5605
- const goToNextSlide = useCallback3(() => {
6000
+ const goToNextSlide = useCallback4(() => {
5606
6001
  navigateToSlide(currentSlide + stepSize);
5607
6002
  }, [currentSlide, navigateToSlide, stepSize]);
5608
- const handleCollapseLeft = useCallback3(() => {
6003
+ const handleCollapseLeft = useCallback4(() => {
5609
6004
  if (collapsedSide === "left") {
5610
6005
  setCollapsedSide(null);
5611
6006
  } else if (collapsedSide === "right") {
@@ -5615,7 +6010,7 @@ var SlidePresentationBook = ({
5615
6010
  setCollapsedSide("right");
5616
6011
  }
5617
6012
  }, [collapsedSide]);
5618
- const handleCollapseRight = useCallback3(() => {
6013
+ const handleCollapseRight = useCallback4(() => {
5619
6014
  if (collapsedSide === "right") {
5620
6015
  setCollapsedSide(null);
5621
6016
  } else if (collapsedSide === "left") {
@@ -5625,7 +6020,7 @@ var SlidePresentationBook = ({
5625
6020
  setCollapsedSide("left");
5626
6021
  }
5627
6022
  }, [collapsedSide]);
5628
- const toggleFullscreen = useCallback3(() => {
6023
+ const toggleFullscreen = useCallback4(() => {
5629
6024
  if (!containerRef.current)
5630
6025
  return;
5631
6026
  if (!isFullscreen) {
@@ -5636,7 +6031,7 @@ var SlidePresentationBook = ({
5636
6031
  setIsFullscreen(false);
5637
6032
  }
5638
6033
  }, [isFullscreen]);
5639
- useEffect10(() => {
6034
+ useEffect11(() => {
5640
6035
  const handleKeyDown = (event) => {
5641
6036
  if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
5642
6037
  if (showSearch && (event.key === "Tab" || event.key === "Enter" || event.key === "Escape")) {} else {
@@ -5755,7 +6150,7 @@ var SlidePresentationBook = ({
5755
6150
  searchResults,
5756
6151
  effectiveTocDisplayMode
5757
6152
  ]);
5758
- useEffect10(() => {
6153
+ useEffect11(() => {
5759
6154
  if (currentSlide >= slides.length && slides.length > 0) {
5760
6155
  setCurrentSlide(slides.length - 1);
5761
6156
  }
@@ -6418,7 +6813,7 @@ var SlidePresentationBook = ({
6418
6813
  }));
6419
6814
  };
6420
6815
  // industryMarkdown/components/DocumentView.tsx
6421
- import React19, { useRef as useRef11 } from "react";
6816
+ import React19, { useRef as useRef12 } from "react";
6422
6817
  var DocumentView = ({
6423
6818
  content,
6424
6819
  onCheckboxChange,
@@ -6437,7 +6832,7 @@ var DocumentView = ({
6437
6832
  transparentBackground = false,
6438
6833
  editable = false
6439
6834
  }) => {
6440
- const containerRef = useRef11(null);
6835
+ const containerRef = useRef12(null);
6441
6836
  const backgroundColor = transparentBackground ? "transparent" : theme2.colors.background;
6442
6837
  return /* @__PURE__ */ React19.createElement("div", {
6443
6838
  ref: containerRef,