@opengeoweb/webmap 7.0.0 → 8.1.0

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.
package/index.esm.js CHANGED
@@ -529,6 +529,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
529
529
  });
530
530
  }
531
531
 
532
+ function __classPrivateFieldGet(receiver, state, kind, f) {
533
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
534
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
535
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
536
+ }
537
+
532
538
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
533
539
  var e = new Error(message);
534
540
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -17749,7 +17755,7 @@ var DebugType;
17749
17755
  DebugType[DebugType["Warning"] = 1] = "Warning";
17750
17756
  DebugType[DebugType["Error"] = 2] = "Error";
17751
17757
  })(DebugType || (DebugType = {}));
17752
- var debug = function debug(type, message) {
17758
+ var debugLogger = function debugLogger(type, message) {
17753
17759
  };
17754
17760
  /**
17755
17761
  * Checks if variable is defined or not
@@ -17847,7 +17853,7 @@ var URLEncode = function URLEncode(plaintext) {
17847
17853
  } else {
17848
17854
  var charCode = ch.charCodeAt(0);
17849
17855
  if (charCode > 255) {
17850
- debug(DebugType.Warning);
17856
+ debugLogger(DebugType.Warning);
17851
17857
  encoded += '+';
17852
17858
  } else {
17853
17859
  encoded += '%';
@@ -18272,6 +18278,11 @@ var WMImage = /*#__PURE__*/function () {
18272
18278
  value: function isLoadedWithoutErrors() {
18273
18279
  return this.isLoaded() && !this.hasError();
18274
18280
  }
18281
+ }, {
18282
+ key: "hasNotStartedLoading",
18283
+ value: function hasNotStartedLoading() {
18284
+ return !this._isLoaded && !this._isLoading;
18285
+ }
18275
18286
  /**
18276
18287
  * Returns true if the image is still loading
18277
18288
  */
@@ -18306,7 +18317,7 @@ var WMImage = /*#__PURE__*/function () {
18306
18317
  key: "setSource",
18307
18318
  value: function setSource(src, options) {
18308
18319
  if (this._isLoading) {
18309
- debug(DebugType.Error);
18320
+ debugLogger(DebugType.Error);
18310
18321
  return;
18311
18322
  }
18312
18323
  this.srcToLoad = src;
@@ -18393,9 +18404,9 @@ var WMImage = /*#__PURE__*/function () {
18393
18404
  _this2.getElement().src = base64Flag + imageStr;
18394
18405
  });
18395
18406
  })["catch"](function () {
18396
- debug(DebugType.Error, "Unable to fetch image ".concat(url, " with headers [").concat(JSON.stringify(headers), "]"));
18407
+ debugLogger(DebugType.Error, "Unable to fetch image ".concat(url, " with headers [").concat(JSON.stringify(headers), "]"));
18397
18408
  if (url.startsWith('http://')) {
18398
- debug(DebugType.Error);
18409
+ debugLogger(DebugType.Error);
18399
18410
  }
18400
18411
  _this2._loadEvent(true);
18401
18412
  });
@@ -18547,11 +18558,11 @@ var WMImageStore = /*#__PURE__*/function () {
18547
18558
  key: "addImageEventCallback",
18548
18559
  value: function addImageEventCallback(callback, id) {
18549
18560
  if (!id) {
18550
- debug(DebugType.Error);
18561
+ debugLogger(DebugType.Error);
18551
18562
  return;
18552
18563
  }
18553
18564
  if (!callback) {
18554
- debug(DebugType.Error);
18565
+ debugLogger(DebugType.Error);
18555
18566
  return;
18556
18567
  }
18557
18568
  this._loadEventCallbackList.push({
@@ -18892,7 +18903,7 @@ var WMListener = /*#__PURE__*/function () {
18892
18903
  try {
18893
18904
  returnList.push(this._callBacks[j].functionpointer(param, this));
18894
18905
  } catch (e) {
18895
- debug(DebugType.Error);
18906
+ debugLogger(DebugType.Error);
18896
18907
  }
18897
18908
  }
18898
18909
  }
@@ -19148,7 +19159,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19148
19159
  this._ctx.drawImage(imageElement, imageX, imageY, imageW, imageH);
19149
19160
  if (enableConsoleDebugging) ;
19150
19161
  } catch (e) {
19151
- debug(DebugType.Error);
19162
+ debugLogger(DebugType.Error);
19152
19163
  }
19153
19164
  }
19154
19165
  }, {
@@ -19178,7 +19189,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19178
19189
  * Check if this image has an error.
19179
19190
  * If the error has occured some time ago, and the amount of retries is low, just retry to load the image.
19180
19191
  */
19181
- if (imageToDisplay.hasError() && imageToDisplay.isLoading() === false && imageToDisplay.getLastErrorMSecondsAgo() > 5000 && imageToDisplay.getNumFailedAttempts() < 10) {
19192
+ if ((imageToDisplay === null || imageToDisplay === void 0 ? void 0 : imageToDisplay.hasError()) && imageToDisplay.isLoading() === false && imageToDisplay.getLastErrorMSecondsAgo() > 5000 && imageToDisplay.getNumFailedAttempts() < 10) {
19182
19193
  imageToDisplay.forceReload();
19183
19194
  }
19184
19195
  /* Find closest alternative and display instead image */
@@ -19209,7 +19220,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19209
19220
  for (var j = 0; j < this.layers.length; j += 1) {
19210
19221
  var image = this._imageStore.getImageForSrc(this.layers[j].imageSource);
19211
19222
  if (image.hasError()) {
19212
- debug(DebugType.Error, "image error: ".concat(image.getSrc()));
19223
+ debugLogger(DebugType.Error, "image error: ".concat(image.getSrc()));
19213
19224
  }
19214
19225
  }
19215
19226
  try {
@@ -19217,7 +19228,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19217
19228
  this.onLoadReadyFunction(this);
19218
19229
  }
19219
19230
  } catch (e) {
19220
- debug(DebugType.Error);
19231
+ debugLogger(DebugType.Error);
19221
19232
  }
19222
19233
  }
19223
19234
  }, {
@@ -19250,7 +19261,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19250
19261
  value: function setSrc(layerIndex, imageSource, linkedInfo, opacity, bbox) {
19251
19262
  var _a, _b;
19252
19263
  if (!isDefined(imageSource)) {
19253
- debug(DebugType.Warning);
19264
+ debugLogger(DebugType.Warning);
19254
19265
  return;
19255
19266
  }
19256
19267
  /* HTTP Headers for the image, necessary in case of certain authentication forms */
@@ -19308,258 +19319,1001 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19308
19319
  return WMCanvasBuffer;
19309
19320
  }();
19310
19321
 
19311
- /**
19312
- * Prefetches given requests
19313
- *
19314
- * @param requests An array of requests to prefetch
19315
- * @return The list of images in prefetch
19322
+ function _typeof(o) {
19323
+ "@babel/helpers - typeof";
19324
+
19325
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19326
+ return typeof o;
19327
+ } : function (o) {
19328
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
19329
+ }, _typeof(o);
19330
+ }
19331
+
19332
+ function toInteger(dirtyNumber) {
19333
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
19334
+ return NaN;
19335
+ }
19336
+ var number = Number(dirtyNumber);
19337
+ if (isNaN(number)) {
19338
+ return number;
19339
+ }
19340
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
19341
+ }
19342
+
19343
+ function requiredArgs(required, args) {
19344
+ if (args.length < required) {
19345
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
19346
+ }
19347
+ }
19348
+
19349
+ /**
19350
+ * @name toDate
19351
+ * @category Common Helpers
19352
+ * @summary Convert the given argument to an instance of Date.
19353
+ *
19354
+ * @description
19355
+ * Convert the given argument to an instance of Date.
19356
+ *
19357
+ * If the argument is an instance of Date, the function returns its clone.
19358
+ *
19359
+ * If the argument is a number, it is treated as a timestamp.
19360
+ *
19361
+ * If the argument is none of the above, the function returns Invalid Date.
19362
+ *
19363
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
19364
+ *
19365
+ * @param {Date|Number} argument - the value to convert
19366
+ * @returns {Date} the parsed date in the local time zone
19367
+ * @throws {TypeError} 1 argument required
19368
+ *
19369
+ * @example
19370
+ * // Clone the date:
19371
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
19372
+ * //=> Tue Feb 11 2014 11:30:30
19373
+ *
19374
+ * @example
19375
+ * // Convert the timestamp to date:
19376
+ * const result = toDate(1392098430000)
19377
+ * //=> Tue Feb 11 2014 11:30:30
19316
19378
  */
19317
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19318
- var prefetch = function prefetch(requests) {
19319
- var prefetching = [];
19320
- requests.forEach(function (request) {
19321
- var image = getMapImageStore.getImage(request.url, {
19322
- headers: request.headers
19323
- });
19324
- if (image.isLoaded() === false && image.isLoading() === false) {
19325
- prefetching.push(image);
19326
- image.load();
19379
+ function toDate(argument) {
19380
+ requiredArgs(1, arguments);
19381
+ var argStr = Object.prototype.toString.call(argument);
19382
+
19383
+ // Clone the date
19384
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
19385
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
19386
+ return new Date(argument.getTime());
19387
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
19388
+ return new Date(argument);
19389
+ } else {
19390
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
19391
+ // eslint-disable-next-line no-console
19392
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
19393
+ // eslint-disable-next-line no-console
19394
+ console.warn(new Error().stack);
19327
19395
  }
19328
- });
19329
- return prefetching;
19330
- };
19331
- var WMJSAnimate = /*#__PURE__*/function () {
19332
- function WMJSAnimate(_map) {
19333
- _classCallCheck(this, WMJSAnimate);
19334
- this._imageStore = getMapImageStore;
19335
- this.isNextTimeCloseToWallClockTime = false;
19336
- _map.animationDelay = 100;
19337
- this._callBack = _map.getListener();
19338
- this._divAnimationInfo = document.createElement('div');
19339
- _map.currentAnimationStep = 0;
19340
- _map.animationList = undefined;
19341
- _map.isAnimating = false;
19342
- _map.setAnimationDelay = function (delay) {
19343
- if (delay < 1) {
19344
- delay = 1;
19345
- }
19346
- _map.animationDelay = delay;
19347
- };
19348
- this.isNextTimeCloseToWallClockTime = false;
19349
- this._divAnimationInfo.style.zIndex = '10000';
19350
- this._divAnimationInfo.style.background = 'none';
19351
- this._divAnimationInfo.style.position = 'absolute';
19352
- this._divAnimationInfo.style.border = 'none';
19353
- this._divAnimationInfo.style.margin = '0px';
19354
- this._divAnimationInfo.style.padding = '0px';
19355
- this._divAnimationInfo.style.lineHeight = '14px';
19356
- this._divAnimationInfo.style.fontFamily = '"Courier New", "Lucida Console", Monospace';
19357
- this._divAnimationInfo.style.fontSize = '10px';
19358
- _map.getBaseElement().append(this._divAnimationInfo);
19359
- _map.isAnimatingLoopRunning = false;
19360
- this._map = _map;
19361
- /* Bind */
19362
- this._animate = this._animate.bind(this);
19363
- this._animateLoop = this._animateLoop.bind(this);
19364
- this.prefetchImagesForAnimationSteps = this.prefetchImagesForAnimationSteps.bind(this);
19365
- this.stopAnimating = this.stopAnimating.bind(this);
19366
- _map.stopAnimating = this.stopAnimating;
19367
- _map.checkAnimation = this.prefetchImagesForAnimationSteps;
19396
+ return new Date(NaN);
19368
19397
  }
19369
- _createClass(WMJSAnimate, [{
19370
- key: "isCurrentAnimationTimeCloseToWallClockTime",
19371
- value: function isCurrentAnimationTimeCloseToWallClockTime() {
19372
- if (this.isNextTimeCloseToWallClockTime) {
19373
- this.isNextTimeCloseToWallClockTime = false;
19374
- return true;
19375
- }
19376
- var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
19377
- var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
19378
- var wallClockTime = new Date();
19379
- var currentAnimationTime = new Date(currentAnimationStep.value);
19380
- var nextAnimationTime = new Date(nextAnimationStep.value);
19381
- if (dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
19382
- var timeDiff1 = dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
19383
- var timeDiff2 = dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
19384
- if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
19385
- // Wall clock time is closer to current animation step time than to the next animation step time
19386
- this.isNextTimeCloseToWallClockTime = false;
19387
- return true;
19388
- }
19389
- // Wall clock time is closer to next animation step time than to the current animation step time
19390
- this.isNextTimeCloseToWallClockTime = true;
19391
- }
19392
- return false;
19393
- }
19394
- }, {
19395
- key: "_animate",
19396
- value: function _animate() {
19397
- if (this._map.isAnimating === false) {
19398
- return;
19399
- }
19400
- if (this._map.animateBusy === true) {
19401
- return;
19402
- }
19403
- var animationStep = this._map.animationList[this._map.currentAnimationStep];
19404
- if (!animationStep) {
19405
- debug(DebugType.Error, "No animation step for ".concat(this._map.currentAnimationStep));
19406
- return;
19407
- }
19408
- this._map.setDimension(animationStep.name, animationStep.value, false);
19409
- this._callBack.triggerEvent('ondimchange');
19410
- this._callBack.triggerEvent('onnextanimationstep', this._map);
19411
- this._map.addLayersToCanvasAndDisplayThem();
19412
- this._map.animateBusy = false;
19413
- }
19414
- }, {
19415
- key: "_animateLoop",
19416
- value: function _animateLoop() {
19417
- var _this = this;
19418
- if (this._map.isAnimating === false) {
19419
- this._map.isAnimatingLoopRunning = false;
19420
- return;
19421
- }
19422
- var animationDelay = this._map.animationDelay;
19423
- var animationSteps = this._map.animationList;
19424
- if (this._map.currentAnimationStep === 0) {
19425
- animationDelay *= 3;
19426
- } else if (this._map.currentAnimationStep === animationSteps.length - 1) {
19427
- animationDelay *= 5;
19428
- } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
19429
- animationDelay *= 5;
19430
- }
19431
- // set up timer for next animation step
19432
- this._map.animationTimer.init(animationDelay, this._animateLoop);
19433
- this.prefetchImagesForAnimationSteps();
19434
- if (this._map.mouseHoverAnimationBox !== false) {
19435
- return;
19436
- }
19437
- this._animate();
19438
- var nextAnimationStepIndex = this._map.currentAnimationStep + 1;
19439
- if (nextAnimationStepIndex >= animationSteps.length) {
19440
- nextAnimationStepIndex = 0;
19441
- }
19442
- // get urls for images in next animation step
19443
- var nextAnimationStep = animationSteps[nextAnimationStepIndex];
19444
- nextAnimationStep.requests = this.getRequestsForAnimationStep(animationSteps, nextAnimationStepIndex);
19445
- // if images for next animation step is ready or haven't started loading
19446
- // change map animation step to next step
19447
- var numberOfImagesReadyForNextAnimationStep = 0;
19448
- nextAnimationStep.requests.forEach(function (request) {
19449
- var url = request.url;
19450
- var image = getMapImageStore.getImageForSrc(url);
19451
- /* Get a loaded image which has no error */
19452
- if (image === null || image === void 0 ? void 0 : image.isLoadedWithoutErrors()) {
19453
- numberOfImagesReadyForNextAnimationStep += 1;
19454
- return;
19455
- }
19456
- /* Check if a similar image is available instead, then we can continue with the smoother animation */
19457
- var alternativeImage = getAlternativeImage(url, getMapImageStore, _this._map.getDrawBBOX());
19458
- if (alternativeImage) {
19459
- numberOfImagesReadyForNextAnimationStep += 1;
19460
- return;
19461
- }
19462
- var imageHasntStartedLoading = !(image === null || image === void 0 ? void 0 : image.isLoading());
19463
- if (imageHasntStartedLoading) {
19464
- /* No alternatives and current image is not loading, so lets continue the animation */
19465
- numberOfImagesReadyForNextAnimationStep += 1;
19466
- }
19467
- });
19468
- if (numberOfImagesReadyForNextAnimationStep >= nextAnimationStep.requests.length) {
19469
- this._map.currentAnimationStep = nextAnimationStepIndex;
19470
- }
19471
- }
19472
- }, {
19473
- key: "prefetchImagesForAnimationSteps",
19474
- value: function prefetchImagesForAnimationSteps() {
19475
- if (this._map.isAnimating === false) {
19476
- this._map.isAnimatingLoopRunning = false;
19477
- return;
19478
- }
19479
- if (!this._map.animationTimer) {
19480
- this._map.animationTimer = new WMTimer();
19481
- }
19482
- var animationSteps = this._map.animationList;
19483
- var countAnimationSteps = animationSteps === null || animationSteps === void 0 ? void 0 : animationSteps.length;
19484
- if (countAnimationSteps && this._map.mouseHoverAnimationBox === false) {
19485
- for (var j = 0; j < countAnimationSteps; j += 1) {
19486
- // dont prefetch if already prefetching too many images
19487
- var maxSimultaneousLoads = 4;
19488
- var countImagesLoading = this._imageStore.getNumImagesLoading();
19489
- if (countImagesLoading > maxSimultaneousLoads - 1) {
19490
- break;
19491
- }
19492
- // start prefecthing images for the next animation step first
19493
- var index = j + this._map.currentAnimationStep;
19494
- while (index < 0) {
19495
- index += countAnimationSteps;
19496
- }
19497
- while (index >= countAnimationSteps) {
19498
- index -= countAnimationSteps;
19499
- }
19500
- if (index < 0) {
19501
- index = 0;
19502
- }
19503
- // get urls for animation step
19504
- var animationStep = animationSteps[index];
19505
- animationStep.requests = this.getRequestsForAnimationStep(animationSteps, index);
19506
- // prefetch images for animation step
19507
- animationStep.imagesInPrefetch = prefetch(animationStep.requests);
19508
- }
19509
- }
19510
- if (this._map.isAnimatingLoopRunning === false) {
19511
- this._map.isAnimatingLoopRunning = true;
19512
- this._animateLoop();
19513
- }
19514
- }
19515
- }, {
19516
- key: "stopAnimating",
19517
- value: function stopAnimating() {
19518
- if (this._map.isAnimating === false) {
19519
- return;
19520
- }
19521
- this._map._animationList = undefined;
19522
- this._divAnimationInfo.style.display = 'none';
19523
- this._map.isAnimating = false;
19524
- this._map.animateBusy = false;
19525
- this._map.rebuildMapDimensions();
19526
- this._callBack.triggerEvent('onstopanimation', this._map);
19527
- }
19528
- }, {
19529
- key: "getRequestsForAnimationStep",
19530
- value: function getRequestsForAnimationStep(animationSteps, index) {
19531
- // get urls for animation step
19532
- var animationStep = animationSteps[index];
19533
- this._map.setDimension(animationStep.name, animationStep.value, false);
19534
- var requests = this._map.getWMSRequests();
19535
- // set map back to correct dimension
19536
- var animationStepShownOnMap = animationSteps[this._map.currentAnimationStep];
19537
- this._map.setDimension(animationStepShownOnMap.name, animationStepShownOnMap.value, false);
19538
- return requests;
19539
- }
19540
- }]);
19541
- return WMJSAnimate;
19542
- }();
19398
+ }
19543
19399
 
