html-flip-book-react 0.0.0-alpha.55 → 0.0.0-alpha.57

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.
@@ -68,9 +68,9 @@ export interface FlipBookProps {
68
68
  enableDownload?: boolean;
69
69
  }
70
70
  declare const FlipBookReact: React.ForwardRefExoticComponent<FlipBookProps & React.RefAttributes<FlipBookHandle>>;
71
- export { FlipBookReact as FlipBook };
72
71
  export type { Bookmark, BookmarkContext, BookmarkPlacement, FlipPageSemantic, HistoryMapper, MouseMode, PageFlipParams, PageSemantics, } from "html-flip-book-vanilla";
73
72
  export { createDefaultHistoryMapper } from "html-flip-book-vanilla";
74
73
  export type { TocEntry, TocPageProps } from "./TocPage";
75
74
  export { TocPage } from "./TocPage";
75
+ export { FlipBookReact as FlipBook };
76
76
  //# sourceMappingURL=FlipBook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlipBook.d.ts","sourceRoot":"","sources":["../src/FlipBook.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,IAAI,oBAAoB,EAG7C,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAoBrE,MAAM,WAAW,cAAc;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD,UAAU,EAAE,CAAC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AAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAMpD,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIrD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAM5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAK9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAKhC,UAAU,CAAC,EAAE,OAAO,CAAC;IAOrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAK7B,aAAa,CAAC,EAAE,OAAO,CAAC;IAMxB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,QAAA,MAAM,aAAa,sFAmZlB,CAAC;AAIF,YAAY,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"flip-book.js","sources":["../src/TocPage.tsx","../src/FlipBook.tsx"],"sourcesContent":["import type { PageSemantics } from \"html-flip-book-vanilla\";\nimport type React from \"react\";\nimport \"./TocPage.css\";\n\n/**\n * Entry in the table of contents.\n */\nexport interface TocEntry {\n\t/** Page index to navigate to */\n\tpageIndex: number;\n\t/** Display title (from pageSemantics.indexToTitle or custom) */\n\ttitle: string;\n\t/** Semantic page name/number (from pageSemantics.indexToSemanticName) */\n\tsemanticName: string;\n}\n\n/**\n * Props for the TocPage component.\n */\nexport interface TocPageProps {\n\t/** Callback to navigate to a specific page */\n\tonNavigate: (pageIndex: number) => void;\n\t/** Total number of pages in the book */\n\ttotalPages: number;\n\t/** Page semantics for generating titles and page numbers */\n\tpageSemantics?: PageSemantics;\n\t/** Custom heading text. Default: \"Table of Contents\" */\n\theading?: string;\n\t/** Custom CSS class for the container */\n\tclassName?: string;\n\t/** Reading direction for RTL support */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/**\n\t * Filter function to determine which pages appear in TOC.\n\t * By default, only pages with a title are included.\n\t */\n\tfilter?: (entry: TocEntry, pageIndex: number) => boolean;\n\t/** URL for an entry. When provided, modified clicks use native browser navigation. */\n\tgetHref?: (entry: TocEntry) => string | null | undefined;\n\t/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void, href?: string) => React.ReactNode;\n}\n\n/**\n * Default filter: include pages that have a non-empty title.\n */\nconst defaultFilter = (entry: TocEntry): boolean => entry.title.length > 0;\n\n/**\n * A table of contents page component for FlipBook.\n *\n * Automatically generates TOC entries from pageSemantics, showing pages\n * that have titles. Entries display title with fallback to semantic name,\n * then page index.\n *\n * @example\n * ```tsx\n * <TocPage\n * onNavigate={(pageIndex) => flipBookRef.current?.flipToPage(pageIndex)}\n * totalPages={20}\n * pageSemantics={mySemantics}\n * heading=\"Contents\"\n * direction=\"rtl\"\n * />\n * ```\n */\nconst TocPage: React.FC<TocPageProps> = ({\n\tonNavigate,\n\ttotalPages,\n\tpageSemantics,\n\theading = \"Table of Contents\",\n\tclassName,\n\tdirection = \"ltr\",\n\tfilter = defaultFilter,\n\tgetHref,\n\trenderEntry,\n}) => {\n\t// Generate TOC entries for all pages\n\tconst entries: TocEntry[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst entry: TocEntry = { pageIndex: i, title, semanticName };\n\n\t\tif (filter(entry, i)) {\n\t\t\tentries.push(entry);\n\t\t}\n\t}\n\n\tconst renderDefaultEntry = (entry: TocEntry, onClick: () => void, href?: string) => {\n\t\t// Title on one side (left in LTR, right in RTL); semantic name or page index on the other\n\t\tconst title = entry.title || entry.semanticName || `Page ${entry.pageIndex + 1}`;\n\t\tconst pageOrSemantic = entry.semanticName || String(entry.pageIndex + 1);\n\n\t\tconst content = (\n\t\t\t<>\n\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t</>\n\t\t);\n\n\t\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t{href ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={href}\n\t\t\t\t\t\tclassName=\"toc-link\"\n\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.button !== 0 ||\n\t\t\t\t\t\t\t\tevent.ctrlKey ||\n\t\t\t\t\t\t\t\tevent.metaKey ||\n\t\t\t\t\t\t\t\tevent.shiftKey ||\n\t\t\t\t\t\t\t\tevent.altKey\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</li>\n\t\t);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`toc-page ${className ?? \"\"}`.trim()}\n\t\t\tstyle={{ direction, textAlign: direction === \"rtl\" ? \"right\" : \"left\" }}\n\t\t>\n\t\t\t<div className=\"toc-page__scroll\">\n\t\t\t\t<h2 className=\"toc-heading\">{heading}</h2>\n\t\t\t\t<ul className=\"toc-list\">\n\t\t\t\t\t{entries.map((entry) => {\n\t\t\t\t\t\tconst onClick = () => onNavigate(entry.pageIndex);\n\t\t\t\t\t\tconst href = getHref?.(entry) ?? undefined;\n\t\t\t\t\t\treturn renderEntry\n\t\t\t\t\t\t\t? renderEntry(entry, onClick, href)\n\t\t\t\t\t\t\t: renderDefaultEntry(entry, onClick, href);\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport { TocPage };\n","import {\n\ttype BookmarkProvider as BaseBookmarkProvider,\n\ttype Bookmark,\n\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype MouseMode,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport \"../../base/src/mouse-mode.scss\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\n/** Bookmark content is rendered with React and keeps access to the consumer's contexts. */\nexport type BookmarkProvider = BaseBookmarkProvider<React.ReactNode>;\n\ninterface BookmarkSlot {\n\tkey: string;\n\tbookmark: Bookmark;\n\telement: HTMLElement;\n\trenderer: BookmarkProvider[\"renderBookmark\"];\n}\n\n/**\n * Imperative handle exposed via ref for programmatic control of the FlipBook.\n * Flipbook methods (flipNext, jumpToPage, etc.) are called internally by commands;\n * consumers interact through commands (execute) and getters (ref).\n *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * const page = ref.current?.getCurrentPageIndex();\n * ```\n */\nexport interface FlipBookHandle {\n\t/** Animate flip to the next page */\n\tflipNext: () => Promise<void>;\n\t/** Animate flip to the previous page */\n\tflipPrev: () => Promise<void>;\n\t/** Animate flip to a specific page index */\n\tflipToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => void;\n\t/** Show a router-selected page without adding a browser history entry. */\n\trestorePage: (pageIndex: number) => void;\n\t/** Toggle debug toolbar visibility (when debug mode is enabled). Bound to Ctrl+Alt+D by default. */\n\ttoggleDebugBar?: () => void;\n\t/** Get the current (leftmost visible) page index */\n\tgetCurrentPageIndex: () => number;\n\t/** Get the total number of pages */\n\tgetTotalPages: () => number;\n\t/** Get the \"of\" value for the indicator (e.g. total label). Defaults to total pages when not set. */\n\tgetOf: () => string | number;\n\t/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\n\t/** Get download configuration for the book. Undefined when no download is configured. */\n\tgetDownloadConfig: () => DownloadConfig | undefined;\n\t/** Get the configured table of contents page index. */\n\tgetTocPageIndex: () => number;\n\t/** Current mouse interaction mode. Touch gestures are unaffected. */\n\tgetMouseMode: () => MouseMode;\n\t/** Switch between continuous page turning and native text selection. */\n\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => void;\n}\n\n/**\n * Configuration for book covers.\n */\nexport interface CoverConfig {\n\t/**\n\t * Make covers \"hard\" - no page curl effect on covers.\n\t * When true, cover pages appear flat without the soft page bend.\n\t * Default: false\n\t */\n\thardCovers?: boolean;\n\t/**\n\t * Disable shadow effects on cover pages.\n\t * Default: false\n\t */\n\tnoShadow?: boolean;\n\t/**\n\t * Page indices that are considered cover pages.\n\t * Default: [0] (front cover only). Use [0, totalPages-1] for front and back covers.\n\t * If \"auto\", uses first and last pages as covers.\n\t */\n\tcoverIndices?: number[] | \"auto\";\n\t/**\n\t * CSS class applied to interior sides of cover leaves (the endpaper).\n\t * Sets the page background to the cover color; the white endpaper inset\n\t * is created automatically by the infrastructure.\n\t */\n\tinteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the front cover interior specifically.\n\t */\n\tfrontInteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the back cover interior specifically.\n\t */\n\tbackInteriorCoverClassName?: string;\n\t/**\n\t * Inset size for the interior endpaper frame.\n\t * Any valid CSS length (e.g. \"5%\", \"12px\"). Default: \"5%\".\n\t */\n\tcoverInset?: string;\n}\n\n/**\n * Handlers for FlipBook events. Pass via the `handlers` prop.\n */\nexport interface FlipBookHandlers {\n\t/** Fired when a flip animation starts. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipping?: (params: PageFlipParams) => void;\n\t/** Fired when a flip completes. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipped?: (params: PageFlipParams) => void;\n}\n\n/**\n * Props for the FlipBook React component.\n */\nexport interface FlipBookProps {\n\t/** Array of React elements to render as pages */\n\tpages: React.ReactNode[];\n\t/** CSS class name for the flipbook container */\n\tclassName: string;\n\t/** Define which pages are covers for special styling */\n\tpageSemantics?: PageSemantics;\n\t/** Page bookmark content, placement, ordering, and optional click behavior. */\n\tbookmarkProvider?: BookmarkProvider;\n\t/** Opt in to bookmarks. Without a custom provider, use the TOC and its chapter entries. Default: false. */\n\tenableBookmarks?: boolean;\n\t/** Enable debug mode */\n\tdebug?: boolean;\n\t/** Reading direction: 'ltr' (left-to-right) or 'rtl' (right-to-left) */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Initial mouse interaction mode. Default: 'turn'. */\n\tmouseMode?: MouseMode;\n\t/** Optional localStorage key used to remember the user's mouse mode. */\n\tmouseModeStorageKey?: string;\n\t/** Indices of leaves that should start in the turned (flipped) state */\n\tinitialTurnedLeaves?: number[];\n\t/** Velocity threshold (px/s) for fast swipe to complete flip. Default: 500 */\n\tfastDeltaThreshold?: number;\n\t/**\n\t * Number of leaves to keep rendered before and after the current position.\n\t * When set, only leaves within the buffer range are visible for performance.\n\t * Default: undefined (all leaves are always rendered)\n\t */\n\tleavesBuffer?: number;\n\t/**\n\t * Configuration for cover pages (front and back covers).\n\t */\n\tcoverConfig?: CoverConfig;\n\t/**\n\t * Override for the \"of\" part of the page indicator (e.g. a gematria letter for the total, like \"נ\" for 50 in Hebrew books).\n\t * Defaults to total pages count when not set.\n\t */\n\tof?: string | number;\n\t/**\n\t * Aspect ratio for inner pages (text block leaves).\n\t * Default: { width: 2, height: 3 }\n\t */\n\tleafAspectRatio?: { width: number; height: number };\n\t/**\n\t * Aspect ratio for cover boards (slightly larger than leaf).\n\t * The delta between cover and leaf aspect ratios determines the visible frame.\n\t * Default: { width: 2.15, height: 3.15 }\n\t */\n\tcoverAspectRatio?: { width: number; height: number };\n\t/**\n\t * Event handlers. Use this to pass callbacks (e.g. onPageFlipped) instead of top-level props.\n\t */\n\thandlers?: FlipBookHandlers;\n\t/**\n\t * When set, syncs the flip-book with browser history: pushState on flip, restore page on back/forward,\n\t * and adopt the page named by the current URL on mount.\n\t * When omitted and enableHistory is not false, the built-in `#page/{name}` hash mapper is used.\n\t */\n\thistoryMapper?: HistoryMapper;\n\t/**\n\t * Table of contents page index (book-level). Populates the store used by goToToc command and TocButton.\n\t * Default: 4.\n\t */\n\ttocPageIndex?: number;\n\t/**\n\t * Download configuration: entire book and page-range handlers plus filename hints.\n\t * Toolbar's DownloadDropdown reads this from the flipbook ref.\n\t * When omitted and enableDownload is not false, the built-in JSON page-index default is used.\n\t */\n\tdownloadConfig?: DownloadConfig;\n\t/**\n\t * When false, disables the inner page shadow/highlight (e.g. to avoid flicker with multiple books).\n\t * Default: true.\n\t */\n\tpageShadow?: boolean;\n\t/**\n\t * When true, uses aggressive containment on pages during flip animations\n\t * so the browser can operate on a cached GPU texture rather than\n\t * re-rendering content every frame. Reduces jank when flipping rapidly.\n\t * Default: true.\n\t */\n\tsnapshotDuringFlip?: boolean;\n\t/**\n\t * When false, history integration is disabled entirely. When true or omitted, the provided\n\t * historyMapper is used, or the built-in hash-based default when none is provided.\n\t */\n\tenableHistory?: boolean;\n\t/**\n\t * When false, download is disabled entirely (getDownloadConfig returns undefined). When true or\n\t * omitted, the provided downloadConfig is used, or the built-in JSON page-index default when none\n\t * is provided.\n\t */\n\tenableDownload?: boolean;\n}\n\n/**\n * A React component for creating realistic page-flip animations.\n *\n * @example\n * ```tsx\n * import { FlipBook } from 'html-flip-book-react';\n *\n * function App() {\n * const ref = useRef<FlipBookHandle>(null);\n * return (\n * <FlipBook\n * ref={ref}\n * pages={[<div>Page 1</div>, <div>Page 2</div>]}\n * className=\"my-book\"\n * direction=\"ltr\"\n * />\n * );\n * }\n * ```\n */\nconst FlipBookReact = forwardRef<FlipBookHandle, FlipBookProps>(\n\t(\n\t\t{\n\t\t\tpages,\n\t\t\tclassName,\n\t\t\tdebug = false,\n\t\t\tdirection = \"ltr\",\n\t\t\tmouseMode = \"turn\",\n\t\t\tmouseModeStorageKey,\n\t\t\tpageSemantics = undefined,\n\t\t\tbookmarkProvider,\n\t\t\tenableBookmarks = false,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = true,\n\t\t\tsnapshotDuringFlip = true,\n\t\t\tenableHistory,\n\t\t\tenableDownload,\n\t\t\tcoverConfig,\n\t\t\tof,\n\t\t\tleafAspectRatio,\n\t\t\tcoverAspectRatio,\n\t\t\thandlers,\n\t\t\thistoryMapper,\n\t\t\ttocPageIndex,\n\t\t\tdownloadConfig,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [currentPageIndex, setCurrentPageIndex] = useState(() => {\n\t\t\t// Derive the initial page index from initialTurnedLeaves so the\n\t\t\t// leavesBuffer renders around the correct page on the very first\n\t\t\t// render — before the base flipbook's useEffect fires.\n\t\t\t// Must match the base flipbook's model: visible spread starts at\n\t\t\t// lastTurnedLeaf * 2 + 1 (back of the last turned leaf).\n\t\t\tif (initialTurnedLeaves && initialTurnedLeaves.length > 0) {\n\t\t\t\tconst lastTurnedLeaf = Math.max(...initialTurnedLeaves);\n\t\t\t\tconst firstVisiblePage = lastTurnedLeaf * 2 + 1;\n\t\t\t\tif (firstVisiblePage >= pages.length) {\n\t\t\t\t\tconst lastLeaf = Math.ceil(pages.length / 2) - 1;\n\t\t\t\t\treturn lastLeaf * 2;\n\t\t\t\t}\n\t\t\t\treturn firstVisiblePage;\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t\tconst setPageIndexRef = useRef(setCurrentPageIndex);\n\t\tconst [bookmarkSlots, setBookmarkSlots] = useState<BookmarkSlot[]>([]);\n\t\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\t// Debounce buffer-related re-renders during rapid consecutive page flips.\n\t\t// When leavesBuffer is set, each onPageChanged triggers a React re-render\n\t\t// that recalculates which pages to mount/unmount — expensive with complex\n\t\t// content (e.g. Hebrew text, perushim). By debouncing, rapid flips (>1 at\n\t\t// a time) batch into a single re-render after settling. The page indicator\n\t\t// reads directly from the imperative handle (flipBook.current) and is not\n\t\t// affected by this debounce.\n\t\tconst BUFFER_DEBOUNCE_MS = 80;\n\t\tconst pageChangedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\t// Leaves whose flip animation is in flight. The base keeps their page\n\t\t// wrappers visible even outside the leavesBuffer window, so their content\n\t\t// must stay mounted too — otherwise a revealed flipping page renders blank\n\t\t// (issue #167). Cleared once flips settle and the buffer window recenters.\n\t\tconst inflightLeavesRef = useRef<Set<number>>(new Set());\n\t\tconst [, setInflightVersion] = useState(0);\n\t\tconst onPageChangedRef = useRef((index: number) => {\n\t\t\tsetPageIndexRef.current?.(index);\n\t\t});\n\t\tonPageChangedRef.current = (index: number) => {\n\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t}\n\t\t\tif (leavesBuffer == null) {\n\t\t\t\t// No buffer — update immediately; no expensive mount/unmount cycle.\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpageChangedTimerRef.current = setTimeout(() => {\n\t\t\t\tpageChangedTimerRef.current = null;\n\t\t\t\tinflightLeavesRef.current.clear();\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\t\tconst onPageFlippingRef = useRef((params: PageFlipParams) => {\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t});\n\t\tonPageFlippingRef.current = (params) => {\n\t\t\tif (leavesBuffer != null) {\n\t\t\t\t// The flipping leaf holds the page on the trailing edge of the target\n\t\t\t\t// spread: backward flips carry pageIndices[1] on their back, forward\n\t\t\t\t// flips carry pageIndices[0] on their front.\n\t\t\t\tconst edgePage =\n\t\t\t\t\tparams.direction === \"backward\" ? params.pageIndices[1] : params.pageIndices[0];\n\t\t\t\tconst flippingLeaf = Math.floor(edgePage / 2);\n\t\t\t\tif (!inflightLeavesRef.current.has(flippingLeaf)) {\n\t\t\t\t\tinflightLeavesRef.current.add(flippingLeaf);\n\t\t\t\t\tsetInflightVersion((v) => v + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t};\n\n\t\t// Clean up debounce timer on unmount.\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tenableBookmarks,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\n\t\t\t\tmouseMode,\n\t\t\t\tinitialTurnedLeaves: initialTurnedLeaves,\n\t\t\t\tfastDeltaThreshold: fastDeltaThreshold,\n\t\t\t\tleavesBuffer: leavesBuffer,\n\t\t\t\tleafAspectRatio: leafAspectRatio,\n\t\t\t\tcoverAspectRatio: coverAspectRatio,\n\t\t\t\tcoverPageIndices: coverConfig?.coverIndices,\n\t\t\t\tonPageChanged: (index: number) => onPageChangedRef.current(index),\n\t\t\t\tonPageFlipping: (params) => onPageFlippingRef.current(params),\n\t\t\t\tonPageFlipped: handlers?.onPageFlipped,\n\t\t\t\thistoryMapper,\n\t\t\t\ttocPageIndex: tocPageIndex ?? 4,\n\t\t\t\tdownloadConfig,\n\t\t\t\tpageShadow,\n\t\t\t\tsnapshotDuringFlip,\n\t\t\t\tenableHistory,\n\t\t\t\tenableDownload,\n\t\t\t}),\n\t\t);\n\n\t\t// Expose imperative handle: flipbook methods (called by commands) and getters (for UI)\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ({\n\t\t\t\tflipNext: () => flipBook.current.flipNext(),\n\t\t\t\tflipPrev: () => flipBook.current.flipPrev(),\n\t\t\t\tflipToPage: (pageIndex: number) => flipBook.current.flipToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\trestorePage: (pageIndex: number) => flipBook.current.restorePage(pageIndex),\n\t\t\t\ttoggleDebugBar: () => {\n\t\t\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\t\t\tconst root = document.querySelector(`.${selectorClass}`);\n\t\t\t\t\tconst bar = root?.querySelector(\".flipbook-debug-bar\");\n\t\t\t\t\tif (bar) bar.classList.toggle(\"flipbook-debug-bar--hidden\");\n\t\t\t\t},\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tgetOf: () => (ofRef.current !== undefined ? ofRef.current : flipBook.current.totalPages),\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t\tgetDownloadConfig: () => flipBook.current.getDownloadConfig(),\n\t\t\t\tgetTocPageIndex: () => flipBook.current.getTocPageIndex(),\n\t\t\t\tgetMouseMode: () => flipBook.current.getMouseMode(),\n\t\t\t\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => {\n\t\t\t\t\tflipBook.current.setMouseMode(mode);\n\t\t\t\t\tif (mouseModeStorageKey && options?.persist !== false) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlocalStorage.setItem(mouseModeStorageKey, mode);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Private browsing may deny storage; the mode still works this session.\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t\t[className, mouseModeStorageKey],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tcurrentFlipBook.render(`.${selectorClass}`, debug);\n\t\t\tif (mouseModeStorageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst savedMode = localStorage.getItem(mouseModeStorageKey);\n\t\t\t\t\tif (savedMode === \"turn\" || savedMode === \"select\")\n\t\t\t\t\t\tcurrentFlipBook.setMouseMode(savedMode);\n\t\t\t\t} catch {\n\t\t\t\t\t// Storage is optional.\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetCurrentPageIndex(currentFlipBook.currentPageIndex);\n\n\t\t\t// Cleanup function to destroy Hammer instance and event listeners\n\t\t\treturn () => {\n\t\t\t\tcurrentFlipBook.destroy();\n\t\t\t};\n\t\t}, [className, debug, mouseModeStorageKey]);\n\n\t\tconst previousBookmarksEnabled = useRef(enableBookmarks);\n\t\tuseEffect(() => {\n\t\t\tif (previousBookmarksEnabled.current === enableBookmarks) return;\n\t\t\tpreviousBookmarksEnabled.current = enableBookmarks;\n\t\t\tflipBook.current.setBookmarksEnabled(enableBookmarks);\n\t\t}, [enableBookmarks]);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tif (!bookmarkProvider) {\n\t\t\t\tsetBookmarkSlots([]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet active = true;\n\t\t\tconst slots = new Map<string, BookmarkSlot>();\n\t\t\tconst renderSlot = (bookmark: Bookmark, expanded: boolean): HTMLElement => {\n\t\t\t\tconst key = `${expanded ? \"expanded\" : \"brief\"}:${bookmark.id}`;\n\t\t\t\tlet slot = slots.get(key);\n\t\t\t\tif (!slot) {\n\t\t\t\t\tslot = {\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tbookmark,\n\t\t\t\t\t\telement: document.createElement(\"span\"),\n\t\t\t\t\t\trenderer: expanded\n\t\t\t\t\t\t\t? bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t\t\t: bookmarkProvider.renderBookmark,\n\t\t\t\t\t};\n\t\t\t\t\tslots.set(key, slot);\n\t\t\t\t}\n\t\t\t\tslot.bookmark = bookmark;\n\t\t\t\treturn slot.element;\n\t\t\t};\n\t\t\tconst provider: BaseBookmarkProvider = {\n\t\t\t\t...bookmarkProvider,\n\t\t\t\tgetBookmarks: (context) => {\n\t\t\t\t\tconst bookmarks = bookmarkProvider.getBookmarks(context);\n\t\t\t\t\tconst ids = new Set(bookmarks.map((bookmark) => bookmark.id));\n\t\t\t\t\tfor (const [key, slot] of slots) {\n\t\t\t\t\t\tif (!ids.has(slot.bookmark.id)) slots.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\t// The base renderer creates the slots synchronously after this query.\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tif (!active) return;\n\t\t\t\t\t\tfor (const [id, slot] of slots) {\n\t\t\t\t\t\t\tif (!slot.element.isConnected) slots.delete(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetBookmarkSlots([...slots.values()]);\n\t\t\t\t\t});\n\t\t\t\t\treturn bookmarks;\n\t\t\t\t},\n\t\t\t\trenderBookmark: (bookmark) => renderSlot(bookmark, false),\n\t\t\t\trenderExpandedBookmark: bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t? (bookmark) => renderSlot(bookmark, true)\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t\tcurrentFlipBook.setBookmarkProvider(provider);\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t\tcurrentFlipBook.setBookmarkProvider(undefined);\n\t\t\t};\n\t\t}, [bookmarkProvider]);\n\n\t\t// Sync pageShadow to DOM when prop changes (base option is set at construct time).\n\t\tuseEffect(() => {\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tconst el = document.querySelector(`.${selectorClass}`);\n\t\t\tif (!el) return;\n\t\t\tif (pageShadow) {\n\t\t\t\tel.classList.remove(\"flipbook--no-page-shadow\");\n\t\t\t} else {\n\t\t\t\tel.classList.add(\"flipbook--no-page-shadow\");\n\t\t\t}\n\t\t}, [className, pageShadow]);\n\n\t\t// Use Children.toArray to get stable keys for each page element\n\t\tconst pagesWithKeys = Children.toArray(pages);\n\t\tconst totalPages = pagesWithKeys.length;\n\n\t\t// Determine cover page indices\n\t\tconst coverIndicesSet = new Set(\n\t\t\tcoverConfig?.coverIndices === \"auto\"\n\t\t\t\t? [0, totalPages - 1]\n\t\t\t\t: (coverConfig?.coverIndices ?? [0]),\n\t\t);\n\t\tconst isCoverPage = (index: number) => coverIndicesSet.has(index);\n\n\t\t// Compute interior cover page indices (the other side of each cover leaf).\n\t\t// Leaf pairs: [0,1], [2,3], ... — interior is the paired page on the same leaf.\n\t\tconst interiorCoverMap = new Map<number, \"front\" | \"back\">();\n\t\tif (\n\t\t\tcoverConfig?.interiorCoverClassName ||\n\t\t\tcoverConfig?.frontInteriorCoverClassName ||\n\t\t\tcoverConfig?.backInteriorCoverClassName\n\t\t) {\n\t\t\tfor (const coverIdx of coverIndicesSet) {\n\t\t\t\tconst interiorIdx = coverIdx % 2 === 0 ? coverIdx + 1 : coverIdx - 1;\n\t\t\t\tif (interiorIdx >= 0 && interiorIdx < totalPages && !coverIndicesSet.has(interiorIdx)) {\n\t\t\t\t\t// First cover index = front, others = back\n\t\t\t\t\tconst role = coverIdx === Math.min(...coverIndicesSet) ? \"front\" : \"back\";\n\t\t\t\t\tinteriorCoverMap.set(interiorIdx, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst coverInset = coverConfig?.coverInset ?? \"5%\";\n\n\t\t// Build CSS class for a page\n\t\tconst getPageClassName = (index: number): string => {\n\t\t\tconst classes = [\"page\"];\n\t\t\tif (isCoverPage(index)) {\n\t\t\t\tclasses.push(\"page--cover\");\n\t\t\t\tif (coverConfig?.hardCovers) {\n\t\t\t\t\tclasses.push(\"page--hard\");\n\t\t\t\t}\n\t\t\t\tif (coverConfig?.noShadow) {\n\t\t\t\t\tclasses.push(\"page--no-shadow\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst interiorRole = interiorCoverMap.get(index);\n\t\t\tif (interiorRole) {\n\t\t\t\tclasses.push(\"page--cover-interior\");\n\t\t\t\tconst cls =\n\t\t\t\t\tinteriorRole === \"front\"\n\t\t\t\t\t\t? (coverConfig?.frontInteriorCoverClassName ?? coverConfig?.interiorCoverClassName)\n\t\t\t\t\t\t: (coverConfig?.backInteriorCoverClassName ?? coverConfig?.interiorCoverClassName);\n\t\t\t\tif (cls) classes.push(cls);\n\t\t\t}\n\t\t\treturn classes.join(\" \");\n\t\t};\n\n\t\t// When leavesBuffer is set, only mount content for pages within the buffer (keep .page wrappers for layout).\n\t\t// Use a small margin so content is ready before vanilla shows the leaf (avoids empty flash when flipping).\n\t\t// Cover pages are always mounted — they are cover-sized and sit behind leaf-sized pages,\n\t\t// acting as the physical book boards. Unmounting them would remove the realistic frame effect.\n\t\tconst contentByIndex =\n\t\t\tleavesBuffer != null && totalPages > 0\n\t\t\t\t? (() => {\n\t\t\t\t\t\tconst currentLeaf = Math.floor(currentPageIndex / 2);\n\t\t\t\t\t\tconst leavesCount = Math.ceil(totalPages / 2);\n\t\t\t\t\t\tconst margin = 2; // extra leaves each side so content exists when vanilla reveals them\n\t\t\t\t\t\tconst leafStart = Math.max(0, currentLeaf - leavesBuffer - margin);\n\t\t\t\t\t\tconst leafEnd = Math.min(leavesCount - 1, currentLeaf + leavesBuffer + margin);\n\t\t\t\t\t\tconst pageStart = leafStart * 2;\n\t\t\t\t\t\tconst pageEnd = Math.min(totalPages - 1, leafEnd * 2 + 1);\n\t\t\t\t\t\tconst inRange = new Set(\n\t\t\t\t\t\t\tArray.from({ length: pageEnd - pageStart + 1 }, (_, i) => pageStart + i),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Always include cover leaf pages so the larger cover boards remain mounted.\n\t\t\t\t\t\tfor (const idx of coverIndicesSet) {\n\t\t\t\t\t\t\tinRange.add(idx);\n\t\t\t\t\t\t\t// Also include the other side of the cover leaf\n\t\t\t\t\t\t\tconst partner = idx % 2 === 0 ? idx + 1 : idx - 1;\n\t\t\t\t\t\t\tif (partner >= 0 && partner < totalPages) {\n\t\t\t\t\t\t\t\tinRange.add(partner);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (index: number) =>\n\t\t\t\t\t\t\tinRange.has(index) || inflightLeavesRef.current.has(Math.floor(index / 2))\n\t\t\t\t\t\t\t\t? (pagesWithKeys.at(index) ?? null)\n\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys.at(index) ?? null;\n\n\t\t/** Wrap interior cover pages with the endpaper inset frame (3-sided: no inset on spine). */\n\t\tconst renderPageContent = (index: number) => {\n\t\t\tconst content = contentByIndex(index);\n\t\t\tif (interiorCoverMap.has(index)) {\n\t\t\t\t// Determine spine side: even pages (engine convention: pageIndex%2===1) are on the\n\t\t\t\t// left in LTR / right in RTL. Their spine is on the opposite side.\n\t\t\t\tconst isEvenPage = index % 2 === 1; // engine: (pageIndex+1)%2===1 → odd; so %2===1 → even\n\t\t\t\tconst spineOnRight = isEvenPage !== (direction === \"rtl\");\n\t\t\t\tconst insetStyle = {\n\t\t\t\t\t\"--cover-inset\": coverInset,\n\t\t\t\t\t...(spineOnRight ? { \"--cover-inset-right\": \"0px\" } : { \"--cover-inset-left\": \"0px\" }),\n\t\t\t\t} as Record<string, string>;\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"page--cover-interior-inset\" style={insetStyle}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn content;\n\t\t};\n\n\t\treturn (\n\t\t\t<div className={className}>\n\t\t\t\t{pagesWithKeys.map((_, index) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: stable slot identity for buffer/mount correctness\n\t\t\t\t\t\tkey={`page-${index}`}\n\t\t\t\t\t\tclassName={getPageClassName(index)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flipbook-page-scrollport\">\n\t\t\t\t\t\t\t<div className=\"flipbook-page-content\" dir={direction}>\n\t\t\t\t\t\t\t\t{renderPageContent(index)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t{bookmarkSlots.map(({ key, bookmark, element, renderer }) =>\n\t\t\t\t\tcreatePortal(renderer ? renderer(bookmark) : bookmark.label, element, key),\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\n\nFlipBookReact.displayName = \"FlipBook\";\n\nexport { FlipBookReact as FlipBook };\nexport type {\n\tBookmark,\n\tBookmarkContext,\n\tBookmarkPlacement,\n\tFlipPageSemantic,\n\tHistoryMapper,\n\tMouseMode,\n\tPageFlipParams,\n\tPageSemantics,\n} from \"html-flip-book-vanilla\";\nexport { createDefaultHistoryMapper } from \"html-flip-book-vanilla\";\nexport type { TocEntry, TocPageProps } from \"./TocPage\";\nexport { TocPage } from \"./TocPage\";\n"],"names":["defaultFilter","entry","TocPage","onNavigate","totalPages","pageSemantics","heading","className","direction","filter","getHref","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","href","pageOrSemantic","content","jsxs","Fragment","jsx","event","FlipBookReact","forwardRef","pages","debug","mouseMode","mouseModeStorageKey","bookmarkProvider","enableBookmarks","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","snapshotDuringFlip","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","firstVisiblePage","setPageIndexRef","useRef","bookmarkSlots","setBookmarkSlots","ofRef","BUFFER_DEBOUNCE_MS","pageChangedTimerRef","inflightLeavesRef","setInflightVersion","onPageChangedRef","index","onPageFlippingRef","params","edgePage","flippingLeaf","v","useEffect","flipBook","FlipBookBase","useImperativeHandle","pageIndex","selectorClass","bar","mode","options","currentFlipBook","savedMode","previousBookmarksEnabled","active","slots","renderSlot","bookmark","expanded","key","slot","provider","context","bookmarks","ids","id","el","pagesWithKeys","Children","coverIndicesSet","isCoverPage","interiorCoverMap","coverIdx","interiorIdx","role","coverInset","getPageClassName","classes","interiorRole","cls","contentByIndex","currentLeaf","leavesCount","margin","leafStart","leafEnd","pageStart","pageEnd","inRange","_","idx","partner","renderPageContent","spineOnRight","insetStyle","element","renderer","createPortal"],"mappings":";;;;;AAiDA,MAAMA,KAAgB,CAACC,MAA6BA,EAAM,MAAM,SAAS,GAoBnEC,KAAkC,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAST;AAAA,EACT,SAAAU;AAAA,EACA,aAAAC;AACD,MAAM;AAEL,QAAMC,IAAsB,CAAA;AAC5B,WAASC,IAAI,GAAGA,IAAIT,GAAYS,KAAK;AACpC,UAAMC,IAAQT,GAAe,aAAaQ,CAAC,KAAK,IAC1CE,IAAeV,GAAe,oBAAoBQ,CAAC,KAAK,IACxDZ,IAAkB,EAAE,WAAWY,GAAG,OAAAC,GAAO,cAAAC,EAAA;AAE/C,IAAIN,EAAOR,GAAOY,CAAC,KAClBD,EAAQ,KAAKX,CAAK;AAAA,EAEpB;AAEA,QAAMe,IAAqB,CAACf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e,EAAE,uBAAuB,UAAU,EAAE,sBAAsB,MAAA;AAAA,QAAM;AAErF,iCACE,OAAA,EAAI,WAAU,8BAA6B,OAAOC,GACjD,UAAArG,GACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,WACC,gBAAAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAAuF,EAAc,IAAI,CAACsB,GAAGrD,MACtB,gBAAAxC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWgF,GAAiBxC,CAAK;AAAA,UAEjC,UAAA,gBAAAxC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAA+G,GAAkBxD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAR,GAAc;AAAA,QAAI,CAAC,EAAE,KAAA+B,GAAK,UAAAF,GAAU,SAAAsC,GAAS,UAAAC,EAAA,MAC7CC,GAAaD,IAAWA,EAASvC,CAAQ,IAAIA,EAAS,OAAOsC,GAASpC,CAAG;AAAA,MAAA;AAAA,IAC1E,GACD;AAAA,EAEF;AACD;AAEA7D,GAAc,cAAc;"}
