PageSourceSearch

https://m5tea.uk/spotter/node_modules/.vite/deps/ol_source_XYZ.js?v=66825d40

js m5tea.uk collected 2026-10-07 11:09:54 UTC 45,651 bytes, 1,360 lines download raw bytes

1import {
2  Tile_default,
3  createOrUpdate as createOrUpdate3,
4  getCacheKey,
5  hash,
6  withinExtentAndZ
7} from "/spotter/node_modules/.vite/deps/chunk-4IHVCAJ6.js?v=66825d40";
8import {
9  ImageTile_default,
10  TileRange_default,
11  createOrUpdate as createOrUpdate2
12} from "/spotter/node_modules/.vite/deps/chunk-JQM2FMXU.js?v=66825d40";
13import {
14  Source_default
15} from "/spotter/node_modules/.vite/deps/chunk-ZIJGIORA.js?v=66825d40";
16import {
17  TileState_default
18} from "/spotter/node_modules/.vite/deps/chunk-5D2XPBR2.js?v=66825d40";
19import {
20  DEFAULT_MAX_ZOOM,
21  DEFAULT_TILE_SIZE
22} from "/spotter/node_modules/.vite/deps/chunk-74SD2LVC.js?v=66825d40";
23import {
24  intersectsLinearRing
25} from "/spotter/node_modules/.vite/deps/chunk-AYWUBMTO.js?v=66825d40";
26import {
27  METERS_PER_UNIT,
28  containsCoordinate,
29  createOrUpdate,
30  equivalent,
31  get,
32  getCorner,
33  getHeight,
34  getTopLeft,
35  getWidth
36} from "/spotter/node_modules/.vite/deps/chunk-KSNLGRUX.js?v=66825d40";
37import {
38  WORKER_OFFSCREEN_CANVAS,
39  scale,
40  toSize
41} from "/spotter/node_modules/.vite/deps/chunk-ATUQEFA6.js?v=66825d40";
42import {
43  EventType_default,
44  Event_default,
45  abstract,
46  assert,
47  getUid,
48  isSorted,
49  linearFindNearest
50} from "/spotter/node_modules/.vite/deps/chunk-HO7PEXKQ.js?v=66825d40";
51import {
52  ceil,
53  clamp,
54  floor,
55  modulo
56} from "/spotter/node_modules/.vite/deps/chunk-LIMV25LW.js?v=66825d40";
57
vendor: 18,145 bytes, lines 58-551
58// node_modules/ol/tilegrid/TileGrid.js
59var tmpTileCoord = [0, 0, 0];
60var DECIMALS = 5;
61var TileGrid = class {
62  /**
63   * @param {Options} options Tile grid options.
64   */
65  constructor(options) {
66    this.minZoom = options.minZoom !== void 0 ? options.minZoom : 0;
67    this.resolutions_ = options.resolutions;
68    assert(
69      isSorted(
70        this.resolutions_,
71        /**
72         * @param {number} a First resolution
73         * @param {number} b Second resolution
74         * @return {number} Comparison result
75         */
76        (a, b) => b - a,
77        true
78      ),
79      "`resolutions` must be sorted in descending order"
80    );
81    let zoomFactor;
82    if (!options.origins) {
83      for (let i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) {
84        if (!zoomFactor) {
85          zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1];
86        } else {
87          if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) {
88            zoomFactor = void 0;
89            break;
90          }
91        }
92      }
93    }
94    this.zoomFactor_ = zoomFactor;
95    this.maxZoom = this.resolutions_.length - 1;
96    this.origin_ = options.origin !== void 0 ? options.origin : null;
97    this.origins_ = null;
98    if (options.origins !== void 0) {
99      this.origins_ = options.origins;
100      assert(
101        this.origins_.length == this.resolutions_.length,
102        "Number of `origins` and `resolutions` must be equal"
103      );
104    }
105    const extent = options.extent;
106    if (extent !== void 0 && !this.origin_ && !this.origins_) {
107      this.origin_ = getTopLeft(extent);
108    }
109    assert(
110      !this.origin_ && this.origins_ || this.origin_ && !this.origins_,
111      "Either `origin` or `origins` must be configured, never both"
112    );
113    this.tileSizes_ = null;
114    if (options.tileSizes !== void 0) {
115      this.tileSizes_ = options.tileSizes;
116      assert(
117        this.tileSizes_.length == this.resolutions_.length,
118        "Number of `tileSizes` and `resolutions` must be equal"
119      );
120    }
121    this.tileSize_ = options.tileSize !== void 0 ? options.tileSize : !this.tileSizes_ ? DEFAULT_TILE_SIZE : null;
122    assert(
123      !this.tileSize_ && this.tileSizes_ || this.tileSize_ && !this.tileSizes_,
124      "Either `tileSize` or `tileSizes` must be configured, never both"
125    );
126    this.extent_ = extent !== void 0 ? extent : null;
127    this.fullTileRanges_ = null;
128    this.tmpSize_ = [0, 0];
129    this.tmpExtent_ = [0, 0, 0, 0];
130    if (options.sizes !== void 0) {
131      this.fullTileRanges_ = options.sizes.map((size, z) => {
132        const tileRange = new TileRange_default(
133          Math.min(0, size[0]),
134          Math.max(size[0] - 1, -1),
135          Math.min(0, size[1]),
136          Math.max(size[1] - 1, -1)
137        );
138        if (extent) {
139          const restrictedTileRange = this.getTileRangeForExtentAndZ(extent, z);
140          tileRange.minX = Math.max(restrictedTileRange.minX, tileRange.minX);
141          tileRange.maxX = Math.min(restrictedTileRange.maxX, tileRange.maxX);
142          tileRange.minY = Math.max(restrictedTileRange.minY, tileRange.minY);
143          tileRange.maxY = Math.min(restrictedTileRange.maxY, tileRange.maxY);
144        }
145        return tileRange;
146      });
147    } else if (extent) {
148      this.calculateTileRanges_(extent);
149    }
150  }
151  /**
152   * Call a function with each tile coordinate for a given extent and zoom level.
153   *
154   * @param {import("../extent.js").Extent} extent Extent.
155   * @param {number} zoom Integer zoom level.
156   * @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
157   * @api
158   */
159  forEachTileCoord(extent, zoom, callback) {
160    const tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
161    for (let i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
162      for (let j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
163        callback([zoom, i, j]);
164      }
165    }
166  }
167  /**
168   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
169   * @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
170   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
171   * @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
172   * @return {boolean} Callback succeeded.
173   */
174  forEachTileCoordParentTileRange(tileCoord, callback, tempTileRange, tempExtent) {
175    let tileRange, x, y;
176    let tileCoordExtent = null;
177    let z = tileCoord[0] - 1;
178    if (this.zoomFactor_ === 2) {
179      x = tileCoord[1];
180      y = tileCoord[2];
181    } else {
182      tileCoordExtent = this.getTileCoordExtent(tileCoord, tempExtent);
183    }
184    while (z >= this.minZoom) {
185      if (x !== void 0 && y !== void 0) {
186        x = Math.floor(x / 2);
187        y = Math.floor(y / 2);
188        tileRange = createOrUpdate2(x, x, y, y, tempTileRange);
189      } else {
190        tileRange = this.getTileRangeForExtentAndZ(
191          tileCoordExtent,
192          z,
193          tempTileRange
194        );
195      }
196      if (callback(z, tileRange)) {
197        return true;
198      }
199      --z;
200    }
201    return false;
202  }
203  /**
204   * Get the extent for this tile grid, if it was configured.
205   * @return {import("../extent.js").Extent} Extent.
206   * @api
207   */
208  getExtent() {
209    return this.extent_;
210  }
211  /**
212   * Get the maximum zoom level for the grid.
213   * @return {number} Max zoom.
214   * @api
215   */
216  getMaxZoom() {
217    return this.maxZoom;
218  }
219  /**
220   * Get the minimum zoom level for the grid.
221   * @return {number} Min zoom.
222   * @api
223   */
224  getMinZoom() {
225    return this.minZoom;
226  }
227  /**
228   * Get the origin for the grid at the given zoom level.
229   * @param {number} z Integer zoom level.
230   * @return {import("../coordinate.js").Coordinate} Origin.
231   * @api
232   */
233  getOrigin(z) {
234    if (this.origin_) {
235      return this.origin_;
236    }
237    return this.origins_[z];
238  }
239  /**
240   * Get the resolution for the given zoom level.
241   * @param {number} z Integer zoom level.
242   * @return {number} Resolution.
243   * @api
244   */
245  getResolution(z) {
246    return this.resolutions_[z];
247  }
248  /**
249   * Get the list of resolutions for the tile grid.
250   * @return {Array<number>} Resolutions.
251   * @api
252   */
253  getResolutions() {
254    return this.resolutions_;
255  }
256  /**
257   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
258   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
259   * @param {import("../extent.js").Extent} [tempExtent] Temporary import("../extent.js").Extent object.
260   * @return {import("../TileRange.js").default|null} Tile range.
261   */
262  getTileCoordChildTileRange(tileCoord, tempTileRange, tempExtent) {
263    if (tileCoord[0] < this.maxZoom) {
264      if (this.zoomFactor_ === 2) {
265        const minX = tileCoord[1] * 2;
266        const minY = tileCoord[2] * 2;
267        return createOrUpdate2(
268          minX,
269          minX + 1,
270          minY,
271          minY + 1,
272          tempTileRange
273        );
274      }
275      const tileCoordExtent = this.getTileCoordExtent(
276        tileCoord,
277        tempExtent || this.tmpExtent_
278      );
279      return this.getTileRangeForExtentAndZ(
280        tileCoordExtent,
281        tileCoord[0] + 1,
282        tempTileRange
283      );
284    }
285    return null;
286  }
287  /**
288   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
289   * @param {number} z Integer zoom level.
290   * @param {import("../TileRange.js").default} [tempTileRange] Temporary import("../TileRange.js").default object.
291   * @return {import("../TileRange.js").default|null} Tile range.
292   */
293  getTileRangeForTileCoordAndZ(tileCoord, z, tempTileRange) {
294    if (z > this.maxZoom || z < this.minZoom) {
295      return null;
296    }
297    const tileCoordZ = tileCoord[0];
298    const tileCoordX = tileCoord[1];
299    const tileCoordY = tileCoord[2];
300    if (z === tileCoordZ) {
301      return createOrUpdate2(
302        tileCoordX,
303        tileCoordY,
304        tileCoordX,
305        tileCoordY,
306        tempTileRange
307      );
308    }
309    if (this.zoomFactor_) {
310      const factor = Math.pow(this.zoomFactor_, z - tileCoordZ);
311      const minX = Math.floor(tileCoordX * factor);
312      const minY = Math.floor(tileCoordY * factor);
313      if (z < tileCoordZ) {
314        return createOrUpdate2(minX, minX, minY, minY, tempTileRange);
315      }
316      const maxX = Math.floor(factor * (tileCoordX + 1)) - 1;
317      const maxY = Math.floor(factor * (tileCoordY + 1)) - 1;
318      return createOrUpdate2(minX, maxX, minY, maxY, tempTileRange);
319    }
320    const tileCoordExtent = this.getTileCoordExtent(tileCoord, this.tmpExtent_);
321    return this.getTileRangeForExtentAndZ(tileCoordExtent, z, tempTileRange);
322  }
323  /**
324   * Get a tile range for the given extent and integer zoom level.
325   * @param {import("../extent.js").Extent} extent Extent.
326   * @param {number} z Integer zoom level.
327   * @param {import("../TileRange.js").default} [tempTileRange] Temporary tile range object.
328   * @return {import("../TileRange.js").default} Tile range.
329   */
330  getTileRangeForExtentAndZ(extent, z, tempTileRange) {
331    this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tmpTileCoord);
332    const minX = tmpTileCoord[1];
333    const minY = tmpTileCoord[2];
334    this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tmpTileCoord);
335    const maxX = tmpTileCoord[1];
336    const maxY = tmpTileCoord[2];
337    return createOrUpdate2(minX, maxX, minY, maxY, tempTileRange);
338  }
339  /**
340   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
341   * @return {import("../coordinate.js").Coordinate} Tile center.
342   */
343  getTileCoordCenter(tileCoord) {
344    const origin = this.getOrigin(tileCoord[0]);
345    const resolution = this.getResolution(tileCoord[0]);
346    const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
347    return [
348      origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution,
349      origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution
350    ];
351  }
352  /**
353   * Get the extent of a tile coordinate.
354   *
355   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
356   * @param {import("../extent.js").Extent} [tempExtent] Temporary extent object.
357   * @return {import("../extent.js").Extent} Extent.
358   * @api
359   */
360  getTileCoordExtent(tileCoord, tempExtent) {
361    const origin = this.getOrigin(tileCoord[0]);
362    const resolution = this.getResolution(tileCoord[0]);
363    const tileSize = toSize(this.getTileSize(tileCoord[0]), this.tmpSize_);
364    const minX = origin[0] + tileCoord[1] * tileSize[0] * resolution;
365    const minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution;
366    const maxX = minX + tileSize[0] * resolution;
367    const maxY = minY + tileSize[1] * resolution;
368    return createOrUpdate(minX, minY, maxX, maxY, tempExtent);
369  }
370  /**
371   * Get the tile coordinate for the given map coordinate and resolution.  This
372   * method considers that coordinates that intersect tile boundaries should be
373   * assigned the higher tile coordinate.
374   *
375   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
376   * @param {number} resolution Resolution.
377   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
378   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
379   * @api
380   */
381  getTileCoordForCoordAndResolution(coordinate, resolution, opt_tileCoord) {
382    return this.getTileCoordForXYAndResolution_(
383      coordinate[0],
384      coordinate[1],
385      resolution,
386      false,
387      opt_tileCoord
388    );
389  }
390  /**
391   * Note that this method should not be called for resolutions that correspond
392   * to an integer zoom level.  Instead call the `getTileCoordForXYAndZ_` method.
393   * @param {number} x X.
394   * @param {number} y Y.
395   * @param {number} resolution Resolution (for a non-integer zoom level).
396   * @param {boolean} reverseIntersectionPolicy Instead of letting edge
397   *     intersections go to the higher tile coordinate, let edge intersections
398   *     go to the lower tile coordinate.
399   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
400   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
401   * @private
402   */
403  getTileCoordForXYAndResolution_(x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) {
404    const z = this.getZForResolution(resolution);
405    const scale2 = resolution / this.getResolution(z);
406    const origin = this.getOrigin(z);
407    const tileSize = toSize(this.getTileSize(z), this.tmpSize_);
408    let tileCoordX = scale2 * (x - origin[0]) / resolution / tileSize[0];
409    let tileCoordY = scale2 * (origin[1] - y) / resolution / tileSize[1];
410    if (reverseIntersectionPolicy) {
411      tileCoordX = ceil(tileCoordX, DECIMALS) - 1;
412      tileCoordY = ceil(tileCoordY, DECIMALS) - 1;
413    } else {
414      tileCoordX = floor(tileCoordX, DECIMALS);
415      tileCoordY = floor(tileCoordY, DECIMALS);
416    }
417    return createOrUpdate3(z, tileCoordX, tileCoordY, opt_tileCoord);
418  }
419  /**
420   * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
421   * they should have separate implementations.  This method is for integer zoom
422   * levels.  The other method should only be called for resolutions corresponding
423   * to non-integer zoom levels.
424   * @param {number} x Map x coordinate.
425   * @param {number} y Map y coordinate.
426   * @param {number} z Integer zoom level.
427   * @param {boolean} reverseIntersectionPolicy Instead of letting edge
428   *     intersections go to the higher tile coordinate, let edge intersections
429   *     go to the lower tile coordinate.
430   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Temporary import("../tilecoord.js").TileCoord object.
431   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
432   * @private
433   */
434  getTileCoordForXYAndZ_(x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
435    const origin = this.getOrigin(z);
436    const resolution = this.getResolution(z);
437    const tileSize = toSize(this.getTileSize(z), this.tmpSize_);
438    let tileCoordX = (x - origin[0]) / resolution / tileSize[0];
439    let tileCoordY = (origin[1] - y) / resolution / tileSize[1];
440    if (reverseIntersectionPolicy) {
441      tileCoordX = ceil(tileCoordX, DECIMALS) - 1;
442      tileCoordY = ceil(tileCoordY, DECIMALS) - 1;
443    } else {
444      tileCoordX = floor(tileCoordX, DECIMALS);
445      tileCoordY = floor(tileCoordY, DECIMALS);
446    }
447    return createOrUpdate3(z, tileCoordX, tileCoordY, opt_tileCoord);
448  }
449  /**
450   * Get a tile coordinate given a map coordinate and zoom level.
451   * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
452   * @param {number} z Integer zoom level, e.g. the result of a `getZForResolution()` method call
453   * @param {import("../tilecoord.js").TileCoord} [opt_tileCoord] Destination import("../tilecoord.js").TileCoord object.
454   * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
455   * @api
456   */
457  getTileCoordForCoordAndZ(coordinate, z, opt_tileCoord) {
458    return this.getTileCoordForXYAndZ_(
459      coordinate[0],
460      coordinate[1],
461      z,
462      false,
463      opt_tileCoord
464    );
465  }
466  /**
467   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
468   * @return {number} Tile resolution.
469   */
470  getTileCoordResolution(tileCoord) {
471    return this.resolutions_[tileCoord[0]];
472  }
473  /**
474   * Get the tile size for a zoom level. The type of the return value matches the
475   * `tileSize` or `tileSizes` that the tile grid was configured with. To always
476   * get an {@link import("../size.js").Size}, run the result through {@link module:ol/size.toSize}.
477   * @param {number} z Z.
478   * @return {number|import("../size.js").Size} Tile size.
479   * @api
480   */
481  getTileSize(z) {
482    if (this.tileSize_) {
483      return this.tileSize_;
484    }
485    return this.tileSizes_[z];
486  }
487  /**
488   * @param {number} z Zoom level.
489   * @return {import("../TileRange.js").default|null} Extent tile range for the specified zoom level.
490   */
491  getFullTileRange(z) {
492    if (!this.fullTileRanges_) {
493      return this.extent_ ? this.getTileRangeForExtentAndZ(this.extent_, z) : null;
494    }
495    return this.fullTileRanges_[z];
496  }
497  /**
498   * @param {number} resolution Resolution.
499   * @param {number|import("../array.js").NearestDirectionFunction} [opt_direction]
500   *     If 0, the nearest resolution will be used.
501   *     If 1, the nearest higher resolution (lower Z) will be used. If -1, the
502   *     nearest lower resolution (higher Z) will be used. Default is 0.
503   *     Use a {@link module:ol/array~NearestDirectionFunction} for more precise control.
504   *
505   * For example to change tile Z at the midpoint of zoom levels
506   * ```js
507   * function(value, high, low) {
508   *   return value - low * Math.sqrt(high / low);
509   * }
510   * ```
511   * @return {number} Z.
512   * @api
513   */
514  getZForResolution(resolution, opt_direction) {
515    const z = linearFindNearest(
516      this.resolutions_,
517      resolution,
518      opt_direction || 0
519    );
520    return clamp(z, this.minZoom, this.maxZoom);
521  }
522  /**
523   * The tile with the provided tile coordinate intersects the given viewport.
524   * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coordinate.
525   * @param {Array<number>} viewport Viewport as returned from {@link module:ol/extent.getRotatedViewport}.
526   * @return {boolean} The tile with the provided tile coordinate intersects the given viewport.
527   */
528  tileCoordIntersectsViewport(tileCoord, viewport) {
529    return intersectsLinearRing(
530      viewport,
531      0,
532      viewport.length,
533      2,
534      this.getTileCoordExtent(tileCoord)
535    );
536  }
537  /**
538   * @param {!import("../extent.js").Extent} extent Extent for this tile grid.
539   * @private
540   */
541  calculateTileRanges_(extent) {
542    const length = this.resolutions_.length;
543    const fullTileRanges = new Array(length);
544    for (let z = this.minZoom; z < length; ++z) {
545      fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z);
546    }
547    this.fullTileRanges_ = fullTileRanges;
548  }
549};
550var TileGrid_default = TileGrid;
551
vendor: 2,567 bytes, lines 552-627
552// node_modules/ol/tilegrid.js
553function getForProjection(projection) {
554  let tileGrid = projection.getDefaultTileGrid();
555  if (!tileGrid) {
556    tileGrid = createForProjection(projection);
557    projection.setDefaultTileGrid(tileGrid);
558  }
559  return tileGrid;
560}
561function wrapX(tileGrid, tileCoord, projection) {
562  const z = tileCoord[0];
563  const center = tileGrid.getTileCoordCenter(tileCoord);
564  const projectionExtent = extentFromProjection(projection);
565  if (!containsCoordinate(projectionExtent, center)) {
566    const worldWidth = getWidth(projectionExtent);
567    const worldsAway = Math.ceil(
568      (projectionExtent[0] - center[0]) / worldWidth
569    );
570    center[0] += worldWidth * worldsAway;
571    return tileGrid.getTileCoordForCoordAndZ(center, z);
572  }
573  return tileCoord;
574}
575function createForExtent(extent, maxZoom, tileSize, corner) {
576  corner = corner !== void 0 ? corner : "top-left";
577  const resolutions = resolutionsFromExtent(extent, maxZoom, tileSize);
578  return new TileGrid_default({
579    extent,
580    origin: getCorner(extent, corner),
581    resolutions,
582    tileSize
583  });
584}
585function createXYZ(options) {
586  const xyzOptions = options || {};
587  const extent = xyzOptions.extent || get("EPSG:3857").getExtent();
588  const gridOptions = {
589    extent,
590    minZoom: xyzOptions.minZoom,
591    tileSize: xyzOptions.tileSize,
592    resolutions: resolutionsFromExtent(
593      extent,
594      xyzOptions.maxZoom,
595      xyzOptions.tileSize,
596      xyzOptions.maxResolution
597    )
598  };
599  return new TileGrid_default(gridOptions);
600}
601function resolutionsFromExtent(extent, maxZoom, tileSize, maxResolution) {
602  maxZoom = maxZoom !== void 0 ? maxZoom : DEFAULT_MAX_ZOOM;
603  tileSize = toSize(tileSize !== void 0 ? tileSize : DEFAULT_TILE_SIZE);
604  const height = getHeight(extent);
605  const width = getWidth(extent);
606  maxResolution = maxResolution > 0 ? maxResolution : Math.max(width / tileSize[0], height / tileSize[1]);
607  const length = maxZoom + 1;
608  const resolutions = new Array(length);
609  for (let z = 0; z < length; ++z) {
610    resolutions[z] = maxResolution / Math.pow(2, z);
611  }
612  return resolutions;
613}
614function createForProjection(projection, maxZoom, tileSize, corner) {
615  const extent = extentFromProjection(projection);
616  return createForExtent(extent, maxZoom, tileSize, corner);
617}
618function extentFromProjection(projection) {
619  projection = get(projection);
620  let extent = projection.getExtent();
621  if (!extent) {
622    const half = 180 * METERS_PER_UNIT.degrees / projection.getMetersPerUnit();
623    extent = createOrUpdate(-half, -half, half, half);
624  }
625  return extent;
626}
627
vendor: 1,177 bytes, lines 628-666
628// node_modules/ol/uri.js
629var zRegEx = /\{z\}/g;
630var xRegEx = /\{x\}/g;
631var yRegEx = /\{y\}/g;
632var dashYRegEx = /\{-y\}/g;
633function renderXYZTemplate(template, z, x, y, maxY) {
634  return template.replace(zRegEx, z.toString()).replace(xRegEx, x.toString()).replace(yRegEx, y.toString()).replace(dashYRegEx, function() {
635    if (maxY === void 0) {
636      throw new Error(
637        "If the URL template has a {-y} placeholder, the grid extent must be known"
638      );
639    }
640    return (maxY - y).toString();
641  });
642}
643function expandUrl(url) {
644  const urls = [];
645  let match = /\{([a-z])-([a-z])\}/.exec(url);
646  if (match) {
647    const startCharCode = match[1].charCodeAt(0);
648    const stopCharCode = match[2].charCodeAt(0);
649    let charCode;
650    for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {
651      urls.push(url.replace(match[0], String.fromCharCode(charCode)));
652    }
653    return urls;
654  }
655  match = /\{(\d+)-(\d+)\}/.exec(url);
656  if (match) {
657    const stop = parseInt(match[2], 10);
658    for (let i = parseInt(match[1], 10); i <= stop; i++) {
659      urls.push(url.replace(match[0], i.toString()));
660    }
661    return urls;
662  }
663  urls.push(url);
664  return urls;
665}
666
vendor: 1,740 bytes, lines 667-721
667// node_modules/ol/tileurlfunction.js
668function createFromTemplate(template, tileGrid) {
669  return (
670    /**
671     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
672     * @param {number} pixelRatio Pixel ratio.
673     * @param {import("./proj/Projection.js").default} projection Projection.
674     * @return {string|undefined} Tile URL.
675     */
676    (function(tileCoord, pixelRatio, projection) {
677      if (!tileCoord) {
678        return void 0;
679      }
680      let maxY;
681      const z = tileCoord[0];
682      if (tileGrid) {
683        const range = tileGrid.getFullTileRange(z);
684        if (range) {
685          maxY = range.getHeight() - 1;
686        }
687      }
688      return renderXYZTemplate(template, z, tileCoord[1], tileCoord[2], maxY);
689    })
690  );
691}
692function createFromTemplates(templates, tileGrid) {
693  const len = templates.length;
694  const tileUrlFunctions = new Array(len);
695  for (let i = 0; i < len; ++i) {
696    tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);
697  }
698  return createFromTileUrlFunctions(tileUrlFunctions);
699}
700function createFromTileUrlFunctions(tileUrlFunctions) {
701  if (tileUrlFunctions.length === 1) {
702    return tileUrlFunctions[0];
703  }
704  return (
705    /**
706     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
707     * @param {number} pixelRatio Pixel ratio.
708     * @param {import("./proj/Projection.js").default} projection Projection.
709     * @return {string|undefined} Tile URL.
710     */
711    (function(tileCoord, pixelRatio, projection) {
712      if (!tileCoord) {
713        return void 0;
714      }
715      const h = hash(tileCoord);
716      const index = modulo(h, tileUrlFunctions.length);
717      return tileUrlFunctions[index](tileCoord, pixelRatio, projection);
718    })
719  );
720}
721
vendor: 5,432 bytes, lines 722-888
722// node_modules/ol/source/Tile.js
723var TileSource = class extends Source_default {
724  /**
725   * @param {Options} options SourceTile source options.
726   */
727  constructor(options) {
728    super({
729      attributions: options.attributions,
730      attributionsCollapsible: options.attributionsCollapsible,
731      projection: options.projection,
732      state: options.state,
733      wrapX: options.wrapX,
734      interpolate: options.interpolate
735    });
736    this.on;
737    this.once;
738    this.un;
739    this.tilePixelRatio_ = options.tilePixelRatio !== void 0 ? options.tilePixelRatio : 1;
740    this.tileGrid = options.tileGrid !== void 0 ? options.tileGrid : null;
741    const tileSize = [256, 256];
742    if (this.tileGrid) {
743      toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()), tileSize);
744    }
745    this.tmpSize = [0, 0];
746    this.key_ = options.key || getUid(this);
747    this.tileOptions = {
748      transition: options.transition,
749      interpolate: options.interpolate
750    };
751    this.zDirection = options.zDirection ? options.zDirection : 0;
752  }
753  /**
754   * @param {import("../proj/Projection.js").default} projection Projection.
755   * @return {number} Gutter.
756   */
757  getGutterForProjection(projection) {
758    return 0;
759  }
760  /**
761   * Return the key to be used for all tiles in the source.
762   * @return {string} The key for all tiles.
763   */
764  getKey() {
765    return this.key_;
766  }
767  /**
768   * Set the value to be used as the key for all tiles in the source.
769   * @param {string} key The key for tiles.
770   * @protected
771   */
772  setKey(key) {
773    if (this.key_ !== key) {
774      this.key_ = key;
775      this.changed();
776    }
777  }
778  /**
779   * @param {import("../proj/Projection").default} [projection] Projection.
780   * @return {Array<number>|null} Resolutions.
781   * @override
782   */
783  getResolutions(projection) {
784    const tileGrid = projection ? this.getTileGridForProjection(projection) : this.tileGrid;
785    if (!tileGrid) {
786      return null;
787    }
788    return tileGrid.getResolutions();
789  }
790  /**
791   * @abstract
792   * @param {number} z Tile coordinate z.
793   * @param {number} x Tile coordinate x.
794   * @param {number} y Tile coordinate y.
795   * @param {number} pixelRatio Pixel ratio.
796   * @param {import("../proj/Projection.js").default} projection Projection.
797   * @param {import("../structs/LRUCache.js").default<import("../Tile.js").default>} [tileCache] Tile cache.
798   * @return {TileType|null} Tile.
799   */
800  getTile(z, x, y, pixelRatio, projection, tileCache) {
801    return abstract();
802  }
803  /**
804   * Return the tile grid of the tile source.
805   * @return {import("../tilegrid/TileGrid.js").default|null} Tile grid.
806   * @api
807   */
808  getTileGrid() {
809    return this.tileGrid;
810  }
811  /**
812   * @param {import("../proj/Projection.js").default} projection Projection.
813   * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
814   */
815  getTileGridForProjection(projection) {
816    if (!this.tileGrid) {
817      return getForProjection(projection);
818    }
819    return this.tileGrid;
820  }
821  /**
822   * Get the tile pixel ratio for this source. Subclasses may override this
823   * method, which is meant to return a supported pixel ratio that matches the
824   * provided `pixelRatio` as close as possible.
825   * @param {number} pixelRatio Pixel ratio.
826   * @return {number} Tile pixel ratio.
827   */
828  getTilePixelRatio(pixelRatio) {
829    return this.tilePixelRatio_;
830  }
831  /**
832   * @param {number} z Z.
833   * @param {number} pixelRatio Pixel ratio.
834   * @param {import("../proj/Projection.js").default} projection Projection.
835   * @return {import("../size.js").Size} Tile size.
836   */
837  getTilePixelSize(z, pixelRatio, projection) {
838    const tileGrid = this.getTileGridForProjection(projection);
839    const tilePixelRatio = this.getTilePixelRatio(pixelRatio);
840    const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);
841    if (tilePixelRatio == 1) {
842      return tileSize;
843    }
844    return scale(tileSize, tilePixelRatio, this.tmpSize);
845  }
846  /**
847   * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
848   * is outside the resolution and extent range of the tile grid, `null` will be
849   * returned.
850   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
851   * @param {import("../proj/Projection.js").default} [projection] Projection.
852   * @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
853   *     null if no tile URL should be created for the passed `tileCoord`.
854   */
855  getTileCoordForTileUrlFunction(tileCoord, projection) {
856    const gridProjection = projection !== void 0 ? projection : this.getProjection();
857    const tileGrid = projection !== void 0 ? this.getTileGridForProjection(gridProjection) : this.tileGrid || this.getTileGridForProjection(gridProjection);
858    if (this.getWrapX() && gridProjection.isGlobal()) {
859      tileCoord = wrapX(tileGrid, tileCoord, gridProjection);
860    }
861    return withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
862  }
863  /**
864   * Remove all cached reprojected tiles from the source. The next render cycle will create new tiles.
865   * @api
866   */
867  clear() {
868  }
869  /**
870   * @override
871   */
872  refresh() {
873    this.clear();
874    super.refresh();
875  }
876};
877var TileSourceEvent = class extends Event_default {
878  /**
879   * @param {string} type Type.
880   * @param {import("../Tile.js").default} tile The tile.
881   */
882  constructor(type, tile) {
883    super(type);
884    this.tile = tile;
885  }
886};
887var Tile_default2 = TileSource;
888
vendor: 800 bytes, lines 889-913
889// node_modules/ol/source/TileEventType.js
890var TileEventType_default = {
891  /**
892   * Triggered when a tile starts loading.
893   * @event module:ol/source/Tile.TileSourceEvent#tileloadstart
894   * @api
895   */
896  TILELOADSTART: "tileloadstart",
897  /**
898   * Triggered when a tile finishes loading, either when its data is loaded,
899   * or when loading was aborted because the tile is no longer needed.
900   * @event module:ol/source/Tile.TileSourceEvent#tileloadend
901   * @api
902   */
903  TILELOADEND: "tileloadend",
904  /**
905   * Triggered if tile loading results in an error. Note that this is not the
906   * right place to re-fetch tiles. See {@link module:ol/ImageTile~ImageTile#load}
907   * for details.
908   * @event module:ol/source/Tile.TileSourceEvent#tileloaderror
909   * @api
910   */
911  TILELOADERROR: "tileloaderror"
912};
913
vendor: 4,531 bytes, lines 914-1061
914// node_modules/ol/source/UrlTile.js
915var UrlTile = class _UrlTile extends Tile_default2 {
916  /**
917   * @param {Options} options Image tile options.
918   */
919  constructor(options) {
920    super({
921      attributions: options.attributions,
922      cacheSize: options.cacheSize,
923      projection: options.projection,
924      state: options.state,
925      tileGrid: options.tileGrid,
926      tilePixelRatio: options.tilePixelRatio,
927      wrapX: options.wrapX,
928      transition: options.transition,
929      interpolate: options.interpolate,
930      key: options.key,
931      attributionsCollapsible: options.attributionsCollapsible,
932      zDirection: options.zDirection
933    });
934    this.generateTileUrlFunction_ = this.tileUrlFunction === _UrlTile.prototype.tileUrlFunction;
935    this.tileLoadFunction = options.tileLoadFunction;
936    if (options.tileUrlFunction) {
937      this.tileUrlFunction = options.tileUrlFunction;
938    }
939    this.urls = null;
940    if (options.urls) {
941      this.setUrls(options.urls);
942    } else if (options.url) {
943      this.setUrl(options.url);
944    }
945    this.tileLoadingKeys_ = {};
946  }
947  /**
948   * Deprecated.  Use an ImageTile source instead.
949   * Return the tile load function of the source.
950   * @return {import("../Tile.js").LoadFunction} TileLoadFunction
951   * @api
952   */
953  getTileLoadFunction() {
954    return this.tileLoadFunction;
955  }
956  /**
957   * Deprecated.  Use an ImageTile source instead.
958   * Return the tile URL function of the source.
959   * @return {import("../Tile.js").UrlFunction} TileUrlFunction
960   * @api
961   */
962  getTileUrlFunction() {
963    return Object.getPrototypeOf(this).tileUrlFunction === this.tileUrlFunction ? this.tileUrlFunction.bind(this) : this.tileUrlFunction;
964  }
965  /**
966   * Deprecated.  Use an ImageTile source instead.
967   * Return the URLs used for this source.
968   * When a tileUrlFunction is used instead of url or urls,
969   * null will be returned.
970   * @return {!Array<string>|null} URLs.
971   * @api
972   */
973  getUrls() {
974    return this.urls;
975  }
976  /**
977   * Handle tile change events.
978   * @param {import("../events/Event.js").default} event Event.
979   * @protected
980   */
981  handleTileChange(event) {
982    const tile = (
983      /** @type {import("../Tile.js").default} */
984      event.target
985    );
986    const uid = getUid(tile);
987    const tileState = tile.getState();
988    let type;
989    if (tileState == TileState_default.LOADING) {
990      this.tileLoadingKeys_[uid] = true;
991      type = TileEventType_default.TILELOADSTART;
992    } else if (uid in this.tileLoadingKeys_) {
993      delete this.tileLoadingKeys_[uid];
994      type = tileState == TileState_default.ERROR ? TileEventType_default.TILELOADERROR : tileState == TileState_default.LOADED ? TileEventType_default.TILELOADEND : void 0;
995    }
996    if (type != void 0) {
997      this.dispatchEvent(new TileSourceEvent(type, tile));
998    }
999  }
1000  /**
1001   * Deprecated.  Use an ImageTile source instead.
1002   * Set the tile load function of the source.
1003   * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
1004   * @api
1005   */
1006  setTileLoadFunction(tileLoadFunction) {
1007    this.tileLoadFunction = tileLoadFunction;
1008    this.changed();
1009  }
1010  /**
1011   * Deprecated.  Use an ImageTile source instead.
1012   * Set the tile URL function of the source.
1013   * @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
1014   * @param {string} [key] Optional new tile key for the source.
1015   * @api
1016   */
1017  setTileUrlFunction(tileUrlFunction, key) {
1018    this.tileUrlFunction = tileUrlFunction;
1019    if (typeof key !== "undefined") {
1020      this.setKey(key);
1021    } else {
1022      this.changed();
1023    }
1024  }
1025  /**
1026   * Set the URL to use for requests.
1027   * @param {string} url URL.
1028   * @api
1029   */
1030  setUrl(url) {
1031    const urls = expandUrl(url);
1032    this.urls = urls;
1033    this.setUrls(urls);
1034  }
1035  /**
1036   * Deprecated.  Use an ImageTile source instead.
1037   * Set the URLs to use for requests.
1038   * @param {Array<string>} urls URLs.
1039   * @api
1040   */
1041  setUrls(urls) {
1042    this.urls = urls;
1043    const key = urls.join("\n");
1044    if (this.generateTileUrlFunction_) {
1045      this.setTileUrlFunction(createFromTemplates(urls, this.tileGrid), key);
1046    } else {
1047      this.setKey(key);
1048    }
1049  }
1050  /**
1051   * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
1052   * @param {number} pixelRatio Pixel ratio.
1053   * @param {import("../proj/Projection.js").default} projection Projection.
1054   * @return {string|undefined} Tile URL.
1055   */
1056  tileUrlFunction(tileCoord, pixelRatio, projection) {
1057    return void 0;
1058  }
1059};
1060var UrlTile_default = UrlTile;
1061
vendor: 8,351 bytes, lines 1062-1312
1062// node_modules/ol/source/TileImage.js
1063var TileImage = class extends UrlTile_default {
1064  /**
1065   * @param {!Options} options Image tile options.
1066   */
1067  constructor(options) {
1068    super({
1069      attributions: options.attributions,
1070      cacheSize: options.cacheSize,
1071      projection: options.projection,
1072      state: options.state,
1073      tileGrid: options.tileGrid,
1074      tileLoadFunction: options.tileLoadFunction ? options.tileLoadFunction : defaultTileLoadFunction,
1075      tilePixelRatio: options.tilePixelRatio,
1076      tileUrlFunction: options.tileUrlFunction,
1077      url: options.url,
1078      urls: options.urls,
1079      wrapX: options.wrapX,
1080      transition: options.transition,
1081      interpolate: options.interpolate !== void 0 ? options.interpolate : true,
1082      key: options.key,
1083      attributionsCollapsible: options.attributionsCollapsible,
1084      zDirection: options.zDirection
1085    });
1086    this.crossOrigin = options.crossOrigin !== void 0 ? options.crossOrigin : null;
1087    this.tileClass = options.tileClass !== void 0 ? options.tileClass : ImageTile_default;
1088    this.tileGridForProjection = {};
1089    this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
1090    this.renderReprojectionEdges_ = false;
1091  }
1092  /**
1093   * @param {import("../proj/Projection.js").default} projection Projection.
1094   * @return {number} Gutter.
1095   * @override
1096   */
1097  getGutterForProjection(projection) {
1098    if (this.getProjection() && projection && !equivalent(this.getProjection(), projection)) {
1099      return 0;
1100    }
1101    return this.getGutter();
1102  }
1103  /**
1104   * @return {number} Gutter.
1105   */
1106  getGutter() {
1107    return 0;
1108  }
1109  /**
1110   * Return the key to be used for all tiles in the source.
1111   * @return {string} The key for all tiles.
1112   * @override
1113   */
1114  getKey() {
1115    let key = super.getKey();
1116    if (!this.getInterpolate()) {
1117      key += ":disable-interpolation";
1118    }
1119    return key;
1120  }
1121  /**
1122   * @param {import("../proj/Projection.js").default} projection Projection.
1123   * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
1124   * @override
1125   */
1126  getTileGridForProjection(projection) {
1127    const thisProj = this.getProjection();
1128    if (this.tileGrid && (!thisProj || equivalent(thisProj, projection))) {
1129      return this.tileGrid;
1130    }
1131    const projKey = getUid(projection);
1132    if (!(projKey in this.tileGridForProjection)) {
1133      this.tileGridForProjection[projKey] = getForProjection(projection);
1134    }
1135    return this.tileGridForProjection[projKey];
1136  }
1137  /**
1138   * @param {number} z Tile coordinate z.
1139   * @param {number} x Tile coordinate x.
1140   * @param {number} y Tile coordinate y.
1141   * @param {number} pixelRatio Pixel ratio.
1142   * @param {import("../proj/Projection.js").default} projection Projection.
1143   * @param {string} key The key set on the tile.
1144   * @return {!ImageTile} Tile.
1145   * @private
1146   */
1147  createTile_(z, x, y, pixelRatio, projection, key) {
1148    const tileCoord = [z, x, y];
1149    const urlTileCoord = this.getTileCoordForTileUrlFunction(
1150      tileCoord,
1151      projection
1152    );
1153    const tileUrl = urlTileCoord ? this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : void 0;
1154    const tile = new this.tileClass(
1155      tileCoord,
1156      tileUrl !== void 0 ? TileState_default.IDLE : TileState_default.EMPTY,
1157      tileUrl !== void 0 ? tileUrl : "",
1158      this.crossOrigin,
1159      this.tileLoadFunction,
1160      this.tileOptions
1161    );
1162    tile.key = key;
1163    tile.addEventListener(EventType_default.CHANGE, this.handleTileChange.bind(this));
1164    return tile;
1165  }
1166  /**
1167   * @param {number} z Tile coordinate z.
1168   * @param {number} x Tile coordinate x.
1169   * @param {number} y Tile coordinate y.
1170   * @param {number} pixelRatio Pixel ratio.
1171   * @param {import("../proj/Projection.js").default} projection Projection.
1172   * @param {import("../structs/LRUCache.js").default<import("../Tile.js").default>} [tileCache] Tile cache.
1173   * @return {!(ImageTile|ReprojTile)} Tile.
1174   * @override
1175   */
1176  getTile(z, x, y, pixelRatio, projection, tileCache) {
1177    const sourceProjection = this.getProjection();
1178    if (!sourceProjection || !projection || equivalent(sourceProjection, projection)) {
1179      return this.getTileInternal(
1180        z,
1181        x,
1182        y,
1183        pixelRatio,
1184        sourceProjection || projection
1185      );
1186    }
1187    const tileCoord = [z, x, y];
1188    const key = this.getKey();
1189    const sourceTileGrid = this.getTileGridForProjection(sourceProjection);
1190    const targetTileGrid = this.getTileGridForProjection(projection);
1191    const wrappedTileCoord = this.getTileCoordForTileUrlFunction(
1192      tileCoord,
1193      projection
1194    );
1195    const tile = new Tile_default(
1196      sourceProjection,
1197      sourceTileGrid,
1198      projection,
1199      targetTileGrid,
1200      tileCoord,
1201      wrappedTileCoord,
1202      this.getTilePixelRatio(pixelRatio),
1203      this.getGutter(),
1204      (z2, x2, y2, pixelRatio2) => this.getTileInternal(z2, x2, y2, pixelRatio2, sourceProjection, tileCache),
1205      this.reprojectionErrorThreshold_,
1206      this.renderReprojectionEdges_,
1207      this.tileOptions
1208    );
1209    tile.key = key;
1210    return tile;
1211  }
1212  /**
1213   * @param {number} z Tile coordinate z.
1214   * @param {number} x Tile coordinate x.
1215   * @param {number} y Tile coordinate y.
1216   * @param {number} pixelRatio Pixel ratio.
1217   * @param {!import("../proj/Projection.js").default} projection Projection.
1218   * @param {import("../structs/LRUCache.js").default<import("../Tile.js").default>} [tileCache] Tile cache.
1219   * @return {!ImageTile} Tile.
1220   * @protected
1221   */
1222  getTileInternal(z, x, y, pixelRatio, projection, tileCache) {
1223    const key = this.getKey();
1224    const cacheKey = getCacheKey(this, key, z, x, y);
1225    if (tileCache && tileCache.containsKey(cacheKey)) {
1226      const tile2 = (
1227        /** @type {!ImageTile} */
1228        tileCache.get(cacheKey)
1229      );
1230      return tile2;
1231    }
1232    const tile = this.createTile_(z, x, y, pixelRatio, projection, key);
1233    tileCache?.set(cacheKey, tile);
1234    return tile;
1235  }
1236  /**
1237   * Sets whether to render reprojection edges or not (usually for debugging).
1238   * @param {boolean} render Render the edges.
1239   * @api
1240   */
1241  setRenderReprojectionEdges(render) {
1242    if (this.renderReprojectionEdges_ == render) {
1243      return;
1244    }
1245    this.renderReprojectionEdges_ = render;
1246    this.changed();
1247  }
1248  /**
1249   * Sets the tile grid to use when reprojecting the tiles to the given
1250   * projection instead of the default tile grid for the projection.
1251   *
1252   * This can be useful when the default tile grid cannot be created
1253   * (e.g. projection has no extent defined) or
1254   * for optimization reasons (custom tile size, resolutions, ...).
1255   *
1256   * @param {import("../proj.js").ProjectionLike} projection Projection.
1257   * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
1258   * @api
1259   */
1260  setTileGridForProjection(projection, tilegrid) {
1261    const proj = get(projection);
1262    if (proj) {
1263      const projKey = getUid(proj);
1264      if (!(projKey in this.tileGridForProjection)) {
1265        this.tileGridForProjection[projKey] = tilegrid;
1266      }
1267    }
1268  }
1269};
1270function defaultTileLoadFunction(imageTile, src) {
1271  if (WORKER_OFFSCREEN_CANVAS) {
1272    const crossOrigin = imageTile.getCrossOrigin();
1273    let mode = "same-origin";
1274    let credentials = "same-origin";
1275    if (crossOrigin === "anonymous" || crossOrigin === "") {
1276      mode = "cors";
1277      credentials = "omit";
1278    } else if (crossOrigin === "use-credentials") {
1279      mode = "cors";
1280      credentials = "include";
1281    }
1282    fetch(src, {
1283      mode,
1284      credentials
1285    }).then((response) => {
1286      if (!response.ok) {
1287        throw new Error(`HTTP ${response.status}`);
1288      }
1289      return response.blob();
1290    }).then((blob) => {
1291      return createImageBitmap(blob);
1292    }).then((imageBitmap) => {
1293      const canvas = imageTile.getImage();
1294      canvas.width = imageBitmap.width;
1295      canvas.height = imageBitmap.height;
1296      const ctx = (
1297        /** @type {OffscreenCanvas} */
1298        canvas.getContext("2d")
1299      );
1300      ctx.drawImage(imageBitmap, 0, 0);
1301      imageBitmap.close?.();
1302      canvas.dispatchEvent(new Event("load"));
1303    }).catch(() => {
1304      const canvas = imageTile.getImage();
1305      canvas.dispatchEvent(new Event("error"));
1306    });
1307    return;
1308  }
1309  imageTile.getImage().src = src;
1310}
1311var TileImage_default = TileImage;
1312
vendor: 1,511 bytes, lines 1313-1360
1313// node_modules/ol/source/XYZ.js
1314var XYZ = class extends TileImage_default {
1315  /**
1316   * @param {Options} [options] XYZ options.
1317   */
1318  constructor(options) {
1319    options = options || {};
1320    const projection = options.projection !== void 0 ? options.projection : "EPSG:3857";
1321    const tileGrid = options.tileGrid !== void 0 ? options.tileGrid : createXYZ({
1322      extent: extentFromProjection(projection),
1323      maxResolution: options.maxResolution,
1324      maxZoom: options.maxZoom,
1325      minZoom: options.minZoom,
1326      tileSize: options.tileSize
1327    });
1328    super({
1329      attributions: options.attributions,
1330      cacheSize: options.cacheSize,
1331      crossOrigin: options.crossOrigin,
1332      interpolate: options.interpolate,
1333      projection,
1334      reprojectionErrorThreshold: options.reprojectionErrorThreshold,
1335      tileGrid,
1336      tileLoadFunction: options.tileLoadFunction,
1337      tilePixelRatio: options.tilePixelRatio,
1338      tileUrlFunction: options.tileUrlFunction,
1339      url: options.url,
1340      urls: options.urls,
1341      wrapX: options.wrapX !== void 0 ? options.wrapX : true,
1342      transition: options.transition,
1343      attributionsCollapsible: options.attributionsCollapsible,
1344      zDirection: options.zDirection
1345    });
1346    this.gutter_ = options.gutter !== void 0 ? options.gutter : 0;
1347  }
1348  /**
1349   * @return {number} Gutter.
1350   * @override
1351   */
1352  getGutter() {
1353    return this.gutter_;
1354  }
1355};
1356var XYZ_default = XYZ;
1357export {
1358  XYZ_default as default
1359};
1360//# sourceMappingURL=ol_source_XYZ.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.