@page-speed/lightbox 0.0.1 → 0.0.2

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 CHANGED
@@ -979,7 +979,7 @@ var require_react_development = __commonJS({
979
979
  }
980
980
  return lazyType;
981
981
  }
982
- function forwardRef(render) {
982
+ function forwardRef2(render) {
983
983
  {
984
984
  if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
985
985
  error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
@@ -1040,7 +1040,7 @@ var require_react_development = __commonJS({
1040
1040
  }
1041
1041
  return false;
1042
1042
  }
1043
- function memo(type, compare) {
1043
+ function memo2(type, compare) {
1044
1044
  {
1045
1045
  if (!isValidElementType(type)) {
1046
1046
  error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
@@ -1100,11 +1100,11 @@ var require_react_development = __commonJS({
1100
1100
  var dispatcher = resolveDispatcher();
1101
1101
  return dispatcher.useReducer(reducer, initialArg, init);
1102
1102
  }
1103
- function useRef4(initialValue) {
1103
+ function useRef5(initialValue) {
1104
1104
  var dispatcher = resolveDispatcher();
1105
1105
  return dispatcher.useRef(initialValue);
1106
1106
  }
1107
- function useEffect7(create, deps) {
1107
+ function useEffect10(create, deps) {
1108
1108
  var dispatcher = resolveDispatcher();
1109
1109
  return dispatcher.useEffect(create, deps);
1110
1110
  }
@@ -1120,11 +1120,11 @@ var require_react_development = __commonJS({
1120
1120
  var dispatcher = resolveDispatcher();
1121
1121
  return dispatcher.useCallback(callback, deps);
1122
1122
  }
1123
- function useMemo2(create, deps) {
1123
+ function useMemo4(create, deps) {
1124
1124
  var dispatcher = resolveDispatcher();
1125
1125
  return dispatcher.useMemo(create, deps);
1126
1126
  }
1127
- function useImperativeHandle(ref, create, deps) {
1127
+ function useImperativeHandle2(ref, create, deps) {
1128
1128
  var dispatcher = resolveDispatcher();
1129
1129
  return dispatcher.useImperativeHandle(ref, create, deps);
1130
1130
  }
@@ -1877,24 +1877,24 @@ var require_react_development = __commonJS({
1877
1877
  exports2.createElement = createElement$1;
1878
1878
  exports2.createFactory = createFactory;
1879
1879
  exports2.createRef = createRef;
1880
- exports2.forwardRef = forwardRef;
1880
+ exports2.forwardRef = forwardRef2;
1881
1881
  exports2.isValidElement = isValidElement;
1882
1882
  exports2.lazy = lazy;
1883
- exports2.memo = memo;
1883
+ exports2.memo = memo2;
1884
1884
  exports2.startTransition = startTransition;
1885
1885
  exports2.unstable_act = act;
1886
1886
  exports2.useCallback = useCallback7;
1887
1887
  exports2.useContext = useContext;
1888
1888
  exports2.useDebugValue = useDebugValue;
1889
1889
  exports2.useDeferredValue = useDeferredValue;
1890
- exports2.useEffect = useEffect7;
1890
+ exports2.useEffect = useEffect10;
1891
1891
  exports2.useId = useId;
1892
- exports2.useImperativeHandle = useImperativeHandle;
1892
+ exports2.useImperativeHandle = useImperativeHandle2;
1893
1893
  exports2.useInsertionEffect = useInsertionEffect;
1894
1894
  exports2.useLayoutEffect = useLayoutEffect;
1895
- exports2.useMemo = useMemo2;
1895
+ exports2.useMemo = useMemo4;
1896
1896
  exports2.useReducer = useReducer;
1897
- exports2.useRef = useRef4;
1897
+ exports2.useRef = useRef5;
1898
1898
  exports2.useState = useState9;
1899
1899
  exports2.useSyncExternalStore = useSyncExternalStore;
1900
1900
  exports2.useTransition = useTransition;
@@ -20878,11 +20878,11 @@ __export(dist_exports, {
20878
20878
  useZoom: () => useZoom
20879
20879
  });
20880
20880
  function usePDFDocument(url, onError) {
20881
- const [document2, setDocument] = (0, import_react5.useState)(null);
20882
- const [loading, setLoading] = (0, import_react5.useState)(true);
20883
- const [error, setError] = (0, import_react5.useState)(null);
20884
- const [pdfDoc, setPdfDoc] = (0, import_react5.useState)(null);
20885
- (0, import_react5.useEffect)(() => {
20881
+ const [document2, setDocument] = (0, import_react9.useState)(null);
20882
+ const [loading, setLoading] = (0, import_react9.useState)(true);
20883
+ const [error, setError] = (0, import_react9.useState)(null);
20884
+ const [pdfDoc, setPdfDoc] = (0, import_react9.useState)(null);
20885
+ (0, import_react9.useEffect)(() => {
20886
20886
  if (!url) return;
20887
20887
  setLoading(true);
20888
20888
  setError(null);
@@ -20929,17 +20929,17 @@ function usePageState({
20929
20929
  totalPages,
20930
20930
  initialPage = 1
20931
20931
  }) {
20932
- const [currentPage, setCurrentPage] = (0, import_react6.useState)(
20932
+ const [currentPage, setCurrentPage] = (0, import_react10.useState)(
20933
20933
  Math.max(1, Math.min(initialPage, totalPages))
20934
20934
  );
20935
- const goToPage = (0, import_react6.useCallback)((page) => {
20935
+ const goToPage = (0, import_react10.useCallback)((page) => {
20936
20936
  const validPage = Math.max(1, Math.min(page, totalPages));
20937
20937
  setCurrentPage(validPage);
20938
20938
  }, [totalPages]);
20939
- const nextPage = (0, import_react6.useCallback)(() => {
20939
+ const nextPage = (0, import_react10.useCallback)(() => {
20940
20940
  goToPage(currentPage + 1);
20941
20941
  }, [currentPage, goToPage]);
20942
- const prevPage = (0, import_react6.useCallback)(() => {
20942
+ const prevPage = (0, import_react10.useCallback)(() => {
20943
20943
  goToPage(currentPage - 1);
20944
20944
  }, [currentPage, goToPage]);
20945
20945
  return {
@@ -20952,10 +20952,10 @@ function usePageState({
20952
20952
  };
20953
20953
  }
20954
20954
  function usePageRenderer(pdfDoc) {
20955
- const cacheRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
20956
- const [rendering, setRendering] = (0, import_react7.useState)(false);
20957
- const [pageInfo, setPageInfo] = (0, import_react7.useState)(null);
20958
- const renderPage = (0, import_react7.useCallback)(
20955
+ const cacheRef = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
20956
+ const [rendering, setRendering] = (0, import_react11.useState)(false);
20957
+ const [pageInfo, setPageInfo] = (0, import_react11.useState)(null);
20958
+ const renderPage = (0, import_react11.useCallback)(
20959
20959
  async (pageNumber, scale = DEFAULT_SCALE, rotation = 0) => {
20960
20960
  if (!pdfDoc) return null;
20961
20961
  try {
@@ -21014,21 +21014,21 @@ function usePageRenderer(pdfDoc) {
21014
21014
  return { renderPage, rendering, pageInfo };
21015
21015
  }
21016
21016
  function useZoom(initialZoom = 1.5) {
21017
- const [zoomLevel, setZoomLevel] = (0, import_react8.useState)(
21017
+ const [zoomLevel, setZoomLevel] = (0, import_react12.useState)(
21018
21018
  typeof initialZoom === "number" ? initialZoom : 1.5
21019
21019
  );
21020
- const [zoomMode, setZoomMode] = (0, import_react8.useState)(
21020
+ const [zoomMode, setZoomMode] = (0, import_react12.useState)(
21021
21021
  typeof initialZoom === "string" ? initialZoom : "custom"
21022
21022
  );
21023
- const zoomIn = (0, import_react8.useCallback)(() => {
21023
+ const zoomIn = (0, import_react12.useCallback)(() => {
21024
21024
  setZoomLevel((prev) => Math.min(MAX_ZOOM, prev + ZOOM_STEP));
21025
21025
  setZoomMode("custom");
21026
21026
  }, []);
21027
- const zoomOut = (0, import_react8.useCallback)(() => {
21027
+ const zoomOut = (0, import_react12.useCallback)(() => {
21028
21028
  setZoomLevel((prev) => Math.max(MIN_ZOOM, prev - ZOOM_STEP));
21029
21029
  setZoomMode("custom");
21030
21030
  }, []);
21031
- const setZoom = (0, import_react8.useCallback)((level) => {
21031
+ const setZoom = (0, import_react12.useCallback)((level) => {
21032
21032
  if (typeof level === "number") {
21033
21033
  setZoomLevel(Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, level)));
21034
21034
  setZoomMode("custom");
@@ -21047,11 +21047,11 @@ function useZoom(initialZoom = 1.5) {
21047
21047
  };
21048
21048
  }
21049
21049
  function useSearch(pdfDoc) {
21050
- const [query, setQuery] = (0, import_react9.useState)("");
21051
- const [results, setResults] = (0, import_react9.useState)([]);
21052
- const [searching, setSearching] = (0, import_react9.useState)(false);
21053
- const [currentResultIndex, setCurrentResultIndex] = (0, import_react9.useState)(0);
21054
- const search = (0, import_react9.useCallback)(
21050
+ const [query, setQuery] = (0, import_react13.useState)("");
21051
+ const [results, setResults] = (0, import_react13.useState)([]);
21052
+ const [searching, setSearching] = (0, import_react13.useState)(false);
21053
+ const [currentResultIndex, setCurrentResultIndex] = (0, import_react13.useState)(0);
21054
+ const search = (0, import_react13.useCallback)(
21055
21055
  async (searchText) => {
21056
21056
  if (!pdfDoc || !searchText.trim()) {
21057
21057
  setResults([]);
@@ -21088,10 +21088,10 @@ function useSearch(pdfDoc) {
21088
21088
  },
21089
21089
  [pdfDoc]
21090
21090
  );
21091
- const nextResult = (0, import_react9.useCallback)(() => {
21091
+ const nextResult = (0, import_react13.useCallback)(() => {
21092
21092
  setCurrentResultIndex((prev) => (prev + 1) % results.length);
21093
21093
  }, [results.length]);
21094
- const prevResult = (0, import_react9.useCallback)(() => {
21094
+ const prevResult = (0, import_react13.useCallback)(() => {
21095
21095
  setCurrentResultIndex((prev) => (prev - 1 + results.length) % results.length);
21096
21096
  }, [results.length]);
21097
21097
  return {
@@ -21110,9 +21110,9 @@ function PDFCanvas({
21110
21110
  scale,
21111
21111
  onRender
21112
21112
  }) {
21113
- const containerRef = (0, import_react10.useRef)(null);
21114
- const [canvas, setCanvas] = (0, import_react10.useState)(null);
21115
- (0, import_react10.useEffect)(() => {
21113
+ const containerRef = (0, import_react14.useRef)(null);
21114
+ const [canvas, setCanvas] = (0, import_react14.useState)(null);
21115
+ (0, import_react14.useEffect)(() => {
21116
21116
  const render = async () => {
21117
21117
  const renderedCanvas = await onRender(pageNumber, scale, 0);
21118
21118
  if (renderedCanvas && containerRef.current) {
@@ -21127,7 +21127,7 @@ function PDFCanvas({
21127
21127
  render();
21128
21128
  }
21129
21129
  }, [pdfDoc, pageNumber, scale, onRender]);
21130
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: containerRef, className: PDFViewer_default.canvas });
21130
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: containerRef, className: PDFViewer_default.canvas });
21131
21131
  }
21132
21132
  function PDFControls({
21133
21133
  pageState,
@@ -21140,8 +21140,8 @@ function PDFControls({
21140
21140
  url
21141
21141
  }) {
21142
21142
  if (!pdfDocument) return null;
21143
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: PDFViewer_default.controls, children: [
21144
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21143
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: PDFViewer_default.controls, children: [
21144
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21145
21145
  "button",
21146
21146
  {
21147
21147
  onClick: pageState.prevPage,
@@ -21150,7 +21150,7 @@ function PDFControls({
21150
21150
  children: "<"
21151
21151
  }
21152
21152
  ),
21153
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21153
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21154
21154
  "input",
21155
21155
  {
21156
21156
  type: "number",
@@ -21161,11 +21161,11 @@ function PDFControls({
21161
21161
  className: PDFViewer_default.pageInput
21162
21162
  }
21163
21163
  ),
21164
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.pageTotal, children: [
21164
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: PDFViewer_default.pageTotal, children: [
21165
21165
  "of ",
21166
21166
  pdfDocument.numPages
21167
21167
  ] }),
21168
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21168
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21169
21169
  "button",
21170
21170
  {
21171
21171
  onClick: pageState.nextPage,
@@ -21174,7 +21174,7 @@ function PDFControls({
21174
21174
  children: ">"
21175
21175
  }
21176
21176
  ),
21177
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21177
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21178
21178
  "button",
21179
21179
  {
21180
21180
  onClick: zoom.zoomOut,
@@ -21183,11 +21183,11 @@ function PDFControls({
21183
21183
  children: "-"
21184
21184
  }
21185
21185
  ),
21186
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.zoomLevel, children: [
21186
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: PDFViewer_default.zoomLevel, children: [
21187
21187
  Math.round(zoom.zoomLevel * 100),
21188
21188
  "%"
21189
21189
  ] }),
21190
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21190
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21191
21191
  "button",
21192
21192
  {
21193
21193
  onClick: zoom.zoomIn,
@@ -21196,7 +21196,7 @@ function PDFControls({
21196
21196
  children: "+"
21197
21197
  }
21198
21198
  ),
21199
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21199
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21200
21200
  "input",
21201
21201
  {
21202
21202
  type: "text",
@@ -21206,13 +21206,13 @@ function PDFControls({
21206
21206
  className: PDFViewer_default.searchInput
21207
21207
  }
21208
21208
  ),
21209
- search.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.searchResults, children: [
21209
+ search.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: PDFViewer_default.searchResults, children: [
21210
21210
  search.results.length,
21211
21211
  " results"
21212
21212
  ] }),
21213
- enableDownload && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: url, download: true, className: PDFViewer_default.button, title: "Download", children: "Download" }),
21214
- enablePrint && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => window.print(), title: "Print", children: "Print" }),
21215
- enableFullscreen && typeof document !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21213
+ enableDownload && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: url, download: true, className: PDFViewer_default.button, title: "Download", children: "Download" }),
21214
+ enablePrint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: () => window.print(), title: "Print", children: "Print" }),
21215
+ enableFullscreen && typeof document !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21216
21216
  "button",
21217
21217
  {
21218
21218
  onClick: () => {
@@ -21234,8 +21234,8 @@ function PDFThumbnails({
21234
21234
  onSelectPage,
21235
21235
  numPages
21236
21236
  }) {
21237
- const [thumbnails, setThumbnails] = (0, import_react11.useState)([]);
21238
- (0, import_react11.useEffect)(() => {
21237
+ const [thumbnails, setThumbnails] = (0, import_react15.useState)([]);
21238
+ (0, import_react15.useEffect)(() => {
21239
21239
  const generateThumbnails = async () => {
21240
21240
  if (!pdfDoc) return;
21241
21241
  const thumbs = [];
@@ -21264,13 +21264,13 @@ function PDFThumbnails({
21264
21264
  };
21265
21265
  generateThumbnails();
21266
21266
  }, [pdfDoc, numPages]);
21267
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: PDFViewer_default.thumbnails, children: thumbnails.map((thumb, idx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
21267
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: PDFViewer_default.thumbnails, children: thumbnails.map((thumb, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
21268
21268
  "div",
21269
21269
  {
21270
21270
  className: `${PDFViewer_default.thumbnail} ${idx + 1 === currentPage ? PDFViewer_default.active : ""}`,
21271
21271
  onClick: () => onSelectPage(idx + 1),
21272
21272
  children: [
21273
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21273
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21274
21274
  "canvas",
21275
21275
  {
21276
21276
  width: thumb.width,
@@ -21285,7 +21285,7 @@ function PDFThumbnails({
21285
21285
  }
21286
21286
  }
21287
21287
  ),
21288
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: PDFViewer_default.pageNumber, children: idx + 1 })
21288
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: PDFViewer_default.pageNumber, children: idx + 1 })
21289
21289
  ]
21290
21290
  },
21291
21291
  idx
@@ -21322,35 +21322,35 @@ function PDFViewer({
21322
21322
  const { renderPage, pageInfo } = usePageRenderer(pdfDoc);
21323
21323
  const zoom = useZoom(initialZoom);
21324
21324
  const search = useSearch(pdfDoc);
21325
- (0, import_react4.useEffect)(() => {
21325
+ (0, import_react8.useEffect)(() => {
21326
21326
  if (document2) {
21327
21327
  onDocumentLoad?.(document2);
21328
21328
  }
21329
21329
  }, [document2, onDocumentLoad]);
21330
- (0, import_react4.useEffect)(() => {
21330
+ (0, import_react8.useEffect)(() => {
21331
21331
  onPageChange?.(pageState.currentPage);
21332
21332
  }, [pageState.currentPage, onPageChange]);
21333
- (0, import_react4.useEffect)(() => {
21333
+ (0, import_react8.useEffect)(() => {
21334
21334
  if (search.results.length > 0) {
21335
21335
  onSearchResults?.(search.results);
21336
21336
  }
21337
21337
  }, [search.results, onSearchResults]);
21338
21338
  if (error) {
21339
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: PDFViewer_default.error, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { children: [
21339
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: PDFViewer_default.error, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { children: [
21340
21340
  "Failed to load PDF: ",
21341
21341
  error.message
21342
21342
  ] }) });
21343
21343
  }
21344
21344
  if (loading) {
21345
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: PDFViewer_default.loading, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "Loading PDF..." }) });
21345
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: PDFViewer_default.loading, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: "Loading PDF..." }) });
21346
21346
  }
21347
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
21347
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
21348
21348
  "div",
21349
21349
  {
21350
21350
  className: `${PDFViewer_default.viewer} ${className || ""}`,
21351
21351
  style: { height, width, ...style },
21352
21352
  children: [
21353
- showControls && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21353
+ showControls && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
21354
21354
  PDFControls,
21355
21355
  {
21356
21356
  pageState,
@@ -21363,8 +21363,8 @@ function PDFViewer({
21363
21363
  url
21364
21364
  }
21365
21365
  ),
21366
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: PDFViewer_default.content, children: [
21367
- showThumbnails && document2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21366
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: PDFViewer_default.content, children: [
21367
+ showThumbnails && document2 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
21368
21368
  PDFThumbnails,
21369
21369
  {
21370
21370
  pdfDoc,
@@ -21373,7 +21373,7 @@ function PDFViewer({
21373
21373
  numPages: document2.numPages
21374
21374
  }
21375
21375
  ),
21376
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21376
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
21377
21377
  PDFCanvas,
21378
21378
  {
21379
21379
  pdfDoc,
@@ -21451,22 +21451,22 @@ function createProgressiveFetchHandler(onProgress) {
21451
21451
  return response.arrayBuffer();
21452
21452
  };
21453
21453
  }
21454
- var import_react4, import_react5, pdfjsLib, import_react6, import_react7, import_react8, import_react9, import_react10, import_jsx_runtime4, import_jsx_runtime5, import_react11, import_jsx_runtime6, import_jsx_runtime7, DEFAULT_SCALE, CACHE_SIZE, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, PDFViewer_default, linearizedPDFConfig;
21454
+ var import_react8, import_react9, pdfjsLib, 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, PDFViewer_default, linearizedPDFConfig;
21455
21455
  var init_dist = __esm({
21456
21456
  "node_modules/.pnpm/@page-speed+pdf-viewer@0.0.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/pdf-viewer/dist/index.js"() {
21457
- import_react4 = __toESM(require_react());
21458
- import_react5 = __toESM(require_react());
21459
- pdfjsLib = __toESM(require_pdf());
21460
- import_react6 = __toESM(require_react());
21461
- import_react7 = __toESM(require_react());
21462
21457
  import_react8 = __toESM(require_react());
21463
21458
  import_react9 = __toESM(require_react());
21459
+ pdfjsLib = __toESM(require_pdf());
21464
21460
  import_react10 = __toESM(require_react());
21465
- import_jsx_runtime4 = __toESM(require_jsx_runtime());
21466
- import_jsx_runtime5 = __toESM(require_jsx_runtime());
21467
21461
  import_react11 = __toESM(require_react());
21462
+ import_react12 = __toESM(require_react());
21463
+ import_react13 = __toESM(require_react());
21464
+ import_react14 = __toESM(require_react());
21465
+ import_jsx_runtime5 = __toESM(require_jsx_runtime());
21468
21466
  import_jsx_runtime6 = __toESM(require_jsx_runtime());
21467
+ import_react15 = __toESM(require_react());
21469
21468
  import_jsx_runtime7 = __toESM(require_jsx_runtime());
21469
+ import_jsx_runtime8 = __toESM(require_jsx_runtime());
21470
21470
  if (typeof window !== "undefined") {
21471
21471
  pdfjsLib.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjsLib.version}/pdf.worker.min.js`;
21472
21472
  }
@@ -21523,7 +21523,7 @@ __export(index_exports, {
21523
21523
  module.exports = __toCommonJS(index_exports);
21524
21524
 
21525
21525
  // src/components/Lightbox.tsx
21526
- var import_react13 = __toESM(require_react());
21526
+ var import_react17 = __toESM(require_react());
21527
21527
 
21528
21528
  // src/hooks/useGalleryState.ts
21529
21529
  var import_react = __toESM(require_react());
@@ -21645,27 +21645,679 @@ function LightboxOverlay({
21645
21645
  );
21646
21646
  }
21647
21647
 
21648
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/Img.js
21649
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
21650
+ var import_react7 = __toESM(require_react(), 1);
21651
+
21652
+ // node_modules/.pnpm/@page-speed+hooks@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/hooks/dist/chunk-JSF23IF7.js
21653
+ var import_react4 = __toESM(require_react(), 1);
21654
+ var BASE_URL = "https://octane.cdn.ing/api/v1/images/transform?";
21655
+ var DPR_MULTIPLIERS = [1, 2];
21656
+ function useOptimizedImage(options) {
21657
+ const {
21658
+ src,
21659
+ eager = false,
21660
+ threshold = 0.1,
21661
+ rootMargin = "50px",
21662
+ width,
21663
+ height,
21664
+ optixFlowConfig
21665
+ } = options;
21666
+ const optixFlowApiKey = (0, import_react4.useMemo)(() => {
21667
+ return optixFlowConfig?.apiKey;
21668
+ }, [optixFlowConfig?.apiKey]);
21669
+ const useOptixFlow = (0, import_react4.useMemo)(() => {
21670
+ return optixFlowApiKey ? true : false;
21671
+ }, [optixFlowApiKey]);
21672
+ const [state, setState] = (0, import_react4.useState)({
21673
+ isLoaded: false,
21674
+ isInView: false
21675
+ });
21676
+ const [size, setSize] = (0, import_react4.useState)({
21677
+ width: width ?? 0,
21678
+ height: height ?? 0
21679
+ });
21680
+ const imgRef = (0, import_react4.useRef)(null);
21681
+ const observerRef = (0, import_react4.useRef)(null);
21682
+ (0, import_react4.useEffect)(() => {
21683
+ if (width !== void 0 || height !== void 0) {
21684
+ setSize((prev) => ({
21685
+ width: width ?? prev.width,
21686
+ height: height ?? prev.height
21687
+ }));
21688
+ }
21689
+ }, [width, height]);
21690
+ (0, import_react4.useEffect)(() => {
21691
+ if (!imgRef.current) return;
21692
+ const calculateRenderedSize = () => {
21693
+ const img2 = imgRef.current;
21694
+ if (!img2) return;
21695
+ const renderedWidth = width ?? (Math.round(img2.clientWidth) || img2.naturalWidth || 0);
21696
+ const renderedHeight = height ?? (Math.round(img2.clientHeight) || img2.naturalHeight || 0);
21697
+ if (renderedWidth > 0 || renderedHeight > 0) {
21698
+ setSize((prev) => {
21699
+ if (prev.width !== renderedWidth || prev.height !== renderedHeight) {
21700
+ return { width: renderedWidth, height: renderedHeight };
21701
+ }
21702
+ return prev;
21703
+ });
21704
+ }
21705
+ };
21706
+ if (imgRef.current.clientWidth > 0) {
21707
+ calculateRenderedSize();
21708
+ }
21709
+ const img = imgRef.current;
21710
+ img.addEventListener("load", calculateRenderedSize);
21711
+ let resizeObserver = null;
21712
+ if (typeof ResizeObserver !== "undefined") {
21713
+ resizeObserver = new ResizeObserver(() => {
21714
+ calculateRenderedSize();
21715
+ });
21716
+ resizeObserver.observe(img);
21717
+ }
21718
+ return () => {
21719
+ img.removeEventListener("load", calculateRenderedSize);
21720
+ resizeObserver?.disconnect();
21721
+ };
21722
+ }, [width, height, state.isLoaded]);
21723
+ const buildOptixFlowUrl = (0, import_react4.useCallback)(
21724
+ (imgWidth, imgHeight, format) => {
21725
+ if (!useOptixFlow) return src;
21726
+ if (!imgWidth || !imgHeight) return src;
21727
+ const params = new URLSearchParams();
21728
+ params.set("url", src);
21729
+ params.set("w", String(imgWidth));
21730
+ params.set("h", String(imgHeight));
21731
+ params.set("q", String(optixFlowConfig?.compressionLevel ?? 75));
21732
+ params.set("f", format);
21733
+ params.set("apiKey", optixFlowApiKey);
21734
+ return `${BASE_URL}${params.toString()}`;
21735
+ },
21736
+ [useOptixFlow, src, optixFlowConfig?.compressionLevel, optixFlowApiKey]
21737
+ );
21738
+ const generateSrcset = (0, import_react4.useCallback)(
21739
+ (baseWidth, baseHeight, format) => {
21740
+ if (!useOptixFlow || baseWidth === 0 || baseHeight === 0) return "";
21741
+ return DPR_MULTIPLIERS.map((dpr) => {
21742
+ const scaledWidth = Math.round(baseWidth * dpr);
21743
+ const scaledHeight = Math.round(baseHeight * dpr);
21744
+ const url = buildOptixFlowUrl(scaledWidth, scaledHeight, format);
21745
+ return `${url} ${dpr}x`;
21746
+ }).join(", ");
21747
+ },
21748
+ [useOptixFlow, buildOptixFlowUrl]
21749
+ );
21750
+ const primarySrc = (0, import_react4.useMemo)(() => {
21751
+ const hasDimensions = size.width > 0 && size.height > 0;
21752
+ if (!useOptixFlow || !hasDimensions) return src;
21753
+ const fallbackFormat = optixFlowConfig?.renderedFileType ?? "jpeg";
21754
+ return buildOptixFlowUrl(size.width, size.height, fallbackFormat);
21755
+ }, [useOptixFlow, src, size.width, size.height, optixFlowConfig?.renderedFileType, buildOptixFlowUrl]);
21756
+ const srcset = (0, import_react4.useMemo)(() => {
21757
+ return {
21758
+ avif: generateSrcset(size.width, size.height, "avif"),
21759
+ webp: generateSrcset(size.width, size.height, "webp"),
21760
+ jpeg: generateSrcset(size.width, size.height, "jpeg")
21761
+ };
21762
+ }, [size.width, size.height, generateSrcset]);
21763
+ const sizes = (0, import_react4.useMemo)(() => {
21764
+ if (size.width === 0) return "";
21765
+ return `${size.width}px`;
21766
+ }, [size.width]);
21767
+ (0, import_react4.useEffect)(() => {
21768
+ if (typeof window === "undefined" || !imgRef.current) {
21769
+ return;
21770
+ }
21771
+ if (eager) {
21772
+ setState({ isLoaded: false, isInView: true });
21773
+ return;
21774
+ }
21775
+ observerRef.current = new IntersectionObserver(
21776
+ ([entry]) => {
21777
+ if (entry.isIntersecting) {
21778
+ setState((prev) => ({ ...prev, isInView: true }));
21779
+ observerRef.current?.disconnect();
21780
+ }
21781
+ },
21782
+ { threshold, rootMargin }
21783
+ );
21784
+ observerRef.current.observe(imgRef.current);
21785
+ return () => {
21786
+ observerRef.current?.disconnect();
21787
+ };
21788
+ }, [eager, threshold, rootMargin]);
21789
+ (0, import_react4.useEffect)(() => {
21790
+ if (!imgRef.current) return;
21791
+ const handleLoad = () => {
21792
+ setState((prev) => ({ ...prev, isLoaded: true }));
21793
+ };
21794
+ const img = imgRef.current;
21795
+ if (img.complete) {
21796
+ handleLoad();
21797
+ } else {
21798
+ img.addEventListener("load", handleLoad);
21799
+ return () => img.removeEventListener("load", handleLoad);
21800
+ }
21801
+ }, [state.isInView]);
21802
+ const ref = (0, import_react4.useCallback)((node) => {
21803
+ imgRef.current = node;
21804
+ }, []);
21805
+ const emptySrcset = { avif: "", webp: "", jpeg: "" };
21806
+ return {
21807
+ ref,
21808
+ // Primary src uses exact rendered dimensions for Lighthouse "Properly size images" compliance
21809
+ src: state.isInView || eager ? primarySrc : src,
21810
+ // Srcset with format variants and DPR multipliers for <picture> element
21811
+ srcset: state.isInView || eager ? srcset : emptySrcset,
21812
+ // Sizes attribute for responsive image selection
21813
+ sizes: state.isInView || eager ? sizes : "",
21814
+ isLoaded: state.isLoaded,
21815
+ isInView: state.isInView,
21816
+ loading: eager ? "eager" : "lazy",
21817
+ size
21818
+ };
21819
+ }
21820
+
21821
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/utils/cache.js
21822
+ var l2Cache = /* @__PURE__ */ new Map();
21823
+ function cacheGet(key) {
21824
+ return l2Cache.get(key);
21825
+ }
21826
+ function cacheSet(key, value) {
21827
+ l2Cache.set(key, value);
21828
+ }
21829
+
21830
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/utils/api.js
21831
+ var DEFAULT_CDN_HOST = "https://cdn.ing";
21832
+ function normalizeHost(cdnHost) {
21833
+ return (cdnHost ?? DEFAULT_CDN_HOST).replace(/\/$/, "");
21834
+ }
21835
+ function buildPrimaryImageUrl(mediaId, cdnHost) {
21836
+ const host = normalizeHost(cdnHost);
21837
+ return `${host}/assets/images/${mediaId}`;
21838
+ }
21839
+ function buildLegacyImageUrl(mediaId, cdnHost) {
21840
+ const host = normalizeHost(cdnHost);
21841
+ return `${host}/i/r/${mediaId}`;
21842
+ }
21843
+ function buildPlaceholderImageUrl(mediaId, cdnHost) {
21844
+ const host = normalizeHost(cdnHost);
21845
+ return `${host}/assets/low_res_thumb/${mediaId}`;
21846
+ }
21847
+ function hasRenderableUrlVariant(variant) {
21848
+ if (!variant)
21849
+ return false;
21850
+ const candidates = [variant.sm, variant.md, variant.lg, variant.full];
21851
+ return candidates.some((value) => typeof value === "string" && value.trim().length > 0);
21852
+ }
21853
+ function imageVariantsHaveRenderableSource(variants) {
21854
+ if (!variants)
21855
+ return false;
21856
+ return ["AVIF", "WEBP", "JPEG"].some((format) => {
21857
+ const entry = variants?.[format];
21858
+ return hasRenderableUrlVariant(entry);
21859
+ });
21860
+ }
21861
+ function hasUrlValue(value) {
21862
+ return typeof value === "string" && value.trim().length > 0;
21863
+ }
21864
+ function imageDataHasRenderableSource(data) {
21865
+ if (!data)
21866
+ return false;
21867
+ if (imageVariantsHaveRenderableSource(data.variants_data?.variants ?? null)) {
21868
+ return true;
21869
+ }
21870
+ const raw = data;
21871
+ const directFields = [
21872
+ raw.img_url,
21873
+ raw.file_data_url,
21874
+ raw.file_data_thumbnail_url,
21875
+ raw.img_src,
21876
+ raw.med_src,
21877
+ raw.thumb_src,
21878
+ raw.low_res_thumb
21879
+ ];
21880
+ return directFields.some(hasUrlValue);
21881
+ }
21882
+ async function fetchFrom(url, signal) {
21883
+ const res = await fetch(url, { signal });
21884
+ if (!res.ok) {
21885
+ const error = new Error(`Failed to fetch image data (status ${res.status}) from ${url}`);
21886
+ error.status = res.status;
21887
+ throw error;
21888
+ }
21889
+ return await res.json();
21890
+ }
21891
+ async function fetchImageData(mediaId, options = {}) {
21892
+ if (!Number.isFinite(mediaId)) {
21893
+ throw new Error("Invalid mediaId provided to fetchImageData");
21894
+ }
21895
+ const host = normalizeHost(options.cdnHost);
21896
+ const cacheKey = `image:${host}:${mediaId}`;
21897
+ if (!options.bypassCache) {
21898
+ const cached = cacheGet(cacheKey);
21899
+ if (cached)
21900
+ return cached;
21901
+ }
21902
+ const urls = [buildPrimaryImageUrl(mediaId, host), buildLegacyImageUrl(mediaId, host)];
21903
+ let lastError;
21904
+ for (const url of urls) {
21905
+ try {
21906
+ const data = await fetchFrom(url, options.signal);
21907
+ if (imageDataHasRenderableSource(data)) {
21908
+ cacheSet(cacheKey, data);
21909
+ }
21910
+ return data;
21911
+ } catch (err) {
21912
+ if (err?.name === "AbortError") {
21913
+ throw err;
21914
+ }
21915
+ lastError = err;
21916
+ }
21917
+ }
21918
+ if (lastError instanceof Error) {
21919
+ throw lastError;
21920
+ }
21921
+ throw new Error(`Failed to fetch image data for mediaId ${mediaId}`);
21922
+ }
21923
+
21924
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/useMediaSelectionEffect.js
21925
+ var import_react5 = __toESM(require_react(), 1);
21926
+ var MEDIA_SELECTED_EVENT = "dt:media-selected";
21927
+ function useMediaSelectionEffect() {
21928
+ (0, import_react5.useEffect)(() => {
21929
+ if (typeof window === "undefined")
21930
+ return;
21931
+ const handler = () => {
21932
+ };
21933
+ window.addEventListener(MEDIA_SELECTED_EVENT, handler);
21934
+ return () => window.removeEventListener(MEDIA_SELECTED_EVENT, handler);
21935
+ }, []);
21936
+ }
21937
+
21938
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/useResponsiveReset.js
21939
+ var import_react6 = __toESM(require_react(), 1);
21940
+ function resetResponsivePictureState(element) {
21941
+ if (!element)
21942
+ return;
21943
+ element.querySelectorAll("source").forEach((source) => {
21944
+ const srcset = source.getAttribute("srcset");
21945
+ if (srcset) {
21946
+ source.setAttribute("data-srcset", srcset);
21947
+ source.removeAttribute("srcset");
21948
+ requestAnimationFrame(() => {
21949
+ source.setAttribute("srcset", srcset);
21950
+ });
21951
+ }
21952
+ });
21953
+ }
21954
+ function useResponsiveReset(ref) {
21955
+ (0, import_react6.useEffect)(() => {
21956
+ const element = ref.current;
21957
+ if (!element)
21958
+ return;
21959
+ if (element instanceof HTMLPictureElement) {
21960
+ resetResponsivePictureState(element);
21961
+ } else if (element.parentElement instanceof HTMLPictureElement) {
21962
+ resetResponsivePictureState(element.parentElement);
21963
+ }
21964
+ }, [ref]);
21965
+ }
21966
+
21967
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/Img.js
21968
+ var DEFAULT_WIDTHS = {
21969
+ sm: 640,
21970
+ md: 1024,
21971
+ lg: 1536,
21972
+ full: 2560
21973
+ };
21974
+ var MAX_VARIANT_REFRESH_ATTEMPTS = 5;
21975
+ var VARIANT_REFRESH_DELAY_MS = 3e3;
21976
+ var TRANSPARENT_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
21977
+ var defaultOptixFlowConfig;
21978
+ var deprecatedMediaWarnings = /* @__PURE__ */ new Set();
21979
+ var readGlobalOptixFlowConfig = () => {
21980
+ if (typeof globalThis === "undefined")
21981
+ return void 0;
21982
+ const globalAny = globalThis;
21983
+ return globalAny.PageSpeedImgDefaults?.optixFlowConfig || globalAny.OpensiteImgDefaults?.optixFlowConfig || globalAny.PAGE_SPEED_IMG_DEFAULTS?.optixFlowConfig;
21984
+ };
21985
+ var resolveOptixFlowConfig = (config) => {
21986
+ return config ?? defaultOptixFlowConfig ?? readGlobalOptixFlowConfig();
21987
+ };
21988
+ var warnDeprecatedMediaId = (mediaId) => {
21989
+ if (!Number.isFinite(mediaId) || mediaId == null)
21990
+ return;
21991
+ const id = mediaId;
21992
+ if (deprecatedMediaWarnings.has(id))
21993
+ return;
21994
+ deprecatedMediaWarnings.add(id);
21995
+ if (typeof console !== "undefined" && console.warn) {
21996
+ console.warn("[DEPRECATED] <Img mediaId> is deprecated. Provide src + optixFlowConfig instead.", { mediaId: id });
21997
+ }
21998
+ };
21999
+ var isUrlString = (value) => typeof value === "string" && value.trim().length > 0;
22000
+ var parseDimension = (value) => {
22001
+ if (value === "" || value === null || typeof value === "undefined")
22002
+ return void 0;
22003
+ if (typeof value === "number" && Number.isFinite(value))
22004
+ return value;
22005
+ if (typeof value === "string") {
22006
+ const numeric = Number(value);
22007
+ if (Number.isFinite(numeric))
22008
+ return numeric;
22009
+ }
22010
+ return void 0;
22011
+ };
22012
+ var composeRefs = (hookRef, forwardedRef, localRef) => (0, import_react7.useCallback)((node) => {
22013
+ hookRef(node);
22014
+ localRef.current = node;
22015
+ if (typeof forwardedRef === "function") {
22016
+ forwardedRef(node);
22017
+ } else if (forwardedRef && typeof forwardedRef === "object") {
22018
+ forwardedRef.current = node;
22019
+ }
22020
+ }, [hookRef, forwardedRef, localRef]);
22021
+ function widthMapFromMetadata(v) {
22022
+ const w = v?.widths;
22023
+ if (!w)
22024
+ return null;
22025
+ return {
22026
+ sm: w.small ?? w.sm ?? DEFAULT_WIDTHS.sm,
22027
+ md: w.medium ?? w.md ?? DEFAULT_WIDTHS.md,
22028
+ lg: w.large ?? w.lg ?? DEFAULT_WIDTHS.lg,
22029
+ full: w.full_size ?? w.full ?? DEFAULT_WIDTHS.full
22030
+ };
22031
+ }
22032
+ function pickBest(sizes) {
22033
+ if (!sizes)
22034
+ return void 0;
22035
+ return sizes.md || sizes.lg || sizes.sm || sizes.full || Object.values(sizes).find(Boolean);
22036
+ }
22037
+ var DEFAULT_SIZES = "(max-width:640px) 640px, (max-width:1024px) 1024px, 1536px";
22038
+ var ModernImg = ({ sizes, loading, decoding, alt, title, src: directSrc, eager, intersectionMargin, intersectionThreshold, optixFlowConfig, forwardedRef, ...rest }) => {
22039
+ const imgRef = (0, import_react7.useRef)(null);
22040
+ const pictureRef = (0, import_react7.useRef)(null);
22041
+ useResponsiveReset(pictureRef);
22042
+ useMediaSelectionEffect();
22043
+ const normalizedSrc = (0, import_react7.useMemo)(() => typeof directSrc === "string" ? directSrc.trim() : "", [directSrc]);
22044
+ const numericWidth = (0, import_react7.useMemo)(() => parseDimension(rest.width), [rest]);
22045
+ const numericHeight = (0, import_react7.useMemo)(() => parseDimension(rest.height), [rest]);
22046
+ const resolvedOptixConfig = (0, import_react7.useMemo)(() => resolveOptixFlowConfig(optixFlowConfig), [optixFlowConfig]);
22047
+ const eagerLoad = eager ?? loading === "eager";
22048
+ const { ref: hookRef, src, srcset, sizes: computedSizes, loading: hookLoading, size } = useOptimizedImage({
22049
+ src: normalizedSrc,
22050
+ eager: eagerLoad,
22051
+ width: numericWidth,
22052
+ height: numericHeight,
22053
+ rootMargin: intersectionMargin ?? "200px",
22054
+ threshold: intersectionThreshold ?? 0.1,
22055
+ optixFlowConfig: resolvedOptixConfig
22056
+ });
22057
+ const mergedRef = composeRefs(hookRef, forwardedRef, imgRef);
22058
+ const { width, height, ...restProps } = rest;
22059
+ const sizesAttr = sizes ?? (computedSizes || void 0);
22060
+ const loadingAttr = loading ?? hookLoading ?? "lazy";
22061
+ const decodingAttr = decoding ?? "async";
22062
+ const hasSrcSet = Boolean(srcset.avif || srcset.webp || srcset.jpeg);
22063
+ const imgSrc = src || normalizedSrc || TRANSPARENT_PIXEL;
22064
+ const inlineSrcSet = hasSrcSet && !srcset.avif && !srcset.webp ? srcset.jpeg : "";
22065
+ const parsedWidth = parseDimension(width);
22066
+ const parsedHeight = parseDimension(height);
22067
+ const widthAttr = parsedWidth ?? (size.width || numericWidth || void 0);
22068
+ const heightAttr = parsedHeight ?? (size.height || numericHeight || void 0);
22069
+ if (!hasSrcSet) {
22070
+ return (0, import_jsx_runtime2.jsx)("img", { ref: mergedRef, src: imgSrc, loading: loadingAttr, decoding: decodingAttr, alt, title, width: widthAttr, height: heightAttr, ...restProps });
22071
+ }
22072
+ return (0, import_jsx_runtime2.jsxs)("picture", { ref: pictureRef, children: [srcset.avif ? (0, import_jsx_runtime2.jsx)("source", { type: "image/avif", srcSet: srcset.avif, sizes: sizesAttr }) : null, srcset.webp ? (0, import_jsx_runtime2.jsx)("source", { type: "image/webp", srcSet: srcset.webp, sizes: sizesAttr }) : null, (0, import_jsx_runtime2.jsx)("img", { ref: mergedRef, src: imgSrc, srcSet: inlineSrcSet || void 0, sizes: inlineSrcSet ? sizesAttr : void 0, loading: loadingAttr, decoding: decodingAttr, alt, title, width: widthAttr, height: heightAttr, ...restProps })] });
22073
+ };
22074
+ var LegacyImg = ({ mediaId, cdnHost, sizes, onImageData, loading, decoding, alt, title, src: directSrc, forwardedRef, ...rest }) => {
22075
+ const imgRef = (0, import_react7.useRef)(null);
22076
+ const pictureRef = (0, import_react7.useRef)(null);
22077
+ (0, import_react7.useImperativeHandle)(forwardedRef, () => imgRef.current);
22078
+ useResponsiveReset(pictureRef);
22079
+ useMediaSelectionEffect();
22080
+ const [data, setData] = (0, import_react7.useState)(null);
22081
+ const [retryCount, setRetryCount] = (0, import_react7.useState)(0);
22082
+ const hasMediaId = Number.isFinite(mediaId);
22083
+ const loadingAttr = loading ?? "lazy";
22084
+ const decodingAttr = decoding ?? "async";
22085
+ const [isInView, setIsInView] = (0, import_react7.useState)(() => !hasMediaId || loadingAttr !== "lazy");
22086
+ const cdnOrigin = (0, import_react7.useMemo)(() => (cdnHost ?? DEFAULT_CDN_HOST).replace(/\/$/, ""), [cdnHost]);
22087
+ (0, import_react7.useEffect)(() => {
22088
+ if (!hasMediaId) {
22089
+ setData(null);
22090
+ setRetryCount(0);
22091
+ return;
22092
+ }
22093
+ setData(null);
22094
+ setRetryCount(0);
22095
+ }, [hasMediaId, mediaId, cdnHost]);
22096
+ (0, import_react7.useEffect)(() => {
22097
+ if (!hasMediaId) {
22098
+ return;
22099
+ }
22100
+ const controller = new AbortController();
22101
+ fetchImageData(mediaId, {
22102
+ cdnHost,
22103
+ signal: controller.signal,
22104
+ bypassCache: retryCount > 0
22105
+ }).then((d) => {
22106
+ setData(d);
22107
+ onImageData?.(d);
22108
+ }).catch((err) => {
22109
+ if (err?.name !== "AbortError") {
22110
+ console.warn("Image data fetch failed:", err);
22111
+ }
22112
+ });
22113
+ return () => controller.abort();
22114
+ }, [hasMediaId, mediaId, cdnHost, onImageData, retryCount]);
22115
+ (0, import_react7.useEffect)(() => {
22116
+ if (!hasMediaId || loadingAttr !== "lazy") {
22117
+ setIsInView(true);
22118
+ return;
22119
+ }
22120
+ setIsInView(false);
22121
+ }, [hasMediaId, mediaId, loadingAttr]);
22122
+ (0, import_react7.useEffect)(() => {
22123
+ if (!hasMediaId || loadingAttr !== "lazy" || isInView) {
22124
+ return;
22125
+ }
22126
+ if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
22127
+ setIsInView(true);
22128
+ return;
22129
+ }
22130
+ const node = imgRef.current;
22131
+ if (!node) {
22132
+ return;
22133
+ }
22134
+ const observer = new IntersectionObserver((entries) => {
22135
+ if (entries.some((entry) => entry.isIntersecting)) {
22136
+ setIsInView(true);
22137
+ observer.disconnect();
22138
+ }
22139
+ }, { rootMargin: "200px" });
22140
+ observer.observe(node);
22141
+ return () => observer.disconnect();
22142
+ }, [hasMediaId, loadingAttr, isInView]);
22143
+ const picture = (0, import_react7.useMemo)(() => {
22144
+ if (!data)
22145
+ return null;
22146
+ const v = data.variants_data?.variants ?? {};
22147
+ const webp2 = v.WEBP;
22148
+ const avif2 = v.AVIF;
22149
+ const jpeg2 = v.JPEG;
22150
+ const widths = widthMapFromMetadata(v.WEBP?.metadata) || widthMapFromMetadata(v.JPEG?.metadata) || { ...DEFAULT_WIDTHS };
22151
+ const ensureAbsolute = (url) => {
22152
+ if (!isUrlString(url))
22153
+ return void 0;
22154
+ if (/^https?:\/\//i.test(url) || url.startsWith("data:"))
22155
+ return url;
22156
+ if (url.startsWith("//"))
22157
+ return `https:${url}`;
22158
+ if (url.startsWith("/"))
22159
+ return `${cdnOrigin}${url}`;
22160
+ return `${cdnOrigin}/${url}`;
22161
+ };
22162
+ const normalizeCandidate = (candidate) => ensureAbsolute(typeof candidate === "string" ? candidate : void 0);
22163
+ const variantCandidates = [
22164
+ pickBest(webp2),
22165
+ pickBest(jpeg2),
22166
+ pickBest(avif2),
22167
+ webp2?.sm,
22168
+ webp2?.md,
22169
+ webp2?.lg,
22170
+ webp2?.full,
22171
+ jpeg2?.sm,
22172
+ jpeg2?.md,
22173
+ jpeg2?.lg,
22174
+ jpeg2?.full,
22175
+ avif2?.sm,
22176
+ avif2?.md,
22177
+ avif2?.lg,
22178
+ avif2?.full
22179
+ ].map((candidate) => normalizeCandidate(candidate ?? void 0)).filter(isUrlString);
22180
+ const raw = data;
22181
+ const directCandidates = [
22182
+ raw.img_url,
22183
+ raw.file_data_url,
22184
+ raw.file_data_thumbnail_url,
22185
+ raw.img_src,
22186
+ raw.med_src,
22187
+ raw.thumb_src,
22188
+ raw.low_res_thumb
22189
+ ].map((candidate) => isUrlString(candidate) ? normalizeCandidate(candidate) : void 0).filter(isUrlString);
22190
+ const fallbackCandidates = raw.fallback_url ? [normalizeCandidate(raw.fallback_url)].filter(isUrlString) : [];
22191
+ const fallback2 = [...variantCandidates, ...directCandidates, ...fallbackCandidates][0];
22192
+ if (!fallback2) {
22193
+ return null;
22194
+ }
22195
+ const toSrcSet2 = (sizes2) => {
22196
+ if (!sizes2)
22197
+ return void 0;
22198
+ const entries = [];
22199
+ const push = (url, width) => {
22200
+ const absolute = normalizeCandidate(url);
22201
+ if (absolute && width)
22202
+ entries.push(`${absolute} ${width}w`);
22203
+ };
22204
+ push(sizes2.sm, widths.sm);
22205
+ push(sizes2.md, widths.md);
22206
+ push(sizes2.lg, widths.lg);
22207
+ push(sizes2.full, widths.full);
22208
+ return entries.length ? entries.join(", ") : void 0;
22209
+ };
22210
+ return { webp: webp2, avif: avif2, jpeg: jpeg2, toSrcSet: toSrcSet2, fallback: fallback2, widths, hasVariantSource: variantCandidates.length > 0 };
22211
+ }, [data, cdnOrigin]);
22212
+ const hasVariantEntries = (0, import_react7.useMemo)(() => imageVariantsHaveRenderableSource(data?.variants_data?.variants ?? null), [data]);
22213
+ const variantsStatus = (0, import_react7.useMemo)(() => {
22214
+ const status = data?.variants_data?.status ?? data?.variants_status ?? "";
22215
+ return typeof status === "string" ? status.toLowerCase() : "";
22216
+ }, [data]);
22217
+ const variantsFailed = variantsStatus === "failed" || variantsStatus === "error";
22218
+ const shouldPollForVariants = hasMediaId && Boolean(data) && !variantsFailed && !hasVariantEntries && retryCount < MAX_VARIANT_REFRESH_ATTEMPTS;
22219
+ (0, import_react7.useEffect)(() => {
22220
+ if (!shouldPollForVariants) {
22221
+ return;
22222
+ }
22223
+ if (typeof window === "undefined") {
22224
+ return;
22225
+ }
22226
+ const timeoutId = window.setTimeout(() => {
22227
+ setRetryCount((count) => count + 1);
22228
+ }, VARIANT_REFRESH_DELAY_MS);
22229
+ return () => window.clearTimeout(timeoutId);
22230
+ }, [shouldPollForVariants]);
22231
+ const altAttr = (0, import_react7.useMemo)(() => {
22232
+ if (typeof alt === "string")
22233
+ return alt;
22234
+ return data?.meta?.content_manifest?.summary ?? void 0;
22235
+ }, [alt, data]);
22236
+ const titleAttr = (0, import_react7.useMemo)(() => {
22237
+ if (typeof title === "string")
22238
+ return title;
22239
+ return data?.meta?.content_manifest?.title ?? void 0;
22240
+ }, [title, data]);
22241
+ const widthAttr = (0, import_react7.useMemo)(() => data?.meta?.sizing?.width ?? data?.variants_data?.metadata?.width ?? void 0, [data]);
22242
+ const heightAttr = (0, import_react7.useMemo)(() => data?.meta?.sizing?.height ?? data?.variants_data?.metadata?.height ?? void 0, [data]);
22243
+ const dataFilename = (0, import_react7.useMemo)(() => {
22244
+ const base = data?.meta?.content_manifest?.optimized_filename;
22245
+ if (!base)
22246
+ return void 0;
22247
+ const href = picture?.fallback;
22248
+ if (!href)
22249
+ return void 0;
22250
+ const dot = href.lastIndexOf(".");
22251
+ const ext = dot > -1 ? href.slice(dot + 1).toLowerCase() : "jpg";
22252
+ return `${base}.${ext}`;
22253
+ }, [data, picture]);
22254
+ if (!hasMediaId) {
22255
+ const r = { ...rest };
22256
+ return (0, import_jsx_runtime2.jsx)("img", { ref: imgRef, src: directSrc, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: r.width, height: r.height, ...r });
22257
+ }
22258
+ const placeholderSrc = buildPlaceholderImageUrl(mediaId, cdnHost);
22259
+ if (!data || !picture || !isInView) {
22260
+ const r = { ...rest };
22261
+ return (0, import_jsx_runtime2.jsx)("img", { ref: imgRef, src: placeholderSrc, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: r.width ?? widthAttr, height: r.height ?? heightAttr, ...r });
22262
+ }
22263
+ const sizesAttr = sizes ?? DEFAULT_SIZES;
22264
+ const { webp, avif, jpeg, toSrcSet, fallback } = picture;
22265
+ const webpSet = toSrcSet(webp);
22266
+ const avifSet = toSrcSet(avif);
22267
+ const jpegSet = toSrcSet(jpeg);
22268
+ if (webpSet || avifSet || jpegSet) {
22269
+ return (0, import_jsx_runtime2.jsxs)("picture", { children: [avifSet ? (0, import_jsx_runtime2.jsx)("source", { type: "image/avif", srcSet: avifSet, sizes: sizesAttr }) : null, webpSet ? (0, import_jsx_runtime2.jsx)("source", { type: "image/webp", srcSet: webpSet, sizes: sizesAttr }) : null, (0, import_jsx_runtime2.jsx)("img", { ref: imgRef, src: fallback, srcSet: jpegSet && !webpSet && !avifSet ? jpegSet : void 0, sizes: jpegSet && !webpSet && !avifSet ? sizesAttr : void 0, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: widthAttr, height: heightAttr, "data-filename": dataFilename, ...rest })] });
22270
+ }
22271
+ return (0, import_jsx_runtime2.jsx)("img", { ref: imgRef, src: fallback, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: widthAttr, height: heightAttr, "data-filename": dataFilename, ...rest });
22272
+ };
22273
+ var ImgBase = (0, import_react7.forwardRef)(function Img(props, ref) {
22274
+ const hasMediaId = Number.isFinite(props.mediaId);
22275
+ if (hasMediaId) {
22276
+ warnDeprecatedMediaId(props.mediaId);
22277
+ return (0, import_jsx_runtime2.jsx)(LegacyImg, { ...props, forwardedRef: ref });
22278
+ }
22279
+ const hasSrc = typeof props.src === "string" && props.src.trim().length > 0;
22280
+ if (!hasSrc) {
22281
+ if (typeof console !== "undefined" && console.warn) {
22282
+ console.warn("<Img /> requires either src or mediaId. No src provided, rendering null.");
22283
+ }
22284
+ return null;
22285
+ }
22286
+ return (0, import_jsx_runtime2.jsx)(ModernImg, { ...props, forwardedRef: ref });
22287
+ });
22288
+ var Img2 = (0, import_react7.memo)(ImgBase);
22289
+ Img2.displayName = "PageSpeedImg";
22290
+
21648
22291
  // src/renderers/ImageRenderer.tsx
21649
- var import_jsx_runtime2 = __toESM(require_jsx_runtime());
21650
- function ImageRenderer({ item }) {
22292
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime());
22293
+ var toImgOptixFlowConfig = (config) => {
22294
+ if (!config) return void 0;
22295
+ const { compression, ...rest } = config;
22296
+ const base = rest;
22297
+ return {
22298
+ ...base,
22299
+ compressionLevel: typeof compression === "number" ? compression : base.compressionLevel
22300
+ };
22301
+ };
22302
+ function ImageRenderer({ item, optixFlowConfig }) {
21651
22303
  if (!item.src) return null;
21652
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
21653
- "img",
22304
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
22305
+ Img2,
21654
22306
  {
21655
22307
  className: Lightbox_default.media,
21656
22308
  src: item.src,
21657
- srcSet: item.srcSet,
21658
22309
  alt: item.alt || item.title || "",
21659
- loading: "lazy"
22310
+ loading: "lazy",
22311
+ optixFlowConfig: toImgOptixFlowConfig(optixFlowConfig)
21660
22312
  }
21661
22313
  );
21662
22314
  }
21663
22315
 
21664
22316
  // src/renderers/VideoRenderer.tsx
21665
- var import_jsx_runtime3 = __toESM(require_jsx_runtime());
22317
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime());
21666
22318
  function VideoRenderer({ item }) {
21667
22319
  if (!item.src) return null;
21668
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
22320
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21669
22321
  "video",
21670
22322
  {
21671
22323
  className: Lightbox_default.media,
@@ -21677,8 +22329,8 @@ function VideoRenderer({ item }) {
21677
22329
  }
21678
22330
 
21679
22331
  // src/renderers/PDFRenderer.tsx
21680
- var import_react12 = __toESM(require_react());
21681
- var import_jsx_runtime8 = __toESM(require_jsx_runtime());
22332
+ var import_react16 = __toESM(require_react());
22333
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime());
21682
22334
  function loadPDFViewer() {
21683
22335
  return Promise.resolve().then(() => (init_dist(), dist_exports)).then((mod) => ({
21684
22336
  // The PDF viewer package exposes a named PDFViewer export.
@@ -21686,47 +22338,54 @@ function loadPDFViewer() {
21686
22338
  default: mod.PDFViewer
21687
22339
  }));
21688
22340
  }
21689
- var LazyPDFViewer = import_react12.default.lazy(loadPDFViewer);
22341
+ var LazyPDFViewer = import_react16.default.lazy(loadPDFViewer);
21690
22342
  var AnyPDFViewer = LazyPDFViewer;
21691
22343
  function PDFRenderer({ item }) {
21692
22344
  if (!item.src) return null;
21693
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: Lightbox_default.pdfContainer, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
21694
- import_react12.Suspense,
22345
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: Lightbox_default.pdfContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
22346
+ import_react16.Suspense,
21695
22347
  {
21696
- fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: Lightbox_default.pdfFallback, children: "Loading document..." }),
21697
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AnyPDFViewer, { url: item.src })
22348
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: Lightbox_default.pdfFallback, children: "Loading document..." }),
22349
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AnyPDFViewer, { url: item.src })
21698
22350
  }
21699
22351
  ) });
21700
22352
  }
21701
22353
 
21702
22354
  // src/renderers/ComponentRenderer.tsx
21703
- var import_jsx_runtime9 = __toESM(require_jsx_runtime());
22355
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime());
21704
22356
  function ComponentRenderer({ item }) {
21705
22357
  if (!item.component) return null;
21706
22358
  const Component = item.component;
21707
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, { ...item.data || {} });
22359
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { ...item.data || {} });
21708
22360
  }
21709
22361
 
21710
22362
  // src/components/LightboxContent.tsx
21711
- var import_jsx_runtime10 = __toESM(require_jsx_runtime());
21712
- function LightboxContent({ item, layout }) {
22363
+ var import_jsx_runtime11 = __toESM(require_jsx_runtime());
22364
+ function LightboxContent({ item, layout, optixFlowConfig }) {
21713
22365
  if (!item) return null;
21714
22366
  switch (item.type) {
21715
22367
  case "image":
21716
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageRenderer, { item, layout });
22368
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
22369
+ ImageRenderer,
22370
+ {
22371
+ item,
22372
+ layout,
22373
+ optixFlowConfig
22374
+ }
22375
+ );
21717
22376
  case "video":
21718
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VideoRenderer, { item, layout });
22377
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(VideoRenderer, { item, layout });
21719
22378
  case "pdf":
21720
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PDFRenderer, { item, layout });
22379
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PDFRenderer, { item, layout });
21721
22380
  case "component":
21722
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ComponentRenderer, { item });
22381
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ComponentRenderer, { item });
21723
22382
  default:
21724
22383
  return null;
21725
22384
  }
21726
22385
  }
21727
22386
 
21728
22387
  // src/components/LightboxChrome.tsx
21729
- var import_jsx_runtime11 = __toESM(require_jsx_runtime());
22388
+ var import_jsx_runtime12 = __toESM(require_jsx_runtime());
21730
22389
  var DEFAULT_CONTROLS = {
21731
22390
  navigation: true,
21732
22391
  keyboard: true,
@@ -21756,9 +22415,9 @@ function LightboxChrome({
21756
22415
  onClose
21757
22416
  }) {
21758
22417
  const resolved = mergeControls(controls);
21759
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: Lightbox_default.chrome, children: [
21760
- resolved.navigation && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: Lightbox_default.chromeSection, children: [
21761
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
22418
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: Lightbox_default.chrome, children: [
22419
+ resolved.navigation && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: Lightbox_default.chromeSection, children: [
22420
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
21762
22421
  "button",
21763
22422
  {
21764
22423
  type: "button",
@@ -21769,7 +22428,7 @@ function LightboxChrome({
21769
22428
  children: "\u2039"
21770
22429
  }
21771
22430
  ),
21772
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
22431
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
21773
22432
  "button",
21774
22433
  {
21775
22434
  type: "button",
@@ -21781,17 +22440,17 @@ function LightboxChrome({
21781
22440
  }
21782
22441
  )
21783
22442
  ] }),
21784
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: Lightbox_default.chromeSection, children: resolved.captions && currentItem && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: Lightbox_default.captionContainer, children: [
21785
- currentItem.title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: Lightbox_default.captionTitle, children: currentItem.title }),
21786
- currentItem.caption && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: Lightbox_default.captionText, children: currentItem.caption })
22443
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.chromeSection, children: resolved.captions && currentItem && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: Lightbox_default.captionContainer, children: [
22444
+ currentItem.title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.captionTitle, children: currentItem.title }),
22445
+ currentItem.caption && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.captionText, children: currentItem.caption })
21787
22446
  ] }) }),
21788
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: Lightbox_default.chromeSection, children: [
21789
- resolved.counter && totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: Lightbox_default.counter, children: [
22447
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: Lightbox_default.chromeSection, children: [
22448
+ resolved.counter && totalItems > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: Lightbox_default.counter, children: [
21790
22449
  currentIndex + 1,
21791
22450
  " / ",
21792
22451
  totalItems
21793
22452
  ] }),
21794
- resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
22453
+ resolved.closeButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
21795
22454
  "button",
21796
22455
  {
21797
22456
  type: "button",
@@ -21806,7 +22465,7 @@ function LightboxChrome({
21806
22465
  }
21807
22466
 
21808
22467
  // src/components/Layouts/HorizontalLayout.tsx
21809
- var import_jsx_runtime12 = __toESM(require_jsx_runtime());
22468
+ var import_jsx_runtime13 = __toESM(require_jsx_runtime());
21810
22469
  function HorizontalLayout({
21811
22470
  content,
21812
22471
  chrome,
@@ -21820,7 +22479,7 @@ function HorizontalLayout({
21820
22479
  height,
21821
22480
  ...style
21822
22481
  };
21823
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.horizontalLayoutRoot, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
22482
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: Lightbox_default.horizontalLayoutRoot, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
21824
22483
  "div",
21825
22484
  {
21826
22485
  className: [
@@ -21828,15 +22487,15 @@ function HorizontalLayout({
21828
22487
  className || ""
21829
22488
  ].join(" ").trim(),
21830
22489
  children: [
21831
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.mainContent, children: content }),
21832
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: Lightbox_default.toolbar, children: chrome })
22490
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: Lightbox_default.mainContent, children: content }),
22491
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: Lightbox_default.toolbar, children: chrome })
21833
22492
  ]
21834
22493
  }
21835
22494
  ) });
21836
22495
  }
21837
22496
 
21838
22497
  // src/components/Lightbox.tsx
21839
- var import_jsx_runtime13 = __toESM(require_jsx_runtime());
22498
+ var import_jsx_runtime14 = __toESM(require_jsx_runtime());
21840
22499
  function Lightbox(props) {
21841
22500
  const { items, initialIndex = 0 } = props;
21842
22501
  const gallery = useGalleryState({
@@ -21845,14 +22504,14 @@ function Lightbox(props) {
21845
22504
  onSelect: props.onSelect
21846
22505
  });
21847
22506
  const { breakpoint } = useResponsiveness();
21848
- const layout = (0, import_react13.useMemo)(() => {
22507
+ const layout = (0, import_react17.useMemo)(() => {
21849
22508
  if (props.layout) return props.layout;
21850
22509
  if (breakpoint === "mobile") return "fullscreen";
21851
22510
  if (breakpoint === "tablet") return "vertical-split";
21852
22511
  return "horizontal";
21853
22512
  }, [props.layout, breakpoint]);
21854
- const didCloseRef = (0, import_react13.useRef)(false);
21855
- (0, import_react13.useEffect)(() => {
22513
+ const didCloseRef = (0, import_react17.useRef)(false);
22514
+ (0, import_react17.useEffect)(() => {
21856
22515
  props.onOpen?.();
21857
22516
  if (props.disableScroll === false) {
21858
22517
  return () => {
@@ -21877,17 +22536,17 @@ function Lightbox(props) {
21877
22536
  }
21878
22537
  };
21879
22538
  }, [props.disableScroll, props.onOpen, props.onClose]);
21880
- const handleClose = (0, import_react13.useCallback)(() => {
22539
+ const handleClose = (0, import_react17.useCallback)(() => {
21881
22540
  if (didCloseRef.current) return;
21882
22541
  didCloseRef.current = true;
21883
22542
  props.onClose?.();
21884
22543
  }, [props.onClose]);
21885
- const handleNext = (0, import_react13.useCallback)(() => {
22544
+ const handleNext = (0, import_react17.useCallback)(() => {
21886
22545
  if (!gallery.canNext) return;
21887
22546
  gallery.next();
21888
22547
  props.onNext?.();
21889
22548
  }, [gallery, props.onNext]);
21890
- const handlePrev = (0, import_react13.useCallback)(() => {
22549
+ const handlePrev = (0, import_react17.useCallback)(() => {
21891
22550
  if (!gallery.canPrev) return;
21892
22551
  gallery.prev();
21893
22552
  props.onPrev?.();
@@ -21913,19 +22572,26 @@ function Lightbox(props) {
21913
22572
  captions: true,
21914
22573
  ...props.controls
21915
22574
  };
21916
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: Lightbox_default.lightboxPortal, role: "dialog", "aria-modal": "true", children: [
21917
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
22575
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: Lightbox_default.lightboxPortal, role: "dialog", "aria-modal": "true", children: [
22576
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
21918
22577
  LightboxOverlay,
21919
22578
  {
21920
22579
  onClose: handleClose,
21921
22580
  closeOnBackdropClick: props.closeOnBackdropClick ?? true
21922
22581
  }
21923
22582
  ),
21924
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
22583
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
21925
22584
  HorizontalLayout,
21926
22585
  {
21927
- content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LightboxContent, { item: currentItem, layout }),
21928
- chrome: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
22586
+ content: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
22587
+ LightboxContent,
22588
+ {
22589
+ item: currentItem,
22590
+ layout,
22591
+ optixFlowConfig: props.optixFlowConfig
22592
+ }
22593
+ ),
22594
+ chrome: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
21929
22595
  LightboxChrome,
21930
22596
  {
21931
22597
  currentIndex: gallery.currentIndex,
@@ -21949,28 +22615,28 @@ function Lightbox(props) {
21949
22615
  }
21950
22616
 
21951
22617
  // src/hooks/useLightboxState.ts
21952
- var import_react14 = __toESM(require_react());
22618
+ var import_react18 = __toESM(require_react());
21953
22619
  function useLightboxState({
21954
22620
  onOpen,
21955
22621
  onClose,
21956
22622
  disableScroll = true
21957
22623
  }) {
21958
- const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
21959
- const open = (0, import_react14.useCallback)(() => {
22624
+ const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
22625
+ const open = (0, import_react18.useCallback)(() => {
21960
22626
  setIsOpen(true);
21961
22627
  onOpen?.();
21962
22628
  if (disableScroll) {
21963
22629
  document.body.style.overflow = "hidden";
21964
22630
  }
21965
22631
  }, [onOpen, disableScroll]);
21966
- const close = (0, import_react14.useCallback)(() => {
22632
+ const close = (0, import_react18.useCallback)(() => {
21967
22633
  setIsOpen(false);
21968
22634
  onClose?.();
21969
22635
  if (disableScroll) {
21970
22636
  document.body.style.overflow = "";
21971
22637
  }
21972
22638
  }, [onClose, disableScroll]);
21973
- (0, import_react14.useEffect)(() => {
22639
+ (0, import_react18.useEffect)(() => {
21974
22640
  return () => {
21975
22641
  if (disableScroll) {
21976
22642
  document.body.style.overflow = "";