/** * Copyright 2026 - present Nazmul Hassan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { _i as QueryObject, gi as ParsedQueryGeneric, hi as ParsedQuery } from "./index-Dx3yeNwR.mjs"; import { U as QueryString } from "./string-C1gMz4HF.mjs"; //#region src/dom/query.d.ts /** * * Utility to generate query parameters from an object. * * @param params - Object containing query parameters. * @returns A query string as a URL-encoded string, e.g., `?key1=value1&key2=value2`. * * @example * generateQueryParams({ key1: 'value1', key2: 42 }); // "?key1=value1&key2=42" * generateQueryParams({ key1: ['value1', 'value2'], key2: 42 }); // "?key1=value1&key1=value2&key2=42" * generateQueryParams({ key1: '', key2: null }); // "" * generateQueryParams({ key1: true, key2: false }); // "?key1=true&key2=false" * generateQueryParams({ filters: { category: 'laptop', price: 1000 } }); // "?category=laptop&price=1000" */ declare function generateQueryParams(params?: T): QueryString; /** * * Get query params as standard `JavaScript` Object `Record`. You can define the type by passing a type argument. * * - **Note:** *Extracts query parameters from the current URL (window.location.search).* * * @returns Query string as key-value paired object. `Record`. */ declare function getQueryParams>(): QParams; /** * * Update query params in the browser URL with given key and value. * @param key Key for the query to update. * @param value Value to updated against the given key. */ declare function updateQueryParam(key: string, value: string): void; /** * Parses a query string (with optional `?` prefix) into an object. * Supports multiple values for the same key by returning arrays. * Optionally parses primitive string values into actual types (e.g., "1" → 1, "true" → true). * * @remarks This utility is designed to parse generic string, for literal use, try {@link parseQueryStringLiteral}. * * - **Note:** *This function does **not** access or depend on `current URL` a.k.a `window.location.search`.* * * @param query - The query string to parse. * @param parsePrimitives - Whether to convert stringified primitives into real values (default: true). * @returns An object where keys are strings and values can be string, array, number, boolean, or null/undefined. */ declare function parseQueryString(query: string, parsePrimitives?: boolean): QParams; /** * Parses a query string (with optional `?` prefix) into an object. * Supports multiple values for the same key by returning arrays. * It returns properly typed object. * * @remarks This utility is designed to parse literal string, for generic use, try {@link parseQueryString}. * * - **Note:** *This function does **not** access or depend on `current URL` a.k.a `window.location.search`.* * * @param query - The literal query string to parse. * @returns An object where keys are strings and values can be string, array, or null/undefined. */ declare function parseQueryStringLiteral(query: Q): ParsedQuery; //#endregion export { updateQueryParam as a, parseQueryStringLiteral as i, getQueryParams as n, parseQueryString as r, generateQueryParams as t };