/**
 * @since 4.0.0
 */
import * as Cause from "../../Cause.ts";
import * as Redacted from "../../Redacted.ts";
import * as Result from "../../Result.ts";
import * as UrlParams from "./UrlParams.ts";
/**
 * Parses a URL string into a `URL` object, returning an `Result` type for safe
 * error handling.
 *
 * **Details**
 *
 * This function converts a string into a `URL` object, enabling safe URL
 * parsing with built-in error handling. If the string is invalid or fails to
 * parse, this function does not throw an error; instead, it wraps the error in
 * a `IllegalArgumentError` and returns it as the `Failure` value of an
 * `Result`. The `Success` value contains the successfully parsed `URL`.
 *
 * An optional `base` parameter can be provided to resolve relative URLs. If
 * specified, the function interprets the input `url` as relative to this
 * `base`. This is especially useful when dealing with URLs that might not be
 * fully qualified.
 *
 * **Example**
 *
 * ```ts
 * import { Url } from "effect/unstable/http"
 * import { Result } from "effect"
 *
 * // Parse an absolute URL
 * //
 * //      ┌─── Result<URL, IllegalArgumentError>
 * //      ▼
 * const parsed = Url.fromString("https://example.com/path")
 *
 * if (Result.isSuccess(parsed)) {
 *   console.log("Parsed URL:", parsed.success.toString())
 * } else {
 *   console.log("Error:", parsed.failure.message)
 * }
 * // Output: Parsed URL: https://example.com/path
 *
 * // Parse a relative URL with a base
 * const relativeParsed = Url.fromString("/relative-path", "https://example.com")
 *
 * if (Result.isSuccess(relativeParsed)) {
 *   console.log("Parsed relative URL:", relativeParsed.success.toString())
 * } else {
 *   console.log("Error:", relativeParsed.failure.message)
 * }
 * // Output: Parsed relative URL: https://example.com/relative-path
 * ```
 *
 * @since 4.0.0
 * @category Constructors
 */
export declare const fromString: {
    /**
     * Parses a URL string into a `URL` object, returning an `Result` type for safe
     * error handling.
     *
     * **Details**
     *
     * This function converts a string into a `URL` object, enabling safe URL
     * parsing with built-in error handling. If the string is invalid or fails to
     * parse, this function does not throw an error; instead, it wraps the error in
     * a `IllegalArgumentError` and returns it as the `Failure` value of an
     * `Result`. The `Success` value contains the successfully parsed `URL`.
     *
     * An optional `base` parameter can be provided to resolve relative URLs. If
     * specified, the function interprets the input `url` as relative to this
     * `base`. This is especially useful when dealing with URLs that might not be
     * fully qualified.
     *
     * **Example**
     *
     * ```ts
     * import { Url } from "effect/unstable/http"
     * import { Result } from "effect"
     *
     * // Parse an absolute URL
     * //
     * //      ┌─── Result<URL, IllegalArgumentError>
     * //      ▼
     * const parsed = Url.fromString("https://example.com/path")
     *
     * if (Result.isSuccess(parsed)) {
     *   console.log("Parsed URL:", parsed.success.toString())
     * } else {
     *   console.log("Error:", parsed.failure.message)
     * }
     * // Output: Parsed URL: https://example.com/path
     *
     * // Parse a relative URL with a base
     * const relativeParsed = Url.fromString("/relative-path", "https://example.com")
     *
     * if (Result.isSuccess(relativeParsed)) {
     *   console.log("Parsed relative URL:", relativeParsed.success.toString())
     * } else {
     *   console.log("Error:", relativeParsed.failure.message)
     * }
     * // Output: Parsed relative URL: https://example.com/relative-path
     * ```
     *
     * @since 4.0.0
     * @category Constructors
     */
    (url: string, base?: string | URL | undefined): Result.Result<URL, Cause.IllegalArgumentError>;
};
/**
 * This function clones the original `URL` object and applies a callback to the
 * clone, allowing multiple updates at once.
 *
 * **Example**
 *
 * ```ts
 * import { Url } from "effect/unstable/http"
 *
 * const myUrl = new URL("https://example.com")
 *
 * const mutatedUrl = Url.mutate(myUrl, (url) => {
 *   url.username = "user"
 *   url.password = "pass"
 * })
 *
 * console.log("Mutated:", mutatedUrl.toString())
 * // Output: Mutated: https://user:pass@example.com/
 * ```
 *
 * @since 4.0.0
 * @category Modifiers
 */
