async render({ viewport, intent = "display" }) {
    if (intent === "print") {
      const parameters = {
        viewport: viewport.clone({ dontFlip: true }),
        div: this.div,
        xfaHtml: this.xfaHtml,
        annotationStorage: this.annotationStorage,
        linkService: this.linkService,
        intent,
      };

      // Create an xfa layer div and render the form
      this.div = document.createElement("div");
      parameters.div = this.div;

      return XfaLayer.render(parameters);
    }

    // intent === "display"
    const xfaHtml = await this.pdfPage.getXfa();
    if (this._cancelled || !xfaHtml) {
      return { textDivs: [] };
    }

    const parameters = {
      viewport: viewport.clone({ dontFlip: true }),
      div: this.div,
      xfaHtml,
      annotationStorage: this.annotationStorage,
      linkService: this.linkService,
      intent,
    };

    if (this.div) {
      return XfaLayer.update(parameters);
    }
    // Create an xfa layer div and render the form
    this.div = document.createElement("div");
    parameters.div = this.div;

    return XfaLayer.render(parameters);
  }
@param {XfaLayerBuilderRenderOptions} viewport
@returns {Promise<Object | void>} A promise that is resolved when rendering
  of the XFA layer is complete. The first rendering will return an object
  with a `textDivs` property that can be used with the TextHighlighter.