native-fn 1.0.42 → 1.0.44

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 (62) hide show
  1. package/dist/native.cjs +372 -11
  2. package/dist/native.min.cjs +1 -1
  3. package/dist/native.min.mjs +1 -1
  4. package/dist/native.mjs +372 -11
  5. package/dist/native.umd.js +372 -11
  6. package/dist/native.umd.min.js +1 -1
  7. package/dist/plugin/app/index.cjs +317 -151
  8. package/dist/plugin/app/index.d.ts +5 -1
  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 +317 -151
  12. package/dist/plugin/app/index.umd.js +317 -151
  13. package/dist/plugin/app/index.umd.min.js +1 -1
  14. package/dist/plugin/app/src/constants/platform.d.ts +3 -13
  15. package/dist/plugin/app/src/plugin/app/types/app.d.ts +4 -0
  16. package/dist/plugin/app/src/types/platform.d.ts +17 -0
  17. package/dist/plugin/app/src/utils/create-hidden-element.d.ts +1 -1
  18. package/dist/plugin/camera/index.cjs +253 -86
  19. package/dist/plugin/camera/index.min.cjs +1 -1
  20. package/dist/plugin/camera/index.min.mjs +1 -1
  21. package/dist/plugin/camera/index.mjs +253 -86
  22. package/dist/plugin/camera/index.umd.js +253 -86
  23. package/dist/plugin/camera/index.umd.min.js +1 -1
  24. package/dist/plugin/camera/src/constants/platform.d.ts +3 -13
  25. package/dist/plugin/camera/src/plugin/app/types/app.d.ts +4 -0
  26. package/dist/plugin/camera/src/types/platform.d.ts +17 -0
  27. package/dist/plugin/camera/src/utils/create-hidden-element.d.ts +1 -1
  28. package/dist/plugin/clipboard/index.cjs +6 -0
  29. package/dist/plugin/clipboard/index.min.cjs +1 -1
  30. package/dist/plugin/clipboard/index.min.mjs +1 -1
  31. package/dist/plugin/clipboard/index.mjs +6 -0
  32. package/dist/plugin/clipboard/index.umd.js +6 -0
  33. package/dist/plugin/clipboard/index.umd.min.js +1 -1
  34. package/dist/plugin/clipboard/src/constants/platform.d.ts +3 -13
  35. package/dist/plugin/clipboard/src/plugin/app/types/app.d.ts +4 -0
  36. package/dist/plugin/clipboard/src/types/platform.d.ts +17 -0
  37. package/dist/plugin/clipboard/src/utils/create-hidden-element.d.ts +1 -1
  38. package/dist/plugin/fullscreen/index.cjs +246 -82
  39. package/dist/plugin/fullscreen/index.min.cjs +1 -1
  40. package/dist/plugin/fullscreen/index.min.mjs +1 -1
  41. package/dist/plugin/fullscreen/index.mjs +246 -82
  42. package/dist/plugin/fullscreen/index.umd.js +246 -82
  43. package/dist/plugin/fullscreen/index.umd.min.js +1 -1
  44. package/dist/plugin/fullscreen/src/constants/platform.d.ts +3 -13
  45. package/dist/plugin/fullscreen/src/plugin/app/types/app.d.ts +4 -0
  46. package/dist/plugin/fullscreen/src/types/platform.d.ts +17 -0
  47. package/dist/plugin/fullscreen/src/utils/create-hidden-element.d.ts +1 -1
  48. package/dist/plugin/theme/index.cjs +257 -91
  49. package/dist/plugin/theme/index.min.cjs +1 -1
  50. package/dist/plugin/theme/index.min.mjs +1 -1
  51. package/dist/plugin/theme/index.mjs +257 -91
  52. package/dist/plugin/theme/index.umd.js +257 -91
  53. package/dist/plugin/theme/index.umd.min.js +1 -1
  54. package/dist/plugin/theme/src/constants/platform.d.ts +3 -13
  55. package/dist/plugin/theme/src/plugin/app/types/app.d.ts +4 -0
  56. package/dist/plugin/theme/src/types/platform.d.ts +17 -0
  57. package/dist/plugin/theme/src/utils/create-hidden-element.d.ts +1 -1
  58. package/dist/src/constants/platform.d.ts +3 -13
  59. package/dist/src/plugin/app/types/app.d.ts +4 -0
  60. package/dist/src/types/platform.d.ts +17 -0
  61. package/dist/src/utils/create-hidden-element.d.ts +1 -1
  62. package/package.json +1 -8
@@ -4,7 +4,28 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Camera = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
- var USER_AGENT = navigator.userAgent;
7
+ function dynamicImport(moduleName) {
8
+ if ('require' in globalThis && typeof globalThis.require === 'function') {
9
+ try {
10
+ return Promise.resolve(globalThis.require(moduleName));
11
+ }
12
+ catch (_) {
13
+ return Promise.resolve(null);
14
+ }
15
+ }
16
+ try {
17
+ return import(moduleName)
18
+ .then(function (module) {
19
+ return (module.default || module);
20
+ })
21
+ .catch(function () {
22
+ return Promise.resolve(null);
23
+ });
24
+ }
25
+ catch (_) {
26
+ return Promise.resolve(null);
27
+ }
28
+ }
8
29
 
9
30
  var OS;
10
31
  (function (OS) {
@@ -45,42 +66,22 @@
45
66
  Browsers["IE"] = "IE";
46
67
  Browsers["SamsungInternet"] = "SamsungInternet";
47
68
  })(Browsers || (Browsers = {}));
