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.
@@ -4,24 +4,37 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LaunchKit = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- var version$2 = "0.0.3";
7
+ var version$3 = "0.0.5";
8
+ var packageJSON$3 = {
9
+ version: version$3};
10
+
11
+ var version$2 = "0.0.5";
8
12
  var packageJSON$2 = {
9
13
  version: version$2};
10
14
 
11
- var version$1 = "0.0.4";
12
- var packageJSON$1 = {
13
- version: version$1};
14
-
15
- var NAVIGATOR$1 = globalThis.navigator;
16
- var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgent : '';
17
- var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgentData : undefined;
15
+ function getGlobal$3() {
16
+ if (typeof globalThis !== 'undefined')
17
+ return globalThis;
18
+ if (typeof self !== 'undefined')
19
+ return self;
20
+ if (typeof window !== 'undefined')
21
+ return window;
22
+ if (typeof global !== 'undefined')
23
+ return global;
24
+ return {};
25
+ }
26
+ var GLOBAL$5 = getGlobal$3();
27
+ var NAVIGATOR$1 = GLOBAL$5.navigator;
28
+ var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.userAgent === 'string' ? NAVIGATOR$1.userAgent : '';
29
+ var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null ? NAVIGATOR$1.userAgentData : undefined;
18
30
  var OS_RESOLVER_MAP = [
19
- [/windows nt (6\.[23]); arm/i, 'windows', resolveWindowsVersion],
20
- [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows', resolveWindowsVersion],
21
- [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows', resolveWindowsVersion],
31
+ [/windows nt (6\.[23]); arm/i, 'windows', 'RT'],
32
+ [/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, 'windows'],
33
+ [/win 9x 4\.90/i, 'windows', 'ME'],
34
+ [/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, 'windows'],
22
35
  [/windows nt ?([\d.)]*)(?!.+xbox)/i, 'windows', resolveWindowsVersion],
23
36
  [/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, 'windows', resolveWindowsVersion],
24
- [/windows ce\/?([\d.]*)/i, 'windows', resolveWindowsVersion],
37
+ [/windows ce\/?([\d.]*)/i, 'windows'],
25
38
  [/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, 'ios', resolveUnderscoreVersion],
26
39
  [/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, 'ios', resolveUnderscoreVersion],
27
40
  [/cfnetwork\/.+darwin/i, 'ios', resolveUnderscoreVersion],
@@ -50,13 +63,14 @@
50
63
  [/samsungbrowser\/([\w.]+)/i, 'samsung'],
51
64
  [/headlesschrome(?:\/([\w.]+)| )/i, 'chrome'],
52
65
  [/wv\).+chrome\/([\w.]+).+edgw\//i, 'edge'],
53
- [/ wv\).+(chrome)\/([\w.]+)/i, 'chrome'],
66
+ [/ wv\).+chrome\/([\w.]+)/i, 'chrome'],
54
67
  [/chrome\/([\w.]+) mobile/i, 'chrome'],
55
68
  [/chrome\/v?([\w.]+)/i, 'chrome'],
56
69
  [/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
57
70
  [/iphone .*mobile(?:\/\w+ | ?)safari/i, 'safari'],
58
71
  [/version\/([\w.,]+) .*safari/i, 'safari'],
59
72
  [/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, 'safari', '1'],
73
+ [/(?:iphone|ipad|ipod).+applewebkit(?!.*safari)/i, 'safari'],
60
74
  [/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, 'firefox'],
61
75
  [/mobile vr; rv:([\w.]+)\).+firefox/i, 'firefox'],
62
76
  [/firefox\/([\w.]+)/i, 'firefox'],
@@ -73,6 +87,18 @@
73
87
  [/tasman[\/ ]\(?([\w.]+)/i, 'tasman'],
74
88
  [/rv:([\w.]{1,9})\b.+gecko/i, 'gecko']
75
89
  ];
90
+ var IN_APP_BROWSER_RESOLVER_MAP = [
91
+ [/kakaotalk/i, 'kakaotalk'],
92
+ [/\bline\/[\d.]/i, 'line'],
93
+ [/instagram/i, 'instagram'],
94
+ [/\bfban\/|\bfbav\/|fb_iab/i, 'facebook'],
95
+ [/naver\(inapp/i, 'naver'],
96
+ [/daumapps/i, 'daum'],
97
+ [/\bband\/[\d.]/i, 'band'],
98
+ [/micromessenger/i, 'wechat'],
99
+ [/twitter for|twitterandroid/i, 'twitter'],
100
+ [/musical_ly|bytedancewebview|\btiktok/i, 'tiktok'],
101
+ ];
76
102
  var HIGH_ENTROPY_BRAND_NAME_MAP = {
77
103
  'Google Chrome': 'Chrome',
78
104
  'Microsoft Edge': 'Edge',
@@ -95,19 +121,18 @@
95
121
  return '';
96
122
  var mapped = {
97
123
  '4.90': 'ME',
98
- 'NT3.51': 'NT 3.11',
99
- 'NT4.0': 'NT 4.0',
100
- 'NT 5.0': '2000',
101
- 'NT 5.1': 'XP',
102
- 'NT 5.2': 'XP',
103
- 'NT 6.0': 'Vista',
104
- 'NT 6.1': '7',
105
- 'NT 6.2': '8',
106
- 'NT 6.3': '8.1',
107
- 'NT 6.4': '10',
108
- 'NT 10.0': '10',
109
- 'ARM': 'RT'
110
- }[string];
124
+ '3.51': 'NT 3.51',
125
+ '4.0': 'NT 4.0',
126
+ '5.0': '2000',
127
+ '5.1': 'XP',
128
+ '5.2': 'XP',
129
+ '6.0': 'Vista',
130
+ '6.1': '7',
131
+ '6.2': '8',
132
+ '6.3': '8.1',
133
+ '6.4': '10',
134
+ '10.0': '10'
135
+ }[string.replace(/[^\d.]/g, '')];
111
136
  if (typeof mapped !== 'undefined')
112
137
  return mapped;
113
138
  return string;
@@ -126,6 +151,28 @@
126
151
  return '';
127
152
  return string;
128
153
  }
154
+ function compareVersion(lhs, rhs) {
155
+ var pa = lhs.split('.');
156
+ var pb = rhs.split('.');
157
+ var length = Math.max(pa.length, pb.length);
158
+ for (var i = 0; i < length; i++) {
159
+ var a = void 0;
160
+ var b = void 0;
161
+ if (i < pa.length)
162
+ a = parseInt(pa[i], 10);
163
+ else
164
+ a = 0;
165
+ if (i < pb.length)
166
+ b = parseInt(pb[i], 10);
167
+ else
168
+ b = 0;
169
+ if (a > b)
170
+ return 1;
171
+ if (a < b)
172
+ return -1;
173
+ }
174
+ return 0;
175
+ }
129
176
  function parseOS() {
130
177
  var name = 'unknown';
131
178
  var version = '';
@@ -138,7 +185,7 @@
138
185
  break;
139
186
  }
140
187
  }
141
- if (name === 'ios' && PlatformKit.compareVersion(version, '18.6') === 0) {
188
+ if (name === 'ios' && compareVersion(version, '18.6') === 0) {
142
189
  var execs = /\) Version\/([\d.]+)/.exec(currentUserAgent);
143
190
  if (execs !== null) {
144
191
  var major = parseInt(execs[1].split('.')[0], 10);
@@ -151,7 +198,7 @@
151
198
  name = parsedFromHighEntropyValuesOSName;
152
199
  if (typeof parsedFromHighEntropyValuesOSVersion !== 'undefined')
153
200
  version = parsedFromHighEntropyValuesOSVersion;
154
- if (name === 'macos' && typeof globalThis.navigator.standalone !== 'undefined' && typeof globalThis.navigator.maxTouchPoints !== 'undefined' && globalThis.navigator.maxTouchPoints > 2)
201
+ if (name === 'macos' && typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && typeof NAVIGATOR$1.standalone !== 'undefined' && typeof NAVIGATOR$1.maxTouchPoints === 'number' && NAVIGATOR$1.maxTouchPoints > 2)
155
202
  name = 'ios';
156
203
  }
157
204
  return {
@@ -203,6 +250,39 @@
203
250
  version: version
204
251
  };
205
252
  }
