async runCancelable(e, t, r, i) {
    const s = e.filter((o) => o.state < t);
    for (const o of s)
      await Ae(r), await i(o), o.state = t, await this.notifyDocumentPhase(o, t, r);
    const a = e.filter((o) => o.state === t);
    await this.notifyBuildPhase(a, t, r), this.currentState = t;
  }
Runs a cancelable operation on a set of documents to bring them to a specified {@link DocumentState}.

@param documents The array of documents to process.
@param targetState The target {@link DocumentState} to bring the documents to.
@param cancelToken A token that can be used to cancel the operation.
@param callback A function to be called for each document.
@returns A promise that resolves when all documents have been processed or the operation is canceled.
@throws Will throw `OperationCancelled` if the operation is canceled via a `CancellationToken`.