native-fn 1.0.82 → 1.0.84

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.
Files changed (141) hide show
  1. package/dist/index.d.ts +8 -1
  2. package/dist/native.cjs +4 -10
  3. package/dist/native.min.cjs +1 -1
  4. package/dist/native.min.mjs +1 -1
  5. package/dist/native.mjs +4 -10
  6. package/dist/native.umd.js +4 -10
  7. package/dist/native.umd.min.js +1 -1
  8. package/dist/plugin/app/index.cjs +160 -270
  9. package/dist/plugin/app/index.min.cjs +1 -1
  10. package/dist/plugin/app/index.min.mjs +1 -1
  11. package/dist/plugin/app/index.mjs +160 -270
  12. package/dist/plugin/app/index.umd.js +160 -270
  13. package/dist/plugin/app/index.umd.min.js +1 -1
  14. package/dist/plugin/app/src/plugin/appearance/constants/index.d.ts +2 -2
  15. package/dist/plugin/app/src/plugin/appearance/types/appearance.d.ts +0 -6
  16. package/dist/plugin/app/src/plugin/dimension/constants/index.d.ts +4 -0
  17. package/dist/plugin/app/src/plugin/dimension/types/dimension.d.ts +9 -6
  18. package/dist/plugin/app/src/plugin/dimension/types/dimensions.d.ts +11 -0
  19. package/dist/plugin/app/src/plugin/dimension/types/index.d.ts +2 -2
  20. package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +1 -0
  21. package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +0 -10
  22. package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +3 -19
  23. package/dist/plugin/app/src/types/listener-entry.d.ts +6 -0
  24. package/dist/plugin/app/src/utils/request.d.ts +1 -0
  25. package/dist/plugin/appearance/index.cjs +111 -223
  26. package/dist/plugin/appearance/index.d.ts +1 -7
  27. package/dist/plugin/appearance/index.min.cjs +1 -1
  28. package/dist/plugin/appearance/index.min.mjs +1 -1
  29. package/dist/plugin/appearance/index.mjs +111 -223
  30. package/dist/plugin/appearance/index.umd.js +111 -223
  31. package/dist/plugin/appearance/index.umd.min.js +1 -1
  32. package/dist/plugin/appearance/src/plugin/appearance/constants/index.d.ts +2 -2
  33. package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +0 -6
  34. package/dist/plugin/appearance/src/plugin/dimension/constants/index.d.ts +4 -0
  35. package/dist/plugin/appearance/src/plugin/dimension/types/dimension.d.ts +9 -6
  36. package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +11 -0
  37. package/dist/plugin/appearance/src/plugin/dimension/types/index.d.ts +2 -2
  38. package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +1 -0
  39. package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +0 -10
  40. package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +3 -19
  41. package/dist/plugin/appearance/src/types/listener-entry.d.ts +6 -0
  42. package/dist/plugin/appearance/src/utils/request.d.ts +1 -0
  43. package/dist/plugin/clipboard/index.cjs +61 -214
  44. package/dist/plugin/clipboard/index.min.cjs +1 -1
  45. package/dist/plugin/clipboard/index.min.mjs +1 -1
  46. package/dist/plugin/clipboard/index.mjs +61 -214
  47. package/dist/plugin/clipboard/index.umd.js +61 -214
  48. package/dist/plugin/clipboard/index.umd.min.js +1 -1
  49. package/dist/plugin/clipboard/src/plugin/appearance/constants/index.d.ts +2 -2
  50. package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +0 -6
  51. package/dist/plugin/clipboard/src/plugin/dimension/constants/index.d.ts +4 -0
  52. package/dist/plugin/clipboard/src/plugin/dimension/types/dimension.d.ts +9 -6
  53. package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +11 -0
  54. package/dist/plugin/clipboard/src/plugin/dimension/types/index.d.ts +2 -2
  55. package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +1 -0
  56. package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +0 -10
  57. package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +3 -19
  58. package/dist/plugin/clipboard/src/types/listener-entry.d.ts +6 -0
  59. package/dist/plugin/clipboard/src/utils/request.d.ts +1 -0
  60. package/dist/plugin/dimension/index.cjs +981 -1
  61. package/dist/plugin/dimension/index.d.ts +9 -0
  62. package/dist/plugin/dimension/index.min.cjs +1 -1
  63. package/dist/plugin/dimension/index.min.mjs +1 -1
  64. package/dist/plugin/dimension/index.mjs +981 -1
  65. package/dist/plugin/dimension/index.umd.js +981 -1
  66. package/dist/plugin/dimension/index.umd.min.js +1 -1
  67. package/dist/plugin/dimension/src/plugin/appearance/constants/index.d.ts +2 -2
  68. package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +0 -6
  69. package/dist/plugin/dimension/src/plugin/dimension/constants/index.d.ts +4 -0
  70. package/dist/plugin/dimension/src/plugin/dimension/types/dimension.d.ts +9 -6
  71. package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +11 -0
  72. package/dist/plugin/dimension/src/plugin/dimension/types/index.d.ts +2 -2
  73. package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +1 -0
  74. package/dist/plugin/dimension/src/plugin/platform/cores/index.d.ts +0 -10
  75. package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +3 -19
  76. package/dist/plugin/dimension/src/types/listener-entry.d.ts +6 -0
  77. package/dist/plugin/dimension/src/utils/request.d.ts +1 -0
  78. package/dist/plugin/fullscreen/index.cjs +54 -207
  79. package/dist/plugin/fullscreen/index.min.cjs +1 -1
  80. package/dist/plugin/fullscreen/index.min.mjs +1 -1
  81. package/dist/plugin/fullscreen/index.mjs +54 -207
  82. package/dist/plugin/fullscreen/index.umd.js +54 -207
  83. package/dist/plugin/fullscreen/index.umd.min.js +1 -1
  84. package/dist/plugin/fullscreen/src/plugin/appearance/constants/index.d.ts +2 -2
  85. package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +0 -6
  86. package/dist/plugin/fullscreen/src/plugin/dimension/constants/index.d.ts +4 -0
  87. package/dist/plugin/fullscreen/src/plugin/dimension/types/dimension.d.ts +9 -6
  88. package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +11 -0
  89. package/dist/plugin/fullscreen/src/plugin/dimension/types/index.d.ts +2 -2
  90. package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +1 -0
  91. package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +0 -10
  92. package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +3 -19
  93. package/dist/plugin/fullscreen/src/types/listener-entry.d.ts +6 -0
  94. package/dist/plugin/fullscreen/src/utils/request.d.ts +1 -0
  95. package/dist/plugin/platform/index.cjs +50 -203
  96. package/dist/plugin/platform/index.d.ts +4 -20
  97. package/dist/plugin/platform/index.min.cjs +1 -1
  98. package/dist/plugin/platform/index.min.mjs +1 -1
  99. package/dist/plugin/platform/index.mjs +50 -203
  100. package/dist/plugin/platform/index.umd.js +50 -203
  101. package/dist/plugin/platform/index.umd.min.js +1 -1
  102. package/dist/plugin/platform/src/plugin/appearance/constants/index.d.ts +2 -2
  103. package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +0 -6
  104. package/dist/plugin/platform/src/plugin/dimension/constants/index.d.ts +4 -0
  105. package/dist/plugin/platform/src/plugin/dimension/types/dimension.d.ts +9 -6
  106. package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +11 -0
  107. package/dist/plugin/platform/src/plugin/dimension/types/index.d.ts +2 -2
  108. package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +1 -0
  109. package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +0 -10
  110. package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +3 -19
  111. package/dist/plugin/platform/src/types/listener-entry.d.ts +6 -0
  112. package/dist/plugin/platform/src/utils/request.d.ts +1 -0
  113. package/dist/plugin/theme/index.cjs +51 -204
  114. package/dist/plugin/theme/index.min.cjs +1 -1
  115. package/dist/plugin/theme/index.min.mjs +1 -1
  116. package/dist/plugin/theme/index.mjs +51 -204
  117. package/dist/plugin/theme/index.umd.js +51 -204
  118. package/dist/plugin/theme/index.umd.min.js +1 -1
  119. package/dist/plugin/theme/src/plugin/appearance/constants/index.d.ts +2 -2
  120. package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +0 -6
  121. package/dist/plugin/theme/src/plugin/dimension/constants/index.d.ts +4 -0
  122. package/dist/plugin/theme/src/plugin/dimension/types/dimension.d.ts +9 -6
  123. package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +11 -0
  124. package/dist/plugin/theme/src/plugin/dimension/types/index.d.ts +2 -2
  125. package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +1 -0
  126. package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +0 -10
  127. package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +3 -19
  128. package/dist/plugin/theme/src/types/listener-entry.d.ts +6 -0
  129. package/dist/plugin/theme/src/utils/request.d.ts +1 -0
  130. package/dist/src/plugin/appearance/constants/index.d.ts +2 -2
  131. package/dist/src/plugin/appearance/types/appearance.d.ts +0 -6
  132. package/dist/src/plugin/dimension/constants/index.d.ts +4 -0
  133. package/dist/src/plugin/dimension/types/dimension.d.ts +9 -6
  134. package/dist/src/plugin/dimension/types/dimensions.d.ts +11 -0
  135. package/dist/src/plugin/dimension/types/index.d.ts +2 -2
  136. package/dist/src/plugin/platform/constants/index.d.ts +1 -0
  137. package/dist/src/plugin/platform/cores/index.d.ts +0 -10
  138. package/dist/src/plugin/platform/types/platform.d.ts +3 -19
  139. package/dist/src/types/listener-entry.d.ts +6 -0
  140. package/dist/src/utils/request.d.ts +1 -0
  141. package/package.json +1 -1
