@corva/ui 3.77.0-0 → 3.77.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/cjs-bundle/components/AddComment/Popover.js +1 -1
- package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
- package/cjs-bundle/components/AttachFileButton/AttachFileButton.js +1 -1
- package/cjs-bundle/components/AttachFileButton/AttachFileButton.js.map +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/metrics/fetchMetricsAggregate.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/metrics/fetchMetricsAggregate.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/metrics/fetchMudAggregate.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/metrics/fetchMudAggregate.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAllAssets.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAllAssets.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByBounds.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByBounds.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByIds.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByIds.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/wells/fetchWellsByRigIds.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/api/wells/fetchWellsByRigIds.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/cjs-bundle/components/WellhubFilePicker/WellhubFilePicker.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/WellhubFilePicker.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/api/fetchWellhubRecords.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/api/fetchWellhubRecords.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/api/postWellhubRecords.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/api/postWellhubRecords.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/api/registerAttachmentsInWellhub.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/api/registerAttachmentsInWellhub.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.scss.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.scss.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.scss.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.scss.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/constants.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/constants.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/hooks/useWellhubFiles.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/hooks/useWellhubFiles.js.map +1 -0
- package/cjs-bundle/components/WellhubFilePicker/utils/wellhubRecords.js +2 -0
- package/cjs-bundle/components/WellhubFilePicker/utils/wellhubRecords.js.map +1 -0
- package/cjs-bundle/components/index.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs-bundle/utils/fetchDataByChunks.js +2 -0
- package/cjs-bundle/utils/fetchDataByChunks.js.map +1 -0
- package/components/AddComment/Popover.js +1 -1
- package/components/AddComment/Popover.js.map +1 -1
- package/components/AddComment/components/Content.js +1 -1
- package/components/AddComment/components/Content.js.map +1 -1
- package/components/AttachFileButton/AttachFileButton.d.ts +3 -1
- package/components/AttachFileButton/AttachFileButton.d.ts.map +1 -1
- package/components/AttachFileButton/AttachFileButton.js +1 -1
- package/components/AttachFileButton/AttachFileButton.js.map +1 -1
- package/components/AttachFileButton/__tests__/AttachFileButton.test.d.ts +2 -0
- package/components/AttachFileButton/__tests__/AttachFileButton.test.d.ts.map +1 -0
- package/components/BICOffsetPickerDialog/index.js +1 -1
- package/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/components/CommentComposer/CommentComposer.d.ts +3 -1
- package/components/CommentComposer/CommentComposer.d.ts.map +1 -1
- package/components/CommentComposer/CommentComposer.js +1 -1
- package/components/CommentComposer/CommentComposer.js.map +1 -1
- package/components/CommentComposer/__tests__/useAttachmentUpload.stored.test.d.ts +2 -0
- package/components/CommentComposer/__tests__/useAttachmentUpload.stored.test.d.ts.map +1 -0
- package/components/CommentComposer/useAttachmentUpload.d.ts +4 -0
- package/components/CommentComposer/useAttachmentUpload.d.ts.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/components/DocumentViewer/DocumentViewer.js +1 -1
- package/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/components/OffsetWellPickerV5/api/metrics/fetchMetricsAggregate.js +1 -1
- package/components/OffsetWellPickerV5/api/metrics/fetchMetricsAggregate.js.map +1 -1
- package/components/OffsetWellPickerV5/api/metrics/fetchMudAggregate.js +1 -1
- package/components/OffsetWellPickerV5/api/metrics/fetchMudAggregate.js.map +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAllAssets.js +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAllAssets.js.map +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByBounds.js +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByBounds.js.map +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByIds.js +1 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/getAssetsByIds.js.map +1 -1
- package/components/OffsetWellPickerV5/api/wells/fetchWellsByRigIds.js +1 -1
- package/components/OffsetWellPickerV5/api/wells/fetchWellsByRigIds.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/components/WellhubFilePicker/WellhubFilePicker.d.ts +10 -0
- package/components/WellhubFilePicker/WellhubFilePicker.d.ts.map +1 -0
- package/components/WellhubFilePicker/WellhubFilePicker.js +2 -0
- package/components/WellhubFilePicker/WellhubFilePicker.js.map +1 -0
- package/components/WellhubFilePicker/WellhubFilePicker.types.d.ts +34 -0
- package/components/WellhubFilePicker/WellhubFilePicker.types.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/__tests__/registerAttachmentsInWellhub.test.d.ts +2 -0
- package/components/WellhubFilePicker/api/__tests__/registerAttachmentsInWellhub.test.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/fetchWellhubRecords.d.ts +4 -0
- package/components/WellhubFilePicker/api/fetchWellhubRecords.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/fetchWellhubRecords.js +2 -0
- package/components/WellhubFilePicker/api/fetchWellhubRecords.js.map +1 -0
- package/components/WellhubFilePicker/api/index.d.ts +4 -0
- package/components/WellhubFilePicker/api/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/postWellhubRecords.d.ts +10 -0
- package/components/WellhubFilePicker/api/postWellhubRecords.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/postWellhubRecords.js +2 -0
- package/components/WellhubFilePicker/api/postWellhubRecords.js.map +1 -0
- package/components/WellhubFilePicker/api/registerAttachmentsInWellhub.d.ts +22 -0
- package/components/WellhubFilePicker/api/registerAttachmentsInWellhub.d.ts.map +1 -0
- package/components/WellhubFilePicker/api/registerAttachmentsInWellhub.js +2 -0
- package/components/WellhubFilePicker/api/registerAttachmentsInWellhub.js.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.d.ts +15 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.d.ts.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.js +2 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.js.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.scss.js +2 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.scss.js.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/index.d.ts +3 -0
- package/components/WellhubFilePicker/components/WellhubFileCard/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.d.ts +17 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.d.ts.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.js +2 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.js.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.scss.js +2 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.scss.js.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/__tests__/WellhubFilePickerView.test.d.ts +2 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/__tests__/WellhubFilePickerView.test.d.ts.map +1 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/index.d.ts +3 -0
- package/components/WellhubFilePicker/components/WellhubFilePickerView/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/constants.d.ts +5 -0
- package/components/WellhubFilePicker/constants.d.ts.map +1 -0
- package/components/WellhubFilePicker/constants.js +2 -0
- package/components/WellhubFilePicker/constants.js.map +1 -0
- package/components/WellhubFilePicker/hooks/index.d.ts +2 -0
- package/components/WellhubFilePicker/hooks/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/hooks/useWellhubFiles.d.ts +8 -0
- package/components/WellhubFilePicker/hooks/useWellhubFiles.d.ts.map +1 -0
- package/components/WellhubFilePicker/hooks/useWellhubFiles.js +2 -0
- package/components/WellhubFilePicker/hooks/useWellhubFiles.js.map +1 -0
- package/components/WellhubFilePicker/index.d.ts +6 -0
- package/components/WellhubFilePicker/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/utils/index.d.ts +2 -0
- package/components/WellhubFilePicker/utils/index.d.ts.map +1 -0
- package/components/WellhubFilePicker/utils/wellhubRecords.d.ts +10 -0
- package/components/WellhubFilePicker/utils/wellhubRecords.d.ts.map +1 -0
- package/components/WellhubFilePicker/utils/wellhubRecords.js +2 -0
- package/components/WellhubFilePicker/utils/wellhubRecords.js.map +1 -0
- package/components/index.d.ts +3 -0
- package/components/index.d.ts.map +1 -1
- package/components/index.js +1 -1
- package/componentsV2/Autocomplete/Autocomplete.d.ts +9 -1
- package/componentsV2/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/componentsV2/Autocomplete/Autocomplete.js +1 -1
- package/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
- package/componentsV2/Autocomplete/Autocomplete.stories.d.ts.map +1 -1
- package/componentsV2/Autocomplete/AutocompleteNext.stories.d.ts.map +1 -1
- package/mcp-server/server.mjs +90 -9
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/fetchDataByChunks.d.ts.map +1 -0
- package/utils/fetchDataByChunks.js +2 -0
- package/utils/fetchDataByChunks.js.map +1 -0
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/fetchDataByChunks.js +0 -2
- package/cjs-bundle/components/OffsetWellPickerV5/api/shared/fetchers/fetchDataByChunks.js.map +0 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/fetchDataByChunks.d.ts.map +0 -1
- package/components/OffsetWellPickerV5/api/shared/fetchers/fetchDataByChunks.js +0 -2
- package/components/OffsetWellPickerV5/api/shared/fetchers/fetchDataByChunks.js.map +0 -1
- /package/{components/OffsetWellPickerV5/api/shared/fetchers → utils}/fetchDataByChunks.d.ts +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"@babel/runtime/helpers/toConsumableArray";import e from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import i from"@babel/runtime/regenerator";import{useState as o,useRef as u,useCallback as l,useEffect as c}from"react";import a from"react-s3-uploader/s3upload";import{getAttachmentKind as f}from"../AttachmentPreview/getAttachmentKind.js";import{ACCEPTED_ATTACHMENT_TYPES as s}from"../AttachFileButton/AttachFileButton.js";import{getS3SignedUrl as d}from"../../clients/jsonApi/index.js";import{getUrlFileName as p}from"../../utils/links.js";import{getSignedLink as v,peekSignedLink as m}from"../../utils/signedLinkCache.js";function h(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.push.apply(n,t)}return n}function g(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?h(Object(t),!0).forEach((function(e){n(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var b=10,w=function(r){return r.type.startsWith("image/")?"image":r.type.startsWith("video/")?"video":"file"},U=function(r){return(r/1048576).toFixed(1)},y=function(r){return{id:r.url,name:r.name,file:null,previewUrl:"",isUploading:!1,error:null,uploaded:r}},j=0,O=function(){return"attachment-".concat(j+=1)},k=function(n){var h,b,j=n.value,k=n.onChange,F=n.onError,x=n.maxSizeBytes,L=n.maxFiles,P=void 0===L?10:L,A=n.accept,S=void 0===A?s:A,z=o([]),E=t(z,2),R=E[0],B=E[1],C=u(null),D=u(new Map),M=u(new Map),W=u([]),T=u(k),I=u(F);T.current=k,I.current=F;var Y=u([]),_=l((function(r){var e=r(W.current);W.current=e,B(e),Y.current=function(r){return r.map((function(r){return r.uploaded})).filter(Boolean)}(e),T.current(Y.current)}),[]),G=l((function(r,e){return _((function(n){return n.map((function(n){return n.id===r?g(g({},n),e):n}))}))}),[_]),K=l((function(r){var e,n;null===(e=D.current.get(r))||void 0===e||e.abortUpload(),D.current.delete(r),M.current.set(r,(null!==(n=M.current.get(r))&&void 0!==n?n:0)+1)}),[]),q=l((function(r){null!=r&&r.previewUrl&&URL.revokeObjectURL(r.previewUrl)}),[]),H=l((function(){var r,e,n;null===(r=I.current)||void 0===r||r.call(I,null!==(e=null===(n=W.current.find((function(r){return r.error})))||void 0===n?void 0:n.error)&&void 0!==e?e:null)}),[]);c((function(){return function(){D.current.forEach((function(r){return r.abortUpload()})),D.current.clear(),W.current.forEach((function(r){r.previewUrl&&URL.revokeObjectURL(r.previewUrl)}))}}),[]);var J=l((function(r,n){var t,o=(null!==(t=M.current.get(r))&&void 0!==t?t:0)+1;M.current.set(r,o);var u,l,c=function(){return M.current.get(r)===o},f=function(e){var n;c()&&(G(r,{isUploading:!1,error:e}),null===(n=I.current)||void 0===n||n.call(I,e))},s="",p=new a({files:[n],preprocess:function(r,e){return e(r)},onProgress:function(){},getSignedUrl:(l=e(i.mark((function r(e,n){var t;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,d(e.name,e.type);case 3:t=r.sent,s=t.file_name,n(g(g({},t),{},{signedUrl:t.signed_url})),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(0),f((null===r.t0||void 0===r.t0?void 0:r.t0.message)||"Failed to upload the file");case 11:case"end":return r.stop()}}),r,null,[[0,8]])}))),function(r,e){return l.apply(this,arguments)}),onFinishS3Put:(u=e(i.mark((function e(){var t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,v(s);case 3:if(t=e.sent,c()){e.next=6;break}return e.abrupt("return");case 6:D.current.delete(r),G(r,{isUploading:!1,error:null,uploaded:{url:t,name:s,size:n.size}}),H(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),f((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Failed to upload the file");case 14:case"end":return e.stop()}}),e,null,[[0,11]])}))),function(){return u.apply(this,arguments)}),onError:function(r){return f(r||"Failed to upload the file")}});D.current.set(r,p)}),[G,H]),N=l((function(e){var n,t=p(e);t&&(W.current.length>=P?null===(n=I.current)||void 0===n||n.call(I,"You can attach up to ".concat(P," files.")):W.current.some((function(r){var n;return(null===(n=r.uploaded)||void 0===n?void 0:n.url)===e}))||_((function(n){return[].concat(r(n),[{id:O(),name:t,file:null,previewUrl:e,isUploading:!1,error:null,uploaded:{url:e,name:t}}])})))}),[_,P]),Q=l((function(e){var n,t,i,o,u=e.filter((function(r){return function(r,e){return e.split(",").map((function(r){return r.trim().toLowerCase()})).filter(Boolean).some((function(e){if(e.startsWith("."))return r.name.toLowerCase().endsWith(e);if(e.endsWith("/*")){var n=r.type.toLowerCase();return n?n.startsWith(e.slice(0,-1)):f({name:r.name})===e.slice(0,-1)}return r.type.toLowerCase()===e}))}(r,S)})),l=u.length<e.length?1===e.length?"That file type is not supported.":"Some files were skipped — unsupported file type.":null,c="You can attach up to ".concat(P," files."),a=P-W.current.length;if(!u.length||a<=0){var s;null===(s=I.current)||void 0===s||s.call(I,u.length?c:l)}else{var d=u.slice(0,a),p=d.map((function(r){var e=w(r),n=!!x&&r.size>x;return{id:O(),name:r.name,file:r,previewUrl:"file"===e?"":URL.createObjectURL(r),isUploading:!n,error:n?"File is too large (".concat(U(r.size)," MB). Maximum size is ").concat(U(x)," MB."):null,uploaded:null}}));_((function(e){return[].concat(r(e),r(p))}));var v=u.length>d.length?c:null;null===(n=I.current)||void 0===n||n.call(I,null!==(t=null!==(i=null===(o=W.current.find((function(r){return r.error})))||void 0===o?void 0:o.error)&&void 0!==i?i:l)&&void 0!==t?t:v),p.filter((function(r){return!r.error})).forEach((function(r){return J(r.id,r.file)}))}}),[_,P,x,J,S]),V=l((function(r){var e,n=Array.from(null!==(e=r.target.files)&&void 0!==e?e:[]);C.current&&(C.current.value=""),n.length&&Q(n)}),[Q]),X=l((function(){var r;return null===(r=C.current)||void 0===r?void 0:r.click()}),[]),Z=l((function(r){var e=String(r);K(e),q(W.current.find((function(r){return r.id===e}))),_((function(r){return r.filter((function(r){return r.id!==e}))})),H()}),[K,q,_,H]),$=l((function(r){var e=String(r),n=W.current.find((function(r){return r.id===e}));null!=n&&n.file&&(K(e),G(e,{isUploading:!0,error:null}),H(),J(e,n.file))}),[K,G,J,H]),rr=l((function(e){return _((function(n){var t=new Map(n.map((function(r){return[r.id,r]}))),i=e.map((function(r){return t.get(String(r))})).filter(Boolean),o=n.filter((function(r){return!e.some((function(e){return String(e)===r.id}))}));return[].concat(r(i),r(o))}))}),[_]),er=l((function(){var r;W.current.forEach((function(r){K(r.id),q(r)})),_((function(){return[]})),null===(r=I.current)||void 0===r||r.call(I,null)}),[K,_,q]);c((function(){var r,e,n;(e=Y.current,n=j,e.length===n.length&&e.every((function(r,e){return r.url===n[e].url})))||(W.current.forEach((function(r){K(r.id),r.previewUrl&&URL.revokeObjectURL(r.previewUrl)})),W.current=j.map(y),Y.current=j,B(W.current),null===(r=I.current)||void 0===r||r.call(I,null))}),[j,K]);var nr=o((function(){return j.reduce((function(r,e){var n=m(e.name,"inline");return n&&(r[e.name]=n),r}),{})})),tr=t(nr,2),ir=tr[0],or=tr[1],ur=u(ir);ur.current=ir;var lr=R.filter((function(r){return!r.file&&!r.previewUrl&&r.uploaded})).map((function(r){return r.uploaded.name})).join("|");return c((function(){var r=lr.split("|").filter((function(r){return r&&!(r in ur.current)}));if(r.length){var e=!0;return Promise.all(r.map((function(r){return v(r,"inline").then((function(e){return[r,e]})).catch((function(e){return console.error('Failed to sign stored attachment "'.concat(r,'"'),e),[r,""]}))}))).then((function(r){e&&or((function(e){return g(g({},e),Object.fromEntries(r))}))})),function(){e=!1}}}),[lr]),{items:R.reduce((function(r,e){var n;if(e.file)return r.push({id:e.id,name:e.name,src:e.previewUrl,kind:w(e.file),size:e.file.size,isUploading:e.isUploading,hideDownload:!0,error:null!==(n=e.error)&&void 0!==n?n:void 0}),r;var t=e.uploaded,i=f(t),o=e.previewUrl||ir[t.name];return"file"===i||o?(r.push({id:e.id,name:t.name,src:o,kind:i,size:t.size,hideDownload:!0}),r):r}),[]),fileInputRef:C,openFileDialog:X,handleFileSelect:V,addFiles:Q,addLinkedImage:N,removeAttachment:Z,handleRetry:$,reorderAttachments:rr,clearAttachments:er,isUploading:R.some((function(r){return r.isUploading})),error:null!==(h=null===(b=R.find((function(r){return r.error})))||void 0===b?void 0:b.error)&&void 0!==h?h:null,count:R.length,isFull:R.length>=P,maxFiles:P}};export{b as DEFAULT_MAX_ATTACHMENTS,k as useAttachmentUpload};
|
|
1
|
+
import r from"@babel/runtime/helpers/toConsumableArray";import e from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import i from"@babel/runtime/regenerator";import{useState as u,useRef as o,useCallback as l,useEffect as c}from"react";import a from"react-s3-uploader/s3upload";import{getAttachmentKind as f}from"../AttachmentPreview/getAttachmentKind.js";import{ACCEPTED_ATTACHMENT_TYPES as s}from"../AttachFileButton/AttachFileButton.js";import{getS3SignedUrl as d}from"../../clients/jsonApi/index.js";import{getUrlFileName as p}from"../../utils/links.js";import{getSignedLink as v,peekSignedLink as m}from"../../utils/signedLinkCache.js";function h(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.push.apply(n,t)}return n}function g(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?h(Object(t),!0).forEach((function(e){n(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}var b=10,w=function(r){return r.type.startsWith("image/")?"image":r.type.startsWith("video/")?"video":"file"},U=function(r){return(r/1048576).toFixed(1)},y=function(r){return{id:r.url,name:r.name,file:null,previewUrl:"",isUploading:!1,error:null,uploaded:r}},j=0,O=function(){return"attachment-".concat(j+=1)},x=function(n){var h,b,j=n.value,x=n.onChange,k=n.onError,F=n.maxSizeBytes,L=n.maxFiles,P=void 0===L?10:L,z=n.accept,S=void 0===z?s:z,A=u([]),E=t(A,2),R=E[0],B=E[1],C=o(null),D=o(new Map),M=o(new Map),W=o([]),N=o(x),Y=o(k);N.current=x,Y.current=k;var I=o([]),T=l((function(r){var e=r(W.current);W.current=e,B(e),I.current=function(r){return r.map((function(r){return r.uploaded})).filter(Boolean)}(e),N.current(I.current)}),[]),_=l((function(r,e){return T((function(n){return n.map((function(n){return n.id===r?g(g({},n),e):n}))}))}),[T]),G=l((function(r){var e,n;null===(e=D.current.get(r))||void 0===e||e.abortUpload(),D.current.delete(r),M.current.set(r,(null!==(n=M.current.get(r))&&void 0!==n?n:0)+1)}),[]),K=l((function(r){null!=r&&r.previewUrl&&URL.revokeObjectURL(r.previewUrl)}),[]),q=l((function(){var r,e,n;null===(r=Y.current)||void 0===r||r.call(Y,null!==(e=null===(n=W.current.find((function(r){return r.error})))||void 0===n?void 0:n.error)&&void 0!==e?e:null)}),[]);c((function(){return function(){D.current.forEach((function(r){return r.abortUpload()})),D.current.clear(),W.current.forEach((function(r){r.previewUrl&&URL.revokeObjectURL(r.previewUrl)}))}}),[]);var H=l((function(r,n){var t,u=(null!==(t=M.current.get(r))&&void 0!==t?t:0)+1;M.current.set(r,u);var o,l,c=function(){return M.current.get(r)===u},f=function(e){var n;c()&&(_(r,{isUploading:!1,error:e}),null===(n=Y.current)||void 0===n||n.call(Y,e))},s="",p=new a({files:[n],preprocess:function(r,e){return e(r)},onProgress:function(){},getSignedUrl:(l=e(i.mark((function r(e,n){var t;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,d(e.name,e.type);case 3:t=r.sent,s=t.file_name,n(g(g({},t),{},{signedUrl:t.signed_url})),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(0),f((null===r.t0||void 0===r.t0?void 0:r.t0.message)||"Failed to upload the file");case 11:case"end":return r.stop()}}),r,null,[[0,8]])}))),function(r,e){return l.apply(this,arguments)}),onFinishS3Put:(o=e(i.mark((function e(){var t;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,v(s);case 3:if(t=e.sent,c()){e.next=6;break}return e.abrupt("return");case 6:D.current.delete(r),_(r,{isUploading:!1,error:null,uploaded:{url:t,name:s,size:n.size}}),q(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),f((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Failed to upload the file");case 14:case"end":return e.stop()}}),e,null,[[0,11]])}))),function(){return o.apply(this,arguments)}),onError:function(r){return f(r||"Failed to upload the file")}});D.current.set(r,p)}),[_,q]),J=l((function(e){var n,t=p(e);t&&(W.current.length>=P?null===(n=Y.current)||void 0===n||n.call(Y,"You can attach up to ".concat(P," files.")):W.current.some((function(r){var n;return(null===(n=r.uploaded)||void 0===n?void 0:n.url)===e}))||T((function(n){return[].concat(r(n),[{id:O(),name:t,file:null,previewUrl:e,isUploading:!1,error:null,uploaded:{url:e,name:t}}])})))}),[T,P]),Q=l(function(){var n=e(i.mark((function e(n){var t,u,o,l,c,a,f,s,d,p,m;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=n.filter((function(r,e,n){return!W.current.some((function(e){var n;return(null===(n=e.uploaded)||void 0===n?void 0:n.name)===r.fileName}))&&n.findIndex((function(e){return e.fileName===r.fileName}))===e}))).length){e.next=3;break}return e.abrupt("return");case 3:if(!((l=P-W.current.length)<=0)){e.next=7;break}return null===(c=Y.current)||void 0===c||c.call(Y,"You can attach up to ".concat(P," files.")),e.abrupt("return");case 7:return a=o.slice(0,l),e.next=10,Promise.all(a.map((function(r){return v(r.fileName).then((function(e){return{url:e,name:r.fileName,size:r.size}})).catch((function(){return null}))})));case 10:f=e.sent,s=f.filter(Boolean),d=0,s.length&&T((function(e){var n=s.slice(0,Math.max(P-e.length,0));return d=n.length,[].concat(r(e),r(n.map((function(r){return g(g({},y(r)),{},{id:O()})}))))})),p=f.length-s.length,m=o.length>a.length||d<s.length,null===(t=Y.current)||void 0===t||t.call(Y,p&&"Could not attach ".concat(1===p?"a file":"".concat(p," files")," from Wellhub.")||m&&"You can attach up to ".concat(P," files.")||(null===(u=W.current.find((function(r){return r.error})))||void 0===u?void 0:u.error)||null);case 17:case"end":return e.stop()}}),e)})));return function(r){return n.apply(this,arguments)}}(),[T,P]),V=l((function(e){var n,t,i,u,o=e.filter((function(r){return function(r,e){return e.split(",").map((function(r){return r.trim().toLowerCase()})).filter(Boolean).some((function(e){if(e.startsWith("."))return r.name.toLowerCase().endsWith(e);if(e.endsWith("/*")){var n=r.type.toLowerCase();return n?n.startsWith(e.slice(0,-1)):f({name:r.name})===e.slice(0,-1)}return r.type.toLowerCase()===e}))}(r,S)})),l=o.length<e.length?1===e.length?"That file type is not supported.":"Some files were skipped — unsupported file type.":null,c="You can attach up to ".concat(P," files."),a=P-W.current.length;if(!o.length||a<=0){var s;null===(s=Y.current)||void 0===s||s.call(Y,o.length?c:l)}else{var d=o.slice(0,a),p=d.map((function(r){var e=w(r),n=!!F&&r.size>F;return{id:O(),name:r.name,file:r,previewUrl:"file"===e?"":URL.createObjectURL(r),isUploading:!n,error:n?"File is too large (".concat(U(r.size)," MB). Maximum size is ").concat(U(F)," MB."):null,uploaded:null}}));T((function(e){return[].concat(r(e),r(p))}));var v=o.length>d.length?c:null;null===(n=Y.current)||void 0===n||n.call(Y,null!==(t=null!==(i=null===(u=W.current.find((function(r){return r.error})))||void 0===u?void 0:u.error)&&void 0!==i?i:l)&&void 0!==t?t:v),p.filter((function(r){return!r.error})).forEach((function(r){return H(r.id,r.file)}))}}),[T,P,F,H,S]),X=l((function(r){var e,n=Array.from(null!==(e=r.target.files)&&void 0!==e?e:[]);C.current&&(C.current.value=""),n.length&&V(n)}),[V]),Z=l((function(){var r;return null===(r=C.current)||void 0===r?void 0:r.click()}),[]),$=l((function(r){var e=String(r);G(e),K(W.current.find((function(r){return r.id===e}))),T((function(r){return r.filter((function(r){return r.id!==e}))})),q()}),[G,K,T,q]),rr=l((function(r){var e=String(r),n=W.current.find((function(r){return r.id===e}));null!=n&&n.file&&(G(e),_(e,{isUploading:!0,error:null}),q(),H(e,n.file))}),[G,_,H,q]),er=l((function(e){return T((function(n){var t=new Map(n.map((function(r){return[r.id,r]}))),i=e.map((function(r){return t.get(String(r))})).filter(Boolean),u=n.filter((function(r){return!e.some((function(e){return String(e)===r.id}))}));return[].concat(r(i),r(u))}))}),[T]),nr=l((function(){var r;W.current.forEach((function(r){G(r.id),K(r)})),T((function(){return[]})),null===(r=Y.current)||void 0===r||r.call(Y,null)}),[G,T,K]);c((function(){var r,e,n;(e=I.current,n=j,e.length===n.length&&e.every((function(r,e){return r.url===n[e].url})))||(W.current.forEach((function(r){G(r.id),r.previewUrl&&URL.revokeObjectURL(r.previewUrl)})),W.current=j.map(y),I.current=j,B(W.current),null===(r=Y.current)||void 0===r||r.call(Y,null))}),[j,G]);var tr=u((function(){return j.reduce((function(r,e){var n=m(e.name,"inline");return n&&(r[e.name]=n),r}),{})})),ir=t(tr,2),ur=ir[0],or=ir[1],lr=o(ur);lr.current=ur;var cr=R.filter((function(r){return!r.file&&!r.previewUrl&&r.uploaded})).map((function(r){return r.uploaded.name})).join("|");return c((function(){var r=cr.split("|").filter((function(r){return r&&!(r in lr.current)}));if(r.length){var e=!0;return Promise.all(r.map((function(r){return v(r,"inline").then((function(e){return[r,e]})).catch((function(e){return console.error('Failed to sign stored attachment "'.concat(r,'"'),e),[r,""]}))}))).then((function(r){e&&or((function(e){return g(g({},e),Object.fromEntries(r))}))})),function(){e=!1}}}),[cr]),{items:R.reduce((function(r,e){var n;if(e.file)return r.push({id:e.id,name:e.name,src:e.previewUrl,kind:w(e.file),size:e.file.size,isUploading:e.isUploading,hideDownload:!0,error:null!==(n=e.error)&&void 0!==n?n:void 0}),r;var t=e.uploaded,i=f(t),u=e.previewUrl||ur[t.name];return"file"===i||u?(r.push({id:e.id,name:t.name,src:u,kind:i,size:t.size,hideDownload:!0}),r):r}),[]),fileInputRef:C,openFileDialog:Z,handleFileSelect:X,addFiles:V,addLinkedImage:J,addStoredFiles:Q,removeAttachment:$,handleRetry:rr,reorderAttachments:er,clearAttachments:nr,isUploading:R.some((function(r){return r.isUploading})),error:null!==(h=null===(b=R.find((function(r){return r.error})))||void 0===b?void 0:b.error)&&void 0!==h?h:null,count:R.length,isFull:R.length>=P,maxFiles:P}};export{b as DEFAULT_MAX_ATTACHMENTS,x as useAttachmentUpload};
|
|
2
2
|
//# sourceMappingURL=useAttachmentUpload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAttachmentUpload.js","sources":["../../../src/components/CommentComposer/useAttachmentUpload.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\n\nimport type {\n AttachmentKind,\n AttachmentPreviewItem,\n} from '../AttachmentPreview/AttachmentPreview.types';\nimport { getAttachmentKind } from '../AttachmentPreview/getAttachmentKind';\nimport { ACCEPTED_ATTACHMENT_TYPES } from '../AttachFileButton';\n\nimport { getS3SignedUrl } from '~/clients/jsonApi';\nimport { getUrlFileName } from '~/utils/links';\nimport { getSignedLink, peekSignedLink } from '~/utils/signedLinkCache';\n\nexport type UploadedAttachment = {\n url: string;\n name: string;\n size?: number;\n};\n\ntype UseAttachmentUploadOptions = {\n value: UploadedAttachment[];\n onChange: (attachments: UploadedAttachment[]) => void;\n onError?: (message: string | null) => void;\n maxSizeBytes?: number;\n maxFiles?: number;\n /** Mirrors the file input's `accept`; also gates drag-and-drop. */\n accept?: string;\n};\n\n/** A picked or already-stored file, in the order the user arranged it. */\ntype Entry = {\n id: string;\n name: string;\n /** Set while the file is local; cleared entries come from `value`. */\n file: File | null;\n previewUrl: string;\n isUploading: boolean;\n error: string | null;\n uploaded: UploadedAttachment | null;\n};\n\nexport const DEFAULT_MAX_ATTACHMENTS = 10;\n\n/** Same rules the file input enforces via `accept`, so drag-and-drop can't smuggle a type past it. */\nconst isAcceptedType = (file: File, accept: string) =>\n accept\n .split(',')\n .map(rule => rule.trim().toLowerCase())\n .filter(Boolean)\n .some(rule => {\n if (rule.startsWith('.')) return file.name.toLowerCase().endsWith(rule);\n if (rule.endsWith('/*')) {\n const type = file.type.toLowerCase();\n if (type) return type.startsWith(rule.slice(0, -1));\n\n return getAttachmentKind({ name: file.name }) === rule.slice(0, -1);\n }\n\n return file.type.toLowerCase() === rule;\n });\n\nconst getFileKind = (file: File): AttachmentKind => {\n if (file.type.startsWith('image/')) return 'image';\n if (file.type.startsWith('video/')) return 'video';\n return 'file';\n};\n\nconst formatMb = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);\n\nconst getUploaded = (entries: Entry[]) =>\n entries.map(entry => entry.uploaded).filter(Boolean) as UploadedAttachment[];\n\nconst isSameList = (a: UploadedAttachment[], b: UploadedAttachment[]) =>\n a.length === b.length && a.every((item, index) => item.url === b[index].url);\n\nconst toStoredEntry = (attachment: UploadedAttachment): Entry => ({\n id: attachment.url,\n name: attachment.name,\n file: null,\n previewUrl: '',\n isUploading: false,\n error: null,\n uploaded: attachment,\n});\n\nlet entrySeq = 0;\nconst nextEntryId = () => {\n entrySeq += 1;\n return `attachment-${entrySeq}`;\n};\n\nexport const useAttachmentUpload = ({\n value,\n onChange,\n onError,\n maxSizeBytes,\n maxFiles = DEFAULT_MAX_ATTACHMENTS,\n accept = ACCEPTED_ATTACHMENT_TYPES,\n}: UseAttachmentUploadOptions) => {\n const [entries, setEntries] = useState<Entry[]>([]);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n const uploadersRef = useRef(new Map<string, S3Upload>());\n // Bumped per attempt so a superseded upload can't write state for a restarted entry.\n const sessionsRef = useRef(new Map<string, number>());\n // Mutations are driven from async upload callbacks, so the latest list lives in a ref.\n const entriesRef = useRef<Entry[]>([]);\n const onChangeRef = useRef(onChange);\n const onErrorRef = useRef(onError);\n\n onChangeRef.current = onChange;\n onErrorRef.current = onError;\n\n // What we last handed the parent. A `value` that still matches it is our own change echoing\n // back; anything else is a parent-driven reset we must adopt.\n const emittedRef = useRef<UploadedAttachment[]>([]);\n\n const commit = useCallback((updater: (prev: Entry[]) => Entry[]) => {\n const next = updater(entriesRef.current);\n entriesRef.current = next;\n setEntries(next);\n emittedRef.current = getUploaded(next);\n onChangeRef.current(emittedRef.current);\n }, []);\n\n const patchEntry = useCallback(\n (id: string, patch: Partial<Entry>) =>\n commit(prev => prev.map(entry => (entry.id === id ? { ...entry, ...patch } : entry))),\n [commit]\n );\n\n const abortUpload = useCallback((id: string) => {\n uploadersRef.current.get(id)?.abortUpload();\n uploadersRef.current.delete(id);\n // Bump, never delete: deleting would let the next attempt reuse session 1, so a callback\n // still in flight from the aborted attempt would pass `isCurrent` and clobber it.\n sessionsRef.current.set(id, (sessionsRef.current.get(id) ?? 0) + 1);\n }, []);\n\n const releasePreview = useCallback((entry?: Entry) => {\n if (entry?.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n }, []);\n\n // The banner is shared by every tile, so recompute it rather than clear it — one file\n // succeeding must not hide a sibling that is still failing.\n const syncError = useCallback(() => {\n onErrorRef.current?.(entriesRef.current.find(entry => entry.error)?.error ?? null);\n }, []);\n\n useEffect(\n () => () => {\n uploadersRef.current.forEach(uploader => uploader.abortUpload());\n uploadersRef.current.clear();\n entriesRef.current.forEach(entry => {\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n },\n []\n );\n\n const startUpload = useCallback(\n (id: string, file: File) => {\n const session = (sessionsRef.current.get(id) ?? 0) + 1;\n sessionsRef.current.set(id, session);\n // A superseded upload must not write state for an entry that is gone or restarted.\n const isCurrent = () => sessionsRef.current.get(id) === session;\n\n const fail = (message: string) => {\n if (!isCurrent()) return;\n patchEntry(id, { isUploading: false, error: message });\n onErrorRef.current?.(message);\n };\n\n let storedKey = '';\n\n const uploader = new S3Upload({\n files: [file],\n preprocess: (target: File, next: (file: File) => void) => next(target),\n onProgress: () => {},\n getSignedUrl: async (\n target: File,\n callback: (data: { signedUrl: string; [key: string]: unknown }) => void\n ) => {\n try {\n const data = await getS3SignedUrl(target.name, target.type);\n storedKey = data.file_name;\n callback({ ...data, signedUrl: data.signed_url });\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onFinishS3Put: async () => {\n try {\n const url = await getSignedLink(storedKey);\n if (!isCurrent()) return;\n\n uploadersRef.current.delete(id);\n patchEntry(id, {\n isUploading: false,\n error: null,\n uploaded: { url, name: storedKey, size: file.size },\n });\n syncError();\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onError: (message: string) => fail(message || 'Failed to upload the file'),\n });\n\n uploadersRef.current.set(id, uploader);\n },\n [patchEntry, syncError]\n );\n\n /** Nothing is uploaded: a comment attachment is a url, so the link itself is the attachment. */\n const addLinkedImage = useCallback(\n (url: string) => {\n const name = getUrlFileName(url);\n\n if (!name) return;\n if (entriesRef.current.length >= maxFiles) {\n onErrorRef.current?.(`You can attach up to ${maxFiles} files.`);\n\n return;\n }\n\n if (entriesRef.current.some(entry => entry.uploaded?.url === url)) return;\n\n commit(prev => [\n ...prev,\n {\n id: nextEntryId(),\n name,\n file: null,\n previewUrl: url,\n isUploading: false,\n error: null,\n uploaded: { url, name },\n },\n ]);\n },\n [commit, maxFiles]\n );\n\n const addFiles = useCallback(\n (files: File[]) => {\n const supported = files.filter(file => isAcceptedType(file, accept));\n const skipped = supported.length < files.length;\n // One banner, one message: report the most actionable reason once, at the end. Reporting\n // as we go would let a later call overwrite an earlier warning on a mixed drop.\n const unsupported = skipped\n ? (files.length === 1 && 'That file type is not supported.') ||\n 'Some files were skipped — unsupported file type.'\n : null;\n const tooMany = `You can attach up to ${maxFiles} files.`;\n\n const room = maxFiles - entriesRef.current.length;\n if (!supported.length || room <= 0) {\n onErrorRef.current?.(supported.length ? tooMany : unsupported);\n return;\n }\n\n const accepted = supported.slice(0, room);\n const added: Entry[] = accepted.map(file => {\n const kind = getFileKind(file);\n const isTooLarge = !!maxSizeBytes && file.size > maxSizeBytes;\n\n return {\n id: nextEntryId(),\n name: file.name,\n file,\n previewUrl: kind === 'file' ? '' : URL.createObjectURL(file),\n isUploading: !isTooLarge,\n error: isTooLarge\n ? `File is too large (${formatMb(file.size)} MB). Maximum size is ${formatMb(\n maxSizeBytes as number\n )} MB.`\n : null,\n uploaded: null,\n };\n });\n\n commit(prev => [...prev, ...added]);\n\n const overflow = supported.length > accepted.length ? tooMany : null;\n onErrorRef.current?.(\n entriesRef.current.find(entry => entry.error)?.error ?? unsupported ?? overflow\n );\n\n added\n .filter(entry => !entry.error)\n .forEach(entry => startUpload(entry.id, entry.file as File));\n },\n [commit, maxFiles, maxSizeBytes, startUpload, accept]\n );\n\n const handleFileSelect = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files ?? []);\n // Reset the input so re-picking the same file still fires a change event.\n if (fileInputRef.current) fileInputRef.current.value = '';\n if (files.length) addFiles(files);\n },\n [addFiles]\n );\n\n const openFileDialog = useCallback(() => fileInputRef.current?.click(), []);\n\n const removeAttachment = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n abortUpload(key);\n releasePreview(entriesRef.current.find(entry => entry.id === key));\n commit(prev => prev.filter(entry => entry.id !== key));\n syncError();\n },\n [abortUpload, releasePreview, commit, syncError]\n );\n\n const handleRetry = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n const entry = entriesRef.current.find(item => item.id === key);\n if (!entry?.file) return;\n\n abortUpload(key);\n patchEntry(key, { isUploading: true, error: null });\n syncError();\n startUpload(key, entry.file);\n },\n [abortUpload, patchEntry, startUpload, syncError]\n );\n\n const reorderAttachments = useCallback(\n (orderedIds: AttachmentPreviewItem['id'][]) =>\n commit(prev => {\n const byId = new Map(prev.map(entry => [entry.id, entry]));\n const reordered = orderedIds.map(id => byId.get(String(id))).filter(Boolean) as Entry[];\n // Unlisted ids (a race with a removal) keep their place at the end.\n const missing = prev.filter(entry => !orderedIds.some(id => String(id) === entry.id));\n return [...reordered, ...missing];\n }),\n [commit]\n );\n\n const clearAttachments = useCallback(() => {\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n releasePreview(entry);\n });\n commit(() => []);\n onErrorRef.current?.(null);\n }, [abortUpload, commit, releasePreview]);\n\n // Adopt a value we didn't produce — an edit form's initial attachments, or a parent-side reset.\n // Compared against what we emitted, not against the current entries: a failed-only or\n // mid-upload list emits `[]` too, and treating that as \"in sync\" would strand those tiles\n // on screen and let a late upload write itself back into freshly reset parent state.\n useEffect(() => {\n if (isSameList(emittedRef.current, value)) return;\n\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n entriesRef.current = value.map(toStoredEntry);\n emittedRef.current = value;\n setEntries(entriesRef.current);\n onErrorRef.current?.(null);\n }, [value, abortUpload]);\n\n // A stored url has expired by now, so re-sign it for the preview.\n const [storedSrcs, setStoredSrcs] = useState<Record<string, string>>(() =>\n value.reduce<Record<string, string>>((acc, attachment) => {\n const src = peekSignedLink(attachment.name, 'inline');\n if (src) acc[attachment.name] = src;\n\n return acc;\n }, {})\n );\n const storedSrcsRef = useRef(storedSrcs);\n storedSrcsRef.current = storedSrcs;\n\n const storedNames = entries\n // A linked image carries its own url, so there is no key of ours to sign.\n .filter(entry => !entry.file && !entry.previewUrl && entry.uploaded)\n .map(entry => (entry.uploaded as UploadedAttachment).name)\n .join('|');\n\n useEffect(() => {\n const pending = storedNames.split('|').filter(name => name && !(name in storedSrcsRef.current));\n if (!pending.length) return undefined;\n\n let isActive = true;\n Promise.all(\n pending.map(name =>\n getSignedLink(name, 'inline')\n .then(url => [name, url] as const)\n .catch(error => {\n console.error(`Failed to sign stored attachment \"${name}\"`, error);\n\n return [name, ''] as const;\n })\n )\n ).then(resolved => {\n if (isActive) setStoredSrcs(prev => ({ ...prev, ...Object.fromEntries(resolved) }));\n });\n\n return () => {\n isActive = false;\n };\n }, [storedNames]);\n\n const items = entries.reduce<AttachmentPreviewItem[]>((acc, entry) => {\n if (entry.file) {\n acc.push({\n id: entry.id,\n name: entry.name,\n src: entry.previewUrl,\n kind: getFileKind(entry.file),\n size: entry.file.size,\n isUploading: entry.isUploading,\n hideDownload: true,\n error: entry.error ?? undefined,\n });\n return acc;\n }\n\n const stored = entry.uploaded as UploadedAttachment;\n const kind = getAttachmentKind(stored);\n // A linked image is already a url; only one of ours has an S3 key worth signing.\n const src = entry.previewUrl || storedSrcs[stored.name];\n // A thumbnail without its signed url would paint as a broken image, so hold it back.\n if (kind !== 'file' && !src) return acc;\n\n acc.push({ id: entry.id, name: stored.name, src, kind, size: stored.size, hideDownload: true });\n return acc;\n }, []);\n\n return {\n items,\n fileInputRef,\n openFileDialog,\n handleFileSelect,\n addFiles,\n addLinkedImage,\n removeAttachment,\n handleRetry,\n reorderAttachments,\n clearAttachments,\n isUploading: entries.some(entry => entry.isUploading),\n error: entries.find(entry => entry.error)?.error ?? null,\n count: entries.length,\n isFull: entries.length >= maxFiles,\n maxFiles,\n };\n};\n"],"names":["DEFAULT_MAX_ATTACHMENTS","getFileKind","file","type","startsWith","formatMb","bytes","toFixed","toStoredEntry","attachment","id","url","name","previewUrl","isUploading","error","uploaded","entrySeq","nextEntryId","concat","useAttachmentUpload","_ref","_entries$find$error","_entries$find","value","onChange","onError","maxSizeBytes","_ref$maxFiles","maxFiles","_ref$accept","accept","ACCEPTED_ATTACHMENT_TYPES","useState","_useState2","_slicedToArray","_useState","entries","setEntries","fileInputRef","useRef","uploadersRef","Map","sessionsRef","entriesRef","onChangeRef","onErrorRef","current","emittedRef","commit","useCallback","updater","next","map","entry","filter","Boolean","getUploaded","patchEntry","patch","prev","abortUpload","_uploadersRef$current","_sessionsRef$current$","get","delete","set","releasePreview","URL","revokeObjectURL","syncError","_onErrorRef$current","_entriesRef$current$f","_entriesRef$current$f2","find","useEffect","forEach","uploader","clear","startUpload","_sessionsRef$current$2","session","_onFinishS3Put","_getSignedUrl","isCurrent","fail","message","_onErrorRef$current2","storedKey","S3Upload","files","preprocess","target","onProgress","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","callback","_data","wrap","_context","getS3SignedUrl","data","sent","file_name","signedUrl","signed_url","t0","stop","_x","_x2","apply","this","arguments","onFinishS3Put","_callee2","_context2","getSignedLink","abrupt","size","addLinkedImage","_onErrorRef$current3","getUrlFileName","length","some","_entry$uploaded","_toConsumableArray","addFiles","_onErrorRef$current5","_ref2","_entriesRef$current$f3","_entriesRef$current$f4","supported","split","rule","trim","toLowerCase","endsWith","slice","getAttachmentKind","isAcceptedType","unsupported","tooMany","room","_onErrorRef$current4","accepted","added","kind","isTooLarge","createObjectURL","overflow","handleFileSelect","event","_event$target$files","Array","from","openFileDialog","_fileInputRef$current","click","removeAttachment","key","String","handleRetry","item","reorderAttachments","orderedIds","byId","reordered","missing","clearAttachments","_onErrorRef$current6","_onErrorRef$current7","a","b","every","index","_useState3","reduce","acc","src","peekSignedLink","_useState4","storedSrcs","setStoredSrcs","storedSrcsRef","storedNames","join","pending","isActive","Promise","all","then","catch","console","resolved","_objectSpread","Object","fromEntries","items","_entry$error","push","hideDownload","undefined","stored","count","isFull"],"mappings":"myCA0CO,IAAMA,EAA0B,GAoBjCC,EAAc,SAACC,GACnB,OAAIA,EAAKC,KAAKC,WAAW,UAAkB,QACvCF,EAAKC,KAAKC,WAAW,UAAkB,QACpC,MACT,EAEMC,EAAW,SAACC,GAAa,OAAMA,EAAK,SAAkBC,QAAQ,EAAE,EAQhEC,EAAgB,SAACC,GAA8B,MAAa,CAChEC,GAAID,EAAWE,IACfC,KAAMH,EAAWG,KACjBV,KAAM,KACNW,WAAY,GACZC,aAAa,EACbC,MAAO,KACPC,SAAUP,EACX,EAEGQ,EAAW,EACTC,EAAc,WAElB,MAAA,cAAAC,OADAF,GAAY,EAEd,EAEaG,EAAsB,SAODC,GAAA,IAAAC,EAAAC,EANhCC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,QACAC,IAAAA,aAAYC,EAAAP,EACZQ,SAAAA,aAvDqC,GAuDHD,EAAAE,EAAAT,EAClCU,OAAAA,aAASC,EAAyBF,EAEJG,EAAAA,EAAkB,IAAGC,EAAAC,EAAAC,EAAA,GAA5CC,EAAOH,EAAA,GAAEI,EAAUJ,EAAA,GAEpBK,EAAeC,EAAyB,MACxCC,EAAeD,EAAO,IAAIE,KAE1BC,EAAcH,EAAO,IAAIE,KAEzBE,EAAaJ,EAAgB,IAC7BK,EAAcL,EAAOf,GACrBqB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EAAOjM,KAAMyK,IAAAA,EAAKhC,KAAAA,EAAM5B,KAAMoF,EAAOpF,KAAMkF,cAAc,IACjFvB,GAH6BA,CAIrC,GAAE,IAID7I,aAAAA,EACAuH,eAAAA,EACAL,iBAAAA,EACAxB,SAAAA,EACAP,eAAAA,EACAuC,iBAAAA,EACAG,YAAAA,EACAE,mBAAAA,GACAK,iBAAAA,GACA7J,YAAauB,EAAQyF,MAAK,SAAAxE,GAAK,OAAIA,EAAMxC,eACzCC,MAAgD,UAAzC,UAAAsB,EAAQqC,MAAK,SAAApB,GAAK,OAAIA,EAAMvC,KAAK,WAAjC,IAAAQ,OAAA,EAAAA,EAAoCR,aAAK,IAAAO,EAAAA,EAAI,KACpDwL,MAAOzK,EAAQwF,OACfkF,OAAQ1K,EAAQwF,QAAUhG,EAC1BA,SAAAA,EAEJ"}
|
|
1
|
+
{"version":3,"file":"useAttachmentUpload.js","sources":["../../../src/components/CommentComposer/useAttachmentUpload.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\n\nimport type {\n AttachmentKind,\n AttachmentPreviewItem,\n} from '../AttachmentPreview/AttachmentPreview.types';\nimport { getAttachmentKind } from '../AttachmentPreview/getAttachmentKind';\nimport { ACCEPTED_ATTACHMENT_TYPES } from '../AttachFileButton';\n\nimport { getS3SignedUrl } from '~/clients/jsonApi';\nimport { getUrlFileName } from '~/utils/links';\nimport { getSignedLink, peekSignedLink } from '~/utils/signedLinkCache';\n\nexport type UploadedAttachment = {\n url: string;\n name: string;\n size?: number;\n};\n\ntype UseAttachmentUploadOptions = {\n value: UploadedAttachment[];\n onChange: (attachments: UploadedAttachment[]) => void;\n onError?: (message: string | null) => void;\n maxSizeBytes?: number;\n maxFiles?: number;\n /** Mirrors the file input's `accept`; also gates drag-and-drop. */\n accept?: string;\n};\n\n/** A picked or already-stored file, in the order the user arranged it. */\ntype Entry = {\n id: string;\n name: string;\n /** Set while the file is local; cleared entries come from `value`. */\n file: File | null;\n previewUrl: string;\n isUploading: boolean;\n error: string | null;\n uploaded: UploadedAttachment | null;\n};\n\nexport const DEFAULT_MAX_ATTACHMENTS = 10;\n\n/** Same rules the file input enforces via `accept`, so drag-and-drop can't smuggle a type past it. */\nconst isAcceptedType = (file: File, accept: string) =>\n accept\n .split(',')\n .map(rule => rule.trim().toLowerCase())\n .filter(Boolean)\n .some(rule => {\n if (rule.startsWith('.')) return file.name.toLowerCase().endsWith(rule);\n if (rule.endsWith('/*')) {\n const type = file.type.toLowerCase();\n if (type) return type.startsWith(rule.slice(0, -1));\n\n return getAttachmentKind({ name: file.name }) === rule.slice(0, -1);\n }\n\n return file.type.toLowerCase() === rule;\n });\n\nconst getFileKind = (file: File): AttachmentKind => {\n if (file.type.startsWith('image/')) return 'image';\n if (file.type.startsWith('video/')) return 'video';\n return 'file';\n};\n\nconst formatMb = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);\n\nconst getUploaded = (entries: Entry[]) =>\n entries.map(entry => entry.uploaded).filter(Boolean) as UploadedAttachment[];\n\nconst isSameList = (a: UploadedAttachment[], b: UploadedAttachment[]) =>\n a.length === b.length && a.every((item, index) => item.url === b[index].url);\n\nconst toStoredEntry = (attachment: UploadedAttachment): Entry => ({\n id: attachment.url,\n name: attachment.name,\n file: null,\n previewUrl: '',\n isUploading: false,\n error: null,\n uploaded: attachment,\n});\n\nlet entrySeq = 0;\nconst nextEntryId = () => {\n entrySeq += 1;\n return `attachment-${entrySeq}`;\n};\n\nexport const useAttachmentUpload = ({\n value,\n onChange,\n onError,\n maxSizeBytes,\n maxFiles = DEFAULT_MAX_ATTACHMENTS,\n accept = ACCEPTED_ATTACHMENT_TYPES,\n}: UseAttachmentUploadOptions) => {\n const [entries, setEntries] = useState<Entry[]>([]);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n const uploadersRef = useRef(new Map<string, S3Upload>());\n // Bumped per attempt so a superseded upload can't write state for a restarted entry.\n const sessionsRef = useRef(new Map<string, number>());\n // Mutations are driven from async upload callbacks, so the latest list lives in a ref.\n const entriesRef = useRef<Entry[]>([]);\n const onChangeRef = useRef(onChange);\n const onErrorRef = useRef(onError);\n\n onChangeRef.current = onChange;\n onErrorRef.current = onError;\n\n // What we last handed the parent. A `value` that still matches it is our own change echoing\n // back; anything else is a parent-driven reset we must adopt.\n const emittedRef = useRef<UploadedAttachment[]>([]);\n\n const commit = useCallback((updater: (prev: Entry[]) => Entry[]) => {\n const next = updater(entriesRef.current);\n entriesRef.current = next;\n setEntries(next);\n emittedRef.current = getUploaded(next);\n onChangeRef.current(emittedRef.current);\n }, []);\n\n const patchEntry = useCallback(\n (id: string, patch: Partial<Entry>) =>\n commit(prev => prev.map(entry => (entry.id === id ? { ...entry, ...patch } : entry))),\n [commit]\n );\n\n const abortUpload = useCallback((id: string) => {\n uploadersRef.current.get(id)?.abortUpload();\n uploadersRef.current.delete(id);\n // Bump, never delete: deleting would let the next attempt reuse session 1, so a callback\n // still in flight from the aborted attempt would pass `isCurrent` and clobber it.\n sessionsRef.current.set(id, (sessionsRef.current.get(id) ?? 0) + 1);\n }, []);\n\n const releasePreview = useCallback((entry?: Entry) => {\n if (entry?.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n }, []);\n\n // The banner is shared by every tile, so recompute it rather than clear it — one file\n // succeeding must not hide a sibling that is still failing.\n const syncError = useCallback(() => {\n onErrorRef.current?.(entriesRef.current.find(entry => entry.error)?.error ?? null);\n }, []);\n\n useEffect(\n () => () => {\n uploadersRef.current.forEach(uploader => uploader.abortUpload());\n uploadersRef.current.clear();\n entriesRef.current.forEach(entry => {\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n },\n []\n );\n\n const startUpload = useCallback(\n (id: string, file: File) => {\n const session = (sessionsRef.current.get(id) ?? 0) + 1;\n sessionsRef.current.set(id, session);\n // A superseded upload must not write state for an entry that is gone or restarted.\n const isCurrent = () => sessionsRef.current.get(id) === session;\n\n const fail = (message: string) => {\n if (!isCurrent()) return;\n patchEntry(id, { isUploading: false, error: message });\n onErrorRef.current?.(message);\n };\n\n let storedKey = '';\n\n const uploader = new S3Upload({\n files: [file],\n preprocess: (target: File, next: (file: File) => void) => next(target),\n onProgress: () => {},\n getSignedUrl: async (\n target: File,\n callback: (data: { signedUrl: string; [key: string]: unknown }) => void\n ) => {\n try {\n const data = await getS3SignedUrl(target.name, target.type);\n storedKey = data.file_name;\n callback({ ...data, signedUrl: data.signed_url });\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onFinishS3Put: async () => {\n try {\n const url = await getSignedLink(storedKey);\n if (!isCurrent()) return;\n\n uploadersRef.current.delete(id);\n patchEntry(id, {\n isUploading: false,\n error: null,\n uploaded: { url, name: storedKey, size: file.size },\n });\n syncError();\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onError: (message: string) => fail(message || 'Failed to upload the file'),\n });\n\n uploadersRef.current.set(id, uploader);\n },\n [patchEntry, syncError]\n );\n\n /** Nothing is uploaded: a comment attachment is a url, so the link itself is the attachment. */\n const addLinkedImage = useCallback(\n (url: string) => {\n const name = getUrlFileName(url);\n\n if (!name) return;\n if (entriesRef.current.length >= maxFiles) {\n onErrorRef.current?.(`You can attach up to ${maxFiles} files.`);\n\n return;\n }\n\n if (entriesRef.current.some(entry => entry.uploaded?.url === url)) return;\n\n commit(prev => [\n ...prev,\n {\n id: nextEntryId(),\n name,\n file: null,\n previewUrl: url,\n isUploading: false,\n error: null,\n uploaded: { url, name },\n },\n ]);\n },\n [commit, maxFiles]\n );\n\n /** Attaches files already in S3 (e.g. Wellhub picks): nothing to upload, the key is signed. */\n const addStoredFiles = useCallback(\n async (files: { fileName: string; size?: number }[]) => {\n const fresh = files.filter(\n (file, index, list) =>\n !entriesRef.current.some(entry => entry.uploaded?.name === file.fileName) &&\n list.findIndex(other => other.fileName === file.fileName) === index\n );\n if (!fresh.length) return;\n\n const room = maxFiles - entriesRef.current.length;\n if (room <= 0) {\n onErrorRef.current?.(`You can attach up to ${maxFiles} files.`);\n\n return;\n }\n\n const accepted = fresh.slice(0, room);\n const signed = await Promise.all(\n accepted.map(file =>\n getSignedLink(file.fileName)\n .then(url => ({ url, name: file.fileName, size: file.size }))\n .catch(() => null)\n )\n );\n const attachments = signed.filter(Boolean) as UploadedAttachment[];\n\n // Files may have been dropped in while the keys were signing, so re-check the room.\n let added = 0;\n if (attachments.length) {\n commit(prev => {\n const fitting = attachments.slice(0, Math.max(maxFiles - prev.length, 0));\n added = fitting.length;\n\n return [\n ...prev,\n ...fitting.map(attachment => ({ ...toStoredEntry(attachment), id: nextEntryId() })),\n ];\n });\n }\n\n const failed = signed.length - attachments.length;\n const overflow = fresh.length > accepted.length || added < attachments.length;\n onErrorRef.current?.(\n (failed &&\n `Could not attach ${failed === 1 ? 'a file' : `${failed} files`} from Wellhub.`) ||\n (overflow && `You can attach up to ${maxFiles} files.`) ||\n entriesRef.current.find(entry => entry.error)?.error ||\n null\n );\n },\n [commit, maxFiles]\n );\n\n const addFiles = useCallback(\n (files: File[]) => {\n const supported = files.filter(file => isAcceptedType(file, accept));\n const skipped = supported.length < files.length;\n // One banner, one message: report the most actionable reason once, at the end. Reporting\n // as we go would let a later call overwrite an earlier warning on a mixed drop.\n const unsupported = skipped\n ? (files.length === 1 && 'That file type is not supported.') ||\n 'Some files were skipped — unsupported file type.'\n : null;\n const tooMany = `You can attach up to ${maxFiles} files.`;\n\n const room = maxFiles - entriesRef.current.length;\n if (!supported.length || room <= 0) {\n onErrorRef.current?.(supported.length ? tooMany : unsupported);\n return;\n }\n\n const accepted = supported.slice(0, room);\n const added: Entry[] = accepted.map(file => {\n const kind = getFileKind(file);\n const isTooLarge = !!maxSizeBytes && file.size > maxSizeBytes;\n\n return {\n id: nextEntryId(),\n name: file.name,\n file,\n previewUrl: kind === 'file' ? '' : URL.createObjectURL(file),\n isUploading: !isTooLarge,\n error: isTooLarge\n ? `File is too large (${formatMb(file.size)} MB). Maximum size is ${formatMb(\n maxSizeBytes as number\n )} MB.`\n : null,\n uploaded: null,\n };\n });\n\n commit(prev => [...prev, ...added]);\n\n const overflow = supported.length > accepted.length ? tooMany : null;\n onErrorRef.current?.(\n entriesRef.current.find(entry => entry.error)?.error ?? unsupported ?? overflow\n );\n\n added\n .filter(entry => !entry.error)\n .forEach(entry => startUpload(entry.id, entry.file as File));\n },\n [commit, maxFiles, maxSizeBytes, startUpload, accept]\n );\n\n const handleFileSelect = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files ?? []);\n // Reset the input so re-picking the same file still fires a change event.\n if (fileInputRef.current) fileInputRef.current.value = '';\n if (files.length) addFiles(files);\n },\n [addFiles]\n );\n\n const openFileDialog = useCallback(() => fileInputRef.current?.click(), []);\n\n const removeAttachment = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n abortUpload(key);\n releasePreview(entriesRef.current.find(entry => entry.id === key));\n commit(prev => prev.filter(entry => entry.id !== key));\n syncError();\n },\n [abortUpload, releasePreview, commit, syncError]\n );\n\n const handleRetry = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n const entry = entriesRef.current.find(item => item.id === key);\n if (!entry?.file) return;\n\n abortUpload(key);\n patchEntry(key, { isUploading: true, error: null });\n syncError();\n startUpload(key, entry.file);\n },\n [abortUpload, patchEntry, startUpload, syncError]\n );\n\n const reorderAttachments = useCallback(\n (orderedIds: AttachmentPreviewItem['id'][]) =>\n commit(prev => {\n const byId = new Map(prev.map(entry => [entry.id, entry]));\n const reordered = orderedIds.map(id => byId.get(String(id))).filter(Boolean) as Entry[];\n // Unlisted ids (a race with a removal) keep their place at the end.\n const missing = prev.filter(entry => !orderedIds.some(id => String(id) === entry.id));\n return [...reordered, ...missing];\n }),\n [commit]\n );\n\n const clearAttachments = useCallback(() => {\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n releasePreview(entry);\n });\n commit(() => []);\n onErrorRef.current?.(null);\n }, [abortUpload, commit, releasePreview]);\n\n // Adopt a value we didn't produce — an edit form's initial attachments, or a parent-side reset.\n // Compared against what we emitted, not against the current entries: a failed-only or\n // mid-upload list emits `[]` too, and treating that as \"in sync\" would strand those tiles\n // on screen and let a late upload write itself back into freshly reset parent state.\n useEffect(() => {\n if (isSameList(emittedRef.current, value)) return;\n\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n entriesRef.current = value.map(toStoredEntry);\n emittedRef.current = value;\n setEntries(entriesRef.current);\n onErrorRef.current?.(null);\n }, [value, abortUpload]);\n\n // A stored url has expired by now, so re-sign it for the preview.\n const [storedSrcs, setStoredSrcs] = useState<Record<string, string>>(() =>\n value.reduce<Record<string, string>>((acc, attachment) => {\n const src = peekSignedLink(attachment.name, 'inline');\n if (src) acc[attachment.name] = src;\n\n return acc;\n }, {})\n );\n const storedSrcsRef = useRef(storedSrcs);\n storedSrcsRef.current = storedSrcs;\n\n const storedNames = entries\n // A linked image carries its own url, so there is no key of ours to sign.\n .filter(entry => !entry.file && !entry.previewUrl && entry.uploaded)\n .map(entry => (entry.uploaded as UploadedAttachment).name)\n .join('|');\n\n useEffect(() => {\n const pending = storedNames.split('|').filter(name => name && !(name in storedSrcsRef.current));\n if (!pending.length) return undefined;\n\n let isActive = true;\n Promise.all(\n pending.map(name =>\n getSignedLink(name, 'inline')\n .then(url => [name, url] as const)\n .catch(error => {\n console.error(`Failed to sign stored attachment \"${name}\"`, error);\n\n return [name, ''] as const;\n })\n )\n ).then(resolved => {\n if (isActive) setStoredSrcs(prev => ({ ...prev, ...Object.fromEntries(resolved) }));\n });\n\n return () => {\n isActive = false;\n };\n }, [storedNames]);\n\n const items = entries.reduce<AttachmentPreviewItem[]>((acc, entry) => {\n if (entry.file) {\n acc.push({\n id: entry.id,\n name: entry.name,\n src: entry.previewUrl,\n kind: getFileKind(entry.file),\n size: entry.file.size,\n isUploading: entry.isUploading,\n hideDownload: true,\n error: entry.error ?? undefined,\n });\n return acc;\n }\n\n const stored = entry.uploaded as UploadedAttachment;\n const kind = getAttachmentKind(stored);\n // A linked image is already a url; only one of ours has an S3 key worth signing.\n const src = entry.previewUrl || storedSrcs[stored.name];\n // A thumbnail without its signed url would paint as a broken image, so hold it back.\n if (kind !== 'file' && !src) return acc;\n\n acc.push({ id: entry.id, name: stored.name, src, kind, size: stored.size, hideDownload: true });\n return acc;\n }, []);\n\n return {\n items,\n fileInputRef,\n openFileDialog,\n handleFileSelect,\n addFiles,\n addLinkedImage,\n addStoredFiles,\n removeAttachment,\n handleRetry,\n reorderAttachments,\n clearAttachments,\n isUploading: entries.some(entry => entry.isUploading),\n error: entries.find(entry => entry.error)?.error ?? null,\n count: entries.length,\n isFull: entries.length >= maxFiles,\n maxFiles,\n };\n};\n"],"names":["DEFAULT_MAX_ATTACHMENTS","getFileKind","file","type","startsWith","formatMb","bytes","toFixed","toStoredEntry","attachment","id","url","name","previewUrl","isUploading","error","uploaded","entrySeq","nextEntryId","concat","useAttachmentUpload","_ref","_entries$find$error","_entries$find","value","onChange","onError","maxSizeBytes","_ref$maxFiles","maxFiles","_ref$accept","accept","ACCEPTED_ATTACHMENT_TYPES","useState","_useState2","_slicedToArray","_useState","entries","setEntries","fileInputRef","useRef","uploadersRef","Map","sessionsRef","entriesRef","onChangeRef","onErrorRef","current","emittedRef","commit","useCallback","updater","next","map","entry","filter","Boolean","getUploaded","patchEntry","patch","prev","abortUpload","_uploadersRef$current","_sessionsRef$current$","get","delete","set","releasePreview","URL","revokeObjectURL","syncError","_onErrorRef$current","_entriesRef$current$f","_entriesRef$current$f2","find","useEffect","forEach","uploader","clear","startUpload","_sessionsRef$current$2","session","_onFinishS3Put","_getSignedUrl","isCurrent","fail","message","_onErrorRef$current2","storedKey","S3Upload","files","preprocess","target","onProgress","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","callback","_data","wrap","_context","getS3SignedUrl","data","sent","file_name","signedUrl","signed_url","t0","stop","_x","_x2","apply","this","arguments","onFinishS3Put","_callee2","_context2","getSignedLink","abrupt","size","addLinkedImage","_onErrorRef$current3","getUrlFileName","length","some","_entry$uploaded","_toConsumableArray","addStoredFiles","_ref2","_onErrorRef$current5","_entriesRef$current$f3","fresh","room","_onErrorRef$current4","accepted","signed","attachments","added","failed","overflow","_context3","index","list","_entry$uploaded2","fileName","findIndex","other","slice","Promise","all","then","catch","fitting","Math","max","_callee3","_x3","addFiles","_onErrorRef$current7","_ref3","_entriesRef$current$f4","_entriesRef$current$f5","supported","split","rule","trim","toLowerCase","endsWith","getAttachmentKind","isAcceptedType","unsupported","tooMany","_onErrorRef$current6","kind","isTooLarge","createObjectURL","handleFileSelect","event","_event$target$files","Array","from","openFileDialog","_fileInputRef$current","click","removeAttachment","key","String","handleRetry","item","reorderAttachments","orderedIds","byId","reordered","missing","clearAttachments","_onErrorRef$current8","_onErrorRef$current9","a","b","every","_useState3","reduce","acc","src","peekSignedLink","_useState4","storedSrcs","setStoredSrcs","storedSrcsRef","storedNames","join","pending","isActive","console","resolved","_objectSpread","Object","fromEntries","items","_entry$error","push","hideDownload","undefined","stored","count","isFull"],"mappings":"myCA0CO,IAAMA,EAA0B,GAoBjCC,EAAc,SAACC,GACnB,OAAIA,EAAKC,KAAKC,WAAW,UAAkB,QACvCF,EAAKC,KAAKC,WAAW,UAAkB,QACpC,MACT,EAEMC,EAAW,SAACC,GAAa,OAAMA,EAAK,SAAkBC,QAAQ,EAAE,EAQhEC,EAAgB,SAACC,GAA8B,MAAa,CAChEC,GAAID,EAAWE,IACfC,KAAMH,EAAWG,KACjBV,KAAM,KACNW,WAAY,GACZC,aAAa,EACbC,MAAO,KACPC,SAAUP,EACX,EAEGQ,EAAW,EACTC,EAAc,WAElB,MAAA,cAAAC,OADAF,GAAY,EAEd,EAEaG,EAAsB,SAODC,GAAA,IAAAC,EAAAC,EANhCC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,QACAC,IAAAA,aAAYC,EA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,EAAK9B,KAAAA,EAAMtD,KAAMwG,EAAOxG,KAAMsG,cAAc,IACjFnB,GAH6BA,CAIrC,GAAE,IAIDrK,aAAAA,EACAgJ,eAAAA,EACAL,iBAAAA,EACAnB,SAAAA,EACArC,eAAAA,EACAO,eAAAA,EACAyD,iBAAAA,EACAG,YAAAA,GACAE,mBAAAA,GACAK,iBAAAA,GACAtL,YAAauB,EAAQyF,MAAK,SAAAxE,GAAK,OAAIA,EAAMxC,eACzCC,MAAgD,UAAzC,UAAAsB,EAAQqC,MAAK,SAAApB,GAAK,OAAIA,EAAMvC,KAAK,WAAjC,IAAAQ,OAAA,EAAAA,EAAoCR,aAAK,IAAAO,EAAAA,EAAI,KACpD4M,MAAO7L,EAAQwF,OACfsG,OAAQ9L,EAAQwF,QAAUhG,EAC1BA,SAAAA,EAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import o from"@babel/runtime/helpers/slicedToArray";import{useState as t,createRef as s,useCallback as i,useEffect as n}from"react";import r from"prop-types";import p from"classnames";import{Modal as m,Typography as c,IconButton as a}from"@material-ui/core";import l from"@material-ui/icons/Close";import d from"@material-ui/icons/GetApp";import{useStyles as j}from"./styles.js";import"../DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js";import"../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js";import"../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js";import"@babel/runtime/helpers/objectWithoutProperties";import"lodash";import"../Modal/CorvaModal.scss.js";import"@icon-park/react/es/all";import{jsx as u,jsxs as C}from"react/jsx-runtime";import"../../icons/IconParkProvider.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import"../../utils/mobileDetect.js";import"../IconButton/index.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/appPackages.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../constants/corvaCompanyId.js";import"../GradientManager/configuration/constants.js";import"uuid";import"../IconMenu/index.js";import"../StyledMenuItem/index.js";import"../AppIcon/AppIcon.js";import"../DevCenter/AppHeader/AppHeader.js";import"../DevCenter/AppSideBar/AppSideBar.js";import"../DevCenter/AppsDataProvider/AppsDataProvider.js";import"../DevCenter/AppContext.js";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router-dom";import"query-string";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../utils/index.js";import"@material-ui/icons";import"../EmptyState/EmptyState.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/RemoveAppButton.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/SettingsAccordion.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/styles.js";import"@material-ui/pickers";import"@date-io/moment";import"moment";import"../../config/theme/index.js";import"../../hocs/withAssetEditorLockHOC.js";import"../ErrorBoundary/ErrorBoundary.js";import"../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../Button/components/Button/index.js";import"moment-timezone";import"../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../Button/components/LiveButton/styles.js";import"../AssetEditorV2/index.js";import"../AppVersionsSelect/AppVersionsSelect.js";import"../DisabledSettingsMessage/DisabledSettingsMessage.js";import"../ConfirmationDialog.js";import"immutable";import"../../permissions/PermissionsContext.js";import"../../permissions/constants/index.js";import"../../permissions/withPermissionsHOC.js";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import"../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.constants.js";import"../Annotations/components/AnnotationsList/index.js";import"../Annotations/components/LastAnnotation/index.js";import"../Annotations/AnnotationsContext.js";import"../../componentsV2/AppContainer/AppContainer.js";import"../../componentsV2/AppContainer/AppContainer.constants.js";import"../../componentsV2/Text/Text.js";import"../../componentsV2/Header/Header.scss.js";import"../../componentsV2/Tooltip/Tooltip.scss.js";import"../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js";import"../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import"../../componentsV2/AppHeader/AppHeader.constants.js";import"../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js";import"../../componentsV2/Chip/Chip.js";import"../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js";import"../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js";import"../../componentsV2/AppHeader/AppAssets/utils.js";import"../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js";import"../PadModeSelect/PadModeSelect.js";import"../../componentsV2/AppHeader/PadMode/PadMode.scss.js";import"../../constants/streamSourceType.js";import"../../componentsV2/PadModeSelect/PadModeSelect.js";import"../../componentsV2/PadModeSelect/PadModeSelect.constants.js";import"../../componentsV2/AppCommonsProvider/AppCommonsProvider.js";import"../../componentsV2/utils.js";import"../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js";import"../../componentsV2/UniversalLink/UniversalLink.scss.js";import"../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js";import"../../componentsV2/Button/Button.js";import"../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js";import"../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.constants.js";import"../../componentsV2/Popover/Popover.js";import"@babel/runtime/helpers/toConsumableArray";import"../../componentsV2/Accordion/Accordion.scss.js";import"../../componentsV2/ButtonIcon/ButtonIcon.js";import"../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js";import"../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js";import"../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js";import"../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js";import"../../componentsV2/AppDqPopover/AppDqPopover.scss.js";import"../../componentsV2/Menu/Menu.js";import"../../componentsV2/ModalWindow/ModalWindow.js";import"../../componentsV2/Modal/Modal.scss.js";import"../../componentsV2/LoaderLogo/LoaderLogo.constants.js";import"../../componentsV2/LoaderLogo/LoaderLogo.scss.js";import"../../utils/getSingleAsset.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js";import"../../componentsV2/TextInput/TextInput.js";import"../../componentsV2/AppHeader/V3/AssetSelector/constants.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js";import"../../componentsV2/ChipIndicator/ChipIndicator.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js";import"../../clients/subscriptions/constants.js";import"querystring";import"uuid/v1";import"../../clients/subscriptions.v1.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"jsona";import"../../utils/env.js";import"../StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import"../../componentsV2/AppPanel/AppPanelsContext.js";import"../../componentsV2/AppHeader/V3/AppTitle/AppTitle.constants.js";import"../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js";import"../../componentsV2/AppHeader/V3/constants.scss.js";import"@babel/runtime/helpers/typeof";import"../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.constants.js";import"../../componentsV2/AppHeader/V3/Actions/Actions.constants.js";import"../../componentsV2/AppHeader/V3/Actions/Actions.scss.js";import"../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js";import"../../componentsV2/AppHeader/AppHeader.scss.js";import"../../componentsV2/EmptyState/EmptyState.scss.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/DevCenterAppView.scss.js";import"../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js";import"../../componentsV2/Grid/Grid.js";import"../../componentsV2/Grid/Cell.js";import"../../componentsV2/PopoverPanel/PopoverPanel.js";import"../../componentsV2/Radio/Radio.js";import"../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js";import"../../componentsV2/Checkbox/Checkbox.js";import"../../componentsV2/TextInputNext/TextInputNext.js";import"../../componentsV2/TextArea/TextArea.js";import"../../componentsV2/Label/Label.js";import"../../componentsV2/TextLink/TextLink.js";import"../../componentsV2/ChipAlert/ChipAlert.js";import"../../componentsV2/Avatar/Avatar.js";import"../../componentsV2/AvatarGroup/AvatarGroup.js";import"@material-ui/lab";import"../../componentsV2/ToggleButtons/ToggleButtons.scss.js";import"../../componentsV2/Paper/Paper.js";import"../../componentsV2/Hint/Hint.scss.js";import"../../componentsV2/Counter/Counter.js";import"../../componentsV2/BadgeBase/BadgeBase.scss.js";import"../../componentsV2/TemplatesControl/TemplatesControl.js";import"zustand";import"../../componentsV2/TemplatesControl/utils.js";import"../../componentsV2/TemplatesControl/icons/folder/index.js";import"../../componentsV2/TemplatesControl/Store/utils.js";import"../../componentsV2/TemplatesControl/types.js";import"../../componentsV2/BadgeDot/BadgeDot.scss.js";import"../../componentsV2/LoaderLinear/LoaderLinear.scss.js";import"../../componentsV2/Switch/Switch.js";import"../../componentsV2/Tabs/Tabs.js";import"../../componentsV2/FileIcon/FileIcon.js";import"../../componentsV2/Tag/Tag.js";import"react-dropzone";import"../../componentsV2/FilesDropzone/FilesDropzone.scss.js";import"../../componentsV2/FilesLoader/FilesLoader.scss.js";import"file-extension";import"image-extensions";import"video-extensions";import"../../componentsV2/FilesProcessor/FilesProcessor.scss.js";import"../../componentsV2/Skeleton/Skeleton.scss.js";import"../../utils/main.js";import"../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js";import"../../componentsV2/Stepper/Step/Step.scss.js";import"../../componentsV2/Stepper/Stepper.scss.js";import"../../componentsV2/ButtonLive/ButtonLive.js";import"../../componentsV2/ButtonText/ButtonText.js";import"../../componentsV2/IndicatorLive/IndicatorLive.js";import"../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js";import"../../componentsV2/BadgeComment/BadgeComment.js";import"../../componentsV2/AppFooter/AppFooter.js";import"../../componentsV2/OffsetWellsButton/OffsetWellsButton.js";import"../../componentsV2/ChartAxisExtreme/ChartAxisExtreme.scss.js";import"highcharts";import"../../componentsV2/ChartAxisExtreme/ChartAxisExtremeDragTracker.js";import"../../componentsV2/Autocomplete/Autocomplete.js";import"../../componentsV2/Select/Select.js";import"../../componentsV2/AppPanel/AppPanel.js";import"../../componentsV2/AppSettingsDivider/AppSettingsDivider.scss.js";import"../../componentsV2/WellArchivedMessage/WellArchivedMessage.js";import"../../componentsV2/DatePicker/DatePicker.js";import"../../componentsV2/DragHandle/DragHandle.js";import"../../componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js";import"../../componentsV2/Slider/constants.js";import"../../componentsV2/Slider/components/SliderThumb.js";import"../../componentsV2/Slider/Slider.scss.js";import"../../componentsV2/SliderAdvanced/SliderAdvanced.js";import"react-color";import"../../componentsV2/ColorPicker/Swatches/Swatches.scss.js";import"../../componentsV2/ColorPicker/OpacityDragtracker/OpacityDragTracker.scss.js";import"../../componentsV2/ColorPicker/ColorPicker.scss.js";import"../../componentsV2/ChartHelper/ChartHelper.scss.js";import"../../componentsV2/Hotkey/Hotkey.js";import"@tanstack/react-query";import"../../componentsV2/InterventionEventSelector/useInterventionUnitEvents.js";import"../../componentsV2/InterventionEventSelector/InterventionEventSelector.scss.js";import"../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.css.js";import"../Icons/AnnotationIcon.js";import"../HelpCenter/HelpCenterIcon.js";import"../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/RestoreAppSizeButton.css.js";import"../DevCenter/DevCenterAppContainer/DevCenterAppContainer.scss.js";import"../Toaster/Toaster.js";import"../DevCenter/NavigationBar/NavigationBar.js";import"../DevCenter/SideBar/SideBar.js";import"../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../DevCenter/AppFilterPanelLayout/AppFilterPanelLayout.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../AssetEditor/index.js";import I from"../LoadingIndicator/LoadingIndicator.js";import"../Typography.js";import"../RealTimeValuesSidebar/RealTimeSidebar.js";import"../CollapsableSidebar.js";import"../DateTimePicker/index.js";import"../DatePicker/index.js";import"../SlateFormattedText/SlateFormattedText.js";import"../SlateFormattedText/RenderElements.js";import"slate";import"../ParameterCharts/ParameterCharts.js";import"../ParameterCharts/AddEditTrack.js";import"../ChartActionsList/ChartActionsList.js";import"../CopyToClipboard/CopyToClipboard.js";import"../AssetEditor/AssetEditorAutocomplete.js";import"../AssetEditor/SingleAssetEditor.js";import"../SettingEditors/ColorEditor/style.css.js";import"../SettingEditors/DropdownEditor/index.js";import"../SwitchControl/index.js";import"../ColorPicker/ColorPicker.js";import"../Chart/components/ChartButton.js";import"../Chart/components/ChartButtons.js";import"../Chart/components/ChartWrapper.js";import"../Chart/components/AxisDropdown.js";import"../Chart/components/ChartSelect.js";import"../Chart/ChartWrapperContext.js";import"../Chart/effects/useChartModifier.js";import"../Chart/components/buttons/HideAxesButton.js";import"../Chart/components/buttons/ChartTypeButton.js";import"../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../TruncatedText/index.js";import"../MiddleTruncatedText/MiddleTruncatedText.js";import"../RangeSlider/constants.js";import"../RangeSlider/Input.css.js";import"../RangeSlider/RangeSlider.css.js";import"../AdvancedSlider/AdvancedSlider.js";import"../Breadcrumbs/index.js";import"../VirtualizedTable/index.js";import"../EmptyView/EmptyView.js";import"../EmptyView/EmptyAppView/EmptyAppView.js";import"../ContextMenuItem/index.js";import"../FolderMenuItem/index.js";import"../EditableItem/EditableItem/index.js";import"../EditableItem/EditableItemWithBadge/index.js";import"../Checkbox/index.js";import"../FolderMenuItemWithLinks/index.js";import"../TextField/index.js";import"../Chip/index.js";import"../Counter/index.js";import"../AnchorsList/AnchorsList.js";import"../Select/index.js";import"../Select/SelectFilterBy.js";import"../CustomSelect/index.js";import"../Tabs/Tabs.js";import"../Tabs/Tab.js";import"../ResizableTable/ResizableTable.js";import"../GradientPicker/GradientPicker.js";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"../GradientManager/GradientPreview/GradientPreview.js";import"../GradientManager/GradientSelect.scss.js";import"../GradientManager/GradientManager.styles.js";import"../Drillstring/BHASchematic.js";import"../Drillstring/BHATable/index.js";import"../Drillstring/BHAComponentIcon.js";import"../Drillstring/BHAComponentDetail/index.js";import"../Drillstring/BHATileIcon.js";import"../Drillstring/BHATile/BHATile.js";import"../Drillstring/BHAList/BHAList.js";import"../Drillstring/BHAComponentsTable/BHAComponentsTable.js";import"../Casing/CasingTable/index.js";import"../Casing/CasingComponentIcon.js";import"../Casing/CasingTileIcon.js";import"../Casing/CasingTableV2/CasingTableV2.js";import"../Casing/CasingTile/CasingTile.js";import"../WellSummary/WellSummaryItemLabel.js";import"../WellSummary/WellSummaryItemTitle.js";import"../WellSummary/WellSummaryItemValue.js";import"../WellSummary/ActivitySummaryChart.js";import"../WellSummary/FracWirelineTimeChart.js";import"../BICOffsetPickerDialog/index.js";import"../OffsetWellButton/OffsetWellButton.js";import"../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../OffsetWellPickerV3/index.js";import"../OffsetWellChips/Chip.js";import"../OffsetWellChips/ChipsContainer.js";import"../OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/OffsetWellPickerV5WithStore.js";import"mapbox-gl/dist/mapbox-gl.css";import"@material-ui/icons/Info";import"@material-ui/icons/Block";import"../OffsetWellMap/WellTooltip.module.css.js";import"../OffsetWellMap/OffsetWellMap.module.css.js";import"../../config/mapboxGl/index.js";import"../../config/mapbox/index.js";import"react-dom";import"@material-ui/core/Snackbar";import"../Notifications/Toast.js";import"../Notifications/Notifications.scss.js";import"../TextLink/index.js";import"../Avatar/index.js";import"../Template/TemplatePopover/index.js";import"../Template/TemplateSharingDialog/index.js";import"../MenuItem/index.js";import"../MiddleTruncate/MiddleTruncate.js";import"../PinnableFilters/PinnableFilters.js";import"../HeaderLayout/HeaderLayout.js";import"../PadOffsetsPicker/PadOffsetsPicker.js";import"../PadOffsetsPicker/OffsetAssetChip.js";import"../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../PadOffsetsPicker/StagesSelector.js";import"../PadOffsetsPickerV2/PadOffsetsPickerV2.js";import"../Table/TableToolbar/TableToolbar.js";import"../Table/TableContainer/TableContainer.js";import"../Table/TableCell/TableCell.js";import"../Table/TablePagination/TablePagination.js";import"../Table/TablePaginationActions/TablePaginationActions.js";import"../Tooltip/ScrollableTooltip.js";import"../PriceInput/PriceInput.js";import"../LabelsCounter/LabelsCounter.js";import"../Stepper/Stepper.js";import"../Stepper/Step/Step.js";import"../Stepper/StepsWrapper.js";import"../Comment/CommentIcon/index.js";import"../FilesLoader/FilesLoader.js";import"../../componentsV2/FileIcon/icons/ArchiveFileIcon.js";import"../../componentsV2/FileIcon/icons/CSVFileIcon.js";import"../../componentsV2/FileIcon/icons/DocFileIcon.js";import"../../componentsV2/FileIcon/icons/EDMFileIcon.js";import"../../componentsV2/FileIcon/icons/ExcelFileIcon.js";import"../../componentsV2/FileIcon/icons/ImageFileIcon.js";import"../../componentsV2/FileIcon/icons/JsonFileIcon.js";import"../../componentsV2/FileIcon/icons/LasFileIcon.js";import"../../componentsV2/FileIcon/icons/OtherFileIcon.js";import"../../componentsV2/FileIcon/icons/PdfFileIcon.js";import"../../componentsV2/FileIcon/icons/PowerPointFileIcon.js";import"../../componentsV2/FileIcon/icons/TxtFileIcon.js";import"../../componentsV2/FileIcon/icons/UnknownFileIcon.js";import"../../componentsV2/FileIcon/icons/VideoFileIcon.js";import"../../componentsV2/FileIcon/icons/XmlFileIcon.js";import"../SearchInput/index.js";import"../FeedItem/FeedItem.js";import"../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../PostInput/PostInput.js";import"../KeyboardDateTimePicker.js";import"../AddComment/Popover.js";import"../AddComment/Popup.js";import"../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../StageDesignVActual/ComparisonHeader.js";import"../StageDesignVActual/ComparisonRow.js";import"../EmbeddedApp/DevCenterEmbeddedApp.js";import"../EmbeddedApp/EmbeddedApp.js";import"../Autocomplete/Autocomplete.js";import"../ColorPickerPalette/ColorPickerPalette.js";import"../Search/Search.js";import"../Search/components/Listbox.js";import"../Search/components/Paper.js";import"../Search/components/RecentSearches.js";import"../Search/components/Groups.js";import"../Search/components/SelectAllListItem.js";import"../StatusBadge/index.js";import"../Attachment/index.js";import"../EmojiIconButton.js";import"../FileUploadIconButton.js";import"../FilePreview/index.js";import"../FailedFileUploading.js";import"../UserMention/index.js";import"../CommentsInfo/index.js";import"../CommentInput/index.js";import"../Comment/index.js";import"../CommentLoader.js";import"../AssetNameLabel/AssetStatusBadge.js";import"../AssetEditorV2/components/PrimaryAssetSelect.js";import"../AssetEditorV2/components/SecondaryAssetSelect.js";import"../AssetEditorV2/components/SelectItem.js";import"../AssetEditorV2/components/MultipleAssetsToggle.js";import"../AssetEditorV2/components/PrimaryAssetSelectV2.js";import"../EChartsWrapper/EChartsWrapper.js";import"../AssetsMultipleSelector/AssetsMultipleSelector.js";import"../GoogleDocsViewer/index.js";import"../NewDocumentViewer/effects/useFileContent.js";import"../NewDocumentViewer/styles.js";import"../FilesLoaderV2/styles.js";import"../FilesDropzone/styles.js";import"../FilesProcessor/styles.js";import"../Hint/styles.js";import"@babel/runtime/helpers/taggedTemplateLiteral";import"fparser";import"../Formula/useFormulaStyles.js";import"../Formula/RootXIcon.js";import"../Formula/FormulaTextEditor.js";import"../Formula/CloseSuggestion.js";import"../Formula/SuggestionsMenu.js";import"../CommentCard/CommentCard.js";import"@material-ui/icons/AlternateEmail";import"../AttachFileButton/AttachFileButton.scss.js";import"../CommentInputNext/CommentInputNext.js";import"../UserMention/utils/index.js";import"react-s3-uploader/s3upload";import"../CommentComposer/CommentMetaLine.scss.js";import"../CommentComposer/ChatChannelSelector.scss.js";import"../CommentComposer/ShareToChatRow.scss.js";import"../CommentComposer/CommentComposer.scss.js";import"../AttachmentPreview/AttachmentPreview.js";import"../AttachmentPreview/AttachmentImage.js";import"../AttachmentPreview/AttachmentPreview.scss.js";import"../CommentPin/CommentPin.js";import"../FeedCard/FeedCard.js";import"../FeedItemCard/FeedItemCard.js";import"../NewCommentCursor/NewCommentCursor.js";import"../LinkedText/LinkedText.js";import"../FeedItem/feedItemTypes/AlertFeedItem.js";import"../FeedItem/feedItemTypes/PostFeedItem.js";import"../FeedItem/feedItemTypes/GeosteeringFeedItem.js";import"../FeedItem/feedItemTypes/DrillingOperationalNoteFeedItem.js";import"../FeedItem/feedItemTypes/DrillingOperationSummaryFeedItem.js";import"../FeedItem/feedItemTypes/DrillingDailyCostFeedItem.js";import"../FeedItem/feedItemTypes/DocumentFeedItem.js";import"../FeedItem/feedItemTypes/DrillerMemoFeedItem.js";import"../FeedItem/feedItemTypes/NptFeedItem.js";import"../FeedItem/feedItemTypes/SurveyStationFeedItem/index.js";import"../FeedItem/feedItemTypes/LessonsLearnedFeedItem/index.js";import"../FeedItem/feedItemTypes/TracesMemoFeedItem.js";import"../FeedItem/feedItemTypes/DepthCommentFeedItem.js";import"../FeedItem/feedItemTypes/CompletionOperationalNoteFeedItem.js";import"../FeedItem/feedItemTypes/CompletionOperationSummaryFeedItem.js";import"../FeedItem/feedItemTypes/CompletionDailyCostFeedItem.js";import"../FeedItem/feedItemTypes/CompletionDocumentFeedItem.js";import"../FeedItem/feedItemTypes/CompletionNptFeedItem.js";import"../FeedItem/feedItemTypes/StageOverviewFeedItem/index.js";import"../FeedItem/feedItemTypes/AppAnnotationFeedItem/index.js";import"../FeedItem/feedItemTypes/WellPlanFeedItem/index.js";import"../FeedItem/feedItemTypes/FluidReportFeedItem.js";import"../FeedItem/feedItemTypes/BhaFeedItem/BhaFeedItem.js";import"../FeedItem/feedItemTypes/DvDCommentFeedItem.js";import"../FeedItem/feedItemTypes/PCCommentFeedItem.js";import"../FeedItem/feedItemTypes/HookloadCommentFeedItem.js";import"../FeedItem/feedItemTypes/NptLessonsCommentFeedItem.js";import"../FeedItem/feedItemTypes/GenericDataCommentFeedItem.js";var A=function(r){var A=r.open,V=r.fileUrl,S=r.fileSize,F=r.fileName,T=r.webviewType,v=void 0===T?"google":T,h=r.onClose,g=t(!0),D=o(g,2),f=D[0],P=D[1],x=t(!1),b=o(x,2),y=b[0],B=b[1],k=s(null),E=s(null),L=j(),w=i((function(){return"office"===v?"https://view.officeapps.live.com/op/embed.aspx?src=".concat(window.encodeURIComponent(V)):"https://docs.google.com/viewer?url=".concat(encodeURIComponent(V),"&embedded=true")}),[V]),M=function(){E.current&&(E.current.src=w(),E.current.contentWindow.location.reload())},H=function(){k.current&&clearInterval(k.current),P(!1)};return n((function(){P(!0),B(!1);var e=S&&S>=1048576?S/1048576*1e4:1e4;return k&&A&&(clearInterval(k.current),k.current=setInterval(M,e)),function(){clearInterval(k.current)}}),[V,A]),u(m,{open:A,onClose:h,onContextMenu:function(e){return e.stopPropagation()},children:C("div",{className:L.cDocsViewer,children:[C("div",{className:L.cDocsViewerToolbar,children:[u(c,{children:F}),C("div",{children:[u(a,{size:"small",className:L.cDocsViewerToolbarIconButton,children:u("a",{download:!0,href:V,target:"_blank",rel:"noopener noreferrer",children:u(d,{fontSize:"small"})})}),u(a,{size:"small",onClick:h,className:L.cDocsViewerToolbarIconButton,children:u(l,{fontSize:"small"})})]})]}),f&&u("div",{className:L.cDocsViewerFrame,children:u(I,{white:!1})}),y?u("div",{className:L.cDocsViewerFrame,children:u(c,{variant:"body2",className:L.cDocsViewerFrameFailed,children:"Loading failed"})}):u("iframe",{className:p(L.cDocsViewerFrame,e({},L.cDocsViewerFrameHidden,f)),title:V,src:w(),onLoad:H,onError:function(){H(),B(!0)},ref:E})]})})};A.propTypes={open:r.bool.isRequired,fileUrl:r.string.isRequired,webviewType:r.oneOf(["google","office"]),fileName:r.string,fileSize:r.number,onClose:r.func.isRequired,classes:r.shape({}).isRequired};export{A as default};
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import o from"@babel/runtime/helpers/slicedToArray";import{useState as t,createRef as s,useCallback as i,useEffect as n}from"react";import r from"prop-types";import p from"classnames";import{Modal as m,Typography as c,IconButton as a}from"@material-ui/core";import l from"@material-ui/icons/Close";import d from"@material-ui/icons/GetApp";import{useStyles as j}from"./styles.js";import"../DevCenter/DevCenterAppContainer/components/IsInsideIsolatedDcAppProvider.js";import"../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js";import"../DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/IsInsideDcFullscreenElemProvider.js";import"@babel/runtime/helpers/objectWithoutProperties";import"lodash";import"../Modal/CorvaModal.scss.js";import"@icon-park/react/es/all";import{jsx as u,jsxs as C}from"react/jsx-runtime";import"../../icons/IconParkProvider.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/SearchOne.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import"../../utils/mobileDetect.js";import"../IconButton/index.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/appPackages.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../constants/corvaCompanyId.js";import"../GradientManager/configuration/constants.js";import"uuid";import"../IconMenu/index.js";import"../StyledMenuItem/index.js";import"../AppIcon/AppIcon.js";import"../DevCenter/AppHeader/AppHeader.js";import"../DevCenter/AppSideBar/AppSideBar.js";import"../DevCenter/AppsDataProvider/AppsDataProvider.js";import"../DevCenter/AppContext.js";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router-dom";import"query-string";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"../../utils/index.js";import"@material-ui/icons";import"../EmptyState/EmptyState.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/RemoveAppButton.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/components/SettingsAccordion.js";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/styles.js";import"@material-ui/pickers";import"@date-io/moment";import"moment";import"../../config/theme/index.js";import"../../hocs/withAssetEditorLockHOC.js";import"../ErrorBoundary/ErrorBoundary.js";import"../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../Button/components/Button/index.js";import"moment-timezone";import"../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../Button/components/LiveButton/styles.js";import"../AssetEditorV2/index.js";import"../AppVersionsSelect/AppVersionsSelect.js";import"../DisabledSettingsMessage/DisabledSettingsMessage.js";import"../ConfirmationDialog.js";import"immutable";import"../../permissions/PermissionsContext.js";import"../../permissions/constants/index.js";import"../../permissions/withPermissionsHOC.js";import"../../clients/jsonApi/index.js";import"../../permissions/ProvidePermissions.js";import"../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.constants.js";import"../Annotations/components/AnnotationsList/index.js";import"../Annotations/components/LastAnnotation/index.js";import"../Annotations/AnnotationsContext.js";import"../../componentsV2/AppContainer/AppContainer.js";import"../../componentsV2/AppContainer/AppContainer.constants.js";import"../../componentsV2/Text/Text.js";import"../../componentsV2/Header/Header.scss.js";import"../../componentsV2/Tooltip/Tooltip.scss.js";import"../../componentsV2/TextEndTruncated/TextEndTruncated.scss.js";import"../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import"../../componentsV2/AppHeader/AppHeader.constants.js";import"../../componentsV2/AppHeader/AppBadge/AppBadge.scss.js";import"../../componentsV2/Chip/Chip.js";import"../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.constants.js";import"../../componentsV2/TextMiddleTruncated/TextMiddleTruncated.scss.js";import"../../componentsV2/AppHeader/AppAssets/utils.js";import"../../componentsV2/AppHeader/AppAssets/AppAssets.scss.js";import"../PadModeSelect/PadModeSelect.js";import"../../componentsV2/AppHeader/PadMode/PadMode.scss.js";import"../../constants/streamSourceType.js";import"../../componentsV2/PadModeSelect/PadModeSelect.js";import"../../componentsV2/PadModeSelect/PadModeSelect.constants.js";import"../../componentsV2/AppCommonsProvider/AppCommonsProvider.js";import"../../componentsV2/utils.js";import"../../componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js";import"../../componentsV2/UniversalLink/UniversalLink.scss.js";import"../../componentsV2/AppHeader/V3/AssetChips/AssetChips.scss.js";import"../../componentsV2/Button/Button.js";import"../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.js";import"../../componentsV2/AppHeader/V3/DqStatusIcon/DqStatusIcon.constants.js";import"../../componentsV2/Popover/Popover.js";import"@babel/runtime/helpers/toConsumableArray";import"../../componentsV2/Accordion/Accordion.scss.js";import"../../componentsV2/ButtonIcon/ButtonIcon.js";import"../../componentsV2/AppFooter/DqPopover/DqStatusIcon/DqStatusIcon.js";import"../../componentsV2/AppDqPopover/DqAlertTooltip/DqAlertTooltip.scss.js";import"../../componentsV2/AppDqPopover/DqAlert/DqAlert.scss.js";import"../../componentsV2/AppDqPopover/DqAsset/DqAsset.scss.js";import"../../componentsV2/AppDqPopover/AppDqPopover.scss.js";import"../../componentsV2/Menu/Menu.js";import"../../componentsV2/ModalWindow/ModalWindow.js";import"../../componentsV2/Modal/Modal.scss.js";import"../../componentsV2/LoaderLogo/LoaderLogo.constants.js";import"../../componentsV2/LoaderLogo/LoaderLogo.scss.js";import"../../utils/getSingleAsset.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorChip/AssetSelectorChip.js";import"../../componentsV2/TextInput/TextInput.js";import"../../componentsV2/AppHeader/V3/AssetSelector/constants.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/AssetSelectorSelect.scss.js";import"../../componentsV2/ChipIndicator/ChipIndicator.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelectorSelect/loadAssets.js";import"../../componentsV2/AppHeader/V3/AssetSelector/AssetSelector.scss.js";import"../../clients/subscriptions/constants.js";import"querystring";import"uuid/v1";import"../../clients/subscriptions.v1.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"jsona";import"../../utils/env.js";import"../StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import"../../componentsV2/AppPanel/AppPanelsContext.js";import"../../componentsV2/AppHeader/V3/AppTitle/AppTitle.constants.js";import"../../componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js";import"../../componentsV2/AppHeader/V3/constants.scss.js";import"@babel/runtime/helpers/typeof";import"../../componentsV2/AppHeader/V3/SettingsButton/SettingsButton.constants.js";import"../../componentsV2/AppHeader/V3/Actions/Actions.constants.js";import"../../componentsV2/AppHeader/V3/Actions/Actions.scss.js";import"../../componentsV2/AppHeader/V3/AppHeaderV3.scss.js";import"../../componentsV2/AppHeader/AppHeader.scss.js";import"../../componentsV2/EmptyState/EmptyState.scss.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/DevCenterAppView.scss.js";import"../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.scss.js";import"../../componentsV2/Grid/Grid.js";import"../../componentsV2/Grid/Cell.js";import"../../componentsV2/PopoverPanel/PopoverPanel.js";import"../../componentsV2/Radio/Radio.js";import"../../componentsV2/RadioAndCheckboxGroup/RadioAndCheckboxGroup.scss.js";import"../../componentsV2/Checkbox/Checkbox.js";import"../../componentsV2/TextInputNext/TextInputNext.js";import"../../componentsV2/TextArea/TextArea.js";import"../../componentsV2/Label/Label.js";import"../../componentsV2/TextLink/TextLink.js";import"../../componentsV2/ChipAlert/ChipAlert.js";import"../../componentsV2/Avatar/Avatar.js";import"../../componentsV2/AvatarGroup/AvatarGroup.js";import"@material-ui/lab";import"../../componentsV2/ToggleButtons/ToggleButtons.scss.js";import"../../componentsV2/Paper/Paper.js";import"../../componentsV2/Hint/Hint.scss.js";import"../../componentsV2/Counter/Counter.js";import"../../componentsV2/BadgeBase/BadgeBase.scss.js";import"../../componentsV2/TemplatesControl/TemplatesControl.js";import"zustand";import"../../componentsV2/TemplatesControl/utils.js";import"../../componentsV2/TemplatesControl/icons/folder/index.js";import"../../componentsV2/TemplatesControl/Store/utils.js";import"../../componentsV2/TemplatesControl/types.js";import"../../componentsV2/BadgeDot/BadgeDot.scss.js";import"../../componentsV2/LoaderLinear/LoaderLinear.scss.js";import"../../componentsV2/Switch/Switch.js";import"../../componentsV2/Tabs/Tabs.js";import"../../componentsV2/FileIcon/FileIcon.js";import"../../componentsV2/Tag/Tag.js";import"react-dropzone";import"../../componentsV2/FilesDropzone/FilesDropzone.scss.js";import"../../componentsV2/FilesLoader/FilesLoader.scss.js";import"file-extension";import"image-extensions";import"video-extensions";import"../../componentsV2/FilesProcessor/FilesProcessor.scss.js";import"../../componentsV2/Skeleton/Skeleton.scss.js";import"../../utils/main.js";import"../../componentsV2/CopyToClipboard/CopyToClipboard.scss.js";import"../../componentsV2/Stepper/Step/Step.scss.js";import"../../componentsV2/Stepper/Stepper.scss.js";import"../../componentsV2/ButtonLive/ButtonLive.js";import"../../componentsV2/ButtonText/ButtonText.js";import"../../componentsV2/IndicatorLive/IndicatorLive.js";import"../../componentsV2/Breadcrumbs/Breadcrumbs.scss.js";import"../../componentsV2/BadgeComment/BadgeComment.js";import"../../componentsV2/AppFooter/AppFooter.js";import"../../componentsV2/OffsetWellsButton/OffsetWellsButton.js";import"../../componentsV2/ChartAxisExtreme/ChartAxisExtreme.scss.js";import"highcharts";import"../../componentsV2/ChartAxisExtreme/ChartAxisExtremeDragTracker.js";import"../../componentsV2/Autocomplete/Autocomplete.js";import"../../componentsV2/Select/Select.js";import"../../componentsV2/AppPanel/AppPanel.js";import"../../componentsV2/AppSettingsDivider/AppSettingsDivider.scss.js";import"../../componentsV2/WellArchivedMessage/WellArchivedMessage.js";import"../../componentsV2/DatePicker/DatePicker.js";import"../../componentsV2/DragHandle/DragHandle.js";import"../../componentsV2/CompletionsOffsetWellPicker/CompletionsOffsetWellPicker.js";import"../../componentsV2/Slider/constants.js";import"../../componentsV2/Slider/components/SliderThumb.js";import"../../componentsV2/Slider/Slider.scss.js";import"../../componentsV2/SliderAdvanced/SliderAdvanced.js";import"react-color";import"../../componentsV2/ColorPicker/Swatches/Swatches.scss.js";import"../../componentsV2/ColorPicker/OpacityDragtracker/OpacityDragTracker.scss.js";import"../../componentsV2/ColorPicker/ColorPicker.scss.js";import"../../componentsV2/ChartHelper/ChartHelper.scss.js";import"../../componentsV2/Hotkey/Hotkey.js";import"@tanstack/react-query";import"../../componentsV2/InterventionEventSelector/useInterventionUnitEvents.js";import"../../componentsV2/InterventionEventSelector/InterventionEventSelector.scss.js";import"../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.css.js";import"../Icons/AnnotationIcon.js";import"../HelpCenter/HelpCenterIcon.js";import"../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/RestoreAppSizeButton.css.js";import"../DevCenter/DevCenterAppContainer/DevCenterAppContainer.scss.js";import"../Toaster/Toaster.js";import"../DevCenter/NavigationBar/NavigationBar.js";import"../DevCenter/SideBar/SideBar.js";import"../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../DevCenter/AppFilterPanelLayout/AppFilterPanelLayout.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../AssetEditor/index.js";import I from"../LoadingIndicator/LoadingIndicator.js";import"../Typography.js";import"../RealTimeValuesSidebar/RealTimeSidebar.js";import"../CollapsableSidebar.js";import"../DateTimePicker/index.js";import"../DatePicker/index.js";import"../SlateFormattedText/SlateFormattedText.js";import"../SlateFormattedText/RenderElements.js";import"slate";import"../ParameterCharts/ParameterCharts.js";import"../ParameterCharts/AddEditTrack.js";import"../ChartActionsList/ChartActionsList.js";import"../CopyToClipboard/CopyToClipboard.js";import"../AssetEditor/AssetEditorAutocomplete.js";import"../AssetEditor/SingleAssetEditor.js";import"../SettingEditors/ColorEditor/style.css.js";import"../SettingEditors/DropdownEditor/index.js";import"../SwitchControl/index.js";import"../ColorPicker/ColorPicker.js";import"../Chart/components/ChartButton.js";import"../Chart/components/ChartButtons.js";import"../Chart/components/ChartWrapper.js";import"../Chart/components/AxisDropdown.js";import"../Chart/components/ChartSelect.js";import"../Chart/ChartWrapperContext.js";import"../Chart/effects/useChartModifier.js";import"../Chart/components/buttons/HideAxesButton.js";import"../Chart/components/buttons/ChartTypeButton.js";import"../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../TruncatedText/index.js";import"../MiddleTruncatedText/MiddleTruncatedText.js";import"../RangeSlider/constants.js";import"../RangeSlider/Input.css.js";import"../RangeSlider/RangeSlider.css.js";import"../AdvancedSlider/AdvancedSlider.js";import"../Breadcrumbs/index.js";import"../VirtualizedTable/index.js";import"../EmptyView/EmptyView.js";import"../EmptyView/EmptyAppView/EmptyAppView.js";import"../ContextMenuItem/index.js";import"../FolderMenuItem/index.js";import"../EditableItem/EditableItem/index.js";import"../EditableItem/EditableItemWithBadge/index.js";import"../Checkbox/index.js";import"../FolderMenuItemWithLinks/index.js";import"../TextField/index.js";import"../Chip/index.js";import"../Counter/index.js";import"../AnchorsList/AnchorsList.js";import"../Select/index.js";import"../Select/SelectFilterBy.js";import"../CustomSelect/index.js";import"../Tabs/Tabs.js";import"../Tabs/Tab.js";import"../ResizableTable/ResizableTable.js";import"../GradientPicker/GradientPicker.js";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"../GradientManager/GradientPreview/GradientPreview.js";import"../GradientManager/GradientSelect.scss.js";import"../GradientManager/GradientManager.styles.js";import"../Drillstring/BHASchematic.js";import"../Drillstring/BHATable/index.js";import"../Drillstring/BHAComponentIcon.js";import"../Drillstring/BHAComponentDetail/index.js";import"../Drillstring/BHATileIcon.js";import"../Drillstring/BHATile/BHATile.js";import"../Drillstring/BHAList/BHAList.js";import"../Drillstring/BHAComponentsTable/BHAComponentsTable.js";import"../Casing/CasingTable/index.js";import"../Casing/CasingComponentIcon.js";import"../Casing/CasingTileIcon.js";import"../Casing/CasingTableV2/CasingTableV2.js";import"../Casing/CasingTile/CasingTile.js";import"../WellSummary/WellSummaryItemLabel.js";import"../WellSummary/WellSummaryItemTitle.js";import"../WellSummary/WellSummaryItemValue.js";import"../WellSummary/ActivitySummaryChart.js";import"../WellSummary/FracWirelineTimeChart.js";import"../BICOffsetPickerDialog/index.js";import"../OffsetWellButton/OffsetWellButton.js";import"../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../OffsetWellPickerV3/index.js";import"../OffsetWellChips/Chip.js";import"../OffsetWellChips/ChipsContainer.js";import"../OffsetWellPickerV5/components/OffsetWellPickerV5WithStore/OffsetWellPickerV5WithStore.js";import"mapbox-gl/dist/mapbox-gl.css";import"@material-ui/icons/Info";import"@material-ui/icons/Block";import"../OffsetWellMap/WellTooltip.module.css.js";import"../OffsetWellMap/OffsetWellMap.module.css.js";import"../../config/mapboxGl/index.js";import"../../config/mapbox/index.js";import"react-dom";import"@material-ui/core/Snackbar";import"../Notifications/Toast.js";import"../Notifications/Notifications.scss.js";import"../TextLink/index.js";import"../Avatar/index.js";import"../Template/TemplatePopover/index.js";import"../Template/TemplateSharingDialog/index.js";import"../MenuItem/index.js";import"../MiddleTruncate/MiddleTruncate.js";import"../PinnableFilters/PinnableFilters.js";import"../HeaderLayout/HeaderLayout.js";import"../PadOffsetsPicker/PadOffsetsPicker.js";import"../PadOffsetsPicker/OffsetAssetChip.js";import"../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../PadOffsetsPicker/StagesSelector.js";import"../PadOffsetsPickerV2/PadOffsetsPickerV2.js";import"../Table/TableToolbar/TableToolbar.js";import"../Table/TableContainer/TableContainer.js";import"../Table/TableCell/TableCell.js";import"../Table/TablePagination/TablePagination.js";import"../Table/TablePaginationActions/TablePaginationActions.js";import"../Tooltip/ScrollableTooltip.js";import"../PriceInput/PriceInput.js";import"../LabelsCounter/LabelsCounter.js";import"../Stepper/Stepper.js";import"../Stepper/Step/Step.js";import"../Stepper/StepsWrapper.js";import"../Comment/CommentIcon/index.js";import"../FilesLoader/FilesLoader.js";import"../../componentsV2/FileIcon/icons/ArchiveFileIcon.js";import"../../componentsV2/FileIcon/icons/CSVFileIcon.js";import"../../componentsV2/FileIcon/icons/DocFileIcon.js";import"../../componentsV2/FileIcon/icons/EDMFileIcon.js";import"../../componentsV2/FileIcon/icons/ExcelFileIcon.js";import"../../componentsV2/FileIcon/icons/ImageFileIcon.js";import"../../componentsV2/FileIcon/icons/JsonFileIcon.js";import"../../componentsV2/FileIcon/icons/LasFileIcon.js";import"../../componentsV2/FileIcon/icons/OtherFileIcon.js";import"../../componentsV2/FileIcon/icons/PdfFileIcon.js";import"../../componentsV2/FileIcon/icons/PowerPointFileIcon.js";import"../../componentsV2/FileIcon/icons/TxtFileIcon.js";import"../../componentsV2/FileIcon/icons/UnknownFileIcon.js";import"../../componentsV2/FileIcon/icons/VideoFileIcon.js";import"../../componentsV2/FileIcon/icons/XmlFileIcon.js";import"../SearchInput/index.js";import"../FeedItem/FeedItem.js";import"../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../PostInput/PostInput.js";import"../KeyboardDateTimePicker.js";import"../AddComment/Popover.js";import"../AddComment/Popup.js";import"../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../StageDesignVActual/ComparisonHeader.js";import"../StageDesignVActual/ComparisonRow.js";import"../EmbeddedApp/DevCenterEmbeddedApp.js";import"../EmbeddedApp/EmbeddedApp.js";import"../Autocomplete/Autocomplete.js";import"../ColorPickerPalette/ColorPickerPalette.js";import"../Search/Search.js";import"../Search/components/Listbox.js";import"../Search/components/Paper.js";import"../Search/components/RecentSearches.js";import"../Search/components/Groups.js";import"../Search/components/SelectAllListItem.js";import"../StatusBadge/index.js";import"../Attachment/index.js";import"../EmojiIconButton.js";import"../FileUploadIconButton.js";import"../FilePreview/index.js";import"../FailedFileUploading.js";import"../UserMention/index.js";import"../CommentsInfo/index.js";import"../CommentInput/index.js";import"../Comment/index.js";import"../CommentLoader.js";import"../AssetNameLabel/AssetStatusBadge.js";import"../AssetEditorV2/components/PrimaryAssetSelect.js";import"../AssetEditorV2/components/SecondaryAssetSelect.js";import"../AssetEditorV2/components/SelectItem.js";import"../AssetEditorV2/components/MultipleAssetsToggle.js";import"../AssetEditorV2/components/PrimaryAssetSelectV2.js";import"../EChartsWrapper/EChartsWrapper.js";import"../AssetsMultipleSelector/AssetsMultipleSelector.js";import"../GoogleDocsViewer/index.js";import"../NewDocumentViewer/effects/useFileContent.js";import"../NewDocumentViewer/styles.js";import"../FilesLoaderV2/styles.js";import"../FilesDropzone/styles.js";import"../FilesProcessor/styles.js";import"../Hint/styles.js";import"@babel/runtime/helpers/taggedTemplateLiteral";import"fparser";import"../Formula/useFormulaStyles.js";import"../Formula/RootXIcon.js";import"../Formula/FormulaTextEditor.js";import"../Formula/CloseSuggestion.js";import"../Formula/SuggestionsMenu.js";import"../CommentCard/CommentCard.js";import"@material-ui/icons/AlternateEmail";import"../AttachFileButton/AttachFileButton.scss.js";import"../CommentInputNext/CommentInputNext.js";import"../UserMention/utils/index.js";import"../WellhubFilePicker/components/WellhubFileCard/WellhubFileCard.scss.js";import"../WellhubFilePicker/components/WellhubFilePickerView/WellhubFilePickerView.scss.js";import"react-s3-uploader/s3upload";import"../CommentComposer/CommentMetaLine.scss.js";import"../CommentComposer/ChatChannelSelector.scss.js";import"../CommentComposer/ShareToChatRow.scss.js";import"../CommentComposer/CommentComposer.scss.js";import"../AttachmentPreview/AttachmentPreview.js";import"../AttachmentPreview/AttachmentImage.js";import"../AttachmentPreview/AttachmentPreview.scss.js";import"../CommentPin/CommentPin.js";import"../FeedCard/FeedCard.js";import"../FeedItemCard/FeedItemCard.js";import"../NewCommentCursor/NewCommentCursor.js";import"../LinkedText/LinkedText.js";import"../FeedItem/feedItemTypes/AlertFeedItem.js";import"../FeedItem/feedItemTypes/PostFeedItem.js";import"../FeedItem/feedItemTypes/GeosteeringFeedItem.js";import"../FeedItem/feedItemTypes/DrillingOperationalNoteFeedItem.js";import"../FeedItem/feedItemTypes/DrillingOperationSummaryFeedItem.js";import"../FeedItem/feedItemTypes/DrillingDailyCostFeedItem.js";import"../FeedItem/feedItemTypes/DocumentFeedItem.js";import"../FeedItem/feedItemTypes/DrillerMemoFeedItem.js";import"../FeedItem/feedItemTypes/NptFeedItem.js";import"../FeedItem/feedItemTypes/SurveyStationFeedItem/index.js";import"../FeedItem/feedItemTypes/LessonsLearnedFeedItem/index.js";import"../FeedItem/feedItemTypes/TracesMemoFeedItem.js";import"../FeedItem/feedItemTypes/DepthCommentFeedItem.js";import"../FeedItem/feedItemTypes/CompletionOperationalNoteFeedItem.js";import"../FeedItem/feedItemTypes/CompletionOperationSummaryFeedItem.js";import"../FeedItem/feedItemTypes/CompletionDailyCostFeedItem.js";import"../FeedItem/feedItemTypes/CompletionDocumentFeedItem.js";import"../FeedItem/feedItemTypes/CompletionNptFeedItem.js";import"../FeedItem/feedItemTypes/StageOverviewFeedItem/index.js";import"../FeedItem/feedItemTypes/AppAnnotationFeedItem/index.js";import"../FeedItem/feedItemTypes/WellPlanFeedItem/index.js";import"../FeedItem/feedItemTypes/FluidReportFeedItem.js";import"../FeedItem/feedItemTypes/BhaFeedItem/BhaFeedItem.js";import"../FeedItem/feedItemTypes/DvDCommentFeedItem.js";import"../FeedItem/feedItemTypes/PCCommentFeedItem.js";import"../FeedItem/feedItemTypes/HookloadCommentFeedItem.js";import"../FeedItem/feedItemTypes/NptLessonsCommentFeedItem.js";import"../FeedItem/feedItemTypes/GenericDataCommentFeedItem.js";var A=function(r){var A=r.open,V=r.fileUrl,S=r.fileSize,F=r.fileName,h=r.webviewType,T=void 0===h?"google":h,v=r.onClose,g=t(!0),D=o(g,2),P=D[0],f=D[1],x=t(!1),b=o(x,2),y=b[0],B=b[1],k=s(null),E=s(null),L=j(),w=i((function(){return"office"===T?"https://view.officeapps.live.com/op/embed.aspx?src=".concat(window.encodeURIComponent(V)):"https://docs.google.com/viewer?url=".concat(encodeURIComponent(V),"&embedded=true")}),[V]),M=function(){E.current&&(E.current.src=w(),E.current.contentWindow.location.reload())},H=function(){k.current&&clearInterval(k.current),f(!1)};return n((function(){f(!0),B(!1);var e=S&&S>=1048576?S/1048576*1e4:1e4;return k&&A&&(clearInterval(k.current),k.current=setInterval(M,e)),function(){clearInterval(k.current)}}),[V,A]),u(m,{open:A,onClose:v,onContextMenu:function(e){return e.stopPropagation()},children:C("div",{className:L.cDocsViewer,children:[C("div",{className:L.cDocsViewerToolbar,children:[u(c,{children:F}),C("div",{children:[u(a,{size:"small",className:L.cDocsViewerToolbarIconButton,children:u("a",{download:!0,href:V,target:"_blank",rel:"noopener noreferrer",children:u(d,{fontSize:"small"})})}),u(a,{size:"small",onClick:v,className:L.cDocsViewerToolbarIconButton,children:u(l,{fontSize:"small"})})]})]}),P&&u("div",{className:L.cDocsViewerFrame,children:u(I,{white:!1})}),y?u("div",{className:L.cDocsViewerFrame,children:u(c,{variant:"body2",className:L.cDocsViewerFrameFailed,children:"Loading failed"})}):u("iframe",{className:p(L.cDocsViewerFrame,e({},L.cDocsViewerFrameHidden,P)),title:V,src:w(),onLoad:H,onError:function(){H(),B(!0)},ref:E})]})})};A.propTypes={open:r.bool.isRequired,fileUrl:r.string.isRequired,webviewType:r.oneOf(["google","office"]),fileName:r.string,fileSize:r.number,onClose:r.func.isRequired,classes:r.shape({}).isRequired};export{A as default};
|
|
2
2
|
//# sourceMappingURL=DocumentViewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentViewer.js","sources":["../../../src/components/DocumentViewer/DocumentViewer.js"],"sourcesContent":["import { createRef, useCallback, useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Typography, Modal, IconButton } from '@material-ui/core';\nimport CloseIcon from '@material-ui/icons/Close';\nimport GetAppIcon from '@material-ui/icons/GetApp';\n\nimport { useStyles } from './styles.js';\n\nimport { LoadingIndicator } from '~/components';\n\nconst REQUEST_TIMEOUT = 10000;\nconst BYTES_IN_MEGABYTE = 1048576;\n\nconst DocumentViewer = ({ open, fileUrl, fileSize, fileName, webviewType = 'google', onClose }) => {\n const [isLoading, setIsLoading] = useState(true);\n const [isLoadingFailed, setIsLoadingFailed] = useState(false);\n const timeoutRef = createRef(null);\n const iframeRef = createRef(null);\n const styles = useStyles();\n\n const getIframeLink = useCallback(() => {\n return webviewType === 'office'\n ? `https://view.officeapps.live.com/op/embed.aspx?src=${window.encodeURIComponent(fileUrl)}`\n : `https://docs.google.com/viewer?url=${encodeURIComponent(fileUrl)}&embedded=true`;\n }, [fileUrl]);\n\n const reloadFrame = () => {\n if (iframeRef.current) {\n iframeRef.current.src = getIframeLink();\n iframeRef.current.contentWindow.location.reload();\n }\n };\n\n const handleFrameLoad = () => {\n if (timeoutRef.current) {\n clearInterval(timeoutRef.current);\n }\n setIsLoading(false);\n };\n\n const handleFrameError = () => {\n handleFrameLoad();\n setIsLoadingFailed(true);\n };\n\n useEffect(() => {\n setIsLoading(true);\n setIsLoadingFailed(false);\n const timeOut =\n fileSize && fileSize >= BYTES_IN_MEGABYTE\n ? (fileSize / BYTES_IN_MEGABYTE) * REQUEST_TIMEOUT\n : REQUEST_TIMEOUT;\n\n if (timeoutRef && open) {\n clearInterval(timeoutRef.current);\n timeoutRef.current = setInterval(reloadFrame, timeOut);\n }\n\n return () => {\n clearInterval(timeoutRef.current);\n };\n }, [fileUrl, open]);\n\n return (\n <Modal open={open} onClose={onClose} onContextMenu={e => e.stopPropagation()}>\n <div className={styles.cDocsViewer}>\n <div className={styles.cDocsViewerToolbar}>\n <Typography>{fileName}</Typography>\n <div>\n <IconButton size=\"small\" className={styles.cDocsViewerToolbarIconButton}>\n <a download href={fileUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <GetAppIcon fontSize=\"small\" />\n </a>\n </IconButton>\n <IconButton\n size=\"small\"\n onClick={onClose}\n className={styles.cDocsViewerToolbarIconButton}\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n </div>\n </div>\n\n {isLoading && (\n <div className={styles.cDocsViewerFrame}>\n <LoadingIndicator white={false} />\n </div>\n )}\n {isLoadingFailed ? (\n <div className={styles.cDocsViewerFrame}>\n <Typography variant=\"body2\" className={styles.cDocsViewerFrameFailed}>\n Loading failed\n </Typography>\n </div>\n ) : (\n <iframe\n className={classNames(styles.cDocsViewerFrame, {\n [styles.cDocsViewerFrameHidden]: isLoading,\n })}\n title={fileUrl}\n src={getIframeLink()}\n onLoad={handleFrameLoad}\n onError={handleFrameError}\n ref={iframeRef}\n />\n )}\n </div>\n </Modal>\n );\n};\n\nDocumentViewer.propTypes = {\n open: PropTypes.bool.isRequired,\n fileUrl: PropTypes.string.isRequired,\n webviewType: PropTypes.oneOf(['google', 'office']),\n fileName: PropTypes.string,\n fileSize: PropTypes.number,\n onClose: PropTypes.func.isRequired,\n classes: PropTypes.shape({}).isRequired,\n};\n\nexport default DocumentViewer;\n"],"names":["DocumentViewer","_ref","open","fileUrl","fileSize","fileName","_ref$webviewType","webviewType","onClose","useState","_useState2","_slicedToArray","_useState","isLoading","setIsLoading","_useState4","_useState3","isLoadingFailed","setIsLoadingFailed","timeoutRef","createRef","iframeRef","styles","useStyles","getIframeLink","useCallback","concat","window","encodeURIComponent","reloadFrame","current","src","contentWindow","location","reload","handleFrameLoad","clearInterval","useEffect","timeOut","setInterval","_jsx","Modal","onContextMenu","e","stopPropagation","children","_jsxs","className","cDocsViewer","cDocsViewerToolbar","Typography","IconButton","size","cDocsViewerToolbarIconButton","download","href","target","rel","GetAppIcon","fontSize","onClick","CloseIcon","cDocsViewerFrame","LoadingIndicator","white","variant","cDocsViewerFrameFailed","classNames","cDocsViewerFrameHidden","title","onLoad","onError","ref","propTypes","PropTypes","bool","isRequired","string","oneOf","number","func","classes","shape"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentViewer.js","sources":["../../../src/components/DocumentViewer/DocumentViewer.js"],"sourcesContent":["import { createRef, useCallback, useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Typography, Modal, IconButton } from '@material-ui/core';\nimport CloseIcon from '@material-ui/icons/Close';\nimport GetAppIcon from '@material-ui/icons/GetApp';\n\nimport { useStyles } from './styles.js';\n\nimport { LoadingIndicator } from '~/components';\n\nconst REQUEST_TIMEOUT = 10000;\nconst BYTES_IN_MEGABYTE = 1048576;\n\nconst DocumentViewer = ({ open, fileUrl, fileSize, fileName, webviewType = 'google', onClose }) => {\n const [isLoading, setIsLoading] = useState(true);\n const [isLoadingFailed, setIsLoadingFailed] = useState(false);\n const timeoutRef = createRef(null);\n const iframeRef = createRef(null);\n const styles = useStyles();\n\n const getIframeLink = useCallback(() => {\n return webviewType === 'office'\n ? `https://view.officeapps.live.com/op/embed.aspx?src=${window.encodeURIComponent(fileUrl)}`\n : `https://docs.google.com/viewer?url=${encodeURIComponent(fileUrl)}&embedded=true`;\n }, [fileUrl]);\n\n const reloadFrame = () => {\n if (iframeRef.current) {\n iframeRef.current.src = getIframeLink();\n iframeRef.current.contentWindow.location.reload();\n }\n };\n\n const handleFrameLoad = () => {\n if (timeoutRef.current) {\n clearInterval(timeoutRef.current);\n }\n setIsLoading(false);\n };\n\n const handleFrameError = () => {\n handleFrameLoad();\n setIsLoadingFailed(true);\n };\n\n useEffect(() => {\n setIsLoading(true);\n setIsLoadingFailed(false);\n const timeOut =\n fileSize && fileSize >= BYTES_IN_MEGABYTE\n ? (fileSize / BYTES_IN_MEGABYTE) * REQUEST_TIMEOUT\n : REQUEST_TIMEOUT;\n\n if (timeoutRef && open) {\n clearInterval(timeoutRef.current);\n timeoutRef.current = setInterval(reloadFrame, timeOut);\n }\n\n return () => {\n clearInterval(timeoutRef.current);\n };\n }, [fileUrl, open]);\n\n return (\n <Modal open={open} onClose={onClose} onContextMenu={e => e.stopPropagation()}>\n <div className={styles.cDocsViewer}>\n <div className={styles.cDocsViewerToolbar}>\n <Typography>{fileName}</Typography>\n <div>\n <IconButton size=\"small\" className={styles.cDocsViewerToolbarIconButton}>\n <a download href={fileUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <GetAppIcon fontSize=\"small\" />\n </a>\n </IconButton>\n <IconButton\n size=\"small\"\n onClick={onClose}\n className={styles.cDocsViewerToolbarIconButton}\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n </div>\n </div>\n\n {isLoading && (\n <div className={styles.cDocsViewerFrame}>\n <LoadingIndicator white={false} />\n </div>\n )}\n {isLoadingFailed ? (\n <div className={styles.cDocsViewerFrame}>\n <Typography variant=\"body2\" className={styles.cDocsViewerFrameFailed}>\n Loading failed\n </Typography>\n </div>\n ) : (\n <iframe\n className={classNames(styles.cDocsViewerFrame, {\n [styles.cDocsViewerFrameHidden]: isLoading,\n })}\n title={fileUrl}\n src={getIframeLink()}\n onLoad={handleFrameLoad}\n onError={handleFrameError}\n ref={iframeRef}\n />\n )}\n </div>\n </Modal>\n );\n};\n\nDocumentViewer.propTypes = {\n open: PropTypes.bool.isRequired,\n fileUrl: PropTypes.string.isRequired,\n webviewType: PropTypes.oneOf(['google', 'office']),\n fileName: PropTypes.string,\n fileSize: PropTypes.number,\n onClose: PropTypes.func.isRequired,\n classes: PropTypes.shape({}).isRequired,\n};\n\nexport default DocumentViewer;\n"],"names":["DocumentViewer","_ref","open","fileUrl","fileSize","fileName","_ref$webviewType","webviewType","onClose","useState","_useState2","_slicedToArray","_useState","isLoading","setIsLoading","_useState4","_useState3","isLoadingFailed","setIsLoadingFailed","timeoutRef","createRef","iframeRef","styles","useStyles","getIframeLink","useCallback","concat","window","encodeURIComponent","reloadFrame","current","src","contentWindow","location","reload","handleFrameLoad","clearInterval","useEffect","timeOut","setInterval","_jsx","Modal","onContextMenu","e","stopPropagation","children","_jsxs","className","cDocsViewer","cDocsViewerToolbar","Typography","IconButton","size","cDocsViewerToolbarIconButton","download","href","target","rel","GetAppIcon","fontSize","onClick","CloseIcon","cDocsViewerFrame","LoadingIndicator","white","variant","cDocsViewerFrameFailed","classNames","cDocsViewerFrameHidden","title","onLoad","onError","ref","propTypes","PropTypes","bool","isRequired","string","oneOf","number","func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