web-launch-kit 0.0.1 → 0.0.3

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,11 +1,11 @@
1
- var version$1 = "0.0.1";
1
+ var version$2 = "0.0.3";
2
+ var packageJSON$2 = {
3
+ version: version$2};
4
+
5
+ var version$1 = "0.0.4";
2
6
  var packageJSON$1 = {
3
7
  version: version$1};
4
8
 
5
- var version = "0.0.4";
6
- var packageJSON = {
7
- version: version};
8
-
9
9
  var NAVIGATOR$1 = globalThis.navigator;
10
10
  var USER_AGENT = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgent : '';
11
11
  var USER_AGENT_DATA = typeof NAVIGATOR$1 !== 'undefined' ? NAVIGATOR$1.userAgentData : undefined;
@@ -294,7 +294,7 @@ function parseFromHighEntropyValues() {
294
294
  }
295
295
  ready = parseFromHighEntropyValues();
296
296
  var PlatformKit = {
297
- version: packageJSON.version,
297
+ version: packageJSON$1.version,
298
298
  get ready() {
299
299
  return ready;
300
300
  },
@@ -365,6 +365,665 @@ var PlatformKit = {
365
365
  }
366
366
  };
367
367
 
368
+ var version = "0.0.1";
369
+ var packageJSON = {
370
+ version: version};
371
+
372
+ var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
373
+ // https://cordova.apache.org/docs/en/latest/cordova/events/events.html
374
+ var CORDOVA_DOCUMENT_EVENTS = ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'];
375
+ // iOS `<video>` fullscreen events have no `on` attribute but are valid on any element exposing `webkitEnterFullscreen` — they must pass through untouched.
376
+ var IOS_VIDEO_FULLSCREEN_EVENTS = ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'];
377
+ var TYPE_ALIAS_MAP = {
378
+ 'focus': ['focus', 'focusin'],
379
+ 'blur': ['blur', 'focusout'],
380
+ 'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
381
+ 'fullscreenchange': ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange', 'msfullscreenchange'],
382
+ 'fullscreenerror': ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError', 'msfullscreenerror'],
383
+ 'pointerdown': ['pointerdown', 'MSPointerDown'],
384
+ 'pointermove': ['pointermove', 'MSPointerMove'],
385
+ 'pointerup': ['pointerup', 'MSPointerUp'],
386
+ 'pointercancel': ['pointercancel', 'MSPointerCancel'],
387
+ 'pointerover': ['pointerover', 'MSPointerOver'],
388
+ 'pointerout': ['pointerout', 'MSPointerOut'],
389
+ 'pointerenter': ['pointerenter', 'MSPointerEnter', 'mouseenter'],
390
+ 'pointerleave': ['pointerleave', 'MSPointerLeave', 'mouseleave'],
391
+ 'gotpointercapture': ['gotpointercapture', 'MSGotPointerCapture'],
392
+ 'lostpointercapture': ['lostpointercapture', 'MSLostPointerCapture'],
393
+ 'pointerlockchange': ['pointerlockchange', 'webkitpointerlockchange', 'mozpointerlockchange', 'mspointerlockchange'],
394
+ 'pointerlockerror': ['pointerlockerror', 'webkitpointerlockerror', 'mozpointerlockerror', 'mspointerlockerror'],
395
+ 'touchstart': ['touchstart', 'pointerdown', 'MSPointerDown'],
396
+ 'touchmove': ['touchmove', 'pointermove', 'MSPointerMove'],
397
+ 'touchend': ['touchend', 'pointerup', 'MSPointerUp'],
398
+ 'touchcancel': ['touchcancel', 'pointercancel', 'MSPointerCancel'],
399
+ 'transitionrun': ['transitionrun', 'webkitTransitionRun'],
400
+ 'transitionstart': ['transitionstart', 'webkitTransitionStart'],
401
+ 'transitionend': ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'otransitionend', 'MSTransitionEnd'],
402
+ 'animationstart': ['animationstart', 'webkitAnimationStart', 'oanimationstart', 'MSAnimationStart'],
403
+ 'animationiteration': ['animationiteration', 'webkitAnimationIteration', 'oanimationiteration', 'MSAnimationIteration'],
404
+ 'animationend': ['animationend', 'webkitAnimationEnd', 'oanimationend', 'MSAnimationEnd'],
405
+ 'visibilitychange': ['visibilitychange', 'webkitvisibilitychange', 'mozvisibilitychange', 'msvisibilitychange'],
406
+ };
407
+ var FULLSCREEN_REQUEST_MAP = {
408
+ '': ['requestFullscreen'],
409
+ 'webkit': ['webkitRequestFullscreen', 'webkitRequestFullScreen'],
410
+ 'moz': ['mozRequestFullScreen', 'mozRequestFullscreen'],
411
+ 'ms': ['msRequestFullscreen'],
412
+ 'MS': ['msRequestFullscreen'],
413
+ };
414
+ function asRecord(value) {
415
+ return value;
416
+ }
417
+ function hasOnProperty(host, name) {
418
+ if (typeof host === 'undefined' || host === null)
419
+ return false;
420
+ if (typeof asRecord(host)['on' + name] !== 'undefined')
421
+ return true;
422
+ var lower = name.toLowerCase();
423
+ return lower !== name && typeof asRecord(host)['on' + lower] !== 'undefined';
424
+ }
425
+ function probeHosts(target) {
426
+ 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);
431
+ return hosts;
432
+ }
433
+ function extractVendorPrefix(name) {
434
+ for (var i = 1; i < VENDORS.length; i++) {
435
+ if (name.indexOf(VENDORS[i]) === 0)
436
+ return VENDORS[i];
437
+ }
438
+ return '';
439
+ }
440
+ function testStyleSupport(name, styleProperty) {
441
+ if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
442
+ return false;
443
+ var style = globalThis.document.documentElement.style;
444
+ if (typeof style === 'undefined' || style === null)
445
+ return false;
446
+ var prefix = extractVendorPrefix(name);
447
+ var property;
448
+ if (prefix === '')
449
+ property = styleProperty;
450
+ else
451
+ property = prefix + styleProperty.charAt(0).toUpperCase() + styleProperty.slice(1);
452
+ return typeof asRecord(style)[property] !== 'undefined';
453
+ }
454
+ function testFullscreenSupport(name) {
455
+ if (typeof globalThis.document === 'undefined' || typeof globalThis.document.documentElement === 'undefined')
456
+ return false;
457
+ var element = globalThis.document.documentElement;
458
+ var methods = FULLSCREEN_REQUEST_MAP[extractVendorPrefix(name)];
459
+ if (typeof methods === 'undefined')
460
+ return false;
461
+ for (var i = 0; i < methods.length; i++) {
462
+ if (typeof asRecord(element)[methods[i]] === 'function')
463
+ return true;
464
+ }
465
+ return false;
466
+ }
467
+ function isEventTypeSupported(target, name) {
468
+ var hosts = probeHosts(target);
469
+ for (var i = 0; i < hosts.length; i++) {
470
+ if (hasOnProperty(hosts[i], name))
471
+ return true;
472
+ }
473
+ var lower = name.toLowerCase();
474
+ if (lower.indexOf('transition') > -1)
475
+ return testStyleSupport(name, 'transition');
476
+ if (lower.indexOf('animation') > -1)
477
+ return testStyleSupport(name, 'animation');
478
+ if (lower.indexOf('fullscreen') > -1)
479
+ return testFullscreenSupport(name);
480
+ return false;
481
+ }
482
+ function resolveEventType(target, type) {
483
+ if (target === globalThis.document && CORDOVA_DOCUMENT_EVENTS.indexOf(type) > -1)
484
+ return type;
485
+ if (typeof asRecord(target)['webkitEnterFullscreen'] === 'function' && IOS_VIDEO_FULLSCREEN_EVENTS.indexOf(type) > -1)
486
+ return type;
487
+ var candidates = typeof TYPE_ALIAS_MAP[type] !== 'undefined' ? TYPE_ALIAS_MAP[type] : [type];
488
+ for (var i = 0; i < candidates.length; i++) {
489
+ if (isEventTypeSupported(target, candidates[i]))
490
+ return candidates[i];
491
+ }
492
+ for (var i = 1; i < VENDORS.length; i++) {
493
+ for (var j = 0; j < candidates.length; j++) {
494
+ var name_1 = VENDORS[i] + candidates[j];
495
+ var hosts = probeHosts(target);
496
+ for (var k = 0; k < hosts.length; k++) {
497
+ if (hasOnProperty(hosts[k], name_1))
498
+ return name_1;
499
+ }
500
+ }
501
+ }
502
+ return type;
503
+ }
504
+
505
+ var SUPPORTED = {
506
+ once: false,
507
+ passive: false,
508
+ capture: false,
509
+ some: false,
510
+ all: false,
511
+ };
512
+ var NOOP$1 = function () {
513
+ };
514
+ function resolveProbeTarget() {
515
+ if (typeof globalThis.document !== 'undefined' && typeof globalThis.document.createDocumentFragment === 'function') {
516
+ try {
517
+ return globalThis.document.createDocumentFragment();
518
+ }
519
+ catch (_) {
520
+ }
521
+ }
522
+ if (typeof globalThis.EventTarget === 'function') {
523
+ try {
524
+ return new globalThis.EventTarget();
525
+ }
526
+ catch (_) {
527
+ }
528
+ }
529
+ return undefined;
530
+ }
531
+ (function detectSupportedListenerOptions() {
532
+ var probe = resolveProbeTarget();
533
+ if (typeof probe === 'undefined' || typeof probe.addEventListener !== 'function')
534
+ return;
535
+ var options = {};
536
+ try {
537
+ Object.defineProperty(options, 'once', {
538
+ get: function () {
539
+ SUPPORTED.once = true;
540
+ return false;
541
+ },
542
+ });
543
+ Object.defineProperty(options, 'passive', {
544
+ get: function () {
545
+ SUPPORTED.passive = true;
546
+ return false;
547
+ },
548
+ });
549
+ Object.defineProperty(options, 'capture', {
550
+ get: function () {
551
+ SUPPORTED.capture = true;
552
+ return false;
553
+ },
554
+ });
555
+ probe.addEventListener('test', NOOP$1, options);
556
+ probe.removeEventListener('test', NOOP$1, options);
557
+ }
558
+ catch (_) {
559
+ }
560
+ SUPPORTED.some = SUPPORTED.once || SUPPORTED.passive || SUPPORTED.capture;
561
+ SUPPORTED.all = SUPPORTED.once && SUPPORTED.passive && SUPPORTED.capture;
562
+ })();
563
+ var SUPPORTED_LISTENER_OPTIONS = SUPPORTED;
564
+ function normalizeListenerOptions(options) {
565
+ if (typeof options === 'boolean')
566
+ return { capture: options, once: false, passive: false, signal: undefined };
567
+ if (typeof options === 'object' && options !== null) {
568
+ return {
569
+ capture: options.capture === true,
570
+ once: options.once === true,
571
+ passive: options.passive === true,
572
+ signal: options.signal,
573
+ };
574
+ }
575
+ return {
576
+ capture: Boolean(options),
577
+ once: false,
578
+ passive: false,
579
+ signal: undefined
580
+ };
581
+ }
582
+ function toNativeListenerOptions(normalized) {
583
+ if (SUPPORTED.passive)
584
+ return {
585
+ capture: normalized.capture,
586
+ passive: normalized.passive
587
+ };
588
+ if (SUPPORTED.capture)
589
+ return {
590
+ capture: normalized.capture
591
+ };
592
+ return normalized.capture;
593
+ }
594
+
595
+ var TOUCH_TYPES = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];
596
+ var POINTER_PHASE_MAP = {
597
+ 'pointerdown': 'start',
598
+ 'MSPointerDown': 'start',
599
+ 'pointermove': 'move',
600
+ 'MSPointerMove': 'move',
601
+ 'pointerup': 'end',
602
+ 'MSPointerUp': 'end',
603
+ 'pointercancel': 'cancel',
604
+ 'MSPointerCancel': 'cancel',
605
+ };
606
+ var ACTIVE_TOUCHES = [];
607
+ function isTouchEventType(type) {
608
+ return TOUCH_TYPES.indexOf(type) > -1;
609
+ }
610
+ function isPointerEventType(type) {
611
+ return typeof POINTER_PHASE_MAP[type] !== 'undefined';
612
+ }
613
+ function createTouchList(touches) {
614
+ var list = touches.slice();
615
+ list.item = function (index) {
616
+ if (index >= 0 && index < list.length)
617
+ return list[index];
618
+ return null;
619
+ };
620
+ return list;
621
+ }
622
+ function findTouchIndex(identifier) {
623
+ for (var i = 0; i < ACTIVE_TOUCHES.length; i++) {
624
+ if (ACTIVE_TOUCHES[i].identifier === identifier)
625
+ return i;
626
+ }
627
+ return -1;
628
+ }
629
+ 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;
634
+ return 0;
635
+ }
636
+ 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;
641
+ return 0;
642
+ }
643
+ function createSyntheticTouch(event, target) {
644
+ var clientX = typeof event.clientX === 'number' ? event.clientX : 0;
645
+ var clientY = typeof event.clientY === 'number' ? event.clientY : 0;
646
+ return {
647
+ identifier: typeof event.pointerId === 'number' ? event.pointerId : 0,
648
+ target: target,
649
+ screenX: typeof event.screenX === 'number' ? event.screenX : 0,
650
+ screenY: typeof event.screenY === 'number' ? event.screenY : 0,
651
+ clientX: clientX,
652
+ clientY: clientY,
653
+ pageX: typeof event.pageX === 'number' ? event.pageX : clientX + scrollOffsetX(),
654
+ pageY: typeof event.pageY === 'number' ? event.pageY : clientY + scrollOffsetY(),
655
+ radiusX: typeof event.width === 'number' ? event.width / 2 : 0,
656
+ radiusY: typeof event.height === 'number' ? event.height / 2 : 0,
657
+ rotationAngle: typeof event.rotation === 'number' ? event.rotation : 0,
658
+ force: typeof event.pressure === 'number' ? event.pressure : 0,
659
+ };
660
+ }
661
+ function defineTouchList(event, property, list) {
662
+ try {
663
+ Object.defineProperty(event, property, { value: list, configurable: true });
664
+ }
665
+ catch (_) {
666
+ event[property] = list;
667
+ }
668
+ }
669
+ function filterByTarget(touches, target) {
670
+ var filtered = [];
671
+ for (var i = 0; i < touches.length; i++) {
672
+ if (touches[i].target === target)
673
+ filtered.push(touches[i]);
674
+ }
675
+ return filtered;
676
+ }
677
+ function synthesizeTouchEvent(event, resolvedType) {
678
+ var phase = POINTER_PHASE_MAP[resolvedType];
679
+ if (typeof phase === 'undefined')
680
+ return;
681
+ var pointerEvent = event;
682
+ var eventTarget = event.target;
683
+ var index = findTouchIndex(typeof pointerEvent.pointerId === 'number' ? pointerEvent.pointerId : 0);
684
+ var originTarget = index > -1 ? ACTIVE_TOUCHES[index].target : eventTarget;
685
+ var touch = createSyntheticTouch(pointerEvent, originTarget);
686
+ if (phase === 'start' || phase === 'move') {
687
+ if (index > -1)
688
+ ACTIVE_TOUCHES[index] = touch;
689
+ else
690
+ ACTIVE_TOUCHES.push(touch);
691
+ }
692
+ else {
693
+ if (index > -1)
694
+ ACTIVE_TOUCHES.splice(index, 1);
695
+ }
696
+ defineTouchList(event, 'touches', createTouchList(ACTIVE_TOUCHES));
697
+ defineTouchList(event, 'targetTouches', createTouchList(filterByTarget(ACTIVE_TOUCHES, originTarget)));
698
+ defineTouchList(event, 'changedTouches', createTouchList([touch]));
699
+ }
700
+
701
+ var KEY_CODE_MAP = {
702
+ 8: 'Backspace',
703
+ 9: 'Tab',
704
+ 12: 'Numpad5',
705
+ 13: 'Enter',
706
+ 16: 'ShiftLeft',
707
+ 17: 'ControlLeft',
708
+ 18: 'AltLeft',
709
+ 19: 'Pause',
710
+ 20: 'CapsLock',
711
+ 27: 'Escape',
712
+ 32: 'Space',
713
+ 33: 'PageUp',
714
+ 34: 'PageDown',
715
+ 35: 'End',
716
+ 36: 'Home',
717
+ 37: 'ArrowLeft',
718
+ 38: 'ArrowUp',
719
+ 39: 'ArrowRight',
720
+ 40: 'ArrowDown',
721
+ 45: 'Insert',
722
+ 46: 'Delete',
723
+ 48: 'Digit0',
724
+ 49: 'Digit1',
725
+ 50: 'Digit2',
726
+ 51: 'Digit3',
727
+ 52: 'Digit4',
728
+ 53: 'Digit5',
729
+ 54: 'Digit6',
730
+ 55: 'Digit7',
731
+ 56: 'Digit8',
732
+ 57: 'Digit9',
733
+ 65: 'KeyA',
734
+ 66: 'KeyB',
735
+ 67: 'KeyC',
736
+ 68: 'KeyD',
737
+ 69: 'KeyE',
738
+ 70: 'KeyF',
739
+ 71: 'KeyG',
740
+ 72: 'KeyH',
741
+ 73: 'KeyI',
742
+ 74: 'KeyJ',
743
+ 75: 'KeyK',
744
+ 76: 'KeyL',
745
+ 77: 'KeyM',
746
+ 78: 'KeyN',
747
+ 79: 'KeyO',
748
+ 80: 'KeyP',
749
+ 81: 'KeyQ',
750
+ 82: 'KeyR',
751
+ 83: 'KeyS',
752
+ 84: 'KeyT',
753
+ 85: 'KeyU',
754
+ 86: 'KeyV',
755
+ 87: 'KeyW',
756
+ 88: 'KeyX',
757
+ 89: 'KeyY',
758
+ 90: 'KeyZ',
759
+ 91: 'MetaLeft',
760
+ 92: 'MetaRight',
761
+ 93: 'ContextMenu',
762
+ 96: 'Numpad0',
763
+ 97: 'Numpad1',
764
+ 98: 'Numpad2',
765
+ 99: 'Numpad3',
766
+ 100: 'Numpad4',
767
+ 101: 'Numpad5',
768
+ 102: 'Numpad6',
769
+ 103: 'Numpad7',
770
+ 104: 'Numpad8',
771
+ 105: 'Numpad9',
772
+ 106: 'NumpadMultiply',
773
+ 107: 'NumpadAdd',
774
+ 109: 'NumpadSubtract',
775
+ 110: 'NumpadDecimal',
776
+ 111: 'NumpadDivide',
777
+ 112: 'F1',
778
+ 113: 'F2',
779
+ 114: 'F3',
780
+ 115: 'F4',
781
+ 116: 'F5',
782
+ 117: 'F6',
783
+ 118: 'F7',
784
+ 119: 'F8',
785
+ 120: 'F9',
786
+ 121: 'F10',
787
+ 122: 'F11',
788
+ 123: 'F12',
789
+ 144: 'NumLock',
790
+ 145: 'ScrollLock',
791
+ 186: 'Semicolon',
792
+ 187: 'Equal',
793
+ 188: 'Comma',
794
+ 189: 'Minus',
795
+ 190: 'Period',
796
+ 191: 'Slash',
797
+ 192: 'Backquote',
798
+ 219: 'BracketLeft',
799
+ 220: 'Backslash',
800
+ 221: 'BracketRight',
801
+ 222: 'Quote',
802
+ 226: 'IntlBackslash',
803
+ };
804
+
805
+ var LISTENER_STORE = [];
806
+ var NOOP = function () {
807
+ };
808
+ function findListenerRecord(target, type, callback, capture) {
809
+ for (var i = 0; i < LISTENER_STORE.length; i++) {
810
+ var record = LISTENER_STORE[i];
811
+ if (record.target === target && record.type === type && record.callback === callback && record.capture === capture)
812
+ return record;
813
+ }
814
+ return undefined;
815
+ }
816
+ 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);
820
+ return;
821
+ }
822
+ }
823
+ }
824
+ function preventDefaultPolyfill() {
825
+ this.returnValue = false;
826
+ }
827
+ function stopPropagationPolyfill() {
828
+ this.cancelBubble = true;
829
+ }
830
+ function passivePreventDefault() {
831
+ // Per spec, preventDefault() inside a passive listener does nothing.
832
+ }
833
+ function invokeCallback(callback, target, event) {
834
+ if (typeof callback === 'function')
835
+ return callback.call(target, event);
836
+ if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
837
+ return callback.handleEvent(event);
838
+ }
839
+ function defineEventProperty(event, property, value) {
840
+ try {
841
+ Object.defineProperty(event, property, { value: value, configurable: true });
842
+ }
843
+ catch (_) {
844
+ try {
845
+ event[property] = value;
846
+ }
847
+ catch (__) {
848
+ }
849
+ }
850
+ }
851
+ function fixLegacyEvent(event, target) {
852
+ if (typeof event.currentTarget === 'undefined' || event.currentTarget === null)
853
+ defineEventProperty(event, 'currentTarget', target);
854
+ if ((typeof event.target === 'undefined' || event.target === null) && typeof event.srcElement !== 'undefined')
855
+ defineEventProperty(event, 'target', event.srcElement);
856
+ if (typeof event.preventDefault !== 'function')
857
+ event.preventDefault = preventDefaultPolyfill.bind(event);
858
+ if (typeof event.stopPropagation !== 'function')
859
+ event.stopPropagation = stopPropagationPolyfill.bind(event);
860
+ }
861
+ function fixKeyboardEvent(event) {
862
+ if (typeof event.keyCode === 'number' && typeof event.code === 'undefined') {
863
+ var code = KEY_CODE_MAP[event.keyCode];
864
+ if (typeof code === 'string')
865
+ defineEventProperty(event, 'code', code);
866
+ }
867
+ }
868
+ function createDispatcher(record) {
869
+ return function (event) {
870
+ if (typeof event === 'undefined')
871
+ event = globalThis.event; // IE: implicit global event object
872
+ if (typeof event === 'undefined' || event === null)
873
+ return;
874
+ if (record.released)
875
+ return;
876
+ fixLegacyEvent(event, record.target);
877
+ if (record.once)
878
+ releaseListenerRecord(record);
879
+ if (record.passive && !SUPPORTED_LISTENER_OPTIONS.passive)
880
+ event.preventDefault = passivePreventDefault.bind(event);
881
+ if (record.resolvedType !== record.type)
882
+ defineEventProperty(event, 'type', record.type);
883
+ if (record.touch)
884
+ synthesizeTouchEvent(event, record.resolvedType);
885
+ fixKeyboardEvent(event);
886
+ invokeCallback(record.callback, record.target, event);
887
+ };
888
+ }
889
+ function attachNativeListener(record) {
890
+ var target = record.target;
891
+ if (typeof target.addEventListener === 'function') {
892
+ target.addEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
893
+ return true;
894
+ }
895
+ if (typeof target.attachEvent === 'function') {
896
+ target.attachEvent('on' + record.resolvedType, record.wrapper);
897
+ return true;
898
+ }
899
+ return false;
900
+ }
901
+ function detachNativeListener(record) {
902
+ var target = record.target;
903
+ if (typeof target.removeEventListener === 'function')
904
+ return target.removeEventListener(record.resolvedType, record.wrapper, toNativeListenerOptions(record));
905
+ if (typeof target.detachEvent === 'function')
906
+ return target.detachEvent('on' + record.resolvedType, record.wrapper);
907
+ }
908
+ function releaseListenerRecord(record) {
909
+ if (record.released)
910
+ return;
911
+ record.released = true;
912
+ removeListenerRecord(record);
913
+ try {
914
+ detachNativeListener(record);
915
+ }
916
+ catch (_) {
917
+ }
918
+ if (typeof record.signal !== 'undefined' && typeof record.onAbort === 'function' && typeof record.signal.removeEventListener === 'function') {
919
+ try {
920
+ record.signal.removeEventListener('abort', record.onAbort);
921
+ }
922
+ catch (_) {
923
+ }
924
+ }
925
+ record.onAbort = undefined;
926
+ }
927
+ function createEventPolyfill(type, init) {
928
+ try {
929
+ return new Event(type, init);
930
+ }
931
+ catch (_) {
932
+ }
933
+ var event = globalThis.document.createEvent('Event');
934
+ event.initEvent(type, typeof init !== 'undefined' && init.bubbles === true, typeof init !== 'undefined' && init.cancelable === true);
935
+ return event;
936
+ }
937
+ function createCustomEventPolyfill(type, init) {
938
+ try {
939
+ return new CustomEvent(type, init);
940
+ }
941
+ catch (_) {
942
+ }
943
+ var event = globalThis.document.createEvent('CustomEvent');
944
+ 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
+ return event;
946
+ }
947
+ var EventKit = {
948
+ version: packageJSON.version,
949
+ utils: {
950
+ get supportedOptions() {
951
+ return {
952
+ once: SUPPORTED_LISTENER_OPTIONS.once,
953
+ passive: SUPPORTED_LISTENER_OPTIONS.passive,
954
+ capture: SUPPORTED_LISTENER_OPTIONS.capture,
955
+ some: SUPPORTED_LISTENER_OPTIONS.some,
956
+ all: SUPPORTED_LISTENER_OPTIONS.all,
957
+ };
958
+ },
959
+ resolveType: resolveEventType,
960
+ createEvent: createEventPolyfill,
961
+ createCustomEvent: createCustomEventPolyfill,
962
+ },
963
+ add: function (target, type, callback, options) {
964
+ if (typeof target === 'undefined' || target === null)
965
+ return NOOP;
966
+ if (typeof type !== 'string' || type.length === 0)
967
+ return NOOP;
968
+ if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
969
+ return NOOP;
970
+ var normalized = normalizeListenerOptions(options);
971
+ var existing = findListenerRecord(target, type, callback, normalized.capture);
972
+ if (typeof existing !== 'undefined') {
973
+ return function () {
974
+ releaseListenerRecord(existing);
975
+ };
976
+ }
977
+ if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
978
+ return NOOP;
979
+ var resolvedType = resolveEventType(target, type);
980
+ var record = {
981
+ target: target,
982
+ type: type,
983
+ callback: callback,
984
+ wrapper: NOOP,
985
+ resolvedType: resolvedType,
986
+ capture: normalized.capture,
987
+ once: normalized.once,
988
+ passive: normalized.passive,
989
+ signal: normalized.signal,
990
+ onAbort: undefined,
991
+ touch: isTouchEventType(type) && isPointerEventType(resolvedType),
992
+ released: false,
993
+ };
994
+ record.wrapper = createDispatcher(record);
995
+ if (!attachNativeListener(record))
996
+ return NOOP;
997
+ LISTENER_STORE.push(record);
998
+ if (typeof record.signal !== 'undefined' && typeof record.signal.addEventListener === 'function') {
999
+ record.onAbort = function () {
1000
+ releaseListenerRecord(record);
1001
+ };
1002
+ record.signal.addEventListener('abort', record.onAbort, { once: true });
1003
+ }
1004
+ return function () {
1005
+ releaseListenerRecord(record);
1006
+ };
1007
+ },
1008
+ remove: function (target, type, callback, options) {
1009
+ if (typeof target === 'undefined' || target === null)
1010
+ return;
1011
+ if (typeof type !== 'string' || type.length === 0)
1012
+ return;
1013
+ if (typeof callback !== 'function' && (typeof callback !== 'object' || callback === null))
1014
+ return;
1015
+ var normalized = normalizeListenerOptions(options);
1016
+ var record = findListenerRecord(target, type, callback, normalized.capture);
1017
+ if (typeof record !== 'undefined')
1018
+ return releaseListenerRecord(record);
1019
+ var resolvedType = resolveEventType(target, type);
1020
+ if (typeof target.removeEventListener === 'function')
1021
+ return target.removeEventListener(resolvedType, callback, toNativeListenerOptions(normalized));
1022
+ if (typeof target.detachEvent === 'function' && typeof callback === 'function')
1023
+ return target.detachEvent('on' + resolvedType, callback);
1024
+ },
1025
+ };
1026
+
368
1027
  function createHiddenElement(tagName, focusable) {
369
1028
  if (focusable === void 0) { focusable = true; }
370
1029
  var element = globalThis.document.createElement(tagName);
@@ -774,101 +1433,6 @@ function getTopmostWindow() {
774
1433
  return globalThis;
775
1434
  }
776
1435
 
777
- var IE_WRAPPER_STORE = [];
778
- var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
779
- var LEGACY_TYPE_MAP = {
780
- 'focus': ['focus', 'focusin'],
781
- 'blur': ['blur', 'focusout'],
782
- };
783
- function resolveVendor(target, type) {
784
- var types;
785
- var legacy = LEGACY_TYPE_MAP[type];
786
- if (typeof legacy !== 'undefined')
787
- types = legacy;
788
- else
789
- types = [type];
790
- for (var i = 0; i < VENDORS.length; i++) {
791
- for (var j = 0; j < types.length; j++) {
792
- var name_1 = VENDORS[i] + types[j];
793
- if (typeof target['on' + name_1] !== 'undefined')
794
- return name_1;
795
- }
796
- }
797
- return type;
798
- }
799
- function findIEWrapper(target, type, callback) {
800
- for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
801
- var wrapper = IE_WRAPPER_STORE[i];
802
- if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
803
- return wrapper.wrapper;
804
- }
805
- return undefined;
806
- }
807
- function setIEWrapper(target, type, callback, wrapper) {
808
- IE_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
809
- }
810
- function removeIEWrapper(target, type, callback) {
811
- for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
812
- var wrapper = IE_WRAPPER_STORE[i];
813
- if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
814
- IE_WRAPPER_STORE.splice(i, 1);
815
- return wrapper.wrapper;
816
- }
817
- }
818
- return undefined;
819
- }
820
- function preventDefaultPolyfill() {
821
- this.returnValue = false;
822
- }
823
- function stopPropagationPolyfill() {
824
- this.cancelBubble = true;
825
- }
826
- function addEvent(target, type, callback) {
827
- if (typeof target === 'undefined' || typeof type === 'undefined')
828
- return;
829
- type = resolveVendor(target, type);
830
- if (typeof target.addEventListener === 'function') {
831
- return target.addEventListener(type, callback);
832
- }
833
- if (typeof target.attachEvent === 'function') {
834
- var existing = findIEWrapper(target, type, callback);
835
- if (typeof existing === 'function')
836
- return;
837
- var wrapper = function (event) {
838
- if (typeof event === 'undefined')
839
- event = globalThis.event;
840
- if (typeof event === 'undefined')
841
- return;
842
- try {
843
- Object.defineProperty(event, 'currentTarget', { value: target, configurable: true });
844
- }
845
- catch (_) {
846
- }
847
- if (typeof event.preventDefault !== 'function')
848
- event.preventDefault = preventDefaultPolyfill.bind(event);
849
- if (typeof event.stopPropagation !== 'function')
850
- event.stopPropagation = stopPropagationPolyfill.bind(event);
851
- callback.call(target, event);
852
- };
853
- setIEWrapper(target, type, callback, wrapper);
854
- return target.attachEvent('on' + type, wrapper);
855
- }
856
- }
857
- function removeEvent(target, type, callback) {
858
- if (typeof target === 'undefined' || typeof type === 'undefined')
859
- return;
860
- type = resolveVendor(target, type);
861
- if (typeof target.removeEventListener === 'function') {
862
- return target.removeEventListener(type, callback);
863
- }
864
- if (typeof target.detachEvent === 'function') {
865
- var wrapper = removeIEWrapper(target, type, callback);
866
- if (typeof wrapper === 'function')
867
- target.detachEvent('on' + type, wrapper);
868
- return;
869
- }
870
- }
871
-
872
1436
  var SettingType;
