web-launch-kit 0.0.3 → 0.0.5

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.
@@ -1,21 +1,34 @@
1
- var version$2 = "0.0.3";
1
+ var version$3 = "0.0.5";
2
+ var packageJSON$3 = {
3
+ version: version$3};
4
+
5
+ var version$2 = "0.0.5";
2
6
  var packageJSON$2 = {
3
7
  version: version$2};
4
8
 
5
- var version$1 = "0.0.4";
6
- var packageJSON$1 = {
7
- version: version$1};
8
-
9
- var NAVIGATOR$1 = globalThis.navigator;
10
- var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgent : '';
11
- var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgentData : undefined;
9
+ function getGlobal$3() {
10
+ if (typeof globalThis !== 'undefined')
11
+ return globalThis;
12
+ if (typeof self !== 'undefined')
13
+ return self;
14
+ if (typeof window !== 'undefined')
15
+ return window;
16
+ if (typeof global !== 'undefined')
17
+ return global;
18
+ return {};
19
+ }
20
+ var GLOBAL$5 = getGlobal$3();
21
+ var NAVIGATOR$1 = GLOBAL$5.navigator;
22
+ var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
23
+ var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
12
24
  var OS_RESOLVER_MAP = [
13
- [/windows nt (6\.[23]); arm/i, 'windows', resolveWindowsVersion],
14
- [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows', resolveWindowsVersion],
15
- [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows', resolveWindowsVersion],
25
+ [/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
26
+ [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
27
+ [/win 9x 4\.90/i, 'windows', 'ME'],
28
+ [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
16
29
  [/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
17
30
  [/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
18
- [/windows ce\/?([\d.]*)/i, 'windows', resolveWindowsVersion],
31
+ [/windows ce\/?([\d.]*)/i, 'windows'],
19
32
  [/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
20
33
  [/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
21
34
  [/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
@@ -44,13 +57,14 @@ var BROWSER_RESOLVER_MAP = [
44
57
  [/samsungbrowser\/([\w.]+)/i, 'samsung'],
45
58
  [/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
46
59
  [/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
47
- [/ wv\).+(chrome)\/([\w.]+)/i, 'chrome'],
60
+ [/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
48
61
  [/chrome\/([\w.]+) mobile/i, 'chrome'],
49
62
  [/chrome\/v?([\w.]+)/i, 'chrome'],
50
63
  [/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
51
64
  [/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
52
65
  [/version\/([\w.,]+) .*safari/i, 'safari'],
53
66
  [/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
67
+ [/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
54
68
  [/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
55
69
  [/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
56
70
  [/firefox\/([\w.]+)/i, 'firefox'],
@@ -67,6 +81,18 @@ var ENGINE_RESOLVER_MAP = [
67
81
  [/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
68
82
  [/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
69
83
  ];
84
+ var IN_APP_BROWSER_RESOLVER_MAP = [
85
+ [/kakaotalk/i, 'kakaotalk'],
86
+ [/\bline\/[\d.]/i, 'line'],
87
+ [/instagram/i, 'instagram'],
88
+ [/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
89
+ [/naver\(inapp/i, 'naver'],
90
+ [/daumapps/i, 'daum'],
91
+ [/\bband\/[\d.]/i, 'band'],
92
+ [/micromessenger/i, 'wechat'],
93
+ [/twitter for|twitterandroid/i, 'twitter'],
94
+ [/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
95
+ ];
70
96
  var HIGH_ENTROPY_BRAND_NAME_MAP = {
71
97
  'Google Chrome': 'Chrome',
72
98
  'Microsoft Edge': 'Edge',
@@ -89,19 +115,18 @@ function resolveWindowsVersion(string) {
89
115
  return '';
90
116
  var mapped = {
91
117
  '4.90': 'ME',
92
- 'NT3.51': 'NT 3.11',
93
- 'NT4.0': 'NT 4.0',
94
- 'NT 5.0': '2000',
95
- 'NT 5.1': 'XP',
96
- 'NT 5.2': 'XP',
97
- 'NT 6.0': 'Vista',
98
- 'NT 6.1': '7',
99
- 'NT 6.2': '8',
100
- 'NT 6.3': '8.1',
101
- 'NT 6.4': '10',
102
- 'NT 10.0': '10',
103
- 'ARM': 'RT'
104
- }[string];
118
+ '3.51': 'NT 3.51',
119
+ '4.0': 'NT 4.0',
120
+ '5.0': '2000',
121
+ '5.1': 'XP',
122
+ '5.2': 'XP',
123
+ '6.0': 'Vista',
124
+ '6.1': '7',
125
+ '6.2': '8',
126
+ '6.3': '8.1',
127
+ '6.4': '10',
128
+ '10.0': '10'
129
+ }[string.replace(/[^\d.]/g, '')];
105
130
  if (typeof mapped !== 'undefined')
106
131
  return mapped;
107
132
  return string;
@@ -120,6 +145,28 @@ function resolveVersion(string, resolver) {
120
145
  return '';
121
146
  return string;
122
147
  }
148
+ function compareVersion(lhs, rhs) {
149
+ var pa = lhs.split('.');
150
+ var pb = rhs.split('.');
151
+ var length = Math.max(pa.length, pb.length);
152
+ for (var i = 0; i < length; i++) {
153
+ var a = void 0;
154
+ var b = void 0;
155
+ if (i < pa.length)
156
+ a = parseInt(pa[i], 10);
157
+ else
158
+ a = 0;
159
+ if (i < pb.length)
160
+ b = parseInt(pb[i], 10);
161
+ else
162
+ b = 0;
163
+ if (a > b)
164
+ return 1;
165
+ if (a < b)
166
+ return -1;
167
+ }
168
+ return 0;
169
+ }
123
170
  function parseOS() {
124
171
  var name = 'unknown';
125
172
  var version = '';
@@ -132,7 +179,7 @@ function parseOS() {
132
179
  break;
133
180
  }
134
181
  }
135
- if (name === 'ios' && PlatformKit.compareVersion(version, '18.6') === 0) {
182
+ if (name === 'ios' && compareVersion(version, '18.6') === 0) {
136
183
  var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
137
184
  if (execs !== null) {
138
185
  var major = parseInt(execs[1].split('.')[0], 10);
@@ -145,7 +192,7 @@ function parseOS() {
145
192
  name = parsedFromHighEntropyValuesOSName;
146
193
  if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
147
194
  version = parsedFromHighEntropyValuesOSVersion;
148
- if (name === 'macos' && typeof globalThis.navigator.standalone !== 'undefined' && typeof globalThis.navigator.maxTouchPoints !== 'undefined' && globalThis.navigator.maxTouchPoints > 2)
195
+ if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
149
196
  name = 'ios';
150
197
  }
151
198
  return {
@@ -197,6 +244,39 @@ function parseEngine() {
197
244
  version: version
198
245
  };
199
246
  }
247
+ function parseInAppBrowser() {
248
+ for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
249
+ if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
250
+ return IN_APP_BROWSER_RESOLVER_MAP[i][1];
251
+ }
252
+ return null;
253
+ }
254
+ function parseWebview() {
255
+ if (/; ?wv\)/i.test(currentUserAgent))
256
+ return true;
257
+ if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
258
+ return true;
259
+ if (/\belectron\//i.test(currentUserAgent))
260
+ return true;
261
+ if (/iphone|ipad|ipod/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
262
+ return true;
263
+ return parseInAppBrowser() !== null;
264
+ }
265
+ function parseDevice() {
266
+ if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
267
+ return parsedFromHighEntropyValuesDevice;
268
+ var osName = getParsedCache().os.name;
269
+ if (osName === 'ios') {
270
+ if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
271
+ return 'tablet';
272
+ return 'mobile';
273
+ }
274
+ if (osName === 'android')
275
+ return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
276
+ if (osName === 'windows' || osName === 'macos')
277
+ return 'desktop';
278
+ return 'unknown';
279
+ }
200
280
  function getParsedCache() {
201
281
  if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
202
282
  return parsedCache;
@@ -224,11 +304,31 @@ function normalizeBrand(entry) {
224
304
  return { brand: entry, version: '' };
225
305
  return { brand: entry.brand, version: entry.version };
226
306
  }
307
+ function resolvedThenable() {
308
+ if (typeof Promise === 'function')
309
+ return Promise.resolve();
310
+ var thenable = {
311
+ then: function (onFulfilled) {
312
+ if (typeof onFulfilled === 'function')
313
+ onFulfilled(undefined);
314
+ return thenable;
315
+ },
316
+ catch: function () {
317
+ return thenable;
318
+ },
319
+ finally: function (onFinally) {
320
+ if (typeof onFinally === 'function')
321
+ onFinally();
322
+ return thenable;
323
+ },
324
+ };
325
+ return thenable;
326
+ }
227
327
  function parseFromHighEntropyValues() {
228
328
  if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
229
- return Promise.resolve();
329
+ return resolvedThenable();
230
330
  return USER_AGENT_DATA
231
- .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
331
+ .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
232
332
  .then(function (result) {
233
333
  try {
234
334
  var brands = result.fullVersionList || result.brands || [];
@@ -281,12 +381,26 @@ function parseFromHighEntropyValues() {
281
381
  else if (/macos|macintel/i.test(platform))
282
382
  parsedFromHighEntropyValuesOSName = 'macos';
283
383
  }
284
- if (result.mobile === true)
384
+ var formFactors = result.formFactors;
385
+ if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
386
+ for (var i = 0; i < formFactors.length; i++) {
387
+ var formFactor = String(formFactors[i]).toLowerCase();
388
+ if (formFactor === 'tablet')
389
+ parsedFromHighEntropyValuesDevice = 'tablet';
390
+ else if (formFactor === 'mobile')
391
+ parsedFromHighEntropyValuesDevice = 'mobile';
392
+ else if (formFactor === 'desktop')
393
+ parsedFromHighEntropyValuesDevice = 'desktop';
394
+ }
395
+ }
396
+ if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
285
397
  parsedFromHighEntropyValuesDevice = 'mobile';
286
- parsedCache = null;
287
398
  }
288
399
  catch (_) {
289
400
  }
401
+ finally {
402
+ parsedCache = null;
403
+ }
290
404
  })
291
405
  .catch(function () {
292
406
  parsedCache = null;
@@ -294,15 +408,29 @@ function parseFromHighEntropyValues() {
294
408
  }
295
409
  ready = parseFromHighEntropyValues();
296
410
  var PlatformKit = {
297
- version: packageJSON$1.version,
411
+ version: packageJSON$2.version,
298
412
  get ready() {
299
413
  return ready;
300
414
  },
415
+ whenReady: function (callback) {
416
+ if (typeof callback !== 'function')
417
+ return;
418
+ ready.then(function () {
419
+ callback();
420
+ });
421
+ },
301
422
  set userAgent(userAgent) {
302
423
  if (currentUserAgent === userAgent)
303
424
  return;
304
425
  currentUserAgent = userAgent;
305
426
  invalidateCache();
427
+ ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
428
+ },
429
+ reset: function () {
430
+ if (currentUserAgent === USER_AGENT)
431
+ return;
432
+ currentUserAgent = USER_AGENT;
433
+ invalidateCache();
306
434
  ready = parseFromHighEntropyValues();
307
435
  },
308
436
  get userAgent() {
@@ -318,65 +446,59 @@ var PlatformKit = {
318
446
  return getParsedCache().engine;
319
447
  },
320
448
  get device() {
321
- if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
322
- return parsedFromHighEntropyValuesDevice;
323
- var osName = getParsedCache().os.name;
324
- if (osName === 'ios' || osName === 'android')
325
- return 'mobile';
326
- if (osName === 'windows' || osName === 'macos')
327
- return 'desktop';
328
- return 'unknown';
449
+ return parseDevice();
329
450
  },
330
451
  get webview() {
331
- return /; ?wv|applewebkit(?!.*safari)/i.test(currentUserAgent);
452
+ return parseWebview();
453
+ },
454
+ get inAppBrowser() {
455
+ return parseInAppBrowser();
332
456
  },
333
457
  get node() {
334
- return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
458
+ var nodeProcess = GLOBAL$5.process;
459
+ return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
335
460
  },
336
461
  get standalone() {
337
462
  var osName = getParsedCache().os.name;
338
463
  if (osName === 'ios')
339
- return globalThis.navigator.standalone === true;
340
- if (typeof globalThis.matchMedia === 'undefined')
464
+ return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
465
+ if (typeof GLOBAL$5.matchMedia !== 'function')
466
+ return false;
467
+ try {
468
+ return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
469
+ }
470
+ catch (_) {
341
471
  return false;
342
- return globalThis.matchMedia('(display-mode: standalone)').matches;
472
+ }
343
473
  },
344
474
  compareVersion: function (lhs, rhs) {
345
- var pa = lhs.split('.');
346
- var pb = rhs.split('.');
347
- var length = Math.max(pa.length, pb.length);
348
- for (var i = 0; i < length; i++) {
349
- var a = void 0;
350
- var b = void 0;
351
- if (i < pa.length)
352
- a = parseInt(pa[i], 10);
353
- else
354
- a = 0;
355
- if (i < pb.length)
356
- b = parseInt(pb[i], 10);
357
- else
358
- b = 0;
359
- if (a > b)
360
- return 1;
361
- if (a < b)
362
- return -1;
363
- }
364
- return 0;
475
+ return compareVersion(lhs, rhs);
365
476
  }
366
477
  };
367
478
 
368
- var version = "0.0.1";
369
- var packageJSON = {
370
- version: version};
479
+ function getGlobal$2() {
480
+ if (typeof globalThis !== 'undefined')
481
+ return globalThis;
482
+ if (typeof self !== 'undefined')
483
+ return self;
484
+ if (typeof window !== 'undefined')
485
+ return window;
486
+ if (typeof global !== 'undefined')
487
+ return global;
488
+ return {};
489
+ }
490
+
491
+ var version$1 = "0.0.3";
492
+ var packageJSON$1 = {
493
+ version: version$1};
371
494
 
495
+ var GLOBAL$3 = getGlobal$2();
372
496
  var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
373
497
  // https://cordova.apache.org/docs/en/latest/cordova/events/events.html
374
498
  var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
375
499
  // iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
376
500
  var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
377
501
  var TYPE_ALIAS_MAP = {
378
- 'focus': ['focus', 'focusin'],
379
- 'blur': ['blur', 'focusout'],
380
502
  'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
381
503
  'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
382
504
  'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
@@ -424,10 +546,10 @@ function hasOnProperty(host, name) {
424
546
  }
425
547
  function probeHosts(target) {
426
548
  var hosts = [target];
427
- if (typeof globalThis.document !== 'undefined' && target !== globalThis.document)
428
- hosts.push(globalThis.document);
429
- if (target !== globalThis)
430
- hosts.push(globalThis);
549
+ if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
550
+ hosts.push(GLOBAL$3.document);
551
+ if (target !== GLOBAL$3)
552
+ hosts.push(GLOBAL$3);
431
553
  return hosts;
432
554
  }
433
555
  function extractVendorPrefix(name) {
@@ -438,9 +560,9 @@ function extractVendorPrefix(name) {
438
560
  return '';
439
561
  }
440
562
  function testStyleSupport(name, styleProperty) {
441
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
563
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
442
564
  return false;
443
- var style = globalThis.document.documentElement.style;
565
+ var style = GLOBAL$3.document.documentElement.style;
444
566
  if (typeof style === 'undefined' || style === null)
445
567
  return false;
446
568
  var prefix = extractVendorPrefix(name);
@@ -452,9 +574,9 @@ function testStyleSupport(name, styleProperty) {
452
574
  return typeof asRecord(style)[property] !== 'undefined';
453
575
  }
454
576
  function testFullscreenSupport(name) {
455
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
577
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
456
578
  return false;
457
- var element = globalThis.document.documentElement;
579
+ var element = GLOBAL$3.document.documentElement;
458
580
  var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
459
581
  if (typeof methods === 'undefined')
460
582
  return false;
@@ -480,7 +602,7 @@ function isEventTypeSupported(target, name) {
480
602
  return false;
481
603
  }
482
604
  function resolveEventType(target, type) {
483
- if (target === globalThis.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
605
+ if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
484
606
  return type;
485
607
  if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
486
608
  return type;
@@ -489,10 +611,10 @@ function resolveEventType(target, type) {
489
611
  if (isEventTypeSupported(target, candidates[i]))
490
612
  return candidates[i];
491
613
  }
614
+ var hosts = probeHosts(target);
492
615
  for (var i = 1; i < VENDORS.length; i++) {
493
616
  for (var j = 0; j < candidates.length; j++) {
494
617
  var name_1 = VENDORS[i] + candidates[j];
495
- var hosts = probeHosts(target);
496
618
  for (var k = 0; k < hosts.length; k++) {
497
619
  if (hasOnProperty(hosts[k], name_1))
498
620
  return name_1;
@@ -502,6 +624,7 @@ function resolveEventType(target, type) {
502
624
  return type;
503
625
  }
504
626
 
627
+ var GLOBAL$2 = getGlobal$2();
505
628
  var SUPPORTED = {
506
629
  once: false,
507
630
  passive: false,
@@ -512,16 +635,16 @@ var SUPPORTED = {
512
635
  var NOOP$1 = function () {
513
636
  };
514
637
  function resolveProbeTarget() {
515
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.createDocumentFragment === 'function') {
638
+ if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
516
639
  try {
517
- return globalThis.document.createDocumentFragment();
640
+ return GLOBAL$2.document.createDocumentFragment();
518
641
  }
519
642
  catch (_) {
520
643
  }
521
644
  }
522
- if (typeof globalThis.EventTarget === 'function') {
645
+ if (typeof GLOBAL$2.EventTarget === 'function') {
523
646
  try {
524
- return new globalThis.EventTarget();
647
+ return new GLOBAL$2.EventTarget();
525
648
  }
526
649
  catch (_) {
527
650
  }
@@ -592,6 +715,7 @@ function toNativeListenerOptions(normalized) {
592
715
  return normalized.capture;
593
716
  }
594
717
 
718
+ var GLOBAL$1$1 = getGlobal$2();
595
719
  var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
596
720
  var POINTER_PHASE_MAP = {
597
721
  'pointerdown': 'start',
@@ -627,17 +751,17 @@ function findTouchIndex(identifier) {
627
751
  return -1;
628
752
  }
629
753
  function scrollOffsetX() {
630
- if (typeof globalThis.pageXOffset === 'number')
631
- return globalThis.pageXOffset;
632
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
633
- return globalThis.document.documentElement.scrollLeft;
754
+ if (typeof GLOBAL$1$1.pageXOffset === 'number')
755
+ return GLOBAL$1$1.pageXOffset;
756
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
757
+ return GLOBAL$1$1.document.documentElement.scrollLeft;
634
758
  return 0;
635
759
  }
636
760
  function scrollOffsetY() {
637
- if (typeof globalThis.pageYOffset === 'number')
638
- return globalThis.pageYOffset;
639
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
640
- return globalThis.document.documentElement.scrollTop;
761
+ if (typeof GLOBAL$1$1.pageYOffset === 'number')
762
+ return GLOBAL$1$1.pageYOffset;
763
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
764
+ return GLOBAL$1$1.document.documentElement.scrollTop;
641
765
  return 0;
642
766
  }
643
767
  function createSyntheticTouch(event, target) {
@@ -658,12 +782,20 @@ function createSyntheticTouch(event, target) {
658
782
  force: typeof event.pressure === 'number' ? event.pressure : 0,
659
783
  };
660
784
  }
661
- function defineTouchList(event, property, list) {
785
+ function defineTouchList(event, property, list, patches) {
786
+ var holder = event;
787
+ var had = false;
788
+ try {
789
+ had = Object.prototype.hasOwnProperty.call(event, property);
790
+ }
791
+ catch (_) {
792
+ }
793
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
662
794
  try {
663
795
  Object.defineProperty(event, property, { value: list, configurable: true });
664
796
  }
665
797
  catch (_) {
666
- event[property] = list;
798
+ holder[property] = list;
667
799
  }
668
800
  }
669
801
  function filterByTarget(touches, target) {
@@ -674,7 +806,7 @@ function filterByTarget(touches, target) {
674
806
  }
675
807
  return filtered;
676
808
  }
677
- function synthesizeTouchEvent(event, resolvedType) {
809
+ function synthesizeTouchEvent(event, resolvedType, patches) {
678
810
  var phase = POINTER_PHASE_MAP[resolvedType];
679
811
  if (typeof phase === 'undefined')
680
812
  return;
@@ -693,9 +825,9 @@ function synthesizeTouchEvent(event, resolvedType) {
693
825
  if (index > -1)
694
826
  ACTIVE_TOUCHES.splice(index, 1);
695
827
  }
696
- defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
697
- defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
698
- defineTouchList(event, 'changedTouches', createTouchList([touch]));
828
+ defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
829
+ defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
830
+ defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
699
831
  }
700
832
 
701
833
  var KEY_CODE_MAP = {
@@ -802,21 +934,48 @@ var KEY_CODE_MAP = {
802
934
  226: 'IntlBackslash',
803
935
  };
804
936
 
937
+ var GLOBAL$4 = getGlobal$2();
805
938
  var LISTENER_STORE = [];
806
939
  var NOOP = function () {
807
940
  };
941
+ var STORE_KEY = '__webEventKitListeners__';
942
+ function resolveBucket(target, create) {
943
+ var holder = target;
944
+ try {
945
+ var existing = holder[STORE_KEY];
946
+ if (typeof existing !== 'undefined' && existing !== null)
947
+ return existing;
948
+ if (!create)
949
+ return LISTENER_STORE;
950
+ var bucket = [];
951
+ try {
952
+ Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
953
+ }
954
+ catch (_) {
955
+ holder[STORE_KEY] = bucket;
956
+ }
957
+ if (holder[STORE_KEY] !== bucket)
958
+ return LISTENER_STORE;
959
+ return bucket;
960
+ }
961
+ catch (_) {
962
+ return LISTENER_STORE;
963
+ }
964
+ }
808
965
  function findListenerRecord(target, type, callback, capture) {
809
- for (var i = 0; i < LISTENER_STORE.length; i++) {
810
- var record = LISTENER_STORE[i];
966
+ var bucket = resolveBucket(target, false);
967
+ for (var i = 0; i < bucket.length; i++) {
968
+ var record = bucket[i];
811
969
  if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
812
970
  return record;
813
971
  }
814
972
  return undefined;
815
973
  }
816
974
  function removeListenerRecord(record) {
817
- for (var i = 0; i < LISTENER_STORE.length; i++) {
818
- if (LISTENER_STORE[i] === record) {
819
- LISTENER_STORE.splice(i, 1);
975
+ var bucket = record.bucket;
976
+ for (var i = 0; i < bucket.length; i++) {
977
+ if (bucket[i] === record) {
978
+ bucket.splice(i, 1);
820
979
  return;
821
980
  }
822
981
  }
@@ -836,6 +995,32 @@ function invokeCallback(callback, target, event) {
836
995
  if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
837
996
  return callback.handleEvent(event);
838
997
  }
998
+ function patchEventProperty(event, property, value, patches) {
999
+ var holder = event;
1000
+ var had = false;
1001
+ try {
1002
+ had = Object.prototype.hasOwnProperty.call(event, property);
1003
+ }
1004
+ catch (_) {
1005
+ }
1006
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
1007
+ defineEventProperty(event, property, value);
1008
+ }
1009
+ function restoreEventProperties(event, patches) {
1010
+ var holder = event;
1011
+ for (var i = patches.length - 1; i >= 0; i--) {
1012
+ var patch = patches[i];
1013
+ try {
1014
+ if (patch.had)
1015
+ defineEventProperty(event, patch.property, patch.previous);
1016
+ else
1017
+ delete holder[patch.property];
1018
+ }
1019
+ catch (_) {
1020
+ }
1021
+ }
1022
+ patches.length = 0;
1023
+ }
839
1024
  function defineEventProperty(event, property, value) {
840
1025
  try {
841
1026
  Object.defineProperty(event, property, { value: value, configurable: true });
@@ -868,7 +1053,7 @@ function fixKeyboardEvent(event) {
868
1053
  function createDispatcher(record) {
869
1054
  return function (event) {
870
1055
  if (typeof event === 'undefined')
871
- event = globalThis.event; // IE: implicit global event object
1056
+ event = GLOBAL$4.event; // IE: implicit global event object
872
1057
  if (typeof event === 'undefined' || event === null)
873
1058
  return;
874
1059
  if (record.released)
@@ -876,14 +1061,20 @@ function createDispatcher(record) {
876
1061
  fixLegacyEvent(event, record.target);
877
1062
  if (record.once)
878
1063
  releaseListenerRecord(record);
1064
+ var patches = [];
879
1065
  if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
880
- event.preventDefault = passivePreventDefault.bind(event);
1066
+ patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
881
1067
  if (record.resolvedType !== record.type)
882
- defineEventProperty(event, 'type', record.type);
1068
+ patchEventProperty(event, 'type', record.type, patches);
883
1069
  if (record.touch)
884
- synthesizeTouchEvent(event, record.resolvedType);
1070
+ synthesizeTouchEvent(event, record.resolvedType, patches);
885
1071
  fixKeyboardEvent(event);
886
- invokeCallback(record.callback, record.target, event);
1072
+ try {
1073
+ invokeCallback(record.callback, record.target, event);
1074
+ }
1075
+ finally {
1076
+ restoreEventProperties(event, patches);
1077
+ }
887
1078
  };
888
1079
  }
889
1080
  function attachNativeListener(record) {
@@ -917,7 +1108,7 @@ function releaseListenerRecord(record) {
917
1108
  }
918
1109
  if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
919
1110
  try {
920
- record.signal.removeEventListener('abort', record.onAbort);
1111
+ record.signal.removeEventListener('abort', record.onAbort, false);
921
1112
  }
922
1113
  catch (_) {
923
1114
  }
@@ -930,7 +1121,7 @@ function createEventPolyfill(type, init) {
930
1121
  }
931
1122
  catch (_) {
932
1123
  }
933
- var event = globalThis.document.createEvent('Event');
1124
+ var event = GLOBAL$4.document.createEvent('Event');
934
1125
  event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
935
1126
  return event;
936
1127
  }
@@ -940,12 +1131,12 @@ function createCustomEventPolyfill(type, init) {
940
1131
  }
941
1132
  catch (_) {
942
1133
  }
943
- var event = globalThis.document.createEvent('CustomEvent');
1134
+ var event = GLOBAL$4.document.createEvent('CustomEvent');
944
1135
  event.initCustomEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true, typeof init !== 'undefined' && typeof init.detail !== 'undefined' ? init.detail : null);
945
1136
  return event;
946
1137
  }
947
1138
  var EventKit = {
948
- version: packageJSON.version,
1139
+ version: packageJSON$1.version,
949
1140
  utils: {
950
1141
  get supportedOptions() {
951
1142
  return {
@@ -969,15 +1160,14 @@ var EventKit = {
969
1160
  return NOOP;
970
1161
  var normalized = normalizeListenerOptions(options);
971
1162
  var existing = findListenerRecord(target, type, callback, normalized.capture);
972
- if (typeof existing !== 'undefined') {
973
- return function () {
974
- releaseListenerRecord(existing);
975
- };
976
- }
1163
+ if (typeof existing !== 'undefined')
1164
+ return NOOP;
977
1165
  if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
978
1166
  return NOOP;
979
1167
  var resolvedType = resolveEventType(target, type);
1168
+ var bucket = resolveBucket(target, true);
980
1169
  var record = {
1170
+ bucket: bucket,
981
1171
  target: target,
982
1172
  type: type,
983
1173
  callback: callback,
@@ -994,12 +1184,12 @@ var EventKit = {
994
1184
  record.wrapper = createDispatcher(record);
995
1185
  if (!attachNativeListener(record))
996
1186
  return NOOP;
997
- LISTENER_STORE.push(record);
1187
+ bucket.push(record);
998
1188
  if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
999
1189
  record.onAbort = function () {
1000
1190
  releaseListenerRecord(record);
1001
1191
  };
1002
- record.signal.addEventListener('abort', record.onAbort, { once: true });
1192
+ record.signal.addEventListener('abort', record.onAbort, false);
1003
1193
  }
1004
1194
  return function () {
1005
1195
  releaseListenerRecord(record);
@@ -1024,9 +1214,22 @@ var EventKit = {
1024
1214
  },
1025
1215
  };
1026
1216
 
1217
+ function getGlobal$1() {
1218
+ if (typeof globalThis !== 'undefined')
1219
+ return globalThis;
1220
+ if (typeof self !== 'undefined')
1221
+ return self;
1222
+ if (typeof window !== 'undefined')
1223
+ return window;
1224
+ if (typeof global !== 'undefined')
1225
+ return global;
1226
+ return {};
1227
+ }
1228
+
1027
1229
  function createHiddenElement(tagName, focusable) {
1028
1230
  if (focusable === void 0) { focusable = true; }
1029
- var element = globalThis.document.createElement(tagName);
1231
+ var document = getGlobal$1().document;
1232
+ var element = document.createElement(tagName);
1030
1233
  if (typeof element.width !== 'undefined')
1031
1234
  element.width = '0';
1032
1235
  if (typeof element.height !== 'undefined')
@@ -1077,116 +1280,301 @@ function createHiddenElement(tagName, focusable) {
1077
1280
  return element;
1078
1281
  }
1079
1282
 
1080
- var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1081
- function normalizeLocale(locale) {
1082
- if (locale === null || typeof locale === 'undefined')
1083
- return locale;
1084
- if (locale.length === 0)
1283
+ var version = "0.0.5";
1284
+ var packageJSON = {
1285
+ version: version};
1286
+
1287
+ var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1288
+ var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
1289
+ var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
1290
+ var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
1291
+ var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
1292
+ var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
1293
+ var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
1294
+ var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
1295
+ function getGlobal() {
1296
+ if (typeof globalThis !== 'undefined')
1297
+ return globalThis;
1298
+ if (typeof self !== 'undefined')
1299
+ return self;
1300
+ if (typeof window !== 'undefined')
1301
+ return window;
1302
+ if (typeof global !== 'undefined')
1303
+ return global;
1304
+ return {};
1305
+ }
1306
+ function freeze(values) {
1307
+ return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
1308
+ }
1309
+ function contains(values, value) {
1310
+ for (var i = 0; i < values.length; i++) {
1311
+ if (values[i] === value)
1312
+ return true;
1313
+ }
1314
+ return false;
1315
+ }
1316
+ function getIntlLocaleConstructor() {
1317
+ if (typeof Intl === 'undefined')
1318
+ return undefined;
1319
+ var constructor = Intl.Locale;
1320
+ return typeof constructor === 'function' ? constructor : undefined;
1321
+ }
1322
+ function parseTag(raw) {
1323
+ if (raw === null || typeof raw !== 'string')
1324
+ return null;
1325
+ var value = raw.replace(/_/g, '-');
1326
+ if (value.length === 0)
1085
1327
  return null;
1086
- locale = locale.replace(/_/g, '-');
1087
- if (locale === 'C' || locale.toLowerCase() === 'posix')
1088
- return 'en-US';
1089
- if (locale.indexOf('.') !== -1)
1090
- return normalizeLocale(locale.split('.')[0]);
1091
- if (locale.indexOf('@') !== -1)
1092
- return normalizeLocale(locale.split('@')[0]);
1093
- var parts = locale.split('-');
1094
- if (parts.length === 0)
1328
+ if (value === 'C' || value.toLowerCase() === 'posix')
1329
+ value = 'en-US';
1330
+ var dot = value.indexOf('.');
1331
+ if (dot !== -1)
1332
+ value = value.slice(0, dot);
1333
+ var at = value.indexOf('@');
1334
+ if (at !== -1)
1335
+ value = value.slice(0, at);
1336
+ if (value.length === 0)
1095
1337
  return null;
1096
- parts[0] = parts[0].toLowerCase();
1097
- if (parts.length > 1 && parts[1].length === 2)
1098
- parts[1] = parts[1].toUpperCase();
1099
- if (parts.length > 2 && parts[1].length === 4)
1100
- parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
1101
- return parts.join('-');
1338
+ var segments = value.split('-');
1339
+ if (LANGUAGE_PATTERN.test(segments[0]) === false)
1340
+ return null;
1341
+ var language = segments[0].toLowerCase();
1342
+ var index = 1;
1343
+ var script = null;
1344
+ if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
1345
+ script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
1346
+ index++;
1347
+ }
1348
+ var region = null;
1349
+ if (index < segments.length && REGION_PATTERN.test(segments[index])) {
1350
+ region = segments[index].toUpperCase();
1351
+ index++;
1352
+ }
1353
+ var variants = [];
1354
+ while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
1355
+ variants.push(segments[index].toLowerCase());
1356
+ index++;
1357
+ }
1358
+ var extensions = [];
1359
+ while (index < segments.length) {
1360
+ var singleton = segments[index];
1361
+ if (SINGLETON_PATTERN.test(singleton) === false)
1362
+ return null;
1363
+ var isPrivateUse = singleton.toLowerCase() === 'x';
1364
+ var parts = [singleton.toLowerCase()];
1365
+ index++;
1366
+ while (index < segments.length) {
1367
+ var segment = segments[index];
1368
+ if (EXTENSION_PATTERN.test(segment) === false)
1369
+ return null;
1370
+ if (segment.length === 1 && isPrivateUse === false)
1371
+ break;
1372
+ parts.push(segment.toLowerCase());
1373
+ index++;
1374
+ }
1375
+ if (parts.length < 2)
1376
+ return null;
1377
+ extensions.push(parts.join('-'));
1378
+ }
1379
+ var base = [language];
1380
+ if (script !== null)
1381
+ base.push(script);
1382
+ if (region !== null)
1383
+ base.push(region);
1384
+ for (var i = 0; i < variants.length; i++)
1385
+ base.push(variants[i]);
1386
+ var baseName = base.join('-');
1387
+ return {
1388
+ tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
1389
+ baseName: baseName,
1390
+ language: language,
1391
+ script: script,
1392
+ region: region,
1393
+ variants: freeze(variants),
1394
+ extensions: freeze(extensions),
1395
+ };
1102
1396
  }
1397
+ function isRTL(subtags) {
1398
+ if (subtags.script !== null)
1399
+ return contains(RTL_SCRIPTS, subtags.script);
1400
+ return contains(RTL_LANGUAGES, subtags.language);
1401
+ }
1402
+ function expandTag(tag) {
1403
+ var parsed = parseTag(tag);
1404
+ if (parsed === null)
1405
+ return freeze([]);
1406
+ var segments = parsed.baseName.split('-');
1407
+ var chain = [];
1408
+ for (var i = segments.length; i > 0; i--)
1409
+ chain.push(segments.slice(0, i).join('-'));
1410
+ return freeze(chain);
1411
+ }
1412
+ function toLookupKey(tag) {
1413
+ var parsed = parseTag(tag);
1414
+ return (parsed === null ? tag : parsed.baseName).toLowerCase();
1415
+ }
1416
+ function lookupTag(supported, preferred, fallback) {
1417
+ if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
1418
+ return fallback;
1419
+ var keys = [];
1420
+ for (var i = 0; i < supported.length; i++)
1421
+ keys.push(toLookupKey(supported[i]));
1422
+ for (var i = 0; i < preferred.length; i++) {
1423
+ var chain = expandTag(preferred[i]);
1424
+ for (var j = 0; j < chain.length; j++) {
1425
+ var candidate = chain[j].toLowerCase();
1426
+ var prefix = candidate + '-';
1427
+ for (var k = 0; k < keys.length; k++) {
1428
+ if (keys[k] === candidate)
1429
+ return supported[k];
1430
+ }
1431
+ for (var k = 0; k < keys.length; k++) {
1432
+ if (keys[k].indexOf(prefix) === 0)
1433
+ return supported[k];
1434
+ }
1435
+ }
1436
+ }
1437
+ return fallback;
1438
+ }
1439
+ function resolveDirection(primary) {
1440
+ if (primary === null)
1441
+ return false;
1442
+ var IntlLocale = getIntlLocaleConstructor();
1443
+ if (typeof IntlLocale !== 'undefined') {
1444
+ try {
1445
+ var intlLocale = new IntlLocale(primary.tag);
1446
+ if (typeof intlLocale.getTextInfo === 'function')
1447
+ return intlLocale.getTextInfo().direction === 'rtl';
1448
+ if (typeof intlLocale.textInfo !== 'undefined')
1449
+ return intlLocale.textInfo.direction === 'rtl';
1450
+ }
1451
+ catch (_) {
1452
+ }
1453
+ }
1454
+ return isRTL(primary);
1455
+ }
1456
+ var subtags = null;
1103
1457
  var language = null;
1104
- var languages = [];
1458
+ var languages = freeze([]);
1459
+ var fallbacks = freeze([]);
1105
1460
  var timezone = null;
1106
1461
  var offset = 0;
1107
- var isRTLResolved = null;
1108
- function addLanguages(langs) {
1109
- for (var i = 0; i < langs.length; i++)
1110
- addLanguage(langs[i]);
1111
- }
1112
- function addLanguage(lang) {
1113
- lang = normalizeLocale(lang);
1114
- if (typeof lang === 'string' && languages.indexOf(lang) === -1) {
1115
- if (language === null)
1116
- language = lang;
1117
- languages.push(lang);
1462
+ var rtl = false;
1463
+ function resolveLanguages(candidates) {
1464
+ var resolved = [];
1465
+ var primary = null;
1466
+ for (var i = 0; i < candidates.length; i++) {
1467
+ var parsed = parseTag(candidates[i]);
1468
+ if (parsed === null)
1469
+ continue;
1470
+ if (contains(resolved, parsed.baseName))
1471
+ continue;
1472
+ if (primary === null)
1473
+ primary = parsed;
1474
+ resolved.push(parsed.baseName);
1475
+ }
1476
+ subtags = primary;
1477
+ language = primary === null ? null : primary.baseName;
1478
+ languages = freeze(resolved);
1479
+ fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
1480
+ rtl = resolveDirection(primary);
1481
+ }
1482
+ function collectEnvironmentLanguages() {
1483
+ var candidates = [];
1484
+ var navigatorLike = getGlobal().navigator;
1485
+ if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
1486
+ if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
1487
+ for (var i = 0; i < navigatorLike.languages.length; i++)
1488
+ candidates.push(navigatorLike.languages[i]);
1489
+ }
1490
+ candidates.push(navigatorLike.language);
1491
+ candidates.push(navigatorLike.userLanguage);
1492
+ candidates.push(navigatorLike.browserLanguage);
1493
+ candidates.push(navigatorLike.systemLanguage);
1494
+ }
1495
+ if (typeof Intl !== 'undefined') {
1496
+ try {
1497
+ candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
1498
+ }
1499
+ catch (_) {
1500
+ }
1118
1501
  }
1502
+ return candidates;
1119
1503
  }
1504
+ var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
1505
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1120
1506
  if (typeof Intl !== 'undefined') {
1121
- try {
1122
- addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
1123
- }
1124
- catch (_) {
1125
- }
1126
1507
  try {
1127
1508
  timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1128
1509
  }
1129
1510
  catch (_) {
1130
1511
  }
1131
1512
  }
1132
- if (typeof globalThis.navigator !== 'undefined') {
1133
- if (typeof globalThis.navigator.languages !== 'undefined')
1134
- addLanguages(globalThis.navigator.languages);
1135
- if (typeof globalThis.navigator.language !== 'undefined')
1136
- addLanguage(globalThis.navigator.language);
1137
- if (typeof globalThis.navigator.userLanguage !== 'undefined')
1138
- addLanguage(globalThis.navigator.userLanguage);
1139
- if (typeof globalThis.navigator.browserLanguage !== 'undefined')
1140
- addLanguage(globalThis.navigator.browserLanguage);
1141
- if (typeof globalThis.navigator.systemLanguage !== 'undefined')
1142
- addLanguage(globalThis.navigator.systemLanguage);
1143
- }
1144
1513
  try {
1145
1514
  offset = new Date().getTimezoneOffset() * -1;
1146
1515
  }
1147
1516
  catch (_) {
1148
1517
  }
1149
- if (typeof language === 'string') {
1150
- if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
1151
- try {
1152
- var intlLocale = new Intl.Locale(language);
1153
- if (typeof intlLocale.getTextInfo === 'function')
1154
- isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
1155
- else if (typeof intlLocale.textInfo !== 'undefined')
1156
- isRTLResolved = intlLocale.textInfo.direction === 'rtl';
1157
- }
1158
- catch (_) {
1159
- }
1160
- }
1161
- if (typeof isRTLResolved !== 'boolean') {
1162
- var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
1163
- if (matched !== null) {
1164
- var lang = matched[1].toLowerCase();
1165
- for (var i = 0; i < RTL_LANGUAGES.length; i++) {
1166
- if (RTL_LANGUAGES[i] === lang) {
1167
- isRTLResolved = true;
1168
- break;
1169
- }
1170
- }
1171
- }
1172
- }
1173
- }
1174
1518
  var LocaleKit = {
1175
- languages: languages};
1519
+ version: packageJSON.version,
1520
+ get language() {
1521
+ return language;
1522
+ },
1523
+ get languages() {
1524
+ return languages;
1525
+ },
1526
+ set languages(value) {
1527
+ resolveLanguages(typeof value === 'string' ? [value] : value);
1528
+ },
1529
+ get subtags() {
1530
+ return subtags;
1531
+ },
1532
+ get fallbacks() {
1533
+ return fallbacks;
1534
+ },
1535
+ get timezone() {
1536
+ return timezone;
1537
+ },
1538
+ get offset() {
1539
+ return offset;
1540
+ },
1541
+ get rtl() {
1542
+ return rtl;
1543
+ },
1544
+ reset: function () {
1545
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1546
+ },
1547
+ parse: function (tag) {
1548
+ return parseTag(tag);
1549
+ },
1550
+ expand: function (tag) {
1551
+ return expandTag(tag);
1552
+ },
1553
+ lookup: function (supported, fallback) {
1554
+ return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
1555
+ },
1556
+ };
1557
+ if (typeof Object.freeze === 'function')
1558
+ Object.freeze(LocaleKit);
1176
1559
 
1560
+ var GLOBAL$1 = getGlobal$1();
1561
+ var CACHE_PREFIX = 'web-launch-kit:';
1177
1562
  var TRACK_ID = 'track-id';
1178
- var BUNDLE_ID = 'bundle-id';
1563
+ var PRODUCT_ID = 'product-id';
1179
1564
  var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
1565
+ function toCacheKey(mode, query) {
1566
+ return CACHE_PREFIX + mode + ':' + query;
1567
+ }
1180
1568
  var idCache = (function () {
1181
1569
  var supportsLocalStorage;
1182
1570
  try {
1183
- if (typeof globalThis.localStorage === 'undefined') {
1571
+ if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
1184
1572
  supportsLocalStorage = false;
1185
1573
  }
1186
1574
  else {
1187
1575
  var key = '__id_cache_test__';
1188
- globalThis.localStorage.setItem(key, '');
1189
- globalThis.localStorage.removeItem(key);
1576
+ GLOBAL$1.localStorage.setItem(key, '');
1577
+ GLOBAL$1.localStorage.removeItem(key);
1190
1578
  supportsLocalStorage = true;
1191
1579
  }
1192
1580
  }
@@ -1197,7 +1585,7 @@ var idCache = (function () {
1197
1585
  return {
1198
1586
  get: function (mode, query) {
1199
1587
  try {
1200
- var item = globalThis.localStorage.getItem(mode + ':' + query);
1588
+ var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
1201
1589
  if (item == null)
1202
1590
  return undefined;
1203
1591
  var split = item.split('|');
@@ -1205,7 +1593,7 @@ var idCache = (function () {
1205
1593
  return undefined;
1206
1594
  var expiry = +split[0];
1207
1595
  if (isNotANumber(expiry) || expiry < getNow()) {
1208
- globalThis.localStorage.removeItem(mode + ':' + query);
1596
+ GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
1209
1597
  return undefined;
1210
1598
  }
1211
1599
  return split[1];
@@ -1216,7 +1604,7 @@ var idCache = (function () {
1216
1604
  },
1217
1605
  set: function (mode, query, id) {
1218
1606
  try {
1219
- globalThis.localStorage.setItem(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1607
+ GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1220
1608
  }
1221
1609
  catch (_) {
1222
1610
  return;
@@ -1224,11 +1612,11 @@ var idCache = (function () {
1224
1612
  }
1225
1613
  };
1226
1614
  }
1227
- if (typeof globalThis.Map !== 'undefined') {
1228
- var cache_1 = new Map();
1615
+ if (typeof GLOBAL$1.Map !== 'undefined') {
1616
+ var cache_1 = new GLOBAL$1.Map();
1229
1617
  return {
1230
1618
  get: function (mode, query) {
1231
- var item = cache_1.get(mode + ':' + query);
1619
+ var item = cache_1.get(toCacheKey(mode, query));
1232
1620
  if (typeof item === 'undefined')
1233
1621
  return undefined;
1234
1622
  var split = item.split('|');
@@ -1236,20 +1624,20 @@ var idCache = (function () {
1236
1624
  return undefined;
1237
1625
  var expiry = +split[0];
1238
1626
  if (isNotANumber(expiry) || expiry < getNow()) {
1239
- cache_1.delete(mode + ':' + query);
1627
+ cache_1.delete(toCacheKey(mode, query));
1240
1628
  return undefined;
1241
1629
  }
1242
1630
  return split[1];
1243
1631
  },
1244
1632
  set: function (mode, query, id) {
1245
- cache_1.set(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1633
+ cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1246
1634
  },
1247
1635
  };
1248
1636
  }
1249
1637
  var cache = Object.create(null);
1250
1638
  return {
1251
1639
  get: function (mode, query) {
1252
- var item = cache[mode + ':' + query];
1640
+ var item = cache[toCacheKey(mode, query)];
1253
1641
  if (typeof item === 'undefined')
1254
1642
  return undefined;
1255
1643
  var split = item.split('|');
@@ -1258,17 +1646,17 @@ var idCache = (function () {
1258
1646
  var expiry = +split[0];
1259
1647
  if (isNotANumber(expiry) || expiry < getNow()) {
1260
1648
  try {
1261
- delete cache[mode + ':' + query];
1649
+ delete cache[toCacheKey(mode, query)];
1262
1650
  }
1263
1651
  catch (_) {
1264
- cache[mode + ':' + query] = undefined;
1652
+ cache[toCacheKey(mode, query)] = undefined;
1265
1653
  }
1266
1654
  return undefined;
1267
1655
  }
1268
1656
  return split[1];
1269
1657
  },
1270
1658
  set: function (mode, query, id) {
1271
- cache[mode + ':' + query] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1659
+ cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1272
1660
  }
1273
1661
  };
1274
1662
  })();
@@ -1282,8 +1670,8 @@ function getNow() {
1282
1670
  }
1283
1671
  function requestGet(url, async) {
1284
1672
  if (async === void 0) { async = false; }
1285
- if (typeof globalThis.fetch === 'function' && async) {
1286
- return globalThis.fetch(url)
1673
+ if (typeof GLOBAL$1.fetch === 'function' && async) {
1674
+ return GLOBAL$1.fetch(url)
1287
1675
  .then(function (response) {
1288
1676
  return response.json();
1289
1677
  })
@@ -1326,10 +1714,10 @@ function resolveGetProductIdURL(packageFamilyName) {
1326
1714
  if (locale === candidate)
1327
1715
  break;
1328
1716
  }
1329
- return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + globalThis.encodeURIComponent(packageFamilyName) + '&market=' + globalThis.encodeURIComponent(country) + '&languages=' + globalThis.encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1717
+ return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1330
1718
  }
1331
1719
  function resolveGetTrackIdURL(bundleId) {
1332
- return 'https://itunes.apple.com/lookup?bundleId=' + globalThis.encodeURIComponent(bundleId);
1720
+ return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
1333
1721
  }
1334
1722
  function parseGetProductIdResponse(response) {
1335
1723
  if (typeof response === 'undefined')
@@ -1355,14 +1743,14 @@ function parseGetTrackIdResponse(response) {
1355
1743
  return '' + result.trackId;
1356
1744
  }
1357
1745
  function getProductId(packageFamilyName) {
1358
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1746
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1359
1747
  if (typeof cache !== 'undefined')
1360
1748
  return cache;
1361
1749
  try {
1362
1750
  var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
1363
1751
  if (typeof productId === 'undefined')
1364
1752
  return undefined;
1365
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1753
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1366
1754
  return productId;
1367
1755
  }
1368
1756
  catch (_) {
@@ -1385,7 +1773,7 @@ function getTrackId(bundleId) {
1385
1773
  }
1386
1774
  }
1387
1775
  function getProductIdAsync(packageFamilyName) {
1388
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1776
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1389
1777
  if (typeof cache !== 'undefined')
1390
1778
  return Promise.resolve(cache);
1391
1779
  try {
@@ -1394,7 +1782,7 @@ function getProductIdAsync(packageFamilyName) {
1394
1782
  .then(function (productId) {
1395
1783
  if (typeof productId === 'undefined')
1396
1784
  return undefined;
1397
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1785
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1398
1786
  return productId;
1399
1787
  });
1400
1788
  }
@@ -1422,15 +1810,16 @@ function getTrackIdAsync(bundleId) {
1422
1810
  }
1423
1811
 
1424
1812
  function getTopmostWindow() {
1813
+ var globalLike = getGlobal$1();
1425
1814
  try {
1426
- if (globalThis.top !== null && globalThis.top !== globalThis.window) {
1427
- void globalThis.top.location.href;
1428
- return globalThis.top;
1815
+ if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
1816
+ void globalLike.top.location.href;
1817
+ return globalLike.top;
1429
1818
  }
1430
1819
  }
1431
1820
  catch (_) {
1432
1821
  }
1433
- return globalThis;
1822
+ return globalLike;
1434
1823
  }
1435
1824
 
1436
1825
  var SettingType;
@@ -1501,8 +1890,10 @@ var IOS_DEFAULT_TIMEOUT = 2000;
1501
1890
  var WINDOWS_DEFAULT_TIMEOUT = 750;
1502
1891
  var MACOS_DEFAULT_TIMEOUT = 750;
1503
1892
  var DEFAULT_TIMEOUT = 750;
1504
- var NAVIGATOR = globalThis.navigator;
1893
+ var GLOBAL = getGlobal$1();
1894
+ var NAVIGATOR = GLOBAL.navigator;
1505
1895
  var CLEANUP_INPUT_ELEMENT = null;
1896
+ var DEBUG = false;
1506
1897
  function createTypeGuard(tag) {
1507
1898
  return function (value) {
1508
1899
  return Object.prototype.toString.call(value) === '[object ' + tag + ']';
@@ -1561,7 +1952,7 @@ function isDocumentHidden() {
1561
1952
  return true;
1562
1953
  }
1563
1954
  function dispatchClickEvent(element, view) {
1564
- if (view === void 0) { view = globalThis; }
1955
+ if (view === void 0) { view = GLOBAL; }
1565
1956
  var fake;
1566
1957
  try {
1567
1958
  fake = new MouseEvent('click', {
@@ -1571,7 +1962,7 @@ function dispatchClickEvent(element, view) {
1571
1962
  });
1572
1963
  }
1573
1964
  catch (_) {
1574
- fake = globalThis.document.createEvent('MouseEvents');
1965
+ fake = GLOBAL.document.createEvent('MouseEvents');
1575
1966
  fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1576
1967
  }
1577
1968
  element.dispatchEvent(fake);
@@ -1599,11 +1990,14 @@ function restoreFocus() {
1599
1990
  focus(top);
1600
1991
  if (hasFocus(topDocument))
1601
1992
  return true;
1602
- if (topDocument.body.tabIndex < 0)
1603
- topDocument.body.tabIndex = -1;
1993
+ var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
1994
+ if (!hadBodyTabIndex)
1995
+ topDocument.body.setAttribute('tabindex', '-1');
1604
1996
  focus(topDocument.body);
1605
1997
  if (hasFocus(topDocument))
1606
1998
  return true;
1999
+ if (!hadBodyTabIndex)
2000
+ topDocument.body.removeAttribute('tabindex');
1607
2001
  var input = undefined;
1608
2002
  try {
1609
2003
  input = createHiddenElement('input');
@@ -1645,7 +2039,7 @@ function stripURL(value) {
1645
2039
  function resolveFocusEventConfig() {
1646
2040
  var top = getTopmostWindow();
1647
2041
  var topDocument = top.document;
1648
- if (typeof globalThis.cordova !== 'undefined') {
2042
+ if (typeof GLOBAL.cordova !== 'undefined') {
1649
2043
  return {
1650
2044
  focus: {
1651
2045
  target: topDocument,
@@ -1683,7 +2077,7 @@ function resolveFocusEventConfig() {
1683
2077
  };
1684
2078
  }
1685
2079
  }
1686
- else if (typeof globalThis.document.addEventListener === 'function') {
2080
+ else if (typeof GLOBAL.document.addEventListener === 'function') {
1687
2081
  return {
1688
2082
  focus: {
1689
2083
  target: top,
@@ -1723,12 +2117,12 @@ function openURL(tried, url, timeout) {
1723
2117
  var anchor = undefined;
1724
2118
  var iframe = undefined;
1725
2119
  function open() {
1726
- if (typeof globalThis.cordova !== 'undefined') {
1727
- if (typeof globalThis.cordova.InAppBrowser !== 'undefined') {
1728
- globalThis.cordova.InAppBrowser.open(url, '_system');
2120
+ if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
2121
+ if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
2122
+ GLOBAL.cordova.InAppBrowser.open(url, '_system');
1729
2123
  }
1730
- else {
1731
- globalThis.open(url, '_system');
2124
+ else if (typeof GLOBAL.open === 'function') {
2125
+ GLOBAL.open(url, '_system');
1732
2126
  }
1733
2127
  return;
1734
2128
  }
@@ -1758,7 +2152,7 @@ function openURL(tried, url, timeout) {
1758
2152
  iframe = createHiddenElement('iframe');
1759
2153
  iframe.src = url;
1760
2154
  topDocument.body.appendChild(iframe);
1761
- globalThis.setTimeout(function () {
2155
+ setTimeout(function () {
1762
2156
  if (typeof iframe !== 'undefined') {
1763
2157
  try {
1764
2158
  topDocument.body.removeChild(iframe);
@@ -1773,7 +2167,8 @@ function openURL(tried, url, timeout) {
1773
2167
  }
1774
2168
  }
1775
2169
  return new Promise(function (resolve, reject) {
1776
- debugger;
2170
+ if (DEBUG)
2171
+ debugger;
1777
2172
  var timeoutId;
1778
2173
  var resolved = false;
1779
2174
  function cleanup() {
@@ -1822,7 +2217,7 @@ function openURL(tried, url, timeout) {
1822
2217
  timeoutId = undefined;
1823
2218
  }
1824
2219
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1825
- EventKit.remove(config.blur.target, config.blur.type, onfocus);
2220
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1826
2221
  if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1827
2222
  EventKit.add(config.focus.target, config.focus.type, onfocus);
1828
2223
  }
@@ -1835,7 +2230,7 @@ function openURL(tried, url, timeout) {
1835
2230
  else
1836
2231
  onfocus();
1837
2232
  }
1838
- timeoutId = globalThis.setTimeout(function () {
2233
+ timeoutId = setTimeout(function () {
1839
2234
  done(false);
1840
2235
  }, timeout);
1841
2236
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
@@ -2043,13 +2438,22 @@ function isFullyBlockedInAppBrowser() {
2043
2438
  function isPartnerAppOnly() {
2044
2439
  return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
2045
2440
  }
2441
+ function canOpenWindowsSetting(version) {
2442
+ if (version.length === 0)
2443
+ return false;
2444
+ if (/^\d/.test(version) === false)
2445
+ return false;
2446
+ if (version === '95' || version === '98' || version === '2000')
2447
+ return false;
2448
+ return PlatformKit.compareVersion(version, '10') >= 0;
2449
+ }
2046
2450
  function canOpenSetting() {
2047
2451
  var os = PlatformKit.os.name;
2048
2452
  var version = PlatformKit.os.version;
2049
2453
  return !(os === 'unknown'
2050
2454
  || (os === 'android' && !canOpenIntent())
2051
2455
  || os === 'ios'
2052
- || (os === 'windows' && (version === 'Vista' || version === 'XP' || version === '2000' || version === 'NT 4.0' || version === 'NT 3.11' || version === 'ME' || PlatformKit.compareVersion(version, '10') < 0))
2456
+ || (os === 'windows' && !canOpenWindowsSetting(version))
2053
2457
  || (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
2054
2458
  }
2055
2459
  function parseIntentURL(intent) {
@@ -2078,7 +2482,7 @@ function parseIntentURL(intent) {
2078
2482
  if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
2079
2483
  var fallback = extras['S.browser_fallback_url'];
2080
2484
  try {
2081
- fallback = globalThis.decodeURIComponent(fallback);
2485
+ fallback = decodeURIComponent(fallback);
2082
2486
  }
2083
2487
  catch (_) {
2084
2488
  }
@@ -2098,9 +2502,9 @@ function createIntentURL(scheme, packageName, fallback) {
2098
2502
  if (typeof packageName !== 'undefined')
2099
2503
  intent += 'package=' + packageName + ';';
2100
2504
  if (typeof fallback !== 'undefined' && typeof fallback === 'string')
2101
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(fallback) + ';';
2505
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
2102
2506
  else if (typeof packageName !== 'undefined')
2103
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2507
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2104
2508
  return intent + 'end';
2105
2509
  }
2106
2510
  function createAppStoreURL(id, os) {
@@ -2132,7 +2536,7 @@ function createWebStoreURL(id, os) {
2132
2536
  }
2133
2537
  }
2134
2538
  function escapeURIComponentString(value) {
2135
- return globalThis.encodeURIComponent(value)
2539
+ return encodeURIComponent(value)
2136
2540
  .replace(/[!'()*]/g, function (char) {
2137
2541
  return '%' + char.charCodeAt(0).toString(16);
2138
2542
  });
@@ -2201,10 +2605,10 @@ function isUserActivationActive() {
2201
2605
  return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
2202
2606
  }
2203
2607
  function canShowDirectoryPicker() {
2204
- return typeof globalThis.showDirectoryPicker === 'function';
2608
+ return typeof GLOBAL.showDirectoryPicker === 'function';
2205
2609
  }
2206
2610
  function canShowOpenFilePicker() {
2207
- return typeof globalThis.showOpenFilePicker === 'function';
2611
+ return typeof GLOBAL.showOpenFilePicker === 'function';
2208
2612
  }
2209
2613
  function isFileSystemFileHandle(handle) {
2210
2614
  return handle.kind === 'file';
@@ -2272,7 +2676,7 @@ function resolveFile(module) {
2272
2676
  resolve(fileListToArray(module.files));
2273
2677
  }
2274
2678
  function onfocus() {
2275
- globalThis.setTimeout(function () {
2679
+ setTimeout(function () {
2276
2680
  if (module.value.length > 0)
2277
2681
  done(true);
2278
2682
  else
@@ -2302,7 +2706,7 @@ function resolveFile(module) {
2302
2706
  EventKit.add(config.focus.target, config.focus.type, onfocus);
2303
2707
  if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2304
2708
  EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2305
- globalThis.setTimeout(function () {
2709
+ setTimeout(function () {
2306
2710
  EventKit.add(topDocument, 'click', onclick);
2307
2711
  }, 100);
2308
2712
  CLEANUP_INPUT_ELEMENT = function () {
@@ -2387,7 +2791,13 @@ function walk(directory, basePath) {
2387
2791
  }
2388
2792
  var LaunchKit = {
2389
2793
  SettingType: SettingType,
2390
- version: packageJSON$2.version,
2794
+ version: packageJSON$3.version,
2795
+ get debug() {
2796
+ return DEBUG;
2797
+ },
2798
+ set debug(value) {
2799
+ DEBUG = value === true;
2800
+ },
2391
2801
  utils: {
2392
2802
  get canOpenIntent() {
2393
2803
  return canOpenIntent();
@@ -2435,7 +2845,12 @@ var LaunchKit = {
2435
2845
  }
2436
2846
  else {
2437
2847
  tried[index] = '[function fallback]';
2438
- url();
2848
+ try {
2849
+ url();
2850
+ }
2851
+ catch (_) {
2852
+ return openURLSequential(index + 1);
2853
+ }
2439
2854
  resolve(by);
2440
2855
  }
2441
2856
  }
@@ -2608,7 +3023,7 @@ var LaunchKit = {
2608
3023
  option.id = options.id;
2609
3024
  if (typeof options.startIn !== 'undefined')
2610
3025
  option.startIn = options.startIn;
2611
- module = globalThis.showDirectoryPicker(option);
3026
+ module = GLOBAL.showDirectoryPicker(option);
2612
3027
  }
2613
3028
  else {
2614
3029
  var input = createHiddenElement('input');
@@ -2646,7 +3061,7 @@ var LaunchKit = {
2646
3061
  }
2647
3062
  }
2648
3063
  }
2649
- module = globalThis.showOpenFilePicker(option);
3064
+ module = GLOBAL.showOpenFilePicker(option);
2650
3065
  }
2651
3066
  else {
2652
3067
  var input = createHiddenElement('input');