native-fn 1.0.47 → 1.0.49
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/dist/native.cjs +150 -70
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +150 -70
- package/dist/native.umd.js +150 -70
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +170 -69
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +170 -69
- package/dist/plugin/app/index.umd.js +170 -69
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/types/platform.d.ts +3 -1
- package/dist/plugin/camera/index.cjs +149 -69
- package/dist/plugin/camera/index.min.cjs +1 -1
- package/dist/plugin/camera/index.min.mjs +1 -1
- package/dist/plugin/camera/index.mjs +149 -69
- package/dist/plugin/camera/index.umd.js +149 -69
- package/dist/plugin/camera/index.umd.min.js +1 -1
- package/dist/plugin/camera/src/types/platform.d.ts +3 -1
- package/dist/plugin/clipboard/src/types/platform.d.ts +3 -1
- package/dist/plugin/fullscreen/index.cjs +149 -69
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +149 -69
- package/dist/plugin/fullscreen/index.umd.js +149 -69
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/types/platform.d.ts +3 -1
- package/dist/plugin/theme/index.cjs +149 -69
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +149 -69
- package/dist/plugin/theme/index.umd.js +149 -69
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/types/platform.d.ts +3 -1
- package/dist/src/types/platform.d.ts +3 -1
- package/package.json +1 -1
package/dist/native.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version$1 = "1.0.
|
|
1
|
+
var version$1 = "1.0.49";
|
|
2
2
|
var packageJSON = {
|
|
3
3
|
version: version$1};
|
|
4
4
|
|
|
@@ -140,6 +140,7 @@ var Browsers;
|
|
|
140
140
|
Browsers["IE"] = "IE";
|
|
141
141
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
142
142
|
})(Browsers || (Browsers = {}));
|
|
143
|
+
var userAgent = typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' ? navigator.userAgent : '';
|
|
143
144
|
var Platform = {
|
|
144
145
|
device: Devices.Unknown,
|
|
145
146
|
os: OS.Unknown,
|
|
@@ -149,12 +150,14 @@ var Platform = {
|
|
|
149
150
|
browser: Browsers.Unknown,
|
|
150
151
|
browserVersion: '',
|
|
151
152
|
renderer: getRenderer(),
|
|
152
|
-
userAgent:
|
|
153
|
-
isWebview: false,
|
|
153
|
+
userAgent: userAgent,
|
|
154
154
|
isMobile: false,
|
|
155
155
|
isDesktop: false,
|
|
156
156
|
isStandalone: false,
|
|
157
|
-
|
|
157
|
+
isWebview: /; ?wv|applewebkit(?!.*safari)/i.test(userAgent),
|
|
158
|
+
isNodeJS: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined,
|
|
159
|
+
isElectron: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined,
|
|
160
|
+
isReactNative: typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
158
161
|
};
|
|
159
162
|
var OS_RESOLVER_MAP = [
|
|
160
163
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -241,6 +244,137 @@ function resolveUnderscoreVersion(string) {
|
|
|
241
244
|
return '';
|
|
242
245
|
return string.replace(/_/g, '.');
|
|
243
246
|
}
|
|
247
|
+
function resolveSemanticWindowsVersion(version, defaultValue) {
|
|
248
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
249
|
+
return '11';
|
|
250
|
+
if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
251
|
+
return '10';
|
|
252
|
+
if (version.major === 6 && version.minor === 3)
|
|
253
|
+
return '8.1';
|
|
254
|
+
if (version.major === 6 && version.minor === 2)
|
|
255
|
+
return '8';
|
|
256
|
+
if (version.major === 6 && version.minor === 1)
|
|
257
|
+
return '7';
|
|
258
|
+
if (version.major === 6 && version.minor === 0)
|
|
259
|
+
return 'Vista';
|
|
260
|
+
if (version.major === 5 && version.minor === 1)
|
|
261
|
+
return 'XP';
|
|
262
|
+
if (version.major === 5 && version.minor === 2)
|
|
263
|
+
return 'XP';
|
|
264
|
+
if (version.major === 5 && version.minor === 0)
|
|
265
|
+
return '2000';
|
|
266
|
+
if (version.major === 4 && version.minor === 90)
|
|
267
|
+
return 'ME';
|
|
268
|
+
if (version.major === 4 && version.minor === 0)
|
|
269
|
+
return 'NT 4.0';
|
|
270
|
+
if (version.major === 3 && version.minor === 51)
|
|
271
|
+
return 'NT 3.11';
|
|
272
|
+
return defaultValue;
|
|
273
|
+
}
|
|
274
|
+
function resolveSemanticDarwinVersion(version, defaultValue) {
|
|
275
|
+
if (version.major >= 24)
|
|
276
|
+
return '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
277
|
+
if (version.major === 23)
|
|
278
|
+
return '14.' + version.minor + '.' + version.build;
|
|
279
|
+
if (version.major === 22)
|
|
280
|
+
return '13.' + version.minor + '.' + version.build;
|
|
281
|
+
if (version.major === 21)
|
|
282
|
+
return '12.' + version.minor + '.' + version.build;
|
|
283
|
+
if (version.major === 20)
|
|
284
|
+
return '11.' + version.minor + '.' + version.build;
|
|
285
|
+
if (version.major === 19)
|
|
286
|
+
return '10.15.' + version.minor;
|
|
287
|
+
if (version.major === 18)
|
|
288
|
+
return '10.14.' + version.minor;
|
|
289
|
+
if (version.major === 17)
|
|
290
|
+
return '10.13.' + version.minor;
|
|
291
|
+
if (version.major === 16)
|
|
292
|
+
return '10.12.' + version.minor;
|
|
293
|
+
if (version.major === 15)
|
|
294
|
+
return '10.11.' + version.minor;
|
|
295
|
+
if (version.major === 14)
|
|
296
|
+
return '10.10.' + version.minor;
|
|
297
|
+
if (version.major === 13)
|
|
298
|
+
return '10.9.' + version.minor;
|
|
299
|
+
if (version.major >= 5 && version.major <= 12)
|
|
300
|
+
return '10.' + (version.major - 4) + '.' + version.minor;
|
|
301
|
+
return defaultValue;
|
|
302
|
+
}
|
|
303
|
+
function resolveSemanticAndroidVersion(version, defaultValue) {
|
|
304
|
+
if (version.major >= 36)
|
|
305
|
+
return '16';
|
|
306
|
+
if (version.major === 35)
|
|
307
|
+
return '15';
|
|
308
|
+
if (version.major === 34)
|
|
309
|
+
return '14';
|
|
310
|
+
if (version.major === 33)
|
|
311
|
+
return '13';
|
|
312
|
+
if (version.major === 32)
|
|
313
|
+
return '12.1';
|
|
314
|
+
if (version.major === 31)
|
|
315
|
+
return '12';
|
|
316
|
+
if (version.major === 30)
|
|
317
|
+
return '11';
|
|
318
|
+
if (version.major === 29)
|
|
319
|
+
return '10';
|
|
320
|
+
if (version.major === 28)
|
|
321
|
+
return '9';
|
|
322
|
+
if (version.major === 27)
|
|
323
|
+
return '8.1';
|
|
324
|
+
if (version.major === 26)
|
|
325
|
+
return '8.0';
|
|
326
|
+
if (version.major === 25)
|
|
327
|
+
return '7.1';
|
|
328
|
+
if (version.major === 24)
|
|
329
|
+
return '7.0';
|
|
330
|
+
if (version.major === 23)
|
|
331
|
+
return '6.0';
|
|
332
|
+
if (version.major === 22)
|
|
333
|
+
return '5.1';
|
|
334
|
+
if (version.major === 21)
|
|
335
|
+
return '5.0';
|
|
336
|
+
if (version.major === 20)
|
|
337
|
+
return '4.4W';
|
|
338
|
+
if (version.major === 19)
|
|
339
|
+
return '4.4';
|
|
340
|
+
if (version.major === 18)
|
|
341
|
+
return '4.3';
|
|
342
|
+
if (version.major === 17)
|
|
343
|
+
return '4.2';
|
|
344
|
+
if (version.major === 16)
|
|
345
|
+
return '4.1';
|
|
346
|
+
if (version.major === 15)
|
|
347
|
+
return '4.0.3';
|
|
348
|
+
if (version.major === 14)
|
|
349
|
+
return '4.0';
|
|
350
|
+
if (version.major === 13)
|
|
351
|
+
return '3.2';
|
|
352
|
+
if (version.major === 12)
|
|
353
|
+
return '3.1';
|
|
354
|
+
if (version.major === 11)
|
|
355
|
+
return '3.0';
|
|
356
|
+
if (version.major === 10)
|
|
357
|
+
return '2.3.3';
|
|
358
|
+
if (version.major === 9)
|
|
359
|
+
return '2.3';
|
|
360
|
+
if (version.major === 8)
|
|
361
|
+
return '2.2';
|
|
362
|
+
if (version.major === 7)
|
|
363
|
+
return '2.1';
|
|
364
|
+
if (version.major === 6)
|
|
365
|
+
return '2.0.1';
|
|
366
|
+
if (version.major === 5)
|
|
367
|
+
return '2.0';
|
|
368
|
+
if (version.major === 4)
|
|
369
|
+
return '1.6';
|
|
370
|
+
if (version.major === 3)
|
|
371
|
+
return '1.5';
|
|
372
|
+
if (version.major === 2)
|
|
373
|
+
return '1.1';
|
|
374
|
+
if (version.major === 1)
|
|
375
|
+
return '1.0';
|
|
376
|
+
return defaultValue;
|
|
377
|
+
}
|
|
244
378
|
function resolveVersion(string, resolver) {
|
|
245
379
|
if (typeof resolver === 'function')
|
|
246
380
|
return resolver(string);
|
|
@@ -257,11 +391,6 @@ function normalizeBrand(entry) {
|
|
|
257
391
|
return { brand: entry, version: '' };
|
|
258
392
|
return { brand: entry.brand, version: entry.version };
|
|
259
393
|
}
|
|
260
|
-
function getUserAgent() {
|
|
261
|
-
if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string')
|
|
262
|
-
return navigator.userAgent;
|
|
263
|
-
return '';
|
|
264
|
-
}
|
|
265
394
|
function getRenderer() {
|
|
266
395
|
if (typeof globalThis.document === 'undefined')
|
|
267
396
|
return '';
|
|
@@ -292,10 +421,7 @@ function getIsStandalone(os) {
|
|
|
292
421
|
function getIsWebview() {
|
|
293
422
|
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
294
423
|
}
|
|
295
|
-
function
|
|
296
|
-
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
297
|
-
}
|
|
298
|
-
function getNodeOSVersion(string) {
|
|
424
|
+
function getSemanticVersion(string) {
|
|
299
425
|
var parts = string.split('.');
|
|
300
426
|
return {
|
|
301
427
|
major: parseInt(parts[0] || '0'),
|
|
@@ -343,95 +469,49 @@ for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
|
343
469
|
break;
|
|
344
470
|
}
|
|
345
471
|
}
|
|
346
|
-
if (
|
|
472
|
+
if (Platform.isReactNative) {
|
|
347
473
|
try {
|
|
348
474
|
var reactNative = require('react-native');
|
|
349
475
|
var platform = reactNative.Platform;
|
|
350
476
|
var os = platform.OS;
|
|
477
|
+
var release = '' + platform.Version;
|
|
478
|
+
var version = getSemanticVersion(release);
|
|
351
479
|
switch (os) {
|
|
352
480
|
case 'android':
|
|
353
481
|
Platform.os = OS.Android;
|
|
482
|
+
Platform.osVersion = resolveSemanticAndroidVersion(version, release);
|
|
354
483
|
break;
|
|
355
484
|
case 'ios':
|
|
356
485
|
Platform.os = OS.iOS;
|
|
486
|
+
Platform.osVersion = release;
|
|
357
487
|
break;
|
|
358
488
|
case 'windows':
|
|
359
489
|
Platform.os = OS.Windows;
|
|
490
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
360
491
|
break;
|
|
361
492
|
case 'macos':
|
|
362
493
|
Platform.os = OS.MacOS;
|
|
494
|
+
Platform.osVersion = release;
|
|
363
495
|
break;
|
|
364
496
|
}
|
|
365
497
|
}
|
|
366
498
|
catch (_) {
|
|
367
499
|
}
|
|
368
500
|
}
|
|
369
|
-
|
|
501
|
+
if (Platform.isNodeJS) {
|
|
370
502
|
try {
|
|
371
503
|
var os = require('os');
|
|
372
504
|
var platform = os.platform();
|
|
373
505
|
var release = os.release();
|
|
374
|
-
var version =
|
|
506
|
+
var version = getSemanticVersion(release);
|
|
375
507
|
switch (platform) {
|
|
376
508
|
case 'win32':
|
|
377
509
|
Platform.os = OS.Windows;
|
|
378
|
-
|
|
379
|
-
Platform.osVersion = '11';
|
|
380
|
-
else if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
381
|
-
Platform.osVersion = '10';
|
|
382
|
-
else if (version.major === 6 && version.minor === 3)
|
|
383
|
-
Platform.osVersion = '8.1';
|
|
384
|
-
else if (version.major === 6 && version.minor === 2)
|
|
385
|
-
Platform.osVersion = '8';
|
|
386
|
-
else if (version.major === 6 && version.minor === 1)
|
|
387
|
-
Platform.osVersion = '7';
|
|
388
|
-
else if (version.major === 6 && version.minor === 0)
|
|
389
|
-
Platform.osVersion = 'Vista';
|
|
390
|
-
else if (version.major === 5 && version.minor === 1)
|
|
391
|
-
Platform.osVersion = 'XP';
|
|
392
|
-
else if (version.major === 5 && version.minor === 2)
|
|
393
|
-
Platform.osVersion = 'XP';
|
|
394
|
-
else if (version.major === 5 && version.minor === 0)
|
|
395
|
-
Platform.osVersion = '2000';
|
|
396
|
-
else if (version.major === 4 && version.minor === 90)
|
|
397
|
-
Platform.osVersion = 'ME';
|
|
398
|
-
else if (version.major === 4 && version.minor === 0)
|
|
399
|
-
Platform.osVersion = 'NT 4.0';
|
|
400
|
-
else if (version.major === 3 && version.minor === 51)
|
|
401
|
-
Platform.osVersion = 'NT 3.11';
|
|
402
|
-
else
|
|
403
|
-
Platform.osVersion = release;
|
|
510
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
404
511
|
break;
|
|
405
512
|
case 'darwin':
|
|
406
513
|
Platform.os = OS.MacOS;
|
|
407
|
-
|
|
408
|
-
Platform.osVersion = '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
409
|
-
else if (version.major === 23)
|
|
410
|
-
Platform.osVersion = '14.' + version.minor + '.' + version.build;
|
|
411
|
-
else if (version.major === 22)
|
|
412
|
-
Platform.osVersion = '13.' + version.minor + '.' + version.build;
|
|
413
|
-
else if (version.major === 21)
|
|
414
|
-
Platform.osVersion = '12.' + version.minor + '.' + version.build;
|
|
415
|
-
else if (version.major === 20)
|
|
416
|
-
Platform.osVersion = '11.' + version.minor + '.' + version.build;
|
|
417
|
-
else if (version.major === 19)
|
|
418
|
-
Platform.osVersion = '10.15.' + version.minor;
|
|
419
|
-
else if (version.major === 18)
|
|
420
|
-
Platform.osVersion = '10.14.' + version.minor;
|
|
421
|
-
else if (version.major === 17)
|
|
422
|
-
Platform.osVersion = '10.13.' + version.minor;
|
|
423
|
-
else if (version.major === 16)
|
|
424
|
-
Platform.osVersion = '10.12.' + version.minor;
|
|
425
|
-
else if (version.major === 15)
|
|
426
|
-
Platform.osVersion = '10.11.' + version.minor;
|
|
427
|
-
else if (version.major === 14)
|
|
428
|
-
Platform.osVersion = '10.10.' + version.minor;
|
|
429
|
-
else if (version.major === 13)
|
|
430
|
-
Platform.osVersion = '10.9.' + version.minor;
|
|
431
|
-
else if (version.major >= 5 && version.major <= 12)
|
|
432
|
-
Platform.osVersion = '10.' + (version.major - 4) + '.' + version.minor;
|
|
433
|
-
else
|
|
434
|
-
Platform.osVersion = release;
|
|
514
|
+
Platform.osVersion = resolveSemanticDarwinVersion(version, release);
|
|
435
515
|
break;
|
|
436
516
|
case 'android':
|
|
437
517
|
Platform.os = OS.Android;
|
package/dist/native.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Native = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$1 = "1.0.
|
|
7
|
+
var version$1 = "1.0.49";
|
|
8
8
|
var packageJSON = {
|
|
9
9
|
version: version$1};
|
|
10
10
|
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
Browsers["IE"] = "IE";
|
|
147
147
|
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
148
148
|
})(Browsers || (Browsers = {}));
|
|
149
|
+
var userAgent = typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' ? navigator.userAgent : '';
|
|
149
150
|
var Platform = {
|
|
150
151
|
device: Devices.Unknown,
|
|
151
152
|
os: OS.Unknown,
|
|
@@ -155,12 +156,14 @@
|
|
|
155
156
|
browser: Browsers.Unknown,
|
|
156
157
|
browserVersion: '',
|
|
157
158
|
renderer: getRenderer(),
|
|
158
|
-
userAgent:
|
|
159
|
-
isWebview: false,
|
|
159
|
+
userAgent: userAgent,
|
|
160
160
|
isMobile: false,
|
|
161
161
|
isDesktop: false,
|
|
162
162
|
isStandalone: false,
|
|
163
|
-
|
|
163
|
+
isWebview: /; ?wv|applewebkit(?!.*safari)/i.test(userAgent),
|
|
164
|
+
isNodeJS: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined,
|
|
165
|
+
isElectron: typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined,
|
|
166
|
+
isReactNative: typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
|
164
167
|
};
|
|
165
168
|
var OS_RESOLVER_MAP = [
|
|
166
169
|
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
@@ -247,6 +250,137 @@
|
|
|
247
250
|
return '';
|
|
248
251
|
return string.replace(/_/g, '.');
|
|
249
252
|
}
|
|
253
|
+
function resolveSemanticWindowsVersion(version, defaultValue) {
|
|
254
|
+
if (version.major === 10 && version.minor === 0 && version.build >= 22000)
|
|
255
|
+
return '11';
|
|
256
|
+
if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
257
|
+
return '10';
|
|
258
|
+
if (version.major === 6 && version.minor === 3)
|
|
259
|
+
return '8.1';
|
|
260
|
+
if (version.major === 6 && version.minor === 2)
|
|
261
|
+
return '8';
|
|
262
|
+
if (version.major === 6 && version.minor === 1)
|
|
263
|
+
return '7';
|
|
264
|
+
if (version.major === 6 && version.minor === 0)
|
|
265
|
+
return 'Vista';
|
|
266
|
+
if (version.major === 5 && version.minor === 1)
|
|
267
|
+
return 'XP';
|
|
268
|
+
if (version.major === 5 && version.minor === 2)
|
|
269
|
+
return 'XP';
|
|
270
|
+
if (version.major === 5 && version.minor === 0)
|
|
271
|
+
return '2000';
|
|
272
|
+
if (version.major === 4 && version.minor === 90)
|
|
273
|
+
return 'ME';
|
|
274
|
+
if (version.major === 4 && version.minor === 0)
|
|
275
|
+
return 'NT 4.0';
|
|
276
|
+
if (version.major === 3 && version.minor === 51)
|
|
277
|
+
return 'NT 3.11';
|
|
278
|
+
return defaultValue;
|
|
279
|
+
}
|
|
280
|
+
function resolveSemanticDarwinVersion(version, defaultValue) {
|
|
281
|
+
if (version.major >= 24)
|
|
282
|
+
return '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
283
|
+
if (version.major === 23)
|
|
284
|
+
return '14.' + version.minor + '.' + version.build;
|
|
285
|
+
if (version.major === 22)
|
|
286
|
+
return '13.' + version.minor + '.' + version.build;
|
|
287
|
+
if (version.major === 21)
|
|
288
|
+
return '12.' + version.minor + '.' + version.build;
|
|
289
|
+
if (version.major === 20)
|
|
290
|
+
return '11.' + version.minor + '.' + version.build;
|
|
291
|
+
if (version.major === 19)
|
|
292
|
+
return '10.15.' + version.minor;
|
|
293
|
+
if (version.major === 18)
|
|
294
|
+
return '10.14.' + version.minor;
|
|
295
|
+
if (version.major === 17)
|
|
296
|
+
return '10.13.' + version.minor;
|
|
297
|
+
if (version.major === 16)
|
|
298
|
+
return '10.12.' + version.minor;
|
|
299
|
+
if (version.major === 15)
|
|
300
|
+
return '10.11.' + version.minor;
|
|
301
|
+
if (version.major === 14)
|
|
302
|
+
return '10.10.' + version.minor;
|
|
303
|
+
if (version.major === 13)
|
|
304
|
+
return '10.9.' + version.minor;
|
|
305
|
+
if (version.major >= 5 && version.major <= 12)
|
|
306
|
+
return '10.' + (version.major - 4) + '.' + version.minor;
|
|
307
|
+
return defaultValue;
|
|
308
|
+
}
|
|
309
|
+
function resolveSemanticAndroidVersion(version, defaultValue) {
|
|
310
|
+
if (version.major >= 36)
|
|
311
|
+
return '16';
|
|
312
|
+
if (version.major === 35)
|
|
313
|
+
return '15';
|
|
314
|
+
if (version.major === 34)
|
|
315
|
+
return '14';
|
|
316
|
+
if (version.major === 33)
|
|
317
|
+
return '13';
|
|
318
|
+
if (version.major === 32)
|
|
319
|
+
return '12.1';
|
|
320
|
+
if (version.major === 31)
|
|
321
|
+
return '12';
|
|
322
|
+
if (version.major === 30)
|
|
323
|
+
return '11';
|
|
324
|
+
if (version.major === 29)
|
|
325
|
+
return '10';
|
|
326
|
+
if (version.major === 28)
|
|
327
|
+
return '9';
|
|
328
|
+
if (version.major === 27)
|
|
329
|
+
return '8.1';
|
|
330
|
+
if (version.major === 26)
|
|
331
|
+
return '8.0';
|
|
332
|
+
if (version.major === 25)
|
|
333
|
+
return '7.1';
|
|
334
|
+
if (version.major === 24)
|
|
335
|
+
return '7.0';
|
|
336
|
+
if (version.major === 23)
|
|
337
|
+
return '6.0';
|
|
338
|
+
if (version.major === 22)
|
|
339
|
+
return '5.1';
|
|
340
|
+
if (version.major === 21)
|
|
341
|
+
return '5.0';
|
|
342
|
+
if (version.major === 20)
|
|
343
|
+
return '4.4W';
|
|
344
|
+
if (version.major === 19)
|
|
345
|
+
return '4.4';
|
|
346
|
+
if (version.major === 18)
|
|
347
|
+
return '4.3';
|
|
348
|
+
if (version.major === 17)
|
|
349
|
+
return '4.2';
|
|
350
|
+
if (version.major === 16)
|
|
351
|
+
return '4.1';
|
|
352
|
+
if (version.major === 15)
|
|
353
|
+
return '4.0.3';
|
|
354
|
+
if (version.major === 14)
|
|
355
|
+
return '4.0';
|
|
356
|
+
if (version.major === 13)
|
|
357
|
+
return '3.2';
|
|
358
|
+
if (version.major === 12)
|
|
359
|
+
return '3.1';
|
|
360
|
+
if (version.major === 11)
|
|
361
|
+
return '3.0';
|
|
362
|
+
if (version.major === 10)
|
|
363
|
+
return '2.3.3';
|
|
364
|
+
if (version.major === 9)
|
|
365
|
+
return '2.3';
|
|
366
|
+
if (version.major === 8)
|
|
367
|
+
return '2.2';
|
|
368
|
+
if (version.major === 7)
|
|
369
|
+
return '2.1';
|
|
370
|
+
if (version.major === 6)
|
|
371
|
+
return '2.0.1';
|
|
372
|
+
if (version.major === 5)
|
|
373
|
+
return '2.0';
|
|
374
|
+
if (version.major === 4)
|
|
375
|
+
return '1.6';
|
|
376
|
+
if (version.major === 3)
|
|
377
|
+
return '1.5';
|
|
378
|
+
if (version.major === 2)
|
|
379
|
+
return '1.1';
|
|
380
|
+
if (version.major === 1)
|
|
381
|
+
return '1.0';
|
|
382
|
+
return defaultValue;
|
|
383
|
+
}
|
|
250
384
|
function resolveVersion(string, resolver) {
|
|
251
385
|
if (typeof resolver === 'function')
|
|
252
386
|
return resolver(string);
|
|
@@ -263,11 +397,6 @@
|
|
|
263
397
|
return { brand: entry, version: '' };
|
|
264
398
|
return { brand: entry.brand, version: entry.version };
|
|
265
399
|
}
|
|
266
|
-
function getUserAgent() {
|
|
267
|
-
if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string')
|
|
268
|
-
return navigator.userAgent;
|
|
269
|
-
return '';
|
|
270
|
-
}
|
|
271
400
|
function getRenderer() {
|
|
272
401
|
if (typeof globalThis.document === 'undefined')
|
|
273
402
|
return '';
|
|
@@ -298,10 +427,7 @@
|
|
|
298
427
|
function getIsWebview() {
|
|
299
428
|
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
300
429
|
}
|
|
301
|
-
function
|
|
302
|
-
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
|
|
303
|
-
}
|
|
304
|
-
function getNodeOSVersion(string) {
|
|
430
|
+
function getSemanticVersion(string) {
|
|
305
431
|
var parts = string.split('.');
|
|
306
432
|
return {
|
|
307
433
|
major: parseInt(parts[0] || '0'),
|
|
@@ -349,95 +475,49 @@
|
|
|
349
475
|
break;
|
|
350
476
|
}
|
|
351
477
|
}
|
|
352
|
-
if (
|
|
478
|
+
if (Platform.isReactNative) {
|
|
353
479
|
try {
|
|
354
480
|
var reactNative = require('react-native');
|
|
355
481
|
var platform = reactNative.Platform;
|
|
356
482
|
var os = platform.OS;
|
|
483
|
+
var release = '' + platform.Version;
|
|
484
|
+
var version = getSemanticVersion(release);
|
|
357
485
|
switch (os) {
|
|
358
486
|
case 'android':
|
|
359
487
|
Platform.os = OS.Android;
|
|
488
|
+
Platform.osVersion = resolveSemanticAndroidVersion(version, release);
|
|
360
489
|
break;
|
|
361
490
|
case 'ios':
|
|
362
491
|
Platform.os = OS.iOS;
|
|
492
|
+
Platform.osVersion = release;
|
|
363
493
|
break;
|
|
364
494
|
case 'windows':
|
|
365
495
|
Platform.os = OS.Windows;
|
|
496
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
366
497
|
break;
|
|
367
498
|
case 'macos':
|
|
368
499
|
Platform.os = OS.MacOS;
|
|
500
|
+
Platform.osVersion = release;
|
|
369
501
|
break;
|
|
370
502
|
}
|
|
371
503
|
}
|
|
372
504
|
catch (_) {
|
|
373
505
|
}
|
|
374
506
|
}
|
|
375
|
-
|
|
507
|
+
if (Platform.isNodeJS) {
|
|
376
508
|
try {
|
|
377
509
|
var os = require('os');
|
|
378
510
|
var platform = os.platform();
|
|
379
511
|
var release = os.release();
|
|
380
|
-
var version =
|
|
512
|
+
var version = getSemanticVersion(release);
|
|
381
513
|
switch (platform) {
|
|
382
514
|
case 'win32':
|
|
383
515
|
Platform.os = OS.Windows;
|
|
384
|
-
|
|
385
|
-
Platform.osVersion = '11';
|
|
386
|
-
else if (version.major === 10 && version.minor === 0 && version.build < 22000)
|
|
387
|
-
Platform.osVersion = '10';
|
|
388
|
-
else if (version.major === 6 && version.minor === 3)
|
|
389
|
-
Platform.osVersion = '8.1';
|
|
390
|
-
else if (version.major === 6 && version.minor === 2)
|
|
391
|
-
Platform.osVersion = '8';
|
|
392
|
-
else if (version.major === 6 && version.minor === 1)
|
|
393
|
-
Platform.osVersion = '7';
|
|
394
|
-
else if (version.major === 6 && version.minor === 0)
|
|
395
|
-
Platform.osVersion = 'Vista';
|
|
396
|
-
else if (version.major === 5 && version.minor === 1)
|
|
397
|
-
Platform.osVersion = 'XP';
|
|
398
|
-
else if (version.major === 5 && version.minor === 2)
|
|
399
|
-
Platform.osVersion = 'XP';
|
|
400
|
-
else if (version.major === 5 && version.minor === 0)
|
|
401
|
-
Platform.osVersion = '2000';
|
|
402
|
-
else if (version.major === 4 && version.minor === 90)
|
|
403
|
-
Platform.osVersion = 'ME';
|
|
404
|
-
else if (version.major === 4 && version.minor === 0)
|
|
405
|
-
Platform.osVersion = 'NT 4.0';
|
|
406
|
-
else if (version.major === 3 && version.minor === 51)
|
|
407
|
-
Platform.osVersion = 'NT 3.11';
|
|
408
|
-
else
|
|
409
|
-
Platform.osVersion = release;
|
|
516
|
+
Platform.osVersion = resolveSemanticWindowsVersion(version, release);
|
|
410
517
|
break;
|
|
411
518
|
case 'darwin':
|
|
412
519
|
Platform.os = OS.MacOS;
|
|
413
|
-
|
|
414
|
-
Platform.osVersion = '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
|
|
415
|
-
else if (version.major === 23)
|
|
416
|
-
Platform.osVersion = '14.' + version.minor + '.' + version.build;
|
|
417
|
-
else if (version.major === 22)
|
|
418
|
-
Platform.osVersion = '13.' + version.minor + '.' + version.build;
|
|
419
|
-
else if (version.major === 21)
|
|
420
|
-
Platform.osVersion = '12.' + version.minor + '.' + version.build;
|
|
421
|
-
else if (version.major === 20)
|
|
422
|
-
Platform.osVersion = '11.' + version.minor + '.' + version.build;
|
|
423
|
-
else if (version.major === 19)
|
|
424
|
-
Platform.osVersion = '10.15.' + version.minor;
|
|
425
|
-
else if (version.major === 18)
|
|
426
|
-
Platform.osVersion = '10.14.' + version.minor;
|
|
427
|
-
else if (version.major === 17)
|
|
428
|
-
Platform.osVersion = '10.13.' + version.minor;
|
|
429
|
-
else if (version.major === 16)
|
|
430
|
-
Platform.osVersion = '10.12.' + version.minor;
|
|
431
|
-
else if (version.major === 15)
|
|
432
|
-
Platform.osVersion = '10.11.' + version.minor;
|
|
433
|
-
else if (version.major === 14)
|
|
434
|
-
Platform.osVersion = '10.10.' + version.minor;
|
|
435
|
-
else if (version.major === 13)
|
|
436
|
-
Platform.osVersion = '10.9.' + version.minor;
|
|
437
|
-
else if (version.major >= 5 && version.major <= 12)
|
|
438
|
-
Platform.osVersion = '10.' + (version.major - 4) + '.' + version.minor;
|
|
439
|
-
else
|
|
440
|
-
Platform.osVersion = release;
|
|
520
|
+
Platform.osVersion = resolveSemanticDarwinVersion(version, release);
|
|
441
521
|
break;
|
|
442
522
|
case 'android':
|
|
443
523
|
Platform.os = OS.Android;
|
package/dist/native.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).Native=o()}(this,(function(){"use strict";var e="1.0.47";function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];for(var r=Object(e[0]),i=1;i<e.length;i++){var n=e[i];if(null!=n)for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&(r[t]=n[t])}return r}var r,i,n,t,a=function(e,o){function r(i){if(!(this instanceof r))return new r(i);var n=new o(i||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(n,r.prototype):n.__proto__=r.prototype,n.name=e,void 0!==i&&(n.message=i),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(n,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(n,r);else if(o.captureStackTrace&&"function"==typeof o.captureStackTrace)o.captureStackTrace(n,r);else try{var t=new o;t.stack&&(n.stack=t.stack)}catch(e){}return n}void 0===o&&(o=Error),r.prototype=Object.create(o.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(r.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(o){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}("PluginNotExtendedError");!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(r||(r={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(t||(t={}));var s,d={device:i.Unknown,os:r.Unknown,osVersion:"",engine:n.Unknown,engineVersion:"",browser:t.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var o=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===o)return"";if(o instanceof WebGLRenderingContext||"getParameter"in o&&"function"==typeof o.getParameter){var r=o.getExtension("WEBGL_debug_renderer_info");return null===r?o.getParameter(o.RENDERER):o.getParameter(r.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"",isWebview:!1,isMobile:!1,isDesktop:!1,isStandalone:!1,isNodeJS:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node},l=[[/windows nt (6\.[23]); arm/i,r.Windows,f],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,r.Windows,f],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,r.Windows,f],[/windows nt ?([\d.)]*)(?!.+xbox)/i,r.Windows,f],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,r.Windows,f],[/windows ce\/?([\d.]*)/i,r.Windows,f],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,r.iOS,b],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,r.iOS,b],[/cfnetwork\/.+darwin/i,r.iOS,b],[/mac os x ?([\w. ]*)/i,r.MacOS,b],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,r.MacOS,b],[/droid ([\w.]+)\b.+(android[- ]x86)/i,r.Android],[/android\w*[-\/.; ]?([\d.]*)/i,r.Android]],c=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],m=[[/\b(?:crmo|crios)\/([\w.]+)/i,t.Chrome],[/webview.+edge\/([\w.]+)/i,t.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,t.Edge],[/opera mini\/([-\w.]+)/i,t.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,t.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,t.Opera],[/opios[\/ ]+([\w.]+)/i,t.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,t.Opera],[/\bopr\/([\w.]+)/i,t.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,t.IE],[/(?:ms|\()ie ([\w.]+)/i,t.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,t.IE],[/\bfocus\/([\w.]+)/i,t.Firefox],[/\bopt\/([\w.]+)/i,t.Opera],[/coast\/([\w.]+)/i,t.Opera],[/fxios\/([\w.-]+)/i,t.Firefox],[/samsungbrowser\/([\w.]+)/i,t.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,t.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,t.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,t.Chrome],[/chrome\/([\w.]+) mobile/i,t.Chrome],[/chrome\/v?([\w.]+)/i,t.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/version\/([\w.,]+) .*safari/i,t.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,t.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,t.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,t.Firefox],[/firefox\/([\w.]+)/i,t.Firefox]];function f(e){if(void 0===e)return"";var o={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==o?o:e}function b(e){return void 0===e?"":e.replace(/_/g,".")}function w(e,o){return"function"==typeof o?o(e):"string"==typeof o?o:void 0===e?"":e}for(var u=0;u<l.length;u++){var p=(k=l[u])[0],g=k[1],v=k[2];if(null!==(y=d.userAgent.match(p))){d.os=g,d.osVersion=w(y[1],v),g===r.iOS||g===r.Android?d.device=i.Mobile:g!==r.Windows&&g!==r.MacOS||(d.device=i.Desktop);break}}for(u=0;u<c.length;u++){p=(k=c[u])[0];var h=k[1];v=k[2];if(null!==(y=d.userAgent.match(p))){d.engine=h,d.engineVersion=w(y[1],v);break}}for(u=0;u<m.length;u++){p=(k=m[u])[0];var k,y,T=k[1];v=k[2];if(null!==(y=d.userAgent.match(p))){d.browser=T,d.browserVersion=w(y[1],v);break}}if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)try{switch(g=(j=require("react-native").Platform).OS){case"android":d.os=r.Android;break;case"ios":d.os=r.iOS;break;case"windows":d.os=r.Windows;break;case"macos":d.os=r.MacOS}}catch(e){}else if(d.isNodeJS)try{var j=(g=require("os")).platform(),O=g.release(),S=(s=O.split("."),{major:parseInt(s[0]||"0"),minor:parseInt(s[1]||"0"),build:parseInt(s[2]||"0")});switch(j){case"win32":d.os=r.Windows,d.osVersion=10===S.major&&0===S.minor&&S.build>=22e3?"11":10===S.major&&0===S.minor&&S.build<22e3?"10":6===S.major&&3===S.minor?"8.1":6===S.major&&2===S.minor?"8":6===S.major&&1===S.minor?"7":6===S.major&&0===S.minor?"Vista":5===S.major&&1===S.minor||5===S.major&&2===S.minor?"XP":5===S.major&&0===S.minor?"2000":4===S.major&&90===S.minor?"ME":4===S.major&&0===S.minor?"NT 4.0":3===S.major&&51===S.minor?"NT 3.11":O;break;case"darwin":d.os=r.MacOS,d.osVersion=S.major>=24?S.major-9+"."+S.minor+"."+S.build:23===S.major?"14."+S.minor+"."+S.build:22===S.major?"13."+S.minor+"."+S.build:21===S.major?"12."+S.minor+"."+S.build:20===S.major?"11."+S.minor+"."+S.build:19===S.major?"10.15."+S.minor:18===S.major?"10.14."+S.minor:17===S.major?"10.13."+S.minor:16===S.major?"10.12."+S.minor:15===S.major?"10.11."+S.minor:14===S.major?"10.10."+S.minor:13===S.major?"10.9."+S.minor:S.major>=5&&S.major<=12?"10."+(S.major-4)+"."+S.minor:O;break;case"android":d.os=r.Android,d.osVersion=O;break;case"linux":/android/i.test(O)&&(d.os=r.Android,d.osVersion=O)}}catch(e){}void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var o,i=e.fullVersionList||e.brands||[],n=e.platformVersion,t=0;t<i.length;t++){var a=null==(o=i[t])?{brand:"",version:""}:"string"==typeof o?{brand:o,version:""}:{brand:o.brand,version:o.version},s=a.brand,l=a.version;/not.a.brand/i.test(s)||"Chromium"===s&&(d.engineVersion=l)}"string"==typeof n&&(d.os===r.Windows&&parseInt(n.replace(/[^\d.]/g,"").split(".")[0],10)>=13?d.osVersion="11":d.osVersion=n)})),d.isMobile=d.device===i.Mobile,d.isDesktop=d.device===i.Desktop,d.isWebview=/; ?wv|applewebkit(?!.*safari)/i.test(d.userAgent),d.isStandalone=function(e){return"matchMedia"in globalThis&&(e===r.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(d.os),function(){if("object"!=typeof globalThis){Object.defineProperty(Object.prototype,"__getGlobalThis__",{get:function(){return this},configurable:!0});try{var e=__getGlobalThis__;Object.defineProperty(e,"globalThis",{value:e,writable:!0,configurable:!0})}finally{delete Object.prototype.__getGlobalThis__}}}();var E=new Proxy({Version:e,Constants:{},Errors:{PluginNotExtendedError:a},extends:function(e){return e.installed||(this.Constants=o(this.Constants,e.Constants),this.Errors=o(this.Errors,e.Errors),this[e.name]=e.module,e.installed=!0),this}},{get:function(e,o,r){if(o in e)return Reflect.get(e,o,r);throw new a(o.toString()+" is not extended yet. Call Native.extends(plugin) first.")}}),x={installed:!1,name:"Platform",module:d,Constants:{OS:r,Devices:i,Engines:n,Browsers:t},Errors:{}};return E.extends(x),E}));
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).Native=o()}(this,(function(){"use strict";var e="1.0.49";function o(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];for(var r=Object(e[0]),i=1;i<e.length;i++){var n=e[i];if(null!=n)for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&(r[t]=n[t])}return r}var r,i,n,t,a=function(e,o){function r(i){if(!(this instanceof r))return new r(i);var n=new o(i||"");if("function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(n,r.prototype):n.__proto__=r.prototype,n.name=e,void 0!==i&&(n.message=i),"undefined"!=typeof Symbol&&Symbol.toStringTag)try{Object.defineProperty(n,Symbol.toStringTag,{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}if("function"==typeof Error.captureStackTrace)Error.captureStackTrace(n,r);else if(o.captureStackTrace&&"function"==typeof o.captureStackTrace)o.captureStackTrace(n,r);else try{var t=new o;t.stack&&(n.stack=t.stack)}catch(e){}return n}void 0===o&&(o=Error),r.prototype=Object.create(o.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0}});try{Object.defineProperty(r.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0})}catch(o){try{r.prototype.name=e}catch(e){}}try{Object.defineProperty(r,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}catch(e){}return r}("PluginNotExtendedError");!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(r||(r={})),function(e){e.Unknown="Unknown",e.Mobile="Mobile",e.Desktop="Desktop"}(i||(i={})),function(e){e.Unknown="Unknown",e.EdgeHTML="EdgeHTML",e.ArkWeb="ArkWeb",e.Blink="Blink",e.Presto="Presto",e.WebKit="WebKit",e.Trident="Trident",e.NetFront="NetFront",e.KHTML="KHTML",e.Tasman="Tasman",e.Gecko="Gecko"}(n||(n={})),function(e){e.Unknown="Unknown",e.Chrome="Chrome",e.Safari="Safari",e.Edge="Edge",e.Firefox="Firefox",e.Opera="Opera",e.IE="IE",e.SamsungInternet="SamsungInternet"}(t||(t={}));var s="undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"",m={device:i.Unknown,os:r.Unknown,osVersion:"",engine:n.Unknown,engineVersion:"",browser:t.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var o=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===o)return"";if(o instanceof WebGLRenderingContext||"getParameter"in o&&"function"==typeof o.getParameter){var r=o.getExtension("WEBGL_debug_renderer_info");return null===r?o.getParameter(o.RENDERER):o.getParameter(r.UNMASKED_RENDERER_WEBGL)}return""}(),userAgent:s,isMobile:!1,isDesktop:!1,isStandalone:!1,isWebview:/; ?wv|applewebkit(?!.*safari)/i.test(s),isNodeJS:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.node,isElectron:void 0!==globalThis.process&&void 0!==globalThis.process.versions&&void 0!==globalThis.process.versions.electron,isReactNative:"undefined"!=typeof navigator&&"ReactNative"===navigator.product},d=[[/windows nt (6\.[23]); arm/i,r.Windows,f],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,r.Windows,f],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,r.Windows,f],[/windows nt ?([\d.)]*)(?!.+xbox)/i,r.Windows,f],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,r.Windows,f],[/windows ce\/?([\d.]*)/i,r.Windows,f],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,r.iOS,b],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,r.iOS,b],[/cfnetwork\/.+darwin/i,r.iOS,b],[/mac os x ?([\w. ]*)/i,r.MacOS,b],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,r.MacOS,b],[/droid ([\w.]+)\b.+(android[- ]x86)/i,r.Android],[/android\w*[-\/.; ]?([\d.]*)/i,r.Android]],l=[[/windows.+ edge\/([\w.]+)/i,n.EdgeHTML],[/arkweb\/([\w.]+)/i,n.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,n.Blink],[/presto\/([\w.]+)/i,n.Presto],[/webkit\/([\w.]+)/i,n.WebKit],[/trident\/([\w.]+)/i,n.Trident],[/netfront\/([\w.]+)/i,n.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,n.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,n.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,n.Gecko]],c=[[/\b(?:crmo|crios)\/([\w.]+)/i,t.Chrome],[/webview.+edge\/([\w.]+)/i,t.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,t.Edge],[/opera mini\/([-\w.]+)/i,t.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,t.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,t.Opera],[/opios[\/ ]+([\w.]+)/i,t.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,t.Opera],[/\bopr\/([\w.]+)/i,t.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,t.IE],[/(?:ms|\()ie ([\w.]+)/i,t.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,t.IE],[/\bfocus\/([\w.]+)/i,t.Firefox],[/\bopt\/([\w.]+)/i,t.Opera],[/coast\/([\w.]+)/i,t.Opera],[/fxios\/([\w.-]+)/i,t.Firefox],[/samsungbrowser\/([\w.]+)/i,t.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,t.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,t.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,t.Chrome],[/chrome\/([\w.]+) mobile/i,t.Chrome],[/chrome\/v?([\w.]+)/i,t.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,t.Safari],[/version\/([\w.,]+) .*safari/i,t.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,t.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,t.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,t.Firefox],[/firefox\/([\w.]+)/i,t.Firefox]];function f(e){if(void 0===e)return"";var o={"4.90":"ME","NT3.51":"NT 3.11","NT4.0":"NT 4.0","NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"XP","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 6.4":"10","NT 10.0":"10",ARM:"RT"}[e];return void 0!==o?o:e}function b(e){return void 0===e?"":e.replace(/_/g,".")}function u(e,o){return 10===e.major&&0===e.minor&&e.build>=22e3?"11":10===e.major&&0===e.minor&&e.build<22e3?"10":6===e.major&&3===e.minor?"8.1":6===e.major&&2===e.minor?"8":6===e.major&&1===e.minor?"7":6===e.major&&0===e.minor?"Vista":5===e.major&&1===e.minor||5===e.major&&2===e.minor?"XP":5===e.major&&0===e.minor?"2000":4===e.major&&90===e.minor?"ME":4===e.major&&0===e.minor?"NT 4.0":3===e.major&&51===e.minor?"NT 3.11":o}function w(e,o){return"function"==typeof o?o(e):"string"==typeof o?o:void 0===e?"":e}function p(e){var o=e.split(".");return{major:parseInt(o[0]||"0"),minor:parseInt(o[1]||"0"),build:parseInt(o[2]||"0")}}for(var g=0;g<d.length;g++){var v=(y=d[g])[0],j=y[1],h=y[2];if(null!==(T=m.userAgent.match(v))){m.os=j,m.osVersion=w(T[1],h),j===r.iOS||j===r.Android?m.device=i.Mobile:j!==r.Windows&&j!==r.MacOS||(m.device=i.Desktop);break}}for(g=0;g<l.length;g++){v=(y=l[g])[0];var k=y[1];h=y[2];if(null!==(T=m.userAgent.match(v))){m.engine=k,m.engineVersion=w(T[1],h);break}}for(g=0;g<c.length;g++){v=(y=c[g])[0];var y,T,E=y[1];h=y[2];if(null!==(T=m.userAgent.match(v))){m.browser=E,m.browserVersion=w(T[1],h);break}}if(m.isReactNative)try{j=(x=require("react-native").Platform).OS;var O=p(S=""+x.Version);switch(j){case"android":m.os=r.Android,m.osVersion=function(e,o){return e.major>=36?"16":35===e.major?"15":34===e.major?"14":33===e.major?"13":32===e.major?"12.1":31===e.major?"12":30===e.major?"11":29===e.major?"10":28===e.major?"9":27===e.major?"8.1":26===e.major?"8.0":25===e.major?"7.1":24===e.major?"7.0":23===e.major?"6.0":22===e.major?"5.1":21===e.major?"5.0":20===e.major?"4.4W":19===e.major?"4.4":18===e.major?"4.3":17===e.major?"4.2":16===e.major?"4.1":15===e.major?"4.0.3":14===e.major?"4.0":13===e.major?"3.2":12===e.major?"3.1":11===e.major?"3.0":10===e.major?"2.3.3":9===e.major?"2.3":8===e.major?"2.2":7===e.major?"2.1":6===e.major?"2.0.1":5===e.major?"2.0":4===e.major?"1.6":3===e.major?"1.5":2===e.major?"1.1":1===e.major?"1.0":o}(O,S);break;case"ios":m.os=r.iOS,m.osVersion=S;break;case"windows":m.os=r.Windows,m.osVersion=u(O,S);break;case"macos":m.os=r.MacOS,m.osVersion=S}}catch(e){}if(m.isNodeJS)try{var S,x=(j=require("os")).platform();O=p(S=j.release());switch(x){case"win32":m.os=r.Windows,m.osVersion=u(O,S);break;case"darwin":m.os=r.MacOS,m.osVersion=function(e,o){return e.major>=24?e.major-9+"."+e.minor+"."+e.build:23===e.major?"14."+e.minor+"."+e.build:22===e.major?"13."+e.minor+"."+e.build:21===e.major?"12."+e.minor+"."+e.build:20===e.major?"11."+e.minor+"."+e.build:19===e.major?"10.15."+e.minor:18===e.major?"10.14."+e.minor:17===e.major?"10.13."+e.minor:16===e.major?"10.12."+e.minor:15===e.major?"10.11."+e.minor:14===e.major?"10.10."+e.minor:13===e.major?"10.9."+e.minor:e.major>=5&&e.major<=12?"10."+(e.major-4)+"."+e.minor:o}(O,S);break;case"android":m.os=r.Android,m.osVersion=S;break;case"linux":/android/i.test(S)&&(m.os=r.Android,m.osVersion=S)}}catch(e){}void 0!==navigator.userAgentData&&void 0!==navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["brands","fullVersionList","mobile","model","platform","platformVersion","architecture","formFactors","bitness","uaFullVersion","wow64"]).then((function(e){for(var o,i=e.fullVersionList||e.brands||[],n=e.platformVersion,t=0;t<i.length;t++){var a=null==(o=i[t])?{brand:"",version:""}:"string"==typeof o?{brand:o,version:""}:{brand:o.brand,version:o.version},s=a.brand,d=a.version;/not.a.brand/i.test(s)||"Chromium"===s&&(m.engineVersion=d)}"string"==typeof n&&(m.os===r.Windows&&parseInt(n.replace(/[^\d.]/g,"").split(".")[0],10)>=13?m.osVersion="11":m.osVersion=n)})),m.isMobile=m.device===i.Mobile,m.isDesktop=m.device===i.Desktop,m.isWebview=/; ?wv|applewebkit(?!.*safari)/i.test(m.userAgent),m.isStandalone=function(e){return"matchMedia"in globalThis&&(e===r.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(m.os),function(){if("object"!=typeof globalThis){Object.defineProperty(Object.prototype,"__getGlobalThis__",{get:function(){return this},configurable:!0});try{var e=__getGlobalThis__;Object.defineProperty(e,"globalThis",{value:e,writable:!0,configurable:!0})}finally{delete Object.prototype.__getGlobalThis__}}}();var N=new Proxy({Version:e,Constants:{},Errors:{PluginNotExtendedError:a},extends:function(e){return e.installed||(this.Constants=o(this.Constants,e.Constants),this.Errors=o(this.Errors,e.Errors),this[e.name]=e.module,e.installed=!0),this}},{get:function(e,o,r){if(o in e)return Reflect.get(e,o,r);throw new a(o.toString()+" is not extended yet. Call Native.extends(plugin) first.")}}),V={installed:!1,name:"Platform",module:m,Constants:{OS:r,Devices:i,Engines:n,Browsers:t},Errors:{}};return N.extends(V),N}));
|