1"use strict";(self.webpackChunkVanGoghBrabantNPWebsiteBundle=self.webpackChunkVanGoghBrabantNPWebsiteBundle||[]).push([[2685],{2685:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _hotwired_stimulus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2891);\n/* harmony import */ var _calculateDistance_module__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5471);\n\n\n\n/* stimulusFetch: 'lazy' */\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class extends _hotwired_stimulus__WEBPACK_IMPORTED_MODULE_0__/* .Controller */ .xI {\n static values = {\n from: String,\n to: String,\n longUnit: String,\n shortUnit: String,\n translations: Object\n };\n connect() {\n this.locale = document.documentElement.lang || 'en';\n this.updateDistance();\n }\n updateDistance() {\n if (!this.fromValue || !this.toValue) {\n return;\n }\n const [fromLat, fromLng] = this.fromValue.split(',').map(parseFloat);\n const [toLat, toLng] = this.toValue.split(',').map(parseFloat);\n const distanceKm = (0,_calculateDistance_module__WEBPACK_IMPORTED_MODULE_1__/* [\"default\"] */ .A)({\n latitude: fromLat,\n longitude: fromLng\n }, {\n latitude: toLat,\n longitude: toLng\n });\n let text;\n if (distanceKm === 0 && this.translationsValue[0]) {\n text = this.translationsValue[0];\n } else {\n const unit = distanceKm < 1 ? this.shortUnitValue : this.longUnitValue;\n const value = distanceKm < 1 ? (distanceKm * 1000).toFixed(0) : distanceKm.toFixed(1);\n const formattedValue = value.toLocaleString(this.locale);\n text = `${formattedValue}${unit} ${this.translationsValue.default}`;\n }\n this.element.textContent = text;\n }\n});\n\n//# sourceURL=webpack://VanGoghBrabantNPWebsiteBundle/./vendor/insiders/kunstmaan-application/kunstmaan-bundles/KunstmaanCoreBundle/Resources/ui/frontend/js/controllers/distance-between-controller.js?\n}")},5471:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("{/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction calculateDistance(pos1, pos2) {\n const toRad = value => value * Math.PI / 180;\n const deltaLat = toRad(pos2.latitude - pos1.latitude);\n const deltaLon = toRad(pos2.longitude - pos1.longitude);\n const a = Math.sin(deltaLat / 2) ** 2 + Math.cos(toRad(pos1.latitude)) * Math.cos(toRad(pos2.latitude)) * Math.sin(deltaLon / 2) ** 2;\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return 6371 * c; // Earth's radius in km\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (calculateDistance);\n\n//# sourceURL=webpack://VanGoghBrabantNPWebsiteBundle/./vendor/insiders/kunstmaan-application/kunstmaan-bundles/KunstmaanCoreBundle/Resources/ui/frontend/js/calculateDistance.module.js?\n}")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.