@nextgis/ngw-map 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 4.0.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 4.0.2; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 4.0.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 4.0.2; author: NextGIS */
2
2
  const svgPath = {
3
3
  brill: '<path d="m6 0-5 6 5 6 5-6z"/>',
4
4
  circle: '<circle cx="6" cy="6" r="6"/>',
@@ -349,8 +349,14 @@ function fixUrlStr(url) {
349
349
  return url.replace(/([^:]\/)\/+/g, "$1");
350
350
  }
351
351
  function updateUrlParams(urlStr, params) {
352
- const url = new URL(urlStr);
353
- const searchParams = new URLSearchParams(url.search);
352
+ const hashIndex = urlStr.indexOf("#");
353
+ const hash = hashIndex === -1 ? "" : urlStr.slice(hashIndex);
354
+ const url = hashIndex === -1 ? urlStr : urlStr.slice(0, hashIndex);
355
+ const queryIndex = url.indexOf("?");
356
+ const baseUrl = queryIndex === -1 ? url : url.slice(0, queryIndex);
357
+ const searchParams = new URLSearchParams(
358
+ queryIndex === -1 ? "" : url.slice(queryIndex + 1)
359
+ );
354
360
  Object.entries(params).forEach(([key, value]) => {
355
361
  if (value === void 0) {
356
362
  searchParams.delete(key);
@@ -360,7 +366,7 @@ function updateUrlParams(urlStr, params) {
360
366
  });
361
367
  searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
362
368
  const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
363
- return `${url.origin}${url.pathname}?${newSearch}`;
369
+ return `${baseUrl}?${newSearch}${hash}`;
364
370
  }
365
371
 
366
372
  const templateRe = /\{ *([\w_-]+) *\}/g;
@@ -1077,7 +1083,7 @@ function unwrapListeners(arr) {
1077
1083
  }
1078
1084
 
1079
1085
  var pkg = {
1080
- version: "4.0.1"};
1086
+ version: "4.0.2"};
1081
1087
 
1082
1088
  class AbortError extends Error {
1083
1089
  constructor(message = "AbortError") {