@@ -30,7 +30,7 @@
30
30
  else
31
31
  error.__proto__ = CustomError.prototype;
32
32
  error.name = name;
33
- if (message !== undefined)
33
+ if (typeof message !== 'undefined')
34
34
  error.message = message;
35
35
  if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
36
36
  try {
@@ -213,7 +213,7 @@
213
213
  var result = '';
214
214
  for (var i = 0; i < groups.length - 2; i++) {
215
215
  var arg = groups[i];
216
- if (arg !== undefined)
216
+ if (typeof arg !== 'undefined')
217
217
  result = result + arg.charAt(0).toUpperCase() + arg.slice(1);
218
218
  }
219
219
  return result;
@@ -237,7 +237,7 @@
237
237
  add: function (target, eventListenerOptions) {
238
238
  if (eventListenerOptions === void 0) { eventListenerOptions = { callback: null, options: false }; }
239
239
  var callback = eventListenerOptions.callback;
240
- if (target === undefined || callback === null)
240
+ if (typeof target === 'undefined' || callback === null)
241
241
  return;
242
242
  var type = EventListenerUtils.withVender(target, eventListenerOptions.type);
243
243
  var options = eventListenerOptions.options;
@@ -265,9 +265,9 @@
265
265
  }
266
266
  }
267
267
  function wrapper(event) {
268
- if (event === undefined)
268
+ if (typeof event === 'undefined')
269
269
  event = globalThis.event;
270
- if (event === undefined)
270
+ if (typeof event === 'undefined')
271
271
  return;
272
272
  event.currentTarget = target;
273
273
  if (typeof event.preventDefault !== 'function')
@@ -288,7 +288,7 @@
288
288
  remove: function (target, eventListenerOptions) {
289
289
  if (eventListenerOptions === void 0) { eventListenerOptions = { callback: null, options: false }; }
290
290
  var callback = eventListenerOptions.callback;
291
- if (target === undefined || callback === null)
291
+ if (typeof target === 'undefined' || callback === null)
292
292
  return;
293
293
  var type = EventListenerUtils.withVender(target, eventListenerOptions.type);
294
294
  var options = eventListenerOptions.options;
@@ -317,7 +317,7 @@
317
317
  }
318
318
  if (typeof target.detachEvent === 'function') {
319
319
  var wrapper = callback.__ieWrapper;
320
- if (wrapper !== undefined) {
320
+ if (typeof wrapper !== 'undefined') {
321
321
  target.detachEvent('on' + type, wrapper);
322
322
  delete callback.__ieWrapper;
323
323
  }
@@ -325,7 +325,7 @@
325
325
  }
326
326
  },
327
327
  withVender: function (target, type) {
328
- if (type === undefined)
328
+ if (typeof type === 'undefined')
329
329
  return '';
330
330
  if (target === globalThis.document && ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'].indexOf(type) > -1)
331
331
  return type;
@@ -396,6 +396,14 @@
396
396
  CrossPlatformFramework["Cordova"] = "Cordova";
397
397
  })(CrossPlatformFramework || (CrossPlatformFramework = {}));
398
398
  var USER_AGENT = typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgent === 'string' ? globalThis.navigator.userAgent : '';
399
+ var HIGH_ENTROPY_BRAND_NAME_MAP = {
400
+ 'Google Chrome': 'Chrome',
401
+ 'Microsoft Edge': 'Edge',
402
+ 'Microsoft Edge WebView2': 'Edge WebView2',
403
+ 'Android WebView': 'Chrome WebView',
404
+ 'HeadlessChrome': 'Chrome Headless',
405
+ 'OperaMobile': 'Opera Mobi',
406
+ };
399
407
 
400
408
  var readyState = 'loading';
401
409
  var readyCallback = [];
@@ -409,15 +417,9 @@
409
417
  get readyState() {
410
418
  return readyState;
411
419
  },
412
- get network() {
413
- return getNetwork();
414
- },
415
420
  get locale() {
416
421
  return getLocale();
417
422
  },
418
- get dimension() {
419
- return getDimension();
420
- },
421
423
  get device() {
422
424
  if (this.os.name === OS.iOS || this.os.name === OS.Android)
423
425
  return Devices.Mobile;
@@ -432,7 +434,7 @@
432
434
  return /; ?wv|applewebkit(?!.*safari)/i.test(this.userAgent);
433
435
  },
434
436
  get isNode() {
435
- return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
437
+ return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
436
438
  },
437
439
  get isStandalone() {
438
440
  if (this.os.name === OS.iOS)
@@ -454,6 +456,33 @@
454
456
  }
455
457
  }
