@ogcio/design-system-react 1.24.0 → 1.25.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.
- package/README.md +5 -5
- package/dist/autocomplete/autocomplete.js +105 -101
- package/dist/autocomplete/use-autocomplete-controller.js +60 -58
- package/dist/browser-support/browser-support.d.ts +6 -0
- package/dist/browser-support/browser-support.js +2202 -0
- package/dist/browser-support/index.d.ts +1 -0
- package/dist/browser-support/index.js +4 -0
- package/dist/constants.d.ts +43 -0
- package/dist/constants.js +46 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +193 -190
- package/dist/pagination/pagination.js +305 -565
- package/dist/side-nav/index.d.ts +2 -0
- package/dist/side-nav/index.js +6 -0
- package/dist/side-nav/side-nav.d.ts +2 -1
- package/dist/side-nav/side-nav.js +119 -98
- package/dist/side-nav/types.d.ts +4 -0
- package/dist/styles.css +1 -1
- package/dist/useTranslation-BmIU4GBA.js +272 -0
- package/package.json +7 -10
- package/dist/browser-support/runtime.d.ts +0 -43
- package/dist/browser-support/runtime.js +0 -282
|
@@ -0,0 +1,2202 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as M, jsx as y } from "react/jsx-runtime";
|
|
3
|
+
import { c as F } from "../clsx-OuTLNxxd.js";
|
|
4
|
+
import { useMemo as S } from "react";
|
|
5
|
+
import { Alert as B } from "../alert/alert.js";
|
|
6
|
+
import { BROWSER_POLICY as x, DS_HOST as k } from "../constants.js";
|
|
7
|
+
import { Link as A } from "../link/link.js";
|
|
8
|
+
import { u as P } from "../useTranslation-BmIU4GBA.js";
|
|
9
|
+
const O = {
|
|
10
|
+
AmazonBot: "amazonbot",
|
|
11
|
+
"Amazon Silk": "amazon_silk",
|
|
12
|
+
"Android Browser": "android",
|
|
13
|
+
BaiduSpider: "baiduspider",
|
|
14
|
+
Bada: "bada",
|
|
15
|
+
BingCrawler: "bingcrawler",
|
|
16
|
+
BlackBerry: "blackberry",
|
|
17
|
+
"ChatGPT-User": "chatgpt_user",
|
|
18
|
+
Chrome: "chrome",
|
|
19
|
+
ClaudeBot: "claudebot",
|
|
20
|
+
Chromium: "chromium",
|
|
21
|
+
Diffbot: "diffbot",
|
|
22
|
+
DuckDuckBot: "duckduckbot",
|
|
23
|
+
Electron: "electron",
|
|
24
|
+
Epiphany: "epiphany",
|
|
25
|
+
FacebookExternalHit: "facebookexternalhit",
|
|
26
|
+
Firefox: "firefox",
|
|
27
|
+
Focus: "focus",
|
|
28
|
+
Generic: "generic",
|
|
29
|
+
"Google Search": "google_search",
|
|
30
|
+
Googlebot: "googlebot",
|
|
31
|
+
GPTBot: "gptbot",
|
|
32
|
+
"Internet Explorer": "ie",
|
|
33
|
+
InternetArchiveCrawler: "internetarchivecrawler",
|
|
34
|
+
"K-Meleon": "k_meleon",
|
|
35
|
+
LibreWolf: "librewolf",
|
|
36
|
+
Maxthon: "maxthon",
|
|
37
|
+
"Meta-ExternalAds": "meta_externalads",
|
|
38
|
+
"Meta-ExternalAgent": "meta_externalagent",
|
|
39
|
+
"Meta-ExternalFetcher": "meta_externalfetcher",
|
|
40
|
+
"Meta-WebIndexer": "meta_webindexer",
|
|
41
|
+
"Microsoft Edge": "edge",
|
|
42
|
+
"MZ Browser": "mz",
|
|
43
|
+
"NAVER Whale Browser": "naver",
|
|
44
|
+
"OAI-SearchBot": "oai_searchbot",
|
|
45
|
+
Omgilibot: "omgilibot",
|
|
46
|
+
Opera: "opera",
|
|
47
|
+
"Opera Coast": "opera_coast",
|
|
48
|
+
"Pale Moon": "pale_moon",
|
|
49
|
+
PerplexityBot: "perplexitybot",
|
|
50
|
+
"Perplexity-User": "perplexity_user",
|
|
51
|
+
PhantomJS: "phantomjs",
|
|
52
|
+
PingdomBot: "pingdombot",
|
|
53
|
+
Puffin: "puffin",
|
|
54
|
+
QQ: "qq",
|
|
55
|
+
QQLite: "qqlite",
|
|
56
|
+
QupZilla: "qupzilla",
|
|
57
|
+
Roku: "roku",
|
|
58
|
+
Safari: "safari",
|
|
59
|
+
Sailfish: "sailfish",
|
|
60
|
+
"Samsung Internet for Android": "samsung_internet",
|
|
61
|
+
SeaMonkey: "seamonkey",
|
|
62
|
+
Sleipnir: "sleipnir",
|
|
63
|
+
"Sogou Browser": "sogou",
|
|
64
|
+
Swing: "swing",
|
|
65
|
+
Tizen: "tizen",
|
|
66
|
+
"UC Browser": "uc",
|
|
67
|
+
Vivaldi: "vivaldi",
|
|
68
|
+
"WebOS Browser": "webos",
|
|
69
|
+
WeChat: "wechat",
|
|
70
|
+
YahooSlurp: "yahooslurp",
|
|
71
|
+
"Yandex Browser": "yandex",
|
|
72
|
+
YandexBot: "yandexbot",
|
|
73
|
+
YouBot: "youbot"
|
|
74
|
+
}, w = {
|
|
75
|
+
amazonbot: "AmazonBot",
|
|
76
|
+
amazon_silk: "Amazon Silk",
|
|
77
|
+
android: "Android Browser",
|
|
78
|
+
baiduspider: "BaiduSpider",
|
|
79
|
+
bada: "Bada",
|
|
80
|
+
bingcrawler: "BingCrawler",
|
|
81
|
+
blackberry: "BlackBerry",
|
|
82
|
+
chatgpt_user: "ChatGPT-User",
|
|
83
|
+
chrome: "Chrome",
|
|
84
|
+
claudebot: "ClaudeBot",
|
|
85
|
+
chromium: "Chromium",
|
|
86
|
+
diffbot: "Diffbot",
|
|
87
|
+
duckduckbot: "DuckDuckBot",
|
|
88
|
+
edge: "Microsoft Edge",
|
|
89
|
+
electron: "Electron",
|
|
90
|
+
epiphany: "Epiphany",
|
|
91
|
+
facebookexternalhit: "FacebookExternalHit",
|
|
92
|
+
firefox: "Firefox",
|
|
93
|
+
focus: "Focus",
|
|
94
|
+
generic: "Generic",
|
|
95
|
+
google_search: "Google Search",
|
|
96
|
+
googlebot: "Googlebot",
|
|
97
|
+
gptbot: "GPTBot",
|
|
98
|
+
ie: "Internet Explorer",
|
|
99
|
+
internetarchivecrawler: "InternetArchiveCrawler",
|
|
100
|
+
k_meleon: "K-Meleon",
|
|
101
|
+
librewolf: "LibreWolf",
|
|
102
|
+
maxthon: "Maxthon",
|
|
103
|
+
meta_externalads: "Meta-ExternalAds",
|
|
104
|
+
meta_externalagent: "Meta-ExternalAgent",
|
|
105
|
+
meta_externalfetcher: "Meta-ExternalFetcher",
|
|
106
|
+
meta_webindexer: "Meta-WebIndexer",
|
|
107
|
+
mz: "MZ Browser",
|
|
108
|
+
naver: "NAVER Whale Browser",
|
|
109
|
+
oai_searchbot: "OAI-SearchBot",
|
|
110
|
+
omgilibot: "Omgilibot",
|
|
111
|
+
opera: "Opera",
|
|
112
|
+
opera_coast: "Opera Coast",
|
|
113
|
+
pale_moon: "Pale Moon",
|
|
114
|
+
perplexitybot: "PerplexityBot",
|
|
115
|
+
perplexity_user: "Perplexity-User",
|
|
116
|
+
phantomjs: "PhantomJS",
|
|
117
|
+
pingdombot: "PingdomBot",
|
|
118
|
+
puffin: "Puffin",
|
|
119
|
+
qq: "QQ Browser",
|
|
120
|
+
qqlite: "QQ Browser Lite",
|
|
121
|
+
qupzilla: "QupZilla",
|
|
122
|
+
roku: "Roku",
|
|
123
|
+
safari: "Safari",
|
|
124
|
+
sailfish: "Sailfish",
|
|
125
|
+
samsung_internet: "Samsung Internet for Android",
|
|
126
|
+
seamonkey: "SeaMonkey",
|
|
127
|
+
sleipnir: "Sleipnir",
|
|
128
|
+
sogou: "Sogou Browser",
|
|
129
|
+
swing: "Swing",
|
|
130
|
+
tizen: "Tizen",
|
|
131
|
+
uc: "UC Browser",
|
|
132
|
+
vivaldi: "Vivaldi",
|
|
133
|
+
webos: "WebOS Browser",
|
|
134
|
+
wechat: "WeChat",
|
|
135
|
+
yahooslurp: "YahooSlurp",
|
|
136
|
+
yandex: "Yandex Browser",
|
|
137
|
+
yandexbot: "YandexBot",
|
|
138
|
+
youbot: "YouBot"
|
|
139
|
+
}, n = {
|
|
140
|
+
bot: "bot",
|
|
141
|
+
desktop: "desktop",
|
|
142
|
+
mobile: "mobile",
|
|
143
|
+
tablet: "tablet",
|
|
144
|
+
tv: "tv"
|
|
145
|
+
}, b = {
|
|
146
|
+
Android: "Android",
|
|
147
|
+
Bada: "Bada",
|
|
148
|
+
BlackBerry: "BlackBerry",
|
|
149
|
+
ChromeOS: "Chrome OS",
|
|
150
|
+
HarmonyOS: "HarmonyOS",
|
|
151
|
+
iOS: "iOS",
|
|
152
|
+
Linux: "Linux",
|
|
153
|
+
MacOS: "macOS",
|
|
154
|
+
PlayStation4: "PlayStation 4",
|
|
155
|
+
Roku: "Roku",
|
|
156
|
+
Tizen: "Tizen",
|
|
157
|
+
WebOS: "WebOS",
|
|
158
|
+
Windows: "Windows",
|
|
159
|
+
WindowsPhone: "Windows Phone"
|
|
160
|
+
}, g = {
|
|
161
|
+
Blink: "Blink",
|
|
162
|
+
EdgeHTML: "EdgeHTML",
|
|
163
|
+
Gecko: "Gecko",
|
|
164
|
+
Presto: "Presto",
|
|
165
|
+
Trident: "Trident",
|
|
166
|
+
WebKit: "WebKit"
|
|
167
|
+
};
|
|
168
|
+
class s {
|
|
169
|
+
/**
|
|
170
|
+
* Get first matched item for a string
|
|
171
|
+
* @param {RegExp} regexp
|
|
172
|
+
* @param {String} ua
|
|
173
|
+
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
174
|
+
*/
|
|
175
|
+
static getFirstMatch(e, t) {
|
|
176
|
+
const i = t.match(e);
|
|
177
|
+
return i && i.length > 0 && i[1] || "";
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get second matched item for a string
|
|
181
|
+
* @param regexp
|
|
182
|
+
* @param {String} ua
|
|
183
|
+
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
184
|
+
*/
|
|
185
|
+
static getSecondMatch(e, t) {
|
|
186
|
+
const i = t.match(e);
|
|
187
|
+
return i && i.length > 1 && i[2] || "";
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Match a regexp and return a constant or undefined
|
|
191
|
+
* @param {RegExp} regexp
|
|
192
|
+
* @param {String} ua
|
|
193
|
+
* @param {*} _const Any const that will be returned if regexp matches the string
|
|
194
|
+
* @return {*}
|
|
195
|
+
*/
|
|
196
|
+
static matchAndReturnConst(e, t, i) {
|
|
197
|
+
if (e.test(t))
|
|
198
|
+
return i;
|
|
199
|
+
}
|
|
200
|
+
static getWindowsVersionName(e) {
|
|
201
|
+
switch (e) {
|
|
202
|
+
case "NT":
|
|
203
|
+
return "NT";
|
|
204
|
+
case "XP":
|
|
205
|
+
return "XP";
|
|
206
|
+
case "NT 5.0":
|
|
207
|
+
return "2000";
|
|
208
|
+
case "NT 5.1":
|
|
209
|
+
return "XP";
|
|
210
|
+
case "NT 5.2":
|
|
211
|
+
return "2003";
|
|
212
|
+
case "NT 6.0":
|
|
213
|
+
return "Vista";
|
|
214
|
+
case "NT 6.1":
|
|
215
|
+
return "7";
|
|
216
|
+
case "NT 6.2":
|
|
217
|
+
return "8";
|
|
218
|
+
case "NT 6.3":
|
|
219
|
+
return "8.1";
|
|
220
|
+
case "NT 10.0":
|
|
221
|
+
return "10";
|
|
222
|
+
default:
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get macOS version name
|
|
228
|
+
* 10.5 - Leopard
|
|
229
|
+
* 10.6 - Snow Leopard
|
|
230
|
+
* 10.7 - Lion
|
|
231
|
+
* 10.8 - Mountain Lion
|
|
232
|
+
* 10.9 - Mavericks
|
|
233
|
+
* 10.10 - Yosemite
|
|
234
|
+
* 10.11 - El Capitan
|
|
235
|
+
* 10.12 - Sierra
|
|
236
|
+
* 10.13 - High Sierra
|
|
237
|
+
* 10.14 - Mojave
|
|
238
|
+
* 10.15 - Catalina
|
|
239
|
+
* 11 - Big Sur
|
|
240
|
+
* 12 - Monterey
|
|
241
|
+
* 13 - Ventura
|
|
242
|
+
* 14 - Sonoma
|
|
243
|
+
* 15 - Sequoia
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* getMacOSVersionName("10.14") // 'Mojave'
|
|
247
|
+
*
|
|
248
|
+
* @param {string} version
|
|
249
|
+
* @return {string} versionName
|
|
250
|
+
*/
|
|
251
|
+
static getMacOSVersionName(e) {
|
|
252
|
+
const t = e.split(".").splice(0, 2).map((c) => parseInt(c, 10) || 0);
|
|
253
|
+
t.push(0);
|
|
254
|
+
const i = t[0], a = t[1];
|
|
255
|
+
if (i === 10)
|
|
256
|
+
switch (a) {
|
|
257
|
+
case 5:
|
|
258
|
+
return "Leopard";
|
|
259
|
+
case 6:
|
|
260
|
+
return "Snow Leopard";
|
|
261
|
+
case 7:
|
|
262
|
+
return "Lion";
|
|
263
|
+
case 8:
|
|
264
|
+
return "Mountain Lion";
|
|
265
|
+
case 9:
|
|
266
|
+
return "Mavericks";
|
|
267
|
+
case 10:
|
|
268
|
+
return "Yosemite";
|
|
269
|
+
case 11:
|
|
270
|
+
return "El Capitan";
|
|
271
|
+
case 12:
|
|
272
|
+
return "Sierra";
|
|
273
|
+
case 13:
|
|
274
|
+
return "High Sierra";
|
|
275
|
+
case 14:
|
|
276
|
+
return "Mojave";
|
|
277
|
+
case 15:
|
|
278
|
+
return "Catalina";
|
|
279
|
+
default:
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
switch (i) {
|
|
283
|
+
case 11:
|
|
284
|
+
return "Big Sur";
|
|
285
|
+
case 12:
|
|
286
|
+
return "Monterey";
|
|
287
|
+
case 13:
|
|
288
|
+
return "Ventura";
|
|
289
|
+
case 14:
|
|
290
|
+
return "Sonoma";
|
|
291
|
+
case 15:
|
|
292
|
+
return "Sequoia";
|
|
293
|
+
default:
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Get Android version name
|
|
299
|
+
* 1.5 - Cupcake
|
|
300
|
+
* 1.6 - Donut
|
|
301
|
+
* 2.0 - Eclair
|
|
302
|
+
* 2.1 - Eclair
|
|
303
|
+
* 2.2 - Froyo
|
|
304
|
+
* 2.x - Gingerbread
|
|
305
|
+
* 3.x - Honeycomb
|
|
306
|
+
* 4.0 - Ice Cream Sandwich
|
|
307
|
+
* 4.1 - Jelly Bean
|
|
308
|
+
* 4.4 - KitKat
|
|
309
|
+
* 5.x - Lollipop
|
|
310
|
+
* 6.x - Marshmallow
|
|
311
|
+
* 7.x - Nougat
|
|
312
|
+
* 8.x - Oreo
|
|
313
|
+
* 9.x - Pie
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* getAndroidVersionName("7.0") // 'Nougat'
|
|
317
|
+
*
|
|
318
|
+
* @param {string} version
|
|
319
|
+
* @return {string} versionName
|
|
320
|
+
*/
|
|
321
|
+
static getAndroidVersionName(e) {
|
|
322
|
+
const t = e.split(".").splice(0, 2).map((i) => parseInt(i, 10) || 0);
|
|
323
|
+
if (t.push(0), !(t[0] === 1 && t[1] < 5)) {
|
|
324
|
+
if (t[0] === 1 && t[1] < 6) return "Cupcake";
|
|
325
|
+
if (t[0] === 1 && t[1] >= 6) return "Donut";
|
|
326
|
+
if (t[0] === 2 && t[1] < 2) return "Eclair";
|
|
327
|
+
if (t[0] === 2 && t[1] === 2) return "Froyo";
|
|
328
|
+
if (t[0] === 2 && t[1] > 2) return "Gingerbread";
|
|
329
|
+
if (t[0] === 3) return "Honeycomb";
|
|
330
|
+
if (t[0] === 4 && t[1] < 1) return "Ice Cream Sandwich";
|
|
331
|
+
if (t[0] === 4 && t[1] < 4) return "Jelly Bean";
|
|
332
|
+
if (t[0] === 4 && t[1] >= 4) return "KitKat";
|
|
333
|
+
if (t[0] === 5) return "Lollipop";
|
|
334
|
+
if (t[0] === 6) return "Marshmallow";
|
|
335
|
+
if (t[0] === 7) return "Nougat";
|
|
336
|
+
if (t[0] === 8) return "Oreo";
|
|
337
|
+
if (t[0] === 9) return "Pie";
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get version precisions count
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* getVersionPrecision("1.10.3") // 3
|
|
345
|
+
*
|
|
346
|
+
* @param {string} version
|
|
347
|
+
* @return {number}
|
|
348
|
+
*/
|
|
349
|
+
static getVersionPrecision(e) {
|
|
350
|
+
return e.split(".").length;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Calculate browser version weight
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* compareVersions('1.10.2.1', '1.8.2.1.90') // 1
|
|
357
|
+
* compareVersions('1.010.2.1', '1.09.2.1.90'); // 1
|
|
358
|
+
* compareVersions('1.10.2.1', '1.10.2.1'); // 0
|
|
359
|
+
* compareVersions('1.10.2.1', '1.0800.2'); // -1
|
|
360
|
+
* compareVersions('1.10.2.1', '1.10', true); // 0
|
|
361
|
+
*
|
|
362
|
+
* @param {String} versionA versions versions to compare
|
|
363
|
+
* @param {String} versionB versions versions to compare
|
|
364
|
+
* @param {boolean} [isLoose] enable loose comparison
|
|
365
|
+
* @return {Number} comparison result: -1 when versionA is lower,
|
|
366
|
+
* 1 when versionA is bigger, 0 when both equal
|
|
367
|
+
*/
|
|
368
|
+
/* eslint consistent-return: 1 */
|
|
369
|
+
static compareVersions(e, t, i = !1) {
|
|
370
|
+
const a = s.getVersionPrecision(e), c = s.getVersionPrecision(t);
|
|
371
|
+
let u = Math.max(a, c), l = 0;
|
|
372
|
+
const d = s.map([e, t], (m) => {
|
|
373
|
+
const h = u - s.getVersionPrecision(m), v = m + new Array(h + 1).join(".0");
|
|
374
|
+
return s.map(v.split("."), (p) => new Array(20 - p.length).join("0") + p).reverse();
|
|
375
|
+
});
|
|
376
|
+
for (i && (l = u - Math.min(a, c)), u -= 1; u >= l; ) {
|
|
377
|
+
if (d[0][u] > d[1][u])
|
|
378
|
+
return 1;
|
|
379
|
+
if (d[0][u] === d[1][u]) {
|
|
380
|
+
if (u === l)
|
|
381
|
+
return 0;
|
|
382
|
+
u -= 1;
|
|
383
|
+
} else if (d[0][u] < d[1][u])
|
|
384
|
+
return -1;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Array::map polyfill
|
|
389
|
+
*
|
|
390
|
+
* @param {Array} arr
|
|
391
|
+
* @param {Function} iterator
|
|
392
|
+
* @return {Array}
|
|
393
|
+
*/
|
|
394
|
+
static map(e, t) {
|
|
395
|
+
const i = [];
|
|
396
|
+
let a;
|
|
397
|
+
if (Array.prototype.map)
|
|
398
|
+
return Array.prototype.map.call(e, t);
|
|
399
|
+
for (a = 0; a < e.length; a += 1)
|
|
400
|
+
i.push(t(e[a]));
|
|
401
|
+
return i;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Array::find polyfill
|
|
405
|
+
*
|
|
406
|
+
* @param {Array} arr
|
|
407
|
+
* @param {Function} predicate
|
|
408
|
+
* @return {Array}
|
|
409
|
+
*/
|
|
410
|
+
static find(e, t) {
|
|
411
|
+
let i, a;
|
|
412
|
+
if (Array.prototype.find)
|
|
413
|
+
return Array.prototype.find.call(e, t);
|
|
414
|
+
for (i = 0, a = e.length; i < a; i += 1) {
|
|
415
|
+
const c = e[i];
|
|
416
|
+
if (t(c, i))
|
|
417
|
+
return c;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Object::assign polyfill
|
|
422
|
+
*
|
|
423
|
+
* @param {Object} obj
|
|
424
|
+
* @param {Object} ...objs
|
|
425
|
+
* @return {Object}
|
|
426
|
+
*/
|
|
427
|
+
static assign(e, ...t) {
|
|
428
|
+
const i = e;
|
|
429
|
+
let a, c;
|
|
430
|
+
if (Object.assign)
|
|
431
|
+
return Object.assign(e, ...t);
|
|
432
|
+
for (a = 0, c = t.length; a < c; a += 1) {
|
|
433
|
+
const u = t[a];
|
|
434
|
+
typeof u == "object" && u !== null && Object.keys(u).forEach((d) => {
|
|
435
|
+
i[d] = u[d];
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
return e;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Get short version/alias for a browser name
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* getBrowserAlias('Microsoft Edge') // edge
|
|
445
|
+
*
|
|
446
|
+
* @param {string} browserName
|
|
447
|
+
* @return {string}
|
|
448
|
+
*/
|
|
449
|
+
static getBrowserAlias(e) {
|
|
450
|
+
return O[e];
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Get browser name for a short version/alias
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* getBrowserTypeByAlias('edge') // Microsoft Edge
|
|
457
|
+
*
|
|
458
|
+
* @param {string} browserAlias
|
|
459
|
+
* @return {string}
|
|
460
|
+
*/
|
|
461
|
+
static getBrowserTypeByAlias(e) {
|
|
462
|
+
return w[e] || "";
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const o = /version\/(\d+(\.?_?\d+)+)/i, _ = [
|
|
466
|
+
/* GPTBot */
|
|
467
|
+
{
|
|
468
|
+
test: [/gptbot/i],
|
|
469
|
+
describe(r) {
|
|
470
|
+
const e = {
|
|
471
|
+
name: "GPTBot"
|
|
472
|
+
}, t = s.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
473
|
+
return t && (e.version = t), e;
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
/* ChatGPT-User */
|
|
477
|
+
{
|
|
478
|
+
test: [/chatgpt-user/i],
|
|
479
|
+
describe(r) {
|
|
480
|
+
const e = {
|
|
481
|
+
name: "ChatGPT-User"
|
|
482
|
+
}, t = s.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
483
|
+
return t && (e.version = t), e;
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
/* OAI-SearchBot */
|
|
487
|
+
{
|
|
488
|
+
test: [/oai-searchbot/i],
|
|
489
|
+
describe(r) {
|
|
490
|
+
const e = {
|
|
491
|
+
name: "OAI-SearchBot"
|
|
492
|
+
}, t = s.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
493
|
+
return t && (e.version = t), e;
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
/* ClaudeBot */
|
|
497
|
+
{
|
|
498
|
+
test: [/claudebot/i, /claude-web/i, /claude-user/i, /claude-searchbot/i],
|
|
499
|
+
describe(r) {
|
|
500
|
+
const e = {
|
|
501
|
+
name: "ClaudeBot"
|
|
502
|
+
}, t = s.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
503
|
+
return t && (e.version = t), e;
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
/* Omgilibot */
|
|
507
|
+
{
|
|
508
|
+
test: [/omgilibot/i, /webzio-extended/i],
|
|
509
|
+
describe(r) {
|
|
510
|
+
const e = {
|
|
511
|
+
name: "Omgilibot"
|
|
512
|
+
}, t = s.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
513
|
+
return t && (e.version = t), e;
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
/* Diffbot */
|
|
517
|
+
{
|
|
518
|
+
test: [/diffbot/i],
|
|
519
|
+
describe(r) {
|
|
520
|
+
const e = {
|
|
521
|
+
name: "Diffbot"
|
|
522
|
+
}, t = s.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
523
|
+
return t && (e.version = t), e;
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
/* PerplexityBot */
|
|
527
|
+
{
|
|
528
|
+
test: [/perplexitybot/i],
|
|
529
|
+
describe(r) {
|
|
530
|
+
const e = {
|
|
531
|
+
name: "PerplexityBot"
|
|
532
|
+
}, t = s.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
533
|
+
return t && (e.version = t), e;
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
/* Perplexity-User */
|
|
537
|
+
{
|
|
538
|
+
test: [/perplexity-user/i],
|
|
539
|
+
describe(r) {
|
|
540
|
+
const e = {
|
|
541
|
+
name: "Perplexity-User"
|
|
542
|
+
}, t = s.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
543
|
+
return t && (e.version = t), e;
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
/* YouBot */
|
|
547
|
+
{
|
|
548
|
+
test: [/youbot/i],
|
|
549
|
+
describe(r) {
|
|
550
|
+
const e = {
|
|
551
|
+
name: "YouBot"
|
|
552
|
+
}, t = s.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
553
|
+
return t && (e.version = t), e;
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
/* Meta-WebIndexer */
|
|
557
|
+
{
|
|
558
|
+
test: [/meta-webindexer/i],
|
|
559
|
+
describe(r) {
|
|
560
|
+
const e = {
|
|
561
|
+
name: "Meta-WebIndexer"
|
|
562
|
+
}, t = s.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
563
|
+
return t && (e.version = t), e;
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
/* Meta-ExternalAds */
|
|
567
|
+
{
|
|
568
|
+
test: [/meta-externalads/i],
|
|
569
|
+
describe(r) {
|
|
570
|
+
const e = {
|
|
571
|
+
name: "Meta-ExternalAds"
|
|
572
|
+
}, t = s.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
573
|
+
return t && (e.version = t), e;
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
/* Meta-ExternalAgent */
|
|
577
|
+
{
|
|
578
|
+
test: [/meta-externalagent/i],
|
|
579
|
+
describe(r) {
|
|
580
|
+
const e = {
|
|
581
|
+
name: "Meta-ExternalAgent"
|
|
582
|
+
}, t = s.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
583
|
+
return t && (e.version = t), e;
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
/* Meta-ExternalFetcher */
|
|
587
|
+
{
|
|
588
|
+
test: [/meta-externalfetcher/i],
|
|
589
|
+
describe(r) {
|
|
590
|
+
const e = {
|
|
591
|
+
name: "Meta-ExternalFetcher"
|
|
592
|
+
}, t = s.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
593
|
+
return t && (e.version = t), e;
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
/* Googlebot */
|
|
597
|
+
{
|
|
598
|
+
test: [/googlebot/i],
|
|
599
|
+
describe(r) {
|
|
600
|
+
const e = {
|
|
601
|
+
name: "Googlebot"
|
|
602
|
+
}, t = s.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, r) || s.getFirstMatch(o, r);
|
|
603
|
+
return t && (e.version = t), e;
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
/* AmazonBot */
|
|
607
|
+
{
|
|
608
|
+
test: [/amazonbot/i],
|
|
609
|
+
describe(r) {
|
|
610
|
+
const e = {
|
|
611
|
+
name: "AmazonBot"
|
|
612
|
+
}, t = s.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
613
|
+
return t && (e.version = t), e;
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
/* BingCrawler */
|
|
617
|
+
{
|
|
618
|
+
test: [/bingbot/i],
|
|
619
|
+
describe(r) {
|
|
620
|
+
const e = {
|
|
621
|
+
name: "BingCrawler"
|
|
622
|
+
}, t = s.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
623
|
+
return t && (e.version = t), e;
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
/* BaiduSpider */
|
|
627
|
+
{
|
|
628
|
+
test: [/baiduspider/i],
|
|
629
|
+
describe(r) {
|
|
630
|
+
const e = {
|
|
631
|
+
name: "BaiduSpider"
|
|
632
|
+
}, t = s.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
633
|
+
return t && (e.version = t), e;
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
/* DuckDuckBot */
|
|
637
|
+
{
|
|
638
|
+
test: [/duckduckbot/i],
|
|
639
|
+
describe(r) {
|
|
640
|
+
const e = {
|
|
641
|
+
name: "DuckDuckBot"
|
|
642
|
+
}, t = s.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
643
|
+
return t && (e.version = t), e;
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
/* InternetArchiveCrawler */
|
|
647
|
+
{
|
|
648
|
+
test: [/ia_archiver/i],
|
|
649
|
+
describe(r) {
|
|
650
|
+
const e = {
|
|
651
|
+
name: "InternetArchiveCrawler"
|
|
652
|
+
}, t = s.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
653
|
+
return t && (e.version = t), e;
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
/* FacebookExternalHit */
|
|
657
|
+
{
|
|
658
|
+
test: [/facebookexternalhit/i, /facebookcatalog/i],
|
|
659
|
+
describe() {
|
|
660
|
+
return {
|
|
661
|
+
name: "FacebookExternalHit"
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
/* YahooSlurp */
|
|
666
|
+
{
|
|
667
|
+
test: [/yahoo!?[\s/]*slurp/i],
|
|
668
|
+
describe() {
|
|
669
|
+
return {
|
|
670
|
+
name: "YahooSlurp"
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
/* YandexBot */
|
|
675
|
+
{
|
|
676
|
+
test: [/yandexbot/i, /yandexmobilebot/i],
|
|
677
|
+
describe() {
|
|
678
|
+
return {
|
|
679
|
+
name: "YandexBot"
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
/* PingdomBot */
|
|
684
|
+
{
|
|
685
|
+
test: [/pingdom/i],
|
|
686
|
+
describe() {
|
|
687
|
+
return {
|
|
688
|
+
name: "PingdomBot"
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
/* Opera < 13.0 */
|
|
693
|
+
{
|
|
694
|
+
test: [/opera/i],
|
|
695
|
+
describe(r) {
|
|
696
|
+
const e = {
|
|
697
|
+
name: "Opera"
|
|
698
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
699
|
+
return t && (e.version = t), e;
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
/* Opera > 13.0 */
|
|
703
|
+
{
|
|
704
|
+
test: [/opr\/|opios/i],
|
|
705
|
+
describe(r) {
|
|
706
|
+
const e = {
|
|
707
|
+
name: "Opera"
|
|
708
|
+
}, t = s.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, r) || s.getFirstMatch(o, r);
|
|
709
|
+
return t && (e.version = t), e;
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
test: [/SamsungBrowser/i],
|
|
714
|
+
describe(r) {
|
|
715
|
+
const e = {
|
|
716
|
+
name: "Samsung Internet for Android"
|
|
717
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
718
|
+
return t && (e.version = t), e;
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
test: [/Whale/i],
|
|
723
|
+
describe(r) {
|
|
724
|
+
const e = {
|
|
725
|
+
name: "NAVER Whale Browser"
|
|
726
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
727
|
+
return t && (e.version = t), e;
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
test: [/PaleMoon/i],
|
|
732
|
+
describe(r) {
|
|
733
|
+
const e = {
|
|
734
|
+
name: "Pale Moon"
|
|
735
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
736
|
+
return t && (e.version = t), e;
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
test: [/MZBrowser/i],
|
|
741
|
+
describe(r) {
|
|
742
|
+
const e = {
|
|
743
|
+
name: "MZ Browser"
|
|
744
|
+
}, t = s.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
745
|
+
return t && (e.version = t), e;
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
test: [/focus/i],
|
|
750
|
+
describe(r) {
|
|
751
|
+
const e = {
|
|
752
|
+
name: "Focus"
|
|
753
|
+
}, t = s.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
754
|
+
return t && (e.version = t), e;
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
test: [/swing/i],
|
|
759
|
+
describe(r) {
|
|
760
|
+
const e = {
|
|
761
|
+
name: "Swing"
|
|
762
|
+
}, t = s.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
763
|
+
return t && (e.version = t), e;
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
test: [/coast/i],
|
|
768
|
+
describe(r) {
|
|
769
|
+
const e = {
|
|
770
|
+
name: "Opera Coast"
|
|
771
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
772
|
+
return t && (e.version = t), e;
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
test: [/opt\/\d+(?:.?_?\d+)+/i],
|
|
777
|
+
describe(r) {
|
|
778
|
+
const e = {
|
|
779
|
+
name: "Opera Touch"
|
|
780
|
+
}, t = s.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
781
|
+
return t && (e.version = t), e;
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
test: [/yabrowser/i],
|
|
786
|
+
describe(r) {
|
|
787
|
+
const e = {
|
|
788
|
+
name: "Yandex Browser"
|
|
789
|
+
}, t = s.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
790
|
+
return t && (e.version = t), e;
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
test: [/ucbrowser/i],
|
|
795
|
+
describe(r) {
|
|
796
|
+
const e = {
|
|
797
|
+
name: "UC Browser"
|
|
798
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
799
|
+
return t && (e.version = t), e;
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
test: [/Maxthon|mxios/i],
|
|
804
|
+
describe(r) {
|
|
805
|
+
const e = {
|
|
806
|
+
name: "Maxthon"
|
|
807
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
808
|
+
return t && (e.version = t), e;
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
test: [/epiphany/i],
|
|
813
|
+
describe(r) {
|
|
814
|
+
const e = {
|
|
815
|
+
name: "Epiphany"
|
|
816
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
817
|
+
return t && (e.version = t), e;
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
test: [/puffin/i],
|
|
822
|
+
describe(r) {
|
|
823
|
+
const e = {
|
|
824
|
+
name: "Puffin"
|
|
825
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
826
|
+
return t && (e.version = t), e;
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
test: [/sleipnir/i],
|
|
831
|
+
describe(r) {
|
|
832
|
+
const e = {
|
|
833
|
+
name: "Sleipnir"
|
|
834
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
835
|
+
return t && (e.version = t), e;
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
test: [/k-meleon/i],
|
|
840
|
+
describe(r) {
|
|
841
|
+
const e = {
|
|
842
|
+
name: "K-Meleon"
|
|
843
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
844
|
+
return t && (e.version = t), e;
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
test: [/micromessenger/i],
|
|
849
|
+
describe(r) {
|
|
850
|
+
const e = {
|
|
851
|
+
name: "WeChat"
|
|
852
|
+
}, t = s.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
853
|
+
return t && (e.version = t), e;
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
test: [/qqbrowser/i],
|
|
858
|
+
describe(r) {
|
|
859
|
+
const e = {
|
|
860
|
+
name: /qqbrowserlite/i.test(r) ? "QQ Browser Lite" : "QQ Browser"
|
|
861
|
+
}, t = s.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
862
|
+
return t && (e.version = t), e;
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
test: [/msie|trident/i],
|
|
867
|
+
describe(r) {
|
|
868
|
+
const e = {
|
|
869
|
+
name: "Internet Explorer"
|
|
870
|
+
}, t = s.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, r);
|
|
871
|
+
return t && (e.version = t), e;
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
test: [/\sedg\//i],
|
|
876
|
+
describe(r) {
|
|
877
|
+
const e = {
|
|
878
|
+
name: "Microsoft Edge"
|
|
879
|
+
}, t = s.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, r);
|
|
880
|
+
return t && (e.version = t), e;
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
test: [/edg([ea]|ios)/i],
|
|
885
|
+
describe(r) {
|
|
886
|
+
const e = {
|
|
887
|
+
name: "Microsoft Edge"
|
|
888
|
+
}, t = s.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, r);
|
|
889
|
+
return t && (e.version = t), e;
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
test: [/vivaldi/i],
|
|
894
|
+
describe(r) {
|
|
895
|
+
const e = {
|
|
896
|
+
name: "Vivaldi"
|
|
897
|
+
}, t = s.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, r);
|
|
898
|
+
return t && (e.version = t), e;
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
test: [/seamonkey/i],
|
|
903
|
+
describe(r) {
|
|
904
|
+
const e = {
|
|
905
|
+
name: "SeaMonkey"
|
|
906
|
+
}, t = s.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, r);
|
|
907
|
+
return t && (e.version = t), e;
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
test: [/sailfish/i],
|
|
912
|
+
describe(r) {
|
|
913
|
+
const e = {
|
|
914
|
+
name: "Sailfish"
|
|
915
|
+
}, t = s.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, r);
|
|
916
|
+
return t && (e.version = t), e;
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
test: [/silk/i],
|
|
921
|
+
describe(r) {
|
|
922
|
+
const e = {
|
|
923
|
+
name: "Amazon Silk"
|
|
924
|
+
}, t = s.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, r);
|
|
925
|
+
return t && (e.version = t), e;
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
test: [/phantom/i],
|
|
930
|
+
describe(r) {
|
|
931
|
+
const e = {
|
|
932
|
+
name: "PhantomJS"
|
|
933
|
+
}, t = s.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
934
|
+
return t && (e.version = t), e;
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
test: [/slimerjs/i],
|
|
939
|
+
describe(r) {
|
|
940
|
+
const e = {
|
|
941
|
+
name: "SlimerJS"
|
|
942
|
+
}, t = s.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
943
|
+
return t && (e.version = t), e;
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
948
|
+
describe(r) {
|
|
949
|
+
const e = {
|
|
950
|
+
name: "BlackBerry"
|
|
951
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, r);
|
|
952
|
+
return t && (e.version = t), e;
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
test: [/(web|hpw)[o0]s/i],
|
|
957
|
+
describe(r) {
|
|
958
|
+
const e = {
|
|
959
|
+
name: "WebOS Browser"
|
|
960
|
+
}, t = s.getFirstMatch(o, r) || s.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, r);
|
|
961
|
+
return t && (e.version = t), e;
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
test: [/bada/i],
|
|
966
|
+
describe(r) {
|
|
967
|
+
const e = {
|
|
968
|
+
name: "Bada"
|
|
969
|
+
}, t = s.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, r);
|
|
970
|
+
return t && (e.version = t), e;
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
test: [/tizen/i],
|
|
975
|
+
describe(r) {
|
|
976
|
+
const e = {
|
|
977
|
+
name: "Tizen"
|
|
978
|
+
}, t = s.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
979
|
+
return t && (e.version = t), e;
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
test: [/qupzilla/i],
|
|
984
|
+
describe(r) {
|
|
985
|
+
const e = {
|
|
986
|
+
name: "QupZilla"
|
|
987
|
+
}, t = s.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
988
|
+
return t && (e.version = t), e;
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
test: [/librewolf/i],
|
|
993
|
+
describe(r) {
|
|
994
|
+
const e = {
|
|
995
|
+
name: "LibreWolf"
|
|
996
|
+
}, t = s.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
997
|
+
return t && (e.version = t), e;
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
test: [/firefox|iceweasel|fxios/i],
|
|
1002
|
+
describe(r) {
|
|
1003
|
+
const e = {
|
|
1004
|
+
name: "Firefox"
|
|
1005
|
+
}, t = s.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1006
|
+
return t && (e.version = t), e;
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
test: [/electron/i],
|
|
1011
|
+
describe(r) {
|
|
1012
|
+
const e = {
|
|
1013
|
+
name: "Electron"
|
|
1014
|
+
}, t = s.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1015
|
+
return t && (e.version = t), e;
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
test: [/sogoumobilebrowser/i, /metasr/i, /se 2\.[x]/i],
|
|
1020
|
+
describe(r) {
|
|
1021
|
+
const e = {
|
|
1022
|
+
name: "Sogou Browser"
|
|
1023
|
+
}, t = s.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i, r), i = s.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, r), a = s.getFirstMatch(/se ([\d.]+)x/i, r), c = t || i || a;
|
|
1024
|
+
return c && (e.version = c), e;
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
test: [/MiuiBrowser/i],
|
|
1029
|
+
describe(r) {
|
|
1030
|
+
const e = {
|
|
1031
|
+
name: "Miui"
|
|
1032
|
+
}, t = s.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1033
|
+
return t && (e.version = t), e;
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
test: [/chromium/i],
|
|
1038
|
+
describe(r) {
|
|
1039
|
+
const e = {
|
|
1040
|
+
name: "Chromium"
|
|
1041
|
+
}, t = s.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, r) || s.getFirstMatch(o, r);
|
|
1042
|
+
return t && (e.version = t), e;
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
test: [/chrome|crios|crmo/i],
|
|
1047
|
+
describe(r) {
|
|
1048
|
+
const e = {
|
|
1049
|
+
name: "Chrome"
|
|
1050
|
+
}, t = s.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1051
|
+
return t && (e.version = t), e;
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
test: [/GSA/i],
|
|
1056
|
+
describe(r) {
|
|
1057
|
+
const e = {
|
|
1058
|
+
name: "Google Search"
|
|
1059
|
+
}, t = s.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1060
|
+
return t && (e.version = t), e;
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
/* Android Browser */
|
|
1064
|
+
{
|
|
1065
|
+
test(r) {
|
|
1066
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1067
|
+
return e && t;
|
|
1068
|
+
},
|
|
1069
|
+
describe(r) {
|
|
1070
|
+
const e = {
|
|
1071
|
+
name: "Android Browser"
|
|
1072
|
+
}, t = s.getFirstMatch(o, r);
|
|
1073
|
+
return t && (e.version = t), e;
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
/* PlayStation 4 */
|
|
1077
|
+
{
|
|
1078
|
+
test: [/playstation 4/i],
|
|
1079
|
+
describe(r) {
|
|
1080
|
+
const e = {
|
|
1081
|
+
name: "PlayStation 4"
|
|
1082
|
+
}, t = s.getFirstMatch(o, r);
|
|
1083
|
+
return t && (e.version = t), e;
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
/* Safari */
|
|
1087
|
+
{
|
|
1088
|
+
test: [/safari|applewebkit/i],
|
|
1089
|
+
describe(r) {
|
|
1090
|
+
const e = {
|
|
1091
|
+
name: "Safari"
|
|
1092
|
+
}, t = s.getFirstMatch(o, r);
|
|
1093
|
+
return t && (e.version = t), e;
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
/* Something else */
|
|
1097
|
+
{
|
|
1098
|
+
test: [/.*/i],
|
|
1099
|
+
describe(r) {
|
|
1100
|
+
const e = /^(.*)\/(.*) /, t = /^(.*)\/(.*)[ \t]\((.*)/, a = r.search("\\(") !== -1 ? t : e;
|
|
1101
|
+
return {
|
|
1102
|
+
name: s.getFirstMatch(a, r),
|
|
1103
|
+
version: s.getSecondMatch(a, r)
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
], E = [
|
|
1108
|
+
/* Roku */
|
|
1109
|
+
{
|
|
1110
|
+
test: [/Roku\/DVP/],
|
|
1111
|
+
describe(r) {
|
|
1112
|
+
const e = s.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, r);
|
|
1113
|
+
return {
|
|
1114
|
+
name: b.Roku,
|
|
1115
|
+
version: e
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
/* Windows Phone */
|
|
1120
|
+
{
|
|
1121
|
+
test: [/windows phone/i],
|
|
1122
|
+
describe(r) {
|
|
1123
|
+
const e = s.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, r);
|
|
1124
|
+
return {
|
|
1125
|
+
name: b.WindowsPhone,
|
|
1126
|
+
version: e
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
/* Windows */
|
|
1131
|
+
{
|
|
1132
|
+
test: [/windows /i],
|
|
1133
|
+
describe(r) {
|
|
1134
|
+
const e = s.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, r), t = s.getWindowsVersionName(e);
|
|
1135
|
+
return {
|
|
1136
|
+
name: b.Windows,
|
|
1137
|
+
version: e,
|
|
1138
|
+
versionName: t
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
/* Firefox on iPad */
|
|
1143
|
+
{
|
|
1144
|
+
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1145
|
+
describe(r) {
|
|
1146
|
+
const e = {
|
|
1147
|
+
name: b.iOS
|
|
1148
|
+
}, t = s.getSecondMatch(/(Version\/)(\d[\d.]+)/, r);
|
|
1149
|
+
return t && (e.version = t), e;
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
/* macOS */
|
|
1153
|
+
{
|
|
1154
|
+
test: [/macintosh/i],
|
|
1155
|
+
describe(r) {
|
|
1156
|
+
const e = s.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, r).replace(/[_\s]/g, "."), t = s.getMacOSVersionName(e), i = {
|
|
1157
|
+
name: b.MacOS,
|
|
1158
|
+
version: e
|
|
1159
|
+
};
|
|
1160
|
+
return t && (i.versionName = t), i;
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
/* iOS */
|
|
1164
|
+
{
|
|
1165
|
+
test: [/(ipod|iphone|ipad)/i],
|
|
1166
|
+
describe(r) {
|
|
1167
|
+
const e = s.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, r).replace(/[_\s]/g, ".");
|
|
1168
|
+
return {
|
|
1169
|
+
name: b.iOS,
|
|
1170
|
+
version: e
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
/* HarmonyOS */
|
|
1175
|
+
{
|
|
1176
|
+
test: [/OpenHarmony/i],
|
|
1177
|
+
describe(r) {
|
|
1178
|
+
const e = s.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i, r);
|
|
1179
|
+
return {
|
|
1180
|
+
name: b.HarmonyOS,
|
|
1181
|
+
version: e
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
/* Android */
|
|
1186
|
+
{
|
|
1187
|
+
test(r) {
|
|
1188
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1189
|
+
return e && t;
|
|
1190
|
+
},
|
|
1191
|
+
describe(r) {
|
|
1192
|
+
const e = s.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, r), t = s.getAndroidVersionName(e), i = {
|
|
1193
|
+
name: b.Android,
|
|
1194
|
+
version: e
|
|
1195
|
+
};
|
|
1196
|
+
return t && (i.versionName = t), i;
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
/* WebOS */
|
|
1200
|
+
{
|
|
1201
|
+
test: [/(web|hpw)[o0]s/i],
|
|
1202
|
+
describe(r) {
|
|
1203
|
+
const e = s.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, r), t = {
|
|
1204
|
+
name: b.WebOS
|
|
1205
|
+
};
|
|
1206
|
+
return e && e.length && (t.version = e), t;
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
/* BlackBerry */
|
|
1210
|
+
{
|
|
1211
|
+
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
1212
|
+
describe(r) {
|
|
1213
|
+
const e = s.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, r) || s.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, r) || s.getFirstMatch(/\bbb(\d+)/i, r);
|
|
1214
|
+
return {
|
|
1215
|
+
name: b.BlackBerry,
|
|
1216
|
+
version: e
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
/* Bada */
|
|
1221
|
+
{
|
|
1222
|
+
test: [/bada/i],
|
|
1223
|
+
describe(r) {
|
|
1224
|
+
const e = s.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, r);
|
|
1225
|
+
return {
|
|
1226
|
+
name: b.Bada,
|
|
1227
|
+
version: e
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
/* Tizen */
|
|
1232
|
+
{
|
|
1233
|
+
test: [/tizen/i],
|
|
1234
|
+
describe(r) {
|
|
1235
|
+
const e = s.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, r);
|
|
1236
|
+
return {
|
|
1237
|
+
name: b.Tizen,
|
|
1238
|
+
version: e
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
},
|
|
1242
|
+
/* Linux */
|
|
1243
|
+
{
|
|
1244
|
+
test: [/linux/i],
|
|
1245
|
+
describe() {
|
|
1246
|
+
return {
|
|
1247
|
+
name: b.Linux
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
/* Chrome OS */
|
|
1252
|
+
{
|
|
1253
|
+
test: [/CrOS/],
|
|
1254
|
+
describe() {
|
|
1255
|
+
return {
|
|
1256
|
+
name: b.ChromeOS
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
/* Playstation 4 */
|
|
1261
|
+
{
|
|
1262
|
+
test: [/PlayStation 4/],
|
|
1263
|
+
describe(r) {
|
|
1264
|
+
const e = s.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, r);
|
|
1265
|
+
return {
|
|
1266
|
+
name: b.PlayStation4,
|
|
1267
|
+
version: e
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
], N = [
|
|
1272
|
+
/* Googlebot */
|
|
1273
|
+
{
|
|
1274
|
+
test: [/googlebot/i],
|
|
1275
|
+
describe() {
|
|
1276
|
+
return {
|
|
1277
|
+
type: n.bot,
|
|
1278
|
+
vendor: "Google"
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
/* AmazonBot */
|
|
1283
|
+
{
|
|
1284
|
+
test: [/amazonbot/i],
|
|
1285
|
+
describe() {
|
|
1286
|
+
return {
|
|
1287
|
+
type: n.bot,
|
|
1288
|
+
vendor: "Amazon"
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
/* GPTBot */
|
|
1293
|
+
{
|
|
1294
|
+
test: [/gptbot/i],
|
|
1295
|
+
describe() {
|
|
1296
|
+
return {
|
|
1297
|
+
type: n.bot,
|
|
1298
|
+
vendor: "OpenAI"
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
/* ChatGPT-User */
|
|
1303
|
+
{
|
|
1304
|
+
test: [/chatgpt-user/i],
|
|
1305
|
+
describe() {
|
|
1306
|
+
return {
|
|
1307
|
+
type: n.bot,
|
|
1308
|
+
vendor: "OpenAI"
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
/* OAI-SearchBot */
|
|
1313
|
+
{
|
|
1314
|
+
test: [/oai-searchbot/i],
|
|
1315
|
+
describe() {
|
|
1316
|
+
return {
|
|
1317
|
+
type: n.bot,
|
|
1318
|
+
vendor: "OpenAI"
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
/* Baidu */
|
|
1323
|
+
{
|
|
1324
|
+
test: [/baiduspider/i],
|
|
1325
|
+
describe() {
|
|
1326
|
+
return {
|
|
1327
|
+
type: n.bot,
|
|
1328
|
+
vendor: "Baidu"
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
/* Bingbot */
|
|
1333
|
+
{
|
|
1334
|
+
test: [/bingbot/i],
|
|
1335
|
+
describe() {
|
|
1336
|
+
return {
|
|
1337
|
+
type: n.bot,
|
|
1338
|
+
vendor: "Bing"
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
/* DuckDuckBot */
|
|
1343
|
+
{
|
|
1344
|
+
test: [/duckduckbot/i],
|
|
1345
|
+
describe() {
|
|
1346
|
+
return {
|
|
1347
|
+
type: n.bot,
|
|
1348
|
+
vendor: "DuckDuckGo"
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
/* ClaudeBot */
|
|
1353
|
+
{
|
|
1354
|
+
test: [/claudebot/i, /claude-web/i, /claude-user/i, /claude-searchbot/i],
|
|
1355
|
+
describe() {
|
|
1356
|
+
return {
|
|
1357
|
+
type: n.bot,
|
|
1358
|
+
vendor: "Anthropic"
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
},
|
|
1362
|
+
/* Omgilibot */
|
|
1363
|
+
{
|
|
1364
|
+
test: [/omgilibot/i, /webzio-extended/i],
|
|
1365
|
+
describe() {
|
|
1366
|
+
return {
|
|
1367
|
+
type: n.bot,
|
|
1368
|
+
vendor: "Webz.io"
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
/* Diffbot */
|
|
1373
|
+
{
|
|
1374
|
+
test: [/diffbot/i],
|
|
1375
|
+
describe() {
|
|
1376
|
+
return {
|
|
1377
|
+
type: n.bot,
|
|
1378
|
+
vendor: "Diffbot"
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
/* PerplexityBot */
|
|
1383
|
+
{
|
|
1384
|
+
test: [/perplexitybot/i],
|
|
1385
|
+
describe() {
|
|
1386
|
+
return {
|
|
1387
|
+
type: n.bot,
|
|
1388
|
+
vendor: "Perplexity AI"
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
/* Perplexity-User */
|
|
1393
|
+
{
|
|
1394
|
+
test: [/perplexity-user/i],
|
|
1395
|
+
describe() {
|
|
1396
|
+
return {
|
|
1397
|
+
type: n.bot,
|
|
1398
|
+
vendor: "Perplexity AI"
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
},
|
|
1402
|
+
/* YouBot */
|
|
1403
|
+
{
|
|
1404
|
+
test: [/youbot/i],
|
|
1405
|
+
describe() {
|
|
1406
|
+
return {
|
|
1407
|
+
type: n.bot,
|
|
1408
|
+
vendor: "You.com"
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
/* Internet Archive Crawler */
|
|
1413
|
+
{
|
|
1414
|
+
test: [/ia_archiver/i],
|
|
1415
|
+
describe() {
|
|
1416
|
+
return {
|
|
1417
|
+
type: n.bot,
|
|
1418
|
+
vendor: "Internet Archive"
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
/* Meta-WebIndexer */
|
|
1423
|
+
{
|
|
1424
|
+
test: [/meta-webindexer/i],
|
|
1425
|
+
describe() {
|
|
1426
|
+
return {
|
|
1427
|
+
type: n.bot,
|
|
1428
|
+
vendor: "Meta"
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
},
|
|
1432
|
+
/* Meta-ExternalAds */
|
|
1433
|
+
{
|
|
1434
|
+
test: [/meta-externalads/i],
|
|
1435
|
+
describe() {
|
|
1436
|
+
return {
|
|
1437
|
+
type: n.bot,
|
|
1438
|
+
vendor: "Meta"
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
},
|
|
1442
|
+
/* Meta-ExternalAgent */
|
|
1443
|
+
{
|
|
1444
|
+
test: [/meta-externalagent/i],
|
|
1445
|
+
describe() {
|
|
1446
|
+
return {
|
|
1447
|
+
type: n.bot,
|
|
1448
|
+
vendor: "Meta"
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
/* Meta-ExternalFetcher */
|
|
1453
|
+
{
|
|
1454
|
+
test: [/meta-externalfetcher/i],
|
|
1455
|
+
describe() {
|
|
1456
|
+
return {
|
|
1457
|
+
type: n.bot,
|
|
1458
|
+
vendor: "Meta"
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
/* Meta Web Crawler */
|
|
1463
|
+
{
|
|
1464
|
+
test: [/facebookexternalhit/i, /facebookcatalog/i],
|
|
1465
|
+
describe() {
|
|
1466
|
+
return {
|
|
1467
|
+
type: n.bot,
|
|
1468
|
+
vendor: "Meta"
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
},
|
|
1472
|
+
/* Yahoo! Slurp */
|
|
1473
|
+
{
|
|
1474
|
+
test: [/yahoo/i],
|
|
1475
|
+
describe() {
|
|
1476
|
+
return {
|
|
1477
|
+
type: n.bot,
|
|
1478
|
+
vendor: "Yahoo"
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
/* Yandex */
|
|
1483
|
+
{
|
|
1484
|
+
test: [/yandexbot/i, /yandexmobilebot/i],
|
|
1485
|
+
describe() {
|
|
1486
|
+
return {
|
|
1487
|
+
type: n.bot,
|
|
1488
|
+
vendor: "Yandex"
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
/* Pingdom */
|
|
1493
|
+
{
|
|
1494
|
+
test: [/pingdom/i],
|
|
1495
|
+
describe() {
|
|
1496
|
+
return {
|
|
1497
|
+
type: n.bot,
|
|
1498
|
+
vendor: "Pingdom"
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
/* Huawei */
|
|
1503
|
+
{
|
|
1504
|
+
test: [/huawei/i],
|
|
1505
|
+
describe(r) {
|
|
1506
|
+
const e = s.getFirstMatch(/(can-l01)/i, r) && "Nova", t = {
|
|
1507
|
+
type: n.mobile,
|
|
1508
|
+
vendor: "Huawei"
|
|
1509
|
+
};
|
|
1510
|
+
return e && (t.model = e), t;
|
|
1511
|
+
}
|
|
1512
|
+
},
|
|
1513
|
+
/* Nexus Tablet */
|
|
1514
|
+
{
|
|
1515
|
+
test: [/nexus\s*(?:7|8|9|10).*/i],
|
|
1516
|
+
describe() {
|
|
1517
|
+
return {
|
|
1518
|
+
type: n.tablet,
|
|
1519
|
+
vendor: "Nexus"
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
},
|
|
1523
|
+
/* iPad */
|
|
1524
|
+
{
|
|
1525
|
+
test: [/ipad/i],
|
|
1526
|
+
describe() {
|
|
1527
|
+
return {
|
|
1528
|
+
type: n.tablet,
|
|
1529
|
+
vendor: "Apple",
|
|
1530
|
+
model: "iPad"
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
/* Firefox on iPad */
|
|
1535
|
+
{
|
|
1536
|
+
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1537
|
+
describe() {
|
|
1538
|
+
return {
|
|
1539
|
+
type: n.tablet,
|
|
1540
|
+
vendor: "Apple",
|
|
1541
|
+
model: "iPad"
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
},
|
|
1545
|
+
/* Amazon Kindle Fire */
|
|
1546
|
+
{
|
|
1547
|
+
test: [/kftt build/i],
|
|
1548
|
+
describe() {
|
|
1549
|
+
return {
|
|
1550
|
+
type: n.tablet,
|
|
1551
|
+
vendor: "Amazon",
|
|
1552
|
+
model: "Kindle Fire HD 7"
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
/* Another Amazon Tablet with Silk */
|
|
1557
|
+
{
|
|
1558
|
+
test: [/silk/i],
|
|
1559
|
+
describe() {
|
|
1560
|
+
return {
|
|
1561
|
+
type: n.tablet,
|
|
1562
|
+
vendor: "Amazon"
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
/* Tablet */
|
|
1567
|
+
{
|
|
1568
|
+
test: [/tablet(?! pc)/i],
|
|
1569
|
+
describe() {
|
|
1570
|
+
return {
|
|
1571
|
+
type: n.tablet
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
/* iPod/iPhone */
|
|
1576
|
+
{
|
|
1577
|
+
test(r) {
|
|
1578
|
+
const e = r.test(/ipod|iphone/i), t = r.test(/like (ipod|iphone)/i);
|
|
1579
|
+
return e && !t;
|
|
1580
|
+
},
|
|
1581
|
+
describe(r) {
|
|
1582
|
+
const e = s.getFirstMatch(/(ipod|iphone)/i, r);
|
|
1583
|
+
return {
|
|
1584
|
+
type: n.mobile,
|
|
1585
|
+
vendor: "Apple",
|
|
1586
|
+
model: e
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
},
|
|
1590
|
+
/* Nexus Mobile */
|
|
1591
|
+
{
|
|
1592
|
+
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
|
1593
|
+
describe() {
|
|
1594
|
+
return {
|
|
1595
|
+
type: n.mobile,
|
|
1596
|
+
vendor: "Nexus"
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
/* Nokia */
|
|
1601
|
+
{
|
|
1602
|
+
test: [/Nokia/i],
|
|
1603
|
+
describe(r) {
|
|
1604
|
+
const e = s.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i, r), t = {
|
|
1605
|
+
type: n.mobile,
|
|
1606
|
+
vendor: "Nokia"
|
|
1607
|
+
};
|
|
1608
|
+
return e && (t.model = e), t;
|
|
1609
|
+
}
|
|
1610
|
+
},
|
|
1611
|
+
/* Mobile */
|
|
1612
|
+
{
|
|
1613
|
+
test: [/[^-]mobi/i],
|
|
1614
|
+
describe() {
|
|
1615
|
+
return {
|
|
1616
|
+
type: n.mobile
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
/* BlackBerry */
|
|
1621
|
+
{
|
|
1622
|
+
test(r) {
|
|
1623
|
+
return r.getBrowserName(!0) === "blackberry";
|
|
1624
|
+
},
|
|
1625
|
+
describe() {
|
|
1626
|
+
return {
|
|
1627
|
+
type: n.mobile,
|
|
1628
|
+
vendor: "BlackBerry"
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
},
|
|
1632
|
+
/* Bada */
|
|
1633
|
+
{
|
|
1634
|
+
test(r) {
|
|
1635
|
+
return r.getBrowserName(!0) === "bada";
|
|
1636
|
+
},
|
|
1637
|
+
describe() {
|
|
1638
|
+
return {
|
|
1639
|
+
type: n.mobile
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
/* Windows Phone */
|
|
1644
|
+
{
|
|
1645
|
+
test(r) {
|
|
1646
|
+
return r.getBrowserName() === "windows phone";
|
|
1647
|
+
},
|
|
1648
|
+
describe() {
|
|
1649
|
+
return {
|
|
1650
|
+
type: n.mobile,
|
|
1651
|
+
vendor: "Microsoft"
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
/* Android Tablet */
|
|
1656
|
+
{
|
|
1657
|
+
test(r) {
|
|
1658
|
+
const e = Number(String(r.getOSVersion()).split(".")[0]);
|
|
1659
|
+
return r.getOSName(!0) === "android" && e >= 3;
|
|
1660
|
+
},
|
|
1661
|
+
describe() {
|
|
1662
|
+
return {
|
|
1663
|
+
type: n.tablet
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
},
|
|
1667
|
+
/* Android Mobile */
|
|
1668
|
+
{
|
|
1669
|
+
test(r) {
|
|
1670
|
+
return r.getOSName(!0) === "android";
|
|
1671
|
+
},
|
|
1672
|
+
describe() {
|
|
1673
|
+
return {
|
|
1674
|
+
type: n.mobile
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
/* desktop */
|
|
1679
|
+
{
|
|
1680
|
+
test(r) {
|
|
1681
|
+
return r.getOSName(!0) === "macos";
|
|
1682
|
+
},
|
|
1683
|
+
describe() {
|
|
1684
|
+
return {
|
|
1685
|
+
type: n.desktop,
|
|
1686
|
+
vendor: "Apple"
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
/* Windows */
|
|
1691
|
+
{
|
|
1692
|
+
test(r) {
|
|
1693
|
+
return r.getOSName(!0) === "windows";
|
|
1694
|
+
},
|
|
1695
|
+
describe() {
|
|
1696
|
+
return {
|
|
1697
|
+
type: n.desktop
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
/* Linux */
|
|
1702
|
+
{
|
|
1703
|
+
test(r) {
|
|
1704
|
+
return r.getOSName(!0) === "linux";
|
|
1705
|
+
},
|
|
1706
|
+
describe() {
|
|
1707
|
+
return {
|
|
1708
|
+
type: n.desktop
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1712
|
+
/* PlayStation 4 */
|
|
1713
|
+
{
|
|
1714
|
+
test(r) {
|
|
1715
|
+
return r.getOSName(!0) === "playstation 4";
|
|
1716
|
+
},
|
|
1717
|
+
describe() {
|
|
1718
|
+
return {
|
|
1719
|
+
type: n.tv
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
/* Roku */
|
|
1724
|
+
{
|
|
1725
|
+
test(r) {
|
|
1726
|
+
return r.getOSName(!0) === "roku";
|
|
1727
|
+
},
|
|
1728
|
+
describe() {
|
|
1729
|
+
return {
|
|
1730
|
+
type: n.tv
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
], C = [
|
|
1735
|
+
/* EdgeHTML */
|
|
1736
|
+
{
|
|
1737
|
+
test(r) {
|
|
1738
|
+
return r.getBrowserName(!0) === "microsoft edge";
|
|
1739
|
+
},
|
|
1740
|
+
describe(r) {
|
|
1741
|
+
if (/\sedg\//i.test(r))
|
|
1742
|
+
return {
|
|
1743
|
+
name: g.Blink
|
|
1744
|
+
};
|
|
1745
|
+
const t = s.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, r);
|
|
1746
|
+
return {
|
|
1747
|
+
name: g.EdgeHTML,
|
|
1748
|
+
version: t
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
/* Trident */
|
|
1753
|
+
{
|
|
1754
|
+
test: [/trident/i],
|
|
1755
|
+
describe(r) {
|
|
1756
|
+
const e = {
|
|
1757
|
+
name: g.Trident
|
|
1758
|
+
}, t = s.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, r);
|
|
1759
|
+
return t && (e.version = t), e;
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1762
|
+
/* Presto */
|
|
1763
|
+
{
|
|
1764
|
+
test(r) {
|
|
1765
|
+
return r.test(/presto/i);
|
|
1766
|
+
},
|
|
1767
|
+
describe(r) {
|
|
1768
|
+
const e = {
|
|
1769
|
+
name: g.Presto
|
|
1770
|
+
}, t = s.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, r);
|
|
1771
|
+
return t && (e.version = t), e;
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
/* Gecko */
|
|
1775
|
+
{
|
|
1776
|
+
test(r) {
|
|
1777
|
+
const e = r.test(/gecko/i), t = r.test(/like gecko/i);
|
|
1778
|
+
return e && !t;
|
|
1779
|
+
},
|
|
1780
|
+
describe(r) {
|
|
1781
|
+
const e = {
|
|
1782
|
+
name: g.Gecko
|
|
1783
|
+
}, t = s.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, r);
|
|
1784
|
+
return t && (e.version = t), e;
|
|
1785
|
+
}
|
|
1786
|
+
},
|
|
1787
|
+
/* Blink */
|
|
1788
|
+
{
|
|
1789
|
+
test: [/(apple)?webkit\/537\.36/i],
|
|
1790
|
+
describe() {
|
|
1791
|
+
return {
|
|
1792
|
+
name: g.Blink
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
/* WebKit */
|
|
1797
|
+
{
|
|
1798
|
+
test: [/(apple)?webkit/i],
|
|
1799
|
+
describe(r) {
|
|
1800
|
+
const e = {
|
|
1801
|
+
name: g.WebKit
|
|
1802
|
+
}, t = s.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, r);
|
|
1803
|
+
return t && (e.version = t), e;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
];
|
|
1807
|
+
class f {
|
|
1808
|
+
/**
|
|
1809
|
+
* Create instance of Parser
|
|
1810
|
+
*
|
|
1811
|
+
* @param {String} UA User-Agent string
|
|
1812
|
+
* @param {Boolean} [skipParsing=false] parser can skip parsing in purpose of performance
|
|
1813
|
+
* improvements if you need to make a more particular parsing
|
|
1814
|
+
* like {@link Parser#parseBrowser} or {@link Parser#parsePlatform}
|
|
1815
|
+
*
|
|
1816
|
+
* @throw {Error} in case of empty UA String
|
|
1817
|
+
*
|
|
1818
|
+
* @constructor
|
|
1819
|
+
*/
|
|
1820
|
+
constructor(e, t = !1) {
|
|
1821
|
+
if (e == null || e === "")
|
|
1822
|
+
throw new Error("UserAgent parameter can't be empty");
|
|
1823
|
+
this._ua = e, this.parsedResult = {}, t !== !0 && this.parse();
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Get UserAgent string of current Parser instance
|
|
1827
|
+
* @return {String} User-Agent String of the current <Parser> object
|
|
1828
|
+
*
|
|
1829
|
+
* @public
|
|
1830
|
+
*/
|
|
1831
|
+
getUA() {
|
|
1832
|
+
return this._ua;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Test a UA string for a regexp
|
|
1836
|
+
* @param {RegExp} regex
|
|
1837
|
+
* @return {Boolean}
|
|
1838
|
+
*/
|
|
1839
|
+
test(e) {
|
|
1840
|
+
return e.test(this._ua);
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Get parsed browser object
|
|
1844
|
+
* @return {Object}
|
|
1845
|
+
*/
|
|
1846
|
+
parseBrowser() {
|
|
1847
|
+
this.parsedResult.browser = {};
|
|
1848
|
+
const e = s.find(_, (t) => {
|
|
1849
|
+
if (typeof t.test == "function")
|
|
1850
|
+
return t.test(this);
|
|
1851
|
+
if (Array.isArray(t.test))
|
|
1852
|
+
return t.test.some((i) => this.test(i));
|
|
1853
|
+
throw new Error("Browser's test function is not valid");
|
|
1854
|
+
});
|
|
1855
|
+
return e && (this.parsedResult.browser = e.describe(this.getUA())), this.parsedResult.browser;
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Get parsed browser object
|
|
1859
|
+
* @return {Object}
|
|
1860
|
+
*
|
|
1861
|
+
* @public
|
|
1862
|
+
*/
|
|
1863
|
+
getBrowser() {
|
|
1864
|
+
return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Get browser's name
|
|
1868
|
+
* @return {String} Browser's name or an empty string
|
|
1869
|
+
*
|
|
1870
|
+
* @public
|
|
1871
|
+
*/
|
|
1872
|
+
getBrowserName(e) {
|
|
1873
|
+
return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Get browser's version
|
|
1877
|
+
* @return {String} version of browser
|
|
1878
|
+
*
|
|
1879
|
+
* @public
|
|
1880
|
+
*/
|
|
1881
|
+
getBrowserVersion() {
|
|
1882
|
+
return this.getBrowser().version;
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* Get OS
|
|
1886
|
+
* @return {Object}
|
|
1887
|
+
*
|
|
1888
|
+
* @example
|
|
1889
|
+
* this.getOS();
|
|
1890
|
+
* {
|
|
1891
|
+
* name: 'macOS',
|
|
1892
|
+
* version: '10.11.12'
|
|
1893
|
+
* }
|
|
1894
|
+
*/
|
|
1895
|
+
getOS() {
|
|
1896
|
+
return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Parse OS and save it to this.parsedResult.os
|
|
1900
|
+
* @return {*|{}}
|
|
1901
|
+
*/
|
|
1902
|
+
parseOS() {
|
|
1903
|
+
this.parsedResult.os = {};
|
|
1904
|
+
const e = s.find(E, (t) => {
|
|
1905
|
+
if (typeof t.test == "function")
|
|
1906
|
+
return t.test(this);
|
|
1907
|
+
if (Array.isArray(t.test))
|
|
1908
|
+
return t.test.some((i) => this.test(i));
|
|
1909
|
+
throw new Error("Browser's test function is not valid");
|
|
1910
|
+
});
|
|
1911
|
+
return e && (this.parsedResult.os = e.describe(this.getUA())), this.parsedResult.os;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Get OS name
|
|
1915
|
+
* @param {Boolean} [toLowerCase] return lower-cased value
|
|
1916
|
+
* @return {String} name of the OS — macOS, Windows, Linux, etc.
|
|
1917
|
+
*/
|
|
1918
|
+
getOSName(e) {
|
|
1919
|
+
const { name: t } = this.getOS();
|
|
1920
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Get OS version
|
|
1924
|
+
* @return {String} full version with dots ('10.11.12', '5.6', etc)
|
|
1925
|
+
*/
|
|
1926
|
+
getOSVersion() {
|
|
1927
|
+
return this.getOS().version;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Get parsed platform
|
|
1931
|
+
* @return {{}}
|
|
1932
|
+
*/
|
|
1933
|
+
getPlatform() {
|
|
1934
|
+
return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* Get platform name
|
|
1938
|
+
* @param {Boolean} [toLowerCase=false]
|
|
1939
|
+
* @return {*}
|
|
1940
|
+
*/
|
|
1941
|
+
getPlatformType(e = !1) {
|
|
1942
|
+
const { type: t } = this.getPlatform();
|
|
1943
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Get parsed platform
|
|
1947
|
+
* @return {{}}
|
|
1948
|
+
*/
|
|
1949
|
+
parsePlatform() {
|
|
1950
|
+
this.parsedResult.platform = {};
|
|
1951
|
+
const e = s.find(N, (t) => {
|
|
1952
|
+
if (typeof t.test == "function")
|
|
1953
|
+
return t.test(this);
|
|
1954
|
+
if (Array.isArray(t.test))
|
|
1955
|
+
return t.test.some((i) => this.test(i));
|
|
1956
|
+
throw new Error("Browser's test function is not valid");
|
|
1957
|
+
});
|
|
1958
|
+
return e && (this.parsedResult.platform = e.describe(this.getUA())), this.parsedResult.platform;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Get parsed engine
|
|
1962
|
+
* @return {{}}
|
|
1963
|
+
*/
|
|
1964
|
+
getEngine() {
|
|
1965
|
+
return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Get engines's name
|
|
1969
|
+
* @return {String} Engines's name or an empty string
|
|
1970
|
+
*
|
|
1971
|
+
* @public
|
|
1972
|
+
*/
|
|
1973
|
+
getEngineName(e) {
|
|
1974
|
+
return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Get parsed platform
|
|
1978
|
+
* @return {{}}
|
|
1979
|
+
*/
|
|
1980
|
+
parseEngine() {
|
|
1981
|
+
this.parsedResult.engine = {};
|
|
1982
|
+
const e = s.find(C, (t) => {
|
|
1983
|
+
if (typeof t.test == "function")
|
|
1984
|
+
return t.test(this);
|
|
1985
|
+
if (Array.isArray(t.test))
|
|
1986
|
+
return t.test.some((i) => this.test(i));
|
|
1987
|
+
throw new Error("Browser's test function is not valid");
|
|
1988
|
+
});
|
|
1989
|
+
return e && (this.parsedResult.engine = e.describe(this.getUA())), this.parsedResult.engine;
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Parse full information about the browser
|
|
1993
|
+
* @returns {Parser}
|
|
1994
|
+
*/
|
|
1995
|
+
parse() {
|
|
1996
|
+
return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Get parsed result
|
|
2000
|
+
* @return {ParsedResult}
|
|
2001
|
+
*/
|
|
2002
|
+
getResult() {
|
|
2003
|
+
return s.assign({}, this.parsedResult);
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Check if parsed browser matches certain conditions
|
|
2007
|
+
*
|
|
2008
|
+
* @param {Object} checkTree It's one or two layered object,
|
|
2009
|
+
* which can include a platform or an OS on the first layer
|
|
2010
|
+
* and should have browsers specs on the bottom-laying layer
|
|
2011
|
+
*
|
|
2012
|
+
* @returns {Boolean|undefined} Whether the browser satisfies the set conditions or not.
|
|
2013
|
+
* Returns `undefined` when the browser is no described in the checkTree object.
|
|
2014
|
+
*
|
|
2015
|
+
* @example
|
|
2016
|
+
* const browser = Bowser.getParser(window.navigator.userAgent);
|
|
2017
|
+
* if (browser.satisfies({chrome: '>118.01.1322' }))
|
|
2018
|
+
* // or with os
|
|
2019
|
+
* if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
|
|
2020
|
+
* // or with platforms
|
|
2021
|
+
* if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
|
|
2022
|
+
*/
|
|
2023
|
+
satisfies(e) {
|
|
2024
|
+
const t = {};
|
|
2025
|
+
let i = 0;
|
|
2026
|
+
const a = {};
|
|
2027
|
+
let c = 0;
|
|
2028
|
+
if (Object.keys(e).forEach((l) => {
|
|
2029
|
+
const d = e[l];
|
|
2030
|
+
typeof d == "string" ? (a[l] = d, c += 1) : typeof d == "object" && (t[l] = d, i += 1);
|
|
2031
|
+
}), i > 0) {
|
|
2032
|
+
const l = Object.keys(t), d = s.find(l, (h) => this.isOS(h));
|
|
2033
|
+
if (d) {
|
|
2034
|
+
const h = this.satisfies(t[d]);
|
|
2035
|
+
if (h !== void 0)
|
|
2036
|
+
return h;
|
|
2037
|
+
}
|
|
2038
|
+
const m = s.find(
|
|
2039
|
+
l,
|
|
2040
|
+
(h) => this.isPlatform(h)
|
|
2041
|
+
);
|
|
2042
|
+
if (m) {
|
|
2043
|
+
const h = this.satisfies(t[m]);
|
|
2044
|
+
if (h !== void 0)
|
|
2045
|
+
return h;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
if (c > 0) {
|
|
2049
|
+
const l = Object.keys(a), d = s.find(l, (m) => this.isBrowser(m, !0));
|
|
2050
|
+
if (d !== void 0)
|
|
2051
|
+
return this.compareVersion(a[d]);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* Check if the browser name equals the passed string
|
|
2056
|
+
* @param {string} browserName The string to compare with the browser name
|
|
2057
|
+
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2058
|
+
* @returns {boolean}
|
|
2059
|
+
*/
|
|
2060
|
+
isBrowser(e, t = !1) {
|
|
2061
|
+
const i = this.getBrowserName().toLowerCase();
|
|
2062
|
+
let a = e.toLowerCase();
|
|
2063
|
+
const c = s.getBrowserTypeByAlias(a);
|
|
2064
|
+
return t && c && (a = c.toLowerCase()), a === i;
|
|
2065
|
+
}
|
|
2066
|
+
compareVersion(e) {
|
|
2067
|
+
let t = [0], i = e, a = !1;
|
|
2068
|
+
const c = this.getBrowserVersion();
|
|
2069
|
+
if (typeof c == "string")
|
|
2070
|
+
return e[0] === ">" || e[0] === "<" ? (i = e.substr(1), e[1] === "=" ? (a = !0, i = e.substr(2)) : t = [], e[0] === ">" ? t.push(1) : t.push(-1)) : e[0] === "=" ? i = e.substr(1) : e[0] === "~" && (a = !0, i = e.substr(1)), t.indexOf(
|
|
2071
|
+
s.compareVersions(c, i, a)
|
|
2072
|
+
) > -1;
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* Check if the OS name equals the passed string
|
|
2076
|
+
* @param {string} osName The string to compare with the OS name
|
|
2077
|
+
* @returns {boolean}
|
|
2078
|
+
*/
|
|
2079
|
+
isOS(e) {
|
|
2080
|
+
return this.getOSName(!0) === String(e).toLowerCase();
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Check if the platform type equals the passed string
|
|
2084
|
+
* @param {string} platformType The string to compare with the platform type
|
|
2085
|
+
* @returns {boolean}
|
|
2086
|
+
*/
|
|
2087
|
+
isPlatform(e) {
|
|
2088
|
+
return this.getPlatformType(!0) === String(e).toLowerCase();
|
|
2089
|
+
}
|
|
2090
|
+
/**
|
|
2091
|
+
* Check if the engine name equals the passed string
|
|
2092
|
+
* @param {string} engineName The string to compare with the engine name
|
|
2093
|
+
* @returns {boolean}
|
|
2094
|
+
*/
|
|
2095
|
+
isEngine(e) {
|
|
2096
|
+
return this.getEngineName(!0) === String(e).toLowerCase();
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Is anything? Check if the browser is called "anything",
|
|
2100
|
+
* the OS called "anything" or the platform called "anything"
|
|
2101
|
+
* @param {String} anything
|
|
2102
|
+
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2103
|
+
* @returns {Boolean}
|
|
2104
|
+
*/
|
|
2105
|
+
is(e, t = !1) {
|
|
2106
|
+
return this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Check if any of the given values satisfies this.is(anything)
|
|
2110
|
+
* @param {String[]} anythings
|
|
2111
|
+
* @returns {Boolean}
|
|
2112
|
+
*/
|
|
2113
|
+
some(e = []) {
|
|
2114
|
+
return e.some((t) => this.is(t));
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
/*!
|
|
2118
|
+
* Bowser - a browser detector
|
|
2119
|
+
* https://github.com/lancedikson/bowser
|
|
2120
|
+
* MIT License | (c) Dustin Diaz 2012-2015
|
|
2121
|
+
* MIT License | (c) Denis Demchenko 2015-2019
|
|
2122
|
+
*/
|
|
2123
|
+
class R {
|
|
2124
|
+
/**
|
|
2125
|
+
* Creates a {@link Parser} instance
|
|
2126
|
+
*
|
|
2127
|
+
* @param {String} UA UserAgent string
|
|
2128
|
+
* @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it
|
|
2129
|
+
* explicitly. Same as `skipParsing` for {@link Parser}.
|
|
2130
|
+
* @returns {Parser}
|
|
2131
|
+
* @throws {Error} when UA is not a String
|
|
2132
|
+
*
|
|
2133
|
+
* @example
|
|
2134
|
+
* const parser = Bowser.getParser(window.navigator.userAgent);
|
|
2135
|
+
* const result = parser.getResult();
|
|
2136
|
+
*/
|
|
2137
|
+
static getParser(e, t = !1) {
|
|
2138
|
+
if (typeof e != "string")
|
|
2139
|
+
throw new Error("UserAgent should be a string");
|
|
2140
|
+
return new f(e, t);
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately
|
|
2144
|
+
*
|
|
2145
|
+
* @param UA
|
|
2146
|
+
* @return {ParsedResult}
|
|
2147
|
+
*
|
|
2148
|
+
* @example
|
|
2149
|
+
* const result = Bowser.parse(window.navigator.userAgent);
|
|
2150
|
+
*/
|
|
2151
|
+
static parse(e) {
|
|
2152
|
+
return new f(e).getResult();
|
|
2153
|
+
}
|
|
2154
|
+
static get BROWSER_MAP() {
|
|
2155
|
+
return w;
|
|
2156
|
+
}
|
|
2157
|
+
static get ENGINE_MAP() {
|
|
2158
|
+
return g;
|
|
2159
|
+
}
|
|
2160
|
+
static get OS_MAP() {
|
|
2161
|
+
return b;
|
|
2162
|
+
}
|
|
2163
|
+
static get PLATFORMS_MAP() {
|
|
2164
|
+
return n;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
const G = ({
|
|
2168
|
+
className: r,
|
|
2169
|
+
...e
|
|
2170
|
+
}) => {
|
|
2171
|
+
const { t } = P();
|
|
2172
|
+
return S(
|
|
2173
|
+
() => R.getParser(navigator.userAgent).satisfies(x),
|
|
2174
|
+
[]
|
|
2175
|
+
) ? null : /* @__PURE__ */ M(
|
|
2176
|
+
B,
|
|
2177
|
+
{
|
|
2178
|
+
...e,
|
|
2179
|
+
variant: "warning",
|
|
2180
|
+
title: t("Limited browser support detected"),
|
|
2181
|
+
dismissible: !0,
|
|
2182
|
+
className: F("gi-min-w-full", r),
|
|
2183
|
+
children: [
|
|
2184
|
+
t(
|
|
2185
|
+
"This browser is not officially supported. Please update or switch to a supported browser for the best experience."
|
|
2186
|
+
),
|
|
2187
|
+
/* @__PURE__ */ y(
|
|
2188
|
+
A,
|
|
2189
|
+
{
|
|
2190
|
+
href: `${k}/get-started/developers/supported-browsers/`,
|
|
2191
|
+
target: "_blank",
|
|
2192
|
+
rel: "noreferrer",
|
|
2193
|
+
children: t("View supported browsers")
|
|
2194
|
+
}
|
|
2195
|
+
)
|
|
2196
|
+
]
|
|
2197
|
+
}
|
|
2198
|
+
);
|
|
2199
|
+
};
|
|
2200
|
+
export {
|
|
2201
|
+
G as BrowserSupport
|
|
2202
|
+
};
|