@papyrus-sdk/ui-react-native 0.2.35-beta.2 → 0.2.35-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -22166,9 +22166,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
22166
22166
 
22167
22167
  // components/Viewer.tsx
22168
22168
  import {
22169
- useMemo as useMemo3,
22169
+ useMemo as useMemo5,
22170
22170
  useRef as useRef5,
22171
- useEffect as useEffect5,
22171
+ useEffect as useEffect7,
22172
22172
  useCallback as useCallback4,
22173
22173
  useState as useState5
22174
22174
  } from "react";
@@ -22177,8 +22177,8 @@ import {
22177
22177
  FlatList,
22178
22178
  Platform as Platform4,
22179
22179
  ScrollView,
22180
- StyleSheet as StyleSheet5,
22181
- View as View5,
22180
+ StyleSheet as StyleSheet7,
22181
+ View as View7,
22182
22182
  PixelRatio,
22183
22183
  useWindowDimensions as useWindowDimensions2
22184
22184
  } from "react-native";
@@ -22187,7 +22187,7 @@ import {
22187
22187
  createPageLayoutMetrics,
22188
22188
  resolveRenderOverscan,
22189
22189
  scalePageLayoutMetrics,
22190
- useViewerStore as useViewerStore5
22190
+ useViewerStore as useViewerStore7
22191
22191
  } from "@papyrus-sdk/core";
22192
22192
 
22193
22193
  // components/PageRenderer.tsx
@@ -22213,7 +22213,8 @@ import { Gesture, GestureDetector } from "react-native-gesture-handler";
22213
22213
  import Svg2, { Path as SvgPath } from "react-native-svg";
22214
22214
  import { createRenderGeneration, useViewerStore } from "@papyrus-sdk/core";
22215
22215
  import {
22216
- PapyrusPageView
22216
+ PapyrusPageView,
22217
+ isPapyrusTablet
22217
22218
  } from "@papyrus-sdk/engine-native";
22218
22219
 
22219
22220
  // perf/mobilePerf.ts
