🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add SpinningGlobe component and update package dependencies
Bill Yang5db82660671f
diff --git a/docs/package-lock.json b/docs/package-lock.jsonindex 5079c9aa4..70074fa3d 100644--- a/docs/package-lock.json+++ b/docs/package-lock.json@@ -13,6 +13,7 @@"@icons-pack/react-simple-icons": "^13.8.0","@radix-ui/react-accordion": "^1.2.12","@radix-ui/react-slider": "^1.3.6",+ "@types/luxon": "^3.7.1","boring-avatars": "^2.0.4","class-variance-authority": "^0.7.1","clsx": "^2.1.1",@@ -22,6 +23,8 @@"fumadocs-ui": "16.0.3","lodash": "^4.17.21","lucide-react": "^0.548.0",+ "luxon": "^3.7.2",+ "mapbox-gl": "^3.16.0","mermaid": "^11.12.0","next": "16.0.0","next-themes": "^0.4.6",@@ -1646,6 +1649,58 @@"@jridgewell/sourcemap-codec": "^1.4.14"}},+ "node_modules/@mapbox/jsonlint-lines-primitives": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz",+ "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/@mapbox/mapbox-gl-supported": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-3.0.0.tgz",+ "integrity": "sha512-2XghOwu16ZwPJLOFVuIOaLbN0iKMn867evzXFyf0P22dqugezfJwLmdanAgU25ITvz1TvOfVP4jsDImlDJzcWg==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@mapbox/point-geometry": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-1.1.0.tgz",+ "integrity": "sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==",+ "license": "ISC"+ },+ "node_modules/@mapbox/tiny-sdf": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.7.tgz",+ "integrity": "sha512-25gQLQMcpivjOSA40g3gO6qgiFPDpWRoMfd+G/GoppPIeP6JDaMMkMrEJnMZhKyyS6iKwVt5YKu02vCUyJM3Ug==",+ "license": "BSD-2-Clause"+ },+ "node_modules/@mapbox/unitbezier": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz",+ "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==",+ "license": "BSD-2-Clause"+ },+ "node_modules/@mapbox/vector-tile": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-2.0.4.tgz",+ "integrity": "sha512-AkOLcbgGTdXScosBWwmmD7cDlvOjkg/DetGva26pIRiZPdeJYjYKarIlb4uxVzi6bwHO6EWH82eZ5Nuv4T5DUg==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "@mapbox/point-geometry": "~1.1.0",+ "@types/geojson": "^7946.0.16",+ "pbf": "^4.0.1"+ }+ },+ "node_modules/@mapbox/whoots-js": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz",+ "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==",+ "license": "ISC",+ "engines": {+ "node": ">=6.0.0"+ }+ },"node_modules/@mdx-js/mdx": {"version": "3.1.1","resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.1.tgz",@@ -3356,6 +3411,15 @@"integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==","license": "MIT"},+ "node_modules/@types/geojson-vt": {+ "version": "3.2.5",+ "resolved": "https://registry.npmjs.org/@types/geojson-vt/-/geojson-vt-3.2.5.tgz",+ "integrity": "sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==",+ "license": "MIT",+ "dependencies": {+ "@types/geojson": "*"+ }+ },"node_modules/@types/hast": {"version": "3.0.4","resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz",@@ -3386,6 +3450,18 @@"dev": true,"license": "MIT"},+ "node_modules/@types/luxon": {+ "version": "3.7.1",+ "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.7.1.tgz",+ "integrity": "sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg==",+ "license": "MIT"+ },+ "node_modules/@types/mapbox__point-geometry": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.4.tgz",+ "integrity": "sha512-mUWlSxAmYLfwnRBmgYV86tgYmMIICX4kza8YnE/eIlywGe2XoOxlpVnXWwir92xRLjwyarqwpu2EJKD2pk0IUA==",+ "license": "MIT"+ },"node_modules/@types/mdast": {"version": "4.0.4","resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",@@ -3417,6 +3493,12 @@"undici-types": "~7.16.0"}},+ "node_modules/@types/pbf": {+ "version": "3.0.5",+ "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz",+ "integrity": "sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA==",+ "license": "MIT"+ },"node_modules/@types/react": {"version": "19.2.6","resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.6.tgz",@@ -3437,6 +3519,15 @@"@types/react": "^19.2.0"}},+ "node_modules/@types/supercluster": {+ "version": "7.1.3",+ "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz",+ "integrity": "sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==",+ "license": "MIT",+ "dependencies": {+ "@types/geojson": "*"+ }+ },"node_modules/@types/trusted-types": {"version": "2.0.7","resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",@@ -4572,6 +4663,12 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/cheap-ruler": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/cheap-ruler/-/cheap-ruler-4.0.0.tgz",+ "integrity": "sha512-0BJa8f4t141BYKQyn9NSQt1PguFQXMXwZiA5shfoaBYHAb2fFk2RAX+tiWMoQU+Agtzt3mdt0JtuyshAXqZ+Vw==",+ "license": "ISC"+ },"node_modules/chevrotain": {"version": "11.0.3","resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz",@@ -4745,6 +4842,12 @@"node": ">= 8"}},+ "node_modules/csscolorparser": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz",+ "integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==",+ "license": "MIT"+ },"node_modules/cssesc": {"version": "3.0.0","resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",@@ -5487,6 +5590,12 @@"node": ">= 0.4"}},+ "node_modules/earcut": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.2.tgz",+ "integrity": "sha512-X7hshQbLyMJ/3RPhyObLARM2sNxxmRALLKx1+NVFFnQ9gKzmCrxm9+uLIAdBcvc8FNLpctqlQ2V6AE92Ol9UDQ==",+ "license": "ISC"+ },"node_modules/electron-to-chromium": {"version": "1.5.259","resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.259.tgz",@@ -6721,6 +6830,12 @@"node": ">=6.9.0"}},+ "node_modules/geojson-vt": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-4.0.2.tgz",+ "integrity": "sha512-AV9ROqlNqoZEIJGfm1ncNjEXfkz2hdFlZf0qkVfmkwdKa8vj7H16YUOT81rJw1rdFhyEDlN2Tds91p/glzbl5A==",+ "license": "ISC"+ },"node_modules/get-intrinsic": {"version": "1.3.0","resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",@@ -6806,6 +6921,12 @@"integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==","license": "ISC"},+ "node_modules/gl-matrix": {+ "version": "3.4.4",+ "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.4.tgz",+ "integrity": "sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==",+ "license": "MIT"+ },"node_modules/glob-parent": {"version": "6.0.2","resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",@@ -6876,6 +6997,12 @@"dev": true,"license": "MIT"},+ "node_modules/grid-index": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.1.0.tgz",+ "integrity": "sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==",+ "license": "ISC"+ },"node_modules/hachure-fill": {"version": "0.5.2","resolved": "https://registry.npmjs.org/hachure-fill/-/hachure-fill-0.5.2.tgz",@@ -7818,6 +7945,12 @@"node": ">= 12"}},+ "node_modules/kdbush": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",+ "integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==",+ "license": "ISC"+ },"node_modules/keyv": {"version": "4.5.4","resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",@@ -8249,6 +8382,15 @@"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"}},+ "node_modules/luxon": {+ "version": "3.7.2",+ "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz",+ "integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==",+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/magic-string": {"version": "0.30.21","resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",@@ -8259,6 +8401,45 @@"@jridgewell/sourcemap-codec": "^1.5.5"}},+ "node_modules/mapbox-gl": {+ "version": "3.16.0",+ "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.16.0.tgz",+ "integrity": "sha512-rluV1Zp/0oHf1Y9BV+nePRNnKyTdljko3E19CzO5rBqtQaNUYS0ePCMPRtxOuWRwSdKp3f9NWJkOCjemM8nmjw==",+ "license": "SEE LICENSE IN LICENSE.txt",+ "workspaces": [+ "src/style-spec",+ "test/build/typings"+ ],+ "dependencies": {+ "@mapbox/jsonlint-lines-primitives": "^2.0.2",+ "@mapbox/mapbox-gl-supported": "^3.0.0",+ "@mapbox/point-geometry": "^1.1.0",+ "@mapbox/tiny-sdf": "^2.0.6",+ "@mapbox/unitbezier": "^0.0.1",+ "@mapbox/vector-tile": "^2.0.4",+ "@mapbox/whoots-js": "^3.1.0",+ "@types/geojson": "^7946.0.16",+ "@types/geojson-vt": "^3.2.5",+ "@types/mapbox__point-geometry": "^0.1.4",+ "@types/pbf": "^3.0.5",+ "@types/supercluster": "^7.1.3",+ "cheap-ruler": "^4.0.0",+ "csscolorparser": "~1.0.3",+ "earcut": "^3.0.1",+ "geojson-vt": "^4.0.2",+ "gl-matrix": "^3.4.4",+ "grid-index": "^1.1.0",+ "kdbush": "^4.0.2",+ "martinez-polygon-clipping": "^0.7.4",+ "murmurhash-js": "^1.0.0",+ "pbf": "^4.0.1",+ "potpack": "^2.0.0",+ "quickselect": "^3.0.0",+ "serialize-to-js": "^3.1.2",+ "supercluster": "^8.0.1",+ "tinyqueue": "^3.0.0"+ }+ },"node_modules/markdown-extensions": {"version": "2.0.0","resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz",@@ -8293,6 +8474,29 @@"node": ">= 20"}},+ "node_modules/martinez-polygon-clipping": {+ "version": "0.7.4",+ "resolved": "https://registry.npmjs.org/martinez-polygon-clipping/-/martinez-polygon-clipping-0.7.4.tgz",+ "integrity": "sha512-jBEwrKtA0jTagUZj2bnmb4Yg2s4KnJGRePStgI7bAVjtcipKiF39R4LZ2V/UT61jMYWrTcBhPazexeqd6JAVtw==",+ "license": "MIT",+ "dependencies": {+ "robust-predicates": "^2.0.4",+ "splaytree": "^0.1.4",+ "tinyqueue": "^1.2.0"+ }+ },+ "node_modules/martinez-polygon-clipping/node_modules/robust-predicates": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-2.0.4.tgz",+ "integrity": "sha512-l4NwboJM74Ilm4VKfbAtFeGq7aEjWL+5kVFcmgFA2MrdnQWx9iE/tUGvxY5HyMI7o/WpSIUFLbC5fbeaHgSCYg==",+ "license": "Unlicense"+ },+ "node_modules/martinez-polygon-clipping/node_modules/tinyqueue": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-1.2.3.tgz",+ "integrity": "sha512-Qz9RgWuO9l8lT+Y9xvbzhPT2efIUIFd69N7eF7tJ9lnQl0iLj1M7peK7IoUGZL9DJHw9XftqLreccfxcQgYLxA==",+ "license": "ISC"+ },"node_modules/math-intrinsics": {"version": "1.1.0","resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",@@ -9442,6 +9646,12 @@"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},+ "node_modules/murmurhash-js": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz",+ "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==",+ "license": "MIT"+ },"node_modules/nanoid": {"version": "3.3.11","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",@@ -9908,6 +10118,18 @@"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==","license": "MIT"},+ "node_modules/pbf": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/pbf/-/pbf-4.0.1.tgz",+ "integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "resolve-protobuf-schema": "^2.1.0"+ },+ "bin": {+ "pbf": "bin/pbf"+ }+ },"node_modules/picocolors": {"version": "1.1.1","resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",@@ -10005,6 +10227,12 @@"node": ">=4"}},+ "node_modules/potpack": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/potpack/-/potpack-2.1.0.tgz",+ "integrity": "sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==",+ "license": "ISC"+ },"node_modules/prelude-ls": {"version": "1.2.1","resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",@@ -10037,6 +10265,12 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/protocol-buffers-schema": {+ "version": "3.6.0",+ "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",+ "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==",+ "license": "MIT"+ },"node_modules/punycode": {"version": "2.3.1","resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",@@ -10084,6 +10318,12 @@],"license": "MIT"},+ "node_modules/quickselect": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz",+ "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==",+ "license": "ISC"+ },"node_modules/react": {"version": "19.2.0","resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz",@@ -10526,6 +10766,15 @@"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"}},+ "node_modules/resolve-protobuf-schema": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz",+ "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==",+ "license": "MIT",+ "dependencies": {+ "protocol-buffers-schema": "^3.3.1"+ }+ },"node_modules/reusify": {"version": "1.1.0","resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",@@ -10671,6 +10920,15 @@"semver": "bin/semver.js"}},+ "node_modules/serialize-to-js": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/serialize-to-js/-/serialize-to-js-3.1.2.tgz",+ "integrity": "sha512-owllqNuDDEimQat7EPG0tH7JjO090xKNzUtYz6X+Sk2BXDnOCilDdNLwjWeFywG9xkJul1ULvtUQa9O4pUaY0w==",+ "license": "MIT",+ "engines": {+ "node": ">=4.0.0"+ }+ },"node_modules/set-function-length": {"version": "1.2.2","resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",@@ -10921,6 +11179,12 @@"url": "https://github.com/sponsors/wooorm"}},+ "node_modules/splaytree": {+ "version": "0.1.4",+ "resolved": "https://registry.npmjs.org/splaytree/-/splaytree-0.1.4.tgz",+ "integrity": "sha512-D50hKrjZgBzqD3FT2Ek53f2dcDLAQT8SSGrzj3vidNH5ISRgceeGVJ2dQIthKOuayqFXfFjXheHNo4bbt9LhRQ==",+ "license": "MIT"+ },"node_modules/stable-hash": {"version": "0.0.5","resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz",@@ -11139,6 +11403,15 @@"integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==","license": "MIT"},+ "node_modules/supercluster": {+ "version": "8.0.1",+ "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz",+ "integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==",+ "license": "ISC",+ "dependencies": {+ "kdbush": "^4.0.2"+ }+ },"node_modules/supports-color": {"version": "7.2.0","resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",@@ -11234,6 +11507,12 @@"url": "https://github.com/sponsors/SuperchupuDev"}},+ "node_modules/tinyqueue": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-3.0.0.tgz",+ "integrity": "sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==",+ "license": "ISC"+ },"node_modules/to-regex-range": {"version": "5.0.1","resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",diff --git a/docs/package.json b/docs/package.jsonindex e1249b609..52eac318e 100644--- a/docs/package.json+++ b/docs/package.json@@ -13,6 +13,7 @@"@icons-pack/react-simple-icons": "^13.8.0","@radix-ui/react-accordion": "^1.2.12","@radix-ui/react-slider": "^1.3.6",+ "@types/luxon": "^3.7.1","boring-avatars": "^2.0.4","class-variance-authority": "^0.7.1","clsx": "^2.1.1",@@ -22,6 +23,8 @@"fumadocs-ui": "16.0.3","lodash": "^4.17.21","lucide-react": "^0.548.0",+ "luxon": "^3.7.2",+ "mapbox-gl": "^3.16.0","mermaid": "^11.12.0","next": "16.0.0","next-themes": "^0.4.6",diff --git a/docs/src/app/(home)/page.tsx b/docs/src/app/(home)/page.tsxindex 44fae6fd6..00016fd07 100644--- a/docs/src/app/(home)/page.tsx+++ b/docs/src/app/(home)/page.tsx@@ -15,6 +15,7 @@ import { RealTimeAnalytics } from "../../components/Cards/RealTimeAnalytics";import { SessionReplay } from "../../components/Cards/SessionReplay";import { UserSessions } from "../../components/Cards/UserSessions";import { DEFAULT_EVENT_LIMIT } from "../../lib/const";+import { SpinningGlobe } from "@/components/SpinningGlobe";const tilt_wrap = Tilt_Warp({subsets: ["latin"],@@ -25,14 +26,14 @@ const faqSchema = {"@context": "https://schema.org","@type": "FAQPage",mainEntity: [- // {- // "@type": "Question",- // name: "Is Rybbit GDPR and CCPA compliant?",- // acceptedAnswer: {- // "@type": "Answer",- // text: "Yes, Rybbit is fully compliant with GDPR, CCPA, and other privacy regulations. We don't use cookies or collect any personal data that could identify your users. We salt user IDs daily to ensure users are not fingerprinted. You will not need to display a cookie consent banner to your users.",- // },- // },+ {+ "@type": "Question",+ name: "Is Rybbit GDPR and CCPA compliant?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Yes, Rybbit is fully compliant with GDPR, CCPA, and other privacy regulations. We don't use cookies or collect any personal data that could identify your users. We salt user IDs daily to ensure users are not fingerprinted. You will not need to display a cookie consent banner to your users.",+ },+ },{"@type": "Question",name: "How does Rybbit compare to Google Analytics?",@@ -329,6 +330,7 @@ export default function HomePage() {</div>{/* </div> */}</section>+<section className="py-14 md:py-20 w-full max-w-6xl px-4"><div className="text-center mb-10 md:mb-16"><SectionBadge className="mb-4"> Analytics Reimagined</SectionBadge>@@ -345,6 +347,21 @@ export default function HomePage() {</div></section>+ {/* Real-Time Globe Section */}+ <section className="py-14 md:py-20 w-full max-w-6xl">+ <div className="text-center mb-10 md:mb-16 px-4">+ <SectionBadge className="mb-4">Real-Time Insights</SectionBadge>+ <h2 className="text-3xl md:text-5xl font-bold tracking-tight">See Your Users Around the World</h2>+ <p className="mt-4 text-base md:text-xl text-neutral-600 dark:text-neutral-300 max-w-2xl mx-auto font-light">+ Watch real-time visitor activity across the globe. Every dot represents a real user exploring your site+ right now.+ </p>+ </div>+ <div className="relative h-[420px] md:h-[700px] max-w-[100vw] mx-auto rounded-2xl">+ <SpinningGlobe />+ </div>+ </section>+<Integrations />{/* Testimonial Section */}<section className="py-10 md:py-16 w-full">@@ -384,7 +401,7 @@ export default function HomePage() {<div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden"><Accordion type="single" collapsible className="w-full">- {/* <AccordionItem value="item-1" className="border-b border-neutral-800/50">+ <AccordionItem value="item-1" className="border-b border-neutral-800/50"><AccordionTrigger className="px-6 py-4 text-base md:text-lg font-medium hover:text-emerald-400 transition-colors">Is Rybbit GDPR and CCPA compliant?</AccordionTrigger>@@ -394,7 +411,7 @@ export default function HomePage() {ensure users are not fingerprinted. You will not need to display a cookie consent banner to yourusers.</AccordionContent>- </AccordionItem> */}+ </AccordionItem><AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50"><AccordionTrigger className="px-6 py-4 text-base md:text-lg font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">@@ -549,11 +566,6 @@ export default function HomePage() {>Get started</TrackedButton>- {/* <Link href="https://docs.tomato.gg" className="w-full sm:w-auto">- <button className="w-full sm:w-auto bg-neutral-800 hover:bg-neutral-700 text-white font-medium px-6 md:px-8 py-3 md:py-4 rounded-lg border border-neutral-600 transform hover:-translate-y-0.5 transition-all duration-200 hover:border-neutral-400 focus:outline-none focus:ring-2 focus:ring-neutral-400 focus:ring-opacity-50">- View Documentation- </button>- </Link> */}</div><p className="text-neutral-500 dark:text-neutral-400 text-xs md:text-sm flex items-center justify-center gap-2">diff --git a/docs/src/components/SpinningGlobe.tsx b/docs/src/components/SpinningGlobe.tsxnew file mode 100644index 000000000..908b84318--- /dev/null+++ b/docs/src/components/SpinningGlobe.tsx@@ -0,0 +1,1036 @@+"use client";++import { isNil, round, throttle } from "lodash";+import mapboxgl from "mapbox-gl";+import "mapbox-gl/dist/mapbox-gl.css";+import { useEffect, useRef, useState } from "react";+import BoringAvatar from "boring-avatars";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import * as CountryFlags from "country-flag-icons/react/3x2";+import {+ Monitor,+ Smartphone,+ Link,+ Search,+ ExternalLink,+ Users,+ Mail,+ HelpCircle,+ DollarSign,+ Video,+ Handshake,+ FileText,+ ShoppingCart,+ Calendar,+ Headphones,+ Eye,+ MousePointerClick,+} from "lucide-react";+import { DateTime } from "luxon";++// Avatar colors from client+const AVATAR_COLORS = [+ "#ec4899",+ "#be185d",+ "#f97316",+ "#c2410c",+ "#eab308",+ "#a16207",+ "#10b981",+ "#059669",+ "#14b8a6",+ "#0d9488",+ "#06b6d4",+ "#0e7490",+ "#3b82f6",+ "#1d4ed8",+ "#6366f1",+ "#8b5cf6",+ "#475569",+ "#6b7280",+ "#9ca3af",+ "#d1d5db",+];++// Session type (full version for tooltip)+type Session = {+ session_id: string;+ user_id: string;+ country: string;+ region: string;+ city: string;+ language: string;+ device_type: string;+ browser: string;+ browser_version: string;+ operating_system: string;+ operating_system_version: string;+ screen_width: number;+ screen_height: number;+ referrer: string;+ channel: string;+ hostname: string;+ page_title: string;+ session_end: string;+ session_start: string;+ session_duration: number;+ entry_page: string;+ exit_page: string;+ pageviews: number;+ events: number;+ lat: number;+ lon: number;+};++type SessionsResponse = Session[];++// Constants+const SOURCE_ID = "demo-sessions";+const CLUSTER_LAYER_ID = "demo-clusters";+const CLUSTER_COUNT_LAYER_ID = "demo-cluster-count";+const UNCLUSTERED_LAYER_ID = "demo-unclustered-point";+const CLUSTER_MAX_ZOOM = 11;+const CLUSTER_RADIUS = 25;+const MIN_CLUSTER_SIZE = 20;+const CLUSTERING_THRESHOLD = 500;+const SPREAD_START_ZOOM = 8;+const SPREAD_RADIUS_DEGREES = 0.006;++// Spin configuration+const SECONDS_PER_REVOLUTION = 120;+const MAX_SPIN_ZOOM = 5;+const SLOW_SPIN_ZOOM = 3;++// Locale detection+const userLocale = typeof navigator !== "undefined" ? navigator.language : "en-US";+const hour12 = (() => {+ try {+ const resolved = new Intl.DateTimeFormat(userLocale, { hour: "numeric" }).resolvedOptions();+ return resolved.hourCycle === "h12";+ } catch {+ return true;+ }+})();++// Name generation (simplified - using colors and animals)+const colors = [+ "Red",+ "Blue",+ "Green",+ "Yellow",+ "Purple",+ "Orange",+ "Pink",+ "Cyan",+ "Teal",+ "Indigo",+ "Amber",+ "Lime",+ "Rose",+ "Sky",+ "Violet",+];+const animals = [+ "Fox",+ "Bear",+ "Wolf",+ "Eagle",+ "Hawk",+ "Owl",+ "Deer",+ "Lion",+ "Tiger",+ "Panda",+ "Koala",+ "Dolphin",+ "Penguin",+ "Rabbit",+ "Falcon",+];++function generateName(userId: string): string {+ const hash = hashStringToNumber(userId);+ const colorIndex = hash % colors.length;+ const animalIndex = Math.floor(hash / colors.length) % animals.length;+ return `${colors[colorIndex]} ${animals[animalIndex]}`;+}++function generateAvatarSVG(userId: string, size: number): string {+ const avatarElement = createElement(BoringAvatar, {+ size,+ name: userId,+ variant: "beam",+ colors: AVATAR_COLORS,+ });+ return renderToStaticMarkup(avatarElement);+}++// Hash function for deterministic spreading+function hashStringToNumber(str: string): number {+ let hash = 0;+ for (let i = 0; i < str.length; i++) {+ const char = str.charCodeAt(i);+ hash = (hash << 5) - hash + char;+ hash = hash & hash;+ }+ return Math.abs(hash);+}++function seededRandom(seed: number): number {+ const x = Math.sin(seed) * 10000;+ return x - Math.floor(x);+}++// Render country flag+function renderCountryFlag(countryCode: string): string {+ if (!countryCode || countryCode.length !== 2) return "";+ const FlagComponent = CountryFlags[countryCode.toUpperCase() as keyof typeof CountryFlags];+ if (!FlagComponent) return "";+ const flagElement = createElement(FlagComponent, { className: "w-4 h-3 inline-block" });+ return renderToStaticMarkup(flagElement);+}++// Render device icon+function renderDeviceIcon(deviceType: string): string {+ const type = deviceType?.toLowerCase() || "";+ const Icon = type.includes("mobile") || type.includes("tablet") ? Smartphone : Monitor;+ const iconElement = createElement(Icon, { size: 14, className: "inline-block" });+ return renderToStaticMarkup(iconElement);+}++// Get channel icon component+function getChannelIconComponent(channel: string) {+ switch (channel) {+ case "Direct":+ return Link;+ case "Organic Search":+ return Search;+ case "Referral":+ return ExternalLink;+ case "Organic Social":+ return Users;+ case "Email":+ return Mail;+ case "Unknown":+ return HelpCircle;+ case "Paid Search":+ return Search;+ case "Paid Unknown":+ return DollarSign;+ case "Paid Social":+ return Users;+ case "Display":+ return Monitor;+ case "Organic Video":+ return Video;+ case "Affiliate":+ return Handshake;+ case "Content":+ return FileText;+ case "Organic Shopping":+ return ShoppingCart;+ case "Event":+ return Calendar;+ case "Audio":+ return Headphones;+ default:+ return null;+ }+}++// Render channel icon+function renderChannelIcon(channel: string): string {+ const IconComponent = getChannelIconComponent(channel);+ if (!IconComponent) return "";+ const iconElement = createElement(IconComponent, { size: 14, className: "inline-block" });+ return renderToStaticMarkup(iconElement);+}++// Browser and OS icon paths+const BROWSER_TO_LOGO: Record<string, string> = {+ Chrome: "Chrome.svg",+ "Mobile Chrome": "Chrome.svg",+ Firefox: "Firefox.svg",+ "Mobile Firefox": "Firefox.svg",+ Safari: "Safari.svg",+ "Mobile Safari": "Safari.svg",+ Edge: "Edge.svg",+ Opera: "Opera.svg",+ Brave: "Brave.svg",+};++const OS_TO_LOGO: Record<string, string> = {+ Windows: "Windows.svg",+ Android: "Android.svg",+ android: "Android.svg",+ Linux: "Tux.svg",+ macOS: "macOS.svg",+ iOS: "Apple.svg",+ "Chrome OS": "Chrome.svg",+};++function getBrowserIconPath(browser: string): string {+ return BROWSER_TO_LOGO[browser] ? `https://app.rybbit.io/browsers/${BROWSER_TO_LOGO[browser]}` : "";+}++function getOSIconPath(os: string): string {+ return OS_TO_LOGO[os] ? `https://app.rybbit.io/operating-systems/${OS_TO_LOGO[os]}` : "";+}++// Duration formatting+function formatShortDuration(seconds: number): string {+ const mins = Math.floor(seconds / 60);+ const secs = Math.round(seconds % 60);+ if (mins > 0) {+ return secs > 0 ? `${mins}m ${secs}s` : `${mins}m`;+ }+ return `${secs}s`;+}++// Extract domain from referrer+function extractDomain(url: string): string | null {+ try {+ if (!url || url === "direct") return null;+ if (url.startsWith("android-app://")) {+ const match = url.match(/android-app:\/\/([^/]+)/);+ return match ? match[1] : null;+ }+ const urlObj = new URL(url);+ return urlObj.hostname;+ } catch {+ return null;+ }+}++// Get display name for common sites+function getDisplayName(hostname: string): string {+ if (hostname.startsWith("google.") || hostname.startsWith("www.google.")) return "Google";+ const commonSites: Record<string, string> = {+ "bing.com": "Bing",+ "www.bing.com": "Bing",+ "facebook.com": "Facebook",+ "www.facebook.com": "Facebook",+ "instagram.com": "Instagram",+ "www.instagram.com": "Instagram",+ "youtube.com": "YouTube",+ "www.youtube.com": "YouTube",+ "reddit.com": "Reddit",+ "www.reddit.com": "Reddit",+ "twitter.com": "Twitter",+ "x.com": "X",+ "t.co": "X",+ "linkedin.com": "LinkedIn",+ "www.linkedin.com": "LinkedIn",+ "github.com": "GitHub",+ "duckduckgo.com": "DuckDuckGo",+ "news.ycombinator.com": "Hacker News",+ };+ return commonSites[hostname] || hostname;+}++// Build tooltip HTML+function buildTooltipHTML(session: Session): string {+ const avatarSVG = generateAvatarSVG(session.user_id, 36);+ const countryCode = session.country?.length === 2 ? session.country : "";+ const flagSVG = renderCountryFlag(countryCode);+ const deviceIconSVG = renderDeviceIcon(session.device_type || "");+ const browserIconPath = getBrowserIconPath(session.browser || "");+ const osIconPath = getOSIconPath(session.operating_system || "");+ const durationDisplay = formatShortDuration(session.session_duration || 0);++ const startTime = DateTime.fromSQL(session.session_start, { zone: "utc" })+ .setLocale(userLocale)+ .toLocal()+ .toFormat(hour12 ? "MMM d, h:mm a" : "dd MMM, HH:mm");++ const pageviewIconSVG = renderToStaticMarkup(+ createElement(Eye, { size: 14, className: "inline-block text-blue-400" })+ );+ const eventIconSVG = renderToStaticMarkup(+ createElement(MousePointerClick, { size: 14, className: "inline-block text-amber-400" })+ );++ const domain = extractDomain(session.referrer);+ let referrerIconSVG = "";+ let referrerText = "";++ if (domain) {+ referrerText = getDisplayName(domain);+ referrerIconSVG = renderChannelIcon(session.channel);+ } else {+ referrerText = session.channel || "Direct";+ referrerIconSVG = renderChannelIcon(session.channel || "Direct");+ }++ const name = generateName(session.user_id);++ return `+ <div class="globe-tooltip-content">+ <div class="tooltip-header">+ <div class="tooltip-avatar">+ ${avatarSVG}+ </div>+ <div class="tooltip-info">+ <h3 class="tooltip-name">${name}</h3>+ <div class="tooltip-location">+ ${flagSVG}+ <span>${session.city || "Unknown"}, ${session.country || "Unknown"}</span>+ </div>+ </div>+ </div>+ <div class="tooltip-stats">+ ${+ browserIconPath+ ? `<img src="${browserIconPath}" alt="${session.browser}" title="${session.browser}" class="tooltip-icon" />`+ : ""+ }+ ${+ osIconPath+ ? `<img src="${osIconPath}" alt="${session.operating_system}" title="${session.operating_system}" class="tooltip-icon" />`+ : ""+ }+ <span class="tooltip-device" title="${session.device_type}">${deviceIconSVG}</span>+ <span class="tooltip-badge">+ ${pageviewIconSVG}+ <span>${session.pageviews || 0}</span>+ </span>+ <span class="tooltip-badge">+ ${eventIconSVG}+ <span>${session.events || 0}</span>+ </span>+ </div>+ <div class="tooltip-channel">+ <span class="tooltip-badge">+ ${referrerIconSVG}+ <span>${referrerText}</span>+ </span>+ </div>+ <div class="tooltip-footer">+ <span>${startTime}</span>+ <span class="tooltip-duration">${durationDisplay}</span>+ </div>+ </div>+ `;+}++function spreadOverlappingPoints(sessions: SessionsResponse, zoom: number): Map<string, [number, number]> {+ const coordinateMap = new Map<string, [number, number]>();++ if (zoom < SPREAD_START_ZOOM) {+ return coordinateMap;+ }++ const spreadIntensity = Math.min((zoom - SPREAD_START_ZOOM) / 6, 1);+ const spreadRadius = SPREAD_RADIUS_DEGREES * spreadIntensity;++ const locationGroups = new Map<string, SessionsResponse>();++ sessions.forEach(session => {+ if (isNil(session.lat) || isNil(session.lon)) return;++ const roundedLon = round(session.lon, 4);+ const roundedLat = round(session.lat, 4);+ const key = `${roundedLat},${roundedLon}`;++ if (!locationGroups.has(key)) {+ locationGroups.set(key, []);+ }+ locationGroups.get(key)!.push(session);+ });++ locationGroups.forEach((group, key) => {+ if (group.length === 1) {+ const session = group[0];+ coordinateMap.set(session.session_id, [round(session.lon, 4), round(session.lat, 4)]);+ } else {+ const [latStr, lonStr] = key.split(",");+ const baseLat = parseFloat(latStr);+ const baseLon = parseFloat(lonStr);++ group.forEach(session => {+ const seed = hashStringToNumber(session.session_id);+ const random1 = seededRandom(seed);+ const random2 = seededRandom(seed + 1);+ const angle = random1 * 2 * Math.PI;+ const radius = Math.sqrt(random2) * spreadRadius;+ const latRad = baseLat * (Math.PI / 180);+ const lonAdjustment = Math.cos(latRad);+ const offsetLat = Math.sin(angle) * radius;+ const offsetLon = (Math.cos(angle) * radius) / lonAdjustment;++ coordinateMap.set(session.session_id, [baseLon + offsetLon, baseLat + offsetLat]);+ });+ }+ });++ return coordinateMap;+}++type MarkerData = {+ marker: mapboxgl.Marker;+ element: HTMLDivElement;+ session: Session;+};++// CSS for tooltip styling+const tooltipStyles = `+ .globe-tooltip .mapboxgl-popup-content {+ background-color: rgb(23, 23, 23);+ border: 1px solid rgb(64, 64, 64);+ border-radius: 8px;+ padding: 0;+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);+ }+ .globe-tooltip .mapboxgl-popup-tip {+ border-top-color: rgb(23, 23, 23);+ }+ .globe-tooltip .mapboxgl-popup-close-button {+ display: none;+ }+ .globe-tooltip-content {+ display: flex;+ flex-direction: column;+ gap: 10px;+ padding: 12px;+ min-width: 220px;+ color: white;+ font-size: 13px;+ }+ .tooltip-header {+ display: flex;+ align-items: flex-start;+ gap: 10px;+ }+ .tooltip-avatar {+ flex-shrink: 0;+ width: 36px;+ height: 36px;+ border-radius: 50%;+ overflow: hidden;+ }+ .tooltip-info {+ flex: 1;+ min-width: 0;+ }+ .tooltip-name {+ font-size: 14px;+ font-weight: 600;+ color: white;+ margin: 0;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+ .tooltip-location {+ display: flex;+ align-items: center;+ gap: 4px;+ font-size: 12px;+ color: rgb(163, 163, 163);+ margin-top: 2px;+ }+ .tooltip-stats {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 6px;+ }+ .tooltip-icon {+ width: 16px;+ height: 16px;+ }+ .tooltip-device {+ display: flex;+ align-items: center;+ color: rgb(163, 163, 163);+ }+ .tooltip-badge {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ padding: 2px 8px;+ border-radius: 6px;+ background-color: rgb(38, 38, 38);+ color: rgb(212, 212, 212);+ font-size: 12px;+ }+ .tooltip-channel {+ display: flex;+ align-items: center;+ gap: 6px;+ }+ .tooltip-footer {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+ font-size: 12px;+ color: rgb(115, 115, 115);+ padding-top: 6px;+ border-top: 1px solid rgb(64, 64, 64);+ }+ .tooltip-duration {+ color: rgb(229, 229, 229);+ }+`;++export function SpinningGlobe() {+ const containerRef = useRef<HTMLDivElement>(null);+ const mapRef = useRef<mapboxgl.Map | null>(null);+ const markersMapRef = useRef<Map<string, MarkerData>>(new Map());+ const popupRef = useRef<mapboxgl.Popup | null>(null);+ const isUserInteractingRef = useRef(false);+ const [mapLoaded, setMapLoaded] = useState(false);+ const [sessions, setSessions] = useState<SessionsResponse>([]);++ const mapboxToken = process.env.NEXT_PUBLIC_MAPBOX_TOKEN;++ // Inject tooltip styles+ useEffect(() => {+ const styleId = "globe-tooltip-styles";+ if (!document.getElementById(styleId)) {+ const styleEl = document.createElement("style");+ styleEl.id = styleId;+ styleEl.textContent = tooltipStyles;+ document.head.appendChild(styleEl);+ }+ }, []);++ // Fetch demo sessions+ useEffect(() => {+ const fetchSessions = async () => {+ try {+ const response = await fetch(+ "https://demo.rybbit.com/api/sessions/1?past_minutes_start=120&past_minutes_end=0&filters=[]&page=1&limit=100"+ );+ const data = await response.json();+ setSessions(data.data || []);+ } catch (error) {+ console.error("Failed to fetch sessions:", error);+ }+ };+ fetchSessions();+ }, []);++ // Initialize map+ useEffect(() => {+ if (!containerRef.current || !mapboxToken || mapRef.current) {+ return;+ }++ mapboxgl.accessToken = mapboxToken;++ // Use lower zoom on mobile to make globe fit better+ const isMobile = window.innerWidth < 768;+ const initialZoom = isMobile ? 1.2 : 2;++ const map = new mapboxgl.Map({+ container: containerRef.current,+ style: "mapbox://styles/mapbox/standard",+ projection: { name: "globe" },+ zoom: initialZoom,+ center: [0, 20],+ pitch: 0,+ bearing: 0,+ antialias: true,+ attributionControl: false,+ preserveDrawingBuffer: true,+ scrollZoom: false,+ doubleClickZoom: false,+ touchZoomRotate: false,+ boxZoom: false,+ });++ mapRef.current = map;++ // Create popup for tooltips+ const popup = new mapboxgl.Popup({+ closeButton: false,+ closeOnClick: false,+ className: "globe-tooltip",+ offset: 20,+ });+ popupRef.current = popup;++ map.on("style.load", () => {+ // Make background transparent+ const canvas = map.getCanvas();+ canvas.style.background = "transparent";++ // Try to remove/hide background layers for transparency+ try {+ map.setFog(null);+ } catch {+ // Fog may not be supported+ }++ // Apply custom styling - dark water+ try {+ if (map.getLayer("water")) {+ map.setPaintProperty("water", "fill-color", "#0a1929");+ }+ } catch {+ // Layer may not exist+ }++ // Try to make land darker/more subtle+ try {+ const layers = map.getStyle()?.layers || [];+ layers.forEach(layer => {+ if (layer.id.includes("background")) {+ map.setLayoutProperty(layer.id, "visibility", "none");+ }+ });+ } catch {+ // Layers may not exist+ }++ // Add clustering source+ map.addSource(SOURCE_ID, {+ type: "geojson",+ data: { type: "FeatureCollection", features: [] },+ cluster: true,+ clusterMaxZoom: CLUSTER_MAX_ZOOM,+ clusterRadius: CLUSTER_RADIUS,+ });++ // Add cluster circle layer+ map.addLayer({+ id: CLUSTER_LAYER_ID,+ type: "circle",+ source: SOURCE_ID,+ filter: ["all", ["has", "point_count"], [">=", ["get", "point_count"], MIN_CLUSTER_SIZE]],+ paint: {+ "circle-color": ["step", ["get", "point_count"], "#059669", 10, "#059669", 30, "#10b981", 100, "#34d399"],+ "circle-radius": ["step", ["get", "point_count"], 15, 10, 20, 30, 25],+ },+ });++ // Add cluster count layer+ map.addLayer({+ id: CLUSTER_COUNT_LAYER_ID,+ type: "symbol",+ source: SOURCE_ID,+ filter: ["all", ["has", "point_count"], [">=", ["get", "point_count"], MIN_CLUSTER_SIZE]],+ layout: {+ "text-field": ["get", "point_count_abbreviated"],+ "text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],+ "text-size": 14,+ "text-allow-overlap": true,+ "text-ignore-placement": true,+ },+ paint: {+ "text-color": "#ffffff",+ },+ });++ // Add unclustered point layer (hidden, for querying)+ map.addLayer({+ id: UNCLUSTERED_LAYER_ID,+ type: "circle",+ source: SOURCE_ID,+ filter: ["!", ["has", "point_count"]],+ paint: {+ "circle-radius": 0,+ "circle-opacity": 0,+ },+ });++ // Cluster click handler+ map.on("click", CLUSTER_LAYER_ID, e => {+ const features = map.queryRenderedFeatures(e.point, { layers: [CLUSTER_LAYER_ID] });+ if (!features.length) return;++ const clusterId = features[0].properties?.cluster_id;+ const source = map.getSource(SOURCE_ID) as mapboxgl.GeoJSONSource;++ source.getClusterExpansionZoom(clusterId, (err, zoom) => {+ if (err || !zoom) return;+ const coordinates = (features[0].geometry as GeoJSON.Point).coordinates;+ map.easeTo({ center: coordinates as [number, number], zoom, duration: 500 });+ });+ });++ // Cursor change on cluster hover+ map.on("mouseenter", CLUSTER_LAYER_ID, () => {+ map.getCanvas().style.cursor = "pointer";+ });+ map.on("mouseleave", CLUSTER_LAYER_ID, () => {+ map.getCanvas().style.cursor = "";+ });++ // Spin globe function using easeTo for smooth animation+ const spinGlobe = () => {+ if (!mapRef.current) return;+ const zoom = mapRef.current.getZoom();+ if (!isUserInteractingRef.current && zoom < MAX_SPIN_ZOOM) {+ let distancePerSecond = 360 / SECONDS_PER_REVOLUTION;+ if (zoom > SLOW_SPIN_ZOOM) {+ const zoomDif = (MAX_SPIN_ZOOM - zoom) / (MAX_SPIN_ZOOM - SLOW_SPIN_ZOOM);+ distancePerSecond *= zoomDif;+ }+ const center = mapRef.current.getCenter();+ center.lng -= distancePerSecond;+ mapRef.current.easeTo({ center, duration: 1000, easing: n => n });+ }+ };++ // Pause spinning on interaction+ map.on("mousedown", () => {+ isUserInteractingRef.current = true;+ });++ // Restart spinning after interaction ends+ map.on("mouseup", () => {+ isUserInteractingRef.current = false;+ spinGlobe();+ });+ map.on("dragend", () => {+ isUserInteractingRef.current = false;+ spinGlobe();+ });+ map.on("pitchend", () => {+ isUserInteractingRef.current = false;+ spinGlobe();+ });+ map.on("rotateend", () => {+ isUserInteractingRef.current = false;+ spinGlobe();+ });++ // When animation completes, spin again (creates continuous rotation)+ map.on("moveend", () => {+ spinGlobe();+ });++ setMapLoaded(true);++ // Start spinning+ spinGlobe();+ });++ return () => {+ // Clear markers+ markersMapRef.current.forEach(({ marker }) => marker.remove());+ markersMapRef.current.clear();+ if (popupRef.current) {+ popupRef.current.remove();+ }+ if (mapRef.current) {+ mapRef.current.remove();+ mapRef.current = null;+ }+ setMapLoaded(false);+ };+ }, [mapboxToken]);++ // Update sessions data and markers+ useEffect(() => {+ if (!mapRef.current || !mapLoaded || sessions.length === 0) return;++ const mapInstance = mapRef.current;+ const markersMap = markersMapRef.current;+ const popup = popupRef.current;+ const shouldShowClusters = sessions.length > CLUSTERING_THRESHOLD;++ // Update GeoJSON data+ const updateGeoJSONData = () => {+ const source = mapInstance.getSource(SOURCE_ID) as mapboxgl.GeoJSONSource;+ if (!source) return;++ const zoom = mapInstance.getZoom();+ const spreadCoordinates = spreadOverlappingPoints(sessions, zoom);++ const geojson: GeoJSON.FeatureCollection = {+ type: "FeatureCollection",+ features: sessions+ .filter(s => !isNil(s.lat) && !isNil(s.lon))+ .map(session => {+ const coords = spreadCoordinates.get(session.session_id) || [round(session.lon, 4), round(session.lat, 4)];+ return {+ type: "Feature",+ properties: session,+ geometry: {+ type: "Point",+ coordinates: coords,+ },+ };+ }),+ };++ source.setData(geojson);+ };++ // Show/hide cluster layers+ const visibility = shouldShowClusters ? "visible" : "none";+ if (mapInstance.getLayer(CLUSTER_LAYER_ID)) {+ mapInstance.setLayoutProperty(CLUSTER_LAYER_ID, "visibility", visibility);+ }+ if (mapInstance.getLayer(CLUSTER_COUNT_LAYER_ID)) {+ mapInstance.setLayoutProperty(CLUSTER_COUNT_LAYER_ID, "visibility", visibility);+ }++ // Update markers function+ const updateMarkers = async () => {+ const zoom = mapInstance.getZoom();+ const spreadCoordinates = spreadOverlappingPoints(sessions, zoom);++ let unclusteredFeatures: GeoJSON.Feature[] = [];++ if (!shouldShowClusters) {+ // Show all sessions as individual markers+ unclusteredFeatures = sessions+ .filter(s => !isNil(s.lat) && !isNil(s.lon))+ .map(session => {+ const coords = spreadCoordinates.get(session.session_id) || [round(session.lon, 4), round(session.lat, 4)];+ return {+ type: "Feature",+ properties: session,+ geometry: { type: "Point", coordinates: coords },+ } as GeoJSON.Feature;+ });+ } else {+ // Get unclustered features from map+ const features = mapInstance.querySourceFeatures(SOURCE_ID);+ const source = mapInstance.getSource(SOURCE_ID) as mapboxgl.GeoJSONSource;+ const promises: Promise<void>[] = [];++ features.forEach(f => {+ if (!f.properties) return;++ if (!f.properties.cluster) {+ unclusteredFeatures.push(f as GeoJSON.Feature);+ } else if (f.properties.point_count && f.properties.point_count < MIN_CLUSTER_SIZE) {+ const promise = new Promise<void>(resolve => {+ source.getClusterLeaves(f.properties!.cluster_id, f.properties!.point_count, 0, (err, leaves) => {+ if (!err && leaves) {+ unclusteredFeatures.push(...(leaves as GeoJSON.Feature[]));+ }+ resolve();+ });+ });+ promises.push(promise);+ }+ });++ await Promise.all(promises);+ }++ // Build set of current session IDs+ const currentSessionIds = new Set(+ unclusteredFeatures.map(f => (f.properties as Session)?.session_id).filter(Boolean)+ );++ // Remove markers no longer visible+ const toRemove: string[] = [];+ markersMap.forEach(({ marker }, sessionId) => {+ if (!currentSessionIds.has(sessionId)) {+ marker.remove();+ toRemove.push(sessionId);+ }+ });+ toRemove.forEach(id => markersMap.delete(id));++ // Create or update markers+ unclusteredFeatures.forEach(feature => {+ const session = feature.properties as Session;+ if (!session?.session_id) return;++ const existing = markersMap.get(session.session_id);+ const [lng, lat] = (feature.geometry as GeoJSON.Point).coordinates;++ if (existing) {+ const currentLngLat = existing.marker.getLngLat();+ if (currentLngLat.lng !== lng || currentLngLat.lat !== lat) {+ existing.marker.setLngLat([lng, lat]);+ }+ } else {+ // Create avatar marker with nested structure to avoid transform conflicts+ const markerContainer = document.createElement("div");+ markerContainer.style.cursor = "pointer";++ const avatarContainer = document.createElement("div");+ avatarContainer.className = "timeline-avatar-marker";+ avatarContainer.style.borderRadius = "50%";+ avatarContainer.style.overflow = "hidden";+ avatarContainer.style.width = "32px";+ avatarContainer.style.height = "32px";+ avatarContainer.style.boxShadow = "0 2px 8px rgba(0,0,0,0.3)";+ avatarContainer.style.transition = "transform 0.15s ease";+ avatarContainer.innerHTML = generateAvatarSVG(session.user_id, 32);++ markerContainer.appendChild(avatarContainer);++ // Add hover events for tooltip+ markerContainer.addEventListener("mouseenter", () => {+ avatarContainer.style.transform = "scale(1.15)";+ if (popup && mapInstance) {+ const markerData = markersMap.get(session.session_id);+ if (markerData) {+ const lngLat = markerData.marker.getLngLat();+ popup.setLngLat(lngLat).setHTML(buildTooltipHTML(markerData.session)).addTo(mapInstance);+ }+ }+ });++ markerContainer.addEventListener("mouseleave", () => {+ avatarContainer.style.transform = "scale(1)";+ if (popup) {+ popup.remove();+ }+ });++ const marker = new mapboxgl.Marker({+ element: markerContainer,+ anchor: "center",+ })+ .setLngLat([lng, lat])+ .addTo(mapInstance);++ markersMap.set(session.session_id, { marker, element: markerContainer, session });+ }+ });+ };++ // Initial update+ updateGeoJSONData();+ updateMarkers();++ // Throttled updates on map events+ const throttledUpdate = throttle(+ () => {+ updateGeoJSONData();+ updateMarkers();+ },+ 150,+ { leading: true, trailing: true }+ );++ mapInstance.on("zoom", throttledUpdate);+ mapInstance.on("move", throttledUpdate);+ mapInstance.on("sourcedata", throttledUpdate);++ return () => {+ throttledUpdate.cancel();+ mapInstance.off("zoom", throttledUpdate);+ mapInstance.off("move", throttledUpdate);+ mapInstance.off("sourcedata", throttledUpdate);+ // Clear markers on cleanup+ markersMap.forEach(({ marker }) => marker.remove());+ markersMap.clear();+ };+ }, [sessions, mapLoaded]);++ if (!mapboxToken) {+ return null;+ }++ return (+ <div+ ref={containerRef}+ className="w-full h-full [&_.mapboxgl-ctrl-bottom-left]:!hidden [&_.mapboxgl-ctrl-logo]:!hidden [&_.mapboxgl-ctrl-bottom-right]:!hidden"+ style={{ background: "transparent" }}+ />+ );+}