native-fn 1.1.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +488 -146
  2. package/dist/index.d.ts +130 -117
  3. package/dist/native.cjs +581 -563
  4. package/dist/native.min.cjs +1 -1
  5. package/dist/native.min.mjs +1 -1
  6. package/dist/native.mjs +581 -563
  7. package/dist/native.umd.js +581 -563
  8. package/dist/native.umd.min.js +1 -1
  9. package/dist/plugin/appearance/src/errors/invalid-state-error.d.ts +2 -0
  10. package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +1 -1
  11. package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +1 -1
  12. package/dist/plugin/appearance/src/plugin/fullscreen/cores/index.d.ts +3 -3
  13. package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  14. package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  15. package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +1 -1
  16. package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +1 -0
  17. package/dist/plugin/appearance/src/plugin/pip/cores/index.d.ts +6 -6
  18. package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +12 -6
  19. package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +1 -1
  20. package/dist/plugin/badge/index.cjs +2 -2
  21. package/dist/plugin/badge/index.d.ts +1 -1
  22. package/dist/plugin/badge/index.mjs +2 -2
  23. package/dist/plugin/badge/src/errors/invalid-state-error.d.ts +2 -0
  24. package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +1 -1
  25. package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +1 -1
  26. package/dist/plugin/badge/src/plugin/fullscreen/cores/index.d.ts +3 -3
  27. package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  28. package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  29. package/dist/plugin/badge/src/plugin/open/types/open.d.ts +1 -1
  30. package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +1 -0
  31. package/dist/plugin/badge/src/plugin/pip/cores/index.d.ts +6 -6
  32. package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +12 -6
  33. package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +1 -1
  34. package/dist/plugin/battery/index.cjs +3 -3
  35. package/dist/plugin/battery/index.d.ts +1 -1
  36. package/dist/plugin/battery/index.mjs +3 -3
  37. package/dist/plugin/battery/src/errors/invalid-state-error.d.ts +2 -0
  38. package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +1 -1
  39. package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +1 -1
  40. package/dist/plugin/battery/src/plugin/fullscreen/cores/index.d.ts +3 -3
  41. package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  42. package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  43. package/dist/plugin/battery/src/plugin/open/types/open.d.ts +1 -1
  44. package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +1 -0
  45. package/dist/plugin/battery/src/plugin/pip/cores/index.d.ts +6 -6
  46. package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +12 -6
  47. package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +1 -1
  48. package/dist/plugin/clipboard/src/errors/invalid-state-error.d.ts +2 -0
  49. package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +1 -1
  50. package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +1 -1
  51. package/dist/plugin/clipboard/src/plugin/fullscreen/cores/index.d.ts +3 -3
  52. package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  53. package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  54. package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +1 -1
  55. package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +1 -0
  56. package/dist/plugin/clipboard/src/plugin/pip/cores/index.d.ts +6 -6
  57. package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +12 -6
  58. package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +1 -1
  59. package/dist/plugin/dimension/src/errors/invalid-state-error.d.ts +2 -0
  60. package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +1 -1
  61. package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +1 -1
  62. package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +3 -3
  63. package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  64. package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  65. package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +1 -1
  66. package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +1 -0
  67. package/dist/plugin/dimension/src/plugin/pip/cores/index.d.ts +6 -6
  68. package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +12 -6
  69. package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +1 -1
  70. package/dist/plugin/fullscreen/index.cjs +499 -265
  71. package/dist/plugin/fullscreen/index.d.ts +14 -7
  72. package/dist/plugin/fullscreen/index.mjs +499 -265
  73. package/dist/plugin/fullscreen/src/errors/invalid-state-error.d.ts +2 -0
  74. package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +1 -1
  75. package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +1 -1
  76. package/dist/plugin/fullscreen/src/plugin/fullscreen/cores/index.d.ts +3 -3
  77. package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  78. package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  79. package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +1 -1
  80. package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +1 -0
  81. package/dist/plugin/fullscreen/src/plugin/pip/cores/index.d.ts +6 -6
  82. package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +12 -6
  83. package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +1 -1
  84. package/dist/plugin/geolocation/index.cjs +6 -0
  85. package/dist/plugin/geolocation/index.d.ts +1 -1
  86. package/dist/plugin/geolocation/index.mjs +6 -0
  87. package/dist/plugin/geolocation/src/errors/invalid-state-error.d.ts +2 -0
  88. package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +1 -1
  89. package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +1 -1
  90. package/dist/plugin/geolocation/src/plugin/fullscreen/cores/index.d.ts +3 -3
  91. package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  92. package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  93. package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +1 -1
  94. package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +1 -0
  95. package/dist/plugin/geolocation/src/plugin/pip/cores/index.d.ts +6 -6
  96. package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +12 -6
  97. package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +1 -1
  98. package/dist/plugin/notification/index.cjs +6 -0
  99. package/dist/plugin/notification/index.mjs +6 -0
  100. package/dist/plugin/notification/src/errors/invalid-state-error.d.ts +2 -0
  101. package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +1 -1
  102. package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +1 -1
  103. package/dist/plugin/notification/src/plugin/fullscreen/cores/index.d.ts +3 -3
  104. package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  105. package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  106. package/dist/plugin/notification/src/plugin/open/types/open.d.ts +1 -1
  107. package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +1 -0
  108. package/dist/plugin/notification/src/plugin/pip/cores/index.d.ts +6 -6
  109. package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +12 -6
  110. package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +1 -1
  111. package/dist/plugin/open/index.cjs +120 -120
  112. package/dist/plugin/open/index.d.ts +35 -35
  113. package/dist/plugin/open/index.mjs +120 -120
  114. package/dist/plugin/open/src/errors/invalid-state-error.d.ts +2 -0
  115. package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +1 -1
  116. package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +1 -1
  117. package/dist/plugin/open/src/plugin/fullscreen/cores/index.d.ts +3 -3
  118. package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  119. package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  120. package/dist/plugin/open/src/plugin/open/types/open.d.ts +1 -1
  121. package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +1 -0
  122. package/dist/plugin/open/src/plugin/pip/cores/index.d.ts +6 -6
  123. package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +12 -6
  124. package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +1 -1
  125. package/dist/plugin/permission/index.cjs +6 -0
  126. package/dist/plugin/permission/index.d.ts +1 -0
  127. package/dist/plugin/permission/index.mjs +6 -0
  128. package/dist/plugin/permission/src/errors/invalid-state-error.d.ts +2 -0
  129. package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +1 -1
  130. package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +1 -1
  131. package/dist/plugin/permission/src/plugin/fullscreen/cores/index.d.ts +3 -3
  132. package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  133. package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  134. package/dist/plugin/permission/src/plugin/open/types/open.d.ts +1 -1
  135. package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +1 -0
  136. package/dist/plugin/permission/src/plugin/pip/cores/index.d.ts +6 -6
  137. package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +12 -6
  138. package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +1 -1
  139. package/dist/plugin/pip/index.cjs +255 -273
  140. package/dist/plugin/pip/index.d.ts +20 -13
  141. package/dist/plugin/pip/index.mjs +255 -273
  142. package/dist/plugin/pip/src/errors/invalid-state-error.d.ts +2 -0
  143. package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +1 -1
  144. package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +1 -1
  145. package/dist/plugin/pip/src/plugin/fullscreen/cores/index.d.ts +3 -3
  146. package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  147. package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  148. package/dist/plugin/pip/src/plugin/open/types/open.d.ts +1 -1
  149. package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +1 -0
  150. package/dist/plugin/pip/src/plugin/pip/cores/index.d.ts +6 -6
  151. package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +12 -6
  152. package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +1 -1
  153. package/dist/plugin/platform/index.d.ts +5 -5
  154. package/dist/plugin/platform/src/errors/invalid-state-error.d.ts +2 -0
  155. package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +1 -1
  156. package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +1 -1
  157. package/dist/plugin/platform/src/plugin/fullscreen/cores/index.d.ts +3 -3
  158. package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  159. package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  160. package/dist/plugin/platform/src/plugin/open/types/open.d.ts +1 -1
  161. package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +1 -0
  162. package/dist/plugin/platform/src/plugin/pip/cores/index.d.ts +6 -6
  163. package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +12 -6
  164. package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +1 -1
  165. package/dist/plugin/theme/src/errors/invalid-state-error.d.ts +2 -0
  166. package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +1 -1
  167. package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +1 -1
  168. package/dist/plugin/theme/src/plugin/fullscreen/cores/index.d.ts +3 -3
  169. package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  170. package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  171. package/dist/plugin/theme/src/plugin/open/types/open.d.ts +1 -1
  172. package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +1 -0
  173. package/dist/plugin/theme/src/plugin/pip/cores/index.d.ts +6 -6
  174. package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +12 -6
  175. package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +1 -1
  176. package/dist/plugin/vibration/index.cjs +5 -5
  177. package/dist/plugin/vibration/index.d.ts +1 -1
  178. package/dist/plugin/vibration/index.mjs +5 -5
  179. package/dist/plugin/vibration/src/errors/invalid-state-error.d.ts +2 -0
  180. package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +1 -1
  181. package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +1 -1
  182. package/dist/plugin/vibration/src/plugin/fullscreen/cores/index.d.ts +3 -3
  183. package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  184. package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  185. package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +1 -1
  186. package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +1 -0
  187. package/dist/plugin/vibration/src/plugin/pip/cores/index.d.ts +6 -6
  188. package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +12 -6
  189. package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +1 -1
  190. package/dist/src/errors/invalid-state-error.d.ts +2 -0
  191. package/dist/src/plugin/badge/types/badge.d.ts +1 -1
  192. package/dist/src/plugin/battery/types/battery.d.ts +1 -1
  193. package/dist/src/plugin/fullscreen/cores/index.d.ts +3 -3
  194. package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +9 -3
  195. package/dist/src/plugin/geolocation/types/geolocation.d.ts +1 -1
  196. package/dist/src/plugin/open/types/open.d.ts +1 -1
  197. package/dist/src/plugin/permission/types/permission.d.ts +1 -0
  198. package/dist/src/plugin/pip/cores/index.d.ts +6 -6
  199. package/dist/src/plugin/pip/types/pip.d.ts +12 -6
  200. package/dist/src/plugin/vibration/types/vibration.d.ts +1 -1
  201. package/package.json +21 -13