export declare const mutate: {
    /**
     * This function clones the original `URL` object and applies a callback to the
     * clone, allowing multiple updates at once.
     *
     * **Example**
     *
     * ```ts
     * import { Url } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com")
     *
     * const mutatedUrl = Url.mutate(myUrl, (url) => {
     *   url.username = "user"
     *   url.password = "pass"
     * })
     *
     * console.log("Mutated:", mutatedUrl.toString())
     * // Output: Mutated: https://user:pass@example.com/
     * ```
     *
     * @since 4.0.0
     * @category Modifiers
     */
    (f: (url: URL) => void): (self: URL) => URL;
    /**
     * This function clones the original `URL` object and applies a callback to the
     * clone, allowing multiple updates at once.
     *
     * **Example**
     *
     * ```ts
     * import { Url } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com")
     *
     * const mutatedUrl = Url.mutate(myUrl, (url) => {
     *   url.username = "user"
     *   url.password = "pass"
     * })
     *
     * console.log("Mutated:", mutatedUrl.toString())
     * // Output: Mutated: https://user:pass@example.com/
     * ```
     *
     * @since 4.0.0
     * @category Modifiers
     */
    (self: URL, f: (url: URL) => void): URL;
};
/**
 * Updates the hash fragment of the URL.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setHash: {
    /**
     * Updates the hash fragment of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (hash: string): (url: URL) => URL;
    /**
     * Updates the hash fragment of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, hash: string): URL;
};
/**
 * Updates the host (domain and port) of the URL.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setHost: {
    /**
     * Updates the host (domain and port) of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (host: string): (url: URL) => URL;
    /**
     * Updates the host (domain and port) of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, host: string): URL;
};
/**
 * Updates the domain of the URL without modifying the port.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setHostname: {
    /**
     * Updates the domain of the URL without modifying the port.
     *
     * @since 4.0.0
     * @category Setters
     */
    (hostname: string): (url: URL) => URL;
    /**
     * Updates the domain of the URL without modifying the port.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, hostname: string): URL;
};
/**
 * Replaces the entire URL string.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setHref: {
    /**
     * Replaces the entire URL string.
     *
     * @since 4.0.0
     * @category Setters
     */
    (href: string): (url: URL) => URL;
    /**
     * Replaces the entire URL string.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, href: string): URL;
};
/**
 * Updates the password used for authentication.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setPassword: {
    /**
     * Updates the password used for authentication.
     *
     * @since 4.0.0
     * @category Setters
     */
    (password: string | Redacted.Redacted): (url: URL) => URL;
    /**
     * Updates the password used for authentication.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, password: string | Redacted.Redacted): URL;
};
/**
 * Updates the path of the URL.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setPathname: {
    /**
     * Updates the path of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (pathname: string): (url: URL) => URL;
    /**
     * Updates the path of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, pathname: string): URL;
};
/**
 * Updates the port of the URL.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setPort: {
    /**
     * Updates the port of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (port: string | number): (url: URL) => URL;
    /**
     * Updates the port of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, port: string | number): URL;
};
/**
 * Updates the protocol (e.g., `http`, `https`).
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setProtocol: {
    /**
     * Updates the protocol (e.g., `http`, `https`).
     *
     * @since 4.0.0
     * @category Setters
     */
    (protocol: string): (url: URL) => URL;
    /**
     * Updates the protocol (e.g., `http`, `https`).
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, protocol: string): URL;
};
/**
 * Updates the query string of the URL.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setSearch: {
    /**
     * Updates the query string of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (search: string): (url: URL) => URL;
    /**
     * Updates the query string of the URL.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, search: string): URL;
};
/**
 * Updates the username used for authentication.
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setUsername: {
    /**
     * Updates the username used for authentication.
     *
     * @since 4.0.0
     * @category Setters
     */
    (username: string): (url: URL) => URL;
    /**
     * Updates the username used for authentication.
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, username: string): URL;
};
/**
 * Updates the query parameters of a URL.
 *
 * **Details**
 *
 * This function allows you to set or replace the query parameters of a `URL`
 * object using the provided `UrlParams`. It creates a new `URL` object with the
 * updated parameters, leaving the original object unchanged.
 *
 * **Example**
 *
 * ```ts
 * import { Url, UrlParams } from "effect/unstable/http"
 *
 * const myUrl = new URL("https://example.com?foo=bar")
 *
 * // Write parameters
 * const updatedUrl = Url.setUrlParams(
 *   myUrl,
 *   UrlParams.fromInput([["key", "value"]])
 * )
 *
 * console.log(updatedUrl.toString())
 * // Output: https://example.com/?key=value
 * ```
 *
 * @since 4.0.0
 * @category Setters
 */