48
- function resolveWindowsVersion(string) {
49
- if (string === undefined)
50
- return '';
51
- var mapped = {
52
- '4.90': 'ME',
53
- 'NT3.51': 'NT 3.11',
54
- 'NT4.0': 'NT 4.0',
55
- 'NT 5.0': '2000',
56
- 'NT 5.1': 'XP',
57
- 'NT 5.2': 'XP',
58
- 'NT 6.0': 'Vista',
59
- 'NT 6.1': '7',
60
- 'NT 6.2': '8',
61
- 'NT 6.3': '8.1',
62
- 'NT 6.4': '10',
63
- 'NT 10.0': '10',
64
- 'ARM': 'RT'
65
- }[string];
66
- if (mapped !== undefined)
67
- return mapped;
68
- return string;
69
- }
70
- function resolveUnderscoreVersion(string) {
71
- if (string === undefined)
72
- return '';
73
- return string.replace(/_/g, '.');
74
- }
75
- function resolveVersion(string, resolver) {
76
- if (typeof resolver === 'function')
77
- return resolver(string);
78
- if (typeof resolver === 'string')
79
- return resolver;
80
- if (string === undefined)
81
- return '';
82
- return string;
83
- }
69
+ var Platform = {
70
+ device: Devices.Unknown,
71
+ os: OS.Unknown,
72
+ osVersion: '',
73
+ engine: Engines.Unknown,
74
+ engineVersion: '',
75
+ browser: Browsers.Unknown,
76
+ browserVersion: '',
77
+ renderer: getRenderer(),
78
+ userAgent: navigator.userAgent,
79
+ isWebview: false,
80
+ isMobile: false,
81
+ isDesktop: false,
82
+ isStandalone: false,
83
+ isNodeJS: getIsNode(),
84
+ };
84
85
  var OS_RESOLVER_MAP = [
85
86
  [/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
86
87
  [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
@@ -139,78 +140,240 @@
139
140
  [/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
140
141
  [/firefox\/([\w.]+)/i, Browsers.Firefox],
141
142
  ];
142
- var DEVICE_NAME = Devices.Unknown;
143
- var OS_NAME = OS.Unknown;
144
- var OS_VERSION = '';
145
- Engines.Unknown;
146
- Browsers.Unknown;
143
+ function resolveWindowsVersion(string) {
144
+ if (string === undefined)
145
+ return '';
146
+ var mapped = {
147
+ '4.90': 'ME',
148
+ 'NT3.51': 'NT 3.11',
149
+ 'NT4.0': 'NT 4.0',
150
+ 'NT 5.0': '2000',
151
+ 'NT 5.1': 'XP',
152
+ 'NT 5.2': 'XP',
153
+ 'NT 6.0': 'Vista',
154
+ 'NT 6.1': '7',
155
+ 'NT 6.2': '8',
156
+ 'NT 6.3': '8.1',
157
+ 'NT 6.4': '10',
158
+ 'NT 10.0': '10',
159
+ 'ARM': 'RT'
160
+ }[string];
161
+ if (mapped !== undefined)
162
+ return mapped;
163
+ return string;
164
+ }
165
+ function resolveUnderscoreVersion(string) {
166
+ if (string === undefined)
167
+ return '';
168
+ return string.replace(/_/g, '.');
169
+ }
170
+ function resolveVersion(string, resolver) {
171
+ if (typeof resolver === 'function')
172
+ return resolver(string);
173
+ if (typeof resolver === 'string')
174
+ return resolver;
175
+ if (string === undefined)
176
+ return '';
177
+ return string;
178
+ }
179
+ function normalizeBrand(entry) {
180
+ if (entry === null || entry === undefined)
181
+ return { brand: '', version: '' };
182
+ if (typeof entry === 'string')
183
+ return { brand: entry, version: '' };
184
+ return { brand: entry.brand, version: entry.version };
185
+ }
186
+ function getRenderer() {
187
+ if (typeof globalThis.document === 'undefined')
188
+ return '';
189
+ var canvas = globalThis.document.createElement('canvas');
190
+ if (typeof canvas.getContext !== 'function')
191
+ return '';
192
+ var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
193
+ if (context === null)
194
+ return '';
195
+ if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
196
+ var extension = context.getExtension('WEBGL_debug_renderer_info');
197
+ if (extension === null)
198
+ return context.getParameter(context.RENDERER);
199
+ else
200
+ return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
201
+ }
202
+ else {
203
+ return '';
204
+ }
205
+ }
206
+ function getIsStandalone(os) {
207
+ if (!('matchMedia' in globalThis))
208
+ return false;
209
+ if (os === OS.iOS)
210
+ return 'standalone' in navigator && !!navigator.standalone;
211
+ return globalThis.matchMedia('(display-mode: standalone)').matches;
212
+ }
213
+ function getIsWebview() {
214
+ return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
215
+ }
216
+ function getIsNode() {
217
+ return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && globalThis.process.versions.node !== undefined;
218
+ }
219
+ function getNodeOSVersion(string) {
220
+ var parts = string.split('.');
221
+ return {
222
+ major: parseInt(parts[0] || '0'),
223
+ minor: parseInt(parts[1] || '0'),
224
+ build: parseInt(parts[2] || '0')
225
+ };
226
+ }
147
227
  for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
148
228
  var map = OS_RESOLVER_MAP[i];
149
229
  var regexp = map[0];
150
230
  var os = map[1];
151
231
  var resolver = map[2];
152
- var matched = USER_AGENT.match(regexp);
232
+ var matched = Platform.userAgent.match(regexp);
153
233
  if (matched !== null) {
154
- OS_NAME = os;
155
- OS_VERSION = resolveVersion(matched[1], resolver);
234
+ Platform.os = os;
235
+ Platform.osVersion = resolveVersion(matched[1], resolver);
156
236
  if (os === OS.iOS || os === OS.Android)
157
- DEVICE_NAME = Devices.Mobile;
237
+ Platform.device = Devices.Mobile;
158
238
  else if (os === OS.Windows || os === OS.MacOS)
159
- DEVICE_NAME = Devices.Desktop;
239
+ Platform.device = Devices.Desktop;
160
240
  break;
161
241
  }
162
242
  }
163
243
  for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
164
244
  var map = ENGINE_RESOLVER_MAP[i];
165
245
  var regexp = map[0];
166
- map[1];
246
+ var engine = map[1];
167
247
  var resolver = map[2];
168
- var matched = USER_AGENT.match(regexp);
248
+ var matched = Platform.userAgent.match(regexp);
169
249
  if (matched !== null) {
170
- resolveVersion(matched[1], resolver);
250
+ Platform.engine = engine;
251
+ Platform.engineVersion = resolveVersion(matched[1], resolver);
171
252
  break;
172
253
  }
173
254
  }
174
255
  for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
175
256
  var map = BROWSER_RESOLVER_MAP[i];
176
257
  var regexp = map[0];
177
- map[1];
258
+ var browser = map[1];
178
259
  var resolver = map[2];
179
- var matched = USER_AGENT.match(regexp);
260
+ var matched = Platform.userAgent.match(regexp);
180
261
  if (matched !== null) {
181
- resolveVersion(matched[1], resolver);
262
+ Platform.browser = browser;
263
+ Platform.browserVersion = resolveVersion(matched[1], resolver);
182
264
  break;
183
265
  }
184
266
  }