package/dist/native.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.1.9";
3
+ var version = "1.2.0";
4
4
  var packageJSON = {
5
5
  version: version};
6
6
 
@@ -855,14 +855,14 @@ function createSubscriptionManager(attach, detach) {
855
855
  };
856
856
  }
857
857
 
858
- var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
858
+ var onChangeSubscriptionManager$5 = createSubscriptionManager(attachOnChange$5, detachOnChange$5);
859
859
  var appearanceRef = null;
860
860
  var pollingIntervalId = null;
861
861
  var Appearance = {
862
862
  get value() {
863
863
  return getAppearance();
864
864
  },
865
- onChange: onChangeSubscriptionManager$3.subscribe,
865
+ onChange: onChangeSubscriptionManager$5.subscribe,
866
866
  Constants: {
867
867
  Appearances: Appearances
868
868
  },
@@ -898,7 +898,7 @@ function startPolling() {
898
898
  var appearance = getAppearanceFromEngine();
899
899
  if (appearance !== appearanceRef) {
900
900
  appearanceRef = appearance;
901
- onChangeSubscriptionManager$3.emit(appearance);
901
+ onChangeSubscriptionManager$5.emit(appearance);
902
902
  }
903
903
  }, 2000);
904
904
  }
@@ -909,13 +909,13 @@ function stopPolling() {
909
909
  pollingIntervalId = null;
910
910
  }
911
911
  }