1
+ {"version":3,"file":"flip-book.js","sources":["../src/TocPage.tsx","../src/FlipBook.tsx"],"sourcesContent":["import type { PageSemantics } from \"html-flip-book-vanilla\";\nimport type React from \"react\";\nimport \"./TocPage.css\";\n\n/**\n * Entry in the table of contents.\n */\nexport interface TocEntry {\n\t/** Page index to navigate to */\n\tpageIndex: number;\n\t/** Display title (from pageSemantics.indexToTitle or custom) */\n\ttitle: string;\n\t/** Semantic page name/number (from pageSemantics.indexToSemanticName) */\n\tsemanticName: string;\n}\n\n/**\n * Props for the TocPage component.\n */\nexport interface TocPageProps {\n\t/** Callback to navigate to a specific page */\n\tonNavigate: (pageIndex: number) => void;\n\t/** Total number of pages in the book */\n\ttotalPages: number;\n\t/** Page semantics for generating titles and page numbers */\n\tpageSemantics?: PageSemantics;\n\t/** Custom heading text. Default: \"Table of Contents\" */\n\theading?: string;\n\t/** Custom CSS class for the container */\n\tclassName?: string;\n\t/** Reading direction for RTL support */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/**\n\t * Filter function to determine which pages appear in TOC.\n\t * By default, only pages with a title are included.\n\t */\n\tfilter?: (entry: TocEntry, pageIndex: number) => boolean;\n\t/** URL for an entry. When provided, modified clicks use native browser navigation. */\n\tgetHref?: (entry: TocEntry) => string | null | undefined;\n\t/**\n\t * Custom render function for TOC entries.\n\t * If not provided, uses default rendering.\n\t */\n\trenderEntry?: (entry: TocEntry, onClick: () => void, href?: string) => React.ReactNode;\n}\n\n/**\n * Default filter: include pages that have a non-empty title.\n */\nconst defaultFilter = (entry: TocEntry): boolean => entry.title.length > 0;\n\n/**\n * A table of contents page component for FlipBook.\n *\n * Automatically generates TOC entries from pageSemantics, showing pages\n * that have titles. Entries display title with fallback to semantic name,\n * then page index.\n *\n * @example\n * ```tsx\n * <TocPage\n * onNavigate={(pageIndex) => flipBookRef.current?.flipToPage(pageIndex)}\n * totalPages={20}\n * pageSemantics={mySemantics}\n * heading=\"Contents\"\n * direction=\"rtl\"\n * />\n * ```\n */\nconst TocPage: React.FC<TocPageProps> = ({\n\tonNavigate,\n\ttotalPages,\n\tpageSemantics,\n\theading = \"Table of Contents\",\n\tclassName,\n\tdirection = \"ltr\",\n\tfilter = defaultFilter,\n\tgetHref,\n\trenderEntry,\n}) => {\n\t// Generate TOC entries for all pages\n\tconst entries: TocEntry[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst entry: TocEntry = { pageIndex: i, title, semanticName };\n\n\t\tif (filter(entry, i)) {\n\t\t\tentries.push(entry);\n\t\t}\n\t}\n\n\tconst renderDefaultEntry = (entry: TocEntry, onClick: () => void, href?: string) => {\n\t\t// Title on one side (left in LTR, right in RTL); semantic name or page index on the other\n\t\tconst title = entry.title || entry.semanticName || `Page ${entry.pageIndex + 1}`;\n\t\tconst pageOrSemantic = entry.semanticName || String(entry.pageIndex + 1);\n\n\t\tconst content = (\n\t\t\t<>\n\t\t\t\t<span className=\"toc-title\">{title}</span>\n\t\t\t\t<span className=\"toc-dots\" aria-hidden />\n\t\t\t\t<span className=\"toc-page-num\">{pageOrSemantic}</span>\n\t\t\t</>\n\t\t);\n\n\t\treturn (\n\t\t\t<li key={entry.pageIndex}>\n\t\t\t\t{href ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={href}\n\t\t\t\t\t\tclassName=\"toc-link\"\n\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.button !== 0 ||\n\t\t\t\t\t\t\t\tevent.ctrlKey ||\n\t\t\t\t\t\t\t\tevent.metaKey ||\n\t\t\t\t\t\t\t\tevent.shiftKey ||\n\t\t\t\t\t\t\t\tevent.altKey\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonClick();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<button type=\"button\" className=\"toc-link\" onClick={onClick}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</li>\n\t\t);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`toc-page ${className ?? \"\"}`.trim()}\n\t\t\tstyle={{ direction, textAlign: direction === \"rtl\" ? \"right\" : \"left\" }}\n\t\t>\n\t\t\t<div className=\"toc-page__scroll\">\n\t\t\t\t<h2 className=\"toc-heading\">{heading}</h2>\n\t\t\t\t<ul className=\"toc-list\">\n\t\t\t\t\t{entries.map((entry) => {\n\t\t\t\t\t\tconst onClick = () => onNavigate(entry.pageIndex);\n\t\t\t\t\t\tconst href = getHref?.(entry) ?? undefined;\n\t\t\t\t\t\treturn renderEntry\n\t\t\t\t\t\t\t? renderEntry(entry, onClick, href)\n\t\t\t\t\t\t\t: renderDefaultEntry(entry, onClick, href);\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport { TocPage };\n","import {\n\ttype BookmarkProvider as BaseBookmarkProvider,\n\ttype Bookmark,\n\tFlipBook as FlipBookBase,\n\ttype HistoryMapper,\n\ttype MouseMode,\n\ttype PageFlipParams,\n\ttype PageSemantics,\n} from \"html-flip-book-vanilla\";\nimport \"../../base/src/mouse-mode.scss\";\nimport type { DownloadConfig } from \"html-flip-book-vanilla/download\";\nimport type React from \"react\";\nimport { Children, forwardRef, useEffect, useImperativeHandle, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\n/** Bookmark content is rendered with React and keeps access to the consumer's contexts. */\nexport type BookmarkProvider = BaseBookmarkProvider<React.ReactNode>;\n\ninterface BookmarkSlot {\n\tkey: string;\n\tbookmark: Bookmark;\n\telement: HTMLElement;\n\trenderer: BookmarkProvider[\"renderBookmark\"];\n}\n\n/**\n * Imperative handle exposed via ref for programmatic control of the FlipBook.\n * Flipbook methods (flipNext, jumpToPage, etc.) are called internally by commands;\n * consumers interact through commands (execute) and getters (ref).\n *\n * @example\n * ```tsx\n * const ref = useRef<FlipBookHandle>(null);\n * const page = ref.current?.getCurrentPageIndex();\n * ```\n */\nexport interface FlipBookHandle {\n\t/** Animate flip to the next page */\n\tflipNext: () => Promise<void>;\n\t/** Animate flip to the previous page */\n\tflipPrev: () => Promise<void>;\n\t/** Animate flip to a specific page index */\n\tflipToPage: (pageIndex: number) => Promise<void>;\n\t/** Jump to a specific page instantly without animation */\n\tjumpToPage: (pageIndex: number) => void;\n\t/** Show a router-selected page without adding a browser history entry. */\n\trestorePage: (pageIndex: number) => void;\n\t/** Toggle debug toolbar visibility (when debug mode is enabled). Bound to Ctrl+Alt+D by default. */\n\ttoggleDebugBar?: () => void;\n\t/** Get the current (leftmost visible) page index */\n\tgetCurrentPageIndex: () => number;\n\t/** Get the total number of pages */\n\tgetTotalPages: () => number;\n\t/** Get the \"of\" value for the indicator (e.g. total label). Defaults to total pages when not set. */\n\tgetOf: () => string | number;\n\t/** Check if currently at the first page */\n\tisFirstPage: () => boolean;\n\t/** Check if currently at the last page */\n\tisLastPage: () => boolean;\n\t/** Get download configuration for the book. Undefined when no download is configured. */\n\tgetDownloadConfig: () => DownloadConfig | undefined;\n\t/** Get the configured table of contents page index. */\n\tgetTocPageIndex: () => number;\n\t/** Current mouse interaction mode. Touch gestures are unaffected. */\n\tgetMouseMode: () => MouseMode;\n\t/** Switch between continuous page turning and native text selection. */\n\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => void;\n}\n\n/**\n * Configuration for book covers.\n */\nexport interface CoverConfig {\n\t/**\n\t * Make covers \"hard\" - no page curl effect on covers.\n\t * When true, cover pages appear flat without the soft page bend.\n\t * Default: false\n\t */\n\thardCovers?: boolean;\n\t/**\n\t * Disable shadow effects on cover pages.\n\t * Default: false\n\t */\n\tnoShadow?: boolean;\n\t/**\n\t * Page indices that are considered cover pages.\n\t * Default: [0] (front cover only). Use [0, totalPages-1] for front and back covers.\n\t * If \"auto\", uses first and last pages as covers.\n\t */\n\tcoverIndices?: number[] | \"auto\";\n\t/**\n\t * CSS class applied to interior sides of cover leaves (the endpaper).\n\t * Sets the page background to the cover color; the white endpaper inset\n\t * is created automatically by the infrastructure.\n\t */\n\tinteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the front cover interior specifically.\n\t */\n\tfrontInteriorCoverClassName?: string;\n\t/**\n\t * Override interiorCoverClassName for the back cover interior specifically.\n\t */\n\tbackInteriorCoverClassName?: string;\n\t/**\n\t * Inset size for the interior endpaper frame.\n\t * Any valid CSS length (e.g. \"5%\", \"12px\"). Default: \"5%\".\n\t */\n\tcoverInset?: string;\n}\n\n/**\n * Handlers for FlipBook events. Pass via the `handlers` prop.\n */\nexport interface FlipBookHandlers {\n\t/** Fired when a flip animation starts. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipping?: (params: PageFlipParams) => void;\n\t/** Fired when a flip completes. Params: leaf index, page indices, semantics, direction. */\n\tonPageFlipped?: (params: PageFlipParams) => void;\n}\n\n/**\n * Props for the FlipBook React component.\n */\nexport interface FlipBookProps {\n\t/** Array of React elements to render as pages */\n\tpages: React.ReactNode[];\n\t/** CSS class name for the flipbook container */\n\tclassName: string;\n\t/** Define which pages are covers for special styling */\n\tpageSemantics?: PageSemantics;\n\t/** Page bookmark content, placement, ordering, and optional click behavior. */\n\tbookmarkProvider?: BookmarkProvider;\n\t/** Opt in to bookmarks. Without a custom provider, use the TOC and its chapter entries. Default: false. */\n\tenableBookmarks?: boolean;\n\t/** Enable debug mode */\n\tdebug?: boolean;\n\t/** Reading direction: 'ltr' (left-to-right) or 'rtl' (right-to-left) */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Initial mouse interaction mode. Default: 'turn'. */\n\tmouseMode?: MouseMode;\n\t/** Optional localStorage key used to remember the user's mouse mode. */\n\tmouseModeStorageKey?: string;\n\t/** Indices of leaves that should start in the turned (flipped) state */\n\tinitialTurnedLeaves?: number[];\n\t/** Velocity threshold (px/s) for fast swipe to complete flip. Default: 500 */\n\tfastDeltaThreshold?: number;\n\t/**\n\t * Number of leaves to keep rendered before and after the current position.\n\t * When set, only leaves within the buffer range are visible for performance.\n\t * Default: undefined (all leaves are always rendered)\n\t */\n\tleavesBuffer?: number;\n\t/**\n\t * Configuration for cover pages (front and back covers).\n\t */\n\tcoverConfig?: CoverConfig;\n\t/**\n\t * Override for the \"of\" part of the page indicator (e.g. a gematria letter for the total, like \"נ\" for 50 in Hebrew books).\n\t * Defaults to total pages count when not set.\n\t */\n\tof?: string | number;\n\t/**\n\t * Aspect ratio for inner pages (text block leaves).\n\t * Default: { width: 2, height: 3 }\n\t */\n\tleafAspectRatio?: { width: number; height: number };\n\t/**\n\t * Aspect ratio for cover boards (slightly larger than leaf).\n\t * The delta between cover and leaf aspect ratios determines the visible frame.\n\t * Default: { width: 2.15, height: 3.15 }\n\t */\n\tcoverAspectRatio?: { width: number; height: number };\n\t/**\n\t * Event handlers. Use this to pass callbacks (e.g. onPageFlipped) instead of top-level props.\n\t */\n\thandlers?: FlipBookHandlers;\n\t/**\n\t * When set, syncs the flip-book with browser history: pushState on flip, restore page on back/forward,\n\t * and adopt the page named by the current URL on mount.\n\t * When omitted and enableHistory is not false, the built-in `#page/{name}` hash mapper is used.\n\t */\n\thistoryMapper?: HistoryMapper;\n\t/**\n\t * Table of contents page index (book-level). Populates the store used by goToToc command and TocButton.\n\t * Default: 4.\n\t */\n\ttocPageIndex?: number;\n\t/**\n\t * Download configuration: entire book and page-range handlers plus filename hints.\n\t * Toolbar's DownloadDropdown reads this from the flipbook ref.\n\t * When omitted and enableDownload is not false, the built-in JSON page-index default is used.\n\t */\n\tdownloadConfig?: DownloadConfig;\n\t/**\n\t * When false, disables the inner page shadow/highlight (e.g. to avoid flicker with multiple books).\n\t * Default: true.\n\t */\n\tpageShadow?: boolean;\n\t/**\n\t * When true, uses aggressive containment on pages during flip animations\n\t * so the browser can operate on a cached GPU texture rather than\n\t * re-rendering content every frame. Reduces jank when flipping rapidly.\n\t * Default: true.\n\t */\n\tsnapshotDuringFlip?: boolean;\n\t/**\n\t * When false, history integration is disabled entirely. When true or omitted, the provided\n\t * historyMapper is used, or the built-in hash-based default when none is provided.\n\t */\n\tenableHistory?: boolean;\n\t/**\n\t * When false, download is disabled entirely (getDownloadConfig returns undefined). When true or\n\t * omitted, the provided downloadConfig is used, or the built-in JSON page-index default when none\n\t * is provided.\n\t */\n\tenableDownload?: boolean;\n}\n\n/**\n * A React component for creating realistic page-flip animations.\n *\n * @example\n * ```tsx\n * import { FlipBook } from 'html-flip-book-react';\n *\n * function App() {\n * const ref = useRef<FlipBookHandle>(null);\n * return (\n * <FlipBook\n * ref={ref}\n * pages={[<div>Page 1</div>, <div>Page 2</div>]}\n * className=\"my-book\"\n * direction=\"ltr\"\n * />\n * );\n * }\n * ```\n */\nconst FlipBookReact = forwardRef<FlipBookHandle, FlipBookProps>(\n\t(\n\t\t{\n\t\t\tpages,\n\t\t\tclassName,\n\t\t\tdebug = false,\n\t\t\tdirection = \"ltr\",\n\t\t\tmouseMode = \"turn\",\n\t\t\tmouseModeStorageKey,\n\t\t\tpageSemantics = undefined,\n\t\t\tbookmarkProvider,\n\t\t\tenableBookmarks = false,\n\t\t\tinitialTurnedLeaves = [],\n\t\t\tfastDeltaThreshold,\n\t\t\tleavesBuffer,\n\t\t\tpageShadow = true,\n\t\t\tsnapshotDuringFlip = true,\n\t\t\tenableHistory,\n\t\t\tenableDownload,\n\t\t\tcoverConfig,\n\t\t\tof,\n\t\t\tleafAspectRatio,\n\t\t\tcoverAspectRatio,\n\t\t\thandlers,\n\t\t\thistoryMapper,\n\t\t\ttocPageIndex,\n\t\t\tdownloadConfig,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst [currentPageIndex, setCurrentPageIndex] = useState(() => {\n\t\t\t// Derive the initial page index from initialTurnedLeaves so the\n\t\t\t// leavesBuffer renders around the correct page on the very first\n\t\t\t// render — before the base flipbook's useEffect fires.\n\t\t\t// Must match the base flipbook's model: visible spread starts at\n\t\t\t// lastTurnedLeaf * 2 + 1 (back of the last turned leaf).\n\t\t\tif (initialTurnedLeaves && initialTurnedLeaves.length > 0) {\n\t\t\t\tconst lastTurnedLeaf = Math.max(...initialTurnedLeaves);\n\t\t\t\tconst firstVisiblePage = lastTurnedLeaf * 2 + 1;\n\t\t\t\tif (firstVisiblePage >= pages.length) {\n\t\t\t\t\tconst lastLeaf = Math.ceil(pages.length / 2) - 1;\n\t\t\t\t\treturn lastLeaf * 2;\n\t\t\t\t}\n\t\t\t\treturn firstVisiblePage;\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t\tconst setPageIndexRef = useRef(setCurrentPageIndex);\n\t\tconst [bookmarkSlots, setBookmarkSlots] = useState<BookmarkSlot[]>([]);\n\t\tsetPageIndexRef.current = setCurrentPageIndex;\n\t\tconst ofRef = useRef(of);\n\t\tofRef.current = of;\n\n\t\t// Debounce buffer-related re-renders during rapid consecutive page flips.\n\t\t// When leavesBuffer is set, each onPageChanged triggers a React re-render\n\t\t// that recalculates which pages to mount/unmount — expensive with complex\n\t\t// content (e.g. Hebrew text, perushim). By debouncing, rapid flips (>1 at\n\t\t// a time) batch into a single re-render after settling. The page indicator\n\t\t// reads directly from the imperative handle (flipBook.current) and is not\n\t\t// affected by this debounce.\n\t\tconst BUFFER_DEBOUNCE_MS = 80;\n\t\tconst pageChangedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\t\t// Leaves whose flip animation is in flight. The base keeps their page\n\t\t// wrappers visible even outside the leavesBuffer window, so their content\n\t\t// must stay mounted too — otherwise a revealed flipping page renders blank\n\t\t// (issue #167). Cleared once flips settle and the buffer window recenters.\n\t\tconst inflightLeavesRef = useRef<Set<number>>(new Set());\n\t\tconst [, setInflightVersion] = useState(0);\n\t\tconst onPageChangedRef = useRef((index: number) => {\n\t\t\tsetPageIndexRef.current?.(index);\n\t\t});\n\t\tonPageChangedRef.current = (index: number) => {\n\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t}\n\t\t\tif (leavesBuffer == null) {\n\t\t\t\t// No buffer — update immediately; no expensive mount/unmount cycle.\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpageChangedTimerRef.current = setTimeout(() => {\n\t\t\t\tpageChangedTimerRef.current = null;\n\t\t\t\tinflightLeavesRef.current.clear();\n\t\t\t\tsetPageIndexRef.current?.(index);\n\t\t\t}, BUFFER_DEBOUNCE_MS);\n\t\t};\n\t\tconst onPageFlippingRef = useRef((params: PageFlipParams) => {\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t});\n\t\tonPageFlippingRef.current = (params) => {\n\t\t\tif (leavesBuffer != null) {\n\t\t\t\t// The flipping leaf holds the page on the trailing edge of the target\n\t\t\t\t// spread: backward flips carry pageIndices[1] on their back, forward\n\t\t\t\t// flips carry pageIndices[0] on their front.\n\t\t\t\tconst edgePage =\n\t\t\t\t\tparams.direction === \"backward\" ? params.pageIndices[1] : params.pageIndices[0];\n\t\t\t\tconst flippingLeaf = Math.floor(edgePage / 2);\n\t\t\t\tif (!inflightLeavesRef.current.has(flippingLeaf)) {\n\t\t\t\t\tinflightLeavesRef.current.add(flippingLeaf);\n\t\t\t\t\tsetInflightVersion((v) => v + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandlers?.onPageFlipping?.(params);\n\t\t};\n\n\t\t// Clean up debounce timer on unmount.\n\t\tuseEffect(() => {\n\t\t\treturn () => {\n\t\t\t\tif (pageChangedTimerRef.current != null) {\n\t\t\t\t\tclearTimeout(pageChangedTimerRef.current);\n\t\t\t\t}\n\t\t\t};\n\t\t}, []);\n\n\t\tconst flipBook = useRef(\n\t\t\tnew FlipBookBase({\n\t\t\t\tpageSemantics: pageSemantics,\n\t\t\t\tenableBookmarks,\n\t\t\t\tpagesCount: pages.length,\n\t\t\t\tdirection: direction,\n\t\t\t\tmouseMode,\n\t\t\t\tinitialTurnedLeaves: initialTurnedLeaves,\n\t\t\t\tfastDeltaThreshold: fastDeltaThreshold,\n\t\t\t\tleavesBuffer: leavesBuffer,\n\t\t\t\tleafAspectRatio: leafAspectRatio,\n\t\t\t\tcoverAspectRatio: coverAspectRatio,\n\t\t\t\tcoverPageIndices: coverConfig?.coverIndices,\n\t\t\t\tonPageChanged: (index: number) => onPageChangedRef.current(index),\n\t\t\t\tonPageFlipping: (params) => onPageFlippingRef.current(params),\n\t\t\t\tonPageFlipped: handlers?.onPageFlipped,\n\t\t\t\thistoryMapper,\n\t\t\t\ttocPageIndex: tocPageIndex ?? 4,\n\t\t\t\tdownloadConfig,\n\t\t\t\tpageShadow,\n\t\t\t\tsnapshotDuringFlip,\n\t\t\t\tenableHistory,\n\t\t\t\tenableDownload,\n\t\t\t}),\n\t\t);\n\n\t\t// Expose imperative handle: flipbook methods (called by commands) and getters (for UI)\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => ({\n\t\t\t\tflipNext: () => flipBook.current.flipNext(),\n\t\t\t\tflipPrev: () => flipBook.current.flipPrev(),\n\t\t\t\tflipToPage: (pageIndex: number) => flipBook.current.flipToPage(pageIndex),\n\t\t\t\tjumpToPage: (pageIndex: number) => flipBook.current.jumpToPage(pageIndex),\n\t\t\t\trestorePage: (pageIndex: number) => flipBook.current.restorePage(pageIndex),\n\t\t\t\ttoggleDebugBar: () => {\n\t\t\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\t\t\tconst root = document.querySelector(`.${selectorClass}`);\n\t\t\t\t\tconst bar = root?.querySelector(\".flipbook-debug-bar\");\n\t\t\t\t\tif (bar) bar.classList.toggle(\"flipbook-debug-bar--hidden\");\n\t\t\t\t},\n\t\t\t\tgetCurrentPageIndex: () => flipBook.current.currentPageIndex,\n\t\t\t\tgetTotalPages: () => flipBook.current.totalPages,\n\t\t\t\tgetOf: () => (ofRef.current !== undefined ? ofRef.current : flipBook.current.totalPages),\n\t\t\t\tisFirstPage: () => flipBook.current.isFirstPage,\n\t\t\t\tisLastPage: () => flipBook.current.isLastPage,\n\t\t\t\tgetDownloadConfig: () => flipBook.current.getDownloadConfig(),\n\t\t\t\tgetTocPageIndex: () => flipBook.current.getTocPageIndex(),\n\t\t\t\tgetMouseMode: () => flipBook.current.getMouseMode(),\n\t\t\t\tsetMouseMode: (mode: MouseMode, options?: { persist?: boolean }) => {\n\t\t\t\t\tflipBook.current.setMouseMode(mode);\n\t\t\t\t\tif (mouseModeStorageKey && options?.persist !== false) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlocalStorage.setItem(mouseModeStorageKey, mode);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Private browsing may deny storage; the mode still works this session.\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t\t[className, mouseModeStorageKey],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tcurrentFlipBook.render(`.${selectorClass}`, debug);\n\t\t\tif (mouseModeStorageKey) {\n\t\t\t\ttry {\n\t\t\t\t\tconst savedMode = localStorage.getItem(mouseModeStorageKey);\n\t\t\t\t\tif (savedMode === \"turn\" || savedMode === \"select\")\n\t\t\t\t\t\tcurrentFlipBook.setMouseMode(savedMode);\n\t\t\t\t} catch {\n\t\t\t\t\t// Storage is optional.\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetCurrentPageIndex(currentFlipBook.currentPageIndex);\n\n\t\t\t// Cleanup function to destroy Hammer instance and event listeners\n\t\t\treturn () => {\n\t\t\t\tcurrentFlipBook.destroy();\n\t\t\t};\n\t\t}, [className, debug, mouseModeStorageKey]);\n\n\t\tconst previousBookmarksEnabled = useRef(enableBookmarks);\n\t\tuseEffect(() => {\n\t\t\tif (previousBookmarksEnabled.current === enableBookmarks) return;\n\t\t\tpreviousBookmarksEnabled.current = enableBookmarks;\n\t\t\tflipBook.current.setBookmarksEnabled(enableBookmarks);\n\t\t}, [enableBookmarks]);\n\n\t\tuseEffect(() => {\n\t\t\tconst currentFlipBook = flipBook.current;\n\t\t\tif (!bookmarkProvider) {\n\t\t\t\tsetBookmarkSlots([]);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet active = true;\n\t\t\tconst slots = new Map<string, BookmarkSlot>();\n\t\t\tconst renderSlot = (bookmark: Bookmark, expanded: boolean): HTMLElement => {\n\t\t\t\tconst key = `${expanded ? \"expanded\" : \"brief\"}:${bookmark.id}`;\n\t\t\t\tlet slot = slots.get(key);\n\t\t\t\tif (!slot) {\n\t\t\t\t\tslot = {\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tbookmark,\n\t\t\t\t\t\telement: document.createElement(\"span\"),\n\t\t\t\t\t\trenderer: expanded\n\t\t\t\t\t\t\t? bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t\t\t: bookmarkProvider.renderBookmark,\n\t\t\t\t\t};\n\t\t\t\t\tslots.set(key, slot);\n\t\t\t\t}\n\t\t\t\tslot.bookmark = bookmark;\n\t\t\t\treturn slot.element;\n\t\t\t};\n\t\t\tconst provider: BaseBookmarkProvider = {\n\t\t\t\t...bookmarkProvider,\n\t\t\t\tgetBookmarks: (context) => {\n\t\t\t\t\tconst bookmarks = bookmarkProvider.getBookmarks(context);\n\t\t\t\t\tconst ids = new Set(bookmarks.map((bookmark) => bookmark.id));\n\t\t\t\t\tfor (const [key, slot] of slots) {\n\t\t\t\t\t\tif (!ids.has(slot.bookmark.id)) slots.delete(key);\n\t\t\t\t\t}\n\t\t\t\t\t// The base renderer creates the slots synchronously after this query.\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tif (!active) return;\n\t\t\t\t\t\tfor (const [id, slot] of slots) {\n\t\t\t\t\t\t\tif (!slot.element.isConnected) slots.delete(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetBookmarkSlots([...slots.values()]);\n\t\t\t\t\t});\n\t\t\t\t\treturn bookmarks;\n\t\t\t\t},\n\t\t\t\trenderBookmark: (bookmark) => renderSlot(bookmark, false),\n\t\t\t\trenderExpandedBookmark: bookmarkProvider.renderExpandedBookmark\n\t\t\t\t\t? (bookmark) => renderSlot(bookmark, true)\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t\tcurrentFlipBook.setBookmarkProvider(provider);\n\t\t\treturn () => {\n\t\t\t\tactive = false;\n\t\t\t\tcurrentFlipBook.setBookmarkProvider(undefined);\n\t\t\t};\n\t\t}, [bookmarkProvider]);\n\n\t\t// Sync pageShadow to DOM when prop changes (base option is set at construct time).\n\t\tuseEffect(() => {\n\t\t\tconst selectorClass = className.split(/\\s+/)[0];\n\t\t\tconst el = document.querySelector(`.${selectorClass}`);\n\t\t\tif (!el) return;\n\t\t\tif (pageShadow) {\n\t\t\t\tel.classList.remove(\"flipbook--no-page-shadow\");\n\t\t\t} else {\n\t\t\t\tel.classList.add(\"flipbook--no-page-shadow\");\n\t\t\t}\n\t\t}, [className, pageShadow]);\n\n\t\t// Use Children.toArray to get stable keys for each page element\n\t\tconst pagesWithKeys = Children.toArray(pages);\n\t\tconst totalPages = pagesWithKeys.length;\n\n\t\t// Determine cover page indices\n\t\tconst coverIndicesSet = new Set(\n\t\t\tcoverConfig?.coverIndices === \"auto\"\n\t\t\t\t? [0, totalPages - 1]\n\t\t\t\t: (coverConfig?.coverIndices ?? [0]),\n\t\t);\n\t\tconst isCoverPage = (index: number) => coverIndicesSet.has(index);\n\n\t\t// Compute interior cover page indices (the other side of each cover leaf).\n\t\t// Leaf pairs: [0,1], [2,3], ... — interior is the paired page on the same leaf.\n\t\tconst interiorCoverMap = new Map<number, \"front\" | \"back\">();\n\t\tif (\n\t\t\tcoverConfig?.interiorCoverClassName ||\n\t\t\tcoverConfig?.frontInteriorCoverClassName ||\n\t\t\tcoverConfig?.backInteriorCoverClassName\n\t\t) {\n\t\t\tfor (const coverIdx of coverIndicesSet) {\n\t\t\t\tconst interiorIdx = coverIdx % 2 === 0 ? coverIdx + 1 : coverIdx - 1;\n\t\t\t\tif (interiorIdx >= 0 && interiorIdx < totalPages && !coverIndicesSet.has(interiorIdx)) {\n\t\t\t\t\t// First cover index = front, others = back\n\t\t\t\t\tconst role = coverIdx === Math.min(...coverIndicesSet) ? \"front\" : \"back\";\n\t\t\t\t\tinteriorCoverMap.set(interiorIdx, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst coverInset = coverConfig?.coverInset ?? \"5%\";\n\n\t\t// Build CSS class for a page\n\t\tconst getPageClassName = (index: number): string => {\n\t\t\tconst classes = [\"page\"];\n\t\t\tif (isCoverPage(index)) {\n\t\t\t\tclasses.push(\"page--cover\");\n\t\t\t\tif (coverConfig?.hardCovers) {\n\t\t\t\t\tclasses.push(\"page--hard\");\n\t\t\t\t}\n\t\t\t\tif (coverConfig?.noShadow) {\n\t\t\t\t\tclasses.push(\"page--no-shadow\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst interiorRole = interiorCoverMap.get(index);\n\t\t\tif (interiorRole) {\n\t\t\t\tclasses.push(\"page--cover-interior\");\n\t\t\t\tconst cls =\n\t\t\t\t\tinteriorRole === \"front\"\n\t\t\t\t\t\t? (coverConfig?.frontInteriorCoverClassName ?? coverConfig?.interiorCoverClassName)\n\t\t\t\t\t\t: (coverConfig?.backInteriorCoverClassName ?? coverConfig?.interiorCoverClassName);\n\t\t\t\tif (cls) classes.push(cls);\n\t\t\t}\n\t\t\treturn classes.join(\" \");\n\t\t};\n\n\t\t// When leavesBuffer is set, only mount content for pages within the buffer (keep .page wrappers for layout).\n\t\t// Use a small margin so content is ready before vanilla shows the leaf (avoids empty flash when flipping).\n\t\t// Cover pages are always mounted — they are cover-sized and sit behind leaf-sized pages,\n\t\t// acting as the physical book boards. Unmounting them would remove the realistic frame effect.\n\t\tconst contentByIndex =\n\t\t\tleavesBuffer != null && totalPages > 0\n\t\t\t\t? (() => {\n\t\t\t\t\t\tconst currentLeaf = Math.floor(currentPageIndex / 2);\n\t\t\t\t\t\tconst leavesCount = Math.ceil(totalPages / 2);\n\t\t\t\t\t\tconst margin = 2; // extra leaves each side so content exists when vanilla reveals them\n\t\t\t\t\t\tconst leafStart = Math.max(0, currentLeaf - leavesBuffer - margin);\n\t\t\t\t\t\tconst leafEnd = Math.min(leavesCount - 1, currentLeaf + leavesBuffer + margin);\n\t\t\t\t\t\tconst pageStart = leafStart * 2;\n\t\t\t\t\t\tconst pageEnd = Math.min(totalPages - 1, leafEnd * 2 + 1);\n\t\t\t\t\t\tconst inRange = new Set(\n\t\t\t\t\t\t\tArray.from({ length: pageEnd - pageStart + 1 }, (_, i) => pageStart + i),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Always include cover leaf pages so the larger cover boards remain mounted.\n\t\t\t\t\t\tfor (const idx of coverIndicesSet) {\n\t\t\t\t\t\t\tinRange.add(idx);\n\t\t\t\t\t\t\t// Also include the other side of the cover leaf\n\t\t\t\t\t\t\tconst partner = idx % 2 === 0 ? idx + 1 : idx - 1;\n\t\t\t\t\t\t\tif (partner >= 0 && partner < totalPages) {\n\t\t\t\t\t\t\t\tinRange.add(partner);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (index: number) =>\n\t\t\t\t\t\t\tinRange.has(index) || inflightLeavesRef.current.has(Math.floor(index / 2))\n\t\t\t\t\t\t\t\t? (pagesWithKeys.at(index) ?? null)\n\t\t\t\t\t\t\t\t: null;\n\t\t\t\t\t})()\n\t\t\t\t: (index: number) => pagesWithKeys.at(index) ?? null;\n\n\t\t/** Wrap interior cover pages with the endpaper inset frame (3-sided: no inset on spine). */\n\t\tconst renderPageContent = (index: number) => {\n\t\t\tconst content = contentByIndex(index);\n\t\t\tif (interiorCoverMap.has(index)) {\n\t\t\t\t// Determine spine side: even pages (engine convention: pageIndex%2===1) are on the\n\t\t\t\t// left in LTR / right in RTL. Their spine is on the opposite side.\n\t\t\t\tconst isEvenPage = index % 2 === 1; // engine: (pageIndex+1)%2===1 → odd; so %2===1 → even\n\t\t\t\tconst spineOnRight = isEvenPage !== (direction === \"rtl\");\n\t\t\t\tconst insetStyle = {\n\t\t\t\t\t\"--cover-inset\": coverInset,\n\t\t\t\t\t...(spineOnRight ? { \"--cover-inset-right\": \"0px\" } : { \"--cover-inset-left\": \"0px\" }),\n\t\t\t\t} as Record<string, string>;\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"page--cover-interior-inset\" style={insetStyle}>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn content;\n\t\t};\n\n\t\treturn (\n\t\t\t<div className={className}>\n\t\t\t\t{pagesWithKeys.map((_, index) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: stable slot identity for buffer/mount correctness\n\t\t\t\t\t\tkey={`page-${index}`}\n\t\t\t\t\t\tclassName={getPageClassName(index)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flipbook-page-scrollport\">\n\t\t\t\t\t\t\t<div className=\"flipbook-page-content\" dir={direction}>\n\t\t\t\t\t\t\t\t{renderPageContent(index)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t\t{bookmarkSlots.map(({ key, bookmark, element, renderer }) =>\n\t\t\t\t\tcreatePortal(renderer ? renderer(bookmark) : bookmark.label, element, key),\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n);\n\nFlipBookReact.displayName = \"FlipBook\";\n\nexport type {\n\tBookmark,\n\tBookmarkContext,\n\tBookmarkPlacement,\n\tFlipPageSemantic,\n\tHistoryMapper,\n\tMouseMode,\n\tPageFlipParams,\n\tPageSemantics,\n} from \"html-flip-book-vanilla\";\nexport { createDefaultHistoryMapper } from \"html-flip-book-vanilla\";\nexport type { TocEntry, TocPageProps } from \"./TocPage\";\nexport { TocPage } from \"./TocPage\";\nexport { FlipBookReact as FlipBook };\n"],"names":["defaultFilter","entry","TocPage","onNavigate","totalPages","pageSemantics","heading","className","direction","filter","getHref","renderEntry","entries","i","title","semanticName","renderDefaultEntry","onClick","href","pageOrSemantic","content","jsxs","Fragment","jsx","event","FlipBookReact","forwardRef","pages","debug","mouseMode","mouseModeStorageKey","bookmarkProvider","enableBookmarks","initialTurnedLeaves","fastDeltaThreshold","leavesBuffer","pageShadow","snapshotDuringFlip","enableHistory","enableDownload","coverConfig","of","leafAspectRatio","coverAspectRatio","handlers","historyMapper","tocPageIndex","downloadConfig","ref","currentPageIndex","setCurrentPageIndex","useState","firstVisiblePage","setPageIndexRef","useRef","bookmarkSlots","setBookmarkSlots","ofRef","BUFFER_DEBOUNCE_MS","pageChangedTimerRef","inflightLeavesRef","setInflightVersion","onPageChangedRef","index","onPageFlippingRef","params","edgePage","flippingLeaf","v","useEffect","flipBook","FlipBookBase","useImperativeHandle","pageIndex","selectorClass","bar","mode","options","currentFlipBook","savedMode","previousBookmarksEnabled","active","slots","renderSlot","bookmark","expanded","key","slot","provider","context","bookmarks","ids","id","el","pagesWithKeys","Children","coverIndicesSet","isCoverPage","interiorCoverMap","coverIdx","interiorIdx","role","coverInset","getPageClassName","classes","interiorRole","cls","contentByIndex","currentLeaf","leavesCount","margin","leafStart","leafEnd","pageStart","pageEnd","inRange","_","idx","partner","renderPageContent","spineOnRight","insetStyle","element","renderer","createPortal"],"mappings":";;;;;AAiDA,MAAMA,KAAgB,CAACC,MAA6BA,EAAM,MAAM,SAAS,GAoBnEC,KAAkC,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAST;AAAA,EACT,SAAAU;AAAA,EACA,aAAAC;AACD,MAAM;AAEL,QAAMC,IAAsB,CAAA;AAC5B,WAASC,IAAI,GAAGA,IAAIT,GAAYS,KAAK;AACpC,UAAMC,IAAQT,GAAe,aAAaQ,CAAC,KAAK,IAC1CE,IAAeV,GAAe,oBAAoBQ,CAAC,KAAK,IACxDZ,IAAkB,EAAE,WAAWY,GAAG,OAAAC,GAAO,cAAAC,EAAA;AAE/C,IAAIN,EAAOR,GAAOY,CAAC,KAClBD,EAAQ,KAAKX,CAAK;AAAA,EAEpB;AAEA,QAAMe,IAAqB,CAACf,GAAiBgB,GAAqBC,MAAkB;AAEnF,UAAMJ,IAAQb,EAAM,SAASA,EAAM,gBAAgB,QAAQA,EAAM,YAAY,CAAC,IACxEkB,IAAiB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ACF;AAAA,MAEF;AACA,aAAOA;AAAA,IACR;AAEA,WACC,gBAAAC,EAAC,SAAI,WAAAd,GACH,UAAA;AAAA,MAAAuF,EAAc,IAAI,CAACsB,GAAGrD,MACtB,gBAAAxC;AAAA,QAAC;AAAA,QAAA;AAAA,UAGA,WAAWgF,GAAiBxC,CAAK;AAAA,UAEjC,UAAA,gBAAAxC,EAAC,OAAA,EAAI,WAAU,4BACd,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,yBAAwB,KAAKf,GAC1C,UAAA+G,GAAkBxD,CAAK,GACzB,EAAA,CACD;AAAA,QAAA;AAAA,QAPK,QAAQA,CAAK;AAAA,MAAA,CASnB;AAAA,MACAR,GAAc;AAAA,QAAI,CAAC,EAAE,KAAA+B,GAAK,UAAAF,GAAU,SAAAsC,GAAS,UAAAC,EAAA,MAC7CC,GAAaD,IAAWA,EAASvC,CAAQ,IAAIA,EAAS,OAAOsC,GAASpC,CAAG;AAAA,MAAA;AAAA,IAC1E,GACD;AAAA,EAEF;AACD;AAEA7D,GAAc,cAAc;"}
@@ -7,6 +7,6 @@ interface ActionButtonProps {
7
7
  className?: string;
8
8
  }
