import { Ref } from 'vue';

/**
 * Result of a custom loader. Resolves when the script is "ready"
 * (flips `isLoaded` to `true`); rejects to populate `error`.
 */
export declare type ScriptLoader = (url: string) => Promise<void>;

/**
 * Replace the script-loading mechanism used by `useScriptTag` with a custom
 * implementation. Primarily intended for test environments — jsdom does not
 * dispatch `load` events for dynamically inserted `<script>` tags, so any
 * composable that gates behavior on `isLoaded` (e.g. `usePlaidLink`) hangs
 * forever by default.
 *
 * In a test setup file:
 *
 * ```ts
 * import { setScriptLoader } from '@leaflink/stash-vue/useScriptTag';
 * setScriptLoader(() => Promise.resolve());
 * ```
 *
 * Pass `null` to restore the default DOM-based loader. The override applies
 * globally for the lifetime of the module — call once per test worker.
 */
export declare function setScriptLoader(loader: ScriptLoader | null): void;

declare type UseScriptOptions = {
    manual: boolean;
};

declare function useScriptTag(url: string, options?: UseScriptOptions): {
    scriptTag: Ref<HTMLScriptElement | null, HTMLScriptElement | null>;
    load: () => void;
    unload: () => void;
    isLoaded: Ref<boolean, boolean>;
    error: Ref<Error | null, Error | null>;
};
export default useScriptTag;

export { }
