"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var getUrlParam = function getUrlParam(key) {
  var href = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href;
  var queryString = href.split('?')[1] || '';
  var query = queryString.split('#')[0];
  var searchParams = new URLSearchParams(query);
  var params = {};
  searchParams.forEach(function (value, name) {
    if (params[name] === undefined) {
      params[name] = value;
    } else if (Array.isArray(params[name])) {
      params[name].push(value);
    } else {
      params[name] = [params[name], value];
    }
  });
  return key ? params[key] : params;
};
var _default = exports["default"] = getUrlParam;
//# sourceMappingURL=getUrlParam.js.map