456
458
  };
459
+ function resolveWindowsVersion(string) {
460
+ if (typeof string === 'undefined')
461
+ return '';
462
+ var mapped = {
463
+ '4.90': 'ME',
464
+ 'NT3.51': 'NT 3.11',
465
+ 'NT4.0': 'NT 4.0',
466
+ 'NT 5.0': '2000',
467
+ 'NT 5.1': 'XP',
468
+ 'NT 5.2': 'XP',
469
+ 'NT 6.0': 'Vista',
470
+ 'NT 6.1': '7',
471
+ 'NT 6.2': '8',
472
+ 'NT 6.3': '8.1',
473
+ 'NT 6.4': '10',
474
+ 'NT 10.0': '10',
475
+ 'ARM': 'RT'
476
+ }[string];
477
+ if (typeof mapped !== 'undefined')
478
+ return mapped;
479
+ return string;
480
+ }
481
+ function resolveUnderscoreVersion(string) {
482
+ if (typeof string === 'undefined')
483
+ return '';
484
+ return string.replace(/_/g, '.');
485
+ }
457
486
  var OS_RESOLVER_MAP = [
458
487
  [/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
459
488
  [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
@@ -512,14 +541,6 @@
512
541
  [/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
513
542
  [/firefox\/([\w.]+)/i, Browsers.Firefox],
514
543
  ];
515
- var HIGH_ENTROPY_BRAND_NAME_MAP = {
516
- 'Google Chrome': 'Chrome',
517
- 'Microsoft Edge': 'Edge',
518
- 'Microsoft Edge WebView2': 'Edge WebView2',
519
- 'Android WebView': 'Chrome WebView',
520
- 'HeadlessChrome': 'Chrome Headless',
521
- 'OperaMobile': 'Opera Mobi',
522
- };
523
544
  function incrementPendingTasks() {
524
545
  pendingTasks++;
525
546
  }
@@ -540,33 +561,6 @@
540
561
  readyCallback.length = 0;
541
562
  }
542
563
  }
543
- function resolveWindowsVersion(string) {
544
- if (string === undefined)
545
- return '';
546
- var mapped = {
547
- '4.90': 'ME',
548
- 'NT3.51': 'NT 3.11',
549
- 'NT4.0': 'NT 4.0',
550
- 'NT 5.0': '2000',
551
- 'NT 5.1': 'XP',
552
- 'NT 5.2': 'XP',
553
- 'NT 6.0': 'Vista',
554
- 'NT 6.1': '7',
555
- 'NT 6.2': '8',
556
- 'NT 6.3': '8.1',
557
- 'NT 6.4': '10',
558
- 'NT 10.0': '10',
559
- 'ARM': 'RT'
560
- }[string];
561
- if (mapped !== undefined)
562
- return mapped;
563
- return string;
564
- }
565
- function resolveUnderscoreVersion(string) {
566
- if (string === undefined)
567
- return '';
568
- return string.replace(/_/g, '.');
569
- }
570
564
  function resolveSemanticWindowsVersion(version, defaultValue) {
571
565
  if (version.major === 10 && version.minor === 0 && version.build >= 22000)
572
566
  return '11';
@@ -703,12 +697,12 @@
703
697
  return resolver(string);
704
698
  if (typeof resolver === 'string')
705
699
  return resolver;
706
- if (string === undefined)
700
+ if (typeof string === 'undefined')
707
701
  return '';
708
702
  return string;
709
703
  }
710
704
  function normalizeBrand(entry) {
711
- if (entry === null || entry === undefined)
705
+ if (entry === null || typeof entry === 'undefined')
712
706
  return { brand: '', version: '' };
713
707
  if (typeof entry === 'string')
714
708
  return { brand: entry, version: '' };
@@ -762,102 +756,13 @@
762
756
  return '';
763
757
  }
764
758
  }
