ua-browser 0.1.9 → 1.0.1

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.
@@ -0,0 +1,139 @@
1
+ type EngineName = 'Trident' | 'Presto' | 'WebKit' | 'Gecko' | 'KHTML' | 'Blink' | 'EdgeHTML' | 'unknown';
2
+ type BrowserName = 'Safari' | 'Chrome' | 'IE' | 'Edge' | 'Firefox' | 'Firefox Focus' | 'Firefox Nightly' | 'Chromium' | 'Opera' | 'Vivaldi' | 'Yandex' | 'Samsung Internet' | 'DuckDuckGo' | 'Puffin' | 'Arora' | 'Lunascape' | 'QupZilla' | 'Coc Coc' | 'Kindle' | 'Iceweasel' | 'Konqueror' | 'Iceape' | 'SeaMonkey' | 'Epiphany' | '360' | '360EE' | '360SE' | 'UC' | 'QQBrowser' | 'QQ' | 'Baidu' | 'Maxthon' | 'Sogou' | 'Liebao' | '2345Explorer' | '115Browser' | 'TheWorld' | 'XiaoMi' | 'Vivo' | 'Huawei' | 'OPPO' | 'Quark' | 'Qiyu' | 'Wechat' | 'Wechat Miniapp' | 'WechatWork' | 'Taobao' | 'Alipay' | 'Weibo' | 'Douban' | 'Suning' | 'iQiYi' | 'DingTalk' | 'Douyin' | 'unknown';
3
+ type OsName = 'Windows' | 'Linux' | 'MacOS' | 'Android' | 'HarmonyOS' | 'Ubuntu' | 'FreeBSD' | 'Debian' | 'Windows Phone' | 'BlackBerry' | 'MeeGo' | 'Symbian' | 'iOS' | 'Chrome OS' | 'WebOS' | 'Tizen' | 'KaiOS' | 'unknown';
4
+ type DeviceName = 'Mobile' | 'Tablet' | 'PC' | 'TV';
5
+ type ArchName$1 = 'x86' | 'x86_64' | 'arm' | 'arm64' | 'unknown';
6
+ type BotName$1 = 'Googlebot' | 'Bingbot' | 'Baiduspider' | 'Bytespider' | 'YandexBot' | 'DuckDuckBot' | 'Slurp' | 'Sogou' | '360Spider' | 'Applebot' | 'Facebookbot' | 'Twitterbot' | 'LinkedInBot' | 'SemrushBot' | 'AhrefsBot' | 'MJ12bot' | 'PetalBot' | 'GPTBot' | 'ClaudeBot' | 'PerplexityBot' | 'CCBot' | 'AdsBot' | 'GenericBot' | 'unknown';
7
+ interface EnvOption {
8
+ browser: BrowserName;
9
+ version: string;
10
+ engine: EngineName;
11
+ os: OsName;
12
+ osVersion: string;
13
+ device: DeviceName;
14
+ arch: ArchName$1;
15
+ isWebview: boolean;
16
+ isHeadless: boolean;
17
+ isBot: boolean;
18
+ botName: BotName$1;
19
+ language: string;
20
+ platform: string;
21
+ }
22
+ declare global {
23
+ const __wxjs_environment: string;
24
+ var chrome: {
25
+ adblock2345?: unknown;
26
+ common2345?: unknown;
27
+ } | undefined;
28
+ var showModalDialog: unknown;
29
+ var u2f: unknown;
30
+ interface Navigator {
31
+ browserLanguage?: string;
32
+ userAgentData?: {
33
+ platform: string;
34
+ getHighEntropyValues(hints: string[]): Promise<Record<string, string>>;
35
+ };
36
+ connection?: {
37
+ saveData?: boolean;
38
+ };
39
+ }
40
+ }
41
+
42
+ /**
43
+ * A subset of the Navigator interface that our detectors need.
44
+ * Accepting NavContext as a parameter makes every detector pure and testable.
45
+ */
46
+ interface NavContext {
47
+ userAgent: string;
48
+ platform: string;
49
+ language: string;
50
+ browserLanguage?: string;
51
+ maxTouchPoints: number;
52
+ mimeTypes?: MimeTypeArray;
53
+ connection?: {
54
+ saveData?: boolean;
55
+ };
56
+ userAgentData?: {
57
+ platform: string;
58
+ getHighEntropyValues(hints: string[]): Promise<Record<string, string>>;
59
+ };
60
+ }
61
+ /** Build a NavContext from the real browser `navigator`, or return a safe default for Node.js. */
62
+ declare function getNavContext(): NavContext;
63
+ /** Returns the normalised browser language (e.g. "zh-CN" → "zh-CN", "en-us" → "en-US"). */
64
+ declare function getLanguage(nav: NavContext): string;
65
+
66
+ interface ParseOptions {
67
+ /** Nav context to use for language, platform, MIME-type checks, and device detection. */
68
+ nav?: NavContext;
69
+ /** Pre-resolved Windows version string (from getWindowsVersion()). Pass to avoid async races. */
70
+ windowsVersion?: string | null;
71
+ }
72
+ /**
73
+ * Parse a user agent string into a full browser/OS/engine/device description.
74
+ *
75
+ * Pure function — no global state, no singletons. All environment access is
76
+ * supplied through `options.nav`; omit it for Node.js / testing contexts.
77
+ */
78
+ declare function parseUA(ua: string, options?: ParseOptions): EnvOption;
79
+
80
+ /**
81
+ * Asynchronously detect whether the Windows version is 10 or 11 using the
82
+ * User-Agent Client Hints API (navigator.userAgentData).
83
+ *
84
+ * Returns '11', '10', or null (non-Windows / API unavailable / error).
85
+ *
86
+ * Because this is async, callers that need accurate Windows 11 detection
87
+ * should await this result and pass it to parseUA() as `options.windowsVersion`.
88
+ */
89
+ declare function getWindowsVersion(nav: NavContext): Promise<string | null>;
90
+
91
+ type BotName = 'Googlebot' | 'Bingbot' | 'Baiduspider' | 'Bytespider' | 'YandexBot' | 'DuckDuckBot' | 'Slurp' | 'Sogou' | '360Spider' | 'Applebot' | 'Facebookbot' | 'Twitterbot' | 'LinkedInBot' | 'SemrushBot' | 'AhrefsBot' | 'MJ12bot' | 'PetalBot' | 'GPTBot' | 'ClaudeBot' | 'PerplexityBot' | 'CCBot' | 'AdsBot' | 'GenericBot' | 'unknown';
92
+
93
+ interface BotResult {
94
+ isBot: boolean;
95
+ botName: BotName;
96
+ }
97
+ /**
98
+ * Detect whether the UA belongs to a bot, crawler, or spider.
99
+ * Returns the specific bot name when recognised, 'GenericBot' for generic patterns,
100
+ * or 'unknown' for regular user agents.
101
+ */
102
+ declare function detectBot(ua: string): BotResult;
103
+
104
+ type ArchName = 'x86' | 'x86_64' | 'arm' | 'arm64' | 'unknown';
105
+
106
+ /**
107
+ * Detect the CPU architecture from a user agent string.
108
+ * Returns 'unknown' when the UA provides no architecture hints.
109
+ */
110
+ declare function detectArch(ua: string): ArchName;
111
+
112
+ /**
113
+ * Detect whether the UA belongs to a headless or automation-driven browser.
114
+ *
115
+ * Note: modern Puppeteer/Playwright using stealth mode can hide these markers.
116
+ * This catches the common/unmodified cases only.
117
+ */
118
+ declare function detectHeadless(ua: string): boolean;
119
+
120
+ declare const VERSION: string;
121
+
122
+ /** Check whether a UA string indicates an Android webview environment. */
123
+ declare const isWebview: (ua: string) => boolean;
124
+ /** Check whether the current context is a WeChat mini-program. */
125
+ declare const isWechatMiniapp: () => boolean;
126
+ /**
127
+ * Detect browser, OS, engine and device information.
128
+ *
129
+ * @param ua - Optional UA string override. Defaults to `navigator.userAgent`.
130
+ */
131
+ declare function uaBrowser(ua?: string): EnvOption;
132
+ declare namespace uaBrowser {
133
+ var isWebview: (ua: string) => boolean;
134
+ var isWechatMiniapp: () => boolean;
135
+ var getLanguage: () => string;
136
+ var VERSION: string;
137
+ }
138
+
139
+ export { type ArchName$1 as ArchName, type BotName$1 as BotName, type BrowserName, type DeviceName, type EngineName, type EnvOption, type OsName, VERSION, uaBrowser as default, detectArch, detectBot, detectHeadless, getLanguage, getNavContext, getWindowsVersion, isWebview, isWechatMiniapp, parseUA };
package/dist/index.d.ts CHANGED
@@ -1,140 +1,139 @@
1
- export type HashOptions = Record<string, string>
2
-
3
- export type OsVersionType =
4
- | 'Android'
5
- | 'iOS'
6
- | 'Debian'
7
- | 'Windows Phone'
8
- | 'MacOS'
9
- | 'WebOS'
10
- | 'HarmonyOS'
11
- | 'Windows'
12
-
13
- export type EnvWebview = {
14
- isWebview: boolean
1
+ type EngineName = 'Trident' | 'Presto' | 'WebKit' | 'Gecko' | 'KHTML' | 'Blink' | 'EdgeHTML' | 'unknown';
2
+ type BrowserName = 'Safari' | 'Chrome' | 'IE' | 'Edge' | 'Firefox' | 'Firefox Focus' | 'Firefox Nightly' | 'Chromium' | 'Opera' | 'Vivaldi' | 'Yandex' | 'Samsung Internet' | 'DuckDuckGo' | 'Puffin' | 'Arora' | 'Lunascape' | 'QupZilla' | 'Coc Coc' | 'Kindle' | 'Iceweasel' | 'Konqueror' | 'Iceape' | 'SeaMonkey' | 'Epiphany' | '360' | '360EE' | '360SE' | 'UC' | 'QQBrowser' | 'QQ' | 'Baidu' | 'Maxthon' | 'Sogou' | 'Liebao' | '2345Explorer' | '115Browser' | 'TheWorld' | 'XiaoMi' | 'Vivo' | 'Huawei' | 'OPPO' | 'Quark' | 'Qiyu' | 'Wechat' | 'Wechat Miniapp' | 'WechatWork' | 'Taobao' | 'Alipay' | 'Weibo' | 'Douban' | 'Suning' | 'iQiYi' | 'DingTalk' | 'Douyin' | 'unknown';
3
+ type OsName = 'Windows' | 'Linux' | 'MacOS' | 'Android' | 'HarmonyOS' | 'Ubuntu' | 'FreeBSD' | 'Debian' | 'Windows Phone' | 'BlackBerry' | 'MeeGo' | 'Symbian' | 'iOS' | 'Chrome OS' | 'WebOS' | 'Tizen' | 'KaiOS' | 'unknown';
4
+ type DeviceName = 'Mobile' | 'Tablet' | 'PC' | 'TV';
5
+ type ArchName$1 = 'x86' | 'x86_64' | 'arm' | 'arm64' | 'unknown';
6
+ type BotName$1 = 'Googlebot' | 'Bingbot' | 'Baiduspider' | 'Bytespider' | 'YandexBot' | 'DuckDuckBot' | 'Slurp' | 'Sogou' | '360Spider' | 'Applebot' | 'Facebookbot' | 'Twitterbot' | 'LinkedInBot' | 'SemrushBot' | 'AhrefsBot' | 'MJ12bot' | 'PetalBot' | 'GPTBot' | 'ClaudeBot' | 'PerplexityBot' | 'CCBot' | 'AdsBot' | 'GenericBot' | 'unknown';
7
+ interface EnvOption {
8
+ browser: BrowserName;
9
+ version: string;
10
+ engine: EngineName;
11
+ os: OsName;
12
+ osVersion: string;
13
+ device: DeviceName;
14
+ arch: ArchName$1;
15
+ isWebview: boolean;
16
+ isHeadless: boolean;
17
+ isBot: boolean;
18
+ botName: BotName$1;
19
+ language: string;
20
+ platform: string;
21
+ }
22
+ declare global {
23
+ const __wxjs_environment: string;
24
+ var chrome: {
25
+ adblock2345?: unknown;
26
+ common2345?: unknown;
27
+ } | undefined;
28
+ var showModalDialog: unknown;
29
+ var u2f: unknown;
30
+ interface Navigator {
31
+ browserLanguage?: string;
32
+ userAgentData?: {
33
+ platform: string;
34
+ getHighEntropyValues(hints: string[]): Promise<Record<string, string>>;
35
+ };
36
+ connection?: {
37
+ saveData?: boolean;
38
+ };
39
+ }
15
40
  }
16
41
 
17
- export type EnvPart = Record<'version' | 'osVersion' | 'platfrom' | 'languge', string>
42
+ /**
43
+ * A subset of the Navigator interface that our detectors need.
44
+ * Accepting NavContext as a parameter makes every detector pure and testable.
45
+ */
46
+ interface NavContext {
47
+ userAgent: string;
48
+ platform: string;
49
+ language: string;
50
+ browserLanguage?: string;
51
+ maxTouchPoints: number;
52
+ mimeTypes?: MimeTypeArray;
53
+ connection?: {
54
+ saveData?: boolean;
55
+ };
56
+ userAgentData?: {
57
+ platform: string;
58
+ getHighEntropyValues(hints: string[]): Promise<Record<string, string>>;
59
+ };
60
+ }
61
+ /** Build a NavContext from the real browser `navigator`, or return a safe default for Node.js. */
62
+ declare function getNavContext(): NavContext;
63
+ /** Returns the normalised browser language (e.g. "zh-CN" → "zh-CN", "en-us" → "en-US"). */
64
+ declare function getLanguage(nav: NavContext): string;
18
65
 
19
- export type EnvOption = EnvPart & EnvWebview & {
20
- engine:
21
- | 'Trident'
22
- | 'Presto'
23
- | 'WebKit'
24
- | 'Gecko'
25
- | 'KHTML'
26
- | 'Blink'
27
- | 'EdgeHTML'
28
- | 'unknown'
29
- browser:
30
- | 'Safari'
31
- | 'Chrome'
32
- | 'IE'
33
- | 'Edge'
34
- | 'Firefox'
35
- | 'Firefox Focus'
36
- | 'Chromium'
37
- | 'Opera'
38
- | 'Vivaldi'
39
- | 'Yandex'
40
- | 'Arora'
41
- | 'Lunascape'
42
- | 'QupZilla'
43
- | 'Coc Coc'
44
- | 'Kindle'
45
- | 'Iceweasel'
46
- | 'Konqueror'
47
- | 'Iceape'
48
- | 'SeaMonkey'
49
- | 'Epiphany'
50
- | '360'
51
- | '360EE'
52
- | '360SE'
53
- | 'UC'
54
- | 'QQBrowser'
55
- | 'QQ'
56
- | 'Baidu'
57
- | 'Maxthon'
58
- | 'Sogou'
59
- | 'Liebao'
60
- | '2345Explorer'
61
- | '115Browser'
62
- | 'TheWorld'
63
- | 'OPPO'
64
- | 'XiaoMi'
65
- | 'Quark'
66
- | 'Qiyu'
67
- | 'Wechat'
68
- | 'WechatWork'
69
- | 'Taobao'
70
- | 'Alipay'
71
- | 'Weibo'
72
- | 'Douban'
73
- | 'Suning'
74
- | 'iQiYi'
75
- | 'DingTalk'
76
- | 'Huawei'
77
- | 'Vivo'
78
- | 'Firefox Nightly'
79
- | 'Wechat Miniapp'
80
- | 'Douyin'
81
- | 'unknown'
82
- os:
83
- | 'Windows'
84
- | 'Linux'
85
- | 'MacOS'
86
- | 'Android'
87
- | 'HarmonyOS'
88
- | 'Ubuntu'
89
- | 'FreeBSD'
90
- | 'Debian'
91
- | 'Windows Phone'
92
- | 'BlackBerry'
93
- | 'MeeGo'
94
- | 'Symbian'
95
- | 'iOS'
96
- | 'Chrome OS'
97
- | 'WebOS'
98
- | 'unknown'
99
- device:
100
- | 'Mobile'
101
- | 'Tablet'
102
- | 'Pc'
66
+ interface ParseOptions {
67
+ /** Nav context to use for language, platform, MIME-type checks, and device detection. */
68
+ nav?: NavContext;
69
+ /** Pre-resolved Windows version string (from getWindowsVersion()). Pass to avoid async races. */
70
+ windowsVersion?: string | null;
103
71
  }
72
+ /**
73
+ * Parse a user agent string into a full browser/OS/engine/device description.
74
+ *
75
+ * Pure function — no global state, no singletons. All environment access is
76
+ * supplied through `options.nav`; omit it for Node.js / testing contexts.
77
+ */
78
+ declare function parseUA(ua: string, options?: ParseOptions): EnvOption;
104
79
 
105
- declare function uaBrowser(ua?: string): EnvOption
80
+ /**
81
+ * Asynchronously detect whether the Windows version is 10 or 11 using the
82
+ * User-Agent Client Hints API (navigator.userAgentData).
83
+ *
84
+ * Returns '11', '10', or null (non-Windows / API unavailable / error).
85
+ *
86
+ * Because this is async, callers that need accurate Windows 11 detection
87
+ * should await this result and pass it to parseUA() as `options.windowsVersion`.
88
+ */
89
+ declare function getWindowsVersion(nav: NavContext): Promise<string | null>;
106
90
 
107
- declare namespace uaBrowser {
108
- /** 检查 `webview` 浏览环境,仅支持 `android` */
109
- function isWebview(ua: string): boolean
110
- /** 检查微信小程序 */
111
- function isWechatMiniapp(): boolean
112
- /** 浏览器语言 */
113
- function getLanguage(): string
114
- /** 当前版本 */
115
- const VERSION: string
91
+ type BotName = 'Googlebot' | 'Bingbot' | 'Baiduspider' | 'Bytespider' | 'YandexBot' | 'DuckDuckBot' | 'Slurp' | 'Sogou' | '360Spider' | 'Applebot' | 'Facebookbot' | 'Twitterbot' | 'LinkedInBot' | 'SemrushBot' | 'AhrefsBot' | 'MJ12bot' | 'PetalBot' | 'GPTBot' | 'ClaudeBot' | 'PerplexityBot' | 'CCBot' | 'AdsBot' | 'GenericBot' | 'unknown';
92
+
93
+ interface BotResult {
94
+ isBot: boolean;
95
+ botName: BotName;
116
96
  }
97
+ /**
98
+ * Detect whether the UA belongs to a bot, crawler, or spider.
99
+ * Returns the specific bot name when recognised, 'GenericBot' for generic patterns,
100
+ * or 'unknown' for regular user agents.
101
+ */
102
+ declare function detectBot(ua: string): BotResult;
117
103
 
118
- export default uaBrowser
104
+ type ArchName = 'x86' | 'x86_64' | 'arm' | 'arm64' | 'unknown';
119
105
 
120
- declare global {
121
- const __wxjs_environment: string
106
+ /**
107
+ * Detect the CPU architecture from a user agent string.
108
+ * Returns 'unknown' when the UA provides no architecture hints.
109
+ */
110
+ declare function detectArch(ua: string): ArchName;
122
111
 
123
- const chrome: {
124
- adblock2345: any
125
- common2345: any
126
- }
112
+ /**
113
+ * Detect whether the UA belongs to a headless or automation-driven browser.
114
+ *
115
+ * Note: modern Puppeteer/Playwright using stealth mode can hide these markers.
116
+ * This catches the common/unmodified cases only.
117
+ */
118
+ declare function detectHeadless(ua: string): boolean;
127
119
 
128
- const showModalDialog: any
120
+ declare const VERSION: string;
129
121
 
130
- const u2f: any
131
-
132
- // Navigator
133
- interface Navigator {
134
- browserLanguage: string
135
- userAgentData: Record<string, any>
136
- connection: Record<string, any>
137
- }
122
+ /** Check whether a UA string indicates an Android webview environment. */
123
+ declare const isWebview: (ua: string) => boolean;
124
+ /** Check whether the current context is a WeChat mini-program. */
125
+ declare const isWechatMiniapp: () => boolean;
126
+ /**
127
+ * Detect browser, OS, engine and device information.
128
+ *
129
+ * @param ua - Optional UA string override. Defaults to `navigator.userAgent`.
130
+ */
131
+ declare function uaBrowser(ua?: string): EnvOption;
132
+ declare namespace uaBrowser {
133
+ var isWebview: (ua: string) => boolean;
134
+ var isWechatMiniapp: () => boolean;
135
+ var getLanguage: () => string;
136
+ var VERSION: string;
138
137
  }
139
138
 
140
- export {}
139
+ export { type ArchName$1 as ArchName, type BotName$1 as BotName, type BrowserName, type DeviceName, type EngineName, type EnvOption, type OsName, VERSION, uaBrowser as default, detectArch, detectBot, detectHeadless, getLanguage, getNavContext, getWindowsVersion, isWebview, isWechatMiniapp, parseUA };
package/dist/index.min.js CHANGED
@@ -1 +1,3 @@
1
- function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,n){return r&&_defineProperties(e.prototype,r),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:r+""}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e,r){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).uaBrowser=r()}(this,(function(){"use strict";var e={};"undefined"!=typeof navigator&&(e=navigator);var r,n=e.userAgent||"",o=e.mimeTypes,i=e.platform,a={Trident:/(Trident|NET CLR)/,Presto:/Presto/,WebKit:/AppleWebKit/,Gecko:/Gecko\//,KHTML:/KHTML\//},t={Safari:/Safari/,Chrome:/(Chrome|CriOS)/,IE:/(MSIE|Trident)/,Edge:/(Edge|Edg\/|EdgA|EdgiOS)/,Firefox:/(Firefox|FxiOS)/,"Firefox Focus":/Focus/,Chromium:/Chromium/,Opera:/(Opera|OPR|OPT)/,Vivaldi:/Vivaldi/,Yandex:/YaBrowser/,Arora:/Arora/,Lunascape:/Lunascape/,QupZilla:/QupZilla/,"Coc Coc":/coc_coc_browser/,Kindle:/(Kindle|Silk\/)/,Iceweasel:/Iceweasel/,Konqueror:/Konqueror/,Iceape:/Iceape/,SeaMonkey:/SeaMonkey/,Epiphany:/Epiphany/,360:/(QihooBrowser|QHBrowser)/,"360EE":/360EE/,"360SE":/360SE/,UC:/(UCBrowser|UBrowser|UCWEB)/,QQBrowser:/QQBrowser/,QQ:/QQ\//,Baidu:/(Baidu|BIDUBrowser|baidubrowser|baiduboxapp|BaiduHD)/,Maxthon:/Maxthon/,Sogou:/(MetaSr|Sogou)/,Liebao:/(LBBROWSER|LieBaoFast)/,"2345Explorer":/2345Explorer/,"115Browser":/115Browser/,TheWorld:/TheWorld/,XiaoMi:/MiuiBrowser/,Vivo:/VivoBrowser/,Huawei:/HuaweiBrowser/,OPPO:/HeyTapBrowser/,Quark:/Quark/,Qiyu:/Qiyu/,Wechat:/MicroMessenger/,WechatWork:/wxwork\//,Taobao:/AliApp\(TB/,Alipay:/AliApp\(AP/,Weibo:/Weibo/,Douban:/com\.douban\.frodo/,Suning:/SNEBUY-APP/,iQiYi:/IqiyiApp/,DingTalk:/DingTalk/,Douyin:/aweme/},u={Windows:/Windows/,Linux:/(Linux|X11)/,MacOS:/Macintosh/,Android:/(Android|Adr)/,HarmonyOS:/HarmonyOS/,Ubuntu:/Ubuntu/,FreeBSD:/FreeBSD/,Debian:/Debian/,"Windows Phone":/(IEMobile|Windows Phone)/,BlackBerry:/(BlackBerry|RIM)/,MeeGo:/MeeGo/,Symbian:/Symbian/,iOS:/like Mac OS X/,"Chrome OS":/CrOS/,WebOS:/hpwOS/},c={Mobile:/(Mobi|iPh|480)/,Tablet:/(Tablet|Pad|Nexus 7)/},s={isWebview:/; wv/},l={os:Object.keys(u),device:Object.keys(c),engine:Object.keys(a),browser:Object.keys(t)},p=function(e){try{return!!o.namedItem(e)}catch(e){return!1}},d=function(e,r){for(var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,i=e.length;i--;){var a=e[i];if(r[a].test(o))return a}return"unknown"};(null==e?void 0:e.userAgentData)&&e.userAgentData.getHighEntropyValues(["platformVersion"]).then((function(n){if("Windows"===e.userAgentData.platform){var o=parseInt(n.platformVersion.split(".")[0]);r=o>=13?"11":"10"}}));var f=function(){var r;return null===(r=e.browserLanguage||e.language)||void 0===r?void 0:r.replace(/-\w+/g,(function(e){return e.toUpperCase()}))},$=function(){return"undefined"!=typeof __wxjs_environment&&"miniprogram"===__wxjs_environment},w=function(e){return s.isWebview.test(e)},h=new(function(){return _createClass((function e(r){var o=this;_classCallCheck(this,e),this.ua=n,this.version={Safari:function(){return o.ua.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return o.ua.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return o.ua.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return o.ua.replace(/^.*Edge\/([\d.]+).*$/,"$1").replace(/^.*Edg\/([\d.]+).*$/,"$1").replace(/^.*EdgA\/([\d.]+).*$/,"$1").replace(/^.*EdgiOS\/([\d.]+).*$/,"$1")},Firefox:function(){return o.ua.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return o.ua.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return o.ua.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return o.ua.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1").replace(/^.*OPT\/([\d.]+).*$/,"$1")},Vivaldi:function(){return o.ua.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return o.ua.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return o.ua.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return o.ua.replace(/^.*Lunascape[\s]([\d.]+).*$/,"$1")},QupZilla:function(){return o.ua.replace(/^.*QupZilla[\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return o.ua.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return o.ua.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return o.ua.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return o.ua.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return o.ua.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return o.ua.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return o.ua.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},Maxthon:function(){return o.ua.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return o.ua.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return o.ua.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return o.ua.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1").replace(/^.*baiduboxapp\/([\d.]+).*$/,"$1")},UC:function(){return o.ua.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return o.ua.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},TheWorld:function(){return o.ua.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return o.ua.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Vivo:function(){return o.ua.replace(/^.*VivoBrowser\/([\d.]+).*$/,"$1")},OPPO:function(){return o.ua.replace(/^.*HeyTapBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return o.ua.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return o.ua.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return o.ua.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},WechatWork:function(){return o.ua.replace(/^.*wxwork\/([\d.]+).*$/,"$1")},Taobao:function(){return o.ua.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return o.ua.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return o.ua.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return o.ua.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return o.ua.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return o.ua.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")},DingTalk:function(){return o.ua.replace(/^.*DingTalk\/([\d.]+).*$/,"$1")},Huawei:function(){return o.ua.replace(/^.*Version\/([\d.]+).*$/,"$1").replace(/^.*HuaweiBrowser\/([\d.]+).*$/,"$1")},Douyin:function(){return o.ua.replace(/^.*app_version\/([\d.]+).*$/,"$1")},"115Browser":function(){return o.ua.replace(/^.*115Browser\/([\d.]+).*$/,"$1")},360:function(){return o.ua.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{108:"14.0",86:"13.0",78:"12.0",69:"11.0",63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[o.getChromeVars()]||""},"360EE":function(){return{86:"13.0",78:"12.0",69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[o.getChromeVars()]||""},"2345Explorer":function(){return{69:"10.0",55:"9.9"}[o.getChromeVars()]||o.ua.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1").replace(/^.*Mb2345Browser\/([\d.]+).*$/,"$1")},Liebao:function(){var e="";/LieBaoFast/.test(o.ua)&&(e=o.ua.replace(/^.*LieBaoFast\/([\d.]+).*$/,"$1"));var r=o.getChromeVars();return e||{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[r]||""}},this.osVersion={Android:function(){return o.ua.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return o.ua.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return o.ua.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return o.ua.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},MacOS:function(){return o.ua.replace(/^.*Mac OS X -?([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return o.ua.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")},HarmonyOS:function(){return{10:"2"}[o.ua.replace(/^Mozilla.*Android ([\d.]+)[;)].*$/,"$1")]||""},Windows:function(){var e=o.ua.replace(/^Mozilla\/\d.0 \(Windows NT ([\d.]+);.*$/,"$1");return{10:"10",6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||parseInt(e).toString()}},this.getChromeVars=function(){return o.ua.replace(/^.*Chrome\/([\d]+).*$/,"$1")},this.setUA(r)}),[{key:"getOs",value:function(){return d(l.os,u,this.ua)}},{key:"getEngine",value:function(){return d(l.engine,a,this.ua)}},{key:"getBrowser",value:function(){return d(l.browser,t,this.ua)}},{key:"getDevice",value:function(){if("MacIntel"===i&&e.maxTouchPoints>1)return"Tablet";var r=d(l.device,c,this.ua);return"unknown"===r?"PC":r}},{key:"setUA",value:function(e){"string"==typeof e?this.ua=e:(void 0!==e&&console.warn("`ua` must be of type string."),this.ua=n)}},{key:"getEnv",value:function(n){var o,a;this.setUA(n);var u={version:"unknown",osVersion:"unknown",engine:this.getEngine(),browser:this.getBrowser(),os:this.getOs(),device:this.getDevice(),isWebview:w(this.ua),language:null!==(o=f())&&void 0!==o?o:"unknown",platfrom:null!=i?i:"unknown"},c=u.browser,s=!1;if("undefined"!=typeof chrome){var d=this.getChromeVars();chrome.adblock2345||chrome.common2345?u.browser="2345Explorer":p("application/360softmgrplugin")||p("application/mozilla-npqihooquicklogin")||d>"36"&&"undefined"!=typeof showModalDialog?s=!0:d>"45"&&!(s=p("application/vnd.chromium.remoting-viewer"))&&d>="69"&&(s=p("application/hwepass2001.installepass2001")||p("application/asx"))}return"Mobile"===u.device&&/iPad/.test(this.ua)?u.device="Tablet":s&&(c=p("application/gameplugin")||!(null===(a=null==e?void 0:e.connection)||void 0===a?void 0:a.saveData)?"360SE":"360EE"),l.browser.indexOf(c)>=l.browser.indexOf(u.browser)&&(u.browser=c),"Baidu"===u.browser&&t.Opera.test(this.ua)&&(u.browser="Opera"),u.os in this.osVersion&&(u.osVersion=this.osVersion[u.os](),u.osVersion===this.ua&&(u.osVersion="unknown")),"Windows"===u.os&&r&&(u.osVersion=r),u.browser in this.version&&(u.version=this.version[u.browser](),u.version===this.ua&&(u.version="unknown")),"Chrome"===u.browser&&this.ua.match(/\S+Browser/)?(u.browser=this.ua.match(/\S+Browser/)[0],u.version=this.ua.replace(/^.*Browser\/([\d.]+).*$/,"$1")):"Firefox"!==u.browser||"undefined"==typeof clientInformation&&"undefined"!=typeof u2f?"Wechat"===u.browser&&$()&&(u.browser="Wechat Miniapp"):u.browser="".concat(u.browser," Nightly"),"Edge"===u.browser?u.engine=parseInt(u.version)>75?"Blink":"EdgeHTML":(t.Chrome.test(this.ua)&&"WebKit"===u.engine&&parseInt(this.version.Chrome())>27||"Opera"===u.browser&&parseInt(u.version)>12||"Yandex"===u.browser)&&(u.engine="Blink"),u}}])}());function b(e){return h.getEnv(e)}return b.isWebview=w,b.isWechatMiniapp=$,b.getLanguage=f,b.VERSION="0.1.7",b}));
1
+ var uaBrowser=(function(){'use strict';var E={version:"1.0.1"};var S=[{name:"Safari",priority:10,detect:/Safari/,versionPattern:/Version\/([\d.]+)/},{name:"Chrome",priority:20,detect:/(Chrome|CriOS)/,versionPattern:[/Chrome\/([\d.]+)/,/CriOS\/([\d.]+)/]},{name:"IE",priority:30,detect:/(MSIE|Trident)/,versionPattern:[/MSIE ([\d.]+)/,/rv:([\d.]+)/]},{name:"Edge",priority:40,detect:/(Edge|Edg\/|EdgA|EdgiOS)/,versionPattern:[/Edge\/([\d.]+)/,/Edg\/([\d.]+)/,/EdgA\/([\d.]+)/,/EdgiOS\/([\d.]+)/]},{name:"Firefox",priority:50,detect:/(Firefox|FxiOS)/,versionPattern:[/Firefox\/([\d.]+)/,/FxiOS\/([\d.]+)/]},{name:"Firefox Focus",priority:55,detect:/Focus/,versionPattern:/Focus\/([\d.]+)/},{name:"Chromium",priority:60,detect:/Chromium/,versionPattern:/Chromium\/([\d.]+)/},{name:"Opera",priority:70,detect:/(Opera|OPR|OPT)/,versionPattern:[/Opera\/([\d.]+)/,/OPR\/([\d.]+)/,/OPT\/([\d.]+)/]},{name:"Vivaldi",priority:80,detect:/Vivaldi/,versionPattern:/Vivaldi\/([\d.]+)/},{name:"Yandex",priority:90,detect:/YaBrowser/,versionPattern:/YaBrowser\/([\d.]+)/},{name:"Samsung Internet",priority:92,detect:/SamsungBrowser/,versionPattern:/SamsungBrowser\/([\d.]+)/},{name:"DuckDuckGo",priority:94,detect:/DuckDuckGo\//,versionPattern:/DuckDuckGo\/([\d.]+)/},{name:"Puffin",priority:96,detect:/Puffin\//,versionPattern:/Puffin\/([\d.]+)/},{name:"Arora",priority:100,detect:/Arora/,versionPattern:/Arora\/([\d.]+)/},{name:"Lunascape",priority:110,detect:/Lunascape/,versionPattern:/Lunascape[\s]([\d.]+)/},{name:"QupZilla",priority:120,detect:/QupZilla/,versionPattern:/QupZilla[\s]([\d.]+)/},{name:"Coc Coc",priority:130,detect:/coc_coc_browser/,versionPattern:/coc_coc_browser\/([\d.]+)/},{name:"Kindle",priority:140,detect:/(Kindle|Silk\/)/,versionPattern:/Version\/([\d.]+)/},{name:"Iceweasel",priority:150,detect:/Iceweasel/,versionPattern:/Iceweasel\/([\d.]+)/},{name:"Konqueror",priority:160,detect:/Konqueror/,versionPattern:/Konqueror\/([\d.]+)/},{name:"Iceape",priority:170,detect:/Iceape/,versionPattern:/Iceape\/([\d.]+)/},{name:"SeaMonkey",priority:180,detect:/SeaMonkey/,versionPattern:/SeaMonkey\/([\d.]+)/},{name:"Epiphany",priority:190,detect:/Epiphany/,versionPattern:/Epiphany\/([\d.]+)/},{name:"Maxthon",priority:200,detect:/Maxthon/,versionPattern:/Maxthon\/([\d.]+)/},{name:"360",priority:300,detect:/(QihooBrowser|QHBrowser)/,versionPattern:/QihooBrowser\/([\d.]+)/},{name:"360SE",priority:310,detect:/360SE/,versionPattern:null,chromeLookup:{108:"14.0",86:"13.0",78:"12.0",69:"11.0",63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}},{name:"360EE",priority:320,detect:/360EE/,versionPattern:null,chromeLookup:{86:"13.0",78:"12.0",69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}},{name:"UC",priority:330,detect:/(UCBrowser|UBrowser|UCWEB)/,versionPattern:/UC?Browser\/([\d.]+)/},{name:"QQBrowser",priority:340,detect:/QQBrowser/,versionPattern:/QQBrowser\/([\d.]+)/},{name:"QQ",priority:345,detect:/QQ\//,versionPattern:/QQ\/([\d.]+)/},{name:"Baidu",priority:350,detect:/(Baidu|BIDUBrowser|baidubrowser|baiduboxapp|BaiduHD)/,versionPattern:[/BIDUBrowser[\s/]([\d.]+)/,/baiduboxapp\/([\d.]+)/]},{name:"Sogou",priority:360,detect:/(MetaSr|Sogou)/,versionPattern:[/SE ([\d.X]+)/,/SogouMobileBrowser\/([\d.]+)/]},{name:"Liebao",priority:370,detect:/(LBBROWSER|LieBaoFast)/,versionPattern:/LieBaoFast\/([\d.]+)/,chromeLookup:{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}},{name:"2345Explorer",priority:380,detect:/2345Explorer/,versionPattern:[/2345Explorer\/([\d.]+)/,/Mb2345Browser\/([\d.]+)/],chromeLookup:{69:"10.0",55:"9.9"}},{name:"115Browser",priority:390,detect:/115Browser/,versionPattern:/115Browser\/([\d.]+)/},{name:"TheWorld",priority:400,detect:/TheWorld/,versionPattern:/TheWorld ([\d.]+)/},{name:"XiaoMi",priority:410,detect:/MiuiBrowser/,versionPattern:/MiuiBrowser\/([\d.]+)/},{name:"Vivo",priority:420,detect:/VivoBrowser/,versionPattern:/VivoBrowser\/([\d.]+)/},{name:"Huawei",priority:430,detect:/HuaweiBrowser/,versionPattern:[/HuaweiBrowser\/([\d.]+)/,/Version\/([\d.]+)/]},{name:"OPPO",priority:440,detect:/HeyTapBrowser/,versionPattern:/HeyTapBrowser\/([\d.]+)/},{name:"Quark",priority:450,detect:/Quark/,versionPattern:/Quark\/([\d.]+)/},{name:"Qiyu",priority:460,detect:/Qiyu/,versionPattern:/Qiyu\/([\d.]+)/},{name:"WechatWork",priority:500,detect:/wxwork\//,versionPattern:/wxwork\/([\d.]+)/},{name:"Wechat",priority:510,detect:/MicroMessenger/,versionPattern:/MicroMessenger\/([\d.]+)/},{name:"Taobao",priority:520,detect:/AliApp\(TB/,versionPattern:/AliApp\(TB\/([\d.]+)/},{name:"Alipay",priority:530,detect:/AliApp\(AP/,versionPattern:/AliApp\(AP\/([\d.]+)/},{name:"Weibo",priority:540,detect:/Weibo/,versionPattern:/weibo__([\d.]+)/},{name:"Douban",priority:550,detect:/com\.douban\.frodo/,versionPattern:/com\.douban\.frodo\/([\d.]+)/},{name:"Suning",priority:560,detect:/SNEBUY-APP/,versionPattern:/SNEBUY-APP([\d.]+)/},{name:"iQiYi",priority:570,detect:/IqiyiApp/,versionPattern:/IqiyiVersion\/([\d.]+)/},{name:"DingTalk",priority:580,detect:/DingTalk/,versionPattern:/DingTalk\/([\d.]+)/},{name:"Douyin",priority:590,detect:/aweme/,versionPattern:/app_version\/([\d.]+)/}];function v(e,r){let t=r.exec(e);if(!t)return null;let n=t[1];return n!=null&&n!==""?n:null}function k(e,r){for(let t of r){let n=v(e,t);if(n!==null)return n}return null}function O(e,r){let t=/Chrome\/([\d]+)/.exec(e);if(!t)return null;let n=t[1];return Object.prototype.hasOwnProperty.call(r,n)?r[n]:null}function D(e){let r=null;for(let n of S)n.detect.test(e)&&(r===null||n.priority>=r.priority)&&(r=n);if(!r)return {browser:"unknown",version:"unknown"};let t=null;if(r.chromeLookup&&(t=O(e,r.chromeLookup)),t===null&&r.versionPattern!==null){let n=Array.isArray(r.versionPattern)?r.versionPattern:[r.versionPattern];t=k(e,n);}return {browser:r.name,version:t!=null?t:"unknown"}}var A=[{name:"KHTML",detect:/KHTML\//},{name:"Trident",detect:/(Trident|NET CLR)/},{name:"Presto",detect:/Presto/},{name:"Gecko",detect:/Gecko\//},{name:"WebKit",detect:/AppleWebKit/}];function N(e,r,t){var o,s;let n="unknown";for(let d of A)d.detect.test(e)&&(n=d.name);return (n==="WebKit"&&/(Chrome|CriOS)/.test(e)&&parseInt((s=((o=/Chrome\/([\d]+)/.exec(e))!=null?o:[])[1])!=null?s:"0",10)>27||r==="Opera"&&parseInt(t,10)>12||r==="Yandex")&&(n="Blink"),r==="Edge"&&(n=parseInt(t,10)>75?"Blink":"EdgeHTML"),n}var T=[{name:"WebOS",detect:/hpwOS/,versionPattern:/hpwOS\/([\d.]+)/},{name:"Symbian",detect:/Symbian/,versionPattern:null},{name:"MeeGo",detect:/MeeGo/,versionPattern:null},{name:"BlackBerry",detect:/(BlackBerry|RIM)/,versionPattern:null},{name:"Windows Phone",detect:/(IEMobile|Windows Phone)/,versionPattern:/Windows Phone(?: OS)? ([\d.]+)/},{name:"FreeBSD",detect:/FreeBSD/,versionPattern:null},{name:"Debian",detect:/Debian/,versionPattern:/Debian\/([\d.]+)/},{name:"Ubuntu",detect:/Ubuntu/,versionPattern:null},{name:"Chrome OS",detect:/CrOS/,versionPattern:null},{name:"Linux",detect:/(Linux|X11)/,versionPattern:null},{name:"Tizen",detect:/Tizen/,versionPattern:/Tizen ([\d.]+)/},{name:"iOS",detect:/like Mac OS X/,versionPattern:/OS ([\d_]+) like/},{name:"MacOS",detect:/Macintosh/,versionPattern:/Mac OS X -?([\d_.]+)/},{name:"HarmonyOS",detect:/HarmonyOS/,versionPattern:/Android ([\d.]+)[;)]/,versionLookup:{10:"2"}},{name:"Android",detect:/(Android|Adr)/,versionPattern:/(?:Android|Adr) ([\d.]+)/},{name:"KaiOS",detect:/KAIOS/,versionPattern:/KAIOS\/([\d.]+)/},{name:"Windows",detect:/Windows/,versionPattern:/Windows NT ([\d.]+)/,versionLookup:{10:"10","6.4":"10","6.3":"8.1","6.2":"8","6.1":"7","6.0":"Vista","5.2":"XP","5.1":"XP","5.0":"2000"}}];function C(e,r){let t=null;for(let o of T)o.detect.test(e)&&(t=o);if(!t)return {os:"unknown",osVersion:"unknown"};let n="unknown";if(t.versionPattern){let o=v(e,t.versionPattern);if(o!==null){let s=o.replace(/_/g,".");if(t.versionLookup){let d=Object.prototype.hasOwnProperty.call(t.versionLookup,s)?t.versionLookup[s]:null;if(d!==null)n=d;else if(t.name==="Windows"){let u=parseInt(s,10);n=isNaN(u)?"unknown":u.toString();}}else n=s;}}return t.name==="Windows"&&r&&(n=r),{os:t.name,osVersion:n}}var M=[{name:"Mobile",detect:/(Mobi|iPh)/},{name:"Tablet",detect:/(Tablet|Pad)/}];function R(e,r){if(/(SMART-TV|HbbTV|SmartTV|TV Safari|Android TV|GoogleTV)/.test(e))return "TV";if((r==null?void 0:r.platform)==="MacIntel"&&r.maxTouchPoints>1||/iPad/.test(e)||/Android/.test(e)&&!/Mobile/.test(e))return "Tablet";for(let t of M)if(t.detect.test(e))return t.name;return "PC"}var _=[{name:"Googlebot",detect:/Googlebot/},{name:"Bingbot",detect:/(bingbot|BingPreview)/},{name:"Baiduspider",detect:/(Baiduspider|BaiduMobaider)/},{name:"Bytespider",detect:/Bytespider/},{name:"YandexBot",detect:/YandexBot/},{name:"DuckDuckBot",detect:/DuckDuckBot/},{name:"Slurp",detect:/Slurp/},{name:"Sogou",detect:/(Sogou|sogou).*[Ss]pider/},{name:"360Spider",detect:/360Spider/},{name:"PetalBot",detect:/PetalBot/},{name:"Applebot",detect:/Applebot/},{name:"Facebookbot",detect:/(facebookexternalhit|FacebookBot)/},{name:"Twitterbot",detect:/Twitterbot/},{name:"LinkedInBot",detect:/LinkedInBot/},{name:"SemrushBot",detect:/SemrushBot/},{name:"AhrefsBot",detect:/AhrefsBot/},{name:"MJ12bot",detect:/MJ12bot/},{name:"GPTBot",detect:/GPTBot/},{name:"ClaudeBot",detect:/ClaudeBot/},{name:"PerplexityBot",detect:/PerplexityBot/},{name:"CCBot",detect:/CCBot/},{name:"AdsBot",detect:/AdsBot-Google/},{name:"GenericBot",detect:/(bot|crawler|spider|crawling|scraper)/i}];function L(e){for(let r of _)if(r.detect.test(e))return {isBot:true,botName:r.name};return {isBot:false,botName:"unknown"}}var F=[{name:"arm64",detect:/(aarch64|arm64|ARM64)/},{name:"arm",detect:/\bARM\b/},{name:"x86_64",detect:/(x86_64|Win64|WOW64|x64;|amd64)/i},{name:"x86",detect:/(i[36]86|i686|x86;)/}];function I(e){for(let r of F)if(r.detect.test(e))return r.name;return "unknown"}var J=/(HeadlessChrome|Headless|PhantomJS|Electron\/|Playwright|jsdom\/|Selenium)/;function W(e){return J.test(e)}function y(){return typeof navigator=="undefined"?{userAgent:"",platform:"",language:"",maxTouchPoints:0}:navigator}function c(e,r){var t;try{return !!((t=e.mimeTypes)!=null&&t.namedItem(r))}catch(n){return false}}function f(e){var n,o;return ((o=(n=e.browserLanguage)!=null?n:e.language)!=null?o:"").replace(/-\w+/g,s=>s.toUpperCase())||"unknown"}function V(e,r={}){var B,w,x,P,b;let{nav:t,windowsVersion:n}=r,{browser:o,version:s}=D(e),{os:d,osVersion:u}=C(e,n),j=R(e,t),Q=I(e),{isBot:H,botName:G}=L(e),U=W(e),K=t?f(t):"unknown",Y=(B=t==null?void 0:t.platform)!=null?B:"unknown",i=o,p=s;if(t){let a=typeof chrome!="undefined"?chrome:void 0,h=/Chrome\/([\d]+)/.exec(e),g=h?parseInt(h[1],10):0;if(a)if(a.adblock2345||a.common2345)i="2345Explorer",p="unknown";else {let m=false;if(c(t,"application/360softmgrplugin")||c(t,"application/mozilla-npqihooquicklogin")||g>36&&typeof showModalDialog!="undefined"?m=true:g>45&&(m=c(t,"application/vnd.chromium.remoting-viewer"),!m&&g>=69&&(m=c(t,"application/hwepass2001.installepass2001")||c(t,"application/asx"))),m){let X=((w=t.connection)==null?void 0:w.saveData)===true;c(t,"application/gameplugin")||!X?i="360SE":i="360EE",p="unknown";}}}if(i==="Baidu"&&/(Opera|OPR|OPT)/.test(e)){i="Opera";let a=(P=(x=/OPR\/([\d.]+)/.exec(e))!=null?x:/OPT\/([\d.]+)/.exec(e))!=null?P:/Opera\/([\d.]+)/.exec(e);p=(b=a==null?void 0:a[1])!=null?b:"unknown";}if(i==="Chrome"&&/\S+Browser\//.test(e)){let a=/(\S+Browser)\/([\d.]+)/.exec(e);a&&(i=a[1],p=a[2]);}if(i==="Firefox"&&t)try{(typeof clientInformation!="undefined"||typeof u2f=="undefined")&&(i="Firefox Nightly");}catch(a){}if(i==="Wechat")try{typeof __wxjs_environment!="undefined"&&__wxjs_environment==="miniprogram"&&(i="Wechat Miniapp");}catch(a){}let q=N(e,i,p);return {browser:i,version:p,engine:q,os:d,osVersion:u,device:j,arch:Q,isWebview:/; wv/.test(e),isHeadless:U,isBot:H,botName:G,language:K,platform:Y}}var{version:Z}=E;var $=e=>/; wv/.test(e),ee=()=>{try{return typeof __wxjs_environment!="undefined"&&__wxjs_environment==="miniprogram"}catch(e){return false}};function l(e){let r=y();return V(e!=null?e:r.userAgent,{nav:r})}l.isWebview=$;l.isWechatMiniapp=ee;l.getLanguage=()=>f(y());l.VERSION=Z;var te=l;
2
+ return te;})();//# sourceMappingURL=index.min.js.map
3
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/constants/browsers.ts","../src/utils/extract.ts","../src/detectors/browser.ts","../src/constants/engines.ts","../src/detectors/engine.ts","../src/constants/os.ts","../src/detectors/os.ts","../src/constants/devices.ts","../src/detectors/device.ts","../src/constants/bots.ts","../src/detectors/bot.ts","../src/constants/arch.ts","../src/detectors/arch.ts","../src/detectors/headless.ts","../src/utils/navigator.ts","../src/parse.ts","../src/index.ts"],"names":["package_default","BROWSER_DEFS","extractVersion","ua","pattern","m","v","extractVersionFromPatterns","patterns","p","lookupFromChromeVersion","table","major","detectBrowser","best","def","version","ENGINE_DEFS","detectEngine","browser","_a","_b","engine","OS_DEFS","detectOs","windowsVersion","matchedDef","osVersion","raw","normalised","mapped","n","DEVICE_DEFS","detectDevice","nav","BOT_DEFS","detectBot","ARCH_DEFS","detectArch","HEADLESS_PATTERN","detectHeadless","getNavContext","getMimeType","type","e","getLanguage","w","parseUA","options","_c","_d","_e","rawBrowser","rawVersion","os","device","arch","isBot","botName","isHeadless","language","platform","chromeGlobal","chromeMatch","chromeMajor","is360","saveDataEnabled","opVer","VERSION","isWebview","isWechatMiniapp","uaBrowser","src_default"],"mappings":"uCAAA,IAAAA,CAAAA,CAAA,CAEE,OAAA,CAAW,OAkEb,CAAA,CChDO,IAAMC,CAAAA,CAAsC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A,CAAW,MAAA,CAAO,IAAA,CAAKrD,CAAE,CAAA,CACzB,UAAA,CAAAwD,CAAAA,CACA,KAAA,CAAAF,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAE,CAAAA,CACA,QAAA,CAAAC,CACF,CACF,CC7IA,GAAM,CAAE,OAAA,CAASO,CAAQ,CAAA,CAAIpE,CAAAA,CAgBtB,IAAMqE,CAAAA,CAAalE,CAAAA,EAAwB,MAAA,CAAO,IAAA,CAAKA,CAAE,CAAA,CAGnDmE,EAAAA,CAAkB,IAAe,CAC5C,GAAI,CACF,OAAO,OAAO,kBAAA,EAAuB,WAAA,EAAe,kBAAA,GAAuB,aAC7E,CAAA,MAAQ,CAAA,CAAA,CACN,OAAO,MACT,CACF,CAAA,CASA,SAASC,CAAAA,CAAUpE,CAAAA,CAAwB,CACzC,IAAM+B,CAAAA,CAAMO,CAAAA,EAAc,CAC1B,OAAOM,CAAAA,CAAQ5C,CAAAA,EAAA,IAAA,CAAAA,CAAAA,CAAM+B,CAAAA,CAAI,SAAA,CAAW,CAAE,GAAA,CAAAA,CAAI,CAAC,CAC7C,CAEAqC,CAAAA,CAAU,SAAA,CAAYF,CAAAA,CACtBE,CAAAA,CAAU,eAAA,CAAkBD,EAAAA,CAC5BC,CAAAA,CAAU,WAAA,CAAc,IAAc1B,CAAAA,CAAYJ,CAAAA,EAAe,CAAA,CACjE8B,CAAAA,CAAU,OAAA,CAAUH,CAAAA,KAEbI,EAAAA,CAAQD","file":"index.min.js","sourcesContent":["{\n \"name\": \"ua-browser\",\n \"version\": \"1.0.1\",\n \"description\": \"uaBrowser - Browser, OS, engine and device detection from user agent strings. Supports Node.js. Zero dependencies.\",\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.mjs\"\n }\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"sideEffects\": false,\n \"scripts\": {\n \"release\": \"pnpm build && changeset publish\",\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"lint\": \"eslint src --ext .ts\",\n \"typecheck\": \"tsc -p tsconfig.build.json --noEmit\",\n \"docs:dev\": \"pnpm build && vitepress dev docs\",\n \"docs:build\": \"pnpm build && vitepress build docs\",\n \"docs:preview\": \"vitepress preview docs\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/yangtianxia/ua-browser.git\"\n },\n \"keywords\": [\n \"uaBrowser\",\n \"userAgent\",\n \"javascript\",\n \"typescript\",\n \"browser-detection\",\n \"user-agent-parser\"\n ],\n \"author\": \"yangtianxia\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/yangtianxia/ua-browser/issues\"\n },\n \"homepage\": \"https://github.com/yangtianxia/ua-browser#readme\",\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.29.4\",\n \"@typescript-eslint/eslint-plugin\": \"^7.0.0\",\n \"@typescript-eslint/parser\": \"^7.0.0\",\n \"@vitest/coverage-v8\": \"^1.6.0\",\n \"eslint\": \"^8.57.0\",\n \"eslint-plugin-import\": \"^2.29.1\",\n \"tsup\": \"^8.0.2\",\n \"typescript\": \"^5.4.0\",\n \"vitepress\": \"^1.6.4\",\n \"vitest\": \"^1.6.0\",\n \"vue\": \"^3.5.32\"\n }\n}\n","import type { BrowserName } from '../types.js'\n\nexport interface BrowserDef {\n name: BrowserName\n /** Detection regex — must match the UA for this browser to be a candidate. */\n detect: RegExp\n /**\n * Version extraction: capture-group regex (or array tried in order).\n * null = no direct version pattern (use chromeLookup only, or lookup table browsers).\n */\n versionPattern: RegExp | RegExp[] | null\n /** Chrome major-version → browser display version lookup (e.g. 360SE/EE, Liebao). */\n chromeLookup?: Record<string, string>\n /**\n * Detection priority. When multiple entries match the same UA, the one with\n * the highest priority wins. Explicit and verifiable — no reverse-iteration magic.\n */\n priority: number\n}\n\nexport const BROWSER_DEFS: readonly BrowserDef[] = [\n // ── Generic / low-priority base browsers ──────────────────────────────────\n { name: 'Safari', priority: 10, detect: /Safari/, versionPattern: /Version\\/([\\d.]+)/ },\n { name: 'Chrome', priority: 20, detect: /(Chrome|CriOS)/, versionPattern: [/Chrome\\/([\\d.]+)/, /CriOS\\/([\\d.]+)/] },\n { name: 'IE', priority: 30, detect: /(MSIE|Trident)/, versionPattern: [/MSIE ([\\d.]+)/, /rv:([\\d.]+)/] },\n { name: 'Edge', priority: 40, detect: /(Edge|Edg\\/|EdgA|EdgiOS)/, versionPattern: [/Edge\\/([\\d.]+)/, /Edg\\/([\\d.]+)/, /EdgA\\/([\\d.]+)/, /EdgiOS\\/([\\d.]+)/] },\n { name: 'Firefox', priority: 50, detect: /(Firefox|FxiOS)/, versionPattern: [/Firefox\\/([\\d.]+)/, /FxiOS\\/([\\d.]+)/] },\n { name: 'Firefox Focus', priority: 55, detect: /Focus/, versionPattern: /Focus\\/([\\d.]+)/ },\n { name: 'Chromium', priority: 60, detect: /Chromium/, versionPattern: /Chromium\\/([\\d.]+)/ },\n { name: 'Opera', priority: 70, detect: /(Opera|OPR|OPT)/, versionPattern: [/Opera\\/([\\d.]+)/, /OPR\\/([\\d.]+)/, /OPT\\/([\\d.]+)/] },\n { name: 'Vivaldi', priority: 80, detect: /Vivaldi/, versionPattern: /Vivaldi\\/([\\d.]+)/ },\n { name: 'Yandex', priority: 90, detect: /YaBrowser/, versionPattern: /YaBrowser\\/([\\d.]+)/ },\n { name: 'Samsung Internet', priority: 92, detect: /SamsungBrowser/, versionPattern: /SamsungBrowser\\/([\\d.]+)/ },\n { name: 'DuckDuckGo', priority: 94, detect: /DuckDuckGo\\//, versionPattern: /DuckDuckGo\\/([\\d.]+)/ },\n { name: 'Puffin', priority: 96, detect: /Puffin\\//, versionPattern: /Puffin\\/([\\d.]+)/ },\n { name: 'Arora', priority: 100, detect: /Arora/, versionPattern: /Arora\\/([\\d.]+)/ },\n { name: 'Lunascape', priority: 110, detect: /Lunascape/, versionPattern: /Lunascape[\\s]([\\d.]+)/ },\n { name: 'QupZilla', priority: 120, detect: /QupZilla/, versionPattern: /QupZilla[\\s]([\\d.]+)/ },\n { name: 'Coc Coc', priority: 130, detect: /coc_coc_browser/, versionPattern: /coc_coc_browser\\/([\\d.]+)/ },\n { name: 'Kindle', priority: 140, detect: /(Kindle|Silk\\/)/, versionPattern: /Version\\/([\\d.]+)/ },\n { name: 'Iceweasel', priority: 150, detect: /Iceweasel/, versionPattern: /Iceweasel\\/([\\d.]+)/ },\n { name: 'Konqueror', priority: 160, detect: /Konqueror/, versionPattern: /Konqueror\\/([\\d.]+)/ },\n { name: 'Iceape', priority: 170, detect: /Iceape/, versionPattern: /Iceape\\/([\\d.]+)/ },\n { name: 'SeaMonkey', priority: 180, detect: /SeaMonkey/, versionPattern: /SeaMonkey\\/([\\d.]+)/ },\n { name: 'Epiphany', priority: 190, detect: /Epiphany/, versionPattern: /Epiphany\\/([\\d.]+)/ },\n { name: 'Maxthon', priority: 200, detect: /Maxthon/, versionPattern: /Maxthon\\/([\\d.]+)/ },\n\n // ── Chinese / Asian browsers — higher priority than generic Chrome ─────────\n { name: '360', priority: 300, detect: /(QihooBrowser|QHBrowser)/, versionPattern: /QihooBrowser\\/([\\d.]+)/ },\n { name: '360SE', priority: 310, detect: /360SE/, versionPattern: null,\n chromeLookup: { '108': '14.0', '86': '13.0', '78': '12.0', '69': '11.0',\n '63': '10.0', '55': '9.1', '45': '8.1', '42': '8.0', '31': '7.0', '21': '6.3' } },\n { name: '360EE', priority: 320, detect: /360EE/, versionPattern: null,\n chromeLookup: { '86': '13.0', '78': '12.0', '69': '11.0', '63': '9.5',\n '55': '9.0', '50': '8.7', '30': '7.5' } },\n { name: 'UC', priority: 330, detect: /(UCBrowser|UBrowser|UCWEB)/, versionPattern: /UC?Browser\\/([\\d.]+)/ },\n { name: 'QQBrowser', priority: 340, detect: /QQBrowser/, versionPattern: /QQBrowser\\/([\\d.]+)/ },\n { name: 'QQ', priority: 345, detect: /QQ\\//, versionPattern: /QQ\\/([\\d.]+)/ },\n { name: 'Baidu', priority: 350, detect: /(Baidu|BIDUBrowser|baidubrowser|baiduboxapp|BaiduHD)/, versionPattern: [/BIDUBrowser[\\s/]([\\d.]+)/, /baiduboxapp\\/([\\d.]+)/] },\n { name: 'Sogou', priority: 360, detect: /(MetaSr|Sogou)/, versionPattern: [/SE ([\\d.X]+)/, /SogouMobileBrowser\\/([\\d.]+)/] },\n { name: 'Liebao', priority: 370, detect: /(LBBROWSER|LieBaoFast)/, versionPattern: /LieBaoFast\\/([\\d.]+)/,\n chromeLookup: { '57': '6.5', '49': '6.0', '46': '5.9', '42': '5.3',\n '39': '5.2', '34': '5.0', '29': '4.5', '21': '4.0' } },\n { name: '2345Explorer', priority: 380, detect: /2345Explorer/, versionPattern: [/2345Explorer\\/([\\d.]+)/, /Mb2345Browser\\/([\\d.]+)/],\n chromeLookup: { '69': '10.0', '55': '9.9' } },\n { name: '115Browser', priority: 390, detect: /115Browser/, versionPattern: /115Browser\\/([\\d.]+)/ },\n { name: 'TheWorld', priority: 400, detect: /TheWorld/, versionPattern: /TheWorld ([\\d.]+)/ },\n { name: 'XiaoMi', priority: 410, detect: /MiuiBrowser/, versionPattern: /MiuiBrowser\\/([\\d.]+)/ },\n { name: 'Vivo', priority: 420, detect: /VivoBrowser/, versionPattern: /VivoBrowser\\/([\\d.]+)/ },\n { name: 'Huawei', priority: 430, detect: /HuaweiBrowser/, versionPattern: [/HuaweiBrowser\\/([\\d.]+)/, /Version\\/([\\d.]+)/] },\n { name: 'OPPO', priority: 440, detect: /HeyTapBrowser/, versionPattern: /HeyTapBrowser\\/([\\d.]+)/ },\n { name: 'Quark', priority: 450, detect: /Quark/, versionPattern: /Quark\\/([\\d.]+)/ },\n { name: 'Qiyu', priority: 460, detect: /Qiyu/, versionPattern: /Qiyu\\/([\\d.]+)/ },\n\n // ── App webviews — highest priority ───────────────────────────────────────\n { name: 'WechatWork', priority: 500, detect: /wxwork\\//, versionPattern: /wxwork\\/([\\d.]+)/ },\n { name: 'Wechat', priority: 510, detect: /MicroMessenger/, versionPattern: /MicroMessenger\\/([\\d.]+)/ },\n { name: 'Taobao', priority: 520, detect: /AliApp\\(TB/, versionPattern: /AliApp\\(TB\\/([\\d.]+)/ },\n { name: 'Alipay', priority: 530, detect: /AliApp\\(AP/, versionPattern: /AliApp\\(AP\\/([\\d.]+)/ },\n { name: 'Weibo', priority: 540, detect: /Weibo/, versionPattern: /weibo__([\\d.]+)/ },\n { name: 'Douban', priority: 550, detect: /com\\.douban\\.frodo/, versionPattern: /com\\.douban\\.frodo\\/([\\d.]+)/ },\n { name: 'Suning', priority: 560, detect: /SNEBUY-APP/, versionPattern: /SNEBUY-APP([\\d.]+)/ },\n { name: 'iQiYi', priority: 570, detect: /IqiyiApp/, versionPattern: /IqiyiVersion\\/([\\d.]+)/ },\n { name: 'DingTalk', priority: 580, detect: /DingTalk/, versionPattern: /DingTalk\\/([\\d.]+)/ },\n { name: 'Douyin', priority: 590, detect: /aweme/, versionPattern: /app_version\\/([\\d.]+)/ }\n] as const\n","/**\n * Extract the first capture group from `ua` using `pattern`.\n * Returns the matched string, or null if the pattern does not match.\n * Unlike String.replace(), this never returns the original input on no-match.\n */\nexport function extractVersion(ua: string, pattern: RegExp): string | null {\n const m = pattern.exec(ua)\n if (!m) return null\n const v = m[1]\n return v != null && v !== '' ? v : null\n}\n\n/**\n * Try each pattern in order; return the first non-null match, or null.\n */\nexport function extractVersionFromPatterns(ua: string, patterns: RegExp[]): string | null {\n for (const p of patterns) {\n const v = extractVersion(ua, p)\n if (v !== null) return v\n }\n return null\n}\n\n/**\n * Extract the Chrome major version from `ua` and look it up in a table.\n * Returns the mapped string on hit, or null on miss / no Chrome token.\n */\nexport function lookupFromChromeVersion(ua: string, table: Record<string, string>): string | null {\n const m = /Chrome\\/([\\d]+)/.exec(ua)\n if (!m) return null\n const major = m[1]\n return Object.prototype.hasOwnProperty.call(table, major) ? table[major] : null\n}\n","import type { BrowserName } from '../types.js'\nimport { BROWSER_DEFS } from '../constants/browsers.js'\nimport { extractVersionFromPatterns, lookupFromChromeVersion } from '../utils/extract.js'\n\nexport interface BrowserResult {\n browser: BrowserName\n version: string\n}\n\n/**\n * Detect the browser name and version from a user agent string.\n *\n * When multiple BROWSER_DEFS entries match the same UA, the one with\n * the highest `priority` value wins (ties go to the later definition).\n */\nexport function detectBrowser(ua: string): BrowserResult {\n let best: (typeof BROWSER_DEFS)[number] | null = null\n\n for (const def of BROWSER_DEFS) {\n if (def.detect.test(ua)) {\n if (best === null || def.priority >= best.priority) {\n best = def\n }\n }\n }\n\n if (!best) return { browser: 'unknown', version: 'unknown' }\n\n let version: string | null = null\n\n // 1. Try Chrome-version lookup table (for browsers like 360SE/EE that version by Chrome major)\n if (best.chromeLookup) {\n version = lookupFromChromeVersion(ua, best.chromeLookup)\n }\n\n // 2. Fall back to direct regex extraction\n if (version === null && best.versionPattern !== null) {\n const patterns = Array.isArray(best.versionPattern)\n ? best.versionPattern\n : [best.versionPattern]\n version = extractVersionFromPatterns(ua, patterns)\n }\n\n return { browser: best.name, version: version ?? 'unknown' }\n}\n","export interface EngineDef {\n name: string\n detect: RegExp\n}\n\nexport const ENGINE_DEFS: readonly EngineDef[] = [\n { name: 'KHTML', detect: /KHTML\\// },\n { name: 'Trident', detect: /(Trident|NET CLR)/ },\n { name: 'Presto', detect: /Presto/ },\n { name: 'Gecko', detect: /Gecko\\// },\n { name: 'WebKit', detect: /AppleWebKit/ }\n] as const\n","import type { EngineName } from '../types.js'\nimport { ENGINE_DEFS } from '../constants/engines.js'\n\n/**\n * Detect the rendering engine, with post-detection upgrades for Blink and EdgeHTML.\n *\n * @param ua - Raw user agent string\n * @param browser - Already-detected browser name (for Blink/EdgeHTML disambiguation)\n * @param version - Already-detected browser version string\n */\nexport function detectEngine(ua: string, browser: string, version: string): EngineName {\n let engine: EngineName = 'unknown'\n\n for (const def of ENGINE_DEFS) {\n if (def.detect.test(ua)) {\n engine = def.name as EngineName\n }\n }\n\n // Upgrade WebKit to Blink for Chrome 28+, Opera 15+, Yandex\n if (\n engine === 'WebKit' &&\n /(Chrome|CriOS)/.test(ua) &&\n parseInt((/Chrome\\/([\\d]+)/.exec(ua) ?? [])[1] ?? '0', 10) > 27\n ) {\n engine = 'Blink'\n } else if (browser === 'Opera' && parseInt(version, 10) > 12) {\n engine = 'Blink'\n } else if (browser === 'Yandex') {\n engine = 'Blink'\n }\n\n // Edge: Chromium-based Edge uses Blink (version > 75), legacy EdgeHTML below that\n if (browser === 'Edge') {\n engine = parseInt(version, 10) > 75 ? 'Blink' : 'EdgeHTML'\n }\n\n return engine\n}\n","import type { OsName } from '../types.js'\n\nexport interface OsDef {\n name: OsName\n detect: RegExp\n /** Capture-group regex for OS version extraction. null = no version. */\n versionPattern: RegExp | null\n /** Lookup table: raw version token → display version. */\n versionLookup?: Record<string, string>\n}\n\nexport const OS_DEFS: readonly OsDef[] = [\n { name: 'WebOS', detect: /hpwOS/, versionPattern: /hpwOS\\/([\\d.]+)/ },\n { name: 'Symbian', detect: /Symbian/, versionPattern: null },\n { name: 'MeeGo', detect: /MeeGo/, versionPattern: null },\n { name: 'BlackBerry', detect: /(BlackBerry|RIM)/, versionPattern: null },\n { name: 'Windows Phone', detect: /(IEMobile|Windows Phone)/, versionPattern: /Windows Phone(?: OS)? ([\\d.]+)/ },\n { name: 'FreeBSD', detect: /FreeBSD/, versionPattern: null },\n { name: 'Debian', detect: /Debian/, versionPattern: /Debian\\/([\\d.]+)/ },\n { name: 'Ubuntu', detect: /Ubuntu/, versionPattern: null },\n { name: 'Chrome OS', detect: /CrOS/, versionPattern: null },\n { name: 'Linux', detect: /(Linux|X11)/, versionPattern: null },\n { name: 'Tizen', detect: /Tizen/, versionPattern: /Tizen ([\\d.]+)/ },\n { name: 'iOS', detect: /like Mac OS X/, versionPattern: /OS ([\\d_]+) like/ },\n { name: 'MacOS', detect: /Macintosh/, versionPattern: /Mac OS X -?([\\d_.]+)/ },\n { name: 'HarmonyOS', detect: /HarmonyOS/, versionPattern: /Android ([\\d.]+)[;)]/,\n versionLookup: { '10': '2' } },\n { name: 'Android', detect: /(Android|Adr)/, versionPattern: /(?:Android|Adr) ([\\d.]+)/ },\n { name: 'KaiOS', detect: /KAIOS/, versionPattern: /KAIOS\\/([\\d.]+)/ },\n { name: 'Windows', detect: /Windows/, versionPattern: /Windows NT ([\\d.]+)/,\n versionLookup: {\n '10': '10', '6.4': '10', '6.3': '8.1', '6.2': '8',\n '6.1': '7', '6.0': 'Vista', '5.2': 'XP', '5.1': 'XP', '5.0': '2000'\n } }\n] as const\n","import type { OsName } from '../types.js'\nimport { OS_DEFS } from '../constants/os.js'\nimport { extractVersion } from '../utils/extract.js'\n\nexport interface OsResult {\n os: OsName\n osVersion: string\n}\n\n/**\n * Detect the operating system and its version from a user agent string.\n *\n * @param ua - Raw user agent string\n * @param windowsVersion - Pre-resolved Windows 11/10 string from getWindowsVersion()\n * (avoids the async race condition of the old implementation)\n */\nexport function detectOs(ua: string, windowsVersion?: string | null): OsResult {\n let matchedDef: (typeof OS_DEFS)[number] | null = null\n\n // Iterate in array order; later entries have higher priority (same as BROWSER_DEFS)\n for (const def of OS_DEFS) {\n if (def.detect.test(ua)) {\n matchedDef = def\n }\n }\n\n if (!matchedDef) return { os: 'unknown', osVersion: 'unknown' }\n\n let osVersion = 'unknown'\n\n if (matchedDef.versionPattern) {\n const raw = extractVersion(ua, matchedDef.versionPattern)\n\n if (raw !== null) {\n // Normalise iOS underscore-separated version: \"17_4_1\" → \"17.4.1\"\n const normalised = raw.replace(/_/g, '.')\n\n if (matchedDef.versionLookup) {\n // Use lookup table if available (Windows NT, HarmonyOS)\n const mapped = Object.prototype.hasOwnProperty.call(matchedDef.versionLookup, normalised)\n ? matchedDef.versionLookup[normalised]\n : null\n\n if (mapped !== null) {\n osVersion = mapped\n } else if (matchedDef.name === 'Windows') {\n // For unknown Windows NT versions, fall back to the integer part\n const n = parseInt(normalised, 10)\n osVersion = isNaN(n) ? 'unknown' : n.toString()\n }\n } else {\n osVersion = normalised\n }\n }\n }\n\n // Windows 11 override — provided externally to avoid async race\n if (matchedDef.name === 'Windows' && windowsVersion) {\n osVersion = windowsVersion\n }\n\n return { os: matchedDef.name, osVersion }\n}\n","export interface DeviceDef {\n name: string\n detect: RegExp\n}\n\nexport const DEVICE_DEFS: readonly DeviceDef[] = [\n { name: 'Mobile', detect: /(Mobi|iPh)/ },\n { name: 'Tablet', detect: /(Tablet|Pad)/ }\n] as const\n","import type { DeviceName } from '../types.js'\nimport { DEVICE_DEFS } from '../constants/devices.js'\nimport type { NavContext } from '../utils/navigator.js'\n\n/**\n * Detect the device type from a user agent string.\n *\n * @param ua - Raw user agent string\n * @param nav - Optional nav context; used to detect iPad on modern macOS\n * (where the UA reports \"Macintosh\" but maxTouchPoints > 1)\n */\nexport function detectDevice(ua: string, nav?: Pick<NavContext, 'platform' | 'maxTouchPoints'>): DeviceName {\n // Smart TV — must come first; some TV UAs also contain Android/Linux tokens\n if (/(SMART-TV|HbbTV|SmartTV|TV Safari|Android TV|GoogleTV)/.test(ua)) {\n return 'TV'\n }\n\n // Modern iPad: platform='MacIntel' with touch points (iPadOS 13+)\n if (nav?.platform === 'MacIntel' && nav.maxTouchPoints > 1) {\n return 'Tablet'\n }\n\n // iPad in UA string (older iPads)\n if (/iPad/.test(ua)) {\n return 'Tablet'\n }\n\n // Android tablet: has Android but no Mobile marker\n if (/Android/.test(ua) && !/Mobile/.test(ua)) {\n return 'Tablet'\n }\n\n for (const def of DEVICE_DEFS) {\n if (def.detect.test(ua)) {\n return def.name as DeviceName\n }\n }\n\n return 'PC'\n}\n","export type BotName =\n | 'Googlebot'\n | 'Bingbot'\n | 'Baiduspider'\n | 'Bytespider'\n | 'YandexBot'\n | 'DuckDuckBot'\n | 'Slurp'\n | 'Sogou'\n | '360Spider'\n | 'Applebot'\n | 'Facebookbot'\n | 'Twitterbot'\n | 'LinkedInBot'\n | 'SemrushBot'\n | 'AhrefsBot'\n | 'MJ12bot'\n | 'PetalBot'\n | 'GPTBot'\n | 'ClaudeBot'\n | 'PerplexityBot'\n | 'CCBot'\n | 'AdsBot'\n | 'GenericBot'\n | 'unknown'\n\nexport interface BotDef {\n name: BotName\n detect: RegExp\n}\n\nexport const BOT_DEFS: readonly BotDef[] = [\n // Search engines\n { name: 'Googlebot', detect: /Googlebot/ },\n { name: 'Bingbot', detect: /(bingbot|BingPreview)/ },\n { name: 'Baiduspider', detect: /(Baiduspider|BaiduMobaider)/ },\n { name: 'Bytespider', detect: /Bytespider/ },\n { name: 'YandexBot', detect: /YandexBot/ },\n { name: 'DuckDuckBot', detect: /DuckDuckBot/ },\n { name: 'Slurp', detect: /Slurp/ },\n { name: 'Sogou', detect: /(Sogou|sogou).*[Ss]pider/ },\n { name: '360Spider', detect: /360Spider/ },\n { name: 'PetalBot', detect: /PetalBot/ },\n { name: 'Applebot', detect: /Applebot/ },\n // Social\n { name: 'Facebookbot', detect: /(facebookexternalhit|FacebookBot)/ },\n { name: 'Twitterbot', detect: /Twitterbot/ },\n { name: 'LinkedInBot', detect: /LinkedInBot/ },\n // SEO tools\n { name: 'SemrushBot', detect: /SemrushBot/ },\n { name: 'AhrefsBot', detect: /AhrefsBot/ },\n { name: 'MJ12bot', detect: /MJ12bot/ },\n // AI / LLM crawlers\n { name: 'GPTBot', detect: /GPTBot/ },\n { name: 'ClaudeBot', detect: /ClaudeBot/ },\n { name: 'PerplexityBot', detect: /PerplexityBot/ },\n { name: 'CCBot', detect: /CCBot/ },\n { name: 'AdsBot', detect: /AdsBot-Google/ },\n // Generic catch-all (must be last)\n { name: 'GenericBot', detect: /(bot|crawler|spider|crawling|scraper)/i }\n] as const\n","import { BOT_DEFS, type BotName } from '../constants/bots.js'\n\nexport interface BotResult {\n isBot: boolean\n botName: BotName\n}\n\n/**\n * Detect whether the UA belongs to a bot, crawler, or spider.\n * Returns the specific bot name when recognised, 'GenericBot' for generic patterns,\n * or 'unknown' for regular user agents.\n */\nexport function detectBot(ua: string): BotResult {\n for (const def of BOT_DEFS) {\n if (def.detect.test(ua)) {\n return { isBot: true, botName: def.name }\n }\n }\n return { isBot: false, botName: 'unknown' }\n}\n","export type ArchName = 'x86' | 'x86_64' | 'arm' | 'arm64' | 'unknown'\n\nexport interface ArchDef {\n name: ArchName\n detect: RegExp\n}\n\n/**\n * Ordered from most specific to least specific.\n * First match wins (unlike browser/OS detection which keeps highest priority).\n */\nexport const ARCH_DEFS: readonly ArchDef[] = [\n { name: 'arm64', detect: /(aarch64|arm64|ARM64)/ },\n { name: 'arm', detect: /\\bARM\\b/ },\n { name: 'x86_64', detect: /(x86_64|Win64|WOW64|x64;|amd64)/i },\n { name: 'x86', detect: /(i[36]86|i686|x86;)/ }\n] as const\n","import { ARCH_DEFS, type ArchName } from '../constants/arch.js'\n\n/**\n * Detect the CPU architecture from a user agent string.\n * Returns 'unknown' when the UA provides no architecture hints.\n */\nexport function detectArch(ua: string): ArchName {\n for (const def of ARCH_DEFS) {\n if (def.detect.test(ua)) {\n return def.name\n }\n }\n return 'unknown'\n}\n","/**\n * Patterns that indicate a headless, automated, or embedded browser environment.\n *\n * | Pattern | Source |\n * |------------------|-----------------------------------------------------|\n * | HeadlessChrome | Chrome launched with --headless flag |\n * | Headless | Generic headless marker in some frameworks |\n * | PhantomJS | PhantomJS (deprecated but still used) |\n * | Electron | Electron apps (not strictly headless, but automated)|\n * | Playwright | Playwright automation framework |\n * | jsdom | Node.js DOM simulation (vitest, jest-environment) |\n * | Selenium | Some WebDriver/Selenium setups inject this token |\n */\nconst HEADLESS_PATTERN = /(HeadlessChrome|Headless|PhantomJS|Electron\\/|Playwright|jsdom\\/|Selenium)/\n\n/**\n * Detect whether the UA belongs to a headless or automation-driven browser.\n *\n * Note: modern Puppeteer/Playwright using stealth mode can hide these markers.\n * This catches the common/unmodified cases only.\n */\nexport function detectHeadless(ua: string): boolean {\n return HEADLESS_PATTERN.test(ua)\n}\n","/**\n * A subset of the Navigator interface that our detectors need.\n * Accepting NavContext as a parameter makes every detector pure and testable.\n */\nexport interface NavContext {\n userAgent: string\n platform: string\n language: string\n browserLanguage?: string\n maxTouchPoints: number\n mimeTypes?: MimeTypeArray\n connection?: { saveData?: boolean }\n userAgentData?: {\n platform: string\n getHighEntropyValues(hints: string[]): Promise<Record<string, string>>\n }\n}\n\n/** Build a NavContext from the real browser `navigator`, or return a safe default for Node.js. */\nexport function getNavContext(): NavContext {\n if (typeof navigator === 'undefined') {\n return { userAgent: '', platform: '', language: '', maxTouchPoints: 0 }\n }\n return navigator as unknown as NavContext\n}\n\n/** Safely query a MIME type from the nav context. Returns false in non-browser envs. */\nexport function getMimeType(nav: NavContext, type: string): boolean {\n try {\n return !!nav.mimeTypes?.namedItem(type)\n } catch {\n return false\n }\n}\n\n/** Returns the normalised browser language (e.g. \"zh-CN\" → \"zh-CN\", \"en-us\" → \"en-US\"). */\nexport function getLanguage(nav: NavContext): string {\n const raw = nav.browserLanguage ?? nav.language ?? ''\n const normalised = raw.replace(/-\\w+/g, (w) => w.toUpperCase())\n return normalised || 'unknown'\n}\n","import type { EnvOption, BrowserName } from './types.js'\nimport { detectBrowser } from './detectors/browser.js'\nimport { detectEngine } from './detectors/engine.js'\nimport { detectOs } from './detectors/os.js'\nimport { detectDevice } from './detectors/device.js'\nimport { detectBot } from './detectors/bot.js'\nimport { detectArch } from './detectors/arch.js'\nimport { detectHeadless } from './detectors/headless.js'\nimport { getMimeType, getLanguage, type NavContext } from './utils/navigator.js'\n\nexport interface ParseOptions {\n /** Nav context to use for language, platform, MIME-type checks, and device detection. */\n nav?: NavContext\n /** Pre-resolved Windows version string (from getWindowsVersion()). Pass to avoid async races. */\n windowsVersion?: string | null\n}\n\n/**\n * Parse a user agent string into a full browser/OS/engine/device description.\n *\n * Pure function — no global state, no singletons. All environment access is\n * supplied through `options.nav`; omit it for Node.js / testing contexts.\n */\nexport function parseUA(ua: string, options: ParseOptions = {}): EnvOption {\n const { nav, windowsVersion } = options\n\n const { browser: rawBrowser, version: rawVersion } = detectBrowser(ua)\n const { os, osVersion } = detectOs(ua, windowsVersion)\n const device = detectDevice(ua, nav)\n const arch = detectArch(ua)\n const { isBot, botName } = detectBot(ua)\n const isHeadless = detectHeadless(ua)\n const language = nav ? getLanguage(nav) : 'unknown'\n const platform = nav?.platform ?? 'unknown'\n\n let browser: BrowserName = rawBrowser\n let version = rawVersion\n\n // ── Post-detection overrides ────────────────────────────────────────────────\n\n // 360 browser disambiguation via Chrome global APIs and MIME types.\n // Only runs when a nav context is provided (browser environment).\n if (nav) {\n const chromeGlobal = typeof chrome !== 'undefined' ? chrome : undefined\n const chromeMatch = /Chrome\\/([\\d]+)/.exec(ua)\n const chromeMajor = chromeMatch ? parseInt(chromeMatch[1], 10) : 0\n\n if (chromeGlobal) {\n if (chromeGlobal.adblock2345 || chromeGlobal.common2345) {\n browser = '2345Explorer'\n version = 'unknown'\n } else {\n let is360 = false\n\n if (\n getMimeType(nav, 'application/360softmgrplugin') ||\n getMimeType(nav, 'application/mozilla-npqihooquicklogin') ||\n (chromeMajor > 36 && typeof showModalDialog !== 'undefined')\n ) {\n is360 = true\n } else if (chromeMajor > 45) {\n is360 = getMimeType(nav, 'application/vnd.chromium.remoting-viewer')\n if (!is360 && chromeMajor >= 69) {\n is360 =\n getMimeType(nav, 'application/hwepass2001.installepass2001') ||\n getMimeType(nav, 'application/asx')\n }\n }\n\n if (is360) {\n // 360EE only when saveData is explicitly enabled; default to 360SE\n const saveDataEnabled = nav.connection?.saveData === true\n if (getMimeType(nav, 'application/gameplugin') || !saveDataEnabled) {\n browser = '360SE'\n } else {\n browser = '360EE'\n }\n version = 'unknown' // re-derived below via browser lookup\n }\n }\n }\n }\n\n // Baidu UA can include Opera token — Opera takes priority\n if (browser === 'Baidu' && /(Opera|OPR|OPT)/.test(ua)) {\n browser = 'Opera'\n const opVer = /OPR\\/([\\d.]+)/.exec(ua) ?? /OPT\\/([\\d.]+)/.exec(ua) ?? /Opera\\/([\\d.]+)/.exec(ua)\n version = opVer?.[1] ?? 'unknown'\n }\n\n // Generic \"SomethingBrowser/x.y\" catch-all: Chrome-based third-party browsers\n // that embed their own token alongside Chrome\n if (browser === 'Chrome' && /\\S+Browser\\//.test(ua)) {\n const m = /(\\S+Browser)\\/([\\d.]+)/.exec(ua)\n if (m) {\n browser = m[1] as BrowserName\n version = m[2]\n }\n }\n\n // Firefox Nightly detection — only meaningful in a real browser environment.\n // The heuristic checks for globals that exist in Chrome (clientInformation) but\n // not in standard Firefox, or where u2f was removed in Nightly builds.\n // Skip entirely in Node.js (no nav = not a browser).\n if (browser === 'Firefox' && nav) {\n try {\n if (typeof clientInformation !== 'undefined' || typeof u2f === 'undefined') {\n browser = 'Firefox Nightly'\n }\n } catch {\n // globals not accessible — leave as Firefox\n }\n }\n\n // WeChat Miniapp detection\n if (browser === 'Wechat') {\n try {\n if (typeof __wxjs_environment !== 'undefined' && __wxjs_environment === 'miniprogram') {\n browser = 'Wechat Miniapp'\n }\n } catch {\n // not in WeChat miniapp context\n }\n }\n\n const engine = detectEngine(ua, browser, version)\n\n return {\n browser,\n version,\n engine,\n os,\n osVersion,\n device,\n arch,\n isWebview: /; wv/.test(ua),\n isHeadless,\n isBot,\n botName,\n language,\n platform\n }\n}\n","import pkg from '../package.json' with { type: 'json' }\nconst { version: VERSION } = pkg\nimport { parseUA } from './parse.js'\nimport { getNavContext, getLanguage } from './utils/navigator.js'\nimport type { EnvOption } from './types.js'\n\n// ── Named exports (tree-shakeable) ──────────────────────────────────────────\nexport type { EnvOption, BrowserName, OsName, EngineName, DeviceName, ArchName, BotName } from './types.js'\nexport { parseUA } from './parse.js'\nexport { getLanguage, getNavContext } from './utils/navigator.js'\nexport { getWindowsVersion } from './utils/windows-version.js'\nexport { detectBot } from './detectors/bot.js'\nexport { detectArch } from './detectors/arch.js'\nexport { detectHeadless } from './detectors/headless.js'\nexport { VERSION }\n\n/** Check whether a UA string indicates an Android webview environment. */\nexport const isWebview = (ua: string): boolean => /; wv/.test(ua)\n\n/** Check whether the current context is a WeChat mini-program. */\nexport const isWechatMiniapp = (): boolean => {\n try {\n return typeof __wxjs_environment !== 'undefined' && __wxjs_environment === 'miniprogram'\n } catch {\n return false\n }\n}\n\n// ── Default export — maintains v0.x call signature ──────────────────────────\n\n/**\n * Detect browser, OS, engine and device information.\n *\n * @param ua - Optional UA string override. Defaults to `navigator.userAgent`.\n */\nfunction uaBrowser(ua?: string): EnvOption {\n const nav = getNavContext()\n return parseUA(ua ?? nav.userAgent, { nav })\n}\n\nuaBrowser.isWebview = isWebview\nuaBrowser.isWechatMiniapp = isWechatMiniapp\nuaBrowser.getLanguage = (): string => getLanguage(getNavContext())\nuaBrowser.VERSION = VERSION\n\nexport default uaBrowser\n"]}