@page-speed/lightbox 0.1.7 → 0.1.9
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/components/index.js +435 -196
- package/dist/index.cjs +435 -196
- package/dist/index.js +435 -196
- package/dist/renderers/index.js +373 -180
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -18065,7 +18065,7 @@ var require_pdf = __commonJS({
|
|
|
18065
18065
|
}
|
|
18066
18066
|
});
|
|
18067
18067
|
|
|
18068
|
-
// node_modules/.pnpm/@page-speed+pdf-viewer@0.1.
|
|
18068
|
+
// node_modules/.pnpm/@page-speed+pdf-viewer@0.1.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/pdf-viewer/dist/index.js
|
|
18069
18069
|
var dist_exports = {};
|
|
18070
18070
|
__export(dist_exports, {
|
|
18071
18071
|
PDFCanvas: () => PDFCanvas,
|
|
@@ -18075,6 +18075,7 @@ __export(dist_exports, {
|
|
|
18075
18075
|
calculateScaleForPageFit: () => calculateScaleForPageFit,
|
|
18076
18076
|
createProgressiveFetchHandler: () => createProgressiveFetchHandler,
|
|
18077
18077
|
downloadPDF: () => downloadPDF,
|
|
18078
|
+
extractPDFFilename: () => extractPDFFilename,
|
|
18078
18079
|
extractPageText: () => extractPageText,
|
|
18079
18080
|
formatFileSize: () => formatFileSize,
|
|
18080
18081
|
getOptimalRangeHeader: () => getOptimalRangeHeader,
|
|
@@ -18320,6 +18321,9 @@ function useSearch(pdfDoc) {
|
|
|
18320
18321
|
prevResult
|
|
18321
18322
|
};
|
|
18322
18323
|
}
|
|
18324
|
+
function cn2(...classes) {
|
|
18325
|
+
return classes.filter(Boolean).join(" ");
|
|
18326
|
+
}
|
|
18323
18327
|
function PDFCanvas({
|
|
18324
18328
|
pdfDoc,
|
|
18325
18329
|
pageNumber,
|
|
@@ -18343,7 +18347,79 @@ function PDFCanvas({
|
|
|
18343
18347
|
render();
|
|
18344
18348
|
}
|
|
18345
18349
|
}, [pdfDoc, pageNumber, scale, onRender]);
|
|
18346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
18350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
18351
|
+
"div",
|
|
18352
|
+
{
|
|
18353
|
+
ref: containerRef,
|
|
18354
|
+
className: cn2(
|
|
18355
|
+
"flex-1 overflow-auto",
|
|
18356
|
+
"flex items-center justify-center",
|
|
18357
|
+
"p-4 min-h-0"
|
|
18358
|
+
),
|
|
18359
|
+
"data-pdf-viewer": "canvas"
|
|
18360
|
+
}
|
|
18361
|
+
);
|
|
18362
|
+
}
|
|
18363
|
+
async function isLinearizedPDF(url) {
|
|
18364
|
+
try {
|
|
18365
|
+
const response = await fetch(url, { headers: { Range: "bytes=0-1024" } });
|
|
18366
|
+
const buffer = await response.arrayBuffer();
|
|
18367
|
+
const view = new Uint8Array(buffer);
|
|
18368
|
+
const text = new TextDecoder().decode(view);
|
|
18369
|
+
return text.includes("Linearized");
|
|
18370
|
+
} catch {
|
|
18371
|
+
return false;
|
|
18372
|
+
}
|
|
18373
|
+
}
|
|
18374
|
+
function extractPDFFilename(url, fallbackName) {
|
|
18375
|
+
try {
|
|
18376
|
+
const urlObj = new URL(url, window.location.origin);
|
|
18377
|
+
const pathname = urlObj.pathname;
|
|
18378
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
18379
|
+
const lastSegment = segments[segments.length - 1] || "";
|
|
18380
|
+
if (lastSegment && lastSegment.includes(".")) {
|
|
18381
|
+
if (lastSegment.toLowerCase().endsWith(".pdf")) {
|
|
18382
|
+
return lastSegment;
|
|
18383
|
+
}
|
|
18384
|
+
const nameWithoutExt = lastSegment.substring(0, lastSegment.lastIndexOf("."));
|
|
18385
|
+
return `${nameWithoutExt}.pdf`;
|
|
18386
|
+
}
|
|
18387
|
+
if (lastSegment) {
|
|
18388
|
+
return `${lastSegment}.pdf`;
|
|
18389
|
+
}
|
|
18390
|
+
} catch {
|
|
18391
|
+
}
|
|
18392
|
+
const name = fallbackName || "document";
|
|
18393
|
+
return name.toLowerCase().endsWith(".pdf") ? name : `${name}.pdf`;
|
|
18394
|
+
}
|
|
18395
|
+
function downloadPDF(url, filename) {
|
|
18396
|
+
const link = document.createElement("a");
|
|
18397
|
+
link.href = url;
|
|
18398
|
+
link.download = filename || extractPDFFilename(url);
|
|
18399
|
+
document.body.appendChild(link);
|
|
18400
|
+
link.click();
|
|
18401
|
+
document.body.removeChild(link);
|
|
18402
|
+
}
|
|
18403
|
+
function calculateScaleForPageFit(pageWidth, pageHeight, containerWidth, containerHeight) {
|
|
18404
|
+
const widthRatio = containerWidth / pageWidth;
|
|
18405
|
+
const heightRatio = containerHeight / pageHeight;
|
|
18406
|
+
return Math.min(widthRatio, heightRatio);
|
|
18407
|
+
}
|
|
18408
|
+
function formatFileSize(bytes) {
|
|
18409
|
+
if (bytes === 0) return "0 Bytes";
|
|
18410
|
+
const k = 1024;
|
|
18411
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
18412
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
18413
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
18414
|
+
}
|
|
18415
|
+
async function extractPageText(pdfDoc, pageNumber) {
|
|
18416
|
+
try {
|
|
18417
|
+
const page = await pdfDoc.getPage(pageNumber);
|
|
18418
|
+
const textContent = await page.getTextContent();
|
|
18419
|
+
return textContent.items.filter((item) => "str" in item).map((item) => item.str).join(" ");
|
|
18420
|
+
} catch {
|
|
18421
|
+
return "";
|
|
18422
|
+
}
|
|
18347
18423
|
}
|
|
18348
18424
|
function PDFControls({
|
|
18349
18425
|
pageState,
|
|
@@ -18356,93 +18432,151 @@ function PDFControls({
|
|
|
18356
18432
|
url
|
|
18357
18433
|
}) {
|
|
18358
18434
|
if (!pdfDocument) return null;
|
|
18359
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18370
|
-
|
|
18371
|
-
|
|
18372
|
-
|
|
18373
|
-
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
|
|
18445
|
-
|
|
18435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
18436
|
+
"div",
|
|
18437
|
+
{
|
|
18438
|
+
className: cn2(
|
|
18439
|
+
"flex items-center gap-2",
|
|
18440
|
+
"px-3 py-2",
|
|
18441
|
+
"bg-background border-b border-border",
|
|
18442
|
+
"overflow-x-auto flex-wrap",
|
|
18443
|
+
"flex-shrink-0 z-10"
|
|
18444
|
+
),
|
|
18445
|
+
"data-pdf-viewer": "controls",
|
|
18446
|
+
children: [
|
|
18447
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
18448
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18449
|
+
IconButton,
|
|
18450
|
+
{
|
|
18451
|
+
onClick: pageState.prevPage,
|
|
18452
|
+
disabled: !pageState.canPrev,
|
|
18453
|
+
title: "Previous page",
|
|
18454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronLeftIcon, {})
|
|
18455
|
+
}
|
|
18456
|
+
),
|
|
18457
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18458
|
+
"input",
|
|
18459
|
+
{
|
|
18460
|
+
type: "number",
|
|
18461
|
+
min: "1",
|
|
18462
|
+
max: pdfDocument.numPages,
|
|
18463
|
+
value: pageState.currentPage,
|
|
18464
|
+
onChange: (e) => pageState.goToPage(parseInt(e.target.value, 10) || 1),
|
|
18465
|
+
className: cn2(
|
|
18466
|
+
"w-14 h-8 px-2",
|
|
18467
|
+
"text-center text-sm font-medium",
|
|
18468
|
+
"bg-background border border-input rounded-md",
|
|
18469
|
+
"focus:outline-none focus:ring-2 focus:ring-ring"
|
|
18470
|
+
)
|
|
18471
|
+
}
|
|
18472
|
+
),
|
|
18473
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
|
|
18474
|
+
"of ",
|
|
18475
|
+
pdfDocument.numPages
|
|
18476
|
+
] }),
|
|
18477
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18478
|
+
IconButton,
|
|
18479
|
+
{
|
|
18480
|
+
onClick: pageState.nextPage,
|
|
18481
|
+
disabled: !pageState.canNext,
|
|
18482
|
+
title: "Next page",
|
|
18483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRightIcon, {})
|
|
18484
|
+
}
|
|
18485
|
+
)
|
|
18486
|
+
] }),
|
|
18487
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
18488
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
18489
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18490
|
+
IconButton,
|
|
18491
|
+
{
|
|
18492
|
+
onClick: zoom.zoomOut,
|
|
18493
|
+
disabled: !zoom.canZoomOut,
|
|
18494
|
+
title: "Zoom out",
|
|
18495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MinusIcon, {})
|
|
18496
|
+
}
|
|
18497
|
+
),
|
|
18498
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-sm font-medium text-foreground min-w-[3.5rem] text-center", children: [
|
|
18499
|
+
Math.round(zoom.zoomLevel * 100),
|
|
18500
|
+
"%"
|
|
18501
|
+
] }),
|
|
18502
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18503
|
+
IconButton,
|
|
18504
|
+
{
|
|
18505
|
+
onClick: zoom.zoomIn,
|
|
18506
|
+
disabled: !zoom.canZoomIn,
|
|
18507
|
+
title: "Zoom in",
|
|
18508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PlusIcon, {})
|
|
18509
|
+
}
|
|
18510
|
+
)
|
|
18511
|
+
] }),
|
|
18512
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-px h-6 bg-border mx-1" }),
|
|
18513
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
18514
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
18515
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18516
|
+
"input",
|
|
18517
|
+
{
|
|
18518
|
+
type: "text",
|
|
18519
|
+
placeholder: "Search...",
|
|
18520
|
+
value: search.query,
|
|
18521
|
+
onChange: (e) => search.search(e.target.value),
|
|
18522
|
+
className: cn2(
|
|
18523
|
+
"h-8 pl-8 pr-3 w-32",
|
|
18524
|
+
"text-sm",
|
|
18525
|
+
"bg-background border border-input rounded-md",
|
|
18526
|
+
"placeholder:text-muted-foreground",
|
|
18527
|
+
"focus:outline-none focus:ring-2 focus:ring-ring"
|
|
18528
|
+
)
|
|
18529
|
+
}
|
|
18530
|
+
),
|
|
18531
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SearchIcon, {}) })
|
|
18532
|
+
] }),
|
|
18533
|
+
search.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
|
|
18534
|
+
search.results.length,
|
|
18535
|
+
" results"
|
|
18536
|
+
] })
|
|
18537
|
+
] }),
|
|
18538
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-1" }),
|
|
18539
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
18540
|
+
enableDownload && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
18541
|
+
ActionButton,
|
|
18542
|
+
{
|
|
18543
|
+
onClick: () => downloadPDF(url),
|
|
18544
|
+
title: "Download",
|
|
18545
|
+
children: [
|
|
18546
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DownloadIcon, {}),
|
|
18547
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Download" })
|
|
18548
|
+
]
|
|
18549
|
+
}
|
|
18550
|
+
),
|
|
18551
|
+
enablePrint && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
18552
|
+
ActionButton,
|
|
18553
|
+
{
|
|
18554
|
+
onClick: () => window.print(),
|
|
18555
|
+
title: "Print",
|
|
18556
|
+
children: [
|
|
18557
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PrintIcon, {}),
|
|
18558
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Print" })
|
|
18559
|
+
]
|
|
18560
|
+
}
|
|
18561
|
+
),
|
|
18562
|
+
enableFullscreen && typeof document !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18563
|
+
IconButton,
|
|
18564
|
+
{
|
|
18565
|
+
onClick: () => {
|
|
18566
|
+
if (document.fullscreenElement) {
|
|
18567
|
+
document.exitFullscreen();
|
|
18568
|
+
} else {
|
|
18569
|
+
document.documentElement?.requestFullscreen();
|
|
18570
|
+
}
|
|
18571
|
+
},
|
|
18572
|
+
title: "Fullscreen",
|
|
18573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FullscreenIcon, {})
|
|
18574
|
+
}
|
|
18575
|
+
)
|
|
18576
|
+
] })
|
|
18577
|
+
]
|
|
18578
|
+
}
|
|
18579
|
+
);
|
|
18446
18580
|
}
|
|
18447
18581
|
function PDFThumbnails({
|
|
18448
18582
|
pdfDoc,
|
|
@@ -18480,32 +18614,55 @@ function PDFThumbnails({
|
|
|
18480
18614
|
};
|
|
18481
18615
|
generateThumbnails();
|
|
18482
18616
|
}, [pdfDoc, numPages]);
|
|
18483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
18617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
18484
18618
|
"div",
|
|
18485
18619
|
{
|
|
18486
|
-
className:
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
|
|
18490
|
-
|
|
18491
|
-
|
|
18492
|
-
|
|
18493
|
-
|
|
18494
|
-
|
|
18495
|
-
|
|
18496
|
-
|
|
18497
|
-
|
|
18498
|
-
|
|
18499
|
-
|
|
18500
|
-
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18620
|
+
className: cn2(
|
|
18621
|
+
"w-32 flex-shrink-0",
|
|
18622
|
+
"overflow-y-auto",
|
|
18623
|
+
"bg-muted/50 border-r border-border",
|
|
18624
|
+
"p-2 space-y-2"
|
|
18625
|
+
),
|
|
18626
|
+
"data-pdf-viewer": "thumbnails",
|
|
18627
|
+
children: thumbnails.map((thumb, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
18628
|
+
"div",
|
|
18629
|
+
{
|
|
18630
|
+
className: cn2(
|
|
18631
|
+
"cursor-pointer rounded-md overflow-hidden",
|
|
18632
|
+
"border-2 transition-colors duration-150",
|
|
18633
|
+
idx + 1 === currentPage ? "border-primary ring-2 ring-primary/20" : "border-transparent hover:border-muted-foreground/30"
|
|
18634
|
+
),
|
|
18635
|
+
onClick: () => onSelectPage(idx + 1),
|
|
18636
|
+
"data-pdf-viewer": "thumbnail",
|
|
18637
|
+
"data-active": idx + 1 === currentPage,
|
|
18638
|
+
children: [
|
|
18639
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
18640
|
+
"canvas",
|
|
18641
|
+
{
|
|
18642
|
+
width: thumb.width,
|
|
18643
|
+
height: thumb.height,
|
|
18644
|
+
ref: (el) => {
|
|
18645
|
+
if (el && thumb) {
|
|
18646
|
+
const ctx = el.getContext("2d");
|
|
18647
|
+
if (ctx) {
|
|
18648
|
+
ctx.drawImage(thumb, 0, 0);
|
|
18649
|
+
}
|
|
18650
|
+
}
|
|
18651
|
+
},
|
|
18652
|
+
className: "w-full h-auto"
|
|
18653
|
+
}
|
|
18654
|
+
),
|
|
18655
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn2(
|
|
18656
|
+
"block text-center text-xs py-1",
|
|
18657
|
+
"text-muted-foreground",
|
|
18658
|
+
idx + 1 === currentPage && "text-primary font-medium"
|
|
18659
|
+
), children: idx + 1 })
|
|
18660
|
+
]
|
|
18661
|
+
},
|
|
18662
|
+
idx
|
|
18663
|
+
))
|
|
18664
|
+
}
|
|
18665
|
+
);
|
|
18509
18666
|
}
|
|
18510
18667
|
function PDFViewer({
|
|
18511
18668
|
url,
|
|
@@ -18553,19 +18710,48 @@ function PDFViewer({
|
|
|
18553
18710
|
}
|
|
18554
18711
|
}, [search.results, onSearchResults]);
|
|
18555
18712
|
if (error) {
|
|
18556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18557
|
-
"
|
|
18558
|
-
|
|
18559
|
-
|
|
18713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18714
|
+
"div",
|
|
18715
|
+
{
|
|
18716
|
+
className: cn2(
|
|
18717
|
+
"flex items-center justify-center",
|
|
18718
|
+
"bg-background rounded-lg",
|
|
18719
|
+
className
|
|
18720
|
+
),
|
|
18721
|
+
style: { height, width },
|
|
18722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-destructive text-base", children: [
|
|
18723
|
+
"Failed to load PDF: ",
|
|
18724
|
+
error.message
|
|
18725
|
+
] })
|
|
18726
|
+
}
|
|
18727
|
+
);
|
|
18560
18728
|
}
|
|
18561
18729
|
if (loading) {
|
|
18562
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18731
|
+
"div",
|
|
18732
|
+
{
|
|
18733
|
+
className: cn2(
|
|
18734
|
+
"flex items-center justify-center",
|
|
18735
|
+
"bg-background rounded-lg",
|
|
18736
|
+
className
|
|
18737
|
+
),
|
|
18738
|
+
style: { height, width },
|
|
18739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-muted-foreground text-base", children: "Loading PDF..." })
|
|
18740
|
+
}
|
|
18741
|
+
);
|
|
18563
18742
|
}
|
|
18564
18743
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
18565
18744
|
"div",
|
|
18566
18745
|
{
|
|
18567
|
-
className:
|
|
18746
|
+
className: cn2(
|
|
18747
|
+
"flex flex-col",
|
|
18748
|
+
"bg-muted/30 rounded-lg overflow-hidden",
|
|
18749
|
+
"shadow-sm border border-border",
|
|
18750
|
+
"font-sans",
|
|
18751
|
+
className
|
|
18752
|
+
),
|
|
18568
18753
|
style: { height, width, ...style },
|
|
18754
|
+
"data-pdf-viewer": "root",
|
|
18569
18755
|
children: [
|
|
18570
18756
|
showControls && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18571
18757
|
PDFControls,
|
|
@@ -18580,7 +18766,7 @@ function PDFViewer({
|
|
|
18580
18766
|
url
|
|
18581
18767
|
}
|
|
18582
18768
|
),
|
|
18583
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className:
|
|
18769
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-1 overflow-hidden min-h-0", "data-pdf-viewer": "content", children: [
|
|
18584
18770
|
showThumbnails && document2 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
18585
18771
|
PDFThumbnails,
|
|
18586
18772
|
{
|
|
@@ -18604,46 +18790,6 @@ function PDFViewer({
|
|
|
18604
18790
|
}
|
|
18605
18791
|
);
|
|
18606
18792
|
}
|
|
18607
|
-
async function isLinearizedPDF(url) {
|
|
18608
|
-
try {
|
|
18609
|
-
const response = await fetch(url, { headers: { Range: "bytes=0-1024" } });
|
|
18610
|
-
const buffer = await response.arrayBuffer();
|
|
18611
|
-
const view = new Uint8Array(buffer);
|
|
18612
|
-
const text = new TextDecoder().decode(view);
|
|
18613
|
-
return text.includes("Linearized");
|
|
18614
|
-
} catch {
|
|
18615
|
-
return false;
|
|
18616
|
-
}
|
|
18617
|
-
}
|
|
18618
|
-
function downloadPDF(url, filename) {
|
|
18619
|
-
const link = document.createElement("a");
|
|
18620
|
-
link.href = url;
|
|
18621
|
-
link.download = filename || "document.pdf";
|
|
18622
|
-
document.body.appendChild(link);
|
|
18623
|
-
link.click();
|
|
18624
|
-
document.body.removeChild(link);
|
|
18625
|
-
}
|
|
18626
|
-
function calculateScaleForPageFit(pageWidth, pageHeight, containerWidth, containerHeight) {
|
|
18627
|
-
const widthRatio = containerWidth / pageWidth;
|
|
18628
|
-
const heightRatio = containerHeight / pageHeight;
|
|
18629
|
-
return Math.min(widthRatio, heightRatio);
|
|
18630
|
-
}
|
|
18631
|
-
function formatFileSize(bytes) {
|
|
18632
|
-
if (bytes === 0) return "0 Bytes";
|
|
18633
|
-
const k = 1024;
|
|
18634
|
-
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
18635
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
18636
|
-
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
18637
|
-
}
|
|
18638
|
-
async function extractPageText(pdfDoc, pageNumber) {
|
|
18639
|
-
try {
|
|
18640
|
-
const page = await pdfDoc.getPage(pageNumber);
|
|
18641
|
-
const textContent = await page.getTextContent();
|
|
18642
|
-
return textContent.items.filter((item) => "str" in item).map((item) => item.str).join(" ");
|
|
18643
|
-
} catch {
|
|
18644
|
-
return "";
|
|
18645
|
-
}
|
|
18646
|
-
}
|
|
18647
18793
|
function getOptimalRangeHeader(fileSize) {
|
|
18648
18794
|
const chunkSize = Math.min(65536, Math.ceil(fileSize * 0.1));
|
|
18649
18795
|
return {
|
|
@@ -18668,9 +18814,9 @@ function createProgressiveFetchHandler(onProgress) {
|
|
|
18668
18814
|
return response.arrayBuffer();
|
|
18669
18815
|
};
|
|
18670
18816
|
}
|
|
18671
|
-
var import_react8, import_react9, import_react10, import_react11, import_react12, import_react13, import_react14, import_jsx_runtime5, import_jsx_runtime6, import_react15, import_jsx_runtime7, import_jsx_runtime8, DEFAULT_SCALE, CACHE_SIZE, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP,
|
|
18817
|
+
var import_react8, import_react9, import_react10, import_react11, import_react12, import_react13, import_react14, import_jsx_runtime5, import_jsx_runtime6, import_react15, import_jsx_runtime7, import_jsx_runtime8, DEFAULT_SCALE, CACHE_SIZE, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, ChevronLeftIcon, ChevronRightIcon, MinusIcon, PlusIcon, DownloadIcon, PrintIcon, FullscreenIcon, SearchIcon, IconButton, ActionButton, linearizedPDFConfig;
|
|
18672
18818
|
var init_dist = __esm({
|
|
18673
|
-
"node_modules/.pnpm/@page-speed+pdf-viewer@0.1.
|
|
18819
|
+
"node_modules/.pnpm/@page-speed+pdf-viewer@0.1.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/pdf-viewer/dist/index.js"() {
|
|
18674
18820
|
"use client";
|
|
18675
18821
|
import_react8 = require("react");
|
|
18676
18822
|
import_react9 = require("react");
|
|
@@ -18689,24 +18835,71 @@ var init_dist = __esm({
|
|
|
18689
18835
|
MIN_ZOOM = 0.5;
|
|
18690
18836
|
MAX_ZOOM = 3;
|
|
18691
18837
|
ZOOM_STEP = 0.25;
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18838
|
+
ChevronLeftIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M15 18l-6-6 6-6" }) });
|
|
18839
|
+
ChevronRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 18l6-6-6-6" }) });
|
|
18840
|
+
MinusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5 12h14" }) });
|
|
18841
|
+
PlusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 5v14M5 12h14" }) });
|
|
18842
|
+
DownloadIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) });
|
|
18843
|
+
PrintIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
18844
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "6 9 6 2 18 2 18 9" }),
|
|
18845
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
|
|
18846
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "6", y: "14", width: "12", height: "8" })
|
|
18847
|
+
] });
|
|
18848
|
+
FullscreenIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) });
|
|
18849
|
+
SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
18850
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
18851
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M21 21l-4.35-4.35" })
|
|
18852
|
+
] });
|
|
18853
|
+
IconButton = ({
|
|
18854
|
+
onClick,
|
|
18855
|
+
disabled,
|
|
18856
|
+
title,
|
|
18857
|
+
children,
|
|
18858
|
+
className
|
|
18859
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18860
|
+
"button",
|
|
18861
|
+
{
|
|
18862
|
+
type: "button",
|
|
18863
|
+
onClick,
|
|
18864
|
+
disabled,
|
|
18865
|
+
title,
|
|
18866
|
+
className: cn2(
|
|
18867
|
+
"inline-flex items-center justify-center",
|
|
18868
|
+
"h-8 w-8 rounded-md",
|
|
18869
|
+
"bg-secondary text-secondary-foreground",
|
|
18870
|
+
"hover:bg-secondary/80",
|
|
18871
|
+
"transition-colors duration-150",
|
|
18872
|
+
"disabled:opacity-50 disabled:pointer-events-none",
|
|
18873
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
18874
|
+
className
|
|
18875
|
+
),
|
|
18876
|
+
children
|
|
18877
|
+
}
|
|
18878
|
+
);
|
|
18879
|
+
ActionButton = ({
|
|
18880
|
+
onClick,
|
|
18881
|
+
title,
|
|
18882
|
+
children,
|
|
18883
|
+
className
|
|
18884
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
18885
|
+
"button",
|
|
18886
|
+
{
|
|
18887
|
+
type: "button",
|
|
18888
|
+
onClick,
|
|
18889
|
+
title,
|
|
18890
|
+
className: cn2(
|
|
18891
|
+
"inline-flex items-center justify-center gap-1.5",
|
|
18892
|
+
"h-8 px-3 rounded-md",
|
|
18893
|
+
"bg-primary text-primary-foreground",
|
|
18894
|
+
"hover:bg-primary/90",
|
|
18895
|
+
"text-sm font-medium",
|
|
18896
|
+
"transition-colors duration-150",
|
|
18897
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
18898
|
+
className
|
|
18899
|
+
),
|
|
18900
|
+
children
|
|
18901
|
+
}
|
|
18902
|
+
);
|
|
18710
18903
|
linearizedPDFConfig = {
|
|
18711
18904
|
rangeChunkSize: 65536,
|
|
18712
18905
|
// 64 KB chunks for streaming
|
|
@@ -22653,7 +22846,7 @@ var DEFAULT_CONTROLS = {
|
|
|
22653
22846
|
function mergeControls(overrides) {
|
|
22654
22847
|
return { ...DEFAULT_CONTROLS, ...overrides || {} };
|
|
22655
22848
|
}
|
|
22656
|
-
var
|
|
22849
|
+
var IconButton2 = ({
|
|
22657
22850
|
onClick,
|
|
22658
22851
|
disabled,
|
|
22659
22852
|
ariaLabel,
|
|
@@ -22682,8 +22875,8 @@ var IconButton = ({
|
|
|
22682
22875
|
var ArrowLeftIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M19 12H5M12 19l-7-7 7-7" }) });
|
|
22683
22876
|
var ArrowRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M5 12h14M12 5l7 7-7 7" }) });
|
|
22684
22877
|
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M18 6L6 18M6 6l12 12" }) });
|
|
22685
|
-
var
|
|
22686
|
-
var
|
|
22878
|
+
var FullscreenIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) });
|
|
22879
|
+
var DownloadIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3" }) });
|
|
22687
22880
|
var ShareIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13" }) });
|
|
22688
22881
|
function LightboxChrome({
|
|
22689
22882
|
currentIndex,
|
|
@@ -22753,10 +22946,56 @@ function LightboxChrome({
|
|
|
22753
22946
|
try {
|
|
22754
22947
|
const response = await fetch(currentItem.src);
|
|
22755
22948
|
const blob = await response.blob();
|
|
22949
|
+
const getFileExtension = () => {
|
|
22950
|
+
const contentType = response.headers.get("Content-Type");
|
|
22951
|
+
if (contentType) {
|
|
22952
|
+
const mimeToExt = {
|
|
22953
|
+
"application/pdf": ".pdf",
|
|
22954
|
+
"image/jpeg": ".jpg",
|
|
22955
|
+
"image/jpg": ".jpg",
|
|
22956
|
+
"image/png": ".png",
|
|
22957
|
+
"image/gif": ".gif",
|
|
22958
|
+
"image/webp": ".webp",
|
|
22959
|
+
"image/svg+xml": ".svg",
|
|
22960
|
+
"video/mp4": ".mp4",
|
|
22961
|
+
"video/webm": ".webm",
|
|
22962
|
+
"video/quicktime": ".mov"
|
|
22963
|
+
};
|
|
22964
|
+
const baseMime = contentType.split(";")[0].trim().toLowerCase();
|
|
22965
|
+
if (mimeToExt[baseMime]) {
|
|
22966
|
+
return mimeToExt[baseMime];
|
|
22967
|
+
}
|
|
22968
|
+
}
|
|
22969
|
+
try {
|
|
22970
|
+
const urlObj = new URL(currentItem.src, window.location.origin);
|
|
22971
|
+
const pathname = urlObj.pathname;
|
|
22972
|
+
const lastDotIndex = pathname.lastIndexOf(".");
|
|
22973
|
+
if (lastDotIndex > pathname.lastIndexOf("/")) {
|
|
22974
|
+
const ext = pathname.substring(lastDotIndex).toLowerCase();
|
|
22975
|
+
if (ext.length >= 2 && ext.length <= 6) {
|
|
22976
|
+
return ext;
|
|
22977
|
+
}
|
|
22978
|
+
}
|
|
22979
|
+
} catch {
|
|
22980
|
+
}
|
|
22981
|
+
const typeToExt = {
|
|
22982
|
+
"pdf": ".pdf",
|
|
22983
|
+
"image": ".jpg",
|
|
22984
|
+
"video": ".mp4"
|
|
22985
|
+
};
|
|
22986
|
+
if (currentItem.type && typeToExt[currentItem.type]) {
|
|
22987
|
+
return typeToExt[currentItem.type];
|
|
22988
|
+
}
|
|
22989
|
+
return "";
|
|
22990
|
+
};
|
|
22991
|
+
const baseName = currentItem.title || "download";
|
|
22992
|
+
const extension = getFileExtension();
|
|
22993
|
+
const hasExtension = baseName.includes(".") && baseName.lastIndexOf(".") > baseName.length - 6;
|
|
22994
|
+
const filename = hasExtension ? baseName : `${baseName}${extension}`;
|
|
22756
22995
|
const url = window.URL.createObjectURL(blob);
|
|
22757
22996
|
const link = document.createElement("a");
|
|
22758
22997
|
link.href = url;
|
|
22759
|
-
link.download =
|
|
22998
|
+
link.download = filename;
|
|
22760
22999
|
document.body.appendChild(link);
|
|
22761
23000
|
link.click();
|
|
22762
23001
|
document.body.removeChild(link);
|
|
@@ -22775,23 +23014,23 @@ function LightboxChrome({
|
|
|
22775
23014
|
className
|
|
22776
23015
|
), children: [
|
|
22777
23016
|
resolved.navigation && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
22778
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22779
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
23017
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onPrev, disabled: !canPrev, ariaLabel: "Previous item", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArrowLeftIcon, {}) }),
|
|
23018
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onNext, disabled: !canNext, ariaLabel: "Next item", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArrowRightIcon, {}) })
|
|
22780
23019
|
] }),
|
|
22781
23020
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col", children: resolved.captions && currentItem && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
22782
23021
|
currentItem.title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-sm font-semibold", children: currentItem.title }),
|
|
22783
23022
|
currentItem.caption && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-xs text-white/70", children: currentItem.caption })
|
|
22784
23023
|
] }) }),
|
|
22785
23024
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
22786
|
-
resolved.share && "share" in navigator && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22787
|
-
resolved.fullscreen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22788
|
-
resolved.download && currentItem?.src && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
23025
|
+
resolved.share && "share" in navigator && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleShare, ariaLabel: "Share", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ShareIcon, {}) }),
|
|
23026
|
+
resolved.fullscreen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleFullscreen, ariaLabel: isFullscreen ? "Exit fullscreen" : "Fullscreen", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FullscreenIcon2, {}) }),
|
|
23027
|
+
resolved.download && currentItem?.src && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleDownload, ariaLabel: "Download", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DownloadIcon2, {}) }),
|
|
22789
23028
|
resolved.counter && totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-xs text-white/70", children: [
|
|
22790
23029
|
currentIndex + 1,
|
|
22791
23030
|
" / ",
|
|
22792
23031
|
totalItems
|
|
22793
23032
|
] }),
|
|
22794
|
-
resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
23033
|
+
resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onClose, ariaLabel: "Close lightbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, {}) })
|
|
22795
23034
|
] })
|
|
22796
23035
|
] });
|
|
22797
23036
|
}
|
|
@@ -22801,14 +23040,14 @@ function LightboxChrome({
|
|
|
22801
23040
|
"flex items-center gap-2",
|
|
22802
23041
|
className
|
|
22803
23042
|
), children: [
|
|
22804
|
-
resolved.share && "share" in navigator && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22805
|
-
resolved.fullscreen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22806
|
-
resolved.download && currentItem?.src && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22807
|
-
resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
23043
|
+
resolved.share && "share" in navigator && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleShare, ariaLabel: "Share", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ShareIcon, {}) }),
|
|
23044
|
+
resolved.fullscreen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleFullscreen, ariaLabel: isFullscreen ? "Exit fullscreen" : "Fullscreen", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FullscreenIcon2, {}) }),
|
|
23045
|
+
resolved.download && currentItem?.src && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: handleDownload, ariaLabel: "Download", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DownloadIcon2, {}) }),
|
|
23046
|
+
resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onClose, ariaLabel: "Close lightbox", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, {}) })
|
|
22808
23047
|
] }),
|
|
22809
23048
|
resolved.navigation && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed bottom-6 right-6 z-50 flex items-center gap-3", children: [
|
|
22810
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
22811
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
23049
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onPrev, disabled: !canPrev, ariaLabel: "Previous item", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArrowLeftIcon, {}) }),
|
|
23050
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton2, { onClick: onNext, disabled: !canNext, ariaLabel: "Next item", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArrowRightIcon, {}) })
|
|
22812
23051
|
] }),
|
|
22813
23052
|
resolved.captions && currentItem && (currentItem.title || currentItem.caption) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn(
|
|
22814
23053
|
"fixed bottom-6 left-6 z-50",
|