19544
- var WMTileRenderer = /*#__PURE__*/function () {
19545
- function WMTileRenderer() {
19546
- _classCallCheck(this, WMTileRenderer);
19400
+ /**
19401
+ * @name addDays
19402
+ * @category Day Helpers
19403
+ * @summary Add the specified number of days to the given date.
19404
+ *
19405
+ * @description
19406
+ * Add the specified number of days to the given date.
19407
+ *
19408
+ * @param {Date|Number} date - the date to be changed
19409
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19410
+ * @returns {Date} - the new date with the days added
19411
+ * @throws {TypeError} - 2 arguments required
19412
+ *
19413
+ * @example
19414
+ * // Add 10 days to 1 September 2014:
19415
+ * const result = addDays(new Date(2014, 8, 1), 10)
19416
+ * //=> Thu Sep 11 2014 00:00:00
19417
+ */
19418
+ function addDays(dirtyDate, dirtyAmount) {
19419
+ requiredArgs(2, arguments);
19420
+ var date = toDate(dirtyDate);
19421
+ var amount = toInteger(dirtyAmount);
19422
+ if (isNaN(amount)) {
19423
+ return new Date(NaN);
19547
19424
  }
19548
- _createClass(WMTileRenderer, [{
19549
- key: "render",
19550
- value: function render(currentBBOX, newBBOX, srs, width, height, ctx, bgMapImageStore,
19551
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
19552
- tileOptions, layerName) {
19553
- var renderedURLs = {};
19554
- var imagesToRender = [];
19555
- if (!layerName) {
19556
- debug(DebugType.Error);
19557
- return undefined;
19558
- }
19559
- /* Temporal mappings from bgmaps.cgi service names to names defined here */
19560
- if (layerName === 'streetmap') {
19561
- layerName = 'OSM';
19562
- }
19425
+ if (!amount) {
19426
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
19427
+ return date;
19428
+ }
19429
+ date.setDate(date.getDate() + amount);
19430
+ return date;
19431
+ }
19432
+
19433
+ /**
19434
+ * @name addMonths
19435
+ * @category Month Helpers
19436
+ * @summary Add the specified number of months to the given date.
19437
+ *
19438
+ * @description
19439
+ * Add the specified number of months to the given date.
19440
+ *
19441
+ * @param {Date|Number} date - the date to be changed
19442
+ * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19443
+ * @returns {Date} the new date with the months added
19444
+ * @throws {TypeError} 2 arguments required
19445
+ *
19446
+ * @example
19447
+ * // Add 5 months to 1 September 2014:
19448
+ * const result = addMonths(new Date(2014, 8, 1), 5)
19449
+ * //=> Sun Feb 01 2015 00:00:00
19450
+ */
19451
+ function addMonths(dirtyDate, dirtyAmount) {
19452
+ requiredArgs(2, arguments);
19453
+ var date = toDate(dirtyDate);
19454
+ var amount = toInteger(dirtyAmount);
19455
+ if (isNaN(amount)) {
19456
+ return new Date(NaN);
19457
+ }
19458
+ if (!amount) {
19459
+ // If 0 months, no-op to avoid changing times in the hour before end of DST
19460
+ return date;
19461
+ }
19462
+ var dayOfMonth = date.getDate();
19463
+
19464
+ // The JS Date object supports date math by accepting out-of-bounds values for
19465
+ // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
19466
+ // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
19467
+ // want except that dates will wrap around the end of a month, meaning that
19468
+ // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
19469
+ // we'll default to the end of the desired month by adding 1 to the desired
19470
+ // month and using a date of 0 to back up one day to the end of the desired
19471
+ // month.
19472
+ var endOfDesiredMonth = new Date(date.getTime());
19473
+ endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
19474
+ var daysInMonth = endOfDesiredMonth.getDate();
19475
+ if (dayOfMonth >= daysInMonth) {
19476
+ // If we're already at the end of the month, then this is the correct date
19477
+ // and we're done.
19478
+ return endOfDesiredMonth;
19479
+ } else {
19480
+ // Otherwise, we now know that setting the original day-of-month value won't
19481
+ // cause an overflow, so set the desired day-of-month. Note that we can't
19482
+ // just set the date of `endOfDesiredMonth` because that object may have had
19483
+ // its time changed in the unusual case where where a DST transition was on
19484
+ // the last day of the month and its local time was in the hour skipped or
19485
+ // repeated next to a DST transition. So we use `date` instead which is
19486
+ // guaranteed to still have the original time.
19487
+ date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
19488
+ return date;
19489
+ }
19490
+ }
19491
+
19492
+ /**
19493
+ * @name add
19494
+ * @category Common Helpers
19495
+ * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
19496
+ *
19497
+ * @description
19498
+ * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
19499
+ *
19500
+ * @param {Date|Number} date - the date to be changed
19501
+ * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19502
+ *
19503
+ * | Key | Description |
19504
+ * |----------------|------------------------------------|
19505
+ * | years | Amount of years to be added |
19506
+ * | months | Amount of months to be added |
19507
+ * | weeks | Amount of weeks to be added |
19508
+ * | days | Amount of days to be added |
19509
+ * | hours | Amount of hours to be added |
19510
+ * | minutes | Amount of minutes to be added |
19511
+ * | seconds | Amount of seconds to be added |
19512
+ *
19513
+ * All values default to 0
19514
+ *
19515
+ * @returns {Date} the new date with the seconds added
19516
+ * @throws {TypeError} 2 arguments required
19517
+ *
19518
+ * @example
19519
+ * // Add the following duration to 1 September 2014, 10:19:50
19520
+ * const result = add(new Date(2014, 8, 1, 10, 19, 50), {
19521
+ * years: 2,
19522
+ * months: 9,
19523
+ * weeks: 1,
19524
+ * days: 7,
19525
+ * hours: 5,
19526
+ * minutes: 9,
19527
+ * seconds: 30,
19528
+ * })
19529
+ * //=> Thu Jun 15 2017 15:29:20
19530
+ */
19531
+ function add(dirtyDate, duration) {
19532
+ requiredArgs(2, arguments);
19533
+ if (!duration || _typeof(duration) !== 'object') return new Date(NaN);
19534
+ var years = duration.years ? toInteger(duration.years) : 0;
19535
+ var months = duration.months ? toInteger(duration.months) : 0;
19536
+ var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
19537
+ var days = duration.days ? toInteger(duration.days) : 0;
19538
+ var hours = duration.hours ? toInteger(duration.hours) : 0;
19539
+ var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
19540
+ var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
19541
+
19542
+ // Add years and months
19543
+ var date = toDate(dirtyDate);
19544
+ var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date;
19545
+
19546
+ // Add weeks and days
19547
+ var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
19548
+
19549
+ // Add days, hours, minutes and seconds
19550
+ var minutesToAdd = minutes + hours * 60;
19551
+ var secondsToAdd = seconds + minutesToAdd * 60;
19552
+ var msToAdd = secondsToAdd * 1000;
19553
+ var finalDate = new Date(dateWithDays.getTime() + msToAdd);
19554
+ return finalDate;
19555
+ }
19556
+
19557
+ /**
19558
+ * Days in 1 week.
19559
+ *
19560
+ * @name daysInWeek
19561
+ * @constant
19562
+ * @type {number}
19563
+ * @default
19564
+ */
19565
+
19566
+ /**
19567
+ * Milliseconds in 1 minute
19568
+ *
19569
+ * @name millisecondsInMinute
19570
+ * @constant
19571
+ * @type {number}
19572
+ * @default
19573
+ */
19574
+ var millisecondsInMinute = 60000;
19575
+
19576
+ /**
19577
+ * Milliseconds in 1 hour
19578
+ *
19579
+ * @name millisecondsInHour
19580
+ * @constant
19581
+ * @type {number}
19582
+ * @default
19583
+ */
19584
+ var millisecondsInHour = 3600000;
19585
+
19586
+ /**
19587
+ * @name isDate
19588
+ * @category Common Helpers
19589
+ * @summary Is the given value a date?
19590
+ *
19591
+ * @description
19592
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
19593
+ *
19594
+ * @param {*} value - the value to check
19595
+ * @returns {boolean} true if the given value is a date
19596
+ * @throws {TypeError} 1 arguments required
19597
+ *
19598
+ * @example
19599
+ * // For a valid date:
19600
+ * const result = isDate(new Date())
19601
+ * //=> true
19602
+ *
19603
+ * @example
19604
+ * // For an invalid date:
19605
+ * const result = isDate(new Date(NaN))
19606
+ * //=> true
19607
+ *
19608
+ * @example
19609
+ * // For some value:
19610
+ * const result = isDate('2014-02-31')
19611
+ * //=> false
19612
+ *
19613
+ * @example
19614
+ * // For an object:
19615
+ * const result = isDate({})
19616
+ * //=> false
19617
+ */
19618
+ function isDate(value) {
19619
+ requiredArgs(1, arguments);
19620
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
19621
+ }
19622
+
19623
+ /**
19624
+ * @name isValid
19625
+ * @category Common Helpers
19626
+ * @summary Is the given date valid?
19627
+ *
19628
+ * @description
19629
+ * Returns false if argument is Invalid Date and true otherwise.
19630
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
19631
+ * Invalid Date is a Date, whose time value is NaN.
19632
+ *
19633
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
19634
+ *
19635
+ * @param {*} date - the date to check
19636
+ * @returns {Boolean} the date is valid
19637
+ * @throws {TypeError} 1 argument required
19638
+ *
19639
+ * @example
19640
+ * // For the valid date:
19641
+ * const result = isValid(new Date(2014, 1, 31))
19642
+ * //=> true
19643
+ *
19644
+ * @example
19645
+ * // For the value, convertable into a date:
19646
+ * const result = isValid(1393804800000)
19647
+ * //=> true
19648
+ *
19649
+ * @example
19650
+ * // For the invalid date:
19651
+ * const result = isValid(new Date(''))
19652
+ * //=> false
19653
+ */
19654
+ function isValid(dirtyDate) {
19655
+ requiredArgs(1, arguments);
19656
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
19657
+ return false;
19658
+ }
19659
+ var date = toDate(dirtyDate);
19660
+ return !isNaN(Number(date));
19661
+ }
19662
+
19663
+ /**
19664
+ * @name isWithinInterval
19665
+ * @category Interval Helpers
19666
+ * @summary Is the given date within the interval?
19667
+ *
19668
+ * @description
19669
+ * Is the given date within the interval? (Including start and end.)
19670
+ *
19671
+ * @param {Date|Number} date - the date to check
19672
+ * @param {Interval} interval - the interval to check
19673
+ * @returns {Boolean} the date is within the interval
19674
+ * @throws {TypeError} 2 arguments required
19675
+ * @throws {RangeError} The start of an interval cannot be after its end
19676
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
19677
+ *
19678
+ * @example
19679
+ * // For the date within the interval:
19680
+ * isWithinInterval(new Date(2014, 0, 3), {
19681
+ * start: new Date(2014, 0, 1),
19682
+ * end: new Date(2014, 0, 7)
19683
+ * })
19684
+ * //=> true
19685
+ *
19686
+ * @example
19687
+ * // For the date outside of the interval:
19688
+ * isWithinInterval(new Date(2014, 0, 10), {
19689
+ * start: new Date(2014, 0, 1),
19690
+ * end: new Date(2014, 0, 7)
19691
+ * })
19692
+ * //=> false
19693
+ *
19694
+ * @example
19695
+ * // For date equal to interval start:
19696
+ * isWithinInterval(date, { start, end: date }) // => true
19697
+ *
19698
+ * @example
19699
+ * // For date equal to interval end:
19700
+ * isWithinInterval(date, { start: date, end }) // => true
19701
+ */
19702
+ function isWithinInterval(dirtyDate, interval) {
19703
+ requiredArgs(2, arguments);
19704
+ var time = toDate(dirtyDate).getTime();
19705
+ var startTime = toDate(interval.start).getTime();
19706
+ var endTime = toDate(interval.end).getTime();
19707
+
19708
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
19709
+ if (!(startTime <= endTime)) {
19710
+ throw new RangeError('Invalid interval');
19711
+ }
19712
+ return time >= startTime && time <= endTime;
19713
+ }
19714
+
19715
+ /**
19716
+ * @name subDays
19717
+ * @category Day Helpers
19718
+ * @summary Subtract the specified number of days from the given date.
19719
+ *
19720
+ * @description
19721
+ * Subtract the specified number of days from the given date.
19722
+ *
19723
+ * @param {Date|Number} date - the date to be changed
19724
+ * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19725
+ * @returns {Date} the new date with the days subtracted
19726
+ * @throws {TypeError} 2 arguments required
19727
+ *
19728
+ * @example
19729
+ * // Subtract 10 days from 1 September 2014:
19730
+ * const result = subDays(new Date(2014, 8, 1), 10)
19731
+ * //=> Fri Aug 22 2014 00:00:00
19732
+ */
19733
+ function subDays(dirtyDate, dirtyAmount) {
19734
+ requiredArgs(2, arguments);
19735
+ var amount = toInteger(dirtyAmount);
19736
+ return addDays(dirtyDate, -amount);
19737
+ }
19738
+
19739
+ /**
19740
+ * @name parseISO
19741
+ * @category Common Helpers
19742
+ * @summary Parse ISO string
19743
+ *
19744
+ * @description
19745
+ * Parse the given string in ISO 8601 format and return an instance of Date.
19746
+ *
19747
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
19748
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
19749
+ *
19750
+ * If the argument isn't a string, the function cannot parse the string or
19751
+ * the values are invalid, it returns Invalid Date.
19752
+ *
19753
+ * @param {String} argument - the value to convert
19754
+ * @param {Object} [options] - an object with options.
19755
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
19756
+ * @returns {Date} the parsed date in the local time zone
19757
+ * @throws {TypeError} 1 argument required
19758
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
19759
+ *
19760
+ * @example
19761
+ * // Convert string '2014-02-11T11:30:30' to date:
19762
+ * const result = parseISO('2014-02-11T11:30:30')
19763
+ * //=> Tue Feb 11 2014 11:30:30
19764
+ *
19765
+ * @example
19766
+ * // Convert string '+02014101' to date,
19767
+ * // if the additional number of digits in the extended year format is 1:
19768
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
19769
+ * //=> Fri Apr 11 2014 00:00:00
19770
+ */
19771
+ function parseISO(argument, options) {
19772
+ var _options$additionalDi;
19773
+ requiredArgs(1, arguments);
19774
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
19775
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
19776
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
19777
+ }
19778
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
19779
+ return new Date(NaN);
19780
+ }
19781
+ var dateStrings = splitDateString(argument);
19782
+ var date;
19783
+ if (dateStrings.date) {
19784
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
19785
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
19786
+ }
19787
+ if (!date || isNaN(date.getTime())) {
19788
+ return new Date(NaN);
19789
+ }
19790
+ var timestamp = date.getTime();
19791
+ var time = 0;
19792
+ var offset;
19793
+ if (dateStrings.time) {
19794
+ time = parseTime(dateStrings.time);
19795
+ if (isNaN(time)) {
19796
+ return new Date(NaN);
19797
+ }
19798
+ }
19799
+ if (dateStrings.timezone) {
19800
+ offset = parseTimezone(dateStrings.timezone);
19801
+ if (isNaN(offset)) {
19802
+ return new Date(NaN);
19803
+ }
19804
+ } else {
19805
+ var dirtyDate = new Date(timestamp + time);
19806
+ // js parsed string assuming it's in UTC timezone
19807
+ // but we need it to be parsed in our timezone
19808
+ // so we use utc values to build date in our timezone.
19809
+ // Year values from 0 to 99 map to the years 1900 to 1999
19810
+ // so set year explicitly with setFullYear.
19811
+ var result = new Date(0);
19812
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
19813
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
19814
+ return result;
19815
+ }
19816
+ return new Date(timestamp + time + offset);
19817
+ }
19818
+ var patterns = {
19819
+ dateTimeDelimiter: /[T ]/,
19820
+ timeZoneDelimiter: /[Z ]/i,
19821
+ timezone: /([Z+-].*)$/
19822
+ };
19823
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
19824
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
19825
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
19826
+ function splitDateString(dateString) {
19827
+ var dateStrings = {};
19828
+ var array = dateString.split(patterns.dateTimeDelimiter);
19829
+ var timeString;
19830
+
19831
+ // The regex match should only return at maximum two array elements.
19832
+ // [date], [time], or [date, time].
19833
+ if (array.length > 2) {
19834
+ return dateStrings;
19835
+ }
19836
+ if (/:/.test(array[0])) {
19837
+ timeString = array[0];
19838
+ } else {
19839
+ dateStrings.date = array[0];
19840
+ timeString = array[1];
19841
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
19842
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
19843
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
19844
+ }
19845
+ }
19846
+ if (timeString) {
19847
+ var token = patterns.timezone.exec(timeString);
19848
+ if (token) {
19849
+ dateStrings.time = timeString.replace(token[1], '');
19850
+ dateStrings.timezone = token[1];
19851
+ } else {
19852
+ dateStrings.time = timeString;
19853
+ }
19854
+ }
19855
+ return dateStrings;
19856
+ }
19857
+ function parseYear(dateString, additionalDigits) {
19858
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
19859
+ var captures = dateString.match(regex);
19860
+ // Invalid ISO-formatted year
19861
+ if (!captures) return {
19862
+ year: NaN,
19863
+ restDateString: ''
19864
+ };
19865
+ var year = captures[1] ? parseInt(captures[1]) : null;
19866
+ var century = captures[2] ? parseInt(captures[2]) : null;
19867
+
19868
+ // either year or century is null, not both
19869
+ return {
19870
+ year: century === null ? year : century * 100,
19871
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
19872
+ };
19873
+ }
19874
+ function parseDate(dateString, year) {
19875
+ // Invalid ISO-formatted year
19876
+ if (year === null) return new Date(NaN);
19877
+ var captures = dateString.match(dateRegex);
19878
+ // Invalid ISO-formatted string
19879
+ if (!captures) return new Date(NaN);
19880
+ var isWeekDate = !!captures[4];
19881
+ var dayOfYear = parseDateUnit(captures[1]);
19882
+ var month = parseDateUnit(captures[2]) - 1;
19883
+ var day = parseDateUnit(captures[3]);
19884
+ var week = parseDateUnit(captures[4]);
19885
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
19886
+ if (isWeekDate) {
19887
+ if (!validateWeekDate(year, week, dayOfWeek)) {
19888
+ return new Date(NaN);
19889
+ }
19890
+ return dayOfISOWeekYear(year, week, dayOfWeek);
19891
+ } else {
19892
+ var date = new Date(0);
19893
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
19894
+ return new Date(NaN);
19895
+ }
19896
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
19897
+ return date;
19898
+ }
19899
+ }
19900
+ function parseDateUnit(value) {
19901
+ return value ? parseInt(value) : 1;
19902
+ }
19903
+ function parseTime(timeString) {
19904
+ var captures = timeString.match(timeRegex);
19905
+ if (!captures) return NaN; // Invalid ISO-formatted time
19906
+
19907
+ var hours = parseTimeUnit(captures[1]);
19908
+ var minutes = parseTimeUnit(captures[2]);
19909
+ var seconds = parseTimeUnit(captures[3]);
19910
+ if (!validateTime(hours, minutes, seconds)) {
19911
+ return NaN;
19912
+ }
19913
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
19914
+ }
19915
+ function parseTimeUnit(value) {
19916
+ return value && parseFloat(value.replace(',', '.')) || 0;
19917
+ }
19918
+ function parseTimezone(timezoneString) {
19919
+ if (timezoneString === 'Z') return 0;
19920
+ var captures = timezoneString.match(timezoneRegex);
19921
+ if (!captures) return 0;
19922
+ var sign = captures[1] === '+' ? -1 : 1;
19923
+ var hours = parseInt(captures[2]);
19924
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
19925
+ if (!validateTimezone(hours, minutes)) {
19926
+ return NaN;
19927
+ }
19928
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
19929
+ }
19930
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
19931
+ var date = new Date(0);
19932
+ date.setUTCFullYear(isoWeekYear, 0, 4);
19933
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
19934
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
19935
+ date.setUTCDate(date.getUTCDate() + diff);
19936
+ return date;
19937
+ }
19938
+
19939
+ // Validation functions
19940
+
19941
+ // February is null to handle the leap year (using ||)
19942
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
19943
+ function isLeapYearIndex(year) {
19944
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
19945
+ }
19946
+ function validateDate(year, month, date) {
19947
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
19948
+ }
19949
+ function validateDayOfYearDate(year, dayOfYear) {
19950
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
19951
+ }
19952
+ function validateWeekDate(_year, week, day) {
19953
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
19954
+ }
19955
+ function validateTime(hours, minutes, seconds) {
19956
+ if (hours === 24) {
19957
+ return minutes === 0 && seconds === 0;
19958
+ }
19959
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
19960
+ }
19961
+ function validateTimezone(_hours, minutes) {
19962
+ return minutes >= 0 && minutes <= 59;
19963
+ }
19964
+
19965
+ /**
19966
+ * @name subMonths
19967
+ * @category Month Helpers
19968
+ * @summary Subtract the specified number of months from the given date.
19969
+ *
19970
+ * @description
19971
+ * Subtract the specified number of months from the given date.
19972
+ *
19973
+ * @param {Date|Number} date - the date to be changed
19974
+ * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19975
+ * @returns {Date} the new date with the months subtracted
19976
+ * @throws {TypeError} 2 arguments required
19977
+ *
19978
+ * @example
19979
+ * // Subtract 5 months from 1 February 2015:
19980
+ * const result = subMonths(new Date(2015, 1, 1), 5)
19981
+ * //=> Mon Sep 01 2014 00:00:00
19982
+ */
19983
+ function subMonths(dirtyDate, dirtyAmount) {
19984
+ requiredArgs(2, arguments);
19985
+ var amount = toInteger(dirtyAmount);
19986
+ return addMonths(dirtyDate, -amount);
19987
+ }
19988
+
19989
+ /**
19990
+ * @name sub
19991
+ * @category Common Helpers
19992
+ * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.
19993
+ *
19994
+ * @description
19995
+ * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.
19996
+ *
19997
+ * @param {Date|Number} date - the date to be changed
19998
+ * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be subtracted
19999
+ *
20000
+ * | Key | Description |
20001
+ * |---------|------------------------------------|
20002
+ * | years | Amount of years to be subtracted |
20003
+ * | months | Amount of months to be subtracted |
20004
+ * | weeks | Amount of weeks to be subtracted |
20005
+ * | days | Amount of days to be subtracted |
20006
+ * | hours | Amount of hours to be subtracted |
20007
+ * | minutes | Amount of minutes to be subtracted |
20008
+ * | seconds | Amount of seconds to be subtracted |
20009
+ *
20010
+ * All values default to 0
20011
+ *
20012
+ * @returns {Date} the new date with the seconds subtracted
20013
+ * @throws {TypeError} 2 arguments required
20014
+ *
20015
+ * @example
20016
+ * // Subtract the following duration from 15 June 2017 15:29:20
20017
+ * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {
20018
+ * years: 2,
20019
+ * months: 9,
20020
+ * weeks: 1,
20021
+ * days: 7,
20022
+ * hours: 5,
20023
+ * minutes: 9,
20024
+ * seconds: 30
20025
+ * })
20026
+ * //=> Mon Sep 1 2014 10:19:50
20027
+ */
20028
+ function sub(date, duration) {
20029
+ requiredArgs(2, arguments);
20030
+ if (!duration || _typeof(duration) !== 'object') return new Date(NaN);
20031
+ var years = duration.years ? toInteger(duration.years) : 0;
20032
+ var months = duration.months ? toInteger(duration.months) : 0;
20033
+ var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
20034
+ var days = duration.days ? toInteger(duration.days) : 0;
20035
+ var hours = duration.hours ? toInteger(duration.hours) : 0;
20036
+ var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
20037
+ var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
20038
+
20039
+ // Subtract years and months
20040
+ var dateWithoutMonths = subMonths(date, months + years * 12);
20041
+
20042
+ // Subtract weeks and days
20043
+ var dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7);
20044
+
20045
+ // Subtract hours, minutes and seconds
20046
+ var minutestoSub = minutes + hours * 60;
20047
+ var secondstoSub = seconds + minutestoSub * 60;
20048
+ var mstoSub = secondstoSub * 1000;
20049
+ var finalDate = new Date(dateWithoutDays.getTime() - mstoSub);
20050
+ return finalDate;
20051
+ }
20052
+
20053
+ var MAX_IMAGES_TO_PREFETCH_DEFAULT = 8;
20054
+ function prefetchImagesForAnimation(wmMap) {
20055
+ var maxImagesToPrefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_IMAGES_TO_PREFETCH_DEFAULT;
20056
+ var animationSteps = wmMap.animationList;
20057
+ var countAnimationSteps = animationSteps.length;
20058
+ var timesToPrefetchInOrder = lodash.exports.range(0, countAnimationSteps).map(function (offset) {
20059
+ // start prefecthing images for the next animation step first
20060
+ // when reaching end of animation, start from the beginning
20061
+ var indexOfNextAnimationStep = (wmMap.currentAnimationStep + offset) % countAnimationSteps;
20062
+ return animationSteps[indexOfNextAnimationStep].value;
20063
+ });
20064
+ var currentTime = animationSteps[wmMap.currentAnimationStep].value;
20065
+ prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime);
20066
+ }
20067
+ function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime) {
20068
+ var _iterator = _createForOfIteratorHelper(timesToPrefetchInOrder),
20069
+ _step;
20070
+ try {
20071
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
20072
+ var timeToPrefetch = _step.value;
20073
+ // dont prefetch if already prefetching too many images
20074
+ var countImagesLoading = getMapImageStore.getNumImagesLoading();
20075
+ if (countImagesLoading > maxImagesToPrefetch - 1) {
20076
+ break;
20077
+ }
20078
+ var layersImageUrls = getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime);
20079
+ prefetchLayerImagesForTime(layersImageUrls);
20080
+ }
20081
+ } catch (err) {
20082
+ _iterator.e(err);
20083
+ } finally {
20084
+ _iterator.f();
20085
+ }
20086
+ }
20087
+ function getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime) {
20088
+ // get urls for layers at time
20089
+ wmMap.setTimeDimension(timeToPrefetch, false);
20090
+ var layersImageUrls = wmMap.getWMSRequests();
20091
+ // set map back to correct time
20092
+ wmMap.setTimeDimension(currentTime, false);
20093
+ return layersImageUrls;
20094
+ }
20095
+ function prefetchLayerImagesForTime(requests) {
20096
+ requests.forEach(function (request) {
20097
+ var image = getMapImageStore.getImage(request.url, {
20098
+ headers: request.headers
20099
+ });
20100
+ if (image.hasNotStartedLoading()) {
20101
+ image.load();
20102
+ }
20103
+ });
20104
+ }
20105
+ function prefetchImagesForNonAnimation(wmMap) {
20106
+ var maxImagesToPrefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_IMAGES_TO_PREFETCH_DEFAULT;
20107
+ var timestepInMinutes = wmMap.timestepInMinutes;
20108
+ var timeDimension = wmMap.getDimension('time');
20109
+ if (!timeDimension || !timestepInMinutes) {
20110
+ return;
20111
+ }
20112
+ var currentValue = timeDimension.currentValue;
20113
+ var currentTimeIsoString = timeDimension.getClosestValue(currentValue);
20114
+ var currentTime = parseISO(currentTimeIsoString);
20115
+ if (!isValid(currentTime)) {
20116
+ return;
20117
+ }
20118
+ var maxTimesToPrefetchIfOneLayer = maxImagesToPrefetch / 2;
20119
+ var timesToPrefetchInOrder = lodash.exports.range(0, maxTimesToPrefetchIfOneLayer).flatMap(function (offset) {
20120
+ var duration = {
20121
+ minutes: timestepInMinutes * offset
20122
+ };
20123
+ var nextTime = add(currentTime, duration).toISOString();
20124
+ var previousTime = sub(currentTime, duration).toISOString();
20125
+ return [nextTime, previousTime];
20126
+ });
20127
+ prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime.toISOString());
20128
+ }
20129
+
20130
+ /* *
20131
+ * Licensed under the Apache License, Version 2.0 (the "License");
20132
+ * you may not use this file except in compliance with the License.
20133
+ * You may obtain a copy of the License at
20134
+ *
20135
+ * http://www.apache.org/licenses/LICENSE-2.0
20136
+ *
20137
+ * Unless required by applicable law or agreed to in writing, software
20138
+ * distributed under the License is distributed on an "AS IS" BASIS,
20139
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20140
+ * See the License for the specific language governing permissions and
20141
+ * limitations under the License.
20142
+ *
20143
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
20144
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
20145
+ * */
20146
+ var _WMJSAnimate_instances, _WMJSAnimate_animate;
20147
+ var WMJSAnimate = /*#__PURE__*/function () {
20148
+ function WMJSAnimate(_map) {
20149
+ _classCallCheck(this, WMJSAnimate);
20150
+ _WMJSAnimate_instances.add(this);
20151
+ this._imageStore = getMapImageStore;
20152
+ this.isNextTimeCloseToWallClockTime = false;
20153
+ _map.animationDelay = 100;
20154
+ this._callBack = _map.getListener();
20155
+ this._divAnimationInfo = document.createElement('div');
20156
+ _map.currentAnimationStep = 0;
20157
+ _map.animationList = undefined;
20158
+ _map.isAnimating = false;
20159
+ _map.setAnimationDelay = function (delay) {
20160
+ if (delay < 1) {
20161
+ delay = 1;
20162
+ }
20163
+ _map.animationDelay = delay;
20164
+ };
20165
+ this.isNextTimeCloseToWallClockTime = false;
20166
+ this._divAnimationInfo.style.zIndex = '10000';
20167
+ this._divAnimationInfo.style.background = 'none';
20168
+ this._divAnimationInfo.style.position = 'absolute';
20169
+ this._divAnimationInfo.style.border = 'none';
20170
+ this._divAnimationInfo.style.margin = '0px';
20171
+ this._divAnimationInfo.style.padding = '0px';
20172
+ this._divAnimationInfo.style.lineHeight = '14px';
20173
+ this._divAnimationInfo.style.fontFamily = '"Courier New", "Lucida Console", Monospace';
20174
+ this._divAnimationInfo.style.fontSize = '10px';
20175
+ _map.getBaseElement().append(this._divAnimationInfo);
20176
+ this._map = _map;
20177
+ /* Bind */
20178
+ this.loopAnimation = this.loopAnimation.bind(this);
20179
+ this.stopAnimating = this.stopAnimating.bind(this);
20180
+ _map.stopAnimating = this.stopAnimating;
20181
+ }
20182
+ _createClass(WMJSAnimate, [{
20183
+ key: "isCurrentAnimationTimeCloseToWallClockTime",
20184
+ value: function isCurrentAnimationTimeCloseToWallClockTime() {
20185
+ if (this.isNextTimeCloseToWallClockTime) {
20186
+ this.isNextTimeCloseToWallClockTime = false;
20187
+ return true;
20188
+ }
20189
+ var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
20190
+ var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
20191
+ var wallClockTime = new Date();
20192
+ var currentAnimationTime = new Date(currentAnimationStep.value);
20193
+ var nextAnimationTime = new Date(nextAnimationStep.value);
20194
+ if (dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
20195
+ var timeDiff1 = dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
20196
+ var timeDiff2 = dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
20197
+ if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
20198
+ // Wall clock time is closer to current animation step time than to the next animation step time
20199
+ this.isNextTimeCloseToWallClockTime = false;
20200
+ return true;
20201
+ }
20202
+ // Wall clock time is closer to next animation step time than to the current animation step time
20203
+ this.isNextTimeCloseToWallClockTime = true;
20204
+ }
20205
+ return false;
20206
+ }
20207
+ }, {
20208
+ key: "loopAnimation",
20209
+ value: function loopAnimation() {
20210
+ var _this = this;
20211
+ if (this._map.isAnimating === false) {
20212
+ return;
20213
+ }
20214
+ var animationDelay = this._map.animationDelay;
20215
+ var animationSteps = this._map.animationList;
20216
+ if (this._map.currentAnimationStep === 0) {
20217
+ animationDelay *= 3;
20218
+ } else if (this._map.currentAnimationStep === animationSteps.length - 1) {
20219
+ animationDelay *= 5;
20220
+ } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
20221
+ animationDelay *= 5;
20222
+ }
20223
+ // set up timer for next animation step
20224
+ this._map.animationTimer.init(animationDelay, this.loopAnimation);
20225
+ prefetchImagesForAnimation(this._map);
20226
+ if (this._map.mouseHoverAnimationBox !== false) {
20227
+ return;
20228
+ }
20229
+ __classPrivateFieldGet(this, _WMJSAnimate_instances, "m", _WMJSAnimate_animate).call(this);
20230
+ var nextAnimationStepIndex = this._map.currentAnimationStep + 1;
20231
+ if (nextAnimationStepIndex >= animationSteps.length) {
20232
+ nextAnimationStepIndex = 0;
20233
+ }
20234
+ // get urls for images in next animation step
20235
+ var layersImageUrls = getLayersImageUrlsForTime(this._map, animationSteps[nextAnimationStepIndex].value, animationSteps[this._map.currentAnimationStep].value);
20236
+ // if images for next animation step is ready or haven't started loading
20237
+ // change map animation step to next step
20238
+ var numberOfImagesReadyForNextAnimationStep = 0;
20239
+ layersImageUrls.forEach(function (request) {
20240
+ var url = request.url;
20241
+ var image = getMapImageStore.getImageForSrc(url);
20242
+ /* Get a loaded image which has no error */
20243
+ if (image === null || image === void 0 ? void 0 : image.isLoadedWithoutErrors()) {
20244
+ numberOfImagesReadyForNextAnimationStep += 1;
20245
+ return;
20246
+ }
20247
+ /* Check if a similar image is available instead, then we can continue with the smoother animation */
20248
+ var alternativeImage = getAlternativeImage(url, getMapImageStore, _this._map.getDrawBBOX());
20249
+ if (alternativeImage) {
20250
+ numberOfImagesReadyForNextAnimationStep += 1;
20251
+ return;
20252
+ }
20253
+ var imageHasntStartedLoading = !(image === null || image === void 0 ? void 0 : image.isLoading());
20254
+ if (imageHasntStartedLoading) {
20255
+ /* No alternatives and current image is not loading, so lets continue the animation */
20256
+ numberOfImagesReadyForNextAnimationStep += 1;
20257
+ }
20258
+ });
20259
+ if (numberOfImagesReadyForNextAnimationStep >= layersImageUrls.length) {
20260
+ this._map.currentAnimationStep = nextAnimationStepIndex;
20261
+ }
20262
+ }
20263
+ }, {
20264
+ key: "stopAnimating",
20265
+ value: function stopAnimating() {
20266
+ if (this._map.isAnimating === false) {
20267
+ return;
20268
+ }
20269
+ this._map._animationList = undefined;
20270
+ this._divAnimationInfo.style.display = 'none';
20271
+ this._map.isAnimating = false;
20272
+ this._map.animateBusy = false;
20273
+ this._map.rebuildMapDimensions();
20274
+ this._callBack.triggerEvent('onstopanimation', this._map);
20275
+ }
20276
+ }]);
20277
+ return WMJSAnimate;
20278
+ }();
20279
+ _WMJSAnimate_instances = new WeakSet(), _WMJSAnimate_animate = function _WMJSAnimate_animate() {
20280
+ if (this._map.isAnimating === false) {
20281
+ return;
20282
+ }
20283
+ if (this._map.animateBusy === true) {
20284
+ return;
20285
+ }
20286
+ var animationStep = this._map.animationList[this._map.currentAnimationStep];
20287
+ if (!animationStep) {
20288
+ debugLogger(DebugType.Error, "No animation step for ".concat(this._map.currentAnimationStep));
20289
+ return;
20290
+ }
20291
+ this._map.setDimension(animationStep.name, animationStep.value, false);
20292
+ this._callBack.triggerEvent('ondimchange');
20293
+ this._callBack.triggerEvent('onnextanimationstep', this._map);
20294
+ this._map.addLayersToCanvasAndDisplayThem();
20295
+ this._map.animateBusy = false;
20296
+ };
20297
+
20298
+ var WMTileRenderer = /*#__PURE__*/function () {
20299
+ function WMTileRenderer() {
20300
+ _classCallCheck(this, WMTileRenderer);
20301
+ }
20302
+ _createClass(WMTileRenderer, [{
20303
+ key: "render",
20304
+ value: function render(currentBBOX, newBBOX, srs, width, height, ctx, bgMapImageStore,
20305
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
20306
+ tileOptions, layerName) {
20307
+ var renderedURLs = {};
20308
+ var imagesToRender = [];
20309
+ if (!layerName) {
20310
+ debugLogger(DebugType.Error);
20311
+ return undefined;
20312
+ }
20313
+ /* Temporal mappings from bgmaps.cgi service names to names defined here */
20314
+ if (layerName === 'streetmap') {
20315
+ layerName = 'OSM';
20316
+ }
19563
20317
  if (layerName === 'pdok') {
19564
20318
  layerName = 'OSM';
19565
20319
  }
@@ -19568,7 +20322,7 @@ var WMTileRenderer = /*#__PURE__*/function () {
19568
20322
  }
19569
20323
  var tileLayer = tileOptions[layerName];
19570
20324
  if (!tileLayer) {
19571
- debug(DebugType.Error);
20325
+ debugLogger(DebugType.Error);
19572
20326
  return undefined;
19573
20327
  }
19574
20328
  var tileSettings = tileLayer[srs];
@@ -19758,11 +20512,11 @@ var WMTileRenderer = /*#__PURE__*/function () {
19758
20512
  tilenright = numTilesAtLevelX;
19759
20513
  }
19760
20514
  if (tilentop - tilenbottom > 20) {
19761
- debug(DebugType.Error);
20515
+ debugLogger(DebugType.Error);
19762
20516
  return;
19763
20517
  }
19764
20518
  if (tilenright - tilenleft > 20) {
19765
- debug(DebugType.Error);
20519
+ debugLogger(DebugType.Error);
19766
20520
  return;
19767
20521
  }
19768
20522
  for (var ty = tilenbottom - 1; ty < tilentop; ty += 1) {
@@ -19884,7 +20638,7 @@ var drawLegend = function drawLegend(canvasContext, width, height, layers) {
19884
20638
  try {
19885
20639
  ctx.drawImage(el, legendX, legendY);
19886
20640
  } catch (e) {
19887
- debug(DebugType.Error);
20641
+ debugLogger(DebugType.Error);
19888
20642
  }
19889
20643
  }
19890
20644
  }
@@ -25576,125 +26330,6 @@ var moment$1 = {exports: {}};
25576
26330
 
25577
26331
  var moment = moment$1.exports;
25578
26332
 
25579
- function _typeof(o) {
25580
- "@babel/helpers - typeof";
25581
-
25582
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
25583
- return typeof o;
25584
- } : function (o) {
25585
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
25586
- }, _typeof(o);
25587
- }
25588
-
25589
- function requiredArgs(required, args) {
25590
- if (args.length < required) {
25591
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
25592
- }
25593
- }
25594
-
25595
- /**
25596
- * @name toDate
25597
- * @category Common Helpers
25598
- * @summary Convert the given argument to an instance of Date.
25599
- *
25600
- * @description
25601
- * Convert the given argument to an instance of Date.
25602
- *
25603
- * If the argument is an instance of Date, the function returns its clone.
25604
- *
25605
- * If the argument is a number, it is treated as a timestamp.
25606
- *
25607
- * If the argument is none of the above, the function returns Invalid Date.
25608
- *
25609
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
25610
- *
25611
- * @param {Date|Number} argument - the value to convert
25612
- * @returns {Date} the parsed date in the local time zone
25613
- * @throws {TypeError} 1 argument required
25614
- *
25615
- * @example
25616
- * // Clone the date:
25617
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
25618
- * //=> Tue Feb 11 2014 11:30:30
25619
- *
25620
- * @example
25621
- * // Convert the timestamp to date:
25622
- * const result = toDate(1392098430000)
25623
- * //=> Tue Feb 11 2014 11:30:30
25624
- */
25625
- function toDate(argument) {
25626
- requiredArgs(1, arguments);
25627
- var argStr = Object.prototype.toString.call(argument);
25628
-
25629
- // Clone the date
25630
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
25631
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
25632
- return new Date(argument.getTime());
25633
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
25634
- return new Date(argument);
25635
- } else {
25636
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
25637
- // eslint-disable-next-line no-console
25638
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
25639
- // eslint-disable-next-line no-console
25640
- console.warn(new Error().stack);
25641
- }
25642
- return new Date(NaN);
25643
- }
25644
- }
25645
-
25646
- /**
25647
- * @name isWithinInterval
25648
- * @category Interval Helpers
25649
- * @summary Is the given date within the interval?
25650
- *
25651
- * @description
25652
- * Is the given date within the interval? (Including start and end.)
25653
- *
25654
- * @param {Date|Number} date - the date to check
25655
- * @param {Interval} interval - the interval to check
25656
- * @returns {Boolean} the date is within the interval
25657
- * @throws {TypeError} 2 arguments required
25658
- * @throws {RangeError} The start of an interval cannot be after its end
25659
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
25660
- *
25661
- * @example
25662
- * // For the date within the interval:
25663
- * isWithinInterval(new Date(2014, 0, 3), {
25664
- * start: new Date(2014, 0, 1),
25665
- * end: new Date(2014, 0, 7)
25666
- * })
25667
- * //=> true
25668
- *
25669
- * @example
25670
- * // For the date outside of the interval:
25671
- * isWithinInterval(new Date(2014, 0, 10), {
25672
- * start: new Date(2014, 0, 1),
25673
- * end: new Date(2014, 0, 7)
25674
- * })
25675
- * //=> false
25676
- *
25677
- * @example
25678
- * // For date equal to interval start:
25679
- * isWithinInterval(date, { start, end: date }) // => true
25680
- *
25681
- * @example
25682
- * // For date equal to interval end:
25683
- * isWithinInterval(date, { start: date, end }) // => true
25684
- */
25685
- function isWithinInterval(dirtyDate, interval) {
25686
- requiredArgs(2, arguments);
25687
- var time = toDate(dirtyDate).getTime();
25688
- var startTime = toDate(interval.start).getTime();
25689
- var endTime = toDate(interval.end).getTime();
25690
-
25691
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
25692
- if (!(startTime <= endTime)) {
25693
- throw new RangeError('Invalid interval');
25694
- }
25695
- return time >= startTime && time <= endTime;
25696
- }
25697
-
25698
26333
  /** ************************************************ */
25699
26334
  /* Object to store a time duration / time interval */
25700
26335
  /** ************************************************ */
@@ -25824,7 +26459,7 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
25824
26459
  };
25825
26460
  var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
25826
26461
  if (!isValidISOTime(isotime)) {
25827
- debug(DebugType.Warning);
26462
+ debugLogger(DebugType.Warning);
25828
26463
  return undefined;
25829
26464
  }
25830
26465
  var _getTimeValues = getTimeValues(isotime),
@@ -26076,14 +26711,14 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
26076
26711
  this.startTime = parseISO8601DateToDate(times[0]);
26077
26712
  this.stopTime = parseISO8601DateToDate(times[1]);
26078
26713
  if (!this.startTime || !this.stopTime) {
26079
- debug(DebugType.Warning);
26714
+ debugLogger(DebugType.Warning);
26080
26715
  return;
26081
26716
  }
26082
26717
  /* Try to get the time interval. If not available default to 1 minute */
26083
26718
  var timeIntervalString = times[2] || 'PT1M';
26084
26719
  this.timeInterval = parseISO8601IntervalToDateInterval(timeIntervalString);
26085
26720
  if (!this.timeInterval) {
26086
- debug(DebugType.Warning);
26721
+ debugLogger(DebugType.Warning);
26087
26722
  return;
26088
26723
  }
26089
26724
  // Calculate the number if steps
@@ -26109,7 +26744,7 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
26109
26744
  return null;
26110
26745
  }
