pdfjs-reader-core 0.2.17 → 0.3.0
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.cjs +573 -290
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +565 -284
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1784,6 +1784,85 @@ var init_coordinates = __esm({
|
|
|
1784
1784
|
}
|
|
1785
1785
|
});
|
|
1786
1786
|
|
|
1787
|
+
// src/utils/page-turn-sound.ts
|
|
1788
|
+
function getAudioContext() {
|
|
1789
|
+
if (typeof window === "undefined") return null;
|
|
1790
|
+
if (!audioContext) {
|
|
1791
|
+
try {
|
|
1792
|
+
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
1793
|
+
} catch {
|
|
1794
|
+
return null;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return audioContext;
|
|
1798
|
+
}
|
|
1799
|
+
function playPageTurnSound(volume = 0.3) {
|
|
1800
|
+
const ctx = getAudioContext();
|
|
1801
|
+
if (!ctx) return;
|
|
1802
|
+
if (ctx.state === "suspended") {
|
|
1803
|
+
ctx.resume();
|
|
1804
|
+
}
|
|
1805
|
+
const now = ctx.currentTime;
|
|
1806
|
+
const duration = 0.35;
|
|
1807
|
+
const bufferSize = Math.floor(ctx.sampleRate * duration);
|
|
1808
|
+
const noiseBuffer = ctx.createBuffer(1, bufferSize, ctx.sampleRate);
|
|
1809
|
+
const data = noiseBuffer.getChannelData(0);
|
|
1810
|
+
for (let i = 0; i < bufferSize; i++) {
|
|
1811
|
+
data[i] = Math.random() * 2 - 1;
|
|
1812
|
+
}
|
|
1813
|
+
const noiseSource = ctx.createBufferSource();
|
|
1814
|
+
noiseSource.buffer = noiseBuffer;
|
|
1815
|
+
const bandpass = ctx.createBiquadFilter();
|
|
1816
|
+
bandpass.type = "bandpass";
|
|
1817
|
+
bandpass.frequency.setValueAtTime(3e3, now);
|
|
1818
|
+
bandpass.frequency.exponentialRampToValueAtTime(800, now + duration * 0.6);
|
|
1819
|
+
bandpass.Q.setValueAtTime(0.8, now);
|
|
1820
|
+
const highpass = ctx.createBiquadFilter();
|
|
1821
|
+
highpass.type = "highpass";
|
|
1822
|
+
highpass.frequency.setValueAtTime(400, now);
|
|
1823
|
+
highpass.frequency.linearRampToValueAtTime(200, now + duration);
|
|
1824
|
+
const envelope = ctx.createGain();
|
|
1825
|
+
envelope.gain.setValueAtTime(0, now);
|
|
1826
|
+
envelope.gain.linearRampToValueAtTime(volume * 0.6, now + 0.02);
|
|
1827
|
+
envelope.gain.setValueAtTime(volume * 0.6, now + 0.05);
|
|
1828
|
+
envelope.gain.linearRampToValueAtTime(volume, now + duration * 0.3);
|
|
1829
|
+
envelope.gain.exponentialRampToValueAtTime(1e-3, now + duration);
|
|
1830
|
+
const snapBuffer = ctx.createBuffer(1, Math.floor(ctx.sampleRate * 0.08), ctx.sampleRate);
|
|
1831
|
+
const snapData = snapBuffer.getChannelData(0);
|
|
1832
|
+
for (let i = 0; i < snapData.length; i++) {
|
|
1833
|
+
snapData[i] = Math.random() * 2 - 1;
|
|
1834
|
+
}
|
|
1835
|
+
const snapSource = ctx.createBufferSource();
|
|
1836
|
+
snapSource.buffer = snapBuffer;
|
|
1837
|
+
const snapFilter = ctx.createBiquadFilter();
|
|
1838
|
+
snapFilter.type = "bandpass";
|
|
1839
|
+
snapFilter.frequency.setValueAtTime(2e3, now);
|
|
1840
|
+
snapFilter.Q.setValueAtTime(1.5, now);
|
|
1841
|
+
const snapEnvelope = ctx.createGain();
|
|
1842
|
+
snapEnvelope.gain.setValueAtTime(0, now);
|
|
1843
|
+
snapEnvelope.gain.setValueAtTime(0, now + duration * 0.7);
|
|
1844
|
+
snapEnvelope.gain.linearRampToValueAtTime(volume * 0.8, now + duration * 0.75);
|
|
1845
|
+
snapEnvelope.gain.exponentialRampToValueAtTime(1e-3, now + duration);
|
|
1846
|
+
noiseSource.connect(bandpass);
|
|
1847
|
+
bandpass.connect(highpass);
|
|
1848
|
+
highpass.connect(envelope);
|
|
1849
|
+
envelope.connect(ctx.destination);
|
|
1850
|
+
snapSource.connect(snapFilter);
|
|
1851
|
+
snapFilter.connect(snapEnvelope);
|
|
1852
|
+
snapEnvelope.connect(ctx.destination);
|
|
1853
|
+
noiseSource.start(now);
|
|
1854
|
+
noiseSource.stop(now + duration);
|
|
1855
|
+
snapSource.start(now);
|
|
1856
|
+
snapSource.stop(now + duration);
|
|
1857
|
+
}
|
|
1858
|
+
var audioContext;
|
|
1859
|
+
var init_page_turn_sound = __esm({
|
|
1860
|
+
"src/utils/page-turn-sound.ts"() {
|
|
1861
|
+
"use strict";
|
|
1862
|
+
audioContext = null;
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
|
|
1787
1866
|
// src/utils/index.ts
|
|
1788
1867
|
var init_utils = __esm({
|
|
1789
1868
|
"src/utils/index.ts"() {
|
|
@@ -1798,6 +1877,7 @@ var init_utils = __esm({
|
|
|
1798
1877
|
init_agent_api();
|
|
1799
1878
|
init_text_search();
|
|
1800
1879
|
init_coordinates();
|
|
1880
|
+
init_page_turn_sound();
|
|
1801
1881
|
}
|
|
1802
1882
|
});
|
|
1803
1883
|
|
|
@@ -9839,16 +9919,211 @@ var init_DualPageContainer = __esm({
|
|
|
9839
9919
|
}
|
|
9840
9920
|
});
|
|
9841
9921
|
|
|
9922
|
+
// src/components/PDFViewer/BookModeContainer.tsx
|
|
9923
|
+
var import_react41, import_react_pageflip, import_jsx_runtime27, BookPage, BookModeContainer;
|
|
9924
|
+
var init_BookModeContainer = __esm({
|
|
9925
|
+
"src/components/PDFViewer/BookModeContainer.tsx"() {
|
|
9926
|
+
"use strict";
|
|
9927
|
+
import_react41 = __toESM(require("react"), 1);
|
|
9928
|
+
import_react_pageflip = __toESM(require("react-pageflip"), 1);
|
|
9929
|
+
init_PDFPage2();
|
|
9930
|
+
init_PDFLoadingScreen2();
|
|
9931
|
+
init_hooks();
|
|
9932
|
+
init_utils();
|
|
9933
|
+
import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9934
|
+
BookPage = import_react41.default.forwardRef(function BookPage2({ pageNumber, page, scale, rotation, width, height }, ref) {
|
|
9935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: "book-page", "data-page-number": pageNumber, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { width, height, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9936
|
+
PDFPage,
|
|
9937
|
+
{
|
|
9938
|
+
pageNumber,
|
|
9939
|
+
page,
|
|
9940
|
+
scale,
|
|
9941
|
+
rotation,
|
|
9942
|
+
showTextLayer: false,
|
|
9943
|
+
showAnnotationLayer: false,
|
|
9944
|
+
showHighlightLayer: false
|
|
9945
|
+
}
|
|
9946
|
+
) }) });
|
|
9947
|
+
});
|
|
9948
|
+
BookModeContainer = (0, import_react41.memo)(function BookModeContainer2({
|
|
9949
|
+
className,
|
|
9950
|
+
flippingTime = 800,
|
|
9951
|
+
drawShadow = true,
|
|
9952
|
+
maxShadowOpacity = 0.7
|
|
9953
|
+
}) {
|
|
9954
|
+
const {
|
|
9955
|
+
document: document2,
|
|
9956
|
+
currentPage,
|
|
9957
|
+
numPages,
|
|
9958
|
+
scale,
|
|
9959
|
+
rotation,
|
|
9960
|
+
theme,
|
|
9961
|
+
isLoading,
|
|
9962
|
+
goToPage
|
|
9963
|
+
} = usePDFViewer();
|
|
9964
|
+
const scrollToPageRequest = useViewerStore((s) => s.scrollToPageRequest);
|
|
9965
|
+
const { viewerStore } = usePDFViewerStores();
|
|
9966
|
+
const [pages, setPages] = (0, import_react41.useState)([]);
|
|
9967
|
+
const [pageDims, setPageDims] = (0, import_react41.useState)({ width: 612, height: 792 });
|
|
9968
|
+
const [isLoadingPages, setIsLoadingPages] = (0, import_react41.useState)(false);
|
|
9969
|
+
const flipBookRef = (0, import_react41.useRef)(null);
|
|
9970
|
+
const isSyncingRef = (0, import_react41.useRef)(false);
|
|
9971
|
+
(0, import_react41.useEffect)(() => {
|
|
9972
|
+
if (!document2) {
|
|
9973
|
+
setPages([]);
|
|
9974
|
+
return;
|
|
9975
|
+
}
|
|
9976
|
+
let cancelled = false;
|
|
9977
|
+
const loadAllPages = async () => {
|
|
9978
|
+
setIsLoadingPages(true);
|
|
9979
|
+
try {
|
|
9980
|
+
const pagePromises = [];
|
|
9981
|
+
for (let i = 1; i <= numPages; i++) {
|
|
9982
|
+
pagePromises.push(document2.getPage(i));
|
|
9983
|
+
}
|
|
9984
|
+
const results = await Promise.allSettled(pagePromises);
|
|
9985
|
+
if (!cancelled) {
|
|
9986
|
+
const loaded = results.map((r) => r.status === "fulfilled" ? r.value : null);
|
|
9987
|
+
setPages(loaded);
|
|
9988
|
+
const firstPage = loaded[0];
|
|
9989
|
+
if (firstPage) {
|
|
9990
|
+
const vp = firstPage.getViewport({ scale, rotation });
|
|
9991
|
+
setPageDims({ width: Math.floor(vp.width), height: Math.floor(vp.height) });
|
|
9992
|
+
}
|
|
9993
|
+
}
|
|
9994
|
+
} catch {
|
|
9995
|
+
} finally {
|
|
9996
|
+
if (!cancelled) setIsLoadingPages(false);
|
|
9997
|
+
}
|
|
9998
|
+
};
|
|
9999
|
+
loadAllPages();
|
|
10000
|
+
return () => {
|
|
10001
|
+
cancelled = true;
|
|
10002
|
+
};
|
|
10003
|
+
}, [document2, numPages, scale, rotation]);
|
|
10004
|
+
(0, import_react41.useEffect)(() => {
|
|
10005
|
+
if (pages[0]) {
|
|
10006
|
+
const vp = pages[0].getViewport({ scale, rotation });
|
|
10007
|
+
setPageDims({ width: Math.floor(vp.width), height: Math.floor(vp.height) });
|
|
10008
|
+
}
|
|
10009
|
+
}, [pages, scale, rotation]);
|
|
10010
|
+
(0, import_react41.useEffect)(() => {
|
|
10011
|
+
const pageFlip = flipBookRef.current?.pageFlip();
|
|
10012
|
+
if (!pageFlip) return;
|
|
10013
|
+
const flipBookPage = pageFlip.getCurrentPageIndex();
|
|
10014
|
+
const targetIndex = currentPage - 1;
|
|
10015
|
+
if (flipBookPage !== targetIndex) {
|
|
10016
|
+
isSyncingRef.current = true;
|
|
10017
|
+
pageFlip.turnToPage(targetIndex);
|
|
10018
|
+
setTimeout(() => {
|
|
10019
|
+
isSyncingRef.current = false;
|
|
10020
|
+
}, 100);
|
|
10021
|
+
}
|
|
10022
|
+
}, [currentPage]);
|
|
10023
|
+
(0, import_react41.useEffect)(() => {
|
|
10024
|
+
if (scrollToPageRequest) {
|
|
10025
|
+
requestAnimationFrame(() => {
|
|
10026
|
+
viewerStore.getState().completeScrollRequest(scrollToPageRequest.requestId);
|
|
10027
|
+
});
|
|
10028
|
+
}
|
|
10029
|
+
}, [scrollToPageRequest, viewerStore]);
|
|
10030
|
+
const handleFlip = (0, import_react41.useCallback)((e) => {
|
|
10031
|
+
if (isSyncingRef.current) return;
|
|
10032
|
+
const newPage = e.data + 1;
|
|
10033
|
+
if (newPage !== currentPage && newPage >= 1 && newPage <= numPages) {
|
|
10034
|
+
goToPage(newPage);
|
|
10035
|
+
}
|
|
10036
|
+
}, [currentPage, numPages, goToPage]);
|
|
10037
|
+
const themeStyles = {
|
|
10038
|
+
light: "bg-gray-100",
|
|
10039
|
+
dark: "bg-gray-900",
|
|
10040
|
+
sepia: "bg-amber-50"
|
|
10041
|
+
};
|
|
10042
|
+
const themeClass = theme === "dark" ? "dark" : theme === "sepia" ? "sepia" : "";
|
|
10043
|
+
if (!document2) {
|
|
10044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("document-container", "flex-1", themeStyles[theme], className), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFLoadingScreen, { phase: isLoading ? "fetching" : "initializing" }) });
|
|
10045
|
+
}
|
|
10046
|
+
if (isLoadingPages || pages.length === 0) {
|
|
10047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("document-container", "flex-1", themeStyles[theme], className), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFLoadingScreen, { phase: "rendering" }) });
|
|
10048
|
+
}
|
|
10049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10050
|
+
"div",
|
|
10051
|
+
{
|
|
10052
|
+
className: cn(
|
|
10053
|
+
"book-mode-container",
|
|
10054
|
+
"flex-1 overflow-hidden",
|
|
10055
|
+
"flex items-center justify-center",
|
|
10056
|
+
themeStyles[theme],
|
|
10057
|
+
themeClass,
|
|
10058
|
+
className
|
|
10059
|
+
),
|
|
10060
|
+
style: { userSelect: "none", WebkitUserSelect: "none" },
|
|
10061
|
+
children: [
|
|
10062
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10063
|
+
import_react_pageflip.default,
|
|
10064
|
+
{
|
|
10065
|
+
ref: flipBookRef,
|
|
10066
|
+
width: pageDims.width,
|
|
10067
|
+
height: pageDims.height,
|
|
10068
|
+
size: "stretch",
|
|
10069
|
+
minWidth: 300,
|
|
10070
|
+
maxWidth: pageDims.width,
|
|
10071
|
+
minHeight: 400,
|
|
10072
|
+
maxHeight: pageDims.height,
|
|
10073
|
+
drawShadow,
|
|
10074
|
+
maxShadowOpacity,
|
|
10075
|
+
flippingTime,
|
|
10076
|
+
usePortrait: true,
|
|
10077
|
+
startPage: currentPage - 1,
|
|
10078
|
+
showCover: false,
|
|
10079
|
+
mobileScrollSupport: false,
|
|
10080
|
+
swipeDistance: 30,
|
|
10081
|
+
showPageCorners: true,
|
|
10082
|
+
useMouseEvents: true,
|
|
10083
|
+
clickEventForward: false,
|
|
10084
|
+
onFlip: handleFlip,
|
|
10085
|
+
className: "book-flipbook",
|
|
10086
|
+
style: {},
|
|
10087
|
+
startZIndex: 0,
|
|
10088
|
+
autoSize: true,
|
|
10089
|
+
renderOnlyPageLengthChange: false,
|
|
10090
|
+
disableFlipByClick: false,
|
|
10091
|
+
children: pages.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10092
|
+
BookPage,
|
|
10093
|
+
{
|
|
10094
|
+
pageNumber: index + 1,
|
|
10095
|
+
page,
|
|
10096
|
+
scale,
|
|
10097
|
+
rotation,
|
|
10098
|
+
width: pageDims.width,
|
|
10099
|
+
height: pageDims.height
|
|
10100
|
+
},
|
|
10101
|
+
index
|
|
10102
|
+
))
|
|
10103
|
+
}
|
|
10104
|
+
),
|
|
10105
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "book-page-indicator", children: [
|
|
10106
|
+
currentPage,
|
|
10107
|
+
" / ",
|
|
10108
|
+
numPages
|
|
10109
|
+
] })
|
|
10110
|
+
]
|
|
10111
|
+
}
|
|
10112
|
+
);
|
|
10113
|
+
});
|
|
10114
|
+
}
|
|
10115
|
+
});
|
|
10116
|
+
|
|
9842
10117
|
// src/components/FloatingZoomControls/FloatingZoomControls.tsx
|
|
9843
|
-
var
|
|
10118
|
+
var import_react42, import_jsx_runtime28, FloatingZoomControls;
|
|
9844
10119
|
var init_FloatingZoomControls = __esm({
|
|
9845
10120
|
"src/components/FloatingZoomControls/FloatingZoomControls.tsx"() {
|
|
9846
10121
|
"use strict";
|
|
9847
|
-
|
|
10122
|
+
import_react42 = require("react");
|
|
9848
10123
|
init_hooks();
|
|
9849
10124
|
init_utils();
|
|
9850
|
-
|
|
9851
|
-
FloatingZoomControls = (0,
|
|
10125
|
+
import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10126
|
+
FloatingZoomControls = (0, import_react42.memo)(function FloatingZoomControls2({
|
|
9852
10127
|
position = "bottom-right",
|
|
9853
10128
|
className,
|
|
9854
10129
|
showFitToWidth = true,
|
|
@@ -9858,20 +10133,20 @@ var init_FloatingZoomControls = __esm({
|
|
|
9858
10133
|
const { viewerStore } = usePDFViewerStores();
|
|
9859
10134
|
const scale = useViewerStore((s) => s.scale);
|
|
9860
10135
|
const document2 = useViewerStore((s) => s.document);
|
|
9861
|
-
const handleZoomIn = (0,
|
|
10136
|
+
const handleZoomIn = (0, import_react42.useCallback)(() => {
|
|
9862
10137
|
const currentScale = viewerStore.getState().scale;
|
|
9863
10138
|
const newScale = Math.min(4, currentScale + 0.05);
|
|
9864
10139
|
viewerStore.getState().setScale(newScale);
|
|
9865
10140
|
}, [viewerStore]);
|
|
9866
|
-
const handleZoomOut = (0,
|
|
10141
|
+
const handleZoomOut = (0, import_react42.useCallback)(() => {
|
|
9867
10142
|
const currentScale = viewerStore.getState().scale;
|
|
9868
10143
|
const newScale = Math.max(0.1, currentScale - 0.05);
|
|
9869
10144
|
viewerStore.getState().setScale(newScale);
|
|
9870
10145
|
}, [viewerStore]);
|
|
9871
|
-
const handleFitToWidth = (0,
|
|
10146
|
+
const handleFitToWidth = (0, import_react42.useCallback)(() => {
|
|
9872
10147
|
viewerStore.getState().setScale(1);
|
|
9873
10148
|
}, [viewerStore]);
|
|
9874
|
-
const handleFitToPage = (0,
|
|
10149
|
+
const handleFitToPage = (0, import_react42.useCallback)(() => {
|
|
9875
10150
|
viewerStore.getState().setScale(0.75);
|
|
9876
10151
|
}, [viewerStore]);
|
|
9877
10152
|
if (!document2) return null;
|
|
@@ -9882,7 +10157,7 @@ var init_FloatingZoomControls = __esm({
|
|
|
9882
10157
|
"top-left": "top-4 left-4"
|
|
9883
10158
|
};
|
|
9884
10159
|
const zoomPercentage = Math.round(scale * 100);
|
|
9885
|
-
return /* @__PURE__ */ (0,
|
|
10160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9886
10161
|
"div",
|
|
9887
10162
|
{
|
|
9888
10163
|
className: cn(
|
|
@@ -9894,7 +10169,7 @@ var init_FloatingZoomControls = __esm({
|
|
|
9894
10169
|
className
|
|
9895
10170
|
),
|
|
9896
10171
|
children: [
|
|
9897
|
-
/* @__PURE__ */ (0,
|
|
10172
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9898
10173
|
"button",
|
|
9899
10174
|
{
|
|
9900
10175
|
onClick: handleZoomOut,
|
|
@@ -9908,14 +10183,14 @@ var init_FloatingZoomControls = __esm({
|
|
|
9908
10183
|
disabled: scale <= 0.25,
|
|
9909
10184
|
title: "Zoom Out",
|
|
9910
10185
|
"aria-label": "Zoom Out",
|
|
9911
|
-
children: /* @__PURE__ */ (0,
|
|
10186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 12H4" }) })
|
|
9912
10187
|
}
|
|
9913
10188
|
),
|
|
9914
|
-
showZoomLevel && /* @__PURE__ */ (0,
|
|
10189
|
+
showZoomLevel && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "min-w-[48px] text-center text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
9915
10190
|
zoomPercentage,
|
|
9916
10191
|
"%"
|
|
9917
10192
|
] }),
|
|
9918
|
-
/* @__PURE__ */ (0,
|
|
10193
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9919
10194
|
"button",
|
|
9920
10195
|
{
|
|
9921
10196
|
onClick: handleZoomIn,
|
|
@@ -9929,11 +10204,11 @@ var init_FloatingZoomControls = __esm({
|
|
|
9929
10204
|
disabled: scale >= 4,
|
|
9930
10205
|
title: "Zoom In",
|
|
9931
10206
|
"aria-label": "Zoom In",
|
|
9932
|
-
children: /* @__PURE__ */ (0,
|
|
10207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) })
|
|
9933
10208
|
}
|
|
9934
10209
|
),
|
|
9935
|
-
(showFitToWidth || showFitToPage) && /* @__PURE__ */ (0,
|
|
9936
|
-
showFitToWidth && /* @__PURE__ */ (0,
|
|
10210
|
+
(showFitToWidth || showFitToPage) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-px h-6 bg-gray-200 dark:bg-gray-700 mx-1" }),
|
|
10211
|
+
showFitToWidth && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9937
10212
|
"button",
|
|
9938
10213
|
{
|
|
9939
10214
|
onClick: handleFitToWidth,
|
|
@@ -9945,10 +10220,10 @@ var init_FloatingZoomControls = __esm({
|
|
|
9945
10220
|
),
|
|
9946
10221
|
title: "Fit to Width",
|
|
9947
10222
|
"aria-label": "Fit to Width",
|
|
9948
|
-
children: /* @__PURE__ */ (0,
|
|
10223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) })
|
|
9949
10224
|
}
|
|
9950
10225
|
),
|
|
9951
|
-
showFitToPage && /* @__PURE__ */ (0,
|
|
10226
|
+
showFitToPage && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9952
10227
|
"button",
|
|
9953
10228
|
{
|
|
9954
10229
|
onClick: handleFitToPage,
|
|
@@ -9960,7 +10235,7 @@ var init_FloatingZoomControls = __esm({
|
|
|
9960
10235
|
),
|
|
9961
10236
|
title: "Fit to Page",
|
|
9962
10237
|
"aria-label": "Fit to Page",
|
|
9963
|
-
children: /* @__PURE__ */ (0,
|
|
10238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) })
|
|
9964
10239
|
}
|
|
9965
10240
|
)
|
|
9966
10241
|
]
|
|
@@ -10022,11 +10297,11 @@ function calculateMatchRects3(textItems, startOffset, length, viewport) {
|
|
|
10022
10297
|
}
|
|
10023
10298
|
return rects;
|
|
10024
10299
|
}
|
|
10025
|
-
var
|
|
10300
|
+
var import_react43, import_jsx_runtime29, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
|
|
10026
10301
|
var init_PDFViewerClient = __esm({
|
|
10027
10302
|
"src/components/PDFViewer/PDFViewerClient.tsx"() {
|
|
10028
10303
|
"use strict";
|
|
10029
|
-
|
|
10304
|
+
import_react43 = require("react");
|
|
10030
10305
|
init_hooks();
|
|
10031
10306
|
init_utils();
|
|
10032
10307
|
init_Toolbar2();
|
|
@@ -10035,11 +10310,12 @@ var init_PDFViewerClient = __esm({
|
|
|
10035
10310
|
init_DocumentContainer();
|
|
10036
10311
|
init_ContinuousScrollContainer();
|
|
10037
10312
|
init_DualPageContainer();
|
|
10313
|
+
init_BookModeContainer();
|
|
10038
10314
|
init_FloatingZoomControls2();
|
|
10039
10315
|
init_PDFLoadingScreen2();
|
|
10040
10316
|
init_utils();
|
|
10041
|
-
|
|
10042
|
-
PDFViewerInner = (0,
|
|
10317
|
+
import_jsx_runtime29 = require("react/jsx-runtime");
|
|
10318
|
+
PDFViewerInner = (0, import_react43.memo)(function PDFViewerInner2({
|
|
10043
10319
|
src,
|
|
10044
10320
|
initialPage = 1,
|
|
10045
10321
|
page: controlledPage,
|
|
@@ -10066,19 +10342,19 @@ var init_PDFViewerClient = __esm({
|
|
|
10066
10342
|
onReady
|
|
10067
10343
|
}) {
|
|
10068
10344
|
const { viewerStore, annotationStore, searchStore } = usePDFViewerStores();
|
|
10069
|
-
const mountedRef = (0,
|
|
10070
|
-
const [, setLoadState] = (0,
|
|
10071
|
-
const onDocumentLoadRef = (0,
|
|
10072
|
-
const onErrorRef = (0,
|
|
10073
|
-
const onPageChangeRef = (0,
|
|
10074
|
-
const onScaleChangeRef = (0,
|
|
10075
|
-
const onZoomChangeRef = (0,
|
|
10076
|
-
const onPageRenderStartRef = (0,
|
|
10077
|
-
const onPageRenderCompleteRef = (0,
|
|
10078
|
-
const onHighlightAddedRef = (0,
|
|
10079
|
-
const onHighlightRemovedRef = (0,
|
|
10080
|
-
const onAnnotationAddedRef = (0,
|
|
10081
|
-
const onReadyRef = (0,
|
|
10345
|
+
const mountedRef = (0, import_react43.useRef)(true);
|
|
10346
|
+
const [, setLoadState] = (0, import_react43.useState)("idle");
|
|
10347
|
+
const onDocumentLoadRef = (0, import_react43.useRef)(onDocumentLoad);
|
|
10348
|
+
const onErrorRef = (0, import_react43.useRef)(onError);
|
|
10349
|
+
const onPageChangeRef = (0, import_react43.useRef)(onPageChange);
|
|
10350
|
+
const onScaleChangeRef = (0, import_react43.useRef)(onScaleChange);
|
|
10351
|
+
const onZoomChangeRef = (0, import_react43.useRef)(onZoomChange);
|
|
10352
|
+
const onPageRenderStartRef = (0, import_react43.useRef)(onPageRenderStart);
|
|
10353
|
+
const onPageRenderCompleteRef = (0, import_react43.useRef)(onPageRenderComplete);
|
|
10354
|
+
const onHighlightAddedRef = (0, import_react43.useRef)(onHighlightAdded);
|
|
10355
|
+
const onHighlightRemovedRef = (0, import_react43.useRef)(onHighlightRemoved);
|
|
10356
|
+
const onAnnotationAddedRef = (0, import_react43.useRef)(onAnnotationAdded);
|
|
10357
|
+
const onReadyRef = (0, import_react43.useRef)(onReady);
|
|
10082
10358
|
onDocumentLoadRef.current = onDocumentLoad;
|
|
10083
10359
|
onErrorRef.current = onError;
|
|
10084
10360
|
onPageChangeRef.current = onPageChange;
|
|
@@ -10091,8 +10367,8 @@ var init_PDFViewerClient = __esm({
|
|
|
10091
10367
|
onAnnotationAddedRef.current = onAnnotationAdded;
|
|
10092
10368
|
onReadyRef.current = onReady;
|
|
10093
10369
|
const isControlled = controlledPage !== void 0;
|
|
10094
|
-
const prevControlledPageRef = (0,
|
|
10095
|
-
const srcIdRef = (0,
|
|
10370
|
+
const prevControlledPageRef = (0, import_react43.useRef)(controlledPage);
|
|
10371
|
+
const srcIdRef = (0, import_react43.useRef)(null);
|
|
10096
10372
|
const currentPage = useViewerStore((s) => s.currentPage);
|
|
10097
10373
|
const scale = useViewerStore((s) => s.scale);
|
|
10098
10374
|
const theme = useViewerStore((s) => s.theme);
|
|
@@ -10102,8 +10378,8 @@ var init_PDFViewerClient = __esm({
|
|
|
10102
10378
|
const sidebarOpen = useViewerStore((s) => s.sidebarOpen);
|
|
10103
10379
|
const streamingProgress = useViewerStore((s) => s.streamingProgress);
|
|
10104
10380
|
const srcId = getSrcIdentifier(src);
|
|
10105
|
-
const handleRef = (0,
|
|
10106
|
-
(0,
|
|
10381
|
+
const handleRef = (0, import_react43.useRef)(null);
|
|
10382
|
+
(0, import_react43.useEffect)(() => {
|
|
10107
10383
|
const handle = {
|
|
10108
10384
|
// ==================== Text Highlighting ====================
|
|
10109
10385
|
highlightText: async (text, options) => {
|
|
@@ -10521,14 +10797,14 @@ var init_PDFViewerClient = __esm({
|
|
|
10521
10797
|
handleRef.current = handle;
|
|
10522
10798
|
onReadyRef.current?.(handle);
|
|
10523
10799
|
}, [viewerStore, annotationStore, searchStore]);
|
|
10524
|
-
const handleRetry = (0,
|
|
10800
|
+
const handleRetry = (0, import_react43.useCallback)(() => {
|
|
10525
10801
|
srcIdRef.current = null;
|
|
10526
10802
|
viewerStore.getState().setError(null);
|
|
10527
10803
|
setLoadState("idle");
|
|
10528
10804
|
}, [viewerStore]);
|
|
10529
|
-
const abortControllerRef = (0,
|
|
10530
|
-
const currentSrcRef = (0,
|
|
10531
|
-
(0,
|
|
10805
|
+
const abortControllerRef = (0, import_react43.useRef)(null);
|
|
10806
|
+
const currentSrcRef = (0, import_react43.useRef)(null);
|
|
10807
|
+
(0, import_react43.useEffect)(() => {
|
|
10532
10808
|
mountedRef.current = true;
|
|
10533
10809
|
return () => {
|
|
10534
10810
|
mountedRef.current = false;
|
|
@@ -10553,8 +10829,8 @@ var init_PDFViewerClient = __esm({
|
|
|
10553
10829
|
viewerStore.getState().setError(null);
|
|
10554
10830
|
};
|
|
10555
10831
|
}, [viewerStore]);
|
|
10556
|
-
const cancelLoaderRef = (0,
|
|
10557
|
-
(0,
|
|
10832
|
+
const cancelLoaderRef = (0, import_react43.useRef)(null);
|
|
10833
|
+
(0, import_react43.useEffect)(() => {
|
|
10558
10834
|
if (srcIdRef.current === srcId && viewerStore.getState().document) {
|
|
10559
10835
|
return;
|
|
10560
10836
|
}
|
|
@@ -10688,22 +10964,22 @@ var init_PDFViewerClient = __esm({
|
|
|
10688
10964
|
}
|
|
10689
10965
|
};
|
|
10690
10966
|
}, [srcId, src, workerSrc, initialPage, initialScale, viewerStore]);
|
|
10691
|
-
const prevPageRef = (0,
|
|
10692
|
-
(0,
|
|
10967
|
+
const prevPageRef = (0, import_react43.useRef)(currentPage);
|
|
10968
|
+
(0, import_react43.useEffect)(() => {
|
|
10693
10969
|
if (prevPageRef.current !== currentPage) {
|
|
10694
10970
|
prevPageRef.current = currentPage;
|
|
10695
10971
|
onPageChangeRef.current?.(currentPage);
|
|
10696
10972
|
}
|
|
10697
10973
|
}, [currentPage]);
|
|
10698
|
-
const prevScaleRef = (0,
|
|
10699
|
-
(0,
|
|
10974
|
+
const prevScaleRef = (0, import_react43.useRef)(scale);
|
|
10975
|
+
(0, import_react43.useEffect)(() => {
|
|
10700
10976
|
if (prevScaleRef.current !== scale) {
|
|
10701
10977
|
prevScaleRef.current = scale;
|
|
10702
10978
|
onScaleChangeRef.current?.(scale);
|
|
10703
10979
|
onZoomChangeRef.current?.(scale);
|
|
10704
10980
|
}
|
|
10705
10981
|
}, [scale]);
|
|
10706
|
-
(0,
|
|
10982
|
+
(0, import_react43.useEffect)(() => {
|
|
10707
10983
|
if (!isControlled || controlledPage === void 0) return;
|
|
10708
10984
|
if (prevControlledPageRef.current === controlledPage) return;
|
|
10709
10985
|
prevControlledPageRef.current = controlledPage;
|
|
@@ -10716,7 +10992,7 @@ var init_PDFViewerClient = __esm({
|
|
|
10716
10992
|
if (error) {
|
|
10717
10993
|
if (errorComponent) {
|
|
10718
10994
|
const errorContent = typeof errorComponent === "function" ? errorComponent(error, handleRetry) : errorComponent;
|
|
10719
|
-
return /* @__PURE__ */ (0,
|
|
10995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10720
10996
|
"div",
|
|
10721
10997
|
{
|
|
10722
10998
|
className: cn(
|
|
@@ -10730,7 +11006,7 @@ var init_PDFViewerClient = __esm({
|
|
|
10730
11006
|
}
|
|
10731
11007
|
);
|
|
10732
11008
|
}
|
|
10733
|
-
return /* @__PURE__ */ (0,
|
|
11009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10734
11010
|
"div",
|
|
10735
11011
|
{
|
|
10736
11012
|
className: cn(
|
|
@@ -10740,10 +11016,10 @@ var init_PDFViewerClient = __esm({
|
|
|
10740
11016
|
themeClass,
|
|
10741
11017
|
className
|
|
10742
11018
|
),
|
|
10743
|
-
children: /* @__PURE__ */ (0,
|
|
10744
|
-
/* @__PURE__ */ (0,
|
|
10745
|
-
/* @__PURE__ */ (0,
|
|
10746
|
-
/* @__PURE__ */ (0,
|
|
11019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "text-center p-8", children: [
|
|
11020
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
|
|
11021
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
|
|
11022
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10747
11023
|
"button",
|
|
10748
11024
|
{
|
|
10749
11025
|
onClick: handleRetry,
|
|
@@ -10758,15 +11034,17 @@ var init_PDFViewerClient = __esm({
|
|
|
10758
11034
|
const renderContainer = () => {
|
|
10759
11035
|
switch (viewMode) {
|
|
10760
11036
|
case "continuous":
|
|
10761
|
-
return /* @__PURE__ */ (0,
|
|
11037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ContinuousScrollContainer, {});
|
|
10762
11038
|
case "dual":
|
|
10763
|
-
return /* @__PURE__ */ (0,
|
|
11039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DualPageContainer, {});
|
|
11040
|
+
case "book":
|
|
11041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(BookModeContainer, {});
|
|
10764
11042
|
case "single":
|
|
10765
11043
|
default:
|
|
10766
|
-
return /* @__PURE__ */ (0,
|
|
11044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DocumentContainer, {});
|
|
10767
11045
|
}
|
|
10768
11046
|
};
|
|
10769
|
-
return /* @__PURE__ */ (0,
|
|
11047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
10770
11048
|
"div",
|
|
10771
11049
|
{
|
|
10772
11050
|
className: cn(
|
|
@@ -10778,14 +11056,14 @@ var init_PDFViewerClient = __esm({
|
|
|
10778
11056
|
className
|
|
10779
11057
|
),
|
|
10780
11058
|
children: [
|
|
10781
|
-
showToolbar && /* @__PURE__ */ (0,
|
|
10782
|
-
showAnnotationToolbar && /* @__PURE__ */ (0,
|
|
10783
|
-
/* @__PURE__ */ (0,
|
|
10784
|
-
showSidebar && sidebarOpen && /* @__PURE__ */ (0,
|
|
11059
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Toolbar, {}),
|
|
11060
|
+
showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AnnotationToolbar, {}),
|
|
11061
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
11062
|
+
showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Sidebar, {}),
|
|
10785
11063
|
renderContainer()
|
|
10786
11064
|
] }),
|
|
10787
|
-
showFloatingZoom && /* @__PURE__ */ (0,
|
|
10788
|
-
isLoading && /* @__PURE__ */ (0,
|
|
11065
|
+
showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FloatingZoomControls, { position: "bottom-right" }),
|
|
11066
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute inset-0 z-50", children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10789
11067
|
PDFLoadingScreen,
|
|
10790
11068
|
{
|
|
10791
11069
|
phase: loadingProgress?.phase ?? "fetching",
|
|
@@ -10794,10 +11072,10 @@ var init_PDFViewerClient = __esm({
|
|
|
10794
11072
|
totalBytes: loadingProgress?.totalBytes
|
|
10795
11073
|
}
|
|
10796
11074
|
) }),
|
|
10797
|
-
!isLoading && streamingProgress && streamingProgress.total > 0 && streamingProgress.loaded < streamingProgress.total && /* @__PURE__ */ (0,
|
|
10798
|
-
/* @__PURE__ */ (0,
|
|
10799
|
-
/* @__PURE__ */ (0,
|
|
10800
|
-
/* @__PURE__ */ (0,
|
|
11075
|
+
!isLoading && streamingProgress && streamingProgress.total > 0 && streamingProgress.loaded < streamingProgress.total && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "absolute bottom-20 right-4 z-40 px-3 py-2 bg-gray-900/80 text-white text-xs rounded-lg shadow-lg flex items-center gap-2", children: [
|
|
11076
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin" }),
|
|
11077
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "Loading pages..." }),
|
|
11078
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-white/60", children: [
|
|
10801
11079
|
Math.round(streamingProgress.loaded / streamingProgress.total * 100),
|
|
10802
11080
|
"%"
|
|
10803
11081
|
] })
|
|
@@ -10806,10 +11084,10 @@ var init_PDFViewerClient = __esm({
|
|
|
10806
11084
|
}
|
|
10807
11085
|
);
|
|
10808
11086
|
});
|
|
10809
|
-
PDFViewerInnerWithRef = (0,
|
|
11087
|
+
PDFViewerInnerWithRef = (0, import_react43.forwardRef)(
|
|
10810
11088
|
function PDFViewerInnerWithRef2(props, ref) {
|
|
10811
|
-
const handleRef = (0,
|
|
10812
|
-
const handleReady = (0,
|
|
11089
|
+
const handleRef = (0, import_react43.useRef)(null);
|
|
11090
|
+
const handleReady = (0, import_react43.useCallback)((handle) => {
|
|
10813
11091
|
handleRef.current = handle;
|
|
10814
11092
|
if (typeof ref === "function") {
|
|
10815
11093
|
ref(handle);
|
|
@@ -10817,17 +11095,17 @@ var init_PDFViewerClient = __esm({
|
|
|
10817
11095
|
ref.current = handle;
|
|
10818
11096
|
}
|
|
10819
11097
|
}, [ref]);
|
|
10820
|
-
return /* @__PURE__ */ (0,
|
|
11098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
|
|
10821
11099
|
}
|
|
10822
11100
|
);
|
|
10823
|
-
PDFViewerClient = (0,
|
|
10824
|
-
(0,
|
|
10825
|
-
return /* @__PURE__ */ (0,
|
|
11101
|
+
PDFViewerClient = (0, import_react43.memo)(
|
|
11102
|
+
(0, import_react43.forwardRef)(function PDFViewerClient2(props, ref) {
|
|
11103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
10826
11104
|
PDFViewerProvider,
|
|
10827
11105
|
{
|
|
10828
11106
|
theme: props.theme,
|
|
10829
11107
|
defaultSidebarPanel: props.defaultSidebarPanel,
|
|
10830
|
-
children: /* @__PURE__ */ (0,
|
|
11108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PDFViewerInnerWithRef, { ref, ...props })
|
|
10831
11109
|
}
|
|
10832
11110
|
);
|
|
10833
11111
|
})
|
|
@@ -10836,20 +11114,20 @@ var init_PDFViewerClient = __esm({
|
|
|
10836
11114
|
});
|
|
10837
11115
|
|
|
10838
11116
|
// src/components/PDFViewer/PDFViewer.tsx
|
|
10839
|
-
var
|
|
11117
|
+
var import_react44, import_jsx_runtime30, PDFViewerClient3, PDFViewerLoading, PDFViewer;
|
|
10840
11118
|
var init_PDFViewer = __esm({
|
|
10841
11119
|
"src/components/PDFViewer/PDFViewer.tsx"() {
|
|
10842
11120
|
"use strict";
|
|
10843
|
-
|
|
11121
|
+
import_react44 = require("react");
|
|
10844
11122
|
init_utils();
|
|
10845
|
-
|
|
10846
|
-
PDFViewerClient3 = (0,
|
|
11123
|
+
import_jsx_runtime30 = require("react/jsx-runtime");
|
|
11124
|
+
PDFViewerClient3 = (0, import_react44.lazy)(
|
|
10847
11125
|
() => Promise.resolve().then(() => (init_PDFViewerClient(), PDFViewerClient_exports)).then((mod) => ({ default: mod.PDFViewerClient }))
|
|
10848
11126
|
);
|
|
10849
|
-
PDFViewerLoading = (0,
|
|
11127
|
+
PDFViewerLoading = (0, import_react44.memo)(function PDFViewerLoading2({
|
|
10850
11128
|
className
|
|
10851
11129
|
}) {
|
|
10852
|
-
return /* @__PURE__ */ (0,
|
|
11130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
10853
11131
|
"div",
|
|
10854
11132
|
{
|
|
10855
11133
|
className: cn(
|
|
@@ -10858,18 +11136,18 @@ var init_PDFViewer = __esm({
|
|
|
10858
11136
|
"bg-white dark:bg-gray-900",
|
|
10859
11137
|
className
|
|
10860
11138
|
),
|
|
10861
|
-
children: /* @__PURE__ */ (0,
|
|
10862
|
-
/* @__PURE__ */ (0,
|
|
10863
|
-
/* @__PURE__ */ (0,
|
|
11139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
11140
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
|
|
11141
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
|
|
10864
11142
|
] }) })
|
|
10865
11143
|
}
|
|
10866
11144
|
);
|
|
10867
11145
|
});
|
|
10868
|
-
PDFViewer = (0,
|
|
11146
|
+
PDFViewer = (0, import_react44.memo)(function PDFViewer2(props) {
|
|
10869
11147
|
if (typeof window === "undefined") {
|
|
10870
|
-
return /* @__PURE__ */ (0,
|
|
11148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PDFViewerLoading, { className: props.className });
|
|
10871
11149
|
}
|
|
10872
|
-
return /* @__PURE__ */ (0,
|
|
11150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react44.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PDFViewerClient3, { ...props }) });
|
|
10873
11151
|
});
|
|
10874
11152
|
}
|
|
10875
11153
|
});
|
|
@@ -10884,6 +11162,7 @@ var init_PDFViewer2 = __esm({
|
|
|
10884
11162
|
init_VirtualizedDocumentContainer();
|
|
10885
11163
|
init_ContinuousScrollContainer();
|
|
10886
11164
|
init_DualPageContainer();
|
|
11165
|
+
init_BookModeContainer();
|
|
10887
11166
|
}
|
|
10888
11167
|
});
|
|
10889
11168
|
|
|
@@ -10894,6 +11173,7 @@ __export(index_exports, {
|
|
|
10894
11173
|
AnnotationToolbar: () => AnnotationToolbar,
|
|
10895
11174
|
AskAboutOverlay: () => AskAboutOverlay,
|
|
10896
11175
|
AskAboutTrigger: () => AskAboutTrigger,
|
|
11176
|
+
BookModeContainer: () => BookModeContainer,
|
|
10897
11177
|
BookmarksPanel: () => BookmarksPanel,
|
|
10898
11178
|
CanvasLayer: () => CanvasLayer,
|
|
10899
11179
|
ContinuousScrollContainer: () => ContinuousScrollContainer,
|
|
@@ -10981,6 +11261,7 @@ __export(index_exports, {
|
|
|
10981
11261
|
pdfjsLib: () => pdfjsLib,
|
|
10982
11262
|
percentToPDF: () => percentToPDF,
|
|
10983
11263
|
percentToViewport: () => percentToViewport,
|
|
11264
|
+
playPageTurnSound: () => playPageTurnSound,
|
|
10984
11265
|
quickViewer: () => quickViewer,
|
|
10985
11266
|
removeRotation: () => removeRotation,
|
|
10986
11267
|
saveHighlights: () => saveHighlights,
|
|
@@ -11023,9 +11304,9 @@ init_HighlightPopover2();
|
|
|
11023
11304
|
init_AnnotationToolbar2();
|
|
11024
11305
|
|
|
11025
11306
|
// src/components/Annotations/StickyNote.tsx
|
|
11026
|
-
var
|
|
11307
|
+
var import_react45 = require("react");
|
|
11027
11308
|
init_utils();
|
|
11028
|
-
var
|
|
11309
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
11029
11310
|
var NOTE_COLORS = [
|
|
11030
11311
|
"#fef08a",
|
|
11031
11312
|
// yellow
|
|
@@ -11038,7 +11319,7 @@ var NOTE_COLORS = [
|
|
|
11038
11319
|
"#fed7aa"
|
|
11039
11320
|
// orange
|
|
11040
11321
|
];
|
|
11041
|
-
var StickyNote = (0,
|
|
11322
|
+
var StickyNote = (0, import_react45.memo)(function StickyNote2({
|
|
11042
11323
|
note,
|
|
11043
11324
|
scale,
|
|
11044
11325
|
isSelected,
|
|
@@ -11051,37 +11332,37 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11051
11332
|
onDragStart,
|
|
11052
11333
|
className
|
|
11053
11334
|
}) {
|
|
11054
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
11055
|
-
const [localContent, setLocalContent] = (0,
|
|
11056
|
-
const textareaRef = (0,
|
|
11057
|
-
const noteRef = (0,
|
|
11058
|
-
(0,
|
|
11335
|
+
const [isExpanded, setIsExpanded] = (0, import_react45.useState)(false);
|
|
11336
|
+
const [localContent, setLocalContent] = (0, import_react45.useState)(note.content);
|
|
11337
|
+
const textareaRef = (0, import_react45.useRef)(null);
|
|
11338
|
+
const noteRef = (0, import_react45.useRef)(null);
|
|
11339
|
+
(0, import_react45.useEffect)(() => {
|
|
11059
11340
|
setLocalContent(note.content);
|
|
11060
11341
|
}, [note.content]);
|
|
11061
|
-
(0,
|
|
11342
|
+
(0, import_react45.useEffect)(() => {
|
|
11062
11343
|
if (isEditing && textareaRef.current) {
|
|
11063
11344
|
textareaRef.current.focus();
|
|
11064
11345
|
textareaRef.current.select();
|
|
11065
11346
|
}
|
|
11066
11347
|
}, [isEditing]);
|
|
11067
|
-
const handleClick = (0,
|
|
11348
|
+
const handleClick = (0, import_react45.useCallback)((e) => {
|
|
11068
11349
|
e.stopPropagation();
|
|
11069
11350
|
onSelect?.();
|
|
11070
11351
|
if (!isExpanded) {
|
|
11071
11352
|
setIsExpanded(true);
|
|
11072
11353
|
}
|
|
11073
11354
|
}, [isExpanded, onSelect]);
|
|
11074
|
-
const handleDoubleClick = (0,
|
|
11355
|
+
const handleDoubleClick = (0, import_react45.useCallback)((e) => {
|
|
11075
11356
|
e.stopPropagation();
|
|
11076
11357
|
onStartEdit?.();
|
|
11077
11358
|
}, [onStartEdit]);
|
|
11078
|
-
const handleBlur = (0,
|
|
11359
|
+
const handleBlur = (0, import_react45.useCallback)(() => {
|
|
11079
11360
|
if (isEditing && localContent !== note.content) {
|
|
11080
11361
|
onUpdate?.({ content: localContent });
|
|
11081
11362
|
}
|
|
11082
11363
|
onEndEdit?.();
|
|
11083
11364
|
}, [isEditing, localContent, note.content, onUpdate, onEndEdit]);
|
|
11084
|
-
const handleKeyDown = (0,
|
|
11365
|
+
const handleKeyDown = (0, import_react45.useCallback)((e) => {
|
|
11085
11366
|
if (e.key === "Escape") {
|
|
11086
11367
|
setLocalContent(note.content);
|
|
11087
11368
|
onEndEdit?.();
|
|
@@ -11089,16 +11370,16 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11089
11370
|
handleBlur();
|
|
11090
11371
|
}
|
|
11091
11372
|
}, [note.content, onEndEdit, handleBlur]);
|
|
11092
|
-
const handleColorChange = (0,
|
|
11373
|
+
const handleColorChange = (0, import_react45.useCallback)((color) => {
|
|
11093
11374
|
onUpdate?.({ color });
|
|
11094
11375
|
}, [onUpdate]);
|
|
11095
|
-
const handleCollapse = (0,
|
|
11376
|
+
const handleCollapse = (0, import_react45.useCallback)((e) => {
|
|
11096
11377
|
e.stopPropagation();
|
|
11097
11378
|
setIsExpanded(false);
|
|
11098
11379
|
onEndEdit?.();
|
|
11099
11380
|
}, [onEndEdit]);
|
|
11100
11381
|
if (!isExpanded) {
|
|
11101
|
-
return /* @__PURE__ */ (0,
|
|
11382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11102
11383
|
"div",
|
|
11103
11384
|
{
|
|
11104
11385
|
ref: noteRef,
|
|
@@ -11119,14 +11400,14 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11119
11400
|
onMouseDown: onDragStart,
|
|
11120
11401
|
onTouchStart: onDragStart,
|
|
11121
11402
|
title: note.content || "Empty note",
|
|
11122
|
-
children: /* @__PURE__ */ (0,
|
|
11403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11123
11404
|
"svg",
|
|
11124
11405
|
{
|
|
11125
11406
|
className: "w-4 h-4 opacity-70",
|
|
11126
11407
|
fill: "currentColor",
|
|
11127
11408
|
viewBox: "0 0 20 20",
|
|
11128
11409
|
style: { color: "#333" },
|
|
11129
|
-
children: /* @__PURE__ */ (0,
|
|
11410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11130
11411
|
"path",
|
|
11131
11412
|
{
|
|
11132
11413
|
fillRule: "evenodd",
|
|
@@ -11139,7 +11420,7 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11139
11420
|
}
|
|
11140
11421
|
);
|
|
11141
11422
|
}
|
|
11142
|
-
return /* @__PURE__ */ (0,
|
|
11423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
11143
11424
|
"div",
|
|
11144
11425
|
{
|
|
11145
11426
|
ref: noteRef,
|
|
@@ -11157,14 +11438,14 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11157
11438
|
},
|
|
11158
11439
|
onClick: handleClick,
|
|
11159
11440
|
children: [
|
|
11160
|
-
/* @__PURE__ */ (0,
|
|
11441
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
11161
11442
|
"div",
|
|
11162
11443
|
{
|
|
11163
11444
|
className: "flex items-center justify-between px-2 py-1 border-b border-black/10 cursor-move",
|
|
11164
11445
|
onMouseDown: onDragStart,
|
|
11165
11446
|
onTouchStart: onDragStart,
|
|
11166
11447
|
children: [
|
|
11167
|
-
/* @__PURE__ */ (0,
|
|
11448
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11168
11449
|
"button",
|
|
11169
11450
|
{
|
|
11170
11451
|
className: cn(
|
|
@@ -11181,8 +11462,8 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11181
11462
|
},
|
|
11182
11463
|
color
|
|
11183
11464
|
)) }),
|
|
11184
|
-
/* @__PURE__ */ (0,
|
|
11185
|
-
/* @__PURE__ */ (0,
|
|
11465
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1", children: [
|
|
11466
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11186
11467
|
"button",
|
|
11187
11468
|
{
|
|
11188
11469
|
className: "p-0.5 hover:bg-black/10 rounded",
|
|
@@ -11191,23 +11472,23 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11191
11472
|
onDelete?.();
|
|
11192
11473
|
},
|
|
11193
11474
|
title: "Delete note",
|
|
11194
|
-
children: /* @__PURE__ */ (0,
|
|
11475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
|
|
11195
11476
|
}
|
|
11196
11477
|
),
|
|
11197
|
-
/* @__PURE__ */ (0,
|
|
11478
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11198
11479
|
"button",
|
|
11199
11480
|
{
|
|
11200
11481
|
className: "p-0.5 hover:bg-black/10 rounded",
|
|
11201
11482
|
onClick: handleCollapse,
|
|
11202
11483
|
title: "Collapse note",
|
|
11203
|
-
children: /* @__PURE__ */ (0,
|
|
11484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
11204
11485
|
}
|
|
11205
11486
|
)
|
|
11206
11487
|
] })
|
|
11207
11488
|
]
|
|
11208
11489
|
}
|
|
11209
11490
|
),
|
|
11210
|
-
/* @__PURE__ */ (0,
|
|
11491
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11211
11492
|
"textarea",
|
|
11212
11493
|
{
|
|
11213
11494
|
ref: textareaRef,
|
|
@@ -11222,7 +11503,7 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11222
11503
|
onKeyDown: handleKeyDown,
|
|
11223
11504
|
placeholder: "Enter note..."
|
|
11224
11505
|
}
|
|
11225
|
-
) : /* @__PURE__ */ (0,
|
|
11506
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
11226
11507
|
"div",
|
|
11227
11508
|
{
|
|
11228
11509
|
className: cn(
|
|
@@ -11233,16 +11514,16 @@ var StickyNote = (0, import_react44.memo)(function StickyNote2({
|
|
|
11233
11514
|
children: note.content || "Double-click to edit..."
|
|
11234
11515
|
}
|
|
11235
11516
|
) }),
|
|
11236
|
-
/* @__PURE__ */ (0,
|
|
11517
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
|
|
11237
11518
|
]
|
|
11238
11519
|
}
|
|
11239
11520
|
);
|
|
11240
11521
|
});
|
|
11241
11522
|
|
|
11242
11523
|
// src/components/Annotations/DrawingCanvas.tsx
|
|
11243
|
-
var
|
|
11524
|
+
var import_react46 = require("react");
|
|
11244
11525
|
init_utils();
|
|
11245
|
-
var
|
|
11526
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
11246
11527
|
function pointsToSvgPath(points) {
|
|
11247
11528
|
if (points.length === 0) return "";
|
|
11248
11529
|
if (points.length === 1) {
|
|
@@ -11280,7 +11561,7 @@ function simplifyPath(points, tolerance = 1) {
|
|
|
11280
11561
|
result.push(points[points.length - 1]);
|
|
11281
11562
|
return result;
|
|
11282
11563
|
}
|
|
11283
|
-
var DrawingCanvas = (0,
|
|
11564
|
+
var DrawingCanvas = (0, import_react46.memo)(function DrawingCanvas2({
|
|
11284
11565
|
width,
|
|
11285
11566
|
height,
|
|
11286
11567
|
scale,
|
|
@@ -11290,10 +11571,10 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11290
11571
|
onDrawingComplete,
|
|
11291
11572
|
className
|
|
11292
11573
|
}) {
|
|
11293
|
-
const svgRef = (0,
|
|
11294
|
-
const [isDrawing, setIsDrawing] = (0,
|
|
11295
|
-
const [currentPath, setCurrentPath] = (0,
|
|
11296
|
-
const getPoint = (0,
|
|
11574
|
+
const svgRef = (0, import_react46.useRef)(null);
|
|
11575
|
+
const [isDrawing, setIsDrawing] = (0, import_react46.useState)(false);
|
|
11576
|
+
const [currentPath, setCurrentPath] = (0, import_react46.useState)([]);
|
|
11577
|
+
const getPoint = (0, import_react46.useCallback)((e) => {
|
|
11297
11578
|
if (!svgRef.current) return null;
|
|
11298
11579
|
const svg = svgRef.current;
|
|
11299
11580
|
const rect = svg.getBoundingClientRect();
|
|
@@ -11313,7 +11594,7 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11313
11594
|
y: (clientY - rect.top) / scale
|
|
11314
11595
|
};
|
|
11315
11596
|
}, [scale]);
|
|
11316
|
-
const handleStart = (0,
|
|
11597
|
+
const handleStart = (0, import_react46.useCallback)((e) => {
|
|
11317
11598
|
if (!isActive) return;
|
|
11318
11599
|
const point = getPoint(e);
|
|
11319
11600
|
if (point) {
|
|
@@ -11321,14 +11602,14 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11321
11602
|
setCurrentPath([point]);
|
|
11322
11603
|
}
|
|
11323
11604
|
}, [isActive, getPoint]);
|
|
11324
|
-
const handleMove = (0,
|
|
11605
|
+
const handleMove = (0, import_react46.useCallback)((e) => {
|
|
11325
11606
|
if (!isDrawing || !isActive) return;
|
|
11326
11607
|
const point = getPoint(e);
|
|
11327
11608
|
if (point) {
|
|
11328
11609
|
setCurrentPath((prev) => [...prev, point]);
|
|
11329
11610
|
}
|
|
11330
11611
|
}, [isDrawing, isActive, getPoint]);
|
|
11331
|
-
const handleEnd = (0,
|
|
11612
|
+
const handleEnd = (0, import_react46.useCallback)(() => {
|
|
11332
11613
|
if (!isDrawing) return;
|
|
11333
11614
|
setIsDrawing(false);
|
|
11334
11615
|
if (currentPath.length >= 2) {
|
|
@@ -11337,7 +11618,7 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11337
11618
|
}
|
|
11338
11619
|
setCurrentPath([]);
|
|
11339
11620
|
}, [isDrawing, currentPath, onDrawingComplete]);
|
|
11340
|
-
return /* @__PURE__ */ (0,
|
|
11621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
11341
11622
|
"svg",
|
|
11342
11623
|
{
|
|
11343
11624
|
ref: svgRef,
|
|
@@ -11357,7 +11638,7 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11357
11638
|
onTouchStart: handleStart,
|
|
11358
11639
|
onTouchMove: handleMove,
|
|
11359
11640
|
onTouchEnd: handleEnd,
|
|
11360
|
-
children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0,
|
|
11641
|
+
children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
11361
11642
|
"path",
|
|
11362
11643
|
{
|
|
11363
11644
|
d: pointsToSvgPath(currentPath),
|
|
@@ -11374,10 +11655,10 @@ var DrawingCanvas = (0, import_react45.memo)(function DrawingCanvas2({
|
|
|
11374
11655
|
});
|
|
11375
11656
|
|
|
11376
11657
|
// src/components/Annotations/ShapeRenderer.tsx
|
|
11377
|
-
var
|
|
11658
|
+
var import_react47 = require("react");
|
|
11378
11659
|
init_utils();
|
|
11379
|
-
var
|
|
11380
|
-
var ShapeRenderer = (0,
|
|
11660
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
11661
|
+
var ShapeRenderer = (0, import_react47.memo)(function ShapeRenderer2({
|
|
11381
11662
|
shape,
|
|
11382
11663
|
scale,
|
|
11383
11664
|
isSelected,
|
|
@@ -11387,18 +11668,18 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11387
11668
|
onDelete: _onDelete,
|
|
11388
11669
|
className
|
|
11389
11670
|
}) {
|
|
11390
|
-
const [_isDragging, setIsDragging] = (0,
|
|
11391
|
-
const [_isResizing, setIsResizing] = (0,
|
|
11392
|
-
const [activeHandle, setActiveHandle] = (0,
|
|
11393
|
-
const startPosRef = (0,
|
|
11394
|
-
const startShapeRef = (0,
|
|
11671
|
+
const [_isDragging, setIsDragging] = (0, import_react47.useState)(false);
|
|
11672
|
+
const [_isResizing, setIsResizing] = (0, import_react47.useState)(false);
|
|
11673
|
+
const [activeHandle, setActiveHandle] = (0, import_react47.useState)(null);
|
|
11674
|
+
const startPosRef = (0, import_react47.useRef)({ x: 0, y: 0 });
|
|
11675
|
+
const startShapeRef = (0, import_react47.useRef)({ x: 0, y: 0, width: 0, height: 0 });
|
|
11395
11676
|
const { shapeType, x, y, width, height, color, strokeWidth, id: _id } = shape;
|
|
11396
11677
|
const scaledX = x * scale;
|
|
11397
11678
|
const scaledY = y * scale;
|
|
11398
11679
|
const scaledWidth = width * scale;
|
|
11399
11680
|
const scaledHeight = height * scale;
|
|
11400
11681
|
const scaledStroke = strokeWidth * scale;
|
|
11401
|
-
const getResizeHandles = (0,
|
|
11682
|
+
const getResizeHandles = (0, import_react47.useCallback)(() => {
|
|
11402
11683
|
const handleSize = 8;
|
|
11403
11684
|
const half = handleSize / 2;
|
|
11404
11685
|
return [
|
|
@@ -11412,7 +11693,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11412
11693
|
{ position: "w", cursor: "ew-resize", x: scaledX - half, y: scaledY + scaledHeight / 2 - half }
|
|
11413
11694
|
];
|
|
11414
11695
|
}, [scaledX, scaledY, scaledWidth, scaledHeight]);
|
|
11415
|
-
const handleMouseDown = (0,
|
|
11696
|
+
const handleMouseDown = (0, import_react47.useCallback)((e, handle) => {
|
|
11416
11697
|
e.stopPropagation();
|
|
11417
11698
|
onSelect?.();
|
|
11418
11699
|
if (!isEditing) return;
|
|
@@ -11488,7 +11769,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11488
11769
|
document.addEventListener("mousemove", handleMouseMove);
|
|
11489
11770
|
document.addEventListener("mouseup", handleMouseUp);
|
|
11490
11771
|
}, [isEditing, x, y, width, height, scale, onSelect, onUpdate]);
|
|
11491
|
-
const renderShape2 = (0,
|
|
11772
|
+
const renderShape2 = (0, import_react47.useCallback)(() => {
|
|
11492
11773
|
const commonProps = {
|
|
11493
11774
|
stroke: color,
|
|
11494
11775
|
strokeWidth: scaledStroke,
|
|
@@ -11500,7 +11781,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11500
11781
|
};
|
|
11501
11782
|
switch (shapeType) {
|
|
11502
11783
|
case "rect":
|
|
11503
|
-
return /* @__PURE__ */ (0,
|
|
11784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11504
11785
|
"rect",
|
|
11505
11786
|
{
|
|
11506
11787
|
x: scaledX,
|
|
@@ -11511,7 +11792,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11511
11792
|
}
|
|
11512
11793
|
);
|
|
11513
11794
|
case "circle":
|
|
11514
|
-
return /* @__PURE__ */ (0,
|
|
11795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11515
11796
|
"ellipse",
|
|
11516
11797
|
{
|
|
11517
11798
|
cx: scaledX + scaledWidth / 2,
|
|
@@ -11522,7 +11803,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11522
11803
|
}
|
|
11523
11804
|
);
|
|
11524
11805
|
case "line":
|
|
11525
|
-
return /* @__PURE__ */ (0,
|
|
11806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11526
11807
|
"line",
|
|
11527
11808
|
{
|
|
11528
11809
|
x1: scaledX,
|
|
@@ -11542,22 +11823,22 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11542
11823
|
const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
|
|
11543
11824
|
const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
|
|
11544
11825
|
const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
|
|
11545
|
-
return /* @__PURE__ */ (0,
|
|
11546
|
-
/* @__PURE__ */ (0,
|
|
11547
|
-
/* @__PURE__ */ (0,
|
|
11548
|
-
/* @__PURE__ */ (0,
|
|
11826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
|
|
11827
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
|
|
11828
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
|
|
11829
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
|
|
11549
11830
|
] });
|
|
11550
11831
|
default:
|
|
11551
11832
|
return null;
|
|
11552
11833
|
}
|
|
11553
11834
|
}, [shapeType, scaledX, scaledY, scaledWidth, scaledHeight, color, scaledStroke, isSelected]);
|
|
11554
|
-
return /* @__PURE__ */ (0,
|
|
11835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
11555
11836
|
"g",
|
|
11556
11837
|
{
|
|
11557
11838
|
className: cn("shape-renderer", className),
|
|
11558
11839
|
onMouseDown: (e) => handleMouseDown(e),
|
|
11559
11840
|
children: [
|
|
11560
|
-
/* @__PURE__ */ (0,
|
|
11841
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11561
11842
|
"rect",
|
|
11562
11843
|
{
|
|
11563
11844
|
x: scaledX - 5,
|
|
@@ -11570,7 +11851,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11570
11851
|
}
|
|
11571
11852
|
),
|
|
11572
11853
|
renderShape2(),
|
|
11573
|
-
isSelected && /* @__PURE__ */ (0,
|
|
11854
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11574
11855
|
"rect",
|
|
11575
11856
|
{
|
|
11576
11857
|
x: scaledX - 2,
|
|
@@ -11583,7 +11864,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11583
11864
|
strokeDasharray: "4 2"
|
|
11584
11865
|
}
|
|
11585
11866
|
),
|
|
11586
|
-
isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0,
|
|
11867
|
+
isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11587
11868
|
"rect",
|
|
11588
11869
|
{
|
|
11589
11870
|
x: handle.x,
|
|
@@ -11603,7 +11884,7 @@ var ShapeRenderer = (0, import_react46.memo)(function ShapeRenderer2({
|
|
|
11603
11884
|
}
|
|
11604
11885
|
);
|
|
11605
11886
|
});
|
|
11606
|
-
var ShapePreview = (0,
|
|
11887
|
+
var ShapePreview = (0, import_react47.memo)(function ShapePreview2({
|
|
11607
11888
|
shapeType,
|
|
11608
11889
|
startPoint,
|
|
11609
11890
|
endPoint,
|
|
@@ -11624,9 +11905,9 @@ var ShapePreview = (0, import_react46.memo)(function ShapePreview2({
|
|
|
11624
11905
|
};
|
|
11625
11906
|
switch (shapeType) {
|
|
11626
11907
|
case "rect":
|
|
11627
|
-
return /* @__PURE__ */ (0,
|
|
11908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("rect", { x, y, width, height, ...commonProps });
|
|
11628
11909
|
case "circle":
|
|
11629
|
-
return /* @__PURE__ */ (0,
|
|
11910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11630
11911
|
"ellipse",
|
|
11631
11912
|
{
|
|
11632
11913
|
cx: x + width / 2,
|
|
@@ -11637,7 +11918,7 @@ var ShapePreview = (0, import_react46.memo)(function ShapePreview2({
|
|
|
11637
11918
|
}
|
|
11638
11919
|
);
|
|
11639
11920
|
case "line":
|
|
11640
|
-
return /* @__PURE__ */ (0,
|
|
11921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11641
11922
|
"line",
|
|
11642
11923
|
{
|
|
11643
11924
|
x1: startPoint.x * scale,
|
|
@@ -11659,8 +11940,8 @@ var ShapePreview = (0, import_react46.memo)(function ShapePreview2({
|
|
|
11659
11940
|
const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
|
|
11660
11941
|
const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
|
|
11661
11942
|
const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
|
|
11662
|
-
return /* @__PURE__ */ (0,
|
|
11663
|
-
/* @__PURE__ */ (0,
|
|
11943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("g", { children: [
|
|
11944
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
11664
11945
|
"line",
|
|
11665
11946
|
{
|
|
11666
11947
|
x1: startPoint.x * scale,
|
|
@@ -11670,8 +11951,8 @@ var ShapePreview = (0, import_react46.memo)(function ShapePreview2({
|
|
|
11670
11951
|
...commonProps
|
|
11671
11952
|
}
|
|
11672
11953
|
),
|
|
11673
|
-
/* @__PURE__ */ (0,
|
|
11674
|
-
/* @__PURE__ */ (0,
|
|
11954
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
|
|
11955
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
|
|
11675
11956
|
] });
|
|
11676
11957
|
default:
|
|
11677
11958
|
return null;
|
|
@@ -11679,10 +11960,10 @@ var ShapePreview = (0, import_react46.memo)(function ShapePreview2({
|
|
|
11679
11960
|
});
|
|
11680
11961
|
|
|
11681
11962
|
// src/components/Annotations/QuickNoteButton.tsx
|
|
11682
|
-
var
|
|
11963
|
+
var import_react48 = require("react");
|
|
11683
11964
|
init_utils();
|
|
11684
|
-
var
|
|
11685
|
-
var QuickNoteButton = (0,
|
|
11965
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
11966
|
+
var QuickNoteButton = (0, import_react48.memo)(function QuickNoteButton2({
|
|
11686
11967
|
pageNumber,
|
|
11687
11968
|
scale,
|
|
11688
11969
|
position = "top-right",
|
|
@@ -11690,8 +11971,8 @@ var QuickNoteButton = (0, import_react47.memo)(function QuickNoteButton2({
|
|
|
11690
11971
|
className,
|
|
11691
11972
|
visible = true
|
|
11692
11973
|
}) {
|
|
11693
|
-
const [isHovered, setIsHovered] = (0,
|
|
11694
|
-
const handleClick = (0,
|
|
11974
|
+
const [isHovered, setIsHovered] = (0, import_react48.useState)(false);
|
|
11975
|
+
const handleClick = (0, import_react48.useCallback)(
|
|
11695
11976
|
(e) => {
|
|
11696
11977
|
e.stopPropagation();
|
|
11697
11978
|
const x = position === "top-right" ? 80 : 80;
|
|
@@ -11703,7 +11984,7 @@ var QuickNoteButton = (0, import_react47.memo)(function QuickNoteButton2({
|
|
|
11703
11984
|
if (!visible) {
|
|
11704
11985
|
return null;
|
|
11705
11986
|
}
|
|
11706
|
-
return /* @__PURE__ */ (0,
|
|
11987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
11707
11988
|
"button",
|
|
11708
11989
|
{
|
|
11709
11990
|
onClick: handleClick,
|
|
@@ -11725,7 +12006,7 @@ var QuickNoteButton = (0, import_react47.memo)(function QuickNoteButton2({
|
|
|
11725
12006
|
),
|
|
11726
12007
|
title: "Add quick note",
|
|
11727
12008
|
"aria-label": "Add quick note",
|
|
11728
|
-
children: /* @__PURE__ */ (0,
|
|
12009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
11729
12010
|
"svg",
|
|
11730
12011
|
{
|
|
11731
12012
|
className: "w-4 h-4 text-yellow-900",
|
|
@@ -11733,7 +12014,7 @@ var QuickNoteButton = (0, import_react47.memo)(function QuickNoteButton2({
|
|
|
11733
12014
|
viewBox: "0 0 24 24",
|
|
11734
12015
|
stroke: "currentColor",
|
|
11735
12016
|
strokeWidth: 2,
|
|
11736
|
-
children: /* @__PURE__ */ (0,
|
|
12017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
|
|
11737
12018
|
}
|
|
11738
12019
|
)
|
|
11739
12020
|
}
|
|
@@ -11741,10 +12022,10 @@ var QuickNoteButton = (0, import_react47.memo)(function QuickNoteButton2({
|
|
|
11741
12022
|
});
|
|
11742
12023
|
|
|
11743
12024
|
// src/components/Annotations/QuickNotePopover.tsx
|
|
11744
|
-
var
|
|
12025
|
+
var import_react49 = require("react");
|
|
11745
12026
|
init_utils();
|
|
11746
|
-
var
|
|
11747
|
-
var QuickNotePopover = (0,
|
|
12027
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
12028
|
+
var QuickNotePopover = (0, import_react49.memo)(function QuickNotePopover2({
|
|
11748
12029
|
visible,
|
|
11749
12030
|
position,
|
|
11750
12031
|
initialContent = "",
|
|
@@ -11753,21 +12034,21 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11753
12034
|
onCancel,
|
|
11754
12035
|
className
|
|
11755
12036
|
}) {
|
|
11756
|
-
const [content, setContent] = (0,
|
|
11757
|
-
const textareaRef = (0,
|
|
11758
|
-
const popoverRef = (0,
|
|
11759
|
-
const [adjustedPosition, setAdjustedPosition] = (0,
|
|
11760
|
-
(0,
|
|
12037
|
+
const [content, setContent] = (0, import_react49.useState)(initialContent);
|
|
12038
|
+
const textareaRef = (0, import_react49.useRef)(null);
|
|
12039
|
+
const popoverRef = (0, import_react49.useRef)(null);
|
|
12040
|
+
const [adjustedPosition, setAdjustedPosition] = (0, import_react49.useState)(position);
|
|
12041
|
+
(0, import_react49.useEffect)(() => {
|
|
11761
12042
|
if (visible && textareaRef.current) {
|
|
11762
12043
|
textareaRef.current.focus();
|
|
11763
12044
|
}
|
|
11764
12045
|
}, [visible]);
|
|
11765
|
-
(0,
|
|
12046
|
+
(0, import_react49.useEffect)(() => {
|
|
11766
12047
|
if (visible) {
|
|
11767
12048
|
setContent(initialContent);
|
|
11768
12049
|
}
|
|
11769
12050
|
}, [visible, initialContent]);
|
|
11770
|
-
(0,
|
|
12051
|
+
(0, import_react49.useEffect)(() => {
|
|
11771
12052
|
if (!visible || !popoverRef.current) return;
|
|
11772
12053
|
const rect = popoverRef.current.getBoundingClientRect();
|
|
11773
12054
|
const padding = 10;
|
|
@@ -11786,14 +12067,14 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11786
12067
|
}
|
|
11787
12068
|
setAdjustedPosition({ x, y });
|
|
11788
12069
|
}, [position, visible]);
|
|
11789
|
-
const handleSave = (0,
|
|
12070
|
+
const handleSave = (0, import_react49.useCallback)(() => {
|
|
11790
12071
|
if (content.trim()) {
|
|
11791
12072
|
onSave(content.trim());
|
|
11792
12073
|
} else {
|
|
11793
12074
|
onCancel();
|
|
11794
12075
|
}
|
|
11795
12076
|
}, [content, onSave, onCancel]);
|
|
11796
|
-
const handleKeyDown = (0,
|
|
12077
|
+
const handleKeyDown = (0, import_react49.useCallback)(
|
|
11797
12078
|
(e) => {
|
|
11798
12079
|
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
11799
12080
|
e.preventDefault();
|
|
@@ -11808,7 +12089,7 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11808
12089
|
if (!visible) {
|
|
11809
12090
|
return null;
|
|
11810
12091
|
}
|
|
11811
|
-
return /* @__PURE__ */ (0,
|
|
12092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
11812
12093
|
"div",
|
|
11813
12094
|
{
|
|
11814
12095
|
ref: popoverRef,
|
|
@@ -11827,15 +12108,15 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11827
12108
|
top: adjustedPosition.y
|
|
11828
12109
|
},
|
|
11829
12110
|
children: [
|
|
11830
|
-
agentLastStatement && /* @__PURE__ */ (0,
|
|
11831
|
-
/* @__PURE__ */ (0,
|
|
11832
|
-
/* @__PURE__ */ (0,
|
|
12111
|
+
agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-start gap-1", children: [
|
|
12112
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
|
|
12113
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "line-clamp-2", children: [
|
|
11833
12114
|
"AI discussed: \u201C",
|
|
11834
12115
|
agentLastStatement,
|
|
11835
12116
|
"\u201D"
|
|
11836
12117
|
] })
|
|
11837
12118
|
] }) }),
|
|
11838
|
-
/* @__PURE__ */ (0,
|
|
12119
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11839
12120
|
"textarea",
|
|
11840
12121
|
{
|
|
11841
12122
|
ref: textareaRef,
|
|
@@ -11854,13 +12135,13 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11854
12135
|
)
|
|
11855
12136
|
}
|
|
11856
12137
|
),
|
|
11857
|
-
/* @__PURE__ */ (0,
|
|
11858
|
-
/* @__PURE__ */ (0,
|
|
12138
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
|
|
12139
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
11859
12140
|
navigator.platform.includes("Mac") ? "\u2318" : "Ctrl",
|
|
11860
12141
|
"+Enter to save"
|
|
11861
12142
|
] }),
|
|
11862
|
-
/* @__PURE__ */ (0,
|
|
11863
|
-
/* @__PURE__ */ (0,
|
|
12143
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex gap-2", children: [
|
|
12144
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11864
12145
|
"button",
|
|
11865
12146
|
{
|
|
11866
12147
|
onClick: onCancel,
|
|
@@ -11873,7 +12154,7 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11873
12154
|
children: "Cancel"
|
|
11874
12155
|
}
|
|
11875
12156
|
),
|
|
11876
|
-
/* @__PURE__ */ (0,
|
|
12157
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11877
12158
|
"button",
|
|
11878
12159
|
{
|
|
11879
12160
|
onClick: handleSave,
|
|
@@ -11896,10 +12177,10 @@ var QuickNotePopover = (0, import_react48.memo)(function QuickNotePopover2({
|
|
|
11896
12177
|
});
|
|
11897
12178
|
|
|
11898
12179
|
// src/components/AskAbout/AskAboutOverlay.tsx
|
|
11899
|
-
var
|
|
12180
|
+
var import_react50 = require("react");
|
|
11900
12181
|
init_utils();
|
|
11901
|
-
var
|
|
11902
|
-
var AskAboutOverlay = (0,
|
|
12182
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
12183
|
+
var AskAboutOverlay = (0, import_react50.memo)(function AskAboutOverlay2({
|
|
11903
12184
|
visible,
|
|
11904
12185
|
progress,
|
|
11905
12186
|
position,
|
|
@@ -11913,7 +12194,7 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11913
12194
|
const radius = (size - strokeWidth) / 2;
|
|
11914
12195
|
const circumference = 2 * Math.PI * radius;
|
|
11915
12196
|
const strokeDashoffset = circumference * (1 - progress);
|
|
11916
|
-
return /* @__PURE__ */ (0,
|
|
12197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
11917
12198
|
"div",
|
|
11918
12199
|
{
|
|
11919
12200
|
className: cn(
|
|
@@ -11926,7 +12207,7 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11926
12207
|
top: position.y - size / 2
|
|
11927
12208
|
},
|
|
11928
12209
|
children: [
|
|
11929
|
-
/* @__PURE__ */ (0,
|
|
12210
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
11930
12211
|
"svg",
|
|
11931
12212
|
{
|
|
11932
12213
|
width: size,
|
|
@@ -11934,7 +12215,7 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11934
12215
|
viewBox: `0 0 ${size} ${size}`,
|
|
11935
12216
|
className: "transform -rotate-90",
|
|
11936
12217
|
children: [
|
|
11937
|
-
/* @__PURE__ */ (0,
|
|
12218
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
11938
12219
|
"circle",
|
|
11939
12220
|
{
|
|
11940
12221
|
cx: size / 2,
|
|
@@ -11945,7 +12226,7 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11945
12226
|
strokeWidth
|
|
11946
12227
|
}
|
|
11947
12228
|
),
|
|
11948
|
-
/* @__PURE__ */ (0,
|
|
12229
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
11949
12230
|
"circle",
|
|
11950
12231
|
{
|
|
11951
12232
|
cx: size / 2,
|
|
@@ -11963,12 +12244,12 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11963
12244
|
]
|
|
11964
12245
|
}
|
|
11965
12246
|
),
|
|
11966
|
-
/* @__PURE__ */ (0,
|
|
12247
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
11967
12248
|
"div",
|
|
11968
12249
|
{
|
|
11969
12250
|
className: "absolute inset-0 flex items-center justify-center",
|
|
11970
12251
|
style: { color: progress >= 1 ? "#22c55e" : "white" },
|
|
11971
|
-
children: progress >= 1 ? /* @__PURE__ */ (0,
|
|
12252
|
+
children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
11972
12253
|
"svg",
|
|
11973
12254
|
{
|
|
11974
12255
|
width: "24",
|
|
@@ -11979,9 +12260,9 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11979
12260
|
strokeWidth: "2",
|
|
11980
12261
|
strokeLinecap: "round",
|
|
11981
12262
|
strokeLinejoin: "round",
|
|
11982
|
-
children: /* @__PURE__ */ (0,
|
|
12263
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
11983
12264
|
}
|
|
11984
|
-
) : /* @__PURE__ */ (0,
|
|
12265
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
11985
12266
|
"svg",
|
|
11986
12267
|
{
|
|
11987
12268
|
width: "20",
|
|
@@ -11993,9 +12274,9 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
11993
12274
|
strokeLinecap: "round",
|
|
11994
12275
|
strokeLinejoin: "round",
|
|
11995
12276
|
children: [
|
|
11996
|
-
/* @__PURE__ */ (0,
|
|
11997
|
-
/* @__PURE__ */ (0,
|
|
11998
|
-
/* @__PURE__ */ (0,
|
|
12277
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
12278
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
12279
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
11999
12280
|
]
|
|
12000
12281
|
}
|
|
12001
12282
|
)
|
|
@@ -12007,10 +12288,10 @@ var AskAboutOverlay = (0, import_react49.memo)(function AskAboutOverlay2({
|
|
|
12007
12288
|
});
|
|
12008
12289
|
|
|
12009
12290
|
// src/components/AskAbout/AskAboutTrigger.tsx
|
|
12010
|
-
var
|
|
12291
|
+
var import_react51 = require("react");
|
|
12011
12292
|
init_utils();
|
|
12012
|
-
var
|
|
12013
|
-
var AskAboutTrigger = (0,
|
|
12293
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
12294
|
+
var AskAboutTrigger = (0, import_react51.memo)(function AskAboutTrigger2({
|
|
12014
12295
|
position,
|
|
12015
12296
|
onConfirm,
|
|
12016
12297
|
onCancel,
|
|
@@ -12018,9 +12299,9 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12018
12299
|
autoHideDelay = 5e3,
|
|
12019
12300
|
className
|
|
12020
12301
|
}) {
|
|
12021
|
-
const [adjustedPosition, setAdjustedPosition] = (0,
|
|
12022
|
-
const triggerRef = (0,
|
|
12023
|
-
(0,
|
|
12302
|
+
const [adjustedPosition, setAdjustedPosition] = (0, import_react51.useState)(position);
|
|
12303
|
+
const triggerRef = (0, import_react51.useRef)(null);
|
|
12304
|
+
(0, import_react51.useEffect)(() => {
|
|
12024
12305
|
if (!visible || !triggerRef.current) return;
|
|
12025
12306
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
12026
12307
|
const padding = 10;
|
|
@@ -12036,19 +12317,19 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12036
12317
|
}
|
|
12037
12318
|
setAdjustedPosition({ x, y });
|
|
12038
12319
|
}, [position, visible]);
|
|
12039
|
-
(0,
|
|
12320
|
+
(0, import_react51.useEffect)(() => {
|
|
12040
12321
|
if (!visible || autoHideDelay === 0) return;
|
|
12041
12322
|
const timer = setTimeout(onCancel, autoHideDelay);
|
|
12042
12323
|
return () => clearTimeout(timer);
|
|
12043
12324
|
}, [visible, autoHideDelay, onCancel]);
|
|
12044
|
-
const handleConfirm = (0,
|
|
12325
|
+
const handleConfirm = (0, import_react51.useCallback)(
|
|
12045
12326
|
(e) => {
|
|
12046
12327
|
e.stopPropagation();
|
|
12047
12328
|
onConfirm();
|
|
12048
12329
|
},
|
|
12049
12330
|
[onConfirm]
|
|
12050
12331
|
);
|
|
12051
|
-
const handleCancel = (0,
|
|
12332
|
+
const handleCancel = (0, import_react51.useCallback)(
|
|
12052
12333
|
(e) => {
|
|
12053
12334
|
e.stopPropagation();
|
|
12054
12335
|
onCancel();
|
|
@@ -12058,7 +12339,7 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12058
12339
|
if (!visible) {
|
|
12059
12340
|
return null;
|
|
12060
12341
|
}
|
|
12061
|
-
return /* @__PURE__ */ (0,
|
|
12342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
12062
12343
|
"div",
|
|
12063
12344
|
{
|
|
12064
12345
|
ref: triggerRef,
|
|
@@ -12077,8 +12358,8 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12077
12358
|
transform: "translate(-50%, 0)"
|
|
12078
12359
|
},
|
|
12079
12360
|
children: [
|
|
12080
|
-
/* @__PURE__ */ (0,
|
|
12081
|
-
/* @__PURE__ */ (0,
|
|
12361
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
12082
12363
|
"button",
|
|
12083
12364
|
{
|
|
12084
12365
|
onClick: handleConfirm,
|
|
@@ -12091,7 +12372,7 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12091
12372
|
children: "Ask"
|
|
12092
12373
|
}
|
|
12093
12374
|
),
|
|
12094
|
-
/* @__PURE__ */ (0,
|
|
12375
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
12095
12376
|
"button",
|
|
12096
12377
|
{
|
|
12097
12378
|
onClick: handleCancel,
|
|
@@ -12111,11 +12392,11 @@ var AskAboutTrigger = (0, import_react50.memo)(function AskAboutTrigger2({
|
|
|
12111
12392
|
});
|
|
12112
12393
|
|
|
12113
12394
|
// src/components/Minimap/Minimap.tsx
|
|
12114
|
-
var
|
|
12395
|
+
var import_react52 = require("react");
|
|
12115
12396
|
init_hooks();
|
|
12116
12397
|
init_utils();
|
|
12117
|
-
var
|
|
12118
|
-
var PageIndicator = (0,
|
|
12398
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
12399
|
+
var PageIndicator = (0, import_react52.memo)(function PageIndicator2({
|
|
12119
12400
|
pageNumber,
|
|
12120
12401
|
status,
|
|
12121
12402
|
isBookmarked,
|
|
@@ -12129,7 +12410,7 @@ var PageIndicator = (0, import_react51.memo)(function PageIndicator2({
|
|
|
12129
12410
|
if (status === "visited") return "bg-green-400";
|
|
12130
12411
|
return "bg-gray-200 dark:bg-gray-700";
|
|
12131
12412
|
};
|
|
12132
|
-
return /* @__PURE__ */ (0,
|
|
12413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
12133
12414
|
"button",
|
|
12134
12415
|
{
|
|
12135
12416
|
onClick,
|
|
@@ -12145,13 +12426,13 @@ var PageIndicator = (0, import_react51.memo)(function PageIndicator2({
|
|
|
12145
12426
|
title: `Page ${pageNumber}${isBookmarked ? " (bookmarked)" : ""}`,
|
|
12146
12427
|
"aria-label": `Go to page ${pageNumber}`,
|
|
12147
12428
|
children: [
|
|
12148
|
-
isBookmarked && !compact && /* @__PURE__ */ (0,
|
|
12149
|
-
showNumber && !compact && /* @__PURE__ */ (0,
|
|
12429
|
+
isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
|
|
12430
|
+
showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
|
|
12150
12431
|
]
|
|
12151
12432
|
}
|
|
12152
12433
|
);
|
|
12153
12434
|
});
|
|
12154
|
-
var Minimap = (0,
|
|
12435
|
+
var Minimap = (0, import_react52.memo)(function Minimap2({
|
|
12155
12436
|
variant = "sidebar",
|
|
12156
12437
|
floatingPosition = "right",
|
|
12157
12438
|
maxHeight = 300,
|
|
@@ -12164,18 +12445,18 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12164
12445
|
const currentPage = useViewerStore((s) => s.currentPage);
|
|
12165
12446
|
const numPages = useViewerStore((s) => s.numPages);
|
|
12166
12447
|
const goToPage = useViewerStore((s) => s.goToPage);
|
|
12167
|
-
const bookmarkedPages = (0,
|
|
12448
|
+
const bookmarkedPages = (0, import_react52.useMemo)(() => {
|
|
12168
12449
|
return new Set(bookmarks.map((b) => b.pageNumber));
|
|
12169
12450
|
}, [bookmarks]);
|
|
12170
12451
|
const compact = numPages > 50;
|
|
12171
|
-
const handlePageClick = (0,
|
|
12452
|
+
const handlePageClick = (0, import_react52.useCallback)(
|
|
12172
12453
|
(pageNumber) => {
|
|
12173
12454
|
goToPage(pageNumber);
|
|
12174
12455
|
onPageClick?.(pageNumber);
|
|
12175
12456
|
},
|
|
12176
12457
|
[goToPage, onPageClick]
|
|
12177
12458
|
);
|
|
12178
|
-
const getPageStatus = (0,
|
|
12459
|
+
const getPageStatus = (0, import_react52.useCallback)(
|
|
12179
12460
|
(pageNumber) => {
|
|
12180
12461
|
if (pageNumber === currentPage) return "current";
|
|
12181
12462
|
if (bookmarkedPages.has(pageNumber)) return "bookmarked";
|
|
@@ -12184,11 +12465,11 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12184
12465
|
},
|
|
12185
12466
|
[currentPage, visitedPages, bookmarkedPages]
|
|
12186
12467
|
);
|
|
12187
|
-
const pageIndicators = (0,
|
|
12468
|
+
const pageIndicators = (0, import_react52.useMemo)(() => {
|
|
12188
12469
|
const pages = [];
|
|
12189
12470
|
for (let i = 1; i <= numPages; i++) {
|
|
12190
12471
|
pages.push(
|
|
12191
|
-
/* @__PURE__ */ (0,
|
|
12472
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
12192
12473
|
PageIndicator,
|
|
12193
12474
|
{
|
|
12194
12475
|
pageNumber: i,
|
|
@@ -12209,16 +12490,16 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12209
12490
|
if (numPages === 0) {
|
|
12210
12491
|
return null;
|
|
12211
12492
|
}
|
|
12212
|
-
const content = /* @__PURE__ */ (0,
|
|
12213
|
-
/* @__PURE__ */ (0,
|
|
12214
|
-
/* @__PURE__ */ (0,
|
|
12215
|
-
/* @__PURE__ */ (0,
|
|
12216
|
-
/* @__PURE__ */ (0,
|
|
12493
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
12494
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mb-3", children: [
|
|
12495
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
|
|
12496
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Progress" }),
|
|
12497
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
|
|
12217
12498
|
progressPercentage,
|
|
12218
12499
|
"%"
|
|
12219
12500
|
] })
|
|
12220
12501
|
] }),
|
|
12221
|
-
/* @__PURE__ */ (0,
|
|
12502
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
12222
12503
|
"div",
|
|
12223
12504
|
{
|
|
12224
12505
|
className: "h-full bg-green-500 rounded-full transition-all duration-300",
|
|
@@ -12226,7 +12507,7 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12226
12507
|
}
|
|
12227
12508
|
) })
|
|
12228
12509
|
] }),
|
|
12229
|
-
/* @__PURE__ */ (0,
|
|
12510
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
12230
12511
|
"div",
|
|
12231
12512
|
{
|
|
12232
12513
|
className: cn(
|
|
@@ -12237,21 +12518,21 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12237
12518
|
children: pageIndicators
|
|
12238
12519
|
}
|
|
12239
12520
|
),
|
|
12240
|
-
/* @__PURE__ */ (0,
|
|
12241
|
-
/* @__PURE__ */ (0,
|
|
12242
|
-
/* @__PURE__ */ (0,
|
|
12243
|
-
/* @__PURE__ */ (0,
|
|
12521
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
12522
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12523
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
|
|
12524
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Current" })
|
|
12244
12525
|
] }),
|
|
12245
|
-
/* @__PURE__ */ (0,
|
|
12246
|
-
/* @__PURE__ */ (0,
|
|
12247
|
-
/* @__PURE__ */ (0,
|
|
12526
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12527
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
|
|
12528
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Visited" })
|
|
12248
12529
|
] }),
|
|
12249
|
-
/* @__PURE__ */ (0,
|
|
12250
|
-
/* @__PURE__ */ (0,
|
|
12251
|
-
/* @__PURE__ */ (0,
|
|
12530
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12531
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
|
|
12532
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Bookmarked" })
|
|
12252
12533
|
] })
|
|
12253
12534
|
] }) }),
|
|
12254
|
-
/* @__PURE__ */ (0,
|
|
12535
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
12255
12536
|
visitedCount,
|
|
12256
12537
|
" of ",
|
|
12257
12538
|
numPages,
|
|
@@ -12259,7 +12540,7 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12259
12540
|
] })
|
|
12260
12541
|
] });
|
|
12261
12542
|
if (variant === "floating") {
|
|
12262
|
-
return /* @__PURE__ */ (0,
|
|
12543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
12263
12544
|
"div",
|
|
12264
12545
|
{
|
|
12265
12546
|
className: cn(
|
|
@@ -12275,13 +12556,13 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12275
12556
|
),
|
|
12276
12557
|
style: { maxHeight },
|
|
12277
12558
|
children: [
|
|
12278
|
-
/* @__PURE__ */ (0,
|
|
12559
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
|
|
12279
12560
|
content
|
|
12280
12561
|
]
|
|
12281
12562
|
}
|
|
12282
12563
|
);
|
|
12283
12564
|
}
|
|
12284
|
-
return /* @__PURE__ */ (0,
|
|
12565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
12285
12566
|
"div",
|
|
12286
12567
|
{
|
|
12287
12568
|
className: cn(
|
|
@@ -12299,13 +12580,13 @@ var Minimap = (0, import_react51.memo)(function Minimap2({
|
|
|
12299
12580
|
init_FloatingZoomControls2();
|
|
12300
12581
|
|
|
12301
12582
|
// src/components/PDFThumbnailNav/PDFThumbnailNav.tsx
|
|
12302
|
-
var
|
|
12583
|
+
var import_react53 = require("react");
|
|
12303
12584
|
init_hooks();
|
|
12304
12585
|
init_utils();
|
|
12305
|
-
var
|
|
12586
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
12306
12587
|
var DEFAULT_WIDTH = 612;
|
|
12307
12588
|
var DEFAULT_HEIGHT = 792;
|
|
12308
|
-
var PDFThumbnailNav = (0,
|
|
12589
|
+
var PDFThumbnailNav = (0, import_react53.memo)(function PDFThumbnailNav2({
|
|
12309
12590
|
thumbnailScale = 0.15,
|
|
12310
12591
|
orientation = "vertical",
|
|
12311
12592
|
maxVisible = 10,
|
|
@@ -12316,14 +12597,14 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12316
12597
|
}) {
|
|
12317
12598
|
const { document: document2, numPages, currentPage } = usePDFViewer();
|
|
12318
12599
|
const { viewerStore } = usePDFViewerStores();
|
|
12319
|
-
const containerRef = (0,
|
|
12320
|
-
const [thumbnails, setThumbnails] = (0,
|
|
12321
|
-
const [visibleRange, setVisibleRange] = (0,
|
|
12322
|
-
const renderQueueRef = (0,
|
|
12323
|
-
const pageCache = (0,
|
|
12600
|
+
const containerRef = (0, import_react53.useRef)(null);
|
|
12601
|
+
const [thumbnails, setThumbnails] = (0, import_react53.useState)(/* @__PURE__ */ new Map());
|
|
12602
|
+
const [visibleRange, setVisibleRange] = (0, import_react53.useState)({ start: 1, end: maxVisible });
|
|
12603
|
+
const renderQueueRef = (0, import_react53.useRef)(/* @__PURE__ */ new Set());
|
|
12604
|
+
const pageCache = (0, import_react53.useRef)(/* @__PURE__ */ new Map());
|
|
12324
12605
|
const thumbnailWidth = Math.floor(DEFAULT_WIDTH * thumbnailScale);
|
|
12325
12606
|
const thumbnailHeight = Math.floor(DEFAULT_HEIGHT * thumbnailScale);
|
|
12326
|
-
const updateVisibleRange = (0,
|
|
12607
|
+
const updateVisibleRange = (0, import_react53.useCallback)(() => {
|
|
12327
12608
|
if (!containerRef.current || numPages === 0) return;
|
|
12328
12609
|
const container = containerRef.current;
|
|
12329
12610
|
const isHorizontal2 = orientation === "horizontal";
|
|
@@ -12335,7 +12616,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12335
12616
|
const lastVisible = Math.min(numPages, firstVisible + visibleCount);
|
|
12336
12617
|
setVisibleRange({ start: firstVisible, end: lastVisible });
|
|
12337
12618
|
}, [numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
|
|
12338
|
-
(0,
|
|
12619
|
+
(0, import_react53.useEffect)(() => {
|
|
12339
12620
|
const container = containerRef.current;
|
|
12340
12621
|
if (!container) return;
|
|
12341
12622
|
const handleScroll = () => {
|
|
@@ -12345,7 +12626,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12345
12626
|
updateVisibleRange();
|
|
12346
12627
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
12347
12628
|
}, [updateVisibleRange]);
|
|
12348
|
-
(0,
|
|
12629
|
+
(0, import_react53.useEffect)(() => {
|
|
12349
12630
|
if (!document2) {
|
|
12350
12631
|
setThumbnails(/* @__PURE__ */ new Map());
|
|
12351
12632
|
pageCache.current.clear();
|
|
@@ -12400,7 +12681,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12400
12681
|
};
|
|
12401
12682
|
renderThumbnails();
|
|
12402
12683
|
}, [document2, visibleRange, thumbnailScale, thumbnails]);
|
|
12403
|
-
(0,
|
|
12684
|
+
(0, import_react53.useEffect)(() => {
|
|
12404
12685
|
if (!containerRef.current || numPages === 0) return;
|
|
12405
12686
|
const container = containerRef.current;
|
|
12406
12687
|
const isHorizontal2 = orientation === "horizontal";
|
|
@@ -12416,12 +12697,12 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12416
12697
|
});
|
|
12417
12698
|
}
|
|
12418
12699
|
}, [currentPage, numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
|
|
12419
|
-
const handleThumbnailClick = (0,
|
|
12700
|
+
const handleThumbnailClick = (0, import_react53.useCallback)((pageNum) => {
|
|
12420
12701
|
onThumbnailClick?.(pageNum);
|
|
12421
12702
|
viewerStore.getState().requestScrollToPage(pageNum, "smooth");
|
|
12422
12703
|
}, [onThumbnailClick, viewerStore]);
|
|
12423
12704
|
if (!document2 || numPages === 0) {
|
|
12424
|
-
return /* @__PURE__ */ (0,
|
|
12705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12425
12706
|
"div",
|
|
12426
12707
|
{
|
|
12427
12708
|
className: cn(
|
|
@@ -12442,7 +12723,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12442
12723
|
}
|
|
12443
12724
|
const isHorizontal = orientation === "horizontal";
|
|
12444
12725
|
const totalSize = numPages * ((isHorizontal ? thumbnailWidth : thumbnailHeight) + gap) - gap;
|
|
12445
|
-
return /* @__PURE__ */ (0,
|
|
12726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12446
12727
|
"div",
|
|
12447
12728
|
{
|
|
12448
12729
|
ref: containerRef,
|
|
@@ -12456,7 +12737,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12456
12737
|
style: {
|
|
12457
12738
|
...isHorizontal ? { overflowX: "auto", overflowY: "hidden" } : { overflowX: "hidden", overflowY: "auto" }
|
|
12458
12739
|
},
|
|
12459
|
-
children: /* @__PURE__ */ (0,
|
|
12740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12460
12741
|
"div",
|
|
12461
12742
|
{
|
|
12462
12743
|
className: cn(
|
|
@@ -12473,7 +12754,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12473
12754
|
const thumbnail = thumbnails.get(pageNum);
|
|
12474
12755
|
const isActive = pageNum === currentPage;
|
|
12475
12756
|
const isVisible = pageNum >= visibleRange.start && pageNum <= visibleRange.end;
|
|
12476
|
-
return /* @__PURE__ */ (0,
|
|
12757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
12477
12758
|
"div",
|
|
12478
12759
|
{
|
|
12479
12760
|
className: cn(
|
|
@@ -12498,7 +12779,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12498
12779
|
}
|
|
12499
12780
|
},
|
|
12500
12781
|
children: [
|
|
12501
|
-
/* @__PURE__ */ (0,
|
|
12782
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12502
12783
|
"div",
|
|
12503
12784
|
{
|
|
12504
12785
|
className: "relative bg-white dark:bg-gray-700",
|
|
@@ -12506,7 +12787,7 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12506
12787
|
width: thumbnailWidth,
|
|
12507
12788
|
height: thumbnailHeight
|
|
12508
12789
|
},
|
|
12509
|
-
children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0,
|
|
12790
|
+
children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12510
12791
|
"img",
|
|
12511
12792
|
{
|
|
12512
12793
|
src: thumbnail.canvas.toDataURL(),
|
|
@@ -12514,10 +12795,10 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12514
12795
|
className: "w-full h-full object-contain",
|
|
12515
12796
|
loading: "lazy"
|
|
12516
12797
|
}
|
|
12517
|
-
) : /* @__PURE__ */ (0,
|
|
12798
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
|
|
12518
12799
|
}
|
|
12519
12800
|
),
|
|
12520
|
-
showPageNumbers && /* @__PURE__ */ (0,
|
|
12801
|
+
showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
12521
12802
|
"div",
|
|
12522
12803
|
{
|
|
12523
12804
|
className: cn(
|
|
@@ -12540,10 +12821,10 @@ var PDFThumbnailNav = (0, import_react52.memo)(function PDFThumbnailNav2({
|
|
|
12540
12821
|
});
|
|
12541
12822
|
|
|
12542
12823
|
// src/components/ErrorBoundary/PDFErrorBoundary.tsx
|
|
12543
|
-
var
|
|
12824
|
+
var import_react54 = require("react");
|
|
12544
12825
|
init_utils();
|
|
12545
|
-
var
|
|
12546
|
-
var PDFErrorBoundary = class extends
|
|
12826
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
12827
|
+
var PDFErrorBoundary = class extends import_react54.Component {
|
|
12547
12828
|
constructor(props) {
|
|
12548
12829
|
super(props);
|
|
12549
12830
|
this.handleReset = () => {
|
|
@@ -12570,7 +12851,7 @@ var PDFErrorBoundary = class extends import_react53.Component {
|
|
|
12570
12851
|
return fallback;
|
|
12571
12852
|
}
|
|
12572
12853
|
if (showDefaultUI) {
|
|
12573
|
-
return /* @__PURE__ */ (0,
|
|
12854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12574
12855
|
DefaultErrorUI,
|
|
12575
12856
|
{
|
|
12576
12857
|
error,
|
|
@@ -12589,7 +12870,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12589
12870
|
const isNetworkError = error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to load");
|
|
12590
12871
|
let title = "Something went wrong";
|
|
12591
12872
|
let description = error.message;
|
|
12592
|
-
let icon = /* @__PURE__ */ (0,
|
|
12873
|
+
let icon = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12593
12874
|
"path",
|
|
12594
12875
|
{
|
|
12595
12876
|
strokeLinecap: "round",
|
|
@@ -12601,7 +12882,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12601
12882
|
if (isPDFError) {
|
|
12602
12883
|
title = "Unable to load PDF";
|
|
12603
12884
|
description = "The PDF file could not be loaded. It may be corrupted or in an unsupported format.";
|
|
12604
|
-
icon = /* @__PURE__ */ (0,
|
|
12885
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12605
12886
|
"path",
|
|
12606
12887
|
{
|
|
12607
12888
|
strokeLinecap: "round",
|
|
@@ -12613,7 +12894,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12613
12894
|
} else if (isNetworkError) {
|
|
12614
12895
|
title = "Network error";
|
|
12615
12896
|
description = "Unable to fetch the PDF file. Please check your internet connection and try again.";
|
|
12616
|
-
icon = /* @__PURE__ */ (0,
|
|
12897
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12617
12898
|
"path",
|
|
12618
12899
|
{
|
|
12619
12900
|
strokeLinecap: "round",
|
|
@@ -12623,7 +12904,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12623
12904
|
}
|
|
12624
12905
|
) });
|
|
12625
12906
|
}
|
|
12626
|
-
return /* @__PURE__ */ (0,
|
|
12907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
12627
12908
|
"div",
|
|
12628
12909
|
{
|
|
12629
12910
|
className: cn(
|
|
@@ -12636,14 +12917,14 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12636
12917
|
),
|
|
12637
12918
|
children: [
|
|
12638
12919
|
icon,
|
|
12639
|
-
/* @__PURE__ */ (0,
|
|
12640
|
-
/* @__PURE__ */ (0,
|
|
12641
|
-
/* @__PURE__ */ (0,
|
|
12642
|
-
/* @__PURE__ */ (0,
|
|
12643
|
-
/* @__PURE__ */ (0,
|
|
12920
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
|
|
12921
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
|
|
12922
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
|
|
12923
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
|
|
12924
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
|
|
12644
12925
|
] }),
|
|
12645
|
-
/* @__PURE__ */ (0,
|
|
12646
|
-
/* @__PURE__ */ (0,
|
|
12926
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "mt-6 flex gap-3", children: [
|
|
12927
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12647
12928
|
"button",
|
|
12648
12929
|
{
|
|
12649
12930
|
onClick: onReset,
|
|
@@ -12657,7 +12938,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12657
12938
|
children: "Try again"
|
|
12658
12939
|
}
|
|
12659
12940
|
),
|
|
12660
|
-
/* @__PURE__ */ (0,
|
|
12941
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
12661
12942
|
"button",
|
|
12662
12943
|
{
|
|
12663
12944
|
onClick: () => window.location.reload(),
|
|
@@ -12677,7 +12958,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
12677
12958
|
);
|
|
12678
12959
|
}
|
|
12679
12960
|
function withErrorBoundary({ component, ...props }) {
|
|
12680
|
-
return /* @__PURE__ */ (0,
|
|
12961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PDFErrorBoundary, { ...props, children: component });
|
|
12681
12962
|
}
|
|
12682
12963
|
|
|
12683
12964
|
// src/components/index.ts
|
|
@@ -12698,6 +12979,7 @@ init_utils();
|
|
|
12698
12979
|
AnnotationToolbar,
|
|
12699
12980
|
AskAboutOverlay,
|
|
12700
12981
|
AskAboutTrigger,
|
|
12982
|
+
BookModeContainer,
|
|
12701
12983
|
BookmarksPanel,
|
|
12702
12984
|
CanvasLayer,
|
|
12703
12985
|
ContinuousScrollContainer,
|
|
@@ -12785,6 +13067,7 @@ init_utils();
|
|
|
12785
13067
|
pdfjsLib,
|
|
12786
13068
|
percentToPDF,
|
|
12787
13069
|
percentToViewport,
|
|
13070
|
+
playPageTurnSound,
|
|
12788
13071
|
quickViewer,
|
|
12789
13072
|
removeRotation,
|
|
12790
13073
|
saveHighlights,
|