765
- function getNetwork() {
766
- var network = {
767
- isOnline: null,
768
- effectiveType: null,
769
- type: null,
770
- downlink: null,
771
- rtt: null,
772
- saveData: null,
773
- };
774
- if (typeof globalThis.navigator !== 'undefined') {
775
- if (typeof globalThis.navigator.onLine !== 'undefined')
776
- network.isOnline = globalThis.navigator.onLine;
777
- var connection = globalThis.navigator.connection || globalThis.navigator.mozConnection || globalThis.navigator.webkitConnection;
778
- if (typeof connection !== 'undefined') {
779
- if (typeof connection.effectiveType !== 'undefined')
780
- network.effectiveType = connection.effectiveType;
781
- if (typeof connection.type !== 'undefined')
782
- network.type = connection.type;
783
- if (typeof connection.downlink !== 'undefined')
784
- network.downlink = connection.downlink;
785
- if (typeof connection.rtt !== 'undefined')
786
- network.rtt = connection.rtt;
787
- if (typeof connection.saveData !== 'undefined')
788
- network.saveData = connection.saveData;
789
- return network;
790
- }
791
- }
792
- if (Platform.isNode) {
793
- try {
794
- var os = require('os');
795
- var networkInterfaces = os.networkInterfaces();
796
- var networkInterfaceNames = Object.keys(networkInterfaces);
797
- for (var i = 0; i < networkInterfaceNames.length; i++) {
798
- var name_1 = networkInterfaceNames[i];
799
- var networkInterface = networkInterfaces[name_1];
800
- for (var j = 0; j < networkInterface.length; j++) {
801
- var address = networkInterface[j];
802
- if (!address.internal && address.family === 'IPv4')
803
- network.isOnline = true;
804
- }
805
- if (network.isOnline)
806
- break;
807
- }
808
- }
809
- catch (_) {
810
- }
811
- try {
812
- var childProcess = require('child_process');
813
- if (Platform.os.name === OS.Windows) {
814
- try {
815
- var output = childProcess.execSync('netsh wlan show interfaces', { encoding: 'utf8', timeout: 5000 });
816
- if (output.includes('State') && output.includes('connected'))
817
- network.type = 'wifi';
818
- }
819
- catch (_) {
820
- }
821
- if (network.type === null) {
822
- try {
823
- var output = childProcess.execSync('ipconfig', { encoding: 'utf8', timeout: 5000 });
824
- if (output.includes('Ethernet adapter'))
825
- network.type = 'ethernet';
826
- }
827
- catch (_) {
828
- }
829
- }
830
- if (network.type === null)
831
- network.type = 'other';
832
- }
833
- else if (Platform.os.name === OS.MacOS) {
834
- try {
835
- var output = childProcess.execSync('networksetup -listallhardwareports', { encoding: 'utf8', timeout: 5000 });
836
- var activeInterface = childProcess.execSync('route -n get default | grep interface', { encoding: 'utf8', timeout: 5000 });
837
- if (activeInterface.includes('en0') && output.includes('Wi-Fi'))
838
- network.type = 'wifi';
839
- else if (activeInterface.includes('en') || output.includes('Ethernet'))
840
- network.type = 'ethernet';
841
- else
842
- network.type = 'other';
843
- }
844
- catch (_) {
845
- network.type = 'other';
846
- }
847
- }
848
- }
849
- catch (_) {
850
- }
851
- }
852
- return network;
853
- }
854
759
  function normalizeLocale(locale) {
855
- if (locale === null || locale === undefined)
760
+ if (locale === null || typeof locale === 'undefined')
856
761
  return locale;
857
762
  if (locale.length === 0)
858
763
  return null;
859
764
  locale = locale.replace(/_/g, '-');
860
- if (locale === 'C' || locale === 'posix' || locale === 'POSIX')
765
+ if (locale === 'C' || locale.toLowerCase() === 'posix')
861
766
  return 'en-US';
862
767
  if (locale.indexOf('.') !== -1)
863
768
  return normalizeLocale(locale.split('.')[0]);
@@ -875,9 +780,9 @@
875
780
  }
