hina-cloud-js-sdk 3.1.6 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/.gitlab-ci.yml +2 -6
  2. package/build/hina.cjs.min.js +1 -0
  3. package/build/hina.esm.min.js +1 -0
  4. package/build/hina.min.js +1 -4
  5. package/build/hotAnalyse.min.js +1 -1
  6. package/package.json +2 -7
  7. package/packages/core/dist/index.cjs.js +64 -0
  8. package/packages/core/dist/index.cjs.js.map +1 -0
  9. package/packages/core/dist/index.d.ts +45 -0
  10. package/packages/core/dist/index.esm.js +62 -0
  11. package/packages/core/dist/index.esm.js.map +1 -0
  12. package/packages/core/dist/index.global.js +1199 -0
  13. package/packages/core/dist/index.global.js.map +1 -0
  14. package/packages/core/dist/index.js +1200 -0
  15. package/packages/core/dist/index.js.map +1 -0
  16. package/packages/monitor/dist/index.cjs.js +150 -0
  17. package/packages/monitor/dist/index.cjs.js.map +1 -0
  18. package/packages/monitor/dist/index.d.ts +35 -0
  19. package/packages/monitor/dist/index.esm.js +145 -0
  20. package/packages/monitor/dist/index.esm.js.map +1 -0
  21. package/packages/monitor/dist/index.global.js +1343 -0
  22. package/packages/monitor/dist/index.global.js.map +1 -0
  23. package/packages/monitor/dist/index.js +1344 -0
  24. package/packages/monitor/dist/index.js.map +1 -0
  25. package/packages/track/dist/index.cjs.js +1930 -0
  26. package/packages/track/dist/index.cjs.js.map +1 -0
  27. package/packages/track/dist/index.d.ts +212 -0
  28. package/packages/track/dist/index.esm.js +1925 -0
  29. package/packages/track/dist/index.esm.js.map +1 -0
  30. package/packages/track/dist/index.global.js +4259 -0
  31. package/packages/track/dist/index.global.js.map +1 -0
  32. package/packages/track/dist/index.js +4260 -0
  33. package/packages/track/dist/index.js.map +1 -0
  34. package/packages/types/dist/index.d.ts +603 -0
  35. package/packages/types/dist/index.esm.js +25 -0
  36. package/packages/types/dist/index.esm.js.map +1 -0
  37. package/packages/utils/dist/index.cjs.js +1535 -0
  38. package/packages/utils/dist/index.cjs.js.map +1 -0
  39. package/packages/utils/dist/index.d.ts +394 -0
  40. package/packages/utils/dist/index.esm.js +1465 -0
  41. package/packages/utils/dist/index.esm.js.map +1 -0
  42. package/packages/utils/dist/index.global.js +2507 -0
  43. package/packages/utils/dist/index.global.js.map +1 -0
  44. package/packages/utils/dist/index.js +2508 -0
  45. package/packages/utils/dist/index.js.map +1 -0
