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