@impui/imp 1.0.15 → 1.0.16-beta.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/axios/index.es.js +143 -0
- package/dist/config/index.es.js +127 -0
- package/dist/core/index.es.js +34 -0
- package/dist/gotool/go2/index.es.js +510 -0
- package/dist/gotool/index/index.es.js +164 -0
- package/dist/imph5/index.es.js +324 -0
- package/dist/index.es.js +49 -1
- package/dist/login/index.es.js +711 -0
- package/dist/node_modules/axios/index/index.es.js +38 -0
- package/dist/node_modules/axios/lib/adapters/adapters/index.es.js +71 -0
- package/dist/node_modules/axios/lib/adapters/fetch/index.es.js +219 -0
- package/dist/node_modules/axios/lib/adapters/xhr/index.es.js +141 -0
- package/dist/node_modules/axios/lib/axios/index.es.js +50 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken/index.es.js +99 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError/index.es.js +12 -0
- package/dist/node_modules/axios/lib/cancel/isCancel/index.es.js +6 -0
- package/dist/node_modules/axios/lib/core/Axios/index.es.js +180 -0
- package/dist/node_modules/axios/lib/core/AxiosError/index.es.js +80 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders/index.es.js +231 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager/index.es.js +65 -0
- package/dist/node_modules/axios/lib/core/buildFullPath/index.es.js +12 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest/index.es.js +52 -0
- package/dist/node_modules/axios/lib/core/mergeConfig/index.es.js +83 -0
- package/dist/node_modules/axios/lib/core/settle/index.es.js +18 -0
- package/dist/node_modules/axios/lib/core/transformData/index.es.js +17 -0
- package/dist/node_modules/axios/lib/defaults/index/index.es.js +116 -0
- package/dist/node_modules/axios/lib/defaults/transitional/index.es.js +8 -0
- package/dist/node_modules/axios/lib/env/data/index.es.js +4 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams/index.es.js +34 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode/index.es.js +77 -0
- package/dist/node_modules/axios/lib/helpers/bind/index.es.js +8 -0
- package/dist/node_modules/axios/lib/helpers/buildURL/index.es.js +34 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs/index.es.js +6 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals/index.es.js +39 -0
- package/dist/node_modules/axios/lib/helpers/cookies/index.es.js +49 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON/index.es.js +54 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL/index.es.js +6 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError/index.es.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin/index.es.js +11 -0
- package/dist/node_modules/axios/lib/helpers/null/index.es.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders/index.es.js +47 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol/index.es.js +7 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer/index.es.js +41 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig/index.es.js +46 -0
- package/dist/node_modules/axios/lib/helpers/speedometer/index.es.js +36 -0
- package/dist/node_modules/axios/lib/helpers/spread/index.es.js +8 -0
- package/dist/node_modules/axios/lib/helpers/throttle/index.es.js +35 -0
- package/dist/node_modules/axios/lib/helpers/toFormData/index.es.js +117 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm/index.es.js +18 -0
- package/dist/node_modules/axios/lib/helpers/trackStream/index.es.js +80 -0
- package/dist/node_modules/axios/lib/helpers/validator/index.es.js +67 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob/index.es.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData/index.es.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams/index.es.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index/index.es.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils/index.es.js +15 -0
- package/dist/node_modules/axios/lib/platform/index/index.es.js +9 -0
- package/dist/node_modules/axios/lib/utils/index.es.js +387 -0
- package/dist/packages/com/dist/browser/index.es/index.es.js +1 -0
- package/dist/packages/com/dist/cache/index.es/index.es.js +145 -0
- package/dist/packages/com/dist/core/index.es/index.es.js +154 -0
- package/dist/packages/com/dist/data/index.es/index.es.js +26 -0
- package/dist/packages/com/dist/date/index.es/index.es.js +194 -0
- package/dist/packages/com/dist/log/index.es/index.es.js +110 -0
- package/dist/packages/com/dist/message/index.es/index.es.js +90 -0
- package/dist/packages/com/dist/req/index.es/index.es.js +35 -0
- package/dist/packages/com/dist/str/index.es/index.es.js +25 -0
- package/dist/packages/com/dist/typetool/index.es/index.es.js +53 -0
- package/dist/packages/com/dist/url/index.es/index.es.js +238 -0
- package/dist/restool/index/index.es.js +266 -0
- package/dist/restool/index.css/index.es.js +4 -0
- package/package.json +2 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function speedometer(samplesCount, min) {
|
|
2
|
+
samplesCount = samplesCount || 10;
|
|
3
|
+
const bytes = new Array(samplesCount);
|
|
4
|
+
const timestamps = new Array(samplesCount);
|
|
5
|
+
let head = 0;
|
|
6
|
+
let tail = 0;
|
|
7
|
+
let firstSampleTS;
|
|
8
|
+
min = min !== void 0 ? min : 1e3;
|
|
9
|
+
return function push(chunkLength) {
|
|
10
|
+
const now = Date.now();
|
|
11
|
+
const startedAt = timestamps[tail];
|
|
12
|
+
if (!firstSampleTS) {
|
|
13
|
+
firstSampleTS = now;
|
|
14
|
+
}
|
|
15
|
+
bytes[head] = chunkLength;
|
|
16
|
+
timestamps[head] = now;
|
|
17
|
+
let i = tail;
|
|
18
|
+
let bytesCount = 0;
|
|
19
|
+
while (i !== head) {
|
|
20
|
+
bytesCount += bytes[i++];
|
|
21
|
+
i = i % samplesCount;
|
|
22
|
+
}
|
|
23
|
+
head = (head + 1) % samplesCount;
|
|
24
|
+
if (head === tail) {
|
|
25
|
+
tail = (tail + 1) % samplesCount;
|
|
26
|
+
}
|
|
27
|
+
if (now - firstSampleTS < min) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const passed = startedAt && now - startedAt;
|
|
31
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
speedometer as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function throttle(fn, freq) {
|
|
2
|
+
let timestamp = 0;
|
|
3
|
+
let threshold = 1e3 / freq;
|
|
4
|
+
let lastArgs;
|
|
5
|
+
let timer;
|
|
6
|
+
const invoke = (args, now = Date.now()) => {
|
|
7
|
+
timestamp = now;
|
|
8
|
+
lastArgs = null;
|
|
9
|
+
if (timer) {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
timer = null;
|
|
12
|
+
}
|
|
13
|
+
fn(...args);
|
|
14
|
+
};
|
|
15
|
+
const throttled = (...args) => {
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
const passed = now - timestamp;
|
|
18
|
+
if (passed >= threshold) {
|
|
19
|
+
invoke(args, now);
|
|
20
|
+
} else {
|
|
21
|
+
lastArgs = args;
|
|
22
|
+
if (!timer) {
|
|
23
|
+
timer = setTimeout(() => {
|
|
24
|
+
timer = null;
|
|
25
|
+
invoke(lastArgs);
|
|
26
|
+
}, threshold - passed);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
31
|
+
return [throttled, flush];
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
throttle as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import utils from "../../utils/index.es.js";
|
|
2
|
+
import AxiosError from "../../core/AxiosError/index.es.js";
|
|
3
|
+
function isVisitable(thing) {
|
|
4
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
5
|
+
}
|
|
6
|
+
function removeBrackets(key) {
|
|
7
|
+
return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
8
|
+
}
|
|
9
|
+
function renderKey(path, key, dots) {
|
|
10
|
+
if (!path) return key;
|
|
11
|
+
return path.concat(key).map(function each(token, i) {
|
|
12
|
+
token = removeBrackets(token);
|
|
13
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
14
|
+
}).join(dots ? "." : "");
|
|
15
|
+
}
|
|
16
|
+
function isFlatArray(arr) {
|
|
17
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
18
|
+
}
|
|
19
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
20
|
+
return /^is[A-Z]/.test(prop);
|
|
21
|
+
});
|
|
22
|
+
function toFormData(obj, formData, options) {
|
|
23
|
+
if (!utils.isObject(obj)) {
|
|
24
|
+
throw new TypeError("target must be an object");
|
|
25
|
+
}
|
|
26
|
+
formData = formData || new FormData();
|
|
27
|
+
options = utils.toFlatObject(options, {
|
|
28
|
+
metaTokens: true,
|
|
29
|
+
dots: false,
|
|
30
|
+
indexes: false
|
|
31
|
+
}, false, function defined(option, source) {
|
|
32
|
+
return !utils.isUndefined(source[option]);
|
|
33
|
+
});
|
|
34
|
+
const metaTokens = options.metaTokens;
|
|
35
|
+
const visitor = options.visitor || defaultVisitor;
|
|
36
|
+
const dots = options.dots;
|
|
37
|
+
const indexes = options.indexes;
|
|
38
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
39
|
+
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
40
|
+
if (!utils.isFunction(visitor)) {
|
|
41
|
+
throw new TypeError("visitor must be a function");
|
|
42
|
+
}
|
|
43
|
+
function convertValue(value) {
|
|
44
|
+
if (value === null) return "";
|
|
45
|
+
if (utils.isDate(value)) {
|
|
46
|
+
return value.toISOString();
|
|
47
|
+
}
|
|
48
|
+
if (utils.isBoolean(value)) {
|
|
49
|
+
return value.toString();
|
|
50
|
+
}
|
|
51
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
52
|
+
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
53
|
+
}
|
|
54
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
55
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
function defaultVisitor(value, key, path) {
|
|
60
|
+
let arr = value;
|
|
61
|
+
if (value && !path && typeof value === "object") {
|
|
62
|
+
if (utils.endsWith(key, "{}")) {
|
|
63
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
64
|
+
value = JSON.stringify(value);
|
|
65
|
+
} else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value))) {
|
|
66
|
+
key = removeBrackets(key);
|
|
67
|
+
arr.forEach(function each(el, index) {
|
|
68
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
69
|
+
// eslint-disable-next-line no-nested-ternary
|
|
70
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
71
|
+
convertValue(el)
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (isVisitable(value)) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const stack = [];
|
|
84
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
85
|
+
defaultVisitor,
|
|
86
|
+
convertValue,
|
|
87
|
+
isVisitable
|
|
88
|
+
});
|
|
89
|
+
function build(value, path) {
|
|
90
|
+
if (utils.isUndefined(value)) return;
|
|
91
|
+
if (stack.indexOf(value) !== -1) {
|
|
92
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
93
|
+
}
|
|
94
|
+
stack.push(value);
|
|
95
|
+
utils.forEach(value, function each(el, key) {
|
|
96
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
97
|
+
formData,
|
|
98
|
+
el,
|
|
99
|
+
utils.isString(key) ? key.trim() : key,
|
|
100
|
+
path,
|
|
101
|
+
exposedHelpers
|
|
102
|
+
);
|
|
103
|
+
if (result === true) {
|
|
104
|
+
build(el, path ? path.concat(key) : [key]);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
stack.pop();
|
|
108
|
+
}
|
|
109
|
+
if (!utils.isObject(obj)) {
|
|
110
|
+
throw new TypeError("data must be an object");
|
|
111
|
+
}
|
|
112
|
+
build(obj);
|
|
113
|
+
return formData;
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
toFormData as default
|
|
117
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import utils from "../../utils/index.es.js";
|
|
2
|
+
import toFormData from "../toFormData/index.es.js";
|
|
3
|
+
import platform from "../../platform/index/index.es.js";
|
|
4
|
+
function toURLEncodedForm(data, options) {
|
|
5
|
+
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
6
|
+
visitor: function(value, key, path, helpers) {
|
|
7
|
+
if (platform.isNode && utils.isBuffer(value)) {
|
|
8
|
+
this.append(key, value.toString("base64"));
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
12
|
+
},
|
|
13
|
+
...options
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
toURLEncodedForm as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
2
|
+
let len = chunk.byteLength;
|
|
3
|
+
if (len < chunkSize) {
|
|
4
|
+
yield chunk;
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
let pos = 0;
|
|
8
|
+
let end;
|
|
9
|
+
while (pos < len) {
|
|
10
|
+
end = pos + chunkSize;
|
|
11
|
+
yield chunk.slice(pos, end);
|
|
12
|
+
pos = end;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
16
|
+
for await (const chunk of readStream(iterable)) {
|
|
17
|
+
yield* streamChunk(chunk, chunkSize);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const readStream = async function* (stream) {
|
|
21
|
+
if (stream[Symbol.asyncIterator]) {
|
|
22
|
+
yield* stream;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const reader = stream.getReader();
|
|
26
|
+
try {
|
|
27
|
+
for (; ; ) {
|
|
28
|
+
const { done, value } = await reader.read();
|
|
29
|
+
if (done) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
yield value;
|
|
33
|
+
}
|
|
34
|
+
} finally {
|
|
35
|
+
await reader.cancel();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
39
|
+
const iterator = readBytes(stream, chunkSize);
|
|
40
|
+
let bytes = 0;
|
|
41
|
+
let done;
|
|
42
|
+
let _onFinish = (e) => {
|
|
43
|
+
if (!done) {
|
|
44
|
+
done = true;
|
|
45
|
+
onFinish && onFinish(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return new ReadableStream({
|
|
49
|
+
async pull(controller) {
|
|
50
|
+
try {
|
|
51
|
+
const { done: done2, value } = await iterator.next();
|
|
52
|
+
if (done2) {
|
|
53
|
+
_onFinish();
|
|
54
|
+
controller.close();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let len = value.byteLength;
|
|
58
|
+
if (onProgress) {
|
|
59
|
+
let loadedBytes = bytes += len;
|
|
60
|
+
onProgress(loadedBytes);
|
|
61
|
+
}
|
|
62
|
+
controller.enqueue(new Uint8Array(value));
|
|
63
|
+
} catch (err) {
|
|
64
|
+
_onFinish(err);
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
cancel(reason) {
|
|
69
|
+
_onFinish(reason);
|
|
70
|
+
return iterator.return();
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
highWaterMark: 2
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
readBytes,
|
|
78
|
+
streamChunk,
|
|
79
|
+
trackStream
|
|
80
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { VERSION } from "../../env/data/index.es.js";
|
|
2
|
+
import AxiosError from "../../core/AxiosError/index.es.js";
|
|
3
|
+
const validators = {};
|
|
4
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
5
|
+
validators[type] = function validator2(thing) {
|
|
6
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
7
|
+
};
|
|
8
|
+
});
|
|
9
|
+
const deprecatedWarnings = {};
|
|
10
|
+
validators.transitional = function transitional(validator2, version, message) {
|
|
11
|
+
function formatMessage(opt, desc) {
|
|
12
|
+
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
13
|
+
}
|
|
14
|
+
return (value, opt, opts) => {
|
|
15
|
+
if (validator2 === false) {
|
|
16
|
+
throw new AxiosError(
|
|
17
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
18
|
+
AxiosError.ERR_DEPRECATED
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
22
|
+
deprecatedWarnings[opt] = true;
|
|
23
|
+
console.warn(
|
|
24
|
+
formatMessage(
|
|
25
|
+
opt,
|
|
26
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
validators.spelling = function spelling(correctSpelling) {
|
|
34
|
+
return (value, opt) => {
|
|
35
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
40
|
+
if (typeof options !== "object") {
|
|
41
|
+
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
42
|
+
}
|
|
43
|
+
const keys = Object.keys(options);
|
|
44
|
+
let i = keys.length;
|
|
45
|
+
while (i-- > 0) {
|
|
46
|
+
const opt = keys[i];
|
|
47
|
+
const validator2 = schema[opt];
|
|
48
|
+
if (validator2) {
|
|
49
|
+
const value = options[opt];
|
|
50
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
51
|
+
if (result !== true) {
|
|
52
|
+
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
53
|
+
}
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (allowUnknown !== true) {
|
|
57
|
+
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const validator = {
|
|
62
|
+
assertOptions,
|
|
63
|
+
validators
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
validator as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import URLSearchParams from "../classes/URLSearchParams/index.es.js";
|
|
2
|
+
import FormData from "../classes/FormData/index.es.js";
|
|
3
|
+
import Blob from "../classes/Blob/index.es.js";
|
|
4
|
+
const platform = {
|
|
5
|
+
isBrowser: true,
|
|
6
|
+
classes: {
|
|
7
|
+
URLSearchParams,
|
|
8
|
+
FormData,
|
|
9
|
+
Blob
|
|
10
|
+
},
|
|
11
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
platform as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
2
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
3
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
4
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
5
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
6
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
7
|
+
})();
|
|
8
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
9
|
+
export {
|
|
10
|
+
hasBrowserEnv,
|
|
11
|
+
hasStandardBrowserEnv,
|
|
12
|
+
hasStandardBrowserWebWorkerEnv,
|
|
13
|
+
_navigator as navigator,
|
|
14
|
+
origin
|
|
15
|
+
};
|