253
+ function parseInAppBrowser() {
254
+ for (var i = 0; i < IN_APP_BROWSER_RESOLVER_MAP.length; i++) {
255
+ if (IN_APP_BROWSER_RESOLVER_MAP[i][0].test(currentUserAgent))
256
+ return IN_APP_BROWSER_RESOLVER_MAP[i][1];
257
+ }
258
+ return null;
259
+ }
260
+ function parseWebview() {
261
+ if (/; ?wv\)/i.test(currentUserAgent))
262
+ return true;
263
+ if (/\bversion\/[\d.]+ chrome\//i.test(currentUserAgent))
264
+ return true;
265
+ if (/\belectron\//i.test(currentUserAgent))
266
+ return true;
267
+ if (/iphone|ipad|ipod/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
268
+ return true;
269
+ return parseInAppBrowser() !== null;
270
+ }
271
+ function parseDevice() {
272
+ if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
273
+ return parsedFromHighEntropyValuesDevice;
274
+ var osName = getParsedCache().os.name;
275
+ if (osName === 'ios') {
276
+ if (/ipad/i.test(currentUserAgent) || /macintosh/i.test(currentUserAgent))
277
+ return 'tablet';
278
+ return 'mobile';
279
+ }
280
+ if (osName === 'android')
281
+ return /\bmobile\b/i.test(currentUserAgent) ? 'mobile' : 'tablet';
282
+ if (osName === 'windows' || osName === 'macos')
283
+ return 'desktop';
284
+ return 'unknown';
285
+ }
206
286
  function getParsedCache() {
207
287
  if (parsedCache !== null && parsedCache.userAgent === currentUserAgent)
208
288
  return parsedCache;
@@ -230,11 +310,31 @@
230
310
  return { brand: entry, version: '' };
231
311
  return { brand: entry.brand, version: entry.version };
232
312
  }
313
+ function resolvedThenable() {
314
+ if (typeof Promise === 'function')
315
+ return Promise.resolve();
316
+ var thenable = {
317
+ then: function (onFulfilled) {
318
+ if (typeof onFulfilled === 'function')
319
+ onFulfilled(undefined);
320
+ return thenable;
321
+ },
322
+ catch: function () {
323
+ return thenable;
324
+ },
325
+ finally: function (onFinally) {
326
+ if (typeof onFinally === 'function')
327
+ onFinally();
328
+ return thenable;
329
+ },
330
+ };
331
+ return thenable;
332
+ }
233
333
  function parseFromHighEntropyValues() {
234
334
  if (typeof USER_AGENT_DATA === 'undefined' || typeof USER_AGENT_DATA.getHighEntropyValues === 'undefined')
235
- return Promise.resolve();
335
+ return resolvedThenable();
236
336
  return USER_AGENT_DATA
237
- .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
337
+ .getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'platform', 'platformVersion', 'formFactors'])
238
338
  .then(function (result) {
239
339
  try {
240
340
  var brands = result.fullVersionList || result.brands || [];
@@ -287,12 +387,26 @@
287
387
  else if (/macos|macintel/i.test(platform))
288
388
  parsedFromHighEntropyValuesOSName = 'macos';
289
389
  }
290
- if (result.mobile === true)
390
+ var formFactors = result.formFactors;
391
+ if (typeof formFactors !== 'undefined' && formFactors !== null && typeof formFactors.length === 'number') {
392
+ for (var i = 0; i < formFactors.length; i++) {
393
+ var formFactor = String(formFactors[i]).toLowerCase();
394
+ if (formFactor === 'tablet')
395
+ parsedFromHighEntropyValuesDevice = 'tablet';
396
+ else if (formFactor === 'mobile')
397
+ parsedFromHighEntropyValuesDevice = 'mobile';
398
+ else if (formFactor === 'desktop')
399
+ parsedFromHighEntropyValuesDevice = 'desktop';
400
+ }
401
+ }
402
+ if (parsedFromHighEntropyValuesDevice === null && result.mobile === true)
291
403
  parsedFromHighEntropyValuesDevice = 'mobile';
292
- parsedCache = null;
293
404
  }
294
405
  catch (_) {
295
406
  }
407
+ finally {
408
+ parsedCache = null;
409
+ }
296
410
  })
