mobility-toolbox-js 2.0.0-beta.30 → 2.0.0-beta.34

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.
Files changed (225) hide show
  1. package/api/RealtimeAPI.d.ts +268 -0
  2. package/api/RealtimeAPI.d.ts.map +1 -0
  3. package/api/RealtimeAPI.js +626 -343
  4. package/api/RoutingAPI.d.ts +33 -0
  5. package/api/RoutingAPI.d.ts.map +1 -0
  6. package/api/RoutingAPI.js +65 -15
  7. package/api/StopsAPI.d.ts +36 -0
  8. package/api/StopsAPI.d.ts.map +1 -0
  9. package/api/StopsAPI.js +70 -12
  10. package/api/index.d.ts +5 -0
  11. package/api/index.d.ts.map +1 -0
  12. package/api/index.js +10 -3
  13. package/api/typedefs.d.ts +105 -0
  14. package/api/typedefs.d.ts.map +1 -0
  15. package/api/typedefs.js +72 -0
  16. package/common/api/HttpAPI.d.ts +31 -0
  17. package/common/api/HttpAPI.d.ts.map +1 -0
  18. package/common/api/HttpAPI.js +82 -30
  19. package/common/api/WebSocketAPI.d.ts +95 -0
  20. package/common/api/WebSocketAPI.d.ts.map +1 -0
  21. package/common/api/WebSocketAPI.js +313 -168
  22. package/common/controls/Control.d.ts +74 -0
  23. package/common/controls/Control.d.ts.map +1 -0
  24. package/common/controls/Control.js +167 -78
  25. package/common/index.d.ts +3 -0
  26. package/common/index.d.ts.map +1 -0
  27. package/common/index.js +18 -2
  28. package/common/layers/Layer.d.ts +80 -0
  29. package/common/layers/Layer.d.ts.map +1 -0
  30. package/common/layers/Layer.js +251 -134
  31. package/common/mixins/CopyrightMixin.d.ts +22 -0
  32. package/common/mixins/CopyrightMixin.d.ts.map +1 -0
  33. package/common/mixins/CopyrightMixin.js +70 -22
  34. package/common/mixins/MapboxLayerMixin.d.ts +27 -0
  35. package/common/mixins/MapboxLayerMixin.d.ts.map +1 -0
  36. package/common/mixins/MapboxLayerMixin.js +240 -0
  37. package/common/mixins/RealtimeLayerMixin.d.ts +58 -0
  38. package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
  39. package/common/mixins/RealtimeLayerMixin.js +698 -429
  40. package/common/mixins/StopFinderMixin.d.ts +40 -0
  41. package/common/mixins/StopFinderMixin.d.ts.map +1 -0
  42. package/common/mixins/StopFinderMixin.js +195 -107
  43. package/common/mixins/UserInteractionsLayerMixin.d.ts +42 -0
  44. package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
  45. package/common/mixins/UserInteractionsLayerMixin.js +222 -121
  46. package/common/styles/index.d.ts +5 -0
  47. package/common/styles/index.d.ts.map +1 -0
  48. package/common/styles/index.js +24 -4
  49. package/common/styles/realtimeDefaultStyle.d.ts +15 -0
  50. package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
  51. package/common/styles/realtimeDefaultStyle.js +236 -190
  52. package/common/styles/realtimeDelayStyle.d.ts +11 -0
  53. package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
  54. package/common/styles/realtimeDelayStyle.js +25 -7
  55. package/common/styles/realtimeSimpleStyle.d.ts +3 -0
  56. package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
  57. package/common/styles/realtimeSimpleStyle.js +23 -17
  58. package/common/typedefs.d.ts +50 -0
  59. package/common/typedefs.d.ts.map +1 -0
  60. package/common/typedefs.js +21 -0
  61. package/common/utils/cleanStopTime.d.ts +7 -0
  62. package/common/utils/cleanStopTime.d.ts.map +1 -0
  63. package/common/utils/cleanStopTime.js +28 -17
  64. package/common/utils/compareDepartures.d.ts +9 -0
  65. package/common/utils/compareDepartures.d.ts.map +1 -0
  66. package/common/utils/compareDepartures.js +34 -22
  67. package/common/utils/createCanvas.d.ts +9 -0
  68. package/common/utils/createCanvas.d.ts.map +1 -0
  69. package/common/utils/createCanvas.js +28 -16
  70. package/common/utils/createTrackerFilters.d.ts +12 -0
  71. package/common/utils/createTrackerFilters.d.ts.map +1 -0
  72. package/common/utils/createTrackerFilters.js +75 -54
  73. package/common/utils/getLayersAsFlatArray.d.ts +3 -0
  74. package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
  75. package/common/utils/getLayersAsFlatArray.js +15 -13
  76. package/common/utils/getMapboxMapCopyrights.d.ts +8 -0
  77. package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
  78. package/common/utils/getMapboxMapCopyrights.js +24 -17
  79. package/common/utils/getMapboxRender.d.ts +5 -0
  80. package/common/utils/getMapboxRender.d.ts.map +1 -0
  81. package/common/utils/getMapboxRender.js +77 -0
  82. package/common/utils/getMaplibreRender.d.ts +5 -0
  83. package/common/utils/getMaplibreRender.d.ts.map +1 -0
  84. package/common/utils/getMaplibreRender.js +38 -0
  85. package/common/utils/getRealtimeModeSuffix.d.ts +8 -0
  86. package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
  87. package/common/utils/getRealtimeModeSuffix.js +11 -2
  88. package/common/utils/getUrlWithParams.d.ts +9 -0
  89. package/common/utils/getUrlWithParams.d.ts.map +1 -0
  90. package/common/utils/getUrlWithParams.js +20 -10
  91. package/common/utils/getVehiclePosition.d.ts +14 -0
  92. package/common/utils/getVehiclePosition.d.ts.map +1 -0
  93. package/common/utils/getVehiclePosition.js +63 -39
  94. package/common/utils/index.d.ts +12 -0
  95. package/common/utils/index.d.ts.map +1 -0
  96. package/common/utils/index.js +37 -9
  97. package/common/utils/removeDuplicate.d.ts +10 -0
  98. package/common/utils/removeDuplicate.d.ts.map +1 -0
  99. package/common/utils/removeDuplicate.js +29 -7
  100. package/common/utils/renderTrajectories.d.ts +20 -0
  101. package/common/utils/renderTrajectories.d.ts.map +1 -0
  102. package/common/utils/renderTrajectories.js +111 -78
  103. package/common/utils/sortByDelay.d.ts +3 -0
  104. package/common/utils/sortByDelay.d.ts.map +1 -0
  105. package/common/utils/sortByDelay.js +21 -17
  106. package/common/utils/timeUtils.d.ts +5 -0
  107. package/common/utils/timeUtils.d.ts.map +1 -0
  108. package/common/utils/timeUtils.js +47 -18
  109. package/common/utils/trackerConfig.d.ts +24 -0
  110. package/common/utils/trackerConfig.d.ts.map +1 -0
  111. package/common/utils/trackerConfig.js +171 -118
  112. package/iife.d.ts +3 -0
  113. package/iife.d.ts.map +1 -0
  114. package/iife.js +7 -0
  115. package/index.d.ts +6 -0
  116. package/index.d.ts.map +1 -0
  117. package/index.js +10 -7
  118. package/mapbox/controls/CopyrightControl.d.ts +32 -0
  119. package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
  120. package/mapbox/controls/CopyrightControl.js +72 -28
  121. package/mapbox/controls/index.d.ts +2 -0
  122. package/mapbox/controls/index.d.ts.map +1 -0
  123. package/mapbox/controls/index.js +6 -1
  124. package/mapbox/index.d.ts +5 -0
  125. package/mapbox/index.d.ts.map +1 -0
  126. package/mapbox/index.js +20 -4
  127. package/mapbox/layers/Layer.d.ts +47 -0
  128. package/mapbox/layers/Layer.d.ts.map +1 -0
  129. package/mapbox/layers/Layer.js +137 -54
  130. package/mapbox/layers/RealtimeLayer.d.ts +118 -0
  131. package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
  132. package/mapbox/layers/RealtimeLayer.js +310 -183
  133. package/mapbox/layers/index.d.ts +3 -0
  134. package/mapbox/layers/index.d.ts.map +1 -0
  135. package/mapbox/layers/index.js +7 -2
  136. package/mapbox/utils.d.ts +8 -0
  137. package/mapbox/utils.d.ts.map +1 -0
  138. package/mapbox/utils.js +54 -29
  139. package/mbt.js +2052 -2109
  140. package/mbt.js.map +3 -3
  141. package/mbt.min.js +18 -18
  142. package/mbt.min.js.map +3 -3
  143. package/ol/controls/CopyrightControl.d.ts +31 -0
  144. package/ol/controls/CopyrightControl.d.ts.map +1 -0
  145. package/ol/controls/CopyrightControl.js +89 -41
  146. package/ol/controls/RoutingControl.d.ts +180 -0
  147. package/ol/controls/RoutingControl.d.ts.map +1 -0
  148. package/ol/controls/RoutingControl.js +666 -371
  149. package/ol/controls/StopFinderControl.d.ts +32 -0
  150. package/ol/controls/StopFinderControl.d.ts.map +1 -0
  151. package/ol/controls/StopFinderControl.js +59 -10
  152. package/ol/controls/index.d.ts +4 -0
  153. package/ol/controls/index.d.ts.map +1 -0
  154. package/ol/controls/index.js +9 -3
  155. package/ol/index.d.ts +6 -0
  156. package/ol/index.d.ts.map +1 -0
  157. package/ol/index.js +21 -5
  158. package/ol/layers/Layer.d.ts +49 -0
  159. package/ol/layers/Layer.d.ts.map +1 -0
  160. package/ol/layers/Layer.js +178 -81
  161. package/ol/layers/MapboxLayer.d.ts +42 -0
  162. package/ol/layers/MapboxLayer.d.ts.map +1 -0
  163. package/ol/layers/MapboxLayer.js +131 -198
  164. package/ol/layers/MapboxStyleLayer.d.ts +146 -0
  165. package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
  166. package/ol/layers/MapboxStyleLayer.js +382 -186
  167. package/ol/layers/MaplibreLayer.d.ts +27 -0
  168. package/ol/layers/MaplibreLayer.d.ts.map +1 -0
  169. package/ol/layers/MaplibreLayer.js +67 -138
  170. package/ol/layers/RealtimeLayer.d.ts +119 -0
  171. package/ol/layers/RealtimeLayer.d.ts.map +1 -0
  172. package/ol/layers/RealtimeLayer.js +327 -184
  173. package/ol/layers/RoutingLayer.d.ts +24 -0
  174. package/ol/layers/RoutingLayer.d.ts.map +1 -0
  175. package/ol/layers/RoutingLayer.js +111 -56
  176. package/ol/layers/VectorLayer.d.ts +23 -0
  177. package/ol/layers/VectorLayer.d.ts.map +1 -0
  178. package/ol/layers/VectorLayer.js +71 -21
  179. package/ol/layers/WMSLayer.d.ts +38 -0
  180. package/ol/layers/WMSLayer.d.ts.map +1 -0
  181. package/ol/layers/WMSLayer.js +105 -37
  182. package/ol/layers/index.d.ts +9 -0
  183. package/ol/layers/index.d.ts.map +1 -0
  184. package/ol/layers/index.js +19 -8
  185. package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
  186. package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
  187. package/ol/styles/fullTrajectoryDelayStyle.js +32 -28
  188. package/ol/styles/fullTrajectoryStyle.d.ts +4 -0
  189. package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
  190. package/ol/styles/fullTrajectoryStyle.js +44 -40
  191. package/ol/styles/index.d.ts +3 -0
  192. package/ol/styles/index.d.ts.map +1 -0
  193. package/ol/styles/index.js +7 -2
  194. package/package.json +14 -36
  195. package/setupTests.d.ts +2 -0
  196. package/setupTests.d.ts.map +1 -0
  197. package/setupTests.js +15 -0
  198. package/types/index.d.ts +7 -6
  199. package/types/routing.d.ts +25 -25
  200. package/types/stops.d.ts +19 -19
  201. package/api/RealtimeAPI.test.js +0 -67
  202. package/api/RoutingAPI.test.js +0 -25
  203. package/api/StopsAPI.test.js +0 -22
  204. package/common/api/HttpAPI.test.js +0 -50
  205. package/common/api/WebSocketAPI.test.js +0 -311
  206. package/common/controls/Control.test.js +0 -87
  207. package/common/layers/Layer.test.js +0 -134
  208. package/common/mixins/UserInteractionsLayerMixin.test.js +0 -199
  209. package/common/utils/createTrackerFilters.test.js +0 -79
  210. package/common/utils/getMapboxMapCopyrights.test.js +0 -40
  211. package/common/utils/removeDuplicate.test.js +0 -19
  212. package/common/utils/timeUtils.test.js +0 -10
  213. package/common/utils/trackerConfig.test.js +0 -23
  214. package/mapbox/layers/Layer.test.js +0 -182
  215. package/mapbox/layers/RealtimeLayer.test.js +0 -10
  216. package/ol/controls/CopyrightControl.test.js +0 -165
  217. package/ol/controls/RoutingControl.test.js +0 -146
  218. package/ol/controls/StopFinderControl.test.js +0 -48
  219. package/ol/layers/Layer.test.js +0 -175
  220. package/ol/layers/MapboxLayer.test.js +0 -160
  221. package/ol/layers/MapboxStyleLayer.test.js +0 -226
  222. package/ol/layers/RealtimeLayer.test.js +0 -67
  223. package/ol/layers/RoutingLayer.test.js +0 -39
  224. package/ol/layers/VectorLayer.test.js +0 -76
  225. package/ol/layers/WMSLayer.test.js +0 -57
package/mbt.js CHANGED
@@ -32774,6 +32774,8 @@ uniform ${i3} ${o3} u_${a3};
32774
32774
  getHoursAndMinutes: () => getHoursAndMinutes,
32775
32775
  getLayersAsFlatArray: () => getLayersAsFlatArray_default,
32776
32776
  getMapboxMapCopyrights: () => getMapboxMapCopyrights_default,
32777
+ getMapboxRender: () => getMapboxRender,
32778
+ getMaplibreRender: () => getMaplibreRender,
32777
32779
  getTextCanvas: () => getTextCanvas,
32778
32780
  getUTCDateString: () => getUTCDateString,
32779
32781
  getUTCTimeString: () => getUTCTimeString,
@@ -33345,9 +33347,9 @@ uniform ${i3} ${o3} u_${a3};
33345
33347
  };
33346
33348
  var getUrlWithParams_default = getUrlWithParams;
33347
33349
 