export declare const setUrlParams: {
    /**
     * Updates the query parameters of a URL.
     *
     * **Details**
     *
     * This function allows you to set or replace the query parameters of a `URL`
     * object using the provided `UrlParams`. It creates a new `URL` object with the
     * updated parameters, leaving the original object unchanged.
     *
     * **Example**
     *
     * ```ts
     * import { Url, UrlParams } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com?foo=bar")
     *
     * // Write parameters
     * const updatedUrl = Url.setUrlParams(
     *   myUrl,
     *   UrlParams.fromInput([["key", "value"]])
     * )
     *
     * console.log(updatedUrl.toString())
     * // Output: https://example.com/?key=value
     * ```
     *
     * @since 4.0.0
     * @category Setters
     */
    (urlParams: UrlParams.UrlParams): (url: URL) => URL;
    /**
     * Updates the query parameters of a URL.
     *
     * **Details**
     *
     * This function allows you to set or replace the query parameters of a `URL`
     * object using the provided `UrlParams`. It creates a new `URL` object with the
     * updated parameters, leaving the original object unchanged.
     *
     * **Example**
     *
     * ```ts
     * import { Url, UrlParams } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com?foo=bar")
     *
     * // Write parameters
     * const updatedUrl = Url.setUrlParams(
     *   myUrl,
     *   UrlParams.fromInput([["key", "value"]])
     * )
     *
     * console.log(updatedUrl.toString())
     * // Output: https://example.com/?key=value
     * ```
     *
     * @since 4.0.0
     * @category Setters
     */
    (url: URL, urlParams: UrlParams.UrlParams): URL;
};
/**
 * Retrieves the query parameters from a URL.
 *
 * **Details**
 *
 * This function extracts the query parameters from a `URL` object and returns
 * them as `UrlParams`. The resulting structure can be easily manipulated or
 * inspected.
 *
 * **Example**
 *
 * ```ts
 * import { Url } from "effect/unstable/http"
 *
 * const myUrl = new URL("https://example.com?foo=bar")
 *
 * // Read parameters
 * const params = Url.urlParams(myUrl)
 *
 * console.log(params)
 * // Output: [ [ 'foo', 'bar' ] ]
 * ```
 *
 * @since 4.0.0
 * @category Getters
 */
export declare const urlParams: (url: URL) => UrlParams.UrlParams;
/**
 * Reads, modifies, and updates the query parameters of a URL.
 *
 * **Details**
 *
 * This function provides a functional way to interact with query parameters by
 * reading the current parameters, applying a transformation function, and then
 * writing the updated parameters back to the URL. It returns a new `URL` object
 * with the modified parameters, ensuring immutability.
 *
 * **Example**
 *
 * ```ts
 * import { Url, UrlParams } from "effect/unstable/http"
 *
 * const myUrl = new URL("https://example.com?foo=bar")
 *
 * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
 *
 * console.log(changedUrl.toString())
 * // Output: https://example.com/?foo=bar&key=value
 * ```
 *
 * @since 4.0.0
 * @category Modifiers
 */
export declare const modifyUrlParams: {
    /**
     * Reads, modifies, and updates the query parameters of a URL.
     *
     * **Details**
     *
     * This function provides a functional way to interact with query parameters by
     * reading the current parameters, applying a transformation function, and then
     * writing the updated parameters back to the URL. It returns a new `URL` object
     * with the modified parameters, ensuring immutability.
     *
     * **Example**
     *
     * ```ts
     * import { Url, UrlParams } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com?foo=bar")
     *
     * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
     *
     * console.log(changedUrl.toString())
     * // Output: https://example.com/?foo=bar&key=value
     * ```
     *
     * @since 4.0.0
     * @category Modifiers
     */
    (f: (urlParams: UrlParams.UrlParams) => UrlParams.UrlParams): (url: URL) => URL;
    /**
     * Reads, modifies, and updates the query parameters of a URL.
     *
     * **Details**
     *
     * This function provides a functional way to interact with query parameters by
     * reading the current parameters, applying a transformation function, and then
     * writing the updated parameters back to the URL. It returns a new `URL` object
     * with the modified parameters, ensuring immutability.
     *
     * **Example**
     *
     * ```ts
     * import { Url, UrlParams } from "effect/unstable/http"
     *
     * const myUrl = new URL("https://example.com?foo=bar")
     *
     * const changedUrl = Url.modifyUrlParams(myUrl, UrlParams.append("key", "value"))
     *
     * console.log(changedUrl.toString())
     * // Output: https://example.com/?foo=bar&key=value
     * ```
     *
     * @since 4.0.0
     * @category Modifiers
     */
    (url: URL, f: (urlParams: UrlParams.UrlParams) => UrlParams.UrlParams): URL;
};
//# sourceMappingURL=Url.d.ts.map