native-fn 1.0.89 → 1.1.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.
- package/dist/index.d.ts +747 -29
- package/dist/native.cjs +4283 -74
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +4283 -74
- package/dist/native.umd.js +4283 -74
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/app/index.cjs +637 -663
- package/dist/plugin/app/index.d.ts +4 -114
- package/dist/plugin/app/index.min.cjs +1 -1
- package/dist/plugin/app/index.min.mjs +1 -1
- package/dist/plugin/app/index.mjs +637 -663
- package/dist/plugin/app/index.umd.js +637 -663
- package/dist/plugin/app/index.umd.min.js +1 -1
- package/dist/plugin/app/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/app/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/app/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/app/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/app/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/app/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/app/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/app/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/app/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/app/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/app/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/app/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/app/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/app/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/app/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/app/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/app/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/app/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/app/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/app/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/app/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/app/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/app/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/app/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/app/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/app/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/app/src/types/native.d.ts +16 -26
- package/dist/plugin/appearance/index.cjs +392 -585
- package/dist/plugin/appearance/index.d.ts +4 -37
- package/dist/plugin/appearance/index.min.cjs +1 -1
- package/dist/plugin/appearance/index.min.mjs +1 -1
- package/dist/plugin/appearance/index.mjs +392 -585
- package/dist/plugin/appearance/index.umd.js +392 -585
- package/dist/plugin/appearance/index.umd.min.js +1 -1
- package/dist/plugin/appearance/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/appearance/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/appearance/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/appearance/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/appearance/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/appearance/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/appearance/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/appearance/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/appearance/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/appearance/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/appearance/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/appearance/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/appearance/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/appearance/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/appearance/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/appearance/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/appearance/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/appearance/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/appearance/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/appearance/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/appearance/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/appearance/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/appearance/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/appearance/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/appearance/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/appearance/src/types/native.d.ts +16 -26
- package/dist/plugin/clipboard/index.cjs +48 -822
- package/dist/plugin/clipboard/index.d.ts +4 -27
- package/dist/plugin/clipboard/index.min.cjs +1 -1
- package/dist/plugin/clipboard/index.min.mjs +1 -1
- package/dist/plugin/clipboard/index.mjs +48 -822
- package/dist/plugin/clipboard/index.umd.js +48 -822
- package/dist/plugin/clipboard/index.umd.min.js +1 -1
- package/dist/plugin/clipboard/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/clipboard/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/clipboard/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/clipboard/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/clipboard/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/clipboard/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/clipboard/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/clipboard/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/clipboard/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/clipboard/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/clipboard/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/clipboard/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/clipboard/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/clipboard/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/clipboard/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/clipboard/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/clipboard/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/clipboard/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/clipboard/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/clipboard/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/clipboard/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/clipboard/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/clipboard/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/clipboard/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/clipboard/src/types/native.d.ts +16 -26
- package/dist/plugin/dimension/index.cjs +3 -883
- package/dist/plugin/dimension/index.d.ts +4 -36
- package/dist/plugin/dimension/index.min.cjs +1 -1
- package/dist/plugin/dimension/index.min.mjs +1 -1
- package/dist/plugin/dimension/index.mjs +3 -883
- package/dist/plugin/dimension/index.umd.js +3 -883
- package/dist/plugin/dimension/index.umd.min.js +1 -1
- package/dist/plugin/dimension/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/dimension/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/dimension/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/dimension/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/dimension/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/dimension/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/dimension/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/dimension/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/dimension/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/dimension/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/dimension/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/dimension/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/dimension/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/dimension/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/dimension/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/dimension/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/dimension/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/dimension/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/dimension/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/dimension/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/dimension/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/dimension/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/dimension/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/dimension/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/dimension/src/types/native.d.ts +16 -26
- package/dist/plugin/fullscreen/index.cjs +391 -588
- package/dist/plugin/fullscreen/index.d.ts +4 -33
- package/dist/plugin/fullscreen/index.min.cjs +1 -1
- package/dist/plugin/fullscreen/index.min.mjs +1 -1
- package/dist/plugin/fullscreen/index.mjs +391 -588
- package/dist/plugin/fullscreen/index.umd.js +391 -588
- package/dist/plugin/fullscreen/index.umd.min.js +1 -1
- package/dist/plugin/fullscreen/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/fullscreen/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/fullscreen/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/fullscreen/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/fullscreen/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/fullscreen/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/fullscreen/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/fullscreen/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/fullscreen/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/fullscreen/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/fullscreen/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/fullscreen/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/fullscreen/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/fullscreen/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/fullscreen/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/fullscreen/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/fullscreen/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/fullscreen/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/fullscreen/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/fullscreen/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/fullscreen/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/fullscreen/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/fullscreen/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/fullscreen/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/fullscreen/src/types/native.d.ts +16 -26
- package/dist/plugin/platform/index.cjs +409 -488
- package/dist/plugin/platform/index.d.ts +4 -96
- package/dist/plugin/platform/index.min.cjs +1 -1
- package/dist/plugin/platform/index.min.mjs +1 -1
- package/dist/plugin/platform/index.mjs +409 -488
- package/dist/plugin/platform/index.umd.js +409 -488
- package/dist/plugin/platform/index.umd.min.js +1 -1
- package/dist/plugin/platform/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/platform/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/platform/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/platform/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/platform/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/platform/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/platform/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/platform/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/platform/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/platform/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/platform/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/platform/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/platform/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/platform/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/platform/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/platform/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/platform/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/platform/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/platform/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/platform/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/platform/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/platform/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/platform/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/platform/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/platform/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/platform/src/types/native.d.ts +16 -26
- package/dist/plugin/theme/index.cjs +390 -461
- package/dist/plugin/theme/index.d.ts +4 -27
- package/dist/plugin/theme/index.min.cjs +1 -1
- package/dist/plugin/theme/index.min.mjs +1 -1
- package/dist/plugin/theme/index.mjs +390 -461
- package/dist/plugin/theme/index.umd.js +390 -461
- package/dist/plugin/theme/index.umd.min.js +1 -1
- package/dist/plugin/theme/src/plugin/app/constants/index.d.ts +13 -0
- package/dist/plugin/theme/src/plugin/app/cores/index.d.ts +3 -2
- package/dist/plugin/theme/src/plugin/app/index.d.ts +2 -11
- package/dist/plugin/theme/src/plugin/app/types/app.d.ts +13 -3
- package/dist/plugin/theme/src/plugin/app/types/index.d.ts +0 -15
- package/dist/plugin/theme/src/plugin/appearance/cores/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/appearance/index.d.ts +2 -7
- package/dist/plugin/theme/src/plugin/appearance/types/appearance.d.ts +6 -3
- package/dist/plugin/theme/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/plugin/theme/src/plugin/clipboard/cores/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/plugin/theme/src/plugin/clipboard/types/clipboard.d.ts +3 -1
- package/dist/plugin/theme/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/plugin/theme/src/plugin/dimension/cores/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/dimension/index.d.ts +3 -4
- package/dist/plugin/theme/src/plugin/dimension/types/dimensions.d.ts +4 -2
- package/dist/plugin/theme/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/plugin/theme/src/plugin/fullscreen/cores/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +6 -4
- package/dist/plugin/theme/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/plugin/theme/src/plugin/platform/constants/index.d.ts +6 -6
- package/dist/plugin/theme/src/plugin/platform/cores/index.d.ts +24 -6
- package/dist/plugin/theme/src/plugin/platform/index.d.ts +2 -11
- package/dist/plugin/theme/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/plugin/theme/src/plugin/platform/types/platform.d.ts +22 -14
- package/dist/plugin/theme/src/plugin/theme/cores/index.d.ts +2 -2
- package/dist/plugin/theme/src/plugin/theme/index.d.ts +2 -4
- package/dist/plugin/theme/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/plugin/theme/src/plugin/theme/types/theme.d.ts +3 -1
- package/dist/plugin/theme/src/types/native.d.ts +16 -26
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/errors/not-supported-error.d.ts +2 -0
- package/dist/src/errors/permission-not-granted-error.d.ts +2 -0
- package/dist/src/plugin/Display/constants/index.d.ts +4 -0
- package/dist/src/plugin/Display/cores/index.d.ts +3 -0
- package/dist/src/plugin/Display/index.d.ts +3 -0
- package/dist/src/plugin/Display/types/display.d.ts +13 -0
- package/dist/src/plugin/Display/types/index.d.ts +1 -0
- package/dist/src/plugin/app/constants/index.d.ts +21 -0
- package/dist/src/plugin/app/cores/index.d.ts +10 -2
- package/dist/src/plugin/app/index.d.ts +2 -11
- package/dist/src/plugin/app/types/app.d.ts +73 -3
- package/dist/src/plugin/app/types/index.d.ts +0 -15
- package/dist/src/plugin/appearance/constants/index.d.ts +1 -4
- package/dist/src/plugin/appearance/index.d.ts +2 -7
- package/dist/src/plugin/appearance/types/appearance.d.ts +5 -2
- package/dist/src/plugin/appearance/types/appearanceInstance.d.ts +9 -0
- package/dist/src/plugin/appearance/types/index.d.ts +0 -12
- package/dist/src/plugin/badge/cores/index.d.ts +3 -0
- package/dist/src/plugin/badge/index.d.ts +3 -0
- package/dist/src/plugin/badge/types/badge.d.ts +10 -0
- package/dist/src/plugin/badge/types/index.d.ts +1 -0
- package/dist/src/plugin/battery/cores/index.d.ts +3 -0
- package/dist/src/plugin/battery/index.d.ts +3 -0
- package/dist/src/plugin/battery/types/battery.d.ts +26 -0
- package/dist/src/plugin/battery/types/index.d.ts +1 -0
- package/dist/src/plugin/clipboard/index.d.ts +2 -4
- package/dist/src/plugin/clipboard/types/clipboard.d.ts +2 -0
- package/dist/src/plugin/clipboard/types/index.d.ts +0 -10
- package/dist/src/plugin/dimension/constants/index.d.ts +42 -2
- package/dist/src/plugin/dimension/index.d.ts +3 -4
- package/dist/src/plugin/dimension/types/dimensions.d.ts +24 -1
- package/dist/src/plugin/dimension/types/index.d.ts +0 -12
- package/dist/src/plugin/dimension/utils/create-env-observer.d.ts +24 -0
- package/dist/src/plugin/fullscreen/cores/index.d.ts +3 -1
- package/dist/src/plugin/fullscreen/index.d.ts +2 -4
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +11 -6
- package/dist/src/plugin/fullscreen/types/index.d.ts +0 -10
- package/dist/src/plugin/geolocation/constants/index.d.ts +2 -0
- package/dist/src/plugin/geolocation/cores/index.d.ts +3 -0
- package/dist/src/plugin/geolocation/index.d.ts +3 -0
- package/dist/src/plugin/geolocation/types/geolocation.d.ts +12 -0
- package/dist/src/plugin/geolocation/types/index.d.ts +1 -0
- package/dist/src/plugin/network/cores/index.d.ts +15 -0
- package/dist/src/plugin/network/index.d.ts +3 -0
- package/dist/src/plugin/network/types/index.d.ts +1 -0
- package/dist/src/plugin/network/types/network.d.ts +4 -0
- package/dist/src/plugin/notification/cores/index.d.ts +3 -0
- package/dist/src/plugin/notification/index.d.ts +3 -0
- package/dist/src/plugin/notification/types/index.d.ts +1 -0
- package/dist/src/plugin/notification/types/notification.d.ts +27 -0
- package/dist/src/plugin/open/constants/index.d.ts +28 -0
- package/dist/src/plugin/open/cores/index.d.ts +55 -0
- package/dist/src/plugin/open/errors/not-supported-error.d.ts +2 -0
- package/dist/src/plugin/open/errors/url-open-error.d.ts +2 -0
- package/dist/src/plugin/open/errors/user-cancel-error.d.ts +2 -0
- package/dist/src/plugin/open/index.d.ts +3 -0
- package/dist/src/plugin/open/types/index.d.ts +1 -0
- package/dist/src/plugin/open/types/open.d.ts +187 -0
- package/dist/src/plugin/permission/constants/index.d.ts +22 -0
- package/dist/src/plugin/permission/cores/index.d.ts +3 -0
- package/dist/src/plugin/permission/index.d.ts +3 -0
- package/dist/src/plugin/permission/types/index.d.ts +1 -0
- package/dist/src/plugin/permission/types/permission.d.ts +10 -0
- package/dist/src/plugin/pip/cores/index.d.ts +12 -0
- package/dist/src/plugin/pip/index.d.ts +3 -0
- package/dist/src/plugin/pip/types/index.d.ts +1 -0
- package/dist/src/plugin/pip/types/pip.d.ts +15 -0
- package/dist/src/plugin/platform/constants/index.d.ts +5 -6
- package/dist/src/plugin/platform/cores/index.d.ts +36 -5
- package/dist/src/plugin/platform/index.d.ts +2 -11
- package/dist/src/plugin/platform/types/index.d.ts +0 -10
- package/dist/src/plugin/platform/types/platform.d.ts +31 -14
- package/dist/src/plugin/pwa/cores/index.d.ts +3 -0
- package/dist/src/plugin/pwa/index.d.ts +3 -0
- package/dist/src/plugin/pwa/types/index.d.ts +1 -0
- package/dist/src/plugin/pwa/types/pwa.d.ts +8 -0
- package/dist/src/plugin/speech/cores/index.d.ts +53 -0
- package/dist/src/plugin/speech/index.d.ts +3 -0
- package/dist/src/plugin/speech/types/index.d.ts +1 -0
- package/dist/src/plugin/speech/types/speech.d.ts +9 -0
- package/dist/src/plugin/theme/index.d.ts +2 -4
- package/dist/src/plugin/theme/types/index.d.ts +0 -10
- package/dist/src/plugin/theme/types/theme.d.ts +2 -0
- package/dist/src/plugin/vibration/cores/index.d.ts +3 -0
- package/dist/src/plugin/vibration/index.d.ts +3 -0
- package/dist/src/plugin/vibration/types/index.d.ts +1 -0
- package/dist/src/plugin/vibration/types/vibration.d.ts +9 -0
- package/dist/src/types/event-listener.d.ts +35 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/listener-entry.d.ts +0 -1
- package/dist/src/types/native.d.ts +30 -26
- package/dist/src/types/subscription-manager.d.ts +4 -0
- package/dist/src/utils/create-env-observer.d.ts +8 -0
- package/dist/src/utils/create-hidden-element.d.ts +1 -1
- package/dist/src/utils/create-subscription-manager.d.ts +2 -0
- package/dist/src/utils/defer.d.ts +1 -0
- package/dist/src/utils/event-listener.d.ts +3 -0
- package/dist/src/utils/keys.d.ts +1 -0
- package/dist/src/utils/now.d.ts +1 -0
- package/dist/src/utils/pad-start.d.ts +1 -0
- package/dist/src/utils/random-string.d.ts +1 -0
- package/dist/src/utils/set-style.d.ts +3 -0
- package/package.json +1 -1
package/dist/native.cjs
CHANGED
|
@@ -1,9 +1,2351 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "1.0
|
|
3
|
+
var version = "1.1.0";
|
|
4
4
|
var packageJSON = {
|
|
5
5
|
version: version};
|
|
6
6
|
|
|
7
|
+
var FALLBACK_MEDIA_QUERY_LIST = {
|
|
8
|
+
matches: false,
|
|
9
|
+
media: 'not all',
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: function () {
|
|
12
|
+
},
|
|
13
|
+
removeListener: function () {
|
|
14
|
+
},
|
|
15
|
+
addEventListener: function () {
|
|
16
|
+
},
|
|
17
|
+
removeEventListener: function () {
|
|
18
|
+
},
|
|
19
|
+
dispatchEvent: function () {
|
|
20
|
+
return false;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var Appearances;
|
|
25
|
+
(function (Appearances) {
|
|
26
|
+
Appearances["Unknown"] = "unknown";
|
|
27
|
+
Appearances["Light"] = "light";
|
|
28
|
+
Appearances["Dark"] = "dark";
|
|
29
|
+
})(Appearances || (Appearances = {}));
|
|
30
|
+
var MEDIA_QUERY_LIST$1;
|
|
31
|
+
if (typeof globalThis.matchMedia !== 'undefined')
|
|
32
|
+
MEDIA_QUERY_LIST$1 = globalThis.matchMedia('(prefers-color-scheme: dark)');
|
|
33
|
+
else
|
|
34
|
+
MEDIA_QUERY_LIST$1 = FALLBACK_MEDIA_QUERY_LIST;
|
|
35
|
+
var CONTEXT = globalThis.document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
36
|
+
var SVG_PIXEL_DATA_URL = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wIDBoMXYxSDB6Ii8+PC9zdmc+';
|
|
37
|
+
|
|
38
|
+
function compareVersion(lhs, rhs) {
|
|
39
|
+
var pa = lhs.split('.');
|
|
40
|
+
var pb = rhs.split('.');
|
|
41
|
+
var length = Math.max(pa.length, pb.length);
|
|
42
|
+
for (var i = 0; i < length; i++) {
|
|
43
|
+
var a = void 0;
|
|
44
|
+
var b = void 0;
|
|
45
|
+
if (i < pa.length)
|
|
46
|
+
a = parseInt(pa[i], 10);
|
|
47
|
+
else
|
|
48
|
+
a = 0;
|
|
49
|
+
if (i < pb.length)
|
|
50
|
+
b = parseInt(pb[i], 10);
|
|
51
|
+
else
|
|
52
|
+
b = 0;
|
|
53
|
+
if (a > b)
|
|
54
|
+
return 1;
|
|
55
|
+
if (a < b)
|
|
56
|
+
return -1;
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function resolveWindowsVersion(string) {
|
|
62
|
+
if (typeof string === 'undefined')
|
|
63
|
+
return '';
|
|
64
|
+
var mapped = {
|
|
65
|
+
'4.90': 'ME',
|
|
66
|
+
'NT3.51': 'NT 3.11',
|
|
67
|
+
'NT4.0': 'NT 4.0',
|
|
68
|
+
'NT 5.0': '2000',
|
|
69
|
+
'NT 5.1': 'XP',
|
|
70
|
+
'NT 5.2': 'XP',
|
|
71
|
+
'NT 6.0': 'Vista',
|
|
72
|
+
'NT 6.1': '7',
|
|
73
|
+
'NT 6.2': '8',
|
|
74
|
+
'NT 6.3': '8.1',
|
|
75
|
+
'NT 6.4': '10',
|
|
76
|
+
'NT 10.0': '10',
|
|
77
|
+
'ARM': 'RT'
|
|
78
|
+
}[string];
|
|
79
|
+
if (typeof mapped !== 'undefined')
|
|
80
|
+
return mapped;
|
|
81
|
+
return string;
|
|
82
|
+
}
|
|
83
|
+
function resolveUnderscoreVersion(string) {
|
|
84
|
+
if (typeof string === 'undefined')
|
|
85
|
+
return '';
|
|
86
|
+
return string.replace(/_/g, '.');
|
|
87
|
+
}
|
|
88
|
+
var OS;
|
|
89
|
+
(function (OS) {
|
|
90
|
+
OS["Unknown"] = "Unknown";
|
|
91
|
+
OS["Android"] = "Android";
|
|
92
|
+
OS["iOS"] = "iOS";
|
|
93
|
+
OS["Windows"] = "Windows";
|
|
94
|
+
OS["MacOS"] = "MacOS";
|
|
95
|
+
})(OS || (OS = {}));
|
|
96
|
+
var Devices;
|
|
97
|
+
(function (Devices) {
|
|
98
|
+
Devices["Unknown"] = "Unknown";
|
|
99
|
+
Devices["Mobile"] = "Mobile";
|
|
100
|
+
Devices["Desktop"] = "Desktop";
|
|
101
|
+
})(Devices || (Devices = {}));
|
|
102
|
+
var Engines;
|
|
103
|
+
(function (Engines) {
|
|
104
|
+
Engines["Unknown"] = "Unknown";
|
|
105
|
+
Engines["EdgeHTML"] = "EdgeHTML";
|
|
106
|
+
Engines["ArkWeb"] = "ArkWeb";
|
|
107
|
+
Engines["Blink"] = "Blink";
|
|
108
|
+
Engines["Presto"] = "Presto";
|
|
109
|
+
Engines["WebKit"] = "WebKit";
|
|
110
|
+
Engines["Trident"] = "Trident";
|
|
111
|
+
Engines["NetFront"] = "NetFront";
|
|
112
|
+
Engines["KHTML"] = "KHTML";
|
|
113
|
+
Engines["Tasman"] = "Tasman";
|
|
114
|
+
Engines["Gecko"] = "Gecko";
|
|
115
|
+
})(Engines || (Engines = {}));
|
|
116
|
+
var Browsers;
|
|
117
|
+
(function (Browsers) {
|
|
118
|
+
Browsers["Unknown"] = "Unknown";
|
|
119
|
+
Browsers["Chrome"] = "Chrome";
|
|
120
|
+
Browsers["Safari"] = "Safari";
|
|
121
|
+
Browsers["Edge"] = "Edge";
|
|
122
|
+
Browsers["Firefox"] = "Firefox";
|
|
123
|
+
Browsers["Opera"] = "Opera";
|
|
124
|
+
Browsers["IE"] = "IE";
|
|
125
|
+
Browsers["SamsungInternet"] = "SamsungInternet";
|
|
126
|
+
})(Browsers || (Browsers = {}));
|
|
127
|
+
var USER_AGENT = (function () {
|
|
128
|
+
if (typeof globalThis.navigator.userAgent !== 'undefined')
|
|
129
|
+
return globalThis.navigator.userAgent;
|
|
130
|
+
return '';
|
|
131
|
+
})();
|
|
132
|
+
var HIGH_ENTROPY_BRAND_NAME_MAP = {
|
|
133
|
+
'Google Chrome': 'Chrome',
|
|
134
|
+
'Microsoft Edge': 'Edge',
|
|
135
|
+
'Microsoft Edge WebView2': 'Edge WebView2',
|
|
136
|
+
'Android WebView': 'Chrome WebView',
|
|
137
|
+
'HeadlessChrome': 'Chrome Headless',
|
|
138
|
+
'OperaMobile': 'Opera Mobi',
|
|
139
|
+
};
|
|
140
|
+
var RTL_LANGUAGES = ['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'iw', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'];
|
|
141
|
+
var OS_RESOLVER_MAP = [
|
|
142
|
+
[/windows nt (6\.[23]); arm/i, OS.Windows, resolveWindowsVersion],
|
|
143
|
+
[/windows (?:phone|mobile|iot)(?: os)?[\/ ]?([\d.]*( se)?)/i, OS.Windows, resolveWindowsVersion],
|
|
144
|
+
[/windows[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i, OS.Windows, resolveWindowsVersion],
|
|
145
|
+
[/windows nt ?([\d.)]*)(?!.+xbox)/i, OS.Windows, resolveWindowsVersion],
|
|
146
|
+
[/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d.;]*)/i, OS.Windows, resolveWindowsVersion],
|
|
147
|
+
[/windows ce\/?([\d.]*)/i, OS.Windows, resolveWindowsVersion],
|
|
148
|
+
[/[adehimnop]{4,7}\b(?:.*os (\w+) like mac|; opera)/i, OS.iOS, resolveUnderscoreVersion],
|
|
149
|
+
[/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w.]+)/i, OS.iOS, resolveUnderscoreVersion],
|
|
150
|
+
[/cfnetwork\/.+darwin/i, OS.iOS, resolveUnderscoreVersion],
|
|
151
|
+
[/mac os x ?([\w. ]*)/i, OS.MacOS, resolveUnderscoreVersion],
|
|
152
|
+
[/(?:macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i, OS.MacOS, resolveUnderscoreVersion],
|
|
153
|
+
[/droid ([\w.]+)\b.+(android[- ]x86)/i, OS.Android],
|
|
154
|
+
[/android\w*[-\/.; ]?([\d.]*)/i, OS.Android],
|
|
155
|
+
];
|
|
156
|
+
var ENGINE_RESOLVER_MAP = [
|
|
157
|
+
[/windows.+ edge\/([\w.]+)/i, Engines.EdgeHTML],
|
|
158
|
+
[/arkweb\/([\w.]+)/i, Engines.ArkWeb],
|
|
159
|
+
[/webkit\/537\.36.+chrome\/(?!27)([\w.]+)/i, Engines.Blink],
|
|
160
|
+
[/presto\/([\w.]+)/i, Engines.Presto],
|
|
161
|
+
[/webkit\/([\w.]+)/i, Engines.WebKit],
|
|
162
|
+
[/trident\/([\w.]+)/i, Engines.Trident],
|
|
163
|
+
[/netfront\/([\w.]+)/i, Engines.NetFront],
|
|
164
|
+
[/khtml[\/ ]\(?([\w.]+)/i, Engines.KHTML],
|
|
165
|
+
[/tasman[\/ ]\(?([\w.]+)/i, Engines.Tasman],
|
|
166
|
+
[/rv:([\w.]{1,9})\b.+gecko/i, Engines.Gecko]
|
|
167
|
+
];
|
|
168
|
+
var BROWSER_RESOLVER_MAP = [
|
|
169
|
+
[/\b(?:crmo|crios)\/([\w.]+)/i, Browsers.Chrome],
|
|
170
|
+
[/webview.+edge\/([\w.]+)/i, Browsers.Edge],
|
|
171
|
+
[/edg(?:e|ios|a)?\/([\w.]+)/i, Browsers.Edge],
|
|
172
|
+
[/opera mini\/([-\w.]+)/i, Browsers.Opera],
|
|
173
|
+
[/opera [mobileta]{3,6}\b.+version\/([-\w.]+)/i, Browsers.Opera],
|
|
174
|
+
[/opera(?:.+version\/|[\/ ]+)([\w.]+)/i, Browsers.Opera],
|
|
175
|
+
[/opios[\/ ]+([\w.]+)/i, Browsers.Opera],
|
|
176
|
+
[/\bop(?:rg)?x\/([\w.]+)/i, Browsers.Opera],
|
|
177
|
+
[/\bopr\/([\w.]+)/i, Browsers.Opera],
|
|
178
|
+
[/iemobile(?:browser|boat|jet)[\/ ]?([\d.]*)/i, Browsers.IE],
|
|
179
|
+
[/(?:ms|\()ie ([\w.]+)/i, Browsers.IE],
|
|
180
|
+
[/trident.+rv[: ]([\w.]{1,9})\b.+like gecko/i, Browsers.IE],
|
|
181
|
+
[/\bfocus\/([\w.]+)/i, Browsers.Firefox],
|
|
182
|
+
[/\bopt\/([\w.]+)/i, Browsers.Opera],
|
|
183
|
+
[/coast\/([\w.]+)/i, Browsers.Opera],
|
|
184
|
+
[/fxios\/([\w.-]+)/i, Browsers.Firefox],
|
|
185
|
+
[/samsungbrowser\/([\w.]+)/i, Browsers.SamsungInternet],
|
|
186
|
+
[/headlesschrome(?:\/([\w.]+)| )/i, Browsers.Chrome],
|
|
187
|
+
[/wv\).+chrome\/([\w.]+).+edgw\//i, Browsers.Edge],
|
|
188
|
+
[/ wv\).+(chrome)\/([\w.]+)/i, Browsers.Chrome],
|
|
189
|
+
[/chrome\/([\w.]+) mobile/i, Browsers.Chrome],
|
|
190
|
+
[/chrome\/v?([\w.]+)/i, Browsers.Chrome],
|
|
191
|
+
[/version\/([\w.,]+) .*mobile(?:\/\w+ | ?)safari/i, Browsers.Safari],
|
|
192
|
+
[/iphone .*mobile(?:\/\w+ | ?)safari/i, Browsers.Safari],
|
|
193
|
+
[/version\/([\w.,]+) .*safari/i, Browsers.Safari],
|
|
194
|
+
[/webkit.+?(?:mobile ?safari|safari)(\/[\w.]+)/i, Browsers.Safari, '1'],
|
|
195
|
+
[/(?:mobile|tablet);.*firefox\/([\w.-]+)/i, Browsers.Firefox],
|
|
196
|
+
[/mobile vr; rv:([\w.]+)\).+firefox/i, Browsers.Firefox],
|
|
197
|
+
[/firefox\/([\w.]+)/i, Browsers.Firefox],
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
var userAgent = USER_AGENT;
|
|
201
|
+
var Platform = {
|
|
202
|
+
get os() {
|
|
203
|
+
return getOS();
|
|
204
|
+
},
|
|
205
|
+
get engine() {
|
|
206
|
+
return getEngine();
|
|
207
|
+
},
|
|
208
|
+
get browser() {
|
|
209
|
+
return getBrowser();
|
|
210
|
+
},
|
|
211
|
+
get userAgent() {
|
|
212
|
+
return userAgent;
|
|
213
|
+
},
|
|
214
|
+
set userAgent(value) {
|
|
215
|
+
userAgent = value;
|
|
216
|
+
},
|
|
217
|
+
get locale() {
|
|
218
|
+
return getLocale();
|
|
219
|
+
},
|
|
220
|
+
get device() {
|
|
221
|
+
return getDevice();
|
|
222
|
+
},
|
|
223
|
+
get gpu() {
|
|
224
|
+
return getGPU();
|
|
225
|
+
},
|
|
226
|
+
get isWebview() {
|
|
227
|
+
return getIsWebview();
|
|
228
|
+
},
|
|
229
|
+
get isNode() {
|
|
230
|
+
return getIsNode();
|
|
231
|
+
},
|
|
232
|
+
get isStandalone() {
|
|
233
|
+
return getIsStandalone();
|
|
234
|
+
},
|
|
235
|
+
Constants: {
|
|
236
|
+
OS: OS,
|
|
237
|
+
Engines: Engines,
|
|
238
|
+
Browsers: Browsers,
|
|
239
|
+
Devices: Devices,
|
|
240
|
+
},
|
|
241
|
+
Errors: {},
|
|
242
|
+
};
|
|
243
|
+
var parsedFromHighEntropyValuesOS = {};
|
|
244
|
+
var parsedFromHighEntropyValuesBrowser = {};
|
|
245
|
+
var parsedFromHighEntropyValuesEngine = {};
|
|
246
|
+
var parsedFromHighEntropyValuesDevice = null;
|
|
247
|
+
var parsedFromNavigatorGPU = {};
|
|
248
|
+
function resolveVersion(string, resolver) {
|
|
249
|
+
if (typeof resolver === 'function')
|
|
250
|
+
return resolver(string);
|
|
251
|
+
if (typeof resolver === 'string')
|
|
252
|
+
return resolver;
|
|
253
|
+
if (typeof string === 'undefined')
|
|
254
|
+
return '';
|
|
255
|
+
return string;
|
|
256
|
+
}
|
|
257
|
+
function normalizeBrand(entry) {
|
|
258
|
+
if (entry === null || typeof entry === 'undefined')
|
|
259
|
+
return { brand: '', version: '' };
|
|
260
|
+
if (typeof entry === 'string')
|
|
261
|
+
return { brand: entry, version: '' };
|
|
262
|
+
return { brand: entry.brand, version: entry.version };
|
|
263
|
+
}
|
|
264
|
+
function normalizeLocale(locale) {
|
|
265
|
+
if (locale === null || typeof locale === 'undefined')
|
|
266
|
+
return locale;
|
|
267
|
+
if (locale.length === 0)
|
|
268
|
+
return null;
|
|
269
|
+
locale = locale.replace(/_/g, '-');
|
|
270
|
+
if (locale === 'C' || locale.toLowerCase() === 'posix')
|
|
271
|
+
return 'en-US';
|
|
272
|
+
if (locale.indexOf('.') !== -1)
|
|
273
|
+
return normalizeLocale(locale.split('.')[0]);
|
|
274
|
+
if (locale.indexOf('@') !== -1)
|
|
275
|
+
return normalizeLocale(locale.split('@')[0]);
|
|
276
|
+
var parts = locale.split('-');
|
|
277
|
+
if (parts.length === 0)
|
|
278
|
+
return null;
|
|
279
|
+
parts[0] = parts[0].toLowerCase();
|
|
280
|
+
if (parts.length > 1 && parts[1].length === 2)
|
|
281
|
+
parts[1] = parts[1].toUpperCase();
|
|
282
|
+
if (parts.length > 2 && parts[1].length === 4)
|
|
283
|
+
parts[1] = parts[1].charAt(0).toUpperCase() + parts[1].slice(1).toLowerCase();
|
|
284
|
+
return parts.join('-');
|
|
285
|
+
}
|
|
286
|
+
function getWebGLRenderer() {
|
|
287
|
+
var canvas = globalThis.document.createElement('canvas');
|
|
288
|
+
if (typeof canvas.getContext !== 'function')
|
|
289
|
+
return '';
|
|
290
|
+
var context = (function () {
|
|
291
|
+
var ctx1 = canvas.getContext('webgl2');
|
|
292
|
+
if (ctx1 !== null)
|
|
293
|
+
return ctx1;
|
|
294
|
+
var ctx2 = canvas.getContext('experimental-webgl');
|
|
295
|
+
if (ctx2 !== null)
|
|
296
|
+
return ctx2;
|
|
297
|
+
var ctx3 = canvas.getContext('webgl');
|
|
298
|
+
if (ctx3 !== null)
|
|
299
|
+
return ctx3;
|
|
300
|
+
return null;
|
|
301
|
+
})();
|
|
302
|
+
if (context === null)
|
|
303
|
+
return '';
|
|
304
|
+
if (typeof context.getExtension !== 'undefined' && typeof context.getParameter !== 'undefined') {
|
|
305
|
+
var extension = context.getExtension('WEBGL_debug_renderer_info');
|
|
306
|
+
if (extension === null)
|
|
307
|
+
return context.getParameter(context.RENDERER);
|
|
308
|
+
else
|
|
309
|
+
return context.getParameter(extension.UNMASKED_RENDERER_WEBGL);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
return '';
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function getGPU() {
|
|
316
|
+
return {
|
|
317
|
+
architecture: parsedFromNavigatorGPU.architecture,
|
|
318
|
+
description: parsedFromNavigatorGPU.description,
|
|
319
|
+
device: parsedFromNavigatorGPU.device,
|
|
320
|
+
vendor: parsedFromNavigatorGPU.vendor,
|
|
321
|
+
webglRenderer: getWebGLRenderer(),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function getLocale() {
|
|
325
|
+
var locale = {
|
|
326
|
+
language: null,
|
|
327
|
+
languages: [],
|
|
328
|
+
timezone: null,
|
|
329
|
+
offset: 0,
|
|
330
|
+
isRTL: false,
|
|
331
|
+
};
|
|
332
|
+
var isRTL = null;
|
|
333
|
+
function addLanguages(language) {
|
|
334
|
+
for (var i = 0; i < language.length; i++)
|
|
335
|
+
addLanguage(language[i]);
|
|
336
|
+
}
|
|
337
|
+
function addLanguage(language) {
|
|
338
|
+
language = normalizeLocale(language);
|
|
339
|
+
if (typeof language === "string" && locale.languages.indexOf(language) === -1) {
|
|
340
|
+
if (locale.language === null)
|
|
341
|
+
locale.language = language;
|
|
342
|
+
locale.languages.push(language);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (typeof Intl !== 'undefined') {
|
|
346
|
+
try {
|
|
347
|
+
addLanguage(Intl.DateTimeFormat().resolvedOptions().locale);
|
|
348
|
+
}
|
|
349
|
+
catch (_) {
|
|
350
|
+
}
|
|
351
|
+
try {
|
|
352
|
+
locale.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
353
|
+
}
|
|
354
|
+
catch (_) {
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (typeof globalThis.navigator !== 'undefined') {
|
|
358
|
+
if (typeof globalThis.navigator.languages !== 'undefined')
|
|
359
|
+
addLanguages(globalThis.navigator.languages);
|
|
360
|
+
if (typeof globalThis.navigator.language !== 'undefined')
|
|
361
|
+
addLanguage(globalThis.navigator.language);
|
|
362
|
+
if (typeof globalThis.navigator.userLanguage !== 'undefined')
|
|
363
|
+
addLanguage(globalThis.navigator.userLanguage);
|
|
364
|
+
if (typeof globalThis.navigator.browserLanguage !== 'undefined')
|
|
365
|
+
addLanguage(globalThis.navigator.browserLanguage);
|
|
366
|
+
if (typeof globalThis.navigator.systemLanguage !== 'undefined')
|
|
367
|
+
addLanguage(globalThis.navigator.systemLanguage);
|
|
368
|
+
}
|
|
369
|
+
try {
|
|
370
|
+
locale.offset = new Date().getTimezoneOffset() * -1;
|
|
371
|
+
}
|
|
372
|
+
catch (_) {
|
|
373
|
+
}
|
|
374
|
+
if (typeof locale.language === 'string') {
|
|
375
|
+
if (typeof Intl !== 'undefined' && typeof Intl.Locale !== 'undefined') {
|
|
376
|
+
try {
|
|
377
|
+
var intlLocale = new Intl.Locale(locale.language);
|
|
378
|
+
if (typeof intlLocale.getTextInfo === 'function')
|
|
379
|
+
isRTL = intlLocale.getTextInfo().direction === 'rtl';
|
|
380
|
+
else if (typeof intlLocale.textInfo !== 'undefined')
|
|
381
|
+
isRTL = intlLocale.textInfo.direction === 'rtl';
|
|
382
|
+
}
|
|
383
|
+
catch (_) {
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (typeof isRTL !== 'boolean') {
|
|
387
|
+
var matched = /^([A-Za-z]{1,8})(?:[-_][A-Za-z0-9]{1,8})*$/.exec(locale.language);
|
|
388
|
+
if (matched !== null) {
|
|
389
|
+
var language = matched[1].toLowerCase();
|
|
390
|
+
for (var i = 0; i < RTL_LANGUAGES.length; i++) {
|
|
391
|
+
if (RTL_LANGUAGES[i] === language) {
|
|
392
|
+
isRTL = true;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (typeof isRTL === 'boolean')
|
|
400
|
+
locale.isRTL = isRTL;
|
|
401
|
+
return locale;
|
|
402
|
+
}
|
|
403
|
+
function getOS() {
|
|
404
|
+
var result = { name: OS.Unknown, version: '' };
|
|
405
|
+
for (var i = 0; i < OS_RESOLVER_MAP.length; i++) {
|
|
406
|
+
var map = OS_RESOLVER_MAP[i];
|
|
407
|
+
var regexp = map[0];
|
|
408
|
+
var os = map[1];
|
|
409
|
+
var resolver = map[2];
|
|
410
|
+
var matched = Platform.userAgent.match(regexp);
|
|
411
|
+
if (matched !== null) {
|
|
412
|
+
result.name = os;
|
|
413
|
+
result.version = resolveVersion(matched[1], resolver);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (result.name === OS.iOS && compareVersion(result.version, '18.6') === 0) {
|
|
418
|
+
var version = /\) Version\/([\d.]+)/.exec(Platform.userAgent);
|
|
419
|
+
if (version !== null && parseInt(version[1].substring(0, 2), 10) >= 26)
|
|
420
|
+
result.version = version[1];
|
|
421
|
+
}
|
|
422
|
+
if (Platform.userAgent === USER_AGENT) {
|
|
423
|
+
if (typeof parsedFromHighEntropyValuesOS.name !== 'undefined')
|
|
424
|
+
result.name = parsedFromHighEntropyValuesOS.name;
|
|
425
|
+
if (typeof parsedFromHighEntropyValuesOS.version !== 'undefined')
|
|
426
|
+
result.version = parsedFromHighEntropyValuesOS.version;
|
|
427
|
+
if (result.name === OS.MacOS && typeof globalThis.navigator.standalone !== 'undefined' && globalThis.navigator.maxTouchPoints > 2)
|
|
428
|
+
result.name = OS.iOS;
|
|
429
|
+
}
|
|
430
|
+
return result;
|
|
431
|
+
}
|
|
432
|
+
function getEngine() {
|
|
433
|
+
var result = { name: Engines.Unknown, version: '' };
|
|
434
|
+
for (var i = 0; i < ENGINE_RESOLVER_MAP.length; i++) {
|
|
435
|
+
var map = ENGINE_RESOLVER_MAP[i];
|
|
436
|
+
var regexp = map[0];
|
|
437
|
+
var engine = map[1];
|
|
438
|
+
var resolver = map[2];
|
|
439
|
+
var matched = Platform.userAgent.match(regexp);
|
|
440
|
+
if (matched !== null) {
|
|
441
|
+
result.name = engine;
|
|
442
|
+
result.version = resolveVersion(matched[1], resolver);
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (Platform.userAgent === USER_AGENT) {
|
|
447
|
+
if (typeof parsedFromHighEntropyValuesEngine.name !== 'undefined')
|
|
448
|
+
result.name = parsedFromHighEntropyValuesEngine.name;
|
|
449
|
+
if (typeof parsedFromHighEntropyValuesEngine.version !== 'undefined')
|
|
450
|
+
result.version = parsedFromHighEntropyValuesEngine.version;
|
|
451
|
+
}
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
function getBrowser() {
|
|
455
|
+
var result = { name: Browsers.Unknown, version: '' };
|
|
456
|
+
for (var i = 0; i < BROWSER_RESOLVER_MAP.length; i++) {
|
|
457
|
+
var map = BROWSER_RESOLVER_MAP[i];
|
|
458
|
+
var regexp = map[0];
|
|
459
|
+
var browser = map[1];
|
|
460
|
+
var resolver = map[2];
|
|
461
|
+
var matched = Platform.userAgent.match(regexp);
|
|
462
|
+
if (matched !== null) {
|
|
463
|
+
result.name = browser;
|
|
464
|
+
result.version = resolveVersion(matched[1], resolver);
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (Platform.userAgent === USER_AGENT) {
|
|
469
|
+
if (typeof parsedFromHighEntropyValuesBrowser.name !== 'undefined')
|
|
470
|
+
result.name = parsedFromHighEntropyValuesBrowser.name;
|
|
471
|
+
if (typeof parsedFromHighEntropyValuesBrowser.version !== 'undefined')
|
|
472
|
+
result.version = parsedFromHighEntropyValuesBrowser.version;
|
|
473
|
+
}
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
function getDevice() {
|
|
477
|
+
if (Platform.userAgent === USER_AGENT && parsedFromHighEntropyValuesDevice !== null)
|
|
478
|
+
return parsedFromHighEntropyValuesDevice;
|
|
479
|
+
if (Platform.os.name === OS.iOS || Platform.os.name === OS.Android)
|
|
480
|
+
return Devices.Mobile;
|
|
481
|
+
if (Platform.os.name === OS.Windows || Platform.os.name === OS.MacOS)
|
|
482
|
+
return Devices.Desktop;
|
|
483
|
+
return Devices.Unknown;
|
|
484
|
+
}
|
|
485
|
+
function getIsWebview() {
|
|
486
|
+
return /; ?wv|applewebkit(?!.*safari)/i.test(Platform.userAgent);
|
|
487
|
+
}
|
|
488
|
+
function getIsNode() {
|
|
489
|
+
return typeof globalThis.process !== 'undefined' && typeof globalThis.process.versions !== 'undefined' && typeof globalThis.process.versions.node !== 'undefined';
|
|
490
|
+
}
|
|
491
|
+
function getIsStandalone() {
|
|
492
|
+
if (Platform.os.name === OS.iOS)
|
|
493
|
+
return typeof globalThis.navigator.standalone !== 'undefined' && globalThis.navigator.standalone;
|
|
494
|
+
if (typeof globalThis.matchMedia === 'undefined')
|
|
495
|
+
return false;
|
|
496
|
+
return globalThis.matchMedia('(display-mode: standalone)').matches;
|
|
497
|
+
}
|
|
498
|
+
function parseFromHighEntropyValues() {
|
|
499
|
+
if (typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.userAgentData !== 'undefined' && typeof globalThis.navigator.userAgentData.getHighEntropyValues !== 'undefined') {
|
|
500
|
+
globalThis.navigator.userAgentData.getHighEntropyValues(['brands', 'fullVersionList', 'mobile', 'model', 'platform', 'platformVersion', 'architecture', 'formFactors', 'bitness', 'uaFullVersion', 'wow64'])
|
|
501
|
+
.then(function (result) {
|
|
502
|
+
try {
|
|
503
|
+
var brands = result.fullVersionList || result.brands || [];
|
|
504
|
+
var platformVersion = result.platformVersion;
|
|
505
|
+
var platform = result.platform;
|
|
506
|
+
var browserName = Platform.browser.name;
|
|
507
|
+
var prevBrandName = null;
|
|
508
|
+
for (var i = 0; i < brands.length; i++) {
|
|
509
|
+
var brand = normalizeBrand(brands[i]);
|
|
510
|
+
var brandVersion = brand.version;
|
|
511
|
+
var brandName = brand.brand;
|
|
512
|
+
if (/not.a.brand/i.test(brandName))
|
|
513
|
+
continue;
|
|
514
|
+
if (prevBrandName === null || (/Chrom/.test(prevBrandName) && brandName !== 'Chromium') || (prevBrandName === 'Edge' && /WebView2/.test(brandName))) {
|
|
515
|
+
brandName = HIGH_ENTROPY_BRAND_NAME_MAP[brandName] || brandName;
|
|
516
|
+
prevBrandName = browserName;
|
|
517
|
+
if (prevBrandName === null || /Chrom/.test(prevBrandName) || !/Chrom/.test(brandName)) {
|
|
518
|
+
browserName = brandName;
|
|
519
|
+
if (browserName === 'Chrome' || browserName === 'Chrome WebView' || browserName === 'Chrome Headless')
|
|
520
|
+
parsedFromHighEntropyValuesBrowser.name = Browsers.Chrome;
|
|
521
|
+
else if (browserName === 'Edge' || browserName === 'Edge WebView2')
|
|
522
|
+
parsedFromHighEntropyValuesBrowser.name = Browsers.Edge;
|
|
523
|
+
else if (browserName === 'Opera Mobi')
|
|
524
|
+
parsedFromHighEntropyValuesBrowser.name = Browsers.Opera;
|
|
525
|
+
parsedFromHighEntropyValuesBrowser.version = brandVersion;
|
|
526
|
+
}
|
|
527
|
+
prevBrandName = brandName;
|
|
528
|
+
}
|
|
529
|
+
if (brandName === 'Chromium')
|
|
530
|
+
parsedFromHighEntropyValuesEngine.version = brandVersion;
|
|
531
|
+
}
|
|
532
|
+
if (typeof platformVersion === 'string') {
|
|
533
|
+
if (Platform.os.name === OS.Windows) {
|
|
534
|
+
if (parseInt(platformVersion.split('.')[0], 10) >= 13)
|
|
535
|
+
parsedFromHighEntropyValuesOS.version = '11';
|
|
536
|
+
else
|
|
537
|
+
parsedFromHighEntropyValuesOS.version = '10';
|
|
538
|
+
}
|
|
539
|
+
else
|
|
540
|
+
parsedFromHighEntropyValuesOS.version = platformVersion;
|
|
541
|
+
}
|
|
542
|
+
if (typeof platform === 'string') {
|
|
543
|
+
if (/android/i.test(platform))
|
|
544
|
+
parsedFromHighEntropyValuesOS.name = OS.Android;
|
|
545
|
+
else if (/ios|iphone|ipad/i.test(platform))
|
|
546
|
+
parsedFromHighEntropyValuesOS.name = OS.iOS;
|
|
547
|
+
else if (/windows|win32/i.test(platform))
|
|
548
|
+
parsedFromHighEntropyValuesOS.name = OS.Windows;
|
|
549
|
+
else if (/macos|macintel/i.test(platform))
|
|
550
|
+
parsedFromHighEntropyValuesOS.name = OS.MacOS;
|
|
551
|
+
}
|
|
552
|
+
if (result.mobile === true)
|
|
553
|
+
parsedFromHighEntropyValuesDevice = Devices.Mobile;
|
|
554
|
+
}
|
|
555
|
+
catch (_) {
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function parseFromNavigatorGPU() {
|
|
561
|
+
if (typeof globalThis.navigator !== 'undefined' && typeof globalThis.navigator.gpu !== 'undefined') {
|
|
562
|
+
globalThis.navigator.gpu.requestAdapter()
|
|
563
|
+
.then(function (adapter) {
|
|
564
|
+
if (adapter !== null) {
|
|
565
|
+
var info = adapter.info;
|
|
566
|
+
parsedFromNavigatorGPU.architecture = info.architecture;
|
|
567
|
+
parsedFromNavigatorGPU.description = info.description;
|
|
568
|
+
parsedFromNavigatorGPU.device = info.device;
|
|
569
|
+
parsedFromNavigatorGPU.vendor = info.vendor;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
parseFromHighEntropyValues();
|
|
575
|
+
parseFromNavigatorGPU();
|
|
576
|
+
|
|
577
|
+
var IE_WRAPPER_STORE = [];
|
|
578
|
+
var MEDIA_QUERY_LIST_WRAPPER_STORE = [];
|
|
579
|
+
function isEventListenerCallback(callback) {
|
|
580
|
+
return (typeof callback === 'function' ||
|
|
581
|
+
(typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function'));
|
|
582
|
+
}
|
|
583
|
+
function isMediaQueryListTarget(target) {
|
|
584
|
+
return typeof target.media === 'string' && typeof target.matches === 'boolean';
|
|
585
|
+
}
|
|
586
|
+
function findIEWrapper(target, type, callback) {
|
|
587
|
+
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
588
|
+
var wrapper = IE_WRAPPER_STORE[i];
|
|
589
|
+
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
|
|
590
|
+
return wrapper.wrapper;
|
|
591
|
+
}
|
|
592
|
+
return undefined;
|
|
593
|
+
}
|
|
594
|
+
function setIEWrapper(target, type, callback, wrapper) {
|
|
595
|
+
IE_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
|
|
596
|
+
}
|
|
597
|
+
function removeIEWrapper(target, type, callback) {
|
|
598
|
+
for (var i = 0; i < IE_WRAPPER_STORE.length; i++) {
|
|
599
|
+
var wrapper = IE_WRAPPER_STORE[i];
|
|
600
|
+
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
|
|
601
|
+
IE_WRAPPER_STORE.splice(i, 1);
|
|
602
|
+
return wrapper.wrapper;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return undefined;
|
|
606
|
+
}
|
|
607
|
+
function findMediaQueryListWrapper(target, type, callback) {
|
|
608
|
+
for (var i = 0; i < MEDIA_QUERY_LIST_WRAPPER_STORE.length; i++) {
|
|
609
|
+
var wrapper = MEDIA_QUERY_LIST_WRAPPER_STORE[i];
|
|
610
|
+
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback)
|
|
611
|
+
return wrapper.wrapper;
|
|
612
|
+
}
|
|
613
|
+
return undefined;
|
|
614
|
+
}
|
|
615
|
+
function setMediaQueryListWrapper(target, type, callback, wrapper) {
|
|
616
|
+
MEDIA_QUERY_LIST_WRAPPER_STORE.push({ target: target, type: type, callback: callback, wrapper: wrapper });
|
|
617
|
+
}
|
|
618
|
+
function removeMediaQueryListWrapper(target, type, callback) {
|
|
619
|
+
for (var i = 0; i < MEDIA_QUERY_LIST_WRAPPER_STORE.length; i++) {
|
|
620
|
+
var wrapper = MEDIA_QUERY_LIST_WRAPPER_STORE[i];
|
|
621
|
+
if (wrapper.target === target && wrapper.type === type && wrapper.callback === callback) {
|
|
622
|
+
MEDIA_QUERY_LIST_WRAPPER_STORE.splice(i, 1);
|
|
623
|
+
return wrapper.wrapper;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return undefined;
|
|
627
|
+
}
|
|
628
|
+
function createMediaQueryListWrapper(callback) {
|
|
629
|
+
return function (event) {
|
|
630
|
+
if (typeof callback === 'function') {
|
|
631
|
+
callback.call(this, event);
|
|
632
|
+
}
|
|
633
|
+
else if (callback && typeof callback.handleEvent === 'function') {
|
|
634
|
+
callback.handleEvent(event);
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
function capitalize(_) {
|
|
639
|
+
var groups = [];
|
|
640
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
641
|
+
groups[_i - 1] = arguments[_i];
|
|
642
|
+
}
|
|
643
|
+
var result = '';
|
|
644
|
+
for (var i = 0; i < groups.length - 2; i++) {
|
|
645
|
+
var arg = groups[i];
|
|
646
|
+
if (typeof arg !== 'undefined')
|
|
647
|
+
result = result + arg.charAt(0).toUpperCase() + arg.slice(1);
|
|
648
|
+
}
|
|
649
|
+
return result;
|
|
650
|
+
}
|
|
651
|
+
function withVendor(target, type) {
|
|
652
|
+
if (target === globalThis.document && ['deviceready', 'pause', 'resume', 'backbutton', 'menubutton', 'searchbutton', 'startcallbutton', 'endcallbutton', 'volumedownbutton', 'volumeupbutton', 'activated', 'cordovacallbackerror'].indexOf(type) > -1)
|
|
653
|
+
return type;
|
|
654
|
+
if (typeof target.webkitEnterFullscreen === 'function' && ['webkitbeginfullscreen', 'webkitendfullscreen', 'webkitpresentationmodechanged'].indexOf(type) > -1)
|
|
655
|
+
return type;
|
|
656
|
+
var types;
|
|
657
|
+
if (typeof LEGACY_TYPE_MAP[type] !== 'undefined')
|
|
658
|
+
types = LEGACY_TYPE_MAP[type];
|
|
659
|
+
else if (EVENT_TYPE_REGEXP.test(type))
|
|
660
|
+
types = [type, type.replace(EVENT_TYPE_REGEXP, capitalize)];
|
|
661
|
+
else
|
|
662
|
+
types = [type];
|
|
663
|
+
for (var i = 0; i < VENDORS.length; i++) {
|
|
664
|
+
for (var j = 0; j < types.length; j++) {
|
|
665
|
+
var name_1 = VENDORS[i] + types[j];
|
|
666
|
+
if (typeof target['on' + name_1] !== 'undefined')
|
|
667
|
+
return name_1;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return type;
|
|
671
|
+
}
|
|
672
|
+
function preventDefaultPolyfill() {
|
|
673
|
+
this.returnValue = false;
|
|
674
|
+
}
|
|
675
|
+
function stopPropagationPolyfill() {
|
|
676
|
+
this.cancelBubble = true;
|
|
677
|
+
}
|
|
678
|
+
var EVENT_TYPE_REGEXP = /(animation)(start|iteration|end|cancel)|(transition)(start|run|end|cancel)|(fullscreen)(change|error)|(lost|got)(pointer)(capture)|(pointer)(lock)(change|error)|(pointer)(cancel|down|enter|leave|move|out|over|up)/i;
|
|
679
|
+
var VENDORS = ['', 'webkit', 'moz', 'ms', 'MS', 'o', 'O'];
|
|
680
|
+
var LEGACY_TYPE_MAP = {
|
|
681
|
+
'wheel': ['wheel', 'mousewheel', 'DOMMouseScroll'],
|
|
682
|
+
'focus': ['focus', 'focusin'],
|
|
683
|
+
'blur': ['blur', 'focusout'],
|
|
684
|
+
'beforeinput': ['beforeinput', 'textInput'],
|
|
685
|
+
};
|
|
686
|
+
var EventListener = {
|
|
687
|
+
useStd: typeof globalThis.document.addEventListener === 'function',
|
|
688
|
+
add: function (target, eventListenerOptions) {
|
|
689
|
+
if (typeof eventListenerOptions.type === 'undefined')
|
|
690
|
+
return;
|
|
691
|
+
if (typeof target === 'undefined')
|
|
692
|
+
return;
|
|
693
|
+
var callback = eventListenerOptions.callback;
|
|
694
|
+
var type = withVendor(target, eventListenerOptions.type);
|
|
695
|
+
var options = eventListenerOptions.options;
|
|
696
|
+
if (isMediaQueryListTarget(target)) {
|
|
697
|
+
if (typeof target.addListener === 'function') {
|
|
698
|
+
try {
|
|
699
|
+
var wrapper = findMediaQueryListWrapper(target, type, callback);
|
|
700
|
+
if (typeof wrapper === 'undefined') {
|
|
701
|
+
setMediaQueryListWrapper(target, type, callback, wrapper = createMediaQueryListWrapper(callback));
|
|
702
|
+
}
|
|
703
|
+
return target.addListener(wrapper);
|
|
704
|
+
}
|
|
705
|
+
catch (_) {
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
if (typeof target.addEventListener === 'function') {
|
|
710
|
+
try {
|
|
711
|
+
if (isEventListenerCallback(callback)) {
|
|
712
|
+
return target.addEventListener(type, callback, options);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
catch (_) {
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (typeof target.attachEvent === 'function') {
|
|
719
|
+
var existing = findIEWrapper(target, type, callback);
|
|
720
|
+
if (typeof existing === 'function')
|
|
721
|
+
return;
|
|
722
|
+
var wrapper = function (event) {
|
|
723
|
+
if (typeof event === 'undefined')
|
|
724
|
+
event = globalThis.event;
|
|
725
|
+
if (typeof event === 'undefined')
|
|
726
|
+
return;
|
|
727
|
+
try {
|
|
728
|
+
Object.defineProperty(event, 'currentTarget', { value: target, configurable: true });
|
|
729
|
+
}
|
|
730
|
+
catch (_) {
|
|
731
|
+
}
|
|
732
|
+
if (typeof event.preventDefault !== 'function')
|
|
733
|
+
event.preventDefault = preventDefaultPolyfill.bind(event);
|
|
734
|
+
if (typeof event.stopPropagation !== 'function')
|
|
735
|
+
event.stopPropagation = stopPropagationPolyfill.bind(event);
|
|
736
|
+
if (typeof callback === 'function')
|
|
737
|
+
callback.call(target, event);
|
|
738
|
+
else if (callback && typeof callback.handleEvent === 'function')
|
|
739
|
+
callback.handleEvent(event);
|
|
740
|
+
};
|
|
741
|
+
setIEWrapper(target, type, callback, wrapper);
|
|
742
|
+
return target.attachEvent('on' + type, wrapper);
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
remove: function (target, eventListenerOptions) {
|
|
746
|
+
if (typeof eventListenerOptions.type === 'undefined')
|
|
747
|
+
return;
|
|
748
|
+
if (typeof target === 'undefined')
|
|
749
|
+
return;
|
|
750
|
+
var callback = eventListenerOptions.callback;
|
|
751
|
+
var type = withVendor(target, eventListenerOptions.type);
|
|
752
|
+
var options = eventListenerOptions.options;
|
|
753
|
+
if (isMediaQueryListTarget(target)) {
|
|
754
|
+
if (typeof target.removeListener === 'function') {
|
|
755
|
+
try {
|
|
756
|
+
var wrapper = removeMediaQueryListWrapper(target, type, callback);
|
|
757
|
+
if (typeof wrapper === 'function')
|
|
758
|
+
return target.removeListener(wrapper);
|
|
759
|
+
}
|
|
760
|
+
catch (_) {
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (typeof target.removeEventListener === 'function') {
|
|
766
|
+
try {
|
|
767
|
+
if (isEventListenerCallback(callback)) {
|
|
768
|
+
return target.removeEventListener(type, callback, options);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
catch (_) {
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
if (typeof target.detachEvent === 'function') {
|
|
775
|
+
var wrapper = removeIEWrapper(target, type, callback);
|
|
776
|
+
if (typeof wrapper === 'function')
|
|
777
|
+
target.detachEvent('on' + type, wrapper);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
function createSubscriptionManager(attach, detach) {
|
|
784
|
+
var entries = [];
|
|
785
|
+
function removeEntry(entry) {
|
|
786
|
+
var index = indexOfEntry(entry);
|
|
787
|
+
if (index !== -1) {
|
|
788
|
+
entries.splice(index, 1);
|
|
789
|
+
if (entries.length === 0)
|
|
790
|
+
detach();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function indexOfEntry(entry) {
|
|
794
|
+
for (var i = 0; i < entries.length; i++)
|
|
795
|
+
if (entries[i].fn === entry.fn)
|
|
796
|
+
return i;
|
|
797
|
+
return -1;
|
|
798
|
+
}
|
|
799
|
+
return {
|
|
800
|
+
emit: function (value) {
|
|
801
|
+
var snapshot = entries.slice();
|
|
802
|
+
for (var i = 0; i < snapshot.length; i++) {
|
|
803
|
+
snapshot[i].fn(value);
|
|
804
|
+
if (snapshot[i].once)
|
|
805
|
+
removeEntry(snapshot[i]);
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
subscribe: function (listener, options) {
|
|
809
|
+
if (options === void 0) { options = {}; }
|
|
810
|
+
var entry = { fn: listener, once: false };
|
|
811
|
+
if (typeof options.once !== 'undefined')
|
|
812
|
+
entry.once = options.once;
|
|
813
|
+
if (typeof options.signal !== 'undefined')
|
|
814
|
+
entry.signal = options.signal;
|
|
815
|
+
var index = indexOfEntry(entry);
|
|
816
|
+
if (index === -1) {
|
|
817
|
+
entries.push(entry);
|
|
818
|
+
if (entries.length === 1)
|
|
819
|
+
attach();
|
|
820
|
+
}
|
|
821
|
+
else if (entries[index].once && !entry.once) {
|
|
822
|
+
entries[index].once = false;
|
|
823
|
+
}
|
|
824
|
+
var cleanup = function () {
|
|
825
|
+
EventListener.remove(entry.signal, { type: 'abort', callback: cleanup });
|
|
826
|
+
removeEntry(entry);
|
|
827
|
+
};
|
|
828
|
+
if (typeof entry.signal !== 'undefined') {
|
|
829
|
+
if (entry.signal.aborted)
|
|
830
|
+
removeEntry(entry);
|
|
831
|
+
else
|
|
832
|
+
EventListener.add(entry.signal, { type: 'abort', callback: cleanup });
|
|
833
|
+
}
|
|
834
|
+
return function unsubscribe() {
|
|
835
|
+
removeEntry(entry);
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
var onChangeSubscriptionManager$5 = createSubscriptionManager(attachOnChange$5, detachOnChange$5);
|
|
842
|
+
var appearanceRef = null;
|
|
843
|
+
var pollingIntervalId = null;
|
|
844
|
+
var Appearance = {
|
|
845
|
+
get value() {
|
|
846
|
+
return getAppearance();
|
|
847
|
+
},
|
|
848
|
+
onChange: onChangeSubscriptionManager$5.subscribe,
|
|
849
|
+
Constants: {
|
|
850
|
+
Appearances: Appearances
|
|
851
|
+
},
|
|
852
|
+
Errors: {}
|
|
853
|
+
};
|
|
854
|
+
function getAppearanceFromEngine() {
|
|
855
|
+
var img = new Image();
|
|
856
|
+
img.src = SVG_PIXEL_DATA_URL;
|
|
857
|
+
if (CONTEXT === null)
|
|
858
|
+
return Appearances.Light;
|
|
859
|
+
CONTEXT.drawImage(img, 0, 0);
|
|
860
|
+
var data = CONTEXT.getImageData(0, 0, 1, 1).data;
|
|
861
|
+
if ((data[0] & data[1] & data[2]) < 255)
|
|
862
|
+
return Appearances.Dark;
|
|
863
|
+
else
|
|
864
|
+
return Appearances.Light;
|
|
865
|
+
}
|
|
866
|
+
function getAppearanceFromMediaQuery() {
|
|
867
|
+
if (MEDIA_QUERY_LIST$1.media === 'not all')
|
|
868
|
+
return Appearances.Unknown;
|
|
869
|
+
if (MEDIA_QUERY_LIST$1.matches)
|
|
870
|
+
return Appearances.Dark;
|
|
871
|
+
return Appearances.Light;
|
|
872
|
+
}
|
|
873
|
+
function getAppearance() {
|
|
874
|
+
if (Platform.browser.name === Browsers.SamsungInternet)
|
|
875
|
+
return getAppearanceFromEngine();
|
|
876
|
+
return getAppearanceFromMediaQuery();
|
|
877
|
+
}
|
|
878
|
+
function startPolling() {
|
|
879
|
+
appearanceRef = getAppearanceFromEngine();
|
|
880
|
+
pollingIntervalId = globalThis.setInterval(function () {
|
|
881
|
+
var appearance = getAppearanceFromEngine();
|
|
882
|
+
if (appearance !== appearanceRef) {
|
|
883
|
+
appearanceRef = appearance;
|
|
884
|
+
onChangeSubscriptionManager$5.emit(appearance);
|
|
885
|
+
}
|
|
886
|
+
}, 2000);
|
|
887
|
+
}
|
|
888
|
+
function stopPolling() {
|
|
889
|
+
appearanceRef = null;
|
|
890
|
+
if (pollingIntervalId !== null) {
|
|
891
|
+
clearInterval(pollingIntervalId);
|
|
892
|
+
pollingIntervalId = null;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function attachOnChange$5() {
|
|
896
|
+
appearanceRef = getAppearanceFromMediaQuery();
|
|
897
|
+
EventListener.add(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
|
|
898
|
+
if (Platform.browser.name === Browsers.SamsungInternet)
|
|
899
|
+
startPolling();
|
|
900
|
+
}
|
|
901
|
+
function detachOnChange$5() {
|
|
902
|
+
appearanceRef = null;
|
|
903
|
+
EventListener.remove(MEDIA_QUERY_LIST$1, { type: 'change', callback: onMediaChange });
|
|
904
|
+
if (Platform.browser.name === Browsers.SamsungInternet)
|
|
905
|
+
stopPolling();
|
|
906
|
+
}
|
|
907
|
+
function onMediaChange(event) {
|
|
908
|
+
var appearance;
|
|
909
|
+
if (event.matches)
|
|
910
|
+
appearance = Appearances.Dark;
|
|
911
|
+
else
|
|
912
|
+
appearance = Appearances.Light;
|
|
913
|
+
if (appearance !== appearanceRef)
|
|
914
|
+
onChangeSubscriptionManager$5.emit(appearanceRef = appearance);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function isSecureContext() {
|
|
918
|
+
if (typeof globalThis.isSecureContext !== 'undefined')
|
|
919
|
+
return globalThis.isSecureContext;
|
|
920
|
+
var protocol = location.protocol;
|
|
921
|
+
var hostname = location.hostname;
|
|
922
|
+
return protocol === 'https:' ||
|
|
923
|
+
hostname === 'localhost' ||
|
|
924
|
+
hostname === '127.0.0.1' ||
|
|
925
|
+
hostname === '[::1]';
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
function setStyle(element, styles) {
|
|
929
|
+
var elementStyle = element.style;
|
|
930
|
+
for (var key in styles) {
|
|
931
|
+
var style = styles[key];
|
|
932
|
+
if (typeof style !== 'undefined')
|
|
933
|
+
elementStyle[key] = style;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function createHiddenElement(tagName, focusable) {
|
|
938
|
+
if (focusable === void 0) { focusable = true; }
|
|
939
|
+
var element = globalThis.document.createElement(tagName);
|
|
940
|
+
if (typeof element.width !== 'undefined')
|
|
941
|
+
element.width = '0';
|
|
942
|
+
if (typeof element.height !== 'undefined')
|
|
943
|
+
element.height = '0';
|
|
944
|
+
if (typeof element.border !== 'undefined')
|
|
945
|
+
element.border = '0';
|
|
946
|
+
if (typeof element.frameBorder !== 'undefined')
|
|
947
|
+
element.frameBorder = '0';
|
|
948
|
+
if (typeof element.scrolling !== 'undefined')
|
|
949
|
+
element.scrolling = 'no';
|
|
950
|
+
if (typeof element.cellPadding !== 'undefined')
|
|
951
|
+
element.cellPadding = '0';
|
|
952
|
+
if (typeof element.cellSpacing !== 'undefined')
|
|
953
|
+
element.cellSpacing = '0';
|
|
954
|
+
if (typeof element.frame !== 'undefined')
|
|
955
|
+
element.frame = 'void';
|
|
956
|
+
if (typeof element.rules !== 'undefined')
|
|
957
|
+
element.rules = 'none';
|
|
958
|
+
if (typeof element.noWrap !== 'undefined')
|
|
959
|
+
element.noWrap = true;
|
|
960
|
+
element.tabIndex = -1;
|
|
961
|
+
element.setAttribute('role', 'presentation');
|
|
962
|
+
if (focusable) {
|
|
963
|
+
setStyle(element, {
|
|
964
|
+
width: '1px',
|
|
965
|
+
height: '1px',
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
element.setAttribute('aria-hidden', 'true');
|
|
970
|
+
setStyle(element, {
|
|
971
|
+
width: '0',
|
|
972
|
+
height: '0',
|
|
973
|
+
zIndex: '-9999',
|
|
974
|
+
display: 'none',
|
|
975
|
+
visibility: 'hidden',
|
|
976
|
+
pointerEvents: 'none',
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
setStyle(element, {
|
|
980
|
+
position: 'absolute',
|
|
981
|
+
top: '0',
|
|
982
|
+
left: '0',
|
|
983
|
+
padding: '0',
|
|
984
|
+
margin: '0',
|
|
985
|
+
border: 'none',
|
|
986
|
+
outline: 'hidden',
|
|
987
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
988
|
+
clipPath: 'inset(50%)',
|
|
989
|
+
overflow: 'hidden',
|
|
990
|
+
whiteSpace: 'nowrap',
|
|
991
|
+
});
|
|
992
|
+
return element;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
var Clipboard = {
|
|
996
|
+
copy: copy,
|
|
997
|
+
paste: paste,
|
|
998
|
+
Constants: {},
|
|
999
|
+
Errors: {},
|
|
1000
|
+
};
|
|
1001
|
+
function isObject(item) {
|
|
1002
|
+
return item !== null && typeof item === 'object';
|
|
1003
|
+
}
|
|
1004
|
+
function isArray(item) {
|
|
1005
|
+
return Array.isArray(item);
|
|
1006
|
+
}
|
|
1007
|
+
function isSerializable(item) {
|
|
1008
|
+
return isObject(item) || isArray(item);
|
|
1009
|
+
}
|
|
1010
|
+
function isElement(item) {
|
|
1011
|
+
if (item == null || (typeof item !== "object" && typeof item !== "function"))
|
|
1012
|
+
return false;
|
|
1013
|
+
if (item.nodeType !== 1)
|
|
1014
|
+
return false;
|
|
1015
|
+
if (typeof item.nodeName !== "string")
|
|
1016
|
+
return false;
|
|
1017
|
+
return typeof item.getAttribute === "function";
|
|
1018
|
+
}
|
|
1019
|
+
function isSelection(item) {
|
|
1020
|
+
return Object.prototype.toString.call(item) === '[object Selection]';
|
|
1021
|
+
}
|
|
1022
|
+
function convertToString(item) {
|
|
1023
|
+
if (isElement(item)) {
|
|
1024
|
+
var textContent = item.textContent;
|
|
1025
|
+
if (textContent !== null)
|
|
1026
|
+
return textContent;
|
|
1027
|
+
return '';
|
|
1028
|
+
}
|
|
1029
|
+
if (isSelection(item))
|
|
1030
|
+
return item.toString();
|
|
1031
|
+
if (isSerializable(item)) {
|
|
1032
|
+
try {
|
|
1033
|
+
return JSON.stringify(item);
|
|
1034
|
+
}
|
|
1035
|
+
catch (_) {
|
|
1036
|
+
return '' + item;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
else if (typeof item !== 'string') {
|
|
1040
|
+
return '' + item;
|
|
1041
|
+
}
|
|
1042
|
+
return item;
|
|
1043
|
+
}
|
|
1044
|
+
function convertToHTML(item) {
|
|
1045
|
+
var html = null;
|
|
1046
|
+
if (isElement(item))
|
|
1047
|
+
html = item.outerHTML;
|
|
1048
|
+
if (isSelection(item) && item.rangeCount > 0) {
|
|
1049
|
+
var div = globalThis.document.createElement('div');
|
|
1050
|
+
for (var i = 0; i < item.rangeCount; i++)
|
|
1051
|
+
div.appendChild(item.getRangeAt(i).cloneContents());
|
|
1052
|
+
html = div.innerHTML;
|
|
1053
|
+
}
|
|
1054
|
+
if (html === null)
|
|
1055
|
+
return;
|
|
1056
|
+
return html;
|
|
1057
|
+
}
|
|
1058
|
+
function supportsClipboardAPI() {
|
|
1059
|
+
return (isSecureContext() && typeof globalThis.navigator.clipboard !== 'undefined');
|
|
1060
|
+
}
|
|
1061
|
+
function supportsClipboardWriteAPI() {
|
|
1062
|
+
return supportsClipboardAPI() && (typeof globalThis.navigator.clipboard.write !== 'undefined' || typeof globalThis.navigator.clipboard.writeText !== 'undefined');
|
|
1063
|
+
}
|
|
1064
|
+
function supportsClipboardReadAPI() {
|
|
1065
|
+
return supportsClipboardAPI() && (typeof globalThis.navigator.clipboard.read !== 'undefined' || typeof globalThis.navigator.clipboard.readText !== 'undefined');
|
|
1066
|
+
}
|
|
1067
|
+
function copy(item) {
|
|
1068
|
+
var text = convertToString(item);
|
|
1069
|
+
var html = convertToHTML(item);
|
|
1070
|
+
if (supportsClipboardWriteAPI()) {
|
|
1071
|
+
return copyViaClipboardAPI(text, html)
|
|
1072
|
+
.then(function (success) {
|
|
1073
|
+
if (success)
|
|
1074
|
+
return true;
|
|
1075
|
+
return copyViaLegacy(text, html);
|
|
1076
|
+
})
|
|
1077
|
+
.catch(function () {
|
|
1078
|
+
return copyViaLegacy(text, html);
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
return Promise.resolve(copyViaLegacy(text, html));
|
|
1082
|
+
}
|
|
1083
|
+
function copyViaClipboardAPI(text, html) {
|
|
1084
|
+
try {
|
|
1085
|
+
if (typeof globalThis.ClipboardItem !== 'undefined' && typeof globalThis.navigator.clipboard.write !== 'undefined') {
|
|
1086
|
+
var items = {};
|
|
1087
|
+
if (typeof html !== 'undefined')
|
|
1088
|
+
items['text/html'] = new Blob([html], { type: 'text/html' });
|
|
1089
|
+
items['text/plain'] = new Blob([text], { type: 'text/plain' });
|
|
1090
|
+
return globalThis.navigator.clipboard.write([new ClipboardItem(items)])
|
|
1091
|
+
.then(function () {
|
|
1092
|
+
return true;
|
|
1093
|
+
})
|
|
1094
|
+
.catch(function () {
|
|
1095
|
+
return false;
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
else if (typeof globalThis.navigator.clipboard.writeText !== 'undefined') {
|
|
1099
|
+
return globalThis.navigator.clipboard.writeText(text)
|
|
1100
|
+
.then(function () {
|
|
1101
|
+
return true;
|
|
1102
|
+
})
|
|
1103
|
+
.catch(function () {
|
|
1104
|
+
return false;
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
catch (_) {
|
|
1109
|
+
return Promise.resolve(false);
|
|
1110
|
+
}
|
|
1111
|
+
return Promise.resolve(false);
|
|
1112
|
+
}
|
|
1113
|
+
function copyViaSelection(text, html) {
|
|
1114
|
+
if (typeof globalThis.getSelection === 'undefined' || typeof globalThis.document.createRange === 'undefined')
|
|
1115
|
+
return false;
|
|
1116
|
+
var div = createHiddenElement('div');
|
|
1117
|
+
div.contentEditable = 'true';
|
|
1118
|
+
if (typeof html !== 'undefined')
|
|
1119
|
+
div.innerHTML = html;
|
|
1120
|
+
else
|
|
1121
|
+
div.textContent = text;
|
|
1122
|
+
div.style.whiteSpace = 'pre';
|
|
1123
|
+
div.style.userSelect = 'text';
|
|
1124
|
+
div.style.setProperty('-webkit-user-select', 'text');
|
|
1125
|
+
div.style.setProperty('-moz-user-select', 'text');
|
|
1126
|
+
div.style.setProperty('-ms-user-select', 'text');
|
|
1127
|
+
globalThis.document.body.appendChild(div);
|
|
1128
|
+
var selection = globalThis.getSelection();
|
|
1129
|
+
var range = globalThis.document.createRange();
|
|
1130
|
+
var onCopy = function (event) {
|
|
1131
|
+
try {
|
|
1132
|
+
if (event.clipboardData !== null && typeof event.clipboardData.setData === 'function') {
|
|
1133
|
+
event.preventDefault();
|
|
1134
|
+
if (typeof html !== 'undefined')
|
|
1135
|
+
event.clipboardData.setData('text/html', html);
|
|
1136
|
+
event.clipboardData.setData('text/plain', text);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
catch (_) {
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
EventListener.add(globalThis.document, { type: 'copy', callback: onCopy, options: { once: true, capture: true } });
|
|
1143
|
+
try {
|
|
1144
|
+
if (selection === null) {
|
|
1145
|
+
cleanupSelection(div, selection, onCopy);
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
selection.removeAllRanges();
|
|
1149
|
+
range.selectNodeContents(div);
|
|
1150
|
+
selection.addRange(range);
|
|
1151
|
+
var success = globalThis.document.execCommand('copy');
|
|
1152
|
+
cleanupSelection(div, selection, onCopy);
|
|
1153
|
+
return success;
|
|
1154
|
+
}
|
|
1155
|
+
catch (_) {
|
|
1156
|
+
cleanupSelection(div, selection, onCopy);
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
function copyViaClipboardData(text, html) {
|
|
1161
|
+
var windowWithClipboardData = globalThis;
|
|
1162
|
+
var clipboardData = windowWithClipboardData.clipboardData;
|
|
1163
|
+
if (typeof clipboardData !== 'undefined' && typeof clipboardData.setData === 'function') {
|
|
1164
|
+
try {
|
|
1165
|
+
if (typeof html !== 'undefined')
|
|
1166
|
+
clipboardData.setData('HTML', html);
|
|
1167
|
+
return clipboardData.setData('Text', text);
|
|
1168
|
+
}
|
|
1169
|
+
catch (_) {
|
|
1170
|
+
return false;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return false;
|
|
1174
|
+
}
|
|
1175
|
+
function copyViaLegacy(text, html) {
|
|
1176
|
+
return copyViaSelection(text, html) || copyViaClipboardData(text, html);
|
|
1177
|
+
}
|
|
1178
|
+
function paste() {
|
|
1179
|
+
if (supportsClipboardReadAPI()) {
|
|
1180
|
+
return pasteViaClipboardAPI()
|
|
1181
|
+
.then(function (text) {
|
|
1182
|
+
if (text !== null)
|
|
1183
|
+
return text;
|
|
1184
|
+
return pasteViaLegacy();
|
|
1185
|
+
})
|
|
1186
|
+
.catch(function () {
|
|
1187
|
+
return pasteViaLegacy();
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
return Promise.resolve(pasteViaLegacy());
|
|
1191
|
+
}
|
|
1192
|
+
function pasteViaClipboardAPI() {
|
|
1193
|
+
try {
|
|
1194
|
+
if (typeof globalThis.ClipboardItem !== 'undefined' && typeof globalThis.navigator.clipboard.read !== 'undefined') {
|
|
1195
|
+
return globalThis.navigator.clipboard.read()
|
|
1196
|
+
.then(function (items) {
|
|
1197
|
+
if (items.length === 0)
|
|
1198
|
+
return Promise.resolve(null);
|
|
1199
|
+
for (var i = 0; i < items.length; i++) {
|
|
1200
|
+
var item = items[i];
|
|
1201
|
+
var types = item.types;
|
|
1202
|
+
for (var j = 0; j < types.length; j++) {
|
|
1203
|
+
if (types[j] === 'text/html') {
|
|
1204
|
+
return item.getType('text/html')
|
|
1205
|
+
.then(function (blob) {
|
|
1206
|
+
return blob.text();
|
|
1207
|
+
})
|
|
1208
|
+
.catch(function () {
|
|
1209
|
+
return null;
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
for (var i = 0; i < items.length; i++) {
|
|
1215
|
+
var item = items[i];
|
|
1216
|
+
var types = item.types;
|
|
1217
|
+
for (var j = 0; j < types.length; j++) {
|
|
1218
|
+
if (types[j] === 'text/plain') {
|
|
1219
|
+
return item.getType('text/plain')
|
|
1220
|
+
.then(function (blob) {
|
|
1221
|
+
return blob.text();
|
|
1222
|
+
})
|
|
1223
|
+
.catch(function () {
|
|
1224
|
+
return null;
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
return Promise.resolve(null);
|
|
1230
|
+
})
|
|
1231
|
+
.catch(function () {
|
|
1232
|
+
return null;
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
else if (typeof globalThis.navigator.clipboard.readText !== 'undefined') {
|
|
1236
|
+
return globalThis.navigator.clipboard.readText()
|
|
1237
|
+
.then(function (text) {
|
|
1238
|
+
return text;
|
|
1239
|
+
})
|
|
1240
|
+
.catch(function () {
|
|
1241
|
+
return null;
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
catch (_) {
|
|
1246
|
+
return Promise.resolve(null);
|
|
1247
|
+
}
|
|
1248
|
+
return Promise.resolve(null);
|
|
1249
|
+
}
|
|
1250
|
+
function pasteViaSelection() {
|
|
1251
|
+
var div = createHiddenElement('div');
|
|
1252
|
+
div.contentEditable = 'true';
|
|
1253
|
+
globalThis.document.body.appendChild(div);
|
|
1254
|
+
div.focus();
|
|
1255
|
+
var pastedText = null;
|
|
1256
|
+
var onPaste = function (event) {
|
|
1257
|
+
try {
|
|
1258
|
+
if (event.clipboardData !== null && typeof event.clipboardData.getData === 'function') {
|
|
1259
|
+
event.preventDefault();
|
|
1260
|
+
var html = event.clipboardData.getData('text/html');
|
|
1261
|
+
var plain = event.clipboardData.getData('text/plain');
|
|
1262
|
+
if (html !== '')
|
|
1263
|
+
pastedText = html;
|
|
1264
|
+
if (plain !== '')
|
|
1265
|
+
pastedText = plain;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
catch (_) {
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
EventListener.add(globalThis.document, { type: 'paste', callback: onPaste, options: { once: true, capture: true } });
|
|
1272
|
+
try {
|
|
1273
|
+
var success = globalThis.document.execCommand('paste');
|
|
1274
|
+
if (!success && pastedText === null) {
|
|
1275
|
+
var innerHTML = div.innerHTML;
|
|
1276
|
+
if (innerHTML !== '') {
|
|
1277
|
+
pastedText = innerHTML;
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
var textContent = div.textContent;
|
|
1281
|
+
if (textContent !== null && textContent !== '')
|
|
1282
|
+
pastedText = textContent;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
cleanupPaste(div, onPaste);
|
|
1286
|
+
return pastedText;
|
|
1287
|
+
}
|
|
1288
|
+
catch (_) {
|
|
1289
|
+
cleanupPaste(div, onPaste);
|
|
1290
|
+
return null;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
function pasteViaClipboardData() {
|
|
1294
|
+
var windowWithClipboardData = globalThis;
|
|
1295
|
+
var clipboardData = windowWithClipboardData.clipboardData;
|
|
1296
|
+
if (typeof clipboardData !== 'undefined' && typeof clipboardData.getData === 'function') {
|
|
1297
|
+
try {
|
|
1298
|
+
var text = clipboardData.getData('Text');
|
|
1299
|
+
if (text !== '')
|
|
1300
|
+
return text;
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
catch (_) {
|
|
1304
|
+
return null;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
function pasteViaLegacy() {
|
|
1310
|
+
var fromSelection = pasteViaSelection();
|
|
1311
|
+
if (fromSelection !== null)
|
|
1312
|
+
return fromSelection;
|
|
1313
|
+
var fromClipboardData = pasteViaClipboardData();
|
|
1314
|
+
if (fromClipboardData !== null)
|
|
1315
|
+
return fromClipboardData;
|
|
1316
|
+
return '';
|
|
1317
|
+
}
|
|
1318
|
+
function cleanupSelection(span, selection, onCopy) {
|
|
1319
|
+
if (selection !== null)
|
|
1320
|
+
selection.removeAllRanges();
|
|
1321
|
+
globalThis.document.body.removeChild(span);
|
|
1322
|
+
EventListener.remove(globalThis.document, { type: 'copy', callback: onCopy });
|
|
1323
|
+
}
|
|
1324
|
+
function cleanupPaste(div, onPaste) {
|
|
1325
|
+
globalThis.document.body.removeChild(div);
|
|
1326
|
+
EventListener.remove(globalThis.document, { type: 'paste', callback: onPaste });
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
var Orientation;
|
|
1330
|
+
(function (Orientation) {
|
|
1331
|
+
Orientation["Portrait"] = "portrait";
|
|
1332
|
+
Orientation["Landscape"] = "landscape";
|
|
1333
|
+
Orientation["Unknown"] = "unknown";
|
|
1334
|
+
})(Orientation || (Orientation = {}));
|
|
1335
|
+
var ENV_PRESETS = {
|
|
1336
|
+
'safe-area-inset': {
|
|
1337
|
+
top: 'safe-area-inset-top',
|
|
1338
|
+
right: 'safe-area-inset-right',
|
|
1339
|
+
bottom: 'safe-area-inset-bottom',
|
|
1340
|
+
left: 'safe-area-inset-left',
|
|
1341
|
+
},
|
|
1342
|
+
'safe-area-max-inset': {
|
|
1343
|
+
top: 'safe-area-max-inset-top',
|
|
1344
|
+
right: 'safe-area-max-inset-right',
|
|
1345
|
+
bottom: 'safe-area-max-inset-bottom',
|
|
1346
|
+
left: 'safe-area-max-inset-left',
|
|
1347
|
+
},
|
|
1348
|
+
'titlebar-area': {
|
|
1349
|
+
x: 'titlebar-area-x',
|
|
1350
|
+
y: 'titlebar-area-y',
|
|
1351
|
+
width: 'titlebar-area-width',
|
|
1352
|
+
height: 'titlebar-area-height',
|
|
1353
|
+
},
|
|
1354
|
+
'keyboard-inset': {
|
|
1355
|
+
top: 'keyboard-inset-top',
|
|
1356
|
+
right: 'keyboard-inset-right',
|
|
1357
|
+
bottom: 'keyboard-inset-bottom',
|
|
1358
|
+
left: 'keyboard-inset-left',
|
|
1359
|
+
width: 'keyboard-inset-width',
|
|
1360
|
+
height: 'keyboard-inset-height',
|
|
1361
|
+
},
|
|
1362
|
+
'viewport-segment': {
|
|
1363
|
+
width: 'viewport-segment-width',
|
|
1364
|
+
height: 'viewport-segment-height',
|
|
1365
|
+
top: 'viewport-segment-top',
|
|
1366
|
+
right: 'viewport-segment-right',
|
|
1367
|
+
bottom: 'viewport-segment-bottom',
|
|
1368
|
+
left: 'viewport-segment-left',
|
|
1369
|
+
},
|
|
1370
|
+
};
|
|
1371
|
+
var FALLBACK_DIMENSION = {
|
|
1372
|
+
innerWidth: -1,
|
|
1373
|
+
innerHeight: -1,
|
|
1374
|
+
outerWidth: -1,
|
|
1375
|
+
outerHeight: -1,
|
|
1376
|
+
scale: 1,
|
|
1377
|
+
orientation: Orientation.Unknown,
|
|
1378
|
+
};
|
|
1379
|
+
var MEDIA_QUERY_LIST;
|
|
1380
|
+
if (typeof globalThis.matchMedia !== 'undefined')
|
|
1381
|
+
MEDIA_QUERY_LIST = globalThis.matchMedia('(orientation: portrait)');
|
|
1382
|
+
else
|
|
1383
|
+
MEDIA_QUERY_LIST = FALLBACK_MEDIA_QUERY_LIST;
|
|
1384
|
+
|
|
1385
|
+
function keys(object) {
|
|
1386
|
+
var keys = [];
|
|
1387
|
+
for (var key in object)
|
|
1388
|
+
if (object.hasOwnProperty(key))
|
|
1389
|
+
keys.push(key);
|
|
1390
|
+
return keys;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
function defer(task) {
|
|
1394
|
+
if (typeof globalThis.queueMicrotask !== 'undefined') {
|
|
1395
|
+
globalThis.queueMicrotask(task);
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (typeof globalThis.Promise === 'function') {
|
|
1399
|
+
Promise.resolve().then(task);
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
globalThis.setTimeout(task, 0);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function noop() {
|
|
1406
|
+
}
|
|
1407
|
+
function createVirtualKeyboardObserver() {
|
|
1408
|
+
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
1409
|
+
function attachOnChange() {
|
|
1410
|
+
EventListener.add(globalThis.navigator.virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
1411
|
+
}
|
|
1412
|
+
function detachOnChange() {
|
|
1413
|
+
EventListener.remove(globalThis.navigator.virtualKeyboard, { type: 'geometrychange', callback: onGeometryChange, options: { passive: true } });
|
|
1414
|
+
}
|
|
1415
|
+
function onGeometryChange() {
|
|
1416
|
+
onChangeSubscriptionManager.emit(getValue());
|
|
1417
|
+
}
|
|
1418
|
+
function getValue() {
|
|
1419
|
+
var rect = globalThis.navigator.virtualKeyboard.boundingRect;
|
|
1420
|
+
var left = rect.x;
|
|
1421
|
+
var top = rect.y;
|
|
1422
|
+
var width = rect.width;
|
|
1423
|
+
var height = rect.height;
|
|
1424
|
+
var right = (function () {
|
|
1425
|
+
if (width === 0)
|
|
1426
|
+
return 0;
|
|
1427
|
+
return Math.max(0, globalThis.innerWidth - (left + width));
|
|
1428
|
+
})();
|
|
1429
|
+
var bottom = (function () {
|
|
1430
|
+
if (height === 0)
|
|
1431
|
+
return 0;
|
|
1432
|
+
return Math.max(0, globalThis.innerHeight - (top + height));
|
|
1433
|
+
})();
|
|
1434
|
+
return {
|
|
1435
|
+
top: top,
|
|
1436
|
+
right: right,
|
|
1437
|
+
bottom: bottom,
|
|
1438
|
+
left: left,
|
|
1439
|
+
width: width,
|
|
1440
|
+
height: height,
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
return {
|
|
1444
|
+
get: getValue,
|
|
1445
|
+
onChange: onChangeSubscriptionManager.subscribe,
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
function createEnvObserver(preset) {
|
|
1449
|
+
if (preset === 'keyboard-inset' && typeof globalThis.navigator.virtualKeyboard !== 'undefined')
|
|
1450
|
+
return createVirtualKeyboardObserver();
|
|
1451
|
+
var envMap = ENV_PRESETS[preset];
|
|
1452
|
+
var attributes = keys(envMap);
|
|
1453
|
+
var support = getSupportedEnv();
|
|
1454
|
+
var parentReadyCallbacks = [];
|
|
1455
|
+
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
1456
|
+
var elementComputedStyle = {};
|
|
1457
|
+
var passiveEvents = undefined;
|
|
1458
|
+
var parentDiv = null;
|
|
1459
|
+
var pendingChange = false;
|
|
1460
|
+
var lastEmittedValues = null;
|
|
1461
|
+
function attachOnChange() {
|
|
1462
|
+
if (typeof support === 'undefined')
|
|
1463
|
+
return;
|
|
1464
|
+
if (parentDiv === null)
|
|
1465
|
+
init();
|
|
1466
|
+
}
|
|
1467
|
+
function detachOnChange() {
|
|
1468
|
+
removeDetector();
|
|
1469
|
+
}
|
|
1470
|
+
function getSupportedEnv() {
|
|
1471
|
+
if (typeof globalThis.CSS !== 'undefined' && typeof globalThis.CSS.supports === 'function') {
|
|
1472
|
+
if (globalThis.CSS.supports('x: env(x)'))
|
|
1473
|
+
return 'env';
|
|
1474
|
+
if (globalThis.CSS.supports('x: constant(x)'))
|
|
1475
|
+
return 'constant';
|
|
1476
|
+
}
|
|
1477
|
+
return undefined;
|
|
1478
|
+
}
|
|
1479
|
+
function isSameValues(a, b) {
|
|
1480
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1481
|
+
var key = attributes[i];
|
|
1482
|
+
if (a[key] !== b[key])
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
return true;
|
|
1486
|
+
}
|
|
1487
|
+
try {
|
|
1488
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
1489
|
+
get: function () {
|
|
1490
|
+
passiveEvents = { passive: true };
|
|
1491
|
+
},
|
|
1492
|
+
});
|
|
1493
|
+
EventListener.add(globalThis, { type: 'test', callback: noop, options: options });
|
|
1494
|
+
}
|
|
1495
|
+
catch (_) {
|
|
1496
|
+
}
|
|
1497
|
+
function attributeChange() {
|
|
1498
|
+
if (pendingChange)
|
|
1499
|
+
return;
|
|
1500
|
+
pendingChange = true;
|
|
1501
|
+
defer(function flush() {
|
|
1502
|
+
pendingChange = false;
|
|
1503
|
+
var nextValues = readValues();
|
|
1504
|
+
if (lastEmittedValues !== null && isSameValues(lastEmittedValues, nextValues))
|
|
1505
|
+
return;
|
|
1506
|
+
lastEmittedValues = nextValues;
|
|
1507
|
+
onChangeSubscriptionManager.emit(nextValues);
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
function parentReady(callback) {
|
|
1511
|
+
if (typeof callback !== 'undefined')
|
|
1512
|
+
parentReadyCallbacks.push(callback);
|
|
1513
|
+
else
|
|
1514
|
+
for (var i = 0; i < parentReadyCallbacks.length; i++)
|
|
1515
|
+
parentReadyCallbacks[i]();
|
|
1516
|
+
}
|
|
1517
|
+
function addChild(parent, attribute) {
|
|
1518
|
+
var envVar = envMap[attribute];
|
|
1519
|
+
var p1 = globalThis.document.createElement('div');
|
|
1520
|
+
var p2 = globalThis.document.createElement('div');
|
|
1521
|
+
var c1 = globalThis.document.createElement('div');
|
|
1522
|
+
var c2 = globalThis.document.createElement('div');
|
|
1523
|
+
var parentStyle = {
|
|
1524
|
+
position: 'absolute',
|
|
1525
|
+
width: '100px',
|
|
1526
|
+
height: '200px',
|
|
1527
|
+
boxSizing: 'border-box',
|
|
1528
|
+
overflow: 'hidden',
|
|
1529
|
+
paddingBottom: support + '(' + envVar + ')',
|
|
1530
|
+
};
|
|
1531
|
+
var child1Style = {
|
|
1532
|
+
transition: '0s',
|
|
1533
|
+
animation: 'none',
|
|
1534
|
+
width: '400px',
|
|
1535
|
+
height: '400px',
|
|
1536
|
+
};
|
|
1537
|
+
var child2Style = {
|
|
1538
|
+
transition: '0s',
|
|
1539
|
+
animation: 'none',
|
|
1540
|
+
width: '250%',
|
|
1541
|
+
height: '250%',
|
|
1542
|
+
};
|
|
1543
|
+
setStyle(p1, parentStyle);
|
|
1544
|
+
setStyle(p2, parentStyle);
|
|
1545
|
+
setStyle(c1, child1Style);
|
|
1546
|
+
setStyle(c2, child2Style);
|
|
1547
|
+
p1.appendChild(c1);
|
|
1548
|
+
p2.appendChild(c2);
|
|
1549
|
+
parent.appendChild(p1);
|
|
1550
|
+
parent.appendChild(p2);
|
|
1551
|
+
parentReady(function () {
|
|
1552
|
+
p1.scrollTop = p2.scrollTop = 10000;
|
|
1553
|
+
var p1LastScrollTop = p1.scrollTop;
|
|
1554
|
+
var p2LastScrollTop = p2.scrollTop;
|
|
1555
|
+
function onScroll() {
|
|
1556
|
+
var lastScrollTop;
|
|
1557
|
+
if (this === p1)
|
|
1558
|
+
lastScrollTop = p1LastScrollTop;
|
|
1559
|
+
else
|
|
1560
|
+
lastScrollTop = p2LastScrollTop;
|
|
1561
|
+
if (this.scrollTop === lastScrollTop)
|
|
1562
|
+
return;
|
|
1563
|
+
p1.scrollTop = p2.scrollTop = 10000;
|
|
1564
|
+
p1LastScrollTop = p1.scrollTop;
|
|
1565
|
+
p2LastScrollTop = p2.scrollTop;
|
|
1566
|
+
attributeChange();
|
|
1567
|
+
}
|
|
1568
|
+
EventListener.add(p1, { type: 'scroll', callback: onScroll, options: passiveEvents });
|
|
1569
|
+
EventListener.add(p2, { type: 'scroll', callback: onScroll, options: passiveEvents });
|
|
1570
|
+
});
|
|
1571
|
+
var computedStyle = globalThis.getComputedStyle(p1);
|
|
1572
|
+
Object.defineProperty(elementComputedStyle, attribute, {
|
|
1573
|
+
configurable: true,
|
|
1574
|
+
get: function () {
|
|
1575
|
+
return globalThis.parseFloat(computedStyle.paddingBottom);
|
|
1576
|
+
},
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function init() {
|
|
1580
|
+
if (typeof support === 'undefined') {
|
|
1581
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1582
|
+
elementComputedStyle[attributes[i]] = 0;
|
|
1583
|
+
}
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
elementComputedStyle = {};
|
|
1587
|
+
parentDiv = globalThis.document.createElement('div');
|
|
1588
|
+
parentDiv.setAttribute('data-' + preset + '-observer', '');
|
|
1589
|
+
setStyle(parentDiv, {
|
|
1590
|
+
position: 'absolute',
|
|
1591
|
+
left: '0',
|
|
1592
|
+
top: '0',
|
|
1593
|
+
width: '0',
|
|
1594
|
+
height: '0',
|
|
1595
|
+
zIndex: '-1',
|
|
1596
|
+
overflow: 'hidden',
|
|
1597
|
+
visibility: 'hidden',
|
|
1598
|
+
});
|
|
1599
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1600
|
+
addChild(parentDiv, attributes[i]);
|
|
1601
|
+
}
|
|
1602
|
+
globalThis.document.body.appendChild(parentDiv);
|
|
1603
|
+
lastEmittedValues = readValues();
|
|
1604
|
+
parentReady();
|
|
1605
|
+
}
|
|
1606
|
+
function removeDetector() {
|
|
1607
|
+
if (parentDiv !== null) {
|
|
1608
|
+
if (parentDiv.parentNode !== null)
|
|
1609
|
+
parentDiv.parentNode.removeChild(parentDiv);
|
|
1610
|
+
parentDiv = null;
|
|
1611
|
+
}
|
|
1612
|
+
parentReadyCallbacks.length = 0;
|
|
1613
|
+
elementComputedStyle = {};
|
|
1614
|
+
lastEmittedValues = null;
|
|
1615
|
+
}
|
|
1616
|
+
function getAttribute(attribute) {
|
|
1617
|
+
return elementComputedStyle[attribute];
|
|
1618
|
+
}
|
|
1619
|
+
function readValues() {
|
|
1620
|
+
var result = {};
|
|
1621
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1622
|
+
var attribute = attributes[i];
|
|
1623
|
+
result[attribute] = getAttribute(attribute);
|
|
1624
|
+
}
|
|
1625
|
+
return result;
|
|
1626
|
+
}
|
|
1627
|
+
return {
|
|
1628
|
+
get: function () {
|
|
1629
|
+
if (parentDiv !== null)
|
|
1630
|
+
return readValues();
|
|
1631
|
+
init();
|
|
1632
|
+
var result = readValues();
|
|
1633
|
+
removeDetector();
|
|
1634
|
+
return result;
|
|
1635
|
+
},
|
|
1636
|
+
onChange: function (callback, options) {
|
|
1637
|
+
if (options === void 0) { options = {}; }
|
|
1638
|
+
if (typeof support === 'undefined')
|
|
1639
|
+
return noop;
|
|
1640
|
+
return onChangeSubscriptionManager.subscribe(callback, options);
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
var safeAreaInsetObserver = createEnvObserver('safe-area-inset');
|
|
1646
|
+
var safeAreaMaxInsetObserver = createEnvObserver('safe-area-max-inset');
|
|
1647
|
+
var keyboardInsetObserver = createEnvObserver('keyboard-inset');
|
|
1648
|
+
var titlebarAreaObserver = createEnvObserver('titlebar-area');
|
|
1649
|
+
var viewportSegmentObserver = createEnvObserver('viewport-segment');
|
|
1650
|
+
var onChangeSubscriptionManager$4 = createSubscriptionManager(attachOnChange$4, detachOnChange$4);
|
|
1651
|
+
var dimensionRef = null;
|
|
1652
|
+
var Dimension = {
|
|
1653
|
+
get value() {
|
|
1654
|
+
return getDimension();
|
|
1655
|
+
},
|
|
1656
|
+
environment: getEnvironment(),
|
|
1657
|
+
onChange: onChangeSubscriptionManager$4.subscribe,
|
|
1658
|
+
Constants: {
|
|
1659
|
+
Orientation: Orientation,
|
|
1660
|
+
},
|
|
1661
|
+
Errors: {},
|
|
1662
|
+
};
|
|
1663
|
+
function getOrientation() {
|
|
1664
|
+
if (typeof globalThis.screen !== 'undefined') {
|
|
1665
|
+
switch (globalThis.screen.orientation.type) {
|
|
1666
|
+
case 'portrait-primary':
|
|
1667
|
+
case 'portrait-secondary':
|
|
1668
|
+
return Orientation.Portrait;
|
|
1669
|
+
case 'landscape-primary':
|
|
1670
|
+
case 'landscape-secondary':
|
|
1671
|
+
return Orientation.Landscape;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
if (typeof globalThis.orientation !== 'undefined') {
|
|
1675
|
+
switch (globalThis.orientation) {
|
|
1676
|
+
case 0:
|
|
1677
|
+
case 180:
|
|
1678
|
+
return Orientation.Portrait;
|
|
1679
|
+
case 90:
|
|
1680
|
+
case 270:
|
|
1681
|
+
return Orientation.Landscape;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
if (MEDIA_QUERY_LIST.media === 'not all')
|
|
1685
|
+
return Orientation.Unknown;
|
|
1686
|
+
else if (MEDIA_QUERY_LIST.matches)
|
|
1687
|
+
return Orientation.Portrait;
|
|
1688
|
+
else
|
|
1689
|
+
return Orientation.Landscape;
|
|
1690
|
+
}
|
|
1691
|
+
function getScale() {
|
|
1692
|
+
if (typeof globalThis.devicePixelRatio !== 'undefined')
|
|
1693
|
+
return globalThis.devicePixelRatio;
|
|
1694
|
+
return -1;
|
|
1695
|
+
}
|
|
1696
|
+
function getEnvironment() {
|
|
1697
|
+
return {
|
|
1698
|
+
safeAreaInset: {
|
|
1699
|
+
get value() {
|
|
1700
|
+
return safeAreaInsetObserver.get();
|
|
1701
|
+
},
|
|
1702
|
+
onChange: safeAreaInsetObserver.onChange,
|
|
1703
|
+
},
|
|
1704
|
+
safeAreaMaxInset: {
|
|
1705
|
+
get value() {
|
|
1706
|
+
return safeAreaMaxInsetObserver.get();
|
|
1707
|
+
},
|
|
1708
|
+
onChange: safeAreaMaxInsetObserver.onChange,
|
|
1709
|
+
},
|
|
1710
|
+
keyboardInset: {
|
|
1711
|
+
get value() {
|
|
1712
|
+
return keyboardInsetObserver.get();
|
|
1713
|
+
},
|
|
1714
|
+
onChange: keyboardInsetObserver.onChange,
|
|
1715
|
+
},
|
|
1716
|
+
titlebarArea: {
|
|
1717
|
+
get value() {
|
|
1718
|
+
return titlebarAreaObserver.get();
|
|
1719
|
+
},
|
|
1720
|
+
onChange: titlebarAreaObserver.onChange,
|
|
1721
|
+
},
|
|
1722
|
+
viewportSegment: {
|
|
1723
|
+
get value() {
|
|
1724
|
+
return viewportSegmentObserver.get();
|
|
1725
|
+
},
|
|
1726
|
+
onChange: viewportSegmentObserver.onChange,
|
|
1727
|
+
},
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
function getDimension() {
|
|
1731
|
+
if (typeof globalThis.innerWidth !== 'undefined') {
|
|
1732
|
+
return {
|
|
1733
|
+
innerWidth: globalThis.innerWidth,
|
|
1734
|
+
innerHeight: globalThis.innerHeight,
|
|
1735
|
+
outerWidth: globalThis.outerWidth,
|
|
1736
|
+
outerHeight: globalThis.outerHeight,
|
|
1737
|
+
scale: getScale(),
|
|
1738
|
+
orientation: getOrientation(),
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
return FALLBACK_DIMENSION;
|
|
1742
|
+
}
|
|
1743
|
+
function attachOnChange$4() {
|
|
1744
|
+
dimensionRef = getDimension();
|
|
1745
|
+
EventListener.add(globalThis, { type: 'resize', callback: onResize });
|
|
1746
|
+
if (typeof globalThis.screen.orientation.addEventListener === 'function')
|
|
1747
|
+
EventListener.add(globalThis.screen.orientation, { type: 'change', callback: onResize });
|
|
1748
|
+
else if (typeof globalThis.orientation !== 'undefined')
|
|
1749
|
+
EventListener.add(globalThis, { type: 'orientationChange', callback: onResize });
|
|
1750
|
+
else if (MEDIA_QUERY_LIST.media !== 'not all')
|
|
1751
|
+
EventListener.add(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
|
|
1752
|
+
}
|
|
1753
|
+
function detachOnChange$4() {
|
|
1754
|
+
dimensionRef = null;
|
|
1755
|
+
EventListener.remove(globalThis, { type: 'resize', callback: onResize });
|
|
1756
|
+
if (typeof globalThis.screen.orientation.removeEventListener === 'function')
|
|
1757
|
+
EventListener.remove(globalThis.screen.orientation, { type: 'change', callback: onResize });
|
|
1758
|
+
else if (typeof globalThis.orientation !== 'undefined')
|
|
1759
|
+
EventListener.remove(globalThis, { type: 'orientationChange', callback: onResize });
|
|
1760
|
+
else if (MEDIA_QUERY_LIST.media !== 'not all')
|
|
1761
|
+
EventListener.remove(MEDIA_QUERY_LIST, { type: 'change', callback: onResize });
|
|
1762
|
+
}
|
|
1763
|
+
function onResize() {
|
|
1764
|
+
var dimension = getDimension();
|
|
1765
|
+
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)
|
|
1766
|
+
onChangeSubscriptionManager$4.emit(dimensionRef = dimension);
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
function createCustomError(name, Base) {
|
|
1770
|
+
if (Base === void 0) { Base = Error; }
|
|
1771
|
+
function CustomError(message) {
|
|
1772
|
+
if (!(this instanceof CustomError))
|
|
1773
|
+
return new CustomError(message);
|
|
1774
|
+
var error = (function () {
|
|
1775
|
+
if (typeof message === 'undefined')
|
|
1776
|
+
return new Base('');
|
|
1777
|
+
return new Base(message);
|
|
1778
|
+
})();
|
|
1779
|
+
if (typeof Object.setPrototypeOf === 'function')
|
|
1780
|
+
Object.setPrototypeOf(error, CustomError.prototype);
|
|
1781
|
+
else
|
|
1782
|
+
error.__proto__ = CustomError.prototype;
|
|
1783
|
+
error.name = name;
|
|
1784
|
+
if (typeof message !== 'undefined')
|
|
1785
|
+
error.message = message;
|
|
1786
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1787
|
+
try {
|
|
1788
|
+
Object.defineProperty(error, Symbol.toStringTag, {
|
|
1789
|
+
value: name,
|
|
1790
|
+
writable: false,
|
|
1791
|
+
enumerable: false,
|
|
1792
|
+
configurable: true
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
catch (_) {
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
1799
|
+
Error.captureStackTrace(error, CustomError);
|
|
1800
|
+
}
|
|
1801
|
+
else if (Base.captureStackTrace && typeof Base.captureStackTrace === 'function') {
|
|
1802
|
+
Base.captureStackTrace(error, CustomError);
|
|
1803
|
+
}
|
|
1804
|
+
else {
|
|
1805
|
+
try {
|
|
1806
|
+
var tempError = new Base();
|
|
1807
|
+
if (tempError.stack)
|
|
1808
|
+
error.stack = tempError.stack;
|
|
1809
|
+
}
|
|
1810
|
+
catch (_) {
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
return error;
|
|
1814
|
+
}
|
|
1815
|
+
CustomError.prototype = Object.create(Base.prototype, {
|
|
1816
|
+
constructor: {
|
|
1817
|
+
value: CustomError,
|
|
1818
|
+
writable: true,
|
|
1819
|
+
enumerable: false,
|
|
1820
|
+
configurable: true
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
try {
|
|
1824
|
+
Object.defineProperty(CustomError.prototype, 'name', {
|
|
1825
|
+
value: name,
|
|
1826
|
+
writable: true,
|
|
1827
|
+
enumerable: false,
|
|
1828
|
+
configurable: true
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
catch (_) {
|
|
1832
|
+
try {
|
|
1833
|
+
CustomError.prototype.name = name;
|
|
1834
|
+
}
|
|
1835
|
+
catch (_) {
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
try {
|
|
1839
|
+
Object.defineProperty(CustomError, 'name', {
|
|
1840
|
+
value: name,
|
|
1841
|
+
writable: false,
|
|
1842
|
+
enumerable: false,
|
|
1843
|
+
configurable: true
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
catch (_) {
|
|
1847
|
+
}
|
|
1848
|
+
return CustomError;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
var NotSupportedError = createCustomError('NotSupportedError');
|
|
1852
|
+
|
|
1853
|
+
var lastIOSVideo = null;
|
|
1854
|
+
var eventsBridged$1 = false;
|
|
1855
|
+
var activeOperation$1 = null;
|
|
1856
|
+
var pendingOperation$1 = null;
|
|
1857
|
+
var pendingTarget$1 = undefined;
|
|
1858
|
+
var pendingOptions = undefined;
|
|
1859
|
+
var expectedIsFullscreen = false;
|
|
1860
|
+
var API_VARIANTS = {
|
|
1861
|
+
standard: {
|
|
1862
|
+
enabled: 'fullscreenEnabled',
|
|
1863
|
+
element: 'fullscreenElement',
|
|
1864
|
+
request: 'requestFullscreen',
|
|
1865
|
+
exit: 'exitFullscreen',
|
|
1866
|
+
events: { change: 'fullscreenchange', error: 'fullscreenerror' },
|
|
1867
|
+
},
|
|
1868
|
+
webkit: {
|
|
1869
|
+
enabled: 'webkitFullscreenEnabled',
|
|
1870
|
+
element: 'webkitFullscreenElement',
|
|
1871
|
+
request: 'webkitRequestFullscreen',
|
|
1872
|
+
exit: 'webkitExitFullscreen',
|
|
1873
|
+
events: { change: 'webkitfullscreenchange', error: 'webkitfullscreenerror' },
|
|
1874
|
+
},
|
|
1875
|
+
moz: {
|
|
1876
|
+
enabled: 'mozFullScreenEnabled',
|
|
1877
|
+
element: 'mozFullScreenElement',
|
|
1878
|
+
request: 'mozRequestFullScreen',
|
|
1879
|
+
exit: 'mozCancelFullScreen',
|
|
1880
|
+
events: { change: 'mozfullscreenchange', error: 'mozfullscreenerror' },
|
|
1881
|
+
},
|
|
1882
|
+
ms: {
|
|
1883
|
+
enabled: 'msFullscreenEnabled',
|
|
1884
|
+
element: 'msFullscreenElement',
|
|
1885
|
+
request: 'msRequestFullscreen',
|
|
1886
|
+
exit: 'msExitFullscreen',
|
|
1887
|
+
events: { change: 'MSFullscreenChange', error: 'MSFullscreenError' },
|
|
1888
|
+
},
|
|
1889
|
+
};
|
|
1890
|
+
var api = detectApi();
|
|
1891
|
+
var onChangeSubscriptionManager$3 = createSubscriptionManager(attachOnChange$3, detachOnChange$3);
|
|
1892
|
+
var onErrorSubscriptionManager$1 = createSubscriptionManager(attachOnError$1, detachOnError$1);
|
|
1893
|
+
var Fullscreen = {
|
|
1894
|
+
get supported() {
|
|
1895
|
+
return getEnabled$1();
|
|
1896
|
+
},
|
|
1897
|
+
get element() {
|
|
1898
|
+
return getElement$1();
|
|
1899
|
+
},
|
|
1900
|
+
get isFullscreen() {
|
|
1901
|
+
return getIsFullscreen();
|
|
1902
|
+
},
|
|
1903
|
+
request: request$3,
|
|
1904
|
+
exit: exit$1,
|
|
1905
|
+
toggle: toggle$1,
|
|
1906
|
+
onChange: onChangeSubscriptionManager$3.subscribe,
|
|
1907
|
+
onError: onErrorSubscriptionManager$1.subscribe,
|
|
1908
|
+
Constants: {},
|
|
1909
|
+
Errors: {
|
|
1910
|
+
NotSupportedError: NotSupportedError,
|
|
1911
|
+
},
|
|
1912
|
+
};
|
|
1913
|
+
function detectApi() {
|
|
1914
|
+
var element = globalThis.document.documentElement;
|
|
1915
|
+
if (typeof globalThis.document.fullscreenEnabled !== 'undefined' || typeof globalThis.document.exitFullscreen !== 'undefined')
|
|
1916
|
+
return API_VARIANTS.standard;
|
|
1917
|
+
var keys = ['webkit', 'moz', 'ms'];
|
|
1918
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1919
|
+
var key = keys[i];
|
|
1920
|
+
var variant = API_VARIANTS[key];
|
|
1921
|
+
if (typeof globalThis.document[variant.enabled] !== 'undefined' || typeof globalThis.document[variant.element] !== 'undefined' || typeof globalThis.document[variant.exit] !== 'undefined') {
|
|
1922
|
+
if (key === 'webkit' && typeof element.webkitRequestFullScreen !== 'undefined')
|
|
1923
|
+
variant.request = 'webkitRequestFullScreen';
|
|
1924
|
+
return variant;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
return null;
|
|
1928
|
+
}
|
|
1929
|
+
function getDefaultTarget$1() {
|
|
1930
|
+
if (Platform.os.name === OS.iOS) {
|
|
1931
|
+
var video = globalThis.document.querySelector('video');
|
|
1932
|
+
if (video === null)
|
|
1933
|
+
return undefined;
|
|
1934
|
+
return video;
|
|
1935
|
+
}
|
|
1936
|
+
return globalThis.document.documentElement;
|
|
1937
|
+
}
|
|
1938
|
+
function bridgeEvents$1() {
|
|
1939
|
+
if (eventsBridged$1)
|
|
1940
|
+
return;
|
|
1941
|
+
eventsBridged$1 = true;
|
|
1942
|
+
if (Platform.os.name === OS.iOS) {
|
|
1943
|
+
bridgeIOSVideoEvents();
|
|
1944
|
+
if (typeof globalThis.MutationObserver !== 'undefined') {
|
|
1945
|
+
var observer = new MutationObserver(function () {
|
|
1946
|
+
bridgeIOSVideoEvents();
|
|
1947
|
+
});
|
|
1948
|
+
observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
|
|
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.__fsBridged__ || !(typeof video.webkitEnterFullscreen !== 'undefined' || typeof video.onwebkitbeginfullscreen !== 'undefined'))
|
|
1958
|
+
return;
|
|
1959
|
+
EventListener.add(video, { type: 'webkitbeginfullscreen', callback: onChangeSubscriptionManager$3.emit, options: false });
|
|
1960
|
+
EventListener.add(video, { type: 'webkitendfullscreen', callback: onChangeSubscriptionManager$3.emit, options: false });
|
|
1961
|
+
video.__fsBridged__ = true;
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function attachOnChange$3() {
|
|
1965
|
+
var changeEvents = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
|
|
1966
|
+
for (var i = 0; i < changeEvents.length; i++)
|
|
1967
|
+
EventListener.add(globalThis.document, { type: changeEvents[i], callback: onChangeSubscriptionManager$3.emit, options: false });
|
|
1968
|
+
}
|
|
1969
|
+
function detachOnChange$3() {
|
|
1970
|
+
var changeEvents = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
|
|
1971
|
+
for (var i = 0; i < changeEvents.length; i++)
|
|
1972
|
+
EventListener.remove(globalThis.document, { type: changeEvents[i], callback: onChangeSubscriptionManager$3.emit, options: false });
|
|
1973
|
+
}
|
|
1974
|
+
function attachOnError$1() {
|
|
1975
|
+
var errorEvents = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
|
|
1976
|
+
for (var i = 0; i < errorEvents.length; i++)
|
|
1977
|
+
EventListener.add(globalThis.document, { type: errorEvents[i], callback: onErrorSubscriptionManager$1.emit, options: false });
|
|
1978
|
+
}
|
|
1979
|
+
function detachOnError$1() {
|
|
1980
|
+
var errorEvents = ['fullscreenerror', 'webkitfullscreenerror', 'mozfullscreenerror', 'MSFullscreenError'];
|
|
1981
|
+
for (var i = 0; i < errorEvents.length; i++)
|
|
1982
|
+
EventListener.remove(globalThis.document, { type: errorEvents[i], callback: onErrorSubscriptionManager$1.emit, options: false });
|
|
1983
|
+
}
|
|
1984
|
+
function getEnabled$1() {
|
|
1985
|
+
if (api === null)
|
|
1986
|
+
return Platform.os.name === OS.iOS && globalThis.HTMLVideoElement.prototype.webkitSupportsFullscreen === true;
|
|
1987
|
+
return globalThis.document[api.enabled] === true;
|
|
1988
|
+
}
|
|
1989
|
+
function getElement$1() {
|
|
1990
|
+
if (api === null) {
|
|
1991
|
+
if (lastIOSVideo !== null && lastIOSVideo.webkitDisplayingFullscreen === true)
|
|
1992
|
+
return lastIOSVideo;
|
|
1993
|
+
return null;
|
|
1994
|
+
}
|
|
1995
|
+
var currentElement = globalThis.document[api.element];
|
|
1996
|
+
if (typeof currentElement !== 'undefined')
|
|
1997
|
+
return currentElement;
|
|
1998
|
+
return null;
|
|
1999
|
+
}
|
|
2000
|
+
function getIsFullscreen() {
|
|
2001
|
+
return getElement$1() !== null;
|
|
2002
|
+
}
|
|
2003
|
+
function drainPendingOperation$1() {
|
|
2004
|
+
if (pendingOperation$1 === null) {
|
|
2005
|
+
activeOperation$1 = Promise.resolve().then(function () {
|
|
2006
|
+
if (pendingOperation$1 === null) {
|
|
2007
|
+
activeOperation$1 = null;
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
drainPendingOperation$1();
|
|
2011
|
+
});
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
var operation = pendingOperation$1;
|
|
2015
|
+
var target = pendingTarget$1;
|
|
2016
|
+
var options = pendingOptions;
|
|
2017
|
+
pendingOperation$1 = null;
|
|
2018
|
+
pendingTarget$1 = undefined;
|
|
2019
|
+
pendingOptions = undefined;
|
|
2020
|
+
var next;
|
|
2021
|
+
if (operation === 'request')
|
|
2022
|
+
next = requestImmediately$1(target, options);
|
|
2023
|
+
else
|
|
2024
|
+
next = exitImmediately$1();
|
|
2025
|
+
activeOperation$1 = next
|
|
2026
|
+
.then(drainPendingOperation$1)
|
|
2027
|
+
.catch(drainPendingOperation$1);
|
|
2028
|
+
}
|
|
2029
|
+
function request$3(target, options) {
|
|
2030
|
+
expectedIsFullscreen = true;
|
|
2031
|
+
if (activeOperation$1 === null) {
|
|
2032
|
+
var next = requestImmediately$1(target, options);
|
|
2033
|
+
activeOperation$1 = next
|
|
2034
|
+
.then(drainPendingOperation$1)
|
|
2035
|
+
.catch(drainPendingOperation$1);
|
|
2036
|
+
return next;
|
|
2037
|
+
}
|
|
2038
|
+
pendingOperation$1 = 'request';
|
|
2039
|
+
pendingTarget$1 = target;
|
|
2040
|
+
pendingOptions = options;
|
|
2041
|
+
return activeOperation$1.then(function () {
|
|
2042
|
+
return Promise.resolve();
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
function exit$1() {
|
|
2046
|
+
expectedIsFullscreen = false;
|
|
2047
|
+
if (activeOperation$1 === null) {
|
|
2048
|
+
var next = exitImmediately$1();
|
|
2049
|
+
activeOperation$1 = next
|
|
2050
|
+
.then(drainPendingOperation$1)
|
|
2051
|
+
.catch(drainPendingOperation$1);
|
|
2052
|
+
return next;
|
|
2053
|
+
}
|
|
2054
|
+
pendingOperation$1 = 'exit';
|
|
2055
|
+
pendingTarget$1 = undefined;
|
|
2056
|
+
pendingOptions = undefined;
|
|
2057
|
+
return activeOperation$1.then(function () {
|
|
2058
|
+
return Promise.resolve();
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
function requestImmediately$1(target, options) {
|
|
2062
|
+
return new Promise(function (resolve, reject) {
|
|
2063
|
+
if (typeof target === 'undefined')
|
|
2064
|
+
target = getDefaultTarget$1();
|
|
2065
|
+
if (typeof target === 'undefined')
|
|
2066
|
+
return reject(new NotSupportedError('Failed to enter fullscreen mode.'));
|
|
2067
|
+
var tagName = target.tagName.toLowerCase();
|
|
2068
|
+
if (api !== null) {
|
|
2069
|
+
var method = target[api.request];
|
|
2070
|
+
if (typeof method === 'function') {
|
|
2071
|
+
var result = method.call(target, options);
|
|
2072
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
2073
|
+
result
|
|
2074
|
+
.then(resolve)
|
|
2075
|
+
.catch(function () {
|
|
2076
|
+
if (Platform.os.name !== OS.iOS)
|
|
2077
|
+
return reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
2078
|
+
fallbackToIOSVideo();
|
|
2079
|
+
});
|
|
2080
|
+
return;
|
|
2081
|
+
}
|
|
2082
|
+
else {
|
|
2083
|
+
return resolve();
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
function fallbackToIOSVideo() {
|
|
2088
|
+
if (Platform.os.name === OS.iOS && typeof target !== 'undefined' && target.tagName.toUpperCase() === 'VIDEO') {
|
|
2089
|
+
var video = target;
|
|
2090
|
+
if (video.webkitSupportsFullscreen && typeof video.webkitEnterFullscreen === 'function') {
|
|
2091
|
+
lastIOSVideo = video;
|
|
2092
|
+
bridgeIOSVideoEvents();
|
|
2093
|
+
video.webkitEnterFullscreen();
|
|
2094
|
+
return resolve();
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
reject(new NotSupportedError('The "' + tagName + '" element does not support fullscreen requests.'));
|
|
2098
|
+
}
|
|
2099
|
+
fallbackToIOSVideo();
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2102
|
+
function exitImmediately$1() {
|
|
2103
|
+
return new Promise(function (resolve, reject) {
|
|
2104
|
+
if (api !== null) {
|
|
2105
|
+
var method = globalThis.document[api.exit];
|
|
2106
|
+
if (typeof method === 'function') {
|
|
2107
|
+
var result = method.call(globalThis.document);
|
|
2108
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
2109
|
+
result
|
|
2110
|
+
.then(resolve)
|
|
2111
|
+
.catch(function () {
|
|
2112
|
+
if (Platform.os.name !== OS.iOS)
|
|
2113
|
+
return reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
2114
|
+
fallbackToIOSVideo();
|
|
2115
|
+
});
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
else {
|
|
2119
|
+
return resolve();
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
function fallbackToIOSVideo() {
|
|
2124
|
+
if (Platform.os.name === OS.iOS) {
|
|
2125
|
+
if (lastIOSVideo !== null) {
|
|
2126
|
+
if (typeof lastIOSVideo.webkitExitFullscreen === 'function' && lastIOSVideo.webkitDisplayingFullscreen === true) {
|
|
2127
|
+
lastIOSVideo.webkitExitFullscreen();
|
|
2128
|
+
lastIOSVideo = null;
|
|
2129
|
+
return resolve();
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
2133
|
+
for (var i = 0; i < videos.length; i++) {
|
|
2134
|
+
var video = videos[i];
|
|
2135
|
+
if (typeof video.webkitExitFullscreen === 'function' && video.webkitDisplayingFullscreen === true) {
|
|
2136
|
+
video.webkitExitFullscreen();
|
|
2137
|
+
lastIOSVideo = null;
|
|
2138
|
+
return resolve();
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
fallbackToIOSVideo();
|
|
2144
|
+
if (getElement$1() === null)
|
|
2145
|
+
return resolve();
|
|
2146
|
+
reject(new NotSupportedError('Failed to exit fullscreen mode.'));
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
function toggle$1(target, options) {
|
|
2150
|
+
if (expectedIsFullscreen)
|
|
2151
|
+
return exit$1();
|
|
2152
|
+
return request$3(target, options);
|
|
2153
|
+
}
|
|
2154
|
+
bridgeEvents$1();
|
|
2155
|
+
|
|
2156
|
+
var PermissionType;
|
|
2157
|
+
(function (PermissionType) {
|
|
2158
|
+
PermissionType["Notification"] = "notifications";
|
|
2159
|
+
PermissionType["Geolocation"] = "geolocation";
|
|
2160
|
+
PermissionType["Camera"] = "camera";
|
|
2161
|
+
PermissionType["Microphone"] = "microphone";
|
|
2162
|
+
PermissionType["MIDI"] = "midi";
|
|
2163
|
+
})(PermissionType || (PermissionType = {}));
|
|
2164
|
+
var PermissionState;
|
|
2165
|
+
(function (PermissionState) {
|
|
2166
|
+
PermissionState["Grant"] = "grant";
|
|
2167
|
+
PermissionState["Denied"] = "denied";
|
|
2168
|
+
PermissionState["Prompt"] = "prompt";
|
|
2169
|
+
PermissionState["Unsupported"] = "unsupported";
|
|
2170
|
+
})(PermissionState || (PermissionState = {}));
|
|
2171
|
+
var GET_USER_MEDIA = (function () {
|
|
2172
|
+
if (typeof globalThis.navigator.mediaDevices !== 'undefined' && typeof globalThis.navigator.mediaDevices.getUserMedia !== 'undefined')
|
|
2173
|
+
return globalThis.navigator.mediaDevices.getUserMedia.bind(globalThis.navigator.mediaDevices);
|
|
2174
|
+
var legacy = (function () {
|
|
2175
|
+
if (typeof globalThis.navigator.getUserMedia !== 'undefined')
|
|
2176
|
+
return globalThis.navigator.getUserMedia;
|
|
2177
|
+
if (typeof globalThis.navigator.webkitGetUserMedia !== 'undefined')
|
|
2178
|
+
return globalThis.navigator.webkitGetUserMedia;
|
|
2179
|
+
if (typeof globalThis.navigator.mozGetUserMedia !== 'undefined')
|
|
2180
|
+
return globalThis.navigator.mozGetUserMedia;
|
|
2181
|
+
if (typeof globalThis.navigator.msGetUserMedia !== 'undefined')
|
|
2182
|
+
return globalThis.navigator.msGetUserMedia;
|
|
2183
|
+
})();
|
|
2184
|
+
if (typeof legacy !== 'undefined') {
|
|
2185
|
+
return function legacyUserMedia(constraints) {
|
|
2186
|
+
if (constraints === void 0) { constraints = {}; }
|
|
2187
|
+
return new Promise(function (resolve, reject) {
|
|
2188
|
+
legacy.call(globalThis.navigator, constraints, resolve, reject);
|
|
2189
|
+
});
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
})();
|
|
2193
|
+
|
|
2194
|
+
var Permission = {
|
|
2195
|
+
request: request$2,
|
|
2196
|
+
check: check,
|
|
2197
|
+
Constants: {
|
|
2198
|
+
PermissionType: PermissionType,
|
|
2199
|
+
PermissionState: PermissionState,
|
|
2200
|
+
},
|
|
2201
|
+
Errors: {},
|
|
2202
|
+
};
|
|
2203
|
+
function request$2(type) {
|
|
2204
|
+
var instance = this;
|
|
2205
|
+
return new Promise(function (resolve) {
|
|
2206
|
+
function resolveAfterCheck() {
|
|
2207
|
+
instance.check(type).then(resolve);
|
|
2208
|
+
}
|
|
2209
|
+
instance.check(type)
|
|
2210
|
+
.then(function (state) {
|
|
2211
|
+
if (state === PermissionState.Grant)
|
|
2212
|
+
return resolve(state);
|
|
2213
|
+
switch (type) {
|
|
2214
|
+
case PermissionType.Notification:
|
|
2215
|
+
if (typeof globalThis.Notification === 'undefined')
|
|
2216
|
+
return resolve(PermissionState.Unsupported);
|
|
2217
|
+
globalThis.Notification.requestPermission().then(function (value) {
|
|
2218
|
+
switch (value) {
|
|
2219
|
+
case 'default':
|
|
2220
|
+
return resolve(PermissionState.Prompt);
|
|
2221
|
+
case 'granted':
|
|
2222
|
+
return resolve(PermissionState.Grant);
|
|
2223
|
+
case 'denied':
|
|
2224
|
+
return resolve(PermissionState.Denied);
|
|
2225
|
+
default:
|
|
2226
|
+
resolveAfterCheck();
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
break;
|
|
2230
|
+
case PermissionType.Geolocation:
|
|
2231
|
+
if (typeof globalThis.navigator.geolocation === 'undefined')
|
|
2232
|
+
return resolve(PermissionState.Unsupported);
|
|
2233
|
+
globalThis.navigator.geolocation.getCurrentPosition(resolveAfterCheck, resolveAfterCheck);
|
|
2234
|
+
break;
|
|
2235
|
+
case PermissionType.Microphone:
|
|
2236
|
+
case PermissionType.Camera:
|
|
2237
|
+
if (typeof GET_USER_MEDIA === 'undefined')
|
|
2238
|
+
return resolve(PermissionState.Unsupported);
|
|
2239
|
+
GET_USER_MEDIA({
|
|
2240
|
+
video: type === PermissionType.Camera,
|
|
2241
|
+
audio: type === PermissionType.Microphone,
|
|
2242
|
+
})
|
|
2243
|
+
.then(function (stream) {
|
|
2244
|
+
var tracks = stream.getTracks();
|
|
2245
|
+
for (var i = 0; i < tracks.length; i++)
|
|
2246
|
+
tracks[i].stop();
|
|
2247
|
+
resolveAfterCheck();
|
|
2248
|
+
})
|
|
2249
|
+
.catch(resolveAfterCheck);
|
|
2250
|
+
break;
|
|
2251
|
+
case PermissionType.MIDI:
|
|
2252
|
+
if (typeof globalThis.navigator.requestMIDIAccess === 'undefined')
|
|
2253
|
+
return resolve(PermissionState.Unsupported);
|
|
2254
|
+
globalThis.navigator.requestMIDIAccess()
|
|
2255
|
+
.then(resolveAfterCheck)
|
|
2256
|
+
.catch(resolveAfterCheck);
|
|
2257
|
+
break;
|
|
2258
|
+
default:
|
|
2259
|
+
return resolve(PermissionState.Unsupported);
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
function check(type) {
|
|
2265
|
+
return new Promise(function (resolve) {
|
|
2266
|
+
if (typeof globalThis.navigator.permissions === 'undefined')
|
|
2267
|
+
return resolve(PermissionState.Unsupported);
|
|
2268
|
+
globalThis.navigator.permissions.query({ name: type })
|
|
2269
|
+
.then(function (status) {
|
|
2270
|
+
switch (status.state) {
|
|
2271
|
+
case 'prompt':
|
|
2272
|
+
return resolve(PermissionState.Prompt);
|
|
2273
|
+
case 'granted':
|
|
2274
|
+
return resolve(PermissionState.Grant);
|
|
2275
|
+
case 'denied':
|
|
2276
|
+
return resolve(PermissionState.Denied);
|
|
2277
|
+
default:
|
|
2278
|
+
return resolve(PermissionState.Unsupported);
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
var PermissionNotGrantedError = createCustomError('PermissionNotGrantedError');
|
|
2285
|
+
|
|
2286
|
+
function request$1(url, options) {
|
|
2287
|
+
return new Promise(function (resolve) {
|
|
2288
|
+
var method = 'GET';
|
|
2289
|
+
var headers = {};
|
|
2290
|
+
var body = undefined;
|
|
2291
|
+
if (typeof globalThis.fetch !== 'undefined') {
|
|
2292
|
+
fetch(url, {
|
|
2293
|
+
method: method,
|
|
2294
|
+
headers: headers,
|
|
2295
|
+
body: body
|
|
2296
|
+
})
|
|
2297
|
+
.then(function (response) {
|
|
2298
|
+
if (!response.ok) {
|
|
2299
|
+
resolve(undefined);
|
|
2300
|
+
return Promise.resolve();
|
|
2301
|
+
}
|
|
2302
|
+
return response
|
|
2303
|
+
.json()
|
|
2304
|
+
.then(function (data) {
|
|
2305
|
+
resolve(data);
|
|
2306
|
+
})
|
|
2307
|
+
.catch(function () {
|
|
2308
|
+
resolve(undefined);
|
|
2309
|
+
});
|
|
2310
|
+
})
|
|
2311
|
+
.catch(function () {
|
|
2312
|
+
resolve(undefined);
|
|
2313
|
+
});
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
if (typeof XMLHttpRequest !== "undefined") {
|
|
2317
|
+
var xhr_1 = new XMLHttpRequest();
|
|
2318
|
+
xhr_1.open(method, url, true);
|
|
2319
|
+
var headerKeys = keys(headers);
|
|
2320
|
+
for (var i = 0; i < headerKeys.length; i++) {
|
|
2321
|
+
var headerKey = headerKeys[i];
|
|
2322
|
+
xhr_1.setRequestHeader(headerKey, headers[headerKey]);
|
|
2323
|
+
}
|
|
2324
|
+
xhr_1.onreadystatechange = function () {
|
|
2325
|
+
if (xhr_1.readyState !== 4)
|
|
2326
|
+
return;
|
|
2327
|
+
if (xhr_1.status >= 200 && xhr_1.status < 300) {
|
|
2328
|
+
try {
|
|
2329
|
+
resolve(JSON.parse(xhr_1.responseText));
|
|
2330
|
+
}
|
|
2331
|
+
catch (_) {
|
|
2332
|
+
resolve(undefined);
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
else {
|
|
2336
|
+
resolve(undefined);
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
xhr_1.onerror = function () {
|
|
2340
|
+
resolve(undefined);
|
|
2341
|
+
};
|
|
2342
|
+
xhr_1.send(body);
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
resolve(undefined);
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
|
|
7
2349
|
function assign() {
|
|
8
2350
|
var args = [];
|
|
9
2351
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -20,94 +2362,1960 @@ function assign() {
|
|
|
20
2362
|
to[key] = src[key];
|
|
21
2363
|
}
|
|
22
2364
|
}
|
|
23
|
-
return to;
|
|
2365
|
+
return to;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
var onChangeSubscriptionManager$2 = createSubscriptionManager(attachOnChange$2, detachOnChange$2);
|
|
2369
|
+
var watchIdRef = null;
|
|
2370
|
+
var Geolocation = {
|
|
2371
|
+
get value() {
|
|
2372
|
+
return getValue$1();
|
|
2373
|
+
},
|
|
2374
|
+
get supported() {
|
|
2375
|
+
return supported$4();
|
|
2376
|
+
},
|
|
2377
|
+
onChange: onChangeSubscriptionManager$2.subscribe,
|
|
2378
|
+
Constants: {},
|
|
2379
|
+
Errors: {
|
|
2380
|
+
NotSupportedError: NotSupportedError,
|
|
2381
|
+
PermissionNotGrantedError: PermissionNotGrantedError,
|
|
2382
|
+
},
|
|
2383
|
+
};
|
|
2384
|
+
function getValue$1() {
|
|
2385
|
+
return new Promise(function (resolve, reject) {
|
|
2386
|
+
function fallback(error) {
|
|
2387
|
+
getFallbackValue(error)
|
|
2388
|
+
.then(resolve)
|
|
2389
|
+
.catch(reject);
|
|
2390
|
+
}
|
|
2391
|
+
if (!supported$4()) {
|
|
2392
|
+
return fallback(new NotSupportedError('\'navigator.geolocation\' does not supported.'));
|
|
2393
|
+
}
|
|
2394
|
+
else {
|
|
2395
|
+
Permission
|
|
2396
|
+
.request(PermissionType.Geolocation)
|
|
2397
|
+
.then(function (state) {
|
|
2398
|
+
if (state === PermissionState.Grant) {
|
|
2399
|
+
globalThis.navigator.geolocation.getCurrentPosition(function (position) {
|
|
2400
|
+
resolve(position.coords);
|
|
2401
|
+
}, function (error) {
|
|
2402
|
+
return fallback(normalizeError(error));
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
else {
|
|
2406
|
+
return fallback(new PermissionNotGrantedError('\'geolocation\' permission is not granted.'));
|
|
2407
|
+
}
|
|
2408
|
+
});
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
function getFallbackValue(error) {
|
|
2413
|
+
return new Promise(function (resolve, reject) {
|
|
2414
|
+
request$1('http://ip-api.com/json?fields=lat,lon')
|
|
2415
|
+
.then(function (response) {
|
|
2416
|
+
if (typeof response !== 'undefined') {
|
|
2417
|
+
var coordinate_1 = {
|
|
2418
|
+
latitude: response.lat,
|
|
2419
|
+
longitude: response.lon,
|
|
2420
|
+
accuracy: -1,
|
|
2421
|
+
altitude: null,
|
|
2422
|
+
altitudeAccuracy: null,
|
|
2423
|
+
heading: null,
|
|
2424
|
+
speed: null
|
|
2425
|
+
};
|
|
2426
|
+
resolve(assign(coordinate_1, {
|
|
2427
|
+
toJSON: function () {
|
|
2428
|
+
return coordinate_1;
|
|
2429
|
+
}
|
|
2430
|
+
}));
|
|
2431
|
+
}
|
|
2432
|
+
else {
|
|
2433
|
+
reject(error);
|
|
2434
|
+
}
|
|
2435
|
+
})
|
|
2436
|
+
.catch(function () {
|
|
2437
|
+
reject(error);
|
|
2438
|
+
});
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
function normalizeError(error) {
|
|
2442
|
+
switch (error.code) {
|
|
2443
|
+
case GeolocationPositionError.PERMISSION_DENIED:
|
|
2444
|
+
return new PermissionNotGrantedError('\'geolocation\' permission is not granted.');
|
|
2445
|
+
case GeolocationPositionError.POSITION_UNAVAILABLE:
|
|
2446
|
+
return new NotSupportedError('The acquisition of the geolocation failed because at least one internal source of position returned an internal error.');
|
|
2447
|
+
case GeolocationPositionError.TIMEOUT:
|
|
2448
|
+
return new NotSupportedError('The time allowed to acquire the geolocation was reached before the information was obtained.');
|
|
2449
|
+
default:
|
|
2450
|
+
return new NotSupportedError('Unknown error.');
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
function attachOnChange$2() {
|
|
2454
|
+
if (!supported$4())
|
|
2455
|
+
return;
|
|
2456
|
+
Permission
|
|
2457
|
+
.request(PermissionType.Geolocation)
|
|
2458
|
+
.then(function (state) {
|
|
2459
|
+
if (state === PermissionState.Grant) {
|
|
2460
|
+
watchIdRef = globalThis.navigator.geolocation.watchPosition(function (position) {
|
|
2461
|
+
onGeolocationCoordinatesChange(position.coords);
|
|
2462
|
+
});
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
function detachOnChange$2() {
|
|
2467
|
+
if (!supported$4() || watchIdRef === null)
|
|
2468
|
+
return;
|
|
2469
|
+
globalThis.navigator.geolocation.clearWatch(watchIdRef);
|
|
2470
|
+
}
|
|
2471
|
+
function onGeolocationCoordinatesChange(coordinates) {
|
|
2472
|
+
onChangeSubscriptionManager$2.emit(coordinates);
|
|
2473
|
+
}
|
|
2474
|
+
function supported$4() {
|
|
2475
|
+
return typeof globalThis.navigator.geolocation !== 'undefined';
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
var _a, _b, _c, _d, _e;
|
|
2479
|
+
var AppOpenState;
|
|
2480
|
+
(function (AppOpenState) {
|
|
2481
|
+
AppOpenState[AppOpenState["Scheme"] = 0] = "Scheme";
|
|
2482
|
+
AppOpenState[AppOpenState["Universal"] = 1] = "Universal";
|
|
2483
|
+
AppOpenState[AppOpenState["Intent"] = 2] = "Intent";
|
|
2484
|
+
AppOpenState[AppOpenState["Fallback"] = 3] = "Fallback";
|
|
2485
|
+
AppOpenState[AppOpenState["Store"] = 4] = "Store";
|
|
2486
|
+
})(AppOpenState || (AppOpenState = {}));
|
|
2487
|
+
var SettingType;
|
|
2488
|
+
(function (SettingType) {
|
|
2489
|
+
SettingType["General"] = "general";
|
|
2490
|
+
SettingType["Network"] = "network";
|
|
2491
|
+
SettingType["Display"] = "display";
|
|
2492
|
+
SettingType["Appearance"] = "appearance";
|
|
2493
|
+
SettingType["Accessibility"] = "accessibility";
|
|
2494
|
+
SettingType["Battery"] = "battery";
|
|
2495
|
+
SettingType["Datetime"] = "datetime";
|
|
2496
|
+
SettingType["Language"] = "language";
|
|
2497
|
+
SettingType["Accounts"] = "accounts";
|
|
2498
|
+
SettingType["Storage"] = "storage";
|
|
2499
|
+
})(SettingType || (SettingType = {}));
|
|
2500
|
+
var CameraType;
|
|
2501
|
+
(function (CameraType) {
|
|
2502
|
+
CameraType["Image"] = "image";
|
|
2503
|
+
CameraType["Video"] = "video";
|
|
2504
|
+
})(CameraType || (CameraType = {}));
|
|
2505
|
+
var CaptureType;
|
|
2506
|
+
(function (CaptureType) {
|
|
2507
|
+
CaptureType["User"] = "user";
|
|
2508
|
+
CaptureType["Environment"] = "environment";
|
|
2509
|
+
})(CaptureType || (CaptureType = {}));
|
|
2510
|
+
var SETTING_URL = (_a = {},
|
|
2511
|
+
_a[OS.Android] = (_b = {},
|
|
2512
|
+
_b[SettingType.General] = 'intent:#Intent;action=android.settings.SETTINGS;end',
|
|
2513
|
+
_b[SettingType.Network] = 'intent:#Intent;action=android.settings.WIFI_SETTINGS;end',
|
|
2514
|
+
_b[SettingType.Display] = 'intent:#Intent;action=android.settings.DISPLAY_SETTINGS;end',
|
|
2515
|
+
_b[SettingType.Appearance] = 'intent:#Intent;action=android.settings.DISPLAY_SETTINGS;end',
|
|
2516
|
+
_b[SettingType.Accessibility] = 'intent:#Intent;action=android.settings.ACCESSIBILITY_SETTINGS;end',
|
|
2517
|
+
_b[SettingType.Battery] = 'intent:#Intent;action=android.settings.BATTERY_SAVER_SETTINGS;end',
|
|
2518
|
+
_b[SettingType.Datetime] = 'intent:#Intent;action=android.settings.DATE_SETTINGS;end',
|
|
2519
|
+
_b[SettingType.Language] = 'intent:#Intent;action=android.settings.LOCALE_SETTINGS;end',
|
|
2520
|
+
_b[SettingType.Accounts] = 'intent:#Intent;action=android.settings.SYNC_SETTINGS;end',
|
|
2521
|
+
_b[SettingType.Storage] = 'intent:#Intent;action=android.settings.INTERNAL_STORAGE_SETTINGS;end',
|
|
2522
|
+
_b),
|
|
2523
|
+
_a[OS.Windows] = (_c = {},
|
|
2524
|
+
_c[SettingType.General] = 'ms-settings:system',
|
|
2525
|
+
_c[SettingType.Network] = 'ms-settings:network',
|
|
2526
|
+
_c[SettingType.Display] = 'ms-settings:display',
|
|
2527
|
+
_c[SettingType.Appearance] = 'ms-settings:colors',
|
|
2528
|
+
_c[SettingType.Accessibility] = 'ms-settings:easeofaccess',
|
|
2529
|
+
_c[SettingType.Battery] = 'ms-settings:batterysaver',
|
|
2530
|
+
_c[SettingType.Datetime] = 'ms-settings:dateandtime',
|
|
2531
|
+
_c[SettingType.Language] = 'ms-settings:regionlanguage',
|
|
2532
|
+
_c[SettingType.Accounts] = 'ms-settings:emailandaccounts',
|
|
2533
|
+
_c[SettingType.Storage] = 'ms-settings:storagesense',
|
|
2534
|
+
_c),
|
|
2535
|
+
_a[OS.MacOS] = (_d = {},
|
|
2536
|
+
_d[SettingType.General] = 'x-apple.systempreferences:',
|
|
2537
|
+
_d[SettingType.Network] = 'x-apple.systempreferences:com.apple.preference.network',
|
|
2538
|
+
_d[SettingType.Display] = 'x-apple.systempreferences:com.apple.preference.displays',
|
|
2539
|
+
_d[SettingType.Appearance] = 'x-apple.systempreferences:com.apple.preference.general',
|
|
2540
|
+
_d[SettingType.Accessibility] = 'x-apple.systempreferences:com.apple.preference.universalaccess',
|
|
2541
|
+
_d[SettingType.Battery] = 'x-apple.systempreferences:com.apple.preference.energysaver',
|
|
2542
|
+
_d[SettingType.Datetime] = 'x-apple.systempreferences:com.apple.preference.datetime',
|
|
2543
|
+
_d[SettingType.Language] = 'x-apple.systempreferences:com.apple.Localization',
|
|
2544
|
+
_d[SettingType.Accounts] = 'x-apple.systempreferences:com.apple.preferences.internetaccounts',
|
|
2545
|
+
_d[SettingType.Storage] = 'x-apple.systempreferences:',
|
|
2546
|
+
_d),
|
|
2547
|
+
_a['MacOS13+'] = (_e = {},
|
|
2548
|
+
_e[SettingType.General] = 'x-apple.systempreferences:com.apple.General-Settings.extension',
|
|
2549
|
+
_e[SettingType.Network] = 'x-apple.systempreferences:com.apple.Network-Settings.extension',
|
|
2550
|
+
_e[SettingType.Display] = 'x-apple.systempreferences:com.apple.Displays-Settings.extension',
|
|
2551
|
+
_e[SettingType.Appearance] = 'x-apple.systempreferences:com.apple.Appearance-Settings.extension',
|
|
2552
|
+
_e[SettingType.Accessibility] = 'x-apple.systempreferences:com.apple.Accessibility-Settings.extension',
|
|
2553
|
+
_e[SettingType.Battery] = 'x-apple.systempreferences:com.apple.Battery-Settings.extension',
|
|
2554
|
+
_e[SettingType.Datetime] = 'x-apple.systempreferences:com.apple.Date-Time-Settings.extension',
|
|
2555
|
+
_e[SettingType.Language] = 'x-apple.systempreferences:com.apple.Localization-Settings.extension',
|
|
2556
|
+
_e[SettingType.Accounts] = 'x-apple.systempreferences:com.apple.Internet-Accounts-Settings.extension',
|
|
2557
|
+
_e[SettingType.Storage] = 'x-apple.systempreferences:com.apple.settings.Storage',
|
|
2558
|
+
_e),
|
|
2559
|
+
_a);
|
|
2560
|
+
|
|
2561
|
+
function getTopmostWindow() {
|
|
2562
|
+
try {
|
|
2563
|
+
if (globalThis.top !== null && globalThis.top !== globalThis.window) {
|
|
2564
|
+
void globalThis.top.location.href;
|
|
2565
|
+
return globalThis.top;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
catch (_) {
|
|
2569
|
+
}
|
|
2570
|
+
return window;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
function dispatchClickEvent(element, view) {
|
|
2574
|
+
if (view === void 0) { view = window; }
|
|
2575
|
+
var fake;
|
|
2576
|
+
try {
|
|
2577
|
+
fake = new MouseEvent('click', {
|
|
2578
|
+
bubbles: true,
|
|
2579
|
+
cancelable: true,
|
|
2580
|
+
view: view
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
catch (_) {
|
|
2584
|
+
fake = globalThis.document.createEvent('MouseEvents');
|
|
2585
|
+
fake.initMouseEvent('click', true, true, view, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
2586
|
+
}
|
|
2587
|
+
element.dispatchEvent(fake);
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
function now() {
|
|
2591
|
+
if (typeof Date.now === 'function')
|
|
2592
|
+
return Date.now();
|
|
2593
|
+
return (new Date).getTime();
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
function randomString(length) {
|
|
2597
|
+
var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
2598
|
+
var result = '';
|
|
2599
|
+
var seed = new Date().getTime();
|
|
2600
|
+
for (var i = 0; i < length; i++) {
|
|
2601
|
+
seed = (seed * 9301 + 49297) % 233280;
|
|
2602
|
+
result += chars.charAt(seed % 62);
|
|
2603
|
+
}
|
|
2604
|
+
return result;
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
function padStart(string, length, pad) {
|
|
2608
|
+
length = length >> 0;
|
|
2609
|
+
if (typeof string !== 'string')
|
|
2610
|
+
string = String(string);
|
|
2611
|
+
if (string.length >= length)
|
|
2612
|
+
return string;
|
|
2613
|
+
length = length - string.length;
|
|
2614
|
+
if (length > pad.length)
|
|
2615
|
+
pad += pad.repeat(length / pad.length);
|
|
2616
|
+
return pad.slice(0, length) + string;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
var URLOpenError = createCustomError('URLOpenError');
|
|
2620
|
+
|
|
2621
|
+
var UserCancelledError = createCustomError('UserCancelledError');
|
|
2622
|
+
|
|
2623
|
+
var Open = {
|
|
2624
|
+
app: app,
|
|
2625
|
+
telephone: telephone,
|
|
2626
|
+
message: message,
|
|
2627
|
+
mail: mail,
|
|
2628
|
+
file: file,
|
|
2629
|
+
directory: directory,
|
|
2630
|
+
setting: setting,
|
|
2631
|
+
camera: camera,
|
|
2632
|
+
contact: contact,
|
|
2633
|
+
share: share,
|
|
2634
|
+
calendar: calendar,
|
|
2635
|
+
supported: {
|
|
2636
|
+
get intent() {
|
|
2637
|
+
return canOpenIntentURL();
|
|
2638
|
+
},
|
|
2639
|
+
get universal() {
|
|
2640
|
+
return canOpenUniversalURL();
|
|
2641
|
+
},
|
|
2642
|
+
get setting() {
|
|
2643
|
+
return canOpenSetting();
|
|
2644
|
+
},
|
|
2645
|
+
get directory() {
|
|
2646
|
+
return canOpenDirectory();
|
|
2647
|
+
},
|
|
2648
|
+
get camera() {
|
|
2649
|
+
return canOpenCamera();
|
|
2650
|
+
},
|
|
2651
|
+
get contact() {
|
|
2652
|
+
return canOpenContact();
|
|
2653
|
+
},
|
|
2654
|
+
get share() {
|
|
2655
|
+
return canOpenShare();
|
|
2656
|
+
},
|
|
2657
|
+
get calendar() {
|
|
2658
|
+
return canOpenCalendar();
|
|
2659
|
+
},
|
|
2660
|
+
},
|
|
2661
|
+
Constants: {
|
|
2662
|
+
AppOpenState: AppOpenState,
|
|
2663
|
+
SettingType: SettingType,
|
|
2664
|
+
CameraType: CameraType,
|
|
2665
|
+
CaptureType: CaptureType,
|
|
2666
|
+
},
|
|
2667
|
+
Errors: {
|
|
2668
|
+
URLOpenError: URLOpenError,
|
|
2669
|
+
NotSupportedError: NotSupportedError,
|
|
2670
|
+
UserCancelledError: UserCancelledError,
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
var resolveFileCleanup = undefined;
|
|
2674
|
+
function resolveFocusEventConfig() {
|
|
2675
|
+
var top = getTopmostWindow();
|
|
2676
|
+
var topDocument = top.document;
|
|
2677
|
+
var eventType = {};
|
|
2678
|
+
var eventTarget = {};
|
|
2679
|
+
var isCordova = typeof globalThis.cordova !== 'undefined';
|
|
2680
|
+
var isIOS = Platform.os.name === OS.iOS;
|
|
2681
|
+
var isIOSOver8 = isIOS && compareVersion(Platform.os.version, '8.0') >= 0;
|
|
2682
|
+
var isIOSUnder8 = isIOS && !isIOSOver8;
|
|
2683
|
+
var isStandard = EventListener.useStd;
|
|
2684
|
+
if (isCordova) {
|
|
2685
|
+
eventType.focus = 'resume';
|
|
2686
|
+
eventType.blur = 'pause';
|
|
2687
|
+
eventTarget.focus = topDocument;
|
|
2688
|
+
eventTarget.blur = topDocument;
|
|
2689
|
+
}
|
|
2690
|
+
else if (isIOSOver8) {
|
|
2691
|
+
eventType.visibilitychange = 'visibilitychange';
|
|
2692
|
+
eventTarget.visibilitychange = topDocument;
|
|
2693
|
+
}
|
|
2694
|
+
else if (isIOSUnder8) {
|
|
2695
|
+
eventType.focus = 'pageshow';
|
|
2696
|
+
eventType.blur = 'pagehide';
|
|
2697
|
+
eventTarget.focus = top;
|
|
2698
|
+
eventTarget.blur = top;
|
|
2699
|
+
}
|
|
2700
|
+
else if (isStandard) {
|
|
2701
|
+
eventType.focus = 'focus';
|
|
2702
|
+
eventType.blur = 'blur';
|
|
2703
|
+
eventType.visibilitychange = 'visibilitychange';
|
|
2704
|
+
eventTarget.focus = top;
|
|
2705
|
+
eventTarget.blur = top;
|
|
2706
|
+
eventTarget.visibilitychange = topDocument;
|
|
2707
|
+
}
|
|
2708
|
+
else {
|
|
2709
|
+
eventType.focus = 'focus';
|
|
2710
|
+
eventType.blur = 'blur';
|
|
2711
|
+
eventType.visibilitychange = 'visibilitychange';
|
|
2712
|
+
eventTarget.focus = topDocument;
|
|
2713
|
+
eventTarget.blur = topDocument;
|
|
2714
|
+
eventTarget.visibilitychange = topDocument;
|
|
2715
|
+
}
|
|
2716
|
+
return {
|
|
2717
|
+
type: eventType,
|
|
2718
|
+
target: eventTarget
|
|
2719
|
+
};
|
|
2720
|
+
}
|
|
2721
|
+
function getTrackId(bundle) {
|
|
2722
|
+
try {
|
|
2723
|
+
var xhr = new XMLHttpRequest();
|
|
2724
|
+
xhr.open('GET', 'https://itunes.apple.com/lookup?bundleId=' + bundle, false);
|
|
2725
|
+
xhr.send();
|
|
2726
|
+
if (xhr.status === 200) {
|
|
2727
|
+
try {
|
|
2728
|
+
return parseLookupBundleIdResponse(JSON.parse(xhr.response));
|
|
2729
|
+
}
|
|
2730
|
+
catch (_) {
|
|
2731
|
+
return undefined;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
return undefined;
|
|
2735
|
+
}
|
|
2736
|
+
catch (_) {
|
|
2737
|
+
return undefined;
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
function parseLookupBundleIdResponse(response) {
|
|
2741
|
+
if (typeof response.results === 'undefined')
|
|
2742
|
+
return undefined;
|
|
2743
|
+
var results = response.results;
|
|
2744
|
+
if (results.length === 0)
|
|
2745
|
+
return undefined;
|
|
2746
|
+
var result = results[0];
|
|
2747
|
+
if (typeof result === 'undefined')
|
|
2748
|
+
return undefined;
|
|
2749
|
+
return '' + result.trackId;
|
|
2750
|
+
}
|
|
2751
|
+
function parseIntentURL(intent) {
|
|
2752
|
+
var parsed = {};
|
|
2753
|
+
var split = intent.split('#Intent;');
|
|
2754
|
+
var host = split[0].substring(9);
|
|
2755
|
+
var suffix = split[1];
|
|
2756
|
+
var parameterString = suffix.substring(0, suffix.length - 4);
|
|
2757
|
+
var parameters = parameterString.split(';');
|
|
2758
|
+
var extras = {};
|
|
2759
|
+
for (var i = 0; i < parameters.length; i++) {
|
|
2760
|
+
var part = parameters[i];
|
|
2761
|
+
var index = part.indexOf('=');
|
|
2762
|
+
if (index !== -1)
|
|
2763
|
+
extras[part.substring(0, index)] = part.substring(index + 1);
|
|
2764
|
+
}
|
|
2765
|
+
if (typeof extras['scheme'] !== 'undefined')
|
|
2766
|
+
parsed.scheme = (extras['scheme'] + '://' + host);
|
|
2767
|
+
if (typeof extras['package'] !== 'undefined')
|
|
2768
|
+
parsed.packageName = extras['package'];
|
|
2769
|
+
if (typeof extras['S.browser_fallback_url'] !== 'undefined')
|
|
2770
|
+
parsed.fallback = extras['S.browser_fallback_url'];
|
|
2771
|
+
return parsed;
|
|
2772
|
+
}
|
|
2773
|
+
function createIntentURL(scheme, packageName, fallback) {
|
|
2774
|
+
var split = scheme.split('://');
|
|
2775
|
+
var prefix = split[0];
|
|
2776
|
+
var suffix = split[1];
|
|
2777
|
+
var intent = 'intent://';
|
|
2778
|
+
if (typeof suffix !== 'undefined')
|
|
2779
|
+
intent += suffix;
|
|
2780
|
+
intent += '#Intent;'
|
|
2781
|
+
+ 'scheme=' + prefix + ';'
|
|
2782
|
+
+ 'action=android.intent.action.VIEW;'
|
|
2783
|
+
+ 'category=android.intent.category.BROWSABLE;';
|
|
2784
|
+
if (typeof packageName !== 'undefined')
|
|
2785
|
+
intent += 'package=' + packageName + ';';
|
|
2786
|
+
if (typeof fallback !== 'undefined' && typeof fallback === 'string')
|
|
2787
|
+
intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(fallback) + ';';
|
|
2788
|
+
else if (typeof packageName !== 'undefined')
|
|
2789
|
+
intent += 'S.browser_fallback_url=' + globalThis.encodeURIComponent(createAppStoreURL(packageName, OS.Android)) + ';';
|
|
2790
|
+
return intent + 'end';
|
|
2791
|
+
}
|
|
2792
|
+
function createAppStoreURL(packageName, os) {
|
|
2793
|
+
if (typeof packageName === 'undefined')
|
|
2794
|
+
return undefined;
|
|
2795
|
+
switch (os) {
|
|
2796
|
+
case OS.Android:
|
|
2797
|
+
return 'market://details?id=' + packageName;
|
|
2798
|
+
case OS.iOS:
|
|
2799
|
+
return 'itms-apps://itunes.apple.com/app/id' + packageName + '?mt=8';
|
|
2800
|
+
case OS.Windows:
|
|
2801
|
+
return 'ms-windows-store://pdp/?ProductId=' + packageName;
|
|
2802
|
+
case OS.MacOS:
|
|
2803
|
+
return 'macappstore://itunes.apple.com/app/id' + packageName + '?mt=12';
|
|
2804
|
+
default:
|
|
2805
|
+
throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
function createWebStoreURL(packageName, os) {
|
|
2809
|
+
if (typeof packageName === 'undefined')
|
|
2810
|
+
return undefined;
|
|
2811
|
+
switch (os) {
|
|
2812
|
+
case OS.Android:
|
|
2813
|
+
return 'https://play.google.com/store/apps/details?id=' + packageName;
|
|
2814
|
+
case OS.iOS:
|
|
2815
|
+
return 'https://itunes.apple.com/app/id' + packageName + '?mt=8';
|
|
2816
|
+
case OS.Windows:
|
|
2817
|
+
return 'https://apps.microsoft.com/detail/' + packageName;
|
|
2818
|
+
case OS.MacOS:
|
|
2819
|
+
return 'https://apps.apple.com/app/id' + packageName + '?mt=12';
|
|
2820
|
+
default:
|
|
2821
|
+
throw new URLOpenError('Unsupported OS: \"' + Platform.userAgent + '\"');
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
function getDefaultTimeoutByOS(os) {
|
|
2825
|
+
switch (os) {
|
|
2826
|
+
case OS.iOS:
|
|
2827
|
+
return 2000;
|
|
2828
|
+
case OS.Android:
|
|
2829
|
+
return 1000;
|
|
2830
|
+
default:
|
|
2831
|
+
return 750;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
function canOpenIntentURL() {
|
|
2835
|
+
if (Platform.os.name !== OS.Android)
|
|
2836
|
+
return false;
|
|
2837
|
+
var version = Platform.browser.version;
|
|
2838
|
+
if (Platform.browser.name === Browsers.SamsungInternet && compareVersion(version, '17.0.1.69') >= 0 && compareVersion(version, '17.0.7.34') < 0)
|
|
2839
|
+
return false;
|
|
2840
|
+
if (Platform.browser.name === Browsers.Firefox && compareVersion(version, '41.0') < 0)
|
|
2841
|
+
return false;
|
|
2842
|
+
if (Platform.browser.name === Browsers.Firefox && compareVersion(version, '59.0') >= 0 && compareVersion(version, '68.11.0') < 0)
|
|
2843
|
+
return false;
|
|
2844
|
+
if (Platform.browser.name === Browsers.Firefox && compareVersion(version, '80.0') >= 0 && compareVersion(version, '82.0') < 0)
|
|
2845
|
+
return false;
|
|
2846
|
+
if (Platform.browser.name === Browsers.Firefox && compareVersion(version, '96.0') >= 0 && compareVersion(version, '107.0') < 0)
|
|
2847
|
+
return false;
|
|
2848
|
+
if (Platform.browser.name === Browsers.Opera && compareVersion(version, '14.0') < 0)
|
|
2849
|
+
return false;
|
|
2850
|
+
return !(/(?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/[\w.]+;/i.test(Platform.userAgent) || /instagram[\/ ][-\w.]+/i.test(Platform.userAgent) || /micromessenger\/([\w.]+)/i.test(Platform.userAgent) || /musical_ly(?:.+app_?version\/|_)[\w.]+/i.test(Platform.userAgent) || /ultralite app_version\/[\w.]+/i.test(Platform.userAgent));
|
|
2851
|
+
}
|
|
2852
|
+
function canOpenUniversalURL() {
|
|
2853
|
+
return Platform.os.name === OS.iOS && compareVersion(Platform.os.version, '9.0') >= 0;
|
|
2854
|
+
}
|
|
2855
|
+
function canOpenSetting() {
|
|
2856
|
+
var os = Platform.os.name;
|
|
2857
|
+
var version = Platform.os.version;
|
|
2858
|
+
if (os === OS.Unknown)
|
|
2859
|
+
return false;
|
|
2860
|
+
if (os === OS.Android && !canOpenIntentURL())
|
|
2861
|
+
return false;
|
|
2862
|
+
if (os === OS.iOS)
|
|
2863
|
+
return false;
|
|
2864
|
+
if (os === OS.Windows && (version === 'Vista' || version === 'XP' || version === '2000' || version === 'NT 4.0' || version === 'NT 3.11' || version === 'ME' || compareVersion(version, '10') < 0))
|
|
2865
|
+
return false;
|
|
2866
|
+
return !(os === OS.MacOS && compareVersion(version, '10.10') < 0);
|
|
2867
|
+
}
|
|
2868
|
+
function canOpenDirectory() {
|
|
2869
|
+
return typeof globalThis.showDirectoryPicker !== 'undefined' || typeof createHiddenElement('input').webkitdirectory !== 'undefined';
|
|
2870
|
+
}
|
|
2871
|
+
function canOpenCamera() {
|
|
2872
|
+
var os = Platform.os.name;
|
|
2873
|
+
var version = Platform.os.version;
|
|
2874
|
+
return !Platform.isWebview && ((os === OS.iOS && compareVersion(version, '10.3.1') === 0) || (os === OS.Android && compareVersion(version, '3.0') >= 0));
|
|
2875
|
+
}
|
|
2876
|
+
function canOpenContact() {
|
|
2877
|
+
return typeof globalThis.navigator.contacts !== 'undefined';
|
|
2878
|
+
}
|
|
2879
|
+
function canOpenShare() {
|
|
2880
|
+
return typeof globalThis.navigator.share !== 'undefined';
|
|
2881
|
+
}
|
|
2882
|
+
function canOpenCalendar() {
|
|
2883
|
+
return Platform.os.name === OS.iOS && compareVersion(Platform.os.version, '15.0') >= 0 && Platform.browser.name === Browsers.Safari && !Platform.isWebview;
|
|
2884
|
+
}
|
|
2885
|
+
function pushURL(urls, url, state, condition) {
|
|
2886
|
+
if (condition === void 0) { condition = false; }
|
|
2887
|
+
if ((typeof url === 'function' || typeof url === 'string') && condition)
|
|
2888
|
+
urls.push([state, url]);
|
|
2889
|
+
}
|
|
2890
|
+
function joining(values, mapfn, separator) {
|
|
2891
|
+
if (mapfn === void 0) { mapfn = undefined; }
|
|
2892
|
+
if (separator === void 0) { separator = ','; }
|
|
2893
|
+
var length = values.length;
|
|
2894
|
+
var result = '';
|
|
2895
|
+
for (var i = 0; i < length; i++) {
|
|
2896
|
+
if (i !== 0)
|
|
2897
|
+
result += separator;
|
|
2898
|
+
if (typeof mapfn !== 'undefined')
|
|
2899
|
+
result += mapfn(values[i]);
|
|
2900
|
+
else
|
|
2901
|
+
result += values[i];
|
|
2902
|
+
}
|
|
2903
|
+
return result;
|
|
2904
|
+
}
|
|
2905
|
+
function escapeURIComponentString(value) {
|
|
2906
|
+
return globalThis.encodeURIComponent(value)
|
|
2907
|
+
.replace(/[!'()*]/g, function (char) {
|
|
2908
|
+
return '%' + char.charCodeAt(0).toString(16);
|
|
2909
|
+
});
|
|
2910
|
+
}
|
|
2911
|
+
function escapeURIComponentMailAddressString(value) {
|
|
2912
|
+
return escapeURIComponentString(value)
|
|
2913
|
+
.replace(/%22/g, '"')
|
|
2914
|
+
.replace(/%40/g, '@')
|
|
2915
|
+
.replace(/%2C/gi, ',');
|
|
2916
|
+
}
|
|
2917
|
+
function escapeICSString(value) {
|
|
2918
|
+
return value
|
|
2919
|
+
.replace(/\\/g, '\\\\')
|
|
2920
|
+
.replace(/;/g, '\\;')
|
|
2921
|
+
.replace(/,/g, '\\,')
|
|
2922
|
+
.replace(/\r\n|\n|\r/g, '\\n');
|
|
2923
|
+
}
|
|
2924
|
+
function utf8ByteLength(value) {
|
|
2925
|
+
if (typeof globalThis.TextEncoder !== 'undefined')
|
|
2926
|
+
return new TextEncoder().encode(value).length;
|
|
2927
|
+
return globalThis.unescape(globalThis.encodeURIComponent(value)).length;
|
|
2928
|
+
}
|
|
2929
|
+
function foldICSString(value) {
|
|
2930
|
+
if (utf8ByteLength(value) <= 75)
|
|
2931
|
+
return value;
|
|
2932
|
+
var out = '';
|
|
2933
|
+
var current = '';
|
|
2934
|
+
var currentBytes = 0;
|
|
2935
|
+
for (var i = 0; i < value.length; i++) {
|
|
2936
|
+
var char = value[i];
|
|
2937
|
+
var charBytes = utf8ByteLength(value[i]);
|
|
2938
|
+
if (current !== '' && currentBytes + charBytes > 75) {
|
|
2939
|
+
out += current + '\r\n ';
|
|
2940
|
+
current = char;
|
|
2941
|
+
currentBytes = charBytes;
|
|
2942
|
+
}
|
|
2943
|
+
else {
|
|
2944
|
+
current += char;
|
|
2945
|
+
currentBytes += charBytes;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
out += current;
|
|
2949
|
+
return out;
|
|
2950
|
+
}
|
|
2951
|
+
function urlToString(value) {
|
|
2952
|
+
if (value instanceof URL)
|
|
2953
|
+
return value.toString();
|
|
2954
|
+
return value;
|
|
2955
|
+
}
|
|
2956
|
+
function dateToICSDateString(date, allDay) {
|
|
2957
|
+
if (allDay === void 0) { allDay = false; }
|
|
2958
|
+
if (allDay) {
|
|
2959
|
+
return date.getUTCFullYear()
|
|
2960
|
+
+ padStart(date.getUTCMonth() + 1, 2, '0')
|
|
2961
|
+
+ padStart(date.getUTCDate() + 1, 2, '0');
|
|
2962
|
+
}
|
|
2963
|
+
return date.getUTCFullYear()
|
|
2964
|
+
+ padStart(date.getUTCMonth() + 1, 2, '0')
|
|
2965
|
+
+ padStart(date.getUTCDate() + 1, 2, '0')
|
|
2966
|
+
+ 'T'
|
|
2967
|
+
+ padStart(date.getUTCHours() + 1, 2, '0')
|
|
2968
|
+
+ padStart(date.getUTCMinutes() + 1, 2, '0')
|
|
2969
|
+
+ padStart(date.getUTCSeconds() + 1, 2, '0')
|
|
2970
|
+
+ 'Z';
|
|
2971
|
+
}
|
|
2972
|
+
function getURLOpenError(tried) {
|
|
2973
|
+
var triedURLString = '';
|
|
2974
|
+
for (var i = 0; i < tried.length; i++)
|
|
2975
|
+
triedURLString += '\n' + (i + 1) + ': ' + tried[i];
|
|
2976
|
+
if (triedURLString.length > 0)
|
|
2977
|
+
triedURLString = '\n' + triedURLString + '\n';
|
|
2978
|
+
return new URLOpenError('Failed to open any of the provided URLs: ' + triedURLString);
|
|
2979
|
+
}
|
|
2980
|
+
function openURLViaHref(url, index) {
|
|
2981
|
+
var top = getTopmostWindow();
|
|
2982
|
+
var topDocument = top.document;
|
|
2983
|
+
var anchor = undefined;
|
|
2984
|
+
try {
|
|
2985
|
+
if (index === 0) {
|
|
2986
|
+
top.location.href = url;
|
|
2987
|
+
return;
|
|
2988
|
+
}
|
|
2989
|
+
anchor = createHiddenElement('a');
|
|
2990
|
+
anchor.href = url;
|
|
2991
|
+
topDocument.body.appendChild(anchor);
|
|
2992
|
+
dispatchClickEvent(anchor, top);
|
|
2993
|
+
return anchor;
|
|
2994
|
+
}
|
|
2995
|
+
catch (_) {
|
|
2996
|
+
}
|
|
2997
|
+
finally {
|
|
2998
|
+
if (typeof anchor !== 'undefined') {
|
|
2999
|
+
try {
|
|
3000
|
+
topDocument.body.removeChild(anchor);
|
|
3001
|
+
}
|
|
3002
|
+
catch (_) {
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
function openURLViaIframe(url) {
|
|
3008
|
+
var top = getTopmostWindow();
|
|
3009
|
+
var topDocument = top.document;
|
|
3010
|
+
var iframe = undefined;
|
|
3011
|
+
try {
|
|
3012
|
+
iframe = createHiddenElement('iframe');
|
|
3013
|
+
if (typeof iframe === 'undefined')
|
|
3014
|
+
return;
|
|
3015
|
+
iframe.src = url;
|
|
3016
|
+
topDocument.body.appendChild(iframe);
|
|
3017
|
+
globalThis.setTimeout(function () {
|
|
3018
|
+
if (typeof iframe !== 'undefined') {
|
|
3019
|
+
try {
|
|
3020
|
+
topDocument.body.removeChild(iframe);
|
|
3021
|
+
}
|
|
3022
|
+
catch (_) {
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
}, 500);
|
|
3026
|
+
}
|
|
3027
|
+
catch (_) {
|
|
3028
|
+
}
|
|
3029
|
+
return iframe;
|
|
3030
|
+
}
|
|
3031
|
+
function isDocumentHidden() {
|
|
3032
|
+
var top = getTopmostWindow();
|
|
3033
|
+
var topDocument = top.document;
|
|
3034
|
+
if (topDocument.visibilityState === 'hidden')
|
|
3035
|
+
return true;
|
|
3036
|
+
if (topDocument.webkitVisibilityState === 'hidden')
|
|
3037
|
+
return true;
|
|
3038
|
+
if (topDocument.mozVisibilityState === 'hidden')
|
|
3039
|
+
return true;
|
|
3040
|
+
if (topDocument.msVisibilityState === 'hidden')
|
|
3041
|
+
return true;
|
|
3042
|
+
if (typeof topDocument.hidden !== 'undefined')
|
|
3043
|
+
return topDocument.hidden;
|
|
3044
|
+
if (typeof topDocument.webkitHidden !== 'undefined')
|
|
3045
|
+
return topDocument.webkitHidden;
|
|
3046
|
+
if (typeof topDocument.mozHidden !== 'undefined')
|
|
3047
|
+
return topDocument.mozHidden;
|
|
3048
|
+
if (typeof topDocument.msHidden !== 'undefined')
|
|
3049
|
+
return topDocument.msHidden;
|
|
3050
|
+
if (typeof topDocument.hasFocus === 'function')
|
|
3051
|
+
return !topDocument.hasFocus();
|
|
3052
|
+
return true;
|
|
3053
|
+
}
|
|
3054
|
+
function hasFocus(document) {
|
|
3055
|
+
if (typeof document.hasFocus === 'function')
|
|
3056
|
+
return document.hasFocus();
|
|
3057
|
+
return false;
|
|
3058
|
+
}
|
|
3059
|
+
function focus(target) {
|
|
3060
|
+
try {
|
|
3061
|
+
target.focus({ preventScroll: true });
|
|
3062
|
+
}
|
|
3063
|
+
catch (_) {
|
|
3064
|
+
try {
|
|
3065
|
+
target.focus();
|
|
3066
|
+
}
|
|
3067
|
+
catch (_) {
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
function restoreFocus() {
|
|
3072
|
+
var top = getTopmostWindow();
|
|
3073
|
+
var topDocument = top.document;
|
|
3074
|
+
focus(top);
|
|
3075
|
+
if (hasFocus(topDocument))
|
|
3076
|
+
return true;
|
|
3077
|
+
if (topDocument.body.tabIndex < 0)
|
|
3078
|
+
topDocument.body.tabIndex = -1;
|
|
3079
|
+
focus(topDocument.body);
|
|
3080
|
+
if (hasFocus(topDocument))
|
|
3081
|
+
return true;
|
|
3082
|
+
var input = undefined;
|
|
3083
|
+
try {
|
|
3084
|
+
input = createHiddenElement('input');
|
|
3085
|
+
if (typeof input === 'undefined')
|
|
3086
|
+
return false;
|
|
3087
|
+
input.type = 'text';
|
|
3088
|
+
input.readOnly = true;
|
|
3089
|
+
topDocument.body.appendChild(input);
|
|
3090
|
+
focus(input);
|
|
3091
|
+
try {
|
|
3092
|
+
input.select();
|
|
3093
|
+
}
|
|
3094
|
+
catch (_) {
|
|
3095
|
+
}
|
|
3096
|
+
if (hasFocus(topDocument))
|
|
3097
|
+
return true;
|
|
3098
|
+
}
|
|
3099
|
+
catch (_) {
|
|
3100
|
+
}
|
|
3101
|
+
finally {
|
|
3102
|
+
if (typeof input !== 'undefined' && input !== null) {
|
|
3103
|
+
try {
|
|
3104
|
+
input.blur();
|
|
3105
|
+
}
|
|
3106
|
+
catch (_) {
|
|
3107
|
+
}
|
|
3108
|
+
try {
|
|
3109
|
+
topDocument.body.removeChild(input);
|
|
3110
|
+
}
|
|
3111
|
+
catch (_) {
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
return hasFocus(topDocument);
|
|
3116
|
+
}
|
|
3117
|
+
function resolveFile(from) {
|
|
3118
|
+
if (Object.prototype.toString.call(from) === '[object Promise]') {
|
|
3119
|
+
var handle_1 = from;
|
|
3120
|
+
return new Promise(function (resolve, reject) {
|
|
3121
|
+
handle_1
|
|
3122
|
+
.then(function (handles) {
|
|
3123
|
+
var getFiles = [];
|
|
3124
|
+
for (var i = 0; i < handles.length; i++)
|
|
3125
|
+
getFiles[i] = handles[i].getFile();
|
|
3126
|
+
Promise.all(getFiles)
|
|
3127
|
+
.then(resolve)
|
|
3128
|
+
.catch(reject);
|
|
3129
|
+
})
|
|
3130
|
+
.catch(function (error) {
|
|
3131
|
+
if (error.name === 'AbortError')
|
|
3132
|
+
return reject(new UserCancelledError('User cancelled the operation.'));
|
|
3133
|
+
return reject(new NotSupportedError(error.message));
|
|
3134
|
+
});
|
|
3135
|
+
});
|
|
3136
|
+
}
|
|
3137
|
+
else {
|
|
3138
|
+
var input_1 = from;
|
|
3139
|
+
var config_1 = resolveFocusEventConfig();
|
|
3140
|
+
var top_1 = getTopmostWindow();
|
|
3141
|
+
var topDocument_1 = top_1.document;
|
|
3142
|
+
return new Promise(function (resolve, reject) {
|
|
3143
|
+
var resolved = false;
|
|
3144
|
+
function cleanup() {
|
|
3145
|
+
resolveFileCleanup = undefined;
|
|
3146
|
+
try {
|
|
3147
|
+
EventListener.remove(config_1.target.focus, { type: config_1.type.focus, callback: onFocus });
|
|
3148
|
+
EventListener.remove(config_1.target.visibilitychange, { type: config_1.type.visibilitychange, callback: onVisibilityChange });
|
|
3149
|
+
EventListener.remove(topDocument_1, { type: 'click', callback: onClick });
|
|
3150
|
+
}
|
|
3151
|
+
catch (_) {
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
function done(success) {
|
|
3155
|
+
if (resolved)
|
|
3156
|
+
return;
|
|
3157
|
+
resolved = true;
|
|
3158
|
+
var fileList = input_1.files;
|
|
3159
|
+
var files = [];
|
|
3160
|
+
if (fileList === null)
|
|
3161
|
+
return resolve(files);
|
|
3162
|
+
for (var i = 0; i < fileList.length; i++)
|
|
3163
|
+
files.push(fileList[i]);
|
|
3164
|
+
cleanup();
|
|
3165
|
+
if (success)
|
|
3166
|
+
resolve(files);
|
|
3167
|
+
else
|
|
3168
|
+
reject(new UserCancelledError('User cancelled the operation.'));
|
|
3169
|
+
}
|
|
3170
|
+
function onFocus() {
|
|
3171
|
+
globalThis.setTimeout(function () {
|
|
3172
|
+
if (input_1.value.length > 0)
|
|
3173
|
+
done(true);
|
|
3174
|
+
else
|
|
3175
|
+
done(false);
|
|
3176
|
+
}, 1000);
|
|
3177
|
+
}
|
|
3178
|
+
function onVisibilityChange() {
|
|
3179
|
+
if (!isDocumentHidden())
|
|
3180
|
+
onFocus();
|
|
3181
|
+
}
|
|
3182
|
+
function onClick() {
|
|
3183
|
+
done(false);
|
|
3184
|
+
}
|
|
3185
|
+
input_1.onchange = function () {
|
|
3186
|
+
done(true);
|
|
3187
|
+
};
|
|
3188
|
+
if (typeof resolveFileCleanup !== 'undefined')
|
|
3189
|
+
resolveFileCleanup();
|
|
3190
|
+
if (typeof input_1.oncancel !== 'undefined') {
|
|
3191
|
+
input_1.oncancel = function () {
|
|
3192
|
+
done(false);
|
|
3193
|
+
};
|
|
3194
|
+
}
|
|
3195
|
+
else {
|
|
3196
|
+
input_1.onclick = function () {
|
|
3197
|
+
EventListener.add(config_1.target.visibilitychange, { type: config_1.type.visibilitychange, callback: onVisibilityChange });
|
|
3198
|
+
EventListener.add(config_1.target.focus, { type: config_1.type.focus, callback: onFocus });
|
|
3199
|
+
globalThis.setTimeout(function () {
|
|
3200
|
+
EventListener.add(topDocument_1, { type: 'click', callback: onClick });
|
|
3201
|
+
}, 100);
|
|
3202
|
+
resolveFileCleanup = function () {
|
|
3203
|
+
done(false);
|
|
3204
|
+
};
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3207
|
+
dispatchClickEvent(input_1);
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
24
3210
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
3211
|
+
function resolveFileWithPath(from) {
|
|
3212
|
+
if (Object.prototype.toString.call(from) === '[object Promise]') {
|
|
3213
|
+
var handle_2 = from;
|
|
3214
|
+
return new Promise(function (resolve, reject) {
|
|
3215
|
+
handle_2
|
|
3216
|
+
.then(function (handle) {
|
|
3217
|
+
var tasks = [];
|
|
3218
|
+
var fileWithPaths = [];
|
|
3219
|
+
function walkDirectory(directory, basePath) {
|
|
3220
|
+
if (basePath === void 0) { basePath = ''; }
|
|
3221
|
+
return new Promise(function (resolve, reject) {
|
|
3222
|
+
var iterator = directory.entries();
|
|
3223
|
+
function pump() {
|
|
3224
|
+
iterator
|
|
3225
|
+
.next()
|
|
3226
|
+
.then(function (result) {
|
|
3227
|
+
if (result.done)
|
|
3228
|
+
return resolve();
|
|
3229
|
+
var name = result.value[0];
|
|
3230
|
+
var handle = result.value[1];
|
|
3231
|
+
var path;
|
|
3232
|
+
if (basePath === '')
|
|
3233
|
+
path = name;
|
|
3234
|
+
else
|
|
3235
|
+
path = basePath + '/' + name;
|
|
3236
|
+
if (handle.kind === 'file') {
|
|
3237
|
+
tasks.push(handle
|
|
3238
|
+
.getFile()
|
|
3239
|
+
.then(function (file) {
|
|
3240
|
+
fileWithPaths.push({
|
|
3241
|
+
file: file,
|
|
3242
|
+
relativePath: path,
|
|
3243
|
+
});
|
|
3244
|
+
}));
|
|
3245
|
+
}
|
|
3246
|
+
else {
|
|
3247
|
+
tasks.push(walkDirectory(handle, path));
|
|
3248
|
+
}
|
|
3249
|
+
pump();
|
|
3250
|
+
})
|
|
3251
|
+
.catch(reject);
|
|
3252
|
+
}
|
|
3253
|
+
pump();
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
walkDirectory(handle, handle.name)
|
|
3257
|
+
.then(function () {
|
|
3258
|
+
Promise.all(tasks)
|
|
3259
|
+
.then(function () {
|
|
3260
|
+
resolve(fileWithPaths);
|
|
3261
|
+
})
|
|
3262
|
+
.catch(reject);
|
|
3263
|
+
})
|
|
3264
|
+
.catch(reject);
|
|
3265
|
+
})
|
|
3266
|
+
.catch(function (error) {
|
|
3267
|
+
if (error.name === 'AbortError')
|
|
3268
|
+
return reject(new UserCancelledError('User cancelled the operation.'));
|
|
3269
|
+
return reject(new NotSupportedError(error.message));
|
|
3270
|
+
});
|
|
3271
|
+
});
|
|
3272
|
+
}
|
|
3273
|
+
else {
|
|
3274
|
+
var input_2 = from;
|
|
3275
|
+
return new Promise(function (resolve, reject) {
|
|
3276
|
+
resolveFile(input_2)
|
|
3277
|
+
.then(function (files) {
|
|
3278
|
+
var fileWithPaths = [];
|
|
3279
|
+
for (var i = 0; i < files.length; i++) {
|
|
3280
|
+
var file_1 = files[i];
|
|
3281
|
+
fileWithPaths.push({
|
|
3282
|
+
file: file_1,
|
|
3283
|
+
relativePath: file_1.webkitRelativePath,
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
resolve(fileWithPaths);
|
|
3287
|
+
})
|
|
3288
|
+
.catch(reject);
|
|
3289
|
+
});
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
function tryOpenURL(url, index, timeout) {
|
|
3293
|
+
var config = resolveFocusEventConfig();
|
|
3294
|
+
var top = getTopmostWindow();
|
|
3295
|
+
var topDocument = top.document;
|
|
3296
|
+
var a = undefined;
|
|
3297
|
+
var iframe = undefined;
|
|
3298
|
+
return new Promise(function (resolve, reject) {
|
|
3299
|
+
var timeoutId;
|
|
3300
|
+
var resolved = false;
|
|
3301
|
+
function cleanup() {
|
|
3302
|
+
if (typeof timeoutId !== 'undefined') {
|
|
3303
|
+
clearTimeout(timeoutId);
|
|
3304
|
+
timeoutId = undefined;
|
|
3305
|
+
}
|
|
40
3306
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
enumerable: false,
|
|
45
|
-
configurable: true
|
|
46
|
-
});
|
|
3307
|
+
EventListener.remove(config.target.blur, { type: config.type.blur, callback: onBlur });
|
|
3308
|
+
EventListener.remove(config.target.focus, { type: config.type.focus, callback: onFocus });
|
|
3309
|
+
EventListener.remove(config.target.visibilitychange, { type: config.type.visibilitychange, callback: onVisibilityChange });
|
|
47
3310
|
}
|
|
48
3311
|
catch (_) {
|
|
49
3312
|
}
|
|
3313
|
+
if (typeof a !== 'undefined') {
|
|
3314
|
+
try {
|
|
3315
|
+
topDocument.body.removeChild(a);
|
|
3316
|
+
}
|
|
3317
|
+
catch (_) {
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
if (typeof iframe !== 'undefined') {
|
|
3321
|
+
try {
|
|
3322
|
+
topDocument.body.removeChild(iframe);
|
|
3323
|
+
}
|
|
3324
|
+
catch (_) {
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
50
3327
|
}
|
|
51
|
-
|
|
52
|
-
|
|
3328
|
+
function done(success) {
|
|
3329
|
+
if (resolved)
|
|
3330
|
+
return;
|
|
3331
|
+
resolved = true;
|
|
3332
|
+
cleanup();
|
|
3333
|
+
if (success)
|
|
3334
|
+
resolve();
|
|
3335
|
+
else
|
|
3336
|
+
reject();
|
|
53
3337
|
}
|
|
54
|
-
|
|
55
|
-
|
|
3338
|
+
function onBlur() {
|
|
3339
|
+
if (typeof timeoutId !== 'undefined') {
|
|
3340
|
+
clearTimeout(timeoutId);
|
|
3341
|
+
timeoutId = undefined;
|
|
3342
|
+
}
|
|
3343
|
+
EventListener.remove(config.target.blur, { type: config.type.blur, callback: onBlur });
|
|
3344
|
+
EventListener.add(config.target.focus, { type: config.type.focus, callback: onFocus });
|
|
56
3345
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
3346
|
+
function onFocus() {
|
|
3347
|
+
done(true);
|
|
3348
|
+
}
|
|
3349
|
+
function onVisibilityChange() {
|
|
3350
|
+
if (isDocumentHidden())
|
|
3351
|
+
onBlur();
|
|
3352
|
+
else
|
|
3353
|
+
onFocus();
|
|
3354
|
+
}
|
|
3355
|
+
timeoutId = globalThis.setTimeout(function () {
|
|
3356
|
+
done(false);
|
|
3357
|
+
}, timeout);
|
|
3358
|
+
EventListener.add(config.target.blur, { type: config.type.blur, callback: onBlur });
|
|
3359
|
+
EventListener.add(config.target.visibilitychange, { type: config.type.visibilitychange, callback: onVisibilityChange });
|
|
3360
|
+
if (!hasFocus(topDocument))
|
|
3361
|
+
restoreFocus();
|
|
3362
|
+
try {
|
|
3363
|
+
if (typeof globalThis.cordova !== 'undefined') {
|
|
3364
|
+
globalThis.open(url, '_system');
|
|
62
3365
|
}
|
|
63
|
-
|
|
3366
|
+
else {
|
|
3367
|
+
a = openURLViaHref(url, index);
|
|
3368
|
+
iframe = openURLViaIframe(url);
|
|
64
3369
|
}
|
|
65
3370
|
}
|
|
66
|
-
|
|
3371
|
+
catch (_) {
|
|
3372
|
+
done(false);
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
function getAndroidAppInfo(options) {
|
|
3377
|
+
if (typeof options[OS.Android] !== 'undefined')
|
|
3378
|
+
return options[OS.Android];
|
|
3379
|
+
return options.android;
|
|
3380
|
+
}
|
|
3381
|
+
function getIOSAppInfo(options) {
|
|
3382
|
+
if (typeof options[OS.iOS] !== 'undefined')
|
|
3383
|
+
return options[OS.iOS];
|
|
3384
|
+
return options.ios;
|
|
3385
|
+
}
|
|
3386
|
+
function getWindowsAppInfo(options) {
|
|
3387
|
+
if (typeof options[OS.Windows] !== 'undefined')
|
|
3388
|
+
return options[OS.Windows];
|
|
3389
|
+
return options.windows;
|
|
3390
|
+
}
|
|
3391
|
+
function getMacOSAppInfo(options) {
|
|
3392
|
+
if (typeof options[OS.MacOS] !== 'undefined')
|
|
3393
|
+
return options[OS.MacOS];
|
|
3394
|
+
return options.macos;
|
|
3395
|
+
}
|
|
3396
|
+
function app(options) {
|
|
3397
|
+
var os = Platform.os.name;
|
|
3398
|
+
var urls = [];
|
|
3399
|
+
var tried = [];
|
|
3400
|
+
var infos = {};
|
|
3401
|
+
var timeout;
|
|
3402
|
+
if (os === OS.Android) {
|
|
3403
|
+
var option = getAndroidAppInfo(options);
|
|
3404
|
+
if (typeof option === 'undefined')
|
|
3405
|
+
return Promise.reject(getURLOpenError(tried));
|
|
3406
|
+
timeout = option.timeout;
|
|
3407
|
+
infos.scheme = urlToString(option.scheme);
|
|
3408
|
+
infos.intent = urlToString(option.intent);
|
|
3409
|
+
infos.packageName = option.packageName;
|
|
3410
|
+
infos.fallback = urlToString(option.fallback);
|
|
3411
|
+
infos.appStore = createAppStoreURL(infos.packageName, OS.Android);
|
|
3412
|
+
infos.webStore = createWebStoreURL(infos.packageName, OS.Android);
|
|
3413
|
+
infos.allowAppStore = option.allowAppStore;
|
|
3414
|
+
infos.allowWebStore = option.allowWebStore;
|
|
3415
|
+
if (typeof infos.intent !== 'undefined' && (typeof infos.scheme === 'undefined' || typeof infos.packageName === 'undefined' || typeof infos.fallback === 'undefined')) {
|
|
3416
|
+
var parsed = parseIntentURL(infos.intent);
|
|
3417
|
+
if (typeof parsed.scheme !== 'undefined' && typeof infos.scheme === 'undefined')
|
|
3418
|
+
infos.scheme = parsed.scheme;
|
|
3419
|
+
if (typeof parsed.packageName !== 'undefined' && typeof infos.packageName === 'undefined')
|
|
3420
|
+
infos.packageName = parsed.packageName;
|
|
3421
|
+
if (typeof parsed.fallback !== 'undefined' && typeof infos.fallback === 'undefined')
|
|
3422
|
+
infos.fallback = parsed.fallback;
|
|
3423
|
+
}
|
|
3424
|
+
if (typeof infos.scheme !== 'undefined' && typeof infos.intent === 'undefined')
|
|
3425
|
+
infos.intent = createIntentURL(infos.scheme, infos.packageName, infos.fallback);
|
|
67
3426
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
3427
|
+
else if (os === OS.iOS) {
|
|
3428
|
+
var option = getIOSAppInfo(options);
|
|
3429
|
+
if (typeof option === 'undefined')
|
|
3430
|
+
return Promise.reject(getURLOpenError(tried));
|
|
3431
|
+
timeout = option.timeout;
|
|
3432
|
+
infos.scheme = urlToString(option.scheme);
|
|
3433
|
+
infos.bundleId = option.bundleId;
|
|
3434
|
+
infos.trackId = option.trackId;
|
|
3435
|
+
infos.universal = urlToString(option.universal);
|
|
3436
|
+
infos.fallback = urlToString(option.fallback);
|
|
3437
|
+
infos.appStore = createAppStoreURL(infos.trackId, OS.iOS);
|
|
3438
|
+
infos.webStore = createWebStoreURL(infos.trackId, OS.iOS);
|
|
3439
|
+
infos.allowAppStore = option.allowAppStore;
|
|
3440
|
+
infos.allowWebStore = option.allowWebStore;
|
|
3441
|
+
if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined')
|
|
3442
|
+
infos.trackId = getTrackId(infos.bundleId);
|
|
3443
|
+
}
|
|
3444
|
+
else if (os === OS.Windows) {
|
|
3445
|
+
var option = getWindowsAppInfo(options);
|
|
3446
|
+
if (typeof option === 'undefined')
|
|
3447
|
+
return Promise.reject(getURLOpenError(tried));
|
|
3448
|
+
timeout = option.timeout;
|
|
3449
|
+
infos.scheme = urlToString(option.scheme);
|
|
3450
|
+
infos.productId = option.productId;
|
|
3451
|
+
infos.fallback = urlToString(option.fallback);
|
|
3452
|
+
infos.appStore = createAppStoreURL(infos.productId, OS.Windows);
|
|
3453
|
+
infos.webStore = createWebStoreURL(infos.productId, OS.Windows);
|
|
3454
|
+
infos.allowAppStore = option.allowAppStore;
|
|
3455
|
+
infos.allowWebStore = option.allowWebStore;
|
|
3456
|
+
}
|
|
3457
|
+
else if (os === OS.MacOS) {
|
|
3458
|
+
var option = getMacOSAppInfo(options);
|
|
3459
|
+
if (typeof option === 'undefined')
|
|
3460
|
+
return Promise.reject(getURLOpenError(tried));
|
|
3461
|
+
timeout = option.timeout;
|
|
3462
|
+
infos.scheme = urlToString(option.scheme);
|
|
3463
|
+
infos.bundleId = option.bundleId;
|
|
3464
|
+
infos.trackId = option.trackId;
|
|
3465
|
+
infos.fallback = urlToString(option.fallback);
|
|
3466
|
+
infos.appStore = createAppStoreURL(infos.trackId, OS.MacOS);
|
|
3467
|
+
infos.webStore = createWebStoreURL(infos.trackId, OS.MacOS);
|
|
3468
|
+
infos.allowAppStore = option.allowAppStore;
|
|
3469
|
+
infos.allowWebStore = option.allowWebStore;
|
|
3470
|
+
if (typeof infos.bundleId !== 'undefined' && typeof infos.trackId === 'undefined')
|
|
3471
|
+
infos.trackId = getTrackId(infos.bundleId);
|
|
3472
|
+
}
|
|
3473
|
+
pushURL(urls, infos.intent, AppOpenState.Intent, canOpenIntentURL());
|
|
3474
|
+
pushURL(urls, infos.universal, AppOpenState.Universal, canOpenUniversalURL());
|
|
3475
|
+
pushURL(urls, infos.scheme, AppOpenState.Scheme, true);
|
|
3476
|
+
pushURL(urls, infos.fallback, AppOpenState.Fallback, true);
|
|
3477
|
+
pushURL(urls, infos.appStore, AppOpenState.Store, infos.allowAppStore);
|
|
3478
|
+
pushURL(urls, infos.webStore, AppOpenState.Store, infos.allowWebStore);
|
|
3479
|
+
if (typeof timeout === 'undefined')
|
|
3480
|
+
timeout = getDefaultTimeoutByOS(os);
|
|
3481
|
+
return new Promise(function (resolve, reject) {
|
|
3482
|
+
function openURLSequential(index) {
|
|
3483
|
+
if (index === void 0) { index = 0; }
|
|
3484
|
+
if (index >= urls.length)
|
|
3485
|
+
return reject(getURLOpenError(tried));
|
|
3486
|
+
var entry = urls[index];
|
|
3487
|
+
var state = entry[0];
|
|
3488
|
+
var url = entry[1];
|
|
3489
|
+
if (typeof url === 'string') {
|
|
3490
|
+
tried[index] = url;
|
|
3491
|
+
return tryOpenURL(url, index, timeout)
|
|
3492
|
+
.then(function () {
|
|
3493
|
+
resolve(state);
|
|
3494
|
+
})
|
|
3495
|
+
.catch(function () {
|
|
3496
|
+
openURLSequential(index + 1);
|
|
3497
|
+
});
|
|
3498
|
+
}
|
|
3499
|
+
else {
|
|
3500
|
+
tried[index] = '[function fallback]';
|
|
3501
|
+
url();
|
|
3502
|
+
resolve(state);
|
|
3503
|
+
}
|
|
74
3504
|
}
|
|
3505
|
+
return openURLSequential();
|
|
75
3506
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
3507
|
+
}
|
|
3508
|
+
function openMessenger(options, type) {
|
|
3509
|
+
if (typeof options.to === 'string')
|
|
3510
|
+
options.to = escapeURIComponentMailAddressString(options.to);
|
|
3511
|
+
if (typeof options.cc === 'string')
|
|
3512
|
+
options.cc = escapeURIComponentMailAddressString(options.cc);
|
|
3513
|
+
if (typeof options.bcc === 'string')
|
|
3514
|
+
options.bcc = escapeURIComponentMailAddressString(options.bcc);
|
|
3515
|
+
if (typeof options.subject === 'string')
|
|
3516
|
+
options.subject = escapeURIComponentString(options.subject);
|
|
3517
|
+
if (typeof options.body === 'string')
|
|
3518
|
+
options.body = escapeURIComponentString(options.body);
|
|
3519
|
+
if (typeof options.to === 'object')
|
|
3520
|
+
options.to = joining(options.to, escapeURIComponentMailAddressString);
|
|
3521
|
+
if (typeof options.cc === 'object')
|
|
3522
|
+
options.cc = joining(options.cc, escapeURIComponentMailAddressString);
|
|
3523
|
+
if (typeof options.bcc === 'object')
|
|
3524
|
+
options.bcc = joining(options.bcc, escapeURIComponentMailAddressString);
|
|
3525
|
+
var params = [];
|
|
3526
|
+
var url = type + ':';
|
|
3527
|
+
if (typeof options.to === 'string')
|
|
3528
|
+
url += options.to;
|
|
3529
|
+
if (typeof options.cc === 'string')
|
|
3530
|
+
params.push('cc=' + options.cc);
|
|
3531
|
+
if (typeof options.bcc === 'string')
|
|
3532
|
+
params.push('bcc=' + options.bcc);
|
|
3533
|
+
if (typeof options.subject === 'string')
|
|
3534
|
+
params.push('subject=' + options.subject);
|
|
3535
|
+
if (typeof options.body === 'string')
|
|
3536
|
+
params.push('body=' + options.body);
|
|
3537
|
+
return tryOpenURL(url + '?' + joining(params, undefined, '&'), 0, getDefaultTimeoutByOS(Platform.os.name));
|
|
3538
|
+
}
|
|
3539
|
+
function telephone(options) {
|
|
3540
|
+
return openMessenger(options, 'tel');
|
|
3541
|
+
}
|
|
3542
|
+
function message(options) {
|
|
3543
|
+
return openMessenger(options, 'sms');
|
|
3544
|
+
}
|
|
3545
|
+
function mail(options) {
|
|
3546
|
+
return openMessenger(options, 'mailto');
|
|
3547
|
+
}
|
|
3548
|
+
function setting(type) {
|
|
3549
|
+
var os = Platform.os.name;
|
|
3550
|
+
var version = Platform.os.version;
|
|
3551
|
+
if (!canOpenSetting())
|
|
3552
|
+
return Promise.reject(getURLOpenError([]));
|
|
3553
|
+
var urls = [];
|
|
3554
|
+
switch (os) {
|
|
3555
|
+
case OS.Android:
|
|
3556
|
+
if (type !== SettingType.General) {
|
|
3557
|
+
if (type === SettingType.Accessibility && compareVersion(version, '1.6') >= 0)
|
|
3558
|
+
urls.push(SETTING_URL['Android'][SettingType.Accessibility]);
|
|
3559
|
+
else if (type === SettingType.Battery && compareVersion(version, '5.1') >= 0)
|
|
3560
|
+
urls.push(SETTING_URL['Android'][SettingType.Battery]);
|
|
3561
|
+
else if (type === SettingType.Accounts && compareVersion(version, '1.5') >= 0)
|
|
3562
|
+
urls.push(SETTING_URL['Android'][SettingType.Accounts]);
|
|
3563
|
+
else if (type === SettingType.Storage && compareVersion(version, '3.0') >= 0)
|
|
3564
|
+
urls.push(SETTING_URL['Android'][SettingType.Storage]);
|
|
3565
|
+
else
|
|
3566
|
+
urls.push(SETTING_URL['Android'][type]);
|
|
3567
|
+
}
|
|
3568
|
+
urls.push(SETTING_URL['Android'][SettingType.General]);
|
|
3569
|
+
break;
|
|
3570
|
+
case OS.Windows:
|
|
3571
|
+
urls.push(SETTING_URL['Windows'][type]);
|
|
3572
|
+
break;
|
|
3573
|
+
case OS.MacOS:
|
|
3574
|
+
if (type === SettingType.Appearance && compareVersion(version, '10.14') < 0) {
|
|
3575
|
+
urls.push(SETTING_URL['MacOS'][SettingType.General]);
|
|
3576
|
+
break;
|
|
3577
|
+
}
|
|
3578
|
+
if (compareVersion(version, '13.0') < 0)
|
|
3579
|
+
urls.push(SETTING_URL['MacOS'][type]);
|
|
3580
|
+
else
|
|
3581
|
+
urls.push(SETTING_URL['MacOS13+'][type]);
|
|
3582
|
+
break;
|
|
3583
|
+
}
|
|
3584
|
+
return new Promise(function (resolve, reject) {
|
|
3585
|
+
function openURLSequential(index) {
|
|
3586
|
+
if (index === void 0) { index = 0; }
|
|
3587
|
+
if (index >= urls.length)
|
|
3588
|
+
return reject(getURLOpenError([]));
|
|
3589
|
+
var url = urls[index];
|
|
3590
|
+
return tryOpenURL(url, index, 750)
|
|
3591
|
+
.then(function () {
|
|
3592
|
+
resolve();
|
|
3593
|
+
})
|
|
3594
|
+
.catch(function () {
|
|
3595
|
+
openURLSequential(index + 1);
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
return openURLSequential();
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
function file(options) {
|
|
3602
|
+
if (typeof globalThis.showOpenFilePicker !== 'undefined') {
|
|
3603
|
+
var openFilePickerOption = {};
|
|
3604
|
+
if (typeof options !== 'undefined') {
|
|
3605
|
+
if (typeof options.multiple !== 'undefined')
|
|
3606
|
+
openFilePickerOption.multiple = options.multiple;
|
|
3607
|
+
if (typeof options.id !== 'undefined')
|
|
3608
|
+
openFilePickerOption.id = options.id;
|
|
3609
|
+
if (typeof options.startIn !== 'undefined')
|
|
3610
|
+
openFilePickerOption.startIn = options.startIn;
|
|
3611
|
+
if (typeof options.accept !== 'undefined') {
|
|
3612
|
+
var accepts = {};
|
|
3613
|
+
openFilePickerOption.excludeAcceptAllOption = true;
|
|
3614
|
+
openFilePickerOption.types = [{
|
|
3615
|
+
description: '',
|
|
3616
|
+
accept: accepts,
|
|
3617
|
+
}];
|
|
3618
|
+
for (var i = 0; i < options.accept.length; i++) {
|
|
3619
|
+
var accept = options.accept[i];
|
|
3620
|
+
if (/^\.\w+/i.test(accept)) {
|
|
3621
|
+
if (typeof accepts['application/octet-stream'] === 'undefined')
|
|
3622
|
+
accepts['application/octet-stream'] = [];
|
|
3623
|
+
accepts['application/octet-stream'].push(accept);
|
|
3624
|
+
}
|
|
3625
|
+
else if (/^\w+\/\w+$/i.test(accept)) {
|
|
3626
|
+
accepts[accept] = [];
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
return resolveFile(globalThis.showOpenFilePicker(openFilePickerOption));
|
|
3632
|
+
}
|
|
3633
|
+
var input = createHiddenElement('input');
|
|
3634
|
+
input.type = 'file';
|
|
3635
|
+
if (typeof options !== 'undefined') {
|
|
3636
|
+
if (typeof options.multiple !== 'undefined')
|
|
3637
|
+
input.multiple = options.multiple;
|
|
3638
|
+
if (typeof options.accept !== 'undefined')
|
|
3639
|
+
input.accept = joining(options.accept);
|
|
3640
|
+
}
|
|
3641
|
+
return resolveFile(input);
|
|
3642
|
+
}
|
|
3643
|
+
function directory(options) {
|
|
3644
|
+
if (!canOpenDirectory())
|
|
3645
|
+
return Promise.reject(new NotSupportedError('\'window.showDirectoryPicker\' and \'HTMLInputElement.prototype.webkitdirectory\' does not supported.'));
|
|
3646
|
+
if (typeof globalThis.showDirectoryPicker !== 'undefined') {
|
|
3647
|
+
var openDirectoryPickerOption = {};
|
|
3648
|
+
if (typeof options !== 'undefined') {
|
|
3649
|
+
if (typeof options.id !== 'undefined')
|
|
3650
|
+
openDirectoryPickerOption.id = options.id;
|
|
3651
|
+
if (typeof options.startIn !== 'undefined')
|
|
3652
|
+
openDirectoryPickerOption.startIn = options.startIn;
|
|
3653
|
+
if (typeof options.mode !== 'undefined')
|
|
3654
|
+
openDirectoryPickerOption.mode = options.mode;
|
|
3655
|
+
}
|
|
3656
|
+
return resolveFileWithPath(globalThis.showDirectoryPicker(openDirectoryPickerOption));
|
|
3657
|
+
}
|
|
3658
|
+
var input = createHiddenElement('input');
|
|
3659
|
+
input.type = 'file';
|
|
3660
|
+
input.webkitdirectory = true;
|
|
3661
|
+
return resolveFileWithPath(input);
|
|
3662
|
+
}
|
|
3663
|
+
function camera(options) {
|
|
3664
|
+
var input = createHiddenElement('input');
|
|
3665
|
+
input.type = 'file';
|
|
3666
|
+
input.accept = 'image/*;capture=camera';
|
|
3667
|
+
input.capture = 'environment';
|
|
3668
|
+
if (typeof options !== 'undefined') {
|
|
3669
|
+
if (typeof options.type !== 'undefined') {
|
|
3670
|
+
if (options.type === CameraType.Image)
|
|
3671
|
+
input.accept = 'image/*;capture=camera';
|
|
3672
|
+
else
|
|
3673
|
+
input.accept = 'video/*;capture=camcorder';
|
|
3674
|
+
}
|
|
3675
|
+
if (typeof options.capture !== 'undefined') {
|
|
3676
|
+
if (options.capture === CaptureType.Environment)
|
|
3677
|
+
input.capture = 'environment';
|
|
3678
|
+
else
|
|
3679
|
+
input.capture = 'user';
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
return resolveFile(input);
|
|
3683
|
+
}
|
|
3684
|
+
function contact(options) {
|
|
3685
|
+
return new Promise(function (resolve, reject) {
|
|
3686
|
+
if (!canOpenContact())
|
|
3687
|
+
return reject(new NotSupportedError('\'navigator.contacts\' does not supported.'));
|
|
3688
|
+
var multiple = false;
|
|
3689
|
+
if (typeof options !== 'undefined' && typeof options.multiple !== 'undefined')
|
|
3690
|
+
multiple = options.multiple;
|
|
3691
|
+
globalThis.navigator.contacts
|
|
3692
|
+
.getProperties()
|
|
3693
|
+
.then(function (properties) {
|
|
3694
|
+
globalThis.navigator.contacts
|
|
3695
|
+
.select(properties, { multiple: multiple })
|
|
3696
|
+
.then(function (contacts) {
|
|
3697
|
+
resolve(contacts);
|
|
3698
|
+
});
|
|
3699
|
+
});
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
function share(options) {
|
|
3703
|
+
return new Promise(function (resolve, reject) {
|
|
3704
|
+
if (!canOpenShare())
|
|
3705
|
+
return reject(new NotSupportedError('\'navigator.share\' does not supported.'));
|
|
3706
|
+
if (!globalThis.navigator.canShare(options))
|
|
3707
|
+
return reject(new NotSupportedError('The provided data cannot be shared on this device.'));
|
|
3708
|
+
globalThis.navigator.share(options)
|
|
3709
|
+
.then(function () {
|
|
3710
|
+
resolve();
|
|
3711
|
+
})
|
|
3712
|
+
.catch(function (error) {
|
|
3713
|
+
if (error.name === 'AbortError')
|
|
3714
|
+
return reject(new UserCancelledError('User cancelled the operation.'));
|
|
3715
|
+
return reject(new NotSupportedError(error.message));
|
|
82
3716
|
});
|
|
3717
|
+
});
|
|
3718
|
+
}
|
|
3719
|
+
function calendar(options) {
|
|
3720
|
+
var timestamp = now();
|
|
3721
|
+
var ics = 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\n';
|
|
3722
|
+
if (globalThis.document.title !== '') {
|
|
3723
|
+
ics += foldICSString('PRODID:-//' + escapeICSString(globalThis.document.title) + '//EN') + '\r\n';
|
|
83
3724
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
3725
|
+
else {
|
|
3726
|
+
ics += foldICSString('PRODID:-//' + escapeICSString(globalThis.location.host) + '//EN') + '\r\n';
|
|
3727
|
+
}
|
|
3728
|
+
ics += 'BEGIN:VEVENT\r\n'
|
|
3729
|
+
+ 'UID:' + timestamp + '-' + randomString(10) + '\r\n'
|
|
3730
|
+
+ 'DTSTAMP:' + dateToICSDateString(new Date()) + '\r\n';
|
|
3731
|
+
if (options.allDay === true) {
|
|
3732
|
+
ics += 'DTSTART;VALUE=DATE:' + dateToICSDateString(options.startDate, true) + '\r\n'
|
|
3733
|
+
+ 'DTEND;VALUE=DATE:' + dateToICSDateString(options.endDate, true) + '\r\n';
|
|
3734
|
+
}
|
|
3735
|
+
else {
|
|
3736
|
+
ics += 'DTSTART:' + dateToICSDateString(options.startDate) + '\r\n'
|
|
3737
|
+
+ 'DTEND:' + dateToICSDateString(options.endDate) + '\r\n';
|
|
3738
|
+
}
|
|
3739
|
+
if (typeof options.title !== 'undefined') {
|
|
3740
|
+
ics += foldICSString('SUMMARY:' + escapeICSString(options.title)) + '\r\n';
|
|
3741
|
+
}
|
|
3742
|
+
if (typeof options.description !== 'undefined') {
|
|
3743
|
+
ics += foldICSString('DESCRIPTION:' + escapeICSString(options.description)) + '\r\n';
|
|
3744
|
+
}
|
|
3745
|
+
if (typeof options.location !== 'undefined') {
|
|
3746
|
+
ics += foldICSString('LOCATION:' + escapeICSString(options.location)) + '\r\n';
|
|
3747
|
+
}
|
|
3748
|
+
if (typeof options.recur !== 'undefined') {
|
|
3749
|
+
var rrule = 'FREQ=' + options.recur.frequency;
|
|
3750
|
+
if (typeof options.recur.interval !== 'undefined' && options.recur.interval > 1) {
|
|
3751
|
+
rrule += ';INTERVAL=' + String(options.recur.interval);
|
|
87
3752
|
}
|
|
88
|
-
|
|
3753
|
+
if (typeof options.recur.count !== 'undefined') {
|
|
3754
|
+
rrule += ';COUNT=' + String(options.recur.count);
|
|
3755
|
+
}
|
|
3756
|
+
if (typeof options.recur.until !== 'undefined') {
|
|
3757
|
+
rrule += ';UNTIL=' + dateToICSDateString(options.recur.until);
|
|
3758
|
+
}
|
|
3759
|
+
if (typeof options.recur.byMonth !== 'undefined' && options.recur.byMonth.length > 0) {
|
|
3760
|
+
rrule += ';BYMONTH=' + joining(options.recur.byMonth);
|
|
3761
|
+
}
|
|
3762
|
+
if (typeof options.recur.byWeekNo !== 'undefined' && options.recur.byWeekNo.length > 0) {
|
|
3763
|
+
rrule += ';BYWEEKNO=' + joining(options.recur.byWeekNo);
|
|
89
3764
|
}
|
|
3765
|
+
if (typeof options.recur.byYearDay !== 'undefined' && options.recur.byYearDay.length > 0) {
|
|
3766
|
+
rrule += ';BYYEARDAY=' + joining(options.recur.byYearDay);
|
|
3767
|
+
}
|
|
3768
|
+
if (typeof options.recur.byMonthDay !== 'undefined' && options.recur.byMonthDay.length > 0) {
|
|
3769
|
+
rrule += ';BYMONTHDAY=' + joining(options.recur.byMonthDay);
|
|
3770
|
+
}
|
|
3771
|
+
if (typeof options.recur.byDay !== 'undefined' && options.recur.byDay.length > 0) {
|
|
3772
|
+
rrule += ';BYDAY=' + joining(options.recur.byDay);
|
|
3773
|
+
}
|
|
3774
|
+
if (typeof options.recur.byHour !== 'undefined' && options.recur.byHour.length > 0) {
|
|
3775
|
+
rrule += ';BYHOUR=' + joining(options.recur.byHour);
|
|
3776
|
+
}
|
|
3777
|
+
if (typeof options.recur.byMinute !== 'undefined' && options.recur.byMinute.length > 0) {
|
|
3778
|
+
rrule += ';BYMINUTE=' + joining(options.recur.byMinute);
|
|
3779
|
+
}
|
|
3780
|
+
if (typeof options.recur.bySecond !== 'undefined' && options.recur.bySecond.length > 0) {
|
|
3781
|
+
rrule += ';BYSECOND=' + joining(options.recur.bySecond);
|
|
3782
|
+
}
|
|
3783
|
+
if (typeof options.recur.bySetPos !== 'undefined' && options.recur.bySetPos.length > 0) {
|
|
3784
|
+
rrule += ';BYSETPOS=' + joining(options.recur.bySetPos);
|
|
3785
|
+
}
|
|
3786
|
+
if (typeof options.recur.weekStart !== 'undefined' && options.recur.weekStart !== 'MO') {
|
|
3787
|
+
rrule += ';WKST=' + options.recur.weekStart;
|
|
3788
|
+
}
|
|
3789
|
+
ics += foldICSString('RRULE:' + rrule) + '\r\n';
|
|
90
3790
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
3791
|
+
if (typeof options.alarm !== 'undefined') {
|
|
3792
|
+
for (var i = 0; i < options.alarm.length; i++) {
|
|
3793
|
+
var alarm = options.alarm[i];
|
|
3794
|
+
ics += 'BEGIN:VALARM\r\n'
|
|
3795
|
+
+ 'ACTION:DISPLAY\r\n';
|
|
3796
|
+
if (typeof alarm.datetime !== 'undefined') {
|
|
3797
|
+
ics += 'TRIGGER;VALUE=DATE-TIME:' + dateToICSDateString(alarm.datetime) + '\r\n';
|
|
3798
|
+
}
|
|
3799
|
+
else {
|
|
3800
|
+
var duration = '';
|
|
3801
|
+
if (typeof alarm.before === 'undefined' || alarm.before) {
|
|
3802
|
+
duration += '-';
|
|
3803
|
+
}
|
|
3804
|
+
duration += 'P';
|
|
3805
|
+
if (typeof alarm.weeks !== 'undefined' && alarm.weeks > 0) {
|
|
3806
|
+
duration += String(alarm.weeks) + 'W';
|
|
3807
|
+
}
|
|
3808
|
+
else {
|
|
3809
|
+
if (typeof alarm.days !== 'undefined' && alarm.days > 0) {
|
|
3810
|
+
duration += String(alarm.days) + 'D';
|
|
3811
|
+
}
|
|
3812
|
+
var hasHours = (typeof alarm.hours !== 'undefined' && alarm.hours > 0);
|
|
3813
|
+
var hasMinutes = (typeof alarm.minutes !== 'undefined' && alarm.minutes > 0);
|
|
3814
|
+
var hasSeconds = (typeof alarm.seconds !== 'undefined' && alarm.seconds > 0);
|
|
3815
|
+
if (hasHours || hasMinutes || hasSeconds) {
|
|
3816
|
+
duration += 'T';
|
|
3817
|
+
if (hasHours) {
|
|
3818
|
+
duration += String(alarm.hours) + 'H';
|
|
3819
|
+
}
|
|
3820
|
+
if (hasMinutes) {
|
|
3821
|
+
duration += String(alarm.minutes) + 'M';
|
|
3822
|
+
}
|
|
3823
|
+
if (hasSeconds) {
|
|
3824
|
+
duration += String(alarm.seconds) + 'S';
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
ics += 'TRIGGER:' + duration + '\r\n';
|
|
3829
|
+
}
|
|
3830
|
+
if (typeof alarm.description !== 'undefined') {
|
|
3831
|
+
ics += foldICSString('DESCRIPTION:' + escapeICSString(alarm.description)) + '\r\n';
|
|
3832
|
+
}
|
|
3833
|
+
else {
|
|
3834
|
+
ics += 'DESCRIPTION:Reminder\r\n';
|
|
3835
|
+
}
|
|
3836
|
+
if (typeof alarm.datetime === 'undefined' && typeof alarm.repeat !== 'undefined' && typeof alarm.repeatDuration !== 'undefined') {
|
|
3837
|
+
ics += 'REPEAT:' + String(alarm.repeat) + '\r\n';
|
|
3838
|
+
ics += 'DURATION:PT' + String(alarm.repeatDuration) + 'M\r\n';
|
|
3839
|
+
}
|
|
3840
|
+
ics += 'END:VALARM\r\n';
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
ics += 'END:VEVENT\r\nEND:VCALENDAR';
|
|
3844
|
+
var anchor = createHiddenElement('a');
|
|
3845
|
+
anchor.href = 'data:text/calendar;charset=utf-8,' + globalThis.encodeURIComponent(ics);
|
|
3846
|
+
anchor.download = 'event-' + timestamp + '.ics';
|
|
3847
|
+
dispatchClickEvent(anchor);
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
var IS_IE_MOBILE = /iemobile/i.test(Platform.userAgent);
|
|
3851
|
+
var IS_WINDOWS_PHONE = /windows phone/i.test(Platform.userAgent);
|
|
3852
|
+
|
|
3853
|
+
var metaElement = null;
|
|
3854
|
+
var Theme = {
|
|
3855
|
+
get value() {
|
|
3856
|
+
return getThemeColor();
|
|
3857
|
+
},
|
|
3858
|
+
set value(color) {
|
|
3859
|
+
if (typeof color === 'undefined')
|
|
3860
|
+
removeThemeColor();
|
|
3861
|
+
else
|
|
3862
|
+
setThemeColor(color);
|
|
3863
|
+
},
|
|
3864
|
+
Constants: {},
|
|
3865
|
+
Errors: {},
|
|
3866
|
+
};
|
|
3867
|
+
function getMetaName() {
|
|
3868
|
+
if (IS_IE_MOBILE)
|
|
3869
|
+
return 'msapplication-navbutton-color';
|
|
3870
|
+
if (IS_WINDOWS_PHONE)
|
|
3871
|
+
return 'msapplication-TileColor';
|
|
3872
|
+
return 'theme-color';
|
|
3873
|
+
}
|
|
3874
|
+
function getMeta() {
|
|
3875
|
+
if (metaElement !== null && metaElement.isConnected)
|
|
3876
|
+
return metaElement;
|
|
3877
|
+
return metaElement = globalThis.document.querySelector('meta[name="' + getMetaName() + '"]');
|
|
3878
|
+
}
|
|
3879
|
+
function createMeta() {
|
|
3880
|
+
var meta = globalThis.document.createElement('meta');
|
|
3881
|
+
meta.setAttribute('name', getMetaName());
|
|
3882
|
+
globalThis.document.head.prepend(meta);
|
|
3883
|
+
return metaElement = meta;
|
|
3884
|
+
}
|
|
3885
|
+
function setThemeColor(color) {
|
|
3886
|
+
var meta = getMeta();
|
|
3887
|
+
if (meta === null)
|
|
3888
|
+
meta = createMeta();
|
|
3889
|
+
meta.setAttribute('content', color);
|
|
3890
|
+
}
|
|
3891
|
+
function getThemeColor() {
|
|
3892
|
+
var meta = getMeta();
|
|
3893
|
+
if (!meta)
|
|
3894
|
+
return undefined;
|
|
3895
|
+
var attribute = meta.getAttribute('content');
|
|
3896
|
+
if (typeof attribute == 'string')
|
|
3897
|
+
return attribute;
|
|
3898
|
+
return undefined;
|
|
3899
|
+
}
|
|
3900
|
+
function removeThemeColor() {
|
|
3901
|
+
var meta = getMeta();
|
|
3902
|
+
if (meta) {
|
|
3903
|
+
meta.remove();
|
|
3904
|
+
metaElement = null;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
var Vibration = {
|
|
3909
|
+
run: run,
|
|
3910
|
+
get supported() {
|
|
3911
|
+
return supported$3();
|
|
3912
|
+
},
|
|
3913
|
+
Constants: {},
|
|
3914
|
+
Errors: {
|
|
3915
|
+
NotSupportedError: NotSupportedError,
|
|
3916
|
+
},
|
|
3917
|
+
};
|
|
3918
|
+
function run(pattern) {
|
|
3919
|
+
if (supported$3())
|
|
3920
|
+
return globalThis.navigator.vibrate(pattern);
|
|
3921
|
+
throw new NotSupportedError('\'navigator.vibrate\' does not supported.');
|
|
3922
|
+
}
|
|
3923
|
+
function supported$3() {
|
|
3924
|
+
return typeof globalThis.navigator.vibrate !== 'undefined';
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
var lastPipVideo = null;
|
|
3928
|
+
var eventsBridged = false;
|
|
3929
|
+
var activeOperation = null;
|
|
3930
|
+
var pendingOperation = null;
|
|
3931
|
+
var pendingTarget = undefined;
|
|
3932
|
+
var expectedIsPip = false;
|
|
3933
|
+
var PIP_PRESENTATION_MODE = 'picture-in-picture';
|
|
3934
|
+
var INLINE_PRESENTATION_MODE = 'inline';
|
|
3935
|
+
var onChangeSubscriptionManager$1 = createSubscriptionManager(attachOnChange$1, detachOnChange$1);
|
|
3936
|
+
var onErrorSubscriptionManager = createSubscriptionManager(attachOnError, detachOnError);
|
|
3937
|
+
var Pip = {
|
|
3938
|
+
get supported() {
|
|
3939
|
+
return getEnabled();
|
|
3940
|
+
},
|
|
3941
|
+
get element() {
|
|
3942
|
+
return getElement();
|
|
3943
|
+
},
|
|
3944
|
+
get isPip() {
|
|
3945
|
+
return getIsPip();
|
|
3946
|
+
},
|
|
3947
|
+
request: request,
|
|
3948
|
+
exit: exit,
|
|
3949
|
+
toggle: toggle,
|
|
3950
|
+
onChange: onChangeSubscriptionManager$1.subscribe,
|
|
3951
|
+
onError: onErrorSubscriptionManager.subscribe,
|
|
3952
|
+
Constants: {},
|
|
3953
|
+
Errors: {
|
|
3954
|
+
NotSupportedError: NotSupportedError,
|
|
3955
|
+
},
|
|
3956
|
+
};
|
|
3957
|
+
function hasStandardPipEvents() {
|
|
3958
|
+
return typeof globalThis.document.pictureInPictureEnabled !== 'undefined';
|
|
3959
|
+
}
|
|
3960
|
+
function getEnabled() {
|
|
3961
|
+
if (typeof globalThis.document.pictureInPictureEnabled === 'boolean')
|
|
3962
|
+
return globalThis.document.pictureInPictureEnabled;
|
|
3963
|
+
if (typeof HTMLVideoElement === 'undefined')
|
|
3964
|
+
return false;
|
|
3965
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
3966
|
+
for (var i = 0; i < videos.length; i++) {
|
|
3967
|
+
var video = videos[i];
|
|
3968
|
+
if (typeof video.webkitSupportsPresentationMode === 'function' && video.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE))
|
|
3969
|
+
return true;
|
|
3970
|
+
}
|
|
3971
|
+
return false;
|
|
3972
|
+
}
|
|
3973
|
+
function getElement() {
|
|
3974
|
+
var currentElement = globalThis.document.pictureInPictureElement;
|
|
3975
|
+
if (currentElement !== null && typeof currentElement !== 'undefined')
|
|
3976
|
+
return currentElement;
|
|
3977
|
+
if (lastPipVideo !== null && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE)
|
|
3978
|
+
return lastPipVideo;
|
|
3979
|
+
return null;
|
|
3980
|
+
}
|
|
3981
|
+
function getIsPip() {
|
|
3982
|
+
return getElement() !== null;
|
|
3983
|
+
}
|
|
3984
|
+
function getDefaultTarget() {
|
|
3985
|
+
var video = globalThis.document.querySelector('video');
|
|
3986
|
+
if (video === null)
|
|
3987
|
+
return undefined;
|
|
3988
|
+
return video;
|
|
3989
|
+
}
|
|
3990
|
+
function onWebkitPresentationModeChanged(event) {
|
|
3991
|
+
if (this.webkitPresentationMode === PIP_PRESENTATION_MODE || this.webkitPresentationMode === INLINE_PRESENTATION_MODE && lastPipVideo === this)
|
|
3992
|
+
onChangeSubscriptionManager$1.emit(event);
|
|
3993
|
+
}
|
|
3994
|
+
function bridgeEvents() {
|
|
3995
|
+
if (eventsBridged)
|
|
3996
|
+
return;
|
|
3997
|
+
eventsBridged = true;
|
|
3998
|
+
if (!hasStandardPipEvents()) {
|
|
3999
|
+
bridgeWebkitVideoEvents();
|
|
4000
|
+
if (typeof globalThis.MutationObserver !== 'undefined') {
|
|
4001
|
+
var observer = new MutationObserver(function () {
|
|
4002
|
+
bridgeWebkitVideoEvents();
|
|
4003
|
+
});
|
|
4004
|
+
observer.observe(globalThis.document.documentElement, { childList: true, subtree: true });
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
function bridgeWebkitVideoEvents() {
|
|
4009
|
+
if (typeof globalThis.document === 'undefined')
|
|
4010
|
+
return;
|
|
4011
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
4012
|
+
videos.forEach(function (video) {
|
|
4013
|
+
if (video.__pipBridged__ || !(typeof video.webkitSetPresentationMode !== 'undefined' || typeof video.onwebkitpresentationmodechanged !== 'undefined'))
|
|
4014
|
+
return;
|
|
4015
|
+
EventListener.add(video, { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
|
|
4016
|
+
video.__pipBridged__ = true;
|
|
4017
|
+
});
|
|
4018
|
+
}
|
|
4019
|
+
function attachOnChange$1() {
|
|
4020
|
+
if (hasStandardPipEvents()) {
|
|
4021
|
+
var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
|
|
4022
|
+
for (var i = 0; i < changeEvents.length; i++)
|
|
4023
|
+
EventListener.add(globalThis.document, { type: changeEvents[i], callback: onChangeSubscriptionManager$1.emit, options: false });
|
|
4024
|
+
return;
|
|
4025
|
+
}
|
|
4026
|
+
bridgeWebkitVideoEvents();
|
|
4027
|
+
}
|
|
4028
|
+
function detachOnChange$1() {
|
|
4029
|
+
if (hasStandardPipEvents()) {
|
|
4030
|
+
var changeEvents = ['enterpictureinpicture', 'leavepictureinpicture'];
|
|
4031
|
+
for (var i = 0; i < changeEvents.length; i++)
|
|
4032
|
+
EventListener.remove(globalThis.document, { type: changeEvents[i], callback: onChangeSubscriptionManager$1.emit, options: false });
|
|
4033
|
+
return;
|
|
4034
|
+
}
|
|
4035
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
4036
|
+
videos.forEach(function (video) {
|
|
4037
|
+
EventListener.remove(video, { type: 'webkitpresentationmodechanged', callback: onWebkitPresentationModeChanged, options: false });
|
|
4038
|
+
video.__pipBridged__ = false;
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
function attachOnError() {
|
|
4042
|
+
EventListener.add(globalThis.document, { type: 'pictureinpictureerror', callback: onErrorSubscriptionManager.emit, options: false });
|
|
4043
|
+
}
|
|
4044
|
+
function detachOnError() {
|
|
4045
|
+
EventListener.remove(globalThis.document, { type: 'pictureinpictureerror', callback: onErrorSubscriptionManager.emit, options: false });
|
|
4046
|
+
}
|
|
4047
|
+
function drainPendingOperation() {
|
|
4048
|
+
if (pendingOperation === null) {
|
|
4049
|
+
activeOperation = Promise.resolve().then(function () {
|
|
4050
|
+
if (pendingOperation === null) {
|
|
4051
|
+
activeOperation = null;
|
|
4052
|
+
return;
|
|
4053
|
+
}
|
|
4054
|
+
drainPendingOperation();
|
|
97
4055
|
});
|
|
4056
|
+
return;
|
|
98
4057
|
}
|
|
99
|
-
|
|
4058
|
+
var operation = pendingOperation;
|
|
4059
|
+
var target = pendingTarget;
|
|
4060
|
+
pendingOperation = null;
|
|
4061
|
+
pendingTarget = undefined;
|
|
4062
|
+
var next;
|
|
4063
|
+
if (operation === 'request')
|
|
4064
|
+
next = requestImmediately(target);
|
|
4065
|
+
else
|
|
4066
|
+
next = exitImmediately();
|
|
4067
|
+
activeOperation = next
|
|
4068
|
+
.then(drainPendingOperation)
|
|
4069
|
+
.catch(drainPendingOperation);
|
|
4070
|
+
}
|
|
4071
|
+
function request(target) {
|
|
4072
|
+
expectedIsPip = true;
|
|
4073
|
+
if (activeOperation === null) {
|
|
4074
|
+
var next = requestImmediately(target);
|
|
4075
|
+
activeOperation = next
|
|
4076
|
+
.then(drainPendingOperation)
|
|
4077
|
+
.catch(drainPendingOperation);
|
|
4078
|
+
return next;
|
|
100
4079
|
}
|
|
101
|
-
|
|
4080
|
+
pendingOperation = 'request';
|
|
4081
|
+
pendingTarget = target;
|
|
4082
|
+
return activeOperation.then(function () {
|
|
4083
|
+
return Promise.resolve();
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4086
|
+
function exit() {
|
|
4087
|
+
expectedIsPip = false;
|
|
4088
|
+
if (activeOperation === null) {
|
|
4089
|
+
var next = exitImmediately();
|
|
4090
|
+
activeOperation = next
|
|
4091
|
+
.then(drainPendingOperation)
|
|
4092
|
+
.catch(drainPendingOperation);
|
|
4093
|
+
return next;
|
|
4094
|
+
}
|
|
4095
|
+
pendingOperation = 'exit';
|
|
4096
|
+
pendingTarget = undefined;
|
|
4097
|
+
return activeOperation.then(function () {
|
|
4098
|
+
return Promise.resolve();
|
|
4099
|
+
});
|
|
4100
|
+
}
|
|
4101
|
+
function requestImmediately(target) {
|
|
4102
|
+
return new Promise(function (resolve, reject) {
|
|
4103
|
+
if (typeof target === 'undefined')
|
|
4104
|
+
target = getDefaultTarget();
|
|
4105
|
+
if (typeof target === 'undefined')
|
|
4106
|
+
return reject(new NotSupportedError('Failed to enter Picture-in-Picture mode.'));
|
|
4107
|
+
var tagName = target.tagName.toLowerCase();
|
|
4108
|
+
if (tagName !== 'video')
|
|
4109
|
+
return reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
|
|
4110
|
+
var method = target.requestPictureInPicture;
|
|
4111
|
+
if (typeof method === 'function') {
|
|
4112
|
+
var result = method.call(target);
|
|
4113
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
4114
|
+
result
|
|
4115
|
+
.then(function () { resolve(); })
|
|
4116
|
+
.catch(function () {
|
|
4117
|
+
fallbackToWebkitVideo();
|
|
4118
|
+
});
|
|
4119
|
+
return;
|
|
4120
|
+
}
|
|
4121
|
+
else {
|
|
4122
|
+
return resolve();
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
function fallbackToWebkitVideo() {
|
|
4126
|
+
if (typeof target !== 'undefined' && typeof target.webkitSupportsPresentationMode === 'function' && target.webkitSupportsPresentationMode(PIP_PRESENTATION_MODE) && typeof target.webkitSetPresentationMode === 'function') {
|
|
4127
|
+
if (target.disablePictureInPicture)
|
|
4128
|
+
return reject(new NotSupportedError('Picture-in-Picture is disabled on this video element.'));
|
|
4129
|
+
lastPipVideo = target;
|
|
4130
|
+
bridgeWebkitVideoEvents();
|
|
4131
|
+
target.webkitSetPresentationMode(PIP_PRESENTATION_MODE);
|
|
4132
|
+
return resolve();
|
|
4133
|
+
}
|
|
4134
|
+
reject(new NotSupportedError('The "' + tagName + '" element does not support Picture-in-Picture requests.'));
|
|
4135
|
+
}
|
|
4136
|
+
fallbackToWebkitVideo();
|
|
4137
|
+
});
|
|
4138
|
+
}
|
|
4139
|
+
function exitImmediately() {
|
|
4140
|
+
return new Promise(function (resolve, reject) {
|
|
4141
|
+
var method = globalThis.document.exitPictureInPicture;
|
|
4142
|
+
if (typeof method === 'function') {
|
|
4143
|
+
var result = method.call(globalThis.document);
|
|
4144
|
+
if (typeof result !== 'undefined' && typeof result.then === 'function') {
|
|
4145
|
+
result
|
|
4146
|
+
.then(resolve)
|
|
4147
|
+
.catch(function () {
|
|
4148
|
+
fallbackToWebkitVideo();
|
|
4149
|
+
});
|
|
4150
|
+
return;
|
|
4151
|
+
}
|
|
4152
|
+
else {
|
|
4153
|
+
return resolve();
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
function fallbackToWebkitVideo() {
|
|
4157
|
+
if (lastPipVideo !== null) {
|
|
4158
|
+
if (typeof lastPipVideo.webkitSetPresentationMode === 'function' && lastPipVideo.webkitPresentationMode === PIP_PRESENTATION_MODE) {
|
|
4159
|
+
lastPipVideo.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
|
|
4160
|
+
lastPipVideo = null;
|
|
4161
|
+
return resolve();
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
4164
|
+
var videos = globalThis.document.querySelectorAll('video');
|
|
4165
|
+
for (var i = 0; i < videos.length; i++) {
|
|
4166
|
+
var video = videos[i];
|
|
4167
|
+
if (typeof video.webkitSetPresentationMode === 'function' && video.webkitPresentationMode === PIP_PRESENTATION_MODE) {
|
|
4168
|
+
video.webkitSetPresentationMode(INLINE_PRESENTATION_MODE);
|
|
4169
|
+
lastPipVideo = null;
|
|
4170
|
+
return resolve();
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
if (getElement() === null)
|
|
4174
|
+
return resolve();
|
|
4175
|
+
reject(new NotSupportedError('Failed to exit Picture-in-Picture mode.'));
|
|
4176
|
+
}
|
|
4177
|
+
fallbackToWebkitVideo();
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
function toggle(target) {
|
|
4181
|
+
if (expectedIsPip)
|
|
4182
|
+
return exit();
|
|
4183
|
+
return request(target);
|
|
4184
|
+
}
|
|
4185
|
+
bridgeEvents();
|
|
4186
|
+
|
|
4187
|
+
var Badge = {
|
|
4188
|
+
set: set,
|
|
4189
|
+
clear: clear,
|
|
4190
|
+
get supported() {
|
|
4191
|
+
return supported$2();
|
|
4192
|
+
},
|
|
4193
|
+
Constants: {},
|
|
4194
|
+
Errors: {
|
|
4195
|
+
NotSupportedError: NotSupportedError,
|
|
4196
|
+
},
|
|
4197
|
+
};
|
|
4198
|
+
function set(contents) {
|
|
4199
|
+
if (supported$2())
|
|
4200
|
+
return globalThis.navigator.setAppBadge(contents);
|
|
4201
|
+
return Promise.reject(new NotSupportedError('\'navigator.setAppBadge\' does not supported.'));
|
|
4202
|
+
}
|
|
4203
|
+
function clear() {
|
|
4204
|
+
return this.set(0);
|
|
4205
|
+
}
|
|
4206
|
+
function supported$2() {
|
|
4207
|
+
return typeof globalThis.navigator.setAppBadge !== 'undefined';
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
var Notification = {
|
|
4211
|
+
send: send,
|
|
4212
|
+
get supported() {
|
|
4213
|
+
return supported$1();
|
|
4214
|
+
},
|
|
4215
|
+
Constants: {},
|
|
4216
|
+
Errors: {
|
|
4217
|
+
NotSupportedError: NotSupportedError,
|
|
4218
|
+
PermissionNotGrantedError: PermissionNotGrantedError,
|
|
4219
|
+
},
|
|
4220
|
+
};
|
|
4221
|
+
function send(options) {
|
|
4222
|
+
return new Promise(function (resolve, reject) {
|
|
4223
|
+
if (!supported$1())
|
|
4224
|
+
return reject(new NotSupportedError('\'window.Notification\' does not supported.'));
|
|
4225
|
+
Permission
|
|
4226
|
+
.request(PermissionType.Notification)
|
|
4227
|
+
.then(function (state) {
|
|
4228
|
+
if (state === PermissionState.Grant) {
|
|
4229
|
+
var constructorOptions = {
|
|
4230
|
+
badge: options.badge,
|
|
4231
|
+
body: options.body,
|
|
4232
|
+
data: options.data,
|
|
4233
|
+
dir: options.dir,
|
|
4234
|
+
icon: options.icon,
|
|
4235
|
+
lang: options.lang,
|
|
4236
|
+
requireInteraction: options.requireInteraction,
|
|
4237
|
+
silent: options.silent,
|
|
4238
|
+
tag: options.tag,
|
|
4239
|
+
};
|
|
4240
|
+
var notification = new globalThis.Notification(options.title, constructorOptions);
|
|
4241
|
+
if (typeof options.onClick !== 'undefined')
|
|
4242
|
+
notification.onclick = options.onClick;
|
|
4243
|
+
if (typeof options.onShow !== 'undefined')
|
|
4244
|
+
notification.onshow = options.onShow;
|
|
4245
|
+
if (typeof options.onClose !== 'undefined')
|
|
4246
|
+
notification.onclose = options.onClose;
|
|
4247
|
+
if (typeof options.onError !== 'undefined')
|
|
4248
|
+
notification.onerror = options.onError;
|
|
4249
|
+
resolve(notification);
|
|
4250
|
+
}
|
|
4251
|
+
else {
|
|
4252
|
+
reject(new PermissionNotGrantedError('\'notification\' permission is not granted.'));
|
|
4253
|
+
}
|
|
4254
|
+
});
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
function supported$1() {
|
|
4258
|
+
return typeof globalThis.Notification !== 'undefined';
|
|
102
4259
|
}
|
|
103
4260
|
|
|
104
|
-
var
|
|
4261
|
+
var onChangeSubscriptionManager = createSubscriptionManager(attachOnChange, detachOnChange);
|
|
4262
|
+
var batteryRef = null;
|
|
4263
|
+
var Battery = {
|
|
4264
|
+
get value() {
|
|
4265
|
+
return getValue();
|
|
4266
|
+
},
|
|
4267
|
+
get supported() {
|
|
4268
|
+
return supported();
|
|
4269
|
+
},
|
|
4270
|
+
onChange: onChangeSubscriptionManager.subscribe,
|
|
4271
|
+
Constants: {},
|
|
4272
|
+
Errors: {
|
|
4273
|
+
NotSupportedError: NotSupportedError,
|
|
4274
|
+
},
|
|
4275
|
+
};
|
|
4276
|
+
function getValue() {
|
|
4277
|
+
return new Promise(function (resolve, reject) {
|
|
4278
|
+
if (!supported())
|
|
4279
|
+
return reject(new NotSupportedError('\'navigator.getBattery\' does not supported.'));
|
|
4280
|
+
globalThis.navigator.getBattery()
|
|
4281
|
+
.then(resolve);
|
|
4282
|
+
});
|
|
4283
|
+
}
|
|
4284
|
+
function attachOnChange() {
|
|
4285
|
+
if (!supported())
|
|
4286
|
+
return;
|
|
4287
|
+
globalThis.navigator.getBattery()
|
|
4288
|
+
.then(function (battery) {
|
|
4289
|
+
batteryRef = battery;
|
|
4290
|
+
EventListener.add(battery, { type: 'chargingchange', callback: onBatteryChange });
|
|
4291
|
+
EventListener.add(battery, { type: 'levelchange', callback: onBatteryChange });
|
|
4292
|
+
EventListener.add(battery, { type: 'chargingtimechange', callback: onBatteryChange });
|
|
4293
|
+
EventListener.add(battery, { type: 'dischargingtimechange', callback: onBatteryChange });
|
|
4294
|
+
});
|
|
4295
|
+
}
|
|
4296
|
+
function detachOnChange() {
|
|
4297
|
+
if (!supported() || batteryRef === null)
|
|
4298
|
+
return;
|
|
4299
|
+
EventListener.add(batteryRef, { type: 'chargingchange', callback: onBatteryChange });
|
|
4300
|
+
EventListener.add(batteryRef, { type: 'levelchange', callback: onBatteryChange });
|
|
4301
|
+
EventListener.add(batteryRef, { type: 'chargingtimechange', callback: onBatteryChange });
|
|
4302
|
+
EventListener.add(batteryRef, { type: 'dischargingtimechange', callback: onBatteryChange });
|
|
4303
|
+
batteryRef = null;
|
|
4304
|
+
}
|
|
4305
|
+
function onBatteryChange() {
|
|
4306
|
+
onChangeSubscriptionManager.emit(batteryRef);
|
|
4307
|
+
}
|
|
4308
|
+
function supported() {
|
|
4309
|
+
return typeof globalThis.navigator.getBattery !== 'undefined';
|
|
4310
|
+
}
|
|
105
4311
|
|
|
106
4312
|
(function () {
|
|
107
4313
|
if (typeof globalThis === 'object')
|
|
108
4314
|
return;
|
|
109
4315
|
Object.defineProperty(Object.prototype, '__getGlobalThis__', {
|
|
110
|
-
get: function () {
|
|
4316
|
+
get: function () {
|
|
4317
|
+
return this;
|
|
4318
|
+
},
|
|
111
4319
|
configurable: true
|
|
112
4320
|
});
|
|
113
4321
|
try {
|
|
@@ -123,20 +4331,21 @@ var PluginNotExtendedError = createCustomError('PluginNotExtendedError');
|
|
|
123
4331
|
}
|
|
124
4332
|
}());
|
|
125
4333
|
var Native = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
4334
|
+
version: packageJSON.version,
|
|
4335
|
+
appearance: Appearance,
|
|
4336
|
+
badge: Badge,
|
|
4337
|
+
battery: Battery,
|
|
4338
|
+
clipboard: Clipboard,
|
|
4339
|
+
dimension: Dimension,
|
|
4340
|
+
fullscreen: Fullscreen,
|
|
4341
|
+
geolocation: Geolocation,
|
|
4342
|
+
notification: Notification,
|
|
4343
|
+
open: Open,
|
|
4344
|
+
permission: Permission,
|
|
4345
|
+
pip: Pip,
|
|
4346
|
+
platform: Platform,
|
|
4347
|
+
theme: Theme,
|
|
4348
|
+
vibration: Vibration,
|
|
140
4349
|
};
|
|
141
4350
|
|
|
142
4351
|
module.exports = Native;
|