wisetrack 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -2
- package/README.md +201 -40
- package/dist/cdn/sdk.bundle.min.js +1 -1
- package/dist/cjs/index.js +1 -3599
- package/dist/esm/index.js +1 -3594
- package/package.json +2 -2
- package/dist/cdn/constants/constants.d.ts +0 -20
- package/dist/cdn/constants/endpoints.d.ts +0 -11
- package/dist/cdn/constants/environments.d.ts +0 -25
- package/dist/cdn/core/caching/queue-data.d.ts +0 -25
- package/dist/cdn/core/caching/request-queue-manager.d.ts +0 -54
- package/dist/cdn/core/fields/event-fields-builder.d.ts +0 -8
- package/dist/cdn/core/fields/fields-builder.d.ts +0 -9
- package/dist/cdn/core/network/api-client.d.ts +0 -9
- package/dist/cdn/core/network/network-error.d.ts +0 -17
- package/dist/cdn/core/network/network-manager.d.ts +0 -22
- package/dist/cdn/core/network/retry-policy.d.ts +0 -8
- package/dist/cdn/core/storage/storage-manager.d.ts +0 -52
- package/dist/cdn/core/wisetrack.d.ts +0 -125
- package/dist/cdn/core/wt-tracker.d.ts +0 -25
- package/dist/cdn/index.d.ts +0 -4
- package/dist/cdn/sdk.bundle.js +0 -3604
- package/dist/cdn/sdk.bundle.js.map +0 -1
- package/dist/cdn/types/config/initial-config.d.ts +0 -43
- package/dist/cdn/types/config/wt-app-settings.d.ts +0 -15
- package/dist/cdn/types/config/wt-config.d.ts +0 -18
- package/dist/cdn/types/event/revenue-currency.d.ts +0 -39
- package/dist/cdn/types/event/wt-event.d.ts +0 -94
- package/dist/cdn/utils/activity-ticker.d.ts +0 -12
- package/dist/cdn/utils/country-finder.d.ts +0 -9
- package/dist/cdn/utils/crypto-helper.d.ts +0 -4
- package/dist/cdn/utils/device-detector.d.ts +0 -41
- package/dist/cdn/utils/logger.d.ts +0 -36
- package/dist/cdn/utils/storage-support.d.ts +0 -16
- package/dist/cdn/utils/utils.d.ts +0 -5
- package/dist/cdn/utils/webgl-fingerprint.d.ts +0 -7
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,3599 +1 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/******************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
21
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
31
|
-
var e = new Error(message);
|
|
32
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
const WTConstants = {
|
|
37
|
-
SDK: {
|
|
38
|
-
HASH: "997bfbb583c1245a426a53dc1899ec779ff354f9",
|
|
39
|
-
PLATFORM: "web",
|
|
40
|
-
VERSION: "2.0.0",
|
|
41
|
-
},
|
|
42
|
-
CONFIG: {
|
|
43
|
-
BASE_URL: "https://config.wisetrack.io",
|
|
44
|
-
DEFAULT_ENVIRONMENT: "debug",
|
|
45
|
-
},
|
|
46
|
-
DEFAULTS: {
|
|
47
|
-
LOG_LEVEL: "debug",
|
|
48
|
-
SESSION_INTERVAL: '1800000', // 30 minutes
|
|
49
|
-
SUBSESSION_INTERVAL: '300000'},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/** @internal */
|
|
53
|
-
const WTSDKEnvironment = {
|
|
54
|
-
DEBUG: "debug",
|
|
55
|
-
STAGE: "stage",
|
|
56
|
-
PRODUCTION: "production",
|
|
57
|
-
};
|
|
58
|
-
/** @internal */
|
|
59
|
-
const EnvironmentUtils = {
|
|
60
|
-
sdkEnvironment: WTConstants.CONFIG.DEFAULT_ENVIRONMENT,
|
|
61
|
-
needAppSettings() {
|
|
62
|
-
return this.sdkEnvironment !== WTSDKEnvironment.PRODUCTION;
|
|
63
|
-
},
|
|
64
|
-
baseUrl() {
|
|
65
|
-
switch (this.sdkEnvironment) {
|
|
66
|
-
case WTSDKEnvironment.DEBUG:
|
|
67
|
-
return "https://core.debug.wisetrackdev.ir";
|
|
68
|
-
case WTSDKEnvironment.STAGE:
|
|
69
|
-
return "https://core.stage.wisetrackdev.ir";
|
|
70
|
-
case WTSDKEnvironment.PRODUCTION:
|
|
71
|
-
return "https://core.wisetrack.io";
|
|
72
|
-
default:
|
|
73
|
-
throw new Error(`Unknown environment: ${this.sdkEnvironment}`);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/** @internal */
|
|
79
|
-
const WTEndpoints = {
|
|
80
|
-
EVENTS: "/api/v1/events",
|
|
81
|
-
SESSIONS: "/api/v1/sessions",
|
|
82
|
-
SDK_CLICKS: "/api/v1/sdk_clicks",
|
|
83
|
-
SDK_INFOS: "/api/v1/sdk_infos",
|
|
84
|
-
ATTRIBUTIONS: "/api/v1/attributions",
|
|
85
|
-
APP_SETTINGS: "/api/v1/app_settings",
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/** @internal */
|
|
89
|
-
class WTAppSettings {
|
|
90
|
-
constructor(events, sessions, sdkClicks, sdkInfos, attributions, sessionInterval = WTConstants.DEFAULTS.SESSION_INTERVAL, subsessionInterval = WTConstants.DEFAULTS.SUBSESSION_INTERVAL) {
|
|
91
|
-
this.events = events;
|
|
92
|
-
this.sessions = sessions;
|
|
93
|
-
this.sdkClicks = sdkClicks;
|
|
94
|
-
this.sdkInfos = sdkInfos;
|
|
95
|
-
this.attributions = attributions;
|
|
96
|
-
this.sessionInterval = sessionInterval;
|
|
97
|
-
this.subsessionInterval = subsessionInterval;
|
|
98
|
-
}
|
|
99
|
-
static fromConfig(config) {
|
|
100
|
-
return new WTAppSettings(config.events, config.sessions, config.sdkClicks, config.sdkInfos, config.attributions, config.sessionInterval, config.subsessionInterval);
|
|
101
|
-
}
|
|
102
|
-
static fromJson(json) {
|
|
103
|
-
var _a, _b;
|
|
104
|
-
return new WTAppSettings(json.events, json.sessions, json.sdk_clicks, json.sdk_infos, json.attributions, (_a = json.session_interval) !== null && _a !== void 0 ? _a : WTConstants.DEFAULTS.SESSION_INTERVAL, (_b = json.subsession_interval) !== null && _b !== void 0 ? _b : WTConstants.DEFAULTS.SUBSESSION_INTERVAL);
|
|
105
|
-
}
|
|
106
|
-
static get defaultValue() {
|
|
107
|
-
return new WTAppSettings(WTEndpoints.EVENTS, WTEndpoints.SESSIONS, WTEndpoints.SDK_CLICKS, WTEndpoints.SDK_INFOS, WTEndpoints.ATTRIBUTIONS, WTConstants.DEFAULTS.SESSION_INTERVAL, WTConstants.DEFAULTS.SUBSESSION_INTERVAL);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** @internal */
|
|
112
|
-
class WTConfig {
|
|
113
|
-
constructor(baseUrl, events, sessions, sdkClicks, sdkInfos, attributions, appSettings, sdkEnabled = true, forceUpdate = false, sdkUpdate = false, sessionInterval = WTConstants.DEFAULTS.SESSION_INTERVAL, subsessionInterval = WTConstants.DEFAULTS.SUBSESSION_INTERVAL) {
|
|
114
|
-
this.baseUrl = baseUrl;
|
|
115
|
-
this.events = events;
|
|
116
|
-
this.sessions = sessions;
|
|
117
|
-
this.sdkClicks = sdkClicks;
|
|
118
|
-
this.sdkInfos = sdkInfos;
|
|
119
|
-
this.attributions = attributions;
|
|
120
|
-
this.appSettings = appSettings;
|
|
121
|
-
this.sdkEnabled = sdkEnabled;
|
|
122
|
-
this.forceUpdate = forceUpdate;
|
|
123
|
-
this.sdkUpdate = sdkUpdate;
|
|
124
|
-
this.sessionInterval = sessionInterval;
|
|
125
|
-
this.subsessionInterval = subsessionInterval;
|
|
126
|
-
}
|
|
127
|
-
static fromJson(json) {
|
|
128
|
-
var _a, _b, _c, _d, _e;
|
|
129
|
-
return new WTConfig(json.base_url, json.events, json.sessions, json.sdk_clicks, json.sdk_infos, json.attributions, json.app_settings, (_a = json.sdk_enabled) !== null && _a !== void 0 ? _a : true, (_b = json.force_update) !== null && _b !== void 0 ? _b : false, (_c = json.sdk_update) !== null && _c !== void 0 ? _c : false, (_d = json.session_interval) !== null && _d !== void 0 ? _d : WTConstants.DEFAULTS.SESSION_INTERVAL, (_e = json.subsession_interval) !== null && _e !== void 0 ? _e : WTConstants.DEFAULTS.SUBSESSION_INTERVAL);
|
|
130
|
-
}
|
|
131
|
-
static get defaultValue() {
|
|
132
|
-
return new WTConfig(EnvironmentUtils.baseUrl(), WTEndpoints.EVENTS, WTEndpoints.SESSIONS, WTEndpoints.SDK_CLICKS, WTEndpoints.SDK_INFOS, WTEndpoints.ATTRIBUTIONS, WTEndpoints.APP_SETTINGS);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** @internal */
|
|
137
|
-
class WTLogEngine {
|
|
138
|
-
}
|
|
139
|
-
/** @internal */
|
|
140
|
-
class ConsoleLogEngine extends WTLogEngine {
|
|
141
|
-
log(level, prefix, ...args) {
|
|
142
|
-
switch (level) {
|
|
143
|
-
case "debug":
|
|
144
|
-
console.debug(prefix, ...args);
|
|
145
|
-
break;
|
|
146
|
-
case "info":
|
|
147
|
-
console.info(prefix, ...args);
|
|
148
|
-
break;
|
|
149
|
-
case "warn":
|
|
150
|
-
console.warn(prefix, ...args);
|
|
151
|
-
break;
|
|
152
|
-
case "error":
|
|
153
|
-
console.error(prefix, ...args);
|
|
154
|
-
break;
|
|
155
|
-
default:
|
|
156
|
-
console.log(prefix, ...args);
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Defines the available log levels for the SDK.
|
|
163
|
-
*
|
|
164
|
-
* - `DEBUG`: Logs everything, including debug info.
|
|
165
|
-
* - `INFO`: Logs general information.
|
|
166
|
-
* - `WARN`: Logs warnings.
|
|
167
|
-
* - `ERROR`: Logs errors only.
|
|
168
|
-
* - `NONE`: Disables logging.
|
|
169
|
-
*/
|
|
170
|
-
const WTLogLevel = {
|
|
171
|
-
DEBUG: "debug",
|
|
172
|
-
INFO: "info",
|
|
173
|
-
WARN: "warn",
|
|
174
|
-
ERROR: "error",
|
|
175
|
-
NONE: "none",
|
|
176
|
-
};
|
|
177
|
-
/** @internal */
|
|
178
|
-
class WTLogger {
|
|
179
|
-
static setLevel(level) {
|
|
180
|
-
this.level = level;
|
|
181
|
-
}
|
|
182
|
-
static setPrefix(prefix) {
|
|
183
|
-
this.prefix = prefix;
|
|
184
|
-
}
|
|
185
|
-
static addOutputEngine(engine) {
|
|
186
|
-
this.outputEngines.push(engine);
|
|
187
|
-
}
|
|
188
|
-
static shouldLog(type) {
|
|
189
|
-
const levels = ["debug", "info", "warn", "error"];
|
|
190
|
-
const currentIndex = levels.indexOf(this.level);
|
|
191
|
-
const typeIndex = levels.indexOf(type);
|
|
192
|
-
return typeIndex >= currentIndex;
|
|
193
|
-
}
|
|
194
|
-
static log(level, ...args) {
|
|
195
|
-
if (!this.shouldLog(level))
|
|
196
|
-
return;
|
|
197
|
-
const prefix = `[${this.prefix}-${level.toUpperCase()}]`;
|
|
198
|
-
for (const output of this.outputEngines) {
|
|
199
|
-
output.log(level, prefix, ...args);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
static debug(...args) {
|
|
203
|
-
this.log("debug", ...args);
|
|
204
|
-
}
|
|
205
|
-
static info(...args) {
|
|
206
|
-
this.log("info", ...args);
|
|
207
|
-
}
|
|
208
|
-
static warn(...args) {
|
|
209
|
-
this.log("warn", ...args);
|
|
210
|
-
}
|
|
211
|
-
static error(...args) {
|
|
212
|
-
this.log("error", ...args);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
WTLogger.level = WTConstants.DEFAULTS.LOG_LEVEL;
|
|
216
|
-
WTLogger.prefix = "WT";
|
|
217
|
-
WTLogger.outputEngines = [new ConsoleLogEngine()];
|
|
218
|
-
|
|
219
|
-
const WTStorageKeys = {
|
|
220
|
-
DEVICE_ID: "WT.DeviceId",
|
|
221
|
-
INITIAL_DATE: "WT.InitialDate",
|
|
222
|
-
INITIAL_CONFIG: "WT.InitialConfigs",
|
|
223
|
-
CONFIG: "WT.Configs",
|
|
224
|
-
APP_SETTINGS: "WT.AppSettings",
|
|
225
|
-
SDK_CLICK_SUBMIT: "WT.SdkClickSubmit",
|
|
226
|
-
FIRST_SESSION_SUBMIT: "WT.FirstSessionSubmit",
|
|
227
|
-
SDK_ENABLED: "WT.SdkEnabled",
|
|
228
|
-
FCM_TOKEN: "WT.FcmToken", // used for calling push token request
|
|
229
|
-
PUSH_TOKEN: "WT.PushToken", // used in request param fields as "push_token"
|
|
230
|
-
EVENT_COUNT: "WT.EventCount",
|
|
231
|
-
SESSION_COUNT: "WT.SessionCount",
|
|
232
|
-
SESSION_LENGTH: "WT.SessionLenght", // ACTIVE_DURATION
|
|
233
|
-
SUBSESSION_COUNT: "WT.SubSessionCount",
|
|
234
|
-
ACTIVE_TIME: "WT.ActiveTime",
|
|
235
|
-
INACTIVE_TIME: "WT.InactiveTime",
|
|
236
|
-
INACTIVE_DURATION: "WT.InactiveDuration",
|
|
237
|
-
REQUEST_QUEUE: "WT.RequestQueue",
|
|
238
|
-
PENDING_REQUEST_QUEUE: "WT.PendingRequestQueue",
|
|
239
|
-
};
|
|
240
|
-
class StorageManager {
|
|
241
|
-
clear() {
|
|
242
|
-
localStorage.clear();
|
|
243
|
-
}
|
|
244
|
-
setJson(key, obj) {
|
|
245
|
-
if (!obj) {
|
|
246
|
-
localStorage.removeItem(key);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
try {
|
|
250
|
-
const encoded = JSON.stringify(obj);
|
|
251
|
-
localStorage.setItem(key, encoded);
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
WTLogger.error(`Error in encoding object for key '${key}'`, error);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
getJson(key) {
|
|
258
|
-
const data = localStorage.getItem(key);
|
|
259
|
-
if (!data) {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
try {
|
|
263
|
-
const decoded = JSON.parse(data);
|
|
264
|
-
return decoded;
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
WTLogger.error(`Error in JSON decoding for key '${key}': ${error}`, error);
|
|
268
|
-
return null;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
optionalNumber(key) {
|
|
272
|
-
const value = localStorage.getItem(key);
|
|
273
|
-
if (value === null) {
|
|
274
|
-
return null;
|
|
275
|
-
}
|
|
276
|
-
const num = Number(value);
|
|
277
|
-
return isNaN(num) ? null : num;
|
|
278
|
-
}
|
|
279
|
-
optionalBool(key) {
|
|
280
|
-
const value = localStorage.getItem(key);
|
|
281
|
-
if (value === null) {
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
return value === "true" ? true : value === "false" ? false : null;
|
|
285
|
-
}
|
|
286
|
-
get deviceId() {
|
|
287
|
-
return localStorage.getItem(WTStorageKeys.DEVICE_ID);
|
|
288
|
-
}
|
|
289
|
-
set deviceId(value) {
|
|
290
|
-
if (value) {
|
|
291
|
-
localStorage.setItem(WTStorageKeys.DEVICE_ID, value);
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
localStorage.removeItem(WTStorageKeys.DEVICE_ID);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
get initialDate() {
|
|
298
|
-
return this.getJson(WTStorageKeys.INITIAL_DATE);
|
|
299
|
-
}
|
|
300
|
-
set initialDate(value) {
|
|
301
|
-
this.setJson(WTStorageKeys.INITIAL_DATE, value);
|
|
302
|
-
}
|
|
303
|
-
get initialConfig() {
|
|
304
|
-
return this.getJson(WTStorageKeys.INITIAL_CONFIG);
|
|
305
|
-
}
|
|
306
|
-
set initialConfig(value) {
|
|
307
|
-
this.setJson(WTStorageKeys.INITIAL_CONFIG, value);
|
|
308
|
-
}
|
|
309
|
-
get config() {
|
|
310
|
-
return this.getJson(WTStorageKeys.CONFIG);
|
|
311
|
-
}
|
|
312
|
-
set config(value) {
|
|
313
|
-
this.setJson(WTStorageKeys.CONFIG, value);
|
|
314
|
-
}
|
|
315
|
-
get appSettings() {
|
|
316
|
-
return this.getJson(WTStorageKeys.APP_SETTINGS);
|
|
317
|
-
}
|
|
318
|
-
set appSettings(value) {
|
|
319
|
-
this.setJson(WTStorageKeys.APP_SETTINGS, value);
|
|
320
|
-
}
|
|
321
|
-
get sdkEnabled() {
|
|
322
|
-
var _a;
|
|
323
|
-
return (_a = this.optionalBool(WTStorageKeys.SDK_ENABLED)) !== null && _a !== void 0 ? _a : false;
|
|
324
|
-
}
|
|
325
|
-
set sdkEnabled(value) {
|
|
326
|
-
localStorage.setItem(WTStorageKeys.SDK_ENABLED, value.toString());
|
|
327
|
-
}
|
|
328
|
-
get sdkClickSubmit() {
|
|
329
|
-
var _a;
|
|
330
|
-
return (_a = this.optionalBool(WTStorageKeys.SDK_CLICK_SUBMIT)) !== null && _a !== void 0 ? _a : false;
|
|
331
|
-
}
|
|
332
|
-
set sdkClickSubmit(value) {
|
|
333
|
-
localStorage.setItem(WTStorageKeys.SDK_CLICK_SUBMIT, value.toString());
|
|
334
|
-
}
|
|
335
|
-
get firstSessionSubmit() {
|
|
336
|
-
var _a;
|
|
337
|
-
return (_a = this.optionalBool(WTStorageKeys.FIRST_SESSION_SUBMIT)) !== null && _a !== void 0 ? _a : false;
|
|
338
|
-
}
|
|
339
|
-
set firstSessionSubmit(value) {
|
|
340
|
-
localStorage.setItem(WTStorageKeys.FIRST_SESSION_SUBMIT, value.toString());
|
|
341
|
-
}
|
|
342
|
-
get fcmToken() {
|
|
343
|
-
return localStorage.getItem(WTStorageKeys.FCM_TOKEN);
|
|
344
|
-
}
|
|
345
|
-
set fcmToken(value) {
|
|
346
|
-
if (value) {
|
|
347
|
-
localStorage.setItem(WTStorageKeys.FCM_TOKEN, value);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
localStorage.removeItem(WTStorageKeys.FCM_TOKEN);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
get pushToken() {
|
|
354
|
-
return localStorage.getItem(WTStorageKeys.PUSH_TOKEN);
|
|
355
|
-
}
|
|
356
|
-
set pushToken(value) {
|
|
357
|
-
if (value) {
|
|
358
|
-
localStorage.setItem(WTStorageKeys.PUSH_TOKEN, value);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
localStorage.removeItem(WTStorageKeys.PUSH_TOKEN);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
get sessionCount() {
|
|
365
|
-
var _a;
|
|
366
|
-
return (_a = this.optionalNumber(WTStorageKeys.SESSION_COUNT)) !== null && _a !== void 0 ? _a : 1;
|
|
367
|
-
}
|
|
368
|
-
set sessionCount(value) {
|
|
369
|
-
localStorage.setItem(WTStorageKeys.SESSION_COUNT, value.toString());
|
|
370
|
-
}
|
|
371
|
-
get subSessionCount() {
|
|
372
|
-
var _a;
|
|
373
|
-
return (_a = this.optionalNumber(WTStorageKeys.SUBSESSION_COUNT)) !== null && _a !== void 0 ? _a : 1;
|
|
374
|
-
}
|
|
375
|
-
set subSessionCount(value) {
|
|
376
|
-
localStorage.setItem(WTStorageKeys.SUBSESSION_COUNT, value.toString());
|
|
377
|
-
}
|
|
378
|
-
get activeDuration() {
|
|
379
|
-
var _a;
|
|
380
|
-
return (_a = this.optionalNumber(WTStorageKeys.SESSION_LENGTH)) !== null && _a !== void 0 ? _a : 0;
|
|
381
|
-
}
|
|
382
|
-
set activeDuration(value) {
|
|
383
|
-
localStorage.setItem(WTStorageKeys.SESSION_LENGTH, value.toString());
|
|
384
|
-
}
|
|
385
|
-
get inactiveDuration() {
|
|
386
|
-
var _a;
|
|
387
|
-
return (_a = this.optionalNumber(WTStorageKeys.INACTIVE_DURATION)) !== null && _a !== void 0 ? _a : 0;
|
|
388
|
-
}
|
|
389
|
-
set inactiveDuration(value) {
|
|
390
|
-
localStorage.setItem(WTStorageKeys.INACTIVE_DURATION, value.toString());
|
|
391
|
-
}
|
|
392
|
-
get inactiveTime() {
|
|
393
|
-
return this.optionalNumber(WTStorageKeys.ACTIVE_TIME);
|
|
394
|
-
}
|
|
395
|
-
set inactiveTime(value) {
|
|
396
|
-
if (value !== null) {
|
|
397
|
-
localStorage.setItem(WTStorageKeys.ACTIVE_TIME, value.toString());
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
localStorage.removeItem(WTStorageKeys.ACTIVE_TIME);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
get activeTime() {
|
|
404
|
-
return this.optionalNumber(WTStorageKeys.INACTIVE_TIME);
|
|
405
|
-
}
|
|
406
|
-
set activeTime(value) {
|
|
407
|
-
if (value !== null) {
|
|
408
|
-
localStorage.setItem(WTStorageKeys.INACTIVE_TIME, value.toString());
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
localStorage.removeItem(WTStorageKeys.INACTIVE_TIME);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
get requestRecords() {
|
|
415
|
-
var _a;
|
|
416
|
-
return (_a = this.getJson(WTStorageKeys.REQUEST_QUEUE)) !== null && _a !== void 0 ? _a : [];
|
|
417
|
-
}
|
|
418
|
-
set requestRecords(value) {
|
|
419
|
-
this.setJson(WTStorageKeys.REQUEST_QUEUE, value);
|
|
420
|
-
}
|
|
421
|
-
get pendingRequestRecords() {
|
|
422
|
-
var _a;
|
|
423
|
-
return (_a = this.getJson(WTStorageKeys.PENDING_REQUEST_QUEUE)) !== null && _a !== void 0 ? _a : [];
|
|
424
|
-
}
|
|
425
|
-
set pendingRequestRecords(value) {
|
|
426
|
-
this.setJson(WTStorageKeys.PENDING_REQUEST_QUEUE, value);
|
|
427
|
-
}
|
|
428
|
-
get eventCount() {
|
|
429
|
-
var _a;
|
|
430
|
-
return (_a = this.optionalNumber(WTStorageKeys.EVENT_COUNT)) !== null && _a !== void 0 ? _a : 0;
|
|
431
|
-
}
|
|
432
|
-
set eventCount(value) {
|
|
433
|
-
localStorage.setItem(WTStorageKeys.EVENT_COUNT, value.toString());
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
/** @internal */
|
|
437
|
-
const storageManager = new StorageManager();
|
|
438
|
-
|
|
439
|
-
/** @internal */
|
|
440
|
-
var ApiError;
|
|
441
|
-
(function (ApiError) {
|
|
442
|
-
class InvalidUrl extends Error {
|
|
443
|
-
constructor(url) {
|
|
444
|
-
super(`Invalid URL: ${url}`);
|
|
445
|
-
this.name = "InvalidUrl";
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
ApiError.InvalidUrl = InvalidUrl;
|
|
449
|
-
class ServerError extends Error {
|
|
450
|
-
constructor(statusCode, message) {
|
|
451
|
-
super(`ServerError ${statusCode}: ${message}`);
|
|
452
|
-
this.statusCode = statusCode;
|
|
453
|
-
this.message = message;
|
|
454
|
-
this.name = "ServerError";
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
ApiError.ServerError = ServerError;
|
|
458
|
-
class NetworkError extends Error {
|
|
459
|
-
constructor(message) {
|
|
460
|
-
super(`NetworkError: ${message}`);
|
|
461
|
-
this.name = "NetworkFailure";
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
ApiError.NetworkError = NetworkError;
|
|
465
|
-
class DecodingError extends Error {
|
|
466
|
-
constructor(message) {
|
|
467
|
-
super(`DecodingError: ${message}`);
|
|
468
|
-
this.name = "DecodingError";
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
ApiError.DecodingError = DecodingError;
|
|
472
|
-
})(ApiError || (ApiError = {}));
|
|
473
|
-
|
|
474
|
-
/** @internal */
|
|
475
|
-
class RetryPolicy {
|
|
476
|
-
constructor(maxRetries = 3, retryInterval = 2000 // milliseconds
|
|
477
|
-
) {
|
|
478
|
-
this.maxRetries = maxRetries;
|
|
479
|
-
this.retryInterval = retryInterval;
|
|
480
|
-
}
|
|
481
|
-
canRetry(attempt) {
|
|
482
|
-
return attempt < this.maxRetries;
|
|
483
|
-
}
|
|
484
|
-
waitBeforeRetry() {
|
|
485
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
486
|
-
return new Promise((res) => setTimeout(res, this.retryInterval));
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
/** @internal */
|
|
492
|
-
const networkManager = {
|
|
493
|
-
retryPolicy() {
|
|
494
|
-
return new RetryPolicy();
|
|
495
|
-
},
|
|
496
|
-
sendRequest(endpoint_1) {
|
|
497
|
-
return __awaiter(this, arguments, void 0, function* (endpoint, options = {}) {
|
|
498
|
-
const retryAttempt = options.retryAttempt || 1;
|
|
499
|
-
WTLogger.debug(`🚀 REQUEST (${retryAttempt}) => ${options.method} ${endpoint}`);
|
|
500
|
-
WTLogger.debug("-- PARAMETERS =>", options.params || options.formData || {});
|
|
501
|
-
let body;
|
|
502
|
-
const requestHeaders = Object.assign({ Accept: "application/json" }, options.headers);
|
|
503
|
-
if (options.formData) {
|
|
504
|
-
const form = new FormData();
|
|
505
|
-
for (const key in options.formData) {
|
|
506
|
-
form.append(key, options.formData[key]);
|
|
507
|
-
}
|
|
508
|
-
body = form;
|
|
509
|
-
}
|
|
510
|
-
else if (options.params) {
|
|
511
|
-
requestHeaders["Content-Type"] = "application/json";
|
|
512
|
-
body = JSON.stringify(options.params);
|
|
513
|
-
}
|
|
514
|
-
try {
|
|
515
|
-
const response = yield fetch(endpoint, {
|
|
516
|
-
method: options.method,
|
|
517
|
-
headers: requestHeaders,
|
|
518
|
-
body,
|
|
519
|
-
});
|
|
520
|
-
if (!response.ok) {
|
|
521
|
-
let json = yield response.json();
|
|
522
|
-
let errorText = json.message || (yield response.text());
|
|
523
|
-
WTLogger.warn(`❌ API ERROR (${response.status}) =>`, errorText);
|
|
524
|
-
throw new ApiError.ServerError(response.status, json.message || "Server error");
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
const result = yield response.json();
|
|
528
|
-
WTLogger.debug(`✅ API SUCCESS (${response.status}) =>`, result.message || "Request successful");
|
|
529
|
-
return result;
|
|
530
|
-
}
|
|
531
|
-
catch (error) {
|
|
532
|
-
throw new ApiError.DecodingError(error.message || String(error));
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
catch (err) {
|
|
536
|
-
if (err instanceof ApiError.ServerError ||
|
|
537
|
-
err instanceof ApiError.DecodingError) {
|
|
538
|
-
throw err;
|
|
539
|
-
}
|
|
540
|
-
WTLogger.error("Error executing request", err);
|
|
541
|
-
if (this.retryPolicy().canRetry(retryAttempt)) {
|
|
542
|
-
yield this.retryPolicy().waitBeforeRetry();
|
|
543
|
-
return this.sendRequest(endpoint, Object.assign(Object.assign({}, options), { retryAttempt: retryAttempt + 1 }));
|
|
544
|
-
}
|
|
545
|
-
throw new ApiError.NetworkError(err.message || "Unknown error");
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
},
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
/** @internal */
|
|
552
|
-
const apiClient = {
|
|
553
|
-
doGetConfig() {
|
|
554
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
555
|
-
const initialConfig = storageManager.initialConfig;
|
|
556
|
-
if (!initialConfig) {
|
|
557
|
-
throw "Initial Config is not set";
|
|
558
|
-
}
|
|
559
|
-
const params = {
|
|
560
|
-
app_token: initialConfig.appToken,
|
|
561
|
-
app_version: initialConfig.appVersion,
|
|
562
|
-
framework: initialConfig.appFrameWork,
|
|
563
|
-
env: EnvironmentUtils.sdkEnvironment,
|
|
564
|
-
sdk_hash: WTConstants.SDK.HASH,
|
|
565
|
-
package_name: window.location.hostname,
|
|
566
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
567
|
-
store_name: "other",
|
|
568
|
-
};
|
|
569
|
-
const response = yield networkManager.sendRequest(WTConstants.CONFIG.BASE_URL, {
|
|
570
|
-
method: "POST",
|
|
571
|
-
formData: params,
|
|
572
|
-
});
|
|
573
|
-
return WTConfig.fromJson(response.result);
|
|
574
|
-
});
|
|
575
|
-
},
|
|
576
|
-
doGetAppSettings() {
|
|
577
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
578
|
-
const initialConfig = storageManager.initialConfig;
|
|
579
|
-
const wtConfig = storageManager.config;
|
|
580
|
-
if (!initialConfig)
|
|
581
|
-
throw "Initial Config is not set";
|
|
582
|
-
if (!wtConfig)
|
|
583
|
-
throw "SDK Config is not set";
|
|
584
|
-
if (!wtConfig.appSettings)
|
|
585
|
-
throw "AppSettings Url is not set";
|
|
586
|
-
const params = {
|
|
587
|
-
app_token: initialConfig.appToken,
|
|
588
|
-
app_version: initialConfig.appVersion,
|
|
589
|
-
framework: initialConfig.appFrameWork,
|
|
590
|
-
env: EnvironmentUtils.sdkEnvironment,
|
|
591
|
-
sdk_hash: WTConstants.SDK.HASH,
|
|
592
|
-
package_name: window.location.hostname,
|
|
593
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
594
|
-
store_name: "other",
|
|
595
|
-
};
|
|
596
|
-
const response = yield networkManager.sendRequest(wtConfig.baseUrl + wtConfig.appSettings, {
|
|
597
|
-
method: "POST",
|
|
598
|
-
formData: params,
|
|
599
|
-
});
|
|
600
|
-
return WTAppSettings.fromJson(response.result);
|
|
601
|
-
});
|
|
602
|
-
},
|
|
603
|
-
doCallRequest(endpoint, params) {
|
|
604
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
605
|
-
const initialConfig = storageManager.initialConfig;
|
|
606
|
-
const wtConfig = storageManager.config;
|
|
607
|
-
if (!initialConfig)
|
|
608
|
-
throw "Initial Config is not set";
|
|
609
|
-
if (!wtConfig)
|
|
610
|
-
throw "SDK Config is not set";
|
|
611
|
-
params.updated_at = new Date().toISOString();
|
|
612
|
-
const response = yield networkManager.sendRequest(wtConfig.baseUrl + endpoint, {
|
|
613
|
-
method: "POST",
|
|
614
|
-
params: {
|
|
615
|
-
needs_response_details: EnvironmentUtils.sdkEnvironment != WTSDKEnvironment.PRODUCTION,
|
|
616
|
-
parameters: params,
|
|
617
|
-
},
|
|
618
|
-
});
|
|
619
|
-
return response.success;
|
|
620
|
-
});
|
|
621
|
-
},
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
// import { WTLogger } from "./logger";
|
|
625
|
-
class ActivityTicker {
|
|
626
|
-
constructor() {
|
|
627
|
-
this.tickerDelay = 1000;
|
|
628
|
-
this.isPaused = false;
|
|
629
|
-
}
|
|
630
|
-
start() {
|
|
631
|
-
if (this.tickerJob) {
|
|
632
|
-
clearInterval(this.tickerJob);
|
|
633
|
-
}
|
|
634
|
-
this.tickerJob = setInterval(() => {
|
|
635
|
-
if (this.isPaused)
|
|
636
|
-
return;
|
|
637
|
-
if (document.hidden)
|
|
638
|
-
return;
|
|
639
|
-
if (!document.hasFocus())
|
|
640
|
-
return;
|
|
641
|
-
console.log(`ActivityTicker: active duration= ${storageManager.activeDuration / 1000}s, inactive duration= ${storageManager.inactiveDuration / 1000}s`);
|
|
642
|
-
storageManager.activeTime = Date.now();
|
|
643
|
-
storageManager.activeDuration += this.tickerDelay;
|
|
644
|
-
}, this.tickerDelay);
|
|
645
|
-
}
|
|
646
|
-
stop() {
|
|
647
|
-
clearInterval(this.tickerJob);
|
|
648
|
-
this.tickerJob = undefined;
|
|
649
|
-
}
|
|
650
|
-
pause() {
|
|
651
|
-
this.isPaused = true;
|
|
652
|
-
}
|
|
653
|
-
resume() {
|
|
654
|
-
this.isPaused = false;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
/** @internal */
|
|
658
|
-
const activityTicker = new ActivityTicker();
|
|
659
|
-
|
|
660
|
-
/** @internal */
|
|
661
|
-
class CountryFinder {
|
|
662
|
-
constructor() {
|
|
663
|
-
this._country = null;
|
|
664
|
-
}
|
|
665
|
-
getCountryCode() {
|
|
666
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
667
|
-
if (!this._country) {
|
|
668
|
-
this._country = yield this.tryAllEndpoints();
|
|
669
|
-
}
|
|
670
|
-
return this._country;
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
tryAllEndpoints() {
|
|
674
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
675
|
-
const endpoints = [
|
|
676
|
-
() => __awaiter(this, void 0, void 0, function* () {
|
|
677
|
-
const res = yield this.fetchWithTimeout("https://api.country.is");
|
|
678
|
-
if (!res.ok)
|
|
679
|
-
throw new Error("country.is failed");
|
|
680
|
-
const json = yield res.json();
|
|
681
|
-
return json.country || null;
|
|
682
|
-
}),
|
|
683
|
-
() => __awaiter(this, void 0, void 0, function* () {
|
|
684
|
-
const res = yield this.fetchWithTimeout("https://free.freeipapi.com/api/json");
|
|
685
|
-
if (!res.ok)
|
|
686
|
-
throw new Error("country.is failed");
|
|
687
|
-
const json = yield res.json();
|
|
688
|
-
return json.countryCode || null;
|
|
689
|
-
}),
|
|
690
|
-
() => __awaiter(this, void 0, void 0, function* () {
|
|
691
|
-
const res = yield this.fetchWithTimeout("https://ipwho.is/");
|
|
692
|
-
if (!res.ok)
|
|
693
|
-
throw new Error("ipwho.is failed");
|
|
694
|
-
const json = yield res.json();
|
|
695
|
-
return json.country_code || null;
|
|
696
|
-
}),
|
|
697
|
-
];
|
|
698
|
-
for (const tryFetch of endpoints) {
|
|
699
|
-
try {
|
|
700
|
-
const countryCode = yield tryFetch();
|
|
701
|
-
if (countryCode)
|
|
702
|
-
return countryCode;
|
|
703
|
-
}
|
|
704
|
-
catch (_) {
|
|
705
|
-
// Try next API
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
return null;
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
fetchWithTimeout(url_1) {
|
|
712
|
-
return __awaiter(this, arguments, void 0, function* (url, timeout = 2000) {
|
|
713
|
-
const controller = new AbortController();
|
|
714
|
-
const id = setTimeout(() => controller.abort(), timeout);
|
|
715
|
-
return fetch(url, { signal: controller.signal }).finally(() => clearTimeout(id));
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
/** @internal */
|
|
720
|
-
const countryFinder = new CountryFinder();
|
|
721
|
-
|
|
722
|
-
/** @internal */
|
|
723
|
-
const cryptoHelper = {
|
|
724
|
-
generateDeviceUUID() {
|
|
725
|
-
return crypto.randomUUID();
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
/** @internal */
|
|
730
|
-
class RequestRecord {
|
|
731
|
-
constructor(endpoint, parameters) {
|
|
732
|
-
this.retryCount = 0;
|
|
733
|
-
this.maxRetries = 3;
|
|
734
|
-
this.id = crypto.randomUUID();
|
|
735
|
-
this.endpoint = endpoint;
|
|
736
|
-
this.parameters = parameters;
|
|
737
|
-
this.createdAt = Date.now();
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
/** @internal */
|
|
741
|
-
class Mutex {
|
|
742
|
-
constructor() {
|
|
743
|
-
this.locked = false;
|
|
744
|
-
this.waitingQueue = [];
|
|
745
|
-
}
|
|
746
|
-
acquire() {
|
|
747
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
-
return new Promise((resolve) => {
|
|
749
|
-
if (!this.locked) {
|
|
750
|
-
this.locked = true;
|
|
751
|
-
resolve();
|
|
752
|
-
}
|
|
753
|
-
else {
|
|
754
|
-
this.waitingQueue.push(resolve);
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
release() {
|
|
760
|
-
if (this.waitingQueue.length > 0) {
|
|
761
|
-
const next = this.waitingQueue.shift();
|
|
762
|
-
next();
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
this.locked = false;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
/** @internal */
|
|
771
|
-
class RequestsQueueManager {
|
|
772
|
-
constructor() {
|
|
773
|
-
this.isInitialized = false;
|
|
774
|
-
this.isProcessing = false;
|
|
775
|
-
this.isCurrentlyProcessing = false;
|
|
776
|
-
this.mutex = new Mutex();
|
|
777
|
-
this.processingInterval = null;
|
|
778
|
-
this.PROCESSING_INTERVAL_MS = 100; // Check queue every 100ms
|
|
779
|
-
// Backoff strategy properties
|
|
780
|
-
this.failedRequestDelay = 0;
|
|
781
|
-
this.MAX_DELAY_MS = 30000; // 30 seconds max delay
|
|
782
|
-
this.BACKOFF_MULTIPLIER = 2;
|
|
783
|
-
this.BASE_DELAY_MS = 1000; // Start with 1 second
|
|
784
|
-
}
|
|
785
|
-
initialize() {
|
|
786
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
787
|
-
// Initialize the queue manager if needed
|
|
788
|
-
this.isInitialized = true;
|
|
789
|
-
if (!this.isProcessing) {
|
|
790
|
-
yield this.startProcessing();
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
shutdown() {
|
|
795
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
796
|
-
if (!this.isInitialized) {
|
|
797
|
-
return; // Nothing to shutdown
|
|
798
|
-
}
|
|
799
|
-
yield this.stopProcessing();
|
|
800
|
-
this.isInitialized = false;
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
startProcessing() {
|
|
804
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
805
|
-
if (!this.isInitialized) {
|
|
806
|
-
WTLogger.warn("Queue Manager is not initialized. Call initialize() first.");
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
yield this.mutex.acquire();
|
|
810
|
-
try {
|
|
811
|
-
if (this.isProcessing) {
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
this.isProcessing = true;
|
|
815
|
-
// Start the processing loop
|
|
816
|
-
this.processingInterval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
817
|
-
try {
|
|
818
|
-
yield this.processQueues();
|
|
819
|
-
}
|
|
820
|
-
catch (error) {
|
|
821
|
-
WTLogger.error("Error in processing loop:", error);
|
|
822
|
-
}
|
|
823
|
-
}), this.PROCESSING_INTERVAL_MS);
|
|
824
|
-
}
|
|
825
|
-
finally {
|
|
826
|
-
this.mutex.release();
|
|
827
|
-
}
|
|
828
|
-
// Process immediately after releasing the mutex
|
|
829
|
-
yield this.processQueues();
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
stopProcessing() {
|
|
833
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
834
|
-
yield this.mutex.acquire();
|
|
835
|
-
try {
|
|
836
|
-
this.isProcessing = false;
|
|
837
|
-
if (this.processingInterval) {
|
|
838
|
-
clearInterval(this.processingInterval);
|
|
839
|
-
this.processingInterval = null;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
finally {
|
|
843
|
-
this.mutex.release();
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
addRequest(request) {
|
|
848
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
849
|
-
yield this.mutex.acquire();
|
|
850
|
-
try {
|
|
851
|
-
const mainQueue = this.getMainQueue();
|
|
852
|
-
mainQueue.push(request);
|
|
853
|
-
this.saveMainQueue(mainQueue);
|
|
854
|
-
// Reset delay when new request is added (optional - gives fresh chance)
|
|
855
|
-
this.failedRequestDelay = 0;
|
|
856
|
-
// Start processing if not already started
|
|
857
|
-
if (!this.isProcessing) {
|
|
858
|
-
// Release mutex before starting processing
|
|
859
|
-
this.mutex.release();
|
|
860
|
-
yield this.startProcessing();
|
|
861
|
-
return; // Exit early since mutex was already released
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
finally {
|
|
865
|
-
// Only release if we haven't already released above
|
|
866
|
-
if (this.isProcessing) {
|
|
867
|
-
this.mutex.release();
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
addPendingRequest(request) {
|
|
873
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
874
|
-
yield this.mutex.acquire();
|
|
875
|
-
try {
|
|
876
|
-
const mainRequestsSent = this.getMainRequestsSentFlag();
|
|
877
|
-
if (mainRequestsSent) {
|
|
878
|
-
// Main requests have been sent, add to main queue directly
|
|
879
|
-
const mainQueue = this.getMainQueue();
|
|
880
|
-
mainQueue.push(request);
|
|
881
|
-
this.saveMainQueue(mainQueue);
|
|
882
|
-
}
|
|
883
|
-
else {
|
|
884
|
-
// Main requests not sent yet, add to pending queue
|
|
885
|
-
const pendingQueue = this.getPendingQueue();
|
|
886
|
-
pendingQueue.push(request);
|
|
887
|
-
this.savePendingQueue(pendingQueue);
|
|
888
|
-
}
|
|
889
|
-
// Reset delay when new request is added
|
|
890
|
-
this.failedRequestDelay = 0;
|
|
891
|
-
// Start processing if not already started
|
|
892
|
-
if (!this.isProcessing) {
|
|
893
|
-
// Release mutex before starting processing
|
|
894
|
-
this.mutex.release();
|
|
895
|
-
yield this.startProcessing();
|
|
896
|
-
return; // Exit early since mutex was already released
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
finally {
|
|
900
|
-
// Only release if we haven't already released above
|
|
901
|
-
if (this.isProcessing) {
|
|
902
|
-
this.mutex.release();
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
processQueues() {
|
|
908
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
909
|
-
if (!this.isProcessing || this.isCurrentlyProcessing) {
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
// Check if we're in delay period
|
|
913
|
-
if (this.failedRequestDelay > 0) {
|
|
914
|
-
if (Date.now() < this.failedRequestDelay) {
|
|
915
|
-
return; // Still in delay period
|
|
916
|
-
}
|
|
917
|
-
// Delay period ended
|
|
918
|
-
this.failedRequestDelay = 0;
|
|
919
|
-
WTLogger.debug("⏰ Backoff delay ended, resuming queue processing");
|
|
920
|
-
}
|
|
921
|
-
this.isCurrentlyProcessing = true;
|
|
922
|
-
yield this.mutex.acquire();
|
|
923
|
-
try {
|
|
924
|
-
yield this.processMainQueue();
|
|
925
|
-
yield this.processPendingQueue();
|
|
926
|
-
}
|
|
927
|
-
finally {
|
|
928
|
-
this.mutex.release();
|
|
929
|
-
this.isCurrentlyProcessing = false;
|
|
930
|
-
}
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
processMainQueue() {
|
|
934
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
935
|
-
const mainQueue = this.getMainQueue();
|
|
936
|
-
if (mainQueue.length === 0) {
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
// Take the first request
|
|
940
|
-
const request = mainQueue[0];
|
|
941
|
-
try {
|
|
942
|
-
const success = yield this.sendRequest(request);
|
|
943
|
-
if (success) {
|
|
944
|
-
// Remove the processed request from queue
|
|
945
|
-
mainQueue.shift();
|
|
946
|
-
this.saveMainQueue(mainQueue);
|
|
947
|
-
// Set flag that main requests have been sent
|
|
948
|
-
this.postRequestCheck(request);
|
|
949
|
-
WTLogger.debug(`✅ Request ${request.id} processed successfully`);
|
|
950
|
-
}
|
|
951
|
-
else {
|
|
952
|
-
// Update retry count in the queue (not just in memory)
|
|
953
|
-
mainQueue[0].retryCount++;
|
|
954
|
-
if (mainQueue[0].retryCount >= mainQueue[0].maxRetries) {
|
|
955
|
-
// Calculate backoff delay
|
|
956
|
-
const delayMs = this.calculateBackoffDelay(mainQueue[0].retryCount);
|
|
957
|
-
this.failedRequestDelay = Date.now() + delayMs;
|
|
958
|
-
WTLogger.warn(`⏳ Request ${request.id} failed after ${request.maxRetries} attempts. ` +
|
|
959
|
-
`Applying backoff delay of ${delayMs}ms`);
|
|
960
|
-
}
|
|
961
|
-
else {
|
|
962
|
-
WTLogger.warn(`⚠️ Request ${request.id} failed. Retry ${mainQueue[0].retryCount}/${mainQueue[0].maxRetries}`);
|
|
963
|
-
}
|
|
964
|
-
// Save the updated queue with new retry count
|
|
965
|
-
this.saveMainQueue(mainQueue);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
catch (error) {
|
|
969
|
-
WTLogger.error(`Error sending request ${request.endpoint}:`, error);
|
|
970
|
-
// Update retry count in storage
|
|
971
|
-
mainQueue[0].retryCount++;
|
|
972
|
-
if (mainQueue[0].retryCount >= mainQueue[0].maxRetries) {
|
|
973
|
-
// Apply backoff delay instead of removing
|
|
974
|
-
const delayMs = this.calculateBackoffDelay(mainQueue[0].retryCount);
|
|
975
|
-
this.failedRequestDelay = Date.now() + delayMs;
|
|
976
|
-
WTLogger.warn(`⏳ Request ${request.id} failed with error after ${mainQueue[0].maxRetries} attempts. ` +
|
|
977
|
-
`Applying backoff delay of ${delayMs}ms`);
|
|
978
|
-
}
|
|
979
|
-
// Save the updated queue
|
|
980
|
-
this.saveMainQueue(mainQueue);
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
calculateBackoffDelay(retryCount) {
|
|
985
|
-
// Exponential backoff: baseDelay * (multiplier ^ (retryCount - 1))
|
|
986
|
-
const delay = this.BASE_DELAY_MS * Math.pow(this.BACKOFF_MULTIPLIER, retryCount - 1);
|
|
987
|
-
return Math.min(delay, this.MAX_DELAY_MS);
|
|
988
|
-
}
|
|
989
|
-
processPendingQueue() {
|
|
990
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
991
|
-
const mainRequestsSent = this.getMainRequestsSentFlag();
|
|
992
|
-
if (!mainRequestsSent) {
|
|
993
|
-
return; // Main requests haven't been sent yet
|
|
994
|
-
}
|
|
995
|
-
const pendingQueue = this.getPendingQueue();
|
|
996
|
-
if (pendingQueue.length === 0) {
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
// Move all pending requests to main queue
|
|
1000
|
-
const mainQueue = this.getMainQueue();
|
|
1001
|
-
mainQueue.push(...pendingQueue);
|
|
1002
|
-
// Clear pending queue
|
|
1003
|
-
this.saveMainQueue(mainQueue);
|
|
1004
|
-
this.savePendingQueue([]);
|
|
1005
|
-
console.log(`📦 Moved ${pendingQueue.length} pending requests to main queue`);
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
sendRequest(request_1) {
|
|
1009
|
-
return __awaiter(this, arguments, void 0, function* (request, attempt = 1) {
|
|
1010
|
-
WTLogger.debug(`💥 Sending request (${request.endpoint}): id=${request.id}`);
|
|
1011
|
-
let result = false;
|
|
1012
|
-
try {
|
|
1013
|
-
result = yield apiClient.doCallRequest(request.endpoint, request.parameters);
|
|
1014
|
-
}
|
|
1015
|
-
catch (error) {
|
|
1016
|
-
WTLogger.error(`❌ Request ${request.endpoint} failed`, error);
|
|
1017
|
-
}
|
|
1018
|
-
return result;
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
getMainQueue() {
|
|
1022
|
-
return storageManager.requestRecords;
|
|
1023
|
-
}
|
|
1024
|
-
saveMainQueue(queue) {
|
|
1025
|
-
storageManager.requestRecords = queue;
|
|
1026
|
-
}
|
|
1027
|
-
getPendingQueue() {
|
|
1028
|
-
return storageManager.pendingRequestRecords;
|
|
1029
|
-
}
|
|
1030
|
-
savePendingQueue(queue) {
|
|
1031
|
-
storageManager.pendingRequestRecords = queue;
|
|
1032
|
-
}
|
|
1033
|
-
getMainRequestsSentFlag() {
|
|
1034
|
-
return storageManager.sdkClickSubmit;
|
|
1035
|
-
}
|
|
1036
|
-
postRequestCheck(request) {
|
|
1037
|
-
switch (request.endpoint) {
|
|
1038
|
-
case WTEndpoints.SDK_CLICKS:
|
|
1039
|
-
storageManager.sdkClickSubmit = true;
|
|
1040
|
-
break;
|
|
1041
|
-
case WTEndpoints.SESSIONS:
|
|
1042
|
-
if (storageManager.firstSessionSubmit) {
|
|
1043
|
-
storageManager.activeDuration = 0;
|
|
1044
|
-
storageManager.inactiveDuration = 0;
|
|
1045
|
-
storageManager.subSessionCount = 1;
|
|
1046
|
-
}
|
|
1047
|
-
else {
|
|
1048
|
-
storageManager.firstSessionSubmit = true;
|
|
1049
|
-
}
|
|
1050
|
-
break;
|
|
1051
|
-
case WTEndpoints.SDK_INFOS:
|
|
1052
|
-
storageManager.fcmToken = request.parameters.push_token;
|
|
1053
|
-
break;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
getQueueStatus() {
|
|
1057
|
-
return {
|
|
1058
|
-
mainQueueLength: this.getMainQueue().length,
|
|
1059
|
-
pendingQueueLength: this.getPendingQueue().length,
|
|
1060
|
-
isProcessing: this.isProcessing,
|
|
1061
|
-
mainRequestsSent: this.getMainRequestsSentFlag(),
|
|
1062
|
-
isInBackoffDelay: this.failedRequestDelay > 0 && Date.now() < this.failedRequestDelay,
|
|
1063
|
-
backoffEndsAt: this.failedRequestDelay > 0 ? this.failedRequestDelay : null,
|
|
1064
|
-
};
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* Manually reset backoff delay (useful for testing or manual recovery)
|
|
1068
|
-
*/
|
|
1069
|
-
resetBackoffDelay() {
|
|
1070
|
-
this.failedRequestDelay = 0;
|
|
1071
|
-
WTLogger.debug("🔄 Backoff delay manually reset");
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Get current backoff delay configuration
|
|
1075
|
-
*/
|
|
1076
|
-
getBackoffConfig() {
|
|
1077
|
-
return {
|
|
1078
|
-
baseDelayMs: this.BASE_DELAY_MS,
|
|
1079
|
-
multiplier: this.BACKOFF_MULTIPLIER,
|
|
1080
|
-
maxDelayMs: this.MAX_DELAY_MS,
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
/** @internal */
|
|
1085
|
-
const queueManager = new RequestsQueueManager();
|
|
1086
|
-
|
|
1087
|
-
// Generated ESM version of ua-parser-js
|
|
1088
|
-
// DO NOT EDIT THIS FILE!
|
|
1089
|
-
// Source: /src/main/ua-parser.js
|
|
1090
|
-
|
|
1091
|
-
/////////////////////////////////////////////////////////////////////////////////
|
|
1092
|
-
/* UAParser.js v2.0.4
|
|
1093
|
-
Copyright © 2012-2025 Faisal Salman <f@faisalman.com>
|
|
1094
|
-
AGPLv3 License *//*
|
|
1095
|
-
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
|
1096
|
-
Supports browser & node.js environment.
|
|
1097
|
-
Demo : https://uaparser.dev
|
|
1098
|
-
Source : https://github.com/faisalman/ua-parser-js */
|
|
1099
|
-
/////////////////////////////////////////////////////////////////////////////////
|
|
1100
|
-
|
|
1101
|
-
/* jshint esversion: 6 */
|
|
1102
|
-
/* globals window */
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
//////////////
|
|
1107
|
-
// Constants
|
|
1108
|
-
/////////////
|
|
1109
|
-
|
|
1110
|
-
var LIBVERSION = '2.0.4',
|
|
1111
|
-
UA_MAX_LENGTH = 500,
|
|
1112
|
-
USER_AGENT = 'user-agent',
|
|
1113
|
-
EMPTY = '',
|
|
1114
|
-
UNKNOWN = '?',
|
|
1115
|
-
|
|
1116
|
-
// typeof
|
|
1117
|
-
FUNC_TYPE = 'function',
|
|
1118
|
-
UNDEF_TYPE = 'undefined',
|
|
1119
|
-
OBJ_TYPE = 'object',
|
|
1120
|
-
STR_TYPE = 'string',
|
|
1121
|
-
|
|
1122
|
-
// properties
|
|
1123
|
-
UA_BROWSER = 'browser',
|
|
1124
|
-
UA_CPU = 'cpu',
|
|
1125
|
-
UA_DEVICE = 'device',
|
|
1126
|
-
UA_ENGINE = 'engine',
|
|
1127
|
-
UA_OS = 'os',
|
|
1128
|
-
UA_RESULT = 'result',
|
|
1129
|
-
|
|
1130
|
-
NAME = 'name',
|
|
1131
|
-
TYPE = 'type',
|
|
1132
|
-
VENDOR = 'vendor',
|
|
1133
|
-
VERSION = 'version',
|
|
1134
|
-
ARCHITECTURE= 'architecture',
|
|
1135
|
-
MAJOR = 'major',
|
|
1136
|
-
MODEL = 'model',
|
|
1137
|
-
|
|
1138
|
-
// device types
|
|
1139
|
-
CONSOLE = 'console',
|
|
1140
|
-
MOBILE = 'mobile',
|
|
1141
|
-
TABLET = 'tablet',
|
|
1142
|
-
SMARTTV = 'smarttv',
|
|
1143
|
-
WEARABLE = 'wearable',
|
|
1144
|
-
XR = 'xr',
|
|
1145
|
-
EMBEDDED = 'embedded',
|
|
1146
|
-
|
|
1147
|
-
// browser types
|
|
1148
|
-
INAPP = 'inapp',
|
|
1149
|
-
|
|
1150
|
-
// client hints
|
|
1151
|
-
BRANDS = 'brands',
|
|
1152
|
-
FORMFACTORS = 'formFactors',
|
|
1153
|
-
FULLVERLIST = 'fullVersionList',
|
|
1154
|
-
PLATFORM = 'platform',
|
|
1155
|
-
PLATFORMVER = 'platformVersion',
|
|
1156
|
-
BITNESS = 'bitness',
|
|
1157
|
-
CH_HEADER = 'sec-ch-ua',
|
|
1158
|
-
CH_HEADER_FULL_VER_LIST = CH_HEADER + '-full-version-list',
|
|
1159
|
-
CH_HEADER_ARCH = CH_HEADER + '-arch',
|
|
1160
|
-
CH_HEADER_BITNESS = CH_HEADER + '-' + BITNESS,
|
|
1161
|
-
CH_HEADER_FORM_FACTORS = CH_HEADER + '-form-factors',
|
|
1162
|
-
CH_HEADER_MOBILE = CH_HEADER + '-' + MOBILE,
|
|
1163
|
-
CH_HEADER_MODEL = CH_HEADER + '-' + MODEL,
|
|
1164
|
-
CH_HEADER_PLATFORM = CH_HEADER + '-' + PLATFORM,
|
|
1165
|
-
CH_HEADER_PLATFORM_VER = CH_HEADER_PLATFORM + '-version',
|
|
1166
|
-
CH_ALL_VALUES = [BRANDS, FULLVERLIST, MOBILE, MODEL, PLATFORM, PLATFORMVER, ARCHITECTURE, FORMFACTORS, BITNESS],
|
|
1167
|
-
|
|
1168
|
-
// device vendors
|
|
1169
|
-
AMAZON = 'Amazon',
|
|
1170
|
-
APPLE = 'Apple',
|
|
1171
|
-
ASUS = 'ASUS',
|
|
1172
|
-
BLACKBERRY = 'BlackBerry',
|
|
1173
|
-
GOOGLE = 'Google',
|
|
1174
|
-
HUAWEI = 'Huawei',
|
|
1175
|
-
LENOVO = 'Lenovo',
|
|
1176
|
-
HONOR = 'Honor',
|
|
1177
|
-
LG = 'LG',
|
|
1178
|
-
MICROSOFT = 'Microsoft',
|
|
1179
|
-
MOTOROLA = 'Motorola',
|
|
1180
|
-
NVIDIA = 'Nvidia',
|
|
1181
|
-
ONEPLUS = 'OnePlus',
|
|
1182
|
-
OPPO = 'OPPO',
|
|
1183
|
-
SAMSUNG = 'Samsung',
|
|
1184
|
-
SHARP = 'Sharp',
|
|
1185
|
-
SONY = 'Sony',
|
|
1186
|
-
XIAOMI = 'Xiaomi',
|
|
1187
|
-
ZEBRA = 'Zebra',
|
|
1188
|
-
|
|
1189
|
-
// browsers
|
|
1190
|
-
CHROME = 'Chrome',
|
|
1191
|
-
CHROMIUM = 'Chromium',
|
|
1192
|
-
CHROMECAST = 'Chromecast',
|
|
1193
|
-
EDGE = 'Edge',
|
|
1194
|
-
FIREFOX = 'Firefox',
|
|
1195
|
-
OPERA = 'Opera',
|
|
1196
|
-
FACEBOOK = 'Facebook',
|
|
1197
|
-
SOGOU = 'Sogou',
|
|
1198
|
-
|
|
1199
|
-
PREFIX_MOBILE = 'Mobile ',
|
|
1200
|
-
SUFFIX_BROWSER = ' Browser',
|
|
1201
|
-
|
|
1202
|
-
// os
|
|
1203
|
-
WINDOWS = 'Windows';
|
|
1204
|
-
|
|
1205
|
-
var isWindow = typeof window !== UNDEF_TYPE,
|
|
1206
|
-
NAVIGATOR = (isWindow && window.navigator) ?
|
|
1207
|
-
window.navigator :
|
|
1208
|
-
undefined,
|
|
1209
|
-
NAVIGATOR_UADATA = (NAVIGATOR && NAVIGATOR.userAgentData) ?
|
|
1210
|
-
NAVIGATOR.userAgentData :
|
|
1211
|
-
undefined;
|
|
1212
|
-
|
|
1213
|
-
///////////
|
|
1214
|
-
// Helper
|
|
1215
|
-
//////////
|
|
1216
|
-
|
|
1217
|
-
var extend = function (defaultRgx, extensions) {
|
|
1218
|
-
var mergedRgx = {};
|
|
1219
|
-
var extraRgx = extensions;
|
|
1220
|
-
if (!isExtensions(extensions)) {
|
|
1221
|
-
extraRgx = {};
|
|
1222
|
-
for (var i in extensions) {
|
|
1223
|
-
for (var j in extensions[i]) {
|
|
1224
|
-
extraRgx[j] = extensions[i][j].concat(extraRgx[j] ? extraRgx[j] : []);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
for (var k in defaultRgx) {
|
|
1229
|
-
mergedRgx[k] = extraRgx[k] && extraRgx[k].length % 2 === 0 ? extraRgx[k].concat(defaultRgx[k]) : defaultRgx[k];
|
|
1230
|
-
}
|
|
1231
|
-
return mergedRgx;
|
|
1232
|
-
},
|
|
1233
|
-
enumerize = function (arr) {
|
|
1234
|
-
var enums = {};
|
|
1235
|
-
for (var i=0; i<arr.length; i++) {
|
|
1236
|
-
enums[arr[i].toUpperCase()] = arr[i];
|
|
1237
|
-
}
|
|
1238
|
-
return enums;
|
|
1239
|
-
},
|
|
1240
|
-
has = function (str1, str2) {
|
|
1241
|
-
if (typeof str1 === OBJ_TYPE && str1.length > 0) {
|
|
1242
|
-
for (var i in str1) {
|
|
1243
|
-
if (lowerize(str2) == lowerize(str1[i])) return true;
|
|
1244
|
-
}
|
|
1245
|
-
return false;
|
|
1246
|
-
}
|
|
1247
|
-
return isString(str1) ? lowerize(str2) == lowerize(str1) : false;
|
|
1248
|
-
},
|
|
1249
|
-
isExtensions = function (obj, deep) {
|
|
1250
|
-
for (var prop in obj) {
|
|
1251
|
-
return /^(browser|cpu|device|engine|os)$/.test(prop) || (deep ? isExtensions(obj[prop]) : false);
|
|
1252
|
-
}
|
|
1253
|
-
},
|
|
1254
|
-
isString = function (val) {
|
|
1255
|
-
return typeof val === STR_TYPE;
|
|
1256
|
-
},
|
|
1257
|
-
itemListToArray = function (header) {
|
|
1258
|
-
if (!header) return undefined;
|
|
1259
|
-
var arr = [];
|
|
1260
|
-
var tokens = strip(/\\?\"/g, header).split(',');
|
|
1261
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1262
|
-
if (tokens[i].indexOf(';') > -1) {
|
|
1263
|
-
var token = trim(tokens[i]).split(';v=');
|
|
1264
|
-
arr[i] = { brand : token[0], version : token[1] };
|
|
1265
|
-
} else {
|
|
1266
|
-
arr[i] = trim(tokens[i]);
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
return arr;
|
|
1270
|
-
},
|
|
1271
|
-
lowerize = function (str) {
|
|
1272
|
-
return isString(str) ? str.toLowerCase() : str;
|
|
1273
|
-
},
|
|
1274
|
-
majorize = function (version) {
|
|
1275
|
-
return isString(version) ? strip(/[^\d\.]/g, version).split('.')[0] : undefined;
|
|
1276
|
-
},
|
|
1277
|
-
setProps = function (arr) {
|
|
1278
|
-
for (var i in arr) {
|
|
1279
|
-
var propName = arr[i];
|
|
1280
|
-
if (typeof propName == OBJ_TYPE && propName.length == 2) {
|
|
1281
|
-
this[propName[0]] = propName[1];
|
|
1282
|
-
} else {
|
|
1283
|
-
this[propName] = undefined;
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
return this;
|
|
1287
|
-
},
|
|
1288
|
-
strip = function (pattern, str) {
|
|
1289
|
-
return isString(str) ? str.replace(pattern, EMPTY) : str;
|
|
1290
|
-
},
|
|
1291
|
-
stripQuotes = function (str) {
|
|
1292
|
-
return strip(/\\?\"/g, str);
|
|
1293
|
-
},
|
|
1294
|
-
trim = function (str, len) {
|
|
1295
|
-
if (isString(str)) {
|
|
1296
|
-
str = strip(/^\s\s*/, str);
|
|
1297
|
-
return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
-
|
|
1301
|
-
///////////////
|
|
1302
|
-
// Map helper
|
|
1303
|
-
//////////////
|
|
1304
|
-
|
|
1305
|
-
var rgxMapper = function (ua, arrays) {
|
|
1306
|
-
|
|
1307
|
-
if(!ua || !arrays) return;
|
|
1308
|
-
|
|
1309
|
-
var i = 0, j, k, p, q, matches, match;
|
|
1310
|
-
|
|
1311
|
-
// loop through all regexes maps
|
|
1312
|
-
while (i < arrays.length && !matches) {
|
|
1313
|
-
|
|
1314
|
-
var regex = arrays[i], // even sequence (0,2,4,..)
|
|
1315
|
-
props = arrays[i + 1]; // odd sequence (1,3,5,..)
|
|
1316
|
-
j = k = 0;
|
|
1317
|
-
|
|
1318
|
-
// try matching uastring with regexes
|
|
1319
|
-
while (j < regex.length && !matches) {
|
|
1320
|
-
|
|
1321
|
-
if (!regex[j]) { break; }
|
|
1322
|
-
matches = regex[j++].exec(ua);
|
|
1323
|
-
|
|
1324
|
-
if (!!matches) {
|
|
1325
|
-
for (p = 0; p < props.length; p++) {
|
|
1326
|
-
match = matches[++k];
|
|
1327
|
-
q = props[p];
|
|
1328
|
-
// check if given property is actually array
|
|
1329
|
-
if (typeof q === OBJ_TYPE && q.length > 0) {
|
|
1330
|
-
if (q.length === 2) {
|
|
1331
|
-
if (typeof q[1] == FUNC_TYPE) {
|
|
1332
|
-
// assign modified match
|
|
1333
|
-
this[q[0]] = q[1].call(this, match);
|
|
1334
|
-
} else {
|
|
1335
|
-
// assign given value, ignore regex match
|
|
1336
|
-
this[q[0]] = q[1];
|
|
1337
|
-
}
|
|
1338
|
-
} else if (q.length >= 3) {
|
|
1339
|
-
// Check whether q[1] FUNCTION or REGEX
|
|
1340
|
-
if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
|
1341
|
-
if (q.length > 3) {
|
|
1342
|
-
this[q[0]] = match ? q[1].apply(this, q.slice(2)) : undefined;
|
|
1343
|
-
} else {
|
|
1344
|
-
// call function (usually string mapper)
|
|
1345
|
-
this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
|
|
1346
|
-
}
|
|
1347
|
-
} else {
|
|
1348
|
-
if (q.length == 3) {
|
|
1349
|
-
// sanitize match using given regex
|
|
1350
|
-
this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
|
1351
|
-
} else if (q.length == 4) {
|
|
1352
|
-
this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
|
|
1353
|
-
} else if (q.length > 4) {
|
|
1354
|
-
this[q[0]] = match ? q[3].apply(this, [match.replace(q[1], q[2])].concat(q.slice(4))) : undefined;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
} else {
|
|
1359
|
-
this[q] = match ? match : undefined;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
i += 2;
|
|
1365
|
-
}
|
|
1366
|
-
},
|
|
1367
|
-
|
|
1368
|
-
strMapper = function (str, map) {
|
|
1369
|
-
|
|
1370
|
-
for (var i in map) {
|
|
1371
|
-
// check if current value is array
|
|
1372
|
-
if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
|
|
1373
|
-
for (var j = 0; j < map[i].length; j++) {
|
|
1374
|
-
if (has(map[i][j], str)) {
|
|
1375
|
-
return (i === UNKNOWN) ? undefined : i;
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
} else if (has(map[i], str)) {
|
|
1379
|
-
return (i === UNKNOWN) ? undefined : i;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
return map.hasOwnProperty('*') ? map['*'] : str;
|
|
1383
|
-
};
|
|
1384
|
-
|
|
1385
|
-
///////////////
|
|
1386
|
-
// String map
|
|
1387
|
-
//////////////
|
|
1388
|
-
|
|
1389
|
-
var windowsVersionMap = {
|
|
1390
|
-
'ME' : '4.90',
|
|
1391
|
-
'NT 3.51': '3.51',
|
|
1392
|
-
'NT 4.0': '4.0',
|
|
1393
|
-
'2000' : ['5.0', '5.01'],
|
|
1394
|
-
'XP' : ['5.1', '5.2'],
|
|
1395
|
-
'Vista' : '6.0',
|
|
1396
|
-
'7' : '6.1',
|
|
1397
|
-
'8' : '6.2',
|
|
1398
|
-
'8.1' : '6.3',
|
|
1399
|
-
'10' : ['6.4', '10.0'],
|
|
1400
|
-
'NT' : ''
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1403
|
-
formFactorsMap = {
|
|
1404
|
-
'embedded' : 'Automotive',
|
|
1405
|
-
'mobile' : 'Mobile',
|
|
1406
|
-
'tablet' : ['Tablet', 'EInk'],
|
|
1407
|
-
'smarttv' : 'TV',
|
|
1408
|
-
'wearable' : 'Watch',
|
|
1409
|
-
'xr' : ['VR', 'XR'],
|
|
1410
|
-
'?' : ['Desktop', 'Unknown'],
|
|
1411
|
-
'*' : undefined
|
|
1412
|
-
},
|
|
1413
|
-
|
|
1414
|
-
browserHintsMap = {
|
|
1415
|
-
'Chrome' : 'Google Chrome',
|
|
1416
|
-
'Edge' : 'Microsoft Edge',
|
|
1417
|
-
'Edge WebView2' : 'Microsoft Edge WebView2',
|
|
1418
|
-
'Chrome WebView': 'Android WebView',
|
|
1419
|
-
'Chrome Headless':'HeadlessChrome',
|
|
1420
|
-
'Huawei Browser': 'HuaweiBrowser',
|
|
1421
|
-
'MIUI Browser' : 'Miui Browser',
|
|
1422
|
-
'Opera Mobi' : 'OperaMobile',
|
|
1423
|
-
'Yandex' : 'YaBrowser'
|
|
1424
|
-
};
|
|
1425
|
-
|
|
1426
|
-
//////////////
|
|
1427
|
-
// Regex map
|
|
1428
|
-
/////////////
|
|
1429
|
-
|
|
1430
|
-
var defaultRegexes = {
|
|
1431
|
-
|
|
1432
|
-
browser : [[
|
|
1433
|
-
|
|
1434
|
-
// Most common regardless engine
|
|
1435
|
-
/\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
|
|
1436
|
-
], [VERSION, [NAME, PREFIX_MOBILE + 'Chrome']], [
|
|
1437
|
-
/webview.+edge\/([\w\.]+)/i // Microsoft Edge
|
|
1438
|
-
], [VERSION, [NAME, EDGE+' WebView']], [
|
|
1439
|
-
/edg(?:e|ios|a)?\/([\w\.]+)/i
|
|
1440
|
-
], [VERSION, [NAME, 'Edge']], [
|
|
1441
|
-
|
|
1442
|
-
// Presto based
|
|
1443
|
-
/(opera mini)\/([-\w\.]+)/i, // Opera Mini
|
|
1444
|
-
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet
|
|
1445
|
-
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera
|
|
1446
|
-
], [NAME, VERSION], [
|
|
1447
|
-
/opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0
|
|
1448
|
-
], [VERSION, [NAME, OPERA+' Mini']], [
|
|
1449
|
-
/\bop(?:rg)?x\/([\w\.]+)/i // Opera GX
|
|
1450
|
-
], [VERSION, [NAME, OPERA+' GX']], [
|
|
1451
|
-
/\bopr\/([\w\.]+)/i // Opera Webkit
|
|
1452
|
-
], [VERSION, [NAME, OPERA]], [
|
|
1453
|
-
|
|
1454
|
-
// Mixed
|
|
1455
|
-
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
|
|
1456
|
-
], [VERSION, [NAME, 'Baidu']], [
|
|
1457
|
-
/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon
|
|
1458
|
-
], [VERSION, [NAME, 'Maxthon']], [
|
|
1459
|
-
/(kindle)\/([\w\.]+)/i, // Kindle
|
|
1460
|
-
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
|
|
1461
|
-
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
|
|
1462
|
-
// Trident based
|
|
1463
|
-
/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
|
|
1464
|
-
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
|
1465
|
-
|
|
1466
|
-
// Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble
|
|
1467
|
-
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,
|
|
1468
|
-
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
|
|
1469
|
-
/(heytap|ovi|115|surf)browser\/([\d\.]+)/i, // HeyTap/Ovi/115/Surf
|
|
1470
|
-
/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i // Ecosia/Weibo
|
|
1471
|
-
], [NAME, VERSION], [
|
|
1472
|
-
/quark(?:pc)?\/([-\w\.]+)/i // Quark
|
|
1473
|
-
], [VERSION, [NAME, 'Quark']], [
|
|
1474
|
-
/\bddg\/([\w\.]+)/i // DuckDuckGo
|
|
1475
|
-
], [VERSION, [NAME, 'DuckDuckGo']], [
|
|
1476
|
-
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
|
|
1477
|
-
], [VERSION, [NAME, 'UCBrowser']], [
|
|
1478
|
-
/microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser
|
|
1479
|
-
/\bqbcore\/([\w\.]+).+microm/i,
|
|
1480
|
-
/micromessenger\/([\w\.]+)/i // WeChat
|
|
1481
|
-
], [VERSION, [NAME, 'WeChat']], [
|
|
1482
|
-
/konqueror\/([\w\.]+)/i // Konqueror
|
|
1483
|
-
], [VERSION, [NAME, 'Konqueror']], [
|
|
1484
|
-
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
|
|
1485
|
-
], [VERSION, [NAME, 'IE']], [
|
|
1486
|
-
/ya(?:search)?browser\/([\w\.]+)/i // Yandex
|
|
1487
|
-
], [VERSION, [NAME, 'Yandex']], [
|
|
1488
|
-
/slbrowser\/([\w\.]+)/i // Smart Lenovo Browser
|
|
1489
|
-
], [VERSION, [NAME, 'Smart ' + LENOVO + SUFFIX_BROWSER]], [
|
|
1490
|
-
/(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
|
|
1491
|
-
], [[NAME, /(.+)/, '$1 Secure' + SUFFIX_BROWSER], VERSION], [
|
|
1492
|
-
/\bfocus\/([\w\.]+)/i // Firefox Focus
|
|
1493
|
-
], [VERSION, [NAME, FIREFOX+' Focus']], [
|
|
1494
|
-
/\bopt\/([\w\.]+)/i // Opera Touch
|
|
1495
|
-
], [VERSION, [NAME, OPERA+' Touch']], [
|
|
1496
|
-
/coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
|
|
1497
|
-
], [VERSION, [NAME, 'Coc Coc']], [
|
|
1498
|
-
/dolfin\/([\w\.]+)/i // Dolphin
|
|
1499
|
-
], [VERSION, [NAME, 'Dolphin']], [
|
|
1500
|
-
/coast\/([\w\.]+)/i // Opera Coast
|
|
1501
|
-
], [VERSION, [NAME, OPERA+' Coast']], [
|
|
1502
|
-
/miuibrowser\/([\w\.]+)/i // MIUI Browser
|
|
1503
|
-
], [VERSION, [NAME, 'MIUI' + SUFFIX_BROWSER]], [
|
|
1504
|
-
/fxios\/([\w\.-]+)/i // Firefox for iOS
|
|
1505
|
-
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
|
|
1506
|
-
/\bqihoobrowser\/?([\w\.]*)/i // 360
|
|
1507
|
-
], [VERSION, [NAME, '360']], [
|
|
1508
|
-
/\b(qq)\/([\w\.]+)/i // QQ
|
|
1509
|
-
], [[NAME, /(.+)/, '$1Browser'], VERSION], [
|
|
1510
|
-
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
|
|
1511
|
-
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
|
|
1512
|
-
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
|
|
1513
|
-
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
|
|
1514
|
-
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
|
|
1515
|
-
], [VERSION, [NAME, SOGOU + ' Explorer']], [
|
|
1516
|
-
/(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
|
|
1517
|
-
], [[NAME, SOGOU + ' Mobile'], VERSION], [
|
|
1518
|
-
/(electron)\/([\w\.]+) safari/i, // Electron-based App
|
|
1519
|
-
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
|
|
1520
|
-
/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345
|
|
1521
|
-
], [NAME, VERSION], [
|
|
1522
|
-
/(lbbrowser|rekonq)/i // LieBao Browser/Rekonq
|
|
1523
|
-
], [NAME], [
|
|
1524
|
-
/ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron
|
|
1525
|
-
/ome\/([\w\.]+).+qihu (360)[es]e/i // 360
|
|
1526
|
-
], [VERSION, NAME], [
|
|
1527
|
-
|
|
1528
|
-
// WebView
|
|
1529
|
-
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
|
|
1530
|
-
], [[NAME, FACEBOOK], VERSION, [TYPE, INAPP]], [
|
|
1531
|
-
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
|
|
1532
|
-
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
|
|
1533
|
-
/(daum)apps[\/ ]([\w\.]+)/i, // Daum App
|
|
1534
|
-
/safari (line)\/([\w\.]+)/i, // Line App for iOS
|
|
1535
|
-
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
|
|
1536
|
-
/(alipay)client\/([\w\.]+)/i, // Alipay
|
|
1537
|
-
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
|
|
1538
|
-
/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i // Instagram/Snapchat/Klarna
|
|
1539
|
-
], [NAME, VERSION, [TYPE, INAPP]], [
|
|
1540
|
-
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
|
|
1541
|
-
], [VERSION, [NAME, 'GSA'], [TYPE, INAPP]], [
|
|
1542
|
-
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
|
|
1543
|
-
], [VERSION, [NAME, 'TikTok'], [TYPE, INAPP]], [
|
|
1544
|
-
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
|
|
1545
|
-
], [NAME, [TYPE, INAPP]], [
|
|
1546
|
-
|
|
1547
|
-
/(chromium)[\/ ]([-\w\.]+)/i // Chromium
|
|
1548
|
-
], [NAME, VERSION], [
|
|
1549
|
-
|
|
1550
|
-
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
|
|
1551
|
-
], [VERSION, [NAME, CHROME+' Headless']], [
|
|
1552
|
-
|
|
1553
|
-
/wv\).+chrome\/([\w\.]+).+edgw\//i // Edge WebView2
|
|
1554
|
-
], [VERSION, [NAME, EDGE+' WebView2']], [
|
|
1555
|
-
|
|
1556
|
-
/ wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
|
|
1557
|
-
], [[NAME, CHROME+' WebView'], VERSION], [
|
|
1558
|
-
|
|
1559
|
-
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
|
|
1560
|
-
], [VERSION, [NAME, 'Android' + SUFFIX_BROWSER]], [
|
|
1561
|
-
|
|
1562
|
-
/chrome\/([\w\.]+) mobile/i // Chrome Mobile
|
|
1563
|
-
], [VERSION, [NAME, PREFIX_MOBILE + 'Chrome']], [
|
|
1564
|
-
|
|
1565
|
-
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
|
|
1566
|
-
], [NAME, VERSION], [
|
|
1567
|
-
|
|
1568
|
-
/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile
|
|
1569
|
-
], [VERSION, [NAME, PREFIX_MOBILE + 'Safari']], [
|
|
1570
|
-
/iphone .*mobile(?:\/\w+ | ?)safari/i
|
|
1571
|
-
], [[NAME, PREFIX_MOBILE + 'Safari']], [
|
|
1572
|
-
/version\/([\w\.\,]+) .*(safari)/i // Safari
|
|
1573
|
-
], [VERSION, NAME], [
|
|
1574
|
-
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
|
|
1575
|
-
], [NAME, [VERSION, '1']], [
|
|
1576
|
-
|
|
1577
|
-
/(webkit|khtml)\/([\w\.]+)/i
|
|
1578
|
-
], [NAME, VERSION], [
|
|
1579
|
-
|
|
1580
|
-
// Gecko based
|
|
1581
|
-
/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile
|
|
1582
|
-
], [[NAME, PREFIX_MOBILE + FIREFOX], VERSION], [
|
|
1583
|
-
/(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
|
|
1584
|
-
], [[NAME, 'Netscape'], VERSION], [
|
|
1585
|
-
/(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf
|
|
1586
|
-
], [NAME, VERSION], [
|
|
1587
|
-
/mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
|
|
1588
|
-
], [VERSION, [NAME, FIREFOX+' Reality']], [
|
|
1589
|
-
/ekiohf.+(flow)\/([\w\.]+)/i, // Flow
|
|
1590
|
-
/(swiftfox)/i, // Swiftfox
|
|
1591
|
-
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,
|
|
1592
|
-
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
|
|
1593
|
-
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
|
|
1594
|
-
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
|
1595
|
-
/(firefox)\/([\w\.]+)/i, // Other Firefox-based
|
|
1596
|
-
/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla
|
|
1597
|
-
|
|
1598
|
-
// Other
|
|
1599
|
-
/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
|
|
1600
|
-
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird
|
|
1601
|
-
/\b(links) \(([\w\.]+)/i // Links
|
|
1602
|
-
], [NAME, [VERSION, /_/g, '.']], [
|
|
1603
|
-
|
|
1604
|
-
/(cobalt)\/([\w\.]+)/i // Cobalt
|
|
1605
|
-
], [NAME, [VERSION, /[^\d\.]+./, EMPTY]]
|
|
1606
|
-
],
|
|
1607
|
-
|
|
1608
|
-
cpu : [[
|
|
1609
|
-
|
|
1610
|
-
/\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64)
|
|
1611
|
-
], [[ARCHITECTURE, 'amd64']], [
|
|
1612
|
-
|
|
1613
|
-
/(ia32(?=;))/i, // IA32 (quicktime)
|
|
1614
|
-
/\b((i[346]|x)86)(pc)?\b/i // IA32 (x86)
|
|
1615
|
-
], [[ARCHITECTURE, 'ia32']], [
|
|
1616
|
-
|
|
1617
|
-
/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64
|
|
1618
|
-
], [[ARCHITECTURE, 'arm64']], [
|
|
1619
|
-
|
|
1620
|
-
/\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF
|
|
1621
|
-
], [[ARCHITECTURE, 'armhf']], [
|
|
1622
|
-
|
|
1623
|
-
// PocketPC mistakenly identified as PowerPC
|
|
1624
|
-
/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i
|
|
1625
|
-
], [[ARCHITECTURE, 'arm']], [
|
|
1626
|
-
|
|
1627
|
-
/((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC
|
|
1628
|
-
], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [
|
|
1629
|
-
|
|
1630
|
-
/ sun4\w[;\)]/i // SPARC
|
|
1631
|
-
], [[ARCHITECTURE, 'sparc']], [
|
|
1632
|
-
|
|
1633
|
-
/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i
|
|
1634
|
-
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
|
|
1635
|
-
], [[ARCHITECTURE, lowerize]]
|
|
1636
|
-
],
|
|
1637
|
-
|
|
1638
|
-
device : [[
|
|
1639
|
-
|
|
1640
|
-
//////////////////////////
|
|
1641
|
-
// MOBILES & TABLETS
|
|
1642
|
-
/////////////////////////
|
|
1643
|
-
|
|
1644
|
-
// Samsung
|
|
1645
|
-
/\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
|
|
1646
|
-
], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
|
|
1647
|
-
/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
|
|
1648
|
-
/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,
|
|
1649
|
-
/sec-(sgh\w+)/i
|
|
1650
|
-
], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
|
|
1651
|
-
|
|
1652
|
-
// Apple
|
|
1653
|
-
/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone
|
|
1654
|
-
], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
|
|
1655
|
-
/\((ipad);[-\w\),; ]+apple/i, // iPad
|
|
1656
|
-
/applecoremedia\/[\w\.]+ \((ipad)/i,
|
|
1657
|
-
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
|
|
1658
|
-
], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
|
|
1659
|
-
/(macintosh);/i
|
|
1660
|
-
], [MODEL, [VENDOR, APPLE]], [
|
|
1661
|
-
|
|
1662
|
-
// Sharp
|
|
1663
|
-
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
|
|
1664
|
-
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
|
|
1665
|
-
|
|
1666
|
-
// Honor
|
|
1667
|
-
/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i
|
|
1668
|
-
], [MODEL, [VENDOR, HONOR], [TYPE, TABLET]], [
|
|
1669
|
-
/honor([-\w ]+)[;\)]/i
|
|
1670
|
-
], [MODEL, [VENDOR, HONOR], [TYPE, MOBILE]], [
|
|
1671
|
-
|
|
1672
|
-
// Huawei
|
|
1673
|
-
/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i
|
|
1674
|
-
], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
|
|
1675
|
-
/(?:huawei)([-\w ]+)[;\)]/i,
|
|
1676
|
-
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
|
|
1677
|
-
], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
|
|
1678
|
-
|
|
1679
|
-
// Xiaomi
|
|
1680
|
-
/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,
|
|
1681
|
-
/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i // Mi Pad tablets
|
|
1682
|
-
],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
|
|
1683
|
-
|
|
1684
|
-
/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO
|
|
1685
|
-
/\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
|
|
1686
|
-
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
|
|
1687
|
-
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
|
|
1688
|
-
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
|
|
1689
|
-
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, // Xiaomi Mi
|
|
1690
|
-
/ ([\w ]+) miui\/v?\d/i
|
|
1691
|
-
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
|
|
1692
|
-
|
|
1693
|
-
// OnePlus
|
|
1694
|
-
/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,
|
|
1695
|
-
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
|
|
1696
|
-
], [MODEL, [VENDOR, ONEPLUS], [TYPE, MOBILE]], [
|
|
1697
|
-
|
|
1698
|
-
// OPPO
|
|
1699
|
-
/; (\w+) bui.+ oppo/i,
|
|
1700
|
-
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
|
|
1701
|
-
], [MODEL, [VENDOR, OPPO], [TYPE, MOBILE]], [
|
|
1702
|
-
/\b(opd2(\d{3}a?))(?: bui|\))/i
|
|
1703
|
-
], [MODEL, [VENDOR, strMapper, { 'OnePlus' : ['203', '304', '403', '404', '413', '415'], '*' : OPPO }], [TYPE, TABLET]], [
|
|
1704
|
-
|
|
1705
|
-
// BLU
|
|
1706
|
-
/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i // Vivo series
|
|
1707
|
-
], [MODEL, [VENDOR, 'BLU'], [TYPE, MOBILE]], [
|
|
1708
|
-
|
|
1709
|
-
// Vivo
|
|
1710
|
-
/; vivo (\w+)(?: bui|\))/i,
|
|
1711
|
-
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
|
|
1712
|
-
], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [
|
|
1713
|
-
|
|
1714
|
-
// Realme
|
|
1715
|
-
/\b(rmx[1-3]\d{3})(?: bui|;|\))/i
|
|
1716
|
-
], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [
|
|
1717
|
-
|
|
1718
|
-
// Lenovo
|
|
1719
|
-
/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,
|
|
1720
|
-
/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i
|
|
1721
|
-
], [MODEL, [VENDOR, LENOVO], [TYPE, TABLET]], [
|
|
1722
|
-
/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i
|
|
1723
|
-
], [MODEL, [VENDOR, LENOVO], [TYPE, MOBILE]], [
|
|
1724
|
-
|
|
1725
|
-
// Motorola
|
|
1726
|
-
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
|
|
1727
|
-
/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,
|
|
1728
|
-
/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i
|
|
1729
|
-
], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
|
|
1730
|
-
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
|
|
1731
|
-
], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
|
|
1732
|
-
|
|
1733
|
-
// LG
|
|
1734
|
-
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
|
|
1735
|
-
], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
|
|
1736
|
-
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
|
|
1737
|
-
/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,
|
|
1738
|
-
/\blg-?([\d\w]+) bui/i
|
|
1739
|
-
], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [
|
|
1740
|
-
|
|
1741
|
-
// Nokia
|
|
1742
|
-
/(nokia) (t[12][01])/i
|
|
1743
|
-
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
|
1744
|
-
/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,
|
|
1745
|
-
/nokia[-_ ]?(([-\w\. ]*))/i
|
|
1746
|
-
], [[MODEL, /_/g, ' '], [TYPE, MOBILE], [VENDOR, 'Nokia']], [
|
|
1747
|
-
|
|
1748
|
-
// Google
|
|
1749
|
-
/(pixel (c|tablet))\b/i // Google Pixel C/Tablet
|
|
1750
|
-
], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
|
|
1751
|
-
// Google Pixel
|
|
1752
|
-
/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i
|
|
1753
|
-
], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
|
|
1754
|
-
/(google) (pixelbook( go)?)/i
|
|
1755
|
-
], [VENDOR, MODEL], [
|
|
1756
|
-
|
|
1757
|
-
// Sony
|
|
1758
|
-
/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
|
|
1759
|
-
], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
|
|
1760
|
-
/sony tablet [ps]/i,
|
|
1761
|
-
/\b(?:sony)?sgp\w+(?: bui|\))/i
|
|
1762
|
-
], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
|
|
1763
|
-
|
|
1764
|
-
// Amazon
|
|
1765
|
-
/(alexa)webm/i,
|
|
1766
|
-
/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, // Kindle Fire without Silk / Echo Show
|
|
1767
|
-
/(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
|
|
1768
|
-
], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
|
|
1769
|
-
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
|
|
1770
|
-
], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [
|
|
1771
|
-
|
|
1772
|
-
// BlackBerry
|
|
1773
|
-
/(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook
|
|
1774
|
-
], [MODEL, VENDOR, [TYPE, TABLET]], [
|
|
1775
|
-
/\b((?:bb[a-f]|st[hv])100-\d)/i,
|
|
1776
|
-
/\(bb10; (\w+)/i // BlackBerry 10
|
|
1777
|
-
], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [
|
|
1778
|
-
|
|
1779
|
-
// Asus
|
|
1780
|
-
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
|
|
1781
|
-
], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
|
|
1782
|
-
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
|
|
1783
|
-
], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [
|
|
1784
|
-
|
|
1785
|
-
// HTC
|
|
1786
|
-
/(nexus 9)/i // HTC Nexus 9
|
|
1787
|
-
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
|
|
1788
|
-
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC
|
|
1789
|
-
|
|
1790
|
-
// ZTE
|
|
1791
|
-
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
|
|
1792
|
-
/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
|
1793
|
-
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
|
1794
|
-
|
|
1795
|
-
// TCL
|
|
1796
|
-
/tcl (xess p17aa)/i,
|
|
1797
|
-
/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i
|
|
1798
|
-
], [MODEL, [VENDOR, 'TCL'], [TYPE, TABLET]], [
|
|
1799
|
-
/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i
|
|
1800
|
-
], [MODEL, [VENDOR, 'TCL'], [TYPE, MOBILE]], [
|
|
1801
|
-
|
|
1802
|
-
// itel
|
|
1803
|
-
/(itel) ((\w+))/i
|
|
1804
|
-
], [[VENDOR, lowerize], MODEL, [TYPE, strMapper, { 'tablet' : ['p10001l', 'w7001'], '*' : 'mobile' }]], [
|
|
1805
|
-
|
|
1806
|
-
// Acer
|
|
1807
|
-
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
|
|
1808
|
-
], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
|
|
1809
|
-
|
|
1810
|
-
// Meizu
|
|
1811
|
-
/droid.+; (m[1-5] note) bui/i,
|
|
1812
|
-
/\bmz-([-\w]{2,})/i
|
|
1813
|
-
], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
|
|
1814
|
-
|
|
1815
|
-
// Ulefone
|
|
1816
|
-
/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
|
|
1817
|
-
], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [
|
|
1818
|
-
|
|
1819
|
-
// Energizer
|
|
1820
|
-
/; (energy ?\w+)(?: bui|\))/i,
|
|
1821
|
-
/; energizer ([\w ]+)(?: bui|\))/i
|
|
1822
|
-
], [MODEL, [VENDOR, 'Energizer'], [TYPE, MOBILE]], [
|
|
1823
|
-
|
|
1824
|
-
// Cat
|
|
1825
|
-
/; cat (b35);/i,
|
|
1826
|
-
/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
|
|
1827
|
-
], [MODEL, [VENDOR, 'Cat'], [TYPE, MOBILE]], [
|
|
1828
|
-
|
|
1829
|
-
// Smartfren
|
|
1830
|
-
/((?:new )?andromax[\w- ]+)(?: bui|\))/i
|
|
1831
|
-
], [MODEL, [VENDOR, 'Smartfren'], [TYPE, MOBILE]], [
|
|
1832
|
-
|
|
1833
|
-
// Nothing
|
|
1834
|
-
/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i
|
|
1835
|
-
], [MODEL, [VENDOR, 'Nothing'], [TYPE, MOBILE]], [
|
|
1836
|
-
|
|
1837
|
-
// Archos
|
|
1838
|
-
/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,
|
|
1839
|
-
/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i
|
|
1840
|
-
], [MODEL, [VENDOR, 'Archos'], [TYPE, TABLET]], [
|
|
1841
|
-
/archos ([\w ]+)( b|\))/i,
|
|
1842
|
-
/; (ac[3-6]\d\w{2,8})( b|\))/i
|
|
1843
|
-
], [MODEL, [VENDOR, 'Archos'], [TYPE, MOBILE]], [
|
|
1844
|
-
|
|
1845
|
-
// HMD
|
|
1846
|
-
/; (n159v)/i
|
|
1847
|
-
], [MODEL, [VENDOR, 'HMD'], [TYPE, MOBILE]], [
|
|
1848
|
-
|
|
1849
|
-
// MIXED
|
|
1850
|
-
/(imo) (tab \w+)/i, // IMO
|
|
1851
|
-
/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i // Infinix XPad / Tecno
|
|
1852
|
-
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
|
1853
|
-
|
|
1854
|
-
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
|
|
1855
|
-
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Tecno/Micromax/Advan
|
|
1856
|
-
/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, // BLU/HMD/IMO/Infinix/Lava/OnePlus/TCL
|
|
1857
|
-
/(hp) ([\w ]+\w)/i, // HP iPAQ
|
|
1858
|
-
/(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
|
|
1859
|
-
/(oppo) ?([\w ]+) bui/i // OPPO
|
|
1860
|
-
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
|
1861
|
-
|
|
1862
|
-
/(kobo)\s(ereader|touch)/i, // Kobo
|
|
1863
|
-
/(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
|
|
1864
|
-
/(kindle)\/([\w\.]+)/i // Kindle
|
|
1865
|
-
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
|
1866
|
-
|
|
1867
|
-
/(surface duo)/i // Surface Duo
|
|
1868
|
-
], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
|
|
1869
|
-
/droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone
|
|
1870
|
-
], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
|
|
1871
|
-
/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets
|
|
1872
|
-
], [MODEL, [VENDOR, NVIDIA], [TYPE, TABLET]], [
|
|
1873
|
-
/(sprint) (\w+)/i // Sprint Phones
|
|
1874
|
-
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
|
1875
|
-
/(kin\.[onetw]{3})/i // Microsoft Kin
|
|
1876
|
-
], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
|
|
1877
|
-
/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra
|
|
1878
|
-
], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
|
|
1879
|
-
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
|
|
1880
|
-
], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [
|
|
1881
|
-
|
|
1882
|
-
///////////////////
|
|
1883
|
-
// SMARTTVS
|
|
1884
|
-
///////////////////
|
|
1885
|
-
|
|
1886
|
-
/smart-tv.+(samsung)/i // Samsung
|
|
1887
|
-
], [VENDOR, [TYPE, SMARTTV]], [
|
|
1888
|
-
/hbbtv.+maple;(\d+)/i
|
|
1889
|
-
], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
|
|
1890
|
-
/(vizio)(?: |.+model\/)(\w+-\w+)/i, // Vizio
|
|
1891
|
-
/tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV
|
|
1892
|
-
], [VENDOR, MODEL, [TYPE, SMARTTV]], [
|
|
1893
|
-
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
|
|
1894
|
-
], [[VENDOR, LG], [TYPE, SMARTTV]], [
|
|
1895
|
-
/(apple) ?tv/i // Apple TV
|
|
1896
|
-
], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
|
|
1897
|
-
/crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation
|
|
1898
|
-
], [[MODEL, CHROMECAST+' Third Generation'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
|
1899
|
-
/crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type
|
|
1900
|
-
], [[MODEL, /^/, 'Chromecast '], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
|
1901
|
-
/fuchsia.*crkey/i // Google Chromecast Nest Hub
|
|
1902
|
-
], [[MODEL, CHROMECAST+' Nest Hub'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
|
1903
|
-
/crkey/i // Google Chromecast, Linux-based or unknown
|
|
1904
|
-
], [[MODEL, CHROMECAST], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
|
|
1905
|
-
/(portaltv)/i // Facebook Portal TV
|
|
1906
|
-
], [MODEL, [VENDOR, FACEBOOK], [TYPE, SMARTTV]], [
|
|
1907
|
-
/droid.+aft(\w+)( bui|\))/i // Fire TV
|
|
1908
|
-
], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
|
|
1909
|
-
/(shield \w+ tv)/i // Nvidia Shield TV
|
|
1910
|
-
], [MODEL, [VENDOR, NVIDIA], [TYPE, SMARTTV]], [
|
|
1911
|
-
/\(dtv[\);].+(aquos)/i,
|
|
1912
|
-
/(aquos-tv[\w ]+)\)/i // Sharp
|
|
1913
|
-
], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
|
|
1914
|
-
/(bravia[\w ]+)( bui|\))/i // Sony
|
|
1915
|
-
], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
|
|
1916
|
-
/(mi(tv|box)-?\w+) bui/i // Xiaomi
|
|
1917
|
-
], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
|
|
1918
|
-
/Hbbtv.*(technisat) (.*);/i // TechniSAT
|
|
1919
|
-
], [VENDOR, MODEL, [TYPE, SMARTTV]], [
|
|
1920
|
-
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
|
|
1921
|
-
/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices
|
|
1922
|
-
], [[VENDOR, /.+\/(\w+)/, '$1', strMapper, {'LG':'lge'}], [MODEL, trim], [TYPE, SMARTTV]], [
|
|
1923
|
-
// SmartTV from Unidentified Vendors
|
|
1924
|
-
/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i
|
|
1925
|
-
], [MODEL, [TYPE, SMARTTV]], [
|
|
1926
|
-
/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i
|
|
1927
|
-
], [[TYPE, SMARTTV]], [
|
|
1928
|
-
|
|
1929
|
-
///////////////////
|
|
1930
|
-
// CONSOLES
|
|
1931
|
-
///////////////////
|
|
1932
|
-
|
|
1933
|
-
/(playstation \w+)/i // Playstation
|
|
1934
|
-
], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
|
|
1935
|
-
/\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox
|
|
1936
|
-
], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [
|
|
1937
|
-
/(ouya)/i, // Ouya
|
|
1938
|
-
/(nintendo) (\w+)/i, // Nintendo
|
|
1939
|
-
/(retroid) (pocket ([^\)]+))/i // Retroid Pocket
|
|
1940
|
-
], [VENDOR, MODEL, [TYPE, CONSOLE]], [
|
|
1941
|
-
/droid.+; (shield)( bui|\))/i // Nvidia Portable
|
|
1942
|
-
], [MODEL, [VENDOR, NVIDIA], [TYPE, CONSOLE]], [
|
|
1943
|
-
|
|
1944
|
-
///////////////////
|
|
1945
|
-
// WEARABLES
|
|
1946
|
-
///////////////////
|
|
1947
|
-
|
|
1948
|
-
/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch
|
|
1949
|
-
], [MODEL, [VENDOR, SAMSUNG], [TYPE, WEARABLE]], [
|
|
1950
|
-
/((pebble))app/i, // Pebble
|
|
1951
|
-
/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch
|
|
1952
|
-
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
|
|
1953
|
-
/(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch
|
|
1954
|
-
], [MODEL, [VENDOR, OPPO], [TYPE, WEARABLE]], [
|
|
1955
|
-
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
|
|
1956
|
-
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
|
|
1957
|
-
/(opwwe\d{3})/i // OnePlus Watch
|
|
1958
|
-
], [MODEL, [VENDOR, ONEPLUS], [TYPE, WEARABLE]], [
|
|
1959
|
-
/(moto 360)/i // Motorola 360
|
|
1960
|
-
], [MODEL, [VENDOR, MOTOROLA], [TYPE, WEARABLE]], [
|
|
1961
|
-
/(smartwatch 3)/i // Sony SmartWatch
|
|
1962
|
-
], [MODEL, [VENDOR, SONY], [TYPE, WEARABLE]], [
|
|
1963
|
-
/(g watch r)/i // LG G Watch R
|
|
1964
|
-
], [MODEL, [VENDOR, LG], [TYPE, WEARABLE]], [
|
|
1965
|
-
/droid.+; (wt63?0{2,3})\)/i
|
|
1966
|
-
], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
|
|
1967
|
-
|
|
1968
|
-
///////////////////
|
|
1969
|
-
// XR
|
|
1970
|
-
///////////////////
|
|
1971
|
-
|
|
1972
|
-
/droid.+; (glass) \d/i // Google Glass
|
|
1973
|
-
], [MODEL, [VENDOR, GOOGLE], [TYPE, XR]], [
|
|
1974
|
-
/(pico) (4|neo3(?: link|pro)?)/i // Pico
|
|
1975
|
-
], [VENDOR, MODEL, [TYPE, XR]], [
|
|
1976
|
-
/(quest( \d| pro)?s?).+vr/i // Meta Quest
|
|
1977
|
-
], [MODEL, [VENDOR, FACEBOOK], [TYPE, XR]], [
|
|
1978
|
-
/mobile vr; rv.+firefox/i // Unidentifiable VR device using Firefox Reality / Wolvic
|
|
1979
|
-
], [[TYPE, XR]], [
|
|
1980
|
-
|
|
1981
|
-
///////////////////
|
|
1982
|
-
// EMBEDDED
|
|
1983
|
-
///////////////////
|
|
1984
|
-
|
|
1985
|
-
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
|
|
1986
|
-
], [VENDOR, [TYPE, EMBEDDED]], [
|
|
1987
|
-
/(aeobc)\b/i // Echo Dot
|
|
1988
|
-
], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
|
|
1989
|
-
/(homepod).+mac os/i // Apple HomePod
|
|
1990
|
-
], [MODEL, [VENDOR, APPLE], [TYPE, EMBEDDED]], [
|
|
1991
|
-
/windows iot/i // Unidentifiable embedded device using Windows IoT
|
|
1992
|
-
], [[TYPE, EMBEDDED]], [
|
|
1993
|
-
|
|
1994
|
-
////////////////////
|
|
1995
|
-
// MIXED (GENERIC)
|
|
1996
|
-
///////////////////
|
|
1997
|
-
|
|
1998
|
-
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i
|
|
1999
|
-
], [MODEL, [TYPE, strMapper, { 'mobile' : 'Mobile', 'xr' : 'VR', '*' : TABLET }]], [
|
|
2000
|
-
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
|
|
2001
|
-
], [[TYPE, TABLET]], [
|
|
2002
|
-
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
|
|
2003
|
-
], [[TYPE, MOBILE]], [
|
|
2004
|
-
/droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device
|
|
2005
|
-
], [MODEL, [VENDOR, 'Generic']]
|
|
2006
|
-
],
|
|
2007
|
-
|
|
2008
|
-
engine : [[
|
|
2009
|
-
|
|
2010
|
-
/windows.+ edge\/([\w\.]+)/i // EdgeHTML
|
|
2011
|
-
], [VERSION, [NAME, EDGE+'HTML']], [
|
|
2012
|
-
|
|
2013
|
-
/(arkweb)\/([\w\.]+)/i // ArkWeb
|
|
2014
|
-
], [NAME, VERSION], [
|
|
2015
|
-
|
|
2016
|
-
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
|
|
2017
|
-
], [VERSION, [NAME, 'Blink']], [
|
|
2018
|
-
|
|
2019
|
-
/(presto)\/([\w\.]+)/i, // Presto
|
|
2020
|
-
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
|
|
2021
|
-
/ekioh(flow)\/([\w\.]+)/i, // Flow
|
|
2022
|
-
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
|
|
2023
|
-
/(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
|
|
2024
|
-
|
|
2025
|
-
/\b(libweb)/i // LibWeb
|
|
2026
|
-
], [NAME, VERSION], [
|
|
2027
|
-
/ladybird\//i
|
|
2028
|
-
], [[NAME, 'LibWeb']], [
|
|
2029
|
-
|
|
2030
|
-
/rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
|
|
2031
|
-
], [VERSION, NAME]
|
|
2032
|
-
],
|
|
2033
|
-
|
|
2034
|
-
os : [[
|
|
2035
|
-
|
|
2036
|
-
// Windows
|
|
2037
|
-
/(windows nt) (6\.[23]); arm/i // Windows RT
|
|
2038
|
-
], [[NAME, /N/, 'R'], [VERSION, strMapper, windowsVersionMap]], [
|
|
2039
|
-
/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i, // Windows IoT/Mobile/Phone
|
|
2040
|
-
// Windows NT/3.1/95/98/ME/2000/XP/Vista/7/8/8.1/10/11
|
|
2041
|
-
/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i
|
|
2042
|
-
], [NAME, VERSION], [
|
|
2043
|
-
/windows nt ?([\d\.\)]*)(?!.+xbox)/i,
|
|
2044
|
-
/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i
|
|
2045
|
-
], [[VERSION, /(;|\))/g, '', strMapper, windowsVersionMap], [NAME, WINDOWS]], [
|
|
2046
|
-
/(windows ce)\/?([\d\.]*)/i // Windows CE
|
|
2047
|
-
], [NAME, VERSION], [
|
|
2048
|
-
|
|
2049
|
-
// iOS/macOS
|
|
2050
|
-
/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
|
|
2051
|
-
/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
|
|
2052
|
-
/cfnetwork\/.+darwin/i
|
|
2053
|
-
], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
|
|
2054
|
-
/(mac os x) ?([\w\. ]*)/i,
|
|
2055
|
-
/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i // Mac OS
|
|
2056
|
-
], [[NAME, 'macOS'], [VERSION, /_/g, '.']], [
|
|
2057
|
-
|
|
2058
|
-
// Google Chromecast
|
|
2059
|
-
/android ([\d\.]+).*crkey/i // Google Chromecast, Android-based
|
|
2060
|
-
], [VERSION, [NAME, CHROMECAST + ' Android']], [
|
|
2061
|
-
/fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based
|
|
2062
|
-
], [VERSION, [NAME, CHROMECAST + ' Fuchsia']], [
|
|
2063
|
-
/crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker
|
|
2064
|
-
], [VERSION, [NAME, CHROMECAST + ' SmartSpeaker']], [
|
|
2065
|
-
/linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based
|
|
2066
|
-
], [VERSION, [NAME, CHROMECAST + ' Linux']], [
|
|
2067
|
-
/crkey\/([\d\.]+)/i // Google Chromecast, unknown
|
|
2068
|
-
], [VERSION, [NAME, CHROMECAST]], [
|
|
2069
|
-
|
|
2070
|
-
// Mobile OSes
|
|
2071
|
-
/droid ([\w\.]+)\b.+(android[- ]x86)/i // Android-x86
|
|
2072
|
-
], [VERSION, NAME], [
|
|
2073
|
-
/(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch
|
|
2074
|
-
], [[NAME, /(.+)/, '$1 Touch'], VERSION], [
|
|
2075
|
-
/(harmonyos)[\/ ]?([\d\.]*)/i, // HarmonyOS
|
|
2076
|
-
// Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen
|
|
2077
|
-
/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i
|
|
2078
|
-
], [NAME, VERSION], [
|
|
2079
|
-
/\(bb(10);/i // BlackBerry 10
|
|
2080
|
-
], [VERSION, [NAME, BLACKBERRY]], [
|
|
2081
|
-
/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian
|
|
2082
|
-
], [VERSION, [NAME, 'Symbian']], [
|
|
2083
|
-
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
|
|
2084
|
-
], [VERSION, [NAME, FIREFOX+' OS']], [
|
|
2085
|
-
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i, // WebOS
|
|
2086
|
-
/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i
|
|
2087
|
-
], [VERSION, [NAME, 'webOS']], [
|
|
2088
|
-
/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i
|
|
2089
|
-
// https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine
|
|
2090
|
-
], [[VERSION, strMapper, {'25':'120','24':'108','23':'94','22':'87','6':'79','5':'68','4':'53','3':'38','2':'538','1':'537','*':'TV'}], [NAME, 'webOS']], [
|
|
2091
|
-
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
|
|
2092
|
-
], [VERSION, [NAME, 'watchOS']], [
|
|
2093
|
-
|
|
2094
|
-
// Google ChromeOS
|
|
2095
|
-
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
|
|
2096
|
-
], [[NAME, "Chrome OS"], VERSION],[
|
|
2097
|
-
|
|
2098
|
-
// Smart TVs
|
|
2099
|
-
/panasonic;(viera)/i, // Panasonic Viera
|
|
2100
|
-
/(netrange)mmh/i, // Netrange
|
|
2101
|
-
/(nettv)\/(\d+\.[\w\.]+)/i, // NetTV
|
|
2102
|
-
|
|
2103
|
-
// Console
|
|
2104
|
-
/(nintendo|playstation) (\w+)/i, // Nintendo/Playstation
|
|
2105
|
-
/(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)
|
|
2106
|
-
/(pico) .+os([\w\.]+)/i, // Pico
|
|
2107
|
-
|
|
2108
|
-
// Other
|
|
2109
|
-
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm
|
|
2110
|
-
/linux.+(mint)[\/\(\) ]?([\w\.]*)/i, // Mint
|
|
2111
|
-
/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i, // Mageia/VectorLinux/Fuchsia/ArcaOS/Arch
|
|
2112
|
-
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
|
|
2113
|
-
// Ubuntu/Debian/SUSE/Gentoo/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire/Knoppix
|
|
2114
|
-
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
|
|
2115
|
-
/\b(aix)[; ]([1-9\.]{0,4})/i, // AIX
|
|
2116
|
-
/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i, // Hurd/Linux/MorphOS
|
|
2117
|
-
/(gnu) ?([\w\.]*)/i, // GNU
|
|
2118
|
-
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
|
|
2119
|
-
/(haiku) ?(r\d)?/i // Haiku
|
|
2120
|
-
], [NAME, VERSION], [
|
|
2121
|
-
/(sunos) ?([\d\.]*)/i // Solaris
|
|
2122
|
-
], [[NAME, 'Solaris'], VERSION], [
|
|
2123
|
-
/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/OpenVMS/HP-UX/SerenityOS
|
|
2124
|
-
/(unix) ?([\w\.]*)/i // UNIX
|
|
2125
|
-
], [NAME, VERSION]
|
|
2126
|
-
]
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
|
-
/////////////////
|
|
2130
|
-
// Factories
|
|
2131
|
-
////////////////
|
|
2132
|
-
|
|
2133
|
-
var defaultProps = (function () {
|
|
2134
|
-
var props = { init : {}, isIgnore : {}, isIgnoreRgx : {}, toString : {}};
|
|
2135
|
-
setProps.call(props.init, [
|
|
2136
|
-
[UA_BROWSER, [NAME, VERSION, MAJOR, TYPE]],
|
|
2137
|
-
[UA_CPU, [ARCHITECTURE]],
|
|
2138
|
-
[UA_DEVICE, [TYPE, MODEL, VENDOR]],
|
|
2139
|
-
[UA_ENGINE, [NAME, VERSION]],
|
|
2140
|
-
[UA_OS, [NAME, VERSION]]
|
|
2141
|
-
]);
|
|
2142
|
-
setProps.call(props.isIgnore, [
|
|
2143
|
-
[UA_BROWSER, [VERSION, MAJOR]],
|
|
2144
|
-
[UA_ENGINE, [VERSION]],
|
|
2145
|
-
[UA_OS, [VERSION]]
|
|
2146
|
-
]);
|
|
2147
|
-
setProps.call(props.isIgnoreRgx, [
|
|
2148
|
-
[UA_BROWSER, / ?browser$/i],
|
|
2149
|
-
[UA_OS, / ?os$/i]
|
|
2150
|
-
]);
|
|
2151
|
-
setProps.call(props.toString, [
|
|
2152
|
-
[UA_BROWSER, [NAME, VERSION]],
|
|
2153
|
-
[UA_CPU, [ARCHITECTURE]],
|
|
2154
|
-
[UA_DEVICE, [VENDOR, MODEL]],
|
|
2155
|
-
[UA_ENGINE, [NAME, VERSION]],
|
|
2156
|
-
[UA_OS, [NAME, VERSION]]
|
|
2157
|
-
]);
|
|
2158
|
-
return props;
|
|
2159
|
-
})();
|
|
2160
|
-
|
|
2161
|
-
var createIData = function (item, itemType) {
|
|
2162
|
-
|
|
2163
|
-
var init_props = defaultProps.init[itemType],
|
|
2164
|
-
is_ignoreProps = defaultProps.isIgnore[itemType] || 0,
|
|
2165
|
-
is_ignoreRgx = defaultProps.isIgnoreRgx[itemType] || 0,
|
|
2166
|
-
toString_props = defaultProps.toString[itemType] || 0;
|
|
2167
|
-
|
|
2168
|
-
function IData () {
|
|
2169
|
-
setProps.call(this, init_props);
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
IData.prototype.getItem = function () {
|
|
2173
|
-
return item;
|
|
2174
|
-
};
|
|
2175
|
-
|
|
2176
|
-
IData.prototype.withClientHints = function () {
|
|
2177
|
-
|
|
2178
|
-
// nodejs / non-client-hints browsers
|
|
2179
|
-
if (!NAVIGATOR_UADATA) {
|
|
2180
|
-
return item
|
|
2181
|
-
.parseCH()
|
|
2182
|
-
.get();
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
// browsers based on chromium 85+
|
|
2186
|
-
return NAVIGATOR_UADATA
|
|
2187
|
-
.getHighEntropyValues(CH_ALL_VALUES)
|
|
2188
|
-
.then(function (res) {
|
|
2189
|
-
return item
|
|
2190
|
-
.setCH(new UACHData(res, false))
|
|
2191
|
-
.parseCH()
|
|
2192
|
-
.get();
|
|
2193
|
-
});
|
|
2194
|
-
};
|
|
2195
|
-
|
|
2196
|
-
IData.prototype.withFeatureCheck = function () {
|
|
2197
|
-
return item.detectFeature().get();
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
if (itemType != UA_RESULT) {
|
|
2201
|
-
IData.prototype.is = function (strToCheck) {
|
|
2202
|
-
var is = false;
|
|
2203
|
-
for (var i in this) {
|
|
2204
|
-
if (this.hasOwnProperty(i) && !has(is_ignoreProps, i) && lowerize(is_ignoreRgx ? strip(is_ignoreRgx, this[i]) : this[i]) == lowerize(is_ignoreRgx ? strip(is_ignoreRgx, strToCheck) : strToCheck)) {
|
|
2205
|
-
is = true;
|
|
2206
|
-
if (strToCheck != UNDEF_TYPE) break;
|
|
2207
|
-
} else if (strToCheck == UNDEF_TYPE && is) {
|
|
2208
|
-
is = !is;
|
|
2209
|
-
break;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
return is;
|
|
2213
|
-
};
|
|
2214
|
-
IData.prototype.toString = function () {
|
|
2215
|
-
var str = EMPTY;
|
|
2216
|
-
for (var i in toString_props) {
|
|
2217
|
-
if (typeof(this[toString_props[i]]) !== UNDEF_TYPE) {
|
|
2218
|
-
str += (str ? ' ' : EMPTY) + this[toString_props[i]];
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return str || UNDEF_TYPE;
|
|
2222
|
-
};
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
if (!NAVIGATOR_UADATA) {
|
|
2226
|
-
IData.prototype.then = function (cb) {
|
|
2227
|
-
var that = this;
|
|
2228
|
-
var IDataResolve = function () {
|
|
2229
|
-
for (var prop in that) {
|
|
2230
|
-
if (that.hasOwnProperty(prop)) {
|
|
2231
|
-
this[prop] = that[prop];
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
};
|
|
2235
|
-
IDataResolve.prototype = {
|
|
2236
|
-
is : IData.prototype.is,
|
|
2237
|
-
toString : IData.prototype.toString
|
|
2238
|
-
};
|
|
2239
|
-
var resolveData = new IDataResolve();
|
|
2240
|
-
cb(resolveData);
|
|
2241
|
-
return resolveData;
|
|
2242
|
-
};
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
return new IData();
|
|
2246
|
-
};
|
|
2247
|
-
|
|
2248
|
-
/////////////////
|
|
2249
|
-
// Constructor
|
|
2250
|
-
////////////////
|
|
2251
|
-
|
|
2252
|
-
function UACHData (uach, isHttpUACH) {
|
|
2253
|
-
uach = uach || {};
|
|
2254
|
-
setProps.call(this, CH_ALL_VALUES);
|
|
2255
|
-
if (isHttpUACH) {
|
|
2256
|
-
setProps.call(this, [
|
|
2257
|
-
[BRANDS, itemListToArray(uach[CH_HEADER])],
|
|
2258
|
-
[FULLVERLIST, itemListToArray(uach[CH_HEADER_FULL_VER_LIST])],
|
|
2259
|
-
[MOBILE, /\?1/.test(uach[CH_HEADER_MOBILE])],
|
|
2260
|
-
[MODEL, stripQuotes(uach[CH_HEADER_MODEL])],
|
|
2261
|
-
[PLATFORM, stripQuotes(uach[CH_HEADER_PLATFORM])],
|
|
2262
|
-
[PLATFORMVER, stripQuotes(uach[CH_HEADER_PLATFORM_VER])],
|
|
2263
|
-
[ARCHITECTURE, stripQuotes(uach[CH_HEADER_ARCH])],
|
|
2264
|
-
[FORMFACTORS, itemListToArray(uach[CH_HEADER_FORM_FACTORS])],
|
|
2265
|
-
[BITNESS, stripQuotes(uach[CH_HEADER_BITNESS])]
|
|
2266
|
-
]);
|
|
2267
|
-
} else {
|
|
2268
|
-
for (var prop in uach) {
|
|
2269
|
-
if(this.hasOwnProperty(prop) && typeof uach[prop] !== UNDEF_TYPE) this[prop] = uach[prop];
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
function UAItem (itemType, ua, rgxMap, uaCH) {
|
|
2275
|
-
|
|
2276
|
-
this.get = function (prop) {
|
|
2277
|
-
if (!prop) return this.data;
|
|
2278
|
-
return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined;
|
|
2279
|
-
};
|
|
2280
|
-
|
|
2281
|
-
this.set = function (prop, val) {
|
|
2282
|
-
this.data[prop] = val;
|
|
2283
|
-
return this;
|
|
2284
|
-
};
|
|
2285
|
-
|
|
2286
|
-
this.setCH = function (ch) {
|
|
2287
|
-
this.uaCH = ch;
|
|
2288
|
-
return this;
|
|
2289
|
-
};
|
|
2290
|
-
|
|
2291
|
-
this.detectFeature = function () {
|
|
2292
|
-
if (NAVIGATOR && NAVIGATOR.userAgent == this.ua) {
|
|
2293
|
-
switch (this.itemType) {
|
|
2294
|
-
case UA_BROWSER:
|
|
2295
|
-
// Brave-specific detection
|
|
2296
|
-
if (NAVIGATOR.brave && typeof NAVIGATOR.brave.isBrave == FUNC_TYPE) {
|
|
2297
|
-
this.set(NAME, 'Brave');
|
|
2298
|
-
}
|
|
2299
|
-
break;
|
|
2300
|
-
case UA_DEVICE:
|
|
2301
|
-
// Chrome-specific detection: check for 'mobile' value of navigator.userAgentData
|
|
2302
|
-
if (!this.get(TYPE) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[MOBILE]) {
|
|
2303
|
-
this.set(TYPE, MOBILE);
|
|
2304
|
-
}
|
|
2305
|
-
// iPadOS-specific detection: identified as Mac, but has some iOS-only properties
|
|
2306
|
-
if (this.get(MODEL) == 'Macintosh' && NAVIGATOR && typeof NAVIGATOR.standalone !== UNDEF_TYPE && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 2) {
|
|
2307
|
-
this.set(MODEL, 'iPad')
|
|
2308
|
-
.set(TYPE, TABLET);
|
|
2309
|
-
}
|
|
2310
|
-
break;
|
|
2311
|
-
case UA_OS:
|
|
2312
|
-
// Chrome-specific detection: check for 'platform' value of navigator.userAgentData
|
|
2313
|
-
if (!this.get(NAME) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[PLATFORM]) {
|
|
2314
|
-
this.set(NAME, NAVIGATOR_UADATA[PLATFORM]);
|
|
2315
|
-
}
|
|
2316
|
-
break;
|
|
2317
|
-
case UA_RESULT:
|
|
2318
|
-
var data = this.data;
|
|
2319
|
-
var detect = function (itemType) {
|
|
2320
|
-
return data[itemType]
|
|
2321
|
-
.getItem()
|
|
2322
|
-
.detectFeature()
|
|
2323
|
-
.get();
|
|
2324
|
-
};
|
|
2325
|
-
this.set(UA_BROWSER, detect(UA_BROWSER))
|
|
2326
|
-
.set(UA_CPU, detect(UA_CPU))
|
|
2327
|
-
.set(UA_DEVICE, detect(UA_DEVICE))
|
|
2328
|
-
.set(UA_ENGINE, detect(UA_ENGINE))
|
|
2329
|
-
.set(UA_OS, detect(UA_OS));
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
return this;
|
|
2333
|
-
};
|
|
2334
|
-
|
|
2335
|
-
this.parseUA = function () {
|
|
2336
|
-
if (this.itemType != UA_RESULT) {
|
|
2337
|
-
rgxMapper.call(this.data, this.ua, this.rgxMap);
|
|
2338
|
-
}
|
|
2339
|
-
if (this.itemType == UA_BROWSER) {
|
|
2340
|
-
this.set(MAJOR, majorize(this.get(VERSION)));
|
|
2341
|
-
}
|
|
2342
|
-
return this;
|
|
2343
|
-
};
|
|
2344
|
-
|
|
2345
|
-
this.parseCH = function () {
|
|
2346
|
-
var uaCH = this.uaCH,
|
|
2347
|
-
rgxMap = this.rgxMap;
|
|
2348
|
-
|
|
2349
|
-
switch (this.itemType) {
|
|
2350
|
-
case UA_BROWSER:
|
|
2351
|
-
case UA_ENGINE:
|
|
2352
|
-
var brands = uaCH[FULLVERLIST] || uaCH[BRANDS], prevName;
|
|
2353
|
-
if (brands) {
|
|
2354
|
-
for (var i in brands) {
|
|
2355
|
-
var brandName = brands[i].brand || brands[i],
|
|
2356
|
-
brandVersion = brands[i].version;
|
|
2357
|
-
if (this.itemType == UA_BROWSER &&
|
|
2358
|
-
!/not.a.brand/i.test(brandName) &&
|
|
2359
|
-
(!prevName ||
|
|
2360
|
-
(/Chrom/.test(prevName) && brandName != CHROMIUM) ||
|
|
2361
|
-
(prevName == EDGE && /WebView2/.test(brandName))
|
|
2362
|
-
)) {
|
|
2363
|
-
brandName = strMapper(brandName, browserHintsMap);
|
|
2364
|
-
prevName = this.get(NAME);
|
|
2365
|
-
if (!(prevName && !/Chrom/.test(prevName) && /Chrom/.test(brandName))) {
|
|
2366
|
-
this.set(NAME, brandName)
|
|
2367
|
-
.set(VERSION, brandVersion)
|
|
2368
|
-
.set(MAJOR, majorize(brandVersion));
|
|
2369
|
-
}
|
|
2370
|
-
prevName = brandName;
|
|
2371
|
-
}
|
|
2372
|
-
if (this.itemType == UA_ENGINE && brandName == CHROMIUM) {
|
|
2373
|
-
this.set(VERSION, brandVersion);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
break;
|
|
2378
|
-
case UA_CPU:
|
|
2379
|
-
var archName = uaCH[ARCHITECTURE];
|
|
2380
|
-
if (archName) {
|
|
2381
|
-
if (archName && uaCH[BITNESS] == '64') archName += '64';
|
|
2382
|
-
rgxMapper.call(this.data, archName + ';', rgxMap);
|
|
2383
|
-
}
|
|
2384
|
-
break;
|
|
2385
|
-
case UA_DEVICE:
|
|
2386
|
-
if (uaCH[MOBILE]) {
|
|
2387
|
-
this.set(TYPE, MOBILE);
|
|
2388
|
-
}
|
|
2389
|
-
if (uaCH[MODEL]) {
|
|
2390
|
-
this.set(MODEL, uaCH[MODEL]);
|
|
2391
|
-
if (!this.get(TYPE) || !this.get(VENDOR)) {
|
|
2392
|
-
var reParse = {};
|
|
2393
|
-
rgxMapper.call(reParse, 'droid 9; ' + uaCH[MODEL] + ')', rgxMap);
|
|
2394
|
-
if (!this.get(TYPE) && !!reParse.type) {
|
|
2395
|
-
this.set(TYPE, reParse.type);
|
|
2396
|
-
}
|
|
2397
|
-
if (!this.get(VENDOR) && !!reParse.vendor) {
|
|
2398
|
-
this.set(VENDOR, reParse.vendor);
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
if (uaCH[FORMFACTORS]) {
|
|
2403
|
-
var ff;
|
|
2404
|
-
if (typeof uaCH[FORMFACTORS] !== 'string') {
|
|
2405
|
-
var idx = 0;
|
|
2406
|
-
while (!ff && idx < uaCH[FORMFACTORS].length) {
|
|
2407
|
-
ff = strMapper(uaCH[FORMFACTORS][idx++], formFactorsMap);
|
|
2408
|
-
}
|
|
2409
|
-
} else {
|
|
2410
|
-
ff = strMapper(uaCH[FORMFACTORS], formFactorsMap);
|
|
2411
|
-
}
|
|
2412
|
-
this.set(TYPE, ff);
|
|
2413
|
-
}
|
|
2414
|
-
break;
|
|
2415
|
-
case UA_OS:
|
|
2416
|
-
var osName = uaCH[PLATFORM];
|
|
2417
|
-
if(osName) {
|
|
2418
|
-
var osVersion = uaCH[PLATFORMVER];
|
|
2419
|
-
if (osName == WINDOWS) osVersion = (parseInt(majorize(osVersion), 10) >= 13 ? '11' : '10');
|
|
2420
|
-
this.set(NAME, osName)
|
|
2421
|
-
.set(VERSION, osVersion);
|
|
2422
|
-
}
|
|
2423
|
-
// Xbox-Specific Detection
|
|
2424
|
-
if (this.get(NAME) == WINDOWS && uaCH[MODEL] == 'Xbox') {
|
|
2425
|
-
this.set(NAME, 'Xbox')
|
|
2426
|
-
.set(VERSION, undefined);
|
|
2427
|
-
}
|
|
2428
|
-
break;
|
|
2429
|
-
case UA_RESULT:
|
|
2430
|
-
var data = this.data;
|
|
2431
|
-
var parse = function (itemType) {
|
|
2432
|
-
return data[itemType]
|
|
2433
|
-
.getItem()
|
|
2434
|
-
.setCH(uaCH)
|
|
2435
|
-
.parseCH()
|
|
2436
|
-
.get();
|
|
2437
|
-
};
|
|
2438
|
-
this.set(UA_BROWSER, parse(UA_BROWSER))
|
|
2439
|
-
.set(UA_CPU, parse(UA_CPU))
|
|
2440
|
-
.set(UA_DEVICE, parse(UA_DEVICE))
|
|
2441
|
-
.set(UA_ENGINE, parse(UA_ENGINE))
|
|
2442
|
-
.set(UA_OS, parse(UA_OS));
|
|
2443
|
-
}
|
|
2444
|
-
return this;
|
|
2445
|
-
};
|
|
2446
|
-
|
|
2447
|
-
setProps.call(this, [
|
|
2448
|
-
['itemType', itemType],
|
|
2449
|
-
['ua', ua],
|
|
2450
|
-
['uaCH', uaCH],
|
|
2451
|
-
['rgxMap', rgxMap],
|
|
2452
|
-
['data', createIData(this, itemType)]
|
|
2453
|
-
]);
|
|
2454
|
-
|
|
2455
|
-
return this;
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
function UAParser (ua, extensions, headers) {
|
|
2459
|
-
|
|
2460
|
-
if (typeof ua === OBJ_TYPE) {
|
|
2461
|
-
if (isExtensions(ua, true)) {
|
|
2462
|
-
if (typeof extensions === OBJ_TYPE) {
|
|
2463
|
-
headers = extensions; // case UAParser(extensions, headers)
|
|
2464
|
-
}
|
|
2465
|
-
extensions = ua; // case UAParser(extensions)
|
|
2466
|
-
} else {
|
|
2467
|
-
headers = ua; // case UAParser(headers)
|
|
2468
|
-
extensions = undefined;
|
|
2469
|
-
}
|
|
2470
|
-
ua = undefined;
|
|
2471
|
-
} else if (typeof ua === STR_TYPE && !isExtensions(extensions, true)) {
|
|
2472
|
-
headers = extensions; // case UAParser(ua, headers)
|
|
2473
|
-
extensions = undefined;
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
// Convert Headers object into a plain object
|
|
2477
|
-
if (headers && typeof headers.append === FUNC_TYPE) {
|
|
2478
|
-
var kv = {};
|
|
2479
|
-
headers.forEach(function (v, k) { kv[k] = v; });
|
|
2480
|
-
headers = kv;
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
if (!(this instanceof UAParser)) {
|
|
2484
|
-
return new UAParser(ua, extensions, headers).getResult();
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
var userAgent = typeof ua === STR_TYPE ? ua : // Passed user-agent string
|
|
2488
|
-
(headers && headers[USER_AGENT] ? headers[USER_AGENT] : // User-Agent from passed headers
|
|
2489
|
-
((NAVIGATOR && NAVIGATOR.userAgent) ? NAVIGATOR.userAgent : // navigator.userAgent
|
|
2490
|
-
EMPTY)), // empty string
|
|
2491
|
-
|
|
2492
|
-
httpUACH = new UACHData(headers, true),
|
|
2493
|
-
regexMap = extensions ?
|
|
2494
|
-
extend(defaultRegexes, extensions) :
|
|
2495
|
-
defaultRegexes,
|
|
2496
|
-
|
|
2497
|
-
createItemFunc = function (itemType) {
|
|
2498
|
-
if (itemType == UA_RESULT) {
|
|
2499
|
-
return function () {
|
|
2500
|
-
return new UAItem(itemType, userAgent, regexMap, httpUACH)
|
|
2501
|
-
.set('ua', userAgent)
|
|
2502
|
-
.set(UA_BROWSER, this.getBrowser())
|
|
2503
|
-
.set(UA_CPU, this.getCPU())
|
|
2504
|
-
.set(UA_DEVICE, this.getDevice())
|
|
2505
|
-
.set(UA_ENGINE, this.getEngine())
|
|
2506
|
-
.set(UA_OS, this.getOS())
|
|
2507
|
-
.get();
|
|
2508
|
-
};
|
|
2509
|
-
} else {
|
|
2510
|
-
return function () {
|
|
2511
|
-
return new UAItem(itemType, userAgent, regexMap[itemType], httpUACH)
|
|
2512
|
-
.parseUA()
|
|
2513
|
-
.get();
|
|
2514
|
-
};
|
|
2515
|
-
}
|
|
2516
|
-
};
|
|
2517
|
-
|
|
2518
|
-
// public methods
|
|
2519
|
-
setProps.call(this, [
|
|
2520
|
-
['getBrowser', createItemFunc(UA_BROWSER)],
|
|
2521
|
-
['getCPU', createItemFunc(UA_CPU)],
|
|
2522
|
-
['getDevice', createItemFunc(UA_DEVICE)],
|
|
2523
|
-
['getEngine', createItemFunc(UA_ENGINE)],
|
|
2524
|
-
['getOS', createItemFunc(UA_OS)],
|
|
2525
|
-
['getResult', createItemFunc(UA_RESULT)],
|
|
2526
|
-
['getUA', function () { return userAgent; }],
|
|
2527
|
-
['setUA', function (ua) {
|
|
2528
|
-
if (isString(ua))
|
|
2529
|
-
userAgent = ua.length > UA_MAX_LENGTH ? trim(ua, UA_MAX_LENGTH) : ua;
|
|
2530
|
-
return this;
|
|
2531
|
-
}]
|
|
2532
|
-
])
|
|
2533
|
-
.setUA(userAgent);
|
|
2534
|
-
|
|
2535
|
-
return this;
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
UAParser.VERSION = LIBVERSION;
|
|
2539
|
-
UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR, TYPE]);
|
|
2540
|
-
UAParser.CPU = enumerize([ARCHITECTURE]);
|
|
2541
|
-
UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
|
|
2542
|
-
UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);
|
|
2543
|
-
|
|
2544
|
-
class DeviceDetector {
|
|
2545
|
-
getDeviceInfo() {
|
|
2546
|
-
const parser = new UAParser();
|
|
2547
|
-
const result = parser.getResult();
|
|
2548
|
-
return {
|
|
2549
|
-
browser: result.browser,
|
|
2550
|
-
os: result.os,
|
|
2551
|
-
device: result.device,
|
|
2552
|
-
engine: result.engine,
|
|
2553
|
-
cpu: result.cpu,
|
|
2554
|
-
ua: result.ua,
|
|
2555
|
-
};
|
|
2556
|
-
}
|
|
2557
|
-
get screenDensity() {
|
|
2558
|
-
if (window.devicePixelRatio >= 3)
|
|
2559
|
-
return "high";
|
|
2560
|
-
if (window.devicePixelRatio >= 2)
|
|
2561
|
-
return "medium";
|
|
2562
|
-
return "low";
|
|
2563
|
-
}
|
|
2564
|
-
get screenFormat() {
|
|
2565
|
-
return window.innerHeight > window.innerWidth ? "long" : "normal";
|
|
2566
|
-
}
|
|
2567
|
-
get screenSize() {
|
|
2568
|
-
const width = window.innerWidth;
|
|
2569
|
-
if (width < 480)
|
|
2570
|
-
return "small";
|
|
2571
|
-
else if (width < 768)
|
|
2572
|
-
return "normal";
|
|
2573
|
-
else if (width < 1440)
|
|
2574
|
-
return "large";
|
|
2575
|
-
else
|
|
2576
|
-
return "xlarge";
|
|
2577
|
-
}
|
|
2578
|
-
get uiMode() {
|
|
2579
|
-
var _a, _b, _c;
|
|
2580
|
-
const deviceInfo = this.getDeviceInfo();
|
|
2581
|
-
const deviceType = ((_a = deviceInfo.device) === null || _a === void 0 ? void 0 : _a.type) || ""; // 'mobile', 'tablet', 'smarttv', 'console', 'wearable', 'embedded'
|
|
2582
|
-
const model = ((_c = (_b = deviceInfo.device) === null || _b === void 0 ? void 0 : _b.model) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || "";
|
|
2583
|
-
const ua = deviceInfo.ua.toLowerCase();
|
|
2584
|
-
if (deviceType === "wearable" || model.includes("watch")) {
|
|
2585
|
-
return 6; // UI_MODE_TYPE_WATCH
|
|
2586
|
-
}
|
|
2587
|
-
if (deviceType === "smarttv" ||
|
|
2588
|
-
ua.includes("smart-tv") ||
|
|
2589
|
-
ua.includes("hbbtv") ||
|
|
2590
|
-
ua.includes("netcast") ||
|
|
2591
|
-
ua.includes("googletv") ||
|
|
2592
|
-
ua.includes("appletv")) {
|
|
2593
|
-
return 4; // UI_MODE_TYPE_TELEVISION
|
|
2594
|
-
}
|
|
2595
|
-
if (deviceType === "console" ||
|
|
2596
|
-
ua.includes("playstation") ||
|
|
2597
|
-
ua.includes("xbox") ||
|
|
2598
|
-
ua.includes("nintendo")) {
|
|
2599
|
-
return 5; // UI_MODE_TYPE_APPLIANCE
|
|
2600
|
-
}
|
|
2601
|
-
if (ua.includes("car") ||
|
|
2602
|
-
ua.includes("android auto") ||
|
|
2603
|
-
ua.includes("carplay")) {
|
|
2604
|
-
return 3; // UI_MODE_TYPE_CAR
|
|
2605
|
-
}
|
|
2606
|
-
if (ua.includes("oculus") ||
|
|
2607
|
-
ua.includes("vive") ||
|
|
2608
|
-
ua.includes("vr") ||
|
|
2609
|
-
deviceType === "embedded") {
|
|
2610
|
-
return 7; // UI_MODE_TYPE_VR_HEADSET
|
|
2611
|
-
}
|
|
2612
|
-
if (deviceType === "mobile" || deviceType === "tablet") {
|
|
2613
|
-
return 1; // UI_MODE_TYPE_NORMAL
|
|
2614
|
-
}
|
|
2615
|
-
if (deviceType === "" || deviceType === "desktop") {
|
|
2616
|
-
return 2; // UI_MODE_TYPE_DESK
|
|
2617
|
-
}
|
|
2618
|
-
return 0; // UI_MODE_TYPE_UNDEFINED
|
|
2619
|
-
}
|
|
2620
|
-
get uiStyle() {
|
|
2621
|
-
const isDarkMode = window.matchMedia &&
|
|
2622
|
-
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2623
|
-
return isDarkMode ? "1" : "0";
|
|
2624
|
-
}
|
|
2625
|
-
get displaySize() {
|
|
2626
|
-
const dpr = window.devicePixelRatio || 1;
|
|
2627
|
-
const pixelWidth = screen.width * dpr;
|
|
2628
|
-
const pixelHeight = screen.height * dpr;
|
|
2629
|
-
const assumedDPI = 160;
|
|
2630
|
-
const widthInInches = pixelWidth / assumedDPI;
|
|
2631
|
-
const heightInInches = pixelHeight / assumedDPI;
|
|
2632
|
-
const diagonal = Math.sqrt(Math.pow(widthInInches, 2) + Math.pow(heightInInches, 2));
|
|
2633
|
-
return diagonal.toFixed(2);
|
|
2634
|
-
}
|
|
2635
|
-
get screenType() {
|
|
2636
|
-
return "ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
2637
|
-
? "touch"
|
|
2638
|
-
: "pointer";
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
/** @internal */
|
|
2642
|
-
const deviceDetector = new DeviceDetector();
|
|
2643
|
-
|
|
2644
|
-
class StorageSupport {
|
|
2645
|
-
constructor() {
|
|
2646
|
-
this.supportResults = null;
|
|
2647
|
-
}
|
|
2648
|
-
getSupportResult() {
|
|
2649
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2650
|
-
if (this.supportResults)
|
|
2651
|
-
return this.supportResults;
|
|
2652
|
-
const localStorageSupported = this.isLocalStorageSupported();
|
|
2653
|
-
const sessionStorageSupported = this.isSessionStorageSupported();
|
|
2654
|
-
const indexedDBSupported = yield this.isIndexedDBSupported();
|
|
2655
|
-
this.supportResults = {
|
|
2656
|
-
localStorage: localStorageSupported,
|
|
2657
|
-
sessionStorage: sessionStorageSupported,
|
|
2658
|
-
indexedDB: indexedDBSupported,
|
|
2659
|
-
};
|
|
2660
|
-
return this.supportResults;
|
|
2661
|
-
});
|
|
2662
|
-
}
|
|
2663
|
-
getStorageSizeBytes(storage) {
|
|
2664
|
-
let total = 0;
|
|
2665
|
-
for (let i = 0; i < storage.length; i++) {
|
|
2666
|
-
const key = storage.key(i);
|
|
2667
|
-
if (!key)
|
|
2668
|
-
continue;
|
|
2669
|
-
const value = storage.getItem(key);
|
|
2670
|
-
if (value == null)
|
|
2671
|
-
continue;
|
|
2672
|
-
total += key.length * 2;
|
|
2673
|
-
total += value.length * 2;
|
|
2674
|
-
}
|
|
2675
|
-
return total;
|
|
2676
|
-
}
|
|
2677
|
-
isLocalStorageSupported() {
|
|
2678
|
-
try {
|
|
2679
|
-
const testKey = "__test__";
|
|
2680
|
-
localStorage.setItem(testKey, "1");
|
|
2681
|
-
localStorage.removeItem(testKey);
|
|
2682
|
-
return true;
|
|
2683
|
-
}
|
|
2684
|
-
catch (e) {
|
|
2685
|
-
return false;
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
isSessionStorageSupported() {
|
|
2689
|
-
try {
|
|
2690
|
-
const testKey = "__test__";
|
|
2691
|
-
sessionStorage.setItem(testKey, "1");
|
|
2692
|
-
sessionStorage.removeItem(testKey);
|
|
2693
|
-
return true;
|
|
2694
|
-
}
|
|
2695
|
-
catch (e) {
|
|
2696
|
-
return false;
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2699
|
-
isIndexedDBSupported() {
|
|
2700
|
-
if (!("indexedDB" in window))
|
|
2701
|
-
return Promise.resolve(false);
|
|
2702
|
-
return new Promise((resolve) => {
|
|
2703
|
-
try {
|
|
2704
|
-
const request = indexedDB.open("__test__check__");
|
|
2705
|
-
request.onerror = () => resolve(false);
|
|
2706
|
-
request.onsuccess = () => {
|
|
2707
|
-
request.result.close();
|
|
2708
|
-
indexedDB.deleteDatabase("__test__check__");
|
|
2709
|
-
resolve(true);
|
|
2710
|
-
};
|
|
2711
|
-
}
|
|
2712
|
-
catch (_a) {
|
|
2713
|
-
resolve(false);
|
|
2714
|
-
}
|
|
2715
|
-
});
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
/** @internal */
|
|
2719
|
-
const storageSupport = new StorageSupport();
|
|
2720
|
-
|
|
2721
|
-
/** @internal */
|
|
2722
|
-
class Utils {
|
|
2723
|
-
static getUTMParamsString() {
|
|
2724
|
-
const params = new URLSearchParams(window.location.search);
|
|
2725
|
-
const utmParams = {};
|
|
2726
|
-
for (const [key, value] of params.entries()) {
|
|
2727
|
-
if (key.startsWith("utm_") && value) {
|
|
2728
|
-
utmParams[key] = value;
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
|
-
if (!utmParams["utm_source"]) {
|
|
2732
|
-
const referrer = document.referrer;
|
|
2733
|
-
utmParams["utm_source"] = referrer ? new URL(referrer).hostname : "other";
|
|
2734
|
-
}
|
|
2735
|
-
if (!utmParams["utm_medium"]) {
|
|
2736
|
-
utmParams["utm_medium"] = "organic";
|
|
2737
|
-
}
|
|
2738
|
-
return Object.entries(utmParams)
|
|
2739
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
|
2740
|
-
.join("&");
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
Utils.detectWebFramework = () => {
|
|
2744
|
-
// Next.js (React)
|
|
2745
|
-
if (!!document.querySelector("script[id=__NEXT_DATA__]") ||
|
|
2746
|
-
[...document.scripts].some((s) => s.src.includes("/_next/")))
|
|
2747
|
-
return "Next.js";
|
|
2748
|
-
// React (if next.js dosn't exists)
|
|
2749
|
-
if (!!window.React ||
|
|
2750
|
-
!!document.querySelector("[data-reactroot], [data-reactid]") ||
|
|
2751
|
-
Array.from(document.querySelectorAll("*")).some((e) => e._reactRootContainer !== undefined ||
|
|
2752
|
-
Object.keys(e).some((k) => k.startsWith("__reactContainer"))) ||
|
|
2753
|
-
window.__REACT_DEVTOOLS_GLOBAL_HOOK__)
|
|
2754
|
-
return "React";
|
|
2755
|
-
// Vue / Nuxt.js
|
|
2756
|
-
if ([...document.scripts].some((s) => s.src.includes("/_nuxt/")))
|
|
2757
|
-
return "Nuxt.js";
|
|
2758
|
-
if (window.__VUE__ ||
|
|
2759
|
-
window.Vue ||
|
|
2760
|
-
document.querySelector("[data-v-app], [data-v-]"))
|
|
2761
|
-
return "Vue.js";
|
|
2762
|
-
// Gatsby.js
|
|
2763
|
-
if (!!document.querySelector("[id=___gatsby]"))
|
|
2764
|
-
return "Gatsby.js";
|
|
2765
|
-
// Angular
|
|
2766
|
-
if (!!window ||
|
|
2767
|
-
!!document.querySelector(".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]") ||
|
|
2768
|
-
!!document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]') ||
|
|
2769
|
-
window.ng ||
|
|
2770
|
-
document.querySelector("[ng-version]"))
|
|
2771
|
-
return "Angular";
|
|
2772
|
-
// Svelte
|
|
2773
|
-
if ([...document.scripts].some((s) => { var _a; return s.src.includes("svelte") || ((_a = s.textContent) === null || _a === void 0 ? void 0 : _a.includes("svelte")); }))
|
|
2774
|
-
return "Svelte";
|
|
2775
|
-
// Alpine.js
|
|
2776
|
-
if (document.querySelector("[x-data], [x-init], [x-bind]"))
|
|
2777
|
-
return "Alpine.js";
|
|
2778
|
-
// jQuery
|
|
2779
|
-
if (window.jQuery)
|
|
2780
|
-
return "jQuery";
|
|
2781
|
-
// Backbone
|
|
2782
|
-
if (!!window.Backbone)
|
|
2783
|
-
return "Backbone.js";
|
|
2784
|
-
// Meteor
|
|
2785
|
-
if (!!window.Meteor)
|
|
2786
|
-
return "Meteor.js";
|
|
2787
|
-
// Zepto
|
|
2788
|
-
if (!!window.Zepto)
|
|
2789
|
-
return "Zepto.js";
|
|
2790
|
-
// WordPress (CMS)
|
|
2791
|
-
if (document.querySelector('meta[name="generator"][content*="WordPress"]') ||
|
|
2792
|
-
[...document.scripts].some((s) => s.src.includes("wp-content") || s.src.includes("wp-includes")))
|
|
2793
|
-
return "WordPress";
|
|
2794
|
-
// Laravel
|
|
2795
|
-
if ([...document.scripts].some((s) => s.src.includes("/js/app.js") || s.src.includes("mix-manifest.json")))
|
|
2796
|
-
return "Laravel";
|
|
2797
|
-
// Drupal (CMS)
|
|
2798
|
-
if (document.querySelector('meta[name="generator"][content*="Drupal"]') ||
|
|
2799
|
-
document.documentElement.innerHTML.includes("drupal-settings-json"))
|
|
2800
|
-
return "Drupal";
|
|
2801
|
-
// Shopify
|
|
2802
|
-
if (document.documentElement.innerHTML.includes("cdn.shopify.com"))
|
|
2803
|
-
return "Shopify";
|
|
2804
|
-
// Squarespace
|
|
2805
|
-
if ([...document.scripts].some((s) => s.src.includes("static.squarespace.com")))
|
|
2806
|
-
return "Squarespace";
|
|
2807
|
-
// Wix
|
|
2808
|
-
if ([...document.scripts].some((s) => s.src.includes("wix.com")))
|
|
2809
|
-
return "Wix";
|
|
2810
|
-
// Ghost CMS
|
|
2811
|
-
if (document.querySelector('meta[name="generator"][content*="Ghost"]'))
|
|
2812
|
-
return "Ghost CMS";
|
|
2813
|
-
return undefined;
|
|
2814
|
-
};
|
|
2815
|
-
|
|
2816
|
-
/** @internal */
|
|
2817
|
-
class DeviceFingerprint {
|
|
2818
|
-
static isWebGLSupported() {
|
|
2819
|
-
try {
|
|
2820
|
-
const canvas = document.createElement("canvas");
|
|
2821
|
-
return !!(canvas.getContext("webgl") || canvas.getContext("experimental-webgl"));
|
|
2822
|
-
}
|
|
2823
|
-
catch (e) {
|
|
2824
|
-
return false;
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
static getWebGLFingerprint() {
|
|
2828
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2829
|
-
const canvas = document.createElement("canvas");
|
|
2830
|
-
const gl = (canvas.getContext("webgl") ||
|
|
2831
|
-
canvas.getContext("experimental-webgl"));
|
|
2832
|
-
if (!gl)
|
|
2833
|
-
return undefined;
|
|
2834
|
-
const info = {
|
|
2835
|
-
version: gl.getParameter(gl.VERSION),
|
|
2836
|
-
shadingLangVersion: gl.getParameter(gl.SHADING_LANGUAGE_VERSION),
|
|
2837
|
-
maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),
|
|
2838
|
-
maxRenderBufferSize: gl.getParameter(gl.MAX_RENDERBUFFER_SIZE),
|
|
2839
|
-
supportedExtensions: gl.getSupportedExtensions(),
|
|
2840
|
-
};
|
|
2841
|
-
try {
|
|
2842
|
-
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
2843
|
-
info.vendor = debugInfo
|
|
2844
|
-
? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL)
|
|
2845
|
-
: gl.getParameter(gl.VENDOR);
|
|
2846
|
-
}
|
|
2847
|
-
catch (_) {
|
|
2848
|
-
info.vendor = gl.getParameter(gl.VENDOR);
|
|
2849
|
-
}
|
|
2850
|
-
try {
|
|
2851
|
-
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
2852
|
-
info.renderer = debugInfo
|
|
2853
|
-
? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)
|
|
2854
|
-
: gl.getParameter(gl.RENDERER);
|
|
2855
|
-
}
|
|
2856
|
-
catch (_) {
|
|
2857
|
-
info.renderer = gl.getParameter(gl.RENDERER);
|
|
2858
|
-
}
|
|
2859
|
-
return yield this.hashData(JSON.stringify(info));
|
|
2860
|
-
});
|
|
2861
|
-
}
|
|
2862
|
-
static getCanvasFingerprint() {
|
|
2863
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2864
|
-
const canvas = document.createElement("canvas");
|
|
2865
|
-
canvas.width = 200;
|
|
2866
|
-
canvas.height = 50;
|
|
2867
|
-
const ctx = canvas.getContext("2d");
|
|
2868
|
-
if (!ctx)
|
|
2869
|
-
return undefined;
|
|
2870
|
-
ctx.textBaseline = "top";
|
|
2871
|
-
ctx.font = "14px 'Arial'";
|
|
2872
|
-
ctx.fillStyle = "#f60";
|
|
2873
|
-
ctx.fillRect(0, 0, 200, 50);
|
|
2874
|
-
ctx.fillStyle = "#069";
|
|
2875
|
-
ctx.fillText("WiseTrack WebGL Fingerprint!", 2, 2);
|
|
2876
|
-
return yield this.hashData(canvas.toDataURL());
|
|
2877
|
-
});
|
|
2878
|
-
}
|
|
2879
|
-
// static async generateFingerprint(): Promise<string> {
|
|
2880
|
-
// const webglData = this.getWebGLFingerprint();
|
|
2881
|
-
// const canvasData = this.getCanvasFingerprint();
|
|
2882
|
-
// const combined = webglData + "|" + canvasData;
|
|
2883
|
-
// const encoder = new TextEncoder();
|
|
2884
|
-
// const data = encoder.encode(combined);
|
|
2885
|
-
// const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
2886
|
-
// const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
2887
|
-
// const hashHex = hashArray
|
|
2888
|
-
// .map((b) => b.toString(16).padStart(2, "0"))
|
|
2889
|
-
// .join("");
|
|
2890
|
-
// return hashHex;
|
|
2891
|
-
// }
|
|
2892
|
-
static hashData(input) {
|
|
2893
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2894
|
-
const str = typeof input === "string" ? input : JSON.stringify(input);
|
|
2895
|
-
const encoder = new TextEncoder();
|
|
2896
|
-
const data = encoder.encode(str);
|
|
2897
|
-
const hashBuffer = yield crypto.subtle.digest("SHA-256", data);
|
|
2898
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
2899
|
-
const hashHex = hashArray
|
|
2900
|
-
.map((b) => b.toString(16).padStart(2, "0"))
|
|
2901
|
-
.join("");
|
|
2902
|
-
return hashHex;
|
|
2903
|
-
});
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
/** @internal */
|
|
2908
|
-
class FieldsBuilder {
|
|
2909
|
-
build() {
|
|
2910
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2911
|
-
const startTime = window.performance.now();
|
|
2912
|
-
let fields = {};
|
|
2913
|
-
fields.created_at = new Date().toISOString();
|
|
2914
|
-
Object.assign(fields, this.getLocalFields());
|
|
2915
|
-
Object.assign(fields, yield this.getApplicationFields());
|
|
2916
|
-
Object.assign(fields, this.getDeviceFields());
|
|
2917
|
-
fields.time_spent = (window.performance.now() - startTime).toFixed(1);
|
|
2918
|
-
{
|
|
2919
|
-
fields = Object.fromEntries(Object.entries(fields).filter(([_, value]) => value !== null && value !== undefined));
|
|
2920
|
-
}
|
|
2921
|
-
return fields;
|
|
2922
|
-
});
|
|
2923
|
-
}
|
|
2924
|
-
getApplicationFields() {
|
|
2925
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2926
|
-
const storageSupportResult = yield storageSupport.getSupportResult();
|
|
2927
|
-
return {
|
|
2928
|
-
connectivity_type: navigator.onLine ? "1" : "-1",
|
|
2929
|
-
country: yield countryFinder.getCountryCode(),
|
|
2930
|
-
package_name: window.location.hostname,
|
|
2931
|
-
session_storage_enabled: storageSupportResult.sessionStorage,
|
|
2932
|
-
indexed_db_enabled: storageSupportResult.indexedDB,
|
|
2933
|
-
local_storage_enabled: storageSupportResult.localStorage,
|
|
2934
|
-
session_storage: storageSupport
|
|
2935
|
-
.getStorageSizeBytes(sessionStorage)
|
|
2936
|
-
.toFixed(0),
|
|
2937
|
-
local_storage: storageSupport
|
|
2938
|
-
.getStorageSizeBytes(localStorage)
|
|
2939
|
-
.toFixed(0),
|
|
2940
|
-
web_gl_support: DeviceFingerprint.isWebGLSupported(),
|
|
2941
|
-
web_gl_fingerprint: yield DeviceFingerprint.getWebGLFingerprint(),
|
|
2942
|
-
web_gl_canvas_fingerprint: yield DeviceFingerprint.getCanvasFingerprint(),
|
|
2943
|
-
};
|
|
2944
|
-
});
|
|
2945
|
-
}
|
|
2946
|
-
getLocalFields() {
|
|
2947
|
-
const initialConfig = storageManager.initialConfig;
|
|
2948
|
-
if (!initialConfig)
|
|
2949
|
-
return {};
|
|
2950
|
-
return {
|
|
2951
|
-
uuid: storageManager.deviceId,
|
|
2952
|
-
app_token: initialConfig.appToken,
|
|
2953
|
-
environment: initialConfig.userEnvironment,
|
|
2954
|
-
store_name: "other",
|
|
2955
|
-
app_version: initialConfig.appVersion,
|
|
2956
|
-
push_token: storageManager.pushToken,
|
|
2957
|
-
custom_device_id: initialConfig.customDeviceId,
|
|
2958
|
-
default_tracker: initialConfig.defaultTracker,
|
|
2959
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
2960
|
-
framework: initialConfig.appFrameWork.toLowerCase(),
|
|
2961
|
-
initiated_by: `${WTConstants.SDK.PLATFORM}_${initialConfig.appFrameWork.toLowerCase()}`,
|
|
2962
|
-
initiated_version: WTConstants.SDK.VERSION,
|
|
2963
|
-
referrer: Utils.getUTMParamsString(),
|
|
2964
|
-
installed_at: storageManager.initialDate,
|
|
2965
|
-
session_count: storageManager.sessionCount.toString(),
|
|
2966
|
-
session_length: parseInt((storageManager.activeDuration / 1000).toString()).toString(),
|
|
2967
|
-
subsession_count: parseInt((storageManager.subSessionCount / 1000).toString()).toString(),
|
|
2968
|
-
last_interval: parseInt((storageManager.inactiveDuration / 1000).toString()).toString(),
|
|
2969
|
-
};
|
|
2970
|
-
}
|
|
2971
|
-
getDeviceFields() {
|
|
2972
|
-
const deviceInfo = deviceDetector.getDeviceInfo();
|
|
2973
|
-
return {
|
|
2974
|
-
browser_version: deviceInfo.browser.version,
|
|
2975
|
-
device_manufacturer: deviceInfo.device.vendor,
|
|
2976
|
-
device_name: deviceInfo.device.model,
|
|
2977
|
-
device_type: deviceInfo.device.type,
|
|
2978
|
-
os_name: deviceInfo.os.name,
|
|
2979
|
-
os_version: deviceInfo.os.version,
|
|
2980
|
-
cpu_type: deviceInfo.cpu.architecture,
|
|
2981
|
-
web_user_agent: deviceInfo.ua,
|
|
2982
|
-
display_height: window.innerHeight.toFixed(0),
|
|
2983
|
-
display_width: window.innerWidth.toFixed(0),
|
|
2984
|
-
language: navigator.language.split("-")[0],
|
|
2985
|
-
screen_density: deviceDetector.screenDensity,
|
|
2986
|
-
screen_format: deviceDetector.screenFormat,
|
|
2987
|
-
screen_size: deviceDetector.screenSize,
|
|
2988
|
-
ui_mode: deviceDetector.uiMode.toString(),
|
|
2989
|
-
cpu_lpc: navigator.hardwareConcurrency.toString(),
|
|
2990
|
-
ui_style: deviceDetector.uiStyle,
|
|
2991
|
-
wout_width: window.outerWidth.toString(),
|
|
2992
|
-
wout_height: window.outerHeight.toString(),
|
|
2993
|
-
web_engine: deviceInfo.engine.name,
|
|
2994
|
-
web_engine_version: deviceInfo.engine.version,
|
|
2995
|
-
display_size: deviceDetector.displaySize,
|
|
2996
|
-
screen_type: deviceDetector.screenType,
|
|
2997
|
-
};
|
|
2998
|
-
}
|
|
2999
|
-
}
|
|
3000
|
-
/** @internal */
|
|
3001
|
-
const fieldsBuilder = new FieldsBuilder();
|
|
3002
|
-
|
|
3003
|
-
/** @internal */
|
|
3004
|
-
class EventFieldsBuilder extends FieldsBuilder {
|
|
3005
|
-
constructor(event) {
|
|
3006
|
-
super();
|
|
3007
|
-
this.event = event;
|
|
3008
|
-
}
|
|
3009
|
-
build() {
|
|
3010
|
-
const _super = Object.create(null, {
|
|
3011
|
-
build: { get: () => super.build }
|
|
3012
|
-
});
|
|
3013
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3014
|
-
const fields = yield _super.build.call(this);
|
|
3015
|
-
return new Promise((resolve) => {
|
|
3016
|
-
resolve(Object.assign(Object.assign({}, fields), this.event.toJSON()));
|
|
3017
|
-
});
|
|
3018
|
-
});
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
/** @internal */
|
|
3023
|
-
class WTTracker {
|
|
3024
|
-
constructor() {
|
|
3025
|
-
this.isRunning = false;
|
|
3026
|
-
this.initialized = false;
|
|
3027
|
-
}
|
|
3028
|
-
get isEnabled() {
|
|
3029
|
-
return storageManager.sdkEnabled;
|
|
3030
|
-
}
|
|
3031
|
-
initialize() {
|
|
3032
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3033
|
-
this.getCountryCode();
|
|
3034
|
-
yield this.setActivityTimes();
|
|
3035
|
-
this.createDeviceID();
|
|
3036
|
-
this.addObservers();
|
|
3037
|
-
this.initialized = true;
|
|
3038
|
-
});
|
|
3039
|
-
}
|
|
3040
|
-
startTracking() {
|
|
3041
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3042
|
-
if (!this.isEnabled) {
|
|
3043
|
-
WTLogger.warn("SDK is not enabled to start tracking!");
|
|
3044
|
-
return;
|
|
3045
|
-
}
|
|
3046
|
-
WTLogger.debug("WT Tracker started");
|
|
3047
|
-
yield queueManager.initialize();
|
|
3048
|
-
yield this.checkSdkClicks();
|
|
3049
|
-
yield this.checkFirstSession();
|
|
3050
|
-
yield this.createAttribution();
|
|
3051
|
-
this.isRunning = true;
|
|
3052
|
-
});
|
|
3053
|
-
}
|
|
3054
|
-
stopTracking() {
|
|
3055
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3056
|
-
this.isRunning = false;
|
|
3057
|
-
activityTicker.stop();
|
|
3058
|
-
yield queueManager.shutdown();
|
|
3059
|
-
WTLogger.debug("WT Tracker stopped");
|
|
3060
|
-
});
|
|
3061
|
-
}
|
|
3062
|
-
checkPushToken(token) {
|
|
3063
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3064
|
-
storageManager.pushToken = token;
|
|
3065
|
-
if (!this.isEnabled) {
|
|
3066
|
-
WTLogger.warn("CheckPushToken: SDK is not enabled");
|
|
3067
|
-
return;
|
|
3068
|
-
}
|
|
3069
|
-
if (storageManager.fcmToken === token) {
|
|
3070
|
-
WTLogger.info("This Notification token has sent to server previously");
|
|
3071
|
-
return;
|
|
3072
|
-
}
|
|
3073
|
-
yield this.createRequest({
|
|
3074
|
-
endpoint: WTEndpoints.SDK_INFOS,
|
|
3075
|
-
queueType: "pending",
|
|
3076
|
-
});
|
|
3077
|
-
});
|
|
3078
|
-
}
|
|
3079
|
-
trackEvent(event) {
|
|
3080
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3081
|
-
if (!this.isEnabled) {
|
|
3082
|
-
WTLogger.warn("trackEvent: SDK is not enabled");
|
|
3083
|
-
return;
|
|
3084
|
-
}
|
|
3085
|
-
if (!this.initialized) {
|
|
3086
|
-
WTLogger.warn("trackEvent: SDK is not initialized yet");
|
|
3087
|
-
return;
|
|
3088
|
-
}
|
|
3089
|
-
storageManager.eventCount += 1;
|
|
3090
|
-
yield this.createRequest({
|
|
3091
|
-
endpoint: WTEndpoints.EVENTS,
|
|
3092
|
-
fBuilder: new EventFieldsBuilder(event),
|
|
3093
|
-
queueType: "pending",
|
|
3094
|
-
});
|
|
3095
|
-
});
|
|
3096
|
-
}
|
|
3097
|
-
// =======================================================================
|
|
3098
|
-
getCountryCode() {
|
|
3099
|
-
countryFinder.getCountryCode();
|
|
3100
|
-
}
|
|
3101
|
-
createAttribution() {
|
|
3102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3103
|
-
if (!this.isEnabled) {
|
|
3104
|
-
WTLogger.warn("Creating Attribution: SDK is not enabled!");
|
|
3105
|
-
return;
|
|
3106
|
-
}
|
|
3107
|
-
yield this.createRequest({
|
|
3108
|
-
endpoint: WTEndpoints.ATTRIBUTIONS,
|
|
3109
|
-
queueType: "pending",
|
|
3110
|
-
});
|
|
3111
|
-
});
|
|
3112
|
-
}
|
|
3113
|
-
checkFirstSession() {
|
|
3114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3115
|
-
if (!this.isEnabled) {
|
|
3116
|
-
WTLogger.warn("Creating First Session: SDK is not enabled!");
|
|
3117
|
-
return;
|
|
3118
|
-
}
|
|
3119
|
-
if (storageManager.firstSessionSubmit) {
|
|
3120
|
-
WTLogger.debug("Creating Session: First-Session has already submitted");
|
|
3121
|
-
return;
|
|
3122
|
-
}
|
|
3123
|
-
yield this.createRequest({
|
|
3124
|
-
endpoint: WTEndpoints.SESSIONS,
|
|
3125
|
-
queueType: storageManager.sdkClickSubmit ? "main" : "pending",
|
|
3126
|
-
});
|
|
3127
|
-
});
|
|
3128
|
-
}
|
|
3129
|
-
checkSdkClicks() {
|
|
3130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3131
|
-
if (!this.isEnabled) {
|
|
3132
|
-
WTLogger.warn("Creating Install: SDK is not enabled!");
|
|
3133
|
-
return;
|
|
3134
|
-
}
|
|
3135
|
-
if (storageManager.sdkClickSubmit) {
|
|
3136
|
-
WTLogger.debug("Creating Install: SDK-Clicks has already submitted");
|
|
3137
|
-
return;
|
|
3138
|
-
}
|
|
3139
|
-
yield this.createRequest({
|
|
3140
|
-
endpoint: WTEndpoints.SDK_CLICKS,
|
|
3141
|
-
});
|
|
3142
|
-
});
|
|
3143
|
-
}
|
|
3144
|
-
createRequest(_a) {
|
|
3145
|
-
return __awaiter(this, arguments, void 0, function* ({ endpoint, fBuilder = fieldsBuilder, queueType = "main", }) {
|
|
3146
|
-
const fields = yield fBuilder.build();
|
|
3147
|
-
const request = new RequestRecord(endpoint, fields);
|
|
3148
|
-
if (queueType === "pending") {
|
|
3149
|
-
WTLogger.info(`Add ${endpoint} request to pending queue`);
|
|
3150
|
-
yield queueManager.addPendingRequest(request);
|
|
3151
|
-
}
|
|
3152
|
-
else {
|
|
3153
|
-
WTLogger.info(`Add ${endpoint} request to main queue`);
|
|
3154
|
-
yield queueManager.addRequest(request);
|
|
3155
|
-
}
|
|
3156
|
-
const queueStatus = queueManager.getQueueStatus();
|
|
3157
|
-
console.log(JSON.stringify(queueStatus));
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
|
-
createDeviceID() {
|
|
3161
|
-
if (!storageManager.deviceId) {
|
|
3162
|
-
storageManager.deviceId = cryptoHelper.generateDeviceUUID();
|
|
3163
|
-
}
|
|
3164
|
-
if (!storageManager.initialDate) {
|
|
3165
|
-
storageManager.initialDate = new Date().toISOString();
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
setActivityTimes() {
|
|
3169
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3170
|
-
// Update inactive time to last stored active time
|
|
3171
|
-
if (storageManager.activeTime) {
|
|
3172
|
-
storageManager.inactiveTime = storageManager.activeTime;
|
|
3173
|
-
const inteval = Date.now() - storageManager.inactiveTime;
|
|
3174
|
-
storageManager.inactiveDuration += inteval;
|
|
3175
|
-
console.log(`User was inactived for ${inteval / 1000}s | (${storageManager.inactiveDuration / 1000}s Totaly)`);
|
|
3176
|
-
yield this.checkSessionIntervals();
|
|
3177
|
-
}
|
|
3178
|
-
// update active time to now and start ticker for update active time/duration per 1s
|
|
3179
|
-
storageManager.activeTime = Date.now();
|
|
3180
|
-
activityTicker.start();
|
|
3181
|
-
});
|
|
3182
|
-
}
|
|
3183
|
-
checkSessionIntervals() {
|
|
3184
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3185
|
-
var _a, _b;
|
|
3186
|
-
const inactiveTime = storageManager.inactiveTime;
|
|
3187
|
-
const sessionInterval = (_a = storageManager.appSettings) === null || _a === void 0 ? void 0 : _a.sessionInterval;
|
|
3188
|
-
const subsessionInterval = (_b = storageManager.appSettings) === null || _b === void 0 ? void 0 : _b.subsessionInterval;
|
|
3189
|
-
if (!this.isEnabled) {
|
|
3190
|
-
WTLogger.warn("Creating Session: SDK is not enabled!");
|
|
3191
|
-
return;
|
|
3192
|
-
}
|
|
3193
|
-
if (!inactiveTime || !sessionInterval || !subsessionInterval) {
|
|
3194
|
-
return;
|
|
3195
|
-
}
|
|
3196
|
-
const interval = Date.now() - inactiveTime;
|
|
3197
|
-
if (interval > parseInt(sessionInterval)) {
|
|
3198
|
-
storageManager.sessionCount += 1;
|
|
3199
|
-
yield this.createRequest({
|
|
3200
|
-
endpoint: WTEndpoints.SESSIONS,
|
|
3201
|
-
queueType: storageManager.sdkClickSubmit ? "main" : "pending",
|
|
3202
|
-
});
|
|
3203
|
-
}
|
|
3204
|
-
else if (interval > parseInt(subsessionInterval)) {
|
|
3205
|
-
storageManager.subSessionCount += 1;
|
|
3206
|
-
}
|
|
3207
|
-
});
|
|
3208
|
-
}
|
|
3209
|
-
isVisibleFocused() {
|
|
3210
|
-
return document.visibilityState === "visible" && document.hasFocus();
|
|
3211
|
-
}
|
|
3212
|
-
addObservers() {
|
|
3213
|
-
// document.addEventListener("load", () => {
|
|
3214
|
-
// this.setActivityTimes();
|
|
3215
|
-
// });
|
|
3216
|
-
window.addEventListener("beforeunload", () => {
|
|
3217
|
-
activityTicker.stop();
|
|
3218
|
-
});
|
|
3219
|
-
document.addEventListener("visibilitychange", () => {
|
|
3220
|
-
if (this.isVisibleFocused()) {
|
|
3221
|
-
this.createAttribution();
|
|
3222
|
-
this.setActivityTimes();
|
|
3223
|
-
}
|
|
3224
|
-
else {
|
|
3225
|
-
activityTicker.stop();
|
|
3226
|
-
}
|
|
3227
|
-
});
|
|
3228
|
-
window.addEventListener("focus", () => {
|
|
3229
|
-
if (this.isVisibleFocused()) {
|
|
3230
|
-
this.createAttribution();
|
|
3231
|
-
this.setActivityTimes();
|
|
3232
|
-
}
|
|
3233
|
-
});
|
|
3234
|
-
window.addEventListener("blur", () => {
|
|
3235
|
-
activityTicker.stop();
|
|
3236
|
-
});
|
|
3237
|
-
}
|
|
3238
|
-
}
|
|
3239
|
-
/** @internal */
|
|
3240
|
-
const tracker = new WTTracker();
|
|
3241
|
-
|
|
3242
|
-
/**
|
|
3243
|
-
* The main entry point for the WiseTrack Web SDK.
|
|
3244
|
-
*
|
|
3245
|
-
* Use this singleton to initialize the SDK, configure its behavior, and track events.
|
|
3246
|
-
*
|
|
3247
|
-
* @example
|
|
3248
|
-
* ```ts
|
|
3249
|
-
* const initialConfig: WTInitialConfig = {
|
|
3250
|
-
* appToken: appToken ?? "rMN5ZCwpOzY7",
|
|
3251
|
-
* appFrameWork: "native",
|
|
3252
|
-
* appVersion: "1.0.0",
|
|
3253
|
-
* };
|
|
3254
|
-
* await WiseTrack.instance.init(initialConfig);
|
|
3255
|
-
* ```
|
|
3256
|
-
*/
|
|
3257
|
-
class WiseTrack {
|
|
3258
|
-
/**
|
|
3259
|
-
* Returns the singleton instance of the WiseTrack SDK.
|
|
3260
|
-
*/
|
|
3261
|
-
static get instance() {
|
|
3262
|
-
if (!WiseTrack._instance) {
|
|
3263
|
-
WiseTrack._instance = new WiseTrack();
|
|
3264
|
-
}
|
|
3265
|
-
return WiseTrack._instance;
|
|
3266
|
-
}
|
|
3267
|
-
constructor() {
|
|
3268
|
-
this.sdkInitialized = false;
|
|
3269
|
-
}
|
|
3270
|
-
/**
|
|
3271
|
-
* Initializes the WiseTrack SDK with the given configuration.
|
|
3272
|
-
*
|
|
3273
|
-
* This method must be called before using any tracking features.
|
|
3274
|
-
*
|
|
3275
|
-
* @param initConfig - The initial configuration object.
|
|
3276
|
-
*
|
|
3277
|
-
* @example
|
|
3278
|
-
* ```ts
|
|
3279
|
-
* const initialConfig: WTInitialConfig = {
|
|
3280
|
-
* appToken: appToken ?? "rMN5ZCwpOzY7",
|
|
3281
|
-
* appFrameWork: "native", // your current web app framework (native, reactjs, nextjs, ...)
|
|
3282
|
-
* appVersion: "1.0.0", // your current web app version
|
|
3283
|
-
* };
|
|
3284
|
-
*
|
|
3285
|
-
* ```
|
|
3286
|
-
*/
|
|
3287
|
-
init(initConfig) {
|
|
3288
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3289
|
-
var _a, _b;
|
|
3290
|
-
const config = yield this.getConfig(initConfig);
|
|
3291
|
-
this.checkSdkEnabled(config);
|
|
3292
|
-
this.checkSdkUpdate(config);
|
|
3293
|
-
this.setEnabled(true);
|
|
3294
|
-
yield this.updateAppSettings(config);
|
|
3295
|
-
this.sdkInitialized = true;
|
|
3296
|
-
yield tracker.initialize();
|
|
3297
|
-
const autoStart = (_a = initConfig.startTrackerAutomatically) !== null && _a !== void 0 ? _a : true;
|
|
3298
|
-
if (autoStart) {
|
|
3299
|
-
setTimeout(() => this.startTracking(), ((_b = initConfig.trackingWaitingTime) !== null && _b !== void 0 ? _b : 0) * 1000);
|
|
3300
|
-
}
|
|
3301
|
-
});
|
|
3302
|
-
}
|
|
3303
|
-
/**
|
|
3304
|
-
* Sets the log level for internal SDK logging.
|
|
3305
|
-
*
|
|
3306
|
-
* @param level - The desired log level.
|
|
3307
|
-
*
|
|
3308
|
-
* @example
|
|
3309
|
-
* ```ts
|
|
3310
|
-
* WiseTrack.instance.setLogLevel(WTLogLevel.WARN)
|
|
3311
|
-
* // or
|
|
3312
|
-
* WiseTrack.instance.setLogLevel("warn")
|
|
3313
|
-
*
|
|
3314
|
-
* ```
|
|
3315
|
-
*/
|
|
3316
|
-
setLogLevel(level) {
|
|
3317
|
-
WTLogger.setLevel(level);
|
|
3318
|
-
}
|
|
3319
|
-
/**
|
|
3320
|
-
* Clears all stored data and stops the tracker.
|
|
3321
|
-
*/
|
|
3322
|
-
flush() {
|
|
3323
|
-
WTLogger.info("Clearing Data and stop tracker!");
|
|
3324
|
-
storageManager.clear();
|
|
3325
|
-
this.stopTracking();
|
|
3326
|
-
}
|
|
3327
|
-
/**
|
|
3328
|
-
* Returns whether the SDK is currently enabled.
|
|
3329
|
-
*/
|
|
3330
|
-
isEnabled() {
|
|
3331
|
-
return storageManager.sdkEnabled;
|
|
3332
|
-
}
|
|
3333
|
-
/**
|
|
3334
|
-
* Enables or disables the SDK.
|
|
3335
|
-
*
|
|
3336
|
-
* Throws an error if the SDK is disabled by the server or needs an update.
|
|
3337
|
-
*
|
|
3338
|
-
* @param enabled - Whether to enable the SDK.
|
|
3339
|
-
* @throws If the server has disabled the SDK or a forced update is required.
|
|
3340
|
-
*/
|
|
3341
|
-
setEnabled(enabled) {
|
|
3342
|
-
const config = storageManager.config;
|
|
3343
|
-
if (!config) {
|
|
3344
|
-
throw new Error("Config is not set!");
|
|
3345
|
-
}
|
|
3346
|
-
if (!config.sdkEnabled) {
|
|
3347
|
-
throw new Error("SDK is disabled form server, contact your adminstrator!");
|
|
3348
|
-
}
|
|
3349
|
-
if (config.forceUpdate) {
|
|
3350
|
-
throw new Error("The version you are currently using has expired and is no longer supported. Please update to the latest version to continue using the SDK");
|
|
3351
|
-
}
|
|
3352
|
-
storageManager.sdkEnabled = enabled;
|
|
3353
|
-
}
|
|
3354
|
-
/**
|
|
3355
|
-
* Starts the tracking process.
|
|
3356
|
-
*
|
|
3357
|
-
* @remarks
|
|
3358
|
-
* The SDK must be initialized and enabled before calling this method.
|
|
3359
|
-
*
|
|
3360
|
-
* NOTE: call this method just if you set startTrackerAutomatically=false in WTInitialConfig
|
|
3361
|
-
*/
|
|
3362
|
-
startTracking() {
|
|
3363
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3364
|
-
if (!this.sdkInitialized) {
|
|
3365
|
-
WTLogger.warn("‼️ Start Tracking: SDK is not initialized yet");
|
|
3366
|
-
return;
|
|
3367
|
-
}
|
|
3368
|
-
if (!this.isEnabled()) {
|
|
3369
|
-
WTLogger.warn("Start Tracking: SDK is not enabled!");
|
|
3370
|
-
return;
|
|
3371
|
-
}
|
|
3372
|
-
yield tracker.startTracking();
|
|
3373
|
-
});
|
|
3374
|
-
}
|
|
3375
|
-
/**
|
|
3376
|
-
* Stops the tracking process.
|
|
3377
|
-
*/
|
|
3378
|
-
stopTracking() {
|
|
3379
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3380
|
-
yield tracker.stopTracking();
|
|
3381
|
-
});
|
|
3382
|
-
}
|
|
3383
|
-
/**
|
|
3384
|
-
* Sets the Firebase Cloud Messaging (FCM) push token for server.
|
|
3385
|
-
*
|
|
3386
|
-
* @param token - The FCM token.
|
|
3387
|
-
*/
|
|
3388
|
-
setFCMToken(token) {
|
|
3389
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3390
|
-
if (!this.sdkInitialized) {
|
|
3391
|
-
WTLogger.warn("‼️ Set Fcm Token: SDK is not initialized yet");
|
|
3392
|
-
return;
|
|
3393
|
-
}
|
|
3394
|
-
if (!this.isEnabled()) {
|
|
3395
|
-
WTLogger.warn("Set Fcm Token: SDK is not enabled!");
|
|
3396
|
-
return;
|
|
3397
|
-
}
|
|
3398
|
-
yield tracker.checkPushToken(token);
|
|
3399
|
-
});
|
|
3400
|
-
}
|
|
3401
|
-
/**
|
|
3402
|
-
* Tracks a custom event or revenue event.
|
|
3403
|
-
*
|
|
3404
|
-
* @param event - The event object to be tracked.
|
|
3405
|
-
*
|
|
3406
|
-
* @example
|
|
3407
|
-
* ```ts
|
|
3408
|
-
* // Create a Default Event
|
|
3409
|
-
* const defaultEvent = new WTEvent.Default("default-event");
|
|
3410
|
-
* defaultEvent.addParam("key1", "value1");
|
|
3411
|
-
* defaultEvent.addParam("key2", 123);
|
|
3412
|
-
* defaultEvent.addParam("key3", true);
|
|
3413
|
-
* await WiseTrack.instance.trackEvent(defaultEvent);
|
|
3414
|
-
*
|
|
3415
|
-
* // Create a Revenue Event
|
|
3416
|
-
* const revenueEvent = new WTEvent.Revenue("revenue-event", 100, "USD");
|
|
3417
|
-
* revenueEvent.addParam("item_id", "item123");
|
|
3418
|
-
* revenueEvent.addParam("quantity", 2);
|
|
3419
|
-
* await WiseTrack.instance.trackEvent(revenueEvent);
|
|
3420
|
-
* ```
|
|
3421
|
-
*/
|
|
3422
|
-
trackEvent(event) {
|
|
3423
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3424
|
-
if (!this.sdkInitialized) {
|
|
3425
|
-
WTLogger.warn("‼️ Track Event: SDK is not initialized yet");
|
|
3426
|
-
return;
|
|
3427
|
-
}
|
|
3428
|
-
if (!this.isEnabled()) {
|
|
3429
|
-
WTLogger.warn("Track Event: SDK is not enabled!");
|
|
3430
|
-
return;
|
|
3431
|
-
}
|
|
3432
|
-
yield tracker.trackEvent(event);
|
|
3433
|
-
});
|
|
3434
|
-
}
|
|
3435
|
-
// ===========================================================================
|
|
3436
|
-
/** @internal */
|
|
3437
|
-
getConfig(initConfig) {
|
|
3438
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3439
|
-
storageManager.initialConfig = initConfig;
|
|
3440
|
-
let config;
|
|
3441
|
-
try {
|
|
3442
|
-
config = yield apiClient.doGetConfig();
|
|
3443
|
-
}
|
|
3444
|
-
catch (error) {
|
|
3445
|
-
if (!(error instanceof ApiError.NetworkError)) {
|
|
3446
|
-
WTLogger.info("‼️ SDK Config NOT set!, check errors.");
|
|
3447
|
-
throw error;
|
|
3448
|
-
}
|
|
3449
|
-
config = storageManager.config || WTConfig.defaultValue;
|
|
3450
|
-
}
|
|
3451
|
-
storageManager.config = config;
|
|
3452
|
-
WTLogger.info("SDK Config set");
|
|
3453
|
-
return config;
|
|
3454
|
-
});
|
|
3455
|
-
}
|
|
3456
|
-
/** @internal */
|
|
3457
|
-
updateAppSettings(config) {
|
|
3458
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3459
|
-
let appSettings;
|
|
3460
|
-
if (!EnvironmentUtils.needAppSettings()) {
|
|
3461
|
-
appSettings = WTAppSettings.fromConfig(config);
|
|
3462
|
-
}
|
|
3463
|
-
else {
|
|
3464
|
-
WTLogger.debug(`Need to get app-settings for ${EnvironmentUtils.sdkEnvironment} environment`);
|
|
3465
|
-
try {
|
|
3466
|
-
appSettings = yield apiClient.doGetAppSettings();
|
|
3467
|
-
}
|
|
3468
|
-
catch (error) {
|
|
3469
|
-
if (!(error instanceof ApiError.NetworkError)) {
|
|
3470
|
-
WTLogger.info("‼️ App Settings NOT set!, check errors.");
|
|
3471
|
-
throw error;
|
|
3472
|
-
}
|
|
3473
|
-
appSettings = WTAppSettings.defaultValue;
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
|
-
storageManager.appSettings = appSettings;
|
|
3477
|
-
WTLogger.info("App Settings set");
|
|
3478
|
-
return appSettings;
|
|
3479
|
-
});
|
|
3480
|
-
}
|
|
3481
|
-
/** @internal */
|
|
3482
|
-
checkSdkEnabled(config) {
|
|
3483
|
-
if (!config.sdkEnabled) {
|
|
3484
|
-
const message = "SDK is disabled form server, contact your adminstrator!";
|
|
3485
|
-
WTLogger.error(message);
|
|
3486
|
-
throw new Error(message);
|
|
3487
|
-
}
|
|
3488
|
-
}
|
|
3489
|
-
/** @internal */
|
|
3490
|
-
checkSdkUpdate(config) {
|
|
3491
|
-
if (config.forceUpdate) {
|
|
3492
|
-
const message = "The version you are currently using has expired and is no longer supported. Please update to the latest version to continue using the SDK";
|
|
3493
|
-
WTLogger.error(message);
|
|
3494
|
-
throw new Error(message);
|
|
3495
|
-
}
|
|
3496
|
-
if (config.sdkUpdate) {
|
|
3497
|
-
WTLogger.warn("A new version of the SDK is available. It is recommended to update to the latest version to enjoy improved features and better performance.");
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
}
|
|
3501
|
-
|
|
3502
|
-
exports.WTEvent = void 0;
|
|
3503
|
-
(function (WTEvent) {
|
|
3504
|
-
/**
|
|
3505
|
-
* Represents a generic custom event.
|
|
3506
|
-
*
|
|
3507
|
-
* Use this class to log custom actions performed by the user.
|
|
3508
|
-
*
|
|
3509
|
-
* @example
|
|
3510
|
-
* ```ts
|
|
3511
|
-
* const event = new WTEvent.Default("signup");
|
|
3512
|
-
* event.addParam("method", "Google");
|
|
3513
|
-
* WiseTrack.instance.trackEvent(event);
|
|
3514
|
-
* ```
|
|
3515
|
-
*/
|
|
3516
|
-
class Default {
|
|
3517
|
-
/**
|
|
3518
|
-
* Creates a new custom event.
|
|
3519
|
-
* @param name - The name of the event.
|
|
3520
|
-
*/
|
|
3521
|
-
constructor(name) {
|
|
3522
|
-
/**
|
|
3523
|
-
* The type of event.
|
|
3524
|
-
* @internal
|
|
3525
|
-
*/
|
|
3526
|
-
this.type = "default";
|
|
3527
|
-
this.name = name;
|
|
3528
|
-
}
|
|
3529
|
-
/**
|
|
3530
|
-
* Adds a parameter to the event.
|
|
3531
|
-
*
|
|
3532
|
-
* @param key - The parameter key.
|
|
3533
|
-
* @param value - The parameter value.
|
|
3534
|
-
*/
|
|
3535
|
-
addParam(key, value) {
|
|
3536
|
-
var _a;
|
|
3537
|
-
let _params = (_a = this.params) !== null && _a !== void 0 ? _a : {};
|
|
3538
|
-
_params[key] = value;
|
|
3539
|
-
this.params = _params;
|
|
3540
|
-
}
|
|
3541
|
-
/** @internal */
|
|
3542
|
-
toJSON() {
|
|
3543
|
-
return {
|
|
3544
|
-
event_type: this.type,
|
|
3545
|
-
event_name: this.name,
|
|
3546
|
-
partner_params: this.params,
|
|
3547
|
-
};
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
WTEvent.Default = Default;
|
|
3551
|
-
/**
|
|
3552
|
-
* Represents a revenue event with an amount and currency.
|
|
3553
|
-
*
|
|
3554
|
-
* Use this class to log purchases or monetary transactions.
|
|
3555
|
-
*
|
|
3556
|
-
* @example
|
|
3557
|
-
* ```ts
|
|
3558
|
-
* const purchase = new WTEvent.Revenue("order_complete", 49.99, RevenueCurrency.USD);
|
|
3559
|
-
* purchase.addParam("item_count", "3");
|
|
3560
|
-
* WiseTrack.instance.trackEvent(purchase);
|
|
3561
|
-
* ```
|
|
3562
|
-
*/
|
|
3563
|
-
class Revenue extends Default {
|
|
3564
|
-
/**
|
|
3565
|
-
* Creates a new revenue event.
|
|
3566
|
-
*
|
|
3567
|
-
* @param name - The name of the revenue event.
|
|
3568
|
-
* @param amount - The amount of revenue.
|
|
3569
|
-
* @param currency - The currency of the revenue.
|
|
3570
|
-
*/
|
|
3571
|
-
constructor(name, amount, currency) {
|
|
3572
|
-
super(name);
|
|
3573
|
-
/**
|
|
3574
|
-
* The type of event.
|
|
3575
|
-
* @internal
|
|
3576
|
-
*/
|
|
3577
|
-
this.type = "revenue";
|
|
3578
|
-
this.amount = amount;
|
|
3579
|
-
this.currency = currency;
|
|
3580
|
-
}
|
|
3581
|
-
/** @internal */
|
|
3582
|
-
toJSON() {
|
|
3583
|
-
return {
|
|
3584
|
-
event_type: this.type,
|
|
3585
|
-
event_name: this.name,
|
|
3586
|
-
revenue: this.amount,
|
|
3587
|
-
currency: this.currency,
|
|
3588
|
-
partner_params: this.params,
|
|
3589
|
-
};
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
WTEvent.Revenue = Revenue;
|
|
3593
|
-
})(exports.WTEvent || (exports.WTEvent = {}));
|
|
3594
|
-
|
|
3595
|
-
exports.WTLogEngine = WTLogEngine;
|
|
3596
|
-
exports.WTLogLevel = WTLogLevel;
|
|
3597
|
-
exports.WTLogger = WTLogger;
|
|
3598
|
-
exports.WiseTrack = WiseTrack;
|
|
3599
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";function __awaiter(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function _0x14b6(){const e=["2.0.0","web","1229425lwxzqw","6731285omubvn","2616jtayGq","37899NeccLd","https://config.wisetrack.io","2236682xJruES","21528970FbcPGD","1800000","17475HwluVB","997bfbb583c1245a426a53dc1899ec779ff354f9","432ApjaMx","502668InQBYk","77MrWKiy","debug"];return(_0x14b6=function(){return e})()}"function"==typeof SuppressedError&&SuppressedError;const _0x351a10=_0x2986;function _0x2986(e,t){const r=_0x14b6();return(_0x2986=function(e,t){return r[e-=314]})(e,t)}!function(){const e=_0x2986,t=_0x14b6();for(;;)try{if(744063===parseInt(e(324))/1+-parseInt(e(329))/2+parseInt(e(316))/3*(-parseInt(e(318))/4)+-parseInt(e(325))/5+parseInt(e(319))/6*(-parseInt(e(320))/7)+-parseInt(e(326))/8*(-parseInt(e(327))/9)+parseInt(e(314))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const WTConstants={SDK:{HASH:_0x351a10(317),PLATFORM:_0x351a10(323),VERSION:_0x351a10(322)},CONFIG:{BASE_URL:_0x351a10(328),DEFAULT_ENVIRONMENT:_0x351a10(321)},DEFAULTS:{LOG_LEVEL:_0x351a10(321),SESSION_INTERVAL:_0x351a10(315),SUBSESSION_INTERVAL:"300000",PARAMETERS_VALUE:void 0}},_0x43638b=_0x4e47;function _0x3b7c(){const e=["STAGE","10311750tcWOly","89943IxzfwN","423933FEunmw","https://core.debug.wisetrackdev.ir","sdkEnvironment","718510rCKGWb","PRODUCTION","DEBUG","6QmzTlm","8807283IaeXlw","debug","CONFIG","DEFAULT_ENVIRONMENT","3528264BjviwK","production","193812RItLyo","Unknown environment: ","stage","304xbQMSj","36lhujQf","https://core.stage.wisetrackdev.ir"];return(_0x3b7c=function(){return e})()}function _0x4e47(e,t){const r=_0x3b7c();return(_0x4e47=function(e,t){return r[e-=116]})(e,t)}!function(){const e=_0x4e47,t=_0x3b7c();for(;;)try{if(751117===-parseInt(e(120))/1+-parseInt(e(135))/2*(-parseInt(e(129))/3)+-parseInt(e(118))/4+-parseInt(e(132))/5*(-parseInt(e(124))/6)+parseInt(e(128))/7*(parseInt(e(123))/8)+-parseInt(e(136))/9+parseInt(e(127))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),_0x43638b(119);const WTSDKEnvironment={DEBUG:_0x43638b(137),STAGE:_0x43638b(122),PRODUCTION:_0x43638b(119)},EnvironmentUtils={sdkEnvironment:WTConstants[_0x43638b(116)][_0x43638b(117)],needAppSettings(){const e=_0x43638b;return this[e(131)]!==WTSDKEnvironment[e(133)]},baseUrl(){const e=_0x43638b;switch(this[e(131)]){case WTSDKEnvironment[e(134)]:return e(130);case WTSDKEnvironment[e(126)]:return e(125);case WTSDKEnvironment[e(133)]:return"https://core.wisetrack.io";default:throw new Error(e(121)+this.sdkEnvironment)}}},_0x3f3b61=_0x31e1;!function(){const e=_0x31e1,t=_0x4f28();for(;;)try{if(988936===parseInt(e(341))/1+-parseInt(e(339))/2*(parseInt(e(348))/3)+-parseInt(e(346))/4+parseInt(e(345))/5*(-parseInt(e(350))/6)+parseInt(e(343))/7+parseInt(e(338))/8+-parseInt(e(347))/9)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const WTEndpoints={EVENTS:_0x3f3b61(349),SESSIONS:_0x3f3b61(340),SDK_CLICKS:_0x3f3b61(344),SDK_INFOS:_0x3f3b61(351),ATTRIBUTIONS:_0x3f3b61(342),APP_SETTINGS:"/api/v1/app_settings"};function _0x31e1(e,t){const r=_0x4f28();return(_0x31e1=function(e,t){return r[e-=338]})(e,t)}function _0x4f28(){const e=["6cerXcD","/api/v1/events","6jMGsru","/api/v1/sdk_infos","12953432LFoHNn","1592296BdnnDJ","/api/v1/sessions","1770256tAQata","/api/v1/attributions","9366049rSQmGo","/api/v1/sdk_clicks","8019985GmOrJc","346620cdjqqP","4100022IIDRZz"];return(_0x4f28=function(){return e})()}var _0x8d603a=_0x345e;function _0x4fe0(){var e=["1614OkFqAW","sdkInfos","4086DrPsjR","30QnMdiQ","fromJson","SDK_CLICKS","subsessionInterval","140JZHwJZ","attributions","239WhgYSJ","EVENTS","379955MitNhI","sdkClicks","events","DEFAULTS","26jtGIBT","session_interval","1848024IlRPWH","3446216PyTvWU","sessions","387706DTEvBX","SESSIONS","7xokBXC","SESSION_INTERVAL","fromConfig","ATTRIBUTIONS","960eodpcx","sdk_infos","sessionInterval","SUBSESSION_INTERVAL","3469308GAvodM"];return(_0x4fe0=function(){return e})()}function _0x345e(e,t){var r=_0x4fe0();return(_0x345e=function(e,t){return r[e-=151]})(e,t)}!function(){for(var e=_0x345e,t=_0x4fe0();;)try{if(428897===parseInt(e(174))/1*(parseInt(e(167))/2)+parseInt(e(165))/3*(-parseInt(e(160))/4)+parseInt(e(176))/5*(parseInt(e(168))/6)+parseInt(e(156))/7*(-parseInt(e(152))/8)+parseInt(e(151))/9+parseInt(e(172))/10*(parseInt(e(154))/11)+-parseInt(e(164))/12*(parseInt(e(180))/13))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class WTAppSettings{constructor(e,t,r,i,n,s=WTConstants.DEFAULTS[_0x8d603a(157)],o=WTConstants[_0x8d603a(179)][_0x8d603a(163)]){var a=_0x8d603a;this[a(178)]=e,this[a(153)]=t,this[a(177)]=r,this[a(166)]=i,this[a(173)]=n,this[a(162)]=s,this[a(171)]=o}static[_0x8d603a(158)](e){var t=_0x8d603a;return new WTAppSettings(e[t(178)],e[t(153)],e[t(177)],e.sdkInfos,e[t(173)],e[t(162)],e[t(171)])}static[_0x8d603a(169)](e){var t,r,i=_0x8d603a;return new WTAppSettings(e[i(178)],e.sessions,e.sdk_clicks,e[i(161)],e.attributions,null!==(t=e[i(181)])&&void 0!==t?t:WTConstants[i(179)][i(157)],null!==(r=e.subsession_interval)&&void 0!==r?r:WTConstants.DEFAULTS.SUBSESSION_INTERVAL)}static get defaultValue(){var e=_0x8d603a;return new WTAppSettings(WTEndpoints[e(175)],WTEndpoints[e(155)],WTEndpoints[e(170)],WTEndpoints.SDK_INFOS,WTEndpoints[e(159)],WTConstants[e(179)][e(157)],WTConstants.DEFAULTS.SUBSESSION_INTERVAL)}}function _0x2fbb(e,t){var r=_0x1369();return(_0x2fbb=function(e,t){return r[e-=412]})(e,t)}var _0x26e84c=_0x2fbb;function _0x1369(){var e=["sdk_infos","10542rZIZtr","EVENTS","11PqYZFD","subsessionInterval","force_update","2495Qmxjnv","sdkClicks","4003560wMLIDF","1604106SMALkS","sdk_clicks","fromJson","970047KLxSLJ","SESSION_INTERVAL","forceUpdate","defaultValue","4DANKDd","attributions","17618710TahGcN","APP_SETTINGS","sdk_update","SDK_CLICKS","8ijURLj","5607322bTQmZL","sdkEnabled","appSettings","DEFAULTS","76149372NlNqyf","session_interval","2SAfwiE","sdk_enabled","baseUrl","SESSIONS","sessions","base_url","SUBSESSION_INTERVAL","app_settings"];return(_0x1369=function(){return e})()}!function(){for(var e=_0x2fbb,t=_0x1369();;)try{if(956532===parseInt(e(425))/1*(-parseInt(e(442))/2)+parseInt(e(422))/3*(-parseInt(e(429))/4)+-parseInt(e(419))/5*(parseInt(e(414))/6)+parseInt(e(436))/7*(-parseInt(e(435))/8)+-parseInt(e(421))/9+parseInt(e(431))/10*(-parseInt(e(416))/11)+parseInt(e(440))/12)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class WTConfig{constructor(e,t,r,i,n,s,o,a=!0,c=!1,u=!1,d=WTConstants[_0x26e84c(439)].SESSION_INTERVAL,p=WTConstants[_0x26e84c(439)][_0x26e84c(448)]){var l=_0x26e84c;this[l(444)]=e,this.events=t,this.sessions=r,this[l(420)]=i,this.sdkInfos=n,this[l(430)]=s,this[l(438)]=o,this[l(437)]=a,this[l(427)]=c,this.sdkUpdate=u,this.sessionInterval=d,this[l(417)]=p}static[_0x26e84c(424)](e){var t,r,i,n,s,o=_0x26e84c;return new WTConfig(e[o(447)],e.events,e[o(446)],e[o(423)],e[o(413)],e[o(430)],e[o(412)],null===(t=e[o(443)])||void 0===t||t,null!==(r=e[o(418)])&&void 0!==r&&r,null!==(i=e[o(433)])&&void 0!==i&&i,null!==(n=e[o(441)])&&void 0!==n?n:WTConstants[o(439)][o(426)],null!==(s=e.subsession_interval)&&void 0!==s?s:WTConstants[o(439)][o(448)])}static get[_0x26e84c(428)](){var e=_0x26e84c;return new WTConfig(EnvironmentUtils[e(444)](),WTEndpoints[e(415)],WTEndpoints[e(445)],WTEndpoints[e(434)],WTEndpoints.SDK_INFOS,WTEndpoints.ATTRIBUTIONS,WTEndpoints[e(432)])}}const _0x52b81d=_0x1742;function _0x1742(e,t){const r=_0x2500();return(_0x1742=function(e,t){return r[e-=124]})(e,t)}!function(){const e=_0x1742,t=_0x2500();for(;;)try{if(203459===-parseInt(e(148))/1+parseInt(e(137))/2*(-parseInt(e(146))/3)+parseInt(e(138))/4+-parseInt(e(143))/5+parseInt(e(132))/6+-parseInt(e(140))/7+parseInt(e(130))/8)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class WTLogEngine{}class ConsoleLogEngine extends WTLogEngine{[_0x52b81d(127)](e,t,...r){const i=_0x52b81d;switch(e){case i(135):console[i(135)](t,...r);break;case i(144):console.info(t,...r);break;case"warn":console[i(136)](t,...r);break;case i(129):console.error(t,...r);break;default:console[i(127)](t,...r)}}}const WTLogLevel={DEBUG:_0x52b81d(135),INFO:_0x52b81d(144),WARN:_0x52b81d(136),ERROR:_0x52b81d(129),NONE:_0x52b81d(134)};function _0x2500(){const e=["setLevel","157452jGUHaN","prefix","level","LOG_LEVEL","log","push","error","1234176mNBMwE","indexOf","2199906VNBncV","shouldLog","none","debug","warn","2whXiJt","1571216PmJpsu","setPrefix","1299557fQLjAt","addOutputEngine","toUpperCase","1556820WYnpJA","info","outputEngines","167403MrWGBY"];return(_0x2500=function(){return e})()}class WTLogger{static[_0x52b81d(147)](e){this[_0x52b81d(125)]=e}static[_0x52b81d(139)](e){this[_0x52b81d(124)]=e}static[_0x52b81d(141)](e){const t=_0x52b81d;this.outputEngines[t(128)](e)}static[_0x52b81d(133)](e){const t=_0x52b81d,r=[t(135),t(144),"warn",t(129)],i=r[t(131)](this[t(125)]);return r[t(131)](e)>=i}static[_0x52b81d(127)](e,...t){const r=_0x52b81d;if(!this[r(133)](e))return;const i="["+this[r(124)]+"-"+e[r(142)]()+"]";for(const n of this[r(145)])n[r(127)](e,i,...t)}static[_0x52b81d(135)](...e){const t=_0x52b81d;this.log(t(135),...e)}static info(...e){this.log("info",...e)}static[_0x52b81d(136)](...e){this[_0x52b81d(127)]("warn",...e)}static error(...e){const t=_0x52b81d;this[t(127)](t(129),...e)}}WTLogger[_0x52b81d(125)]=WTConstants.DEFAULTS[_0x52b81d(126)],WTLogger.prefix="WT",WTLogger.outputEngines=[new ConsoleLogEngine];var _0x1e107b=_0x15dc;function _0x1c3b(){var e=["7591243CpOSDJ","firstSessionSubmit","WT.Configs","pushToken","fcmToken","WT.RequestQueue","pendingRequestRecords","3jxMozy","FIRST_SESSION_SUBMIT","sdkClickSubmit","true","WT.PendingRequestQueue","5CirfLU","48rXelSA","inactiveTime","4nFpkVW","optionalNumber","1010CMdOtD","getItem","WT.InactiveTime","toString","setJson","Error in encoding object for key '","SDK_ENABLED","7NBQjFy","error","optionalBool","2123202ZXnKOO","': ","WT.InactiveDuration","eventCount","WT.InitialDate","71793yKMJqT","activeTime","EVENT_COUNT","WT.SessionCount","WT.SessionLenght","appSettings","WT.DeviceId","sessionCount","CONFIG","1315576WaPzmk","DEVICE_ID","8310152rRyFjV","initialDate","INACTIVE_DURATION","WT.FcmToken","setItem","WT.InitialConfigs","initialConfig","sdkEnabled","9175088sRfBoh","clear","WT.ActiveTime","activeDuration","WT.SdkClickSubmit","PUSH_TOKEN","PENDING_REQUEST_QUEUE","subSessionCount","stringify","WT.AppSettings","FCM_TOKEN","547211iDBnEY","WT.FirstSessionSubmit","ACTIVE_TIME","getJson","WT.SdkEnabled","deviceId","inactiveDuration","INACTIVE_TIME","WT.EventCount","APP_SETTINGS","REQUEST_QUEUE","false","removeItem","SESSION_LENGTH","SUBSESSION_COUNT"];return(_0x1c3b=function(){return e})()}function _0x15dc(e,t){var r=_0x1c3b();return(_0x15dc=function(e,t){return r[e-=221]})(e,t)}!function(){for(var e=_0x15dc,t=_0x1c3b();;)try{if(599322===-parseInt(e(257))/1*(parseInt(e(287))/2)+-parseInt(e(279))/3*(parseInt(e(236))/4)+-parseInt(e(284))/5*(-parseInt(e(222))/6)+-parseInt(e(296))/7*(parseInt(e(238))/8)+parseInt(e(227))/9*(-parseInt(e(289))/10)+parseInt(e(272))/11+-parseInt(e(285))/12*(-parseInt(e(246))/13))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const WTStorageKeys={DEVICE_ID:_0x1e107b(233),INITIAL_DATE:_0x1e107b(226),INITIAL_CONFIG:_0x1e107b(243),CONFIG:_0x1e107b(274),APP_SETTINGS:_0x1e107b(255),SDK_CLICK_SUBMIT:_0x1e107b(250),FIRST_SESSION_SUBMIT:_0x1e107b(258),SDK_ENABLED:_0x1e107b(261),FCM_TOKEN:_0x1e107b(241),PUSH_TOKEN:"WT.PushToken",EVENT_COUNT:_0x1e107b(265),SESSION_COUNT:_0x1e107b(230),SESSION_LENGTH:_0x1e107b(231),SUBSESSION_COUNT:"WT.SubSessionCount",ACTIVE_TIME:_0x1e107b(248),INACTIVE_TIME:_0x1e107b(291),INACTIVE_DURATION:_0x1e107b(224),REQUEST_QUEUE:_0x1e107b(277),PENDING_REQUEST_QUEUE:_0x1e107b(283)};class StorageManager{[_0x1e107b(247)](){localStorage[_0x1e107b(247)]()}[_0x1e107b(293)](e,t){var r=_0x1e107b;if(t)try{const i=JSON[r(254)](t);localStorage[r(242)](e,i)}catch(t){WTLogger[r(297)](r(294)+e+"'",t)}else localStorage.removeItem(e)}getJson(e){var t=_0x1e107b;const r=localStorage[t(290)](e);if(!r)return null;try{return JSON.parse(r)}catch(r){return WTLogger.error("Error in JSON decoding for key '"+e+t(223)+r,r),null}}[_0x1e107b(288)](e){const t=localStorage[_0x1e107b(290)](e);if(null===t)return null;const r=Number(t);return isNaN(r)?null:r}[_0x1e107b(221)](e){var t=_0x1e107b;const r=localStorage[t(290)](e);return null===r?null:r===t(282)||r!==t(268)&&null}get[_0x1e107b(262)](){var e=_0x1e107b;return localStorage[e(290)](WTStorageKeys[e(237)])}set[_0x1e107b(262)](e){var t=_0x1e107b;e?localStorage[t(242)](WTStorageKeys.DEVICE_ID,e):localStorage[t(269)](WTStorageKeys[t(237)])}get[_0x1e107b(239)](){return this[_0x1e107b(260)](WTStorageKeys.INITIAL_DATE)}set[_0x1e107b(239)](e){this.setJson(WTStorageKeys.INITIAL_DATE,e)}get[_0x1e107b(244)](){return this[_0x1e107b(260)](WTStorageKeys.INITIAL_CONFIG)}set initialConfig(e){this[_0x1e107b(293)](WTStorageKeys.INITIAL_CONFIG,e)}get config(){var e=_0x1e107b;return this[e(260)](WTStorageKeys[e(235)])}set config(e){var t=_0x1e107b;this[t(293)](WTStorageKeys[t(235)],e)}get[_0x1e107b(232)](){var e=_0x1e107b;return this[e(260)](WTStorageKeys[e(266)])}set[_0x1e107b(232)](e){this[_0x1e107b(293)](WTStorageKeys.APP_SETTINGS,e)}get[_0x1e107b(245)](){var e,t=_0x1e107b;return null!==(e=this[t(221)](WTStorageKeys[t(295)]))&&void 0!==e&&e}set[_0x1e107b(245)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys[t(295)],e[t(292)]())}get[_0x1e107b(281)](){var e;return null!==(e=this.optionalBool(WTStorageKeys.SDK_CLICK_SUBMIT))&&void 0!==e&&e}set[_0x1e107b(281)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys.SDK_CLICK_SUBMIT,e[t(292)]())}get firstSessionSubmit(){var e,t=_0x1e107b;return null!==(e=this[t(221)](WTStorageKeys[t(280)]))&&void 0!==e&&e}set[_0x1e107b(273)](e){var t=_0x1e107b;localStorage.setItem(WTStorageKeys.FIRST_SESSION_SUBMIT,e[t(292)]())}get fcmToken(){return localStorage[_0x1e107b(290)](WTStorageKeys.FCM_TOKEN)}set[_0x1e107b(276)](e){var t=_0x1e107b;e?localStorage[t(242)](WTStorageKeys[t(256)],e):localStorage[t(269)](WTStorageKeys[t(256)])}get[_0x1e107b(275)](){var e=_0x1e107b;return localStorage[e(290)](WTStorageKeys[e(251)])}set[_0x1e107b(275)](e){var t=_0x1e107b;e?localStorage[t(242)](WTStorageKeys[t(251)],e):localStorage[t(269)](WTStorageKeys[t(251)])}get[_0x1e107b(234)](){var e;return null!==(e=this[_0x1e107b(288)](WTStorageKeys.SESSION_COUNT))&&void 0!==e?e:1}set[_0x1e107b(234)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys.SESSION_COUNT,e[t(292)]())}get[_0x1e107b(253)](){var e,t=_0x1e107b;return null!==(e=this.optionalNumber(WTStorageKeys[t(271)]))&&void 0!==e?e:1}set[_0x1e107b(253)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys[t(271)],e[t(292)]())}get activeDuration(){var e,t=_0x1e107b;return null!==(e=this[t(288)](WTStorageKeys[t(270)]))&&void 0!==e?e:0}set[_0x1e107b(249)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys[t(270)],e.toString())}get[_0x1e107b(263)](){var e,t=_0x1e107b;return null!==(e=this[t(288)](WTStorageKeys[t(240)]))&&void 0!==e?e:0}set[_0x1e107b(263)](e){var t=_0x1e107b;localStorage[t(242)](WTStorageKeys[t(240)],e[t(292)]())}get[_0x1e107b(286)](){var e=_0x1e107b;return this[e(288)](WTStorageKeys[e(259)])}set inactiveTime(e){var t=_0x1e107b;null!==e?localStorage[t(242)](WTStorageKeys[t(259)],e.toString()):localStorage[t(269)](WTStorageKeys[t(259)])}get[_0x1e107b(228)](){var e=_0x1e107b;return this[e(288)](WTStorageKeys[e(264)])}set[_0x1e107b(228)](e){var t=_0x1e107b;null!==e?localStorage.setItem(WTStorageKeys.INACTIVE_TIME,e.toString()):localStorage[t(269)](WTStorageKeys[t(264)])}get requestRecords(){var e,t=_0x1e107b;return null!==(e=this[t(260)](WTStorageKeys[t(267)]))&&void 0!==e?e:[]}set requestRecords(e){var t=_0x1e107b;this[t(293)](WTStorageKeys[t(267)],e)}get[_0x1e107b(278)](){var e,t=_0x1e107b;return null!==(e=this[t(260)](WTStorageKeys[t(252)]))&&void 0!==e?e:[]}set[_0x1e107b(278)](e){var t=_0x1e107b;this[t(293)](WTStorageKeys[t(252)],e)}get eventCount(){var e,t=_0x1e107b;return null!==(e=this[t(288)](WTStorageKeys[t(229)]))&&void 0!==e?e:0}set[_0x1e107b(225)](e){var t=_0x1e107b;localStorage.setItem(WTStorageKeys[t(229)],e[t(292)]())}}const storageManager=new StorageManager;function _0x5b1a(e,t){var r=_0x48b9();return(_0x5b1a=function(e,t){return r[e-=488]})(e,t)}var ApiError;function _0x48b9(){var e=["2217606aHBpWV","statusCode","411020jSqFax","Invalid URL: ","23743Cjfpti","14vmqAPI","NetworkFailure","7548152VAxKHx","261VRSYng","2687130kYJctn","NetworkError: ","307104MNXjcZ","21KJsRDQ","NetworkError","InvalidUrl","message","name","DecodingError","2472102AuFIZl"];return(_0x48b9=function(){return e})()}!function(){for(var e=_0x5b1a,t=_0x48b9();;)try{if(787075===parseInt(e(505))/1*(parseInt(e(506))/2)+-parseInt(e(501))/3+-parseInt(e(493))/4+parseInt(e(491))/5+parseInt(e(500))/6*(-parseInt(e(494))/7)+parseInt(e(489))/8+parseInt(e(490))/9*(parseInt(e(503))/10))break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),function(e){var t=_0x5b1a;class r extends Error{constructor(e){var t=_0x5b1a;super(t(504)+e),this[t(498)]=t(496)}}e[t(496)]=r;class i extends Error{constructor(e,r){var i=t;super("ServerError "+e+": "+r),this[i(502)]=e,this[i(497)]=r,this[i(498)]="ServerError"}}e.ServerError=i;class n extends Error{constructor(e){var r=t;super(r(492)+e),this[r(498)]=r(488)}}e[t(495)]=n;class s extends Error{constructor(e){var r=t;super("DecodingError: "+e),this[r(498)]="DecodingError"}}e[t(499)]=s}(ApiError||(ApiError={}));var _0xf4a5f=_0x4f9c;function _0x4f9c(e,t){var r=_0x5363();return(_0x4f9c=function(e,t){return r[e-=446]})(e,t)}function _0x5363(){var e=["803652UohxDK","477780ITnarH","1426nWSjCF","427ATTzDX","retryInterval","1876546nSKTHl","maxRetries","1930465cdcpSm","6rsehvv","2274064wfogJg","canRetry","872766hnyhpb"];return(_0x5363=function(){return e})()}!function(){for(var e=_0x4f9c,t=_0x5363();;)try{if(217217===parseInt(e(448))/1*(parseInt(e(447))/2)+-parseInt(e(446))/3+-parseInt(e(457))/4+-parseInt(e(452))/5*(-parseInt(e(453))/6)+parseInt(e(450))/7+-parseInt(e(454))/8+-parseInt(e(456))/9)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class RetryPolicy{constructor(e=3,t=2e3){var r=_0x4f9c;this[r(451)]=e,this[r(449)]=t}[_0xf4a5f(455)](e){return e<this[_0xf4a5f(451)]}waitBeforeRetry(){return __awaiter(this,void 0,void 0,function*(){var e=_0x4f9c;return new Promise(t=>setTimeout(t,this[e(449)]))})}}function _0x10b5(e,t){const r=_0x3a68();return(_0x10b5=function(e,t){return r[e-=353]})(e,t)}function _0x3a68(){const e=["Error executing request","996880dZHqOr","NetworkError","ServerError","canRetry","167426NLbLbp","🚀 REQUEST (","message","debug","status","append","6HpzHmH","2874436UHUoBA","10782224pTDvMY","stringify","-- PARAMETERS =>","5613629AHxbtq","headers","738552yoAGbD","1349040PJRprZ",") =>","formData","method","DecodingError","params","Content-Type","application/json","text","❌ API ERROR (","retryPolicy","sendRequest","warn"];return(_0x3a68=function(){return e})()}!function(){const e=_0x10b5,t=_0x3a68();for(;;)try{if(403408===-parseInt(e(367))/1*(-parseInt(e(361))/2)+-parseInt(e(374))/3+parseInt(e(368))/4+parseInt(e(357))/5+-parseInt(e(375))/6+parseInt(e(372))/7+-parseInt(e(369))/8)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const networkManager={retryPolicy:()=>new RetryPolicy,sendRequest(e){return __awaiter(this,arguments,void 0,function*(e,t={}){const r=_0x10b5,i=t.retryAttempt||1;let n;WTLogger[r(364)](r(362)+i+") => "+t[r(378)]+" "+e),WTLogger[r(364)](r(371),t[r(380)]||t[r(377)]||{});const s=Object.assign({Accept:r(382)},t[r(373)]);if(t.formData){const e=new FormData;for(const i in t.formData)e[r(366)](i,t[r(377)][i]);n=e}else t[r(380)]&&(s[r(381)]=r(382),n=JSON[r(370)](t.params));try{const i=yield fetch(e,{method:t.method,headers:s,body:n});if(!i.ok){let e=yield i.json(),t=e.message||(yield i[r(383)]());throw WTLogger[r(355)](r(384)+i.status+") =>",t),new ApiError.ServerError(i[r(365)],e[r(363)]||"Server error")}try{const e=yield i.json();return WTLogger.debug("✅ API SUCCESS ("+i[r(365)]+r(376),e[r(363)]||"Request successful"),e}catch(e){throw new ApiError.DecodingError(e[r(363)]||String(e))}}catch(n){if(n instanceof ApiError[r(359)]||n instanceof ApiError[r(379)])throw n;if(WTLogger.error(r(356),n),this[r(353)]()[r(360)](i))return yield this[r(353)]().waitBeforeRetry(),this[r(354)](e,Object.assign(Object.assign({},t),{retryAttempt:i+1}));throw new(ApiError[r(358)])(n[r(363)]||"Unknown error")}})}};function _0x268a(){const e=["1057304cDJDRh","hostname","12mWiENQ","HASH","SDK","6626984LYENCo","1062774pdZxZD","config","506188yRTaAS","toISOString","baseUrl","appSettings","BASE_URL","sendRequest","SDK Config is not set","appToken","PLATFORM","2565xPWFbR","34051391gSXQQR","result","21oGVkvd","Initial Config is not set","other","location","694308yToqQl","sdkEnvironment","15WNHdcH","appVersion","appFrameWork","initialConfig","fromJson","PRODUCTION","POST","51170jSMhMq"];return(_0x268a=function(){return e})()}function _0x14ed(e,t){const r=_0x268a();return(_0x14ed=function(e,t){return r[e-=290]})(e,t)}!function(){const e=_0x14ed,t=_0x268a();for(;;)try{if(891339===parseInt(e(300))/1+parseInt(e(302))/2*(parseInt(e(290))/3)+-parseInt(e(308))/4*(-parseInt(e(292))/5)+-parseInt(e(306))/6*(-parseInt(e(320))/7)+-parseInt(e(305))/8+-parseInt(e(317))/9*(-parseInt(e(299))/10)+-parseInt(e(318))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const apiClient={doGetConfig(){return __awaiter(this,void 0,void 0,function*(){const e=_0x14ed,t=storageManager.initialConfig;if(!t)throw e(321);const r={app_token:t.appToken,app_version:t[e(293)],framework:t.appFrameWork,env:EnvironmentUtils[e(291)],sdk_hash:WTConstants[e(304)][e(303)],package_name:window[e(323)][e(301)],platform:WTConstants[e(304)].PLATFORM,store_name:e(322)},i=yield networkManager.sendRequest(WTConstants.CONFIG[e(312)],{method:e(298),formData:r});return WTConfig[e(296)](i.result)})},doGetAppSettings(){return __awaiter(this,void 0,void 0,function*(){const e=_0x14ed,t=storageManager[e(295)],r=storageManager[e(307)];if(!t)throw e(321);if(!r)throw e(314);if(!r[e(311)])throw"AppSettings Url is not set";const i={app_token:t[e(315)],app_version:t[e(293)],framework:t[e(294)],env:EnvironmentUtils.sdkEnvironment,sdk_hash:WTConstants[e(304)][e(303)],package_name:window[e(323)].hostname,platform:WTConstants.SDK[e(316)],store_name:"other"},n=yield networkManager[e(313)](r[e(310)]+r[e(311)],{method:"POST",formData:i});return WTAppSettings[e(296)](n[e(319)])})},doCallRequest(e,t){return __awaiter(this,void 0,void 0,function*(){const r=_0x14ed,i=storageManager[r(295)],n=storageManager.config;if(!i)throw r(321);if(!n)throw r(314);t.updated_at=(new Date)[r(309)]();return(yield networkManager[r(313)](n[r(310)]+e,{method:"POST",params:{needs_response_details:EnvironmentUtils[r(291)]!=WTSDKEnvironment[r(297)],parameters:t}})).success})}};function _0x44c5(e,t){const r=_0xf030();return(_0x44c5=function(e,t){return r[e-=448]})(e,t)}const _0x413470=_0x44c5;function _0xf030(){const e=["tickerJob","32270VJMyFJ","521460APKpwt","2OzRxRR","3110JTPBYp","activeDuration","hasFocus","111742CXCFDH","stop","start","ActivityTicker: active duration= ","resume","23065XjjbjP","tickerDelay","inactiveDuration","isPaused","pause","log","hidden","4545gecbFb","617796LYqOdq","244DuRrVe","344kWholC","9592671PGoBhc"];return(_0xf030=function(){return e})()}!function(){const e=_0x44c5,t=_0xf030();for(;;)try{if(144909===parseInt(e(469))/1*(-parseInt(e(449))/2)+-parseInt(e(462))/3+-parseInt(e(463))/4*(parseInt(e(454))/5)+-parseInt(e(468))/6+parseInt(e(467))/7*(-parseInt(e(464))/8)+-parseInt(e(461))/9*(-parseInt(e(470))/10)+parseInt(e(465))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class ActivityTicker{constructor(){const e=_0x44c5;this[e(455)]=1e3,this[e(457)]=!1}[_0x413470(451)](){const e=_0x413470;this[e(466)]&&clearInterval(this[e(466)]),this[e(466)]=setInterval(()=>{const t=e;this[t(457)]||document[t(460)]||document[t(448)]()&&(console[t(459)](t(452)+storageManager[t(471)]/1e3+"s, inactive duration= "+storageManager[t(456)]/1e3+"s"),storageManager.activeTime=Date.now(),storageManager[t(471)]+=this[t(455)])},this[e(455)])}[_0x413470(450)](){const e=_0x413470;clearInterval(this[e(466)]),this[e(466)]=void 0}[_0x413470(458)](){this[_0x413470(457)]=!0}[_0x413470(453)](){this[_0x413470(457)]=!1}}const activityTicker=new ActivityTicker,_0x512df9=_0x3159;function _0x3159(e,t){const r=_0x39bc();return(_0x3159=function(e,t){return r[e-=349]})(e,t)}function _0x39bc(){const e=["country","58416gIQrpZ","finally","country.is failed","520704slTnTM","https://api.country.is","107290aobREM","182LrApjD","ipwho.is failed","country_code","tryAllEndpoints","2sZGOnN","signal","_country","json","fetchWithTimeout","342HhKwtr","https://ipwho.is/","abort","432276yhGfYY","5aNTwLB","963042OKSjwv","55iROhpE","301368dAPWbQ","11450MXWtHm"];return(_0x39bc=function(){return e})()}!function(){const e=_0x3159,t=_0x39bc();for(;;)try{if(130764===-parseInt(e(356))/1*(parseInt(e(351))/2)+-parseInt(e(349))/3+-parseInt(e(368))/4+-parseInt(e(365))/5*(-parseInt(e(366))/6)+-parseInt(e(352))/7*(-parseInt(e(371))/8)+parseInt(e(361))/9*(-parseInt(e(369))/10)+-parseInt(e(367))/11*(-parseInt(e(364))/12))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class CountryFinder{constructor(){this[_0x3159(358)]=null}getCountryCode(){return __awaiter(this,void 0,void 0,function*(){const e=_0x3159;return!this[e(358)]&&(this._country=yield this[e(355)]()),this[e(358)]})}[_0x512df9(355)](){return __awaiter(this,void 0,void 0,function*(){const e=[()=>__awaiter(this,void 0,void 0,function*(){const e=_0x3159,t=yield this[e(360)](e(350));if(!t.ok)throw new Error(e(373));return(yield t.json())[e(370)]||null}),()=>__awaiter(this,void 0,void 0,function*(){const e=_0x3159,t=yield this.fetchWithTimeout("https://free.freeipapi.com/api/json");if(!t.ok)throw new Error(e(373));return(yield t[e(359)]()).countryCode||null}),()=>__awaiter(this,void 0,void 0,function*(){const e=_0x3159,t=yield this.fetchWithTimeout(e(362));if(!t.ok)throw new Error(e(353));return(yield t[e(359)]())[e(354)]||null})];for(const t of e)try{const e=yield t();if(e)return e}catch(e){}return null})}fetchWithTimeout(e){return __awaiter(this,arguments,void 0,function*(e,t=2e3){const r=_0x3159,i=new AbortController,n=setTimeout(()=>i[r(363)](),t);return fetch(e,{signal:i[r(357)]})[r(372)](()=>clearTimeout(n))})}}const countryFinder=new CountryFinder;function _0x3aca(e,t){const r=_0x565d();return(_0x3aca=function(e,t){return r[e-=303]})(e,t)}!function(){const e=_0x3aca,t=_0x565d();for(;;)try{if(925033===parseInt(e(304))/1*(-parseInt(e(309))/2)+parseInt(e(311))/3*(-parseInt(e(313))/4)+-parseInt(e(312))/5*(parseInt(e(306))/6)+-parseInt(e(307))/7*(parseInt(e(305))/8)+-parseInt(e(314))/9+-parseInt(e(308))/10*(-parseInt(e(303))/11)+parseInt(e(310))/12)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const cryptoHelper={generateDeviceUUID:()=>crypto[_0x3aca(315)]()};function _0x565d(){const e=["3553448swLoUy","5270319BANxAr","randomUUID","1784057ScPRpQ","9449cygUCC","8ROEirR","78crIJXq","4018987OIxuPi","70SKxZyo","342zGQDLA","53041608ePBtlg","3QCqNSg","371745rtYvlU"];return(_0x565d=function(){return e})()}const _0x571952=_0x4791;function _0x4791(e,t){const r=_0x5ded();return(_0x4791=function(e,t){return r[e-=357]})(e,t)}function _0x5ded(){const e=["274998BMPNpw","maxRetries","203494kiJYVG","1371378dxwcVT","release","now","1753371BxrcDU","12779757KsYPEP","acquire","length","144921DvTDpu","1112825ccqyTi","locked","parameters","8nRwQZh","248myuElc","push","retryCount","createdAt","waitingQueue","endpoint"];return(_0x5ded=function(){return e})()}!function(){const e=_0x4791,t=_0x5ded();for(;;)try{if(344295===-parseInt(e(372))/1+parseInt(e(370))/2+-parseInt(e(376))/3+parseInt(e(363))/4*(parseInt(e(360))/5)+-parseInt(e(373))/6+-parseInt(e(359))/7*(parseInt(e(364))/8)+parseInt(e(377))/9)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class RequestRecord{constructor(e,t){const r=_0x4791;this[r(366)]=0,this[r(371)]=3,this.id=crypto.randomUUID(),this[r(369)]=e,this[r(362)]=t,this[r(367)]=Date[r(375)]()}}class Mutex{constructor(){this[_0x4791(361)]=!1,this.waitingQueue=[]}[_0x571952(357)](){return __awaiter(this,void 0,void 0,function*(){return new Promise(e=>{const t=_0x4791;this[t(361)]?this[t(368)][t(365)](e):(this[t(361)]=!0,e())})})}[_0x571952(374)](){const e=_0x571952;if(this[e(368)][e(358)]>0){this[e(368)].shift()()}else this[e(361)]=!1}}const _0x3d176a=_0x21c4;function _0x21c4(e,t){const r=_0x34c8();return(_0x21c4=function(e,t){return r[e-=178]})(e,t)}function _0x34c8(){const e=["release","requestRecords","getPendingQueue","log","SESSIONS","mutex","processingInterval","debug","startProcessing","saveMainQueue","isInitialized","⏰ Backoff delay ended, resuming queue processing","push_token","processQueues","Error in processing loop:","Applying backoff delay of ","push","2943110qHjszI","2493834DOeXcj","addPendingRequest","1062678cMmEKq","parameters","8199585iFcKby","4CwSnnb","SDK_INFOS","shutdown"," processed successfully","7129152Uazbew","inactiveDuration","retryCount","✅ Request ","16CGyPFE","postRequestCheck","getBackoffConfig","addRequest","BASE_DELAY_MS","Queue Manager is not initialized. Call initialize() first.","pendingRequestRecords","⏳ Request ","firstSessionSubmit","warn","PROCESSING_INTERVAL_MS","🔄 Backoff delay manually reset","min"," failed with error after ","getQueueStatus","BACKOFF_MULTIPLIER","pow"," failed","maxRetries","MAX_DELAY_MS","acquire","❌ Request ","⚠️ Request ","processPendingQueue","sdkClickSubmit","getMainQueue","activeDuration","savePendingQueue","failedRequestDelay","doCallRequest","41613902OWTUrJ","stopProcessing"," pending requests to main queue","getMainRequestsSentFlag"," attempts. ","📦 Moved "," failed. Retry ","sendRequest","error","processMainQueue","now","6aRrRIP","isCurrentlyProcessing"," failed after ","): id=","isProcessing","fcmToken","💥 Sending request (","Error sending request ","505378jmBYIo","initialize","length","10dvAfht","endpoint"];return(_0x34c8=function(){return e})()}!function(){const e=_0x21c4,t=_0x34c8();for(;;)try{if(636753===-parseInt(e(249))/1+-parseInt(e(189))/2*(parseInt(e(241))/3)+-parseInt(e(192))/4*(parseInt(e(186))/5)+-parseInt(e(196))/6+-parseInt(e(187))/7*(parseInt(e(200))/8)+-parseInt(e(191))/9*(-parseInt(e(252))/10)+parseInt(e(230))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class RequestsQueueManager{constructor(){const e=_0x21c4;this[e(179)]=!1,this[e(245)]=!1,this[e(242)]=!1,this.mutex=new Mutex,this.processingInterval=null,this[e(210)]=100,this[e(228)]=0,this[e(219)]=3e4,this[e(215)]=2,this.BASE_DELAY_MS=1e3}[_0x3d176a(250)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4;this[e(179)]=!0,!this[e(245)]&&(yield this[e(262)]())})}[_0x3d176a(194)](){return __awaiter(this,void 0,void 0,function*(){this.isInitialized&&(yield this.stopProcessing(),this.isInitialized=!1)})}[_0x3d176a(262)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4;if(this.isInitialized){yield this[e(259)].acquire();try{if(this[e(245)])return;this.isProcessing=!0,this[e(260)]=setInterval(()=>__awaiter(this,void 0,void 0,function*(){const t=e;try{yield this[t(182)]()}catch(e){WTLogger[t(238)](t(183),e)}}),this[e(210)])}finally{this[e(259)][e(254)]()}yield this.processQueues()}else WTLogger[e(209)](e(205))})}[_0x3d176a(231)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4;yield this.mutex.acquire();try{this[e(245)]=!1,this.processingInterval&&(clearInterval(this.processingInterval),this.processingInterval=null)}finally{this[e(259)].release()}})}[_0x3d176a(203)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x21c4;yield this[t(259)][t(220)]();try{const r=this[t(225)]();if(r[t(185)](e),this[t(178)](r),this[t(228)]=0,!this.isProcessing)return this[t(259)].release(),void(yield this[t(262)]())}finally{this[t(245)]&&this[t(259)][t(254)]()}})}[_0x3d176a(188)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x21c4;yield this[t(259)][t(220)]();try{if(this[t(233)]()){const r=this.getMainQueue();r[t(185)](e),this.saveMainQueue(r)}else{const r=this[t(256)]();r.push(e),this[t(227)](r)}if(this[t(228)]=0,!this[t(245)])return this.mutex.release(),void(yield this[t(262)]())}finally{this[t(245)]&&this[t(259)][t(254)]()}})}[_0x3d176a(182)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4;if(this.isProcessing&&!this[e(242)]){if(this[e(228)]>0){if(Date[e(240)]()<this.failedRequestDelay)return;this[e(228)]=0,WTLogger[e(261)](e(180))}this[e(242)]=!0,yield this.mutex.acquire();try{yield this[e(239)](),yield this[e(223)]()}finally{this[e(259)][e(254)](),this[e(242)]=!1}}})}[_0x3d176a(239)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4,t=this[e(225)]();if(0===t[e(251)])return;const r=t[0];try{if(yield this.sendRequest(r))t.shift(),this[e(178)](t),this[e(201)](r),WTLogger[e(261)](e(199)+r.id+e(195));else{if(t[0][e(198)]++,t[0][e(198)]>=t[0][e(218)]){const i=this.calculateBackoffDelay(t[0].retryCount);this.failedRequestDelay=Date[e(240)]()+i,WTLogger.warn("⏳ Request "+r.id+e(243)+r[e(218)]+" attempts. "+(e(184)+i)+"ms")}else WTLogger[e(209)](e(222)+r.id+e(236)+t[0].retryCount+"/"+t[0][e(218)]);this.saveMainQueue(t)}}catch(i){if(WTLogger[e(238)](e(248)+r[e(253)]+":",i),t[0].retryCount++,t[0].retryCount>=t[0][e(218)]){const i=this.calculateBackoffDelay(t[0][e(198)]);this[e(228)]=Date.now()+i,WTLogger[e(209)](e(207)+r.id+e(213)+t[0].maxRetries+e(234)+(e(184)+i+"ms"))}this[e(178)](t)}})}calculateBackoffDelay(e){const t=_0x3d176a,r=this[t(204)]*Math[t(216)](this[t(215)],e-1);return Math[t(212)](r,this[t(219)])}[_0x3d176a(223)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x21c4;if(!this[e(233)]())return;const t=this[e(256)]();if(0===t[e(251)])return;const r=this[e(225)]();r[e(185)](...t),this[e(178)](r),this[e(227)]([]),console[e(257)](e(235)+t[e(251)]+e(232))})}[_0x3d176a(237)](e){return __awaiter(this,arguments,void 0,function*(e,t=1){const r=_0x21c4;WTLogger[r(261)](r(247)+e[r(253)]+r(244)+e.id);let i=!1;try{i=yield apiClient[r(229)](e[r(253)],e[r(190)])}catch(t){WTLogger[r(238)](r(221)+e[r(253)]+r(217),t)}return i})}[_0x3d176a(225)](){return storageManager[_0x3d176a(255)]}[_0x3d176a(178)](e){storageManager[_0x3d176a(255)]=e}[_0x3d176a(256)](){return storageManager[_0x3d176a(206)]}[_0x3d176a(227)](e){storageManager[_0x3d176a(206)]=e}getMainRequestsSentFlag(){return storageManager[_0x3d176a(224)]}[_0x3d176a(201)](e){const t=_0x3d176a;switch(e[t(253)]){case WTEndpoints.SDK_CLICKS:storageManager[t(224)]=!0;break;case WTEndpoints[t(258)]:storageManager[t(208)]?(storageManager[t(226)]=0,storageManager[t(197)]=0,storageManager.subSessionCount=1):storageManager[t(208)]=!0;break;case WTEndpoints[t(193)]:storageManager[t(246)]=e[t(190)][t(181)]}}[_0x3d176a(214)](){const e=_0x3d176a;return{mainQueueLength:this[e(225)]()[e(251)],pendingQueueLength:this[e(256)]()[e(251)],isProcessing:this.isProcessing,mainRequestsSent:this[e(233)](),isInBackoffDelay:this.failedRequestDelay>0&&Date[e(240)]()<this[e(228)],backoffEndsAt:this[e(228)]>0?this.failedRequestDelay:null}}resetBackoffDelay(){const e=_0x3d176a;this[e(228)]=0,WTLogger.debug(e(211))}[_0x3d176a(202)](){const e=_0x3d176a;return{baseDelayMs:this.BASE_DELAY_MS,multiplier:this[e(215)],maxDelayMs:this[e(219)]}}}const queueManager=new RequestsQueueManager;var props,NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",MODEL="model",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",CH_ALL_VALUES=["brands","fullVersionList",MOBILE,MODEL,"platform","platformVersion","architecture","formFactors","bitness"],NAVIGATOR="undefined"!=typeof window&&window.navigator?window.navigator:void 0,NAVIGATOR_UADATA=NAVIGATOR&&NAVIGATOR.userAgentData?NAVIGATOR.userAgentData:void 0,enumerize=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},has=function(e,t){if("object"==typeof e&&e.length>0){for(var r in e)if(lowerize(t)==lowerize(e[r]))return!0;return!1}return!!isString(e)&&lowerize(t)==lowerize(e)},isExtensions=function(e,t){for(var r in e)return/^(browser|cpu|device|engine|os)$/.test(r)||!!t&&isExtensions(e[r])},isString=function(e){return"string"==typeof e},itemListToArray=function(e){if(e){for(var t=[],r=strip(/\\?\"/g,e).split(","),i=0;i<r.length;i++)if(r[i].indexOf(";")>-1){var n=trim(r[i]).split(";v=");t[i]={brand:n[0],version:n[1]}}else t[i]=trim(r[i]);return t}},lowerize=function(e){return isString(e)?e.toLowerCase():e},majorize=function(e){return isString(e)?strip(/[^\d\.]/g,e).split(".")[0]:void 0},setProps=function(e){for(var t in e){var r=e[t];"object"==typeof r&&2==r.length?this[r[0]]=r[1]:this[r]=void 0}return this},strip=function(e,t){return isString(t)?t.replace(e,""):t},stripQuotes=function(e){return strip(/\\?\"/g,e)},trim=function(e,t){if(isString(e))return e=strip(/^\s\s*/,e),void 0===t?e:e.substring(0,500)},rgxMapper=function(e,t){if(e&&t)for(var r,i,n,s,o,a,c=0;c<t.length&&!o;){var u=t[c],d=t[c+1];for(r=i=0;r<u.length&&!o&&u[r];)if(o=u[r++].exec(e))for(n=0;n<d.length;n++)a=o[++i],"object"==typeof(s=d[n])&&s.length>0?2===s.length?"function"==typeof s[1]?this[s[0]]=s[1].call(this,a):this[s[0]]=s[1]:s.length>=3&&("function"!=typeof s[1]||s[1].exec&&s[1].test?3==s.length?this[s[0]]=a?a.replace(s[1],s[2]):void 0:4==s.length?this[s[0]]=a?s[3].call(this,a.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=a?s[3].apply(this,[a.replace(s[1],s[2])].concat(s.slice(4))):void 0):s.length>3?this[s[0]]=a?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=a?s[1].call(this,a,s[2]):void 0):this[s]=a||void 0;c+=2}},strMapper=function(e,t){for(var r in t)if("object"==typeof t[r]&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(has(t[r][i],e))return"?"===r?void 0:r}else if(has(t[r],e))return"?"===r?void 0:r;return t.hasOwnProperty("*")?t["*"]:e},windowsVersionMap={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2",8.1:"6.3",10:["6.4","10.0"],NT:""},formFactorsMap={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},browserHintsMap={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},defaultRegexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,"Mobile Chrome"]],[/webview.+edge\/([\w\.]+)/i],[VERSION,[NAME,"Edge WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,"Opera Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[VERSION,[NAME,"Opera GX"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,"Opera"]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[VERSION,[NAME,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[NAME,VERSION],[/quark(?:pc)?\/([-\w\.]+)/i],[VERSION,[NAME,"Quark"]],[/\bddg\/([\w\.]+)/i],[VERSION,[NAME,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[VERSION,[NAME,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure Browser"],VERSION],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[VERSION,[NAME,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI Browser"]],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,"Mobile Firefox"]],[/\bqihoobrowser\/?([\w\.]*)/i],[VERSION,[NAME,"360"]],[/\b(qq)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1Browser"],VERSION],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Browser"],VERSION],[/samsungbrowser\/([\w\.]+)/i],[VERSION,[NAME,"Samsung Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[VERSION,[NAME,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[NAME,"Sogou Mobile"],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[NAME,VERSION],[/(lbbrowser|rekonq)/i],[NAME],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[VERSION,NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,"Facebook"],VERSION,[TYPE,"inapp"]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[NAME,VERSION,[TYPE,"inapp"]],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"],[TYPE,"inapp"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[VERSION,[NAME,"TikTok"],[TYPE,"inapp"]],[/\[(linkedin)app\]/i],[NAME,[TYPE,"inapp"]],[/(chromium)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,"Chrome Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[VERSION,[NAME,"Edge WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[NAME,"Chrome WebView"],VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android Browser"]],[/chrome\/([\w\.]+) mobile/i],[VERSION,[NAME,"Mobile Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[VERSION,[NAME,"Mobile Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[NAME,"Mobile Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[NAME,"Mobile Firefox"],VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/(wolvic|librewolf)\/([\w\.]+)/i],[NAME,VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[NAME,[VERSION,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[NAME,[VERSION,/[^\d\.]+./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[["architecture","amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[["architecture","ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[["architecture","arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[["architecture","arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[["architecture",/ower/,"",lowerize]],[/ sun4\w[;\)]/i],[["architecture","sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[["architecture",lowerize]]],device:[[/\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],[MODEL,[VENDOR,"Samsung"],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,"Samsung"],[TYPE,MOBILE]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[MODEL,[VENDOR,"Apple"],[TYPE,MOBILE]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[MODEL,[VENDOR,"Apple"],[TYPE,TABLET]],[/(macintosh);/i],[MODEL,[VENDOR,"Apple"]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,MOBILE]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[MODEL,[VENDOR,"Honor"],[TYPE,TABLET]],[/honor([-\w ]+)[;\)]/i],[MODEL,[VENDOR,"Honor"],[TYPE,MOBILE]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[MODEL,[VENDOR,"Huawei"],[TYPE,TABLET]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,"Huawei"],[TYPE,MOBILE]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,TABLET]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,MOBILE]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,"OnePlus"],[TYPE,MOBILE]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[MODEL,[VENDOR,"OPPO"],[TYPE,MOBILE]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[MODEL,[VENDOR,strMapper,{OnePlus:["203","304","403","404","413","415"],"*":"OPPO"}],[TYPE,TABLET]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[MODEL,[VENDOR,"BLU"],[TYPE,MOBILE]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[MODEL,[VENDOR,"Lenovo"],[TYPE,TABLET]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[MODEL,[VENDOR,"Lenovo"],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,"Motorola"],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,"Motorola"],[TYPE,TABLET]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,"LG"],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,"LG"],[TYPE,MOBILE]],[/(nokia) (t[12][01])/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[MODEL,/_/g," "],[TYPE,MOBILE],[VENDOR,"Nokia"]],[/(pixel (c|tablet))\b/i],[MODEL,[VENDOR,"Google"],[TYPE,TABLET]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[MODEL,[VENDOR,"Google"],[TYPE,MOBILE]],[/(google) (pixelbook( go)?)/i],[VENDOR,MODEL],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,"Sony"],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,"Sony"],[TYPE,TABLET]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,"Amazon"],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,"Amazon"],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[MODEL,[VENDOR,"BlackBerry"],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,"ASUS"],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,"ASUS"],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,TABLET]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,MOBILE]],[/(itel) ((\w+))/i],[[VENDOR,lowerize],MODEL,[TYPE,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[MODEL,[VENDOR,"Ulefone"],[TYPE,MOBILE]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Energizer"],[TYPE,MOBILE]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[MODEL,[VENDOR,"Cat"],[TYPE,MOBILE]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Smartfren"],[TYPE,MOBILE]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[MODEL,[VENDOR,"Nothing"],[TYPE,MOBILE]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,TABLET]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,MOBILE]],[/; (n159v)/i],[MODEL,[VENDOR,"HMD"],[TYPE,MOBILE]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,"Microsoft"],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,"Microsoft"],[TYPE,MOBILE]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,MOBILE]],[/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,"Samsung"],[TYPE,SMARTTV]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,"LG"],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,"Apple TV"],[TYPE,SMARTTV]],[/crkey.*devicetype\/chromecast/i],[[MODEL,"Chromecast Third Generation"],[VENDOR,"Google"],[TYPE,SMARTTV]],[/crkey.*devicetype\/([^/]*)/i],[[MODEL,/^/,"Chromecast "],[VENDOR,"Google"],[TYPE,SMARTTV]],[/fuchsia.*crkey/i],[[MODEL,"Chromecast Nest Hub"],[VENDOR,"Google"],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,"Chromecast"],[VENDOR,"Google"],[TYPE,SMARTTV]],[/(portaltv)/i],[MODEL,[VENDOR,"Facebook"],[TYPE,SMARTTV]],[/droid.+aft(\w+)( bui|\))/i],[MODEL,[VENDOR,"Amazon"],[TYPE,SMARTTV]],[/(shield \w+ tv)/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,SMARTTV]],[/(bravia[\w ]+)( bui|\))/i],[MODEL,[VENDOR,"Sony"],[TYPE,SMARTTV]],[/(mi(tv|box)-?\w+) bui/i],[MODEL,[VENDOR,"Xiaomi"],[TYPE,SMARTTV]],[/Hbbtv.*(technisat) (.*);/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[VENDOR,/.+\/(\w+)/,"$1",strMapper,{LG:"lge"}],[MODEL,trim],[TYPE,SMARTTV]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[MODEL,[TYPE,SMARTTV]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[TYPE,SMARTTV]],[/(playstation \w+)/i],[MODEL,[VENDOR,"Sony"],[TYPE,"console"]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,"Microsoft"],[TYPE,"console"]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[VENDOR,MODEL,[TYPE,"console"]],[/droid.+; (shield)( bui|\))/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,"console"]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[MODEL,[VENDOR,"Samsung"],[TYPE,"wearable"]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[VENDOR,MODEL,[TYPE,"wearable"]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[MODEL,[VENDOR,"OPPO"],[TYPE,"wearable"]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[MODEL,[VENDOR,"Apple"],[TYPE,"wearable"]],[/(opwwe\d{3})/i],[MODEL,[VENDOR,"OnePlus"],[TYPE,"wearable"]],[/(moto 360)/i],[MODEL,[VENDOR,"Motorola"],[TYPE,"wearable"]],[/(smartwatch 3)/i],[MODEL,[VENDOR,"Sony"],[TYPE,"wearable"]],[/(g watch r)/i],[MODEL,[VENDOR,"LG"],[TYPE,"wearable"]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,"wearable"]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,"Google"],[TYPE,"xr"]],[/(pico) (4|neo3(?: link|pro)?)/i],[VENDOR,MODEL,[TYPE,"xr"]],[/(quest( \d| pro)?s?).+vr/i],[MODEL,[VENDOR,"Facebook"],[TYPE,"xr"]],[/mobile vr; rv.+firefox/i],[[TYPE,"xr"]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,"embedded"]],[/(aeobc)\b/i],[MODEL,[VENDOR,"Amazon"],[TYPE,"embedded"]],[/(homepod).+mac os/i],[MODEL,[VENDOR,"Apple"],[TYPE,"embedded"]],[/windows iot/i],[[TYPE,"embedded"]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[MODEL,[TYPE,strMapper,{mobile:"Mobile",xr:"VR","*":TABLET}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[NAME,VERSION],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[NAME,VERSION],[/ladybird\//i],[[NAME,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/(windows nt) (6\.[23]); arm/i],[[NAME,/N/,"R"],[VERSION,strMapper,windowsVersionMap]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[NAME,VERSION],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[VERSION,/(;|\))/g,"",strMapper,windowsVersionMap],[NAME,"Windows"]],[/(windows ce)\/?([\d\.]*)/i],[NAME,VERSION],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[NAME,"macOS"],[VERSION,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[VERSION,[NAME,"Chromecast Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[VERSION,[NAME,"Chromecast Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[VERSION,[NAME,"Chromecast SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[VERSION,[NAME,"Chromecast Linux"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,"Chromecast"]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(ubuntu) ([\w\.]+) like android/i],[[NAME,/(.+)/,"$1 Touch"],VERSION],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,"BlackBerry"]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[VERSION,[NAME,"Firefox OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[VERSION,[NAME,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[VERSION,strMapper,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[NAME,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[VERSION,[NAME,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[NAME,"Chrome OS"],VERSION],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[NAME,VERSION],[/(sunos) ?([\d\.]*)/i],[[NAME,"Solaris"],VERSION],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]},defaultProps=(setProps.call((props={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[["browser",[NAME,VERSION,"major",TYPE]],["cpu",["architecture"]],["device",[TYPE,MODEL,VENDOR]],["engine",[NAME,VERSION]],["os",[NAME,VERSION]]]),setProps.call(props.isIgnore,[["browser",[VERSION,"major"]],["engine",[VERSION]],["os",[VERSION]]]),setProps.call(props.isIgnoreRgx,[["browser",/ ?browser$/i],["os",/ ?os$/i]]),setProps.call(props.toString,[["browser",[NAME,VERSION]],["cpu",["architecture"]],["device",[VENDOR,MODEL]],["engine",[NAME,VERSION]],["os",[NAME,VERSION]]]),props),createIData=function(e,t){var r=defaultProps.init[t],i=defaultProps.isIgnore[t]||0,n=defaultProps.isIgnoreRgx[t]||0,s=defaultProps.toString[t]||0;function o(){setProps.call(this,r)}return o.prototype.getItem=function(){return e},o.prototype.withClientHints=function(){return NAVIGATOR_UADATA?NAVIGATOR_UADATA.getHighEntropyValues(CH_ALL_VALUES).then(function(t){return e.setCH(new UACHData(t,!1)).parseCH().get()}):e.parseCH().get()},o.prototype.withFeatureCheck=function(){return e.detectFeature().get()},"result"!=t&&(o.prototype.is=function(e){var t=!1;for(var r in this)if(this.hasOwnProperty(r)&&!has(i,r)&&lowerize(n?strip(n,this[r]):this[r])==lowerize(n?strip(n,e):e)){if(t=!0,"undefined"!=e)break}else if("undefined"==e&&t){t=!t;break}return t},o.prototype.toString=function(){var e="";for(var t in s)void 0!==this[s[t]]&&(e+=(e?" ":"")+this[s[t]]);return e||"undefined"}),NAVIGATOR_UADATA||(o.prototype.then=function(e){var t=this,r=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};r.prototype={is:o.prototype.is,toString:o.prototype.toString};var i=new r;return e(i),i}),new o};function UACHData(e,t){if(e=e||{},setProps.call(this,CH_ALL_VALUES),t)setProps.call(this,[["brands",itemListToArray(e["sec-ch-ua"])],["fullVersionList",itemListToArray(e["sec-ch-ua-full-version-list"])],[MOBILE,/\?1/.test(e["sec-ch-ua-mobile"])],[MODEL,stripQuotes(e["sec-ch-ua-model"])],["platform",stripQuotes(e["sec-ch-ua-platform"])],["platformVersion",stripQuotes(e["sec-ch-ua-platform-version"])],["architecture",stripQuotes(e["sec-ch-ua-arch"])],["formFactors",itemListToArray(e["sec-ch-ua-form-factors"])],["bitness",stripQuotes(e["sec-ch-ua-bitness"])]]);else for(var r in e)this.hasOwnProperty(r)&&void 0!==e[r]&&(this[r]=e[r])}function UAItem(e,t,r,i){return this.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},this.set=function(e,t){return this.data[e]=t,this},this.setCH=function(e){return this.uaCH=e,this},this.detectFeature=function(){if(NAVIGATOR&&NAVIGATOR.userAgent==this.ua)switch(this.itemType){case"browser":NAVIGATOR.brave&&"function"==typeof NAVIGATOR.brave.isBrave&&this.set(NAME,"Brave");break;case"device":!this.get(TYPE)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[MOBILE]&&this.set(TYPE,MOBILE),"Macintosh"==this.get(MODEL)&&NAVIGATOR&&void 0!==NAVIGATOR.standalone&&NAVIGATOR.maxTouchPoints&&NAVIGATOR.maxTouchPoints>2&&this.set(MODEL,"iPad").set(TYPE,TABLET);break;case"os":!this.get(NAME)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA.platform&&this.set(NAME,NAVIGATOR_UADATA.platform);break;case"result":var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set("browser",t("browser")).set("cpu",t("cpu")).set("device",t("device")).set("engine",t("engine")).set("os",t("os"))}return this},this.parseUA=function(){return"result"!=this.itemType&&rgxMapper.call(this.data,this.ua,this.rgxMap),"browser"==this.itemType&&this.set("major",majorize(this.get(VERSION))),this},this.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case"browser":case"engine":var r,i=e.fullVersionList||e.brands;if(i)for(var n in i){var s=i[n].brand||i[n],o=i[n].version;"browser"==this.itemType&&!/not.a.brand/i.test(s)&&(!r||/Chrom/.test(r)&&"Chromium"!=s||"Edge"==r&&/WebView2/.test(s))&&(s=strMapper(s,browserHintsMap),(r=this.get(NAME))&&!/Chrom/.test(r)&&/Chrom/.test(s)||this.set(NAME,s).set(VERSION,o).set("major",majorize(o)),r=s),"engine"==this.itemType&&"Chromium"==s&&this.set(VERSION,o)}break;case"cpu":var a=e.architecture;a&&(a&&"64"==e.bitness&&(a+="64"),rgxMapper.call(this.data,a+";",t));break;case"device":if(e[MOBILE]&&this.set(TYPE,MOBILE),e[MODEL]&&(this.set(MODEL,e[MODEL]),!this.get(TYPE)||!this.get(VENDOR))){var c={};rgxMapper.call(c,"droid 9; "+e[MODEL]+")",t),!this.get(TYPE)&&c.type&&this.set(TYPE,c.type),!this.get(VENDOR)&&c.vendor&&this.set(VENDOR,c.vendor)}if(e.formFactors){var u;if("string"!=typeof e.formFactors)for(var d=0;!u&&d<e.formFactors.length;)u=strMapper(e.formFactors[d++],formFactorsMap);else u=strMapper(e.formFactors,formFactorsMap);this.set(TYPE,u)}break;case"os":var p=e.platform;if(p){var l=e.platformVersion;"Windows"==p&&(l=parseInt(majorize(l),10)>=13?"11":"10"),this.set(NAME,p).set(VERSION,l)}"Windows"==this.get(NAME)&&"Xbox"==e[MODEL]&&this.set(NAME,"Xbox").set(VERSION,void 0);break;case"result":var h=this.data,E=function(t){return h[t].getItem().setCH(e).parseCH().get()};this.set("browser",E("browser")).set("cpu",E("cpu")).set("device",E("device")).set("engine",E("engine")).set("os",E("os"))}return this},setProps.call(this,[["itemType",e],["ua",t],["uaCH",i],["rgxMap",r],["data",createIData(this,e)]]),this}function UAParser(e,t,r){if("object"==typeof e?(isExtensions(e,!0)?("object"==typeof t&&(r=t),t=e):(r=e,t=void 0),e=void 0):"string"!=typeof e||isExtensions(t,!0)||(r=t,t=void 0),r&&"function"==typeof r.append){var i={};r.forEach(function(e,t){i[t]=e}),r=i}if(!(this instanceof UAParser))return new UAParser(e,t,r).getResult();var n="string"==typeof e?e:r&&r["user-agent"]?r["user-agent"]:NAVIGATOR&&NAVIGATOR.userAgent?NAVIGATOR.userAgent:"",s=new UACHData(r,!0),o=t?function(e,t){var r={},i=t;if(!isExtensions(t))for(var n in i={},t)for(var s in t[n])i[s]=t[n][s].concat(i[s]?i[s]:[]);for(var o in e)r[o]=i[o]&&i[o].length%2==0?i[o].concat(e[o]):e[o];return r}(defaultRegexes,t):defaultRegexes,a=function(e){return"result"==e?function(){return new UAItem(e,n,o,s).set("ua",n).set("browser",this.getBrowser()).set("cpu",this.getCPU()).set("device",this.getDevice()).set("engine",this.getEngine()).set("os",this.getOS()).get()}:function(){return new UAItem(e,n,o[e],s).parseUA().get()}};return setProps.call(this,[["getBrowser",a("browser")],["getCPU",a("cpu")],["getDevice",a("device")],["getEngine",a("engine")],["getOS",a("os")],["getResult",a("result")],["getUA",function(){return n}],["setUA",function(e){return isString(e)&&(n=e.length>500?trim(e,500):e),this}]]).setUA(n),this}UAParser.VERSION="2.0.4",UAParser.BROWSER=enumerize([NAME,VERSION,"major",TYPE]),UAParser.CPU=enumerize(["architecture"]),UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,"console",MOBILE,SMARTTV,TABLET,"wearable","embedded"]),UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]);const _0x4c34e2=_0x30c3;function _0x30c3(e,t){const r=_0x1b8d();return(_0x30c3=function(e,t){return r[e-=448]})(e,t)}function _0x1b8d(){const e=["android auto","224mmgFtN","toFixed","toLowerCase","4616956CEGidP","device","desktop","getDeviceInfo","googletv","touch","pow","small","maxTouchPoints","nintendo","1739348vFlwxx","displaySize","watch","matches","136835dvBSzn","screenDensity","low","hbbtv","console","innerWidth","devicePixelRatio","engine","cpu","long","uiMode","height","365582eappNu","sqrt","browser","1JlVpWb","includes","pointer","smarttv","embedded","matchMedia","medium","carplay","screenSize","3NnTmbn","60hziwBT","783DHSWtq","11EiEBfa","2190lDkaej","tablet","mobile","1660694KdLyBt","uiStyle","innerHeight","model","xlarge","playstation","24612ynzBFQ"];return(_0x1b8d=function(){return e})()}!function(){const e=_0x30c3,t=_0x1b8d();for(;;)try{if(752074===-parseInt(e(472))/1*(-parseInt(e(488))/2)+parseInt(e(481))/3*(-parseInt(e(499))/4)+parseInt(e(457))/5*(-parseInt(e(482))/6)+-parseInt(e(469))/7*(-parseInt(e(496))/8)+parseInt(e(483))/9*(parseInt(e(485))/10)+-parseInt(e(484))/11*(-parseInt(e(494))/12)+-parseInt(e(453))/13)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class DeviceDetector{[_0x4c34e2(502)](){const e=_0x4c34e2,t=(new UAParser).getResult();return{browser:t[e(471)],os:t.os,device:t[e(500)],engine:t[e(464)],cpu:t[e(465)],ua:t.ua}}get[_0x4c34e2(458)](){const e=_0x4c34e2;return window[e(463)]>=3?"high":window[e(463)]>=2?e(478):e(459)}get screenFormat(){const e=_0x4c34e2;return window[e(490)]>window[e(462)]?e(466):"normal"}get[_0x4c34e2(480)](){const e=_0x4c34e2,t=window[e(462)];return t<480?e(450):t<768?"normal":t<1440?"large":e(492)}get[_0x4c34e2(467)](){const e=_0x4c34e2;var t,r,i;const n=this[e(502)](),s=(null===(t=n[e(500)])||void 0===t?void 0:t.type)||"",o=(null===(i=null===(r=n[e(500)])||void 0===r?void 0:r[e(491)])||void 0===i?void 0:i[e(498)]())||"",a=n.ua.toLowerCase();return"wearable"===s||o.includes(e(455))?6:s===e(475)||a[e(473)]("smart-tv")||a[e(473)](e(460))||a.includes("netcast")||a[e(473)](e(503))||a.includes("appletv")?4:s===e(461)||a[e(473)](e(493))||a.includes("xbox")||a.includes(e(452))?5:a[e(473)]("car")||a.includes(e(495))||a[e(473)](e(479))?3:a.includes("oculus")||a.includes("vive")||a[e(473)]("vr")||s===e(476)?7:s===e(487)||s===e(486)?1:""===s||s===e(501)?2:0}get[_0x4c34e2(489)](){const e=_0x4c34e2;return window[e(477)]&&window.matchMedia("(prefers-color-scheme: dark)")[e(456)]?"1":"0"}get[_0x4c34e2(454)](){const e=_0x4c34e2,t=window[e(463)]||1,r=screen.width*t/160,i=screen[e(468)]*t/160;return Math[e(470)](Math[e(449)](r,2)+Math[e(449)](i,2))[e(497)](2)}get screenType(){const e=_0x4c34e2;return"ontouchstart"in window||navigator[e(451)]>0?e(448):e(474)}}const deviceDetector=new DeviceDetector,_0x4c2511=_0x2c00;function _0x2c00(e,t){const r=_0x436b();return(_0x2c00=function(e,t){return r[e-=386]})(e,t)}!function(){const e=_0x2c00,t=_0x436b();for(;;)try{if(430008===-parseInt(e(396))/1*(-parseInt(e(388))/2)+-parseInt(e(399))/3+-parseInt(e(405))/4+parseInt(e(400))/5*(parseInt(e(387))/6)+parseInt(e(397))/7+-parseInt(e(386))/8*(-parseInt(e(410))/9)+-parseInt(e(390))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class StorageSupport{constructor(){this[_0x2c00(406)]=null}[_0x4c2511(398)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x2c00;if(this.supportResults)return this[e(406)];const t=this[e(409)](),r=this.isSessionStorageSupported(),i=yield this[e(391)]();return this[e(406)]={localStorage:t,sessionStorage:r,indexedDB:i},this[e(406)]})}[_0x4c2511(402)](e){const t=_0x4c2511;let r=0;for(let i=0;i<e[t(392)];i++){const n=e[t(407)](i);if(!n)continue;const s=e.getItem(n);null!=s&&(r+=2*n.length,r+=2*s.length)}return r}isLocalStorageSupported(){const e=_0x4c2511;try{const t=e(393);return localStorage[e(403)](t,"1"),localStorage.removeItem(t),!0}catch(e){return!1}}[_0x4c2511(394)](){const e=_0x4c2511;try{const t=e(393);return sessionStorage[e(403)](t,"1"),sessionStorage[e(408)](t),!0}catch(e){return!1}}[_0x4c2511(391)](){return"indexedDB"in window?new Promise(e=>{const t=_0x2c00;try{const r=indexedDB.open("__test__check__");r.onerror=()=>e(!1),r[t(401)]=()=>{const i=t;r.result[i(395)](),indexedDB[i(389)](i(404)),e(!0)}}catch(t){e(!1)}}):Promise.resolve(!1)}}function _0x436b(){const e=["__test__","isSessionStorageSupported","close","28YpJOBv","2013445ePVSDA","getSupportResult","673740inhABW","15BQvrLp","onsuccess","getStorageSizeBytes","setItem","__test__check__","2801824PZutVB","supportResults","key","removeItem","isLocalStorageSupported","255312RqCziD","240btmday","1644378ZorBGS","27134LqzTJq","deleteDatabase","9856960HPvwOJ","isIndexedDBSupported","length"];return(_0x436b=function(){return e})()}const storageSupport=new StorageSupport;function _0x19ad(e,t){const r=_0x1533();return(_0x19ad=function(e,t){return r[e-=239]})(e,t)}const _0x521cc0=_0x19ad;function _0x1533(){const e=["/js/app.js","530KjzMJM","keys","Next.js","React","utm_source","innerHTML","Vue.js","organic","Backbone.js","WordPress","detectWebFramework","from","272063DHLSzI","/_next/","[ng-version]","Svelte","utm_medium","other","map","8jdBXjd","drupal-settings-json","mix-manifest.json","jQuery","svelte","documentElement","getUTMParamsString",'meta[name="generator"][content*="Drupal"]',"referrer","Laravel","textContent","Meteor.js","cdn.shopify.com","Zepto.js","385VBlEtS","includes","utm_","Nuxt.js","91839plHQNO",".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]","Vue","__reactContainer","Squarespace","wp-includes","_reactRootContainer","Backbone","21jOxHIs","344735EZBiOD","[data-v-app], [data-v-]","hostname","6103737NVwkCC","1037410hRMshr","344956ircjPI","Wix","querySelector","16878rahTJc","scripts","Ghost CMS","Meteor","src","__VUE__","startsWith","some","[data-reactroot], [data-reactid]","Shopify","location","wix.com","entries"];return(_0x1533=function(){return e})()}!function(){const e=_0x19ad,t=_0x1533();for(;;)try{if(370081===-parseInt(e(241))/1+parseInt(e(254))/2+-parseInt(e(249))/3*(parseInt(e(255))/4)+parseInt(e(250))/5+-parseInt(e(258))/6*(parseInt(e(305))/7)+-parseInt(e(291))/8*(parseInt(e(253))/9)+parseInt(e(272))/10*(parseInt(e(284))/11))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class Utils{static[_0x521cc0(297)](){const e=_0x521cc0,t=new URLSearchParams(window[e(268)].search),r={};for(const[i,n]of t[e(270)]())i.startsWith(e(239))&&n&&(r[i]=n);if(!r[e(276)]){const t=document[e(299)];r[e(276)]=t?new URL(t)[e(252)]:e(289)}return!r[e(288)]&&(r[e(288)]=e(279)),Object[e(270)](r)[e(290)](([e,t])=>e+"="+encodeURIComponent(t)).join("&")}}function _0x4947(e,t){const r=_0x5af3();return(_0x4947=function(e,t){return r[e-=321]})(e,t)}Utils[_0x521cc0(282)]=()=>{const e=_0x521cc0;return document[e(257)]("script[id=__NEXT_DATA__]")||[...document[e(259)]][e(265)](t=>t[e(262)].includes(e(285)))?e(274):window[e(275)]||document[e(257)](e(266))||Array[e(283)](document.querySelectorAll("*"))[e(265)](t=>void 0!==t[e(247)]||Object[e(273)](t).some(t=>t[e(264)](e(244))))||window.__REACT_DEVTOOLS_GLOBAL_HOOK__?e(275):[...document[e(259)]][e(265)](e=>e.src.includes("/_nuxt/"))?e(240):window[e(263)]||window[e(243)]||document[e(257)](e(251))?e(278):document[e(257)]("[id=___gatsby]")?"Gatsby.js":window||document[e(257)](e(242))||document[e(257)]('script[src*="angular.js"], script[src*="angular.min.js"]')||window.ng||document.querySelector(e(286))?"Angular":[...document.scripts][e(265)](t=>{const r=e;var i;return t.src.includes(r(295))||(null===(i=t[r(301)])||void 0===i?void 0:i.includes(r(295)))})?e(287):document[e(257)]("[x-data], [x-init], [x-bind]")?"Alpine.js":window[e(294)]?e(294):window[e(248)]?e(280):window[e(261)]?e(302):window.Zepto?e(304):document.querySelector('meta[name="generator"][content*="WordPress"]')||[...document[e(259)]].some(t=>t[e(262)].includes("wp-content")||t[e(262)][e(306)](e(246)))?e(281):[...document[e(259)]].some(t=>t[e(262)].includes(e(271))||t[e(262)][e(306)](e(293)))?e(300):document[e(257)](e(298))||document.documentElement[e(277)].includes(e(292))?"Drupal":document[e(296)].innerHTML.includes(e(303))?e(267):[...document[e(259)]][e(265)](t=>t.src[e(306)]("static.squarespace.com"))?e(245):[...document.scripts].some(t=>t[e(262)][e(306)](e(269)))?e(256):document[e(257)]('meta[name="generator"][content*="Ghost"]')?e(260):void 0};const _0x218207=_0x4947;function _0x5af3(){const e=["11EsJvzT","hashData","getWebGLFingerprint","digest","toString","MAX_TEXTURE_SIZE","VERSION","stringify","6453IyjORP","vendor","2060pFGzEr","WEBGL_debug_renderer_info","22918yVilQV","string","UNMASKED_VENDOR_WEBGL","2032284rDLXVs","309882mvBdAr","RENDERER","143585WsYjaE","encode","padStart","height","MAX_RENDERBUFFER_SIZE","14px 'Arial'","#f60","VENDOR","fillRect","toDataURL","SHA-256","58892edxJxD","top","experimental-webgl","getContext","92631GGPWiy","getCanvasFingerprint","textBaseline","SHADING_LANGUAGE_VERSION","join","12ClkyMx","fillText","width","webgl","getExtension","getParameter","createElement","from","25AaTHig","renderer","WiseTrack WebGL Fingerprint!","#069","canvas","UNMASKED_RENDERER_WEBGL","136vJyaXv"];return(_0x5af3=function(){return e})()}!function(){const e=_0x4947,t=_0x5af3();for(;;)try{if(163079===parseInt(e(336))/1+parseInt(e(330))/2*(parseInt(e(356))/3)+-parseInt(e(347))/4+parseInt(e(364))/5*(-parseInt(e(334))/6)+-parseInt(e(351))/7*(-parseInt(e(370))/8)+-parseInt(e(326))/9*(parseInt(e(328))/10)+parseInt(e(371))/11*(parseInt(e(333))/12))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class DeviceFingerprint{static isWebGLSupported(){const e=_0x4947;try{const t=document[e(362)]("canvas");return!(!t.getContext(e(359))&&!t[e(350)](e(349)))}catch(e){return!1}}static[_0x218207(373)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x4947,t=document[e(362)](e(368)),r=t[e(350)](e(359))||t.getContext(e(349));if(!r)return;const i={version:r[e(361)](r[e(324)]),shadingLangVersion:r[e(361)](r[e(354)]),maxTextureSize:r[e(361)](r[e(323)]),maxRenderBufferSize:r[e(361)](r[e(340)]),supportedExtensions:r.getSupportedExtensions()};try{const t=r[e(360)](e(329));i[e(327)]=t?r.getParameter(t[e(332)]):r.getParameter(r[e(343)])}catch(t){i[e(327)]=r[e(361)](r.VENDOR)}try{const t=r[e(360)]("WEBGL_debug_renderer_info");i[e(365)]=t?r[e(361)](t[e(369)]):r.getParameter(r.RENDERER)}catch(t){i[e(365)]=r.getParameter(r[e(335)])}return yield this[e(372)](JSON.stringify(i))})}static[_0x218207(352)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x4947,t=document.createElement(e(368));t[e(358)]=200,t[e(339)]=50;const r=t[e(350)]("2d");if(r)return r[e(353)]=e(348),r.font=e(341),r.fillStyle=e(342),r[e(344)](0,0,200,50),r.fillStyle=e(367),r[e(357)](e(366),2,2),yield this[e(372)](t[e(345)]())})}static hashData(e){return __awaiter(this,void 0,void 0,function*(){const t=_0x4947,r=typeof e===t(331)?e:JSON[t(325)](e),i=(new TextEncoder)[t(337)](r),n=yield crypto.subtle[t(321)](t(346),i);return Array[t(363)](new Uint8Array(n)).map(e=>e[t(322)](16)[t(338)](2,"0"))[t(355)]("")})}}const _0x42a7a0=_0x39b4;!function(){const e=_0x39b4,t=_0x5ad6();for(;;)try{if(308978===-parseInt(e(180))/1*(-parseInt(e(161))/2)+-parseInt(e(189))/3*(-parseInt(e(147))/4)+-parseInt(e(184))/5+-parseInt(e(185))/6*(-parseInt(e(152))/7)+-parseInt(e(148))/8*(parseInt(e(171))/9)+-parseInt(e(162))/10+parseInt(e(155))/11*(parseInt(e(139))/12))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class FieldsBuilder{[_0x42a7a0(160)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x39b4,t=window[e(164)][e(157)]();let r={};return r.created_at=(new Date)[e(134)](),Object[e(131)](r,this.getLocalFields()),Object[e(131)](r,yield this[e(156)]()),Object.assign(r,this[e(198)]()),r[e(158)]=(window[e(164)][e(157)]()-t)[e(172)](1),WTConstants[e(193)][e(196)]&&(r=Object[e(167)](Object[e(133)](r)[e(150)](([t,r])=>[t,null==r?WTConstants.DEFAULTS[e(196)]:r]))),r=Object[e(167)](Object[e(133)](r).filter(([e,t])=>null!=t)),r})}[_0x42a7a0(156)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x39b4,t=yield storageSupport[e(187)]();return{connectivity_type:navigator.onLine?"1":"-1",country:yield countryFinder[e(176)](),package_name:window[e(153)][e(143)],session_storage_enabled:t[e(142)],indexed_db_enabled:t[e(145)],local_storage_enabled:t[e(163)],session_storage:storageSupport[e(192)](sessionStorage)[e(172)](0),local_storage:storageSupport[e(192)](localStorage)[e(172)](0),web_gl_support:DeviceFingerprint[e(151)](),web_gl_fingerprint:yield DeviceFingerprint[e(138)](),web_gl_canvas_fingerprint:yield DeviceFingerprint.getCanvasFingerprint()}})}[_0x42a7a0(166)](){const e=_0x42a7a0,t=storageManager.initialConfig;return t?{uuid:storageManager[e(168)],app_token:t[e(141)],environment:t[e(149)],store_name:e(175),app_version:t[e(170)],push_token:storageManager.pushToken,custom_device_id:t.customDeviceId,default_tracker:t[e(199)],platform:WTConstants[e(165)][e(137)],framework:t.appFrameWork[e(136)](),initiated_by:WTConstants[e(165)][e(137)]+"_"+t[e(182)][e(136)](),initiated_version:WTConstants[e(165)][e(195)],referrer:Utils[e(191)](),installed_at:storageManager.initialDate,session_count:storageManager.sessionCount[e(159)](),session_length:parseInt((storageManager[e(190)]/1e3)[e(159)]()).toString(),subsession_count:parseInt((storageManager[e(183)]/1e3)[e(159)]())[e(159)](),last_interval:parseInt((storageManager[e(188)]/1e3)[e(159)]())[e(159)]()}:{}}[_0x42a7a0(198)](){const e=_0x42a7a0,t=deviceDetector[e(177)]();return{browser_version:t[e(144)][e(146)],device_manufacturer:t[e(132)].vendor,device_name:t[e(132)].model,device_type:t[e(132)][e(154)],os_name:t.os[e(169)],os_version:t.os[e(146)],cpu_type:t.cpu.architecture,web_user_agent:t.ua,display_height:window[e(173)][e(172)](0),display_width:window.innerWidth[e(172)](0),language:navigator[e(194)][e(181)]("-")[0],screen_density:deviceDetector.screenDensity,screen_format:deviceDetector.screenFormat,screen_size:deviceDetector.screenSize,ui_mode:deviceDetector[e(140)][e(159)](),cpu_lpc:navigator[e(178)][e(159)](),ui_style:deviceDetector[e(135)],wout_width:window[e(186)][e(159)](),wout_height:window.outerHeight[e(159)](),web_engine:t[e(179)][e(169)],web_engine_version:t[e(179)].version,display_size:deviceDetector[e(174)],screen_type:deviceDetector[e(197)]}}}function _0x39b4(e,t){const r=_0x5ad6();return(_0x39b4=function(e,t){return r[e-=131]})(e,t)}const fieldsBuilder=new FieldsBuilder;function _0x5ad6(){const e=["build","2IXTrWm","3918780zRhOZB","localStorage","performance","SDK","getLocalFields","fromEntries","deviceId","name","appVersion","18585kVkuVX","toFixed","innerHeight","displaySize","other","getCountryCode","getDeviceInfo","hardwareConcurrency","engine","147884Kjjbuq","split","appFrameWork","subSessionCount","1193175nItbVL","174fBjTkG","outerWidth","getSupportResult","inactiveDuration","3TnfTAT","activeDuration","getUTMParamsString","getStorageSizeBytes","DEFAULTS","language","VERSION","PARAMETERS_VALUE","screenType","getDeviceFields","defaultTracker","assign","device","entries","toISOString","uiStyle","toLowerCase","PLATFORM","getWebGLFingerprint","11168532bVuRbj","uiMode","appToken","sessionStorage","hostname","browser","indexedDB","version","689732eNNJry","2384lqSJJR","userEnvironment","map","isWebGLSupported","73339Qopufs","location","type","11jNffae","getApplicationFields","now","time_spent","toString"];return(_0x5ad6=function(){return e})()}const _0x2a7f39=_0x4684;function _0x4684(e,t){const r=_0x150b();return(_0x4684=function(e,t){return r[e-=457]})(e,t)}function _0x150b(){const e=["438CTDJaQ","create","25067670nZBpnK","1010558fdLhWR","3gDnfIC","61398EahJXB","14575YUSoyw","3255228UNduoO","build","event","call","21XDJESn","2118280eziTlK","589476tQSTEe","assign"];return(_0x150b=function(){return e})()}!function(){const e=_0x4684,t=_0x150b();for(;;)try{if(594791===-parseInt(e(464))/1+-parseInt(e(469))/2*(-parseInt(e(470))/3)+-parseInt(e(458))/4+parseInt(e(457))/5*(-parseInt(e(466))/6)+-parseInt(e(462))/7*(parseInt(e(463))/8)+-parseInt(e(471))/9+parseInt(e(468))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class EventFieldsBuilder extends FieldsBuilder{constructor(e){super(),this.event=e}[_0x2a7f39(459)](){const e=_0x2a7f39,t=Object[e(467)](null,{build:{get:()=>super[e(459)]}});return __awaiter(this,void 0,void 0,function*(){const r=e,i=yield t[r(459)][r(461)](this);return new Promise(e=>{const t=r;e(Object[t(465)](Object.assign({},i),this[t(460)].toJSON()))})})}}const _0x157ade=_0x4c2d;function _0x4c2d(e,t){const r=_0x4dba();return(_0x4c2d=function(e,t){return r[e-=220]})(e,t)}function _0x4dba(){const e=["2QksPsw","sdkEnabled","beforeunload","inactiveTime","Creating Install: SDK-Clicks has already submitted","27JNeCkA","12wPQcCt","27721OShyJb","SDK is not enabled to start tracking!","toISOString","now","setActivityTimes","build","sdkClickSubmit","SESSIONS","stringify","focus","17166ylhMWM","ATTRIBUTIONS","User was inactived for ","initialDate","SDK_CLICKS","generateDeviceUUID","log","286376jZRCNp","hasFocus"," request to main queue","warn","blur","getQueueStatus","Creating Attribution: SDK is not enabled!","main","createRequest","WT Tracker started","deviceId","2802778GVIuEv","addEventListener","838390gEtWdQ","249027JqAewQ","debug","shutdown","trackEvent: SDK is not enabled","subsessionInterval","visibilitychange","visible","pending","Creating Session: SDK is not enabled!","308CFMPmo","CheckPushToken: SDK is not enabled","isVisibleFocused","Creating Session: First-Session has already submitted","s | (","initialize","appSettings","checkSdkClicks","This Notification token has sent to server previously","pushToken","Creating First Session: SDK is not enabled!","info","s Totaly)","visibilityState","WT Tracker stopped","getCountryCode","createDeviceID","isEnabled","274035acVTGU","firstSessionSubmit","stop","initialized","addPendingRequest","eventCount","activeTime","trackEvent","addObservers","checkFirstSession","start","fcmToken","inactiveDuration","isRunning","Add ","createAttribution"];return(_0x4dba=function(){return e})()}!function(){const e=_0x4c2d,t=_0x4dba();for(;;)try{if(100435===parseInt(e(283))/1+parseInt(e(276))/2*(-parseInt(e(233))/3)+parseInt(e(282))/4*(-parseInt(e(260))/5)+-parseInt(e(293))/6*(parseInt(e(242))/7)+parseInt(e(300))/8*(parseInt(e(281))/9)+parseInt(e(232))/10+parseInt(e(230))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class WTTracker{constructor(){const e=_0x4c2d;this[e(273)]=!1,this[e(263)]=!1}get[_0x157ade(259)](){return storageManager[_0x157ade(277)]}initialize(){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this[e(257)](),yield this.setActivityTimes(),this.createDeviceID(),this[e(268)](),this.initialized=!0})}startTracking(){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this.isEnabled?(WTLogger[e(234)](e(228)),yield queueManager[e(247)](),yield this[e(249)](),yield this[e(269)](),yield this[e(275)](),this[e(273)]=!0):WTLogger[e(222)](e(284))})}stopTracking(){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this[e(273)]=!1,activityTicker[e(262)](),yield queueManager[e(235)](),WTLogger[e(234)](e(256))})}checkPushToken(e){return __awaiter(this,void 0,void 0,function*(){const t=_0x4c2d;storageManager[t(251)]=e,this[t(259)]?storageManager[t(271)]!==e?yield this[t(227)]({endpoint:WTEndpoints.SDK_INFOS,queueType:t(240)}):WTLogger[t(253)](t(250)):WTLogger[t(222)](t(243))})}[_0x157ade(267)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x4c2d;this[t(259)]?this[t(263)]?(storageManager[t(265)]+=1,yield this.createRequest({endpoint:WTEndpoints.EVENTS,fBuilder:new EventFieldsBuilder(e),queueType:t(240)})):WTLogger[t(222)]("trackEvent: SDK is not initialized yet"):WTLogger.warn(t(236))})}getCountryCode(){countryFinder[_0x157ade(257)]()}[_0x157ade(275)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this[e(259)]?yield this[e(227)]({endpoint:WTEndpoints[e(294)],queueType:"pending"}):WTLogger[e(222)](e(225))})}[_0x157ade(269)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this.isEnabled?storageManager[e(261)]?WTLogger[e(234)](e(245)):yield this[e(227)]({endpoint:WTEndpoints[e(290)],queueType:storageManager[e(289)]?"main":e(240)}):WTLogger[e(222)](e(252))})}checkSdkClicks(){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;this[e(259)]?storageManager[e(289)]?WTLogger.debug(e(280)):yield this[e(227)]({endpoint:WTEndpoints[e(297)]}):WTLogger[e(222)]("Creating Install: SDK is not enabled!")})}createRequest(e){const t=_0x157ade;return __awaiter(this,arguments,void 0,function*({endpoint:e,fBuilder:r=fieldsBuilder,queueType:i=t(226)}){const n=t,s=yield r[n(288)](),o=new RequestRecord(e,s);i===n(240)?(WTLogger[n(253)]("Add "+e+" request to pending queue"),yield queueManager[n(264)](o)):(WTLogger[n(253)](n(274)+e+n(221)),yield queueManager.addRequest(o));const a=queueManager[n(224)]();console[n(299)](JSON[n(291)](a))})}[_0x157ade(258)](){const e=_0x157ade;!storageManager[e(229)]&&(storageManager.deviceId=cryptoHelper[e(298)]()),!storageManager[e(296)]&&(storageManager[e(296)]=(new Date)[e(285)]())}[_0x157ade(287)](){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;if(storageManager[e(266)]){storageManager[e(279)]=storageManager[e(266)];const t=Date[e(286)]()-storageManager.inactiveTime;storageManager[e(272)]+=t,console[e(299)](e(295)+t/1e3+e(246)+storageManager.inactiveDuration/1e3+e(254)),yield this.checkSessionIntervals()}storageManager[e(266)]=Date[e(286)](),activityTicker[e(270)]()})}checkSessionIntervals(){return __awaiter(this,void 0,void 0,function*(){const e=_0x4c2d;var t,r;const i=storageManager[e(279)],n=null===(t=storageManager.appSettings)||void 0===t?void 0:t.sessionInterval,s=null===(r=storageManager[e(248)])||void 0===r?void 0:r[e(237)];if(!this[e(259)])return void WTLogger[e(222)](e(241));if(!i||!n||!s)return;const o=Date[e(286)]()-i;o>parseInt(n)?(storageManager.sessionCount+=1,yield this[e(227)]({endpoint:WTEndpoints[e(290)],queueType:storageManager[e(289)]?"main":e(240)})):o>parseInt(s)&&(storageManager.subSessionCount+=1)})}[_0x157ade(244)](){const e=_0x157ade;return document[e(255)]===e(239)&&document[e(220)]()}[_0x157ade(268)](){const e=_0x157ade;window[e(231)](e(278),()=>{activityTicker[e(262)]()}),document[e(231)](e(238),()=>{const t=e;this[t(244)]()?(this.createAttribution(),this[t(287)]()):activityTicker[t(262)]()}),window[e(231)](e(292),()=>{const t=e;this[t(244)]()&&(this.createAttribution(),this[t(287)]())}),window[e(231)](e(223),()=>{activityTicker[e(262)]()})}}const tracker=new WTTracker,_0x59dd55=_0x23cb;function _0x398c(){const e=["fromConfig","flush","updateAppSettings","NetworkError","43144sFGGpi","init","1116mEvOij","_instance","initialConfig","config","385360SCfaXZ","32836COCnxn","warn","Need to get app-settings for ","startTracking","checkPushToken","The version you are currently using has expired and is no longer supported. Please update to the latest version to continue using the SDK","startTrackerAutomatically","isEnabled","needAppSettings"," environment","‼️ Start Tracking: SDK is not initialized yet","checkSdkUpdate","4919321TtiqsK","3678PsUowx","Config is not set!","sdkInitialized","doGetConfig","sdkEnvironment","Track Event: SDK is not enabled!","1523385dfYJfo","setLevel","stopTracking","appSettings","‼️ App Settings NOT set!, check errors.","error","1LWIMyS","‼️ SDK Config NOT set!, check errors.","info","‼️ Set Fcm Token: SDK is not initialized yet","‼️ Track Event: SDK is not initialized yet","sdkUpdate","setEnabled","checkSdkEnabled","forceUpdate","Clearing Data and stop tracker!","trackingWaitingTime","6475MYRADK","doGetAppSettings","25sffGeN","sdkEnabled","Start Tracking: SDK is not enabled!","2750040JCzZoZ","debug","setFCMToken","trackEvent","initialize","defaultValue"];return(_0x398c=function(){return e})()}function _0x23cb(e,t){const r=_0x398c();return(_0x23cb=function(e,t){return r[e-=106]})(e,t)}!function(){const e=_0x23cb,t=_0x398c();for(;;)try{if(352569===parseInt(e(127))/1*(-parseInt(e(160))/2)+parseInt(e(121))/3+-parseInt(e(159))/4*(-parseInt(e(140))/5)+parseInt(e(115))/6*(-parseInt(e(138))/7)+-parseInt(e(153))/8*(-parseInt(e(155))/9)+-parseInt(e(143))/10+-parseInt(e(114))/11)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class WiseTrack{static get instance(){const e=_0x23cb;return!WiseTrack[e(156)]&&(WiseTrack[e(156)]=new WiseTrack),WiseTrack[e(156)]}constructor(){this[_0x23cb(117)]=!1}[_0x59dd55(154)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x23cb;var r,i;const n=yield this.getConfig(e);this[t(134)](n),this[t(113)](n),this[t(133)](!0),yield this.updateAppSettings(n),this[t(117)]=!0,yield tracker[t(147)]();(null===(r=e[t(108)])||void 0===r||r)&&setTimeout(()=>this[t(163)](),1e3*(null!==(i=e[t(137)])&&void 0!==i?i:0))})}setLogLevel(e){WTLogger[_0x59dd55(122)](e)}[_0x59dd55(150)](){const e=_0x59dd55;WTLogger[e(129)](e(136)),storageManager.clear(),this[e(123)]()}[_0x59dd55(109)](){return storageManager[_0x59dd55(141)]}[_0x59dd55(133)](e){const t=_0x59dd55,r=storageManager[t(158)];if(!r)throw new Error(t(116));if(!r[t(141)])throw new Error("SDK is disabled form server, contact your adminstrator!");if(r[t(135)])throw new Error(t(107));storageManager[t(141)]=e}startTracking(){return __awaiter(this,void 0,void 0,function*(){const e=_0x23cb;this.sdkInitialized?this[e(109)]()?yield tracker[e(163)]():WTLogger.warn(e(142)):WTLogger[e(161)](e(112))})}[_0x59dd55(123)](){return __awaiter(this,void 0,void 0,function*(){yield tracker.stopTracking()})}[_0x59dd55(145)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x23cb;this[t(117)]?this[t(109)]()?yield tracker[t(106)](e):WTLogger.warn("Set Fcm Token: SDK is not enabled!"):WTLogger[t(161)](t(130))})}[_0x59dd55(146)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x23cb;this[t(117)]?this[t(109)]()?yield tracker.trackEvent(e):WTLogger[t(161)](t(120)):WTLogger[t(161)](t(131))})}getConfig(e){return __awaiter(this,void 0,void 0,function*(){const t=_0x23cb;let r;storageManager[t(157)]=e;try{r=yield apiClient[t(118)]()}catch(e){if(!(e instanceof ApiError[t(152)]))throw WTLogger[t(129)](t(128)),e;r=storageManager.config||WTConfig[t(148)]}return storageManager.config=r,WTLogger[t(129)]("SDK Config set"),r})}[_0x59dd55(151)](e){return __awaiter(this,void 0,void 0,function*(){const t=_0x23cb;let r;if(EnvironmentUtils[t(110)]()){WTLogger[t(144)](t(162)+EnvironmentUtils[t(119)]+t(111));try{r=yield apiClient[t(139)]()}catch(e){if(!(e instanceof ApiError[t(152)]))throw WTLogger[t(129)](t(125)),e;r=WTAppSettings[t(148)]}}else r=WTAppSettings[t(149)](e);return storageManager[t(124)]=r,WTLogger[t(129)]("App Settings set"),r})}[_0x59dd55(134)](e){const t=_0x59dd55;if(!e[t(141)]){const e="SDK is disabled form server, contact your adminstrator!";throw WTLogger[t(126)](e),new Error(e)}}[_0x59dd55(113)](e){const t=_0x59dd55;if(e[t(135)]){const e=t(107);throw WTLogger[t(126)](e),new Error(e)}e[t(132)]&&WTLogger[t(161)]("A new version of the SDK is available. It is recommended to update to the latest version to enjoy improved features and better performance.")}}function _0x2dc9(e,t){var r=_0x2635();return(_0x2dc9=function(e,t){return r[e-=462]})(e,t)}function _0x2635(){var e=["191900MQkvko","revenue","Default","default","amount","22167qrVAns","475236kqNSob","2774710dkUiPc","Revenue","35UZBzGA","24KGGqGx","params","914994CSyAib","20nQvkSZ","type","176016RBlsdg","currency","toJSON","360185DdVwPJ","name","addParam"];return(_0x2635=function(){return e})()}function _0x29d7(e,t){var r=_0x2d6f();return(_0x29d7=function(e,t){return r[e-=260]})(e,t)}function _0x2d6f(){var e=["256860DPbYGV","647128NrfySs","4eNaGyD","4185NwwDCi","133bIgyzV","806kfWTSz","9154089XOGijo","2368535MduFHt","19215COBJgL","2571630jykmwA"];return(_0x2d6f=function(){return e})()}!function(){for(var e=_0x2dc9,t=_0x2635();;)try{if(224307===parseInt(e(476))/1+parseInt(e(464))/2+-parseInt(e(463))/3+parseInt(e(471))/4*(-parseInt(e(479))/5)+-parseInt(e(473))/6*(parseInt(e(467))/7)+parseInt(e(468))/8*(-parseInt(e(470))/9)+parseInt(e(465))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),exports.WTEvent=void 0,function(e){var t=_0x2dc9;class r{constructor(e){var t=_0x2dc9;this[t(472)]=t(482),this[t(477)]=e}[t(478)](e,r){var i,n=t;let s=null!==(i=this.params)&&void 0!==i?i:{};s[e]=r,this[n(469)]=s}toJSON(){var e=t;return{event_type:this[e(472)],event_name:this[e(477)],partner_params:this[e(469)]}}}e[t(481)]=r;class i extends r{constructor(e,r,i){var n=t;super(e),this[n(472)]=n(480),this[n(462)]=r,this[n(474)]=i}[t(475)](){var e=t;return{event_type:this[e(472)],event_name:this.name,revenue:this.amount,currency:this[e(474)],partner_params:this.params}}}e[t(466)]=i}(exports.WTEvent||(exports.WTEvent={})),function(){for(var e=_0x29d7,t=_0x2d6f();;)try{if(927474===parseInt(e(263))/1+-parseInt(e(260))/2*(-parseInt(e(268))/3)+parseInt(e(267))/4*(-parseInt(e(262))/5)+parseInt(e(265))/6+parseInt(e(269))/7*(parseInt(e(266))/8)+-parseInt(e(261))/9+parseInt(e(264))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}(),exports.WTLogEngine=WTLogEngine,exports.WTLogLevel=WTLogLevel,exports.WTLogger=WTLogger,exports.WiseTrack=WiseTrack;
|