Since #12241 we have notifications for this when the user navigates away from the viewer, but we do not yet warn when switching documents, which means that if you call e.g. `PDFViewerApplication.open` with a new document (or directly call `BaseViewer.setDocument` when using the viewer components standalone) there won't be any warning about losing form data. This should be addressed.
if (this._saveInProgress) {
      return;
    }
    const downloadManager = this.downloadManager,
      url = this.baseUrl,
      filename = this._docFilename;
    
    
    if (!this.pdfDocument || !this.downloadComplete) {
      this.download({ sourceEventType });
      return;
    }
    this._saveInProgress = true;
    await this.pdfScriptingManager.dispatchWillSave();
    this.pdfDocument
      .saveDocument(this.pdfDocument.annotationStorage)
      .then(data => {
        const blob = new Blob([data], { type: "application/pdf" });
        downloadManager.download(blob, url, filename, sourceEventType);
      })
      .catch(() => {
        this.download({ sourceEventType });
      })
      .finally(async () => {
        await this.pdfScriptingManager.dispatchDidSave();
        this._saveInProgress = false;
      });
  },
  downloadOrSave(options) {