import { Observable } from 'rxjs';
import { HeadService } from '@bespunky/angular-zen/core';
import { UniversalService } from '@bespunky/angular-zen/universal';
import { ScriptLoadOptions } from './script-load-options';
import { LoadOptions } from './load-options';
import { LazyLoadedFile } from './lazy-loaded-file';
import * as i0 from "@angular/core";
/**
 * Provides methods for lazy loading scripts and styles programatically.
 * The service keeps track of loaded files to skip reloading unless specified otherwise in the options of `loadScript()` or `loadStyle()`.
 */
export declare class LazyLoaderService {
    private head;
    private universal;
    /**
     * Defines the default options when calling the `LazyLoaderService.loadScript()` method.
     */
    private defaultScriptOptions;
    /**
    * Defines the default options when calling the `LazyLoaderService.loadStyle()` method.
    */
    private defaultStyleOptions;
    /**
     * Keeps track of loaded lazy files status and references
     */
    private cache;
    constructor(head: HeadService, universal: UniversalService);
    /**
     * Checks whether the file from the specified url has already been cached.
     * @param url The url for the file to check.
     * @returns A value indicating whether the file from the specified url has already been cached.
     */
    isCached(url: string): boolean;
    /**
     * Checks whether a script element is already present in `<head>` for the given url.
     * This doesn't guarantee that the script has been loaded.
     *
     * @param {string} url The url of the loaded script.
     * @returns {boolean} `true` if an element matching the url is present in `<head>`; otherwise `false.
     */
    isScriptPresent(url: string): boolean;
    /**
     * Checks whether a link element is already present in `<head>` for the given style url.
     * This doesn't guarantee that the style has been loaded.
     *
     * @param {string} url The url of the loaded link.
     * @returns {boolean} `true` if an element matching the url is present in `<head>`; otherwise `false.
     */
    isStylePresent(url: string): boolean;
    /**
     * Loads a script programatically.
     *
     * @param url The full url of the script to load.
     * @param options (Optional) Specifies custom options to override default behaviour.
     * @returns An observable object which allows subscribers to know when the script has been loaded and access its associated `<script>` element.
     *          The observable will complete immediately in case the script was already previously loaded.
     *          If the script was already loaded outside of the service, the observable will stream `undefined`.
     */
    loadScript(url: string, options?: ScriptLoadOptions): Observable<LazyLoadedFile | null>;
    /**
     * Loads a style programatically.
     *
     * @param url The full url of the style to load.
     * @param options (Optional) Specifies custom options to override default behaviour.
     * @returns An observable object which allows subscribers to know when the style has been loaded and access its associated `<link>` element.
     *          The observable will complete immediately in case the style was already previously loaded.
     *          If the style was already loaded outside of the service, the observable will stream `undefined`.
     */
    loadStyle(url: string, options?: LoadOptions): Observable<LazyLoadedFile | null>;
    private loadFile;
    /**
     * Creates a `<script>` tag for the given url and adds it to the `<head>` tag to start downloading the script.
     *
     * @param url       The url for the script to download.
     * @param onLoad    The callback to execute when the script has been downloaded and executed.
     * @param onError   The callback to execute when script download or execution has failed.
     * @param options   The options to add to the script.
     * @returns A reference to the `<script>` element that was added to the DOM.
     */
    private createScriptElement;
    /**
     * Creates a `<link>` tag for the given url and adds it to the `<head>` tag to start downloading the link.
     *
     * @param url       The url for the link to download.
     * @param onLoad    The callback to execute when the script has been downloaded and executed.
     * @param onError   The callback to execute when script download or execution has failed.
     * @returns A reference to the `<link>` element that was added to the DOM.
     */
    private createLinkElement;
    static ɵfac: i0.ɵɵFactoryDeclaration<LazyLoaderService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<LazyLoaderService>;
}