@@ -0,0 +1,1200 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.HinaCloudCore = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ var ConsoleTypes;
8
+ (function (ConsoleTypes) {
9
+ ConsoleTypes["LOG"] = "log";
10
+ ConsoleTypes["INFO"] = "info";
11
+ ConsoleTypes["WARN"] = "warn";
12
+ ConsoleTypes["ERROR"] = "error";
13
+ ConsoleTypes["ASSERT"] = "assert";
14
+ })(ConsoleTypes || (ConsoleTypes = {}));
15
+ var ReportType;
16
+ (function (ReportType) {
17
+ ReportType["BEACON"] = "beacon";
18
+ ReportType["IMAGE"] = "image";
19
+ ReportType["AJAX"] = "ajax";
20
+ })(ReportType || (ReportType = {}));
21
+
22
+ /******************************************************************************
23
+ Copyright (c) Microsoft Corporation.
24
+
25
+ Permission to use, copy, modify, and/or distribute this software for any
26
+ purpose with or without fee is hereby granted.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
29
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
30
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
31
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
32
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
33
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34
+ PERFORMANCE OF THIS SOFTWARE.
35
+ ***************************************************************************** */
36
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
37
+
38
+ var extendStatics = function(d, b) {
39
+ extendStatics = Object.setPrototypeOf ||
40
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
42
+ return extendStatics(d, b);
43
+ };
44
+
45
+ function __extends(d, b) {
46
+ if (typeof b !== "function" && b !== null)
47
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
48
+ extendStatics(d, b);
49
+ function __() { this.constructor = d; }
50
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
51
+ }
52
+
53
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
54
+ var e = new Error(message);
55
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
56
+ };
57
+
58
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
59
+
60
+ var uaParser = {exports: {}};
61
+
62
+ (function (module, exports) {
63
+ /////////////////////////////////////////////////////////////////////////////////
64
+ /* UAParser.js v1.0.38
65
+ Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
66
+ MIT License *//*
67
+ Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
68
+ Supports browser & node.js environment.
69
+ Demo : https://faisalman.github.io/ua-parser-js
70
+ Source : https://github.com/faisalman/ua-parser-js */
71
+ /////////////////////////////////////////////////////////////////////////////////
72
+
73
+ (function (window, undefined$1) {
74
+
75
+ //////////////
76
+ // Constants
77
+ /////////////
78
+
79
+
80
+ var LIBVERSION = '1.0.38',
81
+ EMPTY = '',
82
+ UNKNOWN = '?',
83
+ FUNC_TYPE = 'function',
84
+ UNDEF_TYPE = 'undefined',
85
+ OBJ_TYPE = 'object',
86
+ STR_TYPE = 'string',
87
+ MAJOR = 'major',
88
+ MODEL = 'model',
89
+ NAME = 'name',
90
+ TYPE = 'type',
91
+ VENDOR = 'vendor',
92
+ VERSION = 'version',
93
+ ARCHITECTURE= 'architecture',
94
+ CONSOLE = 'console',
95
+ MOBILE = 'mobile',
96
+ TABLET = 'tablet',
97
+ SMARTTV = 'smarttv',
98
+ WEARABLE = 'wearable',
99
+ EMBEDDED = 'embedded',
100
+ UA_MAX_LENGTH = 500;
101
+
102
+ var AMAZON = 'Amazon',
103
+ APPLE = 'Apple',
104
+ ASUS = 'ASUS',
105
+ BLACKBERRY = 'BlackBerry',
106
+ BROWSER = 'Browser',
107
+ CHROME = 'Chrome',
108
+ EDGE = 'Edge',
109
+ FIREFOX = 'Firefox',
110
+ GOOGLE = 'Google',
111
+ HUAWEI = 'Huawei',
112
+ LG = 'LG',
113
+ MICROSOFT = 'Microsoft',
114
+ MOTOROLA = 'Motorola',
115
+ OPERA = 'Opera',
116
+ SAMSUNG = 'Samsung',
117
+ SHARP = 'Sharp',
118
+ SONY = 'Sony',
119
+ XIAOMI = 'Xiaomi',
120
+ ZEBRA = 'Zebra',
121
+ FACEBOOK = 'Facebook',
122
+ CHROMIUM_OS = 'Chromium OS',
123
+ MAC_OS = 'Mac OS';
124
+
125
+ ///////////
126
+ // Helper
127
+ //////////
128
+
129
+ var extend = function (regexes, extensions) {
130
+ var mergedRegexes = {};
131
+ for (var i in regexes) {
132
+ if (extensions[i] && extensions[i].length % 2 === 0) {
133
+ mergedRegexes[i] = extensions[i].concat(regexes[i]);
134
+ } else {
135
+ mergedRegexes[i] = regexes[i];
136
+ }
137
+ }
138
+ return mergedRegexes;
139
+ },
140
+ enumerize = function (arr) {
141
+ var enums = {};
142
+ for (var i=0; i<arr.length; i++) {
143
+ enums[arr[i].toUpperCase()] = arr[i];
144
+ }
145
+ return enums;
146
+ },
147
+ has = function (str1, str2) {
148
+ return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;
149
+ },
150
+ lowerize = function (str) {
151
+ return str.toLowerCase();
152
+ },
153
+ majorize = function (version) {
154
+ return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split('.')[0] : undefined$1;
155
+ },
156
+ trim = function (str, len) {
157
+ if (typeof(str) === STR_TYPE) {
158
+ str = str.replace(/^\s\s*/, EMPTY);
159
+ return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
160
+ }
161
+ };
162
+
163
+ ///////////////
164
+ // Map helper
165
+ //////////////
166
+
167
+ var rgxMapper = function (ua, arrays) {
168
+
169
+ var i = 0, j, k, p, q, matches, match;
170
+
171
+ // loop through all regexes maps
172
+ while (i < arrays.length && !matches) {
173
+
174
+ var regex = arrays[i], // even sequence (0,2,4,..)
175
+ props = arrays[i + 1]; // odd sequence (1,3,5,..)
176
+ j = k = 0;
177
+
178
+ // try matching uastring with regexes
179
+ while (j < regex.length && !matches) {
180
+
181
+ if (!regex[j]) { break; }
182
+ matches = regex[j++].exec(ua);
183
+
184
+ if (!!matches) {
185
+ for (p = 0; p < props.length; p++) {
186
+ match = matches[++k];
187
+ q = props[p];
188
+ // check if given property is actually array
189
+ if (typeof q === OBJ_TYPE && q.length > 0) {
190
+ if (q.length === 2) {
191
+ if (typeof q[1] == FUNC_TYPE) {
192
+ // assign modified match
193
+ this[q[0]] = q[1].call(this, match);
194
+ } else {
195
+ // assign given value, ignore regex match
196
+ this[q[0]] = q[1];
197
+ }
198
+ } else if (q.length === 3) {
199
+ // check whether function or regex
200
+ if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
201
+ // call function (usually string mapper)
202
+ this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined$1;
203
+ } else {
204
+ // sanitize match using given regex
205
+ this[q[0]] = match ? match.replace(q[1], q[2]) : undefined$1;
206
+ }
207
+ } else if (q.length === 4) {
208
+ this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined$1;
209
+ }
210
+ } else {
211
+ this[q] = match ? match : undefined$1;
212
+ }
213
+ }
214
+ }
215
+ }
216
+ i += 2;
217
+ }
218
+ },
219
+
220
+ strMapper = function (str, map) {
221
+
222
+ for (var i in map) {
223
+ // check if current value is array
224
+ if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
225
+ for (var j = 0; j < map[i].length; j++) {
226
+ if (has(map[i][j], str)) {
227
+ return (i === UNKNOWN) ? undefined$1 : i;
228
+ }
229
+ }
230
+ } else if (has(map[i], str)) {
231
+ return (i === UNKNOWN) ? undefined$1 : i;
232
+ }
233
+ }
234
+ return str;
235
+ };
236
+
237
+ ///////////////
238
+ // String map
239
+ //////////////
240
+
241
+ // Safari < 3.0
242
+ var oldSafariMap = {
243
+ '1.0' : '/8',
244
+ '1.2' : '/1',
245
+ '1.3' : '/3',
246
+ '2.0' : '/412',
247
+ '2.0.2' : '/416',
248
+ '2.0.3' : '/417',
249
+ '2.0.4' : '/419',
250
+ '?' : '/'
251
+ },
252
+ windowsVersionMap = {
253
+ 'ME' : '4.90',
254
+ 'NT 3.11' : 'NT3.51',
255
+ 'NT 4.0' : 'NT4.0',
256
+ '2000' : 'NT 5.0',
257
+ 'XP' : ['NT 5.1', 'NT 5.2'],
258
+ 'Vista' : 'NT 6.0',
259
+ '7' : 'NT 6.1',
260
+ '8' : 'NT 6.2',
261
+ '8.1' : 'NT 6.3',
262
+ '10' : ['NT 6.4', 'NT 10.0'],
263
+ 'RT' : 'ARM'
264
+ };
265
+
266
+ //////////////
267
+ // Regex map
268
+ /////////////
269
+
270
+ var regexes = {
271
+
272
+ browser : [[
273
+
274
+ /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
275
+ ], [VERSION, [NAME, 'Chrome']], [
276
+ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge
277
+ ], [VERSION, [NAME, 'Edge']], [
278
+
279
+ // Presto based
280
+ /(opera mini)\/([-\w\.]+)/i, // Opera Mini
281
+ /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet
282
+ /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera
283
+ ], [NAME, VERSION], [
284
+ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0
285
+ ], [VERSION, [NAME, OPERA+' Mini']], [
286
+ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX
287
+ ], [VERSION, [NAME, OPERA+' GX']], [
288
+ /\bopr\/([\w\.]+)/i // Opera Webkit
289
+ ], [VERSION, [NAME, OPERA]], [
290
+
291
+ // Mixed
292
+ /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
293
+ ], [VERSION, [NAME, 'Baidu']], [
294
+ /(kindle)\/([\w\.]+)/i, // Kindle
295
+ /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer
296
+ // Trident based
297
+ /(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser
298
+ /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
299
+
300
+ // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
301
+ /(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
302
+ // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
303
+ /(heytap|ovi)browser\/([\d\.]+)/i, // Heytap/Ovi
304
+ /(weibo)__([\d\.]+)/i // Weibo
305
+ ], [NAME, VERSION], [
306
+ /\bddg\/([\w\.]+)/i // DuckDuckGo
307
+ ], [VERSION, [NAME, 'DuckDuckGo']], [
308
+ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
309
+ ], [VERSION, [NAME, 'UC'+BROWSER]], [
310
+ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser
311
+ /\bqbcore\/([\w\.]+).+microm/i,
312
+ /micromessenger\/([\w\.]+)/i // WeChat
313
+ ], [VERSION, [NAME, 'WeChat']], [
314
+ /konqueror\/([\w\.]+)/i // Konqueror
315
+ ], [VERSION, [NAME, 'Konqueror']], [
316
+ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
317
+ ], [VERSION, [NAME, 'IE']], [
318
+ /ya(?:search)?browser\/([\w\.]+)/i // Yandex
319
+ ], [VERSION, [NAME, 'Yandex']], [
320
+ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser
321
+ ], [VERSION, [NAME, 'Smart Lenovo '+BROWSER]], [
322
+ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
323
+ ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [
324
+ /\bfocus\/([\w\.]+)/i // Firefox Focus
325
+ ], [VERSION, [NAME, FIREFOX+' Focus']], [
326
+ /\bopt\/([\w\.]+)/i // Opera Touch
327
+ ], [VERSION, [NAME, OPERA+' Touch']], [
328
+ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
329
+ ], [VERSION, [NAME, 'Coc Coc']], [
330
+ /dolfin\/([\w\.]+)/i // Dolphin
331
+ ], [VERSION, [NAME, 'Dolphin']], [
332
+ /coast\/([\w\.]+)/i // Opera Coast
333
+ ], [VERSION, [NAME, OPERA+' Coast']], [
334
+ /miuibrowser\/([\w\.]+)/i // MIUI Browser
335
+ ], [VERSION, [NAME, 'MIUI '+BROWSER]], [
336
+ /fxios\/([-\w\.]+)/i // Firefox for iOS
337
+ ], [VERSION, [NAME, FIREFOX]], [
338
+ /\bqihu|(qi?ho?o?|360)browser/i // 360
339
+ ], [[NAME, '360 ' + BROWSER]], [
340
+ /(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i
341
+ ], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser
342
+ /samsungbrowser\/([\w\.]+)/i // Samsung Internet
343
+ ], [VERSION, [NAME, SAMSUNG + ' Internet']], [
344
+ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
345
+ ], [[NAME, /_/g, ' '], VERSION], [
346
+ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
347
+ ], [VERSION, [NAME, 'Sogou Explorer']], [
348
+ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
349
+ ], [[NAME, 'Sogou Mobile'], VERSION], [
350
+ /(electron)\/([\w\.]+) safari/i, // Electron-based App
351
+ /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
352
+ /m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/2345 Browser
353
+ ], [NAME, VERSION], [
354
+ /(lbbrowser)/i, // LieBao Browser
355
+ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android
356
+ ], [NAME], [
357
+
358
+ // WebView
359
+ /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
360
+ ], [[NAME, FACEBOOK], VERSION], [
361
+ /(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
362
+ /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
363
+ /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
364
+ /safari (line)\/([\w\.]+)/i, // Line App for iOS
365
+ /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
366
+ /(alipay)client\/([\w\.]+)/i, // Alipay
367
+ /(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
368
+ /(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat
369
+ ], [NAME, VERSION], [
370
+ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
371
+ ], [VERSION, [NAME, 'GSA']], [
372
+ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
373
+ ], [VERSION, [NAME, 'TikTok']], [
374
+
375
+ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
376
+ ], [VERSION, [NAME, CHROME+' Headless']], [
377
+
378
+ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
379
+ ], [[NAME, CHROME+' WebView'], VERSION], [
380
+
381
+ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
382
+ ], [VERSION, [NAME, 'Android '+BROWSER]], [
383
+
384
+ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
385
+ ], [NAME, VERSION], [
386
+
387
+ /version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari
388
+ ], [VERSION, [NAME, 'Mobile Safari']], [
389
+ /version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile
390
+ ], [VERSION, NAME], [
391
+ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
392
+ ], [NAME, [VERSION, strMapper, oldSafariMap]], [
393
+
394
+ /(webkit|khtml)\/([\w\.]+)/i
395
+ ], [NAME, VERSION], [
396
+
397
+ // Gecko based
398
+ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
399
+ ], [[NAME, 'Netscape'], VERSION], [
400
+ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
401
+ ], [VERSION, [NAME, FIREFOX+' Reality']], [
402
+ /ekiohf.+(flow)\/([\w\.]+)/i, // Flow
403
+ /(swiftfox)/i, // Swiftfox
404
+ /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,
405
+ // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar
406
+ /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
407
+ // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
408
+ /(firefox)\/([\w\.]+)/i, // Other Firefox-based
409
+ /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla
410
+
411
+ // Other
412
+ /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
413
+ // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
414
+ /(links) \(([\w\.]+)/i, // Links
415
+ /panasonic;(viera)/i // Panasonic Viera
416
+ ], [NAME, VERSION], [
417
+
418
+ /(cobalt)\/([\w\.]+)/i // Cobalt
419
+ ], [NAME, [VERSION, /master.|lts./, ""]]
420
+ ],
421
+
422
+ cpu : [[
423
+
424
+ /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i // AMD64 (x64)
425
+ ], [[ARCHITECTURE, 'amd64']], [
426
+
427
+ /(ia32(?=;))/i // IA32 (quicktime)
428
+ ], [[ARCHITECTURE, lowerize]], [
429
+
430
+ /((?:i[346]|x)86)[;\)]/i // IA32 (x86)
431
+ ], [[ARCHITECTURE, 'ia32']], [
432
+
433
+ /\b(aarch64|arm(v?8e?l?|_?64))\b/i // ARM64
434
+ ], [[ARCHITECTURE, 'arm64']], [
435
+
436
+ /\b(arm(?:v[67])?ht?n?[fl]p?)\b/i // ARMHF
437
+ ], [[ARCHITECTURE, 'armhf']], [
438
+
439
+ // PocketPC mistakenly identified as PowerPC
440
+ /windows (ce|mobile); ppc;/i
441
+ ], [[ARCHITECTURE, 'arm']], [
442
+
443
+ /((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i // PowerPC
444
+ ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [
445
+
446
+ /(sun4\w)[;\)]/i // SPARC
447
+ ], [[ARCHITECTURE, 'sparc']], [
448
+
449
+ /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i
450
+ // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
451
+ ], [[ARCHITECTURE, lowerize]]
452
+ ],
453
+
454
+ device : [[
455
+
456
+ //////////////////////////
457
+ // MOBILES & TABLETS
458
+ /////////////////////////
459
+
460
+ // Samsung
461
+ /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
462
+ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
463
+ /\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
464
+ /samsung[- ]([-\w]+)/i,
465
+ /sec-(sgh\w+)/i
466
+ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
467
+
468
+ // Apple
469
+ /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone
470
+ ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
471
+ /\((ipad);[-\w\),; ]+apple/i, // iPad
472
+ /applecoremedia\/[\w\.]+ \((ipad)/i,
473
+ /\b(ipad)\d\d?,\d\d?[;\]].+ios/i
474
+ ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
475
+ /(macintosh);/i
476
+ ], [MODEL, [VENDOR, APPLE]], [
477
+
478
+ // Sharp
479
+ /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
480
+ ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
481
+
482
+ // Huawei
483
+ /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
484
+ ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
485
+ /(?:huawei|honor)([-\w ]+)[;\)]/i,
486
+ /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
487
+ ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
488
+
489
+ // Xiaomi
490
+ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO
491
+ /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
492
+ /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
493
+ /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
494
+ /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
495
+ /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
496
+ ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
497
+ /oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, // Redmi Pad
498
+ /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
499
+ ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
500
+
501
+ // OPPO
502
+ /; (\w+) bui.+ oppo/i,
503
+ /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
504
+ ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [
505
+ /\b(opd2\d{3}a?) bui/i
506
+ ], [MODEL, [VENDOR, 'OPPO'], [TYPE, TABLET]], [
507
+
508
+ // Vivo
509
+ /vivo (\w+)(?: bui|\))/i,
510
+ /\b(v[12]\d{3}\w?[at])(?: bui|;)/i
511
+ ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [
512
+
513
+ // Realme
514
+ /\b(rmx[1-3]\d{3})(?: bui|;|\))/i
515
+ ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [
516
+
517
+ // Motorola
518
+ /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
519
+ /\bmot(?:orola)?[- ](\w*)/i,
520
+ /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
521
+ ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
522
+ /\b(mz60\d|xoom[2 ]{0,2}) build\//i
523
+ ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
524
+
525
+ // LG
526
+ /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
527
+ ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
528
+ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
529
+ /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,
530
+ /\blg-?([\d\w]+) bui/i
531
+ ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [
532
+
533
+ // Lenovo
534
+ /(ideatab[-\w ]+)/i,
535
+ /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i
536
+ ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [
537
+
538
+ // Nokia
539
+ /(?:maemo|nokia).*(n900|lumia \d+)/i,
540
+ /nokia[-_ ]?([-\w\.]*)/i
541
+ ], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [
542
+
543
+ // Google
544
+ /(pixel c)\b/i // Google Pixel C
545
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
546
+ /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
547
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
548
+
549
+ // Sony
550
+ /droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
551
+ ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
552
+ /sony tablet [ps]/i,
553
+ /\b(?:sony)?sgp\w+(?: bui|\))/i
554
+ ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
555
+
556
+ // OnePlus
557
+ / (kb2005|in20[12]5|be20[12][59])\b/i,
558
+ /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
559
+ ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [
560
+
561
+ // Amazon
562
+ /(alexa)webm/i,
563
+ /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i, // Kindle Fire without Silk / Echo Show
564
+ /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
565
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
566
+ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
567
+ ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [
568
+
569
+ // BlackBerry
570
+ /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook
571
+ ], [MODEL, VENDOR, [TYPE, TABLET]], [
572
+ /\b((?:bb[a-f]|st[hv])100-\d)/i,
573
+ /\(bb10; (\w+)/i // BlackBerry 10
574
+ ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [
575
+
576
+ // Asus
577
+ /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
578
+ ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
579
+ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
580
+ ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [
581
+
582
+ // HTC
583
+ /(nexus 9)/i // HTC Nexus 9
584
+ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
585
+ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC
586
+
587
+ // ZTE
588
+ /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
589
+ /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
590
+ ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
591
+
592
+ // Acer
593
+ /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
594
+ ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
595
+
596
+ // Meizu
597
+ /droid.+; (m[1-5] note) bui/i,
598
+ /\bmz-([-\w]{2,})/i
599
+ ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
600
+
601
+ // Ulefone
602
+ /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
603
+ ], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [
604
+
605
+ // MIXED
606
+ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,
607
+ // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
608
+ /(hp) ([\w ]+\w)/i, // HP iPAQ
609
+ /(asus)-?(\w+)/i, // Asus
610
+ /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
611
+ /(lenovo)[-_ ]?([-\w]+)/i, // Lenovo
612
+ /(jolla)/i, // Jolla
613
+ /(oppo) ?([\w ]+) bui/i // OPPO
614
+ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
615
+
616
+ /(kobo)\s(ereader|touch)/i, // Kobo
617
+ /(archos) (gamepad2?)/i, // Archos
618
+ /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
619
+ /(kindle)\/([\w\.]+)/i, // Kindle
620
+ /(nook)[\w ]+build\/(\w+)/i, // Nook
621
+ /(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
622
+ /(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
623
+ /(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
624
+ /(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
625
+ /(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
626
+ ], [VENDOR, MODEL, [TYPE, TABLET]], [
627
+
628
+ /(surface duo)/i // Surface Duo
629
+ ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
630
+ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone
631
+ ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
632
+ /(u304aa)/i // AT&T
633
+ ], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
634
+ /\bsie-(\w*)/i // Siemens
635
+ ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
636
+ /\b(rct\w+) b/i // RCA Tablets
637
+ ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
638
+ /\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
639
+ ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
640
+ /\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
641
+ ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
642
+ /\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
643
+ ], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
644
+ /\b(tm\d{3}\w+) b/i
645
+ ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
646
+ /\b(k88) b/i // ZTE K Series Tablet
647
+ ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
648
+ /\b(nx\d{3}j) b/i // ZTE Nubia
649
+ ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
650
+ /\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
651
+ ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
652
+ /\b(zur\d{3}) b/i // Swiss ZUR Tablet
653
+ ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
654
+ /\b((zeki)?tb.*\b) b/i // Zeki Tablets
655
+ ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
656
+ /\b([yr]\d{2}) b/i,
657
+ /\b(dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
658
+ ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [
659
+ /\b(ns-?\w{0,9}) b/i // Insignia Tablets
660
+ ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
661
+ /\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
662
+ ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
663
+ /\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
664
+ ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
665
+ /\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
666
+ ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
667
+ /\b(ph-1) /i // Essential PH-1
668
+ ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
669
+ /\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
670
+ ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
671
+ /\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
672
+ ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
673
+ /\btu_(1491) b/i // Rotor Tablets
674
+ ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [
675
+ /(shield[\w ]+) b/i // Nvidia Shield Tablets
676
+ ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [
677
+ /(sprint) (\w+)/i // Sprint Phones
678
+ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
679
+ /(kin\.[onetw]{3})/i // Microsoft Kin
680
+ ], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
681
+ /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra
682
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
683
+ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
684
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [
685
+
686
+ ///////////////////
687
+ // SMARTTVS
688
+ ///////////////////
689
+
690
+ /smart-tv.+(samsung)/i // Samsung
691
+ ], [VENDOR, [TYPE, SMARTTV]], [
692
+ /hbbtv.+maple;(\d+)/i
693
+ ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
694
+ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i // LG SmartTV
695
+ ], [[VENDOR, LG], [TYPE, SMARTTV]], [
696
+ /(apple) ?tv/i // Apple TV
697
+ ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
698
+ /crkey/i // Google Chromecast
699
+ ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
700
+ /droid.+aft(\w+)( bui|\))/i // Fire TV
701
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
702
+ /\(dtv[\);].+(aquos)/i,
703
+ /(aquos-tv[\w ]+)\)/i // Sharp
704
+ ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
705
+ /(bravia[\w ]+)( bui|\))/i // Sony
706
+ ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
707
+ /(mitv-\w{5}) bui/i // Xiaomi
708
+ ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
709
+ /Hbbtv.*(technisat) (.*);/i // TechniSAT
710
+ ], [VENDOR, MODEL, [TYPE, SMARTTV]], [
711
+ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
712
+ /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices
713
+ ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
714
+ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors
715
+ ], [[TYPE, SMARTTV]], [
716
+
717
+ ///////////////////
718
+ // CONSOLES
719
+ ///////////////////
720
+
721
+ /(ouya)/i, // Ouya
722
+ /(nintendo) ([wids3utch]+)/i // Nintendo
723
+ ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
724
+ /droid.+; (shield) bui/i // Nvidia
725
+ ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [
726
+ /(playstation [345portablevi]+)/i // Playstation
727
+ ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
728
+ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox
729
+ ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [
730
+
731
+ ///////////////////
732
+ // WEARABLES
733
+ ///////////////////
734
+
735
+ /((pebble))app/i // Pebble
736
+ ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
737
+ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
738
+ ], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
739
+ /droid.+; (glass) \d/i // Google Glass
740
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
741
+ /droid.+; (wt63?0{2,3})\)/i
742
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
743
+ /(quest( \d| pro)?)/i // Oculus Quest
744
+ ], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [
745
+
746
+ ///////////////////
747
+ // EMBEDDED
748
+ ///////////////////
749
+
750
+ /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
751
+ ], [VENDOR, [TYPE, EMBEDDED]], [
752
+ /(aeobc)\b/i // Echo Dot
753
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
754
+
755
+ ////////////////////
756
+ // MIXED (GENERIC)
757
+ ///////////////////
758
+
759
+ /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
760
+ ], [MODEL, [TYPE, MOBILE]], [
761
+ /droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
762
+ ], [MODEL, [TYPE, TABLET]], [
763
+ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
764
+ ], [[TYPE, TABLET]], [
765
+ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
766
+ ], [[TYPE, MOBILE]], [
767
+ /(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
768
+ ], [MODEL, [VENDOR, 'Generic']]
769
+ ],
770
+
771
+ engine : [[
772
+
773
+ /windows.+ edge\/([\w\.]+)/i // EdgeHTML
774
+ ], [VERSION, [NAME, EDGE+'HTML']], [
775
+
776
+ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
777
+ ], [VERSION, [NAME, 'Blink']], [
778
+
779
+ /(presto)\/([\w\.]+)/i, // Presto
780
+ /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
781
+ /ekioh(flow)\/([\w\.]+)/i, // Flow
782
+ /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
783
+ /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
784
+ /\b(libweb)/i
785
+ ], [NAME, VERSION], [
786
+
787
+ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
788
+ ], [VERSION, NAME]
789
+ ],
790
+
791
+ os : [[
792
+
793
+ // Windows
794
+ /microsoft (windows) (vista|xp)/i // Windows (iTunes)
795
+ ], [NAME, VERSION], [
796
+ /(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i // Windows Phone
797
+ ], [NAME, [VERSION, strMapper, windowsVersionMap]], [
798
+ /windows nt 6\.2; (arm)/i, // Windows RT
799
+ /windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,
800
+ /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i
801
+ ], [[VERSION, strMapper, windowsVersionMap], [NAME, 'Windows']], [
802
+
803
+ // iOS/macOS
804
+ /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
805
+ /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
806
+ /cfnetwork\/.+darwin/i
807
+ ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
808
+ /(mac os x) ?([\w\. ]*)/i,
809
+ /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
810
+ ], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [
811
+
812
+ // Mobile OSes
813
+ /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
814
+ ], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
815
+ /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
816
+ /(blackberry)\w*\/([\w\.]*)/i, // Blackberry
817
+ /(tizen|kaios)[\/ ]([\w\.]+)/i, // Tizen/KaiOS
818
+ /\((series40);/i // Series 40
819
+ ], [NAME, VERSION], [
820
+ /\(bb(10);/i // BlackBerry 10
821
+ ], [VERSION, [NAME, BLACKBERRY]], [
822
+ /(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i // Symbian
823
+ ], [VERSION, [NAME, 'Symbian']], [
824
+ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
825
+ ], [VERSION, [NAME, FIREFOX+' OS']], [
826
+ /web0s;.+rt(tv)/i,
827
+ /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
828
+ ], [VERSION, [NAME, 'webOS']], [
829
+ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
830
+ ], [VERSION, [NAME, 'watchOS']], [
831
+
832
+ // Google Chromecast
833
+ /crkey\/([\d\.]+)/i // Google Chromecast
834
+ ], [VERSION, [NAME, CHROME+'cast']], [
835
+ /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
836
+ ], [[NAME, CHROMIUM_OS], VERSION],[
837
+
838
+ // Smart TVs
839
+ /panasonic;(viera)/i, // Panasonic Viera
840
+ /(netrange)mmh/i, // Netrange
841
+ /(nettv)\/(\d+\.[\w\.]+)/i, // NetTV
842
+
843
+ // Console
844
+ /(nintendo|playstation) ([wids345portablevuch]+)/i, // Nintendo/Playstation
845
+ /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)
846
+
847
+ // Other
848
+ /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm
849
+ /(mint)[\/\(\) ]?(\w*)/i, // Mint
850
+ /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux
851
+ /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
852
+ // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
853
+ /(hurd|linux) ?([\w\.]*)/i, // Hurd/Linux
854
+ /(gnu) ?([\w\.]*)/i, // GNU
855
+ /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
856
+ /(haiku) (\w+)/i // Haiku
857
+ ], [NAME, VERSION], [
858
+ /(sunos) ?([\w\.\d]*)/i // Solaris
859
+ ], [[NAME, 'Solaris'], VERSION], [
860
+ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
861
+ /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX
862
+ /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
863
+ /(unix) ?([\w\.]*)/i // UNIX
864
+ ], [NAME, VERSION]
865
+ ]
866
+ };
867
+
868
+ /////////////////
869
+ // Constructor
870
+ ////////////////
871
+
872
+ var UAParser = function (ua, extensions) {
873
+
874
+ if (typeof ua === OBJ_TYPE) {
875
+ extensions = ua;
876
+ ua = undefined$1;
877
+ }
878
+
879
+ if (!(this instanceof UAParser)) {
880
+ return new UAParser(ua, extensions).getResult();
881
+ }
882
+
883
+ var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined$1;
884
+ var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY);
885
+ var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined$1;
886
+ var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
887
+ var _isSelfNav = _navigator && _navigator.userAgent == _ua;
888
+
889
+ this.getBrowser = function () {
890
+ var _browser = {};
891
+ _browser[NAME] = undefined$1;
892
+ _browser[VERSION] = undefined$1;
893
+ rgxMapper.call(_browser, _ua, _rgxmap.browser);
894
+ _browser[MAJOR] = majorize(_browser[VERSION]);
895
+ // Brave-specific detection
896
+ if (_isSelfNav && _navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) {
897
+ _browser[NAME] = 'Brave';
898
+ }
899
+ return _browser;
900
+ };
901
+ this.getCPU = function () {
902
+ var _cpu = {};
903
+ _cpu[ARCHITECTURE] = undefined$1;
904
+ rgxMapper.call(_cpu, _ua, _rgxmap.cpu);
905
+ return _cpu;
906
+ };
907
+ this.getDevice = function () {
908
+ var _device = {};
909
+ _device[VENDOR] = undefined$1;
910
+ _device[MODEL] = undefined$1;
911
+ _device[TYPE] = undefined$1;
912
+ rgxMapper.call(_device, _ua, _rgxmap.device);
913
+ if (_isSelfNav && !_device[TYPE] && _uach && _uach.mobile) {
914
+ _device[TYPE] = MOBILE;
915
+ }
916
+ // iPadOS-specific detection: identified as Mac, but has some iOS-only properties
917
+ if (_isSelfNav && _device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) {
918
+ _device[MODEL] = 'iPad';
919
+ _device[TYPE] = TABLET;
920
+ }
921
+ return _device;
922
+ };
923
+ this.getEngine = function () {
924
+ var _engine = {};
925
+ _engine[NAME] = undefined$1;
926
+ _engine[VERSION] = undefined$1;
927
+ rgxMapper.call(_engine, _ua, _rgxmap.engine);
928
+ return _engine;
929
+ };
930
+ this.getOS = function () {
931
+ var _os = {};
932
+ _os[NAME] = undefined$1;
933
+ _os[VERSION] = undefined$1;
934
+ rgxMapper.call(_os, _ua, _rgxmap.os);
935
+ if (_isSelfNav && !_os[NAME] && _uach && _uach.platform && _uach.platform != 'Unknown') {
936
+ _os[NAME] = _uach.platform
937
+ .replace(/chrome os/i, CHROMIUM_OS)
938
+ .replace(/macos/i, MAC_OS); // backward compatibility
939
+ }
940
+ return _os;
941
+ };
942
+ this.getResult = function () {
943
+ return {
944
+ ua : this.getUA(),
945
+ browser : this.getBrowser(),
946
+ engine : this.getEngine(),
947
+ os : this.getOS(),
948
+ device : this.getDevice(),
949
+ cpu : this.getCPU()
950
+ };
951
+ };
952
+ this.getUA = function () {
953
+ return _ua;
954
+ };
955
+ this.setUA = function (ua) {
956
+ _ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;
957
+ return this;
958
+ };
959
+ this.setUA(_ua);
960
+ return this;
961
+ };
962
+
963
+ UAParser.VERSION = LIBVERSION;
964
+ UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR]);
965
+ UAParser.CPU = enumerize([ARCHITECTURE]);
966
+ UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
967
+ UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);
968
+
969
+ ///////////
970
+ // Export
971
+ //////////
972
+
973
+ // check js environment
974
+ {
975
+ // nodejs env
976
+ if (module.exports) {
977
+ exports = module.exports = UAParser;
978
+ }
979
+ exports.UAParser = UAParser;
980
+ }
981
+
982
+ // jQuery/Zepto specific (optional)
983
+ // Note:
984
+ // In AMD env the global scope should be kept clean, but jQuery is an exception.
985
+ // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
986
+ // and we should catch that.
987
+ var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);
988
+ if ($ && !$.ua) {
989
+ var parser = new UAParser();
990
+ $.ua = parser.getResult();
991
+ $.ua.get = function () {
992
+ return parser.getUA();
993
+ };
994
+ $.ua.set = function (ua) {
995
+ parser.setUA(ua);
996
+ var result = parser.getResult();
997
+ for (var prop in result) {
998
+ $.ua[prop] = result[prop];
999
+ }
1000
+ };
1001
+ }
1002
+
1003
+ })(typeof window === 'object' ? window : commonjsGlobal);
1004
+ } (uaParser, uaParser.exports));
1005
+
1006
+ var Request = /** @class */ (function () {
1007
+ function Request(options) {
1008
+ this.options = options;
1009
+ }
1010
+ return Request;
1011
+ }());
1012
+ /**
1013
+ * 图片请求
1014
+ */
1015
+ /** @class */ ((function (_super) {
1016
+ __extends(ImageRequest, _super);
1017
+ function ImageRequest(options) {
1018
+ var _this = _super.call(this, options) || this;
1019
+ _this.options = options;
1020
+ return _this;
1021
+ }
1022
+ ImageRequest.prototype.run = function () {
1023
+ var _this = this;
1024
+ return new Promise(function (resolve) {
1025
+ var _a = _this.options, imgUseCrossOrigin = _a.imgUseCrossOrigin, url = _a.url, data = _a.data;
1026
+ var img = new Image();
1027
+ if (imgUseCrossOrigin) {
1028
+ img.crossOrigin = 'anonymous';
1029
+ }
1030
+ var spliceStr = url.indexOf('?') === -1 ? '?' : '&';
1031
+ img.src = "".concat(url).concat(spliceStr, "data=").concat(data);
1032
+ var callback = function (type) {
1033
+ img.src = null;
1034
+ img = null;
1035
+ resolve({ type: type });
1036
+ };
1037
+ img.onload = function () {
1038
+ callback('success');
1039
+ };
1040
+ img.onerror = function () {
1041
+ callback('error');
1042
+ };
1043
+ img.onabort = function () {
1044
+ callback('abort');
1045
+ };
1046
+ });
1047
+ };
1048
+ return ImageRequest;
1049
+ })(Request));
1050
+ /**
1051
+ * ajax请求
1052
+ */
1053
+ /** @class */ ((function (_super) {
1054
+ __extends(AjaxRequest, _super);
1055
+ function AjaxRequest(options) {
1056
+ var _this = _super.call(this, options) || this;
1057
+ _this.options = options;
1058
+ return _this;
1059
+ }
1060
+ AjaxRequest.prototype.run = function () {
1061
+ var _this = this;
1062
+ return new Promise(function (resolve) {
1063
+ var _a = _this.options, url = _a.url, data = _a.data, timeout = _a.timeout;
1064
+ var xhr = new XMLHttpRequest();
1065
+ xhr.open('POST', url, true);
1066
+ xhr.timeout = timeout || 20000;
1067
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1068
+ xhr.send(data || null);
1069
+ xhr.onreadystatechange = function () {
1070
+ if (xhr.readyState === 4) {
1071
+ if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) {
1072
+ resolve({
1073
+ type: 'success'
1074
+ });
1075
+ }
1076
+ else {
1077
+ resolve({
1078
+ type: 'error',
1079
+ msg: "\u7F51\u7EDC\u5F02\u5E38, \u8BF7\u6C42\u5931\u8D25".concat(xhr.status)
1080
+ });
1081
+ }
1082
+ }
1083
+ };
1084
+ });
1085
+ };
1086
+ return AjaxRequest;
1087
+ })(Request));
1088
+ /**
1089
+ * beacon请求
1090
+ */
1091
+ /** @class */ ((function (_super) {
1092
+ __extends(BeaconRequest, _super);
1093
+ function BeaconRequest(options) {
1094
+ var _this = _super.call(this, options) || this;
1095
+ _this.options = options;
1096
+ return _this;
1097
+ }
1098
+ BeaconRequest.prototype.run = function () {
1099
+ var _this = this;
1100
+ return new Promise(function (resolve) {
1101
+ var _a = _this.options, url = _a.url, data = _a.data;
1102
+ if (navigator.sendBeacon) {
1103
+ var isSuccess = navigator.sendBeacon(url, data);
1104
+ if (isSuccess) {
1105
+ resolve({
1106
+ type: 'success'
1107
+ });
1108
+ }
1109
+ else {
1110
+ resolve({
1111
+ type: 'error',
1112
+ msg: 'sendBeacon 请求失败'
1113
+ });
1114
+ }
1115
+ }
1116
+ });
1117
+ };
1118
+ return BeaconRequest;
1119
+ })(Request));
1120
+
1121
+ /**
1122
+ * 是否支持console
1123
+ */
1124
+ function supportConsole() {
1125
+ return typeof console !== 'undefined';
1126
+ }
1127
+ /**
1128
+ * 打印日志
1129
+ * @param message
1130
+ * @param type
1131
+ */
1132
+ function log(message, type) {
1133
+ if (type === void 0) { type = ConsoleTypes.LOG; }
1134
+ var func = console[type] || console.log;
1135
+ if (typeof func === 'function') {
1136
+ func(message);
1137
+ }
1138
+ }
1139
+
1140
+ var BaseCore = /** @class */ (function () {
1141
+ function BaseCore(options, useInstancing) {
1142
+ if (useInstancing === void 0) { useInstancing = true; }
1143
+ /**
1144
+ * SDK是否已准备就绪
1145
+ */
1146
+ this.isReady = false;
1147
+ /**
1148
+ * 控制台前缀
1149
+ */
1150
+ this.consolePrefix = '';
1151
+ /**
1152
+ * 初始化SDK的方式,默认为true,即通过new的方式初始化SDK,如果使用函数调用初始化SDK,则设置为false
1153
+ */
1154
+ this.useInstancing = true;
1155
+ this.options = options;
1156
+ this.useInstancing = useInstancing;
1157
+ }
1158
+ /**
1159
+ * 打印日志
1160
+ * @param message 日志消息
1161
+ * @param type 日志类型
1162
+ */
1163
+ BaseCore.prototype.log = function (message, type) {
1164
+ if (type === void 0) { type = ConsoleTypes.LOG; }
1165
+ var showLog = this.options.showLog;
1166
+ if (!supportConsole() || !showLog)
1167
+ return;
1168
+ if (typeof message === 'string' && this.consolePrefix) {
1169
+ message = "".concat(this.consolePrefix, "\uFF1A").concat(message);
1170
+ }
1171
+ log(message, type);
1172
+ };
1173
+ /**
1174
+ * 执行插件
1175
+ * @param plugins
1176
+ */
1177
+ BaseCore.prototype.runPlugins = function (plugins) {
1178
+ var _this = this;
1179
+ var _loop_1 = function (i) {
1180
+ var plugin = plugins[i];
1181
+ plugin.init(function (data) {
1182
+ if (!plugin.transform)
1183
+ return;
1184
+ var result = plugin.transform(data);
1185
+ if (!result)
1186
+ return;
1187
+ _this.report(result);
1188
+ });
1189
+ };
1190
+ for (var i = 0; i < plugins.length; i++) {
1191
+ _loop_1(i);
1192
+ }
1193
+ };
1194
+ return BaseCore;
1195
+ }());
1196
+
1197
+ exports.BaseCore = BaseCore;
1198
+
1199
+ }));
1200
+ //# sourceMappingURL=index.js.map