function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
/*
 * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { Spin } from "@blueprintjs/icons";
import React from "react";
import { TiffViewerMedia } from "../images/tiff-renderer/TiffViewerMedia.js";
import { BasePdfViewer } from "../pdf-viewer/PdfViewer.js";
import { ViewerType } from "./DocumentViewerApi.js";
import { useTiffToPdf } from "./hooks/useTiffToPdf.js";
import styles from "./DocumentViewer.module.css.js";
export function TiffDocumentViewer({
  media,
  className,
  enableTiffToPdf,
  tiffRendererProps,
  pdfViewerProps
}) {
  const {
    viewerType,
    pdfData,
    loading
  } = useTiffToPdf(media, enableTiffToPdf);
  if (loading) {
    return /*#__PURE__*/React.createElement("div", {
      className: className
    }, /*#__PURE__*/React.createElement("div", {
      className: styles.loadingContainer
    }, /*#__PURE__*/React.createElement(Spin, {
      className: styles.spinnerIcon
    }), "Converting document\u2026"));
  }
  if (viewerType === ViewerType.Pdf && pdfData != null) {
    return /*#__PURE__*/React.createElement(BasePdfViewer, _extends({
      src: pdfData,
      className: className
    }, pdfViewerProps));
  }
  return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({
    media: media,
    className: className
  }, tiffRendererProps));
}
//# sourceMappingURL=TiffDocumentViewer.js.map