device-passport 1.0.0 → 1.1.0

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 (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +69 -2
  3. package/dist/adapters/index.cjs +19 -0
  4. package/dist/adapters/index.d.cts +156 -0
  5. package/dist/adapters/index.d.mts +156 -0
  6. package/dist/adapters/index.d.ts +156 -0
  7. package/dist/adapters/index.mjs +3 -0
  8. package/dist/evaluator/index.cjs +702 -0
  9. package/dist/evaluator/index.d.cts +204 -0
  10. package/dist/evaluator/index.d.mts +204 -0
  11. package/dist/evaluator/index.d.ts +204 -0
  12. package/dist/evaluator/index.mjs +680 -0
  13. package/dist/geo/index.cjs +50 -0
  14. package/dist/geo/index.d.cts +209 -0
  15. package/dist/geo/index.d.mts +209 -0
  16. package/dist/geo/index.d.ts +209 -0
  17. package/dist/geo/index.mjs +18 -0
  18. package/dist/index.cjs +113 -3543
  19. package/dist/index.d.cts +45 -903
  20. package/dist/index.d.mts +45 -903
  21. package/dist/index.d.ts +45 -903
  22. package/dist/index.mjs +11 -3438
  23. package/dist/shared/device-passport.BBf9OKap.mjs +1237 -0
  24. package/dist/shared/device-passport.BPd2-w8e.cjs +1265 -0
  25. package/dist/shared/device-passport.CLaBZWUV.cjs +1569 -0
  26. package/dist/shared/device-passport.C_F1vBE8.d.cts +79 -0
  27. package/dist/shared/device-passport.C_F1vBE8.d.mts +79 -0
  28. package/dist/shared/device-passport.C_F1vBE8.d.ts +79 -0
  29. package/dist/shared/device-passport.Cjxlv8xI.cjs +245 -0
  30. package/dist/shared/device-passport.CyQtcZeD.mjs +237 -0
  31. package/dist/shared/device-passport.NHw_f6HT.mjs +1535 -0
  32. package/dist/storage/index.cjs +10 -0
  33. package/dist/storage/index.d.cts +128 -0
  34. package/dist/storage/index.d.mts +128 -0
  35. package/dist/storage/index.d.ts +128 -0
  36. package/dist/storage/index.mjs +3 -0
  37. package/dist/types/index.cjs +2 -0
  38. package/dist/types/index.d.cts +215 -0
  39. package/dist/types/index.d.mts +215 -0
  40. package/dist/types/index.d.ts +215 -0
  41. package/dist/types/index.mjs +1 -0
  42. package/package.json +27 -2
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ const aligner = require('../shared/device-passport.BPd2-w8e.cjs');
4
+
5
+ const GEO_LOCALES = aligner.COUNTRY_LOCALES;
6
+ const TIMEZONE_MATRIX = aligner.TIMEZONE_TO_COUNTRY;
7
+ const isValidCountryCode = aligner.hasCountryConfig;
8
+ function detectGeoFromUrl(url) {
9
+ return aligner.extractCountryFromProxyUrl(url);
10
+ }
11
+ function getLocaleProfile(countryCode, timezone) {
12
+ const geo = aligner.alignGeoContext({
13
+ country: countryCode || void 0,
14
+ timezone
15
+ });
16
+ return aligner.toLocaleProfile(geo);
17
+ }
18
+
19
+ exports.ALPHA3_TO_ALPHA2 = aligner.ALPHA3_TO_ALPHA2;
20
+ exports.COUNTRY_LOCALES = aligner.COUNTRY_LOCALES;
21
+ exports.COUNTRY_NAME_TO_CODE = aligner.COUNTRY_NAME_TO_CODE;
22
+ exports.DEFAULT_ACCEPT_LANGUAGE = aligner.DEFAULT_ACCEPT_LANGUAGE;
23
+ exports.DEFAULT_COUNTRY = aligner.DEFAULT_COUNTRY;
24
+ exports.DEFAULT_LOCALE = aligner.DEFAULT_LOCALE;
25
+ exports.DEFAULT_TIMEZONE = aligner.DEFAULT_TIMEZONE;
26
+ exports.TIMEZONE_TO_COUNTRY = aligner.TIMEZONE_TO_COUNTRY;
27
+ exports.alignGeoContext = aligner.alignGeoContext;
28
+ exports.detectCountry = aligner.detectCountry;
29
+ exports.extractCountryFromProxyUrl = aligner.extractCountryFromProxyUrl;
30
+ exports.formatAcceptLanguage = aligner.formatAcceptLanguage;
31
+ exports.getAllSupportedCountries = aligner.getAllSupportedCountries;
32
+ exports.getCountryConfig = aligner.getCountryConfig;
33
+ exports.getCountryForTimezone = aligner.getCountryForTimezone;
34
+ exports.getDefaultTimezoneForCountry = aligner.getDefaultTimezoneForCountry;
35
+ exports.getTimezoneOffsetMinutes = aligner.getTimezoneOffsetMinutes;
36
+ exports.getTimezonesForCountry = aligner.getTimezonesForCountry;
37
+ exports.hasCountryConfig = aligner.hasCountryConfig;
38
+ exports.isGeoAligned = aligner.isGeoAligned;
39
+ exports.isTimezoneAlignedWithCountry = aligner.isTimezoneAlignedWithCountry;
40
+ exports.isValidTimezone = aligner.isValidTimezone;
41
+ exports.listAllTimezones = aligner.listAllTimezones;
42
+ exports.normalizeCountryCode = aligner.normalizeCountryCode;
43
+ exports.parseAcceptLanguage = aligner.parseAcceptLanguage;
44
+ exports.toGeoLocation = aligner.toGeoLocation;
45
+ exports.toLocaleProfile = aligner.toLocaleProfile;
46
+ exports.GEO_LOCALES = GEO_LOCALES;
47
+ exports.TIMEZONE_MATRIX = TIMEZONE_MATRIX;
48
+ exports.detectGeoFromUrl = detectGeoFromUrl;
49
+ exports.getLocaleProfile = getLocaleProfile;
50
+ exports.isValidCountryCode = isValidCountryCode;
@@ -0,0 +1,209 @@
1
+ import { c as GeoOptions, G as GeoContext } from '../shared/device-passport.C_F1vBE8.cjs';
2
+ import { GeoCoordinates, LocaleProfile } from '../index.cjs';
3
+
4
+ /**
5
+ * Comprehensive Geographic-Locale Mapping Database.
6
+ * Zero-dependency, pure TypeScript.
7
+ */
8
+
9
+ interface CountryLocaleConfig {
10
+ /** ISO 3166-1 alpha-2 uppercase country code */
11
+ country: string;
12
+ /** Full English country name */
13
+ countryName: string;
14
+ /** Primary locale identifier, e.g. 'en-US', 'ja-JP' */
15
+ primaryLocale: string;
16
+ /** Primary and fallback languages ordered by preference */
17
+ languages: string[];
18
+ /** Strictly formatted RFC 9110 Accept-Language weighted header string */
19
+ acceptLanguage: string;
20
+ /** Supported IANA timezones within this country */
21
+ timezones: string[];
22
+ /** Default primary IANA timezone */
23
+ defaultTimezone: string;
24
+ /** ISO 4217 currency code */
25
+ currency: string;
26
+ /** Representative geographical center/capital coordinates */
27
+ coordinates: GeoCoordinates;
28
+ }
29
+ /**
30
+ * Global fallback defaults
31
+ */
32
+ declare const DEFAULT_COUNTRY = "US";
33
+ declare const DEFAULT_LOCALE = "en-US";
34
+ declare const DEFAULT_TIMEZONE = "America/New_York";
35
+ declare const DEFAULT_ACCEPT_LANGUAGE = "en-US,en;q=0.9";
36
+ /**
37
+ * Comprehensive Country Locale & Geographic Database.
38
+ */
39
+ declare const COUNTRY_LOCALES: Record<string, CountryLocaleConfig>;
40
+ /**
41
+ * Get country locale configuration with fallback.
42
+ */
43
+ declare function getCountryConfig(countryCode?: string | null): CountryLocaleConfig;
44
+ /**
45
+ * Check if a country code is supported in the database.
46
+ */
47
+ declare function hasCountryConfig(countryCode?: string | null): boolean;
48
+ /**
49
+ * Get all supported ISO country codes.
50
+ */
51
+ declare function getAllSupportedCountries(): string[];
52
+ /**
53
+ * Strictly format an Accept-Language weighted header string from an array of languages.
54
+ * Example: ['en-US', 'en'] -> 'en-US,en;q=0.9'
55
+ * Example: ['de-DE', 'de', 'en-US', 'en'] -> 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7'
56
+ */
57
+ declare function formatAcceptLanguage(languages: string[]): string;
58
+ /**
59
+ * Parse an Accept-Language header string into an array of { locale, q } items ordered by weight descending.
60
+ */
61
+ declare function parseAcceptLanguage(header: string): Array<{
62
+ locale: string;
63
+ q: number;
64
+ }>;
65
+
66
+ /**
67
+ * Timezone Matrix and Chrono-Alignment Engine.
68
+ * Pure TypeScript, zero external dependencies.
69
+ */
70
+ /**
71
+ * Direct mapping from IANA Timezone ID to ISO 3166-1 alpha-2 country code.
72
+ */
73
+ declare const TIMEZONE_TO_COUNTRY: Record<string, string>;
74
+ /**
75
+ * Validate if a timezone string is a valid IANA timezone identifier.
76
+ */
77
+ declare function isValidTimezone(timezone: string): boolean;
78
+ /**
79
+ * Get all supported timezones for a specific country code.
80
+ */
81
+ declare function getTimezonesForCountry(countryCode: string): string[];
82
+ /**
83
+ * Look up the ISO country code associated with an IANA timezone identifier.
84
+ */
85
+ declare function getCountryForTimezone(timezone: string): string | undefined;
86
+ /**
87
+ * Get the primary/default timezone for a country code.
88
+ */
89
+ declare function getDefaultTimezoneForCountry(countryCode: string): string;
90
+ /**
91
+ * Check if a timezone is chronologically aligned with a given country.
92
+ */
93
+ declare function isTimezoneAlignedWithCountry(timezone: string, countryCode: string): boolean;
94
+ /**
95
+ * Calculate timezone offset in minutes relative to UTC.
96
+ * Note: Following the standard convention matching LocaleProfile.timezoneOffset:
97
+ * - Negative for zones west of UTC (e.g. -240 for EDT, -300 for EST)
98
+ * - Positive for zones east of UTC (e.g. +480 for CST / Asia/Shanghai, +540 for JST)
99
+ * - 0 for UTC
100
+ */
101
+ declare function getTimezoneOffsetMinutes(timezone: string, date?: Date): number;
102
+ /**
103
+ * List all unique timezones known to the system.
104
+ */
105
+ declare function listAllTimezones(): string[];
106
+
107
+ /**
108
+ * Proxy and Geo-Context Detector.
109
+ * Extracts country and geo information from residential proxy URLs, IP hints, or explicit ISO codes.
110
+ * Pure TypeScript, zero external dependencies.
111
+ */
112
+ interface GeoDetectOptions {
113
+ /** Country code to fall back to if detection fails. Defaults to 'US'. */
114
+ fallbackCountry?: string;
115
+ }
116
+ /**
117
+ * ISO 3166-1 alpha-3 to alpha-2 code mapping.
118
+ */
119
+ declare const ALPHA3_TO_ALPHA2: Record<string, string>;
120
+ /**
121
+ * Common English country name aliases to ISO 3166-1 alpha-2 code.
122
+ */
123
+ declare const COUNTRY_NAME_TO_CODE: Record<string, string>;
124
+ /**
125
+ * Normalize any country input (2-letter, 3-letter, alias, name) to an ISO 3166-1 alpha-2 uppercase code.
126
+ */
127
+ declare function normalizeCountryCode(code?: string | null): string | null;
128
+ /**
129
+ * Extract an ISO country code from a residential proxy URL or connection string.
130
+ * Supports:
131
+ * - Username authentication tokens (e.g. user-country-us, customer-zone-cc-DE, lum-customer-*-country-fr)
132
+ * - Query parameters (e.g. ?country=JP, &country_code=KR, ?cc=SG, &geo=DE)
133
+ * - Subdomain patterns (e.g. us.smartproxy.com, jp.proxy-seller.com)
134
+ */
135
+ declare function extractCountryFromProxyUrl(url: string): string | null;
136
+ /**
137
+ * Universal country detector.
138
+ * Accepts:
139
+ * - Explicit ISO 3166-1 alpha-2 / alpha-3 codes ('US', 'GB', 'jp', 'JPN')
140
+ * - Country names ('Japan', 'United States', 'Germany')
141
+ * - Residential proxy URLs (http://user-country-us:pass@proxy...)
142
+ * - IANA Timezone strings ('America/New_York' -> 'US', 'Asia/Tokyo' -> 'JP')
143
+ * - Falls back to DEFAULT_COUNTRY ('US') when unknown.
144
+ */
145
+ declare function detectCountry(input?: string | null, options?: GeoDetectOptions): string;
146
+
147
+ /**
148
+ * Geo-Chrono Aligner.
149
+ * Aligns browser persona parameters (country, timezone, locale, accept-language header)
150
+ * with zero contradictions for stealth crawlers and automation.
151
+ * Pure TypeScript, zero external dependencies.
152
+ */
153
+
154
+ /**
155
+ * Align geographic and chronological parameters into a cohesive, contradiction-free GeoContext.
156
+ *
157
+ * @param geoInput Proxy URL, ISO country code, IANA timezone string, or GeoOptions object
158
+ * @returns Fully correlated GeoContext
159
+ */
160
+ declare function alignGeoContext(geoInput?: string | GeoOptions): GeoContext;
161
+ /**
162
+ * Verify whether a partial or full GeoContext is free of geographic or chronological contradictions.
163
+ */
164
+ declare function isGeoAligned(context: Partial<GeoContext>): boolean;
165
+ /**
166
+ * Format GeoContext into a LocaleProfile for runtime device-passport consumers.
167
+ */
168
+ declare function toLocaleProfile(geo: GeoContext): {
169
+ language: string;
170
+ languages: string[];
171
+ timezone: string;
172
+ timezoneOffset: number;
173
+ country: string;
174
+ currency: string | undefined;
175
+ };
176
+ /**
177
+ * Format GeoContext into a GeoLocation object for browser geolocation emulation.
178
+ */
179
+ declare function toGeoLocation(geo: GeoContext): {
180
+ latitude: number;
181
+ longitude: number;
182
+ accuracy: number;
183
+ country: string;
184
+ countryCode: string;
185
+ timezone: string;
186
+ locale: string;
187
+ languages: string[];
188
+ };
189
+
190
+ /**
191
+ * Geo and Chrono Aligner module for Device Passport.
192
+ * Provides geographic-locale mapping database, proxy/IP geo detector,
193
+ * and zero-contradiction geo-chrono alignment.
194
+ */
195
+
196
+ declare const GEO_LOCALES: Record<string, CountryLocaleConfig>;
197
+ declare const TIMEZONE_MATRIX: Record<string, string>;
198
+ declare const isValidCountryCode: typeof hasCountryConfig;
199
+ /**
200
+ * Detect country code from residential proxy URL.
201
+ */
202
+ declare function detectGeoFromUrl(url: string): string | null;
203
+ /**
204
+ * Get a complete LocaleProfile for a country code and optional timezone.
205
+ */
206
+ declare function getLocaleProfile(countryCode?: string | null, timezone?: string): LocaleProfile;
207
+
208
+ export { ALPHA3_TO_ALPHA2, COUNTRY_LOCALES, COUNTRY_NAME_TO_CODE, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_COUNTRY, DEFAULT_LOCALE, DEFAULT_TIMEZONE, GEO_LOCALES, GeoContext, GeoOptions, TIMEZONE_MATRIX, TIMEZONE_TO_COUNTRY, alignGeoContext, detectCountry, detectGeoFromUrl, extractCountryFromProxyUrl, formatAcceptLanguage, getAllSupportedCountries, getCountryConfig, getCountryForTimezone, getDefaultTimezoneForCountry, getLocaleProfile, getTimezoneOffsetMinutes, getTimezonesForCountry, hasCountryConfig, isGeoAligned, isTimezoneAlignedWithCountry, isValidCountryCode, isValidTimezone, listAllTimezones, normalizeCountryCode, parseAcceptLanguage, toGeoLocation, toLocaleProfile };
209
+ export type { CountryLocaleConfig, GeoDetectOptions };
@@ -0,0 +1,209 @@
1
+ import { c as GeoOptions, G as GeoContext } from '../shared/device-passport.C_F1vBE8.mjs';
2
+ import { GeoCoordinates, LocaleProfile } from '../index.mjs';
3
+
4
+ /**
5
+ * Comprehensive Geographic-Locale Mapping Database.
6
+ * Zero-dependency, pure TypeScript.
7
+ */
8
+
9
+ interface CountryLocaleConfig {
10
+ /** ISO 3166-1 alpha-2 uppercase country code */
11
+ country: string;
12
+ /** Full English country name */
13
+ countryName: string;
14
+ /** Primary locale identifier, e.g. 'en-US', 'ja-JP' */
15
+ primaryLocale: string;
16
+ /** Primary and fallback languages ordered by preference */
17
+ languages: string[];
18
+ /** Strictly formatted RFC 9110 Accept-Language weighted header string */
19
+ acceptLanguage: string;
20
+ /** Supported IANA timezones within this country */
21
+ timezones: string[];
22
+ /** Default primary IANA timezone */
23
+ defaultTimezone: string;
24
+ /** ISO 4217 currency code */
25
+ currency: string;
26
+ /** Representative geographical center/capital coordinates */
27
+ coordinates: GeoCoordinates;
28
+ }
29
+ /**
30
+ * Global fallback defaults
31
+ */
32
+ declare const DEFAULT_COUNTRY = "US";
33
+ declare const DEFAULT_LOCALE = "en-US";
34
+ declare const DEFAULT_TIMEZONE = "America/New_York";
35
+ declare const DEFAULT_ACCEPT_LANGUAGE = "en-US,en;q=0.9";
36
+ /**
37
+ * Comprehensive Country Locale & Geographic Database.
38
+ */
39
+ declare const COUNTRY_LOCALES: Record<string, CountryLocaleConfig>;
40
+ /**
41
+ * Get country locale configuration with fallback.
42
+ */
43
+ declare function getCountryConfig(countryCode?: string | null): CountryLocaleConfig;
44
+ /**
45
+ * Check if a country code is supported in the database.
46
+ */
47
+ declare function hasCountryConfig(countryCode?: string | null): boolean;
48
+ /**
49
+ * Get all supported ISO country codes.
50
+ */
51
+ declare function getAllSupportedCountries(): string[];
52
+ /**
53
+ * Strictly format an Accept-Language weighted header string from an array of languages.
54
+ * Example: ['en-US', 'en'] -> 'en-US,en;q=0.9'
55
+ * Example: ['de-DE', 'de', 'en-US', 'en'] -> 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7'
56
+ */
57
+ declare function formatAcceptLanguage(languages: string[]): string;
58
+ /**
59
+ * Parse an Accept-Language header string into an array of { locale, q } items ordered by weight descending.
60
+ */
61
+ declare function parseAcceptLanguage(header: string): Array<{
62
+ locale: string;
63
+ q: number;
64
+ }>;
65
+
66
+ /**
67
+ * Timezone Matrix and Chrono-Alignment Engine.
68
+ * Pure TypeScript, zero external dependencies.
69
+ */
70
+ /**
71
+ * Direct mapping from IANA Timezone ID to ISO 3166-1 alpha-2 country code.
72
+ */
73
+ declare const TIMEZONE_TO_COUNTRY: Record<string, string>;
74
+ /**
75
+ * Validate if a timezone string is a valid IANA timezone identifier.
76
+ */
77
+ declare function isValidTimezone(timezone: string): boolean;
78
+ /**
79
+ * Get all supported timezones for a specific country code.
80
+ */
81
+ declare function getTimezonesForCountry(countryCode: string): string[];
82
+ /**
83
+ * Look up the ISO country code associated with an IANA timezone identifier.
84
+ */
85
+ declare function getCountryForTimezone(timezone: string): string | undefined;
86
+ /**
87
+ * Get the primary/default timezone for a country code.
88
+ */
89
+ declare function getDefaultTimezoneForCountry(countryCode: string): string;
90
+ /**
91
+ * Check if a timezone is chronologically aligned with a given country.
92
+ */
93
+ declare function isTimezoneAlignedWithCountry(timezone: string, countryCode: string): boolean;
94
+ /**
95
+ * Calculate timezone offset in minutes relative to UTC.
96
+ * Note: Following the standard convention matching LocaleProfile.timezoneOffset:
97
+ * - Negative for zones west of UTC (e.g. -240 for EDT, -300 for EST)
98
+ * - Positive for zones east of UTC (e.g. +480 for CST / Asia/Shanghai, +540 for JST)
99
+ * - 0 for UTC
100
+ */
101
+ declare function getTimezoneOffsetMinutes(timezone: string, date?: Date): number;
102
+ /**
103
+ * List all unique timezones known to the system.
104
+ */
105
+ declare function listAllTimezones(): string[];
106
+
107
+ /**
108
+ * Proxy and Geo-Context Detector.
109
+ * Extracts country and geo information from residential proxy URLs, IP hints, or explicit ISO codes.
110
+ * Pure TypeScript, zero external dependencies.
111
+ */
112
+ interface GeoDetectOptions {
113
+ /** Country code to fall back to if detection fails. Defaults to 'US'. */
114
+ fallbackCountry?: string;
115
+ }
116
+ /**
117
+ * ISO 3166-1 alpha-3 to alpha-2 code mapping.
118
+ */
119
+ declare const ALPHA3_TO_ALPHA2: Record<string, string>;
120
+ /**
121
+ * Common English country name aliases to ISO 3166-1 alpha-2 code.
122
+ */
123
+ declare const COUNTRY_NAME_TO_CODE: Record<string, string>;
124
+ /**
125
+ * Normalize any country input (2-letter, 3-letter, alias, name) to an ISO 3166-1 alpha-2 uppercase code.
126
+ */
127
+ declare function normalizeCountryCode(code?: string | null): string | null;
128
+ /**
129
+ * Extract an ISO country code from a residential proxy URL or connection string.
130
+ * Supports:
131
+ * - Username authentication tokens (e.g. user-country-us, customer-zone-cc-DE, lum-customer-*-country-fr)
132
+ * - Query parameters (e.g. ?country=JP, &country_code=KR, ?cc=SG, &geo=DE)
133
+ * - Subdomain patterns (e.g. us.smartproxy.com, jp.proxy-seller.com)
134
+ */
135
+ declare function extractCountryFromProxyUrl(url: string): string | null;
136
+ /**
137
+ * Universal country detector.
138
+ * Accepts:
139
+ * - Explicit ISO 3166-1 alpha-2 / alpha-3 codes ('US', 'GB', 'jp', 'JPN')
140
+ * - Country names ('Japan', 'United States', 'Germany')
141
+ * - Residential proxy URLs (http://user-country-us:pass@proxy...)
142
+ * - IANA Timezone strings ('America/New_York' -> 'US', 'Asia/Tokyo' -> 'JP')
143
+ * - Falls back to DEFAULT_COUNTRY ('US') when unknown.
144
+ */
145
+ declare function detectCountry(input?: string | null, options?: GeoDetectOptions): string;
146
+
147
+ /**
148
+ * Geo-Chrono Aligner.
149
+ * Aligns browser persona parameters (country, timezone, locale, accept-language header)
150
+ * with zero contradictions for stealth crawlers and automation.
151
+ * Pure TypeScript, zero external dependencies.
152
+ */
153
+
154
+ /**
155
+ * Align geographic and chronological parameters into a cohesive, contradiction-free GeoContext.
156
+ *
157
+ * @param geoInput Proxy URL, ISO country code, IANA timezone string, or GeoOptions object
158
+ * @returns Fully correlated GeoContext
159
+ */
160
+ declare function alignGeoContext(geoInput?: string | GeoOptions): GeoContext;
161
+ /**
162
+ * Verify whether a partial or full GeoContext is free of geographic or chronological contradictions.
163
+ */
164
+ declare function isGeoAligned(context: Partial<GeoContext>): boolean;
165
+ /**
166
+ * Format GeoContext into a LocaleProfile for runtime device-passport consumers.
167
+ */
168
+ declare function toLocaleProfile(geo: GeoContext): {
169
+ language: string;
170
+ languages: string[];
171
+ timezone: string;
172
+ timezoneOffset: number;
173
+ country: string;
174
+ currency: string | undefined;
175
+ };
176
+ /**
177
+ * Format GeoContext into a GeoLocation object for browser geolocation emulation.
178
+ */
179
+ declare function toGeoLocation(geo: GeoContext): {
180
+ latitude: number;
181
+ longitude: number;
182
+ accuracy: number;
183
+ country: string;
184
+ countryCode: string;
185
+ timezone: string;
186
+ locale: string;
187
+ languages: string[];
188
+ };
189
+
190
+ /**
191
+ * Geo and Chrono Aligner module for Device Passport.
192
+ * Provides geographic-locale mapping database, proxy/IP geo detector,
193
+ * and zero-contradiction geo-chrono alignment.
194
+ */
195
+
196
+ declare const GEO_LOCALES: Record<string, CountryLocaleConfig>;
197
+ declare const TIMEZONE_MATRIX: Record<string, string>;
198
+ declare const isValidCountryCode: typeof hasCountryConfig;
199
+ /**
200
+ * Detect country code from residential proxy URL.
201
+ */
202
+ declare function detectGeoFromUrl(url: string): string | null;
203
+ /**
204
+ * Get a complete LocaleProfile for a country code and optional timezone.
205
+ */
206
+ declare function getLocaleProfile(countryCode?: string | null, timezone?: string): LocaleProfile;
207
+
208
+ export { ALPHA3_TO_ALPHA2, COUNTRY_LOCALES, COUNTRY_NAME_TO_CODE, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_COUNTRY, DEFAULT_LOCALE, DEFAULT_TIMEZONE, GEO_LOCALES, GeoContext, GeoOptions, TIMEZONE_MATRIX, TIMEZONE_TO_COUNTRY, alignGeoContext, detectCountry, detectGeoFromUrl, extractCountryFromProxyUrl, formatAcceptLanguage, getAllSupportedCountries, getCountryConfig, getCountryForTimezone, getDefaultTimezoneForCountry, getLocaleProfile, getTimezoneOffsetMinutes, getTimezonesForCountry, hasCountryConfig, isGeoAligned, isTimezoneAlignedWithCountry, isValidCountryCode, isValidTimezone, listAllTimezones, normalizeCountryCode, parseAcceptLanguage, toGeoLocation, toLocaleProfile };
209
+ export type { CountryLocaleConfig, GeoDetectOptions };
@@ -0,0 +1,209 @@
1
+ import { c as GeoOptions, G as GeoContext } from '../shared/device-passport.C_F1vBE8.js';
2
+ import { GeoCoordinates, LocaleProfile } from '../index.js';
3
+
4
+ /**
5
+ * Comprehensive Geographic-Locale Mapping Database.
6
+ * Zero-dependency, pure TypeScript.
7
+ */
8
+
9
+ interface CountryLocaleConfig {
10
+ /** ISO 3166-1 alpha-2 uppercase country code */
11
+ country: string;
12
+ /** Full English country name */
13
+ countryName: string;
14
+ /** Primary locale identifier, e.g. 'en-US', 'ja-JP' */
15
+ primaryLocale: string;
16
+ /** Primary and fallback languages ordered by preference */
17
+ languages: string[];
18
+ /** Strictly formatted RFC 9110 Accept-Language weighted header string */
19
+ acceptLanguage: string;
20
+ /** Supported IANA timezones within this country */
21
+ timezones: string[];
22
+ /** Default primary IANA timezone */
23
+ defaultTimezone: string;
24
+ /** ISO 4217 currency code */
25
+ currency: string;
26
+ /** Representative geographical center/capital coordinates */
27
+ coordinates: GeoCoordinates;
28
+ }
29
+ /**
30
+ * Global fallback defaults
31
+ */
32
+ declare const DEFAULT_COUNTRY = "US";
33
+ declare const DEFAULT_LOCALE = "en-US";
34
+ declare const DEFAULT_TIMEZONE = "America/New_York";
35
+ declare const DEFAULT_ACCEPT_LANGUAGE = "en-US,en;q=0.9";
36
+ /**
37
+ * Comprehensive Country Locale & Geographic Database.
38
+ */
39
+ declare const COUNTRY_LOCALES: Record<string, CountryLocaleConfig>;
40
+ /**
41
+ * Get country locale configuration with fallback.
42
+ */
43
+ declare function getCountryConfig(countryCode?: string | null): CountryLocaleConfig;
44
+ /**
45
+ * Check if a country code is supported in the database.
46
+ */
47
+ declare function hasCountryConfig(countryCode?: string | null): boolean;
48
+ /**
49
+ * Get all supported ISO country codes.
50
+ */
51
+ declare function getAllSupportedCountries(): string[];
52
+ /**
53
+ * Strictly format an Accept-Language weighted header string from an array of languages.
54
+ * Example: ['en-US', 'en'] -> 'en-US,en;q=0.9'
55
+ * Example: ['de-DE', 'de', 'en-US', 'en'] -> 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7'
56
+ */
57
+ declare function formatAcceptLanguage(languages: string[]): string;
58
+ /**
59
+ * Parse an Accept-Language header string into an array of { locale, q } items ordered by weight descending.
60
+ */
61
+ declare function parseAcceptLanguage(header: string): Array<{
62
+ locale: string;
63
+ q: number;
64
+ }>;
65
+
66
+ /**
67
+ * Timezone Matrix and Chrono-Alignment Engine.
68
+ * Pure TypeScript, zero external dependencies.
69
+ */
70
+ /**
71
+ * Direct mapping from IANA Timezone ID to ISO 3166-1 alpha-2 country code.
72
+ */
73
+ declare const TIMEZONE_TO_COUNTRY: Record<string, string>;
74
+ /**
75
+ * Validate if a timezone string is a valid IANA timezone identifier.
76
+ */
77
+ declare function isValidTimezone(timezone: string): boolean;
78
+ /**
79
+ * Get all supported timezones for a specific country code.
80
+ */
81
+ declare function getTimezonesForCountry(countryCode: string): string[];
82
+ /**
83
+ * Look up the ISO country code associated with an IANA timezone identifier.
84
+ */
85
+ declare function getCountryForTimezone(timezone: string): string | undefined;
86
+ /**
87
+ * Get the primary/default timezone for a country code.
88
+ */
89
+ declare function getDefaultTimezoneForCountry(countryCode: string): string;
90
+ /**
91
+ * Check if a timezone is chronologically aligned with a given country.
92
+ */
93
+ declare function isTimezoneAlignedWithCountry(timezone: string, countryCode: string): boolean;
94
+ /**
95
+ * Calculate timezone offset in minutes relative to UTC.
96
+ * Note: Following the standard convention matching LocaleProfile.timezoneOffset:
97
+ * - Negative for zones west of UTC (e.g. -240 for EDT, -300 for EST)
98
+ * - Positive for zones east of UTC (e.g. +480 for CST / Asia/Shanghai, +540 for JST)
99
+ * - 0 for UTC
100
+ */
101
+ declare function getTimezoneOffsetMinutes(timezone: string, date?: Date): number;
102
+ /**
103
+ * List all unique timezones known to the system.
104
+ */
105
+ declare function listAllTimezones(): string[];
106
+
107
+ /**
108
+ * Proxy and Geo-Context Detector.
109
+ * Extracts country and geo information from residential proxy URLs, IP hints, or explicit ISO codes.
110
+ * Pure TypeScript, zero external dependencies.
111
+ */
112
+ interface GeoDetectOptions {
113
+ /** Country code to fall back to if detection fails. Defaults to 'US'. */
114
+ fallbackCountry?: string;
115
+ }
116
+ /**
117
+ * ISO 3166-1 alpha-3 to alpha-2 code mapping.
118
+ */
119
+ declare const ALPHA3_TO_ALPHA2: Record<string, string>;
120
+ /**
121
+ * Common English country name aliases to ISO 3166-1 alpha-2 code.
122
+ */
123
+ declare const COUNTRY_NAME_TO_CODE: Record<string, string>;
124
+ /**
125
+ * Normalize any country input (2-letter, 3-letter, alias, name) to an ISO 3166-1 alpha-2 uppercase code.
126
+ */
127
+ declare function normalizeCountryCode(code?: string | null): string | null;
128
+ /**
129
+ * Extract an ISO country code from a residential proxy URL or connection string.
130
+ * Supports:
131
+ * - Username authentication tokens (e.g. user-country-us, customer-zone-cc-DE, lum-customer-*-country-fr)
132
+ * - Query parameters (e.g. ?country=JP, &country_code=KR, ?cc=SG, &geo=DE)
133
+ * - Subdomain patterns (e.g. us.smartproxy.com, jp.proxy-seller.com)
134
+ */
135
+ declare function extractCountryFromProxyUrl(url: string): string | null;
136
+ /**
137
+ * Universal country detector.
138
+ * Accepts:
139
+ * - Explicit ISO 3166-1 alpha-2 / alpha-3 codes ('US', 'GB', 'jp', 'JPN')
140
+ * - Country names ('Japan', 'United States', 'Germany')
141
+ * - Residential proxy URLs (http://user-country-us:pass@proxy...)
142
+ * - IANA Timezone strings ('America/New_York' -> 'US', 'Asia/Tokyo' -> 'JP')
143
+ * - Falls back to DEFAULT_COUNTRY ('US') when unknown.
144
+ */
145
+ declare function detectCountry(input?: string | null, options?: GeoDetectOptions): string;
146
+
147
+ /**
148
+ * Geo-Chrono Aligner.
149
+ * Aligns browser persona parameters (country, timezone, locale, accept-language header)
150
+ * with zero contradictions for stealth crawlers and automation.
151
+ * Pure TypeScript, zero external dependencies.
152
+ */
153
+
154
+ /**
155
+ * Align geographic and chronological parameters into a cohesive, contradiction-free GeoContext.
156
+ *
157
+ * @param geoInput Proxy URL, ISO country code, IANA timezone string, or GeoOptions object
158
+ * @returns Fully correlated GeoContext
159
+ */
160
+ declare function alignGeoContext(geoInput?: string | GeoOptions): GeoContext;
161
+ /**
162
+ * Verify whether a partial or full GeoContext is free of geographic or chronological contradictions.
163
+ */
164
+ declare function isGeoAligned(context: Partial<GeoContext>): boolean;
165
+ /**
166
+ * Format GeoContext into a LocaleProfile for runtime device-passport consumers.
167
+ */
168
+ declare function toLocaleProfile(geo: GeoContext): {
169
+ language: string;
170
+ languages: string[];
171
+ timezone: string;
172
+ timezoneOffset: number;
173
+ country: string;
174
+ currency: string | undefined;
175
+ };
176
+ /**
177
+ * Format GeoContext into a GeoLocation object for browser geolocation emulation.
178
+ */
179
+ declare function toGeoLocation(geo: GeoContext): {
180
+ latitude: number;
181
+ longitude: number;
182
+ accuracy: number;
183
+ country: string;
184
+ countryCode: string;
185
+ timezone: string;
186
+ locale: string;
187
+ languages: string[];
188
+ };
189
+
190
+ /**
191
+ * Geo and Chrono Aligner module for Device Passport.
192
+ * Provides geographic-locale mapping database, proxy/IP geo detector,
193
+ * and zero-contradiction geo-chrono alignment.
194
+ */
195
+
196
+ declare const GEO_LOCALES: Record<string, CountryLocaleConfig>;
197
+ declare const TIMEZONE_MATRIX: Record<string, string>;
198
+ declare const isValidCountryCode: typeof hasCountryConfig;
199
+ /**
200
+ * Detect country code from residential proxy URL.
201
+ */
202
+ declare function detectGeoFromUrl(url: string): string | null;
203
+ /**
204
+ * Get a complete LocaleProfile for a country code and optional timezone.
205
+ */
206
+ declare function getLocaleProfile(countryCode?: string | null, timezone?: string): LocaleProfile;
207
+
208
+ export { ALPHA3_TO_ALPHA2, COUNTRY_LOCALES, COUNTRY_NAME_TO_CODE, DEFAULT_ACCEPT_LANGUAGE, DEFAULT_COUNTRY, DEFAULT_LOCALE, DEFAULT_TIMEZONE, GEO_LOCALES, GeoContext, GeoOptions, TIMEZONE_MATRIX, TIMEZONE_TO_COUNTRY, alignGeoContext, detectCountry, detectGeoFromUrl, extractCountryFromProxyUrl, formatAcceptLanguage, getAllSupportedCountries, getCountryConfig, getCountryForTimezone, getDefaultTimezoneForCountry, getLocaleProfile, getTimezoneOffsetMinutes, getTimezonesForCountry, hasCountryConfig, isGeoAligned, isTimezoneAlignedWithCountry, isValidCountryCode, isValidTimezone, listAllTimezones, normalizeCountryCode, parseAcceptLanguage, toGeoLocation, toLocaleProfile };
209
+ export type { CountryLocaleConfig, GeoDetectOptions };