876
781
  function getLocale() {
877
782
  var locale = {
878
- language: '',
783
+ language: null,
879
784
  languages: [],
880
- timezone: '',
785
+ timezone: null,
881
786
  timezoneOffset: 0,
882
787
  };
883
788
  function addLanguages(language) {
@@ -887,7 +792,7 @@
887
792
  function addLanguage(language) {
888
793
  language = normalizeLocale(language);
889
794
  if (typeof language === "string" && locale.languages.indexOf(language) === -1) {
890
- if (locale.language.length === 0)
795
+ if (locale.language === null)
891
796
  locale.language = language;
892
797
  locale.languages.push(language);
893
798
  }
@@ -945,6 +850,11 @@
945
850
  }
946
851
  catch (_) {
947
852
  }
853
+ try {
854
+ locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
855
+ }
856
+ catch (_) {
857
+ }
948
858
  }
949
859
  if (typeof globalThis.navigator !== 'undefined') {
950
860
  if (typeof globalThis.navigator.languages !== 'undefined')
@@ -958,13 +868,6 @@
958
868
  if (typeof globalThis.navigator.systemLanguage !== 'undefined')
959
869
  addLanguage(globalThis.navigator.systemLanguage);
960
870
  }
961
- try {
962
- if (typeof Intl !== 'undefined') {
963
- locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
964
- }
965
- }
966
- catch (_) {
967
- }
968
871
  try {
969
872
  locale.timezoneOffset = new Date().getTimezoneOffset();
970
873
  }
@@ -972,63 +875,8 @@
972
875
  }
973
876
  return locale;
974
877
  }
975
- function getDimension() {
976
- var dimension = {
977
- innerWidth: -1,
978
- innerHeight: -1,
979
- outerWidth: -1,
980
- outerHeight: -1,
981
- scale: 1,
982
- };
983
- if (typeof globalThis.innerWidth !== 'undefined') {
984
- dimension.innerWidth = globalThis.innerWidth;
985
- dimension.innerHeight = globalThis.innerHeight;
986
- dimension.outerWidth = globalThis.outerWidth;
987
- dimension.outerHeight = globalThis.outerHeight;
988
- dimension.scale = globalThis.devicePixelRatio || 1;
989
- return dimension;
990
- }
991
- if (Platform.crossPlatformFramework === CrossPlatformFramework.ReactNative) {
992
- try {
993
- var reactNative = require('react-native');
994
- var dimensions = reactNative.Dimensions;
995
- var pixelRatio = reactNative.PixelRatio;
996
- var screenDimensions = dimensions.get('screen');
997
- var windowDimensions = dimensions.get('window');
998
- dimension.innerWidth = screenDimensions.width;
999
- dimension.innerHeight = screenDimensions.height;
1000
- dimension.outerWidth = windowDimensions.width;
1001
- dimension.outerHeight = windowDimensions.height;
1002
- dimension.scale = pixelRatio.get();
1003
- return dimension;
1004
- }
1005
- catch (_) {
1006
- }
1007
- }
1008
- if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
1009
- try {
1010
- var electron = require('electron');
1011
- var screen_1 = electron.screen;
1012
- var browserWindow = electron.BrowserWindow;
1013
- var focusedWindow = browserWindow.getFocusedWindow() || browserWindow.getAllWindows()[0];
1014
- if (focusedWindow !== undefined) {
1015
- var contentSize = focusedWindow.getContentSize();
1016
- var size = focusedWindow.getSize();
1017
- dimension.innerWidth = contentSize[0];
1018
- dimension.innerHeight = contentSize[1];
1019
- dimension.outerWidth = size[0];
1020
- dimension.outerHeight = size[1];
1021
- dimension.scale = screen_1.getDisplayMatching(focusedWindow.getBounds()).scaleFactor;
1022
- }
1023
- return dimension;
1024
- }
1025
- catch (_) {
1026
- }
1027
- }
1028
- return dimension;
1029
- }
1030
878
  function init() {
1031
- if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.electron !== undefined) || (/ electron\//i.test(USER_AGENT)))
879
+ if ((typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.electron !== 'undefined') || (/ electron\//i.test(USER_AGENT)))
1032
880
  Platform.crossPlatformFramework = CrossPlatformFramework.Electron;
1033
881
  if (typeof globalThis.navigator !== 'undefined' && globalThis.navigator.product === 'ReactNative')
1034
882
  Platform.crossPlatformFramework = CrossPlatformFramework.ReactNative;
@@ -1224,8 +1072,7 @@
1224
1072
  finally {
1225
1073
  decrementPendingTasks();
1226
1074
  }
1227
- })
1228
- .catch(decrementPendingTasks);
1075
+ });
1229
1076
  }
1230
1077
  checkReady();
1231
1078
  }
@@ -1247,16 +1094,7 @@
1247
1094
  xhr.send();