26111
26746
  if (!this.timeInterval) {
26112
- debug(DebugType.Warning);
26747
+ debugLogger(DebugType.Warning);
26113
26748
  return null;
26114
26749
  }
26115
26750
  if (this.timeInterval.isRegularInterval === false) {
@@ -26302,7 +26937,7 @@ var WMJSDimension = /*#__PURE__*/function () {
26302
26937
  if (!referenceTimeValueToSet) {
26303
26938
  this.reInitializeValues(this.values);
26304
26939
  this.setClosestValue(null);
26305
- debug(DebugType.Warning);
26940
+ debugLogger(DebugType.Warning);
26306
26941
  return;
26307
26942
  }
26308
26943
  /*
@@ -26598,7 +27233,7 @@ var WMJSDimension = /*#__PURE__*/function () {
26598
27233
  value = this.getValueForIndex(index);
26599
27234
  } catch (e) {
26600
27235
  if (typeof e.message === 'number') {
26601
- if (e.message === 0) {
27236
+ if (e.message === '0') {
26602
27237
  value = WMDateTooEarlyString;
26603
27238
  } else {
26604
27239
  value = WMDateTooLateString;
@@ -26763,7 +27398,7 @@ var WMJSDimension = /*#__PURE__*/function () {
26763
27398
  }
26764
27399
  return foundIndex;
26765
27400
  } catch (e) {
26766
- debug(DebugType.Error);
27401
+ debugLogger(DebugType.Error);
26767
27402
  return -1;
26768
27403
  }
26769
27404
  }
@@ -26902,7 +27537,7 @@ var MapPin = /*#__PURE__*/function () {
26902
27537
  _this.redrawMap();
26903
27538
  };
26904
27539
  this.positionMapPinByLatLon = function (coord) {
26905
- debug(DebugType.Log, "positionMapPinByLatLon at ".concat(coord.x, ",").concat(coord.y));
27540
+ debugLogger(DebugType.Log, "positionMapPinByLatLon at ".concat(coord.x, ",").concat(coord.y));
26906
27541
  var newpos = _this._map.getPixelCoordFromLatLong(coord);
26907
27542
  _this.setMapPin(newpos.x, newpos.y);
26908
27543
  };
@@ -27902,7 +28537,7 @@ var WMJSMap = /*#__PURE__*/function () {
27902
28537
  }, this.internalMapId);
27903
28538
  this.callBack.addToCallback('display', this.display, true);
27904
28539
  this.callBack.addToCallback('draw', function () {
27905
- debug(DebugType.Log);
28540
+ debugLogger(DebugType.Log);
27906
28541
  }, true);
27907
28542
  bgMapImageStore.addImageEventCallback(function (image, id, imageEventType) {
27908
28543
  if (imageEventType === WMImageEventType.Loaded) {
@@ -27917,16 +28552,16 @@ var WMJSMap = /*#__PURE__*/function () {
27917
28552
  }, {
27918
28553
  key: "rebuildMapDimensions",
27919
28554
  value: function rebuildMapDimensions() {
27920
- for (var i = 0; i < this.layers.length; i += 1) {
27921
- for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
27922
- var dim = this.layers[i].dimensions[j];
27923
- var mapdim = this.getDimension(dim.name);
28555
+ var _this4 = this;
28556
+ this.layers.forEach(function (layer) {
28557
+ layer.dimensions.forEach(function (dim) {
28558
+ var mapdim = _this4.getDimension(dim.name);
27924
28559
  if (!isDefined(mapdim)) {
27925
28560
  var newdim = dim.clone();
27926
- this.mapdimensions.push(newdim);
28561
+ _this4.mapdimensions.push(newdim);
27927
28562
  }
27928
- }
27929
- }
28563
+ });
28564
+ });
27930
28565
  this.callBack.triggerEvent('onmapdimupdate');
27931
28566
  }
27932
28567
  }, {
@@ -28085,9 +28720,9 @@ var WMJSMap = /*#__PURE__*/function () {
28085
28720
  }
28086
28721
  } else {
28087
28722
  try {
28088
- debug(DebugType.Error, "WebMapJS warning: moveLayerDown: layer '".concat(layerToMove.name, "' not found."));
28723
+ debugLogger(DebugType.Error, "WebMapJS warning: moveLayerDown: layer '".concat(layerToMove.name, "' not found."));
28089
28724
  } catch (e) {
28090
- debug(DebugType.Error);
28725
+ debugLogger(DebugType.Error);
28091
28726
  }
28092
28727
  }
28093
28728
  }
@@ -28105,9 +28740,9 @@ var WMJSMap = /*#__PURE__*/function () {
28105
28740
  }
28106
28741
  } else {
28107
28742
  try {
28108
- debug(DebugType.Error, "WebMapJS: moveLayers: layer '".concat(_layerA.name, "' not found."));
28743
+ debugLogger(DebugType.Error, "WebMapJS: moveLayers: layer '".concat(_layerA.name, "' not found."));
28109
28744
  } catch (e) {
28110
- debug(DebugType.Error);
28745
+ debugLogger(DebugType.Error);
28111
28746
  }
28112
28747
  }
28113
28748
  }
@@ -28124,19 +28759,19 @@ var WMJSMap = /*#__PURE__*/function () {
28124
28759
  }
28125
28760
  } else {
28126
28761
  try {
28127
- debug(DebugType.Error, "WebMapJS: moveLayerUp: layer '".concat(layerToMove.name, "' not found."));
28762
+ debugLogger(DebugType.Error, "WebMapJS: moveLayerUp: layer '".concat(layerToMove.name, "' not found."));
28128
28763
  } catch (e) {
28129
- debug(DebugType.Error);
28764
+ debugLogger(DebugType.Error);
28130
28765
  }
28131
28766
  }
28132
28767
  }
