import { EmbraceInstrumentationBase } from "../../EmbraceInstrumentationBase/EmbraceInstrumentationBase.cjs";
import { DocumentLoadInstrumentationConfig } from "./types.cjs";

//#region src/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.ts
declare class DocumentLoadInstrumentation extends EmbraceInstrumentationBase<DocumentLoadInstrumentationConfig> {
  private readonly _onDocumentLoaded;
  private _performanceCollected;
  constructor({
    diag,
    perf,
    enabled,
    applyCustomAttributesOnSpan,
    ignorePerformancePaintEvents,
    ignoreNetworkEvents
  }?: DocumentLoadInstrumentationConfig);
  protected init(): undefined;
  /**
   * Adds spans for all resources
   * @param rootSpan
   */
  private _addResourcesSpans;
  /**
   * Collects information about performance and creates appropriate spans
   */
  private _collectPerformance;
  /**
   * Helper function for ending a span
   * @param span
   * @param performanceName name of performance entry for end time
   * @param entries
   */
  private _endSpan;
  /**
   * Creates and ends a span with network information about a resource added as timed events
   * @param resource
   * @param parentSpan
   */
  private _initResourceSpan;
  /**
   * Helper function for starting a span
   * @param spanName name of span
   * @param performanceName name of performance entry for time start
   * @param entries
   * @param parentSpan
   */
  private _startSpan;
  /**
   * Executes callback {_onDocumentLoaded} when the page is loaded
   */
  private _waitForPageLoad;
  /**
   * Adds custom attributes to span if configured
   * Used for both documentFetch and documentLoad spans
   */
  private _addCustomAttributesOnSpan;
  /**
   * Adds custom attributes to resource span if configured
   */
  private _addCustomAttributesOnResourceSpan;
  private _hasNoSizeData;
  private _hasTimingData;
  private _isCorsRestricted;
  private _isFetchIncomplete;
  private _isFetchPrevented;
  /**
   * Detect cache validation (304 Not Modified responses)
   *
   * 304 responses show transferSize of ~300 bytes (headers only, no body).
   * Use deliveryType to distinguish from cache hits: 'cache' = no network, otherwise = 304.
   *
   * Spec: https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize
   */
  private _isCacheValidated;
  /**
   * Add diagnostic attributes to identify resource loading issues
   *
   * Diagnostic attributes help identify why resources may have incomplete timing data:
   * - CORS restrictions (opaque responses without Timing-Allow-Origin header)
   * - Cache revalidation (304 Not Modified responses)
   * - Request incomplete (started but didn't complete - network error, aborted)
   * - Request prevented (never started - blocked by CSP, browser, extension)
   */
  private _addResourceDiagnosticAttributes;
  enable(): void;
  disable(): void;
}
//#endregion
export { DocumentLoadInstrumentation };
//# sourceMappingURL=DocumentLoadInstrumentation.d.cts.map