1248
1095
  if (xhr.status === 200) {
1249
1096
  try {
1250
- var response = JSON.parse(xhr.response);
1251
- if (response.results === undefined)
1252
- return undefined;
1253
- var results = response.results;
1254
- if (!Array.isArray(results) || results.length === 0)
1255
- return undefined;
1256
- var result = results[0];
1257
- if (result === undefined)
1258
- return undefined;
1259
- return result.trackId;
1097
+ return parseLookupBundleIdResponse(JSON.parse(xhr.response));
1260
1098
  }
1261
1099
  catch (_) {
1262
1100
  return undefined;
@@ -1268,22 +1106,51 @@
1268
1106
  return undefined;
1269
1107
  }
1270
1108
  }
1109
+ function getTrackIdAsync(bundle) {
1110
+ return new Promise(function (resolve) {
1111
+ fetch('https://itunes.apple.com/lookup?bundleId=' + bundle)
1112
+ .then(function (response) {
1113
+ response
1114
+ .json()
1115
+ .then(function (response) {
1116
+ resolve(parseLookupBundleIdResponse(response));
1117
+ })
1118
+ .catch(function () {
1119
+ resolve(undefined);
1120
+ });
1121
+ })
1122
+ .catch(function () {
1123
+ resolve(undefined);
1124
+ });
1125
+ });
1126
+ }
1127
+ function parseLookupBundleIdResponse(response) {
1128
+ if (typeof response.results === 'undefined')
1129
+ return undefined;
1130
+ var results = response.results;
1131
+ if (results.length === 0)
1132
+ return undefined;
1133
+ var result = results[0];
1134
+ if (typeof result === 'undefined')
1135
+ return undefined;
1136
+ return "" + result.trackId;
1137
+ }
1271
1138
  function createIntentURL(scheme, packageName, fallback) {
1272
1139
  var split = scheme.split('://');
1273
1140
  var prefix = split[0];
1274
1141
  var suffix = split[1];
1275
1142
  var intent = 'intent://';
1276
- if (suffix !== undefined)
1143
+ if (typeof suffix !== 'undefined')
1277
1144
  intent = intent + suffix;
1278
1145
  intent = intent + '#Intent;'
1279
1146
  + 'scheme=' + prefix + ';'
1280
1147
  + 'action=android.intent.action.VIEW;'
1281
1148
  + 'category=android.intent.category.BROWSABLE;';
1282
- if (packageName !== undefined)
1149
+ if (typeof packageName !== 'undefined')
1283
1150
  intent = intent + 'package=' + packageName + ';';
1284
- if (fallback !== undefined && typeof fallback === 'string')
1151
+ if (typeof fallback !== 'undefined' && typeof fallback === 'string')
1285
1152
  intent = intent + 'S.browser_fallback_url=' + fallback + ';';
1286
- else if (packageName !== undefined)
1153
+ else if (typeof packageName !== 'undefined')
1287
1154
  intent = intent + 'S.browser_fallback_url=' + createAppStoreURL(packageName, OS.Android) + ';';
1288
1155
  return intent + 'end';
1289
1156
  }
@@ -1301,16 +1168,16 @@
1301
1168
  if (index !== -1)
1302
1169
  extras[part.substring(0, index)] = part.substring(index + 1);
1303
1170
  }
1304
- if (extras['scheme'] !== undefined)
1171
+ if (typeof extras['scheme'] !== 'undefined')
1305
1172
  parsed.scheme = (extras['scheme'] + '://' + host);
1306
- if (extras['package'] !== undefined)
1173
+ if (typeof extras['package'] !== 'undefined')
1307
1174
  parsed.packageName = extras['package'];
1308
- if (extras['S.browser_fallback_url'] !== undefined)
1175
+ if (typeof extras['S.browser_fallback_url'] !== 'undefined')
1309
1176
  parsed.fallback = extras['S.browser_fallback_url'];
1310
1177
  return parsed;
1311
1178
  }
1312
1179
  function createAppStoreURL(packageName, os) {
1313
- if (packageName === undefined)
1180
+ if (typeof packageName === 'undefined')
1314
1181
  return undefined;
1315
1182
  switch (os) {
1316
1183
  case OS.Android:
@@ -1326,7 +1193,7 @@
1326
1193
  }
1327
1194
  }
