"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendQueryParamsToDappURL = void 0;
const extractDappURLFromManifest_1 = require("./extractDappURLFromManifest");
function appendQueryParamsToDappURL(manifest, queryString = {}) {
    const url = (0, extractDappURLFromManifest_1.extractDappURLFromManifest)(manifest);
    if (url) {
        const searchParams = new URLSearchParams(url.search);
        // Append the new query strings to the existing ones
        Object.entries(queryString).forEach(([key, value]) => {
            if (Array.isArray(value)) {
                value.forEach(item => searchParams.append(key, item));
            }
            else {
                searchParams.append(key, value);
            }
        });
        // Update the search property of the URL with the updated search params
        url.search = searchParams.toString();
        return url;
    }
    return undefined;
}
exports.appendQueryParamsToDappURL = appendQueryParamsToDappURL;
//# sourceMappingURL=appendQueryParamsToDappURL.js.map