912
- function attachOnChange$3() {
912
+ function attachOnChange$5() {
913
913
  appearanceRef = getAppearanceFromMediaQuery();
914
914
  EventListener.add(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
915
915
  if (Platform.browser.name === Browsers.SamsungInternet)
916
916
  startPolling();
917
917
  }
918
- function detachOnChange$3() {
918
+ function detachOnChange$5() {
919
919
  appearanceRef = null;
920
920
  EventListener.remove(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
921
921
  if (Platform.browser.name === Browsers.SamsungInternet)
@@ -928,7 +928,7 @@ function onMediaChange(event) {
928
928
  else
929
929
  appearance = Appearances.Light;
930
930
  if (appearance !== appearanceRef)
931
- onChangeSubscriptionManager$3.emit(appearanceRef = appearance);
931
+ onChangeSubscriptionManager$5.emit(appearanceRef = appearance);
932
932
  }
933
933
 
934
934
  function isSecureContext() {
@@ -1664,14 +1664,14 @@ var safeAreaMaxInsetObserver = createEnvObserver('safe-area-max-inset');
1664
1664
  var keyboardInsetObserver = createEnvObserver('keyboard-inset');
1665
1665
  var titlebarAreaObserver = createEnvObserver('titlebar-area');
1666
1666
  var viewportSegmentObserver = createEnvObserver('viewport-segment');
1667
- var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
1667
+ var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
1668
1668
  var dimensionRef = null;
1669
1669
  var Dimension = {
1670
1670
  get value() {
1671
1671
  return getDimension();
1672
1672
  },
1673
1673
  environment: getEnvironment(),
1674
- onChange: onChangeSubscriptionManager$2.subscribe,
1674
+ onChange: onChangeSubscriptionManager$4.subscribe,
1675
1675
  Constants: {
1676
1676
  Orientation: Orientation,
1677
1677
  },
@@ -1757,7 +1757,7 @@ function getDimension() {
1757
1757
  }
1758
1758
  return FALLBACK_DIMENSION;
1759
1759
  }
1760
- function attachOnChange$2() {
1760
+ function attachOnChange$4() {
1761
1761
  dimensionRef = getDimension();
1762
1762
  EventListener.add(globalThis, { type: 'resize', callback: onResize });
1763
1763
  if (typeof globalThis.screen.orientation.addEventListener === 'function')
@@ -1767,7 +1767,7 @@ function attachOnChange$2() {
1767
1767
  else if (MEDIA_QUERY_LIST.media !== 'not all')
1768
1768
  EventListener.add(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
1769
1769
  }
1770
- function detachOnChange$2() {
1770
+ function detachOnChange$4() {
1771
1771
  dimensionRef = null;
1772
1772
  EventListener.remove(globalThis, { type: 'resize', callback: onResize });
1773
1773
  if (typeof globalThis.screen.orientation.removeEventListener === 'function')
@@ -1780,7 +1780,7 @@ function detachOnChange$2() {
1780
1780
  function onResize() {
1781
1781
  var dimension = getDimension();
1782
1782
  if (dimensionRef === null || dimension.innerWidth !== dimensionRef.innerWidth || dimension.innerHeight !== dimensionRef.innerHeight || dimension.outerWidth !== dimensionRef.outerWidth || dimension.outerHeight !== dimensionRef.outerHeight || dimension.scale !== dimensionRef.scale || dimension.orientation !== dimensionRef.orientation)
1783
- onChangeSubscriptionManager$2.emit(dimensionRef = dimension);
1783
+ onChangeSubscriptionManager$4.emit(dimensionRef = dimension);
1784
1784
  }
1785
1785
 
1786
1786
  function createCustomError(name, Base) {
@@ -1867,7 +1867,19 @@ function createCustomError(name, Base) {
1867
1867
 
1868
1868
  var NotSupportedError = createCustomError('NotSupportedError');
1869
1869
 
1870
- var FS_BRIDGED_KEY = Symbol('fsBridged');
1870
+ var InvalidStateError = createCustomError('InvalidStateError');
1871
+
1872
+ var lastIOSVideo = null;
1873
+ var eventsBridged$1 = false;
1874
+ var FS_BRIDGE_KEY = (function () {
1875
+ if (typeof Symbol === 'function') {
1876
+ var existing = globalThis.__nativeFnFsBridgeKey__;
1877
+ if (typeof existing === 'symbol')
1878
+ return existing;
1879
+ return globalThis.__nativeFnFsBridgeKey__ = Symbol('native.fn.fs.bridged');
1880
+ }
1881
+ return '__nativeFnFsBridged__';
1882
+ }());
1871
1883
  var API_VARIANTS = {
1872
1884
  standard: {
1873
1885
  enabled: 'fullscreenEnabled',
@@ -1899,6 +1911,31 @@ var API_VARIANTS = {
1899
1911
  },
1900
1912
  };
1901
1913
  var api = detectApi();
1914
+ var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
1915
+ var onErrorSubscriptionManager$1 = createSubscriptionManager(attachOnError$1, detachOnError$1);
1916
+ var Fullscreen = {
1917
+ get supported() {
1918
+ return getEnabled$1();
1919
+ },
1920
+ get element() {
1921
+ return getElement$1();
1922
+ },
1923
+ get isFullscreen() {
1924
+ return getIsFullscreen();
1925
+ },
1926
+ request: request$3,
1927
+ exit: exit$1,
1928
+ onChange: onChangeSubscriptionManager$3.subscribe,
1929
+ onError: onErrorSubscriptionManager$1.subscribe,
1930
+ Constants: {},
1931
+ Errors: {
1932
+ NotSupportedError: NotSupportedError,
1933
+ InvalidStateError: InvalidStateError,
1934
+ },
1935
+ };
1936
+ function hasStandardApi$1() {
1937
+ return api !== null;
1938
+ }
1902
1939
  function detectApi() {
1903
1940
  var element = globalThis.document.documentElement;
1904
1941
  if (typeof globalThis.document.fullscreenEnabled !== 'undefined' || typeof globalThis.document.exitFullscreen !== 'undefined')
@@ -1915,287 +1952,282 @@ function detectApi() {
1915
1952
  }
1916
1953
  return null;
1917
1954
  }
1918
- function createFullscreen() {
1919
- var lastIOSVideo = null;
1920
- var eventsBridged = false;
1921
- var activeOperation = null;
1922
- var pendingQueue = [];
1923
- var lastIntendedOperation = 'exit';
1924
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
1925
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
1926
- function getDefaultTarget() {
1927
- if (Platform.os.name === OS.iOS) {
1928
- var video = globalThis.document.querySelector('video');
1929
- if (video === null)
1930
- return undefined;
1931
- return video;
1932
- }
1933
- return globalThis.document.documentElement;
1934
- }
1935
- function bridgeEvents() {
1936
- if (eventsBridged)
1937
- return;
1938
- eventsBridged = true;
1939
- if (Platform.os.name === OS.iOS) {
1940
- bridgeIOSVideoEvents();
1941
- if (typeof globalThis.MutationObserver !== 'undefined') {
1942
- var observer = new MutationObserver(function () {
1943
- bridgeIOSVideoEvents();
1944
- });
1945
- observer.observe(globalThis.document.documentElement, {
1946
- childList: true,
1947
- subtree: true,
1948
- });
1949
- }
1950
- }
1951
- }
1952
- function bridgeIOSVideoEvents() {
1953
- if (typeof globalThis.document === 'undefined')
1954
- return;
1955
- var videos = globalThis.document.querySelectorAll('video');
1956
- videos.forEach(function (video) {
1957
- if (video[FS_BRIDGED_KEY] === true || !(typeof video.webkitEnterFullscreen !== 'undefined' || typeof video.onwebkitbeginfullscreen !== 'undefined'))
1958
- return;
1959
- EventListener.add(video, {
1960
- type: 'webkitbeginfullscreen',
1961
- callback: onChangeSubscriptionManager.emit,
1962
- options: false,
1963
- });
1964
- EventListener.add(video, {
1965
- type: 'webkitendfullscreen',
1966
- callback: onChangeSubscriptionManager.emit,
1967
- options: false,
1968
- });
1969
- video[FS_BRIDGED_KEY] = true;
1970
- });
1971
- }
1972
- function attachOnChange() {
1973
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1974
- for (var i = 0; i < events.length; i++) {
1975
- EventListener.add(globalThis.document, {
1976
- type: events[i],
1977
- callback: onChangeSubscriptionManager.emit,
1978
- options: false,
1979
- });
1980
- }
1981
- }
1982
- function detachOnChange() {
1983
- var events = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
1984
- for (var i = 0; i < events.length; i++) {
1985
- EventListener.remove(globalThis.document, {
1986
- type: events[i],
1987
- callback: onChangeSubscriptionManager.emit,
1988
- options: false,
1989
- });
1990
- }
1991
- }
1992
- function attachOnError() {
1993
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
1994
- for (var i = 0; i < events.length; i++) {
1995
- EventListener.add(globalThis.document, {
1996
- type: events[i],
1997
- callback: onErrorSubscriptionManager.emit,
1998
- options: false,
1999
- });
2000
- }
2001
- }
2002
- function detachOnError() {
2003
- var events = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
2004
- for (var i = 0; i < events.length; i++) {
2005
- EventListener.remove(globalThis.document, {
2006
- type: events[i],
2007
- callback: onErrorSubscriptionManager.emit,
2008
- options: false,
2009
- });
2010
- }
1955
+ function getDefaultTarget$1() {
1956
+ if (Platform.os.name === OS.iOS) {
1957
+ var video = globalThis.document.querySelector('video');
1958
+ return video !== null ? video : undefined;
2011
1959
  }
2012
- function getEnabled() {
2013
- if (api === null)
2014
- return (Platform.os.name === OS.iOS && globalThis.HTMLVideoElement.prototype.webkitSupportsFullscreen === true);
1960
+ return globalThis.document.documentElement;
1961
+ }
1962
+ function getEnabled$1() {
1963
+ if (api !== null)
2015
1964
  return globalThis.document[api.enabled] === true;
2016
- }
2017
- function getElement() {
2018
- if (api === null) {
2019
- if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
2020
- return lastIOSVideo;
2021
- return null;
2022
- }
2023
- var currentElement = globalThis.document[api.element];
2024
- if (typeof currentElement !== 'undefined')
2025
- return currentElement;
1965
+ if (Platform.os.name !== OS.iOS)
1966
+ return false;
1967
+ var video;
1968
+ var selected = globalThis.document.querySelector('video');
1969
+ if (selected !== null)
1970
+ video = selected;
1971
+ else
1972
+ video = globalThis.document.createElement('video');
1973
+ return video.webkitSupportsFullscreen === true || typeof video.webkitEnterFullscreen === 'function';
1974
+ }
1975
+ function getElement$1() {
1976
+ if (api === null) {
1977
+ if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
1978
+ return lastIOSVideo;
2026
1979
  return null;
2027
1980
  }
2028
- function getIsFullscreen() {
2029
- return getElement() !== null;
2030
- }
2031
- function drainPendingOperation() {
2032
- var entry = pendingQueue.shift();
2033
- if (typeof entry === 'undefined') {
2034
- activeOperation = null;
2035
- return;
2036
- }
2037
- var next;
2038
- if (entry.operation === 'request')
2039
- next = requestImmediately(entry.target, entry.options);
2040
- else
2041
- next = exitImmediately();
2042
- activeOperation = next
2043
- .then(function () {
2044
- entry.resolve();
2045
- drainPendingOperation();
2046
- })
2047
- .catch(function (error) {
2048
- entry.reject(error);
2049
- drainPendingOperation();
2050
- });
2051
- }
2052
- function request(target, options) {
2053
- lastIntendedOperation = 'request';
2054
- if (activeOperation === null) {
2055
- var next = requestImmediately(target, options);
2056
- activeOperation = next
2057
- .then(drainPendingOperation)
2058
- .catch(drainPendingOperation);
2059
- return next;
2060
- }
2061
- return new Promise(function (resolve, reject) {
2062
- pendingQueue.push({
2063
- operation: 'request',
2064
- target: target,
2065
- options: options,
2066
- resolve: resolve,
2067
- reject: reject,
2068
- });
2069
- });
2070
- }
2071
- function exit() {
2072
- lastIntendedOperation = 'exit';
2073
- if (activeOperation === null) {
2074
- var next = exitImmediately();
2075
- activeOperation = next
2076
- .then(drainPendingOperation)
2077
- .catch(drainPendingOperation);
2078
- return next;
2079
- }
2080
- return new Promise(function (resolve, reject) {
2081
- pendingQueue.push({
2082
- operation: 'exit',
2083
- target: undefined,
2084
- options: undefined,
2085
- resolve: resolve,
2086
- reject: reject,
2087
- });
2088
- });
2089
- }
2090
- function requestImmediately(target, options) {
2091
- return new Promise(function (resolve, reject) {
2092
- if (typeof target === 'undefined')
2093
- target = getDefaultTarget();
2094
- if (typeof target === 'undefined')
2095
- return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2096
- var tagName = target.tagName.toLowerCase();
2097
- function fallbackToIOSVideo() {
2098
- if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2099
- var video = target;
2100
- if (video.webkitSupportsFullscreen === true && typeof video.webkitEnterFullscreen === 'function') {
2101
- lastIOSVideo = video;
2102
- bridgeIOSVideoEvents();
2103
- video.webkitEnterFullscreen();
2104
- return resolve();
1981
+ var currentElement = globalThis.document[api.element];
1982
+ if (typeof currentElement !== 'undefined')
1983
+ return currentElement;
1984
+ return null;
1985
+ }
1986
+ function getIsFullscreen() {
1987
+ return getElement$1() !== null;
1988
+ }
1989
+ function createEventPayload(nativeEvent, element, isFullscreen) {
1990
+ return {
1991
+ nativeEvent: nativeEvent,
1992
+ element: element,
1993
+ isFullscreen: isFullscreen,
1994
+ };
1995
+ }
1996
+ function emitChange$1(nativeEvent, element, isFullscreen) {
1997
+ onChangeSubscriptionManager$3.emit(createEventPayload(nativeEvent, element, isFullscreen));
1998
+ }
1999
+ function emitError$1(nativeEvent, element, isFullscreen) {
2000
+ onErrorSubscriptionManager$1.emit(createEventPayload(nativeEvent, element, isFullscreen));
2001
+ }
2002
+ function onFullscreenChange(event) {
2003
+ var target = event.target;
2004
+ if (target instanceof globalThis.Element)
2005
+ emitChange$1(event, target, getIsFullscreen());
2006
+ if (target instanceof globalThis.Document)
2007
+ emitChange$1(event, globalThis.document.documentElement, getIsFullscreen());
2008
+ }
2009
+ function onFullscreenError(event) {
2010
+ var target = event.target;
2011
+ if (target instanceof globalThis.Element)
2012
+ emitError$1(event, target, getIsFullscreen());
2013
+ if (target instanceof globalThis.Document)
2014
+ emitError$1(event, globalThis.document.documentElement, getIsFullscreen());
2015
+ }
2016
+ function onIOSBeginFullscreen(event) {
2017
+ lastIOSVideo = this;
2018
+ emitChange$1(event, this, true);
2019
+ }
2020
+ function onIOSEndFullscreen(event) {
2021
+ if (lastIOSVideo === this)
2022
+ lastIOSVideo = null;
2023
+ emitChange$1(event, this, false);
2024
+ }
2025
+ function bridgeSingleVideoNode$1(video) {
2026
+ if (video[FS_BRIDGE_KEY])
2027
+ return;
2028
+ if (typeof video.webkitEnterFullscreen === 'undefined' && typeof video.onwebkitbeginfullscreen === 'undefined')
2029
+ return;
2030
+ EventListener.add(video, { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2031
+ EventListener.add(video, { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2032
+ video[FS_BRIDGE_KEY] = true;
2033
+ }
2034
+ function bridgeIOSVideoEvents() {
2035
+ var videos = globalThis.document.querySelectorAll('video');
2036
+ for (var i = 0; i < videos.length; i++)
2037
+ bridgeSingleVideoNode$1(videos[i]);
2038
+ }
2039
+ function bridgeEvents$1() {
2040
+ if (eventsBridged$1)
2041
+ return;
2042
+ eventsBridged$1 = true;
2043
+ if (Platform.os.name !== OS.iOS)
2044
+ return;
2045
+ bridgeIOSVideoEvents();
2046
+ if (typeof globalThis.MutationObserver === 'undefined')
2047
+ return;
2048
+ var observer = new globalThis.MutationObserver(function (records) {
2049
+ if (lastIOSVideo !== null) {
2050
+ var removed = false;
2051
+ for (var i = 0; i < records.length; i++) {
2052
+ var removedNodes = records[i].removedNodes;
2053
+ for (var j = 0; j < removedNodes.length; j++) {
2054
+ var node = removedNodes[j];
2055
+ if (node === lastIOSVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastIOSVideo))) {
2056
+ removed = true;
2057
+ break;
2105
2058
  }
2106
2059
  }
2107
- reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2060
+ if (removed)
2061
+ break;
2062
+ }
2063
+ if (removed && !globalThis.document.contains(lastIOSVideo))
2064
+ lastIOSVideo = null;
2065
+ }
2066
+ for (var i = 0; i < records.length; i++) {
2067
+ var addedNodes = records[i].addedNodes;
2068
+ for (var j = 0; j < addedNodes.length; j++) {
2069
+ var node = addedNodes[j];
2070
+ if (node.nodeType !== Node.ELEMENT_NODE)
2071
+ continue;
2072
+ var element = node;
2073
+ if (element.tagName === 'VIDEO') {
2074
+ bridgeSingleVideoNode$1(element);
2075
+ continue;
2076
+ }
2077
+ var nested = element.querySelectorAll('video');
2078
+ for (var k = 0; k < nested.length; k++)
2079
+ bridgeSingleVideoNode$1(nested[k]);
2108
2080
  }
2109
- if (api !== null) {
2110
- var method = target[api.request];
2111
- if (typeof method === 'function') {
2112
- var result = method.call(target, options);
2113
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2114
- result
2115
- .then(resolve)
2116
- .catch(function () {
2081
+ }
2082
+ });
2083
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
2084
+ }
2085
+ function attachOnChange$3() {
2086
+ if (api != null)
2087
+ EventListener.add(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2088
+ if (Platform.os.name === OS.iOS)
2089
+ bridgeIOSVideoEvents();
2090
+ }
2091
+ function detachOnChange$3() {
2092
+ if (api != null)
2093
+ EventListener.remove(globalThis.document, { type: api.events.change, callback: onFullscreenChange, options: false });
2094
+ if (Platform.os.name !== OS.iOS)
2095
+ return;
2096
+ var videos = globalThis.document.querySelectorAll('video');
2097
+ for (var i = 0; i < videos.length; i++) {
2098
+ EventListener.remove(videos[i], { type: 'webkitbeginfullscreen', callback: onIOSBeginFullscreen, options: false });
2099
+ EventListener.remove(videos[i], { type: 'webkitendfullscreen', callback: onIOSEndFullscreen, options: false });
2100
+ videos[i][FS_BRIDGE_KEY] = false;
2101
+ }
2102
+ }
2103
+ function attachOnError$1() {
2104
+ if (api != null)
2105
+ EventListener.add(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2106
+ }
2107
+ function detachOnError$1() {
2108
+ if (api != null)
2109
+ EventListener.remove(globalThis.document, { type: api.events.error, callback: onFullscreenError, options: false });
2110
+ }
2111
+ function request$3(target, options) {
2112
+ return new Promise(function (resolve, reject) {
2113
+ if (typeof target === 'undefined')
2114
+ target = getDefaultTarget$1();
2115
+ if (typeof target === 'undefined')
2116
+ return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
2117
+ var tagName = target.tagName.toLowerCase();
2118
+ var isIOSFullscreenActive = lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true;
2119
+ if (api !== null) {
2120
+ var method = target[api.request];
2121
+ if (typeof method === 'function' && !isIOSFullscreenActive) {
2122
+ var result = method.call(target, options);
2123
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2124
+ result
2125
+ .then(resolve)
2126
+ .catch(function () {
2127
+ try {
2117
2128
  if (Platform.os.name !== OS.iOS)
2118
2129
  return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2119
2130
  fallbackToIOSVideo();
2120
- });
2121
- return;
2122
- }
2123
- return resolve();
2131
+ }
2132
+ catch (_e) {
2133
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2134
+ }
2135
+ });
2136
+ return;
2124
2137
  }
2125
- }
2126
- fallbackToIOSVideo();
2127
- });
2128
- }
2129
- function exitImmediately() {
2130
- return new Promise(function (resolve, reject) {
2131
- if (getElement() === null && lastIOSVideo === null)
2132
2138
  return resolve();
2133
- function fallbackToIOSVideo() {
2134
- if (Platform.os.name === OS.iOS) {
2135
- var candidates = void 0;
2136
- if (lastIOSVideo !== null)
2137
- candidates = [lastIOSVideo];
2138
- else
2139
- candidates = globalThis.document.querySelectorAll('video');
2140
- for (var i = 0; i < candidates.length; i++) {
2141
- var video = candidates[i];
2142
- if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2143
- video.webkitExitFullscreen();
2144
- lastIOSVideo = null;
2145
- return resolve();
2139
+ }
2140
+ }
2141
+ function fallbackToIOSVideo() {
2142
+ if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
2143
+ var video_1 = target;
2144
+ if (video_1.webkitSupportsFullscreen && typeof video_1.webkitEnterFullscreen === 'function') {
2145
+ if (!hasStandardApi$1())
2146
+ bridgeSingleVideoNode$1(video_1);
2147
+ if (video_1.played.length === 0) {
2148
+ video_1.play()
2149
+ .then(function () {
2150
+ try {
2151
+ video_1.webkitEnterFullscreen();
2152
+ }
2153
+ catch (e) {
2154
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2155
+ }
2156
+ });
2157
+ }
2158
+ else {
2159
+ try {
2160
+ video_1.webkitEnterFullscreen();
2161
+ }
2162
+ catch (e) {
2163
+ return reject(new InvalidStateError('The object is in an invalid state.'));
2146
2164
  }
2147
2165
  }
2166
+ lastIOSVideo = video_1;
2167
+ return resolve();
2148
2168
  }
2149
- reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2150
2169
  }
2151
- if (api !== null) {
2152
- var method = globalThis.document[api.exit];
2153
- if (typeof method === 'function') {
2154
- var result = method.call(globalThis.document);
2155
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
2156
- result
2157
- .then(resolve)
2158
- .catch(function () {
2170
+ reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
2171
+ }
2172
+ fallbackToIOSVideo();
2173
+ });
2174
+ }
2175
+ function exit$1() {
2176
+ return new Promise(function (resolve, reject) {
2177
+ if (api !== null) {
2178
+ var method = globalThis.document[api.exit];
2179
+ if (typeof method === 'function') {
2180
+ var result = method.call(globalThis.document);
2181
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
2182
+ result
2183
+ .then(resolve)
2184
+ .catch(function () {
2185
+ try {
2159
2186
  if (Platform.os.name !== OS.iOS)
2160
2187
  return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2161
2188
  fallbackToIOSVideo();
2162
- });
2163
- return;
2164
- }
2189
+ }
2190
+ catch (_e) {
2191
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2192
+ }
2193
+ });
2194
+ return;
2195
+ }
2196
+ return resolve();
2197
+ }
2198
+ }
2199
+ function fallbackToIOSVideo() {
2200
+ if (Platform.os.name !== OS.iOS) {
2201
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2202
+ return;
2203
+ }
2204
+ var target = lastIOSVideo;
2205
+ if (target !== null && typeof target.webkitExitFullscreen === 'function' && target.webkitDisplayingFullscreen === true) {
2206
+ target.webkitExitFullscreen();
2207
+ if (target.webkitDisplayingFullscreen)
2208
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2209
+ lastIOSVideo = null;
2210
+ return resolve();
2211
+ }
2212
+ var videos = globalThis.document.querySelectorAll('video');
2213
+ for (var i = 0; i < videos.length; i++) {
2214
+ var video = videos[i];
2215
+ if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
2216
+ video.webkitExitFullscreen();
2217
+ if (video.webkitDisplayingFullscreen)
2218
+ return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2219
+ lastIOSVideo = null;
2165
2220
  return resolve();
2166
2221
  }
2167
2222
  }
2168
- fallbackToIOSVideo();
2169
- });
2170
- }
2171
- function toggle(target, options) {
2172
- if (lastIntendedOperation === 'request')
2173
- return exit();
2174
- return request(target, options);
2175
- }
2176
- bridgeEvents();
2177
- return {
2178
- get supported() {
2179
- return getEnabled();
2180
- },
2181
- get element() {
2182
- return getElement();
2183
- },
2184
- get isFullscreen() {
2185
- return getIsFullscreen();
2186
- },
2187
- request: request,
2188
- exit: exit,
2189
- toggle: toggle,
2190
- onChange: onChangeSubscriptionManager.subscribe,
2191
- onError: onErrorSubscriptionManager.subscribe,
2192
- Constants: {},
2193
- Errors: {
2194
- NotSupportedError: NotSupportedError,
2195
- },
2196
- };
2223
+ if (getElement$1() === null)
2224
+ return resolve();
2225
+ reject(new NotSupportedError('Failed to exit fullscreen mode.'));
2226
+ }
2227
+ fallbackToIOSVideo();
2228
+ });
2197
2229
  }
2198
- var Fullscreen = createFullscreen();
2230
+ bridgeEvents$1();
2199
2231
 
2200
2232
  var PermissionType;
2201
2233
  (function (PermissionType) {
@@ -2237,7 +2269,10 @@ var GET_USER_MEDIA = (function () {
2237
2269
  })();
2238
2270
 
2239
2271
  var Permission = {
2240
- request: request$1,
2272
+ get supported() {
2273
+ return supported$5();
2274
+ },
2275
+ request: request$2,
2241
2276
  check: check,
2242
2277
  Constants: {
2243
2278
  PermissionType: PermissionType,
@@ -2245,7 +2280,10 @@ var Permission = {
2245
2280
  },
2246
2281
  Errors: {},
2247
2282
  };
2248
- function request$1(type) {
2283
+ function supported$5() {
2284
+ return typeof globalThis.navigator.permissions !== 'undefined';
2285
+ }
2286
+ function request$2(type) {
2249
2287
  var instance = this;
2250
2288
  return new Promise(function (resolve) {
2251
2289
  function resolveAfterCheck() {
@@ -2335,7 +2373,7 @@ function check(type) {
2335
2373
 
2336
2374
  var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
2337
2375
 
2338
- function request(url, options) {
2376
+ function request$1(url, options) {
2339
2377
  return new Promise(function (resolve) {
2340
2378
  var method = 'GET';
2341
2379
  var headers = {};
@@ -2417,7 +2455,7 @@ function assign() {
2417
2455
  return to;
2418
2456
  }
2419
2457
 
2420
- var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
2458
+ var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
2421
2459
  var watchIdRef = null;
2422
2460
  var Geolocation = {
2423
2461
  get value() {
@@ -2426,7 +2464,7 @@ var Geolocation = {
2426
2464
  get supported() {
2427
2465
  return supported$4();
2428
2466
  },
2429
- onChange: onChangeSubscriptionManager$1.subscribe,
2467
+ onChange: onChangeSubscriptionManager$2.subscribe,
2430
2468
  Constants: {},
2431
2469
  Errors: {
2432
2470
  NotSupportedError: NotSupportedError,
@@ -2463,7 +2501,7 @@ function getValue$1() {
2463
2501
  }
2464
2502
  function getFallbackValue(error) {
2465
2503
  return new Promise(function (resolve, reject) {
2466
- request('http://ip-api.com/json?fields=lat,lon')
2504
+ request$1('http://ip-api.com/json?fields=lat,lon')
2467
2505
  .then(function (response) {
2468
2506
  if (typeof response !== 'undefined') {
2469
2507
  var coordinate_1 = {
@@ -2502,7 +2540,7 @@ function normalizeError(error) {
2502
2540
  return new NotSupportedError('Unknown error.');
2503
2541
  }
2504
2542
  }
2505
- function attachOnChange$1() {
2543
+ function attachOnChange$2() {
2506
2544
  if (!supported$4())
2507
2545
  return;
2508
2546
  Permission
@@ -2515,13 +2553,13 @@ function attachOnChange$1() {
2515
2553
  }
2516
2554
  });
2517
2555
  }
2518
- function detachOnChange$1() {
2556
+ function detachOnChange$2() {
2519
2557
  if (!supported$4() || watchIdRef === null)
2520
2558
  return;
2521
2559
  globalThis.navigator.geolocation.clearWatch(watchIdRef);
2522
2560
  }
2523
2561
  function onGeolocationCoordinatesChange(coordinates) {
2524
- onChangeSubscriptionManager$1.emit(coordinates);
2562
+ onChangeSubscriptionManager$2.emit(coordinates);
2525
2563
  }
2526
2564
  function supported$4() {
2527
2565
  return typeof globalThis.navigator.geolocation !== 'undefined';
@@ -3972,16 +4010,19 @@ function removeThemeColor() {
3972
4010
  }
3973
4011
 
3974
4012
  var Vibration = {
3975
- run: run,
3976
- stop: stop,
3977
4013
  get supported() {
3978
4014
  return supported$3();
3979
4015
  },
4016
+ run: run,
4017
+ stop: stop,
3980
4018
  Constants: {},
3981
4019
  Errors: {
3982
4020
  NotSupportedError: NotSupportedError,
3983
4021
  },
3984
4022
  };
4023
+ function supported$3() {
4024
+ return typeof globalThis.navigator.vibrate !== 'undefined';
4025
+ }
3985
4026
  function run(pattern) {
3986
4027
  if (supported$3())
3987
4028
  return globalThis.navigator.vibrate(pattern);
@@ -3990,313 +4031,290 @@ function run(pattern) {
3990
4031
  function stop() {
3991
4032
  return this.run(0);
3992
4033
  }
3993
- function supported$3() {
3994
- return typeof globalThis.navigator.vibrate !== 'undefined';
3995
- }
3996
4034
 
3997
- var PIP_BRIDGED_KEY = Symbol('pipBridged');
3998
4035
  var PIP_PRESENTATION_MODE = 'picture-in-picture';
3999
4036
  var INLINE_PRESENTATION_MODE = 'inline';
4000
- function hasStandardPipEvents() {
4037
+ var lastPipVideo = null;
4038
+ var eventsBridged = false;
4039
+ var PIP_BRIDGE_KEY = (function () {
4040
+ if (typeof Symbol === 'function') {
4041
+ var existing = globalThis.__nativeFnPipBridgeKey__;
4042
+ if (typeof existing === 'symbol')
4043
+ return existing;
4044
+ return globalThis.__nativeFnPipBridgeKey__ = Symbol('native.fn.pip.bridged');
4045
+ }
4046
+ return '__nativeFnPipBridged__';
4047
+ }());
4048
+ var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
4049
+ var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4050
+ var Pip = {
4051
+ get supported() {
4052
+ return getEnabled();
4053
+ },
4054
+ get element() {
4055
+ return getElement();
4056
+ },
4057
+ get isPip() {
4058
+ return getIsPip();
4059
+ },
4060
+ request: request,
4061
+ exit: exit,
4062
+ onChange: onChangeSubscriptionManager$1.subscribe,
4063
+ onError: onErrorSubscriptionManager.subscribe,
4064
+ Constants: {},
4065
+ Errors: {
4066
+ NotSupportedError: NotSupportedError,
4067
+ InvalidStateError: InvalidStateError,
4068
+ },
4069
+ };
4070
+ function hasStandardApi() {
4001
4071
  return typeof globalThis.document.pictureInPictureEnabled !== 'undefined';
4002
4072
  }
4003
- function createPip() {
4004
- var lastPipVideo = null;
4005
- var eventsBridged = false;
4006
- var activeOperation = null;
4007
- var pendingQueue = [];
4008
- var lastIntendedOperation = 'exit';
4009
- var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4010
- var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
4011
- function getEnabled() {
4012
- if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4013
- return globalThis.document.pictureInPictureEnabled;
4014
- if (typeof HTMLVideoElement === 'undefined')
4015
- return false;
4016
- var videos = globalThis.document.querySelectorAll('video');
4017
- for (var i = 0; i < videos.length; i++) {
4018
- var video = videos[i];
4019
- if (typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE))
4020
- return true;
4021
- }
4022
- return false;
4023
- }
4024
- function getElement() {
4025
- var currentElement = globalThis.document.pictureInPictureElement;
4026
- if (currentElement !== null && typeof currentElement !== 'undefined')
4027
- return currentElement;
4028
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4029
- return lastPipVideo;
4030
- return null;
4031
- }
4032
- function getIsPip() {
4033
- return getElement() !== null;
4034
- }
4035
- function getDefaultTarget() {
4036
- var video = globalThis.document.querySelector('video');
4037
- if (video === null)
4038
- return undefined;
4039
- return video;
4073
+ function getDefaultTarget() {
4074
+ var video = globalThis.document.querySelector('video');
4075
+ return video !== null ? video : undefined;
4076
+ }
4077
+ function createPipEventPayload(nativeEvent, element, isPip) {
4078
+ return {
4079
+ nativeEvent: nativeEvent,
4080
+ element: element,
4081
+ isPip: isPip
4082
+ };
4083
+ }
4084
+ function emitChange(nativeEvent, element, isPip) {
4085
+ onChangeSubscriptionManager$1.emit(createPipEventPayload(nativeEvent, element, isPip));
4086
+ }
4087
+ function emitError(nativeEvent, element, isPip) {
4088
+ onErrorSubscriptionManager.emit(createPipEventPayload(nativeEvent, element, isPip));
4089
+ }
4090
+ function onEnterPictureInPicture(event) {
4091
+ var target = event.target;
4092
+ if (target instanceof globalThis.HTMLVideoElement)
4093
+ emitChange(event, target, true);
4094
+ }
4095
+ function onLeavePictureInPicture(event) {
4096
+ var target = event.target;
4097
+ if (target instanceof globalThis.HTMLVideoElement)
4098
+ emitChange(event, target, false);
4099
+ }
4100
+ function onPictureInPictureError(event) {
4101
+ var target = event.target;
4102
+ if (target instanceof globalThis.HTMLVideoElement)
4103
+ emitError(event, target, getIsPip());
4104
+ }
4105
+ function onWebkitPresentationModeChanged(event) {
4106
+ if (this.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4107
+ lastPipVideo = this;
4108
+ emitChange(event, this, true);
4109
+ return;
4040
4110
  }
4041
- function onWebkitPresentationModeChanged(event) {
4042
- if (this.webkitPresentationMode === PIP_PRESENTATION_MODE || (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this))
4043
- onChangeSubscriptionManager.emit(event);
4111
+ if (this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this) {
4112
+ lastPipVideo = null;
4113
+ emitChange(event, this, false);
4044
4114
  }
4045
- function bridgeEvents() {
4046
- if (eventsBridged)
4047
- return;
4048
- eventsBridged = true;
4049
- if (!hasStandardPipEvents()) {
4050
- bridgeWebkitVideoEvents();
4051
- if (typeof globalThis.MutationObserver !== 'undefined') {
4052
- var observer = new MutationObserver(function () {
4053
- bridgeWebkitVideoEvents();
4054
- });
4055
- observer.observe(globalThis.document.documentElement, {
4056
- childList: true,
4057
- subtree: true,
4058
- });
4115
+ }
4116
+ function bridgeSingleVideoNode(video) {
4117
+ if (video[PIP_BRIDGE_KEY])
4118
+ return;
4119
+ if (typeof video.webkitSetPresentationMode === 'undefined' && typeof video.onwebkitpresentationmodechanged === 'undefined')
4120
+ return;
4121
+ EventListener.add(video, { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4122
+ video[PIP_BRIDGE_KEY] = true;
4123
+ }
4124
+ function bridgeWebkitVideoEvents() {
4125
+ var videos = globalThis.document.querySelectorAll('video');
4126
+ for (var i = 0; i < videos.length; i++)
4127
+ bridgeSingleVideoNode(videos[i]);
4128
+ }
4129
+ function bridgeEvents() {
4130
+ if (eventsBridged)
4131
+ return;
4132
+ eventsBridged = true;
4133
+ if (hasStandardApi())
4134
+ return;
4135
+ bridgeWebkitVideoEvents();
4136
+ if (typeof globalThis.MutationObserver === 'undefined')
4137
+ return;
4138
+ var observer = new globalThis.MutationObserver(function (records) {
4139
+ if (lastPipVideo !== null) {
4140
+ var removed = false;
4141
+ for (var i = 0; i < records.length; i++) {
4142
+ var removedNodes = records[i].removedNodes;
4143
+ for (var j = 0; j < removedNodes.length; j++) {
4144
+ var node = removedNodes[j];
4145
+ if (node === lastPipVideo || (node.nodeType === Node.ELEMENT_NODE && node.contains(lastPipVideo))) {
4146
+ removed = true;
4147
+ break;
4148
+ }
4149
+ }
4150
+ if (removed)
4151
+ break;
4059
4152
  }
4153
+ if (removed && !globalThis.document.contains(lastPipVideo))
4154
+ lastPipVideo = null;
4060
4155
  }
4061
- }
4062
- function bridgeWebkitVideoEvents() {
4063
- if (typeof globalThis.document === 'undefined')
4064
- return;
4065
- var videos = globalThis.document.querySelectorAll('video');
4066
- videos.forEach(function (video) {
4067
- if (video[PIP_BRIDGED_KEY] === true || !(typeof video.webkitSetPresentationMode !== 'undefined' || typeof video.onwebkitpresentationmodechanged !== 'undefined'))
4068
- return;
4069
- EventListener.add(video, {
4070
- type: 'webkitpresentationmodechanged',
4071
- callback: onWebkitPresentationModeChanged,
4072
- options: false,
4073
- });
4074
- video[PIP_BRIDGED_KEY] = true;
4075
- });
4076
- }
4077
- function attachOnChange() {
4078
- if (hasStandardPipEvents()) {
4079
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4080
- for (var i = 0; i < changeEvents.length; i++) {
4081
- EventListener.add(globalThis.document, {
4082
- type: changeEvents[i],
4083
- callback: onChangeSubscriptionManager.emit,
4084
- options: false,
4085
- });
4156
+ for (var i = 0; i < records.length; i++) {
4157
+ var addedNodes = records[i].addedNodes;
4158
+ for (var j = 0; j < addedNodes.length; j++) {
4159
+ var node = addedNodes[j];
4160
+ if (node.nodeType !== Node.ELEMENT_NODE)
4161
+ continue;
4162
+ var element = node;
4163
+ if (element.tagName === 'VIDEO') {
4164
+ bridgeSingleVideoNode(element);
4165
+ continue;
4166
+ }
4167
+ var nested = element.querySelectorAll('video');
4168
+ for (var k = 0; k < nested.length; k++)
4169
+ bridgeSingleVideoNode(nested[k]);
4086
4170
  }
4087
- return;
4088
4171
  }
4089
- bridgeWebkitVideoEvents();
4172
+ });
4173
+ observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
4174
+ }
4175
+ function attachOnChange$1() {
4176
+ if (hasStandardApi()) {
4177
+ EventListener.add(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4178
+ EventListener.add(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4179
+ return;
4090
4180
  }
4091
- function detachOnChange() {
4092
- if (hasStandardPipEvents()) {
4093
- var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
4094
- for (var i = 0; i < changeEvents.length; i++) {
4095
- EventListener.remove(globalThis.document, {
4096
- type: changeEvents[i],
4097
- callback: onChangeSubscriptionManager.emit,
4098
- options: false,
4181
+ bridgeWebkitVideoEvents();
4182
+ }
4183
+ function detachOnChange$1() {
4184
+ if (hasStandardApi()) {
4185
+ EventListener.remove(globalThis.document, { type: 'enterpictureinpicture', callback: onEnterPictureInPicture, options: false });
4186
+ EventListener.remove(globalThis.document, { type: 'leavepictureinpicture', callback: onLeavePictureInPicture, options: false });
4187
+ return;
4188
+ }
4189
+ var videos = globalThis.document.querySelectorAll('video');
4190
+ for (var i = 0; i < videos.length; i++) {
4191
+ EventListener.remove(videos[i], { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
4192
+ videos[i][PIP_BRIDGE_KEY] = false;
4193
+ }
4194
+ }
4195
+ function attachOnError() {
4196
+ EventListener.add(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4197
+ }
4198
+ function detachOnError() {
4199
+ EventListener.remove(globalThis.document, { type: 'pictureinpictureerror', callback: onPictureInPictureError, options: false });
4200
+ }
4201
+ function getEnabled() {
4202
+ if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
4203
+ return globalThis.document.pictureInPictureEnabled;
4204
+ var video;
4205
+ var selected = globalThis.document.querySelector('video');
4206
+ if (selected !== null)
4207
+ video = selected;
4208
+ else
4209
+ video = globalThis.document.createElement('video');
4210
+ return typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE);
4211
+ }
4212
+ function getElement() {
4213
+ var currentElement = globalThis.document.pictureInPictureElement;
4214
+ if (currentElement !== null && typeof currentElement !== 'undefined')
4215
+ return currentElement;
4216
+ if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4217
+ return lastPipVideo;
4218
+ return null;
4219
+ }
4220
+ function getIsPip() {
4221
+ return getElement() !== null;
4222
+ }
4223
+ function request(target) {
4224
+ return new Promise(function (resolve, reject) {
4225
+ if (typeof target === 'undefined')
4226
+ target = getDefaultTarget();
4227
+ if (typeof target === 'undefined')
4228
+ return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4229
+ var tagName = target.tagName.toLowerCase();
4230
+ if (tagName !== 'video')
4231
+ return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4232
+ var method = target.requestPictureInPicture;
4233
+ var isWebkitPipActive = lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE;
4234
+ if (typeof method === 'function' && !isWebkitPipActive) {
4235
+ var result = method.call(target);
4236
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4237
+ result
4238
+ .then(resolve)
4239
+ .catch(function () {
4240
+ try {
4241
+ fallbackToWebkit();
4242
+ }
4243
+ catch (e) {
4244
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4245
+ }
4099
4246
  });
4247
+ return;
4100
4248
  }
4101
- return;
4249
+ return resolve();
4102
4250
  }
4103
- var videos = globalThis.document.querySelectorAll('video');
4104
- videos.forEach(function (video) {
4105
- EventListener.remove(video, {
4106
- type: 'webkitpresentationmodechanged',
4107
- callback: onWebkitPresentationModeChanged,
4108
- options: false,
4109
- });
4110
- try {
4111
- delete video[PIP_BRIDGED_KEY];
4112
- }
4113
- catch (_) {
4114
- video[PIP_BRIDGED_KEY] = undefined;
4251
+ function fallbackToWebkit() {
4252
+ if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4253
+ if (target.disablePictureInPicture)
4254
+ return reject(new NotSupportedError('Picture-in-Picture is disabled on this element.'));
4255
+ if (!hasStandardApi())
4256
+ bridgeSingleVideoNode(target);
4257
+ target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4258
+ if (target.webkitPresentationMode !== PIP_PRESENTATION_MODE)
4259
+ return reject(new InvalidStateError('Picture-in-Picture transition is already in progress.'));
4260
+ lastPipVideo = target;
4261
+ return resolve();
4115
4262
  }
4116
- });
4117
- }
4118
- function attachOnError() {
4119
- EventListener.add(globalThis.document, {
4120
- type: 'pictureinpictureerror',
4121
- callback: onErrorSubscriptionManager.emit,
4122
- options: false,
4123
- });
4124
- }
4125
- function detachOnError() {
4126
- EventListener.remove(globalThis.document, {
4127
- type: 'pictureinpictureerror',
4128
- callback: onErrorSubscriptionManager.emit,
4129
- options: false,
4130
- });
4131
- }
4132
- function drainPendingOperation() {
4133
- var entry = pendingQueue.shift();
4134
- if (typeof entry === 'undefined') {
4135
- activeOperation = null;
4136
- return;
4137
- }
4138
- var next;
4139
- if (entry.operation === 'request')
4140
- next = requestImmediately(entry.target);
4141
- else
4142
- next = exitImmediately();
4143
- activeOperation = next
4144
- .then(function () {
4145
- entry.resolve();
4146
- drainPendingOperation();
4147
- })
4148
- .catch(function (error) {
4149
- entry.reject(error);
4150
- drainPendingOperation();
4151
- });
4152
- }
4153
- function request(target) {
4154
- lastIntendedOperation = 'request';
4155
- if (activeOperation === null) {
4156
- var next = requestImmediately(target);
4157
- activeOperation = next
4158
- .then(drainPendingOperation)
4159
- .catch(drainPendingOperation);
4160
- return next;
4263
+ reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4161
4264
  }
4162
- return new Promise(function (resolve, reject) {
4163
- pendingQueue.push({
4164
- operation: 'request',
4165
- target: target,
4166
- resolve: resolve,
4167
- reject: reject,
4168
- });
4169
- });
4170
- }
4171
- function exit() {
4172
- lastIntendedOperation = 'exit';
4173
- if (activeOperation === null) {
4174
- var next = exitImmediately();
4175
- activeOperation = next
4176
- .then(drainPendingOperation)
4177
- .catch(drainPendingOperation);
4178
- return next;
4179
- }
4180
- return new Promise(function (resolve, reject) {
4181
- pendingQueue.push({
4182
- operation: 'exit',
4183
- target: undefined,
4184
- resolve: resolve,
4185
- reject: reject,
4186
- });
4187
- });
4188
- }
4189
- function requestImmediately(target) {
4190
- return new Promise(function (resolve, reject) {
4191
- if (typeof target === 'undefined')
4192
- target = getDefaultTarget();
4193
- if (typeof target === 'undefined')
4194
- return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
4195
- var tagName = target.tagName.toLowerCase();
4196
- if (tagName !== 'video')
4197
- return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4198
- function fallbackToWebkitVideo() {
4199
- if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
4200
- if (target.disablePictureInPicture)
4201
- return reject(new NotSupportedError('Picture-in-Picture is disabled on this video element.'));
4202
- lastPipVideo = target;
4203
- bridgeWebkitVideoEvents();
4204
- target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
4205
- return resolve();
4206
- }
4207
- reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
4265
+ fallbackToWebkit();
4266
+ });
4267
+ }
4268
+ function exit() {
4269
+ return new Promise(function (resolve, reject) {
4270
+ var method = globalThis.document.exitPictureInPicture;
4271
+ if (typeof method === 'function') {
4272
+ var result = method.call(globalThis.document);
4273
+ if (typeof result !== 'undefined' && typeof result.then === 'function') {
4274
+ result
4275
+ .then(resolve)
4276
+ .catch(function () {
4277
+ try {
4278
+ fallbackToWebkit();
4279
+ }
4280
+ catch (e) {
4281
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4282
+ }
4283
+ });
4284
+ return;
4208
4285
  }
4209
- var method = target.requestPictureInPicture;
4210
- if (typeof method === 'function') {
4211
- var result = method.call(target);
4212
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4213
- result
4214
- .then(function () {
4215
- resolve();
4216
- })
4217
- .catch(function () {
4218
- fallbackToWebkitVideo();
4219
- });
4220
- return;
4221
- }
4286
+ return resolve();
4287
+ }
4288
+ function fallbackToWebkit() {
4289
+ if (lastPipVideo !== null && typeof lastPipVideo.webkitSetPresentationMode === 'function' && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4290
+ lastPipVideo.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4291
+ lastPipVideo = null;
4222
4292
  return resolve();
4223
4293
  }
4224
- fallbackToWebkitVideo();
4225
- });
4226
- }
4227
- function exitImmediately() {
4228
- return new Promise(function (resolve, reject) {
4229
- if (getElement() === null && lastPipVideo === null)
4230
- return resolve();
4231
- function fallbackToWebkitVideo() {
4232
- var candidates;
4233
- if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
4234
- candidates = [lastPipVideo];
4235
- else
4236
- candidates = globalThis.document.querySelectorAll('video');
4237
- for (var i = 0; i < candidates.length; i++) {
4238
- var video = candidates[i];
4239
- if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4240
- video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4241
- lastPipVideo = null;
4242
- return resolve();
4243
- }
4244
- }
4245
- if (getElement() === null)
4294
+ var videos = globalThis.document.querySelectorAll('video');
4295
+ for (var i = 0; i < videos.length; i++) {
4296
+ var video = videos[i];
4297
+ if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
4298
+ video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
4299
+ lastPipVideo = null;
4246
4300
  return resolve();
4247
- reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4248
- }
4249
- var method = globalThis.document.exitPictureInPicture;
4250
- if (typeof method === 'function') {
4251
- var result = method.call(globalThis.document);
4252
- if (typeof result !== 'undefined' && typeof result.then === 'function') {
4253
- result
4254
- .then(resolve)
4255
- .catch(function () {
4256
- fallbackToWebkitVideo();
4257
- });
4258
- return;
4259
4301
  }
4260
- return resolve();
4261
4302
  }
4262
- fallbackToWebkitVideo();
4263
- });
4264
- }
4265
- function toggle(target) {
4266
- if (lastIntendedOperation === 'request')
4267
- return exit();
4268
- return request(target);
4269
- }
4270
- bridgeEvents();
4271
- return {
4272
- get supported() {
4273
- return getEnabled();
4274
- },
4275
- get element() {
4276
- return getElement();
4277
- },
4278
- get isPip() {
4279
- return getIsPip();
4280
- },
4281
- request: request,
4282
- exit: exit,
4283
- toggle: toggle,
4284
- onChange: onChangeSubscriptionManager.subscribe,
4285
- onError: onErrorSubscriptionManager.subscribe,
4286
- Constants: {},
4287
- Errors: {
4288
- NotSupportedError: NotSupportedError,
4289
- },
4290
- };
4303
+ if (globalThis.document.pictureInPictureElement === null || typeof globalThis.document.pictureInPictureElement === 'undefined')
4304
+ return resolve();
4305
+ reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
4306
+ }
4307
+ fallbackToWebkit();
4308
+ });
4291
4309
  }
4292
- var Pip = createPip();
4310
+ bridgeEvents();
4293
4311
 
4294
4312
  var Badge = {
4295
- set: set,
4296
- clear: clear,
4297
4313
  get supported() {
4298
4314
  return supported$2();
4299
4315
  },
4316
+ set: set,
4317
+ clear: clear,
4300
4318
  Constants: {},
4301
4319
  Errors: {
4302
4320
  NotSupportedError: NotSupportedError,
@@ -4368,12 +4386,12 @@ function supported$1() {
4368
4386
  var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
4369
4387
  var batteryRef = null;
4370
4388
  var Battery = {
4371
- get value() {
4372
- return getValue();
4373
- },
4374
4389
  get supported() {
4375
4390
  return supported();
4376
4391
  },
4392
+ get value() {
4393
+ return getValue();
4394
+ },
4377
4395
  onChange: onChangeSubscriptionManager.subscribe,
4378
4396
  Constants: {},
4379
4397
  Errors: {