This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

5
node_modules/ismobilejs/.dependabot/config.yml generated vendored Normal file
View File

@@ -0,0 +1,5 @@
version: 1
update_configs:
- package_manager: "javascript"
directory: "/"
update_schedule: "daily"

3
node_modules/ismobilejs/.eslintignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
cjs
dist
esm

1
node_modules/ismobilejs/.eslintrc.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('@spotify/web-scripts/config/eslintrc.js');

View File

@@ -0,0 +1,23 @@
name: Node CI
on:
push:
branches:
- refs/pull/*
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10, 12]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn lint
- run: yarn build
- run: yarn test

23
node_modules/ismobilejs/.github/workflows/release.yml generated vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Node CD
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: "https://registry.npmjs.org"
- run: yarn install
- run: yarn build
- run: yarn release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

10
node_modules/ismobilejs/CONTRIBUTORS.md generated vendored Normal file
View File

@@ -0,0 +1,10 @@
* Igor Ribeio Lima ([https://github.com/igorlima](https://github.com/igorlima))
* Clay Hinson ([https://github.com/clayhinson](https://github.com/clayhinson))
* Vitaly Orlov ([https://github.com/orloffv](https://github.com/orloffv))
* Shinnosuke Watanabe ([https://github.com/shinnn](https://github.com/shinnn))
* Vladimir Matsola ([https://github.com/vomchik](https://github.com/vomchik))
* Bryce Neal ([https://github.com/prettymuchbryce](https://github.com/prettymuchbryce))
* Todd Smith-Salter ([https://github.com/ToddSmithSalter](https://github.com/ToddSmithSalter))
* Ma Cheng ([https://github.com/mc-zone](https://github.com/mc-zone))
* Ruslan Ismagilov ([https://github.com/isRuslan](https://github.com/isRuslan))
* Samuli Hiltunen ([https://github.com/samuli-hiltunen-somedia](https://github.com/samuli-hiltunen-somedia))

21
node_modules/ismobilejs/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Kai Mallea
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

187
node_modules/ismobilejs/README.md generated vendored Normal file
View File

@@ -0,0 +1,187 @@
[![Build Status](https://travis-ci.org/kaimallea/isMobile.png)](https://travis-ci.org/kaimallea/isMobile)
[![Node dependencies status](https://david-dm.org/kaimallea/isMobile.png)](https://david-dm.org/kaimallea/isMobile)
[![](https://data.jsdelivr.com/v1/package/npm/ismobilejs/badge)](https://www.jsdelivr.com/package/npm/ismobilejs)
# isMobile
A simple JS library that detects mobile devices in both the browser and NodeJS.
## Why use isMobile?
### In the Browser
You might not need this library. In most cases, [responsive design](https://en.wikipedia.org/wiki/Responsive_web_design) solves the problem of controlling how to render things across different screen sizes. I recommend a [mobile first](https://medium.com/@Vincentxia77/what-is-mobile-first-design-why-its-important-how-to-make-it-7d3cf2e29d00) approach. But there are always edge cases. If you have an edge case, then this library might be for you.
My edge case at the time was redirecting users to a completely separate mobile site. I tried to keep this script small (**currently ~1.3k bytes, minified**) and simple, because it would need to execute in the `<head>`, which is generally a bad idea, since JS blocks the downloading and rendering of all assets while it parses and executes. In the case of mobile redirection, I don't mind so much, because I want to start the redirect as soon as possible, before the device has a chance to start downloading and rendering other stuff. For non-mobile platforms, the script should execute fast, so the browser can quickly get back to downloading and rendering.
#### How it works in the browser
isMobile runs quickly during initial page load to detect mobile devices; it then creates a JavaScript object with the results.
### In NodeJS
You might want to use this library to do server-side device detection to minimize the amount of bytes you send back to visitors. Or you have your own arbitrary use case.
#### How is works in NodeJS
You import and call the `isMobile` function, passing it a user agent string; it then returns a JavaScript object with the results.
## Devices detected by isMobile
In a browser, the following properties of the global `isMobile` object will either be `true` or `false`. In Node, `isMobile` will be whatever you named the variable.
### Apple devices
- `isMobile.apple.phone`
- `isMobile.apple.ipod`
- `isMobile.apple.tablet`
- `isMobile.apple.universal`
- `isMobile.apple.device` (any mobile Apple device)
### Android devices
- `isMobile.android.phone`
- `isMobile.android.tablet`
- `isMobile.android.device` (any mobile Android device; OkHttp user agents will match this)
### Amazon Silk devices (also passes Android checks)
- `isMobile.amazon.phone`
- `isMobile.amazon.tablet`
- `isMobile.amazon.device` (any mobile Amazon Silk device)
### Windows devices
- `isMobile.windows.phone`
- `isMobile.windows.tablet`
- `isMobile.windows.device` (any mobile Windows device)
### "Other" devices
- `isMobile.other.blackberry_10`
- `isMobile.other.blackberry`
- `isMobile.other.opera` (Opera Mini)
- `isMobile.other.firefox`
- `isMobile.other.chrome`
- `isMobile.other.device` (any "Other" device)
### Aggregate Groupings
- `isMobile.any` - any device matched
- `isMobile.phone` - any device in the 'phone' groups above
- `isMobile.tablet` - any device in the 'tablet' groups above
## Usage
### Node.js
#### Install
```bash
yarn add ismobilejs
```
or
```bash
npm install ismobilejs
```
#### Use
```ts
import isMobile from 'ismobilejs';
const userAgent = req.headers['user-agent'];
console.log(isMobile(userAgent).any);
```
Or pass in a `window.navigator`-shaped object that includes at least a `userAgent` property. To properly detect iPad on iOS 13, the object should also include the `platform` and `maxTouchPoints` properties.
```js
// this is just an example. window.navigator is readonly in the browser
window.navigator = {
...
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)',
platform: 'MacIntel',
maxTouchPoints: 2,
..
}
```
```ts
import isMobile from 'ismobilejs';
console.log(isMobile(window.navigator).apple.tablet);
```
### Browser
A real-word example: I include the minified version of the script, inline, and at the top of the `<head>`. Cellular connections tend to suck, so it would be wasteful overhead to open another connection, just to download ~1.3kb of JS:
<!-- prettier-ignore -->
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script>
// Minified version of isMobile included in the HTML since it's small
(function () {var a={};var f=/iPhone/i,h=/iPod/i,i=/iPad/i,r=/\biOS-universal(?:.+)Mac\b/i,g=/\bAndroid(?:.+)Mobile\b/i,j=/Android/i,c=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,d=/Silk/i,b=/Windows Phone/i,k=/\bWindows(?:.+)ARM\b/i,m=/BlackBerry/i,n=/BB10/i,o=/Opera Mini/i,p=/\b(CriOS|Chrome)(?:.+)Mobile/i,q=/Mobile(?:.+)Firefox\b/i;function s(l){return function($){return $.test(l)}}function e(l){var $=(l=l||("undefined"!=typeof navigator?navigator.userAgent:"")).split("[FBAN");void 0!==$[1]&&(l=$[0]),void 0!==($=l.split("Twitter"))[1]&&(l=$[0]);var a=s(l),e={apple:{phone:a(f)&&!a(b),ipod:a(h),tablet:!a(f)&&a(i)&&!a(b),universal:a(r),device:(a(f)||a(h)||a(i))&&!a(b)},amazon:{phone:a(c),tablet:!a(c)&&a(d),device:a(c)||a(d)},android:{phone:!a(b)&&a(c)||!a(b)&&a(g),tablet:!a(b)&&!a(c)&&!a(g)&&(a(d)||a(j)),device:!a(b)&&(a(c)||a(d)||a(g)||a(j))||a(/\bokhttp\b/i)},windows:{phone:a(b),tablet:a(k),device:a(b)||a(k)},other:{blackberry:a(m),blackberry10:a(n),opera:a(o),firefox:a(q),chrome:a(p),device:a(m)||a(n)||a(o)||a(q)||a(p)},any:!1,phone:!1,tablet:!1};return e.any=e.apple.universal||e.apple.device||e.android.device||e.windows.device||e.other.device,e.phone=e.apple.phone||e.android.phone||e.windows.phone,e.tablet=e.apple.tablet||e.android.tablet||e.windows.tablet,e}a=e();if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=a}else if(typeof define==="function"&&define.amd){define(function(){return a})}else{this["isMobile"]=a}})();
// My own arbitrary use of isMobile, as an example
(function() {
var MOBILE_SITE = '/mobile/index.html', // site to redirect to
NO_REDIRECT = 'noredirect'; // cookie to prevent redirect
// I only want to redirect iPhones, Android phones
if (isMobile.apple.phone || isMobile.android.phone) {
// Only redirect if the user didn't previously choose
// to explicitly view the full site. This is validated
// by checking if a "noredirect" cookie exists
if (document.cookie.indexOf(NO_REDIRECT) === -1) {
document.location = MOBILE_SITE;
}
}
})();
</script>
</head>
<body>
<!-- imagine lots of html and content -->
</body>
</html>
```
### jsDelivr CDN [![](https://data.jsdelivr.com/v1/package/npm/ismobilejs/badge)](https://www.jsdelivr.com/package/npm/ismobilejs)
Alternatively, you can include this library via [jsDelivr CDN](https://www.jsdelivr.com/package/npm/ismobilejs) in a `script` tag:
`<script src="https://cdn.jsdelivr.net/npm/ismobilejs@1/dist/isMobile.min.js"></script>`
**Visit the isMobile [jsDelivr page](https://www.jsdelivr.com/package/npm/ismobilejs) to get the most up-to-date URL pointing to the lastest version.**
## Building manually
After checking out the repo, install dependencies:
```bash
yarn install
```
Then build the library:
```bash
yarn build
```
Three versions of the library will be generated:
1. `./cjs/index.js` - the CommonJS version of the library
2. `./esm/index.js` - the ESModule version of the library
3. `./dist/isMobile.min.js` - the browser version of the library
Additionally, types will be output to `types`.
## Contributing
This library uses Spotify's [web-scripts](https://github.com/spotify/web-scripts) project to build, lint, test, format and release the this library.
You must use `yarn commit` rather than `git commit` to commit files. This enforced commit messages to following a specific format and enables automation of release notes and version bump.

2
node_modules/ismobilejs/cjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './isMobile';
export { default } from './isMobile';

9
node_modules/ismobilejs/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__export(require("./isMobile"));
var isMobile_1 = require("./isMobile");
exports["default"] = isMobile_1["default"];
//# sourceMappingURL=index.js.map

1
node_modules/ismobilejs/cjs/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,gCAA2B;AAC3B,uCAAqC;AAA5B,gCAAA,SAAO,EAAA"}

43
node_modules/ismobilejs/cjs/isMobile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
export declare type UserAgent = string;
export declare type Navigator = {
userAgent: string;
platform: string;
maxTouchPoints?: number;
};
export declare type isMobileResult = {
apple: {
phone: boolean;
ipod: boolean;
tablet: boolean;
universal: boolean;
device: boolean;
};
amazon: {
phone: boolean;
tablet: boolean;
device: boolean;
};
android: {
phone: boolean;
tablet: boolean;
device: boolean;
};
windows: {
phone: boolean;
tablet: boolean;
device: boolean;
};
other: {
blackberry: boolean;
blackberry10: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
};
phone: boolean;
tablet: boolean;
any: boolean;
};
export declare type IsMobileParameter = UserAgent | Navigator;
export default function isMobile(param?: IsMobileParameter): isMobileResult;

128
node_modules/ismobilejs/cjs/isMobile.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
"use strict";
exports.__esModule = true;
var appleIphone = /iPhone/i;
var appleIpod = /iPod/i;
var appleTablet = /iPad/i;
var appleUniversal = /\biOS-universal(?:.+)Mac\b/i;
var androidPhone = /\bAndroid(?:.+)Mobile\b/i;
var androidTablet = /Android/i;
var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i;
var amazonTablet = /Silk/i;
var windowsPhone = /Windows Phone/i;
var windowsTablet = /\bWindows(?:.+)ARM\b/i;
var otherBlackBerry = /BlackBerry/i;
var otherBlackBerry10 = /BB10/i;
var otherOpera = /Opera Mini/i;
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
var otherFirefox = /Mobile(?:.+)Firefox\b/i;
var isAppleTabletOnIos13 = function (navigator) {
return (typeof navigator !== 'undefined' &&
navigator.platform === 'MacIntel' &&
typeof navigator.maxTouchPoints === 'number' &&
navigator.maxTouchPoints > 1 &&
typeof MSStream === 'undefined');
};
function createMatch(userAgent) {
return function (regex) { return regex.test(userAgent); };
}
function isMobile(param) {
var nav = {
userAgent: '',
platform: '',
maxTouchPoints: 0
};
if (!param && typeof navigator !== 'undefined') {
nav = {
userAgent: navigator.userAgent,
platform: navigator.platform,
maxTouchPoints: navigator.maxTouchPoints || 0
};
}
else if (typeof param === 'string') {
nav.userAgent = param;
}
else if (param && param.userAgent) {
nav = {
userAgent: param.userAgent,
platform: param.platform,
maxTouchPoints: param.maxTouchPoints || 0
};
}
var userAgent = nav.userAgent;
var tmp = userAgent.split('[FBAN');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
tmp = userAgent.split('Twitter');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
var match = createMatch(userAgent);
var result = {
apple: {
phone: match(appleIphone) && !match(windowsPhone),
ipod: match(appleIpod),
tablet: !match(appleIphone) &&
(match(appleTablet) || isAppleTabletOnIos13(nav)) &&
!match(windowsPhone),
universal: match(appleUniversal),
device: (match(appleIphone) ||
match(appleIpod) ||
match(appleTablet) ||
match(appleUniversal) ||
isAppleTabletOnIos13(nav)) &&
!match(windowsPhone)
},
amazon: {
phone: match(amazonPhone),
tablet: !match(amazonPhone) && match(amazonTablet),
device: match(amazonPhone) || match(amazonTablet)
},
android: {
phone: (!match(windowsPhone) && match(amazonPhone)) ||
(!match(windowsPhone) && match(androidPhone)),
tablet: !match(windowsPhone) &&
!match(amazonPhone) &&
!match(androidPhone) &&
(match(amazonTablet) || match(androidTablet)),
device: (!match(windowsPhone) &&
(match(amazonPhone) ||
match(amazonTablet) ||
match(androidPhone) ||
match(androidTablet))) ||
match(/\bokhttp\b/i)
},
windows: {
phone: match(windowsPhone),
tablet: match(windowsTablet),
device: match(windowsPhone) || match(windowsTablet)
},
other: {
blackberry: match(otherBlackBerry),
blackberry10: match(otherBlackBerry10),
opera: match(otherOpera),
firefox: match(otherFirefox),
chrome: match(otherChrome),
device: match(otherBlackBerry) ||
match(otherBlackBerry10) ||
match(otherOpera) ||
match(otherFirefox) ||
match(otherChrome)
},
any: false,
phone: false,
tablet: false
};
result.any =
result.apple.device ||
result.android.device ||
result.windows.device ||
result.other.device;
result.phone =
result.apple.phone || result.android.phone || result.windows.phone;
result.tablet =
result.apple.tablet || result.android.tablet || result.windows.tablet;
return result;
}
exports["default"] = isMobile;
//# sourceMappingURL=isMobile.js.map

1
node_modules/ismobilejs/cjs/isMobile.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"isMobile.js","sourceRoot":"","sources":["../src/isMobile.ts"],"names":[],"mappings":";;AAAA,IAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,IAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,IAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,IAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,IAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,IAAM,aAAa,GAAG,UAAU,CAAC;AACjC,IAAM,WAAW,GAAG,oCAAoC,CAAC;AACzD,IAAM,YAAY,GAAG,OAAO,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AiB,CAAC;gBACxB,KAAK,CAAC,UAAU,CAAC;gBACjB,KAAK,CAAC,YAAY,CAAC;gBACnB,KAAK,CAAC,WAAW,CAAC;SACrB;QACD,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;KACd,CAAC;IAEF,MAAM,CAAC,GAAG;QACR,MAAM,CAAC,KAAK,CAAC,MAAM;YACnB,MAAM,CAAC,OAAO,CAAC,MAAM;YACrB,MAAM,CAAC,OAAO,CAAC,MAAM;YACrB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;IAEtB,MAAM,CAAC,KAAK;QACV,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACrE,MAAM,CAAC,MAAM;QACX,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IAExE,OAAO,MAAM,CAAC;AAChB,CAAC;AApHD,8BAoHC"}

1
node_modules/ismobilejs/dist/isMobile.min.js generated vendored Normal file
View File

@@ -0,0 +1 @@
(function () {var f={};var g=/iPhone/i,i=/iPod/i,j=/iPad/i,k=/\biOS-universal(?:.+)Mac\b/i,h=/\bAndroid(?:.+)Mobile\b/i,m=/Android/i,c=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,d=/Silk/i,b=/Windows Phone/i,n=/\bWindows(?:.+)ARM\b/i,p=/BlackBerry/i,q=/BB10/i,s=/Opera Mini/i,t=/\b(CriOS|Chrome)(?:.+)Mobile/i,u=/Mobile(?:.+)Firefox\b/i,v=function(l){return void 0!==l&&"MacIntel"===l.platform&&"number"==typeof l.maxTouchPoints&&l.maxTouchPoints>1&&"undefined"==typeof MSStream};function w(l){return function($){return $.test(l)}}function x(l){var $={userAgent:"",platform:"",maxTouchPoints:0};l||"undefined"==typeof navigator?"string"==typeof l?$.userAgent=l:l&&l.userAgent&&($={userAgent:l.userAgent,platform:l.platform,maxTouchPoints:l.maxTouchPoints||0}):$={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var a=$.userAgent,e=a.split("[FBAN");void 0!==e[1]&&(a=e[0]),void 0!==(e=a.split("Twitter"))[1]&&(a=e[0]);var r=w(a),o={apple:{phone:r(g)&&!r(b),ipod:r(i),tablet:!r(g)&&(r(j)||v($))&&!r(b),universal:r(k),device:(r(g)||r(i)||r(j)||r(k)||v($))&&!r(b)},amazon:{phone:r(c),tablet:!r(c)&&r(d),device:r(c)||r(d)},android:{phone:!r(b)&&r(c)||!r(b)&&r(h),tablet:!r(b)&&!r(c)&&!r(h)&&(r(d)||r(m)),device:!r(b)&&(r(c)||r(d)||r(h)||r(m))||r(/\bokhttp\b/i)},windows:{phone:r(b),tablet:r(n),device:r(b)||r(n)},other:{blackberry:r(p),blackberry10:r(q),opera:r(s),firefox:r(u),chrome:r(t),device:r(p)||r(q)||r(s)||r(u)||r(t)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}f=x();if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f}else if(typeof define==="function"&&define.amd){define(function(){return f})}else{this["isMobile"]=f}})();

2
node_modules/ismobilejs/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './isMobile';
export { default } from './isMobile';

3
node_modules/ismobilejs/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './isMobile';
export { default } from './isMobile';
//# sourceMappingURL=index.js.map

1
node_modules/ismobilejs/esm/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}

43
node_modules/ismobilejs/esm/isMobile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
export declare type UserAgent = string;
export declare type Navigator = {
userAgent: string;
platform: string;
maxTouchPoints?: number;
};
export declare type isMobileResult = {
apple: {
phone: boolean;
ipod: boolean;
tablet: boolean;
universal: boolean;
device: boolean;
};
amazon: {
phone: boolean;
tablet: boolean;
device: boolean;
};
android: {
phone: boolean;
tablet: boolean;
device: boolean;
};
windows: {
phone: boolean;
tablet: boolean;
device: boolean;
};
other: {
blackberry: boolean;
blackberry10: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
};
phone: boolean;
tablet: boolean;
any: boolean;
};
export declare type IsMobileParameter = UserAgent | Navigator;
export default function isMobile(param?: IsMobileParameter): isMobileResult;

125
node_modules/ismobilejs/esm/isMobile.js generated vendored Normal file
View File

@@ -0,0 +1,125 @@
var appleIphone = /iPhone/i;
var appleIpod = /iPod/i;
var appleTablet = /iPad/i;
var appleUniversal = /\biOS-universal(?:.+)Mac\b/i;
var androidPhone = /\bAndroid(?:.+)Mobile\b/i;
var androidTablet = /Android/i;
var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i;
var amazonTablet = /Silk/i;
var windowsPhone = /Windows Phone/i;
var windowsTablet = /\bWindows(?:.+)ARM\b/i;
var otherBlackBerry = /BlackBerry/i;
var otherBlackBerry10 = /BB10/i;
var otherOpera = /Opera Mini/i;
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
var otherFirefox = /Mobile(?:.+)Firefox\b/i;
var isAppleTabletOnIos13 = function (navigator) {
return (typeof navigator !== 'undefined' &&
navigator.platform === 'MacIntel' &&
typeof navigator.maxTouchPoints === 'number' &&
navigator.maxTouchPoints > 1 &&
typeof MSStream === 'undefined');
};
function createMatch(userAgent) {
return function (regex) { return regex.test(userAgent); };
}
export default function isMobile(param) {
var nav = {
userAgent: '',
platform: '',
maxTouchPoints: 0
};
if (!param && typeof navigator !== 'undefined') {
nav = {
userAgent: navigator.userAgent,
platform: navigator.platform,
maxTouchPoints: navigator.maxTouchPoints || 0
};
}
else if (typeof param === 'string') {
nav.userAgent = param;
}
else if (param && param.userAgent) {
nav = {
userAgent: param.userAgent,
platform: param.platform,
maxTouchPoints: param.maxTouchPoints || 0
};
}
var userAgent = nav.userAgent;
var tmp = userAgent.split('[FBAN');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
tmp = userAgent.split('Twitter');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
var match = createMatch(userAgent);
var result = {
apple: {
phone: match(appleIphone) && !match(windowsPhone),
ipod: match(appleIpod),
tablet: !match(appleIphone) &&
(match(appleTablet) || isAppleTabletOnIos13(nav)) &&
!match(windowsPhone),
universal: match(appleUniversal),
device: (match(appleIphone) ||
match(appleIpod) ||
match(appleTablet) ||
match(appleUniversal) ||
isAppleTabletOnIos13(nav)) &&
!match(windowsPhone)
},
amazon: {
phone: match(amazonPhone),
tablet: !match(amazonPhone) && match(amazonTablet),
device: match(amazonPhone) || match(amazonTablet)
},
android: {
phone: (!match(windowsPhone) && match(amazonPhone)) ||
(!match(windowsPhone) && match(androidPhone)),
tablet: !match(windowsPhone) &&
!match(amazonPhone) &&
!match(androidPhone) &&
(match(amazonTablet) || match(androidTablet)),
device: (!match(windowsPhone) &&
(match(amazonPhone) ||
match(amazonTablet) ||
match(androidPhone) ||
match(androidTablet))) ||
match(/\bokhttp\b/i)
},
windows: {
phone: match(windowsPhone),
tablet: match(windowsTablet),
device: match(windowsPhone) || match(windowsTablet)
},
other: {
blackberry: match(otherBlackBerry),
blackberry10: match(otherBlackBerry10),
opera: match(otherOpera),
firefox: match(otherFirefox),
chrome: match(otherChrome),
device: match(otherBlackBerry) ||
match(otherBlackBerry10) ||
match(otherOpera) ||
match(otherFirefox) ||
match(otherChrome)
},
any: false,
phone: false,
tablet: false
};
result.any =
result.apple.device ||
result.android.device ||
result.windows.device ||
result.other.device;
result.phone =
result.apple.phone || result.android.phone || result.windows.phone;
result.tablet =
result.apple.tablet || result.android.tablet || result.windows.tablet;
return result;
}
//# sourceMappingURL=isMobile.js.map

1
node_modules/ismobilejs/esm/isMobile.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"isMobile.js","sourceRoot":"","sources":["../src/isMobile.ts"],"names":[],"mappings":"AAAA,IAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,IAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,IAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,IAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,IAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,IAAM,aAAa,GAAG,UAAU,CAAC;AACjC,IAAM,WAAW,GAAG,oCAAoC,CAAC;AACzD,IAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,IAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,IAAM,aAAa,GAAG,uBAAuB,CAAC;AAC9C,IAAM,eAAe,GAAG,aAAa,CAAC;AACtC,IAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,IAAM,UAAU,GAAG,aAAa,CAAC;AACjC,IAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,IAAM,YAAY,GAAG,wBAAwB,CAAC;AAS9C,IAAM,oBAAoB,GAAG,UAAC,SAAqB;IACjD,OAAO,CACL,OAAO,SAAS,KAAK,WAAW;QAChC,SAAS,CAAC,QAAQ,KAAK,UAAU;QACjC,OAAO,SAAS,CAAC,cAAc,KAAK,QAAQ;QAC5C,SAAS,CAAC,cAAc,GAAG,CAAC;QAC5B,OAAO,QAAQ,KAAK,WAAW,CAChC,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,WAAW,CAAC,SAAoB;IACvC,OAAO,UAAC,KAAa,IAAc,OAAA,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAArB,CAAqB,CAAC;AAC3D,CAAC;AAwCD,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C;AAChB,CAAC"}

9
node_modules/ismobilejs/jest.config.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
roots: ['<rootDir>/src/__tests__'],
transform: {
'^.+\\.ts$': 'ts-jest',
},
testRegex: '^.+\\.ts$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
preset: 'jest-puppeteer',
};

55
node_modules/ismobilejs/package.json generated vendored Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "ismobilejs",
"publishConfig": {
"access": "public"
},
"version": "1.1.1",
"description": "A simple JS library that detects mobile devices.",
"keywords": [
"ismobile",
"device detection",
"mobile devices",
"useragent"
],
"homepage": "https://github.com/kaimallea/isMobile",
"license": "MIT",
"author": {
"name": "Kai Mallea",
"email": "kmallea@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/kaimallea/isMobile.git"
},
"main": "cjs/index.js",
"module": "esm/index.js",
"jsdelivr": "dist/isMobile.min.js",
"types": "types",
"scripts": {
"prebuild": "rm -rf cjs esm dist",
"build": "yarn build:library && yarn build:browser",
"build:library": "web-scripts build",
"build:browser": "parcel build --target browser --experimental-scope-hoisting --global isMobile --out-file isMobile.min.js src/index.browser.ts",
"test": "jest",
"format": "web-scripts format",
"lint": "web-scripts lint",
"commit": "web-scripts commit",
"release": "web-scripts release",
"prepare": "web-scripts audit"
},
"husky": {
"hooks": {
"pre-commit": "web-scripts precommit --jest-config ./jest.config.js",
"commit-msg": "web-scripts commitmsg"
}
},
"devDependencies": {
"@spotify/web-scripts": "^6.2.0",
"@types/puppeteer": "^2.0.1",
"husky": "^4.2.5",
"jest-puppeteer": "^4.4.0",
"parcel-bundler": "^1.12.4",
"puppeteer": "^2.1.1",
"ts-jest": "^25.3.1"
}
}

1
node_modules/ismobilejs/prettier.config.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('@spotify/web-scripts/config/prettier.config.js');

546
node_modules/ismobilejs/src/__tests__/amazon.test.ts generated vendored Normal file
View File

@@ -0,0 +1,546 @@
import isMobile, { isMobileResult } from '../';
describe('Amazon', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('Amazon Kindle Fire User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFOT Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HD User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFTT Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HD 8.9inch User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFJWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HD 8.9inch 4G User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFJWA Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HD 7inch (3rd Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFSOWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HDX 7inch (3rd Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFTHWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HDX 7 (3rd Generation) 4G User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFTHWA Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HDX 8.9inch (3rd Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFAPWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Kindle Fire HDX 8.9inch (3rd Generation) 4G User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFAPWA Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire HD 6 (4th Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFARWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire HD 7 (4th Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFASWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire HDX 8.9 (4th Generation) User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFSAWI Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire HDX 8.9 (4th Generation) 4G User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; KFSAWA Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should not be an Amazon Phone', () => {
expect(mobile.amazon.phone).not.toBe(true);
});
test('should be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire Phone User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; U; Android android-version; locale; SD4930UR Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should be an Amazon Phone', () => {
expect(mobile.amazon.phone).toBe(true);
});
test('should not be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).not.toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should be an Android Phone', () => {
expect(mobile.android.phone).toBe(true);
});
test('should not be an Android Tablet', () => {
expect(mobile.android.tablet).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Amazon Fire Generic Phone User Agent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; Android android-version; product-model Build/product-build) AppleWebKit/webkit-version (KHTML, like Gecko) Silk/browser-version like Chrome/chrome-version Mobile Safari/webkit-version';
mobile = isMobile(userAgent);
});
test('should be an Amazon Phone', () => {
expect(mobile.amazon.phone).toBe(true);
});
test('should not be an Amazon Tablet', () => {
expect(mobile.amazon.tablet).not.toBe(true);
});
test('should be an Amazon device', () => {
expect(mobile.amazon.device).toBe(true);
});
test('should be an Android Phone', () => {
expect(mobile.android.phone).toBe(true);
});
test('should not be an Android Tablet', () => {
expect(mobile.android.tablet).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
});

77
node_modules/ismobilejs/src/__tests__/android.test.ts generated vendored Normal file
View File

@@ -0,0 +1,77 @@
import isMobile, { isMobileResult } from '../';
describe('Android', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; <Android Version>; <Build Tag etc.>) AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Mobile Safari/<WebKit Rev>';
mobile = isMobile(userAgent);
});
test('should be an Android Phone', () => {
expect(mobile.android.phone).toBe(true);
});
test('should not be an Android Tablet', () => {
expect(mobile.android.tablet).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('Tablet UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; <Android Version>; <Build Tag etc.>) AppleWebKit/<WebKit Rev>(KHTML, like Gecko) Chrome/<Chrome Rev> Safari/<WebKit Rev>';
mobile = isMobile(userAgent);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).not.toBe(true);
});
test('should be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
describe('OkHttp UserAgent', () => {
beforeEach(() => {
userAgent = 'okhttp/3.9.1';
mobile = isMobile(userAgent);
});
test('should not be an Android Phone', () => {
expect(mobile.android.phone).toBe(false);
});
test('should not be an Android Tablet', () => {
expect(mobile.android.tablet).toBe(false);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(false);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
});
});

214
node_modules/ismobilejs/src/__tests__/apple.test.ts generated vendored Normal file
View File

@@ -0,0 +1,214 @@
import isMobile, { isMobileResult } from '../';
describe('Apple', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('iPhone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3';
mobile = isMobile(userAgent);
});
test('should be an iPhone', () => {
expect(mobile.apple.phone).toBe(true);
});
test('should not be an iPad', () => {
expect(mobile.apple.tablet).not.toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('iPad UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10';
mobile = isMobile(userAgent);
});
test('should not be an iPhone', () => {
expect(mobile.apple.phone).not.toBe(true);
});
test('should be an iPad', () => {
expect(mobile.apple.tablet).toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('iPad on iOS 13', () => {
beforeEach(() => {
const nav = {
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)',
platform: 'MacIntel',
maxTouchPoints: 4,
};
mobile = isMobile(nav);
});
test('should not be an iPhone', () => {
expect(mobile.apple.phone).not.toBe(true);
});
test('should be an iPad', () => {
expect(mobile.apple.tablet).toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('iPod UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A101a Safari/419.3';
mobile = isMobile(userAgent);
});
test('should not be an iPhone', () => {
expect(mobile.apple.phone).not.toBe(true);
});
test('should not be an iPad', () => {
expect(mobile.apple.tablet).not.toBe(true);
});
test('should be an iPod', () => {
expect(mobile.apple.ipod).toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('Facebook iPhone App UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPhone; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B410 [FBAN/FBIOS;FBAV/20.1.0.15.10;FBBV/5758778;FBDV/iPad5,4;FBMD/iPad;FBSN/iPhone OS;FBSV/8.1;FBSS/2; FBCR/;FBID/tablet;FBLC/fi_FI;FBOP/1]';
mobile = isMobile(userAgent);
});
test('should be an iPhone', () => {
expect(mobile.apple.phone).toBe(true);
});
test('should not be an iPad', () => {
expect(mobile.apple.tablet).not.toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('Facebook iPad App UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B410 [FBAN/FBIOS;FBAV/20.1.0.15.10;FBBV/5758778;FBDV/iPad5,4;FBMD/iPad;FBSN/iPhone OS;FBSV/8.1;FBSS/2; FBCR/;FBID/tablet;FBLC/fi_FI;FBOP/1]';
mobile = isMobile(userAgent);
});
test('should not be an iPhone', () => {
expect(mobile.apple.phone).not.toBe(true);
});
test('should be an iPad', () => {
expect(mobile.apple.tablet).toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('Twitter iPhone App UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13D15 Twitter for iPhone';
mobile = isMobile(userAgent);
});
test('should be an iPhone', () => {
expect(mobile.apple.phone).toBe(true);
});
test('should not be an iPad', () => {
expect(mobile.apple.tablet).not.toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
describe('Twitter iPad App UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (iPad; CPU OS 9_2_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13D15 Twitter for iPhone';
mobile = isMobile(userAgent);
});
test('should not be an iPhone', () => {
expect(mobile.apple.phone).not.toBe(true);
});
test('should be an iPad', () => {
expect(mobile.apple.tablet).toBe(true);
});
test('should not be an iPod', () => {
expect(mobile.apple.ipod).not.toBe(true);
});
test('should be an Apple device', () => {
expect(mobile.apple.device).toBe(true);
});
});
});

View File

@@ -0,0 +1,179 @@
import puppeteer from 'puppeteer';
import { isMobileResult } from '..';
describe('E2E Tests', () => {
test('isMobile global variable is present', async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setUserAgent('okhttp/3.0.0');
await page.addScriptTag({ path: './dist/isMobile.min.js' });
const isMobile: isMobileResult = await page.evaluate(() => isMobile);
expect(isMobile).toMatchInlineSnapshot(`
Object {
"amazon": Object {
"device": false,
"phone": false,
"tablet": false,
},
"android": Object {
"device": true,
"phone": false,
"tablet": false,
},
"any": true,
"apple": Object {
"device": false,
"ipod": false,
"phone": false,
"tablet": false,
"universal": false,
},
"other": Object {
"blackberry": false,
"blackberry10": false,
"chrome": false,
"device": false,
"firefox": false,
"opera": false,
},
"phone": false,
"tablet": false,
"windows": Object {
"device": false,
"phone": false,
"tablet": false,
},
}
`);
await browser.close();
});
(process.env.GITHUB_ACTIONS ? test.skip : test)(
'isMobile correctly checks iOS 13',
async () => {
const iPadIos13 = {
...puppeteer.devices['iPad Pro'],
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)',
};
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'maxTouchPoints', {
get: () => 4,
});
});
await page.emulate(iPadIos13);
await page.addScriptTag({ path: './dist/isMobile.min.js' });
const isMobile: isMobileResult = await page.evaluate(() => isMobile);
// eslint-disable-next-line jest/no-standalone-expect
expect(isMobile).toMatchInlineSnapshot(`
Object {
"amazon": Object {
"device": false,
"phone": false,
"tablet": false,
},
"android": Object {
"device": false,
"phone": false,
"tablet": false,
},
"any": true,
"apple": Object {
"device": true,
"ipod": false,
"phone": false,
"tablet": true,
"universal": false,
},
"other": Object {
"blackberry": false,
"blackberry10": false,
"chrome": false,
"device": false,
"firefox": false,
"opera": false,
},
"phone": false,
"tablet": true,
"windows": Object {
"device": false,
"phone": false,
"tablet": false,
},
}
`);
await browser.close();
},
);
test('isMobile correctly fails iOS 13 check when MSStream is present', async () => {
const iPadIos13 = {
...puppeteer.devices['iPad Pro'],
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)',
};
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'maxTouchPoints', {
get: () => 4,
});
Object.defineProperty(window, 'MSStream', {
get: () => (fn: Function) => fn(),
});
});
await page.emulate(iPadIos13);
await page.addScriptTag({ path: './dist/isMobile.min.js' });
const isMobile: isMobileResult = await page.evaluate(() => isMobile);
expect(isMobile).toMatchInlineSnapshot(`
Object {
"amazon": Object {
"device": false,
"phone": false,
"tablet": false,
},
"android": Object {
"device": false,
"phone": false,
"tablet": false,
},
"any": false,
"apple": Object {
"device": false,
"ipod": false,
"phone": false,
"tablet": false,
"universal": false,
},
"other": Object {
"blackberry": false,
"blackberry10": false,
"chrome": false,
"device": false,
"firefox": false,
"opera": false,
},
"phone": false,
"tablet": false,
"windows": Object {
"device": false,
"phone": false,
"tablet": false,
},
}
`);
await browser.close();
});
});

30
node_modules/ismobilejs/src/__tests__/desktop.test.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import isMobile, { isMobileResult } from '../';
describe('Desktop', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('Chrome', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19';
mobile = isMobile(userAgent);
});
test('should not be a mobile device', () => {
expect(mobile.any).not.toBe(true);
});
});
describe('Safari', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10';
mobile = isMobile(userAgent);
});
test('should not be a mobile device', () => {
expect(mobile.any).not.toBe(true);
});
});
});

153
node_modules/ismobilejs/src/__tests__/other.test.ts generated vendored Normal file
View File

@@ -0,0 +1,153 @@
import isMobile, { isMobileResult } from '../';
describe('Other Mobile Devices', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('BlackBerry 10', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.2.0.1791 Mobile Safari/537.35+';
mobile = isMobile(userAgent);
});
test('should not be a Chrome device', () => {
expect(mobile.other.chrome).not.toBe(true);
});
test('should be a BlackBerry 10 device', () => {
expect(mobile.other.blackberry10).toBe(true);
});
test('should not be a BlackBerry device', () => {
expect(mobile.other.blackberry).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('BlackBerry', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+';
mobile = isMobile(userAgent);
});
test('should not be a Chrome device', () => {
expect(mobile.other.chrome).not.toBe(true);
});
test('should be a BlackBerry device', () => {
expect(mobile.other.blackberry).toBe(true);
});
test('should not be a BlackBerry 10 device', () => {
expect(mobile.other.blackberry10).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Opera Mini', () => {
beforeEach(() => {
userAgent =
'Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54';
mobile = isMobile(userAgent);
});
test('should not be a Chrome device', () => {
expect(mobile.other.chrome).not.toBe(true);
});
test('should be an Opera Mini device', () => {
expect(mobile.other.opera).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Firefox OS', () => {
beforeEach(() => {
userAgent = 'Mozilla/5.0 (Mobile; rv:14.0) Gecko/14.0 Firefox/14.0';
mobile = isMobile(userAgent);
});
test('should not be a Chrome device', () => {
expect(mobile.other.chrome).not.toBe(true);
});
test('should be a Firefox OS device', () => {
expect(mobile.other.firefox).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Chrome', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Linux; Android 4.4.4; en-us; Nexus 4 Build/JOP40D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2307.2 Mobile Safari/537.36';
mobile = isMobile(userAgent);
});
test('should be a Chrome device', () => {
expect(mobile.other.chrome).toBe(true);
});
test('should be an Android device', () => {
expect(mobile.android.device).toBe(true);
});
test('should not be a Firefox OS device', () => {
expect(mobile.other.firefox).toBe(false);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
});

154
node_modules/ismobilejs/src/__tests__/windows.test.ts generated vendored Normal file
View File

@@ -0,0 +1,154 @@
import isMobile, { isMobileResult } from '../';
describe('Windows', () => {
let mobile: isMobileResult;
let userAgent: string;
describe('Windows Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows 8.1 Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'//Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Edge Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; <Manufacturer>; <Device>) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Tablet UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)';
mobile = isMobile(userAgent);
});
test('should be a Windows Tablet device', () => {
expect(mobile.windows.tablet).toBe(true);
});
test('should not be a Windows Phone device', () => {
expect(mobile.windows.phone).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Touch Laptop UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; MAGWJS; rv:11.0) like Gecko';
mobile = isMobile(userAgent);
});
test('should not be a Windows Tablet device', () => {
expect(mobile.windows.tablet).not.toBe(true);
});
test('should not be a Windows Phone device', () => {
expect(mobile.windows.phone).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should not be matched as Any Tablet', () => {
expect(mobile.tablet).not.toBe(true);
});
test('should not be a mobile device', () => {
expect(mobile.any).not.toBe(true);
});
});
});

14
node_modules/ismobilejs/src/index.browser.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import isMobile from './';
/**
* This file is used to generate the browser version of this library.
* It is compiled as `isMobile.min.js` into the `dist` directory.
*
* The `dist` directory is published to NPM so that the compiled file can
* can be easily accessed by consumers of the library via the jsDelivr CDN.
*
* It is meant to be included via a `<script>` tag and will execute
* immediately, assigning its result to the `isMobile` global variable.
*/
exports = isMobile();