28133
28768
  }, {
28134
28769
  key: "configureMapDimensions",
28135
28770
  value: function configureMapDimensions(layer) {
28136
- var _this4 = this;
28771
+ var _this5 = this;
28137
28772
  layer.dimensions.forEach(function (dimension) {
28138
- var mapDim = _this4.getDimension(dimension.name);
28139
- if (isDefined(mapDim) && isDefined(mapDim.currentValue) && dimension.linked) {
28773
+ var mapDim = _this5.getDimension(dimension.name);
28774
+ if ((mapDim === null || mapDim === void 0 ? void 0 : mapDim.currentValue) !== undefined && dimension.linked) {
28140
28775
  dimension.setClosestValue(mapDim.currentValue);
28141
28776
  }
28142
28777
  });
@@ -28148,25 +28783,25 @@ var WMJSMap = /*#__PURE__*/function () {
28148
28783
  }, {
28149
28784
  key: "addLayer",
28150
28785
  value: function addLayer(layer) {
28151
- var _this5 = this;
28786
+ var _this6 = this;
28152
28787
  return new Promise(function (resolve, reject) {
28153
28788
  if (!isDefined(layer)) {
28154
- debug(DebugType.Warning);
28789
+ debugLogger(DebugType.Warning);
28155
28790
  reject(new Error('undefined layer'));
28156
28791
  return;
28157
28792
  }
28158
28793
  if (!layer.constructor) {
28159
- debug(DebugType.Warning);
28794
+ debugLogger(DebugType.Warning);
28160
28795
  reject(new Error('layer has no constructor'));
28161
28796
  return;
28162
28797
  }
28163
28798
  /* Set a reference in the layer to this map */
28164
- layer.parentMap = _this5;
28165
- _this5.layers.push(layer);
28799
+ layer.parentMap = _this6;
28800
+ _this6.layers.push(layer);
28166
28801
  var done = function done(layerCallback) {
28167
- _this5.configureMapDimensions(layerCallback);
28168
- _this5.callBack.triggerEvent('onlayeradd');
28169
- resolve(_this5);
28802
+ _this6.configureMapDimensions(layerCallback);
28803
+ _this6.callBack.triggerEvent('onlayeradd');
28804
+ resolve(_this6);
28170
28805
  };
28171
28806
  layer.parseLayer(done, undefined, 'WMJSMap addLayer');
28172
28807
  });
@@ -28256,8 +28891,8 @@ var WMJSMap = /*#__PURE__*/function () {
28256
28891
  }, {
28257
28892
  key: "setSize",
28258
28893
  value: function setSize(w, h) {
28259
- var _this6 = this;
28260
- debug(DebugType.Log, 'setSize', w, h, this.initialized);
28894
+ var _this7 = this;
28895
+ debugLogger(DebugType.Log, 'setSize', w, h, this.initialized);
28261
28896
  if (w < 4 || h < 4 || this.initialized === false) {
28262
28897
  return;
28263
28898
  }
@@ -28273,9 +28908,9 @@ var WMJSMap = /*#__PURE__*/function () {
28273
28908
  return;
28274
28909
  }
28275
28910
  this._resizeTimer.init(200, function () {
28276
- _this6._resizeTimerBusy = false;
28277
- _this6._setSize(_this6.resizeWidth, _this6.resizeHeight);
28278
- _this6.draw('resizeTimer');
28911
+ _this7._resizeTimerBusy = false;
28912
+ _this7._setSize(_this7.resizeWidth, _this7.resizeHeight);
28913
+ _this7.draw('resizeTimer');
28279
28914
  });
28280
28915
  }
28281
28916
  }, {
@@ -28287,7 +28922,7 @@ var WMJSMap = /*#__PURE__*/function () {
28287
28922
  if (w < 4 || h < 4) {
28288
28923
  return;
28289
28924
  }
28290
- debug(DebugType.Log);
28925
+ debugLogger(DebugType.Log);
28291
28926
  var projinfo = this.getProjection();
28292
28927
  this.width = w;
28293
28928
  this.height = h;
@@ -28298,7 +28933,7 @@ var WMJSMap = /*#__PURE__*/function () {
28298
28933
  this.height = 4;
28299
28934
  }
28300
28935
  if (!projinfo.srs || !projinfo.bbox) {
28301
- debug(DebugType.Error);
28936
+ debugLogger(DebugType.Error);
28302
28937
  projinfo.srs = 'EPSG:4326';
28303
28938
  projinfo.bbox.left = -180;
28304
28939
  projinfo.bbox.bottom = -90;
@@ -28396,7 +29031,7 @@ var WMJSMap = /*#__PURE__*/function () {
28396
29031
  this.divDimInfo.style.display = 'none';
28397
29032
  }
28398
29033
  } catch (e) {
28399
- debug(DebugType.Error);
29034
+ debugLogger(DebugType.Error);
28400
29035
  }
28401
29036
  }
28402
29037
  }, {
@@ -28440,7 +29075,7 @@ var WMJSMap = /*#__PURE__*/function () {
28440
29075
  }
28441
29076
  }
28442
29077
  if (this.isAnimating) {
28443
- debug(DebugType.Log);
29078
+ debugLogger(DebugType.Log);
28444
29079
  return;
28445
29080
  }
28446
29081
  this._draw(this._animationList);
@@ -28451,7 +29086,7 @@ var WMJSMap = /*#__PURE__*/function () {
28451
29086
  }, {
28452
29087
  key: "_draw",
28453
29088
  value: function _draw(animationList) {
28454
- debug(DebugType.Log);
29089
+ debugLogger(DebugType.Log);
28455
29090
  this.drawnBBOX.setBBOX(this.bbox);
28456
29091
  this._drawAndLoad(animationList);
28457
29092
  }
@@ -28467,7 +29102,7 @@ var WMJSMap = /*#__PURE__*/function () {
28467
29102
  }, {
28468
29103
  key: "_drawAndLoad",
28469
29104
  value: function _drawAndLoad(animationList) {
28470
- var _this7 = this;
29105
+ var _this8 = this;
28471
29106
  if (this.width < 4 || this.height < 4) {
28472
29107
  this._drawReady();
28473
29108
  return;
@@ -28487,19 +29122,20 @@ var WMJSMap = /*#__PURE__*/function () {
28487
29122
  this.mouseHoverAnimationBox = false;
28488
29123
  animationList.forEach(function (animationStepWithoutRequests, j) {
28489
29124
  if (selectedTime && animationStepWithoutRequests.value === selectedTime) {
28490
- _this7.currentAnimationStep = j;
29125
+ _this8.currentAnimationStep = j;
28491
29126
  }
28492
29127
  var animationStep = {
28493
29128
  name: animationStepWithoutRequests.name,
28494
29129
  value: animationStepWithoutRequests.value,
28495
29130
  requests: []
28496
29131
  };
28497
- _this7.setDimension(animationStepWithoutRequests.name, animationStepWithoutRequests.value, false);
28498
- animationStep.requests = _this7.getWMSRequests();
28499
- _this7.animationList.push(animationStep);
29132
+ _this8.setDimension(animationStepWithoutRequests.name, animationStepWithoutRequests.value, false);
29133
+ animationStep.requests = _this8.getWMSRequests();
29134
+ _this8.animationList.push(animationStep);
28500
29135
  });
28501
29136
  this.setDimension(this.animationList[this.currentAnimationStep].name, this.animationList[this.currentAnimationStep].value, false);
28502
- this.wmAnimate.prefetchImagesForAnimationSteps();
29137
+ this.animationTimer = new WMTimer();
29138
+ this.wmAnimate.loopAnimation();
28503
29139
  }
28504
29140
  this.addLayersToCanvasAndDisplayThem();
28505
29141
  }
@@ -28511,7 +29147,7 @@ var WMJSMap = /*#__PURE__*/function () {
28511
29147
  }, {
28512
29148
  key: "_onMapReadyCallbackFunction",
28513
29149
  value: function _onMapReadyCallbackFunction() {
28514
- debug(DebugType.Log);
29150
+ debugLogger(DebugType.Log);
28515
29151
  this.draw('onmapready callback');
28516
29152
  }
28517
29153
  }, {
@@ -28522,11 +29158,11 @@ var WMJSMap = /*#__PURE__*/function () {
28522
29158
  }, {
28523
29159
  key: "getWMSRequests",
28524
29160
  value: function getWMSRequests() {
28525
- var _this8 = this;
29161
+ var _this9 = this;
28526
29162
  var requests = [];
28527
29163
  this.layers.forEach(function (layer) {
28528
29164
  if (layer.service && layer.enabled) {
28529
- var request = buildWMSGetMapRequest(_this8, layer);
29165
+ var request = buildWMSGetMapRequest(_this9, layer);
28530
29166
  if (request === null || request === void 0 ? void 0 : request.url) {
28531
29167
  requests.push(request);
28532
29168
  }
@@ -28537,34 +29173,37 @@ var WMJSMap = /*#__PURE__*/function () {
28537
29173
  }, {
28538
29174
  key: "addLayersToCanvasAndDisplayThem",
28539
29175
  value: function addLayersToCanvasAndDisplayThem() {
28540
- var _this9 = this;
29176
+ var _this10 = this;
28541
29177
  var _a, _b, _c;
28542
- debug(DebugType.Log);
29178
+ debugLogger(DebugType.Log);
28543
29179
  this.divBuffer.reset();
28544
29180
  var currentLayerIndex = 0;
28545
29181
  this.numBaseLayers = 0;
28546
29182
  (_a = this.baseLayers) === null || _a === void 0 ? void 0 : _a.forEach(function (baseLayer) {
28547
29183
  var _a;
28548
29184
  if (baseLayer.enabled && baseLayer.keepOnTop === false && baseLayer.type && baseLayer.type !== 'twms') {
28549
- _this9.numBaseLayers += 1;
28550
- var requestURL = (_a = buildWMSGetMapRequest(_this9, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
29185
+ _this10.numBaseLayers += 1;
29186
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
28551
29187
  if (requestURL) {
28552
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29188
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28553
29189
  layer: baseLayer
28554
- }, baseLayer.opacity, _this9.getDrawBBOX());
29190
+ }, baseLayer.opacity, _this10.getDrawBBOX());
28555
29191
  currentLayerIndex += 1;
28556
29192
  }
28557
29193
  }
28558
29194
  });
29195
+ if (!this.isAnimating) {
29196
+ prefetchImagesForNonAnimation(this);
29197
+ }
28559
29198
  /* Loop through all layers */
28560
29199
  (_b = this.layers) === null || _b === void 0 ? void 0 : _b.forEach(function (layer) {
28561
29200
  var _a;
28562
29201
  if (layer.service && layer.enabled && layer.isConfigured) {
28563
- var requestURL = (_a = buildWMSGetMapRequest(_this9, layer)) === null || _a === void 0 ? void 0 : _a.url;
29202
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, layer)) === null || _a === void 0 ? void 0 : _a.url;
28564
29203
  if (requestURL) {
28565
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29204
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28566
29205
  layer: layer
28567
- }, layer.opacity, _this9.getDrawBBOX());
29206
+ }, layer.opacity, _this10.getDrawBBOX());
28568
29207
  currentLayerIndex += 1;
28569
29208
  }
28570
29209
  }
@@ -28572,11 +29211,11 @@ var WMJSMap = /*#__PURE__*/function () {
28572
29211
  (_c = this.baseLayers) === null || _c === void 0 ? void 0 : _c.forEach(function (baseLayer) {
28573
29212
  var _a;
28574
29213
  if (baseLayer.enabled && baseLayer.keepOnTop === true) {
28575
- var requestURL = (_a = buildWMSGetMapRequest(_this9, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
29214
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
28576
29215
  if (requestURL) {
28577
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29216
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28578
29217
  layer: baseLayer
28579
- }, baseLayer.opacity, _this9.getDrawBBOX());
29218
+ }, baseLayer.opacity, _this10.getDrawBBOX());
28580
29219
  currentLayerIndex += 1;
28581
29220
  }
28582
29221
  }
@@ -28608,7 +29247,7 @@ var WMJSMap = /*#__PURE__*/function () {
28608
29247
  key: "redrawBuffer",
28609
29248
  value: function redrawBuffer() {
28610
29249
  this.divBuffer.display();
28611
- debug(DebugType.Log);
29250
+ debugLogger(DebugType.Log);
28612
29251
  this.drawnBBOX.setBBOX(this.bbox);
28613
29252
  this.draw();
28614
29253
  }
@@ -28770,20 +29409,20 @@ var WMJSMap = /*#__PURE__*/function () {
28770
29409
  }, {
28771
29410
  key: "_buildLayerDims",
28772
29411
  value: function _buildLayerDims() {
28773
- var _this10 = this;
29412
+ var _this11 = this;
28774
29413
  if (this.buildLayerDimsBusy === true) {
28775
29414
  return;
28776
29415
  }
28777
29416
  this.mapdimensions.forEach(function (mapDim) {
28778
- _this10.layers.forEach(function (layer) {
29417
+ _this11.layers.forEach(function (layer) {
28779
29418
  layer.dimensions.forEach(function (layerDim) {
28780
29419
  if (layerDim.linked === true && layerDim.name === mapDim.name) {
28781
29420
  if (mapDim.currentValue === 'current' || mapDim.currentValue === 'default' || mapDim.currentValue === '' || mapDim.currentValue === 'earliest' || mapDim.currentValue === 'middle' || mapDim.currentValue === 'latest') {
28782
29421
  mapDim.currentValue = layerDim.getClosestValue(mapDim.currentValue);
28783
29422
  }
28784
- _this10.buildLayerDimsBusy = true;
29423
+ _this11.buildLayerDimsBusy = true;
28785
29424
  layerDim.setClosestValue(mapDim.currentValue);
28786
- _this10.buildLayerDimsBusy = false;
29425
+ _this11.buildLayerDimsBusy = false;
28787
29426
  }
28788
29427
  });
28789
29428
  });
@@ -28826,7 +29465,7 @@ var WMJSMap = /*#__PURE__*/function () {
28826
29465
  } catch (e) {
28827
29466
  return undefined;
28828
29467
  }
28829
- debug(DebugType.Log);
29468
+ debugLogger(DebugType.Log);
28830
29469
  return request;
28831
29470
  }
28832
29471
  /* End of GetFeature info handling */
@@ -29177,7 +29816,7 @@ var WMJSMap = /*#__PURE__*/function () {
29177
29816
  this.callBack.triggerEvent('onmousemove', [undefined, undefined]);
29178
29817
  this.updateMouseCursorCoordinates(undefined);
29179
29818
  } catch (e) {
29180
- debug(DebugType.Error);
29819
+ debugLogger(DebugType.Error);
29181
29820
  }
29182
29821
  this.mouseUpX = this.mouseX;
29183
29822
  this.mouseUpY = this.mouseY;
@@ -29317,7 +29956,7 @@ var WMJSMap = /*#__PURE__*/function () {
29317
29956
  this.gfiDialogList[j].origY = this.gfiDialogList[j].y;
29318
29957
  }
29319
29958
  this.mapPanning = 1;
29320
- debug(DebugType.Log);
29959
+ debugLogger(DebugType.Log);
29321
29960
  this.bbox.setBBOX(this.drawnBBOX);
29322
29961
  this.updateBBOX.setBBOX(this.drawnBBOX);
29323
29962
  this.mapPanStartGeoCoords = this.getGeoCoordFromPixelCoord({
@@ -29499,8 +30138,8 @@ var WMJSMap = /*#__PURE__*/function () {
29499
30138
  }, {
29500
30139
  key: "zoomTo",
29501
30140
  value: function zoomTo(_newbbox) {
29502
- var _this11 = this;
29503
- debug(DebugType.Log);
30141
+ var _this12 = this;
30142
+ debugLogger(DebugType.Log);
29504
30143
  var setOrigBox = false;
29505
30144
  var newbbox = new WMBBOX(_newbbox);
29506
30145
  // Maintain aspect ratio
@@ -29515,7 +30154,7 @@ var WMJSMap = /*#__PURE__*/function () {
29515
30154
  setOrigBox = true;
29516
30155
  }
29517
30156
  if (setOrigBox === true) {
29518
- debug(DebugType.Error);
30157
+ debugLogger(DebugType.Error);
29519
30158
  ratio = 1;
29520
30159
  }
29521
30160
  if (ratio < 0) {
@@ -29540,14 +30179,14 @@ var WMJSMap = /*#__PURE__*/function () {
29540
30179
  this._updateBoundingBox(this.bbox);
29541
30180
  this.drawnBBOX.setBBOX(this.bbox);
29542
30181
  var resetMapPinAndDialogs = function resetMapPinAndDialogs() {
29543
- for (var j = 0; j < _this11.gfiDialogList.length; j += 1) {
29544
- var newpos = _this11.getPixelCoordFromGeoCoord({
29545
- x: _this11.gfiDialogList[j].geoPosX,
29546
- y: _this11.gfiDialogList[j].geoPosY
30182
+ for (var j = 0; j < _this12.gfiDialogList.length; j += 1) {
30183
+ var newpos = _this12.getPixelCoordFromGeoCoord({
30184
+ x: _this12.gfiDialogList[j].geoPosX,
30185
+ y: _this12.gfiDialogList[j].geoPosY
29547
30186
  });
29548
- if (_this11.gfiDialogList[j].hasBeenDragged === false) {
29549
- if (_this11.gfiDialogList[j].moveToMouseCursor === true) {
29550
- _this11.gfiDialogList[j].setXY(_this11.gfiDialogList[j].origX + newpos.x, _this11.gfiDialogList[j].origY + newpos.y);
30187
+ if (_this12.gfiDialogList[j].hasBeenDragged === false) {
30188
+ if (_this12.gfiDialogList[j].moveToMouseCursor === true) {
30189
+ _this12.gfiDialogList[j].setXY(_this12.gfiDialogList[j].origX + newpos.x, _this12.gfiDialogList[j].origY + newpos.y);
29551
30190
  }
29552
30191
  }
29553
30192
  }
@@ -29616,7 +30255,7 @@ var WMJSMap = /*#__PURE__*/function () {
29616
30255
  }
29617
30256
  result = proj4(this.longlat, this.proj4.projection, [p.x, p.y]);
29618
30257
  } catch (e) {
29619
- debug(DebugType.Error);
30258
+ debugLogger(DebugType.Error);
29620
30259
  return undefined;
29621
30260
  }
29622
30261
  return this.getPixelCoordFromGeoCoord({
@@ -29745,14 +30384,19 @@ var WMJSMap = /*#__PURE__*/function () {
29745
30384
  }
29746
30385
  return undefined;
29747
30386
  }
30387
+ }, {
30388
+ key: "setTimeDimension",
30389
+ value: function setTimeDimension(value, triggerEvent) {
30390
+ this.setDimension('time', value, triggerEvent);
30391
+ }
29748
30392
  }, {
29749
30393
  key: "setDimension",
29750
30394
  value: function setDimension(name, value) {
29751
30395
  var triggerEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
29752
30396
  var adjustLayerDims = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
29753
- debug(DebugType.Log);
30397
+ debugLogger(DebugType.Log);
29754
30398
  if (!isDefined(name) || !isDefined(value)) {
29755
- debug(DebugType.Error);
30399
+ debugLogger(DebugType.Error);
29756
30400
  return;
29757
30401
  }
29758
30402
  var dim = this.getDimension(name);
@@ -29801,14 +30445,14 @@ var WMJSMap = /*#__PURE__*/function () {
29801
30445
  return;
29802
30446
  }
29803
30447
  }
29804
- debug(DebugType.Error, "WebMapJS: Unable to find the correct bbox with current map projection ".concat(this.srs, " for layer ").concat(layer.title, ". Using default bbox instead."));
30448
+ debugLogger(DebugType.Error, "WebMapJS: Unable to find the correct bbox with current map projection ".concat(this.srs, " for layer ").concat(layer.title, ". Using default bbox instead."));
29805
30449
  this.zoomTo(this.defaultBBOX);
29806
30450
  this.draw('zoomTolayer');
29807
30451
  }
29808
30452
  }, {
29809
30453
  key: "setBBOX",
29810
30454
  value: function setBBOX(left, bottom, right, top) {
29811
- debug(DebugType.Log);
30455
+ debugLogger(DebugType.Log);
29812
30456
  this.bbox.setBBOX(left, bottom, right, top);
29813
30457
  this.resizeBBOX.setBBOX(this.bbox);
29814
30458
  this.wMFlyToBBox.flyZoomToBBOXFly.setBBOX(this.bbox);
@@ -30475,7 +31119,7 @@ var loadGetCapabilitiesViaProxy = function loadGetCapabilitiesViaProxy(url, succ
30475
31119
  fetch(getcapreq, {}).then(function (result) {
30476
31120
  return result.text();
30477
31121
  }).then(function (result) {
30478
- debug(DebugType.Log, 'loadGetCapabilitiesViaProxy succesfully finished');
31122
+ debugLogger(DebugType.Log, 'loadGetCapabilitiesViaProxy succesfully finished');
30479
31123
  succes(result);
30480
31124
  })["catch"](function () {
30481
31125
  fail("Request failed for ".concat(getcapreq));
@@ -30507,7 +31151,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30507
31151
  return;
30508
31152
  }
30509
31153
  if (service.length === 0) {
30510
- debug(DebugType.Error);
31154
+ debugLogger(DebugType.Error);
30511
31155
  fail(I18n.service_url_empty.text);
30512
31156
  return;
30513
31157
  }
@@ -30521,7 +31165,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30521
31165
  service = hostName + service;
30522
31166
  }
30523
31167
  if (!service.startsWith('http://') && !service.startsWith('https:') && !service.startsWith('//')) {
30524
- debug(DebugType.Error);
31168
+ debugLogger(DebugType.Error);
30525
31169
  fail(I18n.service_url_empty.text);
30526
31170
  return;
30527
31171
  }
@@ -30529,7 +31173,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30529
31173
  // eslint-disable-next-line no-param-reassign
30530
31174
  service += '?';
30531
31175
  }
30532
- debug(DebugType.Log);
31176
+ debugLogger(DebugType.Log);
30533
31177
  var addParams = disableCache ? {
30534
31178
  random: Math.random()
30535
31179
  } : {};
@@ -30538,7 +31182,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30538
31182
  try {
30539
31183
  succes(data);
30540
31184
  } catch (e) {
30541
- debug(DebugType.Error);
31185
+ debugLogger(DebugType.Error, e.message);
30542
31186
  }
30543
31187
  })["catch"](function () {
30544
31188
  loadGetCapabilitiesViaProxy(url, succes, function () {
@@ -30822,7 +31466,7 @@ var WMJSService = /*#__PURE__*/function () {
30822
31466
  if (!failure) {
30823
31467
  // eslint-disable-next-line no-param-reassign
30824
31468
  failure = function failure(msg) {
30825
- debug(DebugType.Error);
31469
+ debugLogger(DebugType.Error);
30826
31470
  };
30827
31471
  }
30828
31472
  var parse = function parse(jsonData) {
@@ -30830,7 +31474,7 @@ var WMJSService = /*#__PURE__*/function () {
30830
31474
  try {
30831
31475
  _this2.version = _this2.checkVersion(jsonData);
30832
31476
  } catch (e) {
30833
- failure(e);
31477
+ failure(e.message);
30834
31478
  return;
30835
31479
  }
30836
31480
  var layerTreeStructure = buildLayerTreeFromNestedWMSLayer(rootLayer);
@@ -30909,18 +31553,17 @@ var LayerType;
30909
31553
  * @param layerDimNamesToRemove A set of dimensions names which are flagged for removal, this function removes the dimension from the set if found in the layer.
30910
31554
  */
30911
31555
  var addDimsForLayer = function addDimsForLayer(layerProps, layer, layerDimNamesToRemove) {
30912
- /* Information from the WMS GetCapabilities document */
30913
- var layerDims = layerProps.dimensions || [];
31556
+ var _a;
30914
31557
  /* Loop through all the dims from the WMS GetCapabilities document for this layer */
30915
- var _loop = function _loop() {
31558
+ (_a = layerProps.dimensions) === null || _a === void 0 ? void 0 : _a.forEach(function (layerDimension) {
30916
31559
  /* Obtain layerDim info from the GetCapabilities document and put into a WMSLayerDimInfo object */
30917
- var dimName = (layerDims[d].name || '').toLowerCase();
31560
+ var dimName = (layerDimension.name || '').toLowerCase();
30918
31561
  var layerDim = {
30919
31562
  name: dimName,
30920
- units: layerDims[d].units || '',
30921
- unitSymbol: layerDims[d].unitSymbol || '',
30922
- value: layerDims[d].values || '',
30923
- "default": layerDims[d].currentValue,
31563
+ units: layerDimension.units || '',
31564
+ unitSymbol: layerDimension.unitSymbol || '',
31565
+ value: layerDimension.values || '',
31566
+ "default": layerDimension.currentValue,
30924
31567
  isRefTimeDimension: dimName === 'reference_time'
30925
31568
  };
30926
31569
  /* Flag that this dim should not be removed from the layer */
@@ -30961,10 +31604,7 @@ var addDimsForLayer = function addDimsForLayer(layerProps, layer, layerDimNamesT
30961
31604
  dimensionToUpdate.reInitializeValues(dimensionToUpdate.values);
30962
31605
  dimensionToUpdate.setClosestValue(currentValue);
30963
31606
  }
30964
- };
30965
- for (var d = 0; d < layerDims.length; d += 1) {
30966
- _loop();
30967
- }
31607
+ });
30968
31608
  };
30969
31609
  /**
30970
31610
  * Helper function to configure the WMS Styles from the WMS GetCapabilities document.
@@ -31036,7 +31676,9 @@ var configureGeographicBoundingBox = function configureGeographicBoundingBox(lay
31036
31676
  };
31037
31677
  var WMLayer = /*#__PURE__*/function () {
31038
31678
  function WMLayer(options) {
31679
+ var _this = this;
31039
31680
  _classCallCheck(this, WMLayer);
31681
+ var _a;
31040
31682
  this.init = this.init.bind(this);
31041
31683
  this.getLayerName = this.getLayerName.bind(this);
31042
31684
  this.toggleAutoUpdate = this.toggleAutoUpdate.bind(this);
@@ -31117,10 +31759,10 @@ var WMLayer = /*#__PURE__*/function () {
31117
31759
  if (options.transparent === false) {
31118
31760
  this.transparent = false;
31119
31761
  }
31120
- if (options.dimensions && options.dimensions.length) {
31121
- for (var d = 0; d < options.dimensions.length; d += 1) {
31122
- this.dimensions.push(new WMJSDimension(options.dimensions[d]));
31123
- }
31762
+ if ((_a = options.dimensions) === null || _a === void 0 ? void 0 : _a.length) {
31763
+ options.dimensions.forEach(function (dimension) {
31764
+ _this.dimensions.push(new WMJSDimension(dimension));
31765
+ });
31124
31766
  }
31125
31767
  if (isDefined(options.onReady)) {
31126
31768
  this.onReady = options.onReady;
@@ -31182,12 +31824,12 @@ var WMLayer = /*#__PURE__*/function () {
31182
31824
  }, {
31183
31825
  key: "toggleAutoUpdate",
31184
31826
  value: function toggleAutoUpdate() {
31185
- var _this = this;
31827
+ var _this2 = this;
31186
31828
  this.autoupdate = !this.autoupdate;
31187
31829
  if (this.autoupdate) {
31188
31830
  var numDeltaMS = 60000;
31189
31831
  this.timer = setInterval(function () {
31190
- _this.parseLayer(undefined, true, 'WMLayer toggleAutoUpdate');
31832
+ _this2.parseLayer(undefined, true, 'WMLayer toggleAutoUpdate');
31191
31833
  }, numDeltaMS);
31192
31834
  } else {
31193
31835
  clearInterval(this.timer);
@@ -31196,14 +31838,14 @@ var WMLayer = /*#__PURE__*/function () {
31196
31838
  }, {
31197
31839
  key: "setAutoUpdate",
31198
31840
  value: function setAutoUpdate(val, interval, callback) {
31199
- var _this2 = this;
31841
+ var _this3 = this;
31200
31842
  if (val !== this.autoupdate) {
31201
31843
  this.autoupdate = val;
31202
31844
  if (!val) {
31203
31845
  clearInterval(this.timer);
31204
31846
  } else {
31205
31847
  this.timer = setInterval(function () {
31206
- _this2.parseLayer(callback, true, 'WMLayer setAutoUpdate');
31848
+ _this3.parseLayer(callback, true, 'WMLayer setAutoUpdate');
31207
31849
  }, interval);
31208
31850
  }
31209
31851
  }
@@ -31262,18 +31904,15 @@ var WMLayer = /*#__PURE__*/function () {
31262
31904
  key: "handleReferenceTime",
31263
31905
  value: function handleReferenceTime(name, value) {
31264
31906
  var updateMapDimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
31265
- if (name === 'reference_time') {
31266
- var timeDim = this.getDimension('time');
31267
- var referenceTimeDim = this.getDimension(name);
31268
- if (timeDim) {
31269
- timeDim.setTimeValuesForReferenceTime(value, referenceTimeDim);
31270
- if (updateMapDimensions) {
31271
- if (this.parentMap) {
31272
- if (this.enabled !== false) {
31273
- this.parentMap.getListener().triggerEvent('ondimchange', 'time');
31274
- }
31275
- }
31276
- }
31907
+ if (name !== 'reference_time') {
31908
+ return;
31909
+ }
31910
+ var timeDim = this.getDimension('time');
31911
+ var referenceTimeDim = this.getDimension(name);
31912
+ if (timeDim) {
31913
+ timeDim.setTimeValuesForReferenceTime(value, referenceTimeDim);
31914
+ if (updateMapDimensions && this.parentMap && this.enabled !== false) {
31915
+ this.parentMap.getListener().triggerEvent('ondimchange', 'time');
31277
31916
  }
31278
31917
  }
31279
31918
  }
@@ -31289,27 +31928,20 @@ var WMLayer = /*#__PURE__*/function () {
31289
31928
  if (!isDefined(value)) {
31290
31929
  return;
31291
31930
  }
31292
- var dimIndex = this.dimensions.findIndex(function (dim) {
31293
- return dim.name === name;
31294
- });
31295
- if (dimIndex < 0) {
31931
+ var dim = this.getDimension(name);
31932
+ if (!dim) {
31296
31933
  return;
31297
31934
  }
31298
- var dim = this.dimensions[dimIndex];
31299
31935
  dim.setValue(value);
31300
31936
  this.handleReferenceTime(name, value, updateMapDimensions);
31301
- if (updateMapDimensions) {
31302
- if (dim.linked === true) {
31303
- if (this.parentMap) {
31304
- this.parentMap.setDimension(name, dim.getValue());
31305
- }
31306
- }
31937
+ if (updateMapDimensions && dim.linked === true && this.parentMap) {
31938
+ this.parentMap.setDimension(name, dim.getValue());
31307
31939
  }
31308
31940
  }
31309
31941
  }, {
31310
31942
  key: "__parseGetCapForLayer",
31311
31943
  value: function __parseGetCapForLayer(getcapabilitiesjson, layerDoneCallback, fail) {
31312
- var _this3 = this;
31944
+ var _this4 = this;
31313
31945
  if (!getcapabilitiesjson) {
31314
31946
  this.title = I18n.service_has_error.text;
31315
31947
  this["abstract"] = I18n.not_available_message.text;
@@ -31350,7 +31982,7 @@ var WMLayer = /*#__PURE__*/function () {
31350
31982
  }
31351
31983
  }
31352
31984
  } catch (e) {
31353
- debug(DebugType.Error);
31985
+ debugLogger(DebugType.Error);
31354
31986
  }
31355
31987
  if (this.name === undefined || this.name.length < 1) {
31356
31988
  this.title = WMEmptyLayerTitle;
@@ -31366,7 +31998,7 @@ var WMLayer = /*#__PURE__*/function () {
31366
31998
  }
31367
31999
  if (!isDefined(this.getmapURL)) {
31368
32000
  this.getmapURL = this.service;
31369
- debug(DebugType.Error);
32001
+ debugLogger(DebugType.Error);
31370
32002
  }
31371
32003
  this.getfeatureinfoURL = undefined;
31372
32004
  try {
@@ -31376,7 +32008,7 @@ var WMLayer = /*#__PURE__*/function () {
31376
32008
  }
31377
32009
  if (!isDefined(this.getfeatureinfoURL)) {
31378
32010
  this.getfeatureinfoURL = this.service;
31379
- debug(DebugType.Error);
32011
+ debugLogger(DebugType.Error);
31380
32012
  }
31381
32013
  this.getlegendgraphicURL = undefined;
31382
32014
  try {
@@ -31399,36 +32031,36 @@ var WMLayer = /*#__PURE__*/function () {
31399
32031
  this.path = '';
31400
32032
  // Function will be called when the layer with the right name is found in the getcap doc
31401
32033
  var populateLayerFromTreeElement = function populateLayerFromTreeElement(jsonlayer) {
31402
- _this3.title = jsonlayer.title || jsonlayer.name || '';
31403
- _this3["abstract"] = jsonlayer["abstract"] || I18n.not_available_message.text;
31404
- _this3.path = jsonlayer.path.join('/');
32034
+ _this4.title = jsonlayer.title || jsonlayer.name || '';
32035
+ _this4["abstract"] = jsonlayer["abstract"] || I18n.not_available_message.text;
32036
+ _this4.path = jsonlayer.path.join('/');
31405
32037
  /** ***************** Go through styles **************** */
31406
- configureStyles(jsonlayer, _this3);
32038
+ configureStyles(jsonlayer, _this4);
31407
32039
  /** ***************** Go through Dimensions **************** */
31408
- configureDimensions(jsonlayer, _this3);
32040
+ configureDimensions(jsonlayer, _this4);
31409
32041
  /** ***************** Go through geographicBoundingBox **************** */
31410
- configureGeographicBoundingBox(jsonlayer, _this3);
31411
- _this3.queryable = jsonlayer.queryable || false;
32042
+ configureGeographicBoundingBox(jsonlayer, _this4);
32043
+ _this4.queryable = jsonlayer.queryable || false;
31412
32044
  if (jsonlayer.crs) {
31413
32045
  jsonlayer.crs.forEach(function (p) {
31414
32046
  var wmProjection = new WMProjection();
31415
32047
  wmProjection.srs = p.name || '';
31416
32048
  if (p.bbox) {
31417
- var swapBBOX = _this3.version === WMSVersion.version130 && wmProjection.srs === 'EPSG:4326' && _this3.wms130bboxcompatibilitymode === false;
32049
+ var swapBBOX = _this4.version === WMSVersion.version130 && wmProjection.srs === 'EPSG:4326' && _this4.wms130bboxcompatibilitymode === false;
31418
32050
  if (swapBBOX) {
31419
32051
  wmProjection.bbox.setBBOX(p.bbox.bottom, p.bbox.left, p.bbox.top, p.bbox.right);
31420
32052
  } else {
31421
32053
  wmProjection.bbox.setBBOX(p.bbox.left, p.bbox.bottom, p.bbox.right, p.bbox.top);
31422
32054
  }
31423
32055
  }
31424
- _this3.projectionProperties.push(wmProjection);
32056
+ _this4.projectionProperties.push(wmProjection);
31425
32057
  });
31426
32058
  }
31427
32059
  };
31428
32060
  var layerTreeStructure = buildLayerTreeFromNestedWMSLayer(rootLayer);
31429
32061
  /* Recursively walk the layertree until a child is found with the corresponding name */
31430
32062
  var findTreeNode = function findTreeNode(tree) {
31431
- if (tree.name === _this3.name) {
32063
+ if (tree.name === _this4.name) {
31432
32064
  return tree;
31433
32065
  }
31434
32066
  if (tree.children) {
@@ -31473,7 +32105,7 @@ var WMLayer = /*#__PURE__*/function () {
31473
32105
  value: function parseLayer(_layerDoneCallback, forceReload,
31474
32106
  // eslint-disable-next-line no-unused-vars
31475
32107
  origin) {
31476
- var _this4 = this;
32108
+ var _this5 = this;
31477
32109
  this.hasError = false;
31478
32110
  var layerDoneCallback = function layerDoneCallback(__layer) {
31479
32111
  if (isDefined(_layerDoneCallback)) {
@@ -31483,24 +32115,24 @@ var WMLayer = /*#__PURE__*/function () {
31483
32115
  _layerDoneCallback(__layer);
31484
32116
  // console.timeEnd(origin);
31485
32117
  } catch (e) {
31486
- debug(DebugType.Error);
32118
+ debugLogger(DebugType.Error, e.message);
31487
32119
  }
31488
32120
  }
31489
32121
  };
31490
32122
  var fail = function fail(_layer, message) {
31491
- _this4.hasError = true;
31492
- _this4.lastError = message;
31493
- _this4.title = I18n.service_has_error.text;
32123
+ _this5.hasError = true;
32124
+ _this5.lastError = message;
32125
+ _this5.title = I18n.service_has_error.text;
31494
32126
  layerDoneCallback(_layer);
31495
- if (isDefined(_this4._options.failure)) {
31496
- _this4._options.failure(_layer, message);
32127
+ if (isDefined(_this5._options.failure)) {
32128
+ _this5._options.failure(_layer, message);
31497
32129
  }
31498
32130
  };
31499
32131
  var callback = function callback(data) {
31500
- _this4.__parseGetCapForLayer(data, layerDoneCallback, fail);
32132
+ _this5.__parseGetCapForLayer(data, layerDoneCallback, fail);
31501
32133
  };
31502
32134
  var requestfail = function requestfail() {
31503
- fail(_this4, I18n.no_capability_element_found.text);
32135
+ fail(_this5, I18n.no_capability_element_found.text);
31504
32136
  };
31505
32137
  var options = {
31506
32138
  headers: {}
@@ -31523,12 +32155,12 @@ var WMLayer = /*#__PURE__*/function () {
31523
32155
  }, {
31524
32156
  key: "parseLayerPromise",
31525
32157
  value: function parseLayerPromise() {
31526
- var _this5 = this;
32158
+ var _this6 = this;
31527
32159
  var forceReload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
31528
32160
  return new Promise(function (resolve, reject) {
31529
- _this5.parseLayer(function (layer) {
32161
+ _this6.parseLayer(function (layer) {
31530
32162
  if (layer.hasError === true) {
31531
- debug(DebugType.Error, "[ERROR] Parse layer failed, Reason [".concat(layer.lastError, "]"));
32163
+ debugLogger(DebugType.Error, "[ERROR] Parse layer failed, Reason [".concat(layer.lastError, "]"));
31532
32164
  reject(layer);
31533
32165
  } else {
31534
32166
  resolve(layer);
@@ -31539,7 +32171,7 @@ var WMLayer = /*#__PURE__*/function () {
31539
32171
  }, {
31540
32172
  key: "cloneLayer",
31541
32173
  value: function cloneLayer() {
31542
- return new WMLayer(this);
32174
+ return new WMLayer(this._options);
31543
32175
  }
31544
32176
  /**
31545
32177
  * Set or change the name of this layer. This involves re-parsing the WMS GetCapabilities document and updating the affected layer properties. When done, it resolves the WMLayer
@@ -31559,11 +32191,11 @@ var WMLayer = /*#__PURE__*/function () {
31559
32191
  }, {
31560
32192
  key: "setStyle",
31561
32193
  value: function setStyle(styleName) {
31562
- debug(DebugType.Log);
32194
+ debugLogger(DebugType.Log);
31563
32195
  if (!this.styles || this.styles.length === 0) {
31564
32196
  this.currentStyle = '';
31565
32197
  this.legendGraphic = '';
31566
- debug(DebugType.Log);
32198
+ debugLogger(DebugType.Log);
31567
32199
  return;
31568
32200
  }
31569
32201
  var styleFound = false;
@@ -31575,7 +32207,7 @@ var WMLayer = /*#__PURE__*/function () {
31575
32207
  }
31576
32208
  }
31577
32209
  if (!styleFound) {
31578
- debug(DebugType.Log, "WMLayer::setStyle: Style ".concat(styleName, " not found, setting style ").concat(this.styles[0].name));
32210
+ debugLogger(DebugType.Log, "WMLayer::setStyle: Style ".concat(styleName, " not found, setting style ").concat(this.styles[0].name));
31579
32211
  this.currentStyle = this.styles[0].name;
31580
32212
  this.legendGraphic = this.styles[0].legendURL;
31581
32213
  }
@@ -31631,13 +32263,9 @@ var WMLayer = /*#__PURE__*/function () {
31631
32263
  }, {
31632
32264
  key: "getDimension",
31633
32265
  value: function getDimension(name) {
31634
- var dimIndex = this.dimensions.findIndex(function (dim) {
32266
+ return this.dimensions.find(function (dim) {
31635
32267
  return dim.name === name;
31636
32268
  });
31637
- if (dimIndex < 0) {
31638
- return undefined;
31639
- }
31640
- return this.dimensions[dimIndex];
31641
32269
  }
31642
32270
  /**
31643
32271
  * Returns the Coordinate Reference Systems for this layer
@@ -31888,12 +32516,6 @@ var defaultReduxLayerRadarColor = {
31888
32516
  enabled: true,
31889
32517
  layerType: LayerType.mapLayer,
31890
32518
  dimensions: [],
31891
- styles: [{
31892
- title: 'rainbow/nearest',
31893
- name: 'rainbow/nearest',
31894
- legendURL: 'https://geoservices.knmi.nl/wms?dataset=RADAR&SERVICE=WMS&&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=RAD_NL25_PCP_CM&format=image/png&STYLE=precip-rainbow/nearest',
31895
- "abstract": 'No abstract available'
31896
- }],
31897
32519
  id: generateLayerId()
31898
32520
  };
31899
32521
  var multiDimensionLayer = {
@@ -32931,4 +33553,4 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
32931
33553
  getLayersFlattenedFromService: getLayersFlattenedFromService
32932
33554
  });
32933
33555
 
32934
- export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debug, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
33556
+ export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };