Files
Laca-City/frontend/node_modules/es-abstract/helpers/valueToFloat64Bytes.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

84 lines
2.9 KiB
JavaScript

'use strict';
var GetIntrinsic = require('get-intrinsic');
var $parseInt = GetIntrinsic('%parseInt%');
var $abs = require('math-intrinsics/abs');
var $floor = require('math-intrinsics/floor');
var isNegativeZero = require('math-intrinsics/isNegativeZero');
var callBound = require('call-bound');
var $strIndexOf = callBound('String.prototype.indexOf');
var $strSlice = callBound('String.prototype.slice');
var fractionToBitString = require('../helpers/fractionToBinaryString');
var intToBinString = require('../helpers/intToBinaryString');
var float64bias = 1023;
var elevenOnes = '11111111111';
var elevenZeroes = '00000000000';
var fiftyOneZeroes = elevenZeroes + elevenZeroes + elevenZeroes + elevenZeroes + '0000000';
// IEEE 754-1985
module.exports = function valueToFloat64Bytes(value, isLittleEndian) {
var signBit = value < 0 || isNegativeZero(value) ? '1' : '0';
var exponentBits;
var significandBits;
if (isNaN(value)) {
exponentBits = elevenOnes;
significandBits = '1' + fiftyOneZeroes;
} else if (!isFinite(value)) {
exponentBits = elevenOnes;
significandBits = '0' + fiftyOneZeroes;
} else if (value === 0) {
exponentBits = elevenZeroes;
significandBits = '0' + fiftyOneZeroes;
} else {
value = $abs(value); // eslint-disable-line no-param-reassign
// Isolate the integer part (digits before the decimal):
var integerPart = $floor(value);
var intBinString = intToBinString(integerPart); // bit string for integer part
var fracBinString = fractionToBitString(value - integerPart); // bit string for fractional part
var numberOfBits;
// find exponent needed to normalize integer+fractional parts
if (intBinString) {
exponentBits = intBinString.length - 1; // move the decimal to the left
} else {
var first1 = $strIndexOf(fracBinString, '1');
if (first1 > -1) {
numberOfBits = first1 + 1;
}
exponentBits = -numberOfBits; // move the decimal to the right
}
significandBits = intBinString + fracBinString;
if (exponentBits < 0) {
// subnormals
if (exponentBits <= -float64bias) {
numberOfBits = float64bias - 1; // limit number of removed bits
}
significandBits = $strSlice(significandBits, numberOfBits); // remove all leading 0s and the first 1 for normal values; for subnormals, remove up to `float64bias - 1` leading bits
} else {
significandBits = $strSlice(significandBits, 1); // remove the leading '1' (implicit/hidden bit)
}
exponentBits = $strSlice(elevenZeroes + intToBinString(exponentBits + float64bias), -11); // Convert the exponent to a bit string
significandBits = $strSlice(significandBits + fiftyOneZeroes + '0', 0, 52); // fill in any trailing zeros and ensure we have only 52 fraction bits
}
var bits = signBit + exponentBits + significandBits;
var rawBytes = [];
for (var i = 0; i < 8; i++) {
var targetIndex = isLittleEndian ? 8 - i - 1 : i;
rawBytes[targetIndex] = $parseInt($strSlice(bits, i * 8, (i + 1) * 8), 2);
}
return rawBytes;
};