1328
1195
  function createWebStoreURL(packageName, os) {
1329
- if (packageName === undefined)
1196
+ if (typeof packageName === 'undefined')
1330
1197
  return undefined;
1331
1198
  switch (os) {
1332
1199
  case OS.Android:
@@ -1391,7 +1258,7 @@
1391
1258
  return;
1392
1259
  }
1393
1260
  a = createHiddenElement('a');
1394
- if (a === undefined)
1261
+ if (typeof a === 'undefined')
1395
1262
  return;
1396
1263
  a.href = url;
1397
1264
  topDocument.body.appendChild(a);
@@ -1401,7 +1268,7 @@
1401
1268
  catch (_) {
1402
1269
  }
1403
1270
  finally {
1404
- if (a !== undefined) {
1271
+ if (typeof a !== 'undefined') {
1405
1272
  try {
1406
1273
  topDocument.body.removeChild(a);
1407
1274
  }
@@ -1416,12 +1283,12 @@
1416
1283
  var iframe = undefined;
1417
1284
  try {
1418
1285
  iframe = createHiddenElement('iframe');
1419
- if (iframe === undefined)
1286
+ if (typeof iframe === 'undefined')
1420
1287
  return;
1421
1288
  iframe.src = url;
1422
1289
  topDocument.body.appendChild(iframe);
1423
1290
  globalThis.setTimeout(function () {
1424
- if (iframe !== undefined) {
1291
+ if (typeof iframe !== 'undefined') {
1425
1292
  try {
1426
1293
  topDocument.body.removeChild(iframe);
1427
1294
  }
@@ -1445,13 +1312,13 @@
1445
1312
  return true;
1446
1313
  if (topDocument.msVisibilityState === 'hidden')
1447
1314
  return true;
1448
- if (topDocument.hidden !== undefined)
1315
+ if (typeof topDocument.hidden !== 'undefined')
1449
1316
  return topDocument.hidden;
1450
- if (topDocument.webkitHidden !== undefined)
1317
+ if (typeof topDocument.webkitHidden !== 'undefined')
1451
1318
  return topDocument.webkitHidden;
1452
- if (topDocument.mozHidden !== undefined)
1319
+ if (typeof topDocument.mozHidden !== 'undefined')
1453
1320
  return topDocument.mozHidden;
1454
- if (topDocument.msHidden !== undefined)
1321
+ if (typeof topDocument.msHidden !== 'undefined')
1455
1322
  return topDocument.msHidden;
1456
1323
  if (typeof topDocument.hasFocus === 'function')
1457
1324
  return !topDocument.hasFocus();
@@ -1488,7 +1355,7 @@
1488
1355
  var input = undefined;
1489
1356
  try {
1490
1357
  input = createHiddenElement('input');
1491
- if (input === undefined)
1358
+ if (typeof input === 'undefined')
1492
1359
  return false;
1493
1360
  input.type = 'text';
1494
1361
  input.readOnly = true;
@@ -1505,7 +1372,7 @@
1505
1372
  catch (_) {
1506
1373
  }
1507
1374
  finally {
1508
- if (input !== undefined) {
1375
+ if (typeof input !== 'undefined') {
1509
1376
  try {
1510
1377
  input.blur();
1511
1378
  }
@@ -1595,7 +1462,7 @@
1595
1462
  var timeoutId;
1596
1463
  var resolved = false;
1597
1464
  function cleanup() {
1598
- if (timeoutId !== undefined) {
1465
+ if (typeof timeoutId !== 'undefined') {
1599
1466
  clearTimeout(timeoutId);
1600
1467
  timeoutId = undefined;
1601
1468
  }
@@ -1606,14 +1473,14 @@
1606
1473
  }
1607
1474
  catch (_) {
1608
1475
  }
1609
- if (a !== undefined) {
1476
+ if (typeof a !== 'undefined') {
1610
1477
  try {
1611
1478
  topDocument.body.removeChild(a);
1612
1479
  }
1613
1480
  catch (_) {
1614
1481
  }
1615
1482
  }
1616
- if (iframe !== undefined) {
1483
+ if (typeof iframe !== 'undefined') {
1617
1484
  try {
1618
1485
  topDocument.body.removeChild(iframe);
1619
1486
  }
@@ -1637,7 +1504,7 @@
1637
1504
  }
1638
1505
  }
1639
1506
  function onBlur() {
1640
- if (timeoutId !== undefined) {
1507
+ if (typeof timeoutId !== 'undefined') {
1641
1508
  clearTimeout(timeoutId);
1642
1509
  timeoutId = undefined;
1643
1510
  }
@@ -1680,7 +1547,7 @@
1680
1547
  var timeout;
1681
1548
  if (Platform.os.name === OS.Android) {
1682
1549
  var option = options[OS.Android] || options['android'];
1683
- if (option === undefined)
1550
+ if (typeof option === 'undefined')
1684
1551
  return Promise.reject(getURLOpenError(tried));
1685
1552
  timeout = option.timeout;
1686
1553
  infos.scheme = urlToString(option.scheme);
@@ -1691,21 +1558,21 @@
1691
1558
  infos.webStore = createWebStoreURL(infos.packageName, OS.Android);
1692
1559
  infos.allowAppStore = option.allowAppStore;
1693
1560
  infos.allowWebStore = option.allowWebStore;
1694
- if (infos.intent !== undefined && (infos.scheme === undefined || infos.packageName === undefined || infos.fallback === undefined)) {
1561
+ if (typeof infos.intent !== 'undefined' && (typeof infos.scheme === 'undefined' || typeof infos.packageName === 'undefined' || typeof infos.fallback === 'undefined')) {
1695
1562
  var parsed = parseIntentURL(infos.intent);
1696
- if (parsed.scheme !== undefined && infos.scheme === undefined)
1563
+ if (typeof parsed.scheme !== 'undefined' && typeof infos.scheme === 'undefined')
1697
1564
  infos.scheme = parsed.scheme;
1698
- if (parsed.packageName !== undefined && infos.packageName === undefined)
1565
+ if (typeof parsed.packageName !== 'undefined' && typeof infos.packageName === 'undefined')
1699
1566
  infos.packageName = parsed.packageName;
1700
- if (parsed.fallback !== undefined && infos.fallback === undefined)
1567
+ if (typeof parsed.fallback !== 'undefined' && typeof infos.fallback === 'undefined')
1701
1568
  infos.fallback = parsed.fallback;
1702
1569
  }
1703
- if (infos.scheme !== undefined && infos.intent === undefined)
1570
+ if (typeof infos.scheme !== 'undefined' && typeof infos.intent === 'undefined')
1704
1571
  infos.intent = createIntentURL(infos.scheme, infos.packageName, infos.fallback);
1705
1572
  }
1706
1573
  else if (Platform.os.name === OS.iOS) {
1707
1574
  var option = options[OS.iOS] || options['ios'];
1708
- if (option === undefined)
1575
+ if (typeof option === 'undefined')
1709
1576
  return Promise.reject(getURLOpenError(tried));
1710
1577
  timeout = option.timeout;
1711
1578
  infos.scheme = urlToString(option.scheme);
@@ -1717,12 +1584,12 @@
1717
1584
  infos.webStore = createWebStoreURL(infos.trackId, OS.iOS);
1718
1585
  infos.allowAppStore = option.allowAppStore;
1719
1586
  infos.allowWebStore = option.allowWebStore;
1720
- if (infos.bundleId !== undefined && infos.trackId === undefined)
1587
+ if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined')
1721
1588
  infos.trackId = getTrackId(infos.bundleId);
1722
1589
  }
1723
1590
  else if (Platform.os.name === OS.Windows) {
1724
1591
  var option = options[OS.Windows] || options['windows'];
1725
- if (option === undefined)
1592
+ if (typeof option === 'undefined')
1726
1593
  return Promise.reject(getURLOpenError(tried));
1727
1594
  timeout = option.timeout;
1728
1595
  infos.scheme = urlToString(option.scheme);
@@ -1734,20 +1601,43 @@
1734
1601
  infos.allowWebStore = option.allowWebStore;
1735
1602
  }
1736
1603
  else if (Platform.os.name === OS.MacOS) {
1737
- var option = options[OS.MacOS] || options['mac'];
1738
- if (option === undefined)
1604
+ var option_1 = options[OS.MacOS] || options['mac'];
1605
+ if (typeof option_1 === 'undefined')
1739
1606
  return Promise.reject(getURLOpenError(tried));
1740
- timeout = option.timeout;
1741
- infos.scheme = urlToString(option.scheme);
1742
- infos.bundleId = option.bundleId;
1743
- infos.trackId = option.trackId;
1744
- infos.fallback = urlToString(option.fallback);
1607
+ timeout = option_1.timeout;
1608
+ infos.scheme = urlToString(option_1.scheme);
1609
+ infos.bundleId = option_1.bundleId;
1610
+ infos.trackId = option_1.trackId;
1611
+ infos.fallback = urlToString(option_1.fallback);
1745
1612
  infos.appStore = createAppStoreURL(infos.trackId, OS.MacOS);
1746
1613
  infos.webStore = createWebStoreURL(infos.trackId, OS.MacOS);
1747
- infos.allowAppStore = option.allowAppStore;
1748
- infos.allowWebStore = option.allowWebStore;
1749
- if (infos.bundleId !== undefined && infos.trackId === undefined)
1750
- infos.trackId = getTrackId(infos.bundleId);
1614
+ infos.allowAppStore = option_1.allowAppStore;
1615
+ infos.allowWebStore = option_1.allowWebStore;
1616
+ if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined') {
1617
+ if (Platform.crossPlatformFramework === CrossPlatformFramework.Electron) {
1618
+ if (option_1.electronTrackIdTried !== true) {
1619
+ var self_1 = this;
1620
+ return new Promise(function (resolve) {
1621
+ if (typeof infos.bundleId !== 'undefined') {
1622
+ getTrackIdAsync(infos.bundleId)
1623
+ .then(function (trackId) {
1624
+ option_1.trackId = trackId;
1625
+ option_1.scheme = infos.scheme;
1626
+ option_1.bundleId = infos.bundleId;
1627
+ option_1.fallback = infos.fallback;
1628
+ option_1.allowAppStore = infos.allowAppStore;
1629
+ option_1.allowWebStore = infos.allowWebStore;
1630
+ option_1.electronTrackIdTried = true;
1631
+ resolve(self_1.open({ mac: option_1 }));
1632
+ });
1633
+ }
1634
+ });
1635
+ }
1636
+ }
1637
+ else {
1638
+ infos.trackId = getTrackId(infos.bundleId);
1639
+ }
1640
+ }
1751
1641
  }
1752
1642
  pushURL(urls, infos.intent, AppOpenState.Intent, canOpenIntentURL());
1753
1643
  pushURL(urls, infos.universal, AppOpenState.Universal, canOpenUniversalURL());
@@ -1755,7 +1645,7 @@
1755
1645
  pushURL(urls, infos.fallback, AppOpenState.Fallback);
1756
1646
  pushURL(urls, infos.appStore, AppOpenState.Store, infos.allowAppStore);
1757
1647
  pushURL(urls, infos.webStore, AppOpenState.Store, infos.allowWebStore);
1758
- if (timeout === undefined)
1648
+ if (typeof timeout === 'undefined')
1759
1649
  timeout = getDefaultTimeoutByOS(os);
1760
1650
  return new Promise(function (resolve, reject) {
1761
1651
  function openURLSequential(index) {
@@ -1896,15 +1786,15 @@
1896
1786
  var key = keys[i];
1897
1787
  result[key] = stringifiableToString(value[key]);
1898
1788
  }
1899
- if (result.to === undefined)
1789
+ if (typeof result.to === 'undefined')
1900
1790
  result.to = '';
1901
- if (result.cc === undefined)
1791
+ if (typeof result.cc === 'undefined')
1902
1792
  result.cc = '';
1903
- if (result.bcc === undefined)
1793
+ if (typeof result.bcc === 'undefined')
1904
1794
  result.bcc = '';
1905
- if (result.subject === undefined)
1795
+ if (typeof result.subject === 'undefined')
1906
1796
  result.subject = '';
1907
- if (result.body === undefined)
1797
+ if (typeof result.body === 'undefined')
1908
1798
  result.body = '';
1909
1799
  return result;
1910
1800
  }