33348
- // src/common/api/HttpAPI.js
33350
+ // src/common/api/HttpAPI.ts
33349
33351
  var HttpAPI = class extends Object_default {
33350
- constructor(options = {}) {
33352
+ constructor(options) {
33351
33353
  super();
33352
33354
  this.url = options.url;
33353
33355
  this.apiKey = options.apiKey;
@@ -33377,18 +33379,16 @@ uniform ${i3} ${o3} u_${a3};
33377
33379
  };
33378
33380
  var HttpAPI_default = HttpAPI;
33379
33381
 
33380
- // src/api/RoutingAPI.js
33382
+ // src/api/RoutingAPI.ts
33381
33383
  var RoutingAPI = class extends HttpAPI_default {
33382
- constructor(options = {}) {
33384
+ constructor(options) {
33383
33385
  super({
33384
33386
  url: "https://api.geops.io/routing/v1/",
33385
- ...options
33387
+ ...options || {}
33386
33388
  });
33387
33389
  }
33388
- route(params, abortController = new AbortController()) {
33389
- return this.fetch("", params, {
33390
- signal: abortController.signal
33391
- });
33390
+ route(params, config) {
33391
+ return this.fetch("", params, config);
33392
33392
  }
33393
33393
  };
33394
33394
  var RoutingAPI_default = RoutingAPI;
@@ -34425,475 +34425,248 @@ uniform ${i3} ${o3} u_${a3};
34425
34425
  };
34426
34426
  var renderTrajectories_default = renderTrajectories;
34427
34427
 
34428
- // src/common/utils/trackerConfig.js
34429
- var trackerConfig_exports = {};
34430
- __export(trackerConfig_exports, {
34431
- bgColors: () => bgColors,
34432
- getBgColor: () => getBgColor,
34433
- getDelayColor: () => getDelayColor,
34434
- getDelayText: () => getDelayText,
34435
- getRadius: () => getRadius,
34436
- getTextColor: () => getTextColor,
34437
- getTextSize: () => getTextSize,
34438
- getTypeIndex: () => getTypeIndex,
34439
- textColors: () => textColors,
34440
- types: () => types
34441
- });
34442
- var trackerRadiusMapping = {
34443
- 0: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34444
- 1: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34445
- 2: [0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15],
34446
- 3: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34447
- 4: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34448
- 5: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34449
- 6: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34450
- 7: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34451
- 8: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
34452
- 9: [0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15]
34453
- };
34454
- var types = [
34455
- /^Tram/i,
34456
- /^Subway( \/ Metro \/ S-Bahn)?/i,
34457
- /^Train/i,
34458
- /^Bus/i,
34459
- /^Ferry/i,
34460
- /^Cable ?Car/i,
34461
- /^Gondola/i,
34462
- /^Funicular/i,
34463
- /^(Long distance bus|coach)/i,
34464
- /^Rail/i
34465
- ];
34466
- var bgColors = [
34467
- "#ffb400",
34468
- "#ff5400",
34469
- "#ff8080",
34470
- "#ea0000",
34471
- "#3000ff",
34472
- "#ffb400",
34473
- "#41a27b",
34474
- "#00d237",
34475
- "#b5b5b5",
34476
- "#ff8080"
34477
- ];
34478
- var textColors = [
34479
- "#000000",
34480
- "#ffffff",
34481
- "#000000",
34482
- "#ffffff",
34483
- "#ffffff",
34484
- "#000000",
34485
- "#ffffff",
34486
- "#000000",
34487
- "#000000",
34488
- "#000000"
34489
- ];
34490
- var getTypeIndex = (type) => {
34491
- if (typeof type === "string") {
34492
- return types.findIndex((t) => t.test(type));
34493
- }
34494
- return type;
34495
- };
34496
- var getRadius = (type, zoom) => {
34497
- try {
34498
- const typeIdx = getTypeIndex(type || 0);
34499
- return trackerRadiusMapping[typeIdx][zoom];
34500
- } catch (e) {
34501
- return 1;
34502
- }
34503
- };
34504
- var getBgColor = (type = 0) => {
34505
- try {
34506
- const typeIdx = getTypeIndex(type);
34507
- return bgColors[typeIdx];
34508
- } catch (e) {
34509
- return 1;
34510
- }
34511
- };
34512
- var getTextColor = (type = 0) => {
34513
- try {
34514
- const typeIdx = getTypeIndex(type);
34515
- return textColors[typeIdx];
34516
- } catch (e) {
34517
- return 1;
34518
- }
34428
+ // node_modules/ol/proj/Units.js
34429
+ var Units = {
34430
+ RADIANS: "radians",
34431
+ DEGREES: "degrees",
34432
+ FEET: "ft",
34433
+ METERS: "m",
34434
+ PIXELS: "pixels",
34435
+ TILE_PIXELS: "tile-pixels",
34436
+ USFEET: "us-ft"
34519
34437
  };
34520
- var getTextSize = (ctx, markerSize, text, fontSize) => {
34521
- ctx.font = `bold ${fontSize}px Arial`;
34522
- let newText = ctx.measureText(text);
34523
- const maxiter = 25;
34524
- let i = 0;
34525
- while (newText.width > markerSize - 6 && i < maxiter) {
34526
- fontSize -= 0.5;
34527
- ctx.font = `bold ${fontSize}px arial, sans-serif`;
34528
- newText = ctx.measureText(text);
34529
- i += 1;
34530
- }
34531
- return fontSize;
34438
+ var unitByCode = {
34439
+ "9001": Units.METERS,
34440
+ "9002": Units.FEET,
34441
+ "9003": Units.USFEET,
34442
+ "9101": Units.RADIANS,
34443
+ "9102": Units.DEGREES
34532
34444
  };
34533
- var getDelayColor = (delayInMs, cancelled, isDelayText) => {
34534
- if (cancelled) {
34535
- return isDelayText ? "#ff0000" : "#a0a0a0";
34536
- }
34537
- if (delayInMs >= 36e5) {
34538
- return "#ed004c";
34539
- }
34540
- if (delayInMs >= 5e5) {
34541
- return "#e80000";
34542
- }
34543
- if (delayInMs >= 3e5) {
34544
- return "#ff4a00";
34445
+ var METERS_PER_UNIT = {};
34446
+ METERS_PER_UNIT[Units.RADIANS] = 6370997 / (2 * Math.PI);
34447
+ METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;
34448
+ METERS_PER_UNIT[Units.FEET] = 0.3048;
34449
+ METERS_PER_UNIT[Units.METERS] = 1;
34450
+ METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
34451
+ var Units_default = Units;
34452
+
34453
+ // node_modules/ol/proj/Projection.js
34454
+ var Projection = function() {
34455
+ function Projection2(options) {
34456
+ this.code_ = options.code;
34457
+ this.units_ = options.units;
34458
+ this.extent_ = options.extent !== void 0 ? options.extent : null;
34459
+ this.worldExtent_ = options.worldExtent !== void 0 ? options.worldExtent : null;
34460
+ this.axisOrientation_ = options.axisOrientation !== void 0 ? options.axisOrientation : "enu";
34461
+ this.global_ = options.global !== void 0 ? options.global : false;
34462
+ this.canWrapX_ = !!(this.global_ && this.extent_);
34463
+ this.getPointResolutionFunc_ = options.getPointResolution;
34464
+ this.defaultTileGrid_ = null;
34465
+ this.metersPerUnit_ = options.metersPerUnit;
34545
34466
  }
34546
- if (delayInMs >= 18e4) {
34547
- return "#f7bf00";
34467
+ Projection2.prototype.canWrapX = function() {
34468
+ return this.canWrapX_;
34469
+ };
34470
+ Projection2.prototype.getCode = function() {
34471
+ return this.code_;
34472
+ };
34473
+ Projection2.prototype.getExtent = function() {
34474
+ return this.extent_;
34475
+ };
34476
+ Projection2.prototype.getUnits = function() {
34477
+ return this.units_;
34478
+ };
34479
+ Projection2.prototype.getMetersPerUnit = function() {
34480
+ return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];
34481
+ };
34482
+ Projection2.prototype.getWorldExtent = function() {
34483
+ return this.worldExtent_;
34484
+ };
34485
+ Projection2.prototype.getAxisOrientation = function() {
34486
+ return this.axisOrientation_;
34487
+ };
34488
+ Projection2.prototype.isGlobal = function() {
34489
+ return this.global_;
34490
+ };
34491
+ Projection2.prototype.setGlobal = function(global2) {
34492
+ this.global_ = global2;
34493
+ this.canWrapX_ = !!(global2 && this.extent_);
34494
+ };
34495
+ Projection2.prototype.getDefaultTileGrid = function() {
34496
+ return this.defaultTileGrid_;
34497
+ };
34498
+ Projection2.prototype.setDefaultTileGrid = function(tileGrid) {
34499
+ this.defaultTileGrid_ = tileGrid;
34500
+ };
34501
+ Projection2.prototype.setExtent = function(extent) {
34502
+ this.extent_ = extent;
34503
+ this.canWrapX_ = !!(this.global_ && extent);
34504
+ };
34505
+ Projection2.prototype.setWorldExtent = function(worldExtent) {
34506
+ this.worldExtent_ = worldExtent;
34507
+ };
34508
+ Projection2.prototype.setGetPointResolution = function(func) {
34509
+ this.getPointResolutionFunc_ = func;
34510
+ };
34511
+ Projection2.prototype.getPointResolutionFunc = function() {
34512
+ return this.getPointResolutionFunc_;
34513
+ };
34514
+ return Projection2;
34515
+ }();
34516
+ var Projection_default = Projection;
34517
+
34518
+ // node_modules/ol/math.js
34519
+ function clamp(value, min, max) {
34520
+ return Math.min(Math.max(value, min), max);
34521
+ }
34522
+ var cosh = function() {
34523
+ var cosh2;
34524
+ if ("cosh" in Math) {
34525
+ cosh2 = Math.cosh;
34526
+ } else {
34527
+ cosh2 = function(x) {
34528
+ var y = Math.exp(x);
34529
+ return (y + 1 / y) / 2;
34530
+ };
34548
34531
  }
34549
- if (delayInMs === null) {
34550
- return "#a0a0a0";
34532
+ return cosh2;
34533
+ }();
34534
+ var log2 = function() {
34535
+ var log22;
34536
+ if ("log2" in Math) {
34537
+ log22 = Math.log2;
34538
+ } else {
34539
+ log22 = function(x) {
34540
+ return Math.log(x) * Math.LOG2E;
34541
+ };
34551
34542
  }
34552
- return "#00a00c";
34553
- };
34554
- var getDelayText = (delayInMs, cancelled) => {
34555
- if (cancelled) {
34556
- return String.fromCodePoint(215);
34543
+ return log22;
34544
+ }();
34545
+ function squaredSegmentDistance(x, y, x1, y1, x2, y2) {
34546
+ var dx = x2 - x1;
34547
+ var dy = y2 - y1;
34548
+ if (dx !== 0 || dy !== 0) {
34549
+ var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
34550
+ if (t > 1) {
34551
+ x1 = x2;
34552
+ y1 = y2;
34553
+ } else if (t > 0) {
34554
+ x1 += dx * t;
34555
+ y1 += dy * t;
34556
+ }
34557
34557
  }
34558
- if (delayInMs > 36e5) {
34559
- const rounded = Math.round(delayInMs / 36e5);
34560
- return `+${rounded}h`;
34561
- }
34562
- if (delayInMs > 59e3) {
34563
- const rounded = Math.round(delayInMs / 6e4);
34564
- return `+${rounded}m`;
34565
- }
34566
- if (delayInMs > 0) {
34567
- return `+${delayInMs}s`;
34568
- }
34569
- return "";
34570
- };
34571
-
34572
- // src/common/utils/createCanvas.js
34573
- var createCanvas = (width, height) => {
34574
- let canvas2 = null;
34575
- if (typeof window === "undefined") {
34576
- return null;
34577
- }
34578
- if (document?.createElement) {
34579
- canvas2 = document.createElement("canvas");
34580
- canvas2.width = width;
34581
- canvas2.height = height;
34582
- } else if (OffscreenCanvas) {
34583
- canvas2 = new OffscreenCanvas(width, height);
34584
- } else {
34585
- console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported");
34586
- }
34587
- return canvas2;
34588
- };
34589
- var createCanvas_default = createCanvas;
34558
+ return squaredDistance(x, y, x1, y1);
34559
+ }
34560
+ function squaredDistance(x1, y1, x2, y2) {
34561
+ var dx = x2 - x1;
34562
+ var dy = y2 - y1;
34563
+ return dx * dx + dy * dy;
34564
+ }
34565
+ function toDegrees(angleInRadians) {
34566
+ return angleInRadians * 180 / Math.PI;
34567
+ }
34568
+ function modulo(a, b) {
34569
+ var r = a % b;
34570
+ return r * b < 0 ? r + b : r;
34571
+ }
34572
+ function lerp(a, b, x) {
34573
+ return a + x * (b - a);
34574
+ }
34590
34575
 
34591
- // src/common/styles/realtimeDefaultStyle.js
34592
- var cacheDelayBg = {};
34593
- var getDelayBgCanvas = (origin, radius, color) => {
34594
- const key = `${origin}, ${radius}, ${color}`;
34595
- if (!cacheDelayBg[key]) {
34596
- const canvas2 = createCanvas_default(origin * 2, origin * 2);
34597
- if (canvas2) {
34598
- const ctx = canvas2.getContext("2d");
34599
- ctx.beginPath();
34600
- ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
34601
- ctx.fillStyle = color;
34602
- ctx.filter = "blur(1px)";
34603
- ctx.fill();
34604
- cacheDelayBg[key] = canvas2;
34576
+ // node_modules/ol/proj/epsg3857.js
34577
+ var __extends5 = function() {
34578
+ var extendStatics = function(d, b) {
34579
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
34580
+ d2.__proto__ = b2;
34581
+ } || function(d2, b2) {
34582
+ for (var p in b2)
34583
+ if (Object.prototype.hasOwnProperty.call(b2, p))
34584
+ d2[p] = b2[p];
34585
+ };
34586
+ return extendStatics(d, b);
34587
+ };
34588
+ return function(d, b) {
34589
+ if (typeof b !== "function" && b !== null)
34590
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
34591
+ extendStatics(d, b);
34592
+ function __() {
34593
+ this.constructor = d;
34605
34594
  }
34595
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34596
+ };
34597
+ }();
34598
+ var RADIUS = 6378137;
34599
+ var HALF_SIZE = Math.PI * RADIUS;
34600
+ var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];
34601
+ var WORLD_EXTENT = [-180, -85, 180, 85];
34602
+ var MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2));
34603
+ var EPSG3857Projection = function(_super) {
34604
+ __extends5(EPSG3857Projection2, _super);
34605
+ function EPSG3857Projection2(code) {
34606
+ return _super.call(this, {
34607
+ code,
34608
+ units: Units_default.METERS,
34609
+ extent: EXTENT,
34610
+ global: true,
34611
+ worldExtent: WORLD_EXTENT,
34612
+ getPointResolution: function(resolution, point2) {
34613
+ return resolution / cosh(point2[1] / RADIUS);
34614
+ }
34615
+ }) || this;
34606
34616
  }
34607
- return cacheDelayBg[key];
34608
- };
34609
- var cacheDelayText = {};
34610
- var getDelayTextCanvas = (width, text, fontSize, font, delayColor, delayOutlineColor = "#000", pixelRatio = 1) => {
34611
- const key = `${width}, ${text}, ${font}, ${delayColor}, ${delayOutlineColor}, ${pixelRatio}`;
34612
- if (!cacheDelayText[key]) {
34613
- const canvas2 = createCanvas_default(width, fontSize + 8 * pixelRatio);
34614
- if (canvas2) {
34615
- const ctx = canvas2.getContext("2d");
34616
- ctx.textAlign = "left";
34617
- ctx.textBaseline = "middle";
34618
- ctx.font = font;
34619
- ctx.fillStyle = delayColor;
34620
- ctx.strokeStyle = delayOutlineColor;
34621
- ctx.lineWidth = 1.5 * pixelRatio;
34622
- const delayText = text;
34623
- ctx.strokeText(delayText, 0, fontSize);
34624
- ctx.fillText(delayText, 0, fontSize);
34625
- cacheDelayText[key] = canvas2;
34617
+ return EPSG3857Projection2;
34618
+ }(Projection_default);
34619
+ var PROJECTIONS = [
34620
+ new EPSG3857Projection("EPSG:3857"),
34621
+ new EPSG3857Projection("EPSG:102100"),
34622
+ new EPSG3857Projection("EPSG:102113"),
34623
+ new EPSG3857Projection("EPSG:900913"),
34624
+ new EPSG3857Projection("http://www.opengis.net/def/crs/EPSG/0/3857"),
34625
+ new EPSG3857Projection("http://www.opengis.net/gml/srs/epsg.xml#3857")
34626
+ ];
34627
+ function fromEPSG4326(input, opt_output, opt_dimension) {
34628
+ var length = input.length;
34629
+ var dimension = opt_dimension > 1 ? opt_dimension : 2;
34630
+ var output = opt_output;
34631
+ if (output === void 0) {
34632
+ if (dimension > 2) {
34633
+ output = input.slice();
34634
+ } else {
34635
+ output = new Array(length);
34626
34636
  }
34627
34637
  }
34628
- return cacheDelayText[key];
34629
- };
34630
- var cacheCircle = {};
34631
- var getCircleCanvas = (origin, radius, color, hasStroke, hasDash, pixelRatio) => {
34632
- const key = `${origin}, ${radius}, ${color}, ${hasStroke}, ${hasDash}, ${pixelRatio}`;
34633
- if (!cacheCircle[key]) {
34634
- const canvas2 = createCanvas_default(origin * 2, origin * 2);
34635
- if (canvas2) {
34636
- const ctx = canvas2.getContext("2d");
34637
- ctx.fillStyle = color;
34638
- if (hasStroke) {
34639
- ctx.lineWidth = 1 * pixelRatio;
34640
- ctx.strokeStyle = "#000000";
34641
- }
34642
- ctx.beginPath();
34643
- ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
34644
- ctx.fill();
34645
- if (hasDash) {
34646
- ctx.setLineDash([5, 3]);
34647
- }
34648
- if (hasStroke) {
34649
- ctx.stroke();
34650
- }
34651
- cacheCircle[key] = canvas2;
34638
+ for (var i = 0; i < length; i += dimension) {
34639
+ output[i] = HALF_SIZE * input[i] / 180;
34640
+ var y = RADIUS * Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360));
34641
+ if (y > MAX_SAFE_Y) {
34642
+ y = MAX_SAFE_Y;
34643
+ } else if (y < -MAX_SAFE_Y) {
34644
+ y = -MAX_SAFE_Y;
34652
34645
  }
34646
+ output[i + 1] = y;
34653
34647
  }
34654
- return cacheCircle[key];
34655
- };
34656
- var cacheText = {};
34657
- var getTextCanvas = (text, origin, textSize, fillColor, strokeColor, hasStroke, pixelRatio) => {
34658
- const key = `${text}, ${origin}, ${textSize}, ${fillColor},${strokeColor}, ${hasStroke}, ${pixelRatio}`;
34659
- if (!cacheText[key]) {
34660
- const canvas2 = createCanvas_default(origin * 2, origin * 2);
34661
- if (canvas2) {
34662
- const ctx = canvas2.getContext("2d");
34663
- if (hasStroke) {
34664
- ctx.save();
34665
- ctx.textBaseline = "middle";
34666
- ctx.textAlign = "center";
34667
- ctx.font = `bold ${textSize + 2}px Arial`;
34668
- ctx.strokeStyle = strokeColor;
34669
- ctx.strokeText(text, origin, origin);
34670
- ctx.restore();
34671
- }
34672
- ctx.textBaseline = "middle";
34673
- ctx.textAlign = "center";
34674
- ctx.fillStyle = fillColor;
34675
- ctx.font = `bold ${textSize}px Arial`;
34676
- ctx.strokeStyle = strokeColor;
34677
- ctx.strokeText(text, origin, origin);
34678
- ctx.fillText(text, origin, origin);
34679
- cacheText[key] = canvas2;
34648
+ return output;
34649
+ }
34650
+ function toEPSG4326(input, opt_output, opt_dimension) {
34651
+ var length = input.length;
34652
+ var dimension = opt_dimension > 1 ? opt_dimension : 2;
34653
+ var output = opt_output;
34654
+ if (output === void 0) {
34655
+ if (dimension > 2) {
34656
+ output = input.slice();
34657
+ } else {
34658
+ output = new Array(length);
34680
34659
  }
34681
34660
  }
34682
- return cacheText[key];
34683
- };
34684
- var cache = {};
34685
- var realtimeDefaultStyle = (trajectory, viewState, options) => {
34686
- const {
34687
- hoverVehicleId,
34688
- selectedVehicleId,
34689
- useDelayStyle,
34690
- delayOutlineColor = "#000",
34691
- delayDisplay = 3e5,
34692
- getRadius: getRadius2,
34693
- getBgColor: getBgColor2,
34694
- getDelayColor: getDelayColor2,
34695
- getDelayText: getDelayText2,
34696
- getTextColor: getTextColor2,
34697
- getTextSize: getTextSize2
34698
- } = options;
34699
- const { zoom, pixelRatio } = viewState;
34700
- let { type, cancelled } = trajectory.properties;
34701
- const {
34702
- train_id: id,
34703
- line,
34704
- delay,
34705
- state,
34706
- operator_provides_realtime_journey: operatorProvidesRealtime
34707
- } = trajectory.properties;
34708
- let { name, text_color: textColor, color } = line || {};
34709
- cancelled = cancelled === true || state === "JOURNEY_CANCELLED";
34710
- if (!type) {
34711
- type = "Rail";
34712
- }
34713
- if (!name) {
34714
- name = "I";
34715
- }
34716
- if (!textColor) {
34717
- textColor = "#000000";
34718
- }
34719
- if (color && color[0] !== "#") {
34720
- color = `#${color}`;
34721
- }
34722
- if (textColor[0] !== "#") {
34723
- textColor = `#${textColor}`;
34661
+ for (var i = 0; i < length; i += dimension) {
34662
+ output[i] = 180 * input[i] / HALF_SIZE;
34663
+ output[i + 1] = 360 * Math.atan(Math.exp(input[i + 1] / RADIUS)) / Math.PI - 90;
34724
34664
  }
34725
- const z = Math.min(Math.floor(zoom || 1), 16);
34726
- const hover = hoverVehicleId && hoverVehicleId === id;
34727
- const selected = selectedVehicleId && selectedVehicleId === id;
34728
- let radius = getRadius2(type, z) * pixelRatio;
34729
- const isDisplayStrokeAndDelay = radius >= 7 * pixelRatio;
34730
- if (hover || selected) {
34731
- radius = isDisplayStrokeAndDelay ? radius + 5 * pixelRatio : 14 * pixelRatio;
34732
- }
34733
- const mustDrawText = radius > 10 * pixelRatio;
34734
- let key = `${radius}${hover}${selected}${cancelled}${delay}`;
34735
- if (useDelayStyle) {
34736
- key += `${operatorProvidesRealtime}`;
34737
- } else {
34738
- key += `${type}${color}`;
34739
- }
34740
- if (mustDrawText) {
34741
- key += `${name}${textColor}`;
34742
- }
34743
- if (!cache[key]) {
34744
- if (radius === 0) {
34745
- cache[key] = null;
34746
- return null;
34747
- }
34748
- const margin = 1 * pixelRatio;
34749
- const radiusDelay = radius + 2;
34750
- const markerSize = radius * 2;
34751
- const size = radiusDelay * 2 + margin * 2 + 100 * pixelRatio;
34752
- const origin = size / 2;
34753
- const canvas2 = createCanvas_default(size, size);
34754
- if (canvas2) {
34755
- const ctx = canvas2.getContext("2d");
34756
- if (isDisplayStrokeAndDelay && delay !== null) {
34757
- const delayBg = getDelayBgCanvas(origin, radiusDelay, getDelayColor2(delay, cancelled));
34758
- ctx.drawImage(delayBg, 0, 0);
34759
- }
34760
- if (isDisplayStrokeAndDelay && (hover || delay >= delayDisplay || cancelled)) {
34761
- const fontSize = Math.max(cancelled ? 19 : 14, Math.min(cancelled ? 19 : 17, radius * 1.2)) * pixelRatio;
34762
- const text = getDelayText2(delay, cancelled);
34763
- if (text) {
34764
- const textWidth = text.length * fontSize;
34765
- const delayText = getDelayTextCanvas(textWidth, text, fontSize, `bold ${fontSize}px arial, sans-serif`, getDelayColor2(delay, cancelled, true), delayOutlineColor, pixelRatio);
34766
- ctx.drawImage(delayText, origin + radiusDelay + margin, origin - fontSize);
34767
- }
34768
- }
34769
- let circleFillColor;
34770
- if (useDelayStyle) {
34771
- circleFillColor = getDelayColor2(delay, cancelled);
34772
- } else {
34773
- circleFillColor = color || getBgColor2(type);
34774
- }
34775
- const hasStroke = isDisplayStrokeAndDelay || hover || selected;
34776
- const hasDash = isDisplayStrokeAndDelay && useDelayStyle && delay === null && operatorProvidesRealtime === "yes";
34777
- const circle = getCircleCanvas(origin, radius, circleFillColor, hasStroke, hasDash, pixelRatio);
34778
- ctx.drawImage(circle, 0, 0);
34779
- if (mustDrawText) {
34780
- const fontSize = Math.max(radius, 10);
34781
- const textSize = getTextSize2(ctx, markerSize, name, fontSize);
34782
- const textColor2 = !useDelayStyle ? textColor || getTextColor2(type) : "#000000";
34783
- const hasStroke2 = useDelayStyle && delay === null && operatorProvidesRealtime === "yes";
34784
- const text = getTextCanvas(name, origin, textSize, textColor2, circleFillColor, hasStroke2, pixelRatio);
34785
- ctx.drawImage(text, 0, 0);
34786
- }
34787
- cache[key] = canvas2;
34788
- }
34789
- }
34790
- return cache[key];
34791
- };
34792
- var realtimeDefaultStyle_default = realtimeDefaultStyle;
34793
-
34794
- // src/common/styles/realtimeDelayStyle.js
34795
- var realtimeDelayStyle = (trajectory, viewState, options) => {
34796
- return realtimeDefaultStyle_default(trajectory, viewState, {
34797
- ...options,
34798
- useDelayStyle: true
34799
- });
34800
- };
34801
- var realtimeDelayStyle_default = realtimeDelayStyle;
34802
-
34803
- // src/common/styles/realtimeSimpleStyle.js
34804
- var canvas;
34805
- var realtimeSimpleStyle = () => {
34806
- if (!canvas) {
34807
- document.createElement("canvas");
34808
- canvas.width = 15;
34809
- canvas.height = 15;
34810
- const ctx = canvas.getContext("2d");
34811
- ctx.arc(8, 8, 5, 0, 2 * Math.PI, false);
34812
- ctx.fillStyle = "#8ED6FF";
34813
- ctx.fill();
34814
- ctx.lineWidth = 3;
34815
- ctx.strokeStyle = "black";
34816
- ctx.stroke();
34817
- ctx.lineWidth = 3;
34818
- }
34819
- return canvas;
34820
- };
34821
- var realtimeSimpleStyle_default = realtimeSimpleStyle;
34822
-
34823
- // node_modules/ol/layer/Property.js
34824
- var Property_default = {
34825
- OPACITY: "opacity",
34826
- VISIBLE: "visible",
34827
- EXTENT: "extent",
34828
- Z_INDEX: "zIndex",
34829
- MAX_RESOLUTION: "maxResolution",
34830
- MIN_RESOLUTION: "minResolution",
34831
- MAX_ZOOM: "maxZoom",
34832
- MIN_ZOOM: "minZoom",
34833
- SOURCE: "source",
34834
- MAP: "map"
34835
- };
34836
-
34837
- // node_modules/ol/math.js
34838
- function clamp(value, min, max) {
34839
- return Math.min(Math.max(value, min), max);
34840
- }
34841
- var cosh = function() {
34842
- var cosh2;
34843
- if ("cosh" in Math) {
34844
- cosh2 = Math.cosh;
34845
- } else {
34846
- cosh2 = function(x) {
34847
- var y = Math.exp(x);
34848
- return (y + 1 / y) / 2;
34849
- };
34850
- }
34851
- return cosh2;
34852
- }();
34853
- var log2 = function() {
34854
- var log22;
34855
- if ("log2" in Math) {
34856
- log22 = Math.log2;
34857
- } else {
34858
- log22 = function(x) {
34859
- return Math.log(x) * Math.LOG2E;
34860
- };
34861
- }
34862
- return log22;
34863
- }();
34864
- function squaredSegmentDistance(x, y, x1, y1, x2, y2) {
34865
- var dx = x2 - x1;
34866
- var dy = y2 - y1;
34867
- if (dx !== 0 || dy !== 0) {
34868
- var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
34869
- if (t > 1) {
34870
- x1 = x2;
34871
- y1 = y2;
34872
- } else if (t > 0) {
34873
- x1 += dx * t;
34874
- y1 += dy * t;
34875
- }
34876
- }
34877
- return squaredDistance(x, y, x1, y1);
34878
- }
34879
- function squaredDistance(x1, y1, x2, y2) {
34880
- var dx = x2 - x1;
34881
- var dy = y2 - y1;
34882
- return dx * dx + dy * dy;
34883
- }
34884
- function toDegrees(angleInRadians) {
34885
- return angleInRadians * 180 / Math.PI;
34886
- }
34887
- function modulo(a, b) {
34888
- var r = a % b;
34889
- return r * b < 0 ? r + b : r;
34890
- }
34891
- function lerp(a, b, x) {
34892
- return a + x * (b - a);
34665
+ return output;
34893
34666
  }
34894
34667
 
34895
- // node_modules/ol/layer/Base.js
34896
- var __extends5 = function() {
34668
+ // node_modules/ol/proj/epsg4326.js
34669
+ var __extends6 = function() {
34897
34670
  var extendStatics = function(d, b) {
34898
34671
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
34899
34672
  d2.__proto__ = b2;
@@ -34914,1272 +34687,1597 @@ uniform ${i3} ${o3} u_${a3};
34914
34687
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34915
34688
  };
34916
34689
  }();
34917
- var BaseLayer = function(_super) {
34918
- __extends5(BaseLayer2, _super);
34919
- function BaseLayer2(options) {
34920
- var _this = _super.call(this) || this;
34921
- _this.on;
34922
- _this.once;
34923
- _this.un;
34924
- _this.background_ = options.background;
34925
- var properties = assign({}, options);
34926
- if (typeof options.properties === "object") {
34927
- delete properties.properties;
34928
- assign(properties, options.properties);
34929
- }
34930
- properties[Property_default.OPACITY] = options.opacity !== void 0 ? options.opacity : 1;
34931
- assert(typeof properties[Property_default.OPACITY] === "number", 64);
34932
- properties[Property_default.VISIBLE] = options.visible !== void 0 ? options.visible : true;
34933
- properties[Property_default.Z_INDEX] = options.zIndex;
34934
- properties[Property_default.MAX_RESOLUTION] = options.maxResolution !== void 0 ? options.maxResolution : Infinity;
34935
- properties[Property_default.MIN_RESOLUTION] = options.minResolution !== void 0 ? options.minResolution : 0;
34936
- properties[Property_default.MIN_ZOOM] = options.minZoom !== void 0 ? options.minZoom : -Infinity;
34937
- properties[Property_default.MAX_ZOOM] = options.maxZoom !== void 0 ? options.maxZoom : Infinity;
34938
- _this.className_ = properties.className !== void 0 ? properties.className : "ol-layer";
34939
- delete properties.className;
34940
- _this.setProperties(properties);
34941
- _this.state_ = null;
34942
- return _this;
34690
+ var RADIUS2 = 6378137;
34691
+ var EXTENT2 = [-180, -90, 180, 90];
34692
+ var METERS_PER_UNIT2 = Math.PI * RADIUS2 / 180;
34693
+ var EPSG4326Projection = function(_super) {
34694
+ __extends6(EPSG4326Projection2, _super);
34695
+ function EPSG4326Projection2(code, opt_axisOrientation) {
34696
+ return _super.call(this, {
34697
+ code,
34698
+ units: Units_default.DEGREES,
34699
+ extent: EXTENT2,
34700
+ axisOrientation: opt_axisOrientation,
34701
+ global: true,
34702
+ metersPerUnit: METERS_PER_UNIT2,
34703
+ worldExtent: EXTENT2
34704
+ }) || this;
34943
34705
  }
34944
- BaseLayer2.prototype.getBackground = function() {
34945
- return this.background_;
34946
- };
34947
- BaseLayer2.prototype.getClassName = function() {
34948
- return this.className_;
34949
- };
34950
- BaseLayer2.prototype.getLayerState = function(opt_managed) {
34951
- var state = this.state_ || {
34952
- layer: this,
34953
- managed: opt_managed === void 0 ? true : opt_managed
34954
- };
34955
- var zIndex = this.getZIndex();
34956
- state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);
34957
- state.visible = this.getVisible();
34958
- state.extent = this.getExtent();
34959
- state.zIndex = zIndex === void 0 && !state.managed ? Infinity : zIndex;
34960
- state.maxResolution = this.getMaxResolution();
34961
- state.minResolution = Math.max(this.getMinResolution(), 0);
34962
- state.minZoom = this.getMinZoom();
34963
- state.maxZoom = this.getMaxZoom();
34964
- this.state_ = state;
34965
- return state;
34966
- };
34967
- BaseLayer2.prototype.getLayersArray = function(opt_array) {
34968
- return abstract();
34969
- };
34970
- BaseLayer2.prototype.getLayerStatesArray = function(opt_states) {
34971
- return abstract();
34972
- };
34973
- BaseLayer2.prototype.getExtent = function() {
34974
- return this.get(Property_default.EXTENT);
34975
- };
34976
- BaseLayer2.prototype.getMaxResolution = function() {
34977
- return this.get(Property_default.MAX_RESOLUTION);
34978
- };
34979
- BaseLayer2.prototype.getMinResolution = function() {
34980
- return this.get(Property_default.MIN_RESOLUTION);
34981
- };
34982
- BaseLayer2.prototype.getMinZoom = function() {
34983
- return this.get(Property_default.MIN_ZOOM);
34984
- };
34985
- BaseLayer2.prototype.getMaxZoom = function() {
34986
- return this.get(Property_default.MAX_ZOOM);
34987
- };
34988
- BaseLayer2.prototype.getOpacity = function() {
34989
- return this.get(Property_default.OPACITY);
34990
- };
34991
- BaseLayer2.prototype.getSourceState = function() {
34992
- return abstract();
34993
- };
34994
- BaseLayer2.prototype.getVisible = function() {
34995
- return this.get(Property_default.VISIBLE);
34996
- };
34997
- BaseLayer2.prototype.getZIndex = function() {
34998
- return this.get(Property_default.Z_INDEX);
34999
- };
35000
- BaseLayer2.prototype.setBackground = function(opt_background) {
35001
- this.background_ = opt_background;
35002
- this.changed();
35003
- };
35004
- BaseLayer2.prototype.setExtent = function(extent) {
35005
- this.set(Property_default.EXTENT, extent);
35006
- };
35007
- BaseLayer2.prototype.setMaxResolution = function(maxResolution) {
35008
- this.set(Property_default.MAX_RESOLUTION, maxResolution);
35009
- };
35010
- BaseLayer2.prototype.setMinResolution = function(minResolution) {
35011
- this.set(Property_default.MIN_RESOLUTION, minResolution);
35012
- };
35013
- BaseLayer2.prototype.setMaxZoom = function(maxZoom) {
35014
- this.set(Property_default.MAX_ZOOM, maxZoom);
35015
- };
35016
- BaseLayer2.prototype.setMinZoom = function(minZoom) {
35017
- this.set(Property_default.MIN_ZOOM, minZoom);
35018
- };
35019
- BaseLayer2.prototype.setOpacity = function(opacity) {
35020
- assert(typeof opacity === "number", 64);
35021
- this.set(Property_default.OPACITY, opacity);
35022
- };
35023
- BaseLayer2.prototype.setVisible = function(visible) {
35024
- this.set(Property_default.VISIBLE, visible);
35025
- };
35026
- BaseLayer2.prototype.setZIndex = function(zindex) {
35027
- this.set(Property_default.Z_INDEX, zindex);
35028
- };
35029
- BaseLayer2.prototype.disposeInternal = function() {
35030
- if (this.state_) {
35031
- this.state_.layer = null;
35032
- this.state_ = null;
35033
- }
35034
- _super.prototype.disposeInternal.call(this);
35035
- };
35036
- return BaseLayer2;
35037
- }(Object_default);
35038
- var Base_default = BaseLayer;
34706
+ return EPSG4326Projection2;
34707
+ }(Projection_default);
34708
+ var PROJECTIONS2 = [
34709
+ new EPSG4326Projection("CRS:84"),
34710
+ new EPSG4326Projection("EPSG:4326", "neu"),
34711
+ new EPSG4326Projection("urn:ogc:def:crs:OGC:1.3:CRS84"),
34712
+ new EPSG4326Projection("urn:ogc:def:crs:OGC:2:84"),
34713
+ new EPSG4326Projection("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
34714
+ new EPSG4326Projection("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
34715
+ new EPSG4326Projection("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
34716
+ ];
35039
34717
 
35040
- // node_modules/ol/render/EventType.js
35041
- var EventType_default2 = {
35042
- PRERENDER: "prerender",
35043
- POSTRENDER: "postrender",
35044
- PRECOMPOSE: "precompose",
35045
- POSTCOMPOSE: "postcompose",
35046
- RENDERCOMPLETE: "rendercomplete"
35047
- };
34718
+ // node_modules/ol/proj/projections.js
34719
+ var cache = {};
34720
+ function get(code) {
34721
+ return cache[code] || cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, "EPSG:$3")] || null;
34722
+ }
34723
+ function add(code, projection) {
34724
+ cache[code] = projection;
34725
+ }
35048
34726
 
35049
- // node_modules/ol/source/State.js
35050
- var State_default = {
35051
- UNDEFINED: "undefined",
35052
- LOADING: "loading",
35053
- READY: "ready",
35054
- ERROR: "error"
34727
+ // node_modules/ol/proj/transforms.js
34728
+ var transforms = {};
34729
+ function add2(source, destination, transformFn) {
34730
+ var sourceCode = source.getCode();
34731
+ var destinationCode = destination.getCode();
34732
+ if (!(sourceCode in transforms)) {
34733
+ transforms[sourceCode] = {};
34734
+ }
34735
+ transforms[sourceCode][destinationCode] = transformFn;
34736
+ }
34737
+ function get2(sourceCode, destinationCode) {
34738
+ var transform2;
34739
+ if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {
34740
+ transform2 = transforms[sourceCode][destinationCode];
34741
+ }
34742
+ return transform2;
34743
+ }
34744
+
34745
+ // node_modules/ol/extent/Relationship.js
34746
+ var Relationship_default = {
34747
+ UNKNOWN: 0,
34748
+ INTERSECTING: 1,
34749
+ ABOVE: 2,
34750
+ RIGHT: 4,
34751
+ BELOW: 8,
34752
+ LEFT: 16
35055
34753
  };
35056
34754
 
35057
- // node_modules/ol/layer/Layer.js
35058
- var __extends6 = function() {
35059
- var extendStatics = function(d, b) {
35060
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35061
- d2.__proto__ = b2;
35062
- } || function(d2, b2) {
35063
- for (var p in b2)
35064
- if (Object.prototype.hasOwnProperty.call(b2, p))
35065
- d2[p] = b2[p];
35066
- };
35067
- return extendStatics(d, b);
35068
- };
35069
- return function(d, b) {
35070
- if (typeof b !== "function" && b !== null)
35071
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35072
- extendStatics(d, b);
35073
- function __() {
35074
- this.constructor = d;
35075
- }
35076
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35077
- };
35078
- }();
35079
- var Layer = function(_super) {
35080
- __extends6(Layer5, _super);
35081
- function Layer5(options) {
35082
- var _this = this;
35083
- var baseOptions = assign({}, options);
35084
- delete baseOptions.source;
35085
- _this = _super.call(this, baseOptions) || this;
35086
- _this.on;
35087
- _this.once;
35088
- _this.un;
35089
- _this.mapPrecomposeKey_ = null;
35090
- _this.mapRenderKey_ = null;
35091
- _this.sourceChangeKey_ = null;
35092
- _this.renderer_ = null;
35093
- _this.rendered = false;
35094
- if (options.render) {
35095
- _this.render = options.render;
35096
- }
35097
- if (options.map) {
35098
- _this.setMap(options.map);
35099
- }
35100
- _this.addChangeListener(Property_default.SOURCE, _this.handleSourcePropertyChange_);
35101
- var source = options.source ? options.source : null;
35102
- _this.setSource(source);
35103
- return _this;
34755
+ // node_modules/ol/extent.js
34756
+ function boundingExtent(coordinates2) {
34757
+ var extent = createEmpty();
34758
+ for (var i = 0, ii = coordinates2.length; i < ii; ++i) {
34759
+ extendCoordinate(extent, coordinates2[i]);
35104
34760
  }
35105
- Layer5.prototype.getLayersArray = function(opt_array) {
35106
- var array = opt_array ? opt_array : [];
35107
- array.push(this);
35108
- return array;
35109
- };
35110
- Layer5.prototype.getLayerStatesArray = function(opt_states) {
35111
- var states = opt_states ? opt_states : [];
35112
- states.push(this.getLayerState());
35113
- return states;
35114
- };
35115
- Layer5.prototype.getSource = function() {
35116
- return this.get(Property_default.SOURCE) || null;
35117
- };
35118
- Layer5.prototype.getRenderSource = function() {
35119
- return this.getSource();
35120
- };
35121
- Layer5.prototype.getSourceState = function() {
35122
- var source = this.getSource();
35123
- return !source ? State_default.UNDEFINED : source.getState();
35124
- };
35125
- Layer5.prototype.handleSourceChange_ = function() {
35126
- this.changed();
35127
- };
35128
- Layer5.prototype.handleSourcePropertyChange_ = function() {
35129
- if (this.sourceChangeKey_) {
35130
- unlistenByKey(this.sourceChangeKey_);
35131
- this.sourceChangeKey_ = null;
35132
- }
35133
- var source = this.getSource();
35134
- if (source) {
35135
- this.sourceChangeKey_ = listen(source, EventType_default.CHANGE, this.handleSourceChange_, this);
35136
- }
35137
- this.changed();
35138
- };
35139
- Layer5.prototype.getFeatures = function(pixel) {
35140
- if (!this.renderer_) {
35141
- return new Promise(function(resolve) {
35142
- return resolve([]);
35143
- });
35144
- }
35145
- return this.renderer_.getFeatures(pixel);
35146
- };
35147
- Layer5.prototype.getData = function(pixel) {
35148
- if (!this.renderer_ || !this.rendered) {
35149
- return null;
35150
- }
35151
- return this.renderer_.getData(pixel);
35152
- };
35153
- Layer5.prototype.render = function(frameState, target) {
35154
- var layerRenderer = this.getRenderer();
35155
- if (layerRenderer.prepareFrame(frameState)) {
35156
- this.rendered = true;
35157
- return layerRenderer.renderFrame(frameState, target);
35158
- }
35159
- };
35160
- Layer5.prototype.unrender = function() {
35161
- this.rendered = false;
35162
- };
35163
- Layer5.prototype.setMapInternal = function(map) {
35164
- if (!map) {
35165
- this.unrender();
35166
- }
35167
- this.set(Property_default.MAP, map);
35168
- };
35169
- Layer5.prototype.getMapInternal = function() {
35170
- return this.get(Property_default.MAP);
35171
- };
35172
- Layer5.prototype.setMap = function(map) {
35173
- if (this.mapPrecomposeKey_) {
35174
- unlistenByKey(this.mapPrecomposeKey_);
35175
- this.mapPrecomposeKey_ = null;
35176
- }
35177
- if (!map) {
35178
- this.changed();
35179
- }
35180
- if (this.mapRenderKey_) {
35181
- unlistenByKey(this.mapRenderKey_);
35182
- this.mapRenderKey_ = null;
35183
- }
35184
- if (map) {
35185
- this.mapPrecomposeKey_ = listen(map, EventType_default2.PRECOMPOSE, function(evt) {
35186
- var renderEvent = evt;
35187
- var layerStatesArray = renderEvent.frameState.layerStatesArray;
35188
- var layerState = this.getLayerState(false);
35189
- assert(!layerStatesArray.some(function(arrayLayerState) {
35190
- return arrayLayerState.layer === layerState.layer;
35191
- }), 67);
35192
- layerStatesArray.push(layerState);
35193
- }, this);
35194
- this.mapRenderKey_ = listen(this, EventType_default.CHANGE, map.render, map);
35195
- this.changed();
35196
- }
35197
- };
35198
- Layer5.prototype.setSource = function(source) {
35199
- this.set(Property_default.SOURCE, source);
35200
- };
35201
- Layer5.prototype.getRenderer = function() {
35202
- if (!this.renderer_) {
35203
- this.renderer_ = this.createRenderer();
35204
- }
35205
- return this.renderer_;
35206
- };
35207
- Layer5.prototype.hasRenderer = function() {
35208
- return !!this.renderer_;
35209
- };
35210
- Layer5.prototype.createRenderer = function() {
35211
- return null;
35212
- };
35213
- Layer5.prototype.disposeInternal = function() {
35214
- if (this.renderer_) {
35215
- this.renderer_.dispose();
35216
- delete this.renderer_;
35217
- }
35218
- this.setSource(null);
35219
- _super.prototype.disposeInternal.call(this);
35220
- };
35221
- return Layer5;
35222
- }(Base_default);
35223
- function inView(layerState, viewState) {
35224
- if (!layerState.visible) {
35225
- return false;
34761
+ return extent;
34762
+ }
34763
+ function _boundingExtentXYs(xs, ys, opt_extent) {
34764
+ var minX = Math.min.apply(null, xs);
34765
+ var minY = Math.min.apply(null, ys);
34766
+ var maxX = Math.max.apply(null, xs);
34767
+ var maxY = Math.max.apply(null, ys);
34768
+ return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
34769
+ }
34770
+ function buffer(extent, value, opt_extent) {
34771
+ if (opt_extent) {
34772
+ opt_extent[0] = extent[0] - value;
34773
+ opt_extent[1] = extent[1] - value;
34774
+ opt_extent[2] = extent[2] + value;
34775
+ opt_extent[3] = extent[3] + value;
34776
+ return opt_extent;
34777
+ } else {
34778
+ return [
34779
+ extent[0] - value,
34780
+ extent[1] - value,
34781
+ extent[2] + value,
34782
+ extent[3] + value
34783
+ ];
34784
+ }
34785
+ }
34786
+ function clone(extent, opt_extent) {
34787
+ if (opt_extent) {
34788
+ opt_extent[0] = extent[0];
34789
+ opt_extent[1] = extent[1];
34790
+ opt_extent[2] = extent[2];
34791
+ opt_extent[3] = extent[3];
34792
+ return opt_extent;
34793
+ } else {
34794
+ return extent.slice();
34795
+ }
34796
+ }
34797
+ function closestSquaredDistanceXY(extent, x, y) {
34798
+ var dx, dy;
34799
+ if (x < extent[0]) {
34800
+ dx = extent[0] - x;
34801
+ } else if (extent[2] < x) {
34802
+ dx = x - extent[2];
34803
+ } else {
34804
+ dx = 0;
34805
+ }
34806
+ if (y < extent[1]) {
34807
+ dy = extent[1] - y;
34808
+ } else if (extent[3] < y) {
34809
+ dy = y - extent[3];
34810
+ } else {
34811
+ dy = 0;
34812
+ }
34813
+ return dx * dx + dy * dy;
34814
+ }
34815
+ function containsCoordinate(extent, coordinate) {
34816
+ return containsXY(extent, coordinate[0], coordinate[1]);
34817
+ }
34818
+ function containsExtent(extent1, extent2) {
34819
+ return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
34820
+ }
34821
+ function containsXY(extent, x, y) {
34822
+ return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
34823
+ }
34824
+ function coordinateRelationship(extent, coordinate) {
34825
+ var minX = extent[0];
34826
+ var minY = extent[1];
34827
+ var maxX = extent[2];
34828
+ var maxY = extent[3];
34829
+ var x = coordinate[0];
34830
+ var y = coordinate[1];
34831
+ var relationship = Relationship_default.UNKNOWN;
34832
+ if (x < minX) {
34833
+ relationship = relationship | Relationship_default.LEFT;
34834
+ } else if (x > maxX) {
34835
+ relationship = relationship | Relationship_default.RIGHT;
34836
+ }
34837
+ if (y < minY) {
34838
+ relationship = relationship | Relationship_default.BELOW;
34839
+ } else if (y > maxY) {
34840
+ relationship = relationship | Relationship_default.ABOVE;
34841
+ }
34842
+ if (relationship === Relationship_default.UNKNOWN) {
34843
+ relationship = Relationship_default.INTERSECTING;
34844
+ }
34845
+ return relationship;
34846
+ }
34847
+ function createEmpty() {
34848
+ return [Infinity, Infinity, -Infinity, -Infinity];
34849
+ }
34850
+ function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {
34851
+ if (opt_extent) {
34852
+ opt_extent[0] = minX;
34853
+ opt_extent[1] = minY;
34854
+ opt_extent[2] = maxX;
34855
+ opt_extent[3] = maxY;
34856
+ return opt_extent;
34857
+ } else {
34858
+ return [minX, minY, maxX, maxY];
35226
34859
  }
35227
- var resolution = viewState.resolution;
35228
- if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {
35229
- return false;
34860
+ }
34861
+ function createOrUpdateEmpty(opt_extent) {
34862
+ return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);
34863
+ }
34864
+ function createOrUpdateFromCoordinate(coordinate, opt_extent) {
34865
+ var x = coordinate[0];
34866
+ var y = coordinate[1];
34867
+ return createOrUpdate(x, y, x, y, opt_extent);
34868
+ }
34869
+ function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) {
34870
+ var extent = createOrUpdateEmpty(opt_extent);
34871
+ return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);
34872
+ }
34873
+ function equals2(extent1, extent2) {
34874
+ return extent1[0] == extent2[0] && extent1[2] == extent2[2] && extent1[1] == extent2[1] && extent1[3] == extent2[3];
34875
+ }
34876
+ function extend2(extent1, extent2) {
34877
+ if (extent2[0] < extent1[0]) {
34878
+ extent1[0] = extent2[0];
35230
34879
  }
35231
- var zoom = viewState.zoom;
35232
- return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
34880
+ if (extent2[2] > extent1[2]) {
34881
+ extent1[2] = extent2[2];
34882
+ }
34883
+ if (extent2[1] < extent1[1]) {
34884
+ extent1[1] = extent2[1];
34885
+ }
34886
+ if (extent2[3] > extent1[3]) {
34887
+ extent1[3] = extent2[3];
34888
+ }
34889
+ return extent1;
35233
34890
  }
35234
- var Layer_default = Layer;
35235
-
35236
- // src/common/controls/Control.js
35237
- var Control = class extends Object_default {
35238
- constructor(options = {}) {
35239
- super(options);
35240
- this.defineProperties(options);
35241
- const { active } = {
35242
- active: options.active !== false,
35243
- ...options
35244
- };
35245
- this.active = active;
34891
+ function extendCoordinate(extent, coordinate) {
34892
+ if (coordinate[0] < extent[0]) {
34893
+ extent[0] = coordinate[0];
35246
34894
  }
35247
- defineProperties(options) {
35248
- const { target, element, render } = {
35249
- ...options
35250
- };
35251
- Object.defineProperties(this, {
35252
- active: {
35253
- get: () => this.get("active"),
35254
- set: (newActive) => {
35255
- this.set("active", newActive);
35256
- if (newActive) {
35257
- this.activate();
35258
- } else {
35259
- this.deactivate();
35260
- }
35261
- this.render();
35262
- }
35263
- },
35264
- map: {
35265
- get: () => this.get("map"),
35266
- set: (map) => {
35267
- if (this.map && this.element && this.element.parentNode) {
35268
- this.element.parentNode.removeChild(this.element);
35269
- }
35270
- this.deactivate();
35271
- this.set("map", map);
35272
- if (this.map) {
35273
- const targett = this.target || this.map.getTargetElement && this.map.getTargetElement() || this.map.getContainer && this.map.getContainer();
35274
- if (!this.element) {
35275
- this.createDefaultElement();
35276
- }
35277
- if (this.element) {
35278
- targett.appendChild(this.element);
35279
- }
35280
- if (this.active) {
35281
- this.activate();
35282
- }
35283
- }
35284
- this.render();
35285
- }
35286
- },
35287
- target: {
35288
- value: target
35289
- },
35290
- element: {
35291
- value: element,
35292
- writable: true
35293
- },
35294
- render: {
35295
- value: render || this.render,
35296
- writable: true
35297
- }
35298
- });
34895
+ if (coordinate[0] > extent[2]) {
34896
+ extent[2] = coordinate[0];
35299
34897
  }
35300
- attachToMap(map) {
35301
- this.map = map;
34898
+ if (coordinate[1] < extent[1]) {
34899
+ extent[1] = coordinate[1];
35302
34900
  }
35303
- detachFromMap() {
35304
- this.map = null;
34901
+ if (coordinate[1] > extent[3]) {
34902
+ extent[3] = coordinate[1];
35305
34903
  }
35306
- activate() {
35307
- this.deactivate();
34904
+ }
34905
+ function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) {
34906
+ for (; offset < end; offset += stride) {
34907
+ extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
35308
34908
  }
35309
- deactivate() {
34909
+ return extent;
34910
+ }
34911
+ function extendXY(extent, x, y) {
34912
+ extent[0] = Math.min(extent[0], x);
34913
+ extent[1] = Math.min(extent[1], y);
34914
+ extent[2] = Math.max(extent[2], x);
34915
+ extent[3] = Math.max(extent[3], y);
34916
+ }
34917
+ function forEachCorner(extent, callback) {
34918
+ var val;
34919
+ val = callback(getBottomLeft(extent));
34920
+ if (val) {
34921
+ return val;
35310
34922
  }
35311
- render() {
34923
+ val = callback(getBottomRight(extent));
34924
+ if (val) {
34925
+ return val;
35312
34926
  }
35313
- createDefaultElement() {
34927
+ val = callback(getTopRight(extent));
34928
+ if (val) {
34929
+ return val;
35314
34930
  }
35315
- };
35316
- var Control_default = Control;
35317
-
35318
- // src/common/mixins/CopyrightMixin.js
35319
- var CopyrightMixin = (Base) => class extends Base {
35320
- render() {
35321
- if (!this.element) {
35322
- return;
35323
- }
35324
- this.element.innerHTML = this.active ? this.getCopyrights().join(" | ") : "";
34931
+ val = callback(getTopLeft(extent));
34932
+ if (val) {
34933
+ return val;
35325
34934
  }
35326
- createDefaultElement() {
35327
- this.element = document.createElement("div");
35328
- this.element.id = "mbt-copyright";
35329
- Object.assign(this.element.style, {
35330
- position: "absolute",
35331
- bottom: 0,
35332
- right: 0,
35333
- fontSize: ".8rem",
35334
- padding: "0 10px"
35335
- });
34935
+ return false;
34936
+ }
34937
+ function getBottomLeft(extent) {
34938
+ return [extent[0], extent[1]];
34939
+ }
34940
+ function getBottomRight(extent) {
34941
+ return [extent[2], extent[1]];
34942
+ }
34943
+ function getCenter(extent) {
34944
+ return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
34945
+ }
34946
+ function getHeight(extent) {
34947
+ return extent[3] - extent[1];
34948
+ }
34949
+ function getIntersection(extent1, extent2, opt_extent) {
34950
+ var intersection = opt_extent ? opt_extent : createEmpty();
34951
+ if (intersects(extent1, extent2)) {
34952
+ if (extent1[0] > extent2[0]) {
34953
+ intersection[0] = extent1[0];
34954
+ } else {
34955
+ intersection[0] = extent2[0];
34956
+ }
34957
+ if (extent1[1] > extent2[1]) {
34958
+ intersection[1] = extent1[1];
34959
+ } else {
34960
+ intersection[1] = extent2[1];
34961
+ }
34962
+ if (extent1[2] < extent2[2]) {
34963
+ intersection[2] = extent1[2];
34964
+ } else {
34965
+ intersection[2] = extent2[2];
34966
+ }
34967
+ if (extent1[3] < extent2[3]) {
34968
+ intersection[3] = extent1[3];
34969
+ } else {
34970
+ intersection[3] = extent2[3];
34971
+ }
34972
+ } else {
34973
+ createOrUpdateEmpty(intersection);
35336
34974
  }
35337
- };
35338
- var CopyrightMixin_default = CopyrightMixin;
35339
-
35340
- // src/ol/controls/CopyrightControl.js
35341
- var CopyrightControl = class extends CopyrightMixin_default(Control_default) {
35342
- constructor(options) {
35343
- super(options);
35344
- this.onPostRender = this.onPostRender.bind(this);
34975
+ return intersection;
34976
+ }
34977
+ function getTopLeft(extent) {
34978
+ return [extent[0], extent[3]];
34979
+ }
34980
+ function getTopRight(extent) {
34981
+ return [extent[2], extent[3]];
34982
+ }
34983
+ function getWidth(extent) {
34984
+ return extent[2] - extent[0];
34985
+ }
34986
+ function intersects(extent1, extent2) {
34987
+ return extent1[0] <= extent2[2] && extent1[2] >= extent2[0] && extent1[1] <= extent2[3] && extent1[3] >= extent2[1];
34988
+ }
34989
+ function returnOrUpdate(extent, opt_extent) {
34990
+ if (opt_extent) {
34991
+ opt_extent[0] = extent[0];
34992
+ opt_extent[1] = extent[1];
34993
+ opt_extent[2] = extent[2];
34994
+ opt_extent[3] = extent[3];
34995
+ return opt_extent;
34996
+ } else {
34997
+ return extent;
35345
34998
  }
35346
- getCopyrights() {
35347
- if (!this.frameState) {
35348
- return [];
34999
+ }
35000
+ function intersectsSegment(extent, start, end) {
35001
+ var intersects2 = false;
35002
+ var startRel = coordinateRelationship(extent, start);
35003
+ var endRel = coordinateRelationship(extent, end);
35004
+ if (startRel === Relationship_default.INTERSECTING || endRel === Relationship_default.INTERSECTING) {
35005
+ intersects2 = true;
35006
+ } else {
35007
+ var minX = extent[0];
35008
+ var minY = extent[1];
35009
+ var maxX = extent[2];
35010
+ var maxY = extent[3];
35011
+ var startX = start[0];
35012
+ var startY = start[1];
35013
+ var endX = end[0];
35014
+ var endY = end[1];
35015
+ var slope = (endY - startY) / (endX - startX);
35016
+ var x = void 0, y = void 0;
35017
+ if (!!(endRel & Relationship_default.ABOVE) && !(startRel & Relationship_default.ABOVE)) {
35018
+ x = endX - (endY - maxY) / slope;
35019
+ intersects2 = x >= minX && x <= maxX;
35349
35020
  }
35350
- let copyrights = [];
35351
- this.frameState.layerStatesArray.forEach((layerState) => {
35352
- const { layer } = layerState;
35353
- if (inView(layerState, this.frameState.viewState) && layer && layer.getSource && layer.getSource() && layer.getSource().getAttributions()) {
35354
- copyrights = copyrights.concat(layer.getSource().getAttributions()(this.frameState));
35355
- }
35356
- });
35357
- return removeDuplicate_default(copyrights);
35358
- }
35359
- activate() {
35360
- super.activate();
35361
- if (this.map) {
35362
- this.map.on("postrender", this.onPostRender);
35021
+ if (!intersects2 && !!(endRel & Relationship_default.RIGHT) && !(startRel & Relationship_default.RIGHT)) {
35022
+ y = endY - (endX - maxX) * slope;
35023
+ intersects2 = y >= minY && y <= maxY;
35363
35024
  }
35364
- }
35365
- deactivate() {
35366
- if (this.map) {
35367
- this.map.un("postrender", this.onPostRender);
35025
+ if (!intersects2 && !!(endRel & Relationship_default.BELOW) && !(startRel & Relationship_default.BELOW)) {
35026
+ x = endX - (endY - minY) / slope;
35027
+ intersects2 = x >= minX && x <= maxX;
35028
+ }
35029
+ if (!intersects2 && !!(endRel & Relationship_default.LEFT) && !(startRel & Relationship_default.LEFT)) {
35030
+ y = endY - (endX - minX) * slope;
35031
+ intersects2 = y >= minY && y <= maxY;
35368
35032
  }
35369
- super.deactivate();
35370
35033
  }
35371
- onPostRender(evt) {
35372
- if (this.map && this.element) {
35373
- this.frameState = evt.frameState;
35374
- this.render();
35034
+ return intersects2;
35035
+ }
35036
+ function applyTransform(extent, transformFn, opt_extent, opt_stops) {
35037
+ var coordinates2 = [];
35038
+ if (opt_stops > 1) {
35039
+ var width = extent[2] - extent[0];
35040
+ var height = extent[3] - extent[1];
35041
+ for (var i = 0; i < opt_stops; ++i) {
35042
+ coordinates2.push(extent[0] + width * i / opt_stops, extent[1], extent[2], extent[1] + height * i / opt_stops, extent[2] - width * i / opt_stops, extent[3], extent[0], extent[3] - height * i / opt_stops);
35375
35043
  }
35044
+ } else {
35045
+ coordinates2 = [
35046
+ extent[0],
35047
+ extent[1],
35048
+ extent[2],
35049
+ extent[1],
35050
+ extent[2],
35051
+ extent[3],
35052
+ extent[0],
35053
+ extent[3]
35054
+ ];
35376
35055
  }
35377
- };
35378
- var CopyrightControl_default = CopyrightControl;
35379
-
35380
- // node_modules/ol/CollectionEventType.js
35381
- var CollectionEventType_default = {
35382
- ADD: "add",
35383
- REMOVE: "remove"
35384
- };
35056
+ transformFn(coordinates2, coordinates2, 2);
35057
+ var xs = [];
35058
+ var ys = [];
35059
+ for (var i = 0, l = coordinates2.length; i < l; i += 2) {
35060
+ xs.push(coordinates2[i]);
35061
+ ys.push(coordinates2[i + 1]);
35062
+ }
35063
+ return _boundingExtentXYs(xs, ys, opt_extent);
35064
+ }
35065
+ function wrapX(extent, projection) {
35066
+ var projectionExtent = projection.getExtent();
35067
+ var center = getCenter(extent);
35068
+ if (projection.canWrapX() && (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) {
35069
+ var worldWidth = getWidth(projectionExtent);
35070
+ var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth);
35071
+ var offset = worldsAway * worldWidth;
35072
+ extent[0] -= offset;
35073
+ extent[2] -= offset;
35074
+ }
35075
+ return extent;
35076
+ }
35385
35077
 
35386
- // node_modules/ol/Collection.js
35387
- var __extends7 = function() {
35388
- var extendStatics = function(d, b) {
35389
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35390
- d2.__proto__ = b2;
35391
- } || function(d2, b2) {
35392
- for (var p in b2)
35393
- if (Object.prototype.hasOwnProperty.call(b2, p))
35394
- d2[p] = b2[p];
35395
- };
35396
- return extendStatics(d, b);
35397
- };
35398
- return function(d, b) {
35399
- if (typeof b !== "function" && b !== null)
35400
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35401
- extendStatics(d, b);
35402
- function __() {
35403
- this.constructor = d;
35404
- }
35405
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35406
- };
35407
- }();
35408
- var Property = {
35409
- LENGTH: "length"
35410
- };
35411
- var CollectionEvent = function(_super) {
35412
- __extends7(CollectionEvent2, _super);
35413
- function CollectionEvent2(type, opt_element, opt_index) {
35414
- var _this = _super.call(this, type) || this;
35415
- _this.element = opt_element;
35416
- _this.index = opt_index;
35417
- return _this;
35078
+ // node_modules/ol/coordinate.js
35079
+ function closestOnSegment(coordinate, segment) {
35080
+ var x0 = coordinate[0];
35081
+ var y0 = coordinate[1];
35082
+ var start = segment[0];
35083
+ var end = segment[1];
35084
+ var x1 = start[0];
35085
+ var y1 = start[1];
35086
+ var x2 = end[0];
35087
+ var y2 = end[1];
35088
+ var dx = x2 - x1;
35089
+ var dy = y2 - y1;
35090
+ var along = dx === 0 && dy === 0 ? 0 : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);
35091
+ var x, y;
35092
+ if (along <= 0) {
35093
+ x = x1;
35094
+ y = y1;
35095
+ } else if (along >= 1) {
35096
+ x = x2;
35097
+ y = y2;
35098
+ } else {
35099
+ x = x1 + along * dx;
35100
+ y = y1 + along * dy;
35418
35101
  }
35419
- return CollectionEvent2;
35420
- }(Event_default);
35421
- var Collection = function(_super) {
35422
- __extends7(Collection2, _super);
35423
- function Collection2(opt_array, opt_options) {
35424
- var _this = _super.call(this) || this;
35425
- _this.on;
35426
- _this.once;
35427
- _this.un;
35428
- var options = opt_options || {};
35429
- _this.unique_ = !!options.unique;
35430
- _this.array_ = opt_array ? opt_array : [];
35431
- if (_this.unique_) {
35432
- for (var i = 0, ii = _this.array_.length; i < ii; ++i) {
35433
- _this.assertUnique_(_this.array_[i], i);
35434
- }
35102
+ return [x, y];
35103
+ }
35104
+ function equals3(coordinate1, coordinate2) {
35105
+ var equals4 = true;
35106
+ for (var i = coordinate1.length - 1; i >= 0; --i) {
35107
+ if (coordinate1[i] != coordinate2[i]) {
35108
+ equals4 = false;
35109
+ break;
35435
35110
  }
35436
- _this.updateLength_();
35437
- return _this;
35438
35111
  }
35439
- Collection2.prototype.clear = function() {
35440
- while (this.getLength() > 0) {
35441
- this.pop();
35442
- }
35443
- };
35444
- Collection2.prototype.extend = function(arr) {
35445
- for (var i = 0, ii = arr.length; i < ii; ++i) {
35446
- this.push(arr[i]);
35447
- }
35448
- return this;
35449
- };
35450
- Collection2.prototype.forEach = function(f) {
35451
- var array = this.array_;
35452
- for (var i = 0, ii = array.length; i < ii; ++i) {
35453
- f(array[i], i, array);
35454
- }
35455
- };
35456
- Collection2.prototype.getArray = function() {
35457
- return this.array_;
35458
- };
35459
- Collection2.prototype.item = function(index) {
35460
- return this.array_[index];
35461
- };
35462
- Collection2.prototype.getLength = function() {
35463
- return this.get(Property.LENGTH);
35464
- };
35465
- Collection2.prototype.insertAt = function(index, elem) {
35466
- if (this.unique_) {
35467
- this.assertUnique_(elem);
35468
- }
35469
- this.array_.splice(index, 0, elem);
35470
- this.updateLength_();
35471
- this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD, elem, index));
35472
- };
35473
- Collection2.prototype.pop = function() {
35474
- return this.removeAt(this.getLength() - 1);
35475
- };
35476
- Collection2.prototype.push = function(elem) {
35477
- if (this.unique_) {
35478
- this.assertUnique_(elem);
35479
- }
35480
- var n = this.getLength();
35481
- this.insertAt(n, elem);
35482
- return this.getLength();
35483
- };
35484
- Collection2.prototype.remove = function(elem) {
35485
- var arr = this.array_;
35486
- for (var i = 0, ii = arr.length; i < ii; ++i) {
35487
- if (arr[i] === elem) {
35488
- return this.removeAt(i);
35489
- }
35490
- }
35491
- return void 0;
35492
- };
35493
- Collection2.prototype.removeAt = function(index) {
35494
- var prev = this.array_[index];
35495
- this.array_.splice(index, 1);
35496
- this.updateLength_();
35497
- this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE, prev, index));
35498
- return prev;
35499
- };
35500
- Collection2.prototype.setAt = function(index, elem) {
35501
- var n = this.getLength();
35502
- if (index < n) {
35503
- if (this.unique_) {
35504
- this.assertUnique_(elem, index);
35505
- }
35506
- var prev = this.array_[index];
35507
- this.array_[index] = elem;
35508
- this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE, prev, index));
35509
- this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD, elem, index));
35510
- } else {
35511
- for (var j = n; j < index; ++j) {
35512
- this.insertAt(j, void 0);
35513
- }
35514
- this.insertAt(index, elem);
35515
- }
35516
- };
35517
- Collection2.prototype.updateLength_ = function() {
35518
- this.set(Property.LENGTH, this.array_.length);
35519
- };
35520
- Collection2.prototype.assertUnique_ = function(elem, opt_except) {
35521
- for (var i = 0, ii = this.array_.length; i < ii; ++i) {
35522
- if (this.array_[i] === elem && i !== opt_except) {
35523
- throw new AssertionError_default(58);
35524
- }
35112
+ return equals4;
35113
+ }
35114
+ function squaredDistance2(coord1, coord2) {
35115
+ var dx = coord1[0] - coord2[0];
35116
+ var dy = coord1[1] - coord2[1];
35117
+ return dx * dx + dy * dy;
35118
+ }
35119
+ function distance(coord1, coord2) {
35120
+ return Math.sqrt(squaredDistance2(coord1, coord2));
35121
+ }
35122
+ function squaredDistanceToSegment(coordinate, segment) {
35123
+ return squaredDistance2(coordinate, closestOnSegment(coordinate, segment));
35124
+ }
35125
+ function wrapX2(coordinate, projection) {
35126
+ if (projection.canWrapX()) {
35127
+ var worldWidth = getWidth(projection.getExtent());
35128
+ var worldsAway = getWorldsAway(coordinate, projection, worldWidth);
35129
+ if (worldsAway) {
35130
+ coordinate[0] -= worldsAway * worldWidth;
35525
35131
  }
35526
- };
35527
- return Collection2;
35528
- }(Object_default);
35529
- var Collection_default = Collection;
35132
+ }
35133
+ return coordinate;
35134
+ }
35135
+ function getWorldsAway(coordinate, projection, opt_sourceExtentWidth) {
35136
+ var projectionExtent = projection.getExtent();
35137
+ var worldsAway = 0;
35138
+ if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) {
35139
+ var sourceExtentWidth = opt_sourceExtentWidth || getWidth(projectionExtent);
35140
+ worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / sourceExtentWidth);
35141
+ }
35142
+ return worldsAway;
35143
+ }
35530
35144
 
35531
- // node_modules/ol/Feature.js
35532
- var __extends8 = function() {
35533
- var extendStatics = function(d, b) {
35534
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35535
- d2.__proto__ = b2;
35536
- } || function(d2, b2) {
35537
- for (var p in b2)
35538
- if (Object.prototype.hasOwnProperty.call(b2, p))
35539
- d2[p] = b2[p];
35540
- };
35541
- return extendStatics(d, b);
35542
- };
35543
- return function(d, b) {
35544
- if (typeof b !== "function" && b !== null)
35545
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35546
- extendStatics(d, b);
35547
- function __() {
35548
- this.constructor = d;
35549
- }
35550
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35551
- };
35552
- }();
35553
- var Feature = function(_super) {
35554
- __extends8(Feature2, _super);
35555
- function Feature2(opt_geometryOrProperties) {
35556
- var _this = _super.call(this) || this;
35557
- _this.on;
35558
- _this.once;
35559
- _this.un;
35560
- _this.id_ = void 0;
35561
- _this.geometryName_ = "geometry";
35562
- _this.style_ = null;
35563
- _this.styleFunction_ = void 0;
35564
- _this.geometryChangeKey_ = null;
35565
- _this.addChangeListener(_this.geometryName_, _this.handleGeometryChanged_);
35566
- if (opt_geometryOrProperties) {
35567
- if (typeof opt_geometryOrProperties.getSimplifiedGeometry === "function") {
35568
- var geometry = opt_geometryOrProperties;
35569
- _this.setGeometry(geometry);
35570
- } else {
35571
- var properties = opt_geometryOrProperties;
35572
- _this.setProperties(properties);
35573
- }
35145
+ // node_modules/ol/proj.js
35146
+ var showCoordinateWarning = true;
35147
+ function disableCoordinateWarning(opt_disable) {
35148
+ var hide = opt_disable === void 0 ? true : opt_disable;
35149
+ showCoordinateWarning = !hide;
35150
+ }
35151
+ function cloneTransform(input, opt_output, opt_dimension) {
35152
+ var output;
35153
+ if (opt_output !== void 0) {
35154
+ for (var i = 0, ii = input.length; i < ii; ++i) {
35155
+ opt_output[i] = input[i];
35574
35156
  }
35575
- return _this;
35157
+ output = opt_output;
35158
+ } else {
35159
+ output = input.slice();
35576
35160
  }
35577
- Feature2.prototype.clone = function() {
35578
- var clone3 = new Feature2(this.hasProperties() ? this.getProperties() : null);
35579
- clone3.setGeometryName(this.getGeometryName());
35580
- var geometry = this.getGeometry();
35581
- if (geometry) {
35582
- clone3.setGeometry(geometry.clone());
35161
+ return output;
35162
+ }
35163
+ function identityTransform(input, opt_output, opt_dimension) {
35164
+ if (opt_output !== void 0 && input !== opt_output) {
35165
+ for (var i = 0, ii = input.length; i < ii; ++i) {
35166
+ opt_output[i] = input[i];
35583
35167
  }
35584
- var style = this.getStyle();
35585
- if (style) {
35586
- clone3.setStyle(style);
35168
+ input = opt_output;
35169
+ }
35170
+ return input;
35171
+ }
35172
+ function addProjection(projection) {
35173
+ add(projection.getCode(), projection);
35174
+ add2(projection, projection, cloneTransform);
35175
+ }
35176
+ function addProjections(projections) {
35177
+ projections.forEach(addProjection);
35178
+ }
35179
+ function get3(projectionLike) {
35180
+ return typeof projectionLike === "string" ? get(projectionLike) : projectionLike || null;
35181
+ }
35182
+ function addEquivalentProjections(projections) {
35183
+ addProjections(projections);
35184
+ projections.forEach(function(source) {
35185
+ projections.forEach(function(destination) {
35186
+ if (source !== destination) {
35187
+ add2(source, destination, cloneTransform);
35188
+ }
35189
+ });
35190
+ });
35191
+ }
35192
+ function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {
35193
+ projections1.forEach(function(projection1) {
35194
+ projections2.forEach(function(projection2) {
35195
+ add2(projection1, projection2, forwardTransform);
35196
+ add2(projection2, projection1, inverseTransform);
35197
+ });
35198
+ });
35199
+ }
35200
+ function fromLonLat(coordinate, opt_projection) {
35201
+ disableCoordinateWarning();
35202
+ return transform(coordinate, "EPSG:4326", opt_projection !== void 0 ? opt_projection : "EPSG:3857");
35203
+ }
35204
+ function toLonLat(coordinate, opt_projection) {
35205
+ var lonLat = transform(coordinate, opt_projection !== void 0 ? opt_projection : "EPSG:3857", "EPSG:4326");
35206
+ var lon = lonLat[0];
35207
+ if (lon < -180 || lon > 180) {
35208
+ lonLat[0] = modulo(lon + 180, 360) - 180;
35209
+ }
35210
+ return lonLat;
35211
+ }
35212
+ function equivalent(projection1, projection2) {
35213
+ if (projection1 === projection2) {
35214
+ return true;
35215
+ }
35216
+ var equalUnits = projection1.getUnits() === projection2.getUnits();
35217
+ if (projection1.getCode() === projection2.getCode()) {
35218
+ return equalUnits;
35219
+ } else {
35220
+ var transformFunc = getTransformFromProjections(projection1, projection2);
35221
+ return transformFunc === cloneTransform && equalUnits;
35222
+ }
35223
+ }
35224
+ function getTransformFromProjections(sourceProjection, destinationProjection) {
35225
+ var sourceCode = sourceProjection.getCode();
35226
+ var destinationCode = destinationProjection.getCode();
35227
+ var transformFunc = get2(sourceCode, destinationCode);
35228
+ if (!transformFunc) {
35229
+ transformFunc = identityTransform;
35230
+ }
35231
+ return transformFunc;
35232
+ }
35233
+ function getTransform(source, destination) {
35234
+ var sourceProjection = get3(source);
35235
+ var destinationProjection = get3(destination);
35236
+ return getTransformFromProjections(sourceProjection, destinationProjection);
35237
+ }
35238
+ function transform(coordinate, source, destination) {
35239
+ var transformFunc = getTransform(source, destination);
35240
+ return transformFunc(coordinate, void 0, coordinate.length);
35241
+ }
35242
+ function transformExtent(extent, source, destination, opt_stops) {
35243
+ var transformFunc = getTransform(source, destination);
35244
+ return applyTransform(extent, transformFunc, void 0, opt_stops);
35245
+ }
35246
+ var userProjection = null;
35247
+ function getUserProjection() {
35248
+ return userProjection;
35249
+ }
35250
+ function toUserCoordinate(coordinate, sourceProjection) {
35251
+ if (!userProjection) {
35252
+ return coordinate;
35253
+ }
35254
+ return transform(coordinate, sourceProjection, userProjection);
35255
+ }
35256
+ function fromUserCoordinate(coordinate, destProjection) {
35257
+ if (!userProjection) {
35258
+ if (showCoordinateWarning && !equals3(coordinate, [0, 0]) && coordinate[0] >= -180 && coordinate[0] <= 180 && coordinate[1] >= -90 && coordinate[1] <= 90) {
35259
+ showCoordinateWarning = false;
35260
+ console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.");
35587
35261
  }
35588
- return clone3;
35589
- };
35590
- Feature2.prototype.getGeometry = function() {
35591
- return this.get(this.geometryName_);
35592
- };
35593
- Feature2.prototype.getId = function() {
35594
- return this.id_;
35595
- };
35596
- Feature2.prototype.getGeometryName = function() {
35597
- return this.geometryName_;
35598
- };
35599
- Feature2.prototype.getStyle = function() {
35600
- return this.style_;
35601
- };
35602
- Feature2.prototype.getStyleFunction = function() {
35603
- return this.styleFunction_;
35604
- };
35605
- Feature2.prototype.handleGeometryChange_ = function() {
35606
- this.changed();
35607
- };
35608
- Feature2.prototype.handleGeometryChanged_ = function() {
35609
- if (this.geometryChangeKey_) {
35610
- unlistenByKey(this.geometryChangeKey_);
35611
- this.geometryChangeKey_ = null;
35262
+ return coordinate;
35263
+ }
35264
+ return transform(coordinate, userProjection, destProjection);
35265
+ }
35266
+ function toUserExtent(extent, sourceProjection) {
35267
+ if (!userProjection) {
35268
+ return extent;
35269
+ }
35270
+ return transformExtent(extent, sourceProjection, userProjection);
35271
+ }
35272
+ function fromUserExtent(extent, destProjection) {
35273
+ if (!userProjection) {
35274
+ return extent;
35275
+ }
35276
+ return transformExtent(extent, userProjection, destProjection);
35277
+ }
35278
+ function toUserResolution(resolution, sourceProjection) {
35279
+ if (!userProjection) {
35280
+ return resolution;
35281
+ }
35282
+ var sourceUnits = get3(sourceProjection).getUnits();
35283
+ var userUnits = userProjection.getUnits();
35284
+ return sourceUnits && userUnits ? resolution * METERS_PER_UNIT[sourceUnits] / METERS_PER_UNIT[userUnits] : resolution;
35285
+ }
35286
+ function addCommon() {
35287
+ addEquivalentProjections(PROJECTIONS);
35288
+ addEquivalentProjections(PROJECTIONS2);
35289
+ addEquivalentTransforms(PROJECTIONS2, PROJECTIONS, fromEPSG4326, toEPSG4326);
35290
+ }
35291
+ addCommon();
35292
+
35293
+ // src/common/utils/getMaplibreRender.js
35294
+ function getMaplibreRender(maplibreLayer) {
35295
+ return (frameState) => {
35296
+ const { map, mbMap, olLayer } = maplibreLayer;
35297
+ if (!map || !mbMap) {
35298
+ return null;
35612
35299
  }
35613
- var geometry = this.getGeometry();
35614
- if (geometry) {
35615
- this.geometryChangeKey_ = listen(geometry, EventType_default.CHANGE, this.handleGeometryChange_, this);
35300
+ const canvas2 = mbMap.getCanvas();
35301
+ const { viewState } = frameState;
35302
+ const opacity = olLayer.getOpacity();
35303
+ canvas2.style.opacity = opacity;
35304
+ mbMap.jumpTo({
35305
+ center: toLonLat(viewState.center),
35306
+ zoom: viewState.zoom - 1,
35307
+ bearing: toDegrees(-viewState.rotation),
35308
+ animate: false
35309
+ });
35310
+ if (!canvas2.isConnected) {
35311
+ map.render();
35312
+ } else if (canvas2.width !== frameState.size[0] || canvas2.height !== frameState.size[1]) {
35313
+ mbMap.resize();
35616
35314
  }
35617
- this.changed();
35618
- };
35619
- Feature2.prototype.setGeometry = function(geometry) {
35620
- this.set(this.geometryName_, geometry);
35621
- };
35622
- Feature2.prototype.setStyle = function(opt_style) {
35623
- this.style_ = opt_style;
35624
- this.styleFunction_ = !opt_style ? void 0 : createStyleFunction(opt_style);
35625
- this.changed();
35626
- };
35627
- Feature2.prototype.setId = function(id) {
35628
- this.id_ = id;
35629
- this.changed();
35630
- };
35631
- Feature2.prototype.setGeometryName = function(name) {
35632
- this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);
35633
- this.geometryName_ = name;
35634
- this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);
35635
- this.handleGeometryChanged_();
35315
+ mbMap.redraw();
35316
+ return mbMap.getContainer();
35636
35317
  };
35637
- return Feature2;
35638
- }(Object_default);
35639
- function createStyleFunction(obj) {
35640
- if (typeof obj === "function") {
35641
- return obj;
35642
- } else {
35643
- var styles_1;
35644
- if (Array.isArray(obj)) {
35645
- styles_1 = obj;
35646
- } else {
35647
- assert(typeof obj.getZIndex === "function", 41);
35648
- var style = obj;
35649
- styles_1 = [style];
35318
+ }
35319
+
35320
+ // src/common/utils/getMapboxRender.js
35321
+ function getMapboxRender(mapoxLayer) {
35322
+ return (frameState) => {
35323
+ const { map, mbMap, renderState, olLayer } = mapoxLayer;
35324
+ if (!map || !mbMap) {
35325
+ return null;
35650
35326
  }
35651
- return function() {
35652
- return styles_1;
35653
- };
35654
- }
35327
+ let changed = false;
35328
+ const canvas2 = mbMap.getCanvas();
35329
+ const { viewState } = frameState;
35330
+ const visible = olLayer.getVisible();
35331
+ if (renderState.visible !== visible) {
35332
+ canvas2.style.display = visible ? "block" : "none";
35333
+ renderState.visible = visible;
35334
+ canvas2.style.position = "absolute";
35335
+ }
35336
+ const opacity = olLayer.getOpacity();
35337
+ if (renderState.opacity !== opacity) {
35338
+ canvas2.style.opacity = opacity;
35339
+ renderState.opacity = opacity;
35340
+ }
35341
+ const { rotation } = viewState;
35342
+ if (renderState.rotation !== rotation) {
35343
+ mbMap.rotateTo(-(rotation || 0) * 180 / Math.PI, {
35344
+ animate: false
35345
+ });
35346
+ changed = true;
35347
+ renderState.rotation = rotation;
35348
+ }
35349
+ if (renderState.zoom !== viewState.zoom || renderState.center[0] !== viewState.center[0] || renderState.center[1] !== viewState.center[1]) {
35350
+ mbMap.jumpTo({
35351
+ center: toLonLat(viewState.center),
35352
+ zoom: viewState.zoom - 1,
35353
+ animate: false
35354
+ });
35355
+ changed = true;
35356
+ renderState.zoom = viewState.zoom;
35357
+ renderState.center = viewState.center;
35358
+ }
35359
+ const size = map.getSize();
35360
+ if (renderState.size[0] !== size[0] || renderState.size[1] !== size[1]) {
35361
+ changed = true;
35362
+ renderState.size = size;
35363
+ }
35364
+ if (mbMap && mbMap.style && mbMap.isStyleLoaded() && changed) {
35365
+ try {
35366
+ if (mbMap._frame) {
35367
+ mbMap._frame.cancel();
35368
+ mbMap._frame = null;
35369
+ }
35370
+ mbMap._render();
35371
+ } catch (err) {
35372
+ console.warn(err);
35373
+ }
35374
+ }
35375
+ return mbMap.getContainer();
35376
+ };
35655
35377
  }
35656
- var Feature_default = Feature;
35657
35378
 
35658
- // node_modules/ol/geom/GeometryLayout.js
35659
- var GeometryLayout_default = {
35660
- XY: "XY",
35661
- XYZ: "XYZ",
35662
- XYM: "XYM",
35663
- XYZM: "XYZM"
35379
+ // src/common/utils/trackerConfig.js
35380
+ var trackerConfig_exports = {};
35381
+ __export(trackerConfig_exports, {
35382
+ bgColors: () => bgColors,
35383
+ getBgColor: () => getBgColor,
35384
+ getDelayColor: () => getDelayColor,
35385
+ getDelayText: () => getDelayText,
35386
+ getRadius: () => getRadius,
35387
+ getTextColor: () => getTextColor,
35388
+ getTextSize: () => getTextSize,
35389
+ getTypeIndex: () => getTypeIndex,
35390
+ textColors: () => textColors,
35391
+ types: () => types
35392
+ });
35393
+ var trackerRadiusMapping = {
35394
+ 0: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35395
+ 1: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35396
+ 2: [0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15],
35397
+ 3: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35398
+ 4: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35399
+ 5: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35400
+ 6: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35401
+ 7: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35402
+ 8: [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
35403
+ 9: [0, 0, 0, 0, 0, 2, 2, 3, 7, 7, 7, 12, 15, 15, 15, 15, 15]
35664
35404
  };
35665
-
35666
- // node_modules/ol/proj/Units.js
35667
- var Units = {
35668
- RADIANS: "radians",
35669
- DEGREES: "degrees",
35670
- FEET: "ft",
35671
- METERS: "m",
35672
- PIXELS: "pixels",
35673
- TILE_PIXELS: "tile-pixels",
35674
- USFEET: "us-ft"
35405
+ var types = [
35406
+ /^Tram/i,
35407
+ /^Subway( \/ Metro \/ S-Bahn)?/i,
35408
+ /^Train/i,
35409
+ /^Bus/i,
35410
+ /^Ferry/i,
35411
+ /^Cable ?Car/i,
35412
+ /^Gondola/i,
35413
+ /^Funicular/i,
35414
+ /^(Long distance bus|coach)/i,
35415
+ /^Rail/i
35416
+ ];
35417
+ var bgColors = [
35418
+ "#ffb400",
35419
+ "#ff5400",
35420
+ "#ff8080",
35421
+ "#ea0000",
35422
+ "#3000ff",
35423
+ "#ffb400",
35424
+ "#41a27b",
35425
+ "#00d237",
35426
+ "#b5b5b5",
35427
+ "#ff8080"
35428
+ ];
35429
+ var textColors = [
35430
+ "#000000",
35431
+ "#ffffff",
35432
+ "#000000",
35433
+ "#ffffff",
35434
+ "#ffffff",
35435
+ "#000000",
35436
+ "#ffffff",
35437
+ "#000000",
35438
+ "#000000",
35439
+ "#000000"
35440
+ ];
35441
+ var getTypeIndex = (type) => {
35442
+ if (typeof type === "string") {
35443
+ return types.findIndex((t) => t.test(type));
35444
+ }
35445
+ return type;
35675
35446
  };
35676
- var unitByCode = {
35677
- "9001": Units.METERS,
35678
- "9002": Units.FEET,
35679
- "9003": Units.USFEET,
35680
- "9101": Units.RADIANS,
35681
- "9102": Units.DEGREES
35447
+ var getRadius = (type, zoom) => {
35448
+ try {
35449
+ const typeIdx = getTypeIndex(type || 0);
35450
+ return trackerRadiusMapping[typeIdx][zoom];
35451
+ } catch (e) {
35452
+ return 1;
35453
+ }
35682
35454
  };
35683
- var METERS_PER_UNIT = {};
35684
- METERS_PER_UNIT[Units.RADIANS] = 6370997 / (2 * Math.PI);
35685
- METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;
35686
- METERS_PER_UNIT[Units.FEET] = 0.3048;
35687
- METERS_PER_UNIT[Units.METERS] = 1;
35688
- METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
35689
- var Units_default = Units;
35690
-
35691
- // node_modules/ol/extent/Relationship.js
35692
- var Relationship_default = {
35693
- UNKNOWN: 0,
35694
- INTERSECTING: 1,
35695
- ABOVE: 2,
35696
- RIGHT: 4,
35697
- BELOW: 8,
35698
- LEFT: 16
35455
+ var getBgColor = (type = 0) => {
35456
+ try {
35457
+ const typeIdx = getTypeIndex(type);
35458
+ return bgColors[typeIdx];
35459
+ } catch (e) {
35460
+ return 1;
35461
+ }
35699
35462
  };
35700
-
35701
- // node_modules/ol/extent.js
35702
- function boundingExtent(coordinates2) {
35703
- var extent = createEmpty();
35704
- for (var i = 0, ii = coordinates2.length; i < ii; ++i) {
35705
- extendCoordinate(extent, coordinates2[i]);
35463
+ var getTextColor = (type = 0) => {
35464
+ try {
35465
+ const typeIdx = getTypeIndex(type);
35466
+ return textColors[typeIdx];
35467
+ } catch (e) {
35468
+ return 1;
35706
35469
  }
35707
- return extent;
35708
- }
35709
- function _boundingExtentXYs(xs, ys, opt_extent) {
35710
- var minX = Math.min.apply(null, xs);
35711
- var minY = Math.min.apply(null, ys);
35712
- var maxX = Math.max.apply(null, xs);
35713
- var maxY = Math.max.apply(null, ys);
35714
- return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
35715
- }
35716
- function buffer(extent, value, opt_extent) {
35717
- if (opt_extent) {
35718
- opt_extent[0] = extent[0] - value;
35719
- opt_extent[1] = extent[1] - value;
35720
- opt_extent[2] = extent[2] + value;
35721
- opt_extent[3] = extent[3] + value;
35722
- return opt_extent;
35723
- } else {
35724
- return [
35725
- extent[0] - value,
35726
- extent[1] - value,
35727
- extent[2] + value,
35728
- extent[3] + value
35729
- ];
35470
+ };
35471
+ var getTextSize = (ctx, markerSize, text, fontSize) => {
35472
+ ctx.font = `bold ${fontSize}px Arial`;
35473
+ let newText = ctx.measureText(text);
35474
+ const maxiter = 25;
35475
+ let i = 0;
35476
+ while (newText.width > markerSize - 6 && i < maxiter) {
35477
+ fontSize -= 0.5;
35478
+ ctx.font = `bold ${fontSize}px arial, sans-serif`;
35479
+ newText = ctx.measureText(text);
35480
+ i += 1;
35730
35481
  }
35731
- }
35732
- function clone(extent, opt_extent) {
35733
- if (opt_extent) {
35734
- opt_extent[0] = extent[0];
35735
- opt_extent[1] = extent[1];
35736
- opt_extent[2] = extent[2];
35737
- opt_extent[3] = extent[3];
35738
- return opt_extent;
35739
- } else {
35740
- return extent.slice();
35482
+ return fontSize;
35483
+ };
35484
+ var getDelayColor = (delayInMs, cancelled, isDelayText) => {
35485
+ if (cancelled) {
35486
+ return isDelayText ? "#ff0000" : "#a0a0a0";
35741
35487
  }
35742
- }
35743
- function closestSquaredDistanceXY(extent, x, y) {
35744
- var dx, dy;
35745
- if (x < extent[0]) {
35746
- dx = extent[0] - x;
35747
- } else if (extent[2] < x) {
35748
- dx = x - extent[2];
35749
- } else {
35750
- dx = 0;
35488
+ if (delayInMs >= 36e5) {
35489
+ return "#ed004c";
35751
35490
  }
35752
- if (y < extent[1]) {
35753
- dy = extent[1] - y;
35754
- } else if (extent[3] < y) {
35755
- dy = y - extent[3];
35756
- } else {
35757
- dy = 0;
35491
+ if (delayInMs >= 5e5) {
35492
+ return "#e80000";
35493
+ }
35494
+ if (delayInMs >= 3e5) {
35495
+ return "#ff4a00";
35758
35496
  }
35759
- return dx * dx + dy * dy;
35760
- }
35761
- function containsCoordinate(extent, coordinate) {
35762
- return containsXY(extent, coordinate[0], coordinate[1]);
35763
- }
35764
- function containsExtent(extent1, extent2) {
35765
- return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
35766
- }
35767
- function containsXY(extent, x, y) {
35768
- return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
35769
- }
35770
- function coordinateRelationship(extent, coordinate) {
35771
- var minX = extent[0];
35772
- var minY = extent[1];
35773
- var maxX = extent[2];
35774
- var maxY = extent[3];
35775
- var x = coordinate[0];
35776
- var y = coordinate[1];
35777
- var relationship = Relationship_default.UNKNOWN;
35778
- if (x < minX) {
35779
- relationship = relationship | Relationship_default.LEFT;
35780
- } else if (x > maxX) {
35781
- relationship = relationship | Relationship_default.RIGHT;
35497
+ if (delayInMs >= 18e4) {
35498
+ return "#f7bf00";
35782
35499
  }
35783
- if (y < minY) {
35784
- relationship = relationship | Relationship_default.BELOW;
35785
- } else if (y > maxY) {
35786
- relationship = relationship | Relationship_default.ABOVE;
35500
+ if (delayInMs === null) {
35501
+ return "#a0a0a0";
35787
35502
  }
35788
- if (relationship === Relationship_default.UNKNOWN) {
35789
- relationship = Relationship_default.INTERSECTING;
35503
+ return "#00a00c";
35504
+ };
35505
+ var getDelayText = (delayInMs, cancelled) => {
35506
+ if (cancelled) {
35507
+ return String.fromCodePoint(215);
35790
35508
  }
35791
- return relationship;
35792
- }
35793
- function createEmpty() {
35794
- return [Infinity, Infinity, -Infinity, -Infinity];
35795
- }
35796
- function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {
35797
- if (opt_extent) {
35798
- opt_extent[0] = minX;
35799
- opt_extent[1] = minY;
35800
- opt_extent[2] = maxX;
35801
- opt_extent[3] = maxY;
35802
- return opt_extent;
35803
- } else {
35804
- return [minX, minY, maxX, maxY];
35509
+ if (delayInMs > 36e5) {
35510
+ const rounded = Math.round(delayInMs / 36e5);
35511
+ return `+${rounded}h`;
35805
35512
  }
35806
- }
35807
- function createOrUpdateEmpty(opt_extent) {
35808
- return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);
35809
- }
35810
- function createOrUpdateFromCoordinate(coordinate, opt_extent) {
35811
- var x = coordinate[0];
35812
- var y = coordinate[1];
35813
- return createOrUpdate(x, y, x, y, opt_extent);
35814
- }
35815
- function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) {
35816
- var extent = createOrUpdateEmpty(opt_extent);
35817
- return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);
35818
- }
35819
- function equals2(extent1, extent2) {
35820
- return extent1[0] == extent2[0] && extent1[2] == extent2[2] && extent1[1] == extent2[1] && extent1[3] == extent2[3];
35821
- }
35822
- function extend2(extent1, extent2) {
35823
- if (extent2[0] < extent1[0]) {
35824
- extent1[0] = extent2[0];
35513
+ if (delayInMs > 59e3) {
35514
+ const rounded = Math.round(delayInMs / 6e4);
35515
+ return `+${rounded}m`;
35825
35516
  }
35826
- if (extent2[2] > extent1[2]) {
35827
- extent1[2] = extent2[2];
35517
+ if (delayInMs > 0) {
35518
+ return `+${delayInMs}s`;
35828
35519
  }
35829
- if (extent2[1] < extent1[1]) {
35830
- extent1[1] = extent2[1];
35520
+ return "";
35521
+ };
35522
+
35523
+ // src/common/utils/createCanvas.js
35524
+ var createCanvas = (width, height) => {
35525
+ let canvas2 = null;
35526
+ if (typeof window === "undefined") {
35527
+ return null;
35831
35528
  }
35832
- if (extent2[3] > extent1[3]) {
35833
- extent1[3] = extent2[3];
35529
+ if (document?.createElement) {
35530
+ canvas2 = document.createElement("canvas");
35531
+ canvas2.width = width;
35532
+ canvas2.height = height;
35533
+ } else if (OffscreenCanvas) {
35534
+ canvas2 = new OffscreenCanvas(width, height);
35535
+ } else {
35536
+ console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported");
35834
35537
  }
35835
- return extent1;
35836
- }
35837
- function extendCoordinate(extent, coordinate) {
35838
- if (coordinate[0] < extent[0]) {
35839
- extent[0] = coordinate[0];
35538
+ return canvas2;
35539
+ };
35540
+ var createCanvas_default = createCanvas;
35541
+
35542
+ // src/common/styles/realtimeDefaultStyle.js
35543
+ var cacheDelayBg = {};
35544
+ var getDelayBgCanvas = (origin, radius, color) => {
35545
+ const key = `${origin}, ${radius}, ${color}`;
35546
+ if (!cacheDelayBg[key]) {
35547
+ const canvas2 = createCanvas_default(origin * 2, origin * 2);
35548
+ if (canvas2) {
35549
+ const ctx = canvas2.getContext("2d");
35550
+ ctx.beginPath();
35551
+ ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
35552
+ ctx.fillStyle = color;
35553
+ ctx.filter = "blur(1px)";
35554
+ ctx.fill();
35555
+ cacheDelayBg[key] = canvas2;
35556
+ }
35840
35557
  }
35841
- if (coordinate[0] > extent[2]) {
35842
- extent[2] = coordinate[0];
35558
+ return cacheDelayBg[key];
35559
+ };
35560
+ var cacheDelayText = {};
35561
+ var getDelayTextCanvas = (width, text, fontSize, font, delayColor, delayOutlineColor = "#000", pixelRatio = 1) => {
35562
+ const key = `${width}, ${text}, ${font}, ${delayColor}, ${delayOutlineColor}, ${pixelRatio}`;
35563
+ if (!cacheDelayText[key]) {
35564
+ const canvas2 = createCanvas_default(width, fontSize + 8 * pixelRatio);
35565
+ if (canvas2) {
35566
+ const ctx = canvas2.getContext("2d");
35567
+ ctx.textAlign = "left";
35568
+ ctx.textBaseline = "middle";
35569
+ ctx.font = font;
35570
+ ctx.fillStyle = delayColor;
35571
+ ctx.strokeStyle = delayOutlineColor;
35572
+ ctx.lineWidth = 1.5 * pixelRatio;
35573
+ const delayText = text;
35574
+ ctx.strokeText(delayText, 0, fontSize);
35575
+ ctx.fillText(delayText, 0, fontSize);
35576
+ cacheDelayText[key] = canvas2;
35577
+ }
35843
35578
  }
35844
- if (coordinate[1] < extent[1]) {
35845
- extent[1] = coordinate[1];
35579
+ return cacheDelayText[key];
35580
+ };
35581
+ var cacheCircle = {};
35582
+ var getCircleCanvas = (origin, radius, color, hasStroke, hasDash, pixelRatio) => {
35583
+ const key = `${origin}, ${radius}, ${color}, ${hasStroke}, ${hasDash}, ${pixelRatio}`;
35584
+ if (!cacheCircle[key]) {
35585
+ const canvas2 = createCanvas_default(origin * 2, origin * 2);
35586
+ if (canvas2) {
35587
+ const ctx = canvas2.getContext("2d");
35588
+ ctx.fillStyle = color;
35589
+ if (hasStroke) {
35590
+ ctx.lineWidth = 1 * pixelRatio;
35591
+ ctx.strokeStyle = "#000000";
35592
+ }
35593
+ ctx.beginPath();
35594
+ ctx.arc(origin, origin, radius, 0, 2 * Math.PI, false);
35595
+ ctx.fill();
35596
+ if (hasDash) {
35597
+ ctx.setLineDash([5, 3]);
35598
+ }
35599
+ if (hasStroke) {
35600
+ ctx.stroke();
35601
+ }
35602
+ cacheCircle[key] = canvas2;
35603
+ }
35846
35604
  }
35847
- if (coordinate[1] > extent[3]) {
35848
- extent[3] = coordinate[1];
35605
+ return cacheCircle[key];
35606
+ };
35607
+ var cacheText = {};
35608
+ var getTextCanvas = (text, origin, textSize, fillColor, strokeColor, hasStroke, pixelRatio) => {
35609
+ const key = `${text}, ${origin}, ${textSize}, ${fillColor},${strokeColor}, ${hasStroke}, ${pixelRatio}`;
35610
+ if (!cacheText[key]) {
35611
+ const canvas2 = createCanvas_default(origin * 2, origin * 2);
35612
+ if (canvas2) {
35613
+ const ctx = canvas2.getContext("2d");
35614
+ if (hasStroke) {
35615
+ ctx.save();
35616
+ ctx.textBaseline = "middle";
35617
+ ctx.textAlign = "center";
35618
+ ctx.font = `bold ${textSize + 2}px Arial`;
35619
+ ctx.strokeStyle = strokeColor;
35620
+ ctx.strokeText(text, origin, origin);
35621
+ ctx.restore();
35622
+ }
35623
+ ctx.textBaseline = "middle";
35624
+ ctx.textAlign = "center";
35625
+ ctx.fillStyle = fillColor;
35626
+ ctx.font = `bold ${textSize}px Arial`;
35627
+ ctx.strokeStyle = strokeColor;
35628
+ ctx.strokeText(text, origin, origin);
35629
+ ctx.fillText(text, origin, origin);
35630
+ cacheText[key] = canvas2;
35631
+ }
35849
35632
  }
35850
- }
35851
- function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) {
35852
- for (; offset < end; offset += stride) {
35853
- extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
35633
+ return cacheText[key];
35634
+ };
35635
+ var cache2 = {};
35636
+ var realtimeDefaultStyle = (trajectory, viewState, options) => {
35637
+ const {
35638
+ hoverVehicleId,
35639
+ selectedVehicleId,
35640
+ useDelayStyle,
35641
+ delayOutlineColor = "#000",
35642
+ delayDisplay = 3e5,
35643
+ getRadius: getRadius2,
35644
+ getBgColor: getBgColor2,
35645
+ getDelayColor: getDelayColor2,
35646
+ getDelayText: getDelayText2,
35647
+ getTextColor: getTextColor2,
35648
+ getTextSize: getTextSize2
35649
+ } = options;
35650
+ const { zoom, pixelRatio } = viewState;
35651
+ let { type, cancelled } = trajectory.properties;
35652
+ const {
35653
+ train_id: id,
35654
+ line,
35655
+ delay,
35656
+ state,
35657
+ operator_provides_realtime_journey: operatorProvidesRealtime
35658
+ } = trajectory.properties;
35659
+ let { name, text_color: textColor, color } = line || {};
35660
+ cancelled = cancelled === true || state === "JOURNEY_CANCELLED";
35661
+ if (!type) {
35662
+ type = "Rail";
35854
35663
  }
35855
- return extent;
35856
- }
35857
- function extendXY(extent, x, y) {
35858
- extent[0] = Math.min(extent[0], x);
35859
- extent[1] = Math.min(extent[1], y);
35860
- extent[2] = Math.max(extent[2], x);
35861
- extent[3] = Math.max(extent[3], y);
35862
- }
35863
- function forEachCorner(extent, callback) {
35864
- var val;
35865
- val = callback(getBottomLeft(extent));
35866
- if (val) {
35867
- return val;
35664
+ if (!name) {
35665
+ name = "I";
35666
+ }
35667
+ if (!textColor) {
35668
+ textColor = "#000000";
35669
+ }
35670
+ if (color && color[0] !== "#") {
35671
+ color = `#${color}`;
35868
35672
  }
35869
- val = callback(getBottomRight(extent));
35870
- if (val) {
35871
- return val;
35673
+ if (textColor[0] !== "#") {
35674
+ textColor = `#${textColor}`;
35872
35675
  }
35873
- val = callback(getTopRight(extent));
35874
- if (val) {
35875
- return val;
35676
+ const z = Math.min(Math.floor(zoom || 1), 16);
35677
+ const hover = hoverVehicleId && hoverVehicleId === id;
35678
+ const selected = selectedVehicleId && selectedVehicleId === id;
35679
+ let radius = getRadius2(type, z) * pixelRatio;
35680
+ const isDisplayStrokeAndDelay = radius >= 7 * pixelRatio;
35681
+ if (hover || selected) {
35682
+ radius = isDisplayStrokeAndDelay ? radius + 5 * pixelRatio : 14 * pixelRatio;
35876
35683
  }
35877
- val = callback(getTopLeft(extent));
35878
- if (val) {
35879
- return val;
35684
+ const mustDrawText = radius > 10 * pixelRatio;
35685
+ let key = `${radius}${hover}${selected}${cancelled}${delay}`;
35686
+ if (useDelayStyle) {
35687
+ key += `${operatorProvidesRealtime}`;
35688
+ } else {
35689
+ key += `${type}${color}`;
35880
35690
  }
35881
- return false;
35882
- }
35883
- function getBottomLeft(extent) {
35884
- return [extent[0], extent[1]];
35885
- }
35886
- function getBottomRight(extent) {
35887
- return [extent[2], extent[1]];
35888
- }
35889
- function getCenter(extent) {
35890
- return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
35891
- }
35892
- function getHeight(extent) {
35893
- return extent[3] - extent[1];
35894
- }
35895
- function getIntersection(extent1, extent2, opt_extent) {
35896
- var intersection = opt_extent ? opt_extent : createEmpty();
35897
- if (intersects(extent1, extent2)) {
35898
- if (extent1[0] > extent2[0]) {
35899
- intersection[0] = extent1[0];
35900
- } else {
35901
- intersection[0] = extent2[0];
35902
- }
35903
- if (extent1[1] > extent2[1]) {
35904
- intersection[1] = extent1[1];
35905
- } else {
35906
- intersection[1] = extent2[1];
35907
- }
35908
- if (extent1[2] < extent2[2]) {
35909
- intersection[2] = extent1[2];
35910
- } else {
35911
- intersection[2] = extent2[2];
35691
+ if (mustDrawText) {
35692
+ key += `${name}${textColor}`;
35693
+ }
35694
+ if (!cache2[key]) {
35695
+ if (radius === 0) {
35696
+ cache2[key] = null;
35697
+ return null;
35912
35698
  }
35913
- if (extent1[3] < extent2[3]) {
35914
- intersection[3] = extent1[3];
35915
- } else {
35916
- intersection[3] = extent2[3];
35699
+ const margin = 1 * pixelRatio;
35700
+ const radiusDelay = radius + 2;
35701
+ const markerSize = radius * 2;
35702
+ const size = radiusDelay * 2 + margin * 2 + 100 * pixelRatio;
35703
+ const origin = size / 2;
35704
+ const canvas2 = createCanvas_default(size, size);
35705
+ if (canvas2) {
35706
+ const ctx = canvas2.getContext("2d");
35707
+ if (isDisplayStrokeAndDelay && delay !== null) {
35708
+ const delayBg = getDelayBgCanvas(origin, radiusDelay, getDelayColor2(delay, cancelled));
35709
+ ctx.drawImage(delayBg, 0, 0);
35710
+ }
35711
+ if (isDisplayStrokeAndDelay && (hover || delay >= delayDisplay || cancelled)) {
35712
+ const fontSize = Math.max(cancelled ? 19 : 14, Math.min(cancelled ? 19 : 17, radius * 1.2)) * pixelRatio;
35713
+ const text = getDelayText2(delay, cancelled);
35714
+ if (text) {
35715
+ const textWidth = text.length * fontSize;
35716
+ const delayText = getDelayTextCanvas(textWidth, text, fontSize, `bold ${fontSize}px arial, sans-serif`, getDelayColor2(delay, cancelled, true), delayOutlineColor, pixelRatio);
35717
+ ctx.drawImage(delayText, origin + radiusDelay + margin, origin - fontSize);
35718
+ }
35719
+ }
35720
+ let circleFillColor;
35721
+ if (useDelayStyle) {
35722
+ circleFillColor = getDelayColor2(delay, cancelled);
35723
+ } else {
35724
+ circleFillColor = color || getBgColor2(type);
35725
+ }
35726
+ const hasStroke = isDisplayStrokeAndDelay || hover || selected;
35727
+ const hasDash = isDisplayStrokeAndDelay && useDelayStyle && delay === null && operatorProvidesRealtime === "yes";
35728
+ const circle = getCircleCanvas(origin, radius, circleFillColor, hasStroke, hasDash, pixelRatio);
35729
+ ctx.drawImage(circle, 0, 0);
35730
+ if (mustDrawText) {
35731
+ const fontSize = Math.max(radius, 10);
35732
+ const textSize = getTextSize2(ctx, markerSize, name, fontSize);
35733
+ const textColor2 = !useDelayStyle ? textColor || getTextColor2(type) : "#000000";
35734
+ const hasStroke2 = useDelayStyle && delay === null && operatorProvidesRealtime === "yes";
35735
+ const text = getTextCanvas(name, origin, textSize, textColor2, circleFillColor, hasStroke2, pixelRatio);
35736
+ ctx.drawImage(text, 0, 0);
35737
+ }
35738
+ cache2[key] = canvas2;
35917
35739
  }
35918
- } else {
35919
- createOrUpdateEmpty(intersection);
35920
35740
  }
35921
- return intersection;
35922
- }
35923
- function getTopLeft(extent) {
35924
- return [extent[0], extent[3]];
35925
- }
35926
- function getTopRight(extent) {
35927
- return [extent[2], extent[3]];
35928
- }
35929
- function getWidth(extent) {
35930
- return extent[2] - extent[0];
35931
- }
35932
- function intersects(extent1, extent2) {
35933
- return extent1[0] <= extent2[2] && extent1[2] >= extent2[0] && extent1[1] <= extent2[3] && extent1[3] >= extent2[1];
35934
- }
35935
- function returnOrUpdate(extent, opt_extent) {
35936
- if (opt_extent) {
35937
- opt_extent[0] = extent[0];
35938
- opt_extent[1] = extent[1];
35939
- opt_extent[2] = extent[2];
35940
- opt_extent[3] = extent[3];
35941
- return opt_extent;
35942
- } else {
35943
- return extent;
35741
+ return cache2[key];
35742
+ };
35743
+ var realtimeDefaultStyle_default = realtimeDefaultStyle;
35744
+
35745
+ // src/common/styles/realtimeDelayStyle.js
35746
+ var realtimeDelayStyle = (trajectory, viewState, options) => {
35747
+ return realtimeDefaultStyle_default(trajectory, viewState, {
35748
+ ...options,
35749
+ useDelayStyle: true
35750
+ });
35751
+ };
35752
+ var realtimeDelayStyle_default = realtimeDelayStyle;
35753
+
35754
+ // src/common/styles/realtimeSimpleStyle.js
35755
+ var canvas;
35756
+ var realtimeSimpleStyle = () => {
35757
+ if (!canvas) {
35758
+ document.createElement("canvas");
35759
+ canvas.width = 15;
35760
+ canvas.height = 15;
35761
+ const ctx = canvas.getContext("2d");
35762
+ ctx.arc(8, 8, 5, 0, 2 * Math.PI, false);
35763
+ ctx.fillStyle = "#8ED6FF";
35764
+ ctx.fill();
35765
+ ctx.lineWidth = 3;
35766
+ ctx.strokeStyle = "black";
35767
+ ctx.stroke();
35768
+ ctx.lineWidth = 3;
35944
35769
  }
35945
- }
35946
- function intersectsSegment(extent, start, end) {
35947
- var intersects2 = false;
35948
- var startRel = coordinateRelationship(extent, start);
35949
- var endRel = coordinateRelationship(extent, end);
35950
- if (startRel === Relationship_default.INTERSECTING || endRel === Relationship_default.INTERSECTING) {
35951
- intersects2 = true;
35952
- } else {
35953
- var minX = extent[0];
35954
- var minY = extent[1];
35955
- var maxX = extent[2];
35956
- var maxY = extent[3];
35957
- var startX = start[0];
35958
- var startY = start[1];
35959
- var endX = end[0];
35960
- var endY = end[1];
35961
- var slope = (endY - startY) / (endX - startX);
35962
- var x = void 0, y = void 0;
35963
- if (!!(endRel & Relationship_default.ABOVE) && !(startRel & Relationship_default.ABOVE)) {
35964
- x = endX - (endY - maxY) / slope;
35965
- intersects2 = x >= minX && x <= maxX;
35770
+ return canvas;
35771
+ };
35772
+ var realtimeSimpleStyle_default = realtimeSimpleStyle;
35773
+
35774
+ // node_modules/ol/layer/Property.js
35775
+ var Property_default = {
35776
+ OPACITY: "opacity",
35777
+ VISIBLE: "visible",
35778
+ EXTENT: "extent",
35779
+ Z_INDEX: "zIndex",
35780
+ MAX_RESOLUTION: "maxResolution",
35781
+ MIN_RESOLUTION: "minResolution",
35782
+ MAX_ZOOM: "maxZoom",
35783
+ MIN_ZOOM: "minZoom",
35784
+ SOURCE: "source",
35785
+ MAP: "map"
35786
+ };
35787
+
35788
+ // node_modules/ol/layer/Base.js
35789
+ var __extends7 = function() {
35790
+ var extendStatics = function(d, b) {
35791
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35792
+ d2.__proto__ = b2;
35793
+ } || function(d2, b2) {
35794
+ for (var p in b2)
35795
+ if (Object.prototype.hasOwnProperty.call(b2, p))
35796
+ d2[p] = b2[p];
35797
+ };
35798
+ return extendStatics(d, b);
35799
+ };
35800
+ return function(d, b) {
35801
+ if (typeof b !== "function" && b !== null)
35802
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35803
+ extendStatics(d, b);
35804
+ function __() {
35805
+ this.constructor = d;
35966
35806
  }
35967
- if (!intersects2 && !!(endRel & Relationship_default.RIGHT) && !(startRel & Relationship_default.RIGHT)) {
35968
- y = endY - (endX - maxX) * slope;
35969
- intersects2 = y >= minY && y <= maxY;
35807
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35808
+ };
35809
+ }();
35810
+ var BaseLayer = function(_super) {
35811
+ __extends7(BaseLayer2, _super);
35812
+ function BaseLayer2(options) {
35813
+ var _this = _super.call(this) || this;
35814
+ _this.on;
35815
+ _this.once;
35816
+ _this.un;
35817
+ _this.background_ = options.background;
35818
+ var properties = assign({}, options);
35819
+ if (typeof options.properties === "object") {
35820
+ delete properties.properties;
35821
+ assign(properties, options.properties);
35822
+ }
35823
+ properties[Property_default.OPACITY] = options.opacity !== void 0 ? options.opacity : 1;
35824
+ assert(typeof properties[Property_default.OPACITY] === "number", 64);
35825
+ properties[Property_default.VISIBLE] = options.visible !== void 0 ? options.visible : true;
35826
+ properties[Property_default.Z_INDEX] = options.zIndex;
35827
+ properties[Property_default.MAX_RESOLUTION] = options.maxResolution !== void 0 ? options.maxResolution : Infinity;
35828
+ properties[Property_default.MIN_RESOLUTION] = options.minResolution !== void 0 ? options.minResolution : 0;
35829
+ properties[Property_default.MIN_ZOOM] = options.minZoom !== void 0 ? options.minZoom : -Infinity;
35830
+ properties[Property_default.MAX_ZOOM] = options.maxZoom !== void 0 ? options.maxZoom : Infinity;
35831
+ _this.className_ = properties.className !== void 0 ? properties.className : "ol-layer";
35832
+ delete properties.className;
35833
+ _this.setProperties(properties);
35834
+ _this.state_ = null;
35835
+ return _this;
35836
+ }
35837
+ BaseLayer2.prototype.getBackground = function() {
35838
+ return this.background_;
35839
+ };
35840
+ BaseLayer2.prototype.getClassName = function() {
35841
+ return this.className_;
35842
+ };
35843
+ BaseLayer2.prototype.getLayerState = function(opt_managed) {
35844
+ var state = this.state_ || {
35845
+ layer: this,
35846
+ managed: opt_managed === void 0 ? true : opt_managed
35847
+ };
35848
+ var zIndex = this.getZIndex();
35849
+ state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);
35850
+ state.visible = this.getVisible();
35851
+ state.extent = this.getExtent();
35852
+ state.zIndex = zIndex === void 0 && !state.managed ? Infinity : zIndex;
35853
+ state.maxResolution = this.getMaxResolution();
35854
+ state.minResolution = Math.max(this.getMinResolution(), 0);
35855
+ state.minZoom = this.getMinZoom();
35856
+ state.maxZoom = this.getMaxZoom();
35857
+ this.state_ = state;
35858
+ return state;
35859
+ };
35860
+ BaseLayer2.prototype.getLayersArray = function(opt_array) {
35861
+ return abstract();
35862
+ };
35863
+ BaseLayer2.prototype.getLayerStatesArray = function(opt_states) {
35864
+ return abstract();
35865
+ };
35866
+ BaseLayer2.prototype.getExtent = function() {
35867
+ return this.get(Property_default.EXTENT);
35868
+ };
35869
+ BaseLayer2.prototype.getMaxResolution = function() {
35870
+ return this.get(Property_default.MAX_RESOLUTION);
35871
+ };
35872
+ BaseLayer2.prototype.getMinResolution = function() {
35873
+ return this.get(Property_default.MIN_RESOLUTION);
35874
+ };
35875
+ BaseLayer2.prototype.getMinZoom = function() {
35876
+ return this.get(Property_default.MIN_ZOOM);
35877
+ };
35878
+ BaseLayer2.prototype.getMaxZoom = function() {
35879
+ return this.get(Property_default.MAX_ZOOM);
35880
+ };
35881
+ BaseLayer2.prototype.getOpacity = function() {
35882
+ return this.get(Property_default.OPACITY);
35883
+ };
35884
+ BaseLayer2.prototype.getSourceState = function() {
35885
+ return abstract();
35886
+ };
35887
+ BaseLayer2.prototype.getVisible = function() {
35888
+ return this.get(Property_default.VISIBLE);
35889
+ };
35890
+ BaseLayer2.prototype.getZIndex = function() {
35891
+ return this.get(Property_default.Z_INDEX);
35892
+ };
35893
+ BaseLayer2.prototype.setBackground = function(opt_background) {
35894
+ this.background_ = opt_background;
35895
+ this.changed();
35896
+ };
35897
+ BaseLayer2.prototype.setExtent = function(extent) {
35898
+ this.set(Property_default.EXTENT, extent);
35899
+ };
35900
+ BaseLayer2.prototype.setMaxResolution = function(maxResolution) {
35901
+ this.set(Property_default.MAX_RESOLUTION, maxResolution);
35902
+ };
35903
+ BaseLayer2.prototype.setMinResolution = function(minResolution) {
35904
+ this.set(Property_default.MIN_RESOLUTION, minResolution);
35905
+ };
35906
+ BaseLayer2.prototype.setMaxZoom = function(maxZoom) {
35907
+ this.set(Property_default.MAX_ZOOM, maxZoom);
35908
+ };
35909
+ BaseLayer2.prototype.setMinZoom = function(minZoom) {
35910
+ this.set(Property_default.MIN_ZOOM, minZoom);
35911
+ };
35912
+ BaseLayer2.prototype.setOpacity = function(opacity) {
35913
+ assert(typeof opacity === "number", 64);
35914
+ this.set(Property_default.OPACITY, opacity);
35915
+ };
35916
+ BaseLayer2.prototype.setVisible = function(visible) {
35917
+ this.set(Property_default.VISIBLE, visible);
35918
+ };
35919
+ BaseLayer2.prototype.setZIndex = function(zindex) {
35920
+ this.set(Property_default.Z_INDEX, zindex);
35921
+ };
35922
+ BaseLayer2.prototype.disposeInternal = function() {
35923
+ if (this.state_) {
35924
+ this.state_.layer = null;
35925
+ this.state_ = null;
35970
35926
  }
35971
- if (!intersects2 && !!(endRel & Relationship_default.BELOW) && !(startRel & Relationship_default.BELOW)) {
35972
- x = endX - (endY - minY) / slope;
35973
- intersects2 = x >= minX && x <= maxX;
35927
+ _super.prototype.disposeInternal.call(this);
35928
+ };
35929
+ return BaseLayer2;
35930
+ }(Object_default);
35931
+ var Base_default = BaseLayer;
35932
+
35933
+ // node_modules/ol/render/EventType.js
35934
+ var EventType_default2 = {
35935
+ PRERENDER: "prerender",
35936
+ POSTRENDER: "postrender",
35937
+ PRECOMPOSE: "precompose",
35938
+ POSTCOMPOSE: "postcompose",
35939
+ RENDERCOMPLETE: "rendercomplete"
35940
+ };
35941
+
35942
+ // node_modules/ol/source/State.js
35943
+ var State_default = {
35944
+ UNDEFINED: "undefined",
35945
+ LOADING: "loading",
35946
+ READY: "ready",
35947
+ ERROR: "error"
35948
+ };
35949
+
35950
+ // node_modules/ol/layer/Layer.js
35951
+ var __extends8 = function() {
35952
+ var extendStatics = function(d, b) {
35953
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
35954
+ d2.__proto__ = b2;
35955
+ } || function(d2, b2) {
35956
+ for (var p in b2)
35957
+ if (Object.prototype.hasOwnProperty.call(b2, p))
35958
+ d2[p] = b2[p];
35959
+ };
35960
+ return extendStatics(d, b);
35961
+ };
35962
+ return function(d, b) {
35963
+ if (typeof b !== "function" && b !== null)
35964
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35965
+ extendStatics(d, b);
35966
+ function __() {
35967
+ this.constructor = d;
35974
35968
  }
35975
- if (!intersects2 && !!(endRel & Relationship_default.LEFT) && !(startRel & Relationship_default.LEFT)) {
35976
- y = endY - (endX - minX) * slope;
35977
- intersects2 = y >= minY && y <= maxY;
35969
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35970
+ };
35971
+ }();
35972
+ var Layer = function(_super) {
35973
+ __extends8(Layer5, _super);
35974
+ function Layer5(options) {
35975
+ var _this = this;
35976
+ var baseOptions = assign({}, options);
35977
+ delete baseOptions.source;
35978
+ _this = _super.call(this, baseOptions) || this;
35979
+ _this.on;
35980
+ _this.once;
35981
+ _this.un;
35982
+ _this.mapPrecomposeKey_ = null;
35983
+ _this.mapRenderKey_ = null;
35984
+ _this.sourceChangeKey_ = null;
35985
+ _this.renderer_ = null;
35986
+ _this.rendered = false;
35987
+ if (options.render) {
35988
+ _this.render = options.render;
35978
35989
  }
35979
- }
35980
- return intersects2;
35981
- }
35982
- function applyTransform(extent, transformFn, opt_extent, opt_stops) {
35983
- var coordinates2 = [];
35984
- if (opt_stops > 1) {
35985
- var width = extent[2] - extent[0];
35986
- var height = extent[3] - extent[1];
35987
- for (var i = 0; i < opt_stops; ++i) {
35988
- coordinates2.push(extent[0] + width * i / opt_stops, extent[1], extent[2], extent[1] + height * i / opt_stops, extent[2] - width * i / opt_stops, extent[3], extent[0], extent[3] - height * i / opt_stops);
35990
+ if (options.map) {
35991
+ _this.setMap(options.map);
35989
35992
  }
35990
- } else {
35991
- coordinates2 = [
35992
- extent[0],
35993
- extent[1],
35994
- extent[2],
35995
- extent[1],
35996
- extent[2],
35997
- extent[3],
35998
- extent[0],
35999
- extent[3]
36000
- ];
36001
- }
36002
- transformFn(coordinates2, coordinates2, 2);
36003
- var xs = [];
36004
- var ys = [];
36005
- for (var i = 0, l = coordinates2.length; i < l; i += 2) {
36006
- xs.push(coordinates2[i]);
36007
- ys.push(coordinates2[i + 1]);
36008
- }
36009
- return _boundingExtentXYs(xs, ys, opt_extent);
36010
- }
36011
- function wrapX(extent, projection) {
36012
- var projectionExtent = projection.getExtent();
36013
- var center = getCenter(extent);
36014
- if (projection.canWrapX() && (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) {
36015
- var worldWidth = getWidth(projectionExtent);
36016
- var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth);
36017
- var offset = worldsAway * worldWidth;
36018
- extent[0] -= offset;
36019
- extent[2] -= offset;
36020
- }
36021
- return extent;
36022
- }
36023
-
36024
- // node_modules/ol/proj/Projection.js
36025
- var Projection = function() {
36026
- function Projection2(options) {
36027
- this.code_ = options.code;
36028
- this.units_ = options.units;
36029
- this.extent_ = options.extent !== void 0 ? options.extent : null;
36030
- this.worldExtent_ = options.worldExtent !== void 0 ? options.worldExtent : null;
36031
- this.axisOrientation_ = options.axisOrientation !== void 0 ? options.axisOrientation : "enu";
36032
- this.global_ = options.global !== void 0 ? options.global : false;
36033
- this.canWrapX_ = !!(this.global_ && this.extent_);
36034
- this.getPointResolutionFunc_ = options.getPointResolution;
36035
- this.defaultTileGrid_ = null;
36036
- this.metersPerUnit_ = options.metersPerUnit;
35993
+ _this.addChangeListener(Property_default.SOURCE, _this.handleSourcePropertyChange_);
35994
+ var source = options.source ? options.source : null;
35995
+ _this.setSource(source);
35996
+ return _this;
36037
35997
  }
36038
- Projection2.prototype.canWrapX = function() {
36039
- return this.canWrapX_;
35998
+ Layer5.prototype.getLayersArray = function(opt_array) {
35999
+ var array = opt_array ? opt_array : [];
36000
+ array.push(this);
36001
+ return array;
36040
36002
  };
36041
- Projection2.prototype.getCode = function() {
36042
- return this.code_;
36003
+ Layer5.prototype.getLayerStatesArray = function(opt_states) {
36004
+ var states = opt_states ? opt_states : [];
36005
+ states.push(this.getLayerState());
36006
+ return states;
36043
36007
  };
36044
- Projection2.prototype.getExtent = function() {
36045
- return this.extent_;
36008
+ Layer5.prototype.getSource = function() {
36009
+ return this.get(Property_default.SOURCE) || null;
36046
36010
  };
36047
- Projection2.prototype.getUnits = function() {
36048
- return this.units_;
36011
+ Layer5.prototype.getRenderSource = function() {
36012
+ return this.getSource();
36049
36013
  };
36050
- Projection2.prototype.getMetersPerUnit = function() {
36051
- return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];
36014
+ Layer5.prototype.getSourceState = function() {
36015
+ var source = this.getSource();
36016
+ return !source ? State_default.UNDEFINED : source.getState();
36052
36017
  };
36053
- Projection2.prototype.getWorldExtent = function() {
36054
- return this.worldExtent_;
36018
+ Layer5.prototype.handleSourceChange_ = function() {
36019
+ this.changed();
36020
+ };
36021
+ Layer5.prototype.handleSourcePropertyChange_ = function() {
36022
+ if (this.sourceChangeKey_) {
36023
+ unlistenByKey(this.sourceChangeKey_);
36024
+ this.sourceChangeKey_ = null;
36025
+ }
36026
+ var source = this.getSource();
36027
+ if (source) {
36028
+ this.sourceChangeKey_ = listen(source, EventType_default.CHANGE, this.handleSourceChange_, this);
36029
+ }
36030
+ this.changed();
36031
+ };
36032
+ Layer5.prototype.getFeatures = function(pixel) {
36033
+ if (!this.renderer_) {
36034
+ return new Promise(function(resolve) {
36035
+ return resolve([]);
36036
+ });
36037
+ }
36038
+ return this.renderer_.getFeatures(pixel);
36055
36039
  };
36056
- Projection2.prototype.getAxisOrientation = function() {
36057
- return this.axisOrientation_;
36040
+ Layer5.prototype.getData = function(pixel) {
36041
+ if (!this.renderer_ || !this.rendered) {
36042
+ return null;
36043
+ }
36044
+ return this.renderer_.getData(pixel);
36058
36045
  };
36059
- Projection2.prototype.isGlobal = function() {
36060
- return this.global_;
36046
+ Layer5.prototype.render = function(frameState, target) {
36047
+ var layerRenderer = this.getRenderer();
36048
+ if (layerRenderer.prepareFrame(frameState)) {
36049
+ this.rendered = true;
36050
+ return layerRenderer.renderFrame(frameState, target);
36051
+ }
36061
36052
  };
36062
- Projection2.prototype.setGlobal = function(global2) {
36063
- this.global_ = global2;
36064
- this.canWrapX_ = !!(global2 && this.extent_);
36053
+ Layer5.prototype.unrender = function() {
36054
+ this.rendered = false;
36065
36055
  };
36066
- Projection2.prototype.getDefaultTileGrid = function() {
36067
- return this.defaultTileGrid_;
36056
+ Layer5.prototype.setMapInternal = function(map) {
36057
+ if (!map) {
36058
+ this.unrender();
36059
+ }
36060
+ this.set(Property_default.MAP, map);
36068
36061
  };
36069
- Projection2.prototype.setDefaultTileGrid = function(tileGrid) {
36070
- this.defaultTileGrid_ = tileGrid;
36062
+ Layer5.prototype.getMapInternal = function() {
36063
+ return this.get(Property_default.MAP);
36071
36064
  };
36072
- Projection2.prototype.setExtent = function(extent) {
36073
- this.extent_ = extent;
36074
- this.canWrapX_ = !!(this.global_ && extent);
36065
+ Layer5.prototype.setMap = function(map) {
36066
+ if (this.mapPrecomposeKey_) {
36067
+ unlistenByKey(this.mapPrecomposeKey_);
36068
+ this.mapPrecomposeKey_ = null;
36069
+ }
36070
+ if (!map) {
36071
+ this.changed();
36072
+ }
36073
+ if (this.mapRenderKey_) {
36074
+ unlistenByKey(this.mapRenderKey_);
36075
+ this.mapRenderKey_ = null;
36076
+ }
36077
+ if (map) {
36078
+ this.mapPrecomposeKey_ = listen(map, EventType_default2.PRECOMPOSE, function(evt) {
36079
+ var renderEvent = evt;
36080
+ var layerStatesArray = renderEvent.frameState.layerStatesArray;
36081
+ var layerState = this.getLayerState(false);
36082
+ assert(!layerStatesArray.some(function(arrayLayerState) {
36083
+ return arrayLayerState.layer === layerState.layer;
36084
+ }), 67);
36085
+ layerStatesArray.push(layerState);
36086
+ }, this);
36087
+ this.mapRenderKey_ = listen(this, EventType_default.CHANGE, map.render, map);
36088
+ this.changed();
36089
+ }
36075
36090
  };
36076
- Projection2.prototype.setWorldExtent = function(worldExtent) {
36077
- this.worldExtent_ = worldExtent;
36091
+ Layer5.prototype.setSource = function(source) {
36092
+ this.set(Property_default.SOURCE, source);
36078
36093
  };
36079
- Projection2.prototype.setGetPointResolution = function(func) {
36080
- this.getPointResolutionFunc_ = func;
36094
+ Layer5.prototype.getRenderer = function() {
36095
+ if (!this.renderer_) {
36096
+ this.renderer_ = this.createRenderer();
36097
+ }
36098
+ return this.renderer_;
36081
36099
  };
36082
- Projection2.prototype.getPointResolutionFunc = function() {
36083
- return this.getPointResolutionFunc_;
36100
+ Layer5.prototype.hasRenderer = function() {
36101
+ return !!this.renderer_;
36084
36102
  };
36085
- return Projection2;
36086
- }();
36087
- var Projection_default = Projection;
36088
-
36089
- // node_modules/ol/proj/epsg3857.js
36090
- var __extends9 = function() {
36091
- var extendStatics = function(d, b) {
36092
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
36093
- d2.__proto__ = b2;
36094
- } || function(d2, b2) {
36095
- for (var p in b2)
36096
- if (Object.prototype.hasOwnProperty.call(b2, p))
36097
- d2[p] = b2[p];
36098
- };
36099
- return extendStatics(d, b);
36103
+ Layer5.prototype.createRenderer = function() {
36104
+ return null;
36100
36105
  };
36101
- return function(d, b) {
36102
- if (typeof b !== "function" && b !== null)
36103
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
36104
- extendStatics(d, b);
36105
- function __() {
36106
- this.constructor = d;
36106
+ Layer5.prototype.disposeInternal = function() {
36107
+ if (this.renderer_) {
36108
+ this.renderer_.dispose();
36109
+ delete this.renderer_;
36107
36110
  }
36108
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36111
+ this.setSource(null);
36112
+ _super.prototype.disposeInternal.call(this);
36109
36113
  };
36110
- }();
36111
- var RADIUS = 6378137;
36112
- var HALF_SIZE = Math.PI * RADIUS;
36113
- var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE];
36114
- var WORLD_EXTENT = [-180, -85, 180, 85];
36115
- var MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2));
36116
- var EPSG3857Projection = function(_super) {
36117
- __extends9(EPSG3857Projection2, _super);
36118
- function EPSG3857Projection2(code) {
36119
- return _super.call(this, {
36120
- code,
36121
- units: Units_default.METERS,
36122
- extent: EXTENT,
36123
- global: true,
36124
- worldExtent: WORLD_EXTENT,
36125
- getPointResolution: function(resolution, point2) {
36126
- return resolution / cosh(point2[1] / RADIUS);
36114
+ return Layer5;
36115
+ }(Base_default);
36116
+ function inView(layerState, viewState) {
36117
+ if (!layerState.visible) {
36118
+ return false;
36119
+ }
36120
+ var resolution = viewState.resolution;
36121
+ if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {
36122
+ return false;
36123
+ }
36124
+ var zoom = viewState.zoom;
36125
+ return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
36126
+ }
36127
+ var Layer_default = Layer;
36128
+
36129
+ // src/common/controls/Control.js
36130
+ var Control = class extends Object_default {
36131
+ constructor(options = {}) {
36132
+ super(options);
36133
+ this.defineProperties(options);
36134
+ const { active } = {
36135
+ active: options.active !== false,
36136
+ ...options
36137
+ };
36138
+ this.active = active;
36139
+ }
36140
+ defineProperties(options) {
36141
+ const { target, element, render } = {
36142
+ ...options
36143
+ };
36144
+ Object.defineProperties(this, {
36145
+ active: {
36146
+ get: () => this.get("active"),
36147
+ set: (newActive) => {
36148
+ this.set("active", newActive);
36149
+ if (newActive) {
36150
+ this.activate();
36151
+ } else {
36152
+ this.deactivate();
36153
+ }
36154
+ this.render();
36155
+ }
36156
+ },
36157
+ map: {
36158
+ get: () => this.get("map"),
36159
+ set: (map) => {
36160
+ if (this.map && this.element && this.element.parentNode) {
36161
+ this.element.parentNode.removeChild(this.element);
36162
+ }
36163
+ this.deactivate();
36164
+ this.set("map", map);
36165
+ if (this.map) {
36166
+ const targett = this.target || this.map.getTargetElement && this.map.getTargetElement() || this.map.getContainer && this.map.getContainer();
36167
+ if (!this.element) {
36168
+ this.createDefaultElement();
36169
+ }
36170
+ if (this.element) {
36171
+ targett.appendChild(this.element);
36172
+ }
36173
+ if (this.active) {
36174
+ this.activate();
36175
+ }
36176
+ }
36177
+ this.render();
36178
+ }
36179
+ },
36180
+ target: {
36181
+ value: target
36182
+ },
36183
+ element: {
36184
+ value: element,
36185
+ writable: true
36186
+ },
36187
+ render: {
36188
+ value: render || this.render,
36189
+ writable: true
36127
36190
  }
36128
- }) || this;
36191
+ });
36129
36192
  }
36130
- return EPSG3857Projection2;
36131
- }(Projection_default);
36132
- var PROJECTIONS = [
36133
- new EPSG3857Projection("EPSG:3857"),
36134
- new EPSG3857Projection("EPSG:102100"),
36135
- new EPSG3857Projection("EPSG:102113"),
36136
- new EPSG3857Projection("EPSG:900913"),
36137
- new EPSG3857Projection("http://www.opengis.net/def/crs/EPSG/0/3857"),
36138
- new EPSG3857Projection("http://www.opengis.net/gml/srs/epsg.xml#3857")
36139
- ];
36140
- function fromEPSG4326(input, opt_output, opt_dimension) {
36141
- var length = input.length;
36142
- var dimension = opt_dimension > 1 ? opt_dimension : 2;
36143
- var output = opt_output;
36144
- if (output === void 0) {
36145
- if (dimension > 2) {
36146
- output = input.slice();
36147
- } else {
36148
- output = new Array(length);
36193
+ attachToMap(map) {
36194
+ this.map = map;
36195
+ }
36196
+ detachFromMap() {
36197
+ this.map = null;
36198
+ }
36199
+ activate() {
36200
+ this.deactivate();
36201
+ }
36202
+ deactivate() {
36203
+ }
36204
+ render() {
36205
+ }
36206
+ createDefaultElement() {
36207
+ }
36208
+ };
36209
+ var Control_default = Control;
36210
+
36211
+ // src/common/mixins/CopyrightMixin.js
36212
+ var CopyrightMixin = (Base) => class extends Base {
36213
+ render() {
36214
+ if (!this.element) {
36215
+ return;
36216
+ }
36217
+ this.element.innerHTML = this.active ? this.getCopyrights().join(" | ") : "";
36218
+ }
36219
+ createDefaultElement() {
36220
+ this.element = document.createElement("div");
36221
+ this.element.id = "mbt-copyright";
36222
+ Object.assign(this.element.style, {
36223
+ position: "absolute",
36224
+ bottom: 0,
36225
+ right: 0,
36226
+ fontSize: ".8rem",
36227
+ padding: "0 10px"
36228
+ });
36229
+ }
36230
+ };
36231
+ var CopyrightMixin_default = CopyrightMixin;
36232
+
36233
+ // src/ol/controls/CopyrightControl.js
36234
+ var CopyrightControl = class extends CopyrightMixin_default(Control_default) {
36235
+ constructor(options) {
36236
+ super(options);
36237
+ this.onPostRender = this.onPostRender.bind(this);
36238
+ }
36239
+ getCopyrights() {
36240
+ if (!this.frameState) {
36241
+ return [];
36149
36242
  }
36243
+ let copyrights = [];
36244
+ this.frameState.layerStatesArray.forEach((layerState) => {
36245
+ const { layer } = layerState;
36246
+ if (inView(layerState, this.frameState.viewState) && layer && layer.getSource && layer.getSource() && layer.getSource().getAttributions()) {
36247
+ copyrights = copyrights.concat(layer.getSource().getAttributions()(this.frameState));
36248
+ }
36249
+ });
36250
+ return removeDuplicate_default(copyrights);
36150
36251
  }
36151
- for (var i = 0; i < length; i += dimension) {
36152
- output[i] = HALF_SIZE * input[i] / 180;
36153
- var y = RADIUS * Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360));
36154
- if (y > MAX_SAFE_Y) {
36155
- y = MAX_SAFE_Y;
36156
- } else if (y < -MAX_SAFE_Y) {
36157
- y = -MAX_SAFE_Y;
36252
+ activate() {
36253
+ super.activate();
36254
+ if (this.map) {
36255
+ this.map.on("postrender", this.onPostRender);
36158
36256
  }
36159
- output[i + 1] = y;
36160
36257
  }
36161
- return output;
36162
- }
36163
- function toEPSG4326(input, opt_output, opt_dimension) {
36164
- var length = input.length;
36165
- var dimension = opt_dimension > 1 ? opt_dimension : 2;
36166
- var output = opt_output;
36167
- if (output === void 0) {
36168
- if (dimension > 2) {
36169
- output = input.slice();
36170
- } else {
36171
- output = new Array(length);
36258
+ deactivate() {
36259
+ if (this.map) {
36260
+ this.map.un("postrender", this.onPostRender);
36172
36261
  }
36262
+ super.deactivate();
36173
36263
  }
36174
- for (var i = 0; i < length; i += dimension) {
36175
- output[i] = 180 * input[i] / HALF_SIZE;
36176
- output[i + 1] = 360 * Math.atan(Math.exp(input[i + 1] / RADIUS)) / Math.PI - 90;
36264
+ onPostRender(evt) {
36265
+ if (this.map && this.element) {
36266
+ this.frameState = evt.frameState;
36267
+ this.render();
36268
+ }
36177
36269
  }
36178
- return output;
36179
- }
36270
+ };
36271
+ var CopyrightControl_default = CopyrightControl;
36180
36272
 
36181
- // node_modules/ol/proj/epsg4326.js
36182
- var __extends10 = function() {
36273
+ // node_modules/ol/CollectionEventType.js
36274
+ var CollectionEventType_default = {
36275
+ ADD: "add",
36276
+ REMOVE: "remove"
36277
+ };
36278
+
36279
+ // node_modules/ol/Collection.js
36280
+ var __extends9 = function() {
36183
36281
  var extendStatics = function(d, b) {
36184
36282
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
36185
36283
  d2.__proto__ = b2;
@@ -36200,275 +36298,263 @@ uniform ${i3} ${o3} u_${a3};
36200
36298
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36201
36299
  };
36202
36300
  }();
36203
- var RADIUS2 = 6378137;
36204
- var EXTENT2 = [-180, -90, 180, 90];
36205
- var METERS_PER_UNIT2 = Math.PI * RADIUS2 / 180;
36206
- var EPSG4326Projection = function(_super) {
36207
- __extends10(EPSG4326Projection2, _super);
36208
- function EPSG4326Projection2(code, opt_axisOrientation) {
36209
- return _super.call(this, {
36210
- code,
36211
- units: Units_default.DEGREES,
36212
- extent: EXTENT2,
36213
- axisOrientation: opt_axisOrientation,
36214
- global: true,
36215
- metersPerUnit: METERS_PER_UNIT2,
36216
- worldExtent: EXTENT2
36217
- }) || this;
36218
- }
36219
- return EPSG4326Projection2;
36220
- }(Projection_default);
36221
- var PROJECTIONS2 = [
36222
- new EPSG4326Projection("CRS:84"),
36223
- new EPSG4326Projection("EPSG:4326", "neu"),
36224
- new EPSG4326Projection("urn:ogc:def:crs:OGC:1.3:CRS84"),
36225
- new EPSG4326Projection("urn:ogc:def:crs:OGC:2:84"),
36226
- new EPSG4326Projection("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),
36227
- new EPSG4326Projection("http://www.opengis.net/gml/srs/epsg.xml#4326", "neu"),
36228
- new EPSG4326Projection("http://www.opengis.net/def/crs/EPSG/0/4326", "neu")
36229
- ];
36230
-
36231
- // node_modules/ol/proj/projections.js
36232
- var cache2 = {};
36233
- function get(code) {
36234
- return cache2[code] || cache2[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, "EPSG:$3")] || null;
36235
- }
36236
- function add(code, projection) {
36237
- cache2[code] = projection;
36238
- }
36239
-
36240
- // node_modules/ol/proj/transforms.js
36241
- var transforms = {};
36242
- function add2(source, destination, transformFn) {
36243
- var sourceCode = source.getCode();
36244
- var destinationCode = destination.getCode();
36245
- if (!(sourceCode in transforms)) {
36246
- transforms[sourceCode] = {};
36247
- }
36248
- transforms[sourceCode][destinationCode] = transformFn;
36249
- }
36250
- function get2(sourceCode, destinationCode) {
36251
- var transform2;
36252
- if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {
36253
- transform2 = transforms[sourceCode][destinationCode];
36254
- }
36255
- return transform2;
36256
- }
36257
-
36258
- // node_modules/ol/coordinate.js
36259
- function closestOnSegment(coordinate, segment) {
36260
- var x0 = coordinate[0];
36261
- var y0 = coordinate[1];
36262
- var start = segment[0];
36263
- var end = segment[1];
36264
- var x1 = start[0];
36265
- var y1 = start[1];
36266
- var x2 = end[0];
36267
- var y2 = end[1];
36268
- var dx = x2 - x1;
36269
- var dy = y2 - y1;
36270
- var along = dx === 0 && dy === 0 ? 0 : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);
36271
- var x, y;
36272
- if (along <= 0) {
36273
- x = x1;
36274
- y = y1;
36275
- } else if (along >= 1) {
36276
- x = x2;
36277
- y = y2;
36278
- } else {
36279
- x = x1 + along * dx;
36280
- y = y1 + along * dy;
36301
+ var Property = {
36302
+ LENGTH: "length"
36303
+ };
36304
+ var CollectionEvent = function(_super) {
36305
+ __extends9(CollectionEvent2, _super);
36306
+ function CollectionEvent2(type, opt_element, opt_index) {
36307
+ var _this = _super.call(this, type) || this;
36308
+ _this.element = opt_element;
36309
+ _this.index = opt_index;
36310
+ return _this;
36281
36311
  }
36282
- return [x, y];
36283
- }
36284
- function equals3(coordinate1, coordinate2) {
36285
- var equals4 = true;
36286
- for (var i = coordinate1.length - 1; i >= 0; --i) {
36287
- if (coordinate1[i] != coordinate2[i]) {
36288
- equals4 = false;
36289
- break;
36312
+ return CollectionEvent2;
36313
+ }(Event_default);
36314
+ var Collection = function(_super) {
36315
+ __extends9(Collection2, _super);
36316
+ function Collection2(opt_array, opt_options) {
36317
+ var _this = _super.call(this) || this;
36318
+ _this.on;
36319
+ _this.once;
36320
+ _this.un;
36321
+ var options = opt_options || {};
36322
+ _this.unique_ = !!options.unique;
36323
+ _this.array_ = opt_array ? opt_array : [];
36324
+ if (_this.unique_) {
36325
+ for (var i = 0, ii = _this.array_.length; i < ii; ++i) {
36326
+ _this.assertUnique_(_this.array_[i], i);
36327
+ }
36290
36328
  }
36329
+ _this.updateLength_();
36330
+ return _this;
36291
36331
  }
36292
- return equals4;
36293
- }
36294
- function squaredDistance2(coord1, coord2) {
36295
- var dx = coord1[0] - coord2[0];
36296
- var dy = coord1[1] - coord2[1];
36297
- return dx * dx + dy * dy;
36298
- }
36299
- function distance(coord1, coord2) {
36300
- return Math.sqrt(squaredDistance2(coord1, coord2));
36301
- }
36302
- function squaredDistanceToSegment(coordinate, segment) {
36303
- return squaredDistance2(coordinate, closestOnSegment(coordinate, segment));
36304
- }
36305
- function wrapX2(coordinate, projection) {
36306
- if (projection.canWrapX()) {
36307
- var worldWidth = getWidth(projection.getExtent());
36308
- var worldsAway = getWorldsAway(coordinate, projection, worldWidth);
36309
- if (worldsAway) {
36310
- coordinate[0] -= worldsAway * worldWidth;
36332
+ Collection2.prototype.clear = function() {
36333
+ while (this.getLength() > 0) {
36334
+ this.pop();
36335
+ }
36336
+ };
36337
+ Collection2.prototype.extend = function(arr) {
36338
+ for (var i = 0, ii = arr.length; i < ii; ++i) {
36339
+ this.push(arr[i]);
36340
+ }
36341
+ return this;
36342
+ };
36343
+ Collection2.prototype.forEach = function(f) {
36344
+ var array = this.array_;
36345
+ for (var i = 0, ii = array.length; i < ii; ++i) {
36346
+ f(array[i], i, array);
36347
+ }
36348
+ };
36349
+ Collection2.prototype.getArray = function() {
36350
+ return this.array_;
36351
+ };
36352
+ Collection2.prototype.item = function(index) {
36353
+ return this.array_[index];
36354
+ };
36355
+ Collection2.prototype.getLength = function() {
36356
+ return this.get(Property.LENGTH);
36357
+ };
36358
+ Collection2.prototype.insertAt = function(index, elem) {
36359
+ if (this.unique_) {
36360
+ this.assertUnique_(elem);
36361
+ }
36362
+ this.array_.splice(index, 0, elem);
36363
+ this.updateLength_();
36364
+ this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD, elem, index));
36365
+ };
36366
+ Collection2.prototype.pop = function() {
36367
+ return this.removeAt(this.getLength() - 1);
36368
+ };
36369
+ Collection2.prototype.push = function(elem) {
36370
+ if (this.unique_) {
36371
+ this.assertUnique_(elem);
36372
+ }
36373
+ var n = this.getLength();
36374
+ this.insertAt(n, elem);
36375
+ return this.getLength();
36376
+ };
36377
+ Collection2.prototype.remove = function(elem) {
36378
+ var arr = this.array_;
36379
+ for (var i = 0, ii = arr.length; i < ii; ++i) {
36380
+ if (arr[i] === elem) {
36381
+ return this.removeAt(i);
36382
+ }
36383
+ }
36384
+ return void 0;
36385
+ };
36386
+ Collection2.prototype.removeAt = function(index) {
36387
+ var prev = this.array_[index];
36388
+ this.array_.splice(index, 1);
36389
+ this.updateLength_();
36390
+ this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE, prev, index));
36391
+ return prev;
36392
+ };
36393
+ Collection2.prototype.setAt = function(index, elem) {
36394
+ var n = this.getLength();
36395
+ if (index < n) {
36396
+ if (this.unique_) {
36397
+ this.assertUnique_(elem, index);
36398
+ }
36399
+ var prev = this.array_[index];
36400
+ this.array_[index] = elem;
36401
+ this.dispatchEvent(new CollectionEvent(CollectionEventType_default.REMOVE, prev, index));
36402
+ this.dispatchEvent(new CollectionEvent(CollectionEventType_default.ADD, elem, index));
36403
+ } else {
36404
+ for (var j = n; j < index; ++j) {
36405
+ this.insertAt(j, void 0);
36406
+ }
36407
+ this.insertAt(index, elem);
36311
36408
  }
36312
- }
36313
- return coordinate;
36314
- }
36315
- function getWorldsAway(coordinate, projection, opt_sourceExtentWidth) {
36316
- var projectionExtent = projection.getExtent();
36317
- var worldsAway = 0;
36318
- if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])) {
36319
- var sourceExtentWidth = opt_sourceExtentWidth || getWidth(projectionExtent);
36320
- worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / sourceExtentWidth);
36321
- }
36322
- return worldsAway;
36323
- }
36324
-
36325
- // node_modules/ol/proj.js
36326
- var showCoordinateWarning = true;
36327
- function disableCoordinateWarning(opt_disable) {
36328
- var hide = opt_disable === void 0 ? true : opt_disable;
36329
- showCoordinateWarning = !hide;
36330
- }
36331
- function cloneTransform(input, opt_output, opt_dimension) {
36332
- var output;
36333
- if (opt_output !== void 0) {
36334
- for (var i = 0, ii = input.length; i < ii; ++i) {
36335
- opt_output[i] = input[i];
36409
+ };
36410
+ Collection2.prototype.updateLength_ = function() {
36411
+ this.set(Property.LENGTH, this.array_.length);
36412
+ };
36413
+ Collection2.prototype.assertUnique_ = function(elem, opt_except) {
36414
+ for (var i = 0, ii = this.array_.length; i < ii; ++i) {
36415
+ if (this.array_[i] === elem && i !== opt_except) {
36416
+ throw new AssertionError_default(58);
36417
+ }
36336
36418
  }
36337
- output = opt_output;
36338
- } else {
36339
- output = input.slice();
36340
- }
36341
- return output;
36342
- }
36343
- function identityTransform(input, opt_output, opt_dimension) {
36344
- if (opt_output !== void 0 && input !== opt_output) {
36345
- for (var i = 0, ii = input.length; i < ii; ++i) {
36346
- opt_output[i] = input[i];
36419
+ };
36420
+ return Collection2;
36421
+ }(Object_default);
36422
+ var Collection_default = Collection;
36423
+
36424
+ // node_modules/ol/Feature.js
36425
+ var __extends10 = function() {
36426
+ var extendStatics = function(d, b) {
36427
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
36428
+ d2.__proto__ = b2;
36429
+ } || function(d2, b2) {
36430
+ for (var p in b2)
36431
+ if (Object.prototype.hasOwnProperty.call(b2, p))
36432
+ d2[p] = b2[p];
36433
+ };
36434
+ return extendStatics(d, b);
36435
+ };
36436
+ return function(d, b) {
36437
+ if (typeof b !== "function" && b !== null)
36438
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
36439
+ extendStatics(d, b);
36440
+ function __() {
36441
+ this.constructor = d;
36347
36442
  }
36348
- input = opt_output;
36349
- }
36350
- return input;
36351
- }
36352
- function addProjection(projection) {
36353
- add(projection.getCode(), projection);
36354
- add2(projection, projection, cloneTransform);
36355
- }
36356
- function addProjections(projections) {
36357
- projections.forEach(addProjection);
36358
- }
36359
- function get3(projectionLike) {
36360
- return typeof projectionLike === "string" ? get(projectionLike) : projectionLike || null;
36361
- }
36362
- function addEquivalentProjections(projections) {
36363
- addProjections(projections);
36364
- projections.forEach(function(source) {
36365
- projections.forEach(function(destination) {
36366
- if (source !== destination) {
36367
- add2(source, destination, cloneTransform);
36443
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36444
+ };
36445
+ }();
36446
+ var Feature = function(_super) {
36447
+ __extends10(Feature2, _super);
36448
+ function Feature2(opt_geometryOrProperties) {
36449
+ var _this = _super.call(this) || this;
36450
+ _this.on;
36451
+ _this.once;
36452
+ _this.un;
36453
+ _this.id_ = void 0;
36454
+ _this.geometryName_ = "geometry";
36455
+ _this.style_ = null;
36456
+ _this.styleFunction_ = void 0;
36457
+ _this.geometryChangeKey_ = null;
36458
+ _this.addChangeListener(_this.geometryName_, _this.handleGeometryChanged_);
36459
+ if (opt_geometryOrProperties) {
36460
+ if (typeof opt_geometryOrProperties.getSimplifiedGeometry === "function") {
36461
+ var geometry = opt_geometryOrProperties;
36462
+ _this.setGeometry(geometry);
36463
+ } else {
36464
+ var properties = opt_geometryOrProperties;
36465
+ _this.setProperties(properties);
36368
36466
  }
36369
- });
36370
- });
36371
- }
36372
- function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {
36373
- projections1.forEach(function(projection1) {
36374
- projections2.forEach(function(projection2) {
36375
- add2(projection1, projection2, forwardTransform);
36376
- add2(projection2, projection1, inverseTransform);
36377
- });
36378
- });
36379
- }
36380
- function fromLonLat(coordinate, opt_projection) {
36381
- disableCoordinateWarning();
36382
- return transform(coordinate, "EPSG:4326", opt_projection !== void 0 ? opt_projection : "EPSG:3857");
36383
- }
36384
- function toLonLat(coordinate, opt_projection) {
36385
- var lonLat = transform(coordinate, opt_projection !== void 0 ? opt_projection : "EPSG:3857", "EPSG:4326");
36386
- var lon = lonLat[0];
36387
- if (lon < -180 || lon > 180) {
36388
- lonLat[0] = modulo(lon + 180, 360) - 180;
36389
- }
36390
- return lonLat;
36391
- }
36392
- function equivalent(projection1, projection2) {
36393
- if (projection1 === projection2) {
36394
- return true;
36395
- }
36396
- var equalUnits = projection1.getUnits() === projection2.getUnits();
36397
- if (projection1.getCode() === projection2.getCode()) {
36398
- return equalUnits;
36399
- } else {
36400
- var transformFunc = getTransformFromProjections(projection1, projection2);
36401
- return transformFunc === cloneTransform && equalUnits;
36402
- }
36403
- }
36404
- function getTransformFromProjections(sourceProjection, destinationProjection) {
36405
- var sourceCode = sourceProjection.getCode();
36406
- var destinationCode = destinationProjection.getCode();
36407
- var transformFunc = get2(sourceCode, destinationCode);
36408
- if (!transformFunc) {
36409
- transformFunc = identityTransform;
36410
- }
36411
- return transformFunc;
36412
- }
36413
- function getTransform(source, destination) {
36414
- var sourceProjection = get3(source);
36415
- var destinationProjection = get3(destination);
36416
- return getTransformFromProjections(sourceProjection, destinationProjection);
36417
- }
36418
- function transform(coordinate, source, destination) {
36419
- var transformFunc = getTransform(source, destination);
36420
- return transformFunc(coordinate, void 0, coordinate.length);
36421
- }
36422
- function transformExtent(extent, source, destination, opt_stops) {
36423
- var transformFunc = getTransform(source, destination);
36424
- return applyTransform(extent, transformFunc, void 0, opt_stops);
36425
- }
36426
- var userProjection = null;
36427
- function getUserProjection() {
36428
- return userProjection;
36429
- }
36430
- function toUserCoordinate(coordinate, sourceProjection) {
36431
- if (!userProjection) {
36432
- return coordinate;
36467
+ }
36468
+ return _this;
36433
36469
  }
36434
- return transform(coordinate, sourceProjection, userProjection);
36435
- }
36436
- function fromUserCoordinate(coordinate, destProjection) {
36437
- if (!userProjection) {
36438
- if (showCoordinateWarning && !equals3(coordinate, [0, 0]) && coordinate[0] >= -180 && coordinate[0] <= 180 && coordinate[1] >= -90 && coordinate[1] <= 90) {
36439
- showCoordinateWarning = false;
36440
- console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.");
36470
+ Feature2.prototype.clone = function() {
36471
+ var clone3 = new Feature2(this.hasProperties() ? this.getProperties() : null);
36472
+ clone3.setGeometryName(this.getGeometryName());
36473
+ var geometry = this.getGeometry();
36474
+ if (geometry) {
36475
+ clone3.setGeometry(geometry.clone());
36476
+ }
36477
+ var style = this.getStyle();
36478
+ if (style) {
36479
+ clone3.setStyle(style);
36480
+ }
36481
+ return clone3;
36482
+ };
36483
+ Feature2.prototype.getGeometry = function() {
36484
+ return this.get(this.geometryName_);
36485
+ };
36486
+ Feature2.prototype.getId = function() {
36487
+ return this.id_;
36488
+ };
36489
+ Feature2.prototype.getGeometryName = function() {
36490
+ return this.geometryName_;
36491
+ };
36492
+ Feature2.prototype.getStyle = function() {
36493
+ return this.style_;
36494
+ };
36495
+ Feature2.prototype.getStyleFunction = function() {
36496
+ return this.styleFunction_;
36497
+ };
36498
+ Feature2.prototype.handleGeometryChange_ = function() {
36499
+ this.changed();
36500
+ };
36501
+ Feature2.prototype.handleGeometryChanged_ = function() {
36502
+ if (this.geometryChangeKey_) {
36503
+ unlistenByKey(this.geometryChangeKey_);
36504
+ this.geometryChangeKey_ = null;
36505
+ }
36506
+ var geometry = this.getGeometry();
36507
+ if (geometry) {
36508
+ this.geometryChangeKey_ = listen(geometry, EventType_default.CHANGE, this.handleGeometryChange_, this);
36509
+ }
36510
+ this.changed();
36511
+ };
36512
+ Feature2.prototype.setGeometry = function(geometry) {
36513
+ this.set(this.geometryName_, geometry);
36514
+ };
36515
+ Feature2.prototype.setStyle = function(opt_style) {
36516
+ this.style_ = opt_style;
36517
+ this.styleFunction_ = !opt_style ? void 0 : createStyleFunction(opt_style);
36518
+ this.changed();
36519
+ };
36520
+ Feature2.prototype.setId = function(id) {
36521
+ this.id_ = id;
36522
+ this.changed();
36523
+ };
36524
+ Feature2.prototype.setGeometryName = function(name) {
36525
+ this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);
36526
+ this.geometryName_ = name;
36527
+ this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);
36528
+ this.handleGeometryChanged_();
36529
+ };
36530
+ return Feature2;
36531
+ }(Object_default);
36532
+ function createStyleFunction(obj) {
36533
+ if (typeof obj === "function") {
36534
+ return obj;
36535
+ } else {
36536
+ var styles_1;
36537
+ if (Array.isArray(obj)) {
36538
+ styles_1 = obj;
36539
+ } else {
36540
+ assert(typeof obj.getZIndex === "function", 41);
36541
+ var style = obj;
36542
+ styles_1 = [style];
36441
36543
  }
36442
- return coordinate;
36443
- }
36444
- return transform(coordinate, userProjection, destProjection);
36445
- }
36446
- function toUserExtent(extent, sourceProjection) {
36447
- if (!userProjection) {
36448
- return extent;
36449
- }
36450
- return transformExtent(extent, sourceProjection, userProjection);
36451
- }
36452
- function fromUserExtent(extent, destProjection) {
36453
- if (!userProjection) {
36454
- return extent;
36455
- }
36456
- return transformExtent(extent, userProjection, destProjection);
36457
- }
36458
- function toUserResolution(resolution, sourceProjection) {
36459
- if (!userProjection) {
36460
- return resolution;
36544
+ return function() {
36545
+ return styles_1;
36546
+ };
36461
36547
  }
36462
- var sourceUnits = get3(sourceProjection).getUnits();
36463
- var userUnits = userProjection.getUnits();
36464
- return sourceUnits && userUnits ? resolution * METERS_PER_UNIT[sourceUnits] / METERS_PER_UNIT[userUnits] : resolution;
36465
- }
36466
- function addCommon() {
36467
- addEquivalentProjections(PROJECTIONS);
36468
- addEquivalentProjections(PROJECTIONS2);
36469
- addEquivalentTransforms(PROJECTIONS2, PROJECTIONS, fromEPSG4326, toEPSG4326);
36470
36548
  }
36471
- addCommon();
36549
+ var Feature_default = Feature;
36550
+
36551
+ // node_modules/ol/geom/GeometryLayout.js
36552
+ var GeometryLayout_default = {
36553
+ XY: "XY",
36554
+ XYZ: "XYZ",
36555
+ XYM: "XYM",
36556
+ XYZM: "XYZM"
36557
+ };
36472
36558
 
36473
36559
  // node_modules/ol/geom/flat/transform.js
36474
36560
  function transform2D(flatCoordinates, offset, end, stride, transform2, opt_dest) {
@@ -47342,11 +47428,9 @@ uniform ${i3} ${o3} u_${a3};
47342
47428
  }));
47343
47429
  });
47344
47430
  this.userHoverCallbacks.forEach((callback) => {
47345
- this.userHoverEventsKeys.push([
47346
- this.on("user:hover", ({ target: { features, layer, coordinate, event } }) => {
47347
- callback(features, layer, coordinate, event);
47348
- })
47349
- ]);
47431
+ this.userHoverEventsKeys.push(this.on("user:hover", ({ target: { features, layer, coordinate, event } }) => {
47432
+ callback(features, layer, coordinate, event);
47433
+ }));
47350
47434
  });
47351
47435
  }
47352
47436
  unlistenEvents() {
@@ -47358,19 +47442,26 @@ uniform ${i3} ${o3} u_${a3};
47358
47442
  onClick(callback) {
47359
47443
  this.userClickCallbacks.push(callback);
47360
47444
  this.activateUserInteractions();
47445
+ if (this.map) {
47446
+ this.listenEvents();
47447
+ }
47361
47448
  }
47362
47449
  onHover(callback) {
47363
47450
  this.userHoverCallbacks.push(callback);
47364
47451
  this.activateUserInteractions();
47452
+ if (this.map) {
47453
+ this.listenEvents();
47454
+ }
47365
47455
  }
47366
47456
  onUserClickCallback(evt) {
47457
+ const coordinate = evt.coordinate || fromLonLat(evt.lngLat.toArray());
47367
47458
  const emptyFeatureInfo = {
47368
47459
  features: [],
47369
47460
  layer: this,
47370
- coordinate: evt.coordinate || fromLonLat(evt.lngLat.toArray()),
47461
+ coordinate,
47371
47462
  event: evt
47372
47463
  };
47373
- return this.getFeatureInfoAtCoordinate(evt.coordinate).then((featureInfo) => {
47464
+ return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
47374
47465
  this.dispatchEvent({
47375
47466
  type: "user:click",
47376
47467
  target: featureInfo
@@ -47379,13 +47470,14 @@ uniform ${i3} ${o3} u_${a3};
47379
47470
  }).catch(() => emptyFeatureInfo);
47380
47471
  }
47381
47472
  onUserMoveCallback(evt) {
47473
+ const coordinate = evt.coordinate || fromLonLat(evt.lngLat.toArray());
47382
47474
  const emptyFeatureInfo = {
47383
47475
  features: [],
47384
47476
  layer: this,
47385
- coordinate: evt.coordinate || fromLonLat(evt.lngLat.toArray()),
47477
+ coordinate,
47386
47478
  event: evt
47387
47479
  };
47388
- return this.getFeatureInfoAtCoordinate(evt.coordinate).then((featureInfo) => {
47480
+ return this.getFeatureInfoAtCoordinate(coordinate).then((featureInfo) => {
47389
47481
  this.dispatchEvent({
47390
47482
  type: "user:hover",
47391
47483
  target: featureInfo
@@ -47690,6 +47782,7 @@ uniform ${i3} ${o3} u_${a3};
47690
47782
  this.routingLayer.olLayer.getSource().clear();
47691
47783
  this.viaPoints.forEach((viaPoint, idx) => this.drawViaPoint(viaPoint, idx, this.abortControllers[STOP_FETCH_ABORT_CONTROLLER_KEY]));
47692
47784
  return Promise.all(this.graphs.map(([graph], index) => {
47785
+ const { signal } = this.abortControllers[graph];
47693
47786
  return this.api.route({
47694
47787
  graph,
47695
47788
  via: `${formattedViaPoints.join("|")}`,
@@ -47699,7 +47792,7 @@ uniform ${i3} ${o3} u_${a3};
47699
47792
  "coord-radius": 100,
47700
47793
  "coord-punish": 1e3,
47701
47794
  ...this.routingApiParams
47702
- }, this.abortControllers[graph]).then((featureCollection) => {
47795
+ }, { signal }).then((featureCollection) => {
47703
47796
  this.segments = this.format.readFeatures(featureCollection);
47704
47797
  if (this.mot === "foot") {
47705
47798
  const uniqueVias = this.segments.reduce((resultVias, currentFeat) => {
@@ -48035,68 +48128,14 @@ uniform ${i3} ${o3} u_${a3};
48035
48128
 
48036
48129
  // src/ol/layers/MapboxLayer.js
48037
48130
  var import_mapbox_gl = __toESM(require_mapbox_gl());
48038
- var MapboxLayer = class extends Layer_default4 {
48131
+
48132
+ // src/common/mixins/MapboxLayerMixin.js
48133
+ var MapboxLayerMixin = (Base) => class extends Base {
48039
48134
  constructor(options = {}) {
48040
- const mbLayer = new Layer_default({
48135
+ super(options);
48136
+ this.olLayer = new Layer_default({
48041
48137
  source: new Source_default({}),
48042
- render: (frameState) => {
48043
- if (!this.map || !this.mbMap) {
48044
- return null;
48045
- }
48046
- let changed = false;
48047
- const canvas2 = this.mbMap.getCanvas();
48048
- const { viewState } = frameState;
48049
- const visible = this.olLayer.getVisible();
48050
- if (this.renderState.visible !== visible) {
48051
- canvas2.style.display = visible ? "block" : "none";
48052
- this.renderState.visible = visible;
48053
- canvas2.style.position = "absolute";
48054
- }
48055
- const opacity = this.olLayer.getOpacity();
48056
- if (this.renderState.opacity !== opacity) {
48057
- canvas2.style.opacity = opacity;
48058
- this.renderState.opacity = opacity;
48059
- }
48060
- const { rotation } = viewState;
48061
- if (this.renderState.rotation !== rotation) {
48062
- this.mbMap.rotateTo(-(rotation || 0) * 180 / Math.PI, {
48063
- animate: false
48064
- });
48065
- changed = true;
48066
- this.renderState.rotation = rotation;
48067
- }
48068
- if (this.renderState.zoom !== viewState.zoom || this.renderState.center[0] !== viewState.center[0] || this.renderState.center[1] !== viewState.center[1]) {
48069
- this.mbMap.jumpTo({
48070
- center: toLonLat(viewState.center),
48071
- zoom: viewState.zoom - 1,
48072
- animate: false
48073
- });
48074
- changed = true;
48075
- this.renderState.zoom = viewState.zoom;
48076
- this.renderState.center = viewState.center;
48077
- }
48078
- const size = this.map.getSize();
48079
- if (this.renderState.size[0] !== size[0] || this.renderState.size[1] !== size[1]) {
48080
- changed = true;
48081
- this.renderState.size = size;
48082
- }
48083
- if (this.mbMap && this.mbMap.style && this.mbMap.isStyleLoaded() && changed) {
48084
- try {
48085
- if (this.mbMap._frame) {
48086
- this.mbMap._frame.cancel();
48087
- this.mbMap._frame = null;
48088
- }
48089
- this.mbMap._render();
48090
- } catch (err) {
48091
- console.warn(err);
48092
- }
48093
- }
48094
- return this.mbMap.getContainer();
48095
- }
48096
- });
48097
- super({
48098
- ...options,
48099
- olLayer: mbLayer
48138
+ render: this.getOlLayerRender(this)
48100
48139
  });
48101
48140
  this.styleUrl = options.url;
48102
48141
  this.apiKey = options.apiKey;
@@ -48105,22 +48144,13 @@ uniform ${i3} ${o3} u_${a3};
48105
48144
  }
48106
48145
  attachToMap(map) {
48107
48146
  super.attachToMap(map);
48108
- if (!this.map || this.mbMap) {
48147
+ if (!this.map) {
48109
48148
  return;
48110
48149
  }
48111
48150
  this.format = new GeoJSON_default({
48112
48151
  featureProjection: this.map.getView().getProjection()
48113
48152
  });
48114
48153
  this.loadMbMap();
48115
- this.olListenersKeys.push(this.map.on("change:size", () => {
48116
- try {
48117
- if (this.mbMap) {
48118
- this.mbMap.resize();
48119
- }
48120
- } catch (err) {
48121
- console.warn(err);
48122
- }
48123
- }));
48124
48154
  }
48125
48155
  detachFromMap() {
48126
48156
  if (this.mbMap) {
@@ -48146,19 +48176,15 @@ uniform ${i3} ${o3} u_${a3};
48146
48176
  }));
48147
48177
  return;
48148
48178
  }
48149
- let [x, y] = this.map.getView().getCenter();
48150
- if (!x || !y) {
48151
- x = 0;
48152
- y = 0;
48153
- }
48154
48179
  const container = document.createElement("div");
48155
48180
  container.style.position = "absolute";
48156
48181
  container.style.width = "100%";
48157
48182
  container.style.height = "100%";
48158
48183
  if (!this.apiKey && !this.styleUrl.includes(this.apiKeyName)) {
48159
- console.warn(`No apiKey is defined for request to ${this.styleUrl}`);
48184
+ console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);
48160
48185
  }
48161
- this.mbMap = new import_mapbox_gl.Map({
48186
+ const Map3 = this.getMapboxMapClass();
48187
+ this.mbMap = new Map3({
48162
48188
  style: getUrlWithParams_default(this.styleUrl, {
48163
48189
  [this.apiKeyName]: this.apiKey
48164
48190
  }).toString(),
@@ -48168,37 +48194,18 @@ uniform ${i3} ${o3} u_${a3};
48168
48194
  attributionControl: false,
48169
48195
  ...this.options.mapOptions || {}
48170
48196
  });
48171
- this.renderState = {
48172
- center: [x, y],
48173
- zoom: null,
48174
- rotation: null,
48175
- visible: null,
48176
- opacity: null,
48177
- size: [0, 0]
48178
- };
48179
48197
  this.mbMap.once("load", () => {
48180
- this.mbMap.resize();
48181
48198
  this.loaded = true;
48182
- this.copyrights = getMapboxMapCopyrights_default(this.mbMap) || [];
48183
- this.olLayer.getSource()?.setAttributions(this.copyrights);
48184
48199
  this.dispatchEvent({
48185
48200
  type: "load",
48186
48201
  target: this
48187
48202
  });
48188
48203
  });
48189
- const mapboxCanvas = this.mbMap.getCanvas();
48190
- if (mapboxCanvas) {
48191
- if (this.options.tabIndex) {
48192
- mapboxCanvas.setAttribute("tabindex", this.options.tabIndex);
48193
- } else {
48194
- mapboxCanvas.removeAttribute("tabindex");
48195
- }
48196
- }
48197
48204
  this.mbMap.on("idle", this.updateAttribution);
48198
48205
  }
48199
48206
  updateAttribution(evt) {
48200
48207
  const newAttributions = getMapboxMapCopyrights_default(evt.target) || [];
48201
- if (this.copyrights.toString() !== newAttributions.toString()) {
48208
+ if (this.copyrights?.toString() !== newAttributions.toString()) {
48202
48209
  this.copyrights = newAttributions;
48203
48210
  this.olLayer.getSource()?.setAttributions(newAttributions);
48204
48211
  }
@@ -48228,140 +48235,74 @@ uniform ${i3} ${o3} u_${a3};
48228
48235
  coordinate
48229
48236
  });
48230
48237
  }
48231
- clone(newOptions) {
48232
- return new MapboxLayer({ ...this.options, ...newOptions });
48233
- }
48234
48238
  };
48239
+ var MapboxLayerMixin_default = MapboxLayerMixin;
48235
48240
 
48236
- // src/ol/layers/MaplibreLayer.js
48237
- var import_maplibre_gl = __toESM(require_maplibre_gl());
48238
- var MaplibreLayer = class extends Layer_default4 {
48239
- constructor(options = {}) {
48240
- const mbLayer = new Layer_default({
48241
- source: new Source_default({}),
48242
- render: (frameState) => {
48243
- if (!this.map || !this.mbMap) {
48244
- return null;
48245
- }
48246
- const canvas2 = this.mbMap.getCanvas();
48247
- const { viewState } = frameState;
48248
- const opacity = this.olLayer.getOpacity();
48249
- canvas2.style.opacity = opacity;
48250
- this.mbMap.jumpTo({
48251
- center: toLonLat(viewState.center),
48252
- zoom: viewState.zoom - 1,
48253
- bearing: toDegrees(-viewState.rotation),
48254
- animate: false
48255
- });
48256
- if (!canvas2.isConnected) {
48257
- this.map.render();
48258
- } else if (canvas2.width !== frameState.size[0] || canvas2.height !== frameState.size[1]) {
48259
- this.mbMap.resize();
48260
- }
48261
- this.mbMap.redraw();
48262
- return this.mbMap.getContainer();
48263
- }
48264
- });
48265
- super({
48266
- ...options,
48267
- olLayer: mbLayer
48268
- });
48269
- this.styleUrl = options.url;
48270
- this.apiKey = options.apiKey;
48271
- this.apiKeyName = options.apiKeyName || "key";
48272
- this.updateAttribution = this.updateAttribution.bind(this);
48273
- }
48241
+ // src/ol/layers/MapboxLayer.js
48242
+ var MapboxLayer = class extends MapboxLayerMixin_default(Layer_default4) {
48274
48243
  attachToMap(map) {
48275
48244
  super.attachToMap(map);
48276
- if (!this.map) {
48245
+ if (!this.map || this.mbMap) {
48277
48246
  return;
48278
48247
  }
48279
- this.format = new GeoJSON_default({
48280
- featureProjection: this.map.getView().getProjection()
48281
- });
48282
- this.loadMbMap();
48283
- }
48284
- detachFromMap() {
48285
- if (this.mbMap) {
48286
- this.mbMap.off("idle", this.updateAttribution);
48287
- this.mbMap.triggerRepaint = () => {
48288
- };
48289
- this.mbMap.remove();
48290
- this.mbMap = null;
48291
- }
48292
- this.loaded = false;
48293
- super.detachFromMap();
48248
+ this.olListenersKeys.push(this.map.on("change:size", () => {
48249
+ try {
48250
+ if (this.mbMap) {
48251
+ this.mbMap.resize();
48252
+ }
48253
+ } catch (err) {
48254
+ console.warn(err);
48255
+ }
48256
+ }));
48294
48257
  }
48295
48258
  loadMbMap() {
48296
- this.olListenersKeys.push(this.map.on("change:target", () => {
48297
- this.loadMbMap();
48298
- }));
48299
- if (!this.map.getTargetElement()) {
48300
- return;
48301
- }
48302
- if (!this.visible) {
48303
- this.olListenersKeys.push(this.once("change:visible", () => {
48304
- this.loadMbMap();
48305
- }));
48306
- return;
48307
- }
48308
- const container = document.createElement("div");
48309
- container.style.position = "absolute";
48310
- container.style.width = "100%";
48311
- container.style.height = "100%";
48312
- if (!this.apiKey && !this.styleUrl.includes(this.apiKeyName)) {
48313
- console.error(`No apiKey defined for mapbox layer with style url to ${this.url}`);
48259
+ let [x, y] = this.map.getView().getCenter();
48260
+ if (!x || !y) {
48261
+ x = 0;
48262
+ y = 0;
48314
48263
  }
48315
- this.mbMap = new import_maplibre_gl.Map({
48316
- style: getUrlWithParams_default(this.styleUrl, {
48317
- [this.apiKeyName]: this.apiKey
48318
- }).toString(),
48319
- container,
48320
- interactive: false,
48321
- trackResize: false,
48322
- attributionControl: false,
48323
- ...this.options.mapOptions || {}
48324
- });
48264
+ this.renderState = {
48265
+ center: [x, y],
48266
+ zoom: null,
48267
+ rotation: null,
48268
+ visible: null,
48269
+ opacity: null,
48270
+ size: [0, 0]
48271
+ };
48272
+ super.loadMbMap();
48325
48273
  this.mbMap.once("load", () => {
48326
- this.loaded = true;
48327
- this.dispatchEvent({
48328
- type: "load",
48329
- target: this
48330
- });
48274
+ this.mbMap.resize();
48275
+ this.copyrights = getMapboxMapCopyrights_default(this.mbMap) || [];
48276
+ this.olLayer.getSource()?.setAttributions(this.copyrights);
48331
48277
  });
48332
- this.mbMap.on("idle", this.updateAttribution);
48333
- }
48334
- updateAttribution(evt) {
48335
- const newAttributions = getMapboxMapCopyrights_default(evt.target) || [];
48336
- if (this.copyrights?.toString() !== newAttributions.toString()) {
48337
- this.copyrights = newAttributions;
48338
- this.olLayer.getSource()?.setAttributions(newAttributions);
48278
+ const mapboxCanvas = this.mbMap.getCanvas();
48279
+ if (mapboxCanvas) {
48280
+ if (this.options.tabIndex) {
48281
+ mapboxCanvas.setAttribute("tabindex", this.options.tabIndex);
48282
+ } else {
48283
+ mapboxCanvas.removeAttribute("tabindex");
48284
+ }
48339
48285
  }
48340
48286
  }
48341
- getFeatureInfoAtCoordinate(coordinate, options) {
48342
- if (!options || !this.format || !this.mbMap || !this.mbMap.isStyleLoaded()) {
48343
- return Promise.resolve({ coordinate, features: [], layer: this });
48344
- }
48345
- let pixel = coordinate && this.mbMap.project(toLonLat(coordinate));
48346
- if (this.hitTolerance) {
48347
- const { x, y } = pixel;
48348
- pixel = [
48349
- { x: x - this.hitTolerance, y: y - this.hitTolerance },
48350
- { x: x + this.hitTolerance, y: y + this.hitTolerance }
48351
- ];
48352
- }
48353
- const features = this.mbMap.queryRenderedFeatures(pixel, options).map((feature2) => {
48354
- const olFeature = this.format.readFeature(feature2);
48355
- if (olFeature) {
48356
- olFeature.set("mapboxFeature", feature2);
48357
- }
48358
- return olFeature;
48359
- });
48360
- return Promise.resolve({
48361
- layer: this,
48362
- features,
48363
- coordinate
48364
- });
48287
+ getOlLayerRender() {
48288
+ return getMapboxRender(this);
48289
+ }
48290
+ getMapboxMapClass() {
48291
+ return import_mapbox_gl.Map;
48292
+ }
48293
+ clone(newOptions) {
48294
+ return new MapboxLayer({ ...this.options, ...newOptions });
48295
+ }
48296
+ };
48297
+
48298
+ // src/ol/layers/MaplibreLayer.js
48299
+ var import_maplibre_gl = __toESM(require_maplibre_gl());
48300
+ var MaplibreLayer = class extends MapboxLayerMixin_default(Layer_default4) {
48301
+ getOlLayerRender() {
48302
+ return getMaplibreRender(this);
48303
+ }
48304
+ getMapboxMapClass() {
48305
+ return import_maplibre_gl.Map;
48365
48306
  }
48366
48307
  clone(newOptions) {
48367
48308
  return new MaplibreLayer({ ...this.options, ...newOptions });
@@ -49302,6 +49243,8 @@ uniform ${i3} ${o3} u_${a3};
49302
49243
  getHoursAndMinutes: () => getHoursAndMinutes,
49303
49244
  getLayersAsFlatArray: () => getLayersAsFlatArray_default,
49304
49245
  getMapboxMapCopyrights: () => getMapboxMapCopyrights_default,
49246
+ getMapboxRender: () => getMapboxRender,
49247
+ getMaplibreRender: () => getMaplibreRender,
49305
49248
  getTextCanvas: () => getTextCanvas,
49306
49249
  getUTCDateString: () => getUTCDateString,
49307
49250
  getUTCTimeString: () => getUTCTimeString,
@@ -49959,10 +49902,10 @@ uniform ${i3} ${o3} u_${a3};
49959
49902
  this.listeners.forEach((listener) => {
49960
49903
  unByKey(listener);
49961
49904
  });
49962
- if (this.map.getLayer(this.key)) {
49905
+ if (this.map.style && this.map.getLayer(this.key)) {
49963
49906
  this.map.removeLayer(this.key);
49964
49907
  }
49965
- if (this.map.getSource(this.key)) {
49908
+ if (this.map.style && this.map.getSource(this.key)) {
49966
49909
  this.map.removeSource(this.key);
49967
49910
  }
49968
49911
  }
@@ -50062,7 +50005,7 @@ uniform ${i3} ${o3} u_${a3};
50062
50005
  }
50063
50006
  renderTrajectoriesInternal(viewState, noInterpolate) {
50064
50007
  const render = super.renderTrajectoriesInternal(viewState, noInterpolate);
50065
- if (render) {
50008
+ if (render && this.map.style) {
50066
50009
  const extent = getSourceCoordinates(this.map, this.pixelRatio);
50067
50010
  const source = this.map.getSource(this.key);
50068
50011
  if (source) {