2
node_modules/ismobilejs/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * from './isMobile';
export { default } from './isMobile';

192
node_modules/ismobilejs/src/isMobile.ts generated vendored Normal file
View File

@@ -0,0 +1,192 @@
const appleIphone = /iPhone/i;
const appleIpod = /iPod/i;
const appleTablet = /iPad/i;
const appleUniversal = /\biOS-universal(?:.+)Mac\b/i;
const androidPhone = /\bAndroid(?:.+)Mobile\b/i; // Match 'Android' AND 'Mobile'
const androidTablet = /Android/i;
const amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; // Match 'Silk' AND 'Mobile'
const amazonTablet = /Silk/i;
const windowsPhone = /Windows Phone/i;
const windowsTablet = /\bWindows(?:.+)ARM\b/i; // Match 'Windows' AND 'ARM'
const otherBlackBerry = /BlackBerry/i;
const otherBlackBerry10 = /BB10/i;
const otherOpera = /Opera Mini/i;
const otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
const otherFirefox = /Mobile(?:.+)Firefox\b/i; // Match 'Mobile' AND 'Firefox'
export type UserAgent = string;
export type Navigator = {
userAgent: string;
platform: string;
maxTouchPoints?: number;
};
const isAppleTabletOnIos13 = (navigator?: Navigator): boolean => {
return (
typeof navigator !== 'undefined' &&
navigator.platform === 'MacIntel' &&
typeof navigator.maxTouchPoints === 'number' &&
navigator.maxTouchPoints > 1 &&
typeof MSStream === 'undefined'
);
};
function createMatch(userAgent: UserAgent): (regex: RegExp) => boolean {
return (regex: RegExp): boolean => regex.test(userAgent);
}
export type isMobileResult = {
apple: {
phone: boolean;
ipod: boolean;
tablet: boolean;
universal: boolean;
device: boolean;
};
amazon: {
phone: boolean;
tablet: boolean;
device: boolean;
};
android: {
phone: boolean;
tablet: boolean;
device: boolean;
};
windows: {
phone: boolean;
tablet: boolean;
device: boolean;
};
other: {
blackberry: boolean;
blackberry10: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
};
phone: boolean;
tablet: boolean;
any: boolean;
};
export type IsMobileParameter = UserAgent | Navigator;
export default function isMobile(param?: IsMobileParameter): isMobileResult {
let nav: Navigator = {
userAgent: '',
platform: '',
maxTouchPoints: 0,
};
if (!param && typeof navigator !== 'undefined') {
nav = {
userAgent: navigator.userAgent,
platform: navigator.platform,
maxTouchPoints: navigator.maxTouchPoints || 0,
};
} else if (typeof param === 'string') {
nav.userAgent = param;
} else if (param && param.userAgent) {
nav = {
userAgent: param.userAgent,
platform: param.platform,
maxTouchPoints: param.maxTouchPoints || 0,
};
}
let userAgent = nav.userAgent;
// Facebook mobile app's integrated browser adds a bunch of strings that
// match everything. Strip it out if it exists.
let tmp = userAgent.split('[FBAN');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
// Twitter mobile app's integrated browser on iPad adds a "Twitter for
// iPhone" string. Same probably happens on other tablet platforms.
// This will confuse detection so strip it out if it exists.
tmp = userAgent.split('Twitter');
if (typeof tmp[1] !== 'undefined') {
userAgent = tmp[0];
}
const match = createMatch(userAgent);
const result: isMobileResult = {
apple: {
phone: match(appleIphone) && !match(windowsPhone),
ipod: match(appleIpod),
tablet:
!match(appleIphone) &&
(match(appleTablet) || isAppleTabletOnIos13(nav)) &&
!match(windowsPhone),
universal: match(appleUniversal),
device:
(match(appleIphone) ||
match(appleIpod) ||
match(appleTablet) ||
match(appleUniversal) ||
isAppleTabletOnIos13(nav)) &&
!match(windowsPhone),
},
amazon: {
phone: match(amazonPhone),
tablet: !match(amazonPhone) && match(amazonTablet),
device: match(amazonPhone) || match(amazonTablet),
},
android: {
phone:
(!match(windowsPhone) && match(amazonPhone)) ||
(!match(windowsPhone) && match(androidPhone)),
tablet:
!match(windowsPhone) &&
!match(amazonPhone) &&
!match(androidPhone) &&
(match(amazonTablet) || match(androidTablet)),
device:
(!match(windowsPhone) &&
(match(amazonPhone) ||
match(amazonTablet) ||
match(androidPhone) ||
match(androidTablet))) ||
match(/\bokhttp\b/i),
},
windows: {
phone: match(windowsPhone),
tablet: match(windowsTablet),
device: match(windowsPhone) || match(windowsTablet),
},
other: {
blackberry: match(otherBlackBerry),
blackberry10: match(otherBlackBerry10),
opera: match(otherOpera),
firefox: match(otherFirefox),
chrome: match(otherChrome),
device:
match(otherBlackBerry) ||
match(otherBlackBerry10) ||
match(otherOpera) ||
match(otherFirefox) ||
match(otherChrome),
},
any: false,
phone: false,
tablet: false,
};
result.any =
result.apple.device ||
result.android.device ||
result.windows.device ||
result.other.device;
// excludes 'other' devices and ipods, targeting touchscreen phones
result.phone =
result.apple.phone || result.android.phone || result.windows.phone;
result.tablet =
result.apple.tablet || result.android.tablet || result.windows.tablet;
return result;
}

