import { RequestGlobalsEventTarget } from "./shared.mjs";
import { AbortControllerPolyfill, AbortSignalPolyfill } from "./abort.mjs";
import { MiniProgramNetworkDefaults, RequestGlobalsMiniProgramOptions, WebSocketMiniProgramOptions, getMiniProgramNetworkDefaults, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults } from "./networkDefaults.mjs";
import { URLPolyfill, URLSearchParamsPolyfill } from "./url.mjs";
import { fetch } from "./fetch.mjs";
import { HeadersPolyfill, RequestPolyfill, ResponsePolyfill } from "./http.mjs";
import { BlobPolyfill, FormDataPolyfill } from "./web.mjs";
import { WebSocketPolyfill } from "./websocket.mjs";
import { XMLHttpRequestPolyfill } from "./xhr.mjs";

//#region src/base64.d.ts
declare function btoaPolyfill(input?: string): string;
declare function atobPolyfill(input?: string): string;
//#endregion
//#region src/crypto.d.ts
type IntegerTypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array;
declare function getRandomValuesPolyfill<T extends IntegerTypedArray>(typedArray: T): (T & Int8Array<ArrayBufferLike>) | (T & Uint8Array<ArrayBufferLike>) | (T & Uint8ClampedArray<ArrayBufferLike>) | (T & Int16Array<ArrayBufferLike>) | (T & Uint16Array<ArrayBufferLike>) | (T & Int32Array<ArrayBufferLike>) | (T & Uint32Array<ArrayBufferLike>) | (T & BigInt64Array<ArrayBufferLike>) | (T & BigUint64Array<ArrayBufferLike>);
declare const cryptoPolyfill: {
  getRandomValues: typeof getRandomValuesPolyfill;
};
//#endregion
//#region src/events.d.ts
interface EventInitPolyfill {
  bubbles?: boolean;
  cancelable?: boolean;
  composed?: boolean;
}
interface CustomEventInitPolyfill<T = any> extends EventInitPolyfill {
  detail?: T;
}
declare class EventPolyfill {
  readonly bubbles: boolean;
  readonly cancelable: boolean;
  readonly composed: boolean;
  readonly isTrusted = false;
  readonly timeStamp: number;
  readonly type: string;
  currentTarget: unknown;
  target: unknown;
  defaultPrevented: boolean;
  cancelBubble: boolean;
  constructor(type: string, init?: EventInitPolyfill);
  composedPath(): {}[];
  preventDefault(): void;
  stopImmediatePropagation(): void;
  stopPropagation(): void;
}
declare class CustomEventPolyfill<T = any> extends EventPolyfill {
  readonly detail: T | null;
  constructor(type: string, init?: CustomEventInitPolyfill<T>);
}
//#endregion
//#region src/performance.d.ts
declare const performancePolyfill: {
  __weappVitePerformancePolyfill: boolean;
  now(): number;
  timeOrigin: number;
};
//#endregion
//#region src/task.d.ts
declare function queueMicrotaskPolyfill(callback: () => void): void;
//#endregion
//#region src/textCodec.d.ts
type TextDecoderInput = ArrayBuffer | ArrayBufferView | null | undefined;
declare class TextEncoderPolyfill {
  readonly encoding = "utf-8";
  encode(input?: string): Uint8Array<ArrayBuffer>;
}
declare class TextDecoderPolyfill {
  readonly encoding = "utf-8";
  readonly fatal = false;
  readonly ignoreBOM = false;
  decode(input?: TextDecoderInput): string;
}
//#endregion
//#region src/index.d.ts
type WeappInjectWebRuntimeGlobalsTarget = 'fetch' | 'Headers' | 'Request' | 'Response' | 'TextEncoder' | 'TextDecoder' | 'AbortController' | 'AbortSignal' | 'XMLHttpRequest' | 'WebSocket' | 'atob' | 'btoa' | 'queueMicrotask' | 'performance' | 'crypto' | 'Event' | 'CustomEvent';
type WeappInjectRequestGlobalsTarget = WeappInjectWebRuntimeGlobalsTarget;
interface InstallWebRuntimeGlobalsOptions {
  targets?: WeappInjectWebRuntimeGlobalsTarget[];
  networkDefaults?: MiniProgramNetworkDefaults;
}
interface InstallRequestGlobalsOptions extends InstallWebRuntimeGlobalsOptions {}
/**
 * @description 按需向小程序全局环境注入缺失的 Web Runtime 对象。
 */
declare function installWebRuntimeGlobals(options?: InstallWebRuntimeGlobalsOptions): Record<string, any>;
/**
 * @description 已废弃，请迁移到 `installWebRuntimeGlobals`。
 */
declare function installRequestGlobals(options?: InstallRequestGlobalsOptions): Record<string, any>;
/**
 * @description 仅安装 AbortController 与 AbortSignal 兼容层。
 */
declare function installAbortGlobals(): Record<string, any>;
//#endregion
export { AbortControllerPolyfill, AbortSignalPolyfill, BlobPolyfill, CustomEventPolyfill, EventPolyfill, FormDataPolyfill, HeadersPolyfill, InstallRequestGlobalsOptions, InstallWebRuntimeGlobalsOptions, type MiniProgramNetworkDefaults, RequestGlobalsEventTarget, type RequestGlobalsMiniProgramOptions, RequestPolyfill, ResponsePolyfill, TextDecoderPolyfill, TextEncoderPolyfill, URLPolyfill, URLSearchParamsPolyfill, WeappInjectRequestGlobalsTarget, WeappInjectWebRuntimeGlobalsTarget, type WebSocketMiniProgramOptions, WebSocketPolyfill, XMLHttpRequestPolyfill, atobPolyfill, btoaPolyfill, cryptoPolyfill, fetch, getMiniProgramNetworkDefaults, installAbortGlobals, installRequestGlobals, installWebRuntimeGlobals, performancePolyfill, queueMicrotaskPolyfill, resetMiniProgramNetworkDefaults, setMiniProgramNetworkDefaults };