9
9
  declare const ActionButton: React.FC<ActionButtonProps>;
10
- export { ActionButton };
11
10
  export type { ActionButtonProps };
11
+ export { ActionButton };
12
12
  //# sourceMappingURL=ActionButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ActionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,iBAAiB;IAE1B,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiB7C,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ActionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,iBAAiB;IAE1B,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiB7C,CAAC;AAEF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -4,6 +4,6 @@ interface FirstPageButtonProps {
4
4
  className?: string;
5
5
  }
6
6
  declare const FirstPageButton: React.FC<FirstPageButtonProps>;
7
- export { FirstPageButton };
8
7
  export type { FirstPageButtonProps };
8
+ export { FirstPageButton };
9
9
  //# sourceMappingURL=FirstPageButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FirstPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FirstPageButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,oBAAoB;IAE7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsBnD,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"FirstPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FirstPageButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,oBAAoB;IAE7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsBnD,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -9,6 +9,6 @@ interface FullscreenButtonProps {
9
9
  className?: string;
10
10
  }
11
11
  declare const FullscreenButton: React.FC<FullscreenButtonProps>;
12
- export { FullscreenButton };
13
12
  export type { FullscreenButtonProps };
13
+ export { FullscreenButton };
14
14
  //# sourceMappingURL=FullscreenButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,UAAU,qBAAqB;IAE9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkErD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"FullscreenButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/FullscreenButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,UAAU,qBAAqB;IAE9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAkErD,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -4,6 +4,6 @@ interface LastPageButtonProps {
4
4
  className?: string;
5
5
  }
6
6
  declare const LastPageButton: React.FC<LastPageButtonProps>;
7
- export { LastPageButton };
8
7
  export type { LastPageButtonProps };
8
+ export { LastPageButton };
9
9
  //# sourceMappingURL=LastPageButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LastPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/LastPageButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,mBAAmB;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsBjD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"LastPageButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/LastPageButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,mBAAmB;IAE5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsBjD,CAAC;AAEF,YAAY,EAAE,mBAAmB,EAAE,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -4,6 +4,6 @@ interface NextButtonProps {
4
4
  className?: string;
5
5
  }
6
6
  declare const NextButton: React.FC<NextButtonProps>;
7
- export { NextButton };
8
7
  export type { NextButtonProps };
8
+ export { NextButton };
9
9
  //# sourceMappingURL=NextButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NextButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/NextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsBzC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"NextButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/NextButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsBzC,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -10,6 +10,6 @@ interface PageIndicatorProps {
10
10
  maxLength?: number;
11
11
  }
12
12
  declare const PageIndicator: React.FC<PageIndicatorProps>;
13
+ export type { PageIndicatorMode, PageIndicatorProps };
13
14
  export { PageIndicator };
14
- export type { PageIndicatorProps, PageIndicatorMode };
15
15
  //# sourceMappingURL=PageIndicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../src/toolbar/PageIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9C,UAAU,kBAAkB;IAO3B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkL/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../src/toolbar/PageIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9C,UAAU,kBAAkB;IAO3B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkL/C,CAAC;AAEF,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -4,6 +4,6 @@ interface PrevButtonProps {
4
4
  className?: string;
5
5
  }
6
6
  declare const PrevButton: React.FC<PrevButtonProps>;
7
- export { PrevButton };
8
7
  export type { PrevButtonProps };
8
+ export { PrevButton };
9
9
  //# sourceMappingURL=PrevButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrevButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/PrevButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsBzC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"PrevButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/PrevButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,eAAe;IAExB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsBzC,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -5,6 +5,6 @@ interface TocButtonProps {
5
5
  className?: string;
6
6
  }
7
7
  declare const TocButton: React.FC<TocButtonProps>;
8
- export { TocButton };
9
8
  export type { TocButtonProps };
9
+ export { TocButton };
10
10
  //# sourceMappingURL=TocButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TocButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/TocButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,cAAc;IAEvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqBvC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"TocButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/TocButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,cAAc;IAEvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqBvC,CAAC;AAEF,YAAY,EAAE,cAAc,EAAE,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -16,6 +16,6 @@ interface ToolbarProps {
16
16
  fullscreenTargetRef?: React.RefObject<HTMLElement | null>;
17
17
  }
18
18
  declare const Toolbar: React.FC<ToolbarProps>;
19
- export { Toolbar };
20
19
  export type { ToolbarProps };
20
+ export { Toolbar };
21
21
  //# sourceMappingURL=Toolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IAErB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1D;AAOD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA0HnC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IAErB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAEpD,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1D;AAOD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA0HnC,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -9,6 +9,6 @@ interface ToolbarButtonProps {
9
9
  title?: string;
10
10
  }
11
11
  declare const ToolbarButton: React.FC<ToolbarButtonProps>;
12
- export { ToolbarButton };
13
12
  export type { ToolbarButtonProps };
13
+ export { ToolbarButton };
14
14
  //# sourceMappingURL=ToolbarButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,UAAU,kBAAkB;IAE3B,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAKD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsB/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,UAAU,kBAAkB;IAE3B,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAKD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsB/C,CAAC;AAEF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -18,6 +18,6 @@ interface ToolbarContextValue {
18
18
  }
19
19
  declare const ToolbarContext: React.Context<ToolbarContextValue | null>;
20
20
  export declare function useToolbar(): ToolbarContextValue;
21
- export { ToolbarContext };
22
21
  export type { ToolbarContextValue };