297
411
  .catch(function () {
298
412
  parsedCache = null;
@@ -300,15 +414,29 @@
300
414
  }
301
415
  ready = parseFromHighEntropyValues();
302
416
  var PlatformKit = {
303
- version: packageJSON$1.version,
417
+ version: packageJSON$2.version,
304
418
  get ready() {
305
419
  return ready;
306
420
  },
421
+ whenReady: function (callback) {
422
+ if (typeof callback !== 'function')
423
+ return;
424
+ ready.then(function () {
425
+ callback();
426
+ });
427
+ },
307
428
  set userAgent(userAgent) {
308
429
  if (currentUserAgent === userAgent)
309
430
  return;
310
431
  currentUserAgent = userAgent;
311
432
  invalidateCache();
433
+ ready = userAgent === USER_AGENT ? parseFromHighEntropyValues() : resolvedThenable();
434
+ },
435
+ reset: function () {
436
+ if (currentUserAgent === USER_AGENT)
437
+ return;
438
+ currentUserAgent = USER_AGENT;
439
+ invalidateCache();
312
440
  ready = parseFromHighEntropyValues();
313
441
  },
314
442
  get userAgent() {
@@ -324,65 +452,59 @@
324
452
  return getParsedCache().engine;
325
453
  },
326
454
  get device() {
327
- if (currentUserAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
328
- return parsedFromHighEntropyValuesDevice;
329
- var osName = getParsedCache().os.name;
330
- if (osName === 'ios' || osName === 'android')
331
- return 'mobile';
332
- if (osName === 'windows' || osName === 'macos')
333
- return 'desktop';
334
- return 'unknown';
455
+ return parseDevice();
335
456
  },
336
457
  get webview() {
337
- return /; ?wv|applewebkit(?!.*safari)/i.test(currentUserAgent);
458
+ return parseWebview();
459
+ },
460
+ get inAppBrowser() {
461
+ return parseInAppBrowser();
338
462
  },
339
463
  get node() {
340
- return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
464
+ var nodeProcess = GLOBAL$5.process;
465
+ return typeof nodeProcess !== 'undefined' && nodeProcess !== null && typeof nodeProcess.versions !== 'undefined' && nodeProcess.versions !== null && typeof nodeProcess.versions.node !== 'undefined';
341
466
  },
342
467
  get standalone() {
343
468
  var osName = getParsedCache().os.name;
344
469
  if (osName === 'ios')
345
- return globalThis.navigator.standalone === true;
346
- if (typeof globalThis.matchMedia === 'undefined')
470
+ return typeof NAVIGATOR$1 !== 'undefined' && NAVIGATOR$1 !== null && NAVIGATOR$1.standalone === true;
471
+ if (typeof GLOBAL$5.matchMedia !== 'function')
472
+ return false;
473
+ try {
474
+ return GLOBAL$5.matchMedia('(display-mode: standalone)').matches === true;
475
+ }
476
+ catch (_) {
347
477
  return false;
348
- return globalThis.matchMedia('(display-mode: standalone)').matches;
478
+ }
349
479
  },
350
480
  compareVersion: function (lhs, rhs) {
351
- var pa = lhs.split('.');
352
- var pb = rhs.split('.');
353
- var length = Math.max(pa.length, pb.length);
354
- for (var i = 0; i < length; i++) {
355
- var a = void 0;
356
- var b = void 0;
357
- if (i < pa.length)
358
- a = parseInt(pa[i], 10);
359
- else
360
- a = 0;
361
- if (i < pb.length)
362
- b = parseInt(pb[i], 10);
363
- else
364
- b = 0;
365
- if (a > b)
366
- return 1;
367
- if (a < b)
368
- return -1;
369
- }
370
- return 0;
481
+ return compareVersion(lhs, rhs);
371
482
  }
372
483
  };
373
484
 
374
- var version = "0.0.1";
375
- var packageJSON = {
376
- version: version};
485
+ function getGlobal$2() {
486
+ if (typeof globalThis !== 'undefined')
487
+ return globalThis;
488
+ if (typeof self !== 'undefined')
489
+ return self;
490
+ if (typeof window !== 'undefined')
491
+ return window;
492
+ if (typeof global !== 'undefined')
493
+ return global;
494
+ return {};
495
+ }
496
+
497
+ var version$1 = "0.0.3";
498
+ var packageJSON$1 = {
499
+ version: version$1};
377
500
 
501
+ var GLOBAL$3 = getGlobal$2();
378
502
  var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
379
503
  // https://cordova.apache.org/docs/en/latest/cordova/events/events.html
380
504
  var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
381
505
  // iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
382
506
  var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
383
507
  var TYPE_ALIAS_MAP = {
384
- 'focus': ['focus', 'focusin'],
385
- 'blur': ['blur', 'focusout'],
386
508
  'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
387
509
  'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
388
510
  'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
@@ -430,10 +552,10 @@
430
552
  }
431
553
  function probeHosts(target) {
432
554
  var hosts = [target];
433
- if (typeof globalThis.document !== 'undefined' && target !== globalThis.document)
434
- hosts.push(globalThis.document);
435
- if (target !== globalThis)
436
- hosts.push(globalThis);
555
+ if (typeof GLOBAL$3.document !== 'undefined' && target !== GLOBAL$3.document)
556
+ hosts.push(GLOBAL$3.document);
557
+ if (target !== GLOBAL$3)
558
+ hosts.push(GLOBAL$3);
437
559
  return hosts;
438
560
  }
439
561
  function extractVendorPrefix(name) {
@@ -444,9 +566,9 @@
444
566
  return '';
445
567
  }
446
568
  function testStyleSupport(name, styleProperty) {
447
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
569
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
448
570
  return false;
449
- var style = globalThis.document.documentElement.style;
571
+ var style = GLOBAL$3.document.documentElement.style;
450
572
  if (typeof style === 'undefined' || style === null)
451
573
  return false;
452
574
  var prefix = extractVendorPrefix(name);
@@ -458,9 +580,9 @@
458
580
  return typeof asRecord(style)[property] !== 'undefined';
459
581
  }
460
582
  function testFullscreenSupport(name) {
461
- if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
583
+ if (typeof GLOBAL$3.document === 'undefined' || typeof GLOBAL$3.document.documentElement === 'undefined')
462
584
  return false;
463
- var element = globalThis.document.documentElement;
585
+ var element = GLOBAL$3.document.documentElement;
464
586
  var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
465
587
  if (typeof methods === 'undefined')
466
588
  return false;
@@ -486,7 +608,7 @@
486
608
  return false;
487
609
  }
488
610
  function resolveEventType(target, type) {
489
- if (target === globalThis.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
611
+ if (target === GLOBAL$3.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
490
612
  return type;
491
613
  if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
492
614
  return type;
@@ -495,10 +617,10 @@
495
617
  if (isEventTypeSupported(target, candidates[i]))
496
618
  return candidates[i];
497
619
  }
620
+ var hosts = probeHosts(target);
498
621
  for (var i = 1; i < VENDORS.length; i++) {
499
622
  for (var j = 0; j < candidates.length; j++) {
500
623
  var name_1 = VENDORS[i] + candidates[j];
501
- var hosts = probeHosts(target);
502
624
  for (var k = 0; k < hosts.length; k++) {
503
625
  if (hasOnProperty(hosts[k], name_1))
504
626
  return name_1;
@@ -508,6 +630,7 @@
508
630
  return type;
509
631
  }
510
632
 
633
+ var GLOBAL$2 = getGlobal$2();
511
634
  var SUPPORTED = {
512
635
  once: false,
513
636
  passive: false,
@@ -518,16 +641,16 @@
518
641
  var NOOP$1 = function () {
519
642
  };
520
643
  function resolveProbeTarget() {
521
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.createDocumentFragment === 'function') {
644
+ if (typeof GLOBAL$2.document !== 'undefined' && typeof GLOBAL$2.document.createDocumentFragment === 'function') {
522
645
  try {
523
- return globalThis.document.createDocumentFragment();
646
+ return GLOBAL$2.document.createDocumentFragment();
524
647
  }
525
648
  catch (_) {
526
649
  }
527
650
  }
528
- if (typeof globalThis.EventTarget === 'function') {
651
+ if (typeof GLOBAL$2.EventTarget === 'function') {
529
652
  try {
530
- return new globalThis.EventTarget();
653
+ return new GLOBAL$2.EventTarget();
531
654
  }
532
655
  catch (_) {
533
656
  }
@@ -598,6 +721,7 @@
598
721
  return normalized.capture;
599
722
  }
600
723
 
724
+ var GLOBAL$1$1 = getGlobal$2();
601
725
  var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
602
726
  var POINTER_PHASE_MAP = {
603
727
  'pointerdown': 'start',
@@ -633,17 +757,17 @@
633
757
  return -1;
634
758
  }
635
759
  function scrollOffsetX() {
636
- if (typeof globalThis.pageXOffset === 'number')
637
- return globalThis.pageXOffset;
638
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
639
- return globalThis.document.documentElement.scrollLeft;
760
+ if (typeof GLOBAL$1$1.pageXOffset === 'number')
761
+ return GLOBAL$1$1.pageXOffset;
762
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
763
+ return GLOBAL$1$1.document.documentElement.scrollLeft;
640
764
  return 0;
641
765
  }
642
766
  function scrollOffsetY() {
643
- if (typeof globalThis.pageYOffset === 'number')
644
- return globalThis.pageYOffset;
645
- if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.documentElement !== 'undefined')
646
- return globalThis.document.documentElement.scrollTop;
767
+ if (typeof GLOBAL$1$1.pageYOffset === 'number')
768
+ return GLOBAL$1$1.pageYOffset;
769
+ if (typeof GLOBAL$1$1.document !== 'undefined' && typeof GLOBAL$1$1.document.documentElement !== 'undefined')
770
+ return GLOBAL$1$1.document.documentElement.scrollTop;
647
771
  return 0;
648
772
  }
649
773
  function createSyntheticTouch(event, target) {
@@ -664,12 +788,20 @@
664
788
  force: typeof event.pressure === 'number' ? event.pressure : 0,
665
789
  };
666
790
  }
667
- function defineTouchList(event, property, list) {
791
+ function defineTouchList(event, property, list, patches) {
792
+ var holder = event;
793
+ var had = false;
794
+ try {
795
+ had = Object.prototype.hasOwnProperty.call(event, property);
796
+ }
797
+ catch (_) {
798
+ }
799
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
668
800
  try {
669
801
  Object.defineProperty(event, property, { value: list, configurable: true });
670
802
  }
671
803
  catch (_) {
672
- event[property] = list;
804
+ holder[property] = list;
673
805
  }
674
806
  }
675
807
  function filterByTarget(touches, target) {
@@ -680,7 +812,7 @@
680
812
  }
681
813
  return filtered;
682
814
  }
683
- function synthesizeTouchEvent(event, resolvedType) {
815
+ function synthesizeTouchEvent(event, resolvedType, patches) {
684
816
  var phase = POINTER_PHASE_MAP[resolvedType];
685
817
  if (typeof phase === 'undefined')
686
818
  return;
@@ -699,9 +831,9 @@
699
831
  if (index > -1)
700
832
  ACTIVE_TOUCHES.splice(index, 1);
701
833
  }
702
- defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
703
- defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
704
- defineTouchList(event, 'changedTouches', createTouchList([touch]));
834
+ defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES), patches);
835
+ defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)), patches);
836
+ defineTouchList(event, 'changedTouches', createTouchList([touch]), patches);
705
837
  }
706
838
 
707
839
  var KEY_CODE_MAP = {
@@ -808,21 +940,48 @@
808
940
  226: 'IntlBackslash',
809
941
  };
810
942
 
943
+ var GLOBAL$4 = getGlobal$2();
811
944
  var LISTENER_STORE = [];
812
945
  var NOOP = function () {
813
946
  };
947
+ var STORE_KEY = '__webEventKitListeners__';
948
+ function resolveBucket(target, create) {
949
+ var holder = target;
950
+ try {
951
+ var existing = holder[STORE_KEY];
952
+ if (typeof existing !== 'undefined' && existing !== null)
953
+ return existing;
954
+ if (!create)
955
+ return LISTENER_STORE;
956
+ var bucket = [];
957
+ try {
958
+ Object.defineProperty(target, STORE_KEY, { value: bucket, configurable: true, enumerable: false, writable: true });
959
+ }
960
+ catch (_) {
961
+ holder[STORE_KEY] = bucket;
962
+ }
963
+ if (holder[STORE_KEY] !== bucket)
964
+ return LISTENER_STORE;
965
+ return bucket;
966
+ }
967
+ catch (_) {
968
+ return LISTENER_STORE;
969
+ }
970
+ }
814
971
  function findListenerRecord(target, type, callback, capture) {
815
- for (var i = 0; i < LISTENER_STORE.length; i++) {
816
- var record = LISTENER_STORE[i];
972
+ var bucket = resolveBucket(target, false);
973
+ for (var i = 0; i < bucket.length; i++) {
974
+ var record = bucket[i];
817
975
  if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
818
976
  return record;
819
977
  }
820
978
  return undefined;
821
979
  }
822
980
  function removeListenerRecord(record) {
823
- for (var i = 0; i < LISTENER_STORE.length; i++) {
824
- if (LISTENER_STORE[i] === record) {
825
- LISTENER_STORE.splice(i, 1);
981
+ var bucket = record.bucket;
982
+ for (var i = 0; i < bucket.length; i++) {
983
+ if (bucket[i] === record) {
984
+ bucket.splice(i, 1);
826
985
  return;
827
986
  }
828
987
  }
@@ -842,6 +1001,32 @@
842
1001
  if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
843
1002
  return callback.handleEvent(event);
844
1003
  }
1004
+ function patchEventProperty(event, property, value, patches) {
1005
+ var holder = event;
1006
+ var had = false;
1007
+ try {
1008
+ had = Object.prototype.hasOwnProperty.call(event, property);
1009
+ }
1010
+ catch (_) {
1011
+ }
1012
+ patches.push({ property: property, had: had, previous: had ? holder[property] : undefined });
1013
+ defineEventProperty(event, property, value);
1014
+ }
1015
+ function restoreEventProperties(event, patches) {
1016
+ var holder = event;
1017
+ for (var i = patches.length - 1; i >= 0; i--) {
1018
+ var patch = patches[i];
1019
+ try {
1020
+ if (patch.had)
1021
+ defineEventProperty(event, patch.property, patch.previous);
1022
+ else
1023
+ delete holder[patch.property];
1024
+ }
1025
+ catch (_) {
1026
+ }
1027
+ }
1028
+ patches.length = 0;
1029
+ }
845
1030
  function defineEventProperty(event, property, value) {
846
1031
  try {
847
1032
  Object.defineProperty(event, property, { value: value, configurable: true });
@@ -874,7 +1059,7 @@
874
1059
  function createDispatcher(record) {
875
1060
  return function (event) {
876
1061
  if (typeof event === 'undefined')
877
- event = globalThis.event; // IE: implicit global event object
1062
+ event = GLOBAL$4.event; // IE: implicit global event object
878
1063
  if (typeof event === 'undefined' || event === null)
879
1064
  return;
880
1065
  if (record.released)
@@ -882,14 +1067,20 @@
882
1067
  fixLegacyEvent(event, record.target);
883
1068
  if (record.once)
884
1069
  releaseListenerRecord(record);
1070
+ var patches = [];
885
1071
  if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
886
- event.preventDefault = passivePreventDefault.bind(event);
1072
+ patchEventProperty(event, 'preventDefault', passivePreventDefault.bind(event), patches);
887
1073
  if (record.resolvedType !== record.type)
888
- defineEventProperty(event, 'type', record.type);
1074
+ patchEventProperty(event, 'type', record.type, patches);
889
1075
  if (record.touch)
890
- synthesizeTouchEvent(event, record.resolvedType);
1076
+ synthesizeTouchEvent(event, record.resolvedType, patches);
891
1077
  fixKeyboardEvent(event);
892
- invokeCallback(record.callback, record.target, event);
1078
+ try {
1079
+ invokeCallback(record.callback, record.target, event);
1080
+ }
1081
+ finally {
1082
+ restoreEventProperties(event, patches);
1083
+ }
893
1084
  };
894
1085
  }
895
1086
  function attachNativeListener(record) {
@@ -923,7 +1114,7 @@
923
1114
  }
924
1115
  if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
925
1116
  try {
926
- record.signal.removeEventListener('abort', record.onAbort);
1117
+ record.signal.removeEventListener('abort', record.onAbort, false);
927
1118
  }
928
1119
  catch (_) {
929
1120
  }
@@ -936,7 +1127,7 @@
936
1127
  }
937
1128
  catch (_) {
938
1129
  }
939
- var event = globalThis.document.createEvent('Event');
1130
+ var event = GLOBAL$4.document.createEvent('Event');
940
1131
  event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
941
1132
  return event;
942
1133
  }
@@ -946,12 +1137,12 @@
946
1137
  }
947
1138
  catch (_) {
948
1139
  }
949
- var event = globalThis.document.createEvent('CustomEvent');
1140
+ var event = GLOBAL$4.document.createEvent('CustomEvent');
950
1141
  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);
951
1142
  return event;
952
1143
  }
953
1144
  var EventKit = {
954
- version: packageJSON.version,
1145
+ version: packageJSON$1.version,
955
1146
  utils: {
956
1147
  get supportedOptions() {
957
1148
  return {
@@ -975,15 +1166,14 @@
975
1166
  return NOOP;
976
1167
  var normalized = normalizeListenerOptions(options);
977
1168
  var existing = findListenerRecord(target, type, callback, normalized.capture);
978
- if (typeof existing !== 'undefined') {
979
- return function () {
980
- releaseListenerRecord(existing);
981
- };
982
- }
1169
+ if (typeof existing !== 'undefined')
1170
+ return NOOP;
983
1171
  if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
984
1172
  return NOOP;
985
1173
  var resolvedType = resolveEventType(target, type);
1174
+ var bucket = resolveBucket(target, true);
986
1175
  var record = {
1176
+ bucket: bucket,
987
1177
  target: target,
988
1178
  type: type,
989
1179
  callback: callback,
@@ -1000,12 +1190,12 @@
1000
1190
  record.wrapper = createDispatcher(record);
1001
1191
  if (!attachNativeListener(record))
1002
1192
  return NOOP;
1003
- LISTENER_STORE.push(record);
1193
+ bucket.push(record);
1004
1194
  if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
1005
1195
  record.onAbort = function () {
1006
1196
  releaseListenerRecord(record);
1007
1197
  };
1008
- record.signal.addEventListener('abort', record.onAbort, { once: true });
1198
+ record.signal.addEventListener('abort', record.onAbort, false);
1009
1199
  }
1010
1200
  return function () {
1011
1201
  releaseListenerRecord(record);
@@ -1030,9 +1220,22 @@
1030
1220
  },
1031
1221
  };
1032
1222
 
1223
+ function getGlobal$1() {
1224
+ if (typeof globalThis !== 'undefined')
1225
+ return globalThis;
1226
+ if (typeof self !== 'undefined')
1227
+ return self;
1228
+ if (typeof window !== 'undefined')
1229
+ return window;
1230
+ if (typeof global !== 'undefined')
1231
+ return global;
1232
+ return {};
1233
+ }
1234
+
1033
1235
  function createHiddenElement(tagName, focusable) {
1034
1236
  if (focusable === void 0) { focusable = true; }
1035
- var element = globalThis.document.createElement(tagName);
1237
+ var document = getGlobal$1().document;
1238
+ var element = document.createElement(tagName);
1036
1239
  if (typeof element.width !== 'undefined')
1037
1240
  element.width = '0';
1038
1241
  if (typeof element.height !== 'undefined')
@@ -1083,116 +1286,301 @@
1083
1286
  return element;
1084
1287
  }
1085
1288
 
1086
- var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1087
- function normalizeLocale(locale) {
1088
- if (locale === null || typeof locale === 'undefined')
1089
- return locale;
1090
- if (locale.length === 0)
1289
+ var version = "0.0.5";
1290
+ var packageJSON = {
1291
+ version: version};
1292
+
1293
+ var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ji', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
1294
+ var RTL_SCRIPTS = ['Adlm', 'Arab', 'Aran', 'Hebr', 'Mand', 'Mend', 'Nkoo', 'Rohg', 'Samr', 'Syrc', 'Thaa', 'Yezi'];
1295
+ var LANGUAGE_PATTERN = /^[A-Za-z]{2,8}$/;
1296
+ var SCRIPT_PATTERN = /^[A-Za-z]{4}$/;
1297
+ var REGION_PATTERN = /^(?:[A-Za-z]{2}|[0-9]{3})$/;
1298
+ var VARIANT_PATTERN = /^(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})$/;
1299
+ var SINGLETON_PATTERN = /^[A-Za-z0-9]$/;
1300
+ var EXTENSION_PATTERN = /^[A-Za-z0-9]{1,8}$/;
1301
+ function getGlobal() {
1302
+ if (typeof globalThis !== 'undefined')
1303
+ return globalThis;
1304
+ if (typeof self !== 'undefined')
1305
+ return self;
1306
+ if (typeof window !== 'undefined')
1307
+ return window;
1308
+ if (typeof global !== 'undefined')
1309
+ return global;
1310
+ return {};
1311
+ }
1312
+ function freeze(values) {
1313
+ return typeof Object.freeze === 'function' ? Object.freeze(values) : values;
1314
+ }
1315
+ function contains(values, value) {
1316
+ for (var i = 0; i < values.length; i++) {
1317
+ if (values[i] === value)
1318
+ return true;
1319
+ }
1320
+ return false;
1321
+ }
1322
+ function getIntlLocaleConstructor() {
1323
+ if (typeof Intl === 'undefined')
1324
+ return undefined;
1325
+ var constructor = Intl.Locale;
1326
+ return typeof constructor === 'function' ? constructor : undefined;
1327
+ }
1328
+ function parseTag(raw) {
1329
+ if (raw === null || typeof raw !== 'string')
1330
+ return null;
1331
+ var value = raw.replace(/_/g, '-');
1332
+ if (value.length === 0)
1091
1333
  return null;
1092
- locale = locale.replace(/_/g, '-');
1093
- if (locale === 'C' || locale.toLowerCase() === 'posix')
1094
- return 'en-US';
1095
- if (locale.indexOf('.') !== -1)
1096
- return normalizeLocale(locale.split('.')[0]);
1097
- if (locale.indexOf('@') !== -1)
1098
- return normalizeLocale(locale.split('@')[0]);
1099
- var parts = locale.split('-');
1100
- if (parts.length === 0)
1334
+ if (value === 'C' || value.toLowerCase() === 'posix')
1335
+ value = 'en-US';
1336
+ var dot = value.indexOf('.');
1337
+ if (dot !== -1)
1338
+ value = value.slice(0, dot);
1339
+ var at = value.indexOf('@');
1340
+ if (at !== -1)
1341
+ value = value.slice(0, at);
1342
+ if (value.length === 0)
1101
1343
  return null;
1102
- parts[0] = parts[0].toLowerCase();
1103
- if (parts.length > 1 && parts[1].length === 2)
1104
- parts[1] = parts[1].toUpperCase();
1105
- if (parts.length > 2 && parts[1].length === 4)
1106
- parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
1107
- return parts.join('-');
1344
+ var segments = value.split('-');
1345
+ if (LANGUAGE_PATTERN.test(segments[0]) === false)
1346
+ return null;
1347
+ var language = segments[0].toLowerCase();
1348
+ var index = 1;
1349
+ var script = null;
1350
+ if (index < segments.length && SCRIPT_PATTERN.test(segments[index])) {
1351
+ script = segments[index].charAt(0).toUpperCase() + segments[index].slice(1).toLowerCase();
1352
+ index++;
1353
+ }
1354
+ var region = null;
1355
+ if (index < segments.length && REGION_PATTERN.test(segments[index])) {
1356
+ region = segments[index].toUpperCase();
1357
+ index++;
1358
+ }
1359
+ var variants = [];
1360
+ while (index < segments.length && VARIANT_PATTERN.test(segments[index])) {
1361
+ variants.push(segments[index].toLowerCase());
1362
+ index++;
1363
+ }
1364
+ var extensions = [];
1365
+ while (index < segments.length) {
1366
+ var singleton = segments[index];
1367
+ if (SINGLETON_PATTERN.test(singleton) === false)
1368
+ return null;
1369
+ var isPrivateUse = singleton.toLowerCase() === 'x';
1370
+ var parts = [singleton.toLowerCase()];
1371
+ index++;
1372
+ while (index < segments.length) {
1373
+ var segment = segments[index];
1374
+ if (EXTENSION_PATTERN.test(segment) === false)
1375
+ return null;
1376
+ if (segment.length === 1 && isPrivateUse === false)
1377
+ break;
1378
+ parts.push(segment.toLowerCase());
1379
+ index++;
1380
+ }
1381
+ if (parts.length < 2)
1382
+ return null;
1383
+ extensions.push(parts.join('-'));
1384
+ }
1385
+ var base = [language];
1386
+ if (script !== null)
1387
+ base.push(script);
1388
+ if (region !== null)
1389
+ base.push(region);
1390
+ for (var i = 0; i < variants.length; i++)
1391
+ base.push(variants[i]);
1392
+ var baseName = base.join('-');
1393
+ return {
1394
+ tag: extensions.length === 0 ? baseName : baseName + '-' + extensions.join('-'),
1395
+ baseName: baseName,
1396
+ language: language,
1397
+ script: script,
1398
+ region: region,
1399
+ variants: freeze(variants),
1400
+ extensions: freeze(extensions),
1401
+ };
1108
1402
  }
1403
+ function isRTL(subtags) {
1404
+ if (subtags.script !== null)
1405
+ return contains(RTL_SCRIPTS, subtags.script);
1406
+ return contains(RTL_LANGUAGES, subtags.language);
1407
+ }
1408
+ function expandTag(tag) {
1409
+ var parsed = parseTag(tag);
1410
+ if (parsed === null)
1411
+ return freeze([]);
1412
+ var segments = parsed.baseName.split('-');
1413
+ var chain = [];
1414
+ for (var i = segments.length; i > 0; i--)
1415
+ chain.push(segments.slice(0, i).join('-'));
1416
+ return freeze(chain);
1417
+ }
1418
+ function toLookupKey(tag) {
1419
+ var parsed = parseTag(tag);
1420
+ return (parsed === null ? tag : parsed.baseName).toLowerCase();
1421
+ }
1422
+ function lookupTag(supported, preferred, fallback) {
1423
+ if (supported === null || typeof supported === 'undefined' || typeof supported.length !== 'number')
1424
+ return fallback;
1425
+ var keys = [];
1426
+ for (var i = 0; i < supported.length; i++)
1427
+ keys.push(toLookupKey(supported[i]));
1428
+ for (var i = 0; i < preferred.length; i++) {
1429
+ var chain = expandTag(preferred[i]);
1430
+ for (var j = 0; j < chain.length; j++) {
1431
+ var candidate = chain[j].toLowerCase();
1432
+ var prefix = candidate + '-';
1433
+ for (var k = 0; k < keys.length; k++) {
1434
+ if (keys[k] === candidate)
1435
+ return supported[k];
1436
+ }
1437
+ for (var k = 0; k < keys.length; k++) {
1438
+ if (keys[k].indexOf(prefix) === 0)
1439
+ return supported[k];
1440
+ }
1441
+ }
1442
+ }
1443
+ return fallback;
1444
+ }
1445
+ function resolveDirection(primary) {
1446
+ if (primary === null)
1447
+ return false;
1448
+ var IntlLocale = getIntlLocaleConstructor();
1449
+ if (typeof IntlLocale !== 'undefined') {
1450
+ try {
1451
+ var intlLocale = new IntlLocale(primary.tag);
1452
+ if (typeof intlLocale.getTextInfo === 'function')
1453
+ return intlLocale.getTextInfo().direction === 'rtl';
1454
+ if (typeof intlLocale.textInfo !== 'undefined')
1455
+ return intlLocale.textInfo.direction === 'rtl';
1456
+ }
1457
+ catch (_) {
1458
+ }
1459
+ }
1460
+ return isRTL(primary);
1461
+ }
1462
+ var subtags = null;
1109
1463
  var language = null;
1110
- var languages = [];
1464
+ var languages = freeze([]);
1465
+ var fallbacks = freeze([]);
1111
1466
  var timezone = null;
1112
1467
  var offset = 0;
1113
- var isRTLResolved = null;
1114
- function addLanguages(langs) {
1115
- for (var i = 0; i < langs.length; i++)
1116
- addLanguage(langs[i]);
1117
- }
1118
- function addLanguage(lang) {
1119
- lang = normalizeLocale(lang);
1120
- if (typeof lang === 'string' && languages.indexOf(lang) === -1) {
1121
- if (language === null)
1122
- language = lang;
1123
- languages.push(lang);
1468
+ var rtl = false;
1469
+ function resolveLanguages(candidates) {
1470
+ var resolved = [];
1471
+ var primary = null;
1472
+ for (var i = 0; i < candidates.length; i++) {
1473
+ var parsed = parseTag(candidates[i]);
1474
+ if (parsed === null)
1475
+ continue;
1476
+ if (contains(resolved, parsed.baseName))
1477
+ continue;
1478
+ if (primary === null)
1479
+ primary = parsed;
1480
+ resolved.push(parsed.baseName);
1481
+ }
1482
+ subtags = primary;
1483
+ language = primary === null ? null : primary.baseName;
1484
+ languages = freeze(resolved);
1485
+ fallbacks = primary === null ? freeze([]) : expandTag(primary.baseName);
1486
+ rtl = resolveDirection(primary);
1487
+ }
1488
+ function collectEnvironmentLanguages() {
1489
+ var candidates = [];
1490
+ var navigatorLike = getGlobal().navigator;
1491
+ if (typeof navigatorLike !== 'undefined' && navigatorLike !== null) {
1492
+ if (typeof navigatorLike.languages !== 'undefined' && navigatorLike.languages !== null) {
1493
+ for (var i = 0; i < navigatorLike.languages.length; i++)
1494
+ candidates.push(navigatorLike.languages[i]);
1495
+ }
1496
+ candidates.push(navigatorLike.language);
1497
+ candidates.push(navigatorLike.userLanguage);
1498
+ candidates.push(navigatorLike.browserLanguage);
1499
+ candidates.push(navigatorLike.systemLanguage);
1500
+ }
1501
+ if (typeof Intl !== 'undefined') {
1502
+ try {
1503
+ candidates.push(Intl.DateTimeFormat().resolvedOptions().locale);
1504
+ }
1505
+ catch (_) {
1506
+ }
1124
1507
  }
1508
+ return candidates;
1125
1509
  }
1510
+ var ENVIRONMENT_LANGUAGES = collectEnvironmentLanguages();
1511
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1126
1512
  if (typeof Intl !== 'undefined') {
1127
- try {
1128
- addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
1129
- }
1130
- catch (_) {
1131
- }
1132
1513
  try {
1133
1514
  timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
1134
1515
  }
1135
1516
  catch (_) {
1136
1517
  }
1137
1518
  }
1138
- if (typeof globalThis.navigator !== 'undefined') {
1139
- if (typeof globalThis.navigator.languages !== 'undefined')
1140
- addLanguages(globalThis.navigator.languages);
1141
- if (typeof globalThis.navigator.language !== 'undefined')
1142
- addLanguage(globalThis.navigator.language);
1143
- if (typeof globalThis.navigator.userLanguage !== 'undefined')
1144
- addLanguage(globalThis.navigator.userLanguage);
1145
- if (typeof globalThis.navigator.browserLanguage !== 'undefined')
1146
- addLanguage(globalThis.navigator.browserLanguage);
1147
- if (typeof globalThis.navigator.systemLanguage !== 'undefined')
1148
- addLanguage(globalThis.navigator.systemLanguage);
1149
- }
1150
1519
  try {
1151
1520
  offset = new Date().getTimezoneOffset() * -1;
1152
1521
  }
1153
1522
  catch (_) {
1154
1523
  }
1155
- if (typeof language === 'string') {
1156
- if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
1157
- try {
1158
- var intlLocale = new Intl.Locale(language);
1159
- if (typeof intlLocale.getTextInfo === 'function')
1160
- isRTLResolved = intlLocale.getTextInfo().direction === 'rtl';
1161
- else if (typeof intlLocale.textInfo !== 'undefined')
1162
- isRTLResolved = intlLocale.textInfo.direction === 'rtl';
1163
- }
1164
- catch (_) {
1165
- }
1166
- }
1167
- if (typeof isRTLResolved !== 'boolean') {
1168
- var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(language);
1169
- if (matched !== null) {
1170
- var lang = matched[1].toLowerCase();
1171
- for (var i = 0; i < RTL_LANGUAGES.length; i++) {
1172
- if (RTL_LANGUAGES[i] === lang) {
1173
- isRTLResolved = true;
1174
- break;
1175
- }
1176
- }
1177
- }
1178
- }
1179
- }
1180
1524
  var LocaleKit = {
1181
- languages: languages};
1525
+ version: packageJSON.version,
1526
+ get language() {
1527
+ return language;
1528
+ },
1529
+ get languages() {
1530
+ return languages;
1531
+ },
1532
+ set languages(value) {
1533
+ resolveLanguages(typeof value === 'string' ? [value] : value);
1534
+ },
1535
+ get subtags() {
1536
+ return subtags;
1537
+ },
1538
+ get fallbacks() {
1539
+ return fallbacks;
1540
+ },
1541
+ get timezone() {
1542
+ return timezone;
1543
+ },
1544
+ get offset() {
1545
+ return offset;
1546
+ },
1547
+ get rtl() {
1548
+ return rtl;
1549
+ },
1550
+ reset: function () {
1551
+ resolveLanguages(ENVIRONMENT_LANGUAGES);
1552
+ },
1553
+ parse: function (tag) {
1554
+ return parseTag(tag);
1555
+ },
1556
+ expand: function (tag) {
1557
+ return expandTag(tag);
1558
+ },
1559
+ lookup: function (supported, fallback) {
1560
+ return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
1561
+ },
1562
+ };
1563
+ if (typeof Object.freeze === 'function')
1564
+ Object.freeze(LocaleKit);
1182
1565
 
1566
+ var GLOBAL$1 = getGlobal$1();
1567
+ var CACHE_PREFIX = 'web-launch-kit:';
1183
1568
  var TRACK_ID = 'track-id';
1184
- var BUNDLE_ID = 'bundle-id';
1569
+ var PRODUCT_ID = 'product-id';
1185
1570
  var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
1571
+ function toCacheKey(mode, query) {
1572
+ return CACHE_PREFIX + mode + ':' + query;
1573
+ }
1186
1574
  var idCache = (function () {
1187
1575
  var supportsLocalStorage;
1188
1576
  try {
1189
- if (typeof globalThis.localStorage === 'undefined') {
1577
+ if (typeof GLOBAL$1.localStorage === 'undefined' || GLOBAL$1.localStorage === null) {
1190
1578
  supportsLocalStorage = false;
1191
1579
  }
1192
1580
  else {
1193
1581
  var key = '__id_cache_test__';
1194
- globalThis.localStorage.setItem(key, '');
1195
- globalThis.localStorage.removeItem(key);
1582
+ GLOBAL$1.localStorage.setItem(key, '');
1583
+ GLOBAL$1.localStorage.removeItem(key);
1196
1584
  supportsLocalStorage = true;
1197
1585
  }
1198
1586
  }
@@ -1203,7 +1591,7 @@
1203
1591
  return {
1204
1592
  get: function (mode, query) {
1205
1593
  try {
1206
- var item = globalThis.localStorage.getItem(mode + ':' + query);
1594
+ var item = GLOBAL$1.localStorage.getItem(toCacheKey(mode, query));
1207
1595
  if (item == null)
1208
1596
  return undefined;
1209
1597
  var split = item.split('|');
@@ -1211,7 +1599,7 @@
1211
1599
  return undefined;
1212
1600
  var expiry = +split[0];
1213
1601
  if (isNotANumber(expiry) || expiry < getNow()) {
1214
- globalThis.localStorage.removeItem(mode + ':' + query);
1602
+ GLOBAL$1.localStorage.removeItem(toCacheKey(mode, query));
1215
1603
  return undefined;
1216
1604
  }
1217
1605
  return split[1];
@@ -1222,7 +1610,7 @@
1222
1610
  },
1223
1611
  set: function (mode, query, id) {
1224
1612
  try {
1225
- globalThis.localStorage.setItem(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1613
+ GLOBAL$1.localStorage.setItem(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1226
1614
  }
1227
1615
  catch (_) {
1228
1616
  return;
@@ -1230,11 +1618,11 @@
1230
1618
  }
1231
1619
  };
1232
1620
  }
1233
- if (typeof globalThis.Map !== 'undefined') {
1234
- var cache_1 = new Map();
1621
+ if (typeof GLOBAL$1.Map !== 'undefined') {
1622
+ var cache_1 = new GLOBAL$1.Map();
1235
1623
  return {
1236
1624
  get: function (mode, query) {
1237
- var item = cache_1.get(mode + ':' + query);
1625
+ var item = cache_1.get(toCacheKey(mode, query));
1238
1626
  if (typeof item === 'undefined')
1239
1627
  return undefined;
1240
1628
  var split = item.split('|');
@@ -1242,20 +1630,20 @@
1242
1630
  return undefined;
1243
1631
  var expiry = +split[0];
1244
1632
  if (isNotANumber(expiry) || expiry < getNow()) {
1245
- cache_1.delete(mode + ':' + query);
1633
+ cache_1.delete(toCacheKey(mode, query));
1246
1634
  return undefined;
1247
1635
  }
1248
1636
  return split[1];
1249
1637
  },
1250
1638
  set: function (mode, query, id) {
1251
- cache_1.set(mode + ':' + query, getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1639
+ cache_1.set(toCacheKey(mode, query), getNow() + TRACK_ID_CACHE_TTL + '|' + id);
1252
1640
  },
1253
1641
  };
1254
1642
  }
1255
1643
  var cache = Object.create(null);
1256
1644
  return {
1257
1645
  get: function (mode, query) {
1258
- var item = cache[mode + ':' + query];
1646
+ var item = cache[toCacheKey(mode, query)];
1259
1647
  if (typeof item === 'undefined')
1260
1648
  return undefined;
1261
1649
  var split = item.split('|');
@@ -1264,17 +1652,17 @@
1264
1652
  var expiry = +split[0];
1265
1653
  if (isNotANumber(expiry) || expiry < getNow()) {
1266
1654
  try {
1267
- delete cache[mode + ':' + query];
1655
+ delete cache[toCacheKey(mode, query)];
1268
1656
  }
1269
1657
  catch (_) {
1270
- cache[mode + ':' + query] = undefined;
1658
+ cache[toCacheKey(mode, query)] = undefined;
1271
1659
  }
1272
1660
  return undefined;
1273
1661
  }
1274
1662
  return split[1];
1275
1663
  },
1276
1664
  set: function (mode, query, id) {
1277
- cache[mode + ':' + query] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1665
+ cache[toCacheKey(mode, query)] = getNow() + TRACK_ID_CACHE_TTL + '|' + id;
1278
1666
  }
1279
1667
  };
1280
1668
  })();
@@ -1288,8 +1676,8 @@
1288
1676
  }
1289
1677
  function requestGet(url, async) {
1290
1678
  if (async === void 0) { async = false; }
1291
- if (typeof globalThis.fetch === 'function' && async) {
1292
- return globalThis.fetch(url)
1679
+ if (typeof GLOBAL$1.fetch === 'function' && async) {
1680
+ return GLOBAL$1.fetch(url)
1293
1681
  .then(function (response) {
1294
1682
  return response.json();
1295
1683
  })
@@ -1332,10 +1720,10 @@
1332
1720
  if (locale === candidate)
1333
1721
  break;
1334
1722
  }
1335
- 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';
1723
+ return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(country) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
1336
1724
  }
1337
1725
  function resolveGetTrackIdURL(bundleId) {
1338
- return 'https://itunes.apple.com/lookup?bundleId=' + globalThis.encodeURIComponent(bundleId);
1726
+ return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
1339
1727
  }
1340
1728
  function parseGetProductIdResponse(response) {
1341
1729
  if (typeof response === 'undefined')
@@ -1361,14 +1749,14 @@
1361
1749
  return '' + result.trackId;
1362
1750
  }
1363
1751
  function getProductId(packageFamilyName) {
1364
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1752
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1365
1753
  if (typeof cache !== 'undefined')
1366
1754
  return cache;
1367
1755
  try {
1368
1756
  var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
1369
1757
  if (typeof productId === 'undefined')
1370
1758
  return undefined;
1371
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1759
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1372
1760
  return productId;
1373
1761
  }
1374
1762
  catch (_) {
@@ -1391,7 +1779,7 @@
1391
1779
  }
1392
1780
  }
1393
1781
  function getProductIdAsync(packageFamilyName) {
1394
- var cache = idCache.get(BUNDLE_ID, packageFamilyName);
1782
+ var cache = idCache.get(PRODUCT_ID, packageFamilyName);
1395
1783
  if (typeof cache !== 'undefined')
1396
1784
  return Promise.resolve(cache);
1397
1785
  try {
@@ -1400,7 +1788,7 @@
1400
1788
  .then(function (productId) {
1401
1789
  if (typeof productId === 'undefined')
1402
1790
  return undefined;
1403
- idCache.set(BUNDLE_ID, packageFamilyName, productId);
1791
+ idCache.set(PRODUCT_ID, packageFamilyName, productId);
1404
1792
  return productId;
1405
1793
  });
1406
1794
  }
@@ -1428,15 +1816,16 @@
1428
1816
  }
1429
1817
 
1430
1818
  function getTopmostWindow() {
1819
+ var globalLike = getGlobal$1();
1431
1820
  try {
1432
- if (globalThis.top !== null && globalThis.top !== globalThis.window) {
1433
- void globalThis.top.location.href;
1434
- return globalThis.top;
1821
+ if (typeof globalLike.top !== 'undefined' && globalLike.top !== null && globalLike.top !== globalLike.window) {
1822
+ void globalLike.top.location.href;
1823
+ return globalLike.top;
1435
1824
  }
1436
1825
  }
1437
1826
  catch (_) {
1438
1827
  }
1439
- return globalThis;
1828
+ return globalLike;
1440
1829
  }
1441
1830
 
1442
1831
  exports.SettingType = void 0;
@@ -1507,8 +1896,10 @@
1507
1896
  var WINDOWS_DEFAULT_TIMEOUT = 750;
1508
1897
  var MACOS_DEFAULT_TIMEOUT = 750;
1509
1898
  var DEFAULT_TIMEOUT = 750;
1510
- var NAVIGATOR = globalThis.navigator;
1899
+ var GLOBAL = getGlobal$1();
1900
+ var NAVIGATOR = GLOBAL.navigator;
1511
1901
  var CLEANUP_INPUT_ELEMENT = null;
1902
+ var DEBUG = false;
1512
1903
  function createTypeGuard(tag) {
1513
1904
  return function (value) {
1514
1905
  return Object.prototype.toString.call(value) === '[object ' + tag + ']';
@@ -1567,7 +1958,7 @@
1567
1958
  return true;
1568
1959
  }
1569
1960
  function dispatchClickEvent(element, view) {
1570
- if (view === void 0) { view = globalThis; }
1961
+ if (view === void 0) { view = GLOBAL; }
1571
1962
  var fake;
1572
1963
  try {
1573
1964
  fake = new MouseEvent('click', {
@@ -1577,7 +1968,7 @@
1577
1968
  });
1578
1969
  }
1579
1970
  catch (_) {
1580
- fake = globalThis.document.createEvent('MouseEvents');
1971
+ fake = GLOBAL.document.createEvent('MouseEvents');
1581
1972
  fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1582
1973
  }
1583
1974
  element.dispatchEvent(fake);
@@ -1605,11 +1996,14 @@
1605
1996
  focus(top);
1606
1997
  if (hasFocus(topDocument))
1607
1998
  return true;
1608
- if (topDocument.body.tabIndex < 0)
1609
- topDocument.body.tabIndex = -1;
1999
+ var hadBodyTabIndex = topDocument.body.hasAttribute('tabindex');
2000
+ if (!hadBodyTabIndex)
2001
+ topDocument.body.setAttribute('tabindex', '-1');
1610
2002
  focus(topDocument.body);
1611
2003
  if (hasFocus(topDocument))
1612
2004
  return true;
2005
+ if (!hadBodyTabIndex)
2006
+ topDocument.body.removeAttribute('tabindex');
1613
2007
  var input = undefined;
1614
2008
  try {
1615
2009
  input = createHiddenElement('input');
@@ -1651,7 +2045,7 @@
1651
2045
  function resolveFocusEventConfig() {
1652
2046
  var top = getTopmostWindow();
1653
2047
  var topDocument = top.document;
1654
- if (typeof globalThis.cordova !== 'undefined') {
2048
+ if (typeof GLOBAL.cordova !== 'undefined') {
1655
2049
  return {
1656
2050
  focus: {
1657
2051
  target: topDocument,
@@ -1689,7 +2083,7 @@
1689
2083
  };
1690
2084
  }
1691
2085
  }
1692
- else if (typeof globalThis.document.addEventListener === 'function') {
2086
+ else if (typeof GLOBAL.document.addEventListener === 'function') {
1693
2087
  return {
1694
2088
  focus: {
1695
2089
  target: top,
@@ -1729,12 +2123,12 @@
1729
2123
  var anchor = undefined;
1730
2124
  var iframe = undefined;
1731
2125
  function open() {
1732
- if (typeof globalThis.cordova !== 'undefined') {
1733
- if (typeof globalThis.cordova.InAppBrowser !== 'undefined') {
1734
- globalThis.cordova.InAppBrowser.open(url, '_system');
2126
+ if (typeof GLOBAL.cordova !== 'undefined' && GLOBAL.cordova !== null) {
2127
+ if (typeof GLOBAL.cordova.InAppBrowser !== 'undefined') {
2128
+ GLOBAL.cordova.InAppBrowser.open(url, '_system');
1735
2129
  }
1736
- else {
1737
- globalThis.open(url, '_system');
2130
+ else if (typeof GLOBAL.open === 'function') {
2131
+ GLOBAL.open(url, '_system');
1738
2132
  }
1739
2133
  return;
1740
2134
  }
@@ -1764,7 +2158,7 @@
1764
2158
  iframe = createHiddenElement('iframe');
1765
2159
  iframe.src = url;
1766
2160
  topDocument.body.appendChild(iframe);
1767
- globalThis.setTimeout(function () {
2161
+ setTimeout(function () {
1768
2162
  if (typeof iframe !== 'undefined') {
1769
2163
  try {
1770
2164
  topDocument.body.removeChild(iframe);
@@ -1779,7 +2173,8 @@
1779
2173
  }
1780
2174
  }
1781
2175
  return new Promise(function (resolve, reject) {
1782
- debugger;
2176
+ if (DEBUG)
2177
+ debugger;
1783
2178
  var timeoutId;
1784
2179
  var resolved = false;
1785
2180
  function cleanup() {
@@ -1828,7 +2223,7 @@
1828
2223
  timeoutId = undefined;
1829
2224
  }
1830
2225
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1831
- EventKit.remove(config.blur.target, config.blur.type, onfocus);
2226
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1832
2227
  if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1833
2228
  EventKit.add(config.focus.target, config.focus.type, onfocus);
1834
2229
  }
@@ -1841,7 +2236,7 @@
1841
2236
  else
1842
2237
  onfocus();
1843
2238
  }
1844
- timeoutId = globalThis.setTimeout(function () {
2239
+ timeoutId = setTimeout(function () {
1845
2240
  done(false);
1846
2241
  }, timeout);
1847
2242
  if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
@@ -2049,13 +2444,22 @@
2049
2444
  function isPartnerAppOnly() {
2050
2445
  return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
2051
2446
  }
2447
+ function canOpenWindowsSetting(version) {
2448
+ if (version.length === 0)
2449
+ return false;
2450
+ if (/^\d/.test(version) === false)
2451
+ return false;
2452
+ if (version === '95' || version === '98' || version === '2000')
2453
+ return false;
2454
+ return PlatformKit.compareVersion(version, '10') >= 0;
2455
+ }
2052
2456
  function canOpenSetting() {
2053
2457
  var os = PlatformKit.os.name;
2054
2458
  var version = PlatformKit.os.version;
2055
2459
  return !(os === 'unknown'
2056
2460
  || (os === 'android' && !canOpenIntent())
2057
2461
  || os === 'ios'
2058
- || (os === 'windows' && (version === 'Vista' || version === 'XP' || version === '2000' || version === 'NT 4.0' || version === 'NT 3.11' || version === 'ME' || PlatformKit.compareVersion(version, '10') < 0))
2462
+ || (os === 'windows' && !canOpenWindowsSetting(version))
2059
2463
  || (os === 'macos' && PlatformKit.compareVersion(version, '10.10') < 0));
2060
2464
  }
2061
2465
  function parseIntentURL(intent) {
@@ -2084,7 +2488,7 @@
2084
2488
  if (typeof extras['S.browser_fallback_url'] !== 'undefined') {
2085
2489
  var fallback = extras['S.browser_fallback_url'];
2086
2490
  try {
2087
- fallback = globalThis.decodeURIComponent(fallback);
2491
+ fallback = decodeURIComponent(fallback);
2088
2492
  }
2089
2493
  catch (_) {
2090
2494
  }
@@ -2104,9 +2508,9 @@
2104
2508
  if (typeof packageName !== 'undefined')
2105
2509
  intent += 'package=' + packageName + ';';
2106
2510
  if (typeof fallback !== 'undefined' && typeof fallback === 'string')
2107
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(fallback) + ';';
2511
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(fallback) + ';';
2108
2512
  else if (typeof packageName !== 'undefined')
2109
- intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2513
+ intent += 'S.browser_fallback_url=' + encodeURIComponent(createAppStoreURL(packageName, 'android')) + ';';
2110
2514
  return intent + 'end';
2111
2515
  }
2112
2516
  function createAppStoreURL(id, os) {
@@ -2138,7 +2542,7 @@
2138
2542
  }
2139
2543
  }
2140
2544
  function escapeURIComponentString(value) {
2141
- return globalThis.encodeURIComponent(value)
2545
+ return encodeURIComponent(value)
2142
2546
  .replace(/[!'()*]/g, function (char) {
2143
2547
  return '%' + char.charCodeAt(0).toString(16);
2144
2548
  });
@@ -2207,10 +2611,10 @@
2207
2611
  return typeof NAVIGATOR !== 'undefined' && typeof NAVIGATOR.userActivation !== 'undefined' && NAVIGATOR.userActivation.isActive;
2208
2612
  }
2209
2613
  function canShowDirectoryPicker() {
2210
- return typeof globalThis.showDirectoryPicker === 'function';
2614
+ return typeof GLOBAL.showDirectoryPicker === 'function';
2211
2615
  }
2212
2616
  function canShowOpenFilePicker() {
2213
- return typeof globalThis.showOpenFilePicker === 'function';
2617
+ return typeof GLOBAL.showOpenFilePicker === 'function';
2214
2618
  }
2215
2619
  function isFileSystemFileHandle(handle) {
2216
2620
  return handle.kind === 'file';
@@ -2278,7 +2682,7 @@
2278
2682
  resolve(fileListToArray(module.files));
2279
2683
  }
2280
2684
  function onfocus() {
2281
- globalThis.setTimeout(function () {
2685
+ setTimeout(function () {
2282
2686
  if (module.value.length > 0)
2283
2687
  done(true);
2284
2688
  else
@@ -2308,7 +2712,7 @@
2308
2712
  EventKit.add(config.focus.target, config.focus.type, onfocus);
2309
2713
  if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2310
2714
  EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2311
- globalThis.setTimeout(function () {
2715
+ setTimeout(function () {
2312
2716
  EventKit.add(topDocument, 'click', onclick);
2313
2717
  }, 100);
2314
2718
  CLEANUP_INPUT_ELEMENT = function () {
@@ -2393,7 +2797,13 @@
2393
2797
  }
2394
2798
  var LaunchKit = {
2395
2799
  SettingType: exports.SettingType,
2396
- version: packageJSON$2.version,
2800
+ version: packageJSON$3.version,
2801
+ get debug() {
2802
+ return DEBUG;
2803
+ },
2804
+ set debug(value) {
2805
+ DEBUG = value === true;
2806
+ },
2397
2807
  utils: {
2398
2808
  get canOpenIntent() {
2399
2809
  return canOpenIntent();
@@ -2441,7 +2851,12 @@
2441
2851
  }
2442
2852
  else {
2443
2853
  tried[index] = '[function fallback]';
2444
- url();
2854
+ try {
2855
+ url();
2856
+ }
2857
+ catch (_) {
2858
+ return openURLSequential(index + 1);
2859
+ }
2445
2860
  resolve(by);
2446
2861
  }
2447
2862
  }
@@ -2614,7 +3029,7 @@
2614
3029
  option.id = options.id;
2615
3030
  if (typeof options.startIn !== 'undefined')
2616
3031
  option.startIn = options.startIn;
2617
- module = globalThis.showDirectoryPicker(option);
3032
+ module = GLOBAL.showDirectoryPicker(option);
2618
3033
  }
2619
3034
  else {
2620
3035
  var input = createHiddenElement('input');
@@ -2652,7 +3067,7 @@
2652
3067
  }
2653
3068
  }
2654
3069
  }
2655
- module = globalThis.showOpenFilePicker(option);
3070
+ module = GLOBAL.showOpenFilePicker(option);
2656
3071
  }
2657
3072
  else {
2658
3073
  var input = createHiddenElement('input');