8
node_modules/ismobilejs/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"extends": "@spotify/web-scripts/config/tsconfig.json",
"include": ["src"],
"exclude": ["src/__tests__", "src/index.browser.ts"],
"compilerOptions": {
"target": "es3"
}
}

3
node_modules/ismobilejs/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './isMobile';
export { default } from './isMobile';
//# sourceMappingURL=index.d.ts.map

1
node_modules/ismobilejs/types/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}

44
node_modules/ismobilejs/types/isMobile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
export declare type UserAgent = string;
export declare type Navigator = {
userAgent: string;
platform: string;
maxTouchPoints?: number;
};
export declare type isMobileResult = {
apple: {
phone: boolean;
ipod: boolean;
tablet: boolean;
universal: boolean;
device: boolean;
};
amazon: {
phone: boolean;
tablet: boolean;
device: boolean;
};
android: {
phone: boolean;
tablet: boolean;
device: boolean;
};
windows: {
phone: boolean;
tablet: boolean;
device: boolean;
};
other: {
blackberry: boolean;
blackberry10: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
};
phone: boolean;
tablet: boolean;
any: boolean;
};
export declare type IsMobileParameter = UserAgent | Navigator;
export default function isMobile(param?: IsMobileParameter): isMobileResult;
//# sourceMappingURL=isMobile.d.ts.map

1
node_modules/ismobilejs/types/isMobile.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"isMobile.d.ts","sourceRoot":"","sources":["../src/isMobile.ts"],"names":[],"mappings":"AAgBA,oBAAY,SAAS,GAAG,MAAM,CAAC;AAC/B,oBAAY,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAgB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