185
- ((function () {
186
- if (typeof globalThis.document === 'undefined')
187
- return '';
188
- var canvas = globalThis.document.createElement('canvas');
189
- if (typeof canvas.getContext !== 'function')
190
- return '';
191
- var context = canvas.getContext('webgl2') || canvas.getContext('experimental-webgl') || canvas.getContext('webgl');
192
- if (context === null)
193
- return '';
194
- if (context instanceof WebGLRenderingContext || 'getParameter' in context && typeof context.getParameter === 'function') {
195
- var extension = context.getExtension('WEBGL_debug_renderer_info');
196
- if (extension === null)
197
- return context.getParameter(context.RENDERER);
198
- else
199
- return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
200
- }
201
- else {
202
- return '';
203
- }
204
- }))();
205
- DEVICE_NAME === Devices.Mobile;
206
- DEVICE_NAME === Devices.Desktop;
207
- ((function () {
208
- if (!('matchMedia' in globalThis))
209
- return false;
210
- if (OS_NAME === OS.iOS)
211
- return 'standalone' in navigator && !!navigator.standalone;
212
- return globalThis.matchMedia('(display-mode: standalone)').matches;
213
- }))();
267
+ if (Platform.isNodeJS) {
268
+ dynamicImport('os')
269
+ .then(function (os) {
270
+ if (os === null)
271
+ return;
272
+ var platform = os.platform();
273
+ var release = os.release();
274
+ var version = getNodeOSVersion(release);
275
+ switch (platform) {
276
+ case 'win32':
277
+ Platform.os = OS.Windows;
278
+ if (version.major === 10 && version.minor === 0 && version.build >= 22000)
279
+ Platform.osVersion = '11';
280
+ else if (version.major === 10 && version.minor === 0 && version.build < 22000)
281
+ Platform.osVersion = '10';
282
+ else if (version.major === 6 && version.minor === 3)
283
+ Platform.osVersion = '8.1';
284
+ else if (version.major === 6 && version.minor === 2)
285
+ Platform.osVersion = '8';
286
+ else if (version.major === 6 && version.minor === 1)
287
+ Platform.osVersion = '7';
288
+ else if (version.major === 6 && version.minor === 0)
289
+ Platform.osVersion = 'Vista';
290
+ else if (version.major === 5 && version.minor === 1)
291
+ Platform.osVersion = 'XP';
292
+ else if (version.major === 5 && version.minor === 2)
293
+ Platform.osVersion = 'XP';
294
+ else if (version.major === 5 && version.minor === 0)
295
+ Platform.osVersion = '2000';
296
+ else if (version.major === 4 && version.minor === 90)
297
+ Platform.osVersion = 'ME';
298
+ else if (version.major === 4 && version.minor === 0)
299
+ Platform.osVersion = 'NT 4.0';
300
+ else if (version.major === 3 && version.minor === 51)
301
+ Platform.osVersion = 'NT 3.11';
302
+ else
303
+ Platform.osVersion = release;
304
+ break;
305
+ case 'darwin':
306
+ Platform.os = OS.MacOS;
307
+ if (version.major >= 24)
308
+ Platform.osVersion = '' + (version.major - 9) + '.' + version.minor + '.' + version.build;
309
+ else if (version.major === 23)
310
+ Platform.osVersion = '14.' + version.minor + '.' + version.build;
311
+ else if (version.major === 22)
312
+ Platform.osVersion = '13.' + version.minor + '.' + version.build;
313
+ else if (version.major === 21)
314
+ Platform.osVersion = '12.' + version.minor + '.' + version.build;
315
+ else if (version.major === 20)
316
+ Platform.osVersion = '11.' + version.minor + '.' + version.build;
317
+ else if (version.major === 19)
318
+ Platform.osVersion = '10.15.' + version.minor;
319
+ else if (version.major === 18)
320
+ Platform.osVersion = '10.14.' + version.minor;
321
+ else if (version.major === 17)
322
+ Platform.osVersion = '10.13.' + version.minor;
323
+ else if (version.major === 16)
324
+ Platform.osVersion = '10.12.' + version.minor;
325
+ else if (version.major === 15)
326
+ Platform.osVersion = '10.11.' + version.minor;
327
+ else if (version.major === 14)
328
+ Platform.osVersion = '10.10.' + version.minor;
329
+ else if (version.major === 13)
330
+ Platform.osVersion = '10.9.' + version.minor;
331
+ else if (version.major >= 5 && version.major <= 12)
332
+ Platform.osVersion = '10.' + (version.major - 4) + '.' + version.minor;
333
+ else
334
+ Platform.osVersion = release;
335
+ break;
336
+ case 'android':
337
+ Platform.os = OS.Android;
338
+ Platform.osVersion = release;
339
+ break;
340
+ case 'linux':
341
+ if (/android/i.test(release)) {
342
+ Platform.os = OS.Android;
343
+ Platform.osVersion = release;
344
+ }
345
+ break;
346
+ }
347
+ });
348
+ }
349
+ if (navigator.userAgentData !== undefined && navigator.userAgentData.getHighEntropyValues !== undefined) {
350
+ navigator
351
+ .userAgentData
352
+ .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
353
+ .then(function (result) {
354
+ var brands = result.fullVersionList || result.brands || [];
355
+ var platformVersion = result.platformVersion;
356
+ for (var i = 0; i < brands.length; i++) {
357
+ var brand = normalizeBrand(brands[i]);
358
+ var brandName = brand.brand;
359
+ var brandVersion = brand.version;
360
+ if (/not.a.brand/i.test(brandName))
361
+ continue;
362
+ if (brandName === "Chromium")
363
+ Platform.engineVersion = brandVersion;
364
+ }
365
+ if (typeof platformVersion === 'string') {
366
+ if (Platform.os === OS.Windows && parseInt(platformVersion.replace(/[^\d.]/g, '').split('.')[0], 10) >= 13)
367
+ Platform.osVersion = '11';
368
+ else
369
+ Platform.osVersion = platformVersion;
370
+ }
371
+ });
372
+ }
373
+ Platform.isMobile = Platform.device === Devices.Mobile;
374
+ Platform.isDesktop = Platform.device === Devices.Desktop;
375
+ Platform.isWebview = getIsWebview();
376
+ Platform.isStandalone = getIsStandalone(Platform.os);
214
377
 