@@ -23247,6 +23248,9 @@ var buildCommentTapGestureDeps = ({
23247
23248
  ];
23248
23249
 
23249
23250
  // components/pdfPageMetrics.ts
23251
+ var resolvePdfPageCornerRadius = (isTablet) => {
23252
+ return isTablet ? 14 : 3;
23253
+ };
23250
23254
  var resolvePdfDoublePageContentWidth = ({
23251
23255
  currentPage,
23252
23256
  pageCount,
@@ -23407,8 +23411,9 @@ var PageRenderer = ({
23407
23411
  const renderGenerationRef = useRef(createRenderGeneration());
23408
23412
  const [layout, setLayout] = useState({ width: 0, height: 0 });
23409
23413
  const [pageSize, setPageSize] = useState(null);
23410
- const { width: windowWidth } = useWindowDimensions();
23414
+ const { width: windowWidth, height: windowHeight } = useWindowDimensions();
23411
23415
  const isNative = Platform.OS === "android" || Platform.OS === "ios";
23416
+ const pageCornerRadius = resolvePdfPageCornerRadius(isPapyrusTablet());
23412
23417
  const perfEnabled = isMobilePerfEnabled();
23413
23418
  useEffect(() => {
23414
23419
  if (!perfEnabled) return;
@@ -24523,7 +24528,8 @@ var PageRenderer = ({
24523
24528
  {
24524
24529
  width: pageWidth,
24525
24530
  height: pageHeight,
24526
- marginBottom: spacing
24531
+ marginBottom: spacing,
24532
+ borderRadius: pageCornerRadius
24527
24533
  }
24528
24534
  ],
24529
24535
  onLayout: handleLayout,
@@ -24540,14 +24546,18 @@ var PageRenderer = ({
24540
24546
  ref: viewRef,
24541
24547
  pointerEvents: "none",
24542
24548
  pageTheme,
24543
- style: styles.page
24549
+ style: [styles.page, { borderRadius: pageCornerRadius }]
24544
24550
  }
24545
24551
  ),
24546
24552
  /* @__PURE__ */ jsx3(
24547
24553
  View,
24548
24554
  {
24549
24555
  pointerEvents: "none",
24550
- style: [styles.themeOverlay, themeOverlayStyle]
24556
+ style: [
24557
+ styles.themeOverlay,
24558
+ { borderRadius: pageCornerRadius },
24559
+ themeOverlayStyle
24560
+ ]
24551
24561
  }
24552
24562
  ),
24553
24563
  /* @__PURE__ */ jsxs2(View, { pointerEvents: "box-none", style: styles.selectionLayer, children: [
@@ -25493,6 +25503,11 @@ var WebViewViewer_default = WebViewViewer;
25493
25503
  import { Platform as Platform3 } from "react-native";
25494
25504
 
25495
25505
  // components/nativePdfViewerMode.ts
25506
+ var shouldShowDefineSelection = (text, mode = "selection") => {
25507
+ const normalized = text?.trim() ?? "";
25508
+ if (normalized.length === 0) return false;
25509
+ return mode !== "single-word" || !/\s/u.test(normalized);
25510
+ };
25496
25511
  var resolveViewerModeTelemetry = ({
25497
25512
  requestedMode,
25498
25513
  isNativePdfViewer,
@@ -25531,7 +25546,7 @@ var shouldUseNativePdfViewer = ({
25531
25546
  const implementation = resolveNativePdfViewerImplementation(platform);
25532
25547
  if (implementation === "android") return true;
25533
25548
  if (activeTool === "ink" && !nativeInkOverlayAvailable) return false;
25534
- return implementation === "ios" && nativePdfDocumentViewAvailable && pageTheme === "normal" && viewMode !== "double" && rotation === 0;
25549
+ return implementation === "ios" && nativePdfDocumentViewAvailable && viewMode !== "double" && rotation === 0;
25535
25550
  };
25536
25551
 
25537
25552
  // components/DedicatedAndroidPdfViewer.tsx
@@ -25923,6 +25938,7 @@ var STRINGS = {
25923
25938
  rotate: "Rotate",
25924
25939
  clockwise: "Clockwise",
25925
25940
  counterclockwise: "Counterclockwise",
25941
+ rotationOriginal: "Original / 0\xB0",
25926
25942
  zoom: "Zoom",
25927
25943
  highlight: "Highlight",
25928
25944
  strike: "Strike",
@@ -25954,7 +25970,19 @@ var STRINGS = {
25954
25970
  annotationStrikeout: "Strikeout",
25955
25971
  annotationSquiggly: "Squiggly",
25956
25972
  annotationNote: "Note",
25957
- deleteAnnotation: "Delete"
25973
+ deleteAnnotation: "Delete",
25974
+ previousPage: "Previous page",
25975
+ nextPage: "Next page",
25976
+ comicMode: "Comic layout",
25977
+ comicSingle: "Single page",
25978
+ comicContinuous: "Continuous",
25979
+ comicFit: "Page fit",
25980
+ comicFitWidth: "Fit width",
25981
+ comicFitPage: "Fit page",
25982
+ comicDirection: "Reading direction",
25983
+ comicLtr: "Left to right",
25984
+ comicRtl: "Right to left / Manga",
25985
+ comicPageError: "This comic page could not be displayed."
25958
25986
  },
25959
25987
  "pt-BR": {
25960
25988
  pages: "Paginas",
@@ -25994,6 +26022,7 @@ var STRINGS = {
25994
26022
  rotate: "Girar",
25995
26023
  clockwise: "Sentido horario",
25996
26024
  counterclockwise: "Sentido anti-horario",
26025
+ rotationOriginal: "Original / 0\xB0",
25997
26026
  zoom: "Zoom",
25998
26027
  highlight: "Marca texto",
25999
26028
  strike: "Risco",
@@ -26025,7 +26054,19 @@ var STRINGS = {
26025
26054
  annotationStrikeout: "Riscar",
26026
26055
  annotationSquiggly: "Ondulado",
26027
26056
  annotationNote: "Nota",
26028
- deleteAnnotation: "Apagar"
26057
+ deleteAnnotation: "Apagar",
26058
+ previousPage: "P\xE1gina anterior",
26059
+ nextPage: "Pr\xF3xima p\xE1gina",
26060
+ comicMode: "Layout do quadrinho",
26061
+ comicSingle: "P\xE1gina \xFAnica",
26062
+ comicContinuous: "Cont\xEDnuo",
26063
+ comicFit: "Ajuste da p\xE1gina",
26064
+ comicFitWidth: "Ajustar \xE0 largura",
26065
+ comicFitPage: "Ajustar \xE0 p\xE1gina",
26066
+ comicDirection: "Dire\xE7\xE3o de leitura",
26067
+ comicLtr: "Esquerda para direita",
26068
+ comicRtl: "Direita para esquerda / Mang\xE1",
26069
+ comicPageError: "N\xE3o foi poss\xEDvel exibir esta p\xE1gina do quadrinho."
26029
26070
  }
26030
26071
  };
26031
26072
  var getStrings = (locale) => STRINGS[locale ?? "en"] ?? STRINGS.en;
@@ -26110,7 +26151,8 @@ function DedicatedIosPdfViewer({
26110
26151
  engine,
26111
26152
  maxPageWidth,
26112
26153
  onTextSelected,
26113
- onDefineSelection
26154
+ onDefineSelection,
26155
+ defineSelectionMode = "selection"
26114
26156
  }) {
26115
26157
  const locale = useViewerStore4((state) => state.locale);
26116
26158
  const t = getStrings(locale);
@@ -26229,6 +26271,22 @@ function DedicatedIosPdfViewer({
26229
26271
  },
26230
26272
  [onDefineSelection, updateSelection]
26231
26273
  );
26274
+ const handleInkToolPickerVisibilityChange = useCallback3(
26275
+ (event) => {
26276
+ const visible = event.nativeEvent?.visible === true;
26277
+ if (!visible && activeTool === "ink") {
26278
+ setDocumentState({
26279
+ activeTool: "select",
26280
+ interactionMode: "pan",
26281
+ nativeInkToolPickerActive: false,
26282
+ toolDockOpen: false
26283
+ });
26284
+ return;
26285
+ }
26286
+ setDocumentState({ nativeInkToolPickerActive: visible });
26287
+ },
26288
+ [activeTool, setDocumentState]
26289
+ );
26232
26290
  const trackMobileChromeByOffset = useCallback3(
26233
26291
  (offsetY) => {
26234
26292
  if (pageCount <= 0) return;
@@ -26358,6 +26416,7 @@ function DedicatedIosPdfViewer({
26358
26416
  onTap: handleTap,
26359
26417
  onTextSelected: handleTextSelectionChange,
26360
26418
  defineLabel: t.define,
26419
+ defineSelectionMode,
26361
26420
  annotateLabel: t.annotate,
26362
26421
  annotationHighlightLabel: t.annotationHighlight,
26363
26422
  annotationUnderlineLabel: t.annotationUnderline,
@@ -26377,10 +26436,11 @@ function DedicatedIosPdfViewer({
26377
26436
  return;
26378
26437
  }
26379
26438
  commitInkStrokesForPage(pageIndex, strokes);
26380
- }
26439
+ },
26440
+ onInkToolPickerVisibilityChange: handleInkToolPickerVisibilityChange
26381
26441
  }
26382
26442
  ),
26383
- selection && !supportsNativeEditMenu && onDefineSelection && /* @__PURE__ */ jsx6(View4, { style: styles4.selectionFallback, pointerEvents: "box-none", children: /* @__PURE__ */ jsx6(
26443
+ selection && !supportsNativeEditMenu && onDefineSelection && shouldShowDefineSelection(selection.text, defineSelectionMode) && /* @__PURE__ */ jsx6(View4, { style: styles4.selectionFallback, pointerEvents: "box-none", children: /* @__PURE__ */ jsx6(
26384
26444
  Pressable3,
26385
26445
  {
26386
26446
  onPress: defineSelection,
@@ -26471,7 +26531,8 @@ function NativePdfDocumentViewer({
26471
26531
  engine,
26472
26532
  maxPageWidth,
26473
26533
  onTextSelected,
26474
- onDefineSelection
26534
+ onDefineSelection,
26535
+ defineSelectionMode
26475
26536
  }) {
26476
26537
  const implementation = resolveNativePdfViewerImplementation(
26477
26538
  Platform3.OS
@@ -26492,13 +26553,258 @@ function NativePdfDocumentViewer({
26492
26553
  engine,
26493
26554
  maxPageWidth,
26494
26555
  onTextSelected,
26495
- onDefineSelection
26556
+ onDefineSelection,
26557
+ defineSelectionMode
26496
26558
  }
26497
26559
  );
26498
26560
  }
26499
26561
  return null;
26500
26562
  }
26501
26563
 
26564
+ // components/NativeTextDocumentViewer.tsx
26565
+ import { useEffect as useEffect5, useMemo as useMemo3 } from "react";
26566
+ import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
26567
+ import {
26568
+ PapyrusTextDocumentView
26569
+ } from "@papyrus-sdk/engine-native";
26570
+ import { papyrusEvents, useViewerStore as useViewerStore5 } from "@papyrus-sdk/core";
26571
+ import { PapyrusEventType } from "@papyrus-sdk/types";
26572
+
26573
+ // components/mobileChromeMetrics.ts
26574
+ var MOBILE_CHROME_METRICS = {
26575
+ screenPadding: 16,
26576
+ maxFloatingWidth: 360,
26577
+ maxToolDockWidth: 420,
26578
+ toolDockPaddingTop: 4,
26579
+ toolDockHistoryIconSize: 18,
26580
+ toolDockHistoryGap: 2,
26581
+ toolDockDisabledIconColorDark: "#64748b",
26582
+ toolDockDisabledIconColorLight: "#6b7280",
26583
+ toolDockDisabledOpacity: 0.72,
26584
+ iconSize: 20,
26585
+ iconBoxSize: 28,
26586
+ topbarPageButtonSize: 30,
26587
+ bottomBarItemPaddingHorizontal: 5,
26588
+ bottomBarItemPaddingVertical: 3,
26589
+ bottomBarVisualHeight: 52,
26590
+ toolDockGap: 12,
26591
+ topbarHeight: 56,
26592
+ progressGap: 18,
26593
+ progressHorizontalOffset: 10
26594
+ };
26595
+ var resolveMobileChromeOffsets = (insets) => ({
26596
+ topbar: Math.max(0, insets.top),
26597
+ progress: Math.max(0, insets.top) + MOBILE_CHROME_METRICS.topbarHeight + MOBILE_CHROME_METRICS.progressGap,
26598
+ bottom: Math.max(0, insets.bottom) + 14,
26599
+ toolDock: Math.max(0, insets.bottom) + 14 + MOBILE_CHROME_METRICS.bottomBarVisualHeight + MOBILE_CHROME_METRICS.toolDockGap,
26600
+ search: Math.max(0, insets.bottom) + 20,
26601
+ left: MOBILE_CHROME_METRICS.screenPadding + Math.max(0, insets.left),
26602
+ right: MOBILE_CHROME_METRICS.screenPadding + Math.max(0, insets.right)
26603
+ });
26604
+
26605
+ // components/PapyrusSafeArea.tsx
26606
+ import React6, { useContext as useContext2 } from "react";
26607
+ import {
26608
+ SafeAreaInsetsContext,
26609
+ SafeAreaProvider
26610
+ } from "react-native-safe-area-context";
26611
+ import { Fragment as Fragment2, jsx as jsx8 } from "react/jsx-runtime";
26612
+ var papyrusSafeAreaContext = SafeAreaInsetsContext;
26613
+ var ZERO_SAFE_AREA_INSETS = {
26614
+ top: 0,
26615
+ bottom: 0,
26616
+ left: 0,
26617
+ right: 0
26618
+ };
26619
+ var usePapyrusSafeAreaInsets = () => useContext2(papyrusSafeAreaContext) ?? ZERO_SAFE_AREA_INSETS;
26620
+ function PapyrusSafeAreaBoundary({
26621
+ children
26622
+ }) {
26623
+ const insets = useContext2(papyrusSafeAreaContext);
26624
+ if (insets) return /* @__PURE__ */ jsx8(Fragment2, { children });
26625
+ return React6.createElement(SafeAreaProvider, null, children);
26626
+ }
26627
+
26628
+ // components/NativeTextDocumentViewer.tsx
26629
+ import { jsx as jsx9 } from "react/jsx-runtime";
26630
+ function NativeTextDocumentViewer({
26631
+ engine,
26632
+ onTextRangeSelected,
26633
+ onDefineSelection,
26634
+ defineSelectionMode = "selection"
26635
+ }) {
26636
+ const nativeEngine = engine;
26637
+ const engineId = nativeEngine.getNativeTextEngineId?.() ?? void 0;
26638
+ const documentGeneration = nativeEngine.getNativeTextDocumentGeneration?.() ?? 0;
26639
+ const measuredTextLength = nativeEngine.getTextLength?.() ?? 0;
26640
+ const locale = useViewerStore5((state) => state.locale);
26641
+ const insets = usePapyrusSafeAreaInsets();
26642
+ const pageTheme = useViewerStore5((state) => state.pageTheme);
26643
+ const uiTheme = useViewerStore5((state) => state.uiTheme);
26644
+ const textLength = useViewerStore5((state) => state.textLength);
26645
+ const currentTextOffset = useViewerStore5((state) => state.currentTextOffset);
26646
+ const scrollToTextOffsetSignal = useViewerStore5(
26647
+ (state) => state.scrollToTextOffsetSignal
26648
+ );
26649
+ const textSearchResults = useViewerStore5((state) => state.textSearchResults);
26650
+ const activeSearchIndex = useViewerStore5((state) => state.activeSearchIndex);
26651
+ const setDocumentState = useViewerStore5((state) => state.setDocumentState);
26652
+ const t = getStrings(locale);
26653
+ useEffect5(() => {
26654
+ if (!engineId || measuredTextLength <= 0) return;
26655
+ setDocumentState({
26656
+ textLength: measuredTextLength,
26657
+ pageCount: 1,
26658
+ currentPage: 1,
26659
+ isLoaded: true
26660
+ });
26661
+ }, [engineId, measuredTextLength, setDocumentState]);
26662
+ const viewProps = useMemo3(
26663
+ () => ({
26664
+ engineId,
26665
+ documentGeneration,
26666
+ textLength: textLength || measuredTextLength,
26667
+ currentTextOffset,
26668
+ scrollToTextOffsetSignal,
26669
+ searchResults: textSearchResults,
26670
+ activeSearchIndex,
26671
+ pageTheme,
26672
+ uiTheme,
26673
+ fontSize: 18,
26674
+ lineHeight: 28,
26675
+ pageMargin: 20,
26676
+ defineLabel: t.define,
26677
+ defineSelectionMode,
26678
+ onTextOffsetChange: (event) => {
26679
+ setDocumentState({ currentTextOffset: event.nativeEvent.offset });
26680
+ },
26681
+ onTextRangeSelected: (event) => {
26682
+ const selection = event.nativeEvent;
26683
+ if (!selection.text || selection.end <= selection.start) return;
26684
+ papyrusEvents.emit(PapyrusEventType.TEXT_RANGE_SELECTED, selection);
26685
+ onTextRangeSelected?.(selection);
26686
+ },
26687
+ onDefineSelection: (event) => {
26688
+ onDefineSelection?.(event.nativeEvent);
26689
+ }
26690
+ }),
26691
+ [
26692
+ activeSearchIndex,
26693
+ currentTextOffset,
26694
+ documentGeneration,
26695
+ defineSelectionMode,
26696
+ engineId,
26697
+ measuredTextLength,
26698
+ onDefineSelection,
26699
+ onTextRangeSelected,
26700
+ pageTheme,
26701
+ scrollToTextOffsetSignal,
26702
+ setDocumentState,
26703
+ t.define,
26704
+ textLength,
26705
+ textSearchResults,
26706
+ uiTheme
26707
+ ]
26708
+ );
26709
+ return /* @__PURE__ */ jsx9(
26710
+ View5,
26711
+ {
26712
+ style: [
26713
+ styles5.container,
26714
+ { paddingTop: insets.top + MOBILE_CHROME_METRICS.topbarHeight }
26715
+ ],
26716
+ children: /* @__PURE__ */ jsx9(
26717
+ PapyrusTextDocumentView,
26718
+ {
26719
+ ...viewProps,
26720
+ style: styles5.nativeView
26721
+ },
26722
+ `${engineId ?? "pending"}:${documentGeneration}`
26723
+ )
26724
+ }
26725
+ );
26726
+ }
26727
+ var styles5 = StyleSheet5.create({
26728
+ container: { flex: 1 },
26729
+ nativeView: { flex: 1 }
26730
+ });
26731
+
26732
+ // components/NativeComicDocumentViewer.tsx
26733
+ import { useEffect as useEffect6, useMemo as useMemo4 } from "react";
26734
+ import { Alert, StyleSheet as StyleSheet6, View as View6 } from "react-native";
26735
+ import {
26736
+ PapyrusComicDocumentView
26737
+ } from "@papyrus-sdk/engine-native";
26738
+ import { useViewerStore as useViewerStore6 } from "@papyrus-sdk/core";
26739
+ import { jsx as jsx10 } from "react/jsx-runtime";
26740
+ function NativeComicDocumentViewer({
26741
+ engine
26742
+ }) {
26743
+ const nativeEngine = engine;
26744
+ const engineId = nativeEngine.getNativeComicEngineId?.() ?? void 0;
26745
+ const documentGeneration = nativeEngine.getNativeComicDocumentGeneration?.() ?? 0;
26746
+ const pageCount = nativeEngine.getPageCount();
26747
+ const currentPage = useViewerStore6((state) => state.currentPage);
26748
+ const zoom = useViewerStore6((state) => state.zoom);
26749
+ const pageTheme = useViewerStore6((state) => state.pageTheme);
26750
+ const locale = useViewerStore6((state) => state.locale);
26751
+ const layoutMode = useViewerStore6((state) => state.comicLayoutMode);
26752
+ const fitMode = useViewerStore6((state) => state.comicFitMode);
26753
+ const readingDirection = useViewerStore6((state) => state.comicReadingDirection);
26754
+ const setDocumentState = useViewerStore6((state) => state.setDocumentState);
26755
+ const t = getStrings(locale);
26756
+ useEffect6(() => {
26757
+ if (!engineId || pageCount <= 0) return;
26758
+ setDocumentState({
26759
+ pageCount,
26760
+ currentPage: Math.min(pageCount, Math.max(1, currentPage)),
26761
+ isLoaded: true
26762
+ });
26763
+ }, [currentPage, engineId, pageCount, setDocumentState]);
26764
+ const viewProps = useMemo4(
26765
+ () => ({
26766
+ engineId,
26767
+ documentGeneration,
26768
+ pageCount,
26769
+ currentPage,
26770
+ layoutMode,
26771
+ fitMode,
26772
+ readingDirection,
26773
+ zoom,
26774
+ pageTheme,
26775
+ onPageChanged: (event) => {
26776
+ const page = Math.max(1, Math.min(pageCount, event.nativeEvent.page));
26777
+ nativeEngine.goToPage(page);
26778
+ setDocumentState({ currentPage: page });
26779
+ },
26780
+ onZoomChanged: (event) => {
26781
+ const nextZoom = Math.max(1, Math.min(5, event.nativeEvent.zoom));
26782
+ nativeEngine.setZoom(nextZoom);
26783
+ setDocumentState({ zoom: nextZoom });
26784
+ },
26785
+ onError: (event) => {
26786
+ Alert.alert(t.comicPageError, event.nativeEvent.message || t.comicPageError);
26787
+ }
26788
+ }),
26789
+ [
26790
+ currentPage,
26791
+ documentGeneration,
26792
+ engineId,
26793
+ fitMode,
26794
+ layoutMode,
26795
+ nativeEngine,
26796
+ pageCount,
26797
+ pageTheme,
26798
+ readingDirection,
26799
+ setDocumentState,
26800
+ t.comicPageError,
26801
+ zoom
26802
+ ]
26803
+ );
26804
+ return /* @__PURE__ */ jsx10(View6, { style: styles6.container, children: /* @__PURE__ */ jsx10(PapyrusComicDocumentView, { ...viewProps, style: StyleSheet6.absoluteFill }) });
26805
+ }
26806
+ var styles6 = StyleSheet6.create({ container: { flex: 1 } });
26807
+
26502
26808
  // components/Viewer.tsx
26503
26809
  import { isPapyrusPdfDocumentViewAvailable } from "@papyrus-sdk/engine-native";
26504
26810
 
@@ -26800,7 +27106,7 @@ var resolveRemoveClippedSubviews = ({
26800
27106
  };
26801
27107
 
26802
27108
  // components/Viewer.tsx
26803
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
27109
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
26804
27110
  var LIST_TOP_PADDING = 18;
26805
27111
  var LIST_BOTTOM_PADDING = 120;
26806
27112
  var CONTINUOUS_PAGE_SPACING = 28;
@@ -26842,25 +27148,28 @@ var Viewer = ({
26842
27148
  viewerMode,
26843
27149
  pageScrubActive = false,
26844
27150
  onTextSelected,
26845
- onDefineSelection
27151
+ onDefineSelection,
27152
+ defineSelectionMode = "selection",
27153
+ onTextRangeSelected,
27154
+ onDefineTextSelection
26846
27155
  }) => {
26847
- const pageCount = useViewerStore5((state) => state.pageCount);
26848
- const currentPage = useViewerStore5((state) => state.currentPage);
26849
- const scrollToPageSignal = useViewerStore5(
27156
+ const pageCount = useViewerStore7((state) => state.pageCount);
27157
+ const currentPage = useViewerStore7((state) => state.currentPage);
27158
+ const scrollToPageSignal = useViewerStore7(
26850
27159
  (state) => state.scrollToPageSignal
26851
27160
  );
26852
- const setDocumentState = useViewerStore5((state) => state.setDocumentState);
26853
- const mobileChromeVisible = useViewerStore5(
27161
+ const setDocumentState = useViewerStore7((state) => state.setDocumentState);
27162
+ const mobileChromeVisible = useViewerStore7(
26854
27163
  (state) => state.mobileChromeVisible
26855
27164
  );
26856
- const selectionActive = useViewerStore5((state) => state.selectionActive);
26857
- const activeTool = useViewerStore5((state) => state.activeTool);
26858
- const uiTheme = useViewerStore5((state) => state.uiTheme);
26859
- const pageTheme = useViewerStore5((state) => state.pageTheme);
26860
- const viewMode = useViewerStore5((state) => state.viewMode);
26861
- const rotation = useViewerStore5((state) => state.rotation);
26862
- const zoom = useViewerStore5((state) => state.zoom);
26863
- const storeViewerMode = useViewerStore5((state) => state.viewerMode);
27165
+ const selectionActive = useViewerStore7((state) => state.selectionActive);
27166
+ const activeTool = useViewerStore7((state) => state.activeTool);
27167
+ const uiTheme = useViewerStore7((state) => state.uiTheme);
27168
+ const pageTheme = useViewerStore7((state) => state.pageTheme);
27169
+ const viewMode = useViewerStore7((state) => state.viewMode);
27170
+ const rotation = useViewerStore7((state) => state.rotation);
27171
+ const zoom = useViewerStore7((state) => state.zoom);
27172
+ const storeViewerMode = useViewerStore7((state) => state.viewerMode);
26864
27173
  const listRef = useRef5(null);
26865
27174
  const horizontalScrollRef = useRef5(null);
26866
27175
  const isDark = uiTheme === "dark";
@@ -26869,6 +27178,8 @@ var Viewer = ({
26869
27178
  const isSingle = viewMode === "single";
26870
27179
  const renderTargetType = engine.getRenderTargetType?.() ?? "canvas";
26871
27180
  const isWebView = renderTargetType === "webview";
27181
+ const isNativeTextViewer = renderTargetType === "native-text";
27182
+ const isNativeComicViewer = renderTargetType === "native-comic";
26872
27183
  const resolvedViewerMode = resolveEffectivePdfViewerMode({
26873
27184
  platform: Platform4.OS,
26874
27185
  viewerMode,
@@ -26876,7 +27187,7 @@ var Viewer = ({
26876
27187
  storeViewerMode
26877
27188
  });
26878
27189
  const mobilePerf = useMobilePerf();
26879
- const pinchPerfMachine = useMemo3(
27190
+ const pinchPerfMachine = useMemo5(
26880
27191
  () => createPinchPerfMachine(mobilePerf),
26881
27192
  [mobilePerf]
26882
27193
  );
@@ -26896,7 +27207,11 @@ var Viewer = ({
26896
27207
  activeTool,
26897
27208
  nativeInkOverlayAvailable
26898
27209
  });
26899
- useEffect5(() => {
27210
+ useEffect7(() => {
27211
+ setDocumentState({ nativePdfViewerActive: isNativePdfViewer });
27212
+ return () => setDocumentState({ nativePdfViewerActive: false });
27213
+ }, [isNativePdfViewer, setDocumentState]);
27214
+ useEffect7(() => {
26900
27215
  mobilePerf.emit(
26901
27216
  "viewer.mode",
26902
27217
  resolveViewerModeTelemetry({
@@ -26907,7 +27222,7 @@ var Viewer = ({
26907
27222
  );
26908
27223
  }, [isNativePdfViewer, isWebView, mobilePerf, resolvedViewerMode]);
26909
27224
  const warnedNativePdfFallbackRef = useRef5("");
26910
- useEffect5(() => {
27225
+ useEffect7(() => {
26911
27226
  if (!__DEV__ || Platform4.OS !== "ios" || resolvedViewerMode !== "native" || isWebView || pageCount <= 0) {
26912
27227
  return;
26913
27228
  }
@@ -26917,7 +27232,6 @@ var Viewer = ({
26917
27232
  if (activeTool === "ink" && !nativeInkOverlayAvailable) {
26918
27233
  return "unsupported-ink-overlay";
26919
27234
  }
26920
- if (pageTheme !== "normal") return "unsupported-page-theme";
26921
27235
  if (viewMode === "double") return "unsupported-view-mode";
26922
27236
  if (rotation !== 0) return "unsupported-rotation";
26923
27237
  return "";
@@ -26928,7 +27242,6 @@ var Viewer = ({
26928
27242
  "manager-unavailable": "the PapyrusPdfDocumentView manager is not registered",
26929
27243
  "engine-unavailable": "the native PDF engine id is unavailable",
26930
27244
  "unsupported-ink-overlay": "PencilKit page overlays require iOS 16 or newer",
26931
- "unsupported-page-theme": `pageTheme '${pageTheme}' is not supported by the native viewport`,
26932
27245
  "unsupported-view-mode": "double-page mode is not supported by the native viewport",
26933
27246
  "unsupported-rotation": "document rotation is not supported by the native viewport"
26934
27247
  };
@@ -26942,7 +27255,6 @@ var Viewer = ({
26942
27255
  nativePdfDocumentViewAvailable,
26943
27256
  nativeInkOverlayAvailable,
26944
27257
  pageCount,
26945
- pageTheme,
26946
27258
  rotation,
26947
27259
  resolvedViewerMode,
26948
27260
  viewMode
@@ -26958,7 +27270,7 @@ var Viewer = ({
26958
27270
  createBurstMonitor("Viewer", "onViewableItemsChanged", 12, 800)
26959
27271
  );
26960
27272
  const scrollMonitorRef = useRef5(createScrollPerfMonitor("Viewer"));
26961
- const scrollPerfSession = useMemo3(() => createScrollPerfSession(), []);
27273
+ const scrollPerfSession = useMemo5(() => createScrollPerfSession(), []);
26962
27274
  const dimensionsCacheRef = useRef5(/* @__PURE__ */ new Map());
26963
27275
  const dimensionsPendingRef = useRef5(/* @__PURE__ */ new Set());
26964
27276
  const previousViewportGeometryRef = useRef5(null);
@@ -27012,7 +27324,7 @@ var Viewer = ({
27012
27324
  const [viewerViewportHeight, setViewerViewportHeight] = useState5(0);
27013
27325
  const viewerContentHeightRef = useRef5(0);
27014
27326
  const listLayoutMetricsRef = useRef5(null);
27015
- const resolvedWindowSize = useMemo3(
27327
+ const resolvedWindowSize = useMemo5(
27016
27328
  () => resolvePositiveInt(
27017
27329
  virtualWindowSize,
27018
27330
  resolveRenderOverscan({
@@ -27026,7 +27338,7 @@ var Viewer = ({
27026
27338
  ),
27027
27339
  [virtualWindowSize, windowWidth, zoom]
27028
27340
  );
27029
- const resolvedMaxToRenderPerBatch = useMemo3(
27341
+ const resolvedMaxToRenderPerBatch = useMemo5(
27030
27342
  () => resolvePositiveInt(
27031
27343
  maxToRenderPerBatch,
27032
27344
  FLATLIST_MAX_TO_RENDER_PER_BATCH,
@@ -27046,11 +27358,11 @@ var Viewer = ({
27046
27358
  viewMode,
27047
27359
  renderTargetType
27048
27360
  });
27049
- const pages = useMemo3(
27361
+ const pages = useMemo5(
27050
27362
  () => Array.from({ length: pageCount }).map((_, i) => i),
27051
27363
  [pageCount]
27052
27364
  );
27053
- const rows = useMemo3(() => {
27365
+ const rows = useMemo5(() => {
27054
27366
  if (!isDouble) return [];
27055
27367
  const result = [];
27056
27368
  for (let i = 0; i < pageCount; i += 2) {
@@ -27121,7 +27433,7 @@ var Viewer = ({
27121
27433
  },
27122
27434
  [clearPendingScrollRetry, clearPendingScrollTarget, perfEnabled]
27123
27435
  );
27124
- useEffect5(
27436
+ useEffect7(
27125
27437
  () => () => {
27126
27438
  if (layoutRefreshTimeoutRef.current) {
27127
27439
  clearTimeout(layoutRefreshTimeoutRef.current);
@@ -27174,7 +27486,7 @@ var Viewer = ({
27174
27486
  }
27175
27487
  return dims.width / dims.height;
27176
27488
  }, []);
27177
- useEffect5(() => {
27489
+ useEffect7(() => {
27178
27490
  if (!perfEnabled) return;
27179
27491
  logPerfEvent("Viewer", "mount", {
27180
27492
  viewMode,
@@ -27195,7 +27507,7 @@ var Viewer = ({
27195
27507
  resolvedWindowSize,
27196
27508
  viewMode
27197
27509
  ]);
27198
- useEffect5(() => {
27510
+ useEffect7(() => {
27199
27511
  if (!perfEnabled || readyLoggedRef.current || pageCount <= 0) return;
27200
27512
  readyLoggedRef.current = true;
27201
27513
  logPerfEvent("Viewer", "document.ready", {
@@ -27204,7 +27516,7 @@ var Viewer = ({
27204
27516
  });
27205
27517
  sampleMemory("Viewer", "document.ready", { pageCount });
27206
27518
  }, [pageCount, perfEnabled]);
27207
- useEffect5(() => {
27519
+ useEffect7(() => {
27208
27520
  if (isWebView || isSingle || pageCount <= 0) return;
27209
27521
  const warmupCount = Math.min(pageCount, 12);
27210
27522
  for (let i = 0; i < warmupCount; i += 1) {
@@ -27223,7 +27535,7 @@ var Viewer = ({
27223
27535
  },
27224
27536
  [perfEnabled, setDocumentState]
27225
27537
  );
27226
- useEffect5(() => {
27538
+ useEffect7(() => {
27227
27539
  chromeVisibleRef.current = mobileChromeVisible;
27228
27540
  }, [mobileChromeVisible]);
27229
27541
  const setMobileChromeVisible = useCallback4(
@@ -27286,10 +27598,10 @@ var Viewer = ({
27286
27598
  },
27287
27599
  [clearPendingChromeShow, pageCount, setMobileChromeVisible]
27288
27600
  );
27289
- useEffect5(() => {
27601
+ useEffect7(() => {
27290
27602
  resetMobileChromeTracking(true, "mobileChrome.reset");
27291
27603
  }, [isSingle, isWebView, pageCount, resetMobileChromeTracking]);
27292
- useEffect5(
27604
+ useEffect7(
27293
27605
  () => () => {
27294
27606
  setDocumentState({ mobileChromeVisible: true });
27295
27607
  },
@@ -27342,7 +27654,7 @@ var Viewer = ({
27342
27654
  },
27343
27655
  [columnGap, columnWidth, horizontalPadding, isDouble, windowWidth]
27344
27656
  );
27345
- const documentSurfaceWidth = useMemo3(() => {
27657
+ const documentSurfaceWidth = useMemo5(() => {
27346
27658
  if (isDouble) {
27347
27659
  const doubleContentWidth = resolvePdfDoublePageContentWidth({
27348
27660
  currentPage,
@@ -27794,7 +28106,7 @@ var Viewer = ({
27794
28106
  },
27795
28107
  [documentSurfaceWidth, windowWidth]
27796
28108
  );
27797
- const viewerPinchGesture = useMemo3(
28109
+ const viewerPinchGesture = useMemo5(
27798
28110
  () => Gesture2.Pinch().enabled(!isWebView && pageCount > 0).onTouchesDown((event) => {
27799
28111
  if ((event.allTouches?.length ?? 0) >= 2) {
27800
28112
  handleGestureScrollLockChange(true);
@@ -27825,21 +28137,21 @@ var Viewer = ({
27825
28137
  updateViewerPinch
27826
28138
  ]
27827
28139
  );
27828
- useEffect5(() => {
28140
+ useEffect7(() => {
27829
28141
  selectionDragActiveRef.current = selectionDragActive;
27830
28142
  syncViewerScrollEnabled(
27831
28143
  selectionDragActive,
27832
28144
  gestureScrollLockActiveRef.current
27833
28145
  );
27834
28146
  }, [selectionDragActive, syncViewerScrollEnabled]);
27835
- useEffect5(() => {
28147
+ useEffect7(() => {
27836
28148
  syncViewerScrollEnabled(
27837
28149
  selectionDragActiveRef.current,
27838
28150
  gestureScrollLockActiveRef.current,
27839
28151
  pageScrubActive
27840
28152
  );
27841
28153
  }, [pageScrubActive, syncViewerScrollEnabled]);
27842
- useEffect5(() => {
28154
+ useEffect7(() => {
27843
28155
  const pendingRestore = pendingPinchAnchorRestoreRef.current;
27844
28156
  if (!pendingRestore) return;
27845
28157
  if (Math.abs(pendingRestore.finalZoom - zoom) >= 1e-3) return;
@@ -27937,7 +28249,7 @@ var Viewer = ({
27937
28249
  windowWidth,
27938
28250
  zoom
27939
28251
  ]);
27940
- useEffect5(() => {
28252
+ useEffect7(() => {
27941
28253
  if (zoom > 1 && documentSurfaceWidth > windowWidth) return;
27942
28254
  scrollHorizontalSurfaceTo(0);
27943
28255
  }, [documentSurfaceWidth, scrollHorizontalSurfaceTo, windowWidth, zoom]);
@@ -27991,7 +28303,7 @@ var Viewer = ({
27991
28303
  },
27992
28304
  [scrollViewerBy]
27993
28305
  );
27994
- const listLayoutMetrics = useMemo3(() => {
28306
+ const listLayoutMetrics = useMemo5(() => {
27995
28307
  if (isDouble) {
27996
28308
  const pageWidth2 = resolvePdfBasePageWidth({
27997
28309
  viewportWidth: columnWidth,
@@ -28070,7 +28382,7 @@ var Viewer = ({
28070
28382
  windowWidth
28071
28383
  ]);
28072
28384
  listLayoutMetricsRef.current = listLayoutMetrics;
28073
- const scaledListLayoutMetrics = useMemo3(
28385
+ const scaledListLayoutMetrics = useMemo5(
28074
28386
  () => scalePageLayoutMetrics(listLayoutMetrics, Math.max(zoom, 0.25)),
28075
28387
  [listLayoutMetrics, zoom]
28076
28388
  );
@@ -28124,7 +28436,7 @@ var Viewer = ({
28124
28436
  scaledListLayoutMetrics,
28125
28437
  windowWidth
28126
28438
  ]);
28127
- useEffect5(() => {
28439
+ useEffect7(() => {
28128
28440
  const nextGeometry = { width: windowWidth, pageFitHeight };
28129
28441
  const previousGeometry = previousViewportGeometryRef.current;
28130
28442
  previousViewportGeometryRef.current = nextGeometry;
@@ -28136,7 +28448,7 @@ var Viewer = ({
28136
28448
  }
28137
28449
  restoreOrientationScrollOffset();
28138
28450
  }, [pageFitHeight, restoreOrientationScrollOffset, windowWidth]);
28139
- useEffect5(() => {
28451
+ useEffect7(() => {
28140
28452
  if (pendingScrollTargetRef.current !== null) {
28141
28453
  scrollToPendingTarget(false);
28142
28454
  }
@@ -28170,7 +28482,7 @@ var Viewer = ({
28170
28482
  },
28171
28483
  [ensurePageDimensions, isDouble, rows, scaledListLayoutMetrics]
28172
28484
  );
28173
- useEffect5(() => {
28485
+ useEffect7(() => {
28174
28486
  if (Platform4.OS === "ios" && isNativePdfViewer) {
28175
28487
  clearPendingScrollTarget();
28176
28488
  if (scrollToPageSignal === null) return;
@@ -28392,11 +28704,11 @@ var Viewer = ({
28392
28704
  Animated.View,
28393
28705
  {
28394
28706
  style: [
28395
- styles5.row,
28707
+ styles7.row,
28396
28708
  { paddingHorizontal: horizontalPadding, width: documentSurfaceWidth }
28397
28709
  ],
28398
28710
  children: [
28399
- /* @__PURE__ */ jsx8(View5, { style: { width: columnWidth }, children: /* @__PURE__ */ jsx8(
28711
+ /* @__PURE__ */ jsx11(View7, { style: { width: columnWidth }, children: /* @__PURE__ */ jsx11(
28400
28712
  PageRenderer_default,
28401
28713
  {
28402
28714
  engine,
@@ -28418,7 +28730,7 @@ var Viewer = ({
28418
28730
  gestureId: committedPinchGestureIdRef.current ?? void 0
28419
28731
  }
28420
28732
  ) }),
28421
- row.right !== null ? /* @__PURE__ */ jsx8(View5, { style: { width: columnWidth }, children: /* @__PURE__ */ jsx8(
28733
+ row.right !== null ? /* @__PURE__ */ jsx11(View7, { style: { width: columnWidth }, children: /* @__PURE__ */ jsx11(
28422
28734
  PageRenderer_default,
28423
28735
  {
28424
28736
  engine,
@@ -28439,12 +28751,12 @@ var Viewer = ({
28439
28751
  surfaceId: `page-${row.right}`,
28440
28752
  gestureId: committedPinchGestureIdRef.current ?? void 0
28441
28753
  }
28442
- ) }) : /* @__PURE__ */ jsx8(View5, { style: { width: columnWidth } })
28754
+ ) }) : /* @__PURE__ */ jsx11(View7, { style: { width: columnWidth } })
28443
28755
  ]
28444
28756
  }
28445
28757
  );
28446
28758
  }
28447
- return /* @__PURE__ */ jsx8(
28759
+ return /* @__PURE__ */ jsx11(
28448
28760
  PageRenderer_default,
28449
28761
  {
28450
28762
  engine,
@@ -28483,7 +28795,7 @@ var Viewer = ({
28483
28795
  windowWidth
28484
28796
  ]
28485
28797
  );
28486
- const continuousList = /* @__PURE__ */ jsx8(
28798
+ const continuousList = /* @__PURE__ */ jsx11(
28487
28799
  FlatList,
28488
28800
  {
28489
28801
  ref: listRef,
@@ -28497,7 +28809,7 @@ var Viewer = ({
28497
28809
  removeClippedSubviews: resolvedRemoveClippedSubviews,
28498
28810
  getItemLayout,
28499
28811
  keyExtractor,
28500
- contentContainerStyle: styles5.listContent,
28812
+ contentContainerStyle: styles7.listContent,
28501
28813
  renderItem,
28502
28814
  onViewableItemsChanged,
28503
28815
  viewabilityConfig: { itemVisiblePercentThreshold: 60 },
@@ -28573,7 +28885,7 @@ var Viewer = ({
28573
28885
  }
28574
28886
  );
28575
28887
  if (isWebView) {
28576
- return /* @__PURE__ */ jsx8(View5, { style: [styles5.container, isDark && styles5.containerDark], children: /* @__PURE__ */ jsx8(
28888
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(
28577
28889
  WebViewViewer_default,
28578
28890
  {
28579
28891
  engine,
@@ -28583,23 +28895,38 @@ var Viewer = ({
28583
28895
  }
28584
28896
  ) });
28585
28897
  }
28898
+ if (isNativeTextViewer) {
28899
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(
28900
+ NativeTextDocumentViewer,
28901
+ {
28902
+ engine,
28903
+ onTextRangeSelected,
28904
+ onDefineSelection: onDefineTextSelection,
28905
+ defineSelectionMode
28906
+ }
28907
+ ) });
28908
+ }
28909
+ if (isNativeComicViewer) {
28910
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(NativeComicDocumentViewer, { engine }) });
28911
+ }
28586
28912
  if (isNativePdfViewer) {
28587
- return /* @__PURE__ */ jsx8(View5, { style: [styles5.container, isDark && styles5.containerDark], children: /* @__PURE__ */ jsx8(
28913
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(
28588
28914
  NativePdfDocumentViewer,
28589
28915
  {
28590
28916
  engine,
28591
28917
  maxPageWidth,
28592
28918
  onTextSelected,
28593
- onDefineSelection
28919
+ onDefineSelection,
28920
+ defineSelectionMode
28594
28921
  }
28595
28922
  ) });
28596
28923
  }
28597
28924
  if (isSingle) {
28598
- return /* @__PURE__ */ jsx8(View5, { style: [styles5.container, isDark && styles5.containerDark], children: /* @__PURE__ */ jsx8(GestureDetector2, { gesture: viewerPinchGesture, children: /* @__PURE__ */ jsx8(
28925
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(GestureDetector2, { gesture: viewerPinchGesture, children: /* @__PURE__ */ jsx11(
28599
28926
  Animated.View,
28600
28927
  {
28601
28928
  style: [
28602
- styles5.gestureSurface,
28929
+ styles7.gestureSurface,
28603
28930
  {
28604
28931
  transform: [
28605
28932
  { translateX: pinchPreviewFocalX },
@@ -28610,7 +28937,7 @@ var Viewer = ({
28610
28937
  ]
28611
28938
  }
28612
28939
  ],
28613
- children: /* @__PURE__ */ jsx8(
28940
+ children: /* @__PURE__ */ jsx11(
28614
28941
  ScrollView,
28615
28942
  {
28616
28943
  ref: horizontalScrollRef,
@@ -28622,7 +28949,7 @@ var Viewer = ({
28622
28949
  horizontalScrollOffsetRef.current = event.nativeEvent.contentOffset?.x ?? 0;
28623
28950
  },
28624
28951
  scrollEventThrottle: 16,
28625
- children: /* @__PURE__ */ jsx8(
28952
+ children: /* @__PURE__ */ jsx11(
28626
28953
  ScrollView,
28627
28954
  {
28628
28955
  ref: (node) => {
@@ -28630,7 +28957,7 @@ var Viewer = ({
28630
28957
  listRef.current = node;
28631
28958
  },
28632
28959
  style: { width: documentSurfaceWidth },
28633
- contentContainerStyle: styles5.singleContent,
28960
+ contentContainerStyle: styles7.singleContent,
28634
28961
  showsVerticalScrollIndicator: false,
28635
28962
  scrollEnabled: pageScrubResolvedScrollEnabled,
28636
28963
  onLayout: (event) => {
@@ -28665,7 +28992,7 @@ var Viewer = ({
28665
28992
  });
28666
28993
  } : void 0,
28667
28994
  scrollEventThrottle: 16,
28668
- children: /* @__PURE__ */ jsx8(
28995
+ children: /* @__PURE__ */ jsx11(
28669
28996
  PageRenderer_default,
28670
28997
  {
28671
28998
  engine,
@@ -28695,11 +29022,11 @@ var Viewer = ({
28695
29022
  }
28696
29023
  ) }) });
28697
29024
  }
28698
- return /* @__PURE__ */ jsx8(View5, { style: [styles5.container, isDark && styles5.containerDark], children: /* @__PURE__ */ jsx8(GestureDetector2, { gesture: viewerPinchGesture, children: /* @__PURE__ */ jsx8(
29025
+ return /* @__PURE__ */ jsx11(View7, { style: [styles7.container, isDark && styles7.containerDark], children: /* @__PURE__ */ jsx11(GestureDetector2, { gesture: viewerPinchGesture, children: /* @__PURE__ */ jsx11(
28699
29026
  Animated.View,
28700
29027
  {
28701
29028
  style: [
28702
- styles5.gestureSurface,
29029
+ styles7.gestureSurface,
28703
29030
  {
28704
29031
  transform: [
28705
29032
  { translateX: pinchPreviewFocalX },
@@ -28710,7 +29037,7 @@ var Viewer = ({
28710
29037
  ]
28711
29038
  }
28712
29039
  ],
28713
- children: documentSurfaceWidth > windowWidth + 1 ? /* @__PURE__ */ jsx8(
29040
+ children: documentSurfaceWidth > windowWidth + 1 ? /* @__PURE__ */ jsx11(
28714
29041
  ScrollView,
28715
29042
  {
28716
29043
  ref: horizontalScrollRef,
@@ -28728,7 +29055,7 @@ var Viewer = ({
28728
29055
  }
28729
29056
  ) }) });
28730
29057
  };
28731
- var styles5 = StyleSheet5.create({
29058
+ var styles7 = StyleSheet7.create({
28732
29059
  container: {
28733
29060
  flex: 1,
28734
29061
  backgroundColor: "#e9ecef"
@@ -28757,49 +29084,17 @@ var Viewer_default = Viewer;
28757
29084
  // components/Topbar.tsx
28758
29085
  import { useState as useState8 } from "react";
28759
29086
  import {
28760
- View as View8,
29087
+ View as View10,
28761
29088
  Text as Text4,
28762
29089
  Pressable as Pressable6,
28763
- StyleSheet as StyleSheet8,
29090
+ StyleSheet as StyleSheet10,
28764
29091
  useWindowDimensions as useWindowDimensions4
28765
29092
  } from "react-native";
28766
- import { useViewerStore as useViewerStore6 } from "@papyrus-sdk/core";
28767
-
28768
- // components/mobileChromeMetrics.ts
28769
- var MOBILE_CHROME_METRICS = {
28770
- screenPadding: 16,
28771
- maxFloatingWidth: 360,
28772
- maxToolDockWidth: 420,
28773
- toolDockPaddingTop: 4,
28774
- toolDockHistoryIconSize: 18,
28775
- toolDockHistoryGap: 2,
28776
- toolDockDisabledIconColorDark: "#64748b",
28777
- toolDockDisabledIconColorLight: "#6b7280",
28778
- toolDockDisabledOpacity: 0.72,
28779
- iconSize: 20,
28780
- iconBoxSize: 28,
28781
- topbarPageButtonSize: 30,
28782
- bottomBarItemPaddingHorizontal: 5,
28783
- bottomBarItemPaddingVertical: 3,
28784
- bottomBarVisualHeight: 52,
28785
- toolDockGap: 12,
28786
- topbarHeight: 56,
28787
- progressGap: 18,
28788
- progressHorizontalOffset: 10
28789
- };
28790
- var resolveMobileChromeOffsets = (insets) => ({
28791
- topbar: Math.max(0, insets.top),
28792
- progress: Math.max(0, insets.top) + MOBILE_CHROME_METRICS.topbarHeight + MOBILE_CHROME_METRICS.progressGap,
28793
- bottom: Math.max(0, insets.bottom) + 14,
28794
- toolDock: Math.max(0, insets.bottom) + 14 + MOBILE_CHROME_METRICS.bottomBarVisualHeight + MOBILE_CHROME_METRICS.toolDockGap,
28795
- search: Math.max(0, insets.bottom) + 20,
28796
- left: MOBILE_CHROME_METRICS.screenPadding + Math.max(0, insets.left),
28797
- right: MOBILE_CHROME_METRICS.screenPadding + Math.max(0, insets.right)
28798
- });
29093
+ import { useViewerStore as useViewerStore8 } from "@papyrus-sdk/core";
28799
29094
 
28800
29095
  // components/PageJumpModal.tsx
28801
- import { useEffect as useEffect7, useState as useState7 } from "react";
28802
- import { Pressable as Pressable5, StyleSheet as StyleSheet7, Text as Text3, TextInput, View as View7 } from "react-native";
29096
+ import { useEffect as useEffect9, useState as useState7 } from "react";
29097
+ import { Pressable as Pressable5, StyleSheet as StyleSheet9, Text as Text3, TextInput, View as View9 } from "react-native";
28803
29098
 
28804
29099
  // components/pageJumpModel.ts
28805
29100
  var resolvePageJumpTarget = (value, pageCount) => {
@@ -28810,16 +29105,16 @@ var resolvePageJumpTarget = (value, pageCount) => {
28810
29105
  };
28811
29106
 
28812
29107
  // components/NativeSheet.tsx
28813
- import React8, { useEffect as useEffect6, useRef as useRef6, useState as useState6 } from "react";
29108
+ import React10, { useEffect as useEffect8, useRef as useRef6, useState as useState6 } from "react";
28814
29109
  import {
28815
29110
  Animated as Animated2,
28816
29111
  FlatList as FlatList2,
28817
29112
  Modal,
28818
29113
  Pressable as Pressable4,
28819
29114
  ScrollView as ScrollView2,
28820
- StyleSheet as StyleSheet6,
29115
+ StyleSheet as StyleSheet8,
28821
29116
  Text as Text2,
28822
- View as View6,
29117
+ View as View8,
28823
29118
  useWindowDimensions as useWindowDimensions3
28824
29119
  } from "react-native";
28825
29120
 
@@ -28861,29 +29156,6 @@ var getNativeSheetLayoutStyles = (windowWidth) => {
28861
29156
  };
28862
29157
  };
28863
29158
 
28864
- // components/PapyrusSafeArea.tsx
28865
- import React7, { useContext as useContext2 } from "react";
28866
- import {
28867
- SafeAreaInsetsContext,
28868
- SafeAreaProvider
28869
- } from "react-native-safe-area-context";
28870
- import { Fragment as Fragment2, jsx as jsx9 } from "react/jsx-runtime";
28871
- var papyrusSafeAreaContext = SafeAreaInsetsContext;
28872
- var ZERO_SAFE_AREA_INSETS = {
28873
- top: 0,
28874
- bottom: 0,
28875
- left: 0,
28876
- right: 0
28877
- };
28878
- var usePapyrusSafeAreaInsets = () => useContext2(papyrusSafeAreaContext) ?? ZERO_SAFE_AREA_INSETS;
28879
- function PapyrusSafeAreaBoundary({
28880
- children
28881
- }) {
28882
- const insets = useContext2(papyrusSafeAreaContext);
28883
- if (insets) return /* @__PURE__ */ jsx9(Fragment2, { children });
28884
- return React7.createElement(SafeAreaProvider, null, children);
28885
- }
28886
-
28887
29159
  // components/readerSheetPresentation.ts
28888
29160
  var LIGHT_PALETTE = {
28889
29161
  surface: "#fbfaf6",
@@ -28925,7 +29197,7 @@ var ANNOTATION_KIND_LABELS = {
28925
29197
  var getAnnotationKindLabel = (kind, locale) => (ANNOTATION_KIND_LABELS[kind]?.[locale] ?? kind).toUpperCase();
28926
29198
 
28927
29199
  // components/NativeSheet.tsx
28928
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
29200
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
28929
29201
  function NativeSheet({
28930
29202
  visible,
28931
29203
  onClose,
@@ -28945,7 +29217,7 @@ function NativeSheet({
28945
29217
  const renderedRef = useRef6(visible);
28946
29218
  const motion = useRef6(new Animated2.Value(visible ? 0 : 1)).current;
28947
29219
  const backdropOpacity = useRef6(new Animated2.Value(visible ? 1 : 0)).current;
28948
- useEffect6(() => {
29220
+ useEffect8(() => {
28949
29221
  motion.stopAnimation();
28950
29222
  backdropOpacity.stopAnimation();
28951
29223
  if (visible) {
@@ -28988,20 +29260,20 @@ function NativeSheet({
28988
29260
  });
28989
29261
  }, [backdropOpacity, motion, visible]);
28990
29262
  if (!rendered) return null;
28991
- return /* @__PURE__ */ jsx10(
29263
+ return /* @__PURE__ */ jsx12(
28992
29264
  Modal,
28993
29265
  {
28994
29266
  animationType: "none",
28995
29267
  transparent: true,
28996
29268
  visible: rendered,
28997
29269
  onRequestClose: onClose,
28998
- children: /* @__PURE__ */ jsxs7(View6, { style: [styles6.root, tabletLayout?.root], children: [
28999
- /* @__PURE__ */ jsx10(Animated2.View, { style: [styles6.backdrop, { opacity: backdropOpacity }], children: /* @__PURE__ */ jsx10(
29270
+ children: /* @__PURE__ */ jsxs7(View8, { style: [styles8.root, tabletLayout?.root], children: [
29271
+ /* @__PURE__ */ jsx12(Animated2.View, { style: [styles8.backdrop, { opacity: backdropOpacity }], children: /* @__PURE__ */ jsx12(
29000
29272
  Pressable4,
29001
29273
  {
29002
29274
  accessibilityRole: "button",
29003
29275
  accessibilityLabel: closeAccessibilityLabel,
29004
- style: StyleSheet6.absoluteFill,
29276
+ style: StyleSheet8.absoluteFill,
29005
29277
  onPress: onClose
29006
29278
  }
29007
29279
  ) }),
@@ -29009,9 +29281,9 @@ function NativeSheet({
29009
29281
  Animated2.View,
29010
29282
  {
29011
29283
  style: [
29012
- styles6.sheet,
29284
+ styles8.sheet,
29013
29285
  tabletLayout?.sheet,
29014
- isDark && styles6.sheetDark,
29286
+ isDark && styles8.sheetDark,
29015
29287
  getNativeSheetSizeStyle(maxHeight),
29016
29288
  { paddingBottom: insets.bottom },
29017
29289
  {
@@ -29032,27 +29304,27 @@ function NativeSheet({
29032
29304
  }
29033
29305
  ],
29034
29306
  children: [
29035
- showHeader ? /* @__PURE__ */ jsxs7(View6, { style: styles6.header, children: [
29036
- /* @__PURE__ */ jsx10(View6, { style: styles6.headerSpacer }),
29037
- /* @__PURE__ */ jsx10(
29307
+ showHeader ? /* @__PURE__ */ jsxs7(View8, { style: styles8.header, children: [
29308
+ /* @__PURE__ */ jsx12(View8, { style: styles8.headerSpacer }),
29309
+ /* @__PURE__ */ jsx12(
29038
29310
  Text2,
29039
29311
  {
29040
- style: [styles6.title, { color: palette.textColor }],
29312
+ style: [styles8.title, { color: palette.textColor }],
29041
29313
  numberOfLines: 1,
29042
29314
  children: title
29043
29315
  }
29044
29316
  ),
29045
- /* @__PURE__ */ jsx10(
29317
+ /* @__PURE__ */ jsx12(
29046
29318
  Pressable4,
29047
29319
  {
29048
29320
  onPress: onClose,
29049
29321
  style: [
29050
- styles6.closeButton,
29051
- isDark && styles6.closeButtonDark,
29322
+ styles8.closeButton,
29323
+ isDark && styles8.closeButtonDark,
29052
29324
  { backgroundColor: palette.closeBackgroundColor }
29053
29325
  ],
29054
29326
  accessibilityLabel: closeAccessibilityLabel,
29055
- children: /* @__PURE__ */ jsx10(IconClose, { size: 18, color: palette.textColor })
29327
+ children: /* @__PURE__ */ jsx12(IconClose, { size: 18, color: palette.textColor })
29056
29328
  }
29057
29329
  )
29058
29330
  ] }) : null,
@@ -29064,20 +29336,20 @@ function NativeSheet({
29064
29336
  }
29065
29337
  );
29066
29338
  }
29067
- var NativeSheetScrollView = React8.forwardRef(function NativeSheetScrollView2(props, ref) {
29068
- return /* @__PURE__ */ jsx10(ScrollView2, { ref, ...props });
29339
+ var NativeSheetScrollView = React10.forwardRef(function NativeSheetScrollView2(props, ref) {
29340
+ return /* @__PURE__ */ jsx12(ScrollView2, { ref, ...props });
29069
29341
  });
29070
29342
  function NativeSheetFlatList(props) {
29071
- return /* @__PURE__ */ jsx10(FlatList2, { ...props });
29343
+ return /* @__PURE__ */ jsx12(FlatList2, { ...props });
29072
29344
  }
29073
- var styles6 = StyleSheet6.create({
29345
+ var styles8 = StyleSheet8.create({
29074
29346
  root: {
29075
29347
  flex: 1,
29076
29348
  justifyContent: "flex-end",
29077
29349
  alignItems: "center"
29078
29350
  },
29079
29351
  backdrop: {
29080
- ...StyleSheet6.absoluteFillObject,
29352
+ ...StyleSheet8.absoluteFillObject,
29081
29353
  backgroundColor: "rgba(0, 0, 0, 0.4)"
29082
29354
  },
29083
29355
  sheet: {
@@ -29129,7 +29401,7 @@ var styles6 = StyleSheet6.create({
29129
29401
  });
29130
29402
 
29131
29403
  // components/PageJumpModal.tsx
29132
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
29404
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
29133
29405
  function PageJumpModal({
29134
29406
  visible,
29135
29407
  currentPage,
@@ -29141,7 +29413,7 @@ function PageJumpModal({
29141
29413
  }) {
29142
29414
  const [value, setValue] = useState7(`${currentPage}`);
29143
29415
  const palette = getReaderSheetPalette(isDark);
29144
- useEffect7(() => {
29416
+ useEffect9(() => {
29145
29417
  if (visible) setValue(`${currentPage}`);
29146
29418
  }, [currentPage, visible]);
29147
29419
  const confirmJump = () => {
@@ -29166,7 +29438,7 @@ function PageJumpModal({
29166
29438
  borderTopColor: palette.divider
29167
29439
  },
29168
29440
  children: [
29169
- /* @__PURE__ */ jsx11(
29441
+ /* @__PURE__ */ jsx13(
29170
29442
  TextInput,
29171
29443
  {
29172
29444
  value,
@@ -29178,7 +29450,7 @@ function PageJumpModal({
29178
29450
  placeholder: "1",
29179
29451
  placeholderTextColor: palette.mutedText,
29180
29452
  style: [
29181
- styles7.input,
29453
+ styles9.input,
29182
29454
  {
29183
29455
  color: palette.text,
29184
29456
  backgroundColor: palette.elevatedSurface,
@@ -29190,25 +29462,25 @@ function PageJumpModal({
29190
29462
  testID: "papyrus-page-jump-input"
29191
29463
  }
29192
29464
  ),
29193
- /* @__PURE__ */ jsxs8(View7, { style: styles7.actions, children: [
29194
- /* @__PURE__ */ jsx11(
29465
+ /* @__PURE__ */ jsxs8(View9, { style: styles9.actions, children: [
29466
+ /* @__PURE__ */ jsx13(
29195
29467
  Pressable5,
29196
29468
  {
29197
29469
  onPress: onClose,
29198
29470
  style: [
29199
- styles7.actionButton,
29471
+ styles9.actionButton,
29200
29472
  { backgroundColor: palette.closeSurface }
29201
29473
  ],
29202
- children: /* @__PURE__ */ jsx11(Text3, { style: [styles7.actionText, { color: palette.text }], children: "Cancelar" })
29474
+ children: /* @__PURE__ */ jsx13(Text3, { style: [styles9.actionText, { color: palette.text }], children: "Cancelar" })
29203
29475
  }
29204
29476
  ),
29205
- /* @__PURE__ */ jsx11(
29477
+ /* @__PURE__ */ jsx13(
29206
29478
  Pressable5,
29207
29479
  {
29208
29480
  onPress: confirmJump,
29209
- style: [styles7.actionButton, { backgroundColor: accentColor }],
29481
+ style: [styles9.actionButton, { backgroundColor: accentColor }],
29210
29482
  testID: "papyrus-page-jump-confirm",
29211
- children: /* @__PURE__ */ jsx11(Text3, { style: [styles7.actionText, styles7.actionTextPrimary], children: "Ir" })
29483
+ children: /* @__PURE__ */ jsx13(Text3, { style: [styles9.actionText, styles9.actionTextPrimary], children: "Ir" })
29212
29484
  }
29213
29485
  )
29214
29486
  ] })
@@ -29216,7 +29488,7 @@ function PageJumpModal({
29216
29488
  }
29217
29489
  );
29218
29490
  }
29219
- var styles7 = StyleSheet7.create({
29491
+ var styles9 = StyleSheet9.create({
29220
29492
  input: {
29221
29493
  borderRadius: 14,
29222
29494
  borderWidth: 1,
@@ -29238,7 +29510,7 @@ var styles7 = StyleSheet7.create({
29238
29510
  });
29239
29511
 
29240
29512
  // components/Topbar.tsx
29241
- import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
29513
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
29242
29514
  var Topbar = ({
29243
29515
  engine,
29244
29516
  onOpenSettings,
@@ -29258,7 +29530,7 @@ var Topbar = ({
29258
29530
  triggerScrollToPage,
29259
29531
  accentColor,
29260
29532
  mobileChromeVisible
29261
- } = useViewerStore6();
29533
+ } = useViewerStore8();
29262
29534
  const [jumpModalOpen, setJumpModalOpen] = useState8(false);
29263
29535
  const isDark = uiTheme === "dark";
29264
29536
  const navIconColor = isDark ? "#e5e7eb" : "#111827";
@@ -29281,15 +29553,15 @@ var Topbar = ({
29281
29553
  }
29282
29554
  setJumpModalOpen(true);
29283
29555
  };
29284
- const defaultLogo = /* @__PURE__ */ jsx12(View8, { style: [styles8.logoBadge, { backgroundColor: accentColor }], children: /* @__PURE__ */ jsx12(Text4, { style: styles8.logoText, children: "P" }) });
29556
+ const defaultLogo = /* @__PURE__ */ jsx14(View10, { style: [styles10.logoBadge, { backgroundColor: accentColor }], children: /* @__PURE__ */ jsx14(Text4, { style: styles10.logoText, children: "P" }) });
29285
29557
  const logoElement = logo ?? defaultLogo;
29286
29558
  if (!mobileChromeVisible) return null;
29287
29559
  return /* @__PURE__ */ jsxs9(Fragment3, { children: [
29288
- /* @__PURE__ */ jsx12(
29289
- View8,
29560
+ /* @__PURE__ */ jsx14(
29561
+ View10,
29290
29562
  {
29291
29563
  style: [
29292
- styles8.chromeFrame,
29564
+ styles10.chromeFrame,
29293
29565
  {
29294
29566
  paddingTop: insets.top,
29295
29567
  paddingLeft: MOBILE_CHROME_METRICS.screenPadding + insets.left,
@@ -29299,50 +29571,50 @@ var Topbar = ({
29299
29571
  pointerEvents: "box-none",
29300
29572
  testID: "papyrus-floating-top-controls",
29301
29573
  children: /* @__PURE__ */ jsxs9(
29302
- View8,
29574
+ View10,
29303
29575
  {
29304
29576
  style: [
29305
- styles8.container,
29306
- isDark && styles8.containerDark,
29307
- isLandscape && styles8.containerLandscape
29577
+ styles10.container,
29578
+ isDark && styles10.containerDark,
29579
+ isLandscape && styles10.containerLandscape
29308
29580
  ],
29309
29581
  children: [
29310
- /* @__PURE__ */ jsxs9(View8, { style: styles8.leftGroup, children: [
29311
- onLogoPress ? /* @__PURE__ */ jsx12(
29582
+ /* @__PURE__ */ jsxs9(View10, { style: styles10.leftGroup, children: [
29583
+ onLogoPress ? /* @__PURE__ */ jsx14(
29312
29584
  Pressable6,
29313
29585
  {
29314
29586
  onPress: onLogoPress,
29315
29587
  accessibilityRole: "button",
29316
29588
  accessibilityLabel: logoAccessibilityLabel,
29317
- style: styles8.logoSlot,
29589
+ style: styles10.logoSlot,
29318
29590
  children: logoElement
29319
29591
  }
29320
- ) : /* @__PURE__ */ jsx12(View8, { style: styles8.logoSlot, children: logoElement }),
29321
- /* @__PURE__ */ jsx12(
29592
+ ) : /* @__PURE__ */ jsx14(View10, { style: styles10.logoSlot, children: logoElement }),
29593
+ /* @__PURE__ */ jsx14(
29322
29594
  Pressable6,
29323
29595
  {
29324
29596
  onPress: openJumpModal,
29325
29597
  disabled: pageCount <= 0,
29326
- style: styles8.titleHit,
29598
+ style: styles10.titleHit,
29327
29599
  accessibilityLabel: "Open page jump",
29328
- children: /* @__PURE__ */ jsx12(
29600
+ children: /* @__PURE__ */ jsx14(
29329
29601
  Text4,
29330
29602
  {
29331
29603
  numberOfLines: 1,
29332
- style: [styles8.brandText, isDark && styles8.brandTextDark],
29604
+ style: [styles10.brandText, isDark && styles10.brandTextDark],
29333
29605
  children: title ?? "Papyrus"
29334
29606
  }
29335
29607
  )
29336
29608
  }
29337
29609
  )
29338
29610
  ] }),
29339
- showPageNavigationControls ? /* @__PURE__ */ jsx12(View8, { style: styles8.pageGroup, children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
29340
- /* @__PURE__ */ jsx12(
29611
+ showPageNavigationControls ? /* @__PURE__ */ jsx14(View10, { style: styles10.pageGroup, children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
29612
+ /* @__PURE__ */ jsx14(
29341
29613
  Pressable6,
29342
29614
  {
29343
29615
  onPress: () => handlePageChange(-1),
29344
- style: [styles8.pageButton, isDark && styles8.pageButtonDark],
29345
- children: /* @__PURE__ */ jsx12(
29616
+ style: [styles10.pageButton, isDark && styles10.pageButtonDark],
29617
+ children: /* @__PURE__ */ jsx14(
29346
29618
  IconChevronLeft,
29347
29619
  {
29348
29620
  size: MOBILE_CHROME_METRICS.iconSize,
@@ -29351,18 +29623,18 @@ var Topbar = ({
29351
29623
  )
29352
29624
  }
29353
29625
  ),
29354
- /* @__PURE__ */ jsx12(
29626
+ /* @__PURE__ */ jsx14(
29355
29627
  Pressable6,
29356
29628
  {
29357
29629
  onPress: openJumpModal,
29358
- style: styles8.pageIndicatorHit,
29630
+ style: styles10.pageIndicatorHit,
29359
29631
  accessibilityLabel: "Page jump",
29360
29632
  children: /* @__PURE__ */ jsxs9(
29361
29633
  Text4,
29362
29634
  {
29363
29635
  style: [
29364
- styles8.pageIndicator,
29365
- isDark && styles8.pageIndicatorDark
29636
+ styles10.pageIndicator,
29637
+ isDark && styles10.pageIndicatorDark
29366
29638
  ],
29367
29639
  children: [
29368
29640
  currentPage,
@@ -29373,12 +29645,12 @@ var Topbar = ({
29373
29645
  )
29374
29646
  }
29375
29647
  ),
29376
- /* @__PURE__ */ jsx12(
29648
+ /* @__PURE__ */ jsx14(
29377
29649
  Pressable6,
29378
29650
  {
29379
29651
  onPress: () => handlePageChange(1),
29380
- style: [styles8.pageButton, isDark && styles8.pageButtonDark],
29381
- children: /* @__PURE__ */ jsx12(
29652
+ style: [styles10.pageButton, isDark && styles10.pageButtonDark],
29653
+ children: /* @__PURE__ */ jsx14(
29382
29654
  IconChevronRight,
29383
29655
  {
29384
29656
  size: MOBILE_CHROME_METRICS.iconSize,
@@ -29388,13 +29660,13 @@ var Topbar = ({
29388
29660
  }
29389
29661
  )
29390
29662
  ] }) }) : null,
29391
- /* @__PURE__ */ jsx12(View8, { style: styles8.rightGroup, children: /* @__PURE__ */ jsx12(
29663
+ /* @__PURE__ */ jsx14(View10, { style: styles10.rightGroup, children: /* @__PURE__ */ jsx14(
29392
29664
  Pressable6,
29393
29665
  {
29394
29666
  onPress: () => onOpenOverflow?.() ?? onOpenSettings?.(),
29395
- style: [styles8.iconButton, isDark && styles8.iconButtonDark],
29667
+ style: [styles10.iconButton, isDark && styles10.iconButtonDark],
29396
29668
  accessibilityLabel: "Open overflow menu",
29397
- children: /* @__PURE__ */ jsx12(
29669
+ children: /* @__PURE__ */ jsx14(
29398
29670
  IconSettings,
29399
29671
  {
29400
29672
  size: MOBILE_CHROME_METRICS.iconSize,
@@ -29408,7 +29680,7 @@ var Topbar = ({
29408
29680
  )
29409
29681
  }
29410
29682
  ),
29411
- /* @__PURE__ */ jsx12(
29683
+ /* @__PURE__ */ jsx14(
29412
29684
  PageJumpModal,
29413
29685
  {
29414
29686
  visible: jumpModalOpen,
@@ -29422,7 +29694,7 @@ var Topbar = ({
29422
29694
  )
29423
29695
  ] });
29424
29696
  };
29425
- var styles8 = StyleSheet8.create({
29697
+ var styles10 = StyleSheet10.create({
29426
29698
  container: {
29427
29699
  width: "100%",
29428
29700
  maxWidth: MOBILE_CHROME_METRICS.maxFloatingWidth,
@@ -29583,16 +29855,16 @@ var styles8 = StyleSheet8.create({
29583
29855
  var Topbar_default = Topbar;
29584
29856
 
29585
29857
  // components/ToolDock.tsx
29586
- import React11, { useEffect as useEffect8, useMemo as useMemo4, useRef as useRef7, useState as useState9 } from "react";
29858
+ import React13, { useEffect as useEffect10, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
29587
29859
  import {
29588
- View as View9,
29860
+ View as View11,
29589
29861
  Text as Text5,
29590
29862
  Pressable as Pressable7,
29591
- StyleSheet as StyleSheet9,
29863
+ StyleSheet as StyleSheet11,
29592
29864
  ScrollView as ScrollView3,
29593
29865
  useWindowDimensions as useWindowDimensions5
29594
29866
  } from "react-native";
29595
- import { useViewerStore as useViewerStore7 } from "@papyrus-sdk/core";
29867
+ import { useViewerStore as useViewerStore9 } from "@papyrus-sdk/core";
29596
29868
 
29597
29869
  // components/ToolDock.layout.ts
29598
29870
  var TOOL_DOCK_SCROLL_THRESHOLD = 420;
@@ -29620,7 +29892,7 @@ var resolveToolDockIconColor = ({
29620
29892
  };
29621
29893
 
29622
29894
  // components/ToolDock.tsx
29623
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
29895
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
29624
29896
  var COLOR_SWATCHES = [
29625
29897
  "#fbbf24",
29626
29898
  "#f97316",
@@ -29691,7 +29963,7 @@ var getToolVisual = (toolId) => {
29691
29963
  return { width: 24, iconSize: 28, offsetY: 6 };
29692
29964
  }
29693
29965
  };
29694
- var OpacitySlider = React11.memo(function OpacitySlider2({
29966
+ var OpacitySlider = React13.memo(function OpacitySlider2({
29695
29967
  value,
29696
29968
  color,
29697
29969
  isDark,
@@ -29702,13 +29974,13 @@ var OpacitySlider = React11.memo(function OpacitySlider2({
29702
29974
  const dragValueRef = useRef7(draftValue);
29703
29975
  const isDraggingRef = useRef7(false);
29704
29976
  const frameRef = useRef7(null);
29705
- useEffect8(() => {
29977
+ useEffect10(() => {
29706
29978
  if (!isDraggingRef.current) {
29707
29979
  dragValueRef.current = value;
29708
29980
  setDraftValue(value);
29709
29981
  }
29710
29982
  }, [value]);
29711
- useEffect8(() => {
29983
+ useEffect10(() => {
29712
29984
  return () => {
29713
29985
  if (frameRef.current !== null) {
29714
29986
  cancelAnimationFrame(frameRef.current);
@@ -29745,10 +30017,10 @@ var OpacitySlider = React11.memo(function OpacitySlider2({
29745
30017
  setDraftValue(next);
29746
30018
  onCommit(next);
29747
30019
  };
29748
- return /* @__PURE__ */ jsx13(View9, { style: styles9.opacitySliderWrap, children: /* @__PURE__ */ jsxs10(
29749
- View9,
30020
+ return /* @__PURE__ */ jsx15(View11, { style: styles11.opacitySliderWrap, children: /* @__PURE__ */ jsxs10(
30021
+ View11,
29750
30022
  {
29751
- style: styles9.opacityTouchSurface,
30023
+ style: styles11.opacityTouchSurface,
29752
30024
  onLayout: (event) => setTrackWidth(event.nativeEvent.layout.width),
29753
30025
  onStartShouldSetResponder: () => true,
29754
30026
  onMoveShouldSetResponder: () => true,
@@ -29757,12 +30029,12 @@ var OpacitySlider = React11.memo(function OpacitySlider2({
29757
30029
  onResponderRelease: commitDraft,
29758
30030
  onResponderTerminate: () => commitDraft(),
29759
30031
  children: [
29760
- /* @__PURE__ */ jsx13(View9, { style: styles9.opacityTrack }),
29761
- /* @__PURE__ */ jsx13(
29762
- View9,
30032
+ /* @__PURE__ */ jsx15(View11, { style: styles11.opacityTrack }),
30033
+ /* @__PURE__ */ jsx15(
30034
+ View11,
29763
30035
  {
29764
30036
  style: [
29765
- styles9.opacityTrackFill,
30037
+ styles11.opacityTrackFill,
29766
30038
  {
29767
30039
  width: fillWidth,
29768
30040
  backgroundColor: withInkAlpha(color, 0.92)
@@ -29770,11 +30042,11 @@ var OpacitySlider = React11.memo(function OpacitySlider2({
29770
30042
  ]
29771
30043
  }
29772
30044
  ),
29773
- /* @__PURE__ */ jsx13(
29774
- View9,
30045
+ /* @__PURE__ */ jsx15(
30046
+ View11,
29775
30047
  {
29776
30048
  style: [
29777
- styles9.opacityThumb,
30049
+ styles11.opacityThumb,
29778
30050
  {
29779
30051
  left: thumbOffset,
29780
30052
  borderColor: isDark ? "#0f172a" : "#ffffff"
@@ -29808,7 +30080,7 @@ var ToolDock = () => {
29808
30080
  annotationRedoStack,
29809
30081
  undoAnnotations,
29810
30082
  redoAnnotations
29811
- } = useViewerStore7();
30083
+ } = useViewerStore9();
29812
30084
  const [paletteExpanded, setPaletteExpanded] = useState9(false);
29813
30085
  const [extrasExpanded, setExtrasExpanded] = useState9(false);
29814
30086
  const isDark = uiTheme === "dark";
@@ -29820,7 +30092,7 @@ var ToolDock = () => {
29820
30092
  const iconColor = isDark ? "#e5e7eb" : "#111827";
29821
30093
  const labelColor = isDark ? "#e5e7eb" : "#374151";
29822
30094
  const utilityIconColor = isDark ? "#f8fafc" : "#111827";
29823
- const selectedTool = useMemo4(
30095
+ const selectedTool = useMemo6(
29824
30096
  () => ALL_TOOLS.find(
29825
30097
  (tool) => tool.id === "ink" || tool.id === "highlight" || tool.id === "underline" ? activeTool === "ink" && activeDrawToolPreset === tool.id : isToolDockToolSelected({
29826
30098
  toolId: tool.id,
@@ -29837,7 +30109,7 @@ var ToolDock = () => {
29837
30109
  const canUndo = annotationUndoStack.length > 0;
29838
30110
  const canRedo = annotationRedoStack.length > 0;
29839
30111
  const primaryToolsRowIsScrollable = shouldUseScrollablePrimaryToolsRow(windowWidth);
29840
- useEffect8(() => {
30112
+ useEffect10(() => {
29841
30113
  if (!nativeInkToolPickerActive) return;
29842
30114
  setPaletteExpanded(false);
29843
30115
  setExtrasExpanded(false);
@@ -29903,7 +30175,7 @@ var ToolDock = () => {
29903
30175
  accentColor,
29904
30176
  baseIconColor
29905
30177
  });
29906
- return /* @__PURE__ */ jsx13(
30178
+ return /* @__PURE__ */ jsx15(
29907
30179
  Pressable7,
29908
30180
  {
29909
30181
  onPress: () => {
@@ -29911,14 +30183,14 @@ var ToolDock = () => {
29911
30183
  if (compact) setExtrasExpanded(false);
29912
30184
  },
29913
30185
  style: [
29914
- compact ? styles9.compactToolButton : styles9.toolButton,
30186
+ compact ? styles11.compactToolButton : styles11.toolButton,
29915
30187
  { width: compact ? void 0 : visual.width }
29916
30188
  ],
29917
- children: /* @__PURE__ */ jsx13(
29918
- View9,
30189
+ children: /* @__PURE__ */ jsx15(
30190
+ View11,
29919
30191
  {
29920
30192
  style: [
29921
- compact ? styles9.compactToolIconWrap : styles9.toolIconWrap,
30193
+ compact ? styles11.compactToolIconWrap : styles11.toolIconWrap,
29922
30194
  {
29923
30195
  transform: [
29924
30196
  { translateY: compact ? 4 : visual.offsetY },
@@ -29927,7 +30199,7 @@ var ToolDock = () => {
29927
30199
  opacity: isSelected ? 1 : 0.92
29928
30200
  }
29929
30201
  ],
29930
- children: /* @__PURE__ */ jsx13(
30202
+ children: /* @__PURE__ */ jsx15(
29931
30203
  Icon,
29932
30204
  {
29933
30205
  size: compact ? 34 : visual.iconSize,
@@ -29940,40 +30212,40 @@ var ToolDock = () => {
29940
30212
  tool.id
29941
30213
  );
29942
30214
  };
29943
- return /* @__PURE__ */ jsx13(
29944
- View9,
30215
+ return /* @__PURE__ */ jsx15(
30216
+ View11,
29945
30217
  {
29946
30218
  pointerEvents: "box-none",
29947
- style: [styles9.root, { paddingBottom: chromeOffsets.toolDock }],
29948
- children: toolDockOpen ? /* @__PURE__ */ jsxs10(View9, { style: styles9.stack, children: [
29949
- paletteExpanded && showInkDockControls ? /* @__PURE__ */ jsx13(
29950
- View9,
30219
+ style: [styles11.root, { paddingBottom: chromeOffsets.toolDock }],
30220
+ children: toolDockOpen ? /* @__PURE__ */ jsxs10(View11, { style: styles11.stack, children: [
30221
+ paletteExpanded && showInkDockControls ? /* @__PURE__ */ jsx15(
30222
+ View11,
29951
30223
  {
29952
30224
  style: [
29953
- styles9.popup,
30225
+ styles11.popup,
29954
30226
  {
29955
30227
  backgroundColor: panelColor,
29956
30228
  borderColor
29957
30229
  }
29958
30230
  ],
29959
- children: /* @__PURE__ */ jsx13(View9, { style: styles9.swatchRow, children: COLOR_SWATCHES.map((color) => {
30231
+ children: /* @__PURE__ */ jsx15(View11, { style: styles11.swatchRow, children: COLOR_SWATCHES.map((color) => {
29960
30232
  const isSelected = annotationColor === color;
29961
- return /* @__PURE__ */ jsx13(
30233
+ return /* @__PURE__ */ jsx15(
29962
30234
  Pressable7,
29963
30235
  {
29964
30236
  onPress: () => setAnnotationColor(color),
29965
30237
  style: [
29966
- styles9.swatchOuter,
30238
+ styles11.swatchOuter,
29967
30239
  {
29968
30240
  borderColor: isSelected ? accentColor : "transparent",
29969
30241
  backgroundColor: isSelected ? `${accentColor}12` : "transparent"
29970
30242
  }
29971
30243
  ],
29972
- children: /* @__PURE__ */ jsx13(
29973
- View9,
30244
+ children: /* @__PURE__ */ jsx15(
30245
+ View11,
29974
30246
  {
29975
30247
  style: [
29976
- styles9.swatch,
30248
+ styles11.swatch,
29977
30249
  {
29978
30250
  backgroundColor: color,
29979
30251
  borderColor: color === "#f3f4f6" ? "#d1d5db" : "transparent"
@@ -29988,31 +30260,31 @@ var ToolDock = () => {
29988
30260
  }
29989
30261
  ) : null,
29990
30262
  inkSettingsExpanded && showInkDockControls ? /* @__PURE__ */ jsxs10(
29991
- View9,
30263
+ View11,
29992
30264
  {
29993
30265
  style: [
29994
- styles9.popup,
29995
- styles9.inkPopup,
30266
+ styles11.popup,
30267
+ styles11.inkPopup,
29996
30268
  {
29997
30269
  backgroundColor: panelColor,
29998
30270
  borderColor
29999
30271
  }
30000
30272
  ],
30001
30273
  children: [
30002
- /* @__PURE__ */ jsx13(View9, { style: styles9.inkPreviewRow, children: INK_WIDTHS.map((width) => {
30274
+ /* @__PURE__ */ jsx15(View11, { style: styles11.inkPreviewRow, children: INK_WIDTHS.map((width) => {
30003
30275
  const selected = Math.abs(inkStrokeWidth - width) < 5e-4;
30004
- return /* @__PURE__ */ jsx13(
30276
+ return /* @__PURE__ */ jsx15(
30005
30277
  Pressable7,
30006
30278
  {
30007
30279
  onPress: () => setInkStrokeWidth(width),
30008
30280
  style: [
30009
- styles9.inkWidthButton,
30281
+ styles11.inkWidthButton,
30010
30282
  selected && {
30011
30283
  backgroundColor: `${accentColor}12`,
30012
30284
  borderColor: `${accentColor}30`
30013
30285
  }
30014
30286
  ],
30015
- children: /* @__PURE__ */ jsx13(View9, { style: styles9.inkNib, children: /* @__PURE__ */ jsx13(
30287
+ children: /* @__PURE__ */ jsx15(View11, { style: styles11.inkNib, children: /* @__PURE__ */ jsx15(
30016
30288
  IconToolInk,
30017
30289
  {
30018
30290
  size: Math.round(18 + width * 1200),
@@ -30023,7 +30295,7 @@ var ToolDock = () => {
30023
30295
  width
30024
30296
  );
30025
30297
  }) }),
30026
- /* @__PURE__ */ jsx13(
30298
+ /* @__PURE__ */ jsx15(
30027
30299
  OpacitySlider,
30028
30300
  {
30029
30301
  value: annotationOpacity,
@@ -30035,55 +30307,55 @@ var ToolDock = () => {
30035
30307
  ]
30036
30308
  }
30037
30309
  ) : null,
30038
- extrasExpanded ? /* @__PURE__ */ jsx13(
30039
- View9,
30310
+ extrasExpanded ? /* @__PURE__ */ jsx15(
30311
+ View11,
30040
30312
  {
30041
30313
  style: [
30042
- styles9.popup,
30043
- styles9.extrasPopup,
30314
+ styles11.popup,
30315
+ styles11.extrasPopup,
30044
30316
  {
30045
30317
  backgroundColor: panelColor,
30046
30318
  borderColor
30047
30319
  }
30048
30320
  ],
30049
- children: /* @__PURE__ */ jsx13(View9, { style: styles9.compactToolsRow, children: EXTRA_TOOLS.map((tool) => renderToolButton(tool, true)) })
30321
+ children: /* @__PURE__ */ jsx15(View11, { style: styles11.compactToolsRow, children: EXTRA_TOOLS.map((tool) => renderToolButton(tool, true)) })
30050
30322
  }
30051
30323
  ) : null,
30052
- /* @__PURE__ */ jsx13(
30053
- View9,
30324
+ /* @__PURE__ */ jsx15(
30325
+ View11,
30054
30326
  {
30055
30327
  style: [
30056
- styles9.container,
30328
+ styles11.container,
30057
30329
  {
30058
30330
  backgroundColor: panelColor,
30059
30331
  borderColor
30060
30332
  }
30061
30333
  ],
30062
- children: primaryToolsRowIsScrollable ? /* @__PURE__ */ jsx13(
30334
+ children: primaryToolsRowIsScrollable ? /* @__PURE__ */ jsx15(
30063
30335
  ScrollView3,
30064
30336
  {
30065
30337
  horizontal: true,
30066
30338
  bounces: false,
30067
30339
  showsHorizontalScrollIndicator: false,
30068
- style: styles9.primaryToolsScrollView,
30340
+ style: styles11.primaryToolsScrollView,
30069
30341
  contentContainerStyle: [
30070
- styles9.primaryToolsRow,
30071
- styles9.primaryToolsRowScrollableContent
30342
+ styles11.primaryToolsRow,
30343
+ styles11.primaryToolsRowScrollableContent
30072
30344
  ],
30073
- children: /* @__PURE__ */ jsxs10(View9, { style: styles9.primaryToolsRowInner, children: [
30074
- /* @__PURE__ */ jsxs10(View9, { style: styles9.historyGroup, children: [
30075
- /* @__PURE__ */ jsx13(
30345
+ children: /* @__PURE__ */ jsxs10(View11, { style: styles11.primaryToolsRowInner, children: [
30346
+ /* @__PURE__ */ jsxs10(View11, { style: styles11.historyGroup, children: [
30347
+ /* @__PURE__ */ jsx15(
30076
30348
  Pressable7,
30077
30349
  {
30078
30350
  onPress: undoAnnotations,
30079
30351
  disabled: !canUndo,
30080
30352
  style: [
30081
- styles9.utilityButton,
30082
- styles9.historyButton,
30353
+ styles11.utilityButton,
30354
+ styles11.historyButton,
30083
30355
  { backgroundColor: buttonColor },
30084
- !canUndo && styles9.disabledButton
30356
+ !canUndo && styles11.disabledButton
30085
30357
  ],
30086
- children: /* @__PURE__ */ jsx13(
30358
+ children: /* @__PURE__ */ jsx15(
30087
30359
  IconUndo,
30088
30360
  {
30089
30361
  size: MOBILE_CHROME_METRICS.toolDockHistoryIconSize,
@@ -30093,18 +30365,18 @@ var ToolDock = () => {
30093
30365
  )
30094
30366
  }
30095
30367
  ),
30096
- /* @__PURE__ */ jsx13(
30368
+ /* @__PURE__ */ jsx15(
30097
30369
  Pressable7,
30098
30370
  {
30099
30371
  onPress: redoAnnotations,
30100
30372
  disabled: !canRedo,
30101
30373
  style: [
30102
- styles9.utilityButton,
30103
- styles9.historyButton,
30374
+ styles11.utilityButton,
30375
+ styles11.historyButton,
30104
30376
  { backgroundColor: buttonColor },
30105
- !canRedo && styles9.disabledButton
30377
+ !canRedo && styles11.disabledButton
30106
30378
  ],
30107
- children: /* @__PURE__ */ jsx13(
30379
+ children: /* @__PURE__ */ jsx15(
30108
30380
  IconRedo,
30109
30381
  {
30110
30382
  size: MOBILE_CHROME_METRICS.toolDockHistoryIconSize,
@@ -30115,9 +30387,9 @@ var ToolDock = () => {
30115
30387
  }
30116
30388
  )
30117
30389
  ] }),
30118
- /* @__PURE__ */ jsx13(View9, { style: styles9.toolsGroup, children: PRIMARY_TOOLS.map((tool) => renderToolButton(tool)) }),
30119
- /* @__PURE__ */ jsxs10(View9, { style: styles9.controlsGroup, children: [
30120
- /* @__PURE__ */ jsx13(
30390
+ /* @__PURE__ */ jsx15(View11, { style: styles11.toolsGroup, children: PRIMARY_TOOLS.map((tool) => renderToolButton(tool)) }),
30391
+ /* @__PURE__ */ jsxs10(View11, { style: styles11.controlsGroup, children: [
30392
+ /* @__PURE__ */ jsx15(
30121
30393
  Pressable7,
30122
30394
  {
30123
30395
  onPress: () => {
@@ -30125,16 +30397,16 @@ var ToolDock = () => {
30125
30397
  setPaletteExpanded(false);
30126
30398
  },
30127
30399
  style: [
30128
- styles9.utilityButton,
30400
+ styles11.utilityButton,
30129
30401
  {
30130
30402
  backgroundColor: extrasExpanded ? `${accentColor}12` : buttonColor
30131
30403
  }
30132
30404
  ],
30133
- children: /* @__PURE__ */ jsx13(
30405
+ children: /* @__PURE__ */ jsx15(
30134
30406
  Text5,
30135
30407
  {
30136
30408
  style: [
30137
- styles9.utilityLabel,
30409
+ styles11.utilityLabel,
30138
30410
  { color: extrasExpanded ? accentColor : utilityIconColor }
30139
30411
  ],
30140
30412
  children: "+"
@@ -30142,15 +30414,15 @@ var ToolDock = () => {
30142
30414
  )
30143
30415
  }
30144
30416
  ),
30145
- /* @__PURE__ */ jsx13(
30417
+ /* @__PURE__ */ jsx15(
30146
30418
  Pressable7,
30147
30419
  {
30148
30420
  onPress: () => {
30149
30421
  setPaletteExpanded((value) => !value);
30150
30422
  setExtrasExpanded(false);
30151
30423
  },
30152
- style: styles9.colorButton,
30153
- children: /* @__PURE__ */ jsx13(
30424
+ style: styles11.colorButton,
30425
+ children: /* @__PURE__ */ jsx15(
30154
30426
  IconColorRing,
30155
30427
  {
30156
30428
  size: 30,
@@ -30160,7 +30432,7 @@ var ToolDock = () => {
30160
30432
  )
30161
30433
  }
30162
30434
  ),
30163
- /* @__PURE__ */ jsx13(
30435
+ /* @__PURE__ */ jsx15(
30164
30436
  Pressable7,
30165
30437
  {
30166
30438
  onPress: () => setDocumentState(
@@ -30170,10 +30442,10 @@ var ToolDock = () => {
30170
30442
  })
30171
30443
  ),
30172
30444
  style: [
30173
- styles9.utilityButton,
30445
+ styles11.utilityButton,
30174
30446
  { backgroundColor: buttonColor }
30175
30447
  ],
30176
- children: /* @__PURE__ */ jsx13(
30448
+ children: /* @__PURE__ */ jsx15(
30177
30449
  IconClose,
30178
30450
  {
30179
30451
  size: 15,
@@ -30186,20 +30458,20 @@ var ToolDock = () => {
30186
30458
  ] })
30187
30459
  ] })
30188
30460
  }
30189
- ) : /* @__PURE__ */ jsxs10(View9, { style: styles9.primaryToolsRow, children: [
30190
- /* @__PURE__ */ jsxs10(View9, { style: styles9.historyGroup, children: [
30191
- /* @__PURE__ */ jsx13(
30461
+ ) : /* @__PURE__ */ jsxs10(View11, { style: styles11.primaryToolsRow, children: [
30462
+ /* @__PURE__ */ jsxs10(View11, { style: styles11.historyGroup, children: [
30463
+ /* @__PURE__ */ jsx15(
30192
30464
  Pressable7,
30193
30465
  {
30194
30466
  onPress: undoAnnotations,
30195
30467
  disabled: !canUndo,
30196
30468
  style: [
30197
- styles9.utilityButton,
30198
- styles9.historyButton,
30469
+ styles11.utilityButton,
30470
+ styles11.historyButton,
30199
30471
  { backgroundColor: buttonColor },
30200
- !canUndo && styles9.disabledButton
30472
+ !canUndo && styles11.disabledButton
30201
30473
  ],
30202
- children: /* @__PURE__ */ jsx13(
30474
+ children: /* @__PURE__ */ jsx15(
30203
30475
  IconUndo,
30204
30476
  {
30205
30477
  size: MOBILE_CHROME_METRICS.toolDockHistoryIconSize,
@@ -30209,18 +30481,18 @@ var ToolDock = () => {
30209
30481
  )
30210
30482
  }
30211
30483
  ),
30212
- /* @__PURE__ */ jsx13(
30484
+ /* @__PURE__ */ jsx15(
30213
30485
  Pressable7,
30214
30486
  {
30215
30487
  onPress: redoAnnotations,
30216
30488
  disabled: !canRedo,
30217
30489
  style: [
30218
- styles9.utilityButton,
30219
- styles9.historyButton,
30490
+ styles11.utilityButton,
30491
+ styles11.historyButton,
30220
30492
  { backgroundColor: buttonColor },
30221
- !canRedo && styles9.disabledButton
30493
+ !canRedo && styles11.disabledButton
30222
30494
  ],
30223
- children: /* @__PURE__ */ jsx13(
30495
+ children: /* @__PURE__ */ jsx15(
30224
30496
  IconRedo,
30225
30497
  {
30226
30498
  size: MOBILE_CHROME_METRICS.toolDockHistoryIconSize,
@@ -30231,9 +30503,9 @@ var ToolDock = () => {
30231
30503
  }
30232
30504
  )
30233
30505
  ] }),
30234
- /* @__PURE__ */ jsx13(View9, { style: styles9.toolsGroup, children: PRIMARY_TOOLS.map((tool) => renderToolButton(tool)) }),
30235
- /* @__PURE__ */ jsxs10(View9, { style: styles9.controlsGroup, children: [
30236
- /* @__PURE__ */ jsx13(
30506
+ /* @__PURE__ */ jsx15(View11, { style: styles11.toolsGroup, children: PRIMARY_TOOLS.map((tool) => renderToolButton(tool)) }),
30507
+ /* @__PURE__ */ jsxs10(View11, { style: styles11.controlsGroup, children: [
30508
+ /* @__PURE__ */ jsx15(
30237
30509
  Pressable7,
30238
30510
  {
30239
30511
  onPress: () => {
@@ -30241,16 +30513,16 @@ var ToolDock = () => {
30241
30513
  setPaletteExpanded(false);
30242
30514
  },
30243
30515
  style: [
30244
- styles9.utilityButton,
30516
+ styles11.utilityButton,
30245
30517
  {
30246
30518
  backgroundColor: extrasExpanded ? `${accentColor}12` : buttonColor
30247
30519
  }
30248
30520
  ],
30249
- children: /* @__PURE__ */ jsx13(
30521
+ children: /* @__PURE__ */ jsx15(
30250
30522
  Text5,
30251
30523
  {
30252
30524
  style: [
30253
- styles9.utilityLabel,
30525
+ styles11.utilityLabel,
30254
30526
  { color: extrasExpanded ? accentColor : utilityIconColor }
30255
30527
  ],
30256
30528
  children: "+"
@@ -30258,15 +30530,15 @@ var ToolDock = () => {
30258
30530
  )
30259
30531
  }
30260
30532
  ),
30261
- /* @__PURE__ */ jsx13(
30533
+ /* @__PURE__ */ jsx15(
30262
30534
  Pressable7,
30263
30535
  {
30264
30536
  onPress: () => {
30265
30537
  setPaletteExpanded((value) => !value);
30266
30538
  setExtrasExpanded(false);
30267
30539
  },
30268
- style: styles9.colorButton,
30269
- children: /* @__PURE__ */ jsx13(
30540
+ style: styles11.colorButton,
30541
+ children: /* @__PURE__ */ jsx15(
30270
30542
  IconColorRing,
30271
30543
  {
30272
30544
  size: 30,
@@ -30276,7 +30548,7 @@ var ToolDock = () => {
30276
30548
  )
30277
30549
  }
30278
30550
  ),
30279
- /* @__PURE__ */ jsx13(
30551
+ /* @__PURE__ */ jsx15(
30280
30552
  Pressable7,
30281
30553
  {
30282
30554
  onPress: () => setDocumentState(
@@ -30285,8 +30557,8 @@ var ToolDock = () => {
30285
30557
  interactionMode
30286
30558
  })
30287
30559
  ),
30288
- style: [styles9.utilityButton, { backgroundColor: buttonColor }],
30289
- children: /* @__PURE__ */ jsx13(
30560
+ style: [styles11.utilityButton, { backgroundColor: buttonColor }],
30561
+ children: /* @__PURE__ */ jsx15(
30290
30562
  IconClose,
30291
30563
  {
30292
30564
  size: 15,
@@ -30304,9 +30576,9 @@ var ToolDock = () => {
30304
30576
  }
30305
30577
  );
30306
30578
  };
30307
- var styles9 = StyleSheet9.create({
30579
+ var styles11 = StyleSheet11.create({
30308
30580
  root: {
30309
- ...StyleSheet9.absoluteFillObject,
30581
+ ...StyleSheet11.absoluteFillObject,
30310
30582
  alignItems: "center",
30311
30583
  justifyContent: "flex-end",
30312
30584
  paddingHorizontal: MOBILE_CHROME_METRICS.screenPadding,
@@ -30551,8 +30823,8 @@ var ToolDock_default = ToolDock;
30551
30823
  // components/RightSheet.tsx
30552
30824
  import {
30553
30825
  useCallback as useCallback5,
30554
- useEffect as useEffect9,
30555
- useMemo as useMemo5,
30826
+ useEffect as useEffect11,
30827
+ useMemo as useMemo7,
30556
30828
  useRef as useRef8,
30557
30829
  useState as useState10
30558
30830
  } from "react";
@@ -30560,14 +30832,14 @@ import {
30560
30832
  Image as Image2,
30561
30833
  Platform as Platform5,
30562
30834
  Pressable as Pressable8,
30563
- StyleSheet as StyleSheet10,
30835
+ StyleSheet as StyleSheet12,
30564
30836
  Text as Text6,
30565
30837
  UIManager,
30566
- View as View10,
30838
+ View as View12,
30567
30839
  findNodeHandle as findNodeHandle2,
30568
30840
  useWindowDimensions as useWindowDimensions6
30569
30841
  } from "react-native";
30570
- import { useViewerStore as useViewerStore8 } from "@papyrus-sdk/core";
30842
+ import { useViewerStore as useViewerStore10 } from "@papyrus-sdk/core";
30571
30843
  import { PapyrusPageView as PapyrusPageView2 } from "@papyrus-sdk/engine-native";
30572
30844
 
30573
30845
  // components/rightSheetLayout.ts
@@ -30598,7 +30870,7 @@ var resolveNoteQuoteParts = (content) => ({
30598
30870
  });
30599
30871
 
30600
30872
  // components/RightSheet.tsx
30601
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
30873
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
30602
30874
  var THUMBNAILS_INITIAL_NUM_TO_RENDER = 4;
30603
30875
  var THUMBNAILS_WINDOW_SIZE = 5;
30604
30876
  var THUMBNAILS_MAX_TO_RENDER_PER_BATCH = 6;
@@ -30635,7 +30907,7 @@ var PageThumbnail = ({
30635
30907
  const viewRef = useRef8(null);
30636
30908
  const [layoutReady, setLayoutReady] = useState10(false);
30637
30909
  const [previewUri, setPreviewUri] = useState10(null);
30638
- useEffect9(() => {
30910
+ useEffect11(() => {
30639
30911
  if (!layoutReady || !useNativePreview || !shouldRenderPreview) return;
30640
30912
  const viewTag = findNodeHandle2(viewRef.current);
30641
30913
  if (!viewTag) return;
@@ -30650,7 +30922,7 @@ var PageThumbnail = ({
30650
30922
  useNativePreview,
30651
30923
  zoom
30652
30924
  ]);
30653
- useEffect9(() => {
30925
+ useEffect11(() => {
30654
30926
  if (!useImagePreview || !shouldRenderPreview) {
30655
30927
  setPreviewUri(null);
30656
30928
  return;
@@ -30678,35 +30950,35 @@ var PageThumbnail = ({
30678
30950
  {
30679
30951
  onPress,
30680
30952
  style: [
30681
- styles10.thumbCard,
30953
+ styles12.thumbCard,
30682
30954
  { width: cardWidth },
30683
- isDark && styles10.thumbCardDark,
30684
- isActive && styles10.thumbCardActive,
30955
+ isDark && styles12.thumbCardDark,
30956
+ isActive && styles12.thumbCardActive,
30685
30957
  isActive && { borderColor: accentColor }
30686
30958
  ],
30687
30959
  children: [
30688
- /* @__PURE__ */ jsx14(
30689
- View10,
30960
+ /* @__PURE__ */ jsx16(
30961
+ View12,
30690
30962
  {
30691
30963
  onLayout: handleLayout,
30692
- style: [styles10.thumbFrame, { width: frameWidth, height: frameHeight }],
30693
- children: useNativePreview && shouldRenderPreview ? /* @__PURE__ */ jsx14(PapyrusPageView2, { ref: viewRef, style: styles10.thumbView }) : useImagePreview && shouldRenderPreview && previewUri ? /* @__PURE__ */ jsx14(
30964
+ style: [styles12.thumbFrame, { width: frameWidth, height: frameHeight }],
30965
+ children: useNativePreview && shouldRenderPreview ? /* @__PURE__ */ jsx16(PapyrusPageView2, { ref: viewRef, style: styles12.thumbView }) : useImagePreview && shouldRenderPreview && previewUri ? /* @__PURE__ */ jsx16(
30694
30966
  Image2,
30695
30967
  {
30696
30968
  source: { uri: previewUri },
30697
30969
  resizeMode: "contain",
30698
- style: styles10.thumbImage
30970
+ style: styles12.thumbImage
30699
30971
  }
30700
- ) : /* @__PURE__ */ jsx14(
30701
- View10,
30972
+ ) : /* @__PURE__ */ jsx16(
30973
+ View12,
30702
30974
  {
30703
- style: [styles10.thumbFallback, isDark && styles10.thumbFallbackDark],
30704
- children: /* @__PURE__ */ jsx14(
30975
+ style: [styles12.thumbFallback, isDark && styles12.thumbFallbackDark],
30976
+ children: /* @__PURE__ */ jsx16(
30705
30977
  Text6,
30706
30978
  {
30707
30979
  style: [
30708
- styles10.thumbFallbackText,
30709
- isDark && styles10.thumbFallbackTextDark
30980
+ styles12.thumbFallbackText,
30981
+ isDark && styles12.thumbFallbackTextDark
30710
30982
  ],
30711
30983
  children: pageIndex + 1
30712
30984
  }
@@ -30715,7 +30987,7 @@ var PageThumbnail = ({
30715
30987
  )
30716
30988
  }
30717
30989
  ),
30718
- /* @__PURE__ */ jsx14(Text6, { style: [styles10.thumbLabel, isDark && styles10.thumbLabelDark], children: pageIndex + 1 })
30990
+ /* @__PURE__ */ jsx16(Text6, { style: [styles12.thumbLabel, isDark && styles12.thumbLabelDark], children: pageIndex + 1 })
30719
30991
  ]
30720
30992
  }
30721
30993
  );
@@ -30723,21 +30995,21 @@ var PageThumbnail = ({
30723
30995
  var OutlineNode = ({ item, depth = 0, isDark, onSelect, untitledLabel }) => {
30724
30996
  const hasChildren = item.children && item.children.length > 0;
30725
30997
  const isClickable = item.pageIndex >= 0;
30726
- return /* @__PURE__ */ jsxs11(View10, { children: [
30727
- /* @__PURE__ */ jsx14(
30998
+ return /* @__PURE__ */ jsxs11(View12, { children: [
30999
+ /* @__PURE__ */ jsx16(
30728
31000
  Pressable8,
30729
31001
  {
30730
31002
  onPress: () => {
30731
31003
  if (isClickable) onSelect(item.pageIndex);
30732
31004
  },
30733
- style: [styles10.outlineRow, { paddingLeft: 12 + depth * 12 }],
30734
- children: /* @__PURE__ */ jsx14(
31005
+ style: [styles12.outlineRow, { paddingLeft: 12 + depth * 12 }],
31006
+ children: /* @__PURE__ */ jsx16(
30735
31007
  Text6,
30736
31008
  {
30737
31009
  style: [
30738
- styles10.outlineText,
30739
- isDark && styles10.outlineTextDark,
30740
- !isClickable && styles10.outlineTextMuted
31010
+ styles12.outlineText,
31011
+ isDark && styles12.outlineTextDark,
31012
+ !isClickable && styles12.outlineTextMuted
30741
31013
  ],
30742
31014
  numberOfLines: 2,
30743
31015
  children: item.title || untitledLabel
@@ -30745,7 +31017,7 @@ var OutlineNode = ({ item, depth = 0, isDark, onSelect, untitledLabel }) => {
30745
31017
  )
30746
31018
  }
30747
31019
  ),
30748
- hasChildren ? item.children.map((child, index) => /* @__PURE__ */ jsx14(
31020
+ hasChildren ? item.children.map((child, index) => /* @__PURE__ */ jsx16(
30749
31021
  OutlineNode,
30750
31022
  {
30751
31023
  item: child,
@@ -30779,12 +31051,12 @@ var RightSheet = ({
30779
31051
  zoom,
30780
31052
  locale,
30781
31053
  accentColor
30782
- } = useViewerStore8();
31054
+ } = useViewerStore10();
30783
31055
  const { height: windowHeight, width: windowWidth } = useWindowDimensions6();
30784
31056
  const [pagesMode, setPagesMode] = useState10(
30785
31057
  documentType === "pdf" || documentType === "comic" ? "thumbnails" : "summary"
30786
31058
  );
30787
- useEffect9(() => {
31059
+ useEffect11(() => {
30788
31060
  setPagesMode(
30789
31061
  documentType === "pdf" || documentType === "comic" ? "thumbnails" : "summary"
30790
31062
  );
@@ -30810,7 +31082,7 @@ var RightSheet = ({
30810
31082
  const thumbnailRefreshTimeoutRef = useRef8(null);
30811
31083
  const [thumbnailLayoutRevision, setThumbnailLayoutRevision] = useState10(0);
30812
31084
  const [visibleThumbnailPages, setVisibleThumbnailPages] = useState10(() => /* @__PURE__ */ new Set());
30813
- const resolvedThumbsInitialCount = useMemo5(
31085
+ const resolvedThumbsInitialCount = useMemo7(
30814
31086
  () => resolvePositiveInt2(
30815
31087
  thumbsInitialCount,
30816
31088
  THUMBNAILS_INITIAL_NUM_TO_RENDER,
@@ -30879,7 +31151,7 @@ var RightSheet = ({
30879
31151
  },
30880
31152
  [frameWidth, thumbnailLayoutRevision]
30881
31153
  );
30882
- useEffect9(
31154
+ useEffect11(
30883
31155
  () => () => {
30884
31156
  if (thumbnailRefreshTimeoutRef.current) {
30885
31157
  clearTimeout(thumbnailRefreshTimeoutRef.current);
@@ -30887,11 +31159,11 @@ var RightSheet = ({
30887
31159
  },
30888
31160
  []
30889
31161
  );
30890
- useEffect9(() => {
31162
+ useEffect11(() => {
30891
31163
  if (sidebarRightOpen) return;
30892
31164
  setVisibleThumbnailPages(/* @__PURE__ */ new Set());
30893
31165
  }, [sidebarRightOpen]);
30894
- useEffect9(() => {
31166
+ useEffect11(() => {
30895
31167
  if (!sidebarRightOpen || sidebarRightTab !== "pages") return;
30896
31168
  if (activeMobileDestination === "pages") {
30897
31169
  setPagesMode("thumbnails");
@@ -30899,7 +31171,7 @@ var RightSheet = ({
30899
31171
  }
30900
31172
  setPagesMode("summary");
30901
31173
  }, [activeMobileDestination, sidebarRightOpen, sidebarRightTab]);
30902
- useEffect9(() => {
31174
+ useEffect11(() => {
30903
31175
  if (!sidebarRightOpen || sidebarRightTab !== "pages") return;
30904
31176
  if (pagesMode !== "thumbnails" || !supportsThumbnails) return;
30905
31177
  if (pageCount <= 0) return;
@@ -30929,11 +31201,11 @@ var RightSheet = ({
30929
31201
  sidebarRightTab,
30930
31202
  supportsThumbnails
30931
31203
  ]);
30932
- const pages = useMemo5(
31204
+ const pages = useMemo7(
30933
31205
  () => Array.from({ length: pageCount }, (_, i) => i),
30934
31206
  [pageCount]
30935
31207
  );
30936
- const progressEntries = useMemo5(
31208
+ const progressEntries = useMemo7(
30937
31209
  () => pages.map((pageIndex) => ({
30938
31210
  pageIndex,
30939
31211
  percent: pageCount <= 1 ? 100 : Math.round((pageIndex + 1) / pageCount * 100)
@@ -30960,7 +31232,7 @@ var RightSheet = ({
30960
31232
  const renderThumbnailItem = useCallback5(
30961
31233
  ({ item }) => {
30962
31234
  const shouldRenderPreview = (useNativePreview || useImagePreview) && (visibleThumbnailPages.has(item) || item < resolvedThumbsPrewarmCount || Math.abs(item + 1 - currentPage) <= 1);
30963
- return /* @__PURE__ */ jsx14(
31235
+ return /* @__PURE__ */ jsx16(
30964
31236
  PageThumbnail,
30965
31237
  {
30966
31238
  engine,
@@ -30996,7 +31268,7 @@ var RightSheet = ({
30996
31268
  ]
30997
31269
  );
30998
31270
  if (!sidebarRightOpen) return null;
30999
- return /* @__PURE__ */ jsx14(
31271
+ return /* @__PURE__ */ jsx16(
31000
31272
  NativeSheet,
31001
31273
  {
31002
31274
  visible: sidebarRightOpen,
@@ -31008,20 +31280,20 @@ var RightSheet = ({
31008
31280
  backgroundColor: palette.surface,
31009
31281
  borderTopColor: palette.divider
31010
31282
  },
31011
- children: /* @__PURE__ */ jsxs11(View10, { style: styles10.sheet, children: [
31012
- /* @__PURE__ */ jsxs11(View10, { style: styles10.header, children: [
31013
- /* @__PURE__ */ jsx14(Text6, { style: [styles10.sheetTitle, isDark && styles10.sheetTitleDark], children: showingNotes ? t.notes : navigationTitle }),
31014
- !showingNotes ? /* @__PURE__ */ jsx14(
31283
+ children: /* @__PURE__ */ jsxs11(View12, { style: styles12.sheet, children: [
31284
+ /* @__PURE__ */ jsxs11(View12, { style: styles12.header, children: [
31285
+ /* @__PURE__ */ jsx16(Text6, { style: [styles12.sheetTitle, isDark && styles12.sheetTitleDark], children: showingNotes ? t.notes : navigationTitle }),
31286
+ !showingNotes ? /* @__PURE__ */ jsx16(
31015
31287
  Pressable8,
31016
31288
  {
31017
31289
  onPress: showingProgress ? void 0 : onOpenPageJump,
31018
31290
  disabled: showingProgress || pageCount <= 0,
31019
- style: styles10.pageStatusHit,
31291
+ style: styles12.pageStatusHit,
31020
31292
  accessibilityLabel: "Open page jump",
31021
- children: /* @__PURE__ */ jsx14(
31293
+ children: /* @__PURE__ */ jsx16(
31022
31294
  Text6,
31023
31295
  {
31024
- style: [styles10.pageStatus, isDark && styles10.pageStatusDark],
31296
+ style: [styles12.pageStatus, isDark && styles12.pageStatusDark],
31025
31297
  children: showingProgress ? `${Math.round(
31026
31298
  currentPage / Math.max(pageCount, 1) * 100
31027
31299
  )}%` : `${currentPage}/${pageCount}`
@@ -31029,65 +31301,65 @@ var RightSheet = ({
31029
31301
  )
31030
31302
  }
31031
31303
  ) : null,
31032
- /* @__PURE__ */ jsx14(
31304
+ /* @__PURE__ */ jsx16(
31033
31305
  Pressable8,
31034
31306
  {
31035
31307
  accessibilityRole: "button",
31036
31308
  accessibilityLabel: `${t.close} ${showingNotes ? t.notes.toLowerCase() : t.contents.toLowerCase()}`,
31037
31309
  onPress: closeSheet,
31038
- style: [styles10.closeButton, isDark && styles10.closeButtonDark],
31039
- children: /* @__PURE__ */ jsx14(IconClose, { size: 18, color: palette.text })
31310
+ style: [styles12.closeButton, isDark && styles12.closeButtonDark],
31311
+ children: /* @__PURE__ */ jsx16(IconClose, { size: 18, color: palette.text })
31040
31312
  }
31041
31313
  )
31042
31314
  ] }),
31043
- !showingNotes ? /* @__PURE__ */ jsxs11(View10, { style: styles10.pagesContent, children: [
31044
- !showingProgress ? /* @__PURE__ */ jsx14(View10, { style: styles10.pageHeader, children: /* @__PURE__ */ jsxs11(
31045
- View10,
31315
+ !showingNotes ? /* @__PURE__ */ jsxs11(View12, { style: styles12.pagesContent, children: [
31316
+ !showingProgress ? /* @__PURE__ */ jsx16(View12, { style: styles12.pageHeader, children: /* @__PURE__ */ jsxs11(
31317
+ View12,
31046
31318
  {
31047
- style: [styles10.segmented, isDark && styles10.segmentedDark],
31319
+ style: [styles12.segmented, isDark && styles12.segmentedDark],
31048
31320
  children: [
31049
- supportsThumbnails ? /* @__PURE__ */ jsx14(
31321
+ supportsThumbnails ? /* @__PURE__ */ jsx16(
31050
31322
  Pressable8,
31051
31323
  {
31052
31324
  onPress: () => setPagesMode("thumbnails"),
31053
31325
  style: [
31054
- styles10.segmentButton,
31055
- pagesMode === "thumbnails" && styles10.segmentButtonActive,
31326
+ styles12.segmentButton,
31327
+ pagesMode === "thumbnails" && styles12.segmentButtonActive,
31056
31328
  pagesMode === "thumbnails" && {
31057
31329
  backgroundColor: accentColor
31058
31330
  }
31059
31331
  ],
31060
- children: /* @__PURE__ */ jsx14(
31332
+ children: /* @__PURE__ */ jsx16(
31061
31333
  Text6,
31062
31334
  {
31063
31335
  style: [
31064
- styles10.segmentText,
31065
- isDark && styles10.segmentTextDark,
31066
- pagesMode === "thumbnails" && styles10.segmentTextActive
31336
+ styles12.segmentText,
31337
+ isDark && styles12.segmentTextDark,
31338
+ pagesMode === "thumbnails" && styles12.segmentTextActive
31067
31339
  ],
31068
31340
  children: thumbnailLabel
31069
31341
  }
31070
31342
  )
31071
31343
  }
31072
31344
  ) : null,
31073
- /* @__PURE__ */ jsx14(
31345
+ /* @__PURE__ */ jsx16(
31074
31346
  Pressable8,
31075
31347
  {
31076
31348
  onPress: () => setPagesMode("summary"),
31077
31349
  style: [
31078
- styles10.segmentButton,
31079
- pagesMode === "summary" && styles10.segmentButtonActive,
31350
+ styles12.segmentButton,
31351
+ pagesMode === "summary" && styles12.segmentButtonActive,
31080
31352
  pagesMode === "summary" && {
31081
31353
  backgroundColor: accentColor
31082
31354
  }
31083
31355
  ],
31084
- children: /* @__PURE__ */ jsx14(
31356
+ children: /* @__PURE__ */ jsx16(
31085
31357
  Text6,
31086
31358
  {
31087
31359
  style: [
31088
- styles10.segmentText,
31089
- isDark && styles10.segmentTextDark,
31090
- pagesMode === "summary" && styles10.segmentTextActive
31360
+ styles12.segmentText,
31361
+ isDark && styles12.segmentTextDark,
31362
+ pagesMode === "summary" && styles12.segmentTextActive
31091
31363
  ],
31092
31364
  children: summaryLabel
31093
31365
  }
@@ -31097,14 +31369,14 @@ var RightSheet = ({
31097
31369
  ]
31098
31370
  }
31099
31371
  ) }) : null,
31100
- supportsThumbnails && !showingProgress && pagesMode === "thumbnails" ? /* @__PURE__ */ jsx14(
31372
+ supportsThumbnails && !showingProgress && pagesMode === "thumbnails" ? /* @__PURE__ */ jsx16(
31101
31373
  NativeSheetFlatList,
31102
31374
  {
31103
31375
  data: pages,
31104
31376
  keyExtractor: (item) => `thumb-${item}`,
31105
31377
  numColumns: 2,
31106
- contentContainerStyle: styles10.thumbGrid,
31107
- columnWrapperStyle: styles10.thumbRow,
31378
+ contentContainerStyle: styles12.thumbGrid,
31379
+ columnWrapperStyle: styles12.thumbRow,
31108
31380
  showsVerticalScrollIndicator: false,
31109
31381
  initialNumToRender: normalizedThumbsInitialCount,
31110
31382
  windowSize: THUMBNAILS_WINDOW_SIZE,
@@ -31117,10 +31389,10 @@ var RightSheet = ({
31117
31389
  onViewableItemsChanged: onThumbnailsViewableItemsChanged,
31118
31390
  renderItem: renderThumbnailItem
31119
31391
  }
31120
- ) : showingProgress ? /* @__PURE__ */ jsx14(
31392
+ ) : showingProgress ? /* @__PURE__ */ jsx16(
31121
31393
  NativeSheetScrollView,
31122
31394
  {
31123
- contentContainerStyle: styles10.summaryContent,
31395
+ contentContainerStyle: styles12.summaryContent,
31124
31396
  showsVerticalScrollIndicator: false,
31125
31397
  children: progressEntries.map((entry) => {
31126
31398
  const isActive = entry.pageIndex + 1 === currentPage;
@@ -31129,8 +31401,8 @@ var RightSheet = ({
31129
31401
  {
31130
31402
  onPress: () => jumpToPage(entry.pageIndex),
31131
31403
  style: [
31132
- styles10.progressRow,
31133
- isDark && styles10.progressRowDark,
31404
+ styles12.progressRow,
31405
+ isDark && styles12.progressRowDark,
31134
31406
  isActive && { borderColor: accentColor }
31135
31407
  ],
31136
31408
  children: [
@@ -31138,8 +31410,8 @@ var RightSheet = ({
31138
31410
  Text6,
31139
31411
  {
31140
31412
  style: [
31141
- styles10.progressLabel,
31142
- isDark && styles10.progressLabelDark
31413
+ styles12.progressLabel,
31414
+ isDark && styles12.progressLabelDark
31143
31415
  ],
31144
31416
  children: [
31145
31417
  entry.percent,
@@ -31151,8 +31423,8 @@ var RightSheet = ({
31151
31423
  Text6,
31152
31424
  {
31153
31425
  style: [
31154
- styles10.progressMeta,
31155
- isDark && styles10.progressMetaDark
31426
+ styles12.progressMeta,
31427
+ isDark && styles12.progressMetaDark
31156
31428
  ],
31157
31429
  children: [
31158
31430
  t.page,
@@ -31167,18 +31439,18 @@ var RightSheet = ({
31167
31439
  );
31168
31440
  })
31169
31441
  }
31170
- ) : /* @__PURE__ */ jsx14(
31442
+ ) : /* @__PURE__ */ jsx16(
31171
31443
  NativeSheetScrollView,
31172
31444
  {
31173
- contentContainerStyle: styles10.summaryContent,
31445
+ contentContainerStyle: styles12.summaryContent,
31174
31446
  showsVerticalScrollIndicator: false,
31175
- children: outline.length === 0 ? /* @__PURE__ */ jsx14(
31447
+ children: outline.length === 0 ? /* @__PURE__ */ jsx16(
31176
31448
  Text6,
31177
31449
  {
31178
- style: [styles10.emptyText, isDark && styles10.emptyTextDark],
31450
+ style: [styles12.emptyText, isDark && styles12.emptyTextDark],
31179
31451
  children: t.noSummary
31180
31452
  }
31181
- ) : outline.map((item, index) => /* @__PURE__ */ jsx14(
31453
+ ) : outline.map((item, index) => /* @__PURE__ */ jsx16(
31182
31454
  OutlineNode,
31183
31455
  {
31184
31456
  item,
@@ -31190,12 +31462,12 @@ var RightSheet = ({
31190
31462
  ))
31191
31463
  }
31192
31464
  )
31193
- ] }) : /* @__PURE__ */ jsx14(
31465
+ ] }) : /* @__PURE__ */ jsx16(
31194
31466
  NativeSheetScrollView,
31195
31467
  {
31196
- contentContainerStyle: styles10.notesContent,
31468
+ contentContainerStyle: styles12.notesContent,
31197
31469
  showsVerticalScrollIndicator: false,
31198
- children: annotations.length === 0 ? /* @__PURE__ */ jsx14(Text6, { style: [styles10.emptyText, isDark && styles10.emptyTextDark], children: t.noAnnotations }) : /* @__PURE__ */ jsx14(View10, { children: annotations.map((ann) => /* @__PURE__ */ jsxs11(
31470
+ children: annotations.length === 0 ? /* @__PURE__ */ jsx16(Text6, { style: [styles12.emptyText, isDark && styles12.emptyTextDark], children: t.noAnnotations }) : /* @__PURE__ */ jsx16(View12, { children: annotations.map((ann) => /* @__PURE__ */ jsxs11(
31199
31471
  Pressable8,
31200
31472
  {
31201
31473
  onPress: () => {
@@ -31204,47 +31476,47 @@ var RightSheet = ({
31204
31476
  closeSheet();
31205
31477
  },
31206
31478
  style: [
31207
- styles10.noteCard,
31479
+ styles12.noteCard,
31208
31480
  {
31209
31481
  backgroundColor: palette.elevatedSurface,
31210
31482
  borderColor: palette.divider
31211
31483
  }
31212
31484
  ],
31213
31485
  children: [
31214
- /* @__PURE__ */ jsxs11(View10, { style: styles10.noteHeader, children: [
31215
- /* @__PURE__ */ jsx14(
31216
- View10,
31486
+ /* @__PURE__ */ jsxs11(View12, { style: styles12.noteHeader, children: [
31487
+ /* @__PURE__ */ jsx16(
31488
+ View12,
31217
31489
  {
31218
- style: [styles10.noteDot, { backgroundColor: ann.color }]
31490
+ style: [styles12.noteDot, { backgroundColor: ann.color }]
31219
31491
  }
31220
31492
  ),
31221
- /* @__PURE__ */ jsxs11(Text6, { style: [styles10.noteTitle, { color: palette.text }], children: [
31493
+ /* @__PURE__ */ jsxs11(Text6, { style: [styles12.noteTitle, { color: palette.text }], children: [
31222
31494
  t.page,
31223
31495
  " ",
31224
31496
  ann.pageIndex + 1
31225
31497
  ] })
31226
31498
  ] }),
31227
- /* @__PURE__ */ jsx14(Text6, { style: [styles10.noteType, { color: accentColor }], children: getAnnotationKindLabel(ann.type, locale) }),
31499
+ /* @__PURE__ */ jsx16(Text6, { style: [styles12.noteType, { color: accentColor }], children: getAnnotationKindLabel(ann.type, locale) }),
31228
31500
  ann.content ? (() => {
31229
31501
  const parts = resolveNoteQuoteParts(
31230
31502
  ann.content ?? ""
31231
31503
  );
31232
- return /* @__PURE__ */ jsxs11(View10, { style: styles10.noteQuoteRow, children: [
31233
- /* @__PURE__ */ jsx14(
31234
- View10,
31504
+ return /* @__PURE__ */ jsxs11(View12, { style: styles12.noteQuoteRow, children: [
31505
+ /* @__PURE__ */ jsx16(
31506
+ View12,
31235
31507
  {
31236
31508
  accessible: false,
31237
31509
  importantForAccessibility: "no",
31238
- style: styles10.noteQuoteIconStart,
31239
- children: /* @__PURE__ */ jsx14(IconQuote, { size: 18, color: accentColor })
31510
+ style: styles12.noteQuoteIconStart,
31511
+ children: /* @__PURE__ */ jsx16(IconQuote, { size: 18, color: accentColor })
31240
31512
  }
31241
31513
  ),
31242
31514
  /* @__PURE__ */ jsxs11(
31243
31515
  Text6,
31244
31516
  {
31245
31517
  style: [
31246
- styles10.noteContent,
31247
- styles10.noteQuoteText,
31518
+ styles12.noteContent,
31519
+ styles12.noteQuoteText,
31248
31520
  { color: palette.mutedText }
31249
31521
  ],
31250
31522
  children: [
@@ -31256,13 +31528,13 @@ var RightSheet = ({
31256
31528
  ]
31257
31529
  }
31258
31530
  ),
31259
- /* @__PURE__ */ jsx14(
31260
- View10,
31531
+ /* @__PURE__ */ jsx16(
31532
+ View12,
31261
31533
  {
31262
31534
  accessible: false,
31263
31535
  importantForAccessibility: "no",
31264
- style: styles10.noteQuoteIconEnd,
31265
- children: /* @__PURE__ */ jsx14(IconQuote, { size: 18, color: accentColor })
31536
+ style: styles12.noteQuoteIconEnd,
31537
+ children: /* @__PURE__ */ jsx16(IconQuote, { size: 18, color: accentColor })
31266
31538
  }
31267
31539
  )
31268
31540
  ] });
@@ -31277,7 +31549,7 @@ var RightSheet = ({
31277
31549
  }
31278
31550
  );
31279
31551
  };
31280
- var styles10 = StyleSheet10.create({
31552
+ var styles12 = StyleSheet12.create({
31281
31553
  sheet: {
31282
31554
  flex: 1,
31283
31555
  maxHeight: "100%",
@@ -31563,17 +31835,17 @@ var styles10 = StyleSheet10.create({
31563
31835
  var RightSheet_default = RightSheet;
31564
31836
 
31565
31837
  // components/AnnotationEditor.tsx
31566
- import { useEffect as useEffect10, useState as useState11 } from "react";
31838
+ import { useEffect as useEffect12, useState as useState11 } from "react";
31567
31839
  import {
31568
31840
  Modal as Modal2,
31569
- View as View11,
31841
+ View as View13,
31570
31842
  Text as Text7,
31571
31843
  TextInput as TextInput2,
31572
31844
  Pressable as Pressable9,
31573
- StyleSheet as StyleSheet11
31845
+ StyleSheet as StyleSheet13
31574
31846
  } from "react-native";
31575
- import { useViewerStore as useViewerStore9 } from "@papyrus-sdk/core";
31576
- import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
31847
+ import { useViewerStore as useViewerStore11 } from "@papyrus-sdk/core";
31848
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
31577
31849
  var AnnotationEditor = () => {
31578
31850
  const {
31579
31851
  annotations,
@@ -31584,13 +31856,13 @@ var AnnotationEditor = () => {
31584
31856
  uiTheme,
31585
31857
  locale,
31586
31858
  accentColor
31587
- } = useViewerStore9();
31859
+ } = useViewerStore11();
31588
31860
  const annotation = annotations.find((ann) => ann.id === selectedAnnotationId);
31589
31861
  const isEditable = annotation && (annotation.type === "text" || annotation.type === "comment");
31590
31862
  const [draft, setDraft] = useState11("");
31591
31863
  const isDark = uiTheme === "dark";
31592
31864
  const t = getStrings(locale);
31593
- useEffect10(() => {
31865
+ useEffect12(() => {
31594
31866
  if (isEditable) {
31595
31867
  setDraft(annotation?.content ?? "");
31596
31868
  }
@@ -31608,19 +31880,19 @@ var AnnotationEditor = () => {
31608
31880
  setSelectedAnnotation
31609
31881
  );
31610
31882
  };
31611
- return /* @__PURE__ */ jsx15(
31883
+ return /* @__PURE__ */ jsx17(
31612
31884
  Modal2,
31613
31885
  {
31614
31886
  visible: true,
31615
31887
  transparent: true,
31616
31888
  animationType: "fade",
31617
31889
  onRequestClose: handleClose,
31618
- children: /* @__PURE__ */ jsx15(View11, { style: styles11.overlay, children: /* @__PURE__ */ jsxs12(View11, { style: [styles11.card, isDark && styles11.cardDark], children: [
31619
- /* @__PURE__ */ jsx15(Text7, { style: [styles11.title, isDark && styles11.titleDark], children: t.editNote }),
31620
- /* @__PURE__ */ jsx15(
31890
+ children: /* @__PURE__ */ jsx17(View13, { style: styles13.overlay, children: /* @__PURE__ */ jsxs12(View13, { style: [styles13.card, isDark && styles13.cardDark], children: [
31891
+ /* @__PURE__ */ jsx17(Text7, { style: [styles13.title, isDark && styles13.titleDark], children: t.editNote }),
31892
+ /* @__PURE__ */ jsx17(
31621
31893
  TextInput2,
31622
31894
  {
31623
- style: [styles11.input, isDark && styles11.inputDark],
31895
+ style: [styles13.input, isDark && styles13.inputDark],
31624
31896
  value: draft,
31625
31897
  onChangeText: setDraft,
31626
31898
  placeholder: t.notePlaceholder,
@@ -31628,41 +31900,41 @@ var AnnotationEditor = () => {
31628
31900
  multiline: true
31629
31901
  }
31630
31902
  ),
31631
- /* @__PURE__ */ jsxs12(View11, { style: styles11.actions, children: [
31632
- /* @__PURE__ */ jsx15(
31903
+ /* @__PURE__ */ jsxs12(View13, { style: styles13.actions, children: [
31904
+ /* @__PURE__ */ jsx17(
31633
31905
  Pressable9,
31634
31906
  {
31635
31907
  onPress: handleDelete,
31636
31908
  style: [
31637
- styles11.actionButton,
31638
- styles11.actionDelete,
31639
- isDark && styles11.actionDeleteDark
31909
+ styles13.actionButton,
31910
+ styles13.actionDelete,
31911
+ isDark && styles13.actionDeleteDark
31640
31912
  ],
31641
31913
  accessibilityRole: "button",
31642
31914
  accessibilityLabel: t.deleteAnnotation,
31643
31915
  testID: "annotation-delete-button",
31644
- children: /* @__PURE__ */ jsx15(Text7, { style: [styles11.actionText, styles11.actionTextLight], children: t.deleteAnnotation })
31916
+ children: /* @__PURE__ */ jsx17(Text7, { style: [styles13.actionText, styles13.actionTextLight], children: t.deleteAnnotation })
31645
31917
  }
31646
31918
  ),
31647
- /* @__PURE__ */ jsx15(View11, { style: styles11.actionSpacer }),
31648
- /* @__PURE__ */ jsx15(
31919
+ /* @__PURE__ */ jsx17(View13, { style: styles13.actionSpacer }),
31920
+ /* @__PURE__ */ jsx17(
31649
31921
  Pressable9,
31650
31922
  {
31651
31923
  onPress: handleClose,
31652
- style: [styles11.actionButton, styles11.actionCancel],
31653
- children: /* @__PURE__ */ jsx15(Text7, { style: styles11.actionText, children: t.cancel })
31924
+ style: [styles13.actionButton, styles13.actionCancel],
31925
+ children: /* @__PURE__ */ jsx17(Text7, { style: styles13.actionText, children: t.cancel })
31654
31926
  }
31655
31927
  ),
31656
- /* @__PURE__ */ jsx15(
31928
+ /* @__PURE__ */ jsx17(
31657
31929
  Pressable9,
31658
31930
  {
31659
31931
  onPress: handleSave,
31660
31932
  style: [
31661
- styles11.actionButton,
31662
- styles11.actionSave,
31933
+ styles13.actionButton,
31934
+ styles13.actionSave,
31663
31935
  { backgroundColor: accentColor }
31664
31936
  ],
31665
- children: /* @__PURE__ */ jsx15(Text7, { style: [styles11.actionText, styles11.actionTextLight], children: t.save })
31937
+ children: /* @__PURE__ */ jsx17(Text7, { style: [styles13.actionText, styles13.actionTextLight], children: t.save })
31666
31938
  }
31667
31939
  )
31668
31940
  ] })
@@ -31670,7 +31942,7 @@ var AnnotationEditor = () => {
31670
31942
  }
31671
31943
  );
31672
31944
  };
31673
- var styles11 = StyleSheet11.create({
31945
+ var styles13 = StyleSheet13.create({
31674
31946
  overlay: {
31675
31947
  flex: 1,
31676
31948
  alignItems: "center",
@@ -31747,8 +32019,8 @@ var styles11 = StyleSheet11.create({
31747
32019
  var AnnotationEditor_default = AnnotationEditor;
31748
32020
 
31749
32021
  // components/BottomBar.tsx
31750
- import { View as View12, Pressable as Pressable10, StyleSheet as StyleSheet12, useWindowDimensions as useWindowDimensions7 } from "react-native";
31751
- import { useViewerStore as useViewerStore10 } from "@papyrus-sdk/core";
32022
+ import { View as View14, Pressable as Pressable10, StyleSheet as StyleSheet14, useWindowDimensions as useWindowDimensions7, Platform as Platform6 } from "react-native";
32023
+ import { useViewerStore as useViewerStore12 } from "@papyrus-sdk/core";
31752
32024
 
31753
32025
  // components/bottomBarModel.ts
31754
32026
  function buildBottomBarLayout({
@@ -31792,9 +32064,15 @@ function createOpenDestinationHandler(onOpenDestination, destination) {
31792
32064
  onOpenDestination?.(destination);
31793
32065
  };
31794
32066
  }
32067
+ function resolveAnnotateButtonAction(input) {
32068
+ if (input.isNativeIosInkViewer) {
32069
+ return input.activeTool === "ink" ? "deactivate-native-ink" : "activate-native-ink";
32070
+ }
32071
+ return input.toolDockOpen ? "dismiss-tool-dock" : "open-tool-dock";
32072
+ }
31795
32073
 
31796
32074
  // components/BottomBar.tsx
31797
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
32075
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
31798
32076
  var BottomBar = ({
31799
32077
  documentType,
31800
32078
  onOpenInfo,
@@ -31811,8 +32089,9 @@ var BottomBar = ({
31811
32089
  mobileChromeVisible,
31812
32090
  toolDockOpen,
31813
32091
  activeTool,
31814
- interactionMode
31815
- } = useViewerStore10();
32092
+ interactionMode,
32093
+ nativePdfViewerActive
32094
+ } = useViewerStore12();
31816
32095
  const isDark = uiTheme === "dark";
31817
32096
  const t = getStrings(locale);
31818
32097
  const { width, height } = useWindowDimensions7();
@@ -31832,7 +32111,33 @@ var BottomBar = ({
31832
32111
  label: t.tools,
31833
32112
  icon: IconToolDockTrigger,
31834
32113
  onPress: () => {
31835
- if (toolDockOpen) {
32114
+ const isNativeIosInkViewer = Platform6.OS === "ios" && Number.parseInt(String(Platform6.Version), 10) >= 16 && nativePdfViewerActive;
32115
+ const action = resolveAnnotateButtonAction({
32116
+ isNativeIosInkViewer,
32117
+ activeTool,
32118
+ toolDockOpen
32119
+ });
32120
+ if (action === "activate-native-ink") {
32121
+ setDocumentState({
32122
+ activeTool: "ink",
32123
+ activeDrawToolPreset: "ink",
32124
+ interactionMode: "pan",
32125
+ toolDockOpen: false,
32126
+ activeMobileDestination: "none"
32127
+ });
32128
+ return;
32129
+ }
32130
+ if (action === "deactivate-native-ink") {
32131
+ setDocumentState({
32132
+ activeTool: "select",
32133
+ interactionMode: "pan",
32134
+ nativeInkToolPickerActive: false,
32135
+ toolDockOpen: false,
32136
+ activeMobileDestination: "none"
32137
+ });
32138
+ return;
32139
+ }
32140
+ if (action === "dismiss-tool-dock") {
31836
32141
  setDocumentState({
31837
32142
  ...getToolDockDismissState({
31838
32143
  activeTool,
@@ -31868,38 +32173,38 @@ var BottomBar = ({
31868
32173
  }
31869
32174
  };
31870
32175
  if (!mobileChromeVisible || !mobileDockVisible) return null;
31871
- return /* @__PURE__ */ jsx16(View12, { pointerEvents: "box-none", style: [styles12.frame, { paddingBottom: offsets.bottom, paddingLeft: offsets.left, paddingRight: offsets.right }], children: /* @__PURE__ */ jsxs13(View12, { style: [styles12.row, isLandscape && styles12.rowLandscape], children: [
31872
- layout.leftSlots.length > 0 ? /* @__PURE__ */ jsx16(
31873
- View12,
32176
+ return /* @__PURE__ */ jsx18(View14, { pointerEvents: "box-none", style: [styles14.frame, { paddingBottom: offsets.bottom, paddingLeft: offsets.left, paddingRight: offsets.right }], children: /* @__PURE__ */ jsxs13(View14, { style: [styles14.row, isLandscape && styles14.rowLandscape], children: [
32177
+ layout.leftSlots.length > 0 ? /* @__PURE__ */ jsx18(
32178
+ View14,
31874
32179
  {
31875
32180
  style: [
31876
- styles12.island,
31877
- styles12.editIsland,
31878
- isDark && styles12.islandDark
32181
+ styles14.island,
32182
+ styles14.editIsland,
32183
+ isDark && styles14.islandDark
31879
32184
  ],
31880
32185
  testID: "papyrus-floating-bottom-dock-edit",
31881
32186
  children: layout.leftSlots.map((slot) => {
31882
32187
  const meta = slotMeta[slot.key];
31883
32188
  const Icon = meta.icon;
31884
- return /* @__PURE__ */ jsx16(
32189
+ return /* @__PURE__ */ jsx18(
31885
32190
  Pressable10,
31886
32191
  {
31887
32192
  onPress: meta.onPress,
31888
32193
  style: [
31889
- styles12.iconOnlyItem,
31890
- slot.active && styles12.itemActive
32194
+ styles14.iconOnlyItem,
32195
+ slot.active && styles14.itemActive
31891
32196
  ],
31892
32197
  accessibilityLabel: meta.label,
31893
32198
  testID: `papyrus-mobile-destination-${slot.key}`,
31894
- children: /* @__PURE__ */ jsx16(
31895
- View12,
32199
+ children: /* @__PURE__ */ jsx18(
32200
+ View14,
31896
32201
  {
31897
32202
  style: [
31898
- styles12.itemIcon,
31899
- isDark && styles12.itemIconDark,
31900
- slot.active && styles12.itemIconActive
32203
+ styles14.itemIcon,
32204
+ isDark && styles14.itemIconDark,
32205
+ slot.active && styles14.itemIconActive
31901
32206
  ],
31902
- children: /* @__PURE__ */ jsx16(
32207
+ children: /* @__PURE__ */ jsx18(
31903
32208
  Icon,
31904
32209
  {
31905
32210
  size: MOBILE_CHROME_METRICS.iconSize,
@@ -31914,34 +32219,34 @@ var BottomBar = ({
31914
32219
  })
31915
32220
  }
31916
32221
  ) : null,
31917
- /* @__PURE__ */ jsx16(
31918
- View12,
32222
+ /* @__PURE__ */ jsx18(
32223
+ View14,
31919
32224
  {
31920
32225
  style: [
31921
- styles12.island,
31922
- styles12.utilityIsland,
31923
- isDark && styles12.islandDark
32226
+ styles14.island,
32227
+ styles14.utilityIsland,
32228
+ isDark && styles14.islandDark
31924
32229
  ],
31925
32230
  testID: "papyrus-floating-bottom-dock",
31926
32231
  children: layout.rightSlots.map((slot) => {
31927
32232
  const meta = slotMeta[slot.key];
31928
32233
  const Icon = meta.icon;
31929
- return /* @__PURE__ */ jsx16(
32234
+ return /* @__PURE__ */ jsx18(
31930
32235
  Pressable10,
31931
32236
  {
31932
32237
  onPress: meta.onPress,
31933
- style: [styles12.iconOnlyItem, slot.active && styles12.itemActive],
32238
+ style: [styles14.iconOnlyItem, slot.active && styles14.itemActive],
31934
32239
  accessibilityLabel: meta.label,
31935
32240
  testID: `papyrus-mobile-destination-${slot.key}`,
31936
- children: /* @__PURE__ */ jsx16(
31937
- View12,
32241
+ children: /* @__PURE__ */ jsx18(
32242
+ View14,
31938
32243
  {
31939
32244
  style: [
31940
- styles12.itemIcon,
31941
- isDark && styles12.itemIconDark,
31942
- slot.active && styles12.itemIconActive
32245
+ styles14.itemIcon,
32246
+ isDark && styles14.itemIconDark,
32247
+ slot.active && styles14.itemIconActive
31943
32248
  ],
31944
- children: /* @__PURE__ */ jsx16(
32249
+ children: /* @__PURE__ */ jsx18(
31945
32250
  Icon,
31946
32251
  {
31947
32252
  size: MOBILE_CHROME_METRICS.iconSize,
@@ -31958,7 +32263,7 @@ var BottomBar = ({
31958
32263
  )
31959
32264
  ] }) });
31960
32265
  };
31961
- var styles12 = StyleSheet12.create({
32266
+ var styles14 = StyleSheet14.create({
31962
32267
  frame: {
31963
32268
  position: "absolute",
31964
32269
  left: 0,
@@ -32039,19 +32344,31 @@ var BottomBar_default = BottomBar;
32039
32344
 
32040
32345
  // components/SettingsSheet.tsx
32041
32346
  import {
32042
- View as View13,
32347
+ View as View15,
32043
32348
  Text as Text8,
32044
32349
  Pressable as Pressable11,
32045
- StyleSheet as StyleSheet13,
32350
+ Platform as Platform7,
32351
+ StyleSheet as StyleSheet15,
32046
32352
  useWindowDimensions as useWindowDimensions8
32047
32353
  } from "react-native";
32048
- import { useViewerStore as useViewerStore11 } from "@papyrus-sdk/core";
32354
+ import { useViewerStore as useViewerStore13 } from "@papyrus-sdk/core";
32355
+
32356
+ // components/rotationReset.ts
32357
+ var resetEngineRotation = (engine, onRotationChange) => {
32358
+ const normalizedRotation = (engine.getRotation() % 360 + 360) % 360;
32359
+ const currentQuarterTurns = Math.round(normalizedRotation / 90) % 4;
32360
+ const clockwiseTurnsToReset = (4 - currentQuarterTurns) % 4;
32361
+ for (let turn = 0; turn < clockwiseTurnsToReset; turn += 1) {
32362
+ engine.rotate("clockwise");
32363
+ }
32364
+ onRotationChange(0);
32365
+ };
32049
32366
 
32050
32367
  // components/settingsSheetLayout.ts
32051
32368
  var getSettingsSheetMaxHeight = (windowHeight) => Math.min(640, Math.max(0, windowHeight) * 0.72);
32052
32369
 
32053
32370
  // components/SettingsSheet.tsx
32054
- import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
32371
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
32055
32372
  var PAGE_THEME_OPTIONS = [
32056
32373
  { value: "normal", labelKey: "themeOriginal" },
32057
32374
  { value: "sepia", labelKey: "themeSepia" },
@@ -32060,19 +32377,19 @@ var PAGE_THEME_OPTIONS = [
32060
32377
  ];
32061
32378
  var ThemeSwatch = ({ value }) => {
32062
32379
  if (value === "high-contrast") {
32063
- return /* @__PURE__ */ jsxs14(View13, { style: [styles13.themeSwatch, styles13.themeSwatchContrast], children: [
32064
- /* @__PURE__ */ jsx17(View13, { style: styles13.themeSwatchContrastHalfDark }),
32065
- /* @__PURE__ */ jsx17(View13, { style: styles13.themeSwatchContrastHalfLight })
32380
+ return /* @__PURE__ */ jsxs14(View15, { style: [styles15.themeSwatch, styles15.themeSwatchContrast], children: [
32381
+ /* @__PURE__ */ jsx19(View15, { style: styles15.themeSwatchContrastHalfDark }),
32382
+ /* @__PURE__ */ jsx19(View15, { style: styles15.themeSwatchContrastHalfLight })
32066
32383
  ] });
32067
32384
  }
32068
- return /* @__PURE__ */ jsx17(
32069
- View13,
32385
+ return /* @__PURE__ */ jsx19(
32386
+ View15,
32070
32387
  {
32071
32388
  style: [
32072
- styles13.themeSwatch,
32073
- value === "normal" && styles13.themeSwatchNormal,
32074
- value === "sepia" && styles13.themeSwatchSepia,
32075
- value === "dark" && styles13.themeSwatchDark
32389
+ styles15.themeSwatch,
32390
+ value === "normal" && styles15.themeSwatchNormal,
32391
+ value === "sepia" && styles15.themeSwatchSepia,
32392
+ value === "dark" && styles15.themeSwatchDark
32076
32393
  ]
32077
32394
  }
32078
32395
  );
@@ -32080,7 +32397,8 @@ var ThemeSwatch = ({ value }) => {
32080
32397
  var SettingsSheet = ({
32081
32398
  engine,
32082
32399
  visible,
32083
- onClose
32400
+ onClose,
32401
+ documentType = "pdf"
32084
32402
  }) => {
32085
32403
  const {
32086
32404
  viewMode,
@@ -32089,8 +32407,11 @@ var SettingsSheet = ({
32089
32407
  setDocumentState,
32090
32408
  locale,
32091
32409
  accentColor,
32092
- pageTheme
32093
- } = useViewerStore11();
32410
+ pageTheme,
32411
+ comicLayoutMode,
32412
+ comicFitMode,
32413
+ comicReadingDirection
32414
+ } = useViewerStore13();
32094
32415
  const isDark = uiTheme === "dark";
32095
32416
  const isPaged = viewMode === "single";
32096
32417
  const isDouble = viewMode === "double";
@@ -32117,12 +32438,15 @@ var SettingsSheet = ({
32117
32438
  engine.rotate(direction);
32118
32439
  setDocumentState({ rotation: engine.getRotation() });
32119
32440
  };
32441
+ const handleResetRotation = () => {
32442
+ resetEngineRotation(engine, (rotation) => setDocumentState({ rotation }));
32443
+ };
32120
32444
  const handleZoom = (delta) => {
32121
32445
  const next = Math.max(0.5, Math.min(4, zoom + delta));
32122
32446
  engine.setZoom(next);
32123
32447
  setDocumentState({ zoom: next });
32124
32448
  };
32125
- return /* @__PURE__ */ jsx17(
32449
+ return /* @__PURE__ */ jsx19(
32126
32450
  NativeSheet,
32127
32451
  {
32128
32452
  visible,
@@ -32135,59 +32459,100 @@ var SettingsSheet = ({
32135
32459
  children: /* @__PURE__ */ jsxs14(
32136
32460
  NativeSheetScrollView,
32137
32461
  {
32138
- style: styles13.sheet,
32139
- contentContainerStyle: styles13.sheetContent,
32462
+ style: styles15.sheet,
32463
+ contentContainerStyle: styles15.sheetContent,
32140
32464
  showsVerticalScrollIndicator: false,
32141
32465
  children: [
32142
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32143
- /* @__PURE__ */ jsx17(
32466
+ documentType === "comic" && /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32467
+ /* @__PURE__ */ jsx19(Text8, { style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark], children: t.comicMode }),
32468
+ /* @__PURE__ */ jsx19(View15, { style: styles15.optionRow, children: ["single", "continuous"].map((mode) => {
32469
+ const active = comicLayoutMode === mode;
32470
+ return /* @__PURE__ */ jsx19(
32471
+ Pressable11,
32472
+ {
32473
+ onPress: () => setDocumentState({ comicLayoutMode: mode }),
32474
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark, active && styles15.optionButtonActive, active && { backgroundColor: accentColor }],
32475
+ children: /* @__PURE__ */ jsx19(Text8, { style: [styles15.optionText, isDark && styles15.optionTextDark, active && styles15.optionTextActive], children: mode === "single" ? t.comicSingle : t.comicContinuous })
32476
+ },
32477
+ mode
32478
+ );
32479
+ }) }),
32480
+ /* @__PURE__ */ jsx19(Text8, { style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark], children: t.comicFit }),
32481
+ /* @__PURE__ */ jsx19(View15, { style: styles15.optionRow, children: ["width", "page"].map((mode) => {
32482
+ const active = comicFitMode === mode;
32483
+ return /* @__PURE__ */ jsx19(
32484
+ Pressable11,
32485
+ {
32486
+ onPress: () => setDocumentState({ comicFitMode: mode }),
32487
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark, active && styles15.optionButtonActive, active && { backgroundColor: accentColor }],
32488
+ children: /* @__PURE__ */ jsx19(Text8, { style: [styles15.optionText, isDark && styles15.optionTextDark, active && styles15.optionTextActive], children: mode === "width" ? t.comicFitWidth : t.comicFitPage })
32489
+ },
32490
+ mode
32491
+ );
32492
+ }) }),
32493
+ /* @__PURE__ */ jsx19(Text8, { style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark], children: t.comicDirection }),
32494
+ /* @__PURE__ */ jsx19(View15, { style: styles15.optionRow, children: ["ltr", "rtl"].map((direction) => {
32495
+ const active = comicReadingDirection === direction;
32496
+ return /* @__PURE__ */ jsx19(
32497
+ Pressable11,
32498
+ {
32499
+ onPress: () => setDocumentState({ comicReadingDirection: direction }),
32500
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark, active && styles15.optionButtonActive, active && { backgroundColor: accentColor }],
32501
+ children: /* @__PURE__ */ jsx19(Text8, { style: [styles15.optionText, isDark && styles15.optionTextDark, active && styles15.optionTextActive], children: direction === "ltr" ? t.comicLtr : t.comicRtl })
32502
+ },
32503
+ direction
32504
+ );
32505
+ }) })
32506
+ ] }),
32507
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32508
+ /* @__PURE__ */ jsx19(
32144
32509
  Text8,
32145
32510
  {
32146
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32511
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32147
32512
  children: t.appearance
32148
32513
  }
32149
32514
  ),
32150
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32151
- /* @__PURE__ */ jsx17(
32515
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32516
+ /* @__PURE__ */ jsx19(
32152
32517
  Pressable11,
32153
32518
  {
32154
32519
  onPress: () => setDocumentState({ uiTheme: "light" }),
32155
32520
  style: [
32156
- styles13.optionButton,
32157
- isDark && styles13.optionButtonDark,
32158
- uiTheme === "light" && styles13.optionButtonActive,
32521
+ styles15.optionButton,
32522
+ isDark && styles15.optionButtonDark,
32523
+ uiTheme === "light" && styles15.optionButtonActive,
32159
32524
  uiTheme === "light" && { backgroundColor: accentColor }
32160
32525
  ],
32161
- children: /* @__PURE__ */ jsx17(
32526
+ children: /* @__PURE__ */ jsx19(
32162
32527
  Text8,
32163
32528
  {
32164
32529
  style: [
32165
- styles13.optionText,
32166
- isDark && styles13.optionTextDark,
32167
- uiTheme === "light" && styles13.optionTextActive
32530
+ styles15.optionText,
32531
+ isDark && styles15.optionTextDark,
32532
+ uiTheme === "light" && styles15.optionTextActive
32168
32533
  ],
32169
32534
  children: t.light
32170
32535
  }
32171
32536
  )
32172
32537
  }
32173
32538
  ),
32174
- /* @__PURE__ */ jsx17(
32539
+ /* @__PURE__ */ jsx19(
32175
32540
  Pressable11,
32176
32541
  {
32177
32542
  onPress: () => setDocumentState({ uiTheme: "dark" }),
32178
32543
  style: [
32179
- styles13.optionButton,
32180
- isDark && styles13.optionButtonDark,
32181
- uiTheme === "dark" && styles13.optionButtonActive,
32544
+ styles15.optionButton,
32545
+ isDark && styles15.optionButtonDark,
32546
+ uiTheme === "dark" && styles15.optionButtonActive,
32182
32547
  uiTheme === "dark" && { backgroundColor: accentColor }
32183
32548
  ],
32184
- children: /* @__PURE__ */ jsx17(
32549
+ children: /* @__PURE__ */ jsx19(
32185
32550
  Text8,
32186
32551
  {
32187
32552
  style: [
32188
- styles13.optionText,
32189
- isDark && styles13.optionTextDark,
32190
- uiTheme === "dark" && styles13.optionTextActive
32553
+ styles15.optionText,
32554
+ isDark && styles15.optionTextDark,
32555
+ uiTheme === "dark" && styles15.optionTextActive
32191
32556
  ],
32192
32557
  children: t.dark
32193
32558
  }
@@ -32196,34 +32561,34 @@ var SettingsSheet = ({
32196
32561
  )
32197
32562
  ] })
32198
32563
  ] }),
32199
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32200
- /* @__PURE__ */ jsx17(
32564
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32565
+ /* @__PURE__ */ jsx19(
32201
32566
  Text8,
32202
32567
  {
32203
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32568
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32204
32569
  children: t.pageTheme
32205
32570
  }
32206
32571
  ),
32207
- /* @__PURE__ */ jsx17(View13, { style: styles13.themeOptionRow, children: PAGE_THEME_OPTIONS.map((option) => {
32572
+ /* @__PURE__ */ jsx19(View15, { style: styles15.themeOptionRow, children: PAGE_THEME_OPTIONS.map((option) => {
32208
32573
  const active = pageTheme === option.value;
32209
32574
  return /* @__PURE__ */ jsxs14(
32210
32575
  Pressable11,
32211
32576
  {
32212
32577
  onPress: () => setDocumentState({ pageTheme: option.value }),
32213
32578
  style: [
32214
- styles13.themeOptionButton,
32215
- isDark && styles13.themeOptionButtonDark,
32216
- active && styles13.themeOptionButtonActive,
32579
+ styles15.themeOptionButton,
32580
+ isDark && styles15.themeOptionButtonDark,
32581
+ active && styles15.themeOptionButtonActive,
32217
32582
  active && { borderColor: accentColor }
32218
32583
  ],
32219
32584
  children: [
32220
- /* @__PURE__ */ jsx17(ThemeSwatch, { value: option.value }),
32221
- /* @__PURE__ */ jsx17(
32585
+ /* @__PURE__ */ jsx19(ThemeSwatch, { value: option.value }),
32586
+ /* @__PURE__ */ jsx19(
32222
32587
  Text8,
32223
32588
  {
32224
32589
  style: [
32225
- styles13.themeOptionLabel,
32226
- isDark && styles13.themeOptionLabelDark,
32590
+ styles15.themeOptionLabel,
32591
+ isDark && styles15.themeOptionLabelDark,
32227
32592
  active && { color: accentColor }
32228
32593
  ],
32229
32594
  children: t[option.labelKey]
@@ -32235,55 +32600,55 @@ var SettingsSheet = ({
32235
32600
  );
32236
32601
  }) })
32237
32602
  ] }),
32238
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32239
- /* @__PURE__ */ jsx17(
32603
+ documentType !== "comic" && documentType !== "text" && /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32604
+ /* @__PURE__ */ jsx19(
32240
32605
  Text8,
32241
32606
  {
32242
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32607
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32243
32608
  children: t.pageTransition
32244
32609
  }
32245
32610
  ),
32246
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32247
- /* @__PURE__ */ jsx17(
32611
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32612
+ /* @__PURE__ */ jsx19(
32248
32613
  Pressable11,
32249
32614
  {
32250
32615
  onPress: () => handleTransition("continuous"),
32251
32616
  style: [
32252
- styles13.optionButton,
32253
- isDark && styles13.optionButtonDark,
32254
- (!isPaged || isDouble) && styles13.optionButtonActive,
32617
+ styles15.optionButton,
32618
+ isDark && styles15.optionButtonDark,
32619
+ (!isPaged || isDouble) && styles15.optionButtonActive,
32255
32620
  (!isPaged || isDouble) && { backgroundColor: accentColor }
32256
32621
  ],
32257
- children: /* @__PURE__ */ jsx17(
32622
+ children: /* @__PURE__ */ jsx19(
32258
32623
  Text8,
32259
32624
  {
32260
32625
  style: [
32261
- styles13.optionText,
32262
- isDark && styles13.optionTextDark,
32263
- (!isPaged || isDouble) && styles13.optionTextActive
32626
+ styles15.optionText,
32627
+ isDark && styles15.optionTextDark,
32628
+ (!isPaged || isDouble) && styles15.optionTextActive
32264
32629
  ],
32265
32630
  children: t.continuous
32266
32631
  }
32267
32632
  )
32268
32633
  }
32269
32634
  ),
32270
- /* @__PURE__ */ jsx17(
32635
+ /* @__PURE__ */ jsx19(
32271
32636
  Pressable11,
32272
32637
  {
32273
32638
  onPress: () => handleTransition("paged"),
32274
32639
  style: [
32275
- styles13.optionButton,
32276
- isDark && styles13.optionButtonDark,
32277
- isPaged && styles13.optionButtonActive,
32640
+ styles15.optionButton,
32641
+ isDark && styles15.optionButtonDark,
32642
+ isPaged && styles15.optionButtonActive,
32278
32643
  isPaged && { backgroundColor: accentColor }
32279
32644
  ],
32280
- children: /* @__PURE__ */ jsx17(
32645
+ children: /* @__PURE__ */ jsx19(
32281
32646
  Text8,
32282
32647
  {
32283
32648
  style: [
32284
- styles13.optionText,
32285
- isDark && styles13.optionTextDark,
32286
- isPaged && styles13.optionTextActive
32649
+ styles15.optionText,
32650
+ isDark && styles15.optionTextDark,
32651
+ isPaged && styles15.optionTextActive
32287
32652
  ],
32288
32653
  children: t.pageByPage
32289
32654
  }
@@ -32292,55 +32657,55 @@ var SettingsSheet = ({
32292
32657
  )
32293
32658
  ] })
32294
32659
  ] }),
32295
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32296
- /* @__PURE__ */ jsx17(
32660
+ documentType !== "comic" && documentType !== "text" && /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32661
+ /* @__PURE__ */ jsx19(
32297
32662
  Text8,
32298
32663
  {
32299
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32664
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32300
32665
  children: t.layout
32301
32666
  }
32302
32667
  ),
32303
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32304
- /* @__PURE__ */ jsx17(
32668
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32669
+ /* @__PURE__ */ jsx19(
32305
32670
  Pressable11,
32306
32671
  {
32307
32672
  onPress: () => handleLayout("single"),
32308
32673
  style: [
32309
- styles13.optionButton,
32310
- isDark && styles13.optionButtonDark,
32311
- !isDouble && styles13.optionButtonActive,
32674
+ styles15.optionButton,
32675
+ isDark && styles15.optionButtonDark,
32676
+ !isDouble && styles15.optionButtonActive,
32312
32677
  !isDouble && { backgroundColor: accentColor }
32313
32678
  ],
32314
- children: /* @__PURE__ */ jsx17(
32679
+ children: /* @__PURE__ */ jsx19(
32315
32680
  Text8,
32316
32681
  {
32317
32682
  style: [
32318
- styles13.optionText,
32319
- isDark && styles13.optionTextDark,
32320
- !isDouble && styles13.optionTextActive
32683
+ styles15.optionText,
32684
+ isDark && styles15.optionTextDark,
32685
+ !isDouble && styles15.optionTextActive
32321
32686
  ],
32322
32687
  children: t.singlePage
32323
32688
  }
32324
32689
  )
32325
32690
  }
32326
32691
  ),
32327
- /* @__PURE__ */ jsx17(
32692
+ /* @__PURE__ */ jsx19(
32328
32693
  Pressable11,
32329
32694
  {
32330
32695
  onPress: () => handleLayout("double"),
32331
32696
  style: [
32332
- styles13.optionButton,
32333
- isDark && styles13.optionButtonDark,
32334
- isDouble && styles13.optionButtonActive,
32697
+ styles15.optionButton,
32698
+ isDark && styles15.optionButtonDark,
32699
+ isDouble && styles15.optionButtonActive,
32335
32700
  isDouble && { backgroundColor: accentColor }
32336
32701
  ],
32337
- children: /* @__PURE__ */ jsx17(
32702
+ children: /* @__PURE__ */ jsx19(
32338
32703
  Text8,
32339
32704
  {
32340
32705
  style: [
32341
- styles13.optionText,
32342
- isDark && styles13.optionTextDark,
32343
- isDouble && styles13.optionTextActive
32706
+ styles15.optionText,
32707
+ isDark && styles15.optionTextDark,
32708
+ isDouble && styles15.optionTextActive
32344
32709
  ],
32345
32710
  children: t.doublePage
32346
32711
  }
@@ -32349,38 +32714,52 @@ var SettingsSheet = ({
32349
32714
  )
32350
32715
  ] })
32351
32716
  ] }),
32352
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32353
- /* @__PURE__ */ jsx17(
32717
+ documentType !== "comic" && documentType !== "text" && /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32718
+ /* @__PURE__ */ jsx19(
32354
32719
  Text8,
32355
32720
  {
32356
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32721
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32357
32722
  children: t.rotate
32358
32723
  }
32359
32724
  ),
32360
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32361
- /* @__PURE__ */ jsx17(
32725
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32726
+ /* @__PURE__ */ jsx19(
32362
32727
  Pressable11,
32363
32728
  {
32364
32729
  onPress: () => handleRotate("counterclockwise"),
32365
- style: [styles13.optionButton, isDark && styles13.optionButtonDark],
32366
- children: /* @__PURE__ */ jsx17(
32730
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark],
32731
+ children: /* @__PURE__ */ jsx19(
32367
32732
  Text8,
32368
32733
  {
32369
- style: [styles13.optionText, isDark && styles13.optionTextDark],
32734
+ style: [styles15.optionText, isDark && styles15.optionTextDark],
32370
32735
  children: t.counterclockwise
32371
32736
  }
32372
32737
  )
32373
32738
  }
32374
32739
  ),
32375
- /* @__PURE__ */ jsx17(
32740
+ Platform7.OS === "ios" && /* @__PURE__ */ jsx19(
32741
+ Pressable11,
32742
+ {
32743
+ onPress: handleResetRotation,
32744
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark],
32745
+ children: /* @__PURE__ */ jsx19(
32746
+ Text8,
32747
+ {
32748
+ style: [styles15.optionText, isDark && styles15.optionTextDark],
32749
+ children: t.rotationOriginal
32750
+ }
32751
+ )
32752
+ }
32753
+ ),
32754
+ /* @__PURE__ */ jsx19(
32376
32755
  Pressable11,
32377
32756
  {
32378
32757
  onPress: () => handleRotate("clockwise"),
32379
- style: [styles13.optionButton, isDark && styles13.optionButtonDark],
32380
- children: /* @__PURE__ */ jsx17(
32758
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark],
32759
+ children: /* @__PURE__ */ jsx19(
32381
32760
  Text8,
32382
32761
  {
32383
- style: [styles13.optionText, isDark && styles13.optionTextDark],
32762
+ style: [styles15.optionText, isDark && styles15.optionTextDark],
32384
32763
  children: t.clockwise
32385
32764
  }
32386
32765
  )
@@ -32388,86 +32767,86 @@ var SettingsSheet = ({
32388
32767
  )
32389
32768
  ] })
32390
32769
  ] }),
32391
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32392
- /* @__PURE__ */ jsx17(
32770
+ documentType !== "text" && /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32771
+ /* @__PURE__ */ jsx19(
32393
32772
  Text8,
32394
32773
  {
32395
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32774
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32396
32775
  children: t.zoom
32397
32776
  }
32398
32777
  ),
32399
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32400
- /* @__PURE__ */ jsx17(
32778
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32779
+ /* @__PURE__ */ jsx19(
32401
32780
  Pressable11,
32402
32781
  {
32403
32782
  onPress: () => handleZoom(-0.1),
32404
- style: [styles13.optionButton, isDark && styles13.optionButtonDark],
32405
- children: /* @__PURE__ */ jsx17(IconZoomOut, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
32783
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark],
32784
+ children: /* @__PURE__ */ jsx19(IconZoomOut, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
32406
32785
  }
32407
32786
  ),
32408
- /* @__PURE__ */ jsx17(View13, { style: styles13.zoomValue, children: /* @__PURE__ */ jsxs14(Text8, { style: [styles13.zoomText, isDark && styles13.zoomTextDark], children: [
32787
+ /* @__PURE__ */ jsx19(View15, { style: styles15.zoomValue, children: /* @__PURE__ */ jsxs14(Text8, { style: [styles15.zoomText, isDark && styles15.zoomTextDark], children: [
32409
32788
  Math.round(zoom * 100),
32410
32789
  "%"
32411
32790
  ] }) }),
32412
- /* @__PURE__ */ jsx17(
32791
+ /* @__PURE__ */ jsx19(
32413
32792
  Pressable11,
32414
32793
  {
32415
32794
  onPress: () => handleZoom(0.1),
32416
- style: [styles13.optionButton, isDark && styles13.optionButtonDark],
32417
- children: /* @__PURE__ */ jsx17(IconZoomIn, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
32795
+ style: [styles15.optionButton, isDark && styles15.optionButtonDark],
32796
+ children: /* @__PURE__ */ jsx19(IconZoomIn, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
32418
32797
  }
32419
32798
  )
32420
32799
  ] })
32421
32800
  ] }),
32422
- /* @__PURE__ */ jsxs14(View13, { style: styles13.section, children: [
32423
- /* @__PURE__ */ jsx17(
32801
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.section, children: [
32802
+ /* @__PURE__ */ jsx19(
32424
32803
  Text8,
32425
32804
  {
32426
- style: [styles13.sectionTitle, isDark && styles13.sectionTitleDark],
32805
+ style: [styles15.sectionTitle, isDark && styles15.sectionTitleDark],
32427
32806
  children: t.language
32428
32807
  }
32429
32808
  ),
32430
- /* @__PURE__ */ jsxs14(View13, { style: styles13.optionRow, children: [
32431
- /* @__PURE__ */ jsx17(
32809
+ /* @__PURE__ */ jsxs14(View15, { style: styles15.optionRow, children: [
32810
+ /* @__PURE__ */ jsx19(
32432
32811
  Pressable11,
32433
32812
  {
32434
32813
  onPress: () => setDocumentState({ locale: "en" }),
32435
32814
  style: [
32436
- styles13.optionButton,
32437
- isDark && styles13.optionButtonDark,
32438
- locale === "en" && styles13.optionButtonActive,
32815
+ styles15.optionButton,
32816
+ isDark && styles15.optionButtonDark,
32817
+ locale === "en" && styles15.optionButtonActive,
32439
32818
  locale === "en" && { backgroundColor: accentColor }
32440
32819
  ],
32441
- children: /* @__PURE__ */ jsx17(
32820
+ children: /* @__PURE__ */ jsx19(
32442
32821
  Text8,
32443
32822
  {
32444
32823
  style: [
32445
- styles13.optionText,
32446
- isDark && styles13.optionTextDark,
32447
- locale === "en" && styles13.optionTextActive
32824
+ styles15.optionText,
32825
+ isDark && styles15.optionTextDark,
32826
+ locale === "en" && styles15.optionTextActive
32448
32827
  ],
32449
32828
  children: t.english
32450
32829
  }
32451
32830
  )
32452
32831
  }
32453
32832
  ),
32454
- /* @__PURE__ */ jsx17(
32833
+ /* @__PURE__ */ jsx19(
32455
32834
  Pressable11,
32456
32835
  {
32457
32836
  onPress: () => setDocumentState({ locale: "pt-BR" }),
32458
32837
  style: [
32459
- styles13.optionButton,
32460
- isDark && styles13.optionButtonDark,
32461
- locale === "pt-BR" && styles13.optionButtonActive,
32838
+ styles15.optionButton,
32839
+ isDark && styles15.optionButtonDark,
32840
+ locale === "pt-BR" && styles15.optionButtonActive,
32462
32841
  locale === "pt-BR" && { backgroundColor: accentColor }
32463
32842
  ],
32464
- children: /* @__PURE__ */ jsx17(
32843
+ children: /* @__PURE__ */ jsx19(
32465
32844
  Text8,
32466
32845
  {
32467
32846
  style: [
32468
- styles13.optionText,
32469
- isDark && styles13.optionTextDark,
32470
- locale === "pt-BR" && styles13.optionTextActive
32847
+ styles15.optionText,
32848
+ isDark && styles15.optionTextDark,
32849
+ locale === "pt-BR" && styles15.optionTextActive
32471
32850
  ],
32472
32851
  children: t.portuguese
32473
32852
  }
@@ -32482,7 +32861,7 @@ var SettingsSheet = ({
32482
32861
  }
32483
32862
  );
32484
32863
  };
32485
- var styles13 = StyleSheet13.create({
32864
+ var styles15 = StyleSheet15.create({
32486
32865
  sheet: {
32487
32866
  maxHeight: "100%"
32488
32867
  },
@@ -32615,17 +32994,17 @@ var styles13 = StyleSheet13.create({
32615
32994
  var SettingsSheet_default = SettingsSheet;
32616
32995
 
32617
32996
  // components/CoverPreview.tsx
32618
- import { useEffect as useEffect11, useMemo as useMemo6, useRef as useRef9, useState as useState12 } from "react";
32997
+ import { useEffect as useEffect13, useMemo as useMemo8, useRef as useRef9, useState as useState12 } from "react";
32619
32998
  import {
32620
32999
  ActivityIndicator,
32621
- StyleSheet as StyleSheet14,
33000
+ StyleSheet as StyleSheet16,
32622
33001
  Text as Text9,
32623
33002
  UIManager as UIManager2,
32624
- View as View14,
33003
+ View as View16,
32625
33004
  findNodeHandle as findNodeHandle3
32626
33005
  } from "react-native";
32627
33006
  import { MobileDocumentEngine, PapyrusPageView as PapyrusPageView3 } from "@papyrus-sdk/engine-native";
32628
- import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
33007
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
32629
33008
  var parseDataUri = (value) => {
32630
33009
  const match = /^data:([^;,]+)?(;base64)?,/.exec(value);
32631
33010
  if (!match) return null;
@@ -32679,12 +33058,12 @@ var CoverPreview = ({
32679
33058
  const [loading, setLoading] = useState12(false);
32680
33059
  const [error, setError] = useState12(null);
32681
33060
  const viewRef = useRef9(null);
32682
- const resolvedType = useMemo6(() => inferDocumentType(source, type), [source, type]);
33061
+ const resolvedType = useMemo8(() => inferDocumentType(source, type), [source, type]);
32683
33062
  const isPdf = resolvedType === "pdf";
32684
33063
  const hasNativePageView = Boolean(UIManager2.getViewManagerConfig?.("PapyrusPageView"));
32685
33064
  const canRender = !isPdf || hasNativePageView;
32686
33065
  const shouldRender = Boolean(visible);
32687
- useEffect11(() => {
33066
+ useEffect13(() => {
32688
33067
  if (!shouldRender) {
32689
33068
  if (!keepAlive) {
32690
33069
  setEngine(null);
@@ -32697,7 +33076,7 @@ var CoverPreview = ({
32697
33076
  setEngine(new MobileDocumentEngine());
32698
33077
  }
32699
33078
  }, [shouldRender, keepAlive, engine, canRender]);
32700
- useEffect11(() => {
33079
+ useEffect13(() => {
32701
33080
  if (!engine || !shouldRender || !canRender) return;
32702
33081
  let active = true;
32703
33082
  setLoading(true);
@@ -32724,13 +33103,13 @@ var CoverPreview = ({
32724
33103
  active = false;
32725
33104
  };
32726
33105
  }, [engine, shouldRender, canRender, source, type, pageIndex, isPdf, onLoadStart, onLoadEnd, onError]);
32727
- useEffect11(() => {
33106
+ useEffect13(() => {
32728
33107
  if (!engine || !isPdf || !loaded || !layoutReady || !shouldRender || !canRender) return;
32729
33108
  const viewTag = findNodeHandle3(viewRef.current);
32730
33109
  if (!viewTag) return;
32731
33110
  engine.renderPage(pageIndex, viewTag, renderScale);
32732
33111
  }, [engine, isPdf, loaded, layoutReady, shouldRender, canRender, pageIndex, renderScale]);
32733
- useEffect11(() => {
33112
+ useEffect13(() => {
32734
33113
  return () => {
32735
33114
  engine?.destroy();
32736
33115
  };
@@ -32742,15 +33121,15 @@ var CoverPreview = ({
32742
33121
  }
32743
33122
  };
32744
33123
  if (!shouldRender || !canRender) {
32745
- return /* @__PURE__ */ jsx18(View14, { style: [styles14.container, style], children: placeholder ?? /* @__PURE__ */ jsx18(View14, { style: styles14.placeholder, children: /* @__PURE__ */ jsx18(Text9, { style: styles14.placeholderText, children: "Preview" }) }) });
33124
+ return /* @__PURE__ */ jsx20(View16, { style: [styles16.container, style], children: placeholder ?? /* @__PURE__ */ jsx20(View16, { style: styles16.placeholder, children: /* @__PURE__ */ jsx20(Text9, { style: styles16.placeholderText, children: "Preview" }) }) });
32746
33125
  }
32747
- return /* @__PURE__ */ jsxs15(View14, { style: [styles14.container, style], onLayout: handleLayout, children: [
32748
- /* @__PURE__ */ jsx18(View14, { style: styles14.previewFrame, pointerEvents: allowInteraction ? "auto" : "none", children: isPdf ? /* @__PURE__ */ jsx18(PapyrusPageView3, { ref: viewRef, style: styles14.pageView }) : engine && /* @__PURE__ */ jsx18(WebViewViewer_default, { engine }) }),
32749
- showLoading && loading && /* @__PURE__ */ jsx18(View14, { pointerEvents: "none", style: styles14.loadingOverlay, children: loadingIndicator ?? /* @__PURE__ */ jsx18(ActivityIndicator, { size: "small", color: "#2563eb" }) }),
32750
- error && /* @__PURE__ */ jsx18(View14, { pointerEvents: "none", style: styles14.errorOverlay, children: /* @__PURE__ */ jsx18(Text9, { style: styles14.errorText, children: "Preview unavailable" }) })
33126
+ return /* @__PURE__ */ jsxs15(View16, { style: [styles16.container, style], onLayout: handleLayout, children: [
33127
+ /* @__PURE__ */ jsx20(View16, { style: styles16.previewFrame, pointerEvents: allowInteraction ? "auto" : "none", children: isPdf ? /* @__PURE__ */ jsx20(PapyrusPageView3, { ref: viewRef, style: styles16.pageView }) : engine && /* @__PURE__ */ jsx20(WebViewViewer_default, { engine }) }),
33128
+ showLoading && loading && /* @__PURE__ */ jsx20(View16, { pointerEvents: "none", style: styles16.loadingOverlay, children: loadingIndicator ?? /* @__PURE__ */ jsx20(ActivityIndicator, { size: "small", color: "#2563eb" }) }),
33129
+ error && /* @__PURE__ */ jsx20(View16, { pointerEvents: "none", style: styles16.errorOverlay, children: /* @__PURE__ */ jsx20(Text9, { style: styles16.errorText, children: "Preview unavailable" }) })
32751
33130
  ] });
32752
33131
  };
32753
- var styles14 = StyleSheet14.create({
33132
+ var styles16 = StyleSheet16.create({
32754
33133
  container: {
32755
33134
  backgroundColor: "#f8fafc",
32756
33135
  borderRadius: 12,
@@ -32766,13 +33145,13 @@ var styles14 = StyleSheet14.create({
32766
33145
  backgroundColor: "transparent"
32767
33146
  },
32768
33147
  loadingOverlay: {
32769
- ...StyleSheet14.absoluteFillObject,
33148
+ ...StyleSheet16.absoluteFillObject,
32770
33149
  alignItems: "center",
32771
33150
  justifyContent: "center",
32772
33151
  backgroundColor: "rgba(15, 23, 42, 0.15)"
32773
33152
  },
32774
33153
  errorOverlay: {
32775
- ...StyleSheet14.absoluteFillObject,
33154
+ ...StyleSheet16.absoluteFillObject,
32776
33155
  alignItems: "center",
32777
33156
  justifyContent: "center",
32778
33157
  backgroundColor: "rgba(15, 23, 42, 0.4)"
@@ -32797,22 +33176,22 @@ var styles14 = StyleSheet14.create({
32797
33176
  var CoverPreview_default = CoverPreview;
32798
33177
 
32799
33178
  // components/ReadingShell.tsx
32800
- import React17, { useState as useState15 } from "react";
32801
- import { Keyboard as Keyboard2, View as View20, StyleSheet as StyleSheet21 } from "react-native";
32802
- import { useViewerStore as useViewerStore18 } from "@papyrus-sdk/core";
33179
+ import React19, { useState as useState15 } from "react";
33180
+ import { Keyboard as Keyboard2, View as View22, StyleSheet as StyleSheet23 } from "react-native";
33181
+ import { useViewerStore as useViewerStore20 } from "@papyrus-sdk/core";
32803
33182
 
32804
33183
  // components/DocumentActionsSheet.tsx
32805
- import { StyleSheet as StyleSheet15, Text as Text10, View as View15 } from "react-native";
32806
- import { useViewerStore as useViewerStore12 } from "@papyrus-sdk/core";
32807
- import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
33184
+ import { StyleSheet as StyleSheet17, Text as Text10, View as View17 } from "react-native";
33185
+ import { useViewerStore as useViewerStore14 } from "@papyrus-sdk/core";
33186
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
32808
33187
  function DocumentActionsSheet({
32809
33188
  visible,
32810
33189
  onClose
32811
33190
  }) {
32812
- const { uiTheme } = useViewerStore12();
33191
+ const { uiTheme } = useViewerStore14();
32813
33192
  const isDark = uiTheme === "dark";
32814
33193
  const palette = getReaderSheetPalette(isDark);
32815
- return /* @__PURE__ */ jsx19(
33194
+ return /* @__PURE__ */ jsx21(
32816
33195
  NativeSheet,
32817
33196
  {
32818
33197
  visible,
@@ -32828,38 +33207,38 @@ function DocumentActionsSheet({
32828
33207
  backgroundColor: palette.surface,
32829
33208
  borderTopColor: palette.divider
32830
33209
  },
32831
- children: /* @__PURE__ */ jsxs16(View15, { style: styles15.actionList, children: [
32832
- /* @__PURE__ */ jsx19(
32833
- View15,
33210
+ children: /* @__PURE__ */ jsxs16(View17, { style: styles17.actionList, children: [
33211
+ /* @__PURE__ */ jsx21(
33212
+ View17,
32834
33213
  {
32835
33214
  style: [
32836
- styles15.actionItem,
33215
+ styles17.actionItem,
32837
33216
  {
32838
33217
  backgroundColor: palette.elevatedSurface,
32839
33218
  borderColor: palette.divider
32840
33219
  }
32841
33220
  ],
32842
- children: /* @__PURE__ */ jsx19(Text10, { style: [styles15.actionText, { color: palette.text }], children: "Share" })
33221
+ children: /* @__PURE__ */ jsx21(Text10, { style: [styles17.actionText, { color: palette.text }], children: "Share" })
32843
33222
  }
32844
33223
  ),
32845
- /* @__PURE__ */ jsx19(
32846
- View15,
33224
+ /* @__PURE__ */ jsx21(
33225
+ View17,
32847
33226
  {
32848
33227
  style: [
32849
- styles15.actionItem,
33228
+ styles17.actionItem,
32850
33229
  {
32851
33230
  backgroundColor: palette.elevatedSurface,
32852
33231
  borderColor: palette.divider
32853
33232
  }
32854
33233
  ],
32855
- children: /* @__PURE__ */ jsx19(Text10, { style: [styles15.actionText, { color: palette.text }], children: "Export" })
33234
+ children: /* @__PURE__ */ jsx21(Text10, { style: [styles17.actionText, { color: palette.text }], children: "Export" })
32856
33235
  }
32857
33236
  )
32858
33237
  ] })
32859
33238
  }
32860
33239
  );
32861
33240
  }
32862
- var styles15 = StyleSheet15.create({
33241
+ var styles17 = StyleSheet17.create({
32863
33242
  actionList: {
32864
33243
  gap: 10
32865
33244
  },
@@ -32877,8 +33256,8 @@ var styles15 = StyleSheet15.create({
32877
33256
  });
32878
33257
 
32879
33258
  // components/InfoSheet.tsx
32880
- import { StyleSheet as StyleSheet16, Text as Text11, View as View16 } from "react-native";
32881
- import { useViewerStore as useViewerStore13 } from "@papyrus-sdk/core";
33259
+ import { StyleSheet as StyleSheet18, Text as Text11, View as View18 } from "react-native";
33260
+ import { useViewerStore as useViewerStore15 } from "@papyrus-sdk/core";
32882
33261
 
32883
33262
  // components/infoSheetModel.ts
32884
33263
  var roundPercent = (value) => Math.max(0, Math.min(100, Math.round(value)));
@@ -32977,7 +33356,7 @@ var buildInfoRows = ({
32977
33356
  };
32978
33357
 
32979
33358
  // components/InfoSheet.tsx
32980
- import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
33359
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
32981
33360
  function InfoSheet({
32982
33361
  visible,
32983
33362
  title,
@@ -32993,7 +33372,7 @@ function InfoSheet({
32993
33372
  viewMode,
32994
33373
  pageTheme,
32995
33374
  locale
32996
- } = useViewerStore13();
33375
+ } = useViewerStore15();
32997
33376
  const isDark = uiTheme === "dark";
32998
33377
  const palette = getReaderSheetPalette(isDark);
32999
33378
  const isPortuguese = locale === "pt-BR";
@@ -33009,7 +33388,7 @@ function InfoSheet({
33009
33388
  pageTheme,
33010
33389
  locale
33011
33390
  });
33012
- return /* @__PURE__ */ jsx20(
33391
+ return /* @__PURE__ */ jsx22(
33013
33392
  NativeSheet,
33014
33393
  {
33015
33394
  visible,
@@ -33024,24 +33403,24 @@ function InfoSheet({
33024
33403
  backgroundColor: palette.surface,
33025
33404
  borderTopColor: palette.divider
33026
33405
  },
33027
- children: /* @__PURE__ */ jsx20(View16, { style: styles16.sheet, children: /* @__PURE__ */ jsxs17(
33406
+ children: /* @__PURE__ */ jsx22(View18, { style: styles18.sheet, children: /* @__PURE__ */ jsxs17(
33028
33407
  NativeSheetScrollView,
33029
33408
  {
33030
- style: styles16.content,
33031
- contentContainerStyle: styles16.contentInner,
33409
+ style: styles18.content,
33410
+ contentContainerStyle: styles18.contentInner,
33032
33411
  showsVerticalScrollIndicator: false,
33033
33412
  children: [
33034
- /* @__PURE__ */ jsx20(Text11, { style: [styles16.sectionTitle, { color: palette.mutedText }], children: isPortuguese ? "Resumo do documento" : "Document summary" }),
33035
- /* @__PURE__ */ jsx20(View16, { style: [styles16.rows, { borderTopColor: palette.divider }], children: rows.map((row) => /* @__PURE__ */ jsxs17(
33036
- View16,
33413
+ /* @__PURE__ */ jsx22(Text11, { style: [styles18.sectionTitle, { color: palette.mutedText }], children: isPortuguese ? "Resumo do documento" : "Document summary" }),
33414
+ /* @__PURE__ */ jsx22(View18, { style: [styles18.rows, { borderTopColor: palette.divider }], children: rows.map((row) => /* @__PURE__ */ jsxs17(
33415
+ View18,
33037
33416
  {
33038
- style: [styles16.row, { borderBottomColor: palette.divider }],
33417
+ style: [styles18.row, { borderBottomColor: palette.divider }],
33039
33418
  children: [
33040
- /* @__PURE__ */ jsx20(Text11, { style: [styles16.label, { color: palette.mutedText }], children: row.label }),
33041
- /* @__PURE__ */ jsx20(
33419
+ /* @__PURE__ */ jsx22(Text11, { style: [styles18.label, { color: palette.mutedText }], children: row.label }),
33420
+ /* @__PURE__ */ jsx22(
33042
33421
  Text11,
33043
33422
  {
33044
- style: [styles16.value, { color: palette.text }],
33423
+ style: [styles18.value, { color: palette.text }],
33045
33424
  selectable: true,
33046
33425
  children: row.value
33047
33426
  }
@@ -33056,7 +33435,7 @@ function InfoSheet({
33056
33435
  }
33057
33436
  );
33058
33437
  }
33059
- var styles16 = StyleSheet16.create({
33438
+ var styles18 = StyleSheet18.create({
33060
33439
  sheet: {
33061
33440
  flex: 1,
33062
33441
  paddingBottom: 16
@@ -33102,18 +33481,18 @@ var styles16 = StyleSheet16.create({
33102
33481
  });
33103
33482
 
33104
33483
  // components/OverflowSheet.tsx
33105
- import { Pressable as Pressable12, StyleSheet as StyleSheet17, Text as Text12, View as View17 } from "react-native";
33106
- import { useViewerStore as useViewerStore14 } from "@papyrus-sdk/core";
33107
- import { jsx as jsx21 } from "react/jsx-runtime";
33484
+ import { Pressable as Pressable12, StyleSheet as StyleSheet19, Text as Text12, View as View19 } from "react-native";
33485
+ import { useViewerStore as useViewerStore16 } from "@papyrus-sdk/core";
33486
+ import { jsx as jsx23 } from "react/jsx-runtime";
33108
33487
  var actionLabels = [{ key: "actions", label: "Document actions" }];
33109
33488
  function OverflowSheet({
33110
33489
  visible,
33111
33490
  onClose,
33112
33491
  onOpenActions
33113
33492
  }) {
33114
- const isDark = useViewerStore14((state) => state.uiTheme === "dark");
33493
+ const isDark = useViewerStore16((state) => state.uiTheme === "dark");
33115
33494
  const palette = getReaderSheetPalette(isDark);
33116
- return /* @__PURE__ */ jsx21(
33495
+ return /* @__PURE__ */ jsx23(
33117
33496
  NativeSheet,
33118
33497
  {
33119
33498
  visible,
@@ -33129,12 +33508,12 @@ function OverflowSheet({
33129
33508
  backgroundColor: palette.surface,
33130
33509
  borderTopColor: palette.divider
33131
33510
  },
33132
- children: /* @__PURE__ */ jsx21(View17, { style: styles17.actionList, children: actionLabels.map((action) => /* @__PURE__ */ jsx21(
33511
+ children: /* @__PURE__ */ jsx23(View19, { style: styles19.actionList, children: actionLabels.map((action) => /* @__PURE__ */ jsx23(
33133
33512
  Pressable12,
33134
33513
  {
33135
33514
  onPress: onOpenActions,
33136
33515
  style: [
33137
- styles17.actionButton,
33516
+ styles19.actionButton,
33138
33517
  {
33139
33518
  borderColor: palette.divider,
33140
33519
  backgroundColor: palette.elevatedSurface
@@ -33142,14 +33521,14 @@ function OverflowSheet({
33142
33521
  ],
33143
33522
  accessibilityRole: "button",
33144
33523
  accessibilityLabel: action.label,
33145
- children: /* @__PURE__ */ jsx21(Text12, { style: [styles17.actionText, { color: palette.text }], children: action.label })
33524
+ children: /* @__PURE__ */ jsx23(Text12, { style: [styles19.actionText, { color: palette.text }], children: action.label })
33146
33525
  },
33147
33526
  action.key
33148
33527
  )) })
33149
33528
  }
33150
33529
  );
33151
33530
  }
33152
- var styles17 = StyleSheet17.create({
33531
+ var styles19 = StyleSheet19.create({
33153
33532
  actionList: { gap: 10 },
33154
33533
  actionButton: {
33155
33534
  borderWidth: 1,
@@ -33161,17 +33540,32 @@ var styles17 = StyleSheet17.create({
33161
33540
  });
33162
33541
 
33163
33542
  // components/ProgressPill.tsx
33164
- import { useEffect as useEffect12, useMemo as useMemo7, useRef as useRef10, useState as useState13 } from "react";
33543
+ import { useEffect as useEffect14, useMemo as useMemo9, useRef as useRef10, useState as useState13 } from "react";
33165
33544
  import {
33166
33545
  Animated as Animated3,
33167
33546
  PanResponder as PanResponder2,
33168
- StyleSheet as StyleSheet18,
33547
+ Pressable as Pressable13,
33548
+ StyleSheet as StyleSheet20,
33169
33549
  Text as Text13,
33170
- View as View18,
33550
+ View as View20,
33171
33551
  useWindowDimensions as useWindowDimensions9
33172
33552
  } from "react-native";
33173
- import { useViewerStore as useViewerStore15 } from "@papyrus-sdk/core";
33174
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
33553
+ import { useViewerStore as useViewerStore17 } from "@papyrus-sdk/core";
33554
+
33555
+ // components/progressPillMode.ts
33556
+ function resolveProgressPillMode(viewMode, currentPage, pageCount) {
33557
+ if (viewMode !== "single") return { kind: "scrubber" };
33558
+ const total = Math.max(0, Math.trunc(pageCount));
33559
+ const page = total > 0 ? Math.min(total, Math.max(1, Math.trunc(currentPage))) : 1;
33560
+ return {
33561
+ kind: "navigation",
33562
+ previousPage: page > 1 ? page - 1 : null,
33563
+ nextPage: page < total ? page + 1 : null
33564
+ };
33565
+ }
33566
+
33567
+ // components/ProgressPill.tsx
33568
+ import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
33175
33569
  var clampPercent = (value) => Math.max(0, Math.min(100, Math.round(value)));
33176
33570
  function ProgressPill({
33177
33571
  documentType,
@@ -33183,11 +33577,17 @@ function ProgressPill({
33183
33577
  const {
33184
33578
  currentPage,
33185
33579
  pageCount,
33580
+ currentTextOffset,
33581
+ textLength,
33582
+ comicLayoutMode,
33583
+ viewMode,
33584
+ locale,
33186
33585
  uiTheme,
33187
33586
  accentColor,
33188
33587
  mobileChromeVisible,
33189
33588
  mobileProgressPillVisible
33190
- } = useViewerStore15();
33589
+ } = useViewerStore17();
33590
+ const t = getStrings(locale);
33191
33591
  const isDark = uiTheme === "dark";
33192
33592
  const offsets = resolveMobileChromeOffsets(usePapyrusSafeAreaInsets());
33193
33593
  const { height: windowHeight } = useWindowDimensions9();
@@ -33224,7 +33624,7 @@ function ProgressPill({
33224
33624
  const scrubberResponderRef = useRef10(null);
33225
33625
  const touchPolicy = resolvePageScrubberTouchPolicy();
33226
33626
  const displayedPage = scrubPreviewPage ?? currentPage;
33227
- const label = useMemo7(() => {
33627
+ const label = useMemo9(() => {
33228
33628
  const total = Math.max(pageCount, 1);
33229
33629
  const percent = clampPercent(displayedPage / total * 100);
33230
33630
  if (documentType === "pdf") {
@@ -33249,26 +33649,26 @@ function ProgressPill({
33249
33649
  const [trackOriginY, setTrackOriginY] = useState13(0);
33250
33650
  const scrubberMetricsRef = useRef10({ trackHeight, thumbHeight, pageCount });
33251
33651
  scrubberMetricsRef.current = { trackHeight, thumbHeight, pageCount };
33252
- useEffect12(() => {
33652
+ useEffect14(() => {
33253
33653
  onNavigateToPageRef.current = onNavigateToPage;
33254
33654
  }, [onNavigateToPage]);
33255
- useEffect12(() => {
33655
+ useEffect14(() => {
33256
33656
  onPressRef.current = onPress;
33257
33657
  onOpenPageJumpRef.current = onOpenPageJump;
33258
33658
  }, [onOpenPageJump, onPress]);
33259
- useEffect12(() => {
33659
+ useEffect14(() => {
33260
33660
  const pendingPage = pendingReleasedScrubPageRef.current;
33261
33661
  if (pendingPage !== null && currentPage === pendingPage) {
33262
33662
  pendingReleasedScrubPageRef.current = null;
33263
33663
  setScrubPreviewPage(null);
33264
33664
  }
33265
33665
  }, [currentPage]);
33266
- useEffect12(() => {
33666
+ useEffect14(() => {
33267
33667
  if (!isScrubbingRef.current) {
33268
33668
  thumbTopRef.current.setValue(thumbTop);
33269
33669
  }
33270
33670
  }, [thumbTop, thumbTopRef]);
33271
- useEffect12(
33671
+ useEffect14(
33272
33672
  () => () => {
33273
33673
  if (longPressTimerRef.current !== null) {
33274
33674
  clearTimeout(longPressTimerRef.current);
@@ -33283,6 +33683,86 @@ function ProgressPill({
33283
33683
  })) {
33284
33684
  return null;
33285
33685
  }
33686
+ if (documentType === "text") {
33687
+ const progress = textLength <= 0 ? 0 : clampPercent(currentTextOffset / textLength * 100);
33688
+ return /* @__PURE__ */ jsx24(
33689
+ View20,
33690
+ {
33691
+ pointerEvents: "box-none",
33692
+ style: [styles20.frame, styles20.singleFrame, { top: offsets.progress, right: offsets.right }],
33693
+ children: /* @__PURE__ */ jsx24(
33694
+ Pressable13,
33695
+ {
33696
+ accessibilityRole: "button",
33697
+ accessibilityLabel: `${t.progress} ${progress}%`,
33698
+ onPress: () => onPressRef.current(),
33699
+ style: [styles20.singlePill, isDark && styles20.pillDark],
33700
+ testID: "papyrus-progress-text",
33701
+ children: /* @__PURE__ */ jsxs18(Text13, { style: [styles20.label, isDark && styles20.labelDark], children: [
33702
+ progress,
33703
+ "%"
33704
+ ] })
33705
+ }
33706
+ )
33707
+ }
33708
+ );
33709
+ }
33710
+ const progressViewMode = documentType === "comic" ? comicLayoutMode === "single" ? "single" : "continuous" : viewMode;
33711
+ const pillMode = resolveProgressPillMode(progressViewMode, currentPage, pageCount);
33712
+ if (pillMode.kind === "navigation") {
33713
+ const previousDisabled = pillMode.previousPage === null || !onNavigateToPage;
33714
+ const nextDisabled = pillMode.nextPage === null || !onNavigateToPage;
33715
+ return /* @__PURE__ */ jsx24(
33716
+ View20,
33717
+ {
33718
+ pointerEvents: "box-none",
33719
+ style: [styles20.frame, styles20.singleFrame, { top: offsets.progress, right: offsets.right }],
33720
+ children: /* @__PURE__ */ jsxs18(View20, { style: [styles20.singlePill, isDark && styles20.pillDark], children: [
33721
+ /* @__PURE__ */ jsx24(
33722
+ Pressable13,
33723
+ {
33724
+ accessibilityRole: "button",
33725
+ accessibilityLabel: t.previousPage,
33726
+ accessibilityState: { disabled: previousDisabled },
33727
+ disabled: previousDisabled,
33728
+ onPress: () => pillMode.previousPage !== null && onNavigateToPageRef.current?.(pillMode.previousPage),
33729
+ style: styles20.pageArrowHit,
33730
+ testID: "papyrus-progress-page-previous",
33731
+ children: /* @__PURE__ */ jsx24(Text13, { style: [styles20.pageArrow, isDark && styles20.labelDark, previousDisabled && styles20.pageArrowDisabled], children: "\u2039" })
33732
+ }
33733
+ ),
33734
+ /* @__PURE__ */ jsx24(
33735
+ Pressable13,
33736
+ {
33737
+ accessibilityRole: "button",
33738
+ accessibilityLabel: `${currentPage}/${pageCount || 0}`,
33739
+ onPress: () => onPressRef.current(),
33740
+ style: styles20.singlePageCenter,
33741
+ testID: "papyrus-progress-page-grid",
33742
+ children: /* @__PURE__ */ jsxs18(Text13, { style: [styles20.label, isDark && styles20.labelDark], children: [
33743
+ currentPage,
33744
+ "/",
33745
+ pageCount || 0
33746
+ ] })
33747
+ }
33748
+ ),
33749
+ /* @__PURE__ */ jsx24(
33750
+ Pressable13,
33751
+ {
33752
+ accessibilityRole: "button",
33753
+ accessibilityLabel: t.nextPage,
33754
+ accessibilityState: { disabled: nextDisabled },
33755
+ disabled: nextDisabled,
33756
+ onPress: () => pillMode.nextPage !== null && onNavigateToPageRef.current?.(pillMode.nextPage),
33757
+ style: styles20.pageArrowHit,
33758
+ testID: "papyrus-progress-page-next",
33759
+ children: /* @__PURE__ */ jsx24(Text13, { style: [styles20.pageArrow, isDark && styles20.labelDark, nextDisabled && styles20.pageArrowDisabled], children: "\u203A" })
33760
+ }
33761
+ )
33762
+ ] })
33763
+ }
33764
+ );
33765
+ }
33286
33766
  const scrubToPosition = (position) => {
33287
33767
  const { trackHeight: trackHeight2, thumbHeight: thumbHeight2, pageCount: pageCount2 } = scrubberMetricsRef.current;
33288
33768
  const visualPosition = resolvePageScrubberThumbTopFromPosition({
@@ -33416,12 +33896,12 @@ function ProgressPill({
33416
33896
  });
33417
33897
  }
33418
33898
  const responderPanHandlers = scrubberResponderRef.current?.panHandlers ?? {};
33419
- return /* @__PURE__ */ jsx22(
33420
- View18,
33899
+ return /* @__PURE__ */ jsx24(
33900
+ View20,
33421
33901
  {
33422
33902
  pointerEvents: "box-none",
33423
33903
  style: [
33424
- styles18.frame,
33904
+ styles20.frame,
33425
33905
  resolvePageScrubberOverlayStyle(),
33426
33906
  {
33427
33907
  top: offsets.progress,
@@ -33429,24 +33909,24 @@ function ProgressPill({
33429
33909
  }
33430
33910
  ],
33431
33911
  children: /* @__PURE__ */ jsxs18(
33432
- View18,
33912
+ View20,
33433
33913
  {
33434
33914
  ref: scrubberRef,
33435
33915
  pointerEvents: resolvePageScrubberPointerEvents(),
33436
- style: [styles18.scrubber, { height: trackHeight }],
33916
+ style: [styles20.scrubber, { height: trackHeight }],
33437
33917
  onLayout: () => {
33438
33918
  scrubberRef.current?.measureInWindow((_x, y) => {
33439
33919
  trackYRef.current = y;
33440
33920
  });
33441
33921
  },
33442
33922
  children: [
33443
- /* @__PURE__ */ jsx22(
33923
+ /* @__PURE__ */ jsx24(
33444
33924
  Animated3.View,
33445
33925
  {
33446
33926
  pointerEvents: "none",
33447
33927
  style: [
33448
- styles18.track,
33449
- isDark && styles18.trackDark,
33928
+ styles20.track,
33929
+ isDark && styles20.trackDark,
33450
33930
  {
33451
33931
  transformOrigin: [0, trackOriginY, 0],
33452
33932
  opacity: trackReveal,
@@ -33456,24 +33936,24 @@ function ProgressPill({
33456
33936
  ]
33457
33937
  }
33458
33938
  ),
33459
- /* @__PURE__ */ jsx22(
33939
+ /* @__PURE__ */ jsx24(
33460
33940
  Animated3.View,
33461
33941
  {
33462
33942
  pointerEvents: "box-none",
33463
- style: [styles18.thumb, { top: thumbTopRef.current }],
33943
+ style: [styles20.thumb, { top: thumbTopRef.current }],
33464
33944
  children: /* @__PURE__ */ jsxs18(
33465
- View18,
33945
+ View20,
33466
33946
  {
33467
33947
  style: [
33468
- styles18.pill,
33469
- isDark && styles18.pillDark,
33948
+ styles20.pill,
33949
+ isDark && styles20.pillDark,
33470
33950
  { borderColor: `${accentColor}33` }
33471
33951
  ],
33472
33952
  ...responderPanHandlers,
33473
33953
  testID: "papyrus-progress-pill",
33474
33954
  children: [
33475
- /* @__PURE__ */ jsx22(View18, { style: styles18.labelHit, children: /* @__PURE__ */ jsx22(Text13, { style: [styles18.label, isDark && styles18.labelDark], children: label }) }),
33476
- /* @__PURE__ */ jsx22(View18, { style: styles18.iconHit, children: /* @__PURE__ */ jsx22(
33955
+ /* @__PURE__ */ jsx24(View20, { style: styles20.labelHit, children: /* @__PURE__ */ jsx24(Text13, { style: [styles20.label, isDark && styles20.labelDark], children: label }) }),
33956
+ /* @__PURE__ */ jsx24(View20, { style: styles20.iconHit, children: /* @__PURE__ */ jsx24(
33477
33957
  IconPageNav,
33478
33958
  {
33479
33959
  size: 20,
@@ -33492,7 +33972,7 @@ function ProgressPill({
33492
33972
  }
33493
33973
  );
33494
33974
  }
33495
- var styles18 = StyleSheet18.create({
33975
+ var styles20 = StyleSheet20.create({
33496
33976
  frame: {
33497
33977
  position: "absolute",
33498
33978
  top: 72,
@@ -33507,6 +33987,42 @@ var styles18 = StyleSheet18.create({
33507
33987
  position: "relative",
33508
33988
  marginRight: 4
33509
33989
  },
33990
+ singleFrame: {
33991
+ bottom: "auto"
33992
+ },
33993
+ singlePill: {
33994
+ minWidth: 150,
33995
+ minHeight: 44,
33996
+ marginRight: 4,
33997
+ paddingHorizontal: 4,
33998
+ flexDirection: "row",
33999
+ alignItems: "center",
34000
+ justifyContent: "space-between",
34001
+ borderRadius: 999,
34002
+ borderWidth: 1,
34003
+ borderColor: "rgba(148,163,184,0.35)",
34004
+ backgroundColor: "rgba(255,255,255,0.9)",
34005
+ elevation: 6
34006
+ },
34007
+ pageArrowHit: {
34008
+ width: 38,
34009
+ height: 38,
34010
+ alignItems: "center",
34011
+ justifyContent: "center"
34012
+ },
34013
+ pageArrow: {
34014
+ fontSize: 28,
34015
+ lineHeight: 32,
34016
+ color: "#111827"
34017
+ },
34018
+ pageArrowDisabled: {
34019
+ opacity: 0.28
34020
+ },
34021
+ singlePageCenter: {
34022
+ minWidth: 64,
34023
+ alignItems: "center",
34024
+ justifyContent: "center"
34025
+ },
33510
34026
  track: {
33511
34027
  position: "absolute",
33512
34028
  top: 0,
@@ -33562,17 +34078,17 @@ var styles18 = StyleSheet18.create({
33562
34078
  });
33563
34079
 
33564
34080
  // components/SearchOverlay.tsx
33565
- import React16, { useEffect as useEffect13, useMemo as useMemo8, useState as useState14 } from "react";
34081
+ import React18, { useEffect as useEffect15, useMemo as useMemo10, useState as useState14 } from "react";
33566
34082
  import {
33567
34083
  Keyboard,
33568
- Pressable as Pressable13,
33569
- StyleSheet as StyleSheet19,
34084
+ Pressable as Pressable14,
34085
+ StyleSheet as StyleSheet21,
33570
34086
  Text as Text14,
33571
34087
  TextInput as TextInput3,
33572
- View as View19,
34088
+ View as View21,
33573
34089
  useWindowDimensions as useWindowDimensions10
33574
34090
  } from "react-native";
33575
- import { SearchService, useViewerStore as useViewerStore16 } from "@papyrus-sdk/core";
34091
+ import { SearchService, useViewerStore as useViewerStore18 } from "@papyrus-sdk/core";
33576
34092
 
33577
34093
  // components/searchOverlayLayout.ts
33578
34094
  var getSearchOverlayLayout = (windowWidth) => {
@@ -33592,7 +34108,7 @@ var getSearchOverlayLayout = (windowWidth) => {
33592
34108
  };
33593
34109
 
33594
34110
  // components/SearchOverlay.tsx
33595
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
34111
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
33596
34112
  function SearchOverlay({
33597
34113
  engine,
33598
34114
  documentType,
@@ -33607,27 +34123,29 @@ function SearchOverlay({
33607
34123
  prevSearchResult,
33608
34124
  searchQuery,
33609
34125
  searchResults,
34126
+ textSearchResults,
33610
34127
  isLoaded,
33611
34128
  pageCount,
33612
34129
  setSearch,
33613
34130
  uiTheme,
33614
34131
  accentColor
33615
- } = useViewerStore16();
34132
+ } = useViewerStore18();
33616
34133
  const [draft, setDraft] = useState14(searchQuery);
33617
34134
  const [isSearching, setIsSearching] = useState14(false);
33618
- const searchRequestIdRef = React16.useRef(0);
34135
+ const searchRequestIdRef = React18.useRef(0);
33619
34136
  const isDark = uiTheme === "dark";
33620
34137
  const { width: windowWidth } = useWindowDimensions10();
33621
34138
  const overlayLayout = getSearchOverlayLayout(windowWidth);
33622
34139
  const offsets = resolveMobileChromeOffsets(usePapyrusSafeAreaInsets());
33623
34140
  const t = getStrings(locale);
33624
- const searchService = useMemo8(() => new SearchService(engine), [engine]);
33625
- useEffect13(() => {
34141
+ const searchService = useMemo10(() => new SearchService(engine), [engine]);
34142
+ const results = documentType === "text" ? textSearchResults : searchResults;
34143
+ useEffect15(() => {
33626
34144
  searchService.clearCache();
33627
34145
  }, [isLoaded, pageCount, searchService]);
33628
- const currentCount = searchResults.length > 0 && activeSearchIndex >= 0 ? activeSearchIndex + 1 : 0;
34146
+ const currentCount = results.length > 0 && activeSearchIndex >= 0 ? activeSearchIndex + 1 : 0;
33629
34147
  const targetLabel = documentType === "pdf" ? t.page : documentType === "epub" ? t.contents : t.progress;
33630
- useEffect13(() => {
34148
+ useEffect15(() => {
33631
34149
  if (!visible) return;
33632
34150
  setDraft(searchQuery);
33633
34151
  }, [searchQuery, visible]);
@@ -33641,9 +34159,9 @@ function SearchOverlay({
33641
34159
  }
33642
34160
  setIsSearching(true);
33643
34161
  try {
33644
- const results = await searchService.search(query);
34162
+ const nextResults = await searchService.searchReader(query);
33645
34163
  if (requestId !== searchRequestIdRef.current) return;
33646
- setSearch(query, results);
34164
+ setSearch(query, nextResults);
33647
34165
  } finally {
33648
34166
  if (requestId === searchRequestIdRef.current) setIsSearching(false);
33649
34167
  }
@@ -33654,12 +34172,12 @@ function SearchOverlay({
33654
34172
  onClose();
33655
34173
  };
33656
34174
  if (!visible) return null;
33657
- return /* @__PURE__ */ jsx23(
33658
- View19,
34175
+ return /* @__PURE__ */ jsx25(
34176
+ View21,
33659
34177
  {
33660
34178
  pointerEvents: "box-none",
33661
34179
  style: [
33662
- styles19.frame,
34180
+ styles21.frame,
33663
34181
  overlayLayout.frame,
33664
34182
  {
33665
34183
  bottom: offsets.search,
@@ -33668,22 +34186,22 @@ function SearchOverlay({
33668
34186
  }
33669
34187
  ],
33670
34188
  children: /* @__PURE__ */ jsxs19(
33671
- View19,
34189
+ View21,
33672
34190
  {
33673
- style: [styles19.card, overlayLayout.card, isDark && styles19.cardDark],
34191
+ style: [styles21.card, overlayLayout.card, isDark && styles21.cardDark],
33674
34192
  testID: "papyrus-search-overlay",
33675
34193
  children: [
33676
- /* @__PURE__ */ jsxs19(View19, { style: styles19.inputRow, children: [
33677
- /* @__PURE__ */ jsxs19(View19, { style: [styles19.searchInputWrap, isDark && styles19.searchInputWrapDark], children: [
33678
- /* @__PURE__ */ jsx23(IconSearch, { size: 16, color: isDark ? "#cbd5e1" : "#64748b" }),
33679
- /* @__PURE__ */ jsx23(
34194
+ /* @__PURE__ */ jsxs19(View21, { style: styles21.inputRow, children: [
34195
+ /* @__PURE__ */ jsxs19(View21, { style: [styles21.searchInputWrap, isDark && styles21.searchInputWrapDark], children: [
34196
+ /* @__PURE__ */ jsx25(IconSearch, { size: 16, color: isDark ? "#cbd5e1" : "#64748b" }),
34197
+ /* @__PURE__ */ jsx25(
33680
34198
  TextInput3,
33681
34199
  {
33682
34200
  value: draft,
33683
34201
  onChangeText: setDraft,
33684
34202
  placeholder: t.searchPlaceholder,
33685
34203
  placeholderTextColor: isDark ? "#94a3b8" : "#6b7280",
33686
- style: [styles19.input, isDark && styles19.inputDark],
34204
+ style: [styles21.input, isDark && styles21.inputDark],
33687
34205
  autoFocus: true,
33688
34206
  returnKeyType: "search",
33689
34207
  onSubmitEditing: handleSubmit,
@@ -33692,75 +34210,75 @@ function SearchOverlay({
33692
34210
  }
33693
34211
  )
33694
34212
  ] }),
33695
- /* @__PURE__ */ jsx23(
33696
- Pressable13,
34213
+ /* @__PURE__ */ jsx25(
34214
+ Pressable14,
33697
34215
  {
33698
34216
  onPress: handleClose,
33699
- style: [styles19.closeButton, isDark && styles19.closeButtonDark],
34217
+ style: [styles21.closeButton, isDark && styles21.closeButtonDark],
33700
34218
  accessibilityLabel: "Close search",
33701
- children: /* @__PURE__ */ jsx23(Text14, { style: [styles19.closeText, isDark && styles19.closeTextDark], children: t.cancel })
34219
+ children: /* @__PURE__ */ jsx25(Text14, { style: [styles21.closeText, isDark && styles21.closeTextDark], children: t.cancel })
33702
34220
  }
33703
34221
  )
33704
34222
  ] }),
33705
- /* @__PURE__ */ jsxs19(View19, { style: styles19.metaRow, children: [
33706
- /* @__PURE__ */ jsx23(
33707
- Pressable13,
34223
+ /* @__PURE__ */ jsxs19(View21, { style: styles21.metaRow, children: [
34224
+ /* @__PURE__ */ jsx25(
34225
+ Pressable14,
33708
34226
  {
33709
34227
  onPress: prevSearchResult,
33710
- disabled: searchResults.length === 0,
34228
+ disabled: results.length === 0,
33711
34229
  style: [
33712
- styles19.navButton,
33713
- isDark && styles19.navButtonDark,
33714
- searchResults.length === 0 && styles19.navButtonDisabled
34230
+ styles21.navButton,
34231
+ isDark && styles21.navButtonDark,
34232
+ results.length === 0 && styles21.navButtonDisabled
33715
34233
  ],
33716
34234
  accessibilityLabel: "Previous result",
33717
- children: /* @__PURE__ */ jsx23(IconChevronLeft, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
34235
+ children: /* @__PURE__ */ jsx25(IconChevronLeft, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
33718
34236
  }
33719
34237
  ),
33720
- /* @__PURE__ */ jsx23(Text14, { style: [styles19.metaText, isDark && styles19.metaTextDark], children: isSearching ? t.searching : `${currentCount}/${searchResults.length} ${targetLabel}` }),
33721
- /* @__PURE__ */ jsx23(
33722
- Pressable13,
34238
+ /* @__PURE__ */ jsx25(Text14, { style: [styles21.metaText, isDark && styles21.metaTextDark], children: isSearching ? t.searching : `${currentCount}/${results.length} ${targetLabel}` }),
34239
+ /* @__PURE__ */ jsx25(
34240
+ Pressable14,
33723
34241
  {
33724
34242
  onPress: nextSearchResult,
33725
- disabled: searchResults.length === 0,
34243
+ disabled: results.length === 0,
33726
34244
  style: [
33727
- styles19.navButton,
33728
- isDark && styles19.navButtonDark,
33729
- searchResults.length === 0 && styles19.navButtonDisabled
34245
+ styles21.navButton,
34246
+ isDark && styles21.navButtonDark,
34247
+ results.length === 0 && styles21.navButtonDisabled
33730
34248
  ],
33731
34249
  accessibilityLabel: "Next result",
33732
- children: /* @__PURE__ */ jsx23(IconChevronRight, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
34250
+ children: /* @__PURE__ */ jsx25(IconChevronRight, { size: 16, color: isDark ? "#e5e7eb" : "#111827" })
33733
34251
  }
33734
34252
  )
33735
34253
  ] }),
33736
- /* @__PURE__ */ jsxs19(View19, { style: styles19.actionsRow, children: [
33737
- /* @__PURE__ */ jsx23(
33738
- Pressable13,
34254
+ /* @__PURE__ */ jsxs19(View21, { style: styles21.actionsRow, children: [
34255
+ /* @__PURE__ */ jsx25(
34256
+ Pressable14,
33739
34257
  {
33740
34258
  onPress: handleSubmit,
33741
- style: [styles19.primaryAction, { backgroundColor: accentColor }],
34259
+ style: [styles21.primaryAction, { backgroundColor: accentColor }],
33742
34260
  accessibilityLabel: "Run search",
33743
34261
  testID: "papyrus-search-run",
33744
- children: /* @__PURE__ */ jsx23(Text14, { style: styles19.primaryActionText, children: t.searchGo })
34262
+ children: /* @__PURE__ */ jsx25(Text14, { style: styles21.primaryActionText, children: t.searchGo })
33745
34263
  }
33746
34264
  ),
33747
- /* @__PURE__ */ jsx23(
33748
- Pressable13,
34265
+ /* @__PURE__ */ jsx25(
34266
+ Pressable14,
33749
34267
  {
33750
34268
  onPress: onOpenResults,
33751
- disabled: searchResults.length === 0,
34269
+ disabled: results.length === 0,
33752
34270
  style: [
33753
- styles19.secondaryAction,
33754
- isDark && styles19.secondaryActionDark,
33755
- searchResults.length === 0 && styles19.navButtonDisabled
34271
+ styles21.secondaryAction,
34272
+ isDark && styles21.secondaryActionDark,
34273
+ results.length === 0 && styles21.navButtonDisabled
33756
34274
  ],
33757
34275
  accessibilityLabel: "Open all results",
33758
- children: /* @__PURE__ */ jsx23(
34276
+ children: /* @__PURE__ */ jsx25(
33759
34277
  Text14,
33760
34278
  {
33761
34279
  style: [
33762
- styles19.secondaryActionText,
33763
- isDark && styles19.secondaryActionTextDark
34280
+ styles21.secondaryActionText,
34281
+ isDark && styles21.secondaryActionTextDark
33764
34282
  ],
33765
34283
  children: t.allResults
33766
34284
  }
@@ -33774,7 +34292,7 @@ function SearchOverlay({
33774
34292
  }
33775
34293
  );
33776
34294
  }
33777
- var styles19 = StyleSheet19.create({
34295
+ var styles21 = StyleSheet21.create({
33778
34296
  frame: {
33779
34297
  position: "absolute",
33780
34298
  left: 0,
@@ -33915,9 +34433,9 @@ var styles19 = StyleSheet19.create({
33915
34433
  });
33916
34434
 
33917
34435
  // components/SearchResultsSheet.tsx
33918
- import { Pressable as Pressable14, StyleSheet as StyleSheet20, Text as Text15 } from "react-native";
33919
- import { useViewerStore as useViewerStore17 } from "@papyrus-sdk/core";
33920
- import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
34436
+ import { Pressable as Pressable15, StyleSheet as StyleSheet22, Text as Text15 } from "react-native";
34437
+ import { useViewerStore as useViewerStore19 } from "@papyrus-sdk/core";
34438
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
33921
34439
  function SearchResultsSheet({
33922
34440
  documentType,
33923
34441
  visible,
@@ -33928,11 +34446,15 @@ function SearchResultsSheet({
33928
34446
  locale,
33929
34447
  pageCount,
33930
34448
  searchResults,
34449
+ textSearchResults,
34450
+ textLength,
33931
34451
  setDocumentState,
33932
34452
  triggerScrollToPage,
34453
+ triggerScrollToTextOffset,
33933
34454
  uiTheme,
33934
34455
  accentColor
33935
- } = useViewerStore17();
34456
+ } = useViewerStore19();
34457
+ const results = documentType === "text" ? textSearchResults : searchResults;
33936
34458
  const isDark = uiTheme === "dark";
33937
34459
  const palette = getReaderSheetPalette(isDark);
33938
34460
  const t = getStrings(locale);
@@ -33942,6 +34464,7 @@ function SearchResultsSheet({
33942
34464
  const percent = pageCount <= 1 ? 100 : Math.round((pageIndex + 1) / pageCount * 100);
33943
34465
  return `${t.progress} ${percent}%`;
33944
34466
  };
34467
+ const getTextResultLabel = (offset) => `${t.progress} ${textLength <= 0 ? 0 : Math.round(offset / textLength * 100)}%`;
33945
34468
  return /* @__PURE__ */ jsxs20(
33946
34469
  NativeSheet,
33947
34470
  {
@@ -33958,44 +34481,53 @@ function SearchResultsSheet({
33958
34481
  borderTopColor: palette.divider
33959
34482
  },
33960
34483
  children: [
33961
- /* @__PURE__ */ jsxs20(Text15, { style: [styles20.meta, { color: palette.mutedText }], children: [
33962
- searchResults.length,
34484
+ /* @__PURE__ */ jsxs20(Text15, { style: [styles22.meta, { color: palette.mutedText }], children: [
34485
+ results.length,
33963
34486
  " ",
33964
34487
  t.results
33965
34488
  ] }),
33966
- /* @__PURE__ */ jsx24(NativeSheetScrollView, { contentContainerStyle: styles20.content, children: searchResults.length === 0 ? /* @__PURE__ */ jsx24(Text15, { style: [styles20.emptyText, { color: palette.mutedText }], children: t.noResults }) : searchResults.map((result, index) => {
34489
+ /* @__PURE__ */ jsx26(NativeSheetScrollView, { contentContainerStyle: styles22.content, children: results.length === 0 ? /* @__PURE__ */ jsx26(Text15, { style: [styles22.emptyText, { color: palette.mutedText }], children: t.noResults }) : results.map((result, index) => {
33967
34490
  const isActive = index === activeSearchIndex;
34491
+ const isTextResult = "kind" in result && result.kind === "text";
33968
34492
  return /* @__PURE__ */ jsxs20(
33969
- Pressable14,
34493
+ Pressable15,
33970
34494
  {
33971
34495
  onPress: () => {
33972
- setDocumentState({
33973
- activeSearchIndex: index,
33974
- currentPage: result.pageIndex + 1
33975
- });
33976
- triggerScrollToPage(result.pageIndex);
34496
+ if (isTextResult) {
34497
+ setDocumentState({
34498
+ activeSearchIndex: index,
34499
+ currentTextOffset: result.location.start
34500
+ });
34501
+ triggerScrollToTextOffset(result.location.start);
34502
+ } else {
34503
+ setDocumentState({
34504
+ activeSearchIndex: index,
34505
+ currentPage: result.pageIndex + 1
34506
+ });
34507
+ triggerScrollToPage(result.pageIndex);
34508
+ }
33977
34509
  onClose();
33978
34510
  },
33979
34511
  style: [
33980
- styles20.resultCard,
34512
+ styles22.resultCard,
33981
34513
  {
33982
34514
  borderColor: isActive ? accentColor : palette.divider,
33983
34515
  backgroundColor: isActive ? `${accentColor}14` : palette.elevatedSurface
33984
34516
  }
33985
34517
  ],
33986
34518
  children: [
33987
- /* @__PURE__ */ jsx24(Text15, { style: [styles20.resultLabel, { color: accentColor }], children: getResultLabel(result.pageIndex) }),
33988
- /* @__PURE__ */ jsx24(Text15, { style: [styles20.resultText, { color: palette.text }], children: result.text })
34519
+ /* @__PURE__ */ jsx26(Text15, { style: [styles22.resultLabel, { color: accentColor }], children: isTextResult ? getTextResultLabel(result.location.start) : getResultLabel(result.pageIndex) }),
34520
+ /* @__PURE__ */ jsx26(Text15, { style: [styles22.resultText, { color: palette.text }], children: result.text })
33989
34521
  ]
33990
34522
  },
33991
- `${result.pageIndex}-${index}`
34523
+ isTextResult ? `text-${result.location.start}-${index}` : `page-${result.pageIndex}-${index}`
33992
34524
  );
33993
34525
  }) })
33994
34526
  ]
33995
34527
  }
33996
34528
  );
33997
34529
  }
33998
- var styles20 = StyleSheet20.create({
34530
+ var styles22 = StyleSheet22.create({
33999
34531
  meta: { fontSize: 12, paddingHorizontal: 18, marginBottom: 10 },
34000
34532
  content: { paddingHorizontal: 18, paddingBottom: 18, gap: 10 },
34001
34533
  emptyText: { fontSize: 13 },
@@ -34015,7 +34547,7 @@ var styles20 = StyleSheet20.create({
34015
34547
  var isSidebarBoundDestination = (destination) => destination === "pages" || destination === "contents" || destination === "progress" || destination === "notes";
34016
34548
 
34017
34549
  // components/ReadingShell.tsx
34018
- import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
34550
+ import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
34019
34551
  function ReadingShell({
34020
34552
  engine,
34021
34553
  title,
@@ -34035,7 +34567,7 @@ function ReadingShell({
34035
34567
  pageCount,
34036
34568
  uiTheme,
34037
34569
  accentColor
34038
- } = useViewerStore18();
34570
+ } = useViewerStore20();
34039
34571
  const [overflowOpen, setOverflowOpen] = useState15(false);
34040
34572
  const [infoOpen, setInfoOpen] = useState15(false);
34041
34573
  const [actionsOpen, setActionsOpen] = useState15(false);
@@ -34044,7 +34576,7 @@ function ReadingShell({
34044
34576
  const [pageJumpOpen, setPageJumpOpen] = useState15(false);
34045
34577
  const [pageScrubActive, setPageScrubActive] = useState15(false);
34046
34578
  const isDark = uiTheme === "dark";
34047
- React17.useEffect(() => {
34579
+ React19.useEffect(() => {
34048
34580
  const showSubscription = Keyboard2.addListener("keyboardDidShow", () => {
34049
34581
  setMobileKeyboardOpen(true);
34050
34582
  });
@@ -34056,7 +34588,7 @@ function ReadingShell({
34056
34588
  hideSubscription.remove();
34057
34589
  };
34058
34590
  }, [setMobileKeyboardOpen]);
34059
- React17.useEffect(() => {
34591
+ React19.useEffect(() => {
34060
34592
  if (sidebarRightOpen) return;
34061
34593
  if (isSidebarBoundDestination(activeMobileDestination)) {
34062
34594
  closeMobileDestination();
@@ -34102,8 +34634,8 @@ function ReadingShell({
34102
34634
  setDocumentState({ currentPage: page });
34103
34635
  triggerScrollToPage(page - 1);
34104
34636
  };
34105
- return /* @__PURE__ */ jsx25(PapyrusSafeAreaBoundary, { children: /* @__PURE__ */ jsxs21(View20, { style: styles21.container, testID: "papyrus-rn-reading-shell", children: [
34106
- /* @__PURE__ */ jsx25(
34637
+ return /* @__PURE__ */ jsx27(PapyrusSafeAreaBoundary, { children: /* @__PURE__ */ jsxs21(View22, { style: styles23.container, testID: "papyrus-rn-reading-shell", children: [
34638
+ /* @__PURE__ */ jsx27(
34107
34639
  Topbar_default,
34108
34640
  {
34109
34641
  engine,
@@ -34119,7 +34651,7 @@ function ReadingShell({
34119
34651
  showPageNavigationControls: false
34120
34652
  }
34121
34653
  ),
34122
- /* @__PURE__ */ jsx25(View20, { style: styles21.viewerStage, children: /* @__PURE__ */ jsx25(
34654
+ /* @__PURE__ */ jsx27(View22, { style: styles23.viewerStage, children: /* @__PURE__ */ jsx27(
34123
34655
  Viewer_default,
34124
34656
  {
34125
34657
  engine,
@@ -34127,7 +34659,7 @@ function ReadingShell({
34127
34659
  pageScrubActive
34128
34660
  }
34129
34661
  ) }),
34130
- /* @__PURE__ */ jsx25(
34662
+ /* @__PURE__ */ jsx27(
34131
34663
  ProgressPill,
34132
34664
  {
34133
34665
  documentType,
@@ -34139,7 +34671,7 @@ function ReadingShell({
34139
34671
  onScrubbingChange: setPageScrubActive
34140
34672
  }
34141
34673
  ),
34142
- /* @__PURE__ */ jsx25(
34674
+ /* @__PURE__ */ jsx27(
34143
34675
  BottomBar_default,
34144
34676
  {
34145
34677
  documentType,
@@ -34148,7 +34680,7 @@ function ReadingShell({
34148
34680
  onOpenSettings: () => openDestination("display")
34149
34681
  }
34150
34682
  ),
34151
- /* @__PURE__ */ jsx25(
34683
+ /* @__PURE__ */ jsx27(
34152
34684
  SearchOverlay,
34153
34685
  {
34154
34686
  engine,
@@ -34165,7 +34697,7 @@ function ReadingShell({
34165
34697
  }
34166
34698
  }
34167
34699
  ),
34168
- /* @__PURE__ */ jsx25(
34700
+ /* @__PURE__ */ jsx27(
34169
34701
  SearchResultsSheet,
34170
34702
  {
34171
34703
  documentType,
@@ -34173,7 +34705,7 @@ function ReadingShell({
34173
34705
  onClose: () => setSearchResultsOpen(false)
34174
34706
  }
34175
34707
  ),
34176
- /* @__PURE__ */ jsx25(
34708
+ /* @__PURE__ */ jsx27(
34177
34709
  RightSheet_default,
34178
34710
  {
34179
34711
  engine,
@@ -34182,7 +34714,7 @@ function ReadingShell({
34182
34714
  onOpenPageJump: () => setPageJumpOpen(true)
34183
34715
  }
34184
34716
  ),
34185
- /* @__PURE__ */ jsx25(
34717
+ /* @__PURE__ */ jsx27(
34186
34718
  OverflowSheet,
34187
34719
  {
34188
34720
  visible: overflowOpen,
@@ -34196,7 +34728,7 @@ function ReadingShell({
34196
34728
  }
34197
34729
  }
34198
34730
  ),
34199
- /* @__PURE__ */ jsx25(
34731
+ /* @__PURE__ */ jsx27(
34200
34732
  InfoSheet,
34201
34733
  {
34202
34734
  visible: infoOpen,
@@ -34208,7 +34740,7 @@ function ReadingShell({
34208
34740
  }
34209
34741
  }
34210
34742
  ),
34211
- /* @__PURE__ */ jsx25(
34743
+ /* @__PURE__ */ jsx27(
34212
34744
  DocumentActionsSheet,
34213
34745
  {
34214
34746
  visible: actionsOpen,
@@ -34218,10 +34750,11 @@ function ReadingShell({
34218
34750
  }
34219
34751
  }
34220
34752
  ),
34221
- /* @__PURE__ */ jsx25(
34753
+ /* @__PURE__ */ jsx27(
34222
34754
  SettingsSheet_default,
34223
34755
  {
34224
34756
  engine,
34757
+ documentType,
34225
34758
  visible: settingsOpen,
34226
34759
  onClose: () => {
34227
34760
  setSettingsOpen(false);
@@ -34229,7 +34762,7 @@ function ReadingShell({
34229
34762
  }
34230
34763
  }
34231
34764
  ),
34232
- /* @__PURE__ */ jsx25(
34765
+ /* @__PURE__ */ jsx27(
34233
34766
  PageJumpModal,
34234
34767
  {
34235
34768
  visible: pageJumpOpen,
@@ -34243,7 +34776,7 @@ function ReadingShell({
34243
34776
  )
34244
34777
  ] }) });
34245
34778
  }
34246
- var styles21 = StyleSheet21.create({
34779
+ var styles23 = StyleSheet23.create({
34247
34780
  container: {
34248
34781
  flex: 1
34249
34782
  },