873
1437
  (function (SettingType) {
874
1438
  SettingType["General"] = "general";
@@ -936,7 +1500,7 @@ var ANDROID_DEFAULT_TIMEOUT = 1000;
936
1500
  var IOS_DEFAULT_TIMEOUT = 2000;
937
1501
  var WINDOWS_DEFAULT_TIMEOUT = 750;
938
1502
  var MACOS_DEFAULT_TIMEOUT = 750;
939
- var SETTING_DEFAULT_TIMEOUT = 750;
1503
+ var DEFAULT_TIMEOUT = 750;
940
1504
  var NAVIGATOR = globalThis.navigator;
941
1505
  var CLEANUP_INPUT_ELEMENT = null;
942
1506
  function createTypeGuard(tag) {
@@ -970,7 +1534,7 @@ function getDefaultTimeout() {
970
1534
  case 'macos':
971
1535
  return MACOS_DEFAULT_TIMEOUT;
972
1536
  default:
973
- return WINDOWS_DEFAULT_TIMEOUT;
1537
+ return DEFAULT_TIMEOUT;
974
1538
  }
975
1539
  }
976
1540
  function isDocumentHidden() {
@@ -1076,7 +1640,7 @@ function restoreFocus() {
1076
1640
  return hasFocus(topDocument);
1077
1641
  }
1078
1642
  function stripURL(value) {
1079
- return typeof value === 'undefined' ? undefined : isURL(value) ? value.toString() : value;
1643
+ return isURL(value) ? value.toString() : value;
1080
1644
  }
1081
1645
  function resolveFocusEventConfig() {
1082
1646
  var top = getTopmostWindow();
@@ -1218,9 +1782,12 @@ function openURL(tried, url, timeout) {
1218
1782
  timeoutId = undefined;
1219
1783
  }
1220
1784
  try {
1221
- removeEvent(config.blur.target, config.blur.type, onblur);
1222
- removeEvent(config.focus.target, config.focus.type, onfocus);
1223
- removeEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1785
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1786
+ EventKit.remove(config.blur.target, config.blur.type, onblur);
1787
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1788
+ EventKit.remove(config.focus.target, config.focus.type, onfocus);
1789
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
1790
+ EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1224
1791
  }
1225
1792
  catch (_) {
1226
1793
  }
@@ -1254,8 +1821,10 @@ function openURL(tried, url, timeout) {
1254
1821
  clearTimeout(timeoutId);
1255
1822
  timeoutId = undefined;
1256
1823
  }
1257
- removeEvent(config.blur.target, config.blur.type, onblur);
1258
- addEvent(config.focus.target, config.focus.type, onfocus);
1824
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1825
+ EventKit.remove(config.blur.target, config.blur.type, onfocus);
1826
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
1827
+ EventKit.add(config.focus.target, config.focus.type, onfocus);
1259
1828
  }
1260
1829
  function onfocus() {
1261
1830
  done(true);
@@ -1269,8 +1838,10 @@ function openURL(tried, url, timeout) {
1269
1838
  timeoutId = globalThis.setTimeout(function () {
1270
1839
  done(false);
1271
1840
  }, timeout);
1272
- addEvent(config.blur.target, config.blur.type, onblur);
1273
- addEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1841
+ if (typeof config.blur.target !== 'undefined' && typeof config.blur.type !== 'undefined')
1842
+ EventKit.add(config.blur.target, config.blur.type, onblur);
1843
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
1844
+ EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1274
1845
  if (!hasFocus(topDocument))
1275
1846
  restoreFocus();
1276
1847
  try {
@@ -1290,6 +1861,8 @@ function resolveOptions(option) {
1290
1861
  var fallback;
1291
1862
  var allowAppStore;
1292
1863
  var allowWebStore;
1864
+ var allowScheme;
1865
+ var assumeAllowedInApp;
1293
1866
  var timeout;
1294
1867
  var intent;
1295
1868
  var packageName;
@@ -1306,8 +1879,10 @@ function resolveOptions(option) {
1306
1879
  scheme = stripURL(option.android.scheme);
1307
1880
  fallback = stripURL(option.android.fallback);
1308
1881
  packageName = option.android.packageName;
1882
+ assumeAllowedInApp = option.android.assumeAllowedInApp === true;
1309
1883
  allowAppStore = option.android.allowAppStore;
1310
1884
  allowWebStore = option.android.allowWebStore;
1885
+ allowScheme = canOpenScheme(assumeAllowedInApp);
1311
1886
  timeout = option.android.timeout;
1312
1887
  if (typeof intent !== 'undefined' && (typeof scheme === 'undefined' || typeof packageName === 'undefined' || typeof fallback === 'undefined')) {
1313
1888
  var parsed = parseIntentURL(intent);
@@ -1324,12 +1899,12 @@ function resolveOptions(option) {
1324
1899
  timeout = ANDROID_DEFAULT_TIMEOUT;
1325
1900
  if (typeof intent !== 'undefined' && canOpenIntent())
1326
1901
  resolved.push(['intent', intent]);
1327
- if (typeof scheme !== 'undefined')
1902
+ if (typeof scheme !== 'undefined' && allowScheme)
1328
1903
  resolved.push(['scheme', scheme]);
1329
1904
  if (typeof fallback !== 'undefined')
1330
1905
  resolved.push(['fallback', fallback]);
1331
1906
  if (typeof packageName !== 'undefined') {
1332
- if (allowAppStore)
1907
+ if (allowAppStore && allowScheme)
1333
1908
  resolved.push(['store', createAppStoreURL(packageName, os)]);
1334
1909
  if (allowWebStore)
1335
1910
  resolved.push(['store', createWebStoreURL(packageName, os)]);
@@ -1343,21 +1918,23 @@ function resolveOptions(option) {
1343
1918
  fallback = stripURL(option.ios.fallback);
1344
1919
  bundleId = option.ios.bundleId;
1345
1920
  trackId = option.ios.trackId;
1921
+ assumeAllowedInApp = option.ios.assumeAllowedInApp === true;
1346
1922
  allowAppStore = option.ios.allowAppStore;
1347
1923
  allowWebStore = option.ios.allowWebStore;
1924
+ allowScheme = canOpenScheme(assumeAllowedInApp);
1348
1925
  timeout = option.ios.timeout;
1349
1926
  if (typeof bundleId !== 'undefined' && typeof trackId === 'undefined')
1350
1927
  trackId = getTrackId(bundleId);
1351
1928
  if (typeof timeout === 'undefined')
1352
1929
  timeout = IOS_DEFAULT_TIMEOUT;
1353
- if (typeof universal !== 'undefined' && canOpenUniversal())
1930
+ if (typeof universal !== 'undefined' && canOpenUniversal(assumeAllowedInApp))
1354
1931
  resolved.push(['universal', universal]);
1355
- if (typeof scheme !== 'undefined')
1932
+ if (typeof scheme !== 'undefined' && allowScheme)
1356
1933
  resolved.push(['scheme', scheme]);
1357
1934
  if (typeof fallback !== 'undefined')
1358
1935
  resolved.push(['fallback', fallback]);
1359
1936
  if (typeof trackId !== 'undefined') {
1360
- if (allowAppStore)
1937
+ if (allowAppStore && allowScheme)
1361
1938
  resolved.push(['store', createAppStoreURL(trackId, os)]);
1362
1939
  if (allowWebStore)
1363
1940
  resolved.push(['store', createWebStoreURL(trackId, os)]);
@@ -1430,10 +2007,41 @@ function canOpenIntent() {
1430
2007
  return false;
1431
2008
  if (browser === 'opera' && PlatformKit.compareVersion(version, '14.0') < 0)
1432
2009
  return false;
1433
- return !(/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(PlatformKit.userAgent) || /instagram[\/ ][-\w.]+/i.test(PlatformKit.userAgent) || /micromessenger\/([\w.]+)/i.test(PlatformKit.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(PlatformKit.userAgent) || /ultralite app_version\/[\w.]+/i.test(PlatformKit.userAgent));
2010
+ if (isFullyBlockedInAppBrowser() || isPartnerAppOnly())
2011
+ return false;
2012
+ return !(/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(PlatformKit.userAgent) || /instagram[\/ ][-\w.]+/i.test(PlatformKit.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(PlatformKit.userAgent) || /ultralite app_version\/[\w.]+/i.test(PlatformKit.userAgent));
1434
2013
  }
1435
- function canOpenUniversal() {
1436
- return PlatformKit.os.name === 'ios' && PlatformKit.compareVersion(PlatformKit.os.version, '9.0') >= 0;
2014
+ function canOpenUniversal(assumeAllowedInApp) {
2015
+ if (assumeAllowedInApp === void 0) { assumeAllowedInApp = false; }
2016
+ if (PlatformKit.os.name !== 'ios' || PlatformKit.compareVersion(PlatformKit.os.version, '9.0') < 0)
2017
+ return false;
2018
+ if (isPartnerAppOnly() && !assumeAllowedInApp)
2019
+ return false;
2020
+ var userAgent = PlatformKit.userAgent;
2021
+ var wechat = userAgent.match(/micromessenger\/(\d+(?:\.\d+)*)/i);
2022
+ if (wechat !== null && PlatformKit.compareVersion(wechat[1], '7.0.5') < 0)
2023
+ return false;
2024
+ if (/ qq\/[\d.]+/i.test(userAgent) || /m?qqbrowser\/[\d.]+/i.test(userAgent) || /ucbrowser\/[\d.]+/i.test(userAgent))
2025
+ return false;
2026
+ return !/qzone\/.*_qz_[\d.]+/i.test(userAgent);
2027
+ }
2028
+ function canOpenScheme(assumeAllowedInApp) {
2029
+ if (assumeAllowedInApp === void 0) { assumeAllowedInApp = false; }
2030
+ var os = PlatformKit.os.name;
2031
+ if (os === 'android')
2032
+ return !isFullyBlockedInAppBrowser() && (!isPartnerAppOnly() || assumeAllowedInApp);
2033
+ if (os === 'ios')
2034
+ return !/micromessenger\/[\w.]+/i.test(PlatformKit.userAgent) && (!isPartnerAppOnly() || assumeAllowedInApp);
2035
+ return true;
2036
+ }
2037
+ function isFullyBlockedInAppBrowser() {
2038
+ if (PlatformKit.os.name !== 'android')
2039
+ return false;
2040
+ var userAgent = PlatformKit.userAgent;
2041
+ return /micromessenger\/[\w.]+/i.test(userAgent) || / qq\/[\d.]+/i.test(userAgent) || /qzone\/.*_qz_[\d.]+/i.test(userAgent) || /baiduboxapp\/[\d.]+/i.test(userAgent);
2042
+ }
2043
+ function isPartnerAppOnly() {
2044
+ return /weibo.*weibo__[\d.]+/i.test(PlatformKit.userAgent);
1437
2045
  }
1438
2046
  function canOpenSetting() {
1439
2047
  var os = PlatformKit.os.name;
@@ -1540,6 +2148,18 @@ function escapeURIComponentMailAddressString(value) {
1540
2148
  function encodeMailBody(value) {
1541
2149
  return escapeURIComponentString(value.replace(/\r\n|\n|\r/g, '\r\n'));
1542
2150
  }
2151
+ function encodeMapValue(value) {
2152
+ if (isArray(value))
2153
+ return value[0] + ',' + value[1];
2154
+ return escapeURIComponentString(value);
2155
+ }
2156
+ function encodeBingRoutePoint(value) {
2157
+ if (typeof value === 'undefined')
2158
+ return '';
2159
+ if (isArray(value))
2160
+ return 'pos.' + value[0] + '_' + value[1];
2161
+ return escapeURIComponentString(value);
2162
+ }
1543
2163
  function toArray(value) {
1544
2164
  return typeof value === 'undefined' ? [] : typeof value === 'string' ? [value] : value;
1545
2165
  }
@@ -1678,10 +2298,12 @@ function resolveFile(module) {
1678
2298
  }
1679
2299
  else {
1680
2300
  module.onclick = function () {
1681
- addEvent(config.focus.target, config.focus.type, onfocus);
1682
- addEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2301
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
2302
+ EventKit.add(config.focus.target, config.focus.type, onfocus);
2303
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2304
+ EventKit.add(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1683
2305
  globalThis.setTimeout(function () {
1684
- addEvent(topDocument, 'click', onclick);
2306
+ EventKit.add(topDocument, 'click', onclick);
1685
2307
  }, 100);
1686
2308
  CLEANUP_INPUT_ELEMENT = function () {
1687
2309
  done(false);
@@ -1691,9 +2313,11 @@ function resolveFile(module) {
1691
2313
  function cleanup() {
1692
2314
  CLEANUP_INPUT_ELEMENT = null;
1693
2315
  try {
1694
- removeEvent(config.focus.target, config.focus.type, onfocus);
1695
- removeEvent(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
1696
- removeEvent(topDocument, 'click', onclick);
2316
+ if (typeof config.focus.target !== 'undefined' && typeof config.focus.type !== 'undefined')
2317
+ EventKit.remove(config.focus.target, config.focus.type, onfocus);
2318
+ if (typeof config.visibilitychange.target !== 'undefined' && typeof config.visibilitychange.type !== 'undefined')
2319
+ EventKit.remove(config.visibilitychange.target, config.visibilitychange.type, onvisibilitychange);
2320
+ EventKit.remove(topDocument, 'click', onclick);
1697
2321
  }
1698
2322
  catch (_) {
1699
2323
  }
@@ -1763,7 +2387,7 @@ function walk(directory, basePath) {
1763
2387
  }
1764
2388
  var LaunchKit = {
1765
2389
  SettingType: SettingType,
1766
- version: packageJSON$1.version,
2390
+ version: packageJSON$2.version,
1767
2391
  utils: {
1768
2392
  get canOpenIntent() {
1769
2393
  return canOpenIntent();
@@ -1786,12 +2410,12 @@ var LaunchKit = {
1786
2410
  catch (error) {
1787
2411
  return Promise.reject(error);
1788
2412
  }
1789
- var tried = [];
1790
2413
  var urls = resolved[0];
1791
2414
  var timeout = resolved[1];
1792
2415
  if (urls.length === 0)
1793
2416
  return Promise.reject(new Error('No openable URL candidates were resolved for the current OS ("' + PlatformKit.os.name + '"). Provide at least one of: scheme, intent, universal, fallback, or store id for this platform.'));
1794
2417
  return new Promise(function (resolve, reject) {
2418
+ var tried = [];
1795
2419
  function openURLSequential(index) {
1796
2420
  if (index === void 0) { index = 0; }
1797
2421
  if (index >= urls.length)
@@ -1863,6 +2487,112 @@ var LaunchKit = {
1863
2487
  url += '?' + joining(params, undefined, '&');
1864
2488
  return openURL(0, url, getDefaultTimeout());
1865
2489
  },
2490
+ map: function (options) {
2491
+ if (options === void 0) { options = {}; }
2492
+ var params = [];
2493
+ var urls = [];
2494
+ var url = '';
2495
+ switch (PlatformKit.os.name) {
2496
+ case 'android':
2497
+ if (typeof options.coordinate !== 'undefined') {
2498
+ url = 'geo:' + options.coordinate[0] + ',' + options.coordinate[1];
2499
+ }
2500
+ else if (typeof options.query !== 'undefined') {
2501
+ url = 'geo:0,0';
2502
+ params.push('q=' + escapeURIComponentString(options.query));
2503
+ }
2504
+ else {
2505
+ url = 'geo:0,0';
2506
+ }
2507
+ if (typeof options.zoom !== 'undefined')
2508
+ params.push('z=' + options.zoom);
2509
+ if (params.length > 0)
2510
+ url = url + '?' + joining(params, undefined, '&');
2511
+ urls.push(url);
2512
+ break;
2513
+ case 'ios':
2514
+ case 'macos':
2515
+ if (typeof options.directions !== 'undefined') {
2516
+ if (typeof options.directions.destination !== 'undefined')
2517
+ params.push('daddr=' + encodeMapValue(options.directions.destination));
2518
+ if (typeof options.directions.origin !== 'undefined')
2519
+ params.push('saddr=' + encodeMapValue(options.directions.origin));
2520
+ }
2521
+ else if (typeof options.coordinate !== 'undefined') {
2522
+ params.push('ll=' + options.coordinate[0] + ',' + options.coordinate[1]);
2523
+ if (typeof options.label !== 'undefined')
2524
+ params.push('q=' + escapeURIComponentString(options.label));
2525
+ }
2526
+ else if (typeof options.query !== 'undefined') {
2527
+ params.push('q=' + escapeURIComponentString(options.query));
2528
+ }
2529
+ if (typeof options.zoom !== 'undefined')
2530
+ params.push('z=' + options.zoom);
2531
+ urls.push('maps://?' + joining(params, undefined, '&'));
2532
+ break;
2533
+ case 'windows':
2534
+ if (typeof options.directions !== 'undefined') {
2535
+ params.push('rtp=' + encodeBingRoutePoint(options.directions.origin) + '~' + encodeBingRoutePoint(options.directions.destination));
2536
+ }
2537
+ else if (typeof options.coordinate !== 'undefined') {
2538
+ params.push('cp=' + options.coordinate[0] + '~' + options.coordinate[1]);
2539
+ if (typeof options.label !== 'undefined')
2540
+ params.push('q=' + escapeURIComponentString(options.label));
2541
+ }
2542
+ else if (typeof options.query !== 'undefined') {
2543
+ params.push('where=' + escapeURIComponentString(options.query));
2544
+ }
2545
+ if (typeof options.zoom !== 'undefined')
2546
+ params.push('lvl=' + options.zoom);
2547
+ urls.push('bingmaps:?' + joining(params, undefined, '&'));
2548
+ }
2549
+ if (typeof options.fallback !== 'undefined') {
2550
+ urls.push(stripURL(options.fallback));
2551
+ }
2552
+ else {
2553
+ var params_1 = ['api=1'];
2554
+ if (typeof options.directions !== 'undefined') {
2555
+ params_1.push('destination=' + encodeMapValue(options.directions.destination));
2556
+ if (typeof options.directions.origin !== 'undefined')
2557
+ params_1.push('origin=' + encodeMapValue(options.directions.origin));
2558
+ urls.push('https://www.google.com/maps/dir/?' + joining(params_1, undefined, '&'));
2559
+ }
2560
+ else {
2561
+ if (typeof options.coordinate !== 'undefined')
2562
+ params_1.push('query=' + options.coordinate[0] + ',' + options.coordinate[1]);
2563
+ else if (typeof options.query !== 'undefined')
2564
+ params_1.push('query=' + escapeURIComponentString(options.query));
2565
+ if (typeof options.zoom !== 'undefined')
2566
+ params_1.push('zoom=' + options.zoom);
2567
+ urls.push('https://www.google.com/maps/search/?' + joining(params_1, undefined, '&'));
2568
+ }
2569
+ }
2570
+ return new Promise(function (resolve, reject) {
2571
+ var tried = [];
2572
+ function openURLSequential(index) {
2573
+ if (index === void 0) { index = 0; }
2574
+ if (index >= urls.length)
2575
+ return reject(new Error('Failed to open a map using all available URLs.\n\nAttempted URLs:\n' + joining(tried, undefined, '\n↓\n')));
2576
+ var url = urls[index];
2577
+ if (typeof url === 'string') {
2578
+ tried[index] = url;
2579
+ return openURL(index, url, getDefaultTimeout())
2580
+ .then(function () {
2581
+ resolve();
2582
+ })
2583
+ .catch(function () {
2584
+ openURLSequential(index + 1);
2585
+ });
2586
+ }
2587
+ else {
2588
+ tried[index] = '[function fallback]';
2589
+ url();
2590
+ resolve();
2591
+ }
2592
+ }
2593
+ return openURLSequential();
2594
+ });
2595
+ },
1866
2596
  filepicker: function (options) {
1867
2597
  if (options === void 0) { options = {}; }
1868
2598
  var module;
@@ -1965,7 +2695,7 @@ var LaunchKit = {
1965
2695
  if (index === void 0) { index = 0; }
1966
2696
  if (index >= urls.length)
1967
2697
  return reject(new Error('Failed to open the "' + type + '" settings pane using all available URLs.\n\nAttempted URLs:\n' + joining(urls, undefined, '\n↓\n')));
1968
- return openURL(index, urls[index], SETTING_DEFAULT_TIMEOUT)
2698
+ return openURL(index, urls[index], DEFAULT_TIMEOUT)
1969
2699
  .then(function () {
1970
2700
  resolve();
1971
2701
  })