215
378
  function getTopmostWindow() {
216
379
  try {
@@ -243,6 +406,8 @@
243
406
 
244
407
  function createHiddenElement(tagName, focusable) {
245
408
  if (focusable === void 0) { focusable = true; }
409
+ if (typeof globalThis.document === 'undefined')
410
+ return undefined;
246
411
  var element = globalThis.document.createElement(tagName);
247
412
  if ('width' in element)
248
413
  element.width = '0';
@@ -299,13 +464,15 @@
299
464
  var input;
300
465
  try {
301
466
  input = createHiddenElement('input');
467
+ if (input === undefined)
468
+ return;
302
469
  input.type = 'file';
303
470
  input.tabIndex = -1;
304
471
  input.accept = type + '/*';
305
472
  if ('capture' in HTMLInputElement.prototype) {
306
473
  input.capture = 'user';
307
474
  }
308
- else if (OS_NAME === OS.Android) {
475
+ else if (Platform.os === OS.Android) {
309
476
  var capture = '';
310
477
  if (type === 'image')
311
478
  capture = 'camera';
@@ -347,16 +514,16 @@
347
514
  open: open
348
515
  };
349
516
  function open(type) {
350
- switch (OS_NAME) {
517
+ switch (Platform.os) {
351
518
  case OS.Android:
352
519
  tryOpenCamera(type);
353
520
  break;
354
521
  case OS.iOS:
355
- if (compareVersion(OS_VERSION, '10.3') >= 0) {
522
+ if (compareVersion(Platform.osVersion, '10.3') >= 0) {
356
523
  tryOpenCamera(type);
357
524
  }
358
525
  else {
359
- alert(OS_VERSION);
526
+ alert(Platform.osVersion);
360
527
  }
361
528
  break;
362
529
  case OS.Windows:
@@ -1 +1 @@
1
- !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).Camera=i()}(this,(function(){"use strict";var e,i,n,o,t=navigator.userAgent;function r(e){if(void 0===e)return"";var i={"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!==i?i:e}function a(e){return void 0===e?"":e.replace(/_/g,".")}function s(e,i){return"function"==typeof i?i(e):"string"==typeof i?i:void 0===e?"":e}!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(e||(e={})),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"}(o||(o={}));var d=[[/windows nt (6\.[23]); arm/i,e.Windows,r],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,e.Windows,r],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,e.Windows,r],[/windows nt ?([\d.)]*)(?!.+xbox)/i,e.Windows,r],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,e.Windows,r],[/windows ce\/?([\d.]*)/i,e.Windows,r],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,e.iOS,a],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,e.iOS,a],[/cfnetwork\/.+darwin/i,e.iOS,a],[/mac os x ?([\w. ]*)/i,e.MacOS,a],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,e.MacOS,a],[/droid ([\w.]+)\b.+(android[- ]x86)/i,e.Android],[/android\w*[-\/.; ]?([\d.]*)/i,e.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]],w=[[/\b(?:crmo|crios)\/([\w.]+)/i,o.Chrome],[/webview.+edge\/([\w.]+)/i,o.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,o.Edge],[/opera mini\/([-\w.]+)/i,o.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,o.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,o.Opera],[/opios[\/ ]+([\w.]+)/i,o.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,o.Opera],[/\bopr\/([\w.]+)/i,o.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,o.IE],[/(?:ms|\()ie ([\w.]+)/i,o.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,o.IE],[/\bfocus\/([\w.]+)/i,o.Firefox],[/\bopt\/([\w.]+)/i,o.Opera],[/coast\/([\w.]+)/i,o.Opera],[/fxios\/([\w.-]+)/i,o.Firefox],[/samsungbrowser\/([\w.]+)/i,o.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,o.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,o.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,o.Chrome],[/chrome\/([\w.]+) mobile/i,o.Chrome],[/chrome\/v?([\w.]+)/i,o.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,o.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,o.Safari],[/version\/([\w.,]+) .*safari/i,o.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,o.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,o.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,o.Firefox],[/firefox\/([\w.]+)/i,o.Firefox]],c=(i.Unknown,e.Unknown),f="";n.Unknown,o.Unknown;for(var p=0;p<d.length;p++){var m=(h=d[p])[0],b=h[1],u=h[2];if(null!==(g=t.match(m))){c=b,f=s(g[1],u),b===e.iOS||b===e.Android?i.Mobile:b!==e.Windows&&b!==e.MacOS||i.Desktop;break}}for(p=0;p<l.length;p++){m=(h=l[p])[0];h[1];u=h[2];if(null!==(g=t.match(m))){s(g[1],u);break}}for(p=0;p<w.length;p++){var h;m=(h=w[p])[0];h[1];var g;u=h[2];if(null!==(g=t.match(m))){s(g[1],u);break}}function v(i){var n,o=function(){try{if(globalThis.top&&globalThis.top!==window)return globalThis.top.location.href,globalThis.top}catch(e){}return window}(),t=o.document;try{if((n=function(e,i){void 0===i&&(i=!0);var n=globalThis.document.createElement(e);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),i?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}("input")).type="file",n.tabIndex=-1,n.accept=i+"/*","capture"in HTMLInputElement.prototype)n.capture="user";else if(c===e.Android){var r="";"image"===i?r="camera":"video"===i&&(r="camcorder"),n.accept=i+"/*;capture="+r}t.body.appendChild(n),function(e,i){var n;void 0===i&&(i=window);try{n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:i})}catch(e){(n=globalThis.document.createEvent("MouseEvents")).initMouseEvent("click",!0,!0,i,0,0,0,0,0,!1,!1,!1,!1,0,null)}e.dispatchEvent(n)}(n,o)}catch(e){}}!function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var i=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===i)return"";if(i instanceof WebGLRenderingContext||"getParameter"in i&&"function"==typeof i.getParameter){var n=i.getExtension("WEBGL_debug_renderer_info");return null===n?i.getParameter(i.RENDERER):i.getParameter(n.UNMASKED_RENDERER_WEBGL)}}(),i.Mobile,i.Desktop,"matchMedia"in globalThis&&(c===e.iOS?"standalone"in navigator&&navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches);var k,T={open:function(i){switch(c){case e.Android:v(i);break;case e.iOS:(function(e,i){for(var n=e.split("."),o=i.split("."),t=Math.max(n.length,o.length),r=0;r<t;r++){var a=void 0,s=void 0;if((a=r<n.length?parseInt(n[r],10):0)>(s=r<o.length?parseInt(o[r],10):0))return 1;if(a<s)return-1}return 0})(f,"10.3")>=0?v(i):alert(f);case e.Windows:case e.MacOS:}}};return function(e){e.Image="image",e.Video="video"}(k||(k={})),{installed:!1,name:"Camera",module:T,Constants:{CameraType:k},Errors:{}}}));
1
+ !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e="undefined"!=typeof globalThis?globalThis:e||self).Camera=i()}(this,(function(){"use strict";var e,i,o,n;!function(e){e.Unknown="Unknown",e.Android="Android",e.iOS="iOS",e.Windows="Windows",e.MacOS="MacOS"}(e||(e={})),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"}(o||(o={})),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"}(n||(n={}));var r={device:i.Unknown,os:e.Unknown,osVersion:"",engine:o.Unknown,engineVersion:"",browser:n.Unknown,browserVersion:"",renderer:function(){if(void 0===globalThis.document)return"";var e=globalThis.document.createElement("canvas");if("function"!=typeof e.getContext)return"";var i=e.getContext("webgl2")||e.getContext("experimental-webgl")||e.getContext("webgl");if(null===i)return"";if(i instanceof WebGLRenderingContext||"getParameter"in i&&"function"==typeof i.getParameter){var o=i.getExtension("WEBGL_debug_renderer_info");return null===o?i.getParameter(i.RENDERER):i.getParameter(o.UNMASKED_RENDERER_WEBGL)}return""}(),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},t=[[/windows nt (6\.[23]); arm/i,e.Windows,l],[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i,e.Windows,l],[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i,e.Windows,l],[/windows nt ?([\d.)]*)(?!.+xbox)/i,e.Windows,l],[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i,e.Windows,l],[/windows ce\/?([\d.]*)/i,e.Windows,l],[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i,e.iOS,d],[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i,e.iOS,d],[/cfnetwork\/.+darwin/i,e.iOS,d],[/mac os x ?([\w. ]*)/i,e.MacOS,d],[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i,e.MacOS,d],[/droid ([\w.]+)\b.+(android[- ]x86)/i,e.Android],[/android\w*[-\/.; ]?([\d.]*)/i,e.Android]],a=[[/windows.+ edge\/([\w.]+)/i,o.EdgeHTML],[/arkweb\/([\w.]+)/i,o.ArkWeb],[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i,o.Blink],[/presto\/([\w.]+)/i,o.Presto],[/webkit\/([\w.]+)/i,o.WebKit],[/trident\/([\w.]+)/i,o.Trident],[/netfront\/([\w.]+)/i,o.NetFront],[/khtml[\/ ]\(?([\w.]+)/i,o.KHTML],[/tasman[\/ ]\(?([\w.]+)/i,o.Tasman],[/rv:([\w.]{1,9})\b.+gecko/i,o.Gecko]],s=[[/\b(?:crmo|crios)\/([\w.]+)/i,n.Chrome],[/webview.+edge\/([\w.]+)/i,n.Edge],[/edg(?:e|ios|a)?\/([\w.]+)/i,n.Edge],[/opera mini\/([-\w.]+)/i,n.Opera],[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i,n.Opera],[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i,n.Opera],[/opios[\/ ]+([\w.]+)/i,n.Opera],[/\bop(?:rg)?x\/([\w.]+)/i,n.Opera],[/\bopr\/([\w.]+)/i,n.Opera],[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i,n.IE],[/(?:ms|\()ie ([\w.]+)/i,n.IE],[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i,n.IE],[/\bfocus\/([\w.]+)/i,n.Firefox],[/\bopt\/([\w.]+)/i,n.Opera],[/coast\/([\w.]+)/i,n.Opera],[/fxios\/([\w.-]+)/i,n.Firefox],[/samsungbrowser\/([\w.]+)/i,n.SamsungInternet],[/headlesschrome(?:\/([\w.]+)| )/i,n.Chrome],[/wv\).+chrome\/([\w.]+).+edgw\//i,n.Edge],[/ wv\).+(chrome)\/([\w.]+)/i,n.Chrome],[/chrome\/([\w.]+) mobile/i,n.Chrome],[/chrome\/v?([\w.]+)/i,n.Chrome],[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i,n.Safari],[/iphone .*mobile(?:\/\w+ | ?)safari/i,n.Safari],[/version\/([\w.,]+) .*safari/i,n.Safari],[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i,n.Safari,"1"],[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i,n.Firefox],[/mobile vr; rv:([\w.]+)\).+firefox/i,n.Firefox],[/firefox\/([\w.]+)/i,n.Firefox]];function l(e){if(void 0===e)return"";var i={"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!==i?i:e}function d(e){return void 0===e?"":e.replace(/_/g,".")}function m(e,i){return"function"==typeof i?i(e):"string"==typeof i?i:void 0===e?"":e}for(var c=0;c<t.length;c++){var u=(p=t[c])[0],w=p[1],b=p[2];if(null!==(g=r.userAgent.match(u))){r.os=w,r.osVersion=m(g[1],b),w===e.iOS||w===e.Android?r.device=i.Mobile:w!==e.Windows&&w!==e.MacOS||(r.device=i.Desktop);break}}for(c=0;c<a.length;c++){u=(p=a[c])[0];var f=p[1];b=p[2];if(null!==(g=r.userAgent.match(u))){r.engine=f,r.engineVersion=m(g[1],b);break}}for(c=0;c<s.length;c++){u=(p=s[c])[0];var p,g,h=p[1];b=p[2];if(null!==(g=r.userAgent.match(u))){r.browser=h,r.browserVersion=m(g[1],b);break}}function v(i){var o,n=function(){try{if(globalThis.top&&globalThis.top!==window)return globalThis.top.location.href,globalThis.top}catch(e){}return window}(),t=n.document;try{if(void 0===(o=function(e,i){if(void 0===i&&(i=!0),void 0!==globalThis.document){var o=globalThis.document.createElement(e);return"width"in o&&(o.width="0"),"height"in o&&(o.height="0"),"border"in o&&(o.border="0"),"frameBorder"in o&&(o.frameBorder="0"),"scrolling"in o&&(o.scrolling="no"),"cellPadding"in o&&(o.cellPadding="0"),"cellSpacing"in o&&(o.cellSpacing="0"),"frame"in o&&(o.frame="void"),"rules"in o&&(o.rules="none"),"noWrap"in o&&(o.noWrap=!0),o.tabIndex=-1,o.setAttribute("role","presentation"),i?(o.style.width="1px",o.style.height="1px"):(o.setAttribute("aria-hidden","true"),o.style.width="0",o.style.height="0",o.style.zIndex="-9999",o.style.display="none",o.style.visibility="hidden",o.style.pointerEvents="none"),o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.padding="0",o.style.margin="0",o.style.border="none",o.style.outline="none",o.style.clip="rect(1px, 1px, 1px, 1px)",o.style.clipPath="inset(50%)",o.style.overflow="hidden",o.style.whiteSpace="nowrap",o}}("input")))return;if(o.type="file",o.tabIndex=-1,o.accept=i+"/*","capture"in HTMLInputElement.prototype)o.capture="user";else if(r.os===e.Android){var a="";"image"===i?a="camera":"video"===i&&(a="camcorder"),o.accept=i+"/*;capture="+a}t.body.appendChild(o),function(e,i){var o;void 0===i&&(i=window);try{o=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:i})}catch(e){(o=globalThis.document.createEvent("MouseEvents")).initMouseEvent("click",!0,!0,i,0,0,0,0,0,!1,!1,!1,!1,0,null)}e.dispatchEvent(o)}(o,n)}catch(e){}}r.isNodeJS&&function(e){if("require"in globalThis&&"function"==typeof globalThis.require)try{return Promise.resolve(globalThis.require(e))}catch(e){return Promise.resolve(null)}try{return import(e).then((function(e){return e.default||e})).catch((function(){return Promise.resolve(null)}))}catch(e){return Promise.resolve(null)}}("os").then((function(i){if(null!==i){var o,n=i.platform(),t=i.release(),a=(o=t.split("."),{major:parseInt(o[0]||"0"),minor:parseInt(o[1]||"0"),build:parseInt(o[2]||"0")});switch(n){case"win32":r.os=e.Windows,r.osVersion=10===a.major&&0===a.minor&&a.build>=22e3?"11":10===a.major&&0===a.minor&&a.build<22e3?"10":6===a.major&&3===a.minor?"8.1":6===a.major&&2===a.minor?"8":6===a.major&&1===a.minor?"7":6===a.major&&0===a.minor?"Vista":5===a.major&&1===a.minor||5===a.major&&2===a.minor?"XP":5===a.major&&0===a.minor?"2000":4===a.major&&90===a.minor?"ME":4===a.major&&0===a.minor?"NT 4.0":3===a.major&&51===a.minor?"NT 3.11":t;break;case"darwin":r.os=e.MacOS,r.osVersion=a.major>=24?a.major-9+"."+a.minor+"."+a.build:23===a.major?"14."+a.minor+"."+a.build:22===a.major?"13."+a.minor+"."+a.build:21===a.major?"12."+a.minor+"."+a.build:20===a.major?"11."+a.minor+"."+a.build:19===a.major?"10.15."+a.minor:18===a.major?"10.14."+a.minor:17===a.major?"10.13."+a.minor:16===a.major?"10.12."+a.minor:15===a.major?"10.11."+a.minor:14===a.major?"10.10."+a.minor:13===a.major?"10.9."+a.minor:a.major>=5&&a.major<=12?"10."+(a.major-4)+"."+a.minor:t;break;case"android":r.os=e.Android,r.osVersion=t;break;case"linux":/android/i.test(t)&&(r.os=e.Android,r.osVersion=t)}}})),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(i){for(var o,n=i.fullVersionList||i.brands||[],t=i.platformVersion,a=0;a<n.length;a++){var s=null==(o=n[a])?{brand:"",version:""}:"string"==typeof o?{brand:o,version:""}:{brand:o.brand,version:o.version},l=s.brand,d=s.version;/not.a.brand/i.test(l)||"Chromium"===l&&(r.engineVersion=d)}"string"==typeof t&&(r.os===e.Windows&&parseInt(t.replace(/[^\d.]/g,"").split(".")[0],10)>=13?r.osVersion="11":r.osVersion=t)})),r.isMobile=r.device===i.Mobile,r.isDesktop=r.device===i.Desktop,r.isWebview=/; ?wv|applewebkit(?!.*safari)/i.test(r.userAgent),r.isStandalone=function(i){return"matchMedia"in globalThis&&(i===e.iOS?"standalone"in navigator&&!!navigator.standalone:globalThis.matchMedia("(display-mode: standalone)").matches)}(r.os);var T,k={open:function(i){switch(r.os){case e.Android:v(i);break;case e.iOS:(function(e,i){for(var o=e.split("."),n=i.split("."),r=Math.max(o.length,n.length),t=0;t<r;t++){var a=void 0,s=void 0;if((a=t<o.length?parseInt(o[t],10):0)>(s=t<n.length?parseInt(n[t],10):0))return 1;if(a<s)return-1}return 0})(r.osVersion,"10.3")>=0?v(i):alert(r.osVersion);case e.Windows:case e.MacOS:}}};return function(e){e.Image="image",e.Video="video"}(T||(T={})),{installed:!1,name:"Camera",module:k,Constants:{CameraType:T},Errors:{}}}));
@@ -1,3 +1,4 @@
1
+ import { PlatformInstance } from "../types/platform";
1
2
  declare global {
2
3
  interface Navigator {
3
4
  userAgentData?: UserAgentData;
@@ -51,16 +52,5 @@ export declare enum Browsers {
51
52
  IE = "IE",
52
53
  SamsungInternet = "SamsungInternet"
53
54
  }
54
- export declare let DEVICE_NAME: Devices;
55
- export declare let OS_NAME: OS;
56
- export declare let OS_VERSION: string;
57
- export declare let ENGINE_NAME: Engines;
58
- export declare let ENGINE_VERSION: string;
59
- export declare let BROWSER_NAME: Browsers;
60
- export declare let BROWSER_VERSION: string;
61
- export declare const RENDERER: string;
62
- export declare const IS_WEBVIEW: boolean;
63
- export declare const IS_MOBILE: boolean;
64
- export declare const IS_DESKTOP: boolean;
65
- export declare const IS_STANDALONE: boolean;
66
- export {};
55
+ declare const Platform: PlatformInstance;
56
+ export default Platform;
@@ -20,6 +20,10 @@ export declare interface MacOSAppInfo extends AppInfo {
20
20
  bundleId?: string;
21
21
  trackId?: string;
22
22
  }
23
+ export declare interface StoreInfo {
24
+ appStore?: string;
25
+ webStore?: string;
26
+ }
23
27
  export declare interface AppOpenOptions {
24
28
  [OS.Android]?: AndroidAppInfo;
25
29
  [OS.iOS]?: IOSAppInfo;
@@ -0,0 +1,17 @@
1
+ import { Browsers, Devices, Engines, OS } from "../constants/platform";
2
+ export declare interface PlatformInstance {
3
+ os: OS;
4
+ device: Devices;
5
+ engine: Engines;
6
+ browser: Browsers;
7
+ osVersion: string;
8
+ engineVersion: string;
9
+ browserVersion: string;
10
+ renderer: string;
11
+ userAgent: string;
12
+ isWebview: boolean;
13
+ isStandalone: boolean;
14
+ isMobile: boolean;
15
+ isDesktop: boolean;
16
+ isNodeJS: boolean;
17
+ }
@@ -1 +1 @@
1
- export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K];
1
+ export default function createHiddenElement<K extends keyof HTMLElementTagNameMap>(tagName: K, focusable?: boolean): HTMLElementTagNameMap[K] | undefined;
@@ -2,6 +2,8 @@
2
2
 
3
3
  function createHiddenElement(tagName, focusable) {
4
4
  if (focusable === void 0) { focusable = true; }
5
+ if (typeof globalThis.document === 'undefined')
6
+ return undefined;
5
7
  var element = globalThis.document.createElement(tagName);
6
8
  if ('width' in element)
7
9
  element.width = '0';
@@ -293,6 +295,8 @@ function copyViaSelection(text) {
293
295
  if (!globalThis.getSelection || !globalThis.document.createRange)
294
296
  return false;
295
297
  var div = createHiddenElement('div');
298
+ if (div === undefined)
299
+ return false;
296
300
  div.contentEditable = 'true';
297
301
  div.innerHTML = text;
298
302
  div.style.whiteSpace = 'pre';
@@ -416,6 +420,8 @@ function pasteViaClipboardAPI() {
416
420
  }
417
421
  function pasteViaSelection() {
418
422
  var div = createHiddenElement('div');
423
+ if (div === undefined)
424
+ return null;
419
425
  div.contentEditable = 'true';
420
426
  globalThis.document.body.appendChild(div);
421
427
  div.focus();
@@ -1 +1 @@
1
- "use strict";function t(t,e){void 0===e&&(e=!0);var n=globalThis.document.createElement(t);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),e?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}function e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r="",o=0;o<e.length-2;o++){var i=e[o];void 0!==i&&(r=r+i.charAt(0).toUpperCase()+i.slice(1))}return r}function n(){this.returnValue=!1}function r(){this.cancelBubble=!0}var o=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,i=["","webkit","moz","ms","MS","o","O"],a={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},l={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(t,e){void 0===e&&(e={callback:null,options:!1});var o=e.callback;if(void 0!==t&&null!==o){var i=l.withVender(t,e.type),a=e.options;if("function"==typeof t.addEventListener)try{return t.addEventListener(i,o,a)}catch(t){}if("function"==typeof t.addListener)if("boolean"==typeof t.matches)try{return t.addListener(o)}catch(t){}else try{return t.addListener(i,o)}catch(t){}return"function"==typeof t.attachEvent?o.__ieWrapper?t.attachEvent("on"+i,o.__ieWrapper):t.attachEvent("on"+i,o.__ieWrapper=function(e){void 0===e&&(e=globalThis.event),void 0!==e&&(e.currentTarget=t,"function"!=typeof e.preventDefault&&(e.preventDefault=n),"function"!=typeof e.stopPropagation&&(e.stopPropagation=r),"function"==typeof o?o.call(t,e):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(t,e))}):void 0}},remove:function(t,e){void 0===e&&(e={callback:null,options:!1});var n=e.callback;if(void 0!==t&&null!==n){var r=l.withVender(t,e.type),o=e.options;if("function"==typeof t.removeEventListener)try{return t.removeEventListener(r,n,o)}catch(t){}if("function"==typeof t.removeListener)if("boolean"==typeof t.matches)try{return t.removeListener(n)}catch(t){}else try{return t.removeListener(r,n)}catch(t){}if("function"!=typeof t.detachEvent);else{var i=n.__ieWrapper;void 0!==i&&(t.detachEvent("on"+r,i),delete n.__ieWrapper)}}},withVender:function(t,n){if(void 0===n)return"";if("webkitEnterFullscreen"in t&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(n)>-1)return n;var r;r=n in a?a[n]:o.test(n)?[n,n.replace(o,e)]:[n];for(var l=0;l<i.length;l++)for(var c=0;c<r.length;c++){var u=i[l]+r[c];if(void 0!==t["on"+u])return u}return""}};function c(t){return null!==t&&"object"==typeof t}function u(t){return c(t)||function(t){return Array.isArray(t)}(t)}function s(t){if(function(t){return c(t)&&"innerHTML"in t}(t))return t.innerHTML;if(u(t))try{return JSON.stringify(t)}catch(e){return""+t}else if("string"!=typeof t)return""+t;return t}function d(){return function(){if("isSecureContext"in window)return globalThis.isSecureContext;var t=location.protocol,e=location.hostname;return"https:"===t||"localhost"===e||"127.0.0.1"===e||"[::1]"===e}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function p(e){return function(e){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var n=t("div");n.contentEditable="true",n.innerHTML=e,n.style.whiteSpace="pre",n.style.userSelect="text",n.style.setProperty("-webkit-user-select","text"),n.style.setProperty("-moz-user-select","text"),n.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(n);var r=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(t){try{null!==t.clipboardData&&"function"==typeof t.clipboardData.setData&&(t.preventDefault(),t.clipboardData.setData("text/html",e),t.clipboardData.setData("text/plain",e))}catch(t){}};l.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===r)return h(n,r,i),!1;r.removeAllRanges(),o.selectNodeContents(n),r.addRange(o);var a=globalThis.document.execCommand("copy");return h(n,r,i),a}catch(t){return h(n,r,i),!1}}(e)||function(t){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.setData)try{return e.setData("Text",t)}catch(t){return!1}return!1}(e)}function f(){return function(){var e=t("div");e.contentEditable="true",globalThis.document.body.appendChild(e),e.focus();var n=null,r=function(t){try{null!==t.clipboardData&&"function"==typeof t.clipboardData.getData&&(t.preventDefault(),n=t.clipboardData.getData("text/html")||t.clipboardData.getData("text/plain")||null)}catch(t){}};l.add(globalThis.document,{type:"paste",callback:r,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||n||(n=e.innerHTML||e.textContent||null),v(e,r),n}catch(t){return v(e,r),null}}()||function(){var t=window.clipboardData;if(void 0!==t&&"function"==typeof t.getData)try{return t.getData("Text")||null}catch(t){return null}return null}()||""}function h(t,e,n){null!==e&&e.removeAllRanges(),globalThis.document.body.removeChild(t),l.remove(globalThis.document,{type:"copy",callback:n})}function v(t,e){globalThis.document.body.removeChild(t),l.remove(globalThis.document,{type:"paste",callback:e})}var b={installed:!1,name:"Clipboard",module:{copy:function(t){var e=s(t);return d()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard)?function(t){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(t).then((function(){return!0})).catch((function(){return!1}))}catch(t){return Promise.resolve(!1)}return Promise.resolve(!1)}(e).then((function(t){return!!t||p(e)})).catch((function(){return p(e)})):Promise.resolve(p(e))},paste:function(){return d()&&("read"in navigator.clipboard||"readText"in navigator.clipboard)?function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(t){if(0===t.length)return Promise.resolve(null);for(var e=t[0],n=e.types,r=0;r<n.length;r++)if("text/html"===n[r])return e.getType("text/html").then((function(t){return t.text()})).catch((function(){return null}));for(r=0;r<n.length;r++)if("text/plain"===n[r])return e.getType("text/plain").then((function(t){return t.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(t){return t})).catch((function(){return null}))}catch(t){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(t){return null!==t?t:f()})).catch((function(){return f()})):Promise.resolve(f())}},Constants:{},Errors:{}};module.exports=b;
1
+ "use strict";function t(t,e){if(void 0===e&&(e=!0),void 0!==globalThis.document){var n=globalThis.document.createElement(t);return"width"in n&&(n.width="0"),"height"in n&&(n.height="0"),"border"in n&&(n.border="0"),"frameBorder"in n&&(n.frameBorder="0"),"scrolling"in n&&(n.scrolling="no"),"cellPadding"in n&&(n.cellPadding="0"),"cellSpacing"in n&&(n.cellSpacing="0"),"frame"in n&&(n.frame="void"),"rules"in n&&(n.rules="none"),"noWrap"in n&&(n.noWrap=!0),n.tabIndex=-1,n.setAttribute("role","presentation"),e?(n.style.width="1px",n.style.height="1px"):(n.setAttribute("aria-hidden","true"),n.style.width="0",n.style.height="0",n.style.zIndex="-9999",n.style.display="none",n.style.visibility="hidden",n.style.pointerEvents="none"),n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.padding="0",n.style.margin="0",n.style.border="none",n.style.outline="none",n.style.clip="rect(1px, 1px, 1px, 1px)",n.style.clipPath="inset(50%)",n.style.overflow="hidden",n.style.whiteSpace="nowrap",n}}function e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r="",o=0;o<e.length-2;o++){var i=e[o];void 0!==i&&(r=r+i.charAt(0).toUpperCase()+i.slice(1))}return r}function n(){this.returnValue=!1}function r(){this.cancelBubble=!0}var o=/(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i,i=["","webkit","moz","ms","MS","o","O"],a={wheel:["wheel","mousewheel","DOMMouseScroll"],focus:["focus","focusin"],blur:["blur","focusout"],beforeinput:["beforeinput","textInput"]},l={useStd:void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener,add:function(t,e){void 0===e&&(e={callback:null,options:!1});var o=e.callback;if(void 0!==t&&null!==o){var i=l.withVender(t,e.type),a=e.options;if("function"==typeof t.addEventListener)try{return t.addEventListener(i,o,a)}catch(t){}if("function"==typeof t.addListener)if("boolean"==typeof t.matches)try{return t.addListener(o)}catch(t){}else try{return t.addListener(i,o)}catch(t){}return"function"==typeof t.attachEvent?o.__ieWrapper?t.attachEvent("on"+i,o.__ieWrapper):t.attachEvent("on"+i,o.__ieWrapper=function(e){void 0===e&&(e=globalThis.event),void 0!==e&&(e.currentTarget=t,"function"!=typeof e.preventDefault&&(e.preventDefault=n),"function"!=typeof e.stopPropagation&&(e.stopPropagation=r),"function"==typeof o?o.call(t,e):o&&"function"==typeof o.handleEvent&&o.handleEvent.call(t,e))}):void 0}},remove:function(t,e){void 0===e&&(e={callback:null,options:!1});var n=e.callback;if(void 0!==t&&null!==n){var r=l.withVender(t,e.type),o=e.options;if("function"==typeof t.removeEventListener)try{return t.removeEventListener(r,n,o)}catch(t){}if("function"==typeof t.removeListener)if("boolean"==typeof t.matches)try{return t.removeListener(n)}catch(t){}else try{return t.removeListener(r,n)}catch(t){}if("function"!=typeof t.detachEvent);else{var i=n.__ieWrapper;void 0!==i&&(t.detachEvent("on"+r,i),delete n.__ieWrapper)}}},withVender:function(t,n){if(void 0===n)return"";if("webkitEnterFullscreen"in t&&["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"].indexOf(n)>-1)return n;var r;r=n in a?a[n]:o.test(n)?[n,n.replace(o,e)]:[n];for(var l=0;l<i.length;l++)for(var c=0;c<r.length;c++){var u=i[l]+r[c];if(void 0!==t["on"+u])return u}return""}};function c(t){return null!==t&&"object"==typeof t}function u(t){return c(t)||function(t){return Array.isArray(t)}(t)}function s(t){if(function(t){return c(t)&&"innerHTML"in t}(t))return t.innerHTML;if(u(t))try{return JSON.stringify(t)}catch(e){return""+t}else if("string"!=typeof t)return""+t;return t}function d(){return function(){if("isSecureContext"in window)return globalThis.isSecureContext;var t=location.protocol,e=location.hostname;return"https:"===t||"localhost"===e||"127.0.0.1"===e||"[::1]"===e}()&&"undefined"!=typeof navigator&&"clipboard"in navigator}function p(e){return function(e){if(!globalThis.getSelection||!globalThis.document.createRange)return!1;var n=t("div");if(void 0===n)return!1;n.contentEditable="true",n.innerHTML=e,n.style.whiteSpace="pre",n.style.userSelect="text",n.style.setProperty("-webkit-user-select","text"),n.style.setProperty("-moz-user-select","text"),n.style.setProperty("-ms-user-select","text"),globalThis.document.body.appendChild(n);var r=globalThis.getSelection(),o=globalThis.document.createRange(),i=function(t){try{null!==t.clipboardData&&"function"==typeof t.clipboardData.setData&&(t.preventDefault(),t.clipboardData.setData("text/html",e),t.clipboardData.setData("text/plain",e))}catch(t){}};l.add(globalThis.document,{type:"copy",callback:i,options:{once:!0,capture:!0}});try{if(null===r)return h(n,r,i),!1;r.removeAllRanges(),o.selectNodeContents(n),r.addRange(o);var a=globalThis.document.execCommand("copy");return h(n,r,i),a}catch(t){return h(n,r,i),!1}}(e)||function(t){var e=window.clipboardData;if(void 0!==e&&"function"==typeof e.setData)try{return e.setData("Text",t)}catch(t){return!1}return!1}(e)}function f(){return function(){var e=t("div");if(void 0===e)return null;e.contentEditable="true",globalThis.document.body.appendChild(e),e.focus();var n=null,r=function(t){try{null!==t.clipboardData&&"function"==typeof t.clipboardData.getData&&(t.preventDefault(),n=t.clipboardData.getData("text/html")||t.clipboardData.getData("text/plain")||null)}catch(t){}};l.add(globalThis.document,{type:"paste",callback:r,options:{once:!0,capture:!0}});try{return globalThis.document.execCommand("paste")||n||(n=e.innerHTML||e.textContent||null),v(e,r),n}catch(t){return v(e,r),null}}()||function(){var t=window.clipboardData;if(void 0!==t&&"function"==typeof t.getData)try{return t.getData("Text")||null}catch(t){return null}return null}()||""}function h(t,e,n){null!==e&&e.removeAllRanges(),globalThis.document.body.removeChild(t),l.remove(globalThis.document,{type:"copy",callback:n})}function v(t,e){globalThis.document.body.removeChild(t),l.remove(globalThis.document,{type:"paste",callback:e})}var b={installed:!1,name:"Clipboard",module:{copy:function(t){var e=s(t);return d()&&("write"in navigator.clipboard||"writeText"in navigator.clipboard)?function(t){try{if("ClipboardItem"in window&&"write"in navigator.clipboard)return navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]).then((function(){return!0})).catch((function(){return!1}));if("writeText"in navigator.clipboard)return navigator.clipboard.writeText(t).then((function(){return!0})).catch((function(){return!1}))}catch(t){return Promise.resolve(!1)}return Promise.resolve(!1)}(e).then((function(t){return!!t||p(e)})).catch((function(){return p(e)})):Promise.resolve(p(e))},paste:function(){return d()&&("read"in navigator.clipboard||"readText"in navigator.clipboard)?function(){try{if("ClipboardItem"in window&&"read"in navigator.clipboard)return navigator.clipboard.read().then((function(t){if(0===t.length)return Promise.resolve(null);for(var e=t[0],n=e.types,r=0;r<n.length;r++)if("text/html"===n[r])return e.getType("text/html").then((function(t){return t.text()})).catch((function(){return null}));for(r=0;r<n.length;r++)if("text/plain"===n[r])return e.getType("text/plain").then((function(t){return t.text()})).catch((function(){return null}));return Promise.resolve(null)})).catch((function(){return null}));if("readText"in navigator.clipboard)return navigator.clipboard.readText().then((function(t){return t})).catch((function(){return null}))}catch(t){return Promise.resolve(null)}return Promise.resolve(null)}().then((function(t){return null!==t?t:f()})).catch((function(){return f()})):Promise.resolve(f())}},Constants:{},Errors:{}};module.exports=b;