22
+ export { ToolbarContext };
23
23
  //# sourceMappingURL=ToolbarContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarContext.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,UAAU,mBAAmB;IAC5B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpD,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IAEzB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IAEnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IAErB,mBAAmB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAEjE,mBAAmB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAE3F,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1D;AAED,QAAA,MAAM,cAAc,2CAAkD,CAAC;AAEvE,wBAAgB,UAAU,IAAI,mBAAmB,CAMhD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;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index.js","sources":["../../../base/dist/store/index.js","../../../base/dist/commands/index.js","../../src/commands/CommandContext.tsx","../../../base/dist/download/index.js","../../src/icons/index.tsx","../../src/toolbar/ToolbarButton.tsx","../../src/toolbar/ActionButton.tsx","../../src/toolbar/BookmarkToggleButton.tsx","../../../base/dist/intl.js","../../src/toolbar/ToolbarContext.tsx","../../src/toolbar/DownloadDropdown.tsx","../../src/toolbar/FirstPageButton.tsx","../../src/toolbar/FullscreenButton.tsx","../../src/toolbar/LastPageButton.tsx","../../src/toolbar/ToggleButton.tsx","../../src/toolbar/MouseModeButton.tsx","../../src/toolbar/NextButton.tsx","../../src/toolbar/PageIndicator.tsx","../../src/toolbar/PrevButton.tsx","../../src/toolbar/TocButton.tsx","../../src/commands/open-download-menu-command.ts","../../src/toolbar/Toolbar.tsx"],"sourcesContent":["let e = 4;\nfunction n() {\n return e;\n}\nfunction o(t) {\n e = t;\n}\nexport {\n n as getTocPageIndex,\n o as setTocPageIndex\n};\n//# sourceMappingURL=index.js.map\n","import { getTocPageIndex as u } from \"../store/index.js\";\nconst y = {\n id: \"download\",\n enName: \"Download\",\n enDescription: \"Download entire book or page range\",\n nameKey: \"toolbarItem.download\",\n hotkeys: [],\n execute: (e) => {\n e.data?.onDownload?.(\n e.data?.from,\n e.data?.to\n );\n },\n canExecute: (e) => typeof e.data?.onDownload == \"function\"\n}, p = [\n { key: \"ArrowRight\" },\n { key: \"PageDown\" },\n { key: \" \" }\n // Space\n], k = {\n id: \"flipNext\",\n navKind: \"flip\",\n enName: \"Next Page\",\n enDescription: \"Flip to the next page\",\n nameKey: \"command.jumpToNextPage\",\n hotkeys: p,\n execute: (e) => {\n e.handle?.flipNext();\n },\n canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1\n}, v = [{ key: \"ArrowLeft\" }, { key: \"PageUp\" }], w = {\n id: \"flipPrev\",\n navKind: \"flip\",\n enName: \"Previous Page\",\n enDescription: \"Flip to the previous page\",\n nameKey: \"command.jumpToPrevPage\",\n hotkeys: v,\n execute: (e) => {\n e.handle?.flipPrev();\n },\n canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0\n}, x = [{ key: \"Home\" }, { key: \"ArrowLeft\", modifiers: { ctrl: !0 } }], T = {\n id: \"goToFirst\",\n navKind: \"jump\",\n enName: \"First Page\",\n enDescription: \"Jump to the first page\",\n nameKey: \"command.jumpToFirstPage\",\n hotkeys: x,\n execute: (e) => {\n e.handle?.jumpToPage(0);\n },\n canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0\n}, F = [{ key: \"End\" }, { key: \"ArrowRight\", modifiers: { ctrl: !0 } }], P = {\n id: \"goToLast\",\n navKind: \"jump\",\n enName: \"Last Page\",\n enDescription: \"Jump to the last page\",\n nameKey: \"command.jumpToLastPage\",\n hotkeys: F,\n execute: (e) => {\n const t = e.handle?.getTotalPages() ?? 0;\n e.handle?.jumpToPage(t - 1);\n },\n canExecute: (e) => {\n const t = e.handle?.getCurrentPageIndex() ?? 0, n = e.handle?.getTotalPages() ?? 0;\n return t !== n - 1;\n }\n}, K = [{ key: \"t\" }], A = {\n id: \"goToToc\",\n navKind: \"jump\",\n enName: \"Table of Contents\",\n enDescription: \"Jump to the table of contents\",\n nameKey: \"command.jumpToToc\",\n hotkeys: K,\n execute: (e) => {\n const t = e.handle?.getTocPageIndex?.() ?? u();\n e.handle?.jumpToPage(t);\n },\n canExecute: (e) => {\n const t = e.handle?.getTocPageIndex?.() ?? u();\n return e.handle?.getCurrentPageIndex() !== t;\n }\n}, C = [{ key: \"d\", modifiers: { ctrl: !0, alt: !0 } }], D = {\n id: \"toggleDebug\",\n enName: \"Toggle Debug Toolbar\",\n enDescription: \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n nameKey: \"command.toggleDebug\",\n descriptionKey: \"command.toggleDebugDesc\",\n hotkeys: C,\n execute: (e) => {\n e.handle?.toggleDebugBar?.();\n }\n}, i = () => document, L = [\n \"fullscreenchange\",\n \"webkitfullscreenchange\",\n \"fullscreenerror\",\n \"webkitfullscreenerror\"\n];\nfunction d() {\n return typeof document > \"u\" ? null : i().fullscreenElement ?? i().webkitFullscreenElement ?? null;\n}\nfunction m(e) {\n if (typeof document > \"u\") return !1;\n const t = e ?? i().documentElement;\n return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != \"function\" ? !1 : (i().fullscreenEnabled ?? i().webkitFullscreenEnabled) !== !1;\n}\nasync function b(e) {\n const t = e;\n if (t.requestFullscreen) {\n await t.requestFullscreen();\n return;\n }\n if (t.webkitRequestFullscreen) {\n t.webkitRequestFullscreen();\n return;\n }\n throw new Error(\"Fullscreen API is not available\");\n}\nasync function E() {\n const e = i();\n if (e.exitFullscreen) {\n await e.exitFullscreen();\n return;\n }\n e.webkitExitFullscreen && e.webkitExitFullscreen();\n}\nconst M = [{ key: \"F11\" }], a = {\n id: \"toggleFullscreen\",\n kind: \"toggle\",\n enName: \"Toggle Fullscreen\",\n enDescription: \"Enter or exit fullscreen mode\",\n nameKey: \"command.toggleFullscreen\",\n descriptionKey: \"command.toggleFullscreenDesc\",\n hotkeys: M,\n canExecute: (e) => m(e.data?.getFullscreenTarget?.()),\n isActive: () => d() !== null,\n setActive: (e, t) => {\n const n = d();\n if (t) {\n if (n) return;\n const o = e.data?.getFullscreenTarget?.() ?? document.documentElement;\n if (!m(o)) return !1;\n b(o).catch(console.warn);\n return;\n }\n n && E().catch(console.warn);\n },\n execute: (e) => a.setActive(e, !a.isActive(e))\n}, c = {\n id: \"toggleTextSelection\",\n kind: \"toggle\",\n enName: \"Select Text\",\n enDescription: \"Toggle text selection; hold Ctrl to temporarily turn pages instead\",\n hotkeys: [{ key: \"Control\", mode: \"hold\", active: !1 }],\n canExecute: (e) => !!(e.handle?.getMouseMode && e.handle?.setMouseMode),\n isActive: (e) => e.handle?.getMouseMode?.() === \"select\",\n setActive: (e, t) => {\n if (!e.handle?.setMouseMode) return !1;\n const n = t ? \"select\" : \"turn\";\n e.transient ? e.handle.setMouseMode(n, { persist: !1 }) : e.handle.setMouseMode(n);\n },\n execute: (e) => {\n const t = c.setActive(\n e,\n !c.isActive(e)\n );\n return t !== !1 && window.getSelection()?.removeAllRanges(), t;\n }\n}, q = [\n k,\n w,\n T,\n P,\n A,\n a,\n D,\n c,\n y\n];\nfunction g(e, t) {\n return t !== \"rtl\" ? e : e === \"ArrowLeft\" ? \"ArrowRight\" : e === \"ArrowRight\" ? \"ArrowLeft\" : e;\n}\nfunction B(e, t, n) {\n if (g(t.key, n) !== e.key) return !1;\n const r = e.modifiers ?? {};\n return !(e.key !== \"Control\" && !!r.ctrl !== t.ctrlKey || e.key !== \"Shift\" && !!r.shift !== t.shiftKey || e.key !== \"Alt\" && !!r.alt !== t.altKey || e.key !== \"Meta\" && !!r.meta !== t.metaKey);\n}\nfunction N(e, t) {\n const n = e.modifiers ?? {};\n return [\n n.ctrl && !t.ctrlKey,\n n.shift && !t.shiftKey,\n n.alt && !t.altKey,\n n.meta && !t.metaKey\n ].some(Boolean);\n}\nfunction I(e, t, n) {\n const o = g(t.key, n);\n return o === e.key || o.length === 1 && o.toLowerCase() === e.key.toLowerCase() ? !0 : N(e, t);\n}\nfunction R(e, t) {\n const n = e.modifiers ?? {}, o = t.modifiers ?? {};\n return [\n !!n.ctrl == !!o.ctrl,\n !!n.shift == !!o.shift,\n !!n.alt == !!o.alt,\n !!n.meta == !!o.meta\n ].every(Boolean);\n}\nfunction f(e, t) {\n return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && R(e, t);\n}\nclass S {\n held = /* @__PURE__ */ new Map();\n has(t) {\n return this.held.has(t);\n }\n press(t, n, o) {\n const r = this.held.get(t.id);\n if (r?.bindings.some((l) => f(l, n))) return !1;\n const s = r ?? {\n command: t,\n context: { ...o, transient: !0 },\n initial: t.isActive(o),\n bindings: []\n };\n return t.setActive(s.context, n.active ?? !0) === !1 ? !1 : (s.bindings.push(n), this.held.set(t.id, s), !0);\n }\n release(t, n) {\n return this.removeBindings((o) => I(o, t, n));\n }\n /** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */\n reconcile(t, n) {\n return n ? this.clear() : this.removeBindings((o, r) => !this.isRegistered(o, r, t));\n }\n isRegistered(t, n, o) {\n const r = o[n.command.id];\n return !r || r.options.disableHotkeys || r.command !== n.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((l) => f(l, t));\n }\n clear() {\n return this.removeBindings(() => !0);\n }\n removeBindings(t) {\n let n = !1;\n for (const [o, r] of this.held) {\n const s = r.bindings.filter((h) => !t(h, r));\n if (s.length === r.bindings.length) continue;\n n = !0, r.bindings = s;\n const l = s.length ? s[s.length - 1].active ?? !0 : r.initial;\n r.command.setActive(r.context, l), s.length || this.held.delete(o);\n }\n return n;\n }\n}\nexport {\n S as HoldHotkeyController,\n m as canUseFullscreen,\n q as defaultCommands,\n y as downloadCommand,\n E as exitFullscreen,\n k as flipNextCommand,\n w as flipPrevCommand,\n L as fullscreenStateEvents,\n g as getEffectiveKey,\n d as getFullscreenElement,\n T as goToFirstCommand,\n P as goToLastCommand,\n A as goToTocCommand,\n B as hotkeyMatches,\n I as hotkeyReleased,\n b as requestFullscreen,\n D as toggleDebugCommand,\n a as toggleFullscreenCommand,\n c as toggleTextSelectionCommand\n};\n//# sourceMappingURL=index.js.map\n","import {\n\ttype CommandContext as CommandCtx,\n\ttype CommandDefinition,\n\ttype CommandOptions,\n\ttype CommandRegistry,\n\tdefaultCommands,\n\tHoldHotkeyController,\n\ttype HotkeyBinding,\n\thotkeyMatches,\n\ttype ToggleCommandDefinition,\n} from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from \"react\";\nimport type { FlipBookHandle } from \"../FlipBook\";\n\ninterface CommandProviderProps {\n\t/** Reference to the FlipBook instance */\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\t/** Current page index */\n\tcurrentPage: number;\n\t/** Total number of pages */\n\ttotalPages: number;\n\t/** Reading direction */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Custom commands to register (merged with defaults) */\n\tcommands?: CommandDefinition[];\n\t/** Options for specific commands */\n\tcommandOptions?: Record<string, CommandOptions>;\n\t/** Disable all hotkey bindings */\n\tdisableHotkeys?: boolean;\n\tchildren: React.ReactNode;\n}\n\ninterface CommandsContextValue {\n\t/** Execute a command (pass the command object, not a string ID). */\n\texecute: (command: CommandDefinition, runData?: Record<string, unknown>) => void;\n\t/** Check if a command can execute (for disabled state). */\n\tcanExecute: (command: CommandDefinition) => boolean;\n\t/** Read the current state of a toggle command for its toolbar button. */\n\tisActive: (command: ToggleCommandDefinition) => boolean;\n\t/** Get all registered commands. */\n\tgetAllCommands: () => CommandDefinition[];\n}\n\nconst CommandsContext = createContext<CommandsContextValue | null>(null);\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n\tif (!(target instanceof HTMLElement)) return false;\n\treturn Boolean(\n\t\ttarget.isContentEditable ||\n\t\t\ttarget.closest('input, textarea, select, [contenteditable=\"true\"], [contenteditable=\"\"]'),\n\t);\n}\n\nfunction getHotkeys(entry: CommandRegistry[string]): HotkeyBinding[] {\n\tif (entry.options.disableHotkeys) return [];\n\treturn entry.options.hotkeys ?? entry.command.hotkeys ?? [];\n}\n\nfunction canUseHotkey(\n\tcommand: CommandDefinition,\n\tbinding: HotkeyBinding,\n\tgetContext: (command: CommandDefinition) => CommandCtx,\n): boolean {\n\tif (binding.mode !== \"hold\") return true;\n\tif (command.kind !== \"toggle\") return false;\n\treturn !command.canExecute || command.canExecute(getContext(command));\n}\n\nfunction findHotkey(\n\tregistry: CommandRegistry,\n\tevent: KeyboardEvent,\n\tdirection: \"ltr\" | \"rtl\",\n\tgetContext: (command: CommandDefinition) => CommandCtx,\n) {\n\tfor (const entry of Object.values(registry)) {\n\t\tconst binding = getHotkeys(entry).find(\n\t\t\t(binding) =>\n\t\t\t\thotkeyMatches(binding, event, direction) &&\n\t\t\t\tcanUseHotkey(entry.command, binding, getContext),\n\t\t);\n\t\tif (binding) return { command: entry.command, binding };\n\t}\n\treturn undefined;\n}\n\n/**\n * Provider component that manages flipbook commands and hotkeys.\n * Uses framework-agnostic commands from base; only the provider and hook are React-specific.\n */\nexport const CommandProvider: React.FC<CommandProviderProps> = ({\n\tflipBookRef,\n\tcurrentPage: _currentPage,\n\ttotalPages: _totalPages,\n\tdirection = \"ltr\",\n\tcommands: customCommands = [],\n\tcommandOptions = {},\n\tdisableHotkeys = false,\n\tchildren,\n}) => {\n\tconst holds = useRef(new HoldHotkeyController()).current;\n\tconst [, refresh] = useReducer((value: number) => value + 1, 0);\n\tconst registry = useMemo<CommandRegistry>(() => {\n\t\tconst reg: CommandRegistry = {};\n\n\t\tfor (const cmd of defaultCommands) {\n\t\t\treg[cmd.id] = {\n\t\t\t\tcommand: cmd,\n\t\t\t\toptions: commandOptions[cmd.id] ?? {},\n\t\t\t};\n\t\t}\n\n\t\tfor (const cmd of customCommands) {\n\t\t\treg[cmd.id] = {\n\t\t\t\tcommand: cmd,\n\t\t\t\toptions: commandOptions[cmd.id] ?? {},\n\t\t\t};\n\t\t}\n\n\t\treturn reg;\n\t}, [customCommands, commandOptions]);\n\n\tconst createCommandContext = useCallback(\n\t\t(command: CommandDefinition, runData?: Record<string, unknown>): CommandCtx => {\n\t\t\tconst options = registry[command.id]?.options ?? {};\n\t\t\tconst data = runData ? { ...options.data, ...runData } : options.data;\n\t\t\treturn {\n\t\t\t\thandle: flipBookRef.current,\n\t\t\t\tdata,\n\t\t\t};\n\t\t},\n\t\t[flipBookRef, registry],\n\t);\n\n\tconst execute = useCallback(\n\t\t(command: CommandDefinition, runData?: Record<string, unknown>) => {\n\t\t\tif (holds.has(command.id)) return;\n\t\t\tconst ctx = createCommandContext(command, runData);\n\t\t\tif (command.canExecute && !command.canExecute(ctx)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcommand.execute(ctx);\n\t\t\trefresh();\n\t\t},\n\t\t[createCommandContext, holds],\n\t);\n\n\tconst canExecute = useCallback(\n\t\t(command: CommandDefinition): boolean => {\n\t\t\tif (holds.has(command.id)) return false;\n\t\t\tconst ctx = createCommandContext(command);\n\t\t\tif (!command.canExecute) return true;\n\t\t\treturn command.canExecute(ctx);\n\t\t},\n\t\t[createCommandContext, holds],\n\t);\n\n\tconst isActive = useCallback(\n\t\t(command: ToggleCommandDefinition) => command.isActive(createCommandContext(command)),\n\t\t[createCommandContext],\n\t);\n\n\tconst getAllCommands = useCallback(\n\t\t(): CommandDefinition[] => Object.values(registry).map((e) => e.command),\n\t\t[registry],\n\t);\n\n\tconst latest = useRef({ registry, execute, createCommandContext, direction, disableHotkeys });\n\tlatest.current = { registry, execute, createCommandContext, direction, disableHotkeys };\n\n\tuseEffect(() => {\n\t\tif (holds.reconcile(registry, disableHotkeys)) refresh();\n\t}, [holds, registry, disableHotkeys]);\n\n\tuseEffect(() => {\n\t\tconst handleHoldKeyDown = (\n\t\t\tcommand: CommandDefinition,\n\t\t\tbinding: HotkeyBinding,\n\t\t\tevent: KeyboardEvent,\n\t\t): void => {\n\t\t\tif (command.kind !== \"toggle\") return;\n\t\t\tconst ctx = latest.current.createCommandContext(command);\n\t\t\tif (!event.repeat && holds.press(command, binding, ctx)) refresh();\n\t\t\t// Keep modifier-only browser shortcuts (such as Ctrl+C) usable.\n\t\t\tif (![\"Control\", \"Shift\", \"Alt\", \"Meta\"].includes(binding.key)) event.preventDefault();\n\t\t};\n\t\tconst handleKeyDown = (event: KeyboardEvent): void => {\n\t\t\tconst { registry, execute, direction, disableHotkeys, createCommandContext } = latest.current;\n\t\t\tif (disableHotkeys || event.defaultPrevented || isEditableTarget(event.target)) return;\n\t\t\tconst match = findHotkey(registry, event, direction, createCommandContext);\n\t\t\tif (!match) return;\n\t\t\tif (match.binding.mode === \"hold\") {\n\t\t\t\thandleHoldKeyDown(match.command, match.binding, event);\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\texecute(match.command);\n\t\t\t}\n\t\t};\n\t\tconst handleKeyUp = (event: KeyboardEvent) => {\n\t\t\tif (holds.release(event, latest.current.direction)) refresh();\n\t\t};\n\t\tconst restore = () => {\n\t\t\tif (holds.clear()) refresh();\n\t\t};\n\t\tconst handleVisibility = () => {\n\t\t\tif (document.hidden) restore();\n\t\t};\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\tdocument.addEventListener(\"keyup\", handleKeyUp);\n\t\twindow.addEventListener(\"blur\", restore);\n\t\tdocument.addEventListener(\"visibilitychange\", handleVisibility);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", handleKeyUp);\n\t\t\twindow.removeEventListener(\"blur\", restore);\n\t\t\tdocument.removeEventListener(\"visibilitychange\", handleVisibility);\n\t\t\tholds.clear();\n\t\t};\n\t}, [holds]);\n\n\tconst value: CommandsContextValue = { execute, canExecute, isActive, getAllCommands };\n\n\treturn <CommandsContext.Provider value={value}>{children}</CommandsContext.Provider>;\n};\n\nexport const useCommands = (): CommandsContextValue => {\n\tconst ctx = useContext(CommandsContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useCommands must be used within a CommandProvider\");\n\t}\n\treturn ctx;\n};\n","function c(t) {\n let i = \"\";\n for (const n of new TextEncoder().encode(t))\n i += String.fromCharCode(n);\n return btoa(i);\n}\nfunction s(t) {\n return { ext: \"json\", data: c(JSON.stringify(t, null, \"\t\")) };\n}\nfunction f(t) {\n const { pagesCount: i, pageSemantics: n } = t, a = (e) => {\n const o = n?.indexToSemanticName(e) ?? \"\", r = n?.indexToTitle(e) ?? \"\";\n return n ? { pageIndex: e, semanticName: o, title: r } : { pageIndex: e, semanticName: String(e + 1), title: `Page ${e + 1}` };\n };\n return {\n onDownloadSefer: () => {\n const e = [];\n for (let o = 0; o < i; o++) {\n const r = a(o);\n (r.semanticName || r.title) && e.push(r);\n }\n return Promise.resolve(s(e));\n },\n onDownloadPageRange: (e) => Promise.resolve(s(e.map(a)))\n };\n}\nexport {\n f as createDefaultDownloadConfig\n};\n//# sourceMappingURL=index.js.map\n","/**\n * Icon components for the flipbook toolbar.\n * All icons use currentColor for stroke, making them themeable.\n */\nimport type React from \"react\";\n\ninterface IconProps {\n\t/** Icon size in pixels. Default: 24 */\n\tsize?: number;\n\t/** Additional CSS class */\n\tclassName?: string;\n}\n\nconst defaultProps: IconProps = { size: 24 };\n\nexport const ChevronLeftIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m15 18-6-6 6-6\" />\n\t</svg>\n);\n\nexport const ChevronRightIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m9 18 6-6-6-6\" />\n\t</svg>\n);\n\nexport const ChevronFirstIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m17 18-6-6 6-6\" />\n\t\t<path d=\"M7 6v12\" />\n\t</svg>\n);\n\nexport const ChevronLastIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m7 18 6-6-6-6\" />\n\t\t<path d=\"M17 6v12\" />\n\t</svg>\n);\n\nexport const MaximizeIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n\t\t<path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n\t\t<path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n\t\t<path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n\t</svg>\n);\n\nexport const MinimizeIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />\n\t\t<path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />\n\t\t<path d=\"M3 16h3a2 2 0 0 1 2 2v3\" />\n\t\t<path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />\n\t</svg>\n);\n\nexport const TableOfContentsIcon: React.FC<IconProps> = ({\n\tsize = defaultProps.size,\n\tclassName,\n}) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M16 5H3\" />\n\t\t<path d=\"M16 12H3\" />\n\t\t<path d=\"M16 19H3\" />\n\t\t<path d=\"M21 5h.01\" />\n\t\t<path d=\"M21 12h.01\" />\n\t\t<path d=\"M21 19h.01\" />\n\t</svg>\n);\n\nexport const BookshelfIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t{/* Shelf */}\n\t\t<path d=\"M3 21h18\" />\n\t\t{/* Books */}\n\t\t<rect x=\"4\" y=\"7\" width=\"3\" height=\"14\" rx=\"0.5\" />\n\t\t<rect x=\"8\" y=\"5\" width=\"3\" height=\"16\" rx=\"0.5\" />\n\t\t<rect x=\"12\" y=\"9\" width=\"3\" height=\"12\" rx=\"0.5\" />\n\t\t<rect x=\"16\" y=\"6\" width=\"4\" height=\"15\" rx=\"0.5\" />\n\t</svg>\n);\n\nexport const DownloadIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n\t\t<polyline points=\"7 10 12 15 17 10\" />\n\t\t<line x1=\"12\" x2=\"12\" y1=\"15\" y2=\"3\" />\n\t</svg>\n);\n\nexport type { IconProps };\n","import type React from \"react\";\n\ninterface ToolbarButtonProps {\n\t/** Click handler */\n\tonClick: () => void;\n\t/** Accessible label for the button */\n\tariaLabel: string;\n\t/** Toggle state for mode buttons. */\n\tariaPressed?: boolean;\n\t/** Whether the button is disabled */\n\tdisabled?: boolean;\n\t/** Button content (icon or text) */\n\tchildren: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Title tooltip */\n\ttitle?: string;\n}\n\n/**\n * Base button component for toolbar actions.\n */\nconst ToolbarButton: React.FC<ToolbarButtonProps> = ({\n\tonClick,\n\tariaLabel,\n\tariaPressed,\n\tdisabled = false,\n\tchildren,\n\tclassName = \"\",\n\ttitle,\n}) => {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={onClick}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-pressed={ariaPressed}\n\t\t\tdisabled={disabled}\n\t\t\ttitle={title ?? ariaLabel}\n\t\t\tclassName={`flipbook-toolbar-button ${className}`.trim()}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n};\n\nexport { ToolbarButton };\nexport type { ToolbarButtonProps };\n","import type React from \"react\";\nimport { ToolbarButton } from \"./ToolbarButton\";\n\ninterface ActionButtonProps {\n\t/** Click handler for custom action */\n\tonClick: () => void;\n\t/** ARIA label for accessibility */\n\tariaLabel: string;\n\t/** Custom content (icon or text) */\n\tchildren: React.ReactNode;\n\t/** Whether the button is disabled */\n\tdisabled?: boolean;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Generic toolbar button for custom actions.\n * Use this for actions that aren't standard flipbook navigation.\n */\nconst ActionButton: React.FC<ActionButtonProps> = ({\n\tonClick,\n\tariaLabel,\n\tchildren,\n\tdisabled = false,\n\tclassName,\n}) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={onClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tdisabled={disabled}\n\t\t\tclassName={`flipbook-toolbar-action ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { ActionButton };\nexport type { ActionButtonProps };\n","import { ToolbarButton } from \"./ToolbarButton\";\n\nexport interface BookmarkToggleButtonProps {\n\t/** Current consumer-controlled bookmark visibility. */\n\tenabled: boolean;\n\t/** Update the book's enableBookmarks prop without changing its navigation state. */\n\tonChange: (enabled: boolean) => void;\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\n/** An opt-in bookmark visibility control for a consumer's toolbar. */\nexport const BookmarkToggleButton = ({\n\tenabled,\n\tonChange,\n\tariaLabel,\n\tclassName,\n}: BookmarkToggleButtonProps) => (\n\t<ToolbarButton\n\t\tonClick={() => onChange(!enabled)}\n\t\tariaLabel={ariaLabel ?? (enabled ? \"Hide bookmarks\" : \"Show bookmarks\")}\n\t\tariaPressed={enabled}\n\t\tclassName={`flipbook-toolbar-bookmarks ${className ?? \"\"}`.trim()}\n\t>\n\t\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n\t\t\t<path\n\t\t\t\td=\"M5 2.5h10v15l-5-3-5 3z\"\n\t\t\t\tfill={enabled ? \"currentColor\" : \"none\"}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t</ToolbarButton>\n);\n","const m = {\n align: \"left\",\n direction: \"ltr\",\n translations: {\n \"toolbarItem.download\": \"Download\",\n \"toolbarItem.downloadPageRange\": \"Download page range…\",\n \"toolbarItem.download.from\": \"From\",\n \"toolbarItem.download.to\": \"To\",\n \"toolbarItem.download.download\": \"Download\",\n \"command.downloadEntireBook\": \"Download entire book\",\n \"command.jumpToToc\": \"Table of contents\",\n \"command.jumpToFirstPage\": \"First page\",\n \"command.jumpToLastPage\": \"Last page\",\n \"command.jumpToPrevPage\": \"Previous page\",\n \"command.jumpToNextPage\": \"Next page\",\n \"command.toggleFullscreen\": \"Toggle fullscreen\",\n \"command.toggleFullscreenDesc\": \"Enter or exit fullscreen mode\",\n \"command.toggleDebug\": \"Toggle debug toolbar\",\n \"command.toggleDebugDesc\": \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"Go to page\",\n \"toolbarItem.selectText\": \"Select text with mouse\",\n \"toolbarItem.selectionLetters\": \"Aa\",\n \"toolbarItem.enterFullscreen\": \"Enter fullscreen\",\n \"toolbarItem.exitFullscreen\": \"Exit fullscreen\",\n \"toolbarItem.fullscreenUnsupported\": \"Fullscreen is not supported by this browser\"\n }\n}, d = {\n align: \"right\",\n direction: \"rtl\",\n translations: {\n \"toolbarItem.download\": \"הורדה\",\n \"toolbarItem.downloadPageRange\": \"הורד טווח עמודים…\",\n \"toolbarItem.download.from\": \"מ\",\n \"toolbarItem.download.to\": \"עד\",\n \"toolbarItem.download.download\": \"הורד\",\n \"command.downloadEntireBook\": \"הורד את כל הספר\",\n \"command.jumpToToc\": \"תוכן העניינים\",\n \"command.jumpToFirstPage\": \"עמוד ראשון\",\n \"command.jumpToLastPage\": \"עמוד אחרון\",\n \"command.jumpToPrevPage\": \"עמוד קודם\",\n \"command.jumpToNextPage\": \"עמוד הבא\",\n \"command.toggleFullscreen\": \"מסך מלא\",\n \"command.toggleFullscreenDesc\": \"כניסה או יציאה ממסך מלא\",\n \"command.toggleDebug\": \"סרגל כלים לדיבוג\",\n \"command.toggleDebugDesc\": \"הצג או הסתר סרגל הדיבוג (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"מעבר לעמוד\",\n \"toolbarItem.selectText\": \"בחירת טקסט עם העכבר\",\n \"toolbarItem.selectionLetters\": \"אב\",\n \"toolbarItem.enterFullscreen\": \"כניסה למסך מלא\",\n \"toolbarItem.exitFullscreen\": \"יציאה ממסך מלא\",\n \"toolbarItem.fullscreenUnsupported\": \"מסך מלא אינו נתמך בדפדפן זה\"\n }\n}, l = {\n \"en-US\": m,\n \"he-IL\": d\n}, n = \"en-US\", c = {\n \"toolbarItem.download\": \"Download\",\n \"toolbarItem.downloadPageRange\": \"Download page range…\",\n \"toolbarItem.download.from\": \"From\",\n \"toolbarItem.download.to\": \"To\",\n \"toolbarItem.download.download\": \"Download\",\n \"command.downloadEntireBook\": \"Download entire book\",\n \"command.jumpToToc\": \"Table of contents\",\n \"command.jumpToFirstPage\": \"First page\",\n \"command.jumpToLastPage\": \"Last page\",\n \"command.jumpToPrevPage\": \"Previous page\",\n \"command.jumpToNextPage\": \"Next page\",\n \"command.toggleFullscreen\": \"Toggle fullscreen\",\n \"command.toggleFullscreenDesc\": \"Enter or exit fullscreen mode\",\n \"command.toggleDebug\": \"Toggle debug toolbar\",\n \"command.toggleDebugDesc\": \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"Go to page\",\n \"toolbarItem.enterFullscreen\": \"Enter fullscreen\",\n \"toolbarItem.exitFullscreen\": \"Exit fullscreen\",\n \"toolbarItem.fullscreenUnsupported\": \"Fullscreen is not supported by this browser\"\n};\nfunction a(o) {\n return l[o] ?? l[n];\n}\nfunction g(o) {\n return a(o).direction === \"rtl\";\n}\nfunction u(o) {\n return g(o) ? \"rtl\" : \"ltr\";\n}\nfunction b(o, r) {\n const e = a(r).translations[o];\n if (e !== void 0 && e !== \"\") return e;\n const t = l[n].translations[o];\n return t !== void 0 && t !== \"\" ? t : c[o] ?? o;\n}\nexport {\n n as defaultLocale,\n u as directionFromLocale,\n a as getConfig,\n g as isRtl,\n b as t\n};\n//# sourceMappingURL=intl.js.map\n","import type React from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { FlipBookHandle, MouseMode, PageSemantics } from \"../FlipBook\";\nimport type { Locale } from \"../i18n\";\n\ninterface ToolbarContextValue {\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\tdirection: \"ltr\" | \"rtl\";\n\t/** Locale for UI strings (toolbar, download menu). Defaults to en-US. */\n\tlocale: Locale;\n\tpageSemantics?: PageSemantics;\n\tcurrentPage: number;\n\ttotalPages: number;\n\t/** \"Of\" value from the book (for page indicator). Sourced from FlipBook ref. */\n\tof: string | number;\n\tisFirstPage: boolean;\n\tisLastPage: boolean;\n\tmouseMode: MouseMode;\n\t/** Ref used by openDownloadMenu command (Ctrl+S) to open the download dropdown. DownloadDropdown sets this. */\n\topenDownloadMenuRef: React.MutableRefObject<(() => void) | null>;\n\t/** Ref set by DownloadDropdown: (from?, to?) => void to run download (entire book or range). Used by download command. */\n\tdownloadExecutorRef: React.MutableRefObject<((from?: number, to?: number) => void) | null>;\n\t/** When set (via Toolbar fullscreenTargetRef), fullscreen targets this container (e.g. sefer + toolbar). */\n\tfullscreenTargetRef?: React.RefObject<HTMLElement | null>;\n}\n\nconst ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\nexport function useToolbar(): ToolbarContextValue {\n\tconst context = useContext(ToolbarContext);\n\tif (!context) {\n\t\tthrow new Error(\"Toolbar components must be used within a Toolbar\");\n\t}\n\treturn context;\n}\n\nexport { ToolbarContext };\nexport type { ToolbarContextValue };\n","import type React from \"react\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { SemanticPageInfo } from \"../download/types\";\nimport { isRtl, t } from \"../i18n\";\nimport { DownloadIcon } from \"../icons\";\nimport { useToolbar } from \"./ToolbarContext\";\nimport \"./DownloadDropdown.css\";\n\n/** Strip Hebrew punctuation (geresh, gershaim) from a name for use in filenames. */\nfunction sanitizeForFilename(name: string): string {\n\treturn name.replace(/[׳'״\"]/g, \"\");\n}\n\nfunction triggerDownload(result: { ext: string; data: string }, filenameBase: string): void {\n\ttry {\n\t\tconst binary = atob(result.data);\n\t\tconst bytes = new Uint8Array(binary.length);\n\t\tfor (let i = 0; i < binary.length; i++) {\n\t\t\tbytes[i] = binary.charCodeAt(i);\n\t\t}\n\t\tconst blob = new Blob([bytes]);\n\t\tconst url = URL.createObjectURL(blob);\n\t\tconst a = document.createElement(\"a\");\n\t\ta.href = url;\n\t\ta.download = `${filenameBase}.${result.ext}`;\n\t\ta.click();\n\t\tURL.revokeObjectURL(url);\n\t} catch (e) {\n\t\tconsole.error(\"Download failed:\", e);\n\t}\n}\n\n/** Collect pages that have a semantic name for range selector options.\n * Pages without a semantic name (covers, blanks, TOC) are excluded. */\nfunction getSelectablePages(\n\ttotalPages: number,\n\tpageSemantics?: {\n\t\tindexToSemanticName: (i: number) => string;\n\t\tindexToTitle: (i: number) => string;\n\t},\n): SemanticPageInfo[] {\n\tconst list: SemanticPageInfo[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\t// Only include pages with a real semantic identity\n\t\tif (!semanticName && !title) {\n\t\t\t// No semantics at all — fall back to 1-based index only when\n\t\t\t// no pageSemantics provider exists (plain book without metadata).\n\t\t\tif (!pageSemantics) {\n\t\t\t\tlist.push({ pageIndex: i, semanticName: String(i + 1), title: `Page ${i + 1}` });\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tlist.push({\n\t\t\tpageIndex: i,\n\t\t\tsemanticName: semanticName || String(i + 1),\n\t\t\ttitle: title || semanticName,\n\t\t});\n\t}\n\treturn list;\n}\n\nexport interface DownloadDropdownProps {\n\t/** Label for \"Download\" button. Default: \"Download\" */\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\nconst DownloadDropdown: React.FC<DownloadDropdownProps> = ({\n\tariaLabel = \"Download\",\n\tclassName,\n}) => {\n\tconst {\n\t\ttotalPages,\n\t\tpageSemantics,\n\t\tlocale,\n\t\topenDownloadMenuRef,\n\t\tdownloadExecutorRef,\n\t\tflipBookRef,\n\t} = useToolbar();\n\tconst downloadConfig = flipBookRef.current?.getDownloadConfig?.() ?? undefined;\n\tconst [open, setOpen] = useState(false);\n\n\tuseEffect(() => {\n\t\topenDownloadMenuRef.current = () => setOpen(true);\n\t\treturn () => {\n\t\t\topenDownloadMenuRef.current = null;\n\t\t};\n\t}, [openDownloadMenuRef]);\n\ttype DownloadMode = \"entire\" | \"range\";\n\tconst [downloadMode, setDownloadMode] = useState<DownloadMode>(\"entire\");\n\tconst [fromIndex, setFromIndex] = useState(0);\n\tconst [toIndex, setToIndex] = useState(0);\n\tconst [loading, setLoading] = useState<\"sefer\" | \"range\" | null>(null);\n\tconst [openUp, setOpenUp] = useState(false);\n\tconst dropdownRef = useRef<HTMLDivElement>(null);\n\tconst menuRef = useRef<HTMLDivElement>(null);\n\n\tconst selectablePages = useMemo(\n\t\t() => getSelectablePages(totalPages, pageSemantics),\n\t\t[totalPages, pageSemantics],\n\t);\n\n\tconst hasSefer = Boolean(downloadConfig?.onDownloadSefer);\n\tconst hasRange = Boolean(downloadConfig?.onDownloadPageRange);\n\tconst showDropdown = hasSefer || hasRange;\n\n\t// Pre-compute primitive values from the memoised list so the effect deps stay stable\n\tconst firstSelectablePage = selectablePages[0]?.pageIndex ?? 0;\n\tconst lastSelectablePage = selectablePages[selectablePages.length - 1]?.pageIndex ?? 0;\n\n\t// When opening, default mode to \"entire\" if available, else \"range\"; init range to first/last selectable page\n\tuseEffect(() => {\n\t\tif (!open) return;\n\t\tsetDownloadMode(hasSefer ? \"entire\" : \"range\");\n\t\tsetFromIndex(firstSelectablePage);\n\t\tsetToIndex(lastSelectablePage);\n\t}, [open, hasSefer, firstSelectablePage, lastSelectablePage]);\n\n\tconst closeDropdown = useCallback(() => {\n\t\tsetOpen(false);\n\t}, []);\n\n\t// Anchor to the trigger while keeping both axes inside the viewport, including scrolled toolbars.\n\tuseLayoutEffect(() => {\n\t\tif (!open || !menuRef.current || !dropdownRef.current) return;\n\t\tconst menu = menuRef.current;\n\t\tconst trigger = dropdownRef.current.querySelector(\".flipbook-toolbar-download-trigger\");\n\t\tconst updatePosition = () => {\n\t\t\tconst triggerRect = trigger?.getBoundingClientRect();\n\t\t\tif (!triggerRect) return;\n\t\t\tconst padding = 8;\n\t\t\tconst gap = 6;\n\t\t\tconst spaceBelow = window.innerHeight - triggerRect.bottom - gap - padding;\n\t\t\tconst spaceAbove = triggerRect.top - gap - padding;\n\t\t\tconst desiredHeight = Math.min(menu.scrollHeight, window.innerHeight * 0.7, 480);\n\t\t\tconst above = spaceBelow < desiredHeight && spaceAbove > spaceBelow;\n\t\t\tmenu.style.maxHeight = `${Math.max(0, Math.min(desiredHeight, above ? spaceAbove : spaceBelow))}px`;\n\t\t\tconst bounds = menu.getBoundingClientRect();\n\t\t\tconst left = isRtl(locale) ? triggerRect.left : triggerRect.right - bounds.width;\n\t\t\tmenu.style.left = `${Math.max(padding, Math.min(left, window.innerWidth - bounds.width - padding))}px`;\n\t\t\tconst top = above ? triggerRect.top - gap - bounds.height : triggerRect.bottom + gap;\n\t\t\tmenu.style.top = `${Math.max(padding, Math.min(top, window.innerHeight - bounds.height - padding))}px`;\n\t\t\tsetOpenUp(above);\n\t\t};\n\t\tupdatePosition();\n\t\tconst ro = new ResizeObserver(updatePosition);\n\t\tro.observe(menu);\n\t\tconst toolbar = dropdownRef.current.closest('[role=\"toolbar\"]');\n\t\tif (toolbar) ro.observe(toolbar);\n\t\twindow.addEventListener(\"resize\", updatePosition);\n\t\twindow.addEventListener(\"scroll\", updatePosition, true);\n\t\treturn () => {\n\t\t\tro.disconnect();\n\t\t\twindow.removeEventListener(\"resize\", updatePosition);\n\t\t\twindow.removeEventListener(\"scroll\", updatePosition, true);\n\t\t};\n\t}, [open, locale]);\n\n\tuseEffect(() => {\n\t\tif (!open) return;\n\t\tconst handleClickOutside = (e: MouseEvent) => {\n\t\t\tif (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {\n\t\t\t\tcloseDropdown();\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener(\"mousedown\", handleClickOutside);\n\t\treturn () => document.removeEventListener(\"mousedown\", handleClickOutside);\n\t}, [open, closeDropdown]);\n\n\tconst handleEntireBook = useCallback(async () => {\n\t\tconst config = flipBookRef.current?.getDownloadConfig?.();\n\t\tif (!config?.onDownloadSefer) return;\n\t\tsetLoading(\"sefer\");\n\t\ttry {\n\t\t\tconst result = await config.onDownloadSefer();\n\t\t\tif (result) triggerDownload(result, config.entireBookFilename ?? \"book\");\n\t\t\tcloseDropdown();\n\t\t} finally {\n\t\t\tsetLoading(null);\n\t\t}\n\t}, [flipBookRef, closeDropdown]);\n\n\tconst runRangeDownload = useCallback(\n\t\tasync (from: number, to: number) => {\n\t\t\tconst config = flipBookRef.current?.getDownloadConfig?.();\n\t\t\tif (!config?.onDownloadPageRange) return;\n\t\t\tconst pages: number[] = [];\n\t\t\tconst semanticPages: SemanticPageInfo[] = [];\n\t\t\tfor (let i = from; i <= to; i++) {\n\t\t\t\tpages.push(i);\n\t\t\t\tconst info = selectablePages.find((sp) => sp.pageIndex === i);\n\t\t\t\tif (info) semanticPages.push(info);\n\t\t\t}\n\t\t\tsetLoading(\"range\");\n\t\t\ttry {\n\t\t\t\tconst result = await config.onDownloadPageRange(\n\t\t\t\t\tpages,\n\t\t\t\t\tsemanticPages,\n\t\t\t\t\tconfig.downloadContext,\n\t\t\t\t);\n\t\t\t\tif (result) {\n\t\t\t\t\tconst fromName = sanitizeForFilename(semanticPages[0]?.semanticName ?? String(from));\n\t\t\t\t\tconst toName = sanitizeForFilename(\n\t\t\t\t\t\tsemanticPages[semanticPages.length - 1]?.semanticName ?? String(to),\n\t\t\t\t\t);\n\t\t\t\t\ttriggerDownload(result, `${config.rangeFilename ?? \"pages\"}-${fromName}-${toName}`);\n\t\t\t\t}\n\t\t\t\tcloseDropdown();\n\t\t\t} finally {\n\t\t\t\tsetLoading(null);\n\t\t\t}\n\t\t},\n\t\t[flipBookRef, selectablePages, closeDropdown],\n\t);\n\n\tuseEffect(() => {\n\t\tdownloadExecutorRef.current = (from?: number, to?: number) => {\n\t\t\tif (from === undefined && to === undefined) {\n\t\t\t\tvoid handleEntireBook();\n\t\t\t} else if (from !== undefined && to !== undefined) {\n\t\t\t\tvoid runRangeDownload(from, to);\n\t\t\t}\n\t\t};\n\t\treturn () => {\n\t\t\tdownloadExecutorRef.current = null;\n\t\t};\n\t}, [downloadExecutorRef, handleEntireBook, runRangeDownload]);\n\n\tif (!showDropdown) return null;\n\n\treturn (\n\t\t<div className={`flipbook-toolbar-download-wrap ${className ?? \"\"}`.trim()} ref={dropdownRef}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"flipbook-toolbar-button flipbook-toolbar-download-trigger\"\n\t\t\t\tonClick={() => setOpen((o) => !o)}\n\t\t\t\taria-label={ariaLabel ?? t(\"toolbarItem.download\", locale)}\n\t\t\t\taria-expanded={open}\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\tdisabled={loading !== null}\n\t\t\t>\n\t\t\t\t<DownloadIcon size={18} />\n\t\t\t</button>\n\t\t\t{open && (\n\t\t\t\t<div\n\t\t\t\t\tref={menuRef}\n\t\t\t\t\tclassName={`flipbook-toolbar-download-menu ${openUp ? \"flipbook-toolbar-download-menu--open-up\" : \"\"}`.trim()}\n\t\t\t\t\trole=\"menu\"\n\t\t\t\t\tdir={isRtl(locale) ? \"rtl\" : \"ltr\"}\n\t\t\t\t>\n\t\t\t\t\t<fieldset\n\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-mode\"\n\t\t\t\t\t\taria-label={t(\"toolbarItem.download\", locale)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{hasSefer && (\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-radio-label\">\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tname=\"download-mode\"\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-radio\"\n\t\t\t\t\t\t\t\t\tchecked={downloadMode === \"entire\"}\n\t\t\t\t\t\t\t\t\tonChange={() => setDownloadMode(\"entire\")}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span>{t(\"command.downloadEntireBook\", locale)}</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{hasRange && (\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-radio-label\">\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tname=\"download-mode\"\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-radio\"\n\t\t\t\t\t\t\t\t\tchecked={downloadMode === \"range\"}\n\t\t\t\t\t\t\t\t\tonChange={() => setDownloadMode(\"range\")}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span>{t(\"toolbarItem.downloadPageRange\", locale)}</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t{downloadMode === \"range\" && (\n\t\t\t\t\t\t<div className=\"flipbook-toolbar-download-range\">\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-range-label\">\n\t\t\t\t\t\t\t\t{t(\"toolbarItem.download.from\", locale)}\n\t\t\t\t\t\t\t\t<select\n\t\t\t\t\t\t\t\t\tvalue={fromIndex}\n\t\t\t\t\t\t\t\t\tonChange={(e) => setFromIndex(Number(e.target.value))}\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-range-select\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{selectablePages.map((p) => (\n\t\t\t\t\t\t\t\t\t\t<option key={p.pageIndex} value={p.pageIndex}>\n\t\t\t\t\t\t\t\t\t\t\t{p.semanticName || p.title || `Page ${p.pageIndex + 1}`}\n\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-range-label\">\n\t\t\t\t\t\t\t\t{t(\"toolbarItem.download.to\", locale)}\n\t\t\t\t\t\t\t\t<select\n\t\t\t\t\t\t\t\t\tvalue={toIndex}\n\t\t\t\t\t\t\t\t\tonChange={(e) => setToIndex(Number(e.target.value))}\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-range-select\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{selectablePages.map((p) => (\n\t\t\t\t\t\t\t\t\t\t<option key={p.pageIndex} value={p.pageIndex}>\n\t\t\t\t\t\t\t\t\t\t\t{p.semanticName || p.title || `Page ${p.pageIndex + 1}`}\n\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (downloadMode === \"entire\") {\n\t\t\t\t\t\t\t\tvoid handleEntireBook();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst total = flipBookRef.current?.getTotalPages?.() ?? totalPages;\n\t\t\t\t\t\t\t\tconst from = Math.min(fromIndex, toIndex);\n\t\t\t\t\t\t\t\tlet to = Math.max(fromIndex, toIndex);\n\t\t\t\t\t\t\t\tif (total > 0 && to >= total) to = total - 1;\n\t\t\t\t\t\t\t\tif (to < from) return;\n\t\t\t\t\t\t\t\tvoid runRangeDownload(from, to);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdisabled={loading !== null}\n\t\t\t\t\t>\n\t\t\t\t\t\t{loading === \"sefer\"\n\t\t\t\t\t\t\t? \"…\"\n\t\t\t\t\t\t\t: loading === \"range\"\n\t\t\t\t\t\t\t\t? \"…\"\n\t\t\t\t\t\t\t\t: t(\"toolbarItem.download.download\", locale)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport { DownloadDropdown };\n","import { goToFirstCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronFirstIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface FirstPageButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronFirstIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the first page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst FirstPageButton: React.FC<FirstPageButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(goToFirstCommand);\n\t};\n\n\tconst defaultIcon = <ChevronFirstIcon size={18} />;\n\tconst ariaLabel = t(\"command.jumpToFirstPage\", locale);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(goToFirstCommand)}\n\t\t\tclassName={`flipbook-toolbar-first ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { FirstPageButton };\nexport type { FirstPageButtonProps };\n","import type React from \"react\";\nimport { useEffect, useState } from \"react\";\nimport {\n\tcanUseFullscreen,\n\tfullscreenStateEvents,\n\tgetFullscreenElement,\n\ttoggleFullscreenCommand,\n\tuseCommands,\n} from \"../commands\";\nimport { t } from \"../i18n\";\nimport { MaximizeIcon, MinimizeIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface FullscreenButtonProps {\n\t/** Target element to make fullscreen. If not provided, uses Toolbar's fullscreenTargetRef or document.documentElement */\n\ttargetRef?: React.RefObject<HTMLElement | null>;\n\t/** Custom content for enter fullscreen. Defaults to MaximizeIcon */\n\tenterIcon?: React.ReactNode;\n\t/** Custom content for exit fullscreen. Defaults to MinimizeIcon */\n\texitIcon?: React.ReactNode;\n\t/** ARIA label for entering fullscreen. Defaults to the locale's \"Enter fullscreen\" */\n\tariaLabelEnter?: string;\n\t/** ARIA label for exiting fullscreen. Defaults to the locale's \"Exit fullscreen\" */\n\tariaLabelExit?: string;\n\t/** Behavior when the browser can't use fullscreen (e.g. iOS Safari):\n\t * \"hide\" renders nothing, \"disable\" shows a disabled button explaining why. Defaults to \"hide\". */\n\tunsupportedBehavior?: \"hide\" | \"disable\";\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to toggle fullscreen mode through the toggleFullscreen command,\n * so clicks, hotkeys (F11 by default), and holds stay in sync.\n * Same behavior in LTR and RTL — visual mirroring is handled by CSS\n * (dir=\"rtl\" + icon flip); the default icons are symmetric.\n */\nconst FullscreenButton: React.FC<FullscreenButtonProps> = ({\n\ttargetRef: targetRefProp,\n\tenterIcon,\n\texitIcon,\n\tariaLabelEnter,\n\tariaLabelExit,\n\tunsupportedBehavior = \"hide\",\n\tclassName,\n}) => {\n\tconst toolbar = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\tconst targetRef = targetRefProp ?? toolbar.fullscreenTargetRef;\n\n\t// Initial false keeps SSR/first render matching; real values arrive on mount.\n\tconst [isFullscreen, setIsFullscreen] = useState(false);\n\tconst [supported, setSupported] = useState(false);\n\n\t// Sync on any transition: button clicks, hotkeys, Escape, browser UI,\n\t// and rejected requests — standard and vendor-prefixed events alike.\n\tuseEffect(() => {\n\t\tconst update = () => {\n\t\t\tsetIsFullscreen(getFullscreenElement() !== null);\n\t\t\tsetSupported(canUseFullscreen(targetRef?.current));\n\t\t};\n\t\tupdate();\n\t\tfor (const type of fullscreenStateEvents) {\n\t\t\tdocument.addEventListener(type, update);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const type of fullscreenStateEvents) {\n\t\t\t\tdocument.removeEventListener(type, update);\n\t\t\t}\n\t\t};\n\t}, [targetRef]);\n\n\tconst handleClick = () => {\n\t\tif (targetRefProp) {\n\t\t\texecute(toggleFullscreenCommand, {\n\t\t\t\tgetFullscreenTarget: () => targetRefProp.current ?? null,\n\t\t\t});\n\t\t} else {\n\t\t\texecute(toggleFullscreenCommand);\n\t\t}\n\t};\n\n\tif (!supported && unsupportedBehavior === \"hide\") return null;\n\n\tconst label = isFullscreen\n\t\t? (ariaLabelExit ?? t(\"toolbarItem.exitFullscreen\", toolbar.locale))\n\t\t: (ariaLabelEnter ?? t(\"toolbarItem.enterFullscreen\", toolbar.locale));\n\tconst icon = isFullscreen\n\t\t? (exitIcon ?? <MinimizeIcon size={18} />)\n\t\t: (enterIcon ?? <MaximizeIcon size={18} />);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={label}\n\t\t\tariaPressed={isFullscreen}\n\t\t\tdisabled={!supported || !canExecute(toggleFullscreenCommand)}\n\t\t\ttitle={supported ? label : t(\"toolbarItem.fullscreenUnsupported\", toolbar.locale)}\n\t\t\tclassName={`flipbook-toolbar-fullscreen ${isFullscreen ? \"flipbook-toolbar-fullscreen--active\" : \"\"} ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{icon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { FullscreenButton };\nexport type { FullscreenButtonProps };\n","import { goToLastCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronLastIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface LastPageButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronLastIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the last page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst LastPageButton: React.FC<LastPageButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(goToLastCommand);\n\t};\n\n\tconst defaultIcon = <ChevronLastIcon size={18} />;\n\tconst ariaLabel = t(\"command.jumpToLastPage\", locale);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(goToLastCommand)}\n\t\t\tclassName={`flipbook-toolbar-last ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { LastPageButton };\nexport type { LastPageButtonProps };\n","import type React from \"react\";\nimport { type ToggleCommandDefinition, useCommands } from \"../commands\";\nimport { ToolbarButton } from \"./ToolbarButton\";\n\nexport interface ToggleButtonProps {\n\tcommand: ToggleCommandDefinition;\n\tariaLabel: string;\n\tchildren: React.ReactNode;\n\tdisabled?: boolean;\n\tclassName?: string;\n}\n\n/** A command-backed toggle that follows clicks and temporary hotkey overrides. */\nexport const ToggleButton: React.FC<ToggleButtonProps> = ({\n\tcommand,\n\tariaLabel,\n\tchildren,\n\tdisabled = false,\n\tclassName,\n}) => {\n\tconst { execute, canExecute, isActive } = useCommands();\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={() => execute(command)}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tariaPressed={isActive(command)}\n\t\t\tdisabled={disabled || !canExecute(command)}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{children}\n\t\t</ToolbarButton>\n\t);\n};\n","import type React from \"react\";\nimport { toggleTextSelectionCommand } from \"../commands\";\nimport { t } from \"../i18n\";\nimport { ToggleButton } from \"./ToggleButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\nexport interface MouseModeButtonProps {\n\t/** Override the locale's letters shown beside the text caret. */\n\tletters?: string;\n\t/** Override the localized accessible label. */\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\n/** Switch mouse dragging between native page turning and text selection. */\nexport const MouseModeButton: React.FC<MouseModeButtonProps> = ({\n\tletters,\n\tariaLabel,\n\tclassName,\n}) => {\n\tconst { locale } = useToolbar();\n\tconst label = ariaLabel ?? t(\"toolbarItem.selectText\", locale);\n\treturn (\n\t\t<ToggleButton\n\t\t\tcommand={toggleTextSelectionCommand}\n\t\t\tariaLabel={label}\n\t\t\tclassName={`flipbook-toolbar-mouse-mode ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t<span className=\"flipbook-toolbar-mouse-mode-icon\" aria-hidden=\"true\">\n\t\t\t\t<span className=\"flipbook-toolbar-mouse-mode-caret\" />\n\t\t\t\t<span>{letters ?? t(\"toolbarItem.selectionLetters\", locale)}</span>\n\t\t\t</span>\n\t\t</ToggleButton>\n\t);\n};\n","import { flipNextCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronRightIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface NextButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronRightIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button: next page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst NextButton: React.FC<NextButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(flipNextCommand);\n\t};\n\n\tconst ariaLabel = t(\"command.jumpToNextPage\", locale);\n\tconst defaultIcon = <ChevronRightIcon size={20} />;\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(flipNextCommand)}\n\t\t\tclassName={`flipbook-toolbar-next ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { NextButton };\nexport type { NextButtonProps };\n","import type React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ntype PageIndicatorMode = \"semantic\" | \"index\";\n\ninterface PageIndicatorProps {\n\t/**\n\t * Display mode:\n\t * - \"semantic\": uses pageSemantics to show semantic names (e.g., \"א\", \"ב\")\n\t * - \"index\": shows 1-based page numbers\n\t * Defaults to \"semantic\" if pageSemantics is available, otherwise \"index\".\n\t */\n\tmode?: PageIndicatorMode;\n\t/** Whether to show \"/ total\" after the current page(s). Defaults to true. */\n\tshowTotal?: boolean;\n\t/** Placeholder when current page has no semantic name (semantic mode only) */\n\tplaceholder?: string;\n\t/** Whether the input is editable for navigation. Defaults to true in semantic mode. */\n\teditable?: boolean;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Input aria-label for accessibility */\n\tariaLabel?: string;\n\t/** Maximum input length */\n\tmaxLength?: number;\n}\n\n/**\n * Displays the current page position with support for semantic names or indices.\n * Shows a range when a spread is visible (e.g., \"א - ב\" or \"1 - 2\").\n * Direction-aware: RTL shows right-left, LTR shows left-right.\n * When both pages have the same semantic name, shows scalar (no range).\n */\nconst PageIndicator: React.FC<PageIndicatorProps> = ({\n\tmode: modeProp,\n\tshowTotal = true,\n\tplaceholder = \"—\",\n\teditable: editableProp,\n\tclassName,\n\tariaLabel = \"Go to page\",\n\tmaxLength = 10,\n}) => {\n\tconst { flipBookRef, pageSemantics, direction, currentPage, totalPages, of } = useToolbar();\n\n\t// Determine effective mode\n\tconst mode: PageIndicatorMode = modeProp ?? (pageSemantics ? \"semantic\" : \"index\");\n\tconst editable = editableProp ?? (mode === \"semantic\" && !!pageSemantics);\n\n\tconst [inputValue, setInputValue] = useState(\"\");\n\tconst [isEditing, setIsEditing] = useState(false);\n\t// Ref-only flag: prevents handleBlur from reverting inputValue to a stale\n\t// displayText during the brief gap before Toolbar polling updates currentPage.\n\t// Cleared synchronously once the page actually changes.\n\tconst justNavigatedRef = useRef(false);\n\tconst prevCurrentPageRef = useRef(currentPage);\n\n\t// Calculate the spread pages (current page and its facing page)\n\tconst leftPageIndex = currentPage;\n\tconst rightPageIndex = currentPage + 1 < totalPages ? currentPage + 1 : null;\n\n\t// Get display names for pages\n\tconst getPageName = useCallback(\n\t\t(pageIndex: number): string => {\n\t\t\tif (mode === \"semantic\" && pageSemantics) {\n\t\t\t\treturn pageSemantics.indexToSemanticName(pageIndex) || \"\";\n\t\t\t}\n\t\t\treturn String(pageIndex + 1); // 1-based for display\n\t\t},\n\t\t[mode, pageSemantics],\n\t);\n\n\tconst leftName = getPageName(leftPageIndex);\n\tconst rightName = rightPageIndex != null ? getPageName(rightPageIndex) : \"\";\n\n\t// \"Of\" comes from the book (via context); default is total pages count\n\tconst getTotalDisplay = useCallback((): string => String(of), [of]);\n\n\t// Build display text for the range (always left physical page then right, e.g. י\"א - י\"ב)\n\tconst buildDisplayText = useCallback((): string => {\n\t\tconst firstName = leftName;\n\t\tconst secondName = rightName;\n\n\t\tlet rangeText: string;\n\t\tif (!firstName && !secondName) {\n\t\t\t// Both empty (e.g., cover pages)\n\t\t\trangeText = placeholder;\n\t\t} else if (!firstName) {\n\t\t\t// Only second has a name\n\t\t\trangeText = secondName;\n\t\t} else if (!secondName) {\n\t\t\t// Only first has a name\n\t\t\trangeText = firstName;\n\t\t} else if (firstName === secondName) {\n\t\t\t// Same name on both pages - show scalar\n\t\t\trangeText = firstName;\n\t\t} else {\n\t\t\t// Different names - show range\n\t\t\trangeText = `${firstName} - ${secondName}`;\n\t\t}\n\n\t\tif (showTotal) {\n\t\t\treturn `${rangeText} / ${getTotalDisplay()}`;\n\t\t}\n\t\treturn rangeText;\n\t}, [leftName, rightName, placeholder, showTotal, getTotalDisplay]);\n\n\t// The primary semantic name for editing (use left page in RTL reading order)\n\tconst primarySemanticName = direction === \"rtl\" ? rightName || leftName : leftName || rightName;\n\n\tconst displayText = buildDisplayText();\n\n\t// Sync input value when page changes and not editing.\n\t// After Enter navigation, justNavigatedRef prevents flashing the stale value;\n\t// once Toolbar polling updates currentPage, the flag is cleared and the\n\t// new displayText is applied. Because displayText includes the \" / total\"\n\t// suffix, it is always different from the user's typed value, guaranteeing\n\t// a state change that triggers a re-render.\n\tuseEffect(() => {\n\t\tconst pageChanged = currentPage !== prevCurrentPageRef.current;\n\t\tprevCurrentPageRef.current = currentPage;\n\n\t\tif (pageChanged) {\n\t\t\tjustNavigatedRef.current = false;\n\t\t}\n\t\tif (!isEditing && !justNavigatedRef.current) {\n\t\t\tsetInputValue(displayText);\n\t\t}\n\t}, [displayText, isEditing, currentPage]);\n\n\tconst handleFocus = useCallback(\n\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\tif (editable) {\n\t\t\t\tsetIsEditing(true);\n\t\t\t\tsetInputValue(primarySemanticName);\n\t\t\t\tjustNavigatedRef.current = false;\n\t\t\t\t// Select all text so the user can immediately type a replacement\n\t\t\t\tconst select = () => e.target.select();\n\t\t\t\ttypeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame(select) : select();\n\t\t\t}\n\t\t},\n\t\t[editable, primarySemanticName],\n\t);\n\n\tconst handleBlur = useCallback(() => {\n\t\tsetIsEditing(false);\n\t\t// After a successful Enter navigation, keep the user's typed value visible\n\t\t// until Toolbar polling updates currentPage with the new position.\n\t\tif (!justNavigatedRef.current) {\n\t\t\tsetInputValue(displayText);\n\t\t}\n\t}, [displayText]);\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\tif (e.key === \"Enter\") {\n\t\t\t\t// Navigate on Enter\n\t\t\t\tif (pageSemantics && inputValue.trim()) {\n\t\t\t\t\tconst pageIndex = pageSemantics.semanticNameToIndex(inputValue.trim());\n\t\t\t\t\tif (pageIndex != null && pageIndex >= 0 && pageIndex < totalPages) {\n\t\t\t\t\t\tflipBookRef.current?.jumpToPage(pageIndex);\n\t\t\t\t\t\tjustNavigatedRef.current = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.currentTarget.blur();\n\t\t\t} else if (e.key === \"Escape\") {\n\t\t\t\t// Cancel editing\n\t\t\t\te.currentTarget.blur();\n\t\t\t}\n\t\t},\n\t\t[inputValue, pageSemantics, totalPages, flipBookRef],\n\t);\n\n\tconst handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tsetInputValue(e.target.value);\n\t}, []);\n\n\t// Non-editable display (span)\n\tif (!editable) {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={`flipbook-toolbar-indicator ${className ?? \"\"}`.trim()}\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t>\n\t\t\t\t{displayText}\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Editable input — always shows inputValue.\n\t// When not editing, useEffect keeps inputValue in sync with displayText.\n\t// During editing, inputValue holds the user's typed text.\n\t// After Enter navigation, inputValue keeps the typed value until polling\n\t// updates currentPage, at which point useEffect sets it to the new displayText.\n\tconst editingClass = isEditing ? \"flipbook-toolbar-indicator--editing\" : \"\";\n\treturn (\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\tclassName={`flipbook-toolbar-indicator ${editingClass} ${className ?? \"\"}`.trim()}\n\t\t\tvalue={inputValue}\n\t\t\tonFocus={handleFocus}\n\t\t\tonBlur={handleBlur}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonChange={handleChange}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-live=\"polite\"\n\t\t\taria-atomic=\"true\"\n\t\t\tmaxLength={maxLength}\n\t\t\treadOnly={!editable}\n\t\t/>\n\t);\n};\n\nexport { PageIndicator };\nexport type { PageIndicatorProps, PageIndicatorMode };\n","import { flipPrevCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronLeftIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface PrevButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronLeftIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button: previous page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst PrevButton: React.FC<PrevButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(flipPrevCommand);\n\t};\n\n\tconst ariaLabel = t(\"command.jumpToPrevPage\", locale);\n\tconst defaultIcon = <ChevronLeftIcon size={20} />;\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(flipPrevCommand)}\n\t\t\tclassName={`flipbook-toolbar-prev ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { PrevButton };\nexport type { PrevButtonProps };\n","import { goToTocCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { TableOfContentsIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface TocButtonProps {\n\t/** Custom content (icon or text). Defaults to TableOfContentsIcon */\n\tchildren?: React.ReactNode;\n\t/** Custom ARIA label. Defaults to localized \"Table of contents\" */\n\tariaLabel?: string;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the Table of Contents page (instant jump, same as goToToc command).\n * TOC page index comes from store (populated by book config); command and UI both use the store.\n */\nconst TocButton: React.FC<TocButtonProps> = ({ children, ariaLabel: ariaLabelProp, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\tconst ariaLabel = ariaLabelProp ?? t(\"command.jumpToToc\", locale);\n\n\tconst handleClick = () => {\n\t\texecute(goToTocCommand);\n\t};\n\n\tconst disabled = !canExecute(goToTocCommand);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tdisabled={disabled}\n\t\t\tclassName={`flipbook-toolbar-toc ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? <TableOfContentsIcon size={18} />}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport { TocButton };\nexport type { TocButtonProps };\n","import type { CommandDefinition } from \"html-flip-book-vanilla/commands\";\n\n/**\n * React-layer command: open the download dropdown (e.g. Ctrl+S).\n * Toolbar wires data.open to openDownloadMenuRef.current.\n */\nexport const openDownloadMenuCommand: CommandDefinition = {\n\tid: \"openDownloadMenu\",\n\tenName: \"Open download menu\",\n\tenDescription: \"Open the download menu\",\n\tnameKey: \"toolbarItem.download\",\n\thotkeys: [{ key: \"s\", modifiers: { ctrl: true } }],\n\texecute: (ctx) => {\n\t\t(ctx.data?.open as (() => void) | undefined)?.();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => typeof ctx.data?.open === \"function\",\n};\n","import type React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { CommandDefinition, CommandOptions } from \"../commands\";\nimport { CommandProvider } from \"../commands/CommandContext\";\nimport { openDownloadMenuCommand } from \"../commands/open-download-menu-command\";\nimport type { FlipBookHandle, PageSemantics } from \"../FlipBook\";\nimport { defaultLocale, directionFromLocale, type Locale } from \"../i18n\";\nimport { ToolbarContext } from \"./ToolbarContext\";\nimport \"./Toolbar.css\";\n\ninterface ToolbarProps {\n\t/** Ref to the FlipBook component for programmatic control */\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\t/** Text direction. Defaults from intl locale (en-US → ltr). */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/** Locale for UI strings. Defaults to en-US. */\n\tlocale?: Locale;\n\t/** Optional page semantics for semantic indicator (e.g. perek/chapter) */\n\tpageSemantics?: PageSemantics;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Toolbar children in reading order: First, Prev, Indicator, Next, Last */\n\tchildren: React.ReactNode;\n\t/** Enable keyboard hotkeys for commands. Defaults to true */\n\tenableHotkeys?: boolean;\n\t/** Custom commands to register (merged with defaults) */\n\tcommands?: CommandDefinition[];\n\t/** Options for specific commands (e.g., custom hotkeys, data) */\n\tcommandOptions?: Record<string, CommandOptions>;\n\t/** When set, fullscreen (keyboard or button) targets this container only (e.g. sefer + toolbar wrapper). */\n\tfullscreenTargetRef?: React.RefObject<HTMLElement | null>;\n}\n\n/**\n * Container component for FlipBook toolbar controls.\n * Provides context to child components for accessing FlipBook methods.\n * Includes command system with configurable keyboard hotkeys.\n */\nconst Toolbar: React.FC<ToolbarProps> = ({\n\tflipBookRef,\n\tdirection: directionProp,\n\tlocale: localeProp,\n\tpageSemantics,\n\tclassName = \"\",\n\tchildren,\n\tenableHotkeys = true,\n\tcommands,\n\tcommandOptions,\n\tfullscreenTargetRef,\n}) => {\n\tconst direction = directionProp ?? directionFromLocale(localeProp ?? defaultLocale);\n\tconst locale = localeProp ?? (direction === \"rtl\" ? \"he-IL\" : \"en-US\");\n\tconst openDownloadMenuRef = useRef<(() => void) | null>(null);\n\tconst downloadExecutorRef = useRef<((from?: number, to?: number) => void) | null>(null);\n\tconst [currentPage, setCurrentPage] = useState(0);\n\tconst [totalPages, setTotalPages] = useState(0);\n\tconst [of, setOf] = useState<string | number>(0);\n\tconst [isFirstPage, setIsFirstPage] = useState(true);\n\tconst [isLastPage, setIsLastPage] = useState(false);\n\tconst [mouseMode, setMouseMode] = useState<\"turn\" | \"select\">(\"turn\");\n\n\tconst internalCommandOptions: Record<string, CommandOptions> = {\n\t\t...(fullscreenTargetRef\n\t\t\t? {\n\t\t\t\t\ttoggleFullscreen: {\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tgetFullscreenTarget: () => fullscreenTargetRef.current ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\topenDownloadMenu: {\n\t\t\tdata: { open: () => openDownloadMenuRef.current?.() },\n\t\t},\n\t\tdownload: {\n\t\t\tdata: {\n\t\t\t\tonDownload: (from?: number, to?: number) => downloadExecutorRef.current?.(from, to),\n\t\t\t},\n\t\t},\n\t};\n\n\t// Consumer options override toolbar defaults per command; data merges shallowly so\n\t// e.g. rebinding the fullscreen hotkey doesn't drop the injected fullscreen target.\n\tconst optionsById = new Map(Object.entries(commandOptions ?? {}));\n\tfor (const [id, internal] of Object.entries(internalCommandOptions)) {\n\t\tconst consumer = optionsById.get(id);\n\t\toptionsById.set(\n\t\t\tid,\n\t\t\tconsumer\n\t\t\t\t? { ...internal, ...consumer, data: { ...internal.data, ...consumer.data } }\n\t\t\t\t: internal,\n\t\t);\n\t}\n\tconst mergedCommandOptions = Object.fromEntries(optionsById);\n\n\t// Update state from FlipBook ref (book is source of truth for current, total, of)\n\tconst updateState = useCallback(() => {\n\t\tconst fb = flipBookRef.current;\n\t\tif (fb) {\n\t\t\tsetCurrentPage(fb.getCurrentPageIndex());\n\t\t\tsetTotalPages(fb.getTotalPages());\n\t\t\tsetOf(fb.getOf());\n\t\t\tsetIsFirstPage(fb.isFirstPage());\n\t\t\tsetIsLastPage(fb.isLastPage());\n\t\t\tsetMouseMode(fb.getMouseMode?.() ?? \"turn\");\n\t\t}\n\t}, [flipBookRef]);\n\n\t// Initial state update and periodic polling (throttled to reduce flicker)\n\t// TODO: Replace with event-based updates when FlipBook emits page change events\n\tuseEffect(() => {\n\t\tupdateState();\n\t\tconst interval = setInterval(updateState, 200);\n\t\treturn () => clearInterval(interval);\n\t}, [updateState]);\n\n\tconst toolbarContent = (\n\t\t<ToolbarContext.Provider\n\t\t\tvalue={{\n\t\t\t\tflipBookRef,\n\t\t\t\tdirection,\n\t\t\t\tlocale,\n\t\t\t\tpageSemantics,\n\t\t\t\tcurrentPage,\n\t\t\t\ttotalPages,\n\t\t\t\tof,\n\t\t\t\tisFirstPage,\n\t\t\t\tisLastPage,\n\t\t\t\tmouseMode,\n\t\t\t\topenDownloadMenuRef,\n\t\t\t\tdownloadExecutorRef,\n\t\t\t\tfullscreenTargetRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={`flipbook-toolbar ${direction === \"rtl\" ? \"flipbook-toolbar--rtl\" : \"\"} ${className}`.trim()}\n\t\t\t\trole=\"toolbar\"\n\t\t\t\taria-label=\"FlipBook navigation\"\n\t\t\t\tdir={direction}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</ToolbarContext.Provider>\n\t);\n\n\tconst allCommands: CommandDefinition[] = [openDownloadMenuCommand, ...(commands ?? [])];\n\n\treturn (\n\t\t<CommandProvider\n\t\t\tflipBookRef={flipBookRef}\n\t\t\tcurrentPage={currentPage}\n\t\t\ttotalPages={totalPages}\n\t\t\tdirection={direction}\n\t\t\tcommands={allCommands}\n\t\t\tcommandOptions={mergedCommandOptions}\n\t\t\tdisableHotkeys={!enableHotkeys}\n\t\t>\n\t\t\t{toolbarContent}\n\t\t</CommandProvider>\n\t);\n};\n\nexport { Toolbar };\nexport type { ToolbarProps };\n"],"names":["e","n","y","p","k","v","w","x","T","F","P","K","A","u","C","D","i","L","d","m","b","E","M","a","o","c","q","g","B","r","N","I","R","f","S","l","h","CommandsContext","createContext","isEditableTarget","target","getHotkeys","entry","canUseHotkey","command","binding","getContext","findHotkey","registry","event","direction","hotkeyMatches","CommandProvider","flipBookRef","_currentPage","_totalPages","customCommands","commandOptions","disableHotkeys","children","holds","useRef","HoldHotkeyController","refresh","useReducer","value","useMemo","reg","cmd","defaultCommands","createCommandContext","useCallback","runData","options","data","execute","ctx","canExecute","isActive","getAllCommands","latest","useEffect","handleHoldKeyDown","handleKeyDown","match","handleKeyUp","restore","handleVisibility","jsx","useCommands","useContext","t","s","defaultProps","ChevronLeftIcon","size","className","ChevronRightIcon","ChevronFirstIcon","jsxs","ChevronLastIcon","MaximizeIcon","MinimizeIcon","TableOfContentsIcon","BookshelfIcon","DownloadIcon","ToolbarButton","onClick","ariaLabel","ariaPressed","disabled","title","ActionButton","BookmarkToggleButton","enabled","onChange","ToolbarContext","useToolbar","context","sanitizeForFilename","name","triggerDownload","result","filenameBase","binary","bytes","blob","url","getSelectablePages","totalPages","pageSemantics","list","semanticName","DownloadDropdown","locale","openDownloadMenuRef","downloadExecutorRef","downloadConfig","open","setOpen","useState","downloadMode","setDownloadMode","fromIndex","setFromIndex","toIndex","setToIndex","loading","setLoading","openUp","setOpenUp","dropdownRef","menuRef","selectablePages","hasSefer","hasRange","showDropdown","firstSelectablePage","lastSelectablePage","closeDropdown","useLayoutEffect","menu","trigger","updatePosition","triggerRect","padding","gap","spaceBelow","spaceAbove","desiredHeight","above","bounds","left","isRtl","top","ro","toolbar","handleClickOutside","handleEntireBook","config","runRangeDownload","from","to","pages","semanticPages","info","sp","fromName","toName","total","FirstPageButton","handleClick","goToFirstCommand","defaultIcon","FullscreenButton","targetRefProp","enterIcon","exitIcon","ariaLabelEnter","ariaLabelExit","unsupportedBehavior","targetRef","isFullscreen","setIsFullscreen","supported","setSupported","update","getFullscreenElement","canUseFullscreen","type","fullscreenStateEvents","toggleFullscreenCommand","label","icon","LastPageButton","goToLastCommand","ToggleButton","MouseModeButton","letters","toggleTextSelectionCommand","NextButton","flipNextCommand","PageIndicator","modeProp","showTotal","placeholder","editableProp","maxLength","currentPage","of","mode","editable","inputValue","setInputValue","isEditing","setIsEditing","justNavigatedRef","prevCurrentPageRef","leftPageIndex","rightPageIndex","getPageName","pageIndex","leftName","rightName","getTotalDisplay","buildDisplayText","firstName","secondName","rangeText","primarySemanticName","displayText","pageChanged","handleFocus","select","handleBlur","handleChange","PrevButton","flipPrevCommand","TocButton","ariaLabelProp","goToTocCommand","openDownloadMenuCommand","Toolbar","directionProp","localeProp","enableHotkeys","commands","fullscreenTargetRef","directionFromLocale","defaultLocale","setCurrentPage","setTotalPages","setOf","isFirstPage","setIsFirstPage","isLastPage","setIsLastPage","mouseMode","setMouseMode","internalCommandOptions","optionsById","id","internal","consumer","mergedCommandOptions","updateState","fb","interval","toolbarContent","allCommands"],"mappings":";;AAAA,IAAIA,KAAI;AACR,SAASC,KAAI;AACX,SAAOD;AACT;ACFK,MAACE,KAAI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ACpC,GAAG,CAACF,CAAW,CAAC;AAEhB,QAAMG,IACL,gBAAAxM;AAAA,IAAC4B,GAAe;AAAA,IAAf;AAAA,MACA,OAAO;AAAA,QACN,aAAA/D;AAAA,QACA,WAAAH;AAAA,QACA,QAAAoF;AAAA,QACA,eAAAJ;AAAA,QACA,aAAAkG;AAAA,QACA,YAAAnG;AAAA,QACA,IAAAoG;AAAA,QACA,aAAA4C;AAAA,QACA,YAAAE;AAAA,QACA,WAAAE;AAAA,QACA,qBAAA9I;AAAA,QACA,qBAAAC;AAAA,QACA,qBAAAmI;AAAA,MAAA;AAAA,MAGD,UAAA,gBAAAnL;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,WAAW,oBAAoBtC,MAAc,QAAQ,0BAA0B,EAAE,IAAI8C,CAAS,GAAG,KAAA;AAAA,UACjG,MAAK;AAAA,UACL,cAAW;AAAA,UACX,KAAK9C;AAAA,UAEJ,UAAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,GAIIsO,IAAmC,CAAC5B,IAAyB,GAAIK,KAAY,CAAA,CAAG;AAEtF,SACC,gBAAAlL;AAAA,IAACpC;AAAA,IAAA;AAAA,MACA,aAAAC;AAAA,MACA,aAAA+K;AAAA,MACA,YAAAnG;AAAA,MACA,WAAA/E;AAAA,MACA,UAAU+O;AAAA,MACV,gBAAgBL;AAAA,MAChB,gBAAgB,CAACnB;AAAA,MAEhB,UAAAuB;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../base/dist/store/index.js","../../../base/dist/commands/index.js","../../src/commands/CommandContext.tsx","../../../base/dist/download/index.js","../../src/icons/index.tsx","../../src/toolbar/ToolbarButton.tsx","../../src/toolbar/ActionButton.tsx","../../src/toolbar/BookmarkToggleButton.tsx","../../../base/dist/intl.js","../../src/toolbar/ToolbarContext.tsx","../../src/toolbar/DownloadDropdown.tsx","../../src/toolbar/FirstPageButton.tsx","../../src/toolbar/FullscreenButton.tsx","../../src/toolbar/LastPageButton.tsx","../../src/toolbar/ToggleButton.tsx","../../src/toolbar/MouseModeButton.tsx","../../src/toolbar/NextButton.tsx","../../src/toolbar/PageIndicator.tsx","../../src/toolbar/PrevButton.tsx","../../src/toolbar/TocButton.tsx","../../src/commands/open-download-menu-command.ts","../../src/toolbar/Toolbar.tsx"],"sourcesContent":["let e = 4;\nfunction n() {\n return e;\n}\nfunction o(t) {\n e = t;\n}\nexport {\n n as getTocPageIndex,\n o as setTocPageIndex\n};\n//# sourceMappingURL=index.js.map\n","import { getTocPageIndex as u } from \"../store/index.js\";\nconst y = {\n id: \"download\",\n enName: \"Download\",\n enDescription: \"Download entire book or page range\",\n nameKey: \"toolbarItem.download\",\n hotkeys: [],\n execute: (e) => {\n e.data?.onDownload?.(\n e.data?.from,\n e.data?.to\n );\n },\n canExecute: (e) => typeof e.data?.onDownload == \"function\"\n}, p = [\n { key: \"ArrowRight\" },\n { key: \"PageDown\" },\n { key: \" \" }\n // Space\n], k = {\n id: \"flipNext\",\n navKind: \"flip\",\n enName: \"Next Page\",\n enDescription: \"Flip to the next page\",\n nameKey: \"command.jumpToNextPage\",\n hotkeys: p,\n execute: (e) => {\n e.handle?.flipNext();\n },\n canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1\n}, v = [{ key: \"ArrowLeft\" }, { key: \"PageUp\" }], w = {\n id: \"flipPrev\",\n navKind: \"flip\",\n enName: \"Previous Page\",\n enDescription: \"Flip to the previous page\",\n nameKey: \"command.jumpToPrevPage\",\n hotkeys: v,\n execute: (e) => {\n e.handle?.flipPrev();\n },\n canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0\n}, x = [{ key: \"Home\" }, { key: \"ArrowLeft\", modifiers: { ctrl: !0 } }], T = {\n id: \"goToFirst\",\n navKind: \"jump\",\n enName: \"First Page\",\n enDescription: \"Jump to the first page\",\n nameKey: \"command.jumpToFirstPage\",\n hotkeys: x,\n execute: (e) => {\n e.handle?.jumpToPage(0);\n },\n canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0\n}, F = [{ key: \"End\" }, { key: \"ArrowRight\", modifiers: { ctrl: !0 } }], P = {\n id: \"goToLast\",\n navKind: \"jump\",\n enName: \"Last Page\",\n enDescription: \"Jump to the last page\",\n nameKey: \"command.jumpToLastPage\",\n hotkeys: F,\n execute: (e) => {\n const t = e.handle?.getTotalPages() ?? 0;\n e.handle?.jumpToPage(t - 1);\n },\n canExecute: (e) => {\n const t = e.handle?.getCurrentPageIndex() ?? 0, n = e.handle?.getTotalPages() ?? 0;\n return t !== n - 1;\n }\n}, K = [{ key: \"t\" }], A = {\n id: \"goToToc\",\n navKind: \"jump\",\n enName: \"Table of Contents\",\n enDescription: \"Jump to the table of contents\",\n nameKey: \"command.jumpToToc\",\n hotkeys: K,\n execute: (e) => {\n const t = e.handle?.getTocPageIndex?.() ?? u();\n e.handle?.jumpToPage(t);\n },\n canExecute: (e) => {\n const t = e.handle?.getTocPageIndex?.() ?? u();\n return e.handle?.getCurrentPageIndex() !== t;\n }\n}, C = [{ key: \"d\", modifiers: { ctrl: !0, alt: !0 } }], D = {\n id: \"toggleDebug\",\n enName: \"Toggle Debug Toolbar\",\n enDescription: \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n nameKey: \"command.toggleDebug\",\n descriptionKey: \"command.toggleDebugDesc\",\n hotkeys: C,\n execute: (e) => {\n e.handle?.toggleDebugBar?.();\n }\n}, i = () => document, L = [\n \"fullscreenchange\",\n \"webkitfullscreenchange\",\n \"fullscreenerror\",\n \"webkitfullscreenerror\"\n];\nfunction d() {\n return typeof document > \"u\" ? null : i().fullscreenElement ?? i().webkitFullscreenElement ?? null;\n}\nfunction m(e) {\n if (typeof document > \"u\") return !1;\n const t = e ?? i().documentElement;\n return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != \"function\" ? !1 : (i().fullscreenEnabled ?? i().webkitFullscreenEnabled) !== !1;\n}\nasync function b(e) {\n const t = e;\n if (t.requestFullscreen) {\n await t.requestFullscreen();\n return;\n }\n if (t.webkitRequestFullscreen) {\n t.webkitRequestFullscreen();\n return;\n }\n throw new Error(\"Fullscreen API is not available\");\n}\nasync function E() {\n const e = i();\n if (e.exitFullscreen) {\n await e.exitFullscreen();\n return;\n }\n e.webkitExitFullscreen && e.webkitExitFullscreen();\n}\nconst M = [{ key: \"F11\" }], a = {\n id: \"toggleFullscreen\",\n kind: \"toggle\",\n enName: \"Toggle Fullscreen\",\n enDescription: \"Enter or exit fullscreen mode\",\n nameKey: \"command.toggleFullscreen\",\n descriptionKey: \"command.toggleFullscreenDesc\",\n hotkeys: M,\n canExecute: (e) => m(e.data?.getFullscreenTarget?.()),\n isActive: () => d() !== null,\n setActive: (e, t) => {\n const n = d();\n if (t) {\n if (n) return;\n const o = e.data?.getFullscreenTarget?.() ?? document.documentElement;\n if (!m(o)) return !1;\n b(o).catch(console.warn);\n return;\n }\n n && E().catch(console.warn);\n },\n execute: (e) => a.setActive(e, !a.isActive(e))\n}, c = {\n id: \"toggleTextSelection\",\n kind: \"toggle\",\n enName: \"Select Text\",\n enDescription: \"Toggle text selection; hold Ctrl to temporarily turn pages instead\",\n hotkeys: [{ key: \"Control\", mode: \"hold\", active: !1 }],\n canExecute: (e) => !!(e.handle?.getMouseMode && e.handle?.setMouseMode),\n isActive: (e) => e.handle?.getMouseMode?.() === \"select\",\n setActive: (e, t) => {\n if (!e.handle?.setMouseMode) return !1;\n const n = t ? \"select\" : \"turn\";\n e.transient ? e.handle.setMouseMode(n, { persist: !1 }) : e.handle.setMouseMode(n);\n },\n execute: (e) => {\n const t = c.setActive(\n e,\n !c.isActive(e)\n );\n return t !== !1 && window.getSelection()?.removeAllRanges(), t;\n }\n}, q = [\n k,\n w,\n T,\n P,\n A,\n a,\n D,\n c,\n y\n];\nfunction g(e, t) {\n return t !== \"rtl\" ? e : e === \"ArrowLeft\" ? \"ArrowRight\" : e === \"ArrowRight\" ? \"ArrowLeft\" : e;\n}\nfunction B(e, t, n) {\n if (g(t.key, n) !== e.key) return !1;\n const r = e.modifiers ?? {};\n return !(e.key !== \"Control\" && !!r.ctrl !== t.ctrlKey || e.key !== \"Shift\" && !!r.shift !== t.shiftKey || e.key !== \"Alt\" && !!r.alt !== t.altKey || e.key !== \"Meta\" && !!r.meta !== t.metaKey);\n}\nfunction N(e, t) {\n const n = e.modifiers ?? {};\n return [\n n.ctrl && !t.ctrlKey,\n n.shift && !t.shiftKey,\n n.alt && !t.altKey,\n n.meta && !t.metaKey\n ].some(Boolean);\n}\nfunction I(e, t, n) {\n const o = g(t.key, n);\n return o === e.key || o.length === 1 && o.toLowerCase() === e.key.toLowerCase() ? !0 : N(e, t);\n}\nfunction R(e, t) {\n const n = e.modifiers ?? {}, o = t.modifiers ?? {};\n return [\n !!n.ctrl == !!o.ctrl,\n !!n.shift == !!o.shift,\n !!n.alt == !!o.alt,\n !!n.meta == !!o.meta\n ].every(Boolean);\n}\nfunction f(e, t) {\n return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && R(e, t);\n}\nclass S {\n held = /* @__PURE__ */ new Map();\n has(t) {\n return this.held.has(t);\n }\n press(t, n, o) {\n const r = this.held.get(t.id);\n if (r?.bindings.some((l) => f(l, n))) return !1;\n const s = r ?? {\n command: t,\n context: { ...o, transient: !0 },\n initial: t.isActive(o),\n bindings: []\n };\n return t.setActive(s.context, n.active ?? !0) === !1 ? !1 : (s.bindings.push(n), this.held.set(t.id, s), !0);\n }\n release(t, n) {\n return this.removeBindings((o) => I(o, t, n));\n }\n /** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */\n reconcile(t, n) {\n return n ? this.clear() : this.removeBindings((o, r) => !this.isRegistered(o, r, t));\n }\n isRegistered(t, n, o) {\n const r = o[n.command.id];\n return !r || r.options.disableHotkeys || r.command !== n.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((l) => f(l, t));\n }\n clear() {\n return this.removeBindings(() => !0);\n }\n removeBindings(t) {\n let n = !1;\n for (const [o, r] of this.held) {\n const s = r.bindings.filter((h) => !t(h, r));\n if (s.length === r.bindings.length) continue;\n n = !0, r.bindings = s;\n const l = s.length ? s[s.length - 1].active ?? !0 : r.initial;\n r.command.setActive(r.context, l), s.length || this.held.delete(o);\n }\n return n;\n }\n}\nexport {\n S as HoldHotkeyController,\n m as canUseFullscreen,\n q as defaultCommands,\n y as downloadCommand,\n E as exitFullscreen,\n k as flipNextCommand,\n w as flipPrevCommand,\n L as fullscreenStateEvents,\n g as getEffectiveKey,\n d as getFullscreenElement,\n T as goToFirstCommand,\n P as goToLastCommand,\n A as goToTocCommand,\n B as hotkeyMatches,\n I as hotkeyReleased,\n b as requestFullscreen,\n D as toggleDebugCommand,\n a as toggleFullscreenCommand,\n c as toggleTextSelectionCommand\n};\n//# sourceMappingURL=index.js.map\n","import {\n\ttype CommandContext as CommandCtx,\n\ttype CommandDefinition,\n\ttype CommandOptions,\n\ttype CommandRegistry,\n\tdefaultCommands,\n\tHoldHotkeyController,\n\ttype HotkeyBinding,\n\thotkeyMatches,\n\ttype ToggleCommandDefinition,\n} from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport {\n\tcreateContext,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n} from \"react\";\nimport type { FlipBookHandle } from \"../FlipBook\";\n\ninterface CommandProviderProps {\n\t/** Reference to the FlipBook instance */\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\t/** Current page index */\n\tcurrentPage: number;\n\t/** Total number of pages */\n\ttotalPages: number;\n\t/** Reading direction */\n\tdirection?: \"rtl\" | \"ltr\";\n\t/** Custom commands to register (merged with defaults) */\n\tcommands?: CommandDefinition[];\n\t/** Options for specific commands */\n\tcommandOptions?: Record<string, CommandOptions>;\n\t/** Disable all hotkey bindings */\n\tdisableHotkeys?: boolean;\n\tchildren: React.ReactNode;\n}\n\ninterface CommandsContextValue {\n\t/** Execute a command (pass the command object, not a string ID). */\n\texecute: (command: CommandDefinition, runData?: Record<string, unknown>) => void;\n\t/** Check if a command can execute (for disabled state). */\n\tcanExecute: (command: CommandDefinition) => boolean;\n\t/** Read the current state of a toggle command for its toolbar button. */\n\tisActive: (command: ToggleCommandDefinition) => boolean;\n\t/** Get all registered commands. */\n\tgetAllCommands: () => CommandDefinition[];\n}\n\nconst CommandsContext = createContext<CommandsContextValue | null>(null);\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n\tif (!(target instanceof HTMLElement)) return false;\n\treturn Boolean(\n\t\ttarget.isContentEditable ||\n\t\t\ttarget.closest('input, textarea, select, [contenteditable=\"true\"], [contenteditable=\"\"]'),\n\t);\n}\n\nfunction getHotkeys(entry: CommandRegistry[string]): HotkeyBinding[] {\n\tif (entry.options.disableHotkeys) return [];\n\treturn entry.options.hotkeys ?? entry.command.hotkeys ?? [];\n}\n\nfunction canUseHotkey(\n\tcommand: CommandDefinition,\n\tbinding: HotkeyBinding,\n\tgetContext: (command: CommandDefinition) => CommandCtx,\n): boolean {\n\tif (binding.mode !== \"hold\") return true;\n\tif (command.kind !== \"toggle\") return false;\n\treturn !command.canExecute || command.canExecute(getContext(command));\n}\n\nfunction findHotkey(\n\tregistry: CommandRegistry,\n\tevent: KeyboardEvent,\n\tdirection: \"ltr\" | \"rtl\",\n\tgetContext: (command: CommandDefinition) => CommandCtx,\n) {\n\tfor (const entry of Object.values(registry)) {\n\t\tconst binding = getHotkeys(entry).find(\n\t\t\t(binding) =>\n\t\t\t\thotkeyMatches(binding, event, direction) &&\n\t\t\t\tcanUseHotkey(entry.command, binding, getContext),\n\t\t);\n\t\tif (binding) return { command: entry.command, binding };\n\t}\n\treturn undefined;\n}\n\n/**\n * Provider component that manages flipbook commands and hotkeys.\n * Uses framework-agnostic commands from base; only the provider and hook are React-specific.\n */\nexport const CommandProvider: React.FC<CommandProviderProps> = ({\n\tflipBookRef,\n\tcurrentPage: _currentPage,\n\ttotalPages: _totalPages,\n\tdirection = \"ltr\",\n\tcommands: customCommands = [],\n\tcommandOptions = {},\n\tdisableHotkeys = false,\n\tchildren,\n}) => {\n\tconst holds = useRef(new HoldHotkeyController()).current;\n\tconst [, refresh] = useReducer((value: number) => value + 1, 0);\n\tconst registry = useMemo<CommandRegistry>(() => {\n\t\tconst reg: CommandRegistry = {};\n\n\t\tfor (const cmd of defaultCommands) {\n\t\t\treg[cmd.id] = {\n\t\t\t\tcommand: cmd,\n\t\t\t\toptions: commandOptions[cmd.id] ?? {},\n\t\t\t};\n\t\t}\n\n\t\tfor (const cmd of customCommands) {\n\t\t\treg[cmd.id] = {\n\t\t\t\tcommand: cmd,\n\t\t\t\toptions: commandOptions[cmd.id] ?? {},\n\t\t\t};\n\t\t}\n\n\t\treturn reg;\n\t}, [customCommands, commandOptions]);\n\n\tconst createCommandContext = useCallback(\n\t\t(command: CommandDefinition, runData?: Record<string, unknown>): CommandCtx => {\n\t\t\tconst options = registry[command.id]?.options ?? {};\n\t\t\tconst data = runData ? { ...options.data, ...runData } : options.data;\n\t\t\treturn {\n\t\t\t\thandle: flipBookRef.current,\n\t\t\t\tdata,\n\t\t\t};\n\t\t},\n\t\t[flipBookRef, registry],\n\t);\n\n\tconst execute = useCallback(\n\t\t(command: CommandDefinition, runData?: Record<string, unknown>) => {\n\t\t\tif (holds.has(command.id)) return;\n\t\t\tconst ctx = createCommandContext(command, runData);\n\t\t\tif (command.canExecute && !command.canExecute(ctx)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcommand.execute(ctx);\n\t\t\trefresh();\n\t\t},\n\t\t[createCommandContext, holds],\n\t);\n\n\tconst canExecute = useCallback(\n\t\t(command: CommandDefinition): boolean => {\n\t\t\tif (holds.has(command.id)) return false;\n\t\t\tconst ctx = createCommandContext(command);\n\t\t\tif (!command.canExecute) return true;\n\t\t\treturn command.canExecute(ctx);\n\t\t},\n\t\t[createCommandContext, holds],\n\t);\n\n\tconst isActive = useCallback(\n\t\t(command: ToggleCommandDefinition) => command.isActive(createCommandContext(command)),\n\t\t[createCommandContext],\n\t);\n\n\tconst getAllCommands = useCallback(\n\t\t(): CommandDefinition[] => Object.values(registry).map((e) => e.command),\n\t\t[registry],\n\t);\n\n\tconst latest = useRef({ registry, execute, createCommandContext, direction, disableHotkeys });\n\tlatest.current = { registry, execute, createCommandContext, direction, disableHotkeys };\n\n\tuseEffect(() => {\n\t\tif (holds.reconcile(registry, disableHotkeys)) refresh();\n\t}, [holds, registry, disableHotkeys]);\n\n\tuseEffect(() => {\n\t\tconst handleHoldKeyDown = (\n\t\t\tcommand: CommandDefinition,\n\t\t\tbinding: HotkeyBinding,\n\t\t\tevent: KeyboardEvent,\n\t\t): void => {\n\t\t\tif (command.kind !== \"toggle\") return;\n\t\t\tconst ctx = latest.current.createCommandContext(command);\n\t\t\tif (!event.repeat && holds.press(command, binding, ctx)) refresh();\n\t\t\t// Keep modifier-only browser shortcuts (such as Ctrl+C) usable.\n\t\t\tif (![\"Control\", \"Shift\", \"Alt\", \"Meta\"].includes(binding.key)) event.preventDefault();\n\t\t};\n\t\tconst handleKeyDown = (event: KeyboardEvent): void => {\n\t\t\tconst { registry, execute, direction, disableHotkeys, createCommandContext } = latest.current;\n\t\t\tif (disableHotkeys || event.defaultPrevented || isEditableTarget(event.target)) return;\n\t\t\tconst match = findHotkey(registry, event, direction, createCommandContext);\n\t\t\tif (!match) return;\n\t\t\tif (match.binding.mode === \"hold\") {\n\t\t\t\thandleHoldKeyDown(match.command, match.binding, event);\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\texecute(match.command);\n\t\t\t}\n\t\t};\n\t\tconst handleKeyUp = (event: KeyboardEvent) => {\n\t\t\tif (holds.release(event, latest.current.direction)) refresh();\n\t\t};\n\t\tconst restore = () => {\n\t\t\tif (holds.clear()) refresh();\n\t\t};\n\t\tconst handleVisibility = () => {\n\t\t\tif (document.hidden) restore();\n\t\t};\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\tdocument.addEventListener(\"keyup\", handleKeyUp);\n\t\twindow.addEventListener(\"blur\", restore);\n\t\tdocument.addEventListener(\"visibilitychange\", handleVisibility);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", handleKeyUp);\n\t\t\twindow.removeEventListener(\"blur\", restore);\n\t\t\tdocument.removeEventListener(\"visibilitychange\", handleVisibility);\n\t\t\tholds.clear();\n\t\t};\n\t}, [holds]);\n\n\tconst value: CommandsContextValue = { execute, canExecute, isActive, getAllCommands };\n\n\treturn <CommandsContext.Provider value={value}>{children}</CommandsContext.Provider>;\n};\n\nexport const useCommands = (): CommandsContextValue => {\n\tconst ctx = useContext(CommandsContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useCommands must be used within a CommandProvider\");\n\t}\n\treturn ctx;\n};\n","function c(t) {\n let i = \"\";\n for (const n of new TextEncoder().encode(t))\n i += String.fromCharCode(n);\n return btoa(i);\n}\nfunction s(t) {\n return { ext: \"json\", data: c(JSON.stringify(t, null, \"\t\")) };\n}\nfunction f(t) {\n const { pagesCount: i, pageSemantics: n } = t, a = (e) => {\n const o = n?.indexToSemanticName(e) ?? \"\", r = n?.indexToTitle(e) ?? \"\";\n return n ? { pageIndex: e, semanticName: o, title: r } : { pageIndex: e, semanticName: String(e + 1), title: `Page ${e + 1}` };\n };\n return {\n onDownloadSefer: () => {\n const e = [];\n for (let o = 0; o < i; o++) {\n const r = a(o);\n (r.semanticName || r.title) && e.push(r);\n }\n return Promise.resolve(s(e));\n },\n onDownloadPageRange: (e) => Promise.resolve(s(e.map(a)))\n };\n}\nexport {\n f as createDefaultDownloadConfig\n};\n//# sourceMappingURL=index.js.map\n","/**\n * Icon components for the flipbook toolbar.\n * All icons use currentColor for stroke, making them themeable.\n */\nimport type React from \"react\";\n\ninterface IconProps {\n\t/** Icon size in pixels. Default: 24 */\n\tsize?: number;\n\t/** Additional CSS class */\n\tclassName?: string;\n}\n\nconst defaultProps: IconProps = { size: 24 };\n\nexport const ChevronLeftIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m15 18-6-6 6-6\" />\n\t</svg>\n);\n\nexport const ChevronRightIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m9 18 6-6-6-6\" />\n\t</svg>\n);\n\nexport const ChevronFirstIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m17 18-6-6 6-6\" />\n\t\t<path d=\"M7 6v12\" />\n\t</svg>\n);\n\nexport const ChevronLastIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"m7 18 6-6-6-6\" />\n\t\t<path d=\"M17 6v12\" />\n\t</svg>\n);\n\nexport const MaximizeIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M8 3H5a2 2 0 0 0-2 2v3\" />\n\t\t<path d=\"M21 8V5a2 2 0 0 0-2-2h-3\" />\n\t\t<path d=\"M3 16v3a2 2 0 0 0 2 2h3\" />\n\t\t<path d=\"M16 21h3a2 2 0 0 0 2-2v-3\" />\n\t</svg>\n);\n\nexport const MinimizeIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M8 3v3a2 2 0 0 1-2 2H3\" />\n\t\t<path d=\"M21 8h-3a2 2 0 0 1-2-2V3\" />\n\t\t<path d=\"M3 16h3a2 2 0 0 1 2 2v3\" />\n\t\t<path d=\"M16 21v-3a2 2 0 0 1 2-2h3\" />\n\t</svg>\n);\n\nexport const TableOfContentsIcon: React.FC<IconProps> = ({\n\tsize = defaultProps.size,\n\tclassName,\n}) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M16 5H3\" />\n\t\t<path d=\"M16 12H3\" />\n\t\t<path d=\"M16 19H3\" />\n\t\t<path d=\"M21 5h.01\" />\n\t\t<path d=\"M21 12h.01\" />\n\t\t<path d=\"M21 19h.01\" />\n\t</svg>\n);\n\nexport const BookshelfIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t{/* Shelf */}\n\t\t<path d=\"M3 21h18\" />\n\t\t{/* Books */}\n\t\t<rect x=\"4\" y=\"7\" width=\"3\" height=\"14\" rx=\"0.5\" />\n\t\t<rect x=\"8\" y=\"5\" width=\"3\" height=\"16\" rx=\"0.5\" />\n\t\t<rect x=\"12\" y=\"9\" width=\"3\" height=\"12\" rx=\"0.5\" />\n\t\t<rect x=\"16\" y=\"6\" width=\"4\" height=\"15\" rx=\"0.5\" />\n\t</svg>\n);\n\nexport const DownloadIcon: React.FC<IconProps> = ({ size = defaultProps.size, className }) => (\n\t<svg\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth={size}\n\t\theight={size}\n\t\tviewBox=\"0 0 24 24\"\n\t\tfill=\"none\"\n\t\tstroke=\"currentColor\"\n\t\tstrokeWidth=\"2\"\n\t\tstrokeLinecap=\"round\"\n\t\tstrokeLinejoin=\"round\"\n\t\tclassName={className}\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n\t\t<polyline points=\"7 10 12 15 17 10\" />\n\t\t<line x1=\"12\" x2=\"12\" y1=\"15\" y2=\"3\" />\n\t</svg>\n);\n\nexport type { IconProps };\n","import type React from \"react\";\n\ninterface ToolbarButtonProps {\n\t/** Click handler */\n\tonClick: () => void;\n\t/** Accessible label for the button */\n\tariaLabel: string;\n\t/** Toggle state for mode buttons. */\n\tariaPressed?: boolean;\n\t/** Whether the button is disabled */\n\tdisabled?: boolean;\n\t/** Button content (icon or text) */\n\tchildren: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Title tooltip */\n\ttitle?: string;\n}\n\n/**\n * Base button component for toolbar actions.\n */\nconst ToolbarButton: React.FC<ToolbarButtonProps> = ({\n\tonClick,\n\tariaLabel,\n\tariaPressed,\n\tdisabled = false,\n\tchildren,\n\tclassName = \"\",\n\ttitle,\n}) => {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={onClick}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-pressed={ariaPressed}\n\t\t\tdisabled={disabled}\n\t\t\ttitle={title ?? ariaLabel}\n\t\t\tclassName={`flipbook-toolbar-button ${className}`.trim()}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n};\n\nexport type { ToolbarButtonProps };\nexport { ToolbarButton };\n","import type React from \"react\";\nimport { ToolbarButton } from \"./ToolbarButton\";\n\ninterface ActionButtonProps {\n\t/** Click handler for custom action */\n\tonClick: () => void;\n\t/** ARIA label for accessibility */\n\tariaLabel: string;\n\t/** Custom content (icon or text) */\n\tchildren: React.ReactNode;\n\t/** Whether the button is disabled */\n\tdisabled?: boolean;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Generic toolbar button for custom actions.\n * Use this for actions that aren't standard flipbook navigation.\n */\nconst ActionButton: React.FC<ActionButtonProps> = ({\n\tonClick,\n\tariaLabel,\n\tchildren,\n\tdisabled = false,\n\tclassName,\n}) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={onClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tdisabled={disabled}\n\t\t\tclassName={`flipbook-toolbar-action ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { ActionButtonProps };\nexport { ActionButton };\n","import { ToolbarButton } from \"./ToolbarButton\";\n\nexport interface BookmarkToggleButtonProps {\n\t/** Current consumer-controlled bookmark visibility. */\n\tenabled: boolean;\n\t/** Update the book's enableBookmarks prop without changing its navigation state. */\n\tonChange: (enabled: boolean) => void;\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\n/** An opt-in bookmark visibility control for a consumer's toolbar. */\nexport const BookmarkToggleButton = ({\n\tenabled,\n\tonChange,\n\tariaLabel,\n\tclassName,\n}: BookmarkToggleButtonProps) => (\n\t<ToolbarButton\n\t\tonClick={() => onChange(!enabled)}\n\t\tariaLabel={ariaLabel ?? (enabled ? \"Hide bookmarks\" : \"Show bookmarks\")}\n\t\tariaPressed={enabled}\n\t\tclassName={`flipbook-toolbar-bookmarks ${className ?? \"\"}`.trim()}\n\t>\n\t\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n\t\t\t<path\n\t\t\t\td=\"M5 2.5h10v15l-5-3-5 3z\"\n\t\t\t\tfill={enabled ? \"currentColor\" : \"none\"}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t</ToolbarButton>\n);\n","const m = {\n align: \"left\",\n direction: \"ltr\",\n translations: {\n \"toolbarItem.download\": \"Download\",\n \"toolbarItem.downloadPageRange\": \"Download page range…\",\n \"toolbarItem.download.from\": \"From\",\n \"toolbarItem.download.to\": \"To\",\n \"toolbarItem.download.download\": \"Download\",\n \"command.downloadEntireBook\": \"Download entire book\",\n \"command.jumpToToc\": \"Table of contents\",\n \"command.jumpToFirstPage\": \"First page\",\n \"command.jumpToLastPage\": \"Last page\",\n \"command.jumpToPrevPage\": \"Previous page\",\n \"command.jumpToNextPage\": \"Next page\",\n \"command.toggleFullscreen\": \"Toggle fullscreen\",\n \"command.toggleFullscreenDesc\": \"Enter or exit fullscreen mode\",\n \"command.toggleDebug\": \"Toggle debug toolbar\",\n \"command.toggleDebugDesc\": \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"Go to page\",\n \"toolbarItem.selectText\": \"Select text with mouse\",\n \"toolbarItem.selectionLetters\": \"Aa\",\n \"toolbarItem.enterFullscreen\": \"Enter fullscreen\",\n \"toolbarItem.exitFullscreen\": \"Exit fullscreen\",\n \"toolbarItem.fullscreenUnsupported\": \"Fullscreen is not supported by this browser\"\n }\n}, d = {\n align: \"right\",\n direction: \"rtl\",\n translations: {\n \"toolbarItem.download\": \"הורדה\",\n \"toolbarItem.downloadPageRange\": \"הורד טווח עמודים…\",\n \"toolbarItem.download.from\": \"מ\",\n \"toolbarItem.download.to\": \"עד\",\n \"toolbarItem.download.download\": \"הורד\",\n \"command.downloadEntireBook\": \"הורד את כל הספר\",\n \"command.jumpToToc\": \"תוכן העניינים\",\n \"command.jumpToFirstPage\": \"עמוד ראשון\",\n \"command.jumpToLastPage\": \"עמוד אחרון\",\n \"command.jumpToPrevPage\": \"עמוד קודם\",\n \"command.jumpToNextPage\": \"עמוד הבא\",\n \"command.toggleFullscreen\": \"מסך מלא\",\n \"command.toggleFullscreenDesc\": \"כניסה או יציאה ממסך מלא\",\n \"command.toggleDebug\": \"סרגל כלים לדיבוג\",\n \"command.toggleDebugDesc\": \"הצג או הסתר סרגל הדיבוג (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"מעבר לעמוד\",\n \"toolbarItem.selectText\": \"בחירת טקסט עם העכבר\",\n \"toolbarItem.selectionLetters\": \"אב\",\n \"toolbarItem.enterFullscreen\": \"כניסה למסך מלא\",\n \"toolbarItem.exitFullscreen\": \"יציאה ממסך מלא\",\n \"toolbarItem.fullscreenUnsupported\": \"מסך מלא אינו נתמך בדפדפן זה\"\n }\n}, l = {\n \"en-US\": m,\n \"he-IL\": d\n}, n = \"en-US\", c = {\n \"toolbarItem.download\": \"Download\",\n \"toolbarItem.downloadPageRange\": \"Download page range…\",\n \"toolbarItem.download.from\": \"From\",\n \"toolbarItem.download.to\": \"To\",\n \"toolbarItem.download.download\": \"Download\",\n \"command.downloadEntireBook\": \"Download entire book\",\n \"command.jumpToToc\": \"Table of contents\",\n \"command.jumpToFirstPage\": \"First page\",\n \"command.jumpToLastPage\": \"Last page\",\n \"command.jumpToPrevPage\": \"Previous page\",\n \"command.jumpToNextPage\": \"Next page\",\n \"command.toggleFullscreen\": \"Toggle fullscreen\",\n \"command.toggleFullscreenDesc\": \"Enter or exit fullscreen mode\",\n \"command.toggleDebug\": \"Toggle debug toolbar\",\n \"command.toggleDebugDesc\": \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n \"toolbarItem.goToPage\": \"Go to page\",\n \"toolbarItem.enterFullscreen\": \"Enter fullscreen\",\n \"toolbarItem.exitFullscreen\": \"Exit fullscreen\",\n \"toolbarItem.fullscreenUnsupported\": \"Fullscreen is not supported by this browser\"\n};\nfunction a(o) {\n return l[o] ?? l[n];\n}\nfunction g(o) {\n return a(o).direction === \"rtl\";\n}\nfunction u(o) {\n return g(o) ? \"rtl\" : \"ltr\";\n}\nfunction b(o, r) {\n const e = a(r).translations[o];\n if (e !== void 0 && e !== \"\") return e;\n const t = l[n].translations[o];\n return t !== void 0 && t !== \"\" ? t : c[o] ?? o;\n}\nexport {\n n as defaultLocale,\n u as directionFromLocale,\n a as getConfig,\n g as isRtl,\n b as t\n};\n//# sourceMappingURL=intl.js.map\n","import type React from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { FlipBookHandle, MouseMode, PageSemantics } from \"../FlipBook\";\nimport type { Locale } from \"../i18n\";\n\ninterface ToolbarContextValue {\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\tdirection: \"ltr\" | \"rtl\";\n\t/** Locale for UI strings (toolbar, download menu). Defaults to en-US. */\n\tlocale: Locale;\n\tpageSemantics?: PageSemantics;\n\tcurrentPage: number;\n\ttotalPages: number;\n\t/** \"Of\" value from the book (for page indicator). Sourced from FlipBook ref. */\n\tof: string | number;\n\tisFirstPage: boolean;\n\tisLastPage: boolean;\n\tmouseMode: MouseMode;\n\t/** Ref used by openDownloadMenu command (Ctrl+S) to open the download dropdown. DownloadDropdown sets this. */\n\topenDownloadMenuRef: React.MutableRefObject<(() => void) | null>;\n\t/** Ref set by DownloadDropdown: (from?, to?) => void to run download (entire book or range). Used by download command. */\n\tdownloadExecutorRef: React.MutableRefObject<((from?: number, to?: number) => void) | null>;\n\t/** When set (via Toolbar fullscreenTargetRef), fullscreen targets this container (e.g. sefer + toolbar). */\n\tfullscreenTargetRef?: React.RefObject<HTMLElement | null>;\n}\n\nconst ToolbarContext = createContext<ToolbarContextValue | null>(null);\n\nexport function useToolbar(): ToolbarContextValue {\n\tconst context = useContext(ToolbarContext);\n\tif (!context) {\n\t\tthrow new Error(\"Toolbar components must be used within a Toolbar\");\n\t}\n\treturn context;\n}\n\nexport type { ToolbarContextValue };\nexport { ToolbarContext };\n","import type React from \"react\";\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { SemanticPageInfo } from \"../download/types\";\nimport { isRtl, t } from \"../i18n\";\nimport { DownloadIcon } from \"../icons\";\nimport { useToolbar } from \"./ToolbarContext\";\nimport \"./DownloadDropdown.css\";\n\n/** Strip Hebrew punctuation (geresh, gershaim) from a name for use in filenames. */\nfunction sanitizeForFilename(name: string): string {\n\treturn name.replace(/[׳'״\"]/g, \"\");\n}\n\nfunction triggerDownload(result: { ext: string; data: string }, filenameBase: string): void {\n\ttry {\n\t\tconst binary = atob(result.data);\n\t\tconst bytes = new Uint8Array(binary.length);\n\t\tfor (let i = 0; i < binary.length; i++) {\n\t\t\tbytes[i] = binary.charCodeAt(i);\n\t\t}\n\t\tconst blob = new Blob([bytes]);\n\t\tconst url = URL.createObjectURL(blob);\n\t\tconst a = document.createElement(\"a\");\n\t\ta.href = url;\n\t\ta.download = `${filenameBase}.${result.ext}`;\n\t\ta.click();\n\t\tURL.revokeObjectURL(url);\n\t} catch (e) {\n\t\tconsole.error(\"Download failed:\", e);\n\t}\n}\n\n/** Collect pages that have a semantic name for range selector options.\n * Pages without a semantic name (covers, blanks, TOC) are excluded. */\nfunction getSelectablePages(\n\ttotalPages: number,\n\tpageSemantics?: {\n\t\tindexToSemanticName: (i: number) => string;\n\t\tindexToTitle: (i: number) => string;\n\t},\n): SemanticPageInfo[] {\n\tconst list: SemanticPageInfo[] = [];\n\tfor (let i = 0; i < totalPages; i++) {\n\t\tconst semanticName = pageSemantics?.indexToSemanticName(i) ?? \"\";\n\t\tconst title = pageSemantics?.indexToTitle(i) ?? \"\";\n\t\t// Only include pages with a real semantic identity\n\t\tif (!semanticName && !title) {\n\t\t\t// No semantics at all — fall back to 1-based index only when\n\t\t\t// no pageSemantics provider exists (plain book without metadata).\n\t\t\tif (!pageSemantics) {\n\t\t\t\tlist.push({ pageIndex: i, semanticName: String(i + 1), title: `Page ${i + 1}` });\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tlist.push({\n\t\t\tpageIndex: i,\n\t\t\tsemanticName: semanticName || String(i + 1),\n\t\t\ttitle: title || semanticName,\n\t\t});\n\t}\n\treturn list;\n}\n\nexport interface DownloadDropdownProps {\n\t/** Label for \"Download\" button. Default: \"Download\" */\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\nconst DownloadDropdown: React.FC<DownloadDropdownProps> = ({\n\tariaLabel = \"Download\",\n\tclassName,\n}) => {\n\tconst {\n\t\ttotalPages,\n\t\tpageSemantics,\n\t\tlocale,\n\t\topenDownloadMenuRef,\n\t\tdownloadExecutorRef,\n\t\tflipBookRef,\n\t} = useToolbar();\n\tconst downloadConfig = flipBookRef.current?.getDownloadConfig?.() ?? undefined;\n\tconst [open, setOpen] = useState(false);\n\n\tuseEffect(() => {\n\t\topenDownloadMenuRef.current = () => setOpen(true);\n\t\treturn () => {\n\t\t\topenDownloadMenuRef.current = null;\n\t\t};\n\t}, [openDownloadMenuRef]);\n\ttype DownloadMode = \"entire\" | \"range\";\n\tconst [downloadMode, setDownloadMode] = useState<DownloadMode>(\"entire\");\n\tconst [fromIndex, setFromIndex] = useState(0);\n\tconst [toIndex, setToIndex] = useState(0);\n\tconst [loading, setLoading] = useState<\"sefer\" | \"range\" | null>(null);\n\tconst [openUp, setOpenUp] = useState(false);\n\tconst dropdownRef = useRef<HTMLDivElement>(null);\n\tconst menuRef = useRef<HTMLDivElement>(null);\n\n\tconst selectablePages = useMemo(\n\t\t() => getSelectablePages(totalPages, pageSemantics),\n\t\t[totalPages, pageSemantics],\n\t);\n\n\tconst hasSefer = Boolean(downloadConfig?.onDownloadSefer);\n\tconst hasRange = Boolean(downloadConfig?.onDownloadPageRange);\n\tconst showDropdown = hasSefer || hasRange;\n\n\t// Pre-compute primitive values from the memoised list so the effect deps stay stable\n\tconst firstSelectablePage = selectablePages[0]?.pageIndex ?? 0;\n\tconst lastSelectablePage = selectablePages[selectablePages.length - 1]?.pageIndex ?? 0;\n\n\t// When opening, default mode to \"entire\" if available, else \"range\"; init range to first/last selectable page\n\tuseEffect(() => {\n\t\tif (!open) return;\n\t\tsetDownloadMode(hasSefer ? \"entire\" : \"range\");\n\t\tsetFromIndex(firstSelectablePage);\n\t\tsetToIndex(lastSelectablePage);\n\t}, [open, hasSefer, firstSelectablePage, lastSelectablePage]);\n\n\tconst closeDropdown = useCallback(() => {\n\t\tsetOpen(false);\n\t}, []);\n\n\t// Anchor to the trigger while keeping both axes inside the viewport, including scrolled toolbars.\n\tuseLayoutEffect(() => {\n\t\tif (!open || !menuRef.current || !dropdownRef.current) return;\n\t\tconst menu = menuRef.current;\n\t\tconst trigger = dropdownRef.current.querySelector(\".flipbook-toolbar-download-trigger\");\n\t\tconst updatePosition = () => {\n\t\t\tconst triggerRect = trigger?.getBoundingClientRect();\n\t\t\tif (!triggerRect) return;\n\t\t\tconst padding = 8;\n\t\t\tconst gap = 6;\n\t\t\tconst spaceBelow = window.innerHeight - triggerRect.bottom - gap - padding;\n\t\t\tconst spaceAbove = triggerRect.top - gap - padding;\n\t\t\tconst desiredHeight = Math.min(menu.scrollHeight, window.innerHeight * 0.7, 480);\n\t\t\tconst above = spaceBelow < desiredHeight && spaceAbove > spaceBelow;\n\t\t\tmenu.style.maxHeight = `${Math.max(0, Math.min(desiredHeight, above ? spaceAbove : spaceBelow))}px`;\n\t\t\tconst bounds = menu.getBoundingClientRect();\n\t\t\tconst left = isRtl(locale) ? triggerRect.left : triggerRect.right - bounds.width;\n\t\t\tmenu.style.left = `${Math.max(padding, Math.min(left, window.innerWidth - bounds.width - padding))}px`;\n\t\t\tconst top = above ? triggerRect.top - gap - bounds.height : triggerRect.bottom + gap;\n\t\t\tmenu.style.top = `${Math.max(padding, Math.min(top, window.innerHeight - bounds.height - padding))}px`;\n\t\t\tsetOpenUp(above);\n\t\t};\n\t\tupdatePosition();\n\t\tconst ro = new ResizeObserver(updatePosition);\n\t\tro.observe(menu);\n\t\tconst toolbar = dropdownRef.current.closest('[role=\"toolbar\"]');\n\t\tif (toolbar) ro.observe(toolbar);\n\t\twindow.addEventListener(\"resize\", updatePosition);\n\t\twindow.addEventListener(\"scroll\", updatePosition, true);\n\t\treturn () => {\n\t\t\tro.disconnect();\n\t\t\twindow.removeEventListener(\"resize\", updatePosition);\n\t\t\twindow.removeEventListener(\"scroll\", updatePosition, true);\n\t\t};\n\t}, [open, locale]);\n\n\tuseEffect(() => {\n\t\tif (!open) return;\n\t\tconst handleClickOutside = (e: MouseEvent) => {\n\t\t\tif (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {\n\t\t\t\tcloseDropdown();\n\t\t\t}\n\t\t};\n\t\tdocument.addEventListener(\"mousedown\", handleClickOutside);\n\t\treturn () => document.removeEventListener(\"mousedown\", handleClickOutside);\n\t}, [open, closeDropdown]);\n\n\tconst handleEntireBook = useCallback(async () => {\n\t\tconst config = flipBookRef.current?.getDownloadConfig?.();\n\t\tif (!config?.onDownloadSefer) return;\n\t\tsetLoading(\"sefer\");\n\t\ttry {\n\t\t\tconst result = await config.onDownloadSefer();\n\t\t\tif (result) triggerDownload(result, config.entireBookFilename ?? \"book\");\n\t\t\tcloseDropdown();\n\t\t} finally {\n\t\t\tsetLoading(null);\n\t\t}\n\t}, [flipBookRef, closeDropdown]);\n\n\tconst runRangeDownload = useCallback(\n\t\tasync (from: number, to: number) => {\n\t\t\tconst config = flipBookRef.current?.getDownloadConfig?.();\n\t\t\tif (!config?.onDownloadPageRange) return;\n\t\t\tconst pages: number[] = [];\n\t\t\tconst semanticPages: SemanticPageInfo[] = [];\n\t\t\tfor (let i = from; i <= to; i++) {\n\t\t\t\tpages.push(i);\n\t\t\t\tconst info = selectablePages.find((sp) => sp.pageIndex === i);\n\t\t\t\tif (info) semanticPages.push(info);\n\t\t\t}\n\t\t\tsetLoading(\"range\");\n\t\t\ttry {\n\t\t\t\tconst result = await config.onDownloadPageRange(\n\t\t\t\t\tpages,\n\t\t\t\t\tsemanticPages,\n\t\t\t\t\tconfig.downloadContext,\n\t\t\t\t);\n\t\t\t\tif (result) {\n\t\t\t\t\tconst fromName = sanitizeForFilename(semanticPages[0]?.semanticName ?? String(from));\n\t\t\t\t\tconst toName = sanitizeForFilename(\n\t\t\t\t\t\tsemanticPages[semanticPages.length - 1]?.semanticName ?? String(to),\n\t\t\t\t\t);\n\t\t\t\t\ttriggerDownload(result, `${config.rangeFilename ?? \"pages\"}-${fromName}-${toName}`);\n\t\t\t\t}\n\t\t\t\tcloseDropdown();\n\t\t\t} finally {\n\t\t\t\tsetLoading(null);\n\t\t\t}\n\t\t},\n\t\t[flipBookRef, selectablePages, closeDropdown],\n\t);\n\n\tuseEffect(() => {\n\t\tdownloadExecutorRef.current = (from?: number, to?: number) => {\n\t\t\tif (from === undefined && to === undefined) {\n\t\t\t\tvoid handleEntireBook();\n\t\t\t} else if (from !== undefined && to !== undefined) {\n\t\t\t\tvoid runRangeDownload(from, to);\n\t\t\t}\n\t\t};\n\t\treturn () => {\n\t\t\tdownloadExecutorRef.current = null;\n\t\t};\n\t}, [downloadExecutorRef, handleEntireBook, runRangeDownload]);\n\n\tif (!showDropdown) return null;\n\n\treturn (\n\t\t<div className={`flipbook-toolbar-download-wrap ${className ?? \"\"}`.trim()} ref={dropdownRef}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"flipbook-toolbar-button flipbook-toolbar-download-trigger\"\n\t\t\t\tonClick={() => setOpen((o) => !o)}\n\t\t\t\taria-label={ariaLabel ?? t(\"toolbarItem.download\", locale)}\n\t\t\t\taria-expanded={open}\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\tdisabled={loading !== null}\n\t\t\t>\n\t\t\t\t<DownloadIcon size={18} />\n\t\t\t</button>\n\t\t\t{open && (\n\t\t\t\t<div\n\t\t\t\t\tref={menuRef}\n\t\t\t\t\tclassName={`flipbook-toolbar-download-menu ${openUp ? \"flipbook-toolbar-download-menu--open-up\" : \"\"}`.trim()}\n\t\t\t\t\trole=\"menu\"\n\t\t\t\t\tdir={isRtl(locale) ? \"rtl\" : \"ltr\"}\n\t\t\t\t>\n\t\t\t\t\t<fieldset\n\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-mode\"\n\t\t\t\t\t\taria-label={t(\"toolbarItem.download\", locale)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{hasSefer && (\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-radio-label\">\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tname=\"download-mode\"\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-radio\"\n\t\t\t\t\t\t\t\t\tchecked={downloadMode === \"entire\"}\n\t\t\t\t\t\t\t\t\tonChange={() => setDownloadMode(\"entire\")}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span>{t(\"command.downloadEntireBook\", locale)}</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{hasRange && (\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-radio-label\">\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tname=\"download-mode\"\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-radio\"\n\t\t\t\t\t\t\t\t\tchecked={downloadMode === \"range\"}\n\t\t\t\t\t\t\t\t\tonChange={() => setDownloadMode(\"range\")}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span>{t(\"toolbarItem.downloadPageRange\", locale)}</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t{downloadMode === \"range\" && (\n\t\t\t\t\t\t<div className=\"flipbook-toolbar-download-range\">\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-range-label\">\n\t\t\t\t\t\t\t\t{t(\"toolbarItem.download.from\", locale)}\n\t\t\t\t\t\t\t\t<select\n\t\t\t\t\t\t\t\t\tvalue={fromIndex}\n\t\t\t\t\t\t\t\t\tonChange={(e) => setFromIndex(Number(e.target.value))}\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-range-select\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{selectablePages.map((p) => (\n\t\t\t\t\t\t\t\t\t\t<option key={p.pageIndex} value={p.pageIndex}>\n\t\t\t\t\t\t\t\t\t\t\t{p.semanticName || p.title || `Page ${p.pageIndex + 1}`}\n\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<label className=\"flipbook-toolbar-download-range-label\">\n\t\t\t\t\t\t\t\t{t(\"toolbarItem.download.to\", locale)}\n\t\t\t\t\t\t\t\t<select\n\t\t\t\t\t\t\t\t\tvalue={toIndex}\n\t\t\t\t\t\t\t\t\tonChange={(e) => setToIndex(Number(e.target.value))}\n\t\t\t\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-range-select\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{selectablePages.map((p) => (\n\t\t\t\t\t\t\t\t\t\t<option key={p.pageIndex} value={p.pageIndex}>\n\t\t\t\t\t\t\t\t\t\t\t{p.semanticName || p.title || `Page ${p.pageIndex + 1}`}\n\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\tclassName=\"flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (downloadMode === \"entire\") {\n\t\t\t\t\t\t\t\tvoid handleEntireBook();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst total = flipBookRef.current?.getTotalPages?.() ?? totalPages;\n\t\t\t\t\t\t\t\tconst from = Math.min(fromIndex, toIndex);\n\t\t\t\t\t\t\t\tlet to = Math.max(fromIndex, toIndex);\n\t\t\t\t\t\t\t\tif (total > 0 && to >= total) to = total - 1;\n\t\t\t\t\t\t\t\tif (to < from) return;\n\t\t\t\t\t\t\t\tvoid runRangeDownload(from, to);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdisabled={loading !== null}\n\t\t\t\t\t>\n\t\t\t\t\t\t{loading === \"sefer\"\n\t\t\t\t\t\t\t? \"…\"\n\t\t\t\t\t\t\t: loading === \"range\"\n\t\t\t\t\t\t\t\t? \"…\"\n\t\t\t\t\t\t\t\t: t(\"toolbarItem.download.download\", locale)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nexport { DownloadDropdown };\n","import { goToFirstCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronFirstIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface FirstPageButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronFirstIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the first page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst FirstPageButton: React.FC<FirstPageButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(goToFirstCommand);\n\t};\n\n\tconst defaultIcon = <ChevronFirstIcon size={18} />;\n\tconst ariaLabel = t(\"command.jumpToFirstPage\", locale);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(goToFirstCommand)}\n\t\t\tclassName={`flipbook-toolbar-first ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { FirstPageButtonProps };\nexport { FirstPageButton };\n","import type React from \"react\";\nimport { useEffect, useState } from \"react\";\nimport {\n\tcanUseFullscreen,\n\tfullscreenStateEvents,\n\tgetFullscreenElement,\n\ttoggleFullscreenCommand,\n\tuseCommands,\n} from \"../commands\";\nimport { t } from \"../i18n\";\nimport { MaximizeIcon, MinimizeIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface FullscreenButtonProps {\n\t/** Target element to make fullscreen. If not provided, uses Toolbar's fullscreenTargetRef or document.documentElement */\n\ttargetRef?: React.RefObject<HTMLElement | null>;\n\t/** Custom content for enter fullscreen. Defaults to MaximizeIcon */\n\tenterIcon?: React.ReactNode;\n\t/** Custom content for exit fullscreen. Defaults to MinimizeIcon */\n\texitIcon?: React.ReactNode;\n\t/** ARIA label for entering fullscreen. Defaults to the locale's \"Enter fullscreen\" */\n\tariaLabelEnter?: string;\n\t/** ARIA label for exiting fullscreen. Defaults to the locale's \"Exit fullscreen\" */\n\tariaLabelExit?: string;\n\t/** Behavior when the browser can't use fullscreen (e.g. iOS Safari):\n\t * \"hide\" renders nothing, \"disable\" shows a disabled button explaining why. Defaults to \"hide\". */\n\tunsupportedBehavior?: \"hide\" | \"disable\";\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to toggle fullscreen mode through the toggleFullscreen command,\n * so clicks, hotkeys (F11 by default), and holds stay in sync.\n * Same behavior in LTR and RTL — visual mirroring is handled by CSS\n * (dir=\"rtl\" + icon flip); the default icons are symmetric.\n */\nconst FullscreenButton: React.FC<FullscreenButtonProps> = ({\n\ttargetRef: targetRefProp,\n\tenterIcon,\n\texitIcon,\n\tariaLabelEnter,\n\tariaLabelExit,\n\tunsupportedBehavior = \"hide\",\n\tclassName,\n}) => {\n\tconst toolbar = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\tconst targetRef = targetRefProp ?? toolbar.fullscreenTargetRef;\n\n\t// Initial false keeps SSR/first render matching; real values arrive on mount.\n\tconst [isFullscreen, setIsFullscreen] = useState(false);\n\tconst [supported, setSupported] = useState(false);\n\n\t// Sync on any transition: button clicks, hotkeys, Escape, browser UI,\n\t// and rejected requests — standard and vendor-prefixed events alike.\n\tuseEffect(() => {\n\t\tconst update = () => {\n\t\t\tsetIsFullscreen(getFullscreenElement() !== null);\n\t\t\tsetSupported(canUseFullscreen(targetRef?.current));\n\t\t};\n\t\tupdate();\n\t\tfor (const type of fullscreenStateEvents) {\n\t\t\tdocument.addEventListener(type, update);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const type of fullscreenStateEvents) {\n\t\t\t\tdocument.removeEventListener(type, update);\n\t\t\t}\n\t\t};\n\t}, [targetRef]);\n\n\tconst handleClick = () => {\n\t\tif (targetRefProp) {\n\t\t\texecute(toggleFullscreenCommand, {\n\t\t\t\tgetFullscreenTarget: () => targetRefProp.current ?? null,\n\t\t\t});\n\t\t} else {\n\t\t\texecute(toggleFullscreenCommand);\n\t\t}\n\t};\n\n\tif (!supported && unsupportedBehavior === \"hide\") return null;\n\n\tconst label = isFullscreen\n\t\t? (ariaLabelExit ?? t(\"toolbarItem.exitFullscreen\", toolbar.locale))\n\t\t: (ariaLabelEnter ?? t(\"toolbarItem.enterFullscreen\", toolbar.locale));\n\tconst icon = isFullscreen\n\t\t? (exitIcon ?? <MinimizeIcon size={18} />)\n\t\t: (enterIcon ?? <MaximizeIcon size={18} />);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={label}\n\t\t\tariaPressed={isFullscreen}\n\t\t\tdisabled={!supported || !canExecute(toggleFullscreenCommand)}\n\t\t\ttitle={supported ? label : t(\"toolbarItem.fullscreenUnsupported\", toolbar.locale)}\n\t\t\tclassName={`flipbook-toolbar-fullscreen ${isFullscreen ? \"flipbook-toolbar-fullscreen--active\" : \"\"} ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{icon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { FullscreenButtonProps };\nexport { FullscreenButton };\n","import { goToLastCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronLastIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface LastPageButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronLastIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the last page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst LastPageButton: React.FC<LastPageButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(goToLastCommand);\n\t};\n\n\tconst defaultIcon = <ChevronLastIcon size={18} />;\n\tconst ariaLabel = t(\"command.jumpToLastPage\", locale);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(goToLastCommand)}\n\t\t\tclassName={`flipbook-toolbar-last ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { LastPageButtonProps };\nexport { LastPageButton };\n","import type React from \"react\";\nimport { type ToggleCommandDefinition, useCommands } from \"../commands\";\nimport { ToolbarButton } from \"./ToolbarButton\";\n\nexport interface ToggleButtonProps {\n\tcommand: ToggleCommandDefinition;\n\tariaLabel: string;\n\tchildren: React.ReactNode;\n\tdisabled?: boolean;\n\tclassName?: string;\n}\n\n/** A command-backed toggle that follows clicks and temporary hotkey overrides. */\nexport const ToggleButton: React.FC<ToggleButtonProps> = ({\n\tcommand,\n\tariaLabel,\n\tchildren,\n\tdisabled = false,\n\tclassName,\n}) => {\n\tconst { execute, canExecute, isActive } = useCommands();\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={() => execute(command)}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tariaPressed={isActive(command)}\n\t\t\tdisabled={disabled || !canExecute(command)}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{children}\n\t\t</ToolbarButton>\n\t);\n};\n","import type React from \"react\";\nimport { toggleTextSelectionCommand } from \"../commands\";\nimport { t } from \"../i18n\";\nimport { ToggleButton } from \"./ToggleButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\nexport interface MouseModeButtonProps {\n\t/** Override the locale's letters shown beside the text caret. */\n\tletters?: string;\n\t/** Override the localized accessible label. */\n\tariaLabel?: string;\n\tclassName?: string;\n}\n\n/** Switch mouse dragging between native page turning and text selection. */\nexport const MouseModeButton: React.FC<MouseModeButtonProps> = ({\n\tletters,\n\tariaLabel,\n\tclassName,\n}) => {\n\tconst { locale } = useToolbar();\n\tconst label = ariaLabel ?? t(\"toolbarItem.selectText\", locale);\n\treturn (\n\t\t<ToggleButton\n\t\t\tcommand={toggleTextSelectionCommand}\n\t\t\tariaLabel={label}\n\t\t\tclassName={`flipbook-toolbar-mouse-mode ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t<span className=\"flipbook-toolbar-mouse-mode-icon\" aria-hidden=\"true\">\n\t\t\t\t<span className=\"flipbook-toolbar-mouse-mode-caret\" />\n\t\t\t\t<span>{letters ?? t(\"toolbarItem.selectionLetters\", locale)}</span>\n\t\t\t</span>\n\t\t</ToggleButton>\n\t);\n};\n","import { flipNextCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronRightIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface NextButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronRightIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button: next page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst NextButton: React.FC<NextButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(flipNextCommand);\n\t};\n\n\tconst ariaLabel = t(\"command.jumpToNextPage\", locale);\n\tconst defaultIcon = <ChevronRightIcon size={20} />;\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(flipNextCommand)}\n\t\t\tclassName={`flipbook-toolbar-next ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { NextButtonProps };\nexport { NextButton };\n","import type React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ntype PageIndicatorMode = \"semantic\" | \"index\";\n\ninterface PageIndicatorProps {\n\t/**\n\t * Display mode:\n\t * - \"semantic\": uses pageSemantics to show semantic names (e.g., \"א\", \"ב\")\n\t * - \"index\": shows 1-based page numbers\n\t * Defaults to \"semantic\" if pageSemantics is available, otherwise \"index\".\n\t */\n\tmode?: PageIndicatorMode;\n\t/** Whether to show \"/ total\" after the current page(s). Defaults to true. */\n\tshowTotal?: boolean;\n\t/** Placeholder when current page has no semantic name (semantic mode only) */\n\tplaceholder?: string;\n\t/** Whether the input is editable for navigation. Defaults to true in semantic mode. */\n\teditable?: boolean;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Input aria-label for accessibility */\n\tariaLabel?: string;\n\t/** Maximum input length */\n\tmaxLength?: number;\n}\n\n/**\n * Displays the current page position with support for semantic names or indices.\n * Shows a range when a spread is visible (e.g., \"א - ב\" or \"1 - 2\").\n * Direction-aware: RTL shows right-left, LTR shows left-right.\n * When both pages have the same semantic name, shows scalar (no range).\n */\nconst PageIndicator: React.FC<PageIndicatorProps> = ({\n\tmode: modeProp,\n\tshowTotal = true,\n\tplaceholder = \"—\",\n\teditable: editableProp,\n\tclassName,\n\tariaLabel = \"Go to page\",\n\tmaxLength = 10,\n}) => {\n\tconst { flipBookRef, pageSemantics, direction, currentPage, totalPages, of } = useToolbar();\n\n\t// Determine effective mode\n\tconst mode: PageIndicatorMode = modeProp ?? (pageSemantics ? \"semantic\" : \"index\");\n\tconst editable = editableProp ?? (mode === \"semantic\" && !!pageSemantics);\n\n\tconst [inputValue, setInputValue] = useState(\"\");\n\tconst [isEditing, setIsEditing] = useState(false);\n\t// Ref-only flag: prevents handleBlur from reverting inputValue to a stale\n\t// displayText during the brief gap before Toolbar polling updates currentPage.\n\t// Cleared synchronously once the page actually changes.\n\tconst justNavigatedRef = useRef(false);\n\tconst prevCurrentPageRef = useRef(currentPage);\n\n\t// Calculate the spread pages (current page and its facing page)\n\tconst leftPageIndex = currentPage;\n\tconst rightPageIndex = currentPage + 1 < totalPages ? currentPage + 1 : null;\n\n\t// Get display names for pages\n\tconst getPageName = useCallback(\n\t\t(pageIndex: number): string => {\n\t\t\tif (mode === \"semantic\" && pageSemantics) {\n\t\t\t\treturn pageSemantics.indexToSemanticName(pageIndex) || \"\";\n\t\t\t}\n\t\t\treturn String(pageIndex + 1); // 1-based for display\n\t\t},\n\t\t[mode, pageSemantics],\n\t);\n\n\tconst leftName = getPageName(leftPageIndex);\n\tconst rightName = rightPageIndex != null ? getPageName(rightPageIndex) : \"\";\n\n\t// \"Of\" comes from the book (via context); default is total pages count\n\tconst getTotalDisplay = useCallback((): string => String(of), [of]);\n\n\t// Build display text for the range (always left physical page then right, e.g. י\"א - י\"ב)\n\tconst buildDisplayText = useCallback((): string => {\n\t\tconst firstName = leftName;\n\t\tconst secondName = rightName;\n\n\t\tlet rangeText: string;\n\t\tif (!firstName && !secondName) {\n\t\t\t// Both empty (e.g., cover pages)\n\t\t\trangeText = placeholder;\n\t\t} else if (!firstName) {\n\t\t\t// Only second has a name\n\t\t\trangeText = secondName;\n\t\t} else if (!secondName) {\n\t\t\t// Only first has a name\n\t\t\trangeText = firstName;\n\t\t} else if (firstName === secondName) {\n\t\t\t// Same name on both pages - show scalar\n\t\t\trangeText = firstName;\n\t\t} else {\n\t\t\t// Different names - show range\n\t\t\trangeText = `${firstName} - ${secondName}`;\n\t\t}\n\n\t\tif (showTotal) {\n\t\t\treturn `${rangeText} / ${getTotalDisplay()}`;\n\t\t}\n\t\treturn rangeText;\n\t}, [leftName, rightName, placeholder, showTotal, getTotalDisplay]);\n\n\t// The primary semantic name for editing (use left page in RTL reading order)\n\tconst primarySemanticName = direction === \"rtl\" ? rightName || leftName : leftName || rightName;\n\n\tconst displayText = buildDisplayText();\n\n\t// Sync input value when page changes and not editing.\n\t// After Enter navigation, justNavigatedRef prevents flashing the stale value;\n\t// once Toolbar polling updates currentPage, the flag is cleared and the\n\t// new displayText is applied. Because displayText includes the \" / total\"\n\t// suffix, it is always different from the user's typed value, guaranteeing\n\t// a state change that triggers a re-render.\n\tuseEffect(() => {\n\t\tconst pageChanged = currentPage !== prevCurrentPageRef.current;\n\t\tprevCurrentPageRef.current = currentPage;\n\n\t\tif (pageChanged) {\n\t\t\tjustNavigatedRef.current = false;\n\t\t}\n\t\tif (!isEditing && !justNavigatedRef.current) {\n\t\t\tsetInputValue(displayText);\n\t\t}\n\t}, [displayText, isEditing, currentPage]);\n\n\tconst handleFocus = useCallback(\n\t\t(e: React.FocusEvent<HTMLInputElement>) => {\n\t\t\tif (editable) {\n\t\t\t\tsetIsEditing(true);\n\t\t\t\tsetInputValue(primarySemanticName);\n\t\t\t\tjustNavigatedRef.current = false;\n\t\t\t\t// Select all text so the user can immediately type a replacement\n\t\t\t\tconst select = () => e.target.select();\n\t\t\t\ttypeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame(select) : select();\n\t\t\t}\n\t\t},\n\t\t[editable, primarySemanticName],\n\t);\n\n\tconst handleBlur = useCallback(() => {\n\t\tsetIsEditing(false);\n\t\t// After a successful Enter navigation, keep the user's typed value visible\n\t\t// until Toolbar polling updates currentPage with the new position.\n\t\tif (!justNavigatedRef.current) {\n\t\t\tsetInputValue(displayText);\n\t\t}\n\t}, [displayText]);\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\tif (e.key === \"Enter\") {\n\t\t\t\t// Navigate on Enter\n\t\t\t\tif (pageSemantics && inputValue.trim()) {\n\t\t\t\t\tconst pageIndex = pageSemantics.semanticNameToIndex(inputValue.trim());\n\t\t\t\t\tif (pageIndex != null && pageIndex >= 0 && pageIndex < totalPages) {\n\t\t\t\t\t\tflipBookRef.current?.jumpToPage(pageIndex);\n\t\t\t\t\t\tjustNavigatedRef.current = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.currentTarget.blur();\n\t\t\t} else if (e.key === \"Escape\") {\n\t\t\t\t// Cancel editing\n\t\t\t\te.currentTarget.blur();\n\t\t\t}\n\t\t},\n\t\t[inputValue, pageSemantics, totalPages, flipBookRef],\n\t);\n\n\tconst handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tsetInputValue(e.target.value);\n\t}, []);\n\n\t// Non-editable display (span)\n\tif (!editable) {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName={`flipbook-toolbar-indicator ${className ?? \"\"}`.trim()}\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t>\n\t\t\t\t{displayText}\n\t\t\t</span>\n\t\t);\n\t}\n\n\t// Editable input — always shows inputValue.\n\t// When not editing, useEffect keeps inputValue in sync with displayText.\n\t// During editing, inputValue holds the user's typed text.\n\t// After Enter navigation, inputValue keeps the typed value until polling\n\t// updates currentPage, at which point useEffect sets it to the new displayText.\n\tconst editingClass = isEditing ? \"flipbook-toolbar-indicator--editing\" : \"\";\n\treturn (\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\tclassName={`flipbook-toolbar-indicator ${editingClass} ${className ?? \"\"}`.trim()}\n\t\t\tvalue={inputValue}\n\t\t\tonFocus={handleFocus}\n\t\t\tonBlur={handleBlur}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonChange={handleChange}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-live=\"polite\"\n\t\t\taria-atomic=\"true\"\n\t\t\tmaxLength={maxLength}\n\t\t\treadOnly={!editable}\n\t\t/>\n\t);\n};\n\nexport type { PageIndicatorMode, PageIndicatorProps };\nexport { PageIndicator };\n","import { flipPrevCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { ChevronLeftIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface PrevButtonProps {\n\t/** Custom content (icon or text). Defaults to ChevronLeftIcon */\n\tchildren?: React.ReactNode;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button: previous page. Same behavior in LTR and RTL.\n * Visual mirroring is handled by CSS (dir=\"rtl\" + icon flip).\n */\nconst PrevButton: React.FC<PrevButtonProps> = ({ children, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\n\tconst handleClick = () => {\n\t\texecute(flipPrevCommand);\n\t};\n\n\tconst ariaLabel = t(\"command.jumpToPrevPage\", locale);\n\tconst defaultIcon = <ChevronLeftIcon size={20} />;\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\ttitle={ariaLabel}\n\t\t\tdisabled={!canExecute(flipPrevCommand)}\n\t\t\tclassName={`flipbook-toolbar-prev ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? defaultIcon}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { PrevButtonProps };\nexport { PrevButton };\n","import { goToTocCommand } from \"html-flip-book-vanilla/commands\";\nimport type React from \"react\";\nimport { useCommands } from \"../commands/CommandContext\";\nimport { t } from \"../i18n\";\nimport { TableOfContentsIcon } from \"../icons\";\nimport { ToolbarButton } from \"./ToolbarButton\";\nimport { useToolbar } from \"./ToolbarContext\";\n\ninterface TocButtonProps {\n\t/** Custom content (icon or text). Defaults to TableOfContentsIcon */\n\tchildren?: React.ReactNode;\n\t/** Custom ARIA label. Defaults to localized \"Table of contents\" */\n\tariaLabel?: string;\n\t/** Additional CSS class name */\n\tclassName?: string;\n}\n\n/**\n * Button to navigate to the Table of Contents page (instant jump, same as goToToc command).\n * TOC page index comes from store (populated by book config); command and UI both use the store.\n */\nconst TocButton: React.FC<TocButtonProps> = ({ children, ariaLabel: ariaLabelProp, className }) => {\n\tconst { locale } = useToolbar();\n\tconst { execute, canExecute } = useCommands();\n\tconst ariaLabel = ariaLabelProp ?? t(\"command.jumpToToc\", locale);\n\n\tconst handleClick = () => {\n\t\texecute(goToTocCommand);\n\t};\n\n\tconst disabled = !canExecute(goToTocCommand);\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={handleClick}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tdisabled={disabled}\n\t\t\tclassName={`flipbook-toolbar-toc ${className ?? \"\"}`.trim()}\n\t\t>\n\t\t\t{children ?? <TableOfContentsIcon size={18} />}\n\t\t</ToolbarButton>\n\t);\n};\n\nexport type { TocButtonProps };\nexport { TocButton };\n","import type { CommandDefinition } from \"html-flip-book-vanilla/commands\";\n\n/**\n * React-layer command: open the download dropdown (e.g. Ctrl+S).\n * Toolbar wires data.open to openDownloadMenuRef.current.\n */\nexport const openDownloadMenuCommand: CommandDefinition = {\n\tid: \"openDownloadMenu\",\n\tenName: \"Open download menu\",\n\tenDescription: \"Open the download menu\",\n\tnameKey: \"toolbarItem.download\",\n\thotkeys: [{ key: \"s\", modifiers: { ctrl: true } }],\n\texecute: (ctx) => {\n\t\t(ctx.data?.open as (() => void) | undefined)?.();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => typeof ctx.data?.open === \"function\",\n};\n","import type React from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { CommandDefinition, CommandOptions } from \"../commands\";\nimport { CommandProvider } from \"../commands/CommandContext\";\nimport { openDownloadMenuCommand } from \"../commands/open-download-menu-command\";\nimport type { FlipBookHandle, PageSemantics } from \"../FlipBook\";\nimport { defaultLocale, directionFromLocale, type Locale } from \"../i18n\";\nimport { ToolbarContext } from \"./ToolbarContext\";\nimport \"./Toolbar.css\";\n\ninterface ToolbarProps {\n\t/** Ref to the FlipBook component for programmatic control */\n\tflipBookRef: React.RefObject<FlipBookHandle | null>;\n\t/** Text direction. Defaults from intl locale (en-US → ltr). */\n\tdirection?: \"ltr\" | \"rtl\";\n\t/** Locale for UI strings. Defaults to en-US. */\n\tlocale?: Locale;\n\t/** Optional page semantics for semantic indicator (e.g. perek/chapter) */\n\tpageSemantics?: PageSemantics;\n\t/** Additional CSS class name */\n\tclassName?: string;\n\t/** Toolbar children in reading order: First, Prev, Indicator, Next, Last */\n\tchildren: React.ReactNode;\n\t/** Enable keyboard hotkeys for commands. Defaults to true */\n\tenableHotkeys?: boolean;\n\t/** Custom commands to register (merged with defaults) */\n\tcommands?: CommandDefinition[];\n\t/** Options for specific commands (e.g., custom hotkeys, data) */\n\tcommandOptions?: Record<string, CommandOptions>;\n\t/** When set, fullscreen (keyboard or button) targets this container only (e.g. sefer + toolbar wrapper). */\n\tfullscreenTargetRef?: React.RefObject<HTMLElement | null>;\n}\n\n/**\n * Container component for FlipBook toolbar controls.\n * Provides context to child components for accessing FlipBook methods.\n * Includes command system with configurable keyboard hotkeys.\n */\nconst Toolbar: React.FC<ToolbarProps> = ({\n\tflipBookRef,\n\tdirection: directionProp,\n\tlocale: localeProp,\n\tpageSemantics,\n\tclassName = \"\",\n\tchildren,\n\tenableHotkeys = true,\n\tcommands,\n\tcommandOptions,\n\tfullscreenTargetRef,\n}) => {\n\tconst direction = directionProp ?? directionFromLocale(localeProp ?? defaultLocale);\n\tconst locale = localeProp ?? (direction === \"rtl\" ? \"he-IL\" : \"en-US\");\n\tconst openDownloadMenuRef = useRef<(() => void) | null>(null);\n\tconst downloadExecutorRef = useRef<((from?: number, to?: number) => void) | null>(null);\n\tconst [currentPage, setCurrentPage] = useState(0);\n\tconst [totalPages, setTotalPages] = useState(0);\n\tconst [of, setOf] = useState<string | number>(0);\n\tconst [isFirstPage, setIsFirstPage] = useState(true);\n\tconst [isLastPage, setIsLastPage] = useState(false);\n\tconst [mouseMode, setMouseMode] = useState<\"turn\" | \"select\">(\"turn\");\n\n\tconst internalCommandOptions: Record<string, CommandOptions> = {\n\t\t...(fullscreenTargetRef\n\t\t\t? {\n\t\t\t\t\ttoggleFullscreen: {\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tgetFullscreenTarget: () => fullscreenTargetRef.current ?? null,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {}),\n\t\topenDownloadMenu: {\n\t\t\tdata: { open: () => openDownloadMenuRef.current?.() },\n\t\t},\n\t\tdownload: {\n\t\t\tdata: {\n\t\t\t\tonDownload: (from?: number, to?: number) => downloadExecutorRef.current?.(from, to),\n\t\t\t},\n\t\t},\n\t};\n\n\t// Consumer options override toolbar defaults per command; data merges shallowly so\n\t// e.g. rebinding the fullscreen hotkey doesn't drop the injected fullscreen target.\n\tconst optionsById = new Map(Object.entries(commandOptions ?? {}));\n\tfor (const [id, internal] of Object.entries(internalCommandOptions)) {\n\t\tconst consumer = optionsById.get(id);\n\t\toptionsById.set(\n\t\t\tid,\n\t\t\tconsumer\n\t\t\t\t? { ...internal, ...consumer, data: { ...internal.data, ...consumer.data } }\n\t\t\t\t: internal,\n\t\t);\n\t}\n\tconst mergedCommandOptions = Object.fromEntries(optionsById);\n\n\t// Update state from FlipBook ref (book is source of truth for current, total, of)\n\tconst updateState = useCallback(() => {\n\t\tconst fb = flipBookRef.current;\n\t\tif (fb) {\n\t\t\tsetCurrentPage(fb.getCurrentPageIndex());\n\t\t\tsetTotalPages(fb.getTotalPages());\n\t\t\tsetOf(fb.getOf());\n\t\t\tsetIsFirstPage(fb.isFirstPage());\n\t\t\tsetIsLastPage(fb.isLastPage());\n\t\t\tsetMouseMode(fb.getMouseMode?.() ?? \"turn\");\n\t\t}\n\t}, [flipBookRef]);\n\n\t// Initial state update and periodic polling (throttled to reduce flicker)\n\t// TODO: Replace with event-based updates when FlipBook emits page change events\n\tuseEffect(() => {\n\t\tupdateState();\n\t\tconst interval = setInterval(updateState, 200);\n\t\treturn () => clearInterval(interval);\n\t}, [updateState]);\n\n\tconst toolbarContent = (\n\t\t<ToolbarContext.Provider\n\t\t\tvalue={{\n\t\t\t\tflipBookRef,\n\t\t\t\tdirection,\n\t\t\t\tlocale,\n\t\t\t\tpageSemantics,\n\t\t\t\tcurrentPage,\n\t\t\t\ttotalPages,\n\t\t\t\tof,\n\t\t\t\tisFirstPage,\n\t\t\t\tisLastPage,\n\t\t\t\tmouseMode,\n\t\t\t\topenDownloadMenuRef,\n\t\t\t\tdownloadExecutorRef,\n\t\t\t\tfullscreenTargetRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={`flipbook-toolbar ${direction === \"rtl\" ? \"flipbook-toolbar--rtl\" : \"\"} ${className}`.trim()}\n\t\t\t\trole=\"toolbar\"\n\t\t\t\taria-label=\"FlipBook navigation\"\n\t\t\t\tdir={direction}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</ToolbarContext.Provider>\n\t);\n\n\tconst allCommands: CommandDefinition[] = [openDownloadMenuCommand, ...(commands ?? [])];\n\n\treturn (\n\t\t<CommandProvider\n\t\t\tflipBookRef={flipBookRef}\n\t\t\tcurrentPage={currentPage}\n\t\t\ttotalPages={totalPages}\n\t\t\tdirection={direction}\n\t\t\tcommands={allCommands}\n\t\t\tcommandOptions={mergedCommandOptions}\n\t\t\tdisableHotkeys={!enableHotkeys}\n\t\t>\n\t\t\t{toolbarContent}\n\t\t</CommandProvider>\n\t);\n};\n\nexport type { ToolbarProps };\nexport { Toolbar };\n"],"names":["e","n","y","p","k","v","w","x","T","F","P","K","A","u","C","D","i","L","d","m","b","E","M","a","o","c","q","g","B","r","N","I","R","f","S","l","h","CommandsContext","createContext","isEditableTarget","target","getHotkeys","entry","canUseHotkey","command","binding","getContext","findHotkey","registry","event","direction","hotkeyMatches","CommandProvider","flipBookRef","_currentPage","_totalPages","customCommands","commandOptions","disableHotkeys","children","holds","useRef","HoldHotkeyController","refresh","useReducer","value","useMemo","reg","cmd","defaultCommands","createCommandContext","useCallback","runData","options","data","execute","ctx","canExecute","isActive","getAllCommands","latest","useEffect","handleHoldKeyDown","handleKeyDown","match","handleKeyUp","restore","handleVisibility","jsx","useCommands","useContext","t","s","defaultProps","ChevronLeftIcon","size","className","ChevronRightIcon","ChevronFirstIcon","jsxs","ChevronLastIcon","MaximizeIcon","MinimizeIcon","TableOfContentsIcon","BookshelfIcon","DownloadIcon","ToolbarButton","onClick","ariaLabel","ariaPressed","disabled","title","ActionButton","BookmarkToggleButton","enabled","onChange","ToolbarContext","useToolbar","context","sanitizeForFilename","name","triggerDownload","result","filenameBase","binary","bytes","blob","url","getSelectablePages","totalPages","pageSemantics","list","semanticName","DownloadDropdown","locale","openDownloadMenuRef","downloadExecutorRef","downloadConfig","open","setOpen","useState","downloadMode","setDownloadMode","fromIndex","setFromIndex","toIndex","setToIndex","loading","setLoading","openUp","setOpenUp","dropdownRef","menuRef","selectablePages","hasSefer","hasRange","showDropdown","firstSelectablePage","lastSelectablePage","closeDropdown","useLayoutEffect","menu","trigger","updatePosition","triggerRect","padding","gap","spaceBelow","spaceAbove","desiredHeight","above","bounds","left","isRtl","top","ro","toolbar","handleClickOutside","handleEntireBook","config","runRangeDownload","from","to","pages","semanticPages","info","sp","fromName","toName","total","FirstPageButton","handleClick","goToFirstCommand","defaultIcon","FullscreenButton","targetRefProp","enterIcon","exitIcon","ariaLabelEnter","ariaLabelExit","unsupportedBehavior","targetRef","isFullscreen","setIsFullscreen","supported","setSupported","update","getFullscreenElement","canUseFullscreen","type","fullscreenStateEvents","toggleFullscreenCommand","label","icon","LastPageButton","goToLastCommand","ToggleButton","MouseModeButton","letters","toggleTextSelectionCommand","NextButton","flipNextCommand","PageIndicator","modeProp","showTotal","placeholder","editableProp","maxLength","currentPage","of","mode","editable","inputValue","setInputValue","isEditing","setIsEditing","justNavigatedRef","prevCurrentPageRef","leftPageIndex","rightPageIndex","getPageName","pageIndex","leftName","rightName","getTotalDisplay","buildDisplayText","firstName","secondName","rangeText","primarySemanticName","displayText","pageChanged","handleFocus","select","handleBlur","handleChange","PrevButton","flipPrevCommand","TocButton","ariaLabelProp","goToTocCommand","openDownloadMenuCommand","Toolbar","directionProp","localeProp","enableHotkeys","commands","fullscreenTargetRef","directionFromLocale","defaultLocale","setCurrentPage","setTotalPages","setOf","isFirstPage","setIsFirstPage","isLastPage","setIsLastPage","mouseMode","setMouseMode","internalCommandOptions","optionsById","id","internal","consumer","mergedCommandOptions","updateState","fb","interval","toolbarContent","allCommands"],"mappings":";;AAAA,IAAIA,KAAI;AACR,SAASC,KAAI;AACX,SAAOD;AACT;ACFK,MAACE,KAAI;AAAA,EACR,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,SAAS;AAAA,EACT,SAAS,CAAA;AAAA,EACT,SAAS,CAAC,MAAM;AACd,MAAE,MAAM;AAAA,MACN,EAAE,MAAM;AAAA,MACR,EAAE,MAAM;AAAA,IACd;AAAA,EACE;AAAA,EACA,YAAY,CAAC,MAAM,OAAO,EAAE,MAAM,cAAc;AAClD,GAAGC,KAAI;AAAA,EACL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WAAAE;AAAA,QACA,qBAAA9I;AAAA,QACA,qBAAAC;AAAA,QACA,qBAAAmI;AAAA,MAAA;AAAA,MAGD,UAAA,gBAAAnL;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,WAAW,oBAAoBtC,MAAc,QAAQ,0BAA0B,EAAE,IAAI8C,CAAS,GAAG,KAAA;AAAA,UACjG,MAAK;AAAA,UACL,cAAW;AAAA,UACX,KAAK9C;AAAA,UAEJ,UAAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,GAIIsO,IAAmC,CAAC5B,IAAyB,GAAIK,KAAY,CAAA,CAAG;AAEtF,SACC,gBAAAlL;AAAA,IAACpC;AAAA,IAAA;AAAA,MACA,aAAAC;AAAA,MACA,aAAA+K;AAAA,MACA,YAAAnG;AAAA,MACA,WAAA/E;AAAA,MACA,UAAU+O;AAAA,MACV,gBAAgBL;AAAA,MAChB,gBAAgB,CAACnB;AAAA,MAEhB,UAAAuB;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "html-flip-book-react",
3
3
  "description": "Flip Book React Component",
4
- "version": "0.0.0-alpha.55",
4
+ "version": "0.0.0-alpha.57",
5
5
  "type": "module",
6
6
  "author": "DoradSoft",
7
7
  "main": "./dist/flip-book.js",
@@ -39,7 +39,7 @@
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "html-flip-book-vanilla": "0.0.0-alpha.55"
42
+ "html-flip-book-vanilla": "0.0.0-alpha.57"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "^19.2.13",