@impui/imp 1.0.16-beta.0 → 1.0.16
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 +1 -143
- package/dist/config/index.es.js +1 -127
- package/dist/core/index.es.js +1 -34
- package/dist/gotool/go2/index.es.js +1 -510
- package/dist/gotool/index/index.es.js +1 -164
- package/dist/imph5/index.es.js +1 -324
- package/dist/index.es.js +1 -49
- package/dist/login/index.es.js +1 -711
- package/dist/node_modules/axios/index/index.es.js +1 -38
- package/dist/node_modules/axios/lib/adapters/adapters/index.es.js +1 -71
- package/dist/node_modules/axios/lib/adapters/fetch/index.es.js +1 -219
- package/dist/node_modules/axios/lib/adapters/xhr/index.es.js +1 -141
- package/dist/node_modules/axios/lib/axios/index.es.js +1 -50
- package/dist/node_modules/axios/lib/cancel/CancelToken/index.es.js +1 -99
- package/dist/node_modules/axios/lib/cancel/CanceledError/index.es.js +1 -12
- package/dist/node_modules/axios/lib/cancel/isCancel/index.es.js +1 -6
- package/dist/node_modules/axios/lib/core/Axios/index.es.js +1 -180
- package/dist/node_modules/axios/lib/core/AxiosError/index.es.js +1 -80
- package/dist/node_modules/axios/lib/core/AxiosHeaders/index.es.js +1 -231
- package/dist/node_modules/axios/lib/core/InterceptorManager/index.es.js +1 -65
- package/dist/node_modules/axios/lib/core/buildFullPath/index.es.js +1 -12
- package/dist/node_modules/axios/lib/core/dispatchRequest/index.es.js +1 -52
- package/dist/node_modules/axios/lib/core/mergeConfig/index.es.js +1 -83
- package/dist/node_modules/axios/lib/core/settle/index.es.js +1 -18
- package/dist/node_modules/axios/lib/core/transformData/index.es.js +1 -17
- package/dist/node_modules/axios/lib/defaults/index/index.es.js +1 -116
- package/dist/node_modules/axios/lib/defaults/transitional/index.es.js +1 -8
- package/dist/node_modules/axios/lib/env/data/index.es.js +1 -4
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams/index.es.js +1 -34
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode/index.es.js +1 -77
- package/dist/node_modules/axios/lib/helpers/bind/index.es.js +1 -8
- package/dist/node_modules/axios/lib/helpers/buildURL/index.es.js +1 -34
- package/dist/node_modules/axios/lib/helpers/combineURLs/index.es.js +1 -6
- package/dist/node_modules/axios/lib/helpers/composeSignals/index.es.js +1 -39
- package/dist/node_modules/axios/lib/helpers/cookies/index.es.js +1 -49
- package/dist/node_modules/axios/lib/helpers/formDataToJSON/index.es.js +1 -54
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL/index.es.js +1 -6
- package/dist/node_modules/axios/lib/helpers/isAxiosError/index.es.js +1 -7
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin/index.es.js +1 -11
- package/dist/node_modules/axios/lib/helpers/null/index.es.js +1 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders/index.es.js +1 -47
- package/dist/node_modules/axios/lib/helpers/parseProtocol/index.es.js +1 -7
- package/dist/node_modules/axios/lib/helpers/progressEventReducer/index.es.js +1 -41
- package/dist/node_modules/axios/lib/helpers/resolveConfig/index.es.js +1 -46
- package/dist/node_modules/axios/lib/helpers/speedometer/index.es.js +1 -36
- package/dist/node_modules/axios/lib/helpers/spread/index.es.js +1 -8
- package/dist/node_modules/axios/lib/helpers/throttle/index.es.js +1 -35
- package/dist/node_modules/axios/lib/helpers/toFormData/index.es.js +1 -117
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm/index.es.js +1 -18
- package/dist/node_modules/axios/lib/helpers/trackStream/index.es.js +1 -80
- package/dist/node_modules/axios/lib/helpers/validator/index.es.js +1 -67
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob/index.es.js +1 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData/index.es.js +1 -4
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams/index.es.js +1 -5
- package/dist/node_modules/axios/lib/platform/browser/index/index.es.js +1 -15
- package/dist/node_modules/axios/lib/platform/common/utils/index.es.js +1 -15
- package/dist/node_modules/axios/lib/platform/index/index.es.js +1 -9
- package/dist/node_modules/axios/lib/utils/index.es.js +1 -387
- package/dist/packages/com/dist/cache/index.es/index.es.js +1 -145
- package/dist/packages/com/dist/core/index.es/index.es.js +1 -154
- package/dist/packages/com/dist/data/index.es/index.es.js +1 -26
- package/dist/packages/com/dist/date/index.es/index.es.js +2 -194
- package/dist/packages/com/dist/log/index.es/index.es.js +1 -110
- package/dist/packages/com/dist/message/index.es/index.es.js +1 -90
- package/dist/packages/com/dist/req/index.es/index.es.js +1 -35
- package/dist/packages/com/dist/str/index.es/index.es.js +1 -25
- package/dist/packages/com/dist/typetool/index.es/index.es.js +1 -53
- package/dist/packages/com/dist/url/index.es/index.es.js +1 -238
- package/dist/restool/index/index.es.js +1 -266
- package/dist/restool/index.css/index.es.js +1 -4
- package/package.json +5 -1
|
@@ -1,387 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { toString } = Object.prototype;
|
|
3
|
-
const { getPrototypeOf } = Object;
|
|
4
|
-
const { iterator, toStringTag } = Symbol;
|
|
5
|
-
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
6
|
-
const str = toString.call(thing);
|
|
7
|
-
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
8
|
-
})(/* @__PURE__ */ Object.create(null));
|
|
9
|
-
const kindOfTest = (type) => {
|
|
10
|
-
type = type.toLowerCase();
|
|
11
|
-
return (thing) => kindOf(thing) === type;
|
|
12
|
-
};
|
|
13
|
-
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
14
|
-
const { isArray } = Array;
|
|
15
|
-
const isUndefined = typeOfTest("undefined");
|
|
16
|
-
function isBuffer(val) {
|
|
17
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
18
|
-
}
|
|
19
|
-
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
20
|
-
function isArrayBufferView(val) {
|
|
21
|
-
let result;
|
|
22
|
-
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
23
|
-
result = ArrayBuffer.isView(val);
|
|
24
|
-
} else {
|
|
25
|
-
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
const isString = typeOfTest("string");
|
|
30
|
-
const isFunction = typeOfTest("function");
|
|
31
|
-
const isNumber = typeOfTest("number");
|
|
32
|
-
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
33
|
-
const isBoolean = (thing) => thing === true || thing === false;
|
|
34
|
-
const isPlainObject = (val) => {
|
|
35
|
-
if (kindOf(val) !== "object") {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const prototype = getPrototypeOf(val);
|
|
39
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
40
|
-
};
|
|
41
|
-
const isEmptyObject = (val) => {
|
|
42
|
-
if (!isObject(val) || isBuffer(val)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
47
|
-
} catch (e) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const isDate = kindOfTest("Date");
|
|
52
|
-
const isFile = kindOfTest("File");
|
|
53
|
-
const isBlob = kindOfTest("Blob");
|
|
54
|
-
const isFileList = kindOfTest("FileList");
|
|
55
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
56
|
-
const isFormData = (thing) => {
|
|
57
|
-
let kind;
|
|
58
|
-
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
59
|
-
kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
60
|
-
};
|
|
61
|
-
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
62
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
63
|
-
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
64
|
-
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
65
|
-
if (obj === null || typeof obj === "undefined") {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
let i;
|
|
69
|
-
let l;
|
|
70
|
-
if (typeof obj !== "object") {
|
|
71
|
-
obj = [obj];
|
|
72
|
-
}
|
|
73
|
-
if (isArray(obj)) {
|
|
74
|
-
for (i = 0, l = obj.length; i < l; i++) {
|
|
75
|
-
fn.call(null, obj[i], i, obj);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
if (isBuffer(obj)) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
82
|
-
const len = keys.length;
|
|
83
|
-
let key;
|
|
84
|
-
for (i = 0; i < len; i++) {
|
|
85
|
-
key = keys[i];
|
|
86
|
-
fn.call(null, obj[key], key, obj);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function findKey(obj, key) {
|
|
91
|
-
if (isBuffer(obj)) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
key = key.toLowerCase();
|
|
95
|
-
const keys = Object.keys(obj);
|
|
96
|
-
let i = keys.length;
|
|
97
|
-
let _key;
|
|
98
|
-
while (i-- > 0) {
|
|
99
|
-
_key = keys[i];
|
|
100
|
-
if (key === _key.toLowerCase()) {
|
|
101
|
-
return _key;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
const _global = (() => {
|
|
107
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
108
|
-
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
109
|
-
})();
|
|
110
|
-
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
111
|
-
function merge() {
|
|
112
|
-
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
113
|
-
const result = {};
|
|
114
|
-
const assignValue = (val, key) => {
|
|
115
|
-
const targetKey = caseless && findKey(result, key) || key;
|
|
116
|
-
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
117
|
-
result[targetKey] = merge(result[targetKey], val);
|
|
118
|
-
} else if (isPlainObject(val)) {
|
|
119
|
-
result[targetKey] = merge({}, val);
|
|
120
|
-
} else if (isArray(val)) {
|
|
121
|
-
result[targetKey] = val.slice();
|
|
122
|
-
} else if (!skipUndefined || !isUndefined(val)) {
|
|
123
|
-
result[targetKey] = val;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
127
|
-
arguments[i] && forEach(arguments[i], assignValue);
|
|
128
|
-
}
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
132
|
-
forEach(b, (val, key) => {
|
|
133
|
-
if (thisArg && isFunction(val)) {
|
|
134
|
-
a[key] = bind(val, thisArg);
|
|
135
|
-
} else {
|
|
136
|
-
a[key] = val;
|
|
137
|
-
}
|
|
138
|
-
}, { allOwnKeys });
|
|
139
|
-
return a;
|
|
140
|
-
};
|
|
141
|
-
const stripBOM = (content) => {
|
|
142
|
-
if (content.charCodeAt(0) === 65279) {
|
|
143
|
-
content = content.slice(1);
|
|
144
|
-
}
|
|
145
|
-
return content;
|
|
146
|
-
};
|
|
147
|
-
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
148
|
-
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
149
|
-
constructor.prototype.constructor = constructor;
|
|
150
|
-
Object.defineProperty(constructor, "super", {
|
|
151
|
-
value: superConstructor.prototype
|
|
152
|
-
});
|
|
153
|
-
props && Object.assign(constructor.prototype, props);
|
|
154
|
-
};
|
|
155
|
-
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
156
|
-
let props;
|
|
157
|
-
let i;
|
|
158
|
-
let prop;
|
|
159
|
-
const merged = {};
|
|
160
|
-
destObj = destObj || {};
|
|
161
|
-
if (sourceObj == null) return destObj;
|
|
162
|
-
do {
|
|
163
|
-
props = Object.getOwnPropertyNames(sourceObj);
|
|
164
|
-
i = props.length;
|
|
165
|
-
while (i-- > 0) {
|
|
166
|
-
prop = props[i];
|
|
167
|
-
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
168
|
-
destObj[prop] = sourceObj[prop];
|
|
169
|
-
merged[prop] = true;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
173
|
-
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
174
|
-
return destObj;
|
|
175
|
-
};
|
|
176
|
-
const endsWith = (str, searchString, position) => {
|
|
177
|
-
str = String(str);
|
|
178
|
-
if (position === void 0 || position > str.length) {
|
|
179
|
-
position = str.length;
|
|
180
|
-
}
|
|
181
|
-
position -= searchString.length;
|
|
182
|
-
const lastIndex = str.indexOf(searchString, position);
|
|
183
|
-
return lastIndex !== -1 && lastIndex === position;
|
|
184
|
-
};
|
|
185
|
-
const toArray = (thing) => {
|
|
186
|
-
if (!thing) return null;
|
|
187
|
-
if (isArray(thing)) return thing;
|
|
188
|
-
let i = thing.length;
|
|
189
|
-
if (!isNumber(i)) return null;
|
|
190
|
-
const arr = new Array(i);
|
|
191
|
-
while (i-- > 0) {
|
|
192
|
-
arr[i] = thing[i];
|
|
193
|
-
}
|
|
194
|
-
return arr;
|
|
195
|
-
};
|
|
196
|
-
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
197
|
-
return (thing) => {
|
|
198
|
-
return TypedArray && thing instanceof TypedArray;
|
|
199
|
-
};
|
|
200
|
-
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
201
|
-
const forEachEntry = (obj, fn) => {
|
|
202
|
-
const generator = obj && obj[iterator];
|
|
203
|
-
const _iterator = generator.call(obj);
|
|
204
|
-
let result;
|
|
205
|
-
while ((result = _iterator.next()) && !result.done) {
|
|
206
|
-
const pair = result.value;
|
|
207
|
-
fn.call(obj, pair[0], pair[1]);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const matchAll = (regExp, str) => {
|
|
211
|
-
let matches;
|
|
212
|
-
const arr = [];
|
|
213
|
-
while ((matches = regExp.exec(str)) !== null) {
|
|
214
|
-
arr.push(matches);
|
|
215
|
-
}
|
|
216
|
-
return arr;
|
|
217
|
-
};
|
|
218
|
-
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
219
|
-
const toCamelCase = (str) => {
|
|
220
|
-
return str.toLowerCase().replace(
|
|
221
|
-
/[-_\s]([a-z\d])(\w*)/g,
|
|
222
|
-
function replacer(m, p1, p2) {
|
|
223
|
-
return p1.toUpperCase() + p2;
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
};
|
|
227
|
-
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
228
|
-
const isRegExp = kindOfTest("RegExp");
|
|
229
|
-
const reduceDescriptors = (obj, reducer) => {
|
|
230
|
-
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
231
|
-
const reducedDescriptors = {};
|
|
232
|
-
forEach(descriptors, (descriptor, name) => {
|
|
233
|
-
let ret;
|
|
234
|
-
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
235
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
Object.defineProperties(obj, reducedDescriptors);
|
|
239
|
-
};
|
|
240
|
-
const freezeMethods = (obj) => {
|
|
241
|
-
reduceDescriptors(obj, (descriptor, name) => {
|
|
242
|
-
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
const value = obj[name];
|
|
246
|
-
if (!isFunction(value)) return;
|
|
247
|
-
descriptor.enumerable = false;
|
|
248
|
-
if ("writable" in descriptor) {
|
|
249
|
-
descriptor.writable = false;
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (!descriptor.set) {
|
|
253
|
-
descriptor.set = () => {
|
|
254
|
-
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
};
|
|
259
|
-
const toObjectSet = (arrayOrString, delimiter) => {
|
|
260
|
-
const obj = {};
|
|
261
|
-
const define = (arr) => {
|
|
262
|
-
arr.forEach((value) => {
|
|
263
|
-
obj[value] = true;
|
|
264
|
-
});
|
|
265
|
-
};
|
|
266
|
-
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
267
|
-
return obj;
|
|
268
|
-
};
|
|
269
|
-
const noop = () => {
|
|
270
|
-
};
|
|
271
|
-
const toFiniteNumber = (value, defaultValue) => {
|
|
272
|
-
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
273
|
-
};
|
|
274
|
-
function isSpecCompliantForm(thing) {
|
|
275
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
276
|
-
}
|
|
277
|
-
const toJSONObject = (obj) => {
|
|
278
|
-
const stack = new Array(10);
|
|
279
|
-
const visit = (source, i) => {
|
|
280
|
-
if (isObject(source)) {
|
|
281
|
-
if (stack.indexOf(source) >= 0) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (isBuffer(source)) {
|
|
285
|
-
return source;
|
|
286
|
-
}
|
|
287
|
-
if (!("toJSON" in source)) {
|
|
288
|
-
stack[i] = source;
|
|
289
|
-
const target = isArray(source) ? [] : {};
|
|
290
|
-
forEach(source, (value, key) => {
|
|
291
|
-
const reducedValue = visit(value, i + 1);
|
|
292
|
-
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
293
|
-
});
|
|
294
|
-
stack[i] = void 0;
|
|
295
|
-
return target;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return source;
|
|
299
|
-
};
|
|
300
|
-
return visit(obj, 0);
|
|
301
|
-
};
|
|
302
|
-
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
303
|
-
const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
304
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
305
|
-
if (setImmediateSupported) {
|
|
306
|
-
return setImmediate;
|
|
307
|
-
}
|
|
308
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
309
|
-
_global.addEventListener("message", ({ source, data }) => {
|
|
310
|
-
if (source === _global && data === token) {
|
|
311
|
-
callbacks.length && callbacks.shift()();
|
|
312
|
-
}
|
|
313
|
-
}, false);
|
|
314
|
-
return (cb) => {
|
|
315
|
-
callbacks.push(cb);
|
|
316
|
-
_global.postMessage(token, "*");
|
|
317
|
-
};
|
|
318
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
319
|
-
})(
|
|
320
|
-
typeof setImmediate === "function",
|
|
321
|
-
isFunction(_global.postMessage)
|
|
322
|
-
);
|
|
323
|
-
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
324
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
325
|
-
const utils = {
|
|
326
|
-
isArray,
|
|
327
|
-
isArrayBuffer,
|
|
328
|
-
isBuffer,
|
|
329
|
-
isFormData,
|
|
330
|
-
isArrayBufferView,
|
|
331
|
-
isString,
|
|
332
|
-
isNumber,
|
|
333
|
-
isBoolean,
|
|
334
|
-
isObject,
|
|
335
|
-
isPlainObject,
|
|
336
|
-
isEmptyObject,
|
|
337
|
-
isReadableStream,
|
|
338
|
-
isRequest,
|
|
339
|
-
isResponse,
|
|
340
|
-
isHeaders,
|
|
341
|
-
isUndefined,
|
|
342
|
-
isDate,
|
|
343
|
-
isFile,
|
|
344
|
-
isBlob,
|
|
345
|
-
isRegExp,
|
|
346
|
-
isFunction,
|
|
347
|
-
isStream,
|
|
348
|
-
isURLSearchParams,
|
|
349
|
-
isTypedArray,
|
|
350
|
-
isFileList,
|
|
351
|
-
forEach,
|
|
352
|
-
merge,
|
|
353
|
-
extend,
|
|
354
|
-
trim,
|
|
355
|
-
stripBOM,
|
|
356
|
-
inherits,
|
|
357
|
-
toFlatObject,
|
|
358
|
-
kindOf,
|
|
359
|
-
kindOfTest,
|
|
360
|
-
endsWith,
|
|
361
|
-
toArray,
|
|
362
|
-
forEachEntry,
|
|
363
|
-
matchAll,
|
|
364
|
-
isHTMLForm,
|
|
365
|
-
hasOwnProperty,
|
|
366
|
-
hasOwnProp: hasOwnProperty,
|
|
367
|
-
// an alias to avoid ESLint no-prototype-builtins detection
|
|
368
|
-
reduceDescriptors,
|
|
369
|
-
freezeMethods,
|
|
370
|
-
toObjectSet,
|
|
371
|
-
toCamelCase,
|
|
372
|
-
noop,
|
|
373
|
-
toFiniteNumber,
|
|
374
|
-
findKey,
|
|
375
|
-
global: _global,
|
|
376
|
-
isContextDefined,
|
|
377
|
-
isSpecCompliantForm,
|
|
378
|
-
toJSONObject,
|
|
379
|
-
isAsyncFn,
|
|
380
|
-
isThenable,
|
|
381
|
-
setImmediate: _setImmediate,
|
|
382
|
-
asap,
|
|
383
|
-
isIterable
|
|
384
|
-
};
|
|
385
|
-
export {
|
|
386
|
-
utils as default
|
|
387
|
-
};
|
|
1
|
+
import e from"../helpers/bind/index.es.js";const{toString:t}=Object.prototype,{getPrototypeOf:r}=Object,{iterator:n,toStringTag:o}=Symbol,s=/* @__PURE__ */(e=>r=>{const n=t.call(r);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(/* @__PURE__ */Object.create(null)),i=e=>(e=e.toLowerCase(),t=>s(t)===e),a=e=>t=>typeof t===e,{isArray:l}=Array,c=a("undefined");function u(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&d(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const f=i("ArrayBuffer");const p=a("string"),d=a("function"),y=a("number"),b=e=>null!==e&&"object"==typeof e,m=e=>{if("object"!==s(e))return!1;const t=r(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||o in e||n in e)},O=i("Date"),g=i("File"),h=i("Blob"),j=i("FileList"),w=i("URLSearchParams"),[F,A,S,x]=["ReadableStream","Request","Response","Headers"].map(i);function P(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),l(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(u(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function B(e,t){if(u(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,E=e=>!c(e)&&e!==C;const L=/* @__PURE__ */(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&r(Uint8Array)),D=i("HTMLFormElement"),R=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),T=i("RegExp"),k=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};P(r,(r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)}),Object.defineProperties(e,n)};const M=i("AsyncFunction"),N=(U="function"==typeof setImmediate,v=d(C.postMessage),U?setImmediate:v?(q=`axios@${Math.random()}`,H=[],C.addEventListener("message",({source:e,data:t})=>{e===C&&t===q&&H.length&&H.shift()()},!1),e=>{H.push(e),C.postMessage(q,"*")}):e=>setTimeout(e));var U,v,q,H;const I="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):"undefined"!=typeof process&&process.nextTick||N,K={isArray:l,isArrayBuffer:f,isBuffer:u,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||d(e.append)&&("formdata"===(t=s(e))||"object"===t&&d(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:p,isNumber:y,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:m,isEmptyObject:e=>{if(!b(e)||u(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:F,isRequest:A,isResponse:S,isHeaders:x,isUndefined:c,isDate:O,isFile:g,isBlob:h,isRegExp:T,isFunction:d,isStream:e=>b(e)&&d(e.pipe),isURLSearchParams:w,isTypedArray:L,isFileList:j,forEach:P,merge:function e(){const{caseless:t,skipUndefined:r}=E(this)&&this||{},n={},o=(o,s)=>{const i=t&&B(n,s)||s;m(n[i])&&m(o)?n[i]=e(n[i],o):m(o)?n[i]=e({},o):l(o)?n[i]=o.slice():r&&c(o)||(n[i]=o)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&P(arguments[s],o);return n},extend:(t,r,n,{allOwnKeys:o}={})=>(P(r,(r,o)=>{n&&d(r)?t[o]=e(r,n):t[o]=r},{allOwnKeys:o}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,n,o)=>{let s,i,a;const l={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||l[a]||(t[a]=e[a],l[a]=!0);e=!1!==n&&r(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:i,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!y(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[n]).call(e);let o;for(;(o=r.next())&&!o.done;){const r=o.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:D,hasOwnProperty:R,hasOwnProp:R,reduceDescriptors:k,freezeMethods:e=>{k(e,(t,r)=>{if(d(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];d(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return l(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:B,global:C,isContextDefined:E,isSpecCompliantForm:function(e){return!!(e&&d(e.append)&&"FormData"===e[o]&&e[n])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(u(e))return e;if(!("toJSON"in e)){t[n]=e;const o=l(e)?[]:{};return P(e,(e,t)=>{const s=r(e,n+1);!c(s)&&(o[t]=s)}),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:M,isThenable:e=>e&&(b(e)||d(e))&&d(e.then)&&d(e.catch),setImmediate:N,asap:I,isIterable:e=>null!=e&&d(e[n])};export{K as default};
|
|
@@ -1,145 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { config } from "../../core/index.es/index.es.js";
|
|
3
|
-
const getkey = function(prefix, key2) {
|
|
4
|
-
return prefix + key2;
|
|
5
|
-
};
|
|
6
|
-
class Storage {
|
|
7
|
-
constructor(prefix = "") {
|
|
8
|
-
this.prefix = prefix || config.cachePrefix;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* 缓存被改变事件监听
|
|
12
|
-
* @param {function} [callback = function(e){ }] 缓存被改变回调函数,参数e有e.key、e.oldValue、e.newValue、e.url 4个属性
|
|
13
|
-
*/
|
|
14
|
-
change(callback) {
|
|
15
|
-
window.addEventListener("storage", function(e) {
|
|
16
|
-
callback && callback(e);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 设置缓存前缀
|
|
21
|
-
* @param {string} [prefix = ""] 前缀
|
|
22
|
-
*/
|
|
23
|
-
setPrefix(prefix = "") {
|
|
24
|
-
this.prefix = prefix;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 设置缓存(以指定时间对象设置缓存过期时间)
|
|
28
|
-
* @param {string} [key = ""] 缓存的key
|
|
29
|
-
* @param {object} [value = ""] 缓存的值
|
|
30
|
-
* @param {Date} [date = 0] 指定缓存过期的时间
|
|
31
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
32
|
-
*/
|
|
33
|
-
setDate(key2, value, date, isSession) {
|
|
34
|
-
date = date || /* @__PURE__ */ new Date();
|
|
35
|
-
var time = diff(date);
|
|
36
|
-
return this.set(key2, value, time, isSession);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 设置缓存
|
|
40
|
-
* @param {string} [key = ""] 缓存的key
|
|
41
|
-
* @param {object} [value = ""] 缓存的值
|
|
42
|
-
* @param {int} [time = 0] 缓存的过期时间(秒),为0表示不过期
|
|
43
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
44
|
-
*/
|
|
45
|
-
set(key2, value, time, isSession) {
|
|
46
|
-
time = time || 0;
|
|
47
|
-
var now = getTimestamp();
|
|
48
|
-
var cacheVal = { "value": value, "time": time, "now": now, "endTime": now + time };
|
|
49
|
-
key2 = getkey(this.prefix, key2);
|
|
50
|
-
var cacheObject = isSession ? window.sessionStorage : window.localStorage;
|
|
51
|
-
if (!cacheObject) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
cacheObject.setItem(key2, JSON.stringify(cacheVal));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* 直接设置值,不再重新设置过期事件,适合修改缓存值但是不修改缓存过期时间的场合
|
|
58
|
-
* @param {string} [key = ""] 缓存的key
|
|
59
|
-
* @param {object} [value = ""] 缓存的值
|
|
60
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
61
|
-
* @param {Date} [date = 0] 指定缓存过期的时间
|
|
62
|
-
*/
|
|
63
|
-
setValue(_key, value, isSession, date) {
|
|
64
|
-
key = getkey(this.prefix, _key);
|
|
65
|
-
var cacheObject = isSession ? window.sessionStorage : window.localStorage;
|
|
66
|
-
var cacheVal = cacheObject.getItem(key);
|
|
67
|
-
if (!cacheVal) {
|
|
68
|
-
this.set(_key, value, 0, isSession);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var json = JSON.parse(cacheVal);
|
|
72
|
-
var now = getTimestamp();
|
|
73
|
-
if (json.time > 0 && now > json.endTime) {
|
|
74
|
-
cacheObject.removeItem(key);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
json.value = value;
|
|
78
|
-
if (date) {
|
|
79
|
-
var time = diff(date);
|
|
80
|
-
var now = getTimestamp();
|
|
81
|
-
json.endTime = now + time;
|
|
82
|
-
}
|
|
83
|
-
cacheObject.setItem(key, JSON.stringify(json));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* 获取缓存
|
|
87
|
-
* @param {string} [key = ""] 缓存的key
|
|
88
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
89
|
-
* @return {object} 缓存的值
|
|
90
|
-
*/
|
|
91
|
-
get(key2, isSession) {
|
|
92
|
-
key2 = getkey(this.prefix, key2);
|
|
93
|
-
var cacheObject = isSession ? window.sessionStorage : window.localStorage;
|
|
94
|
-
if (!cacheObject) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
var cacheVal = cacheObject.getItem(key2);
|
|
98
|
-
if (!cacheVal) return null;
|
|
99
|
-
var json = JSON.parse(cacheVal);
|
|
100
|
-
var now = getTimestamp();
|
|
101
|
-
if (json.time > 0 && now > json.endTime) {
|
|
102
|
-
cacheObject.removeItem(key2);
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
return json.value;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* 缓存计数器
|
|
109
|
-
* @param {string} [key = ""] 缓存的key
|
|
110
|
-
* @param {int} [n = 1] 计数器增减值
|
|
111
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
112
|
-
* @param {Date} [date = 0] 指定缓存过期的时间
|
|
113
|
-
* @return {int} 缓存的值
|
|
114
|
-
*/
|
|
115
|
-
add(key2, n, isSession, date) {
|
|
116
|
-
var cacheVal = parseInt(this.get(key2, isSession) || 0);
|
|
117
|
-
var value = cacheVal + n;
|
|
118
|
-
this.setValue(key2, value, isSession, date);
|
|
119
|
-
return value;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 移除缓存
|
|
123
|
-
* @param {string} [key = ""] 缓存的key
|
|
124
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
125
|
-
*/
|
|
126
|
-
remove(key2, isSession) {
|
|
127
|
-
key2 = getkey(this.prefix, key2);
|
|
128
|
-
var cacheObject = isSession ? window.sessionStorage : window.localStorage;
|
|
129
|
-
cacheObject ? cacheObject.removeItem(key2) : null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 清空所有保存的缓存数据
|
|
133
|
-
* @param {bool} [isSession = false] 是否使用session缓存对象
|
|
134
|
-
*/
|
|
135
|
-
clear(isSession) {
|
|
136
|
-
var cacheObject = isSession ? window.sessionStorage : window.localStorage;
|
|
137
|
-
cacheObject.clear();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
const cache = new Storage();
|
|
141
|
-
const cacheClass = Storage;
|
|
142
|
-
export {
|
|
143
|
-
cache,
|
|
144
|
-
cacheClass
|
|
145
|
-
};
|
|
1
|
+
import{diff as e,getTimestamp as t}from"../../date/index.es/index.es.js";import{config as i}from"../../core/index.es/index.es.js";const r=function(e,t){return e+t};class s{constructor(e=""){this.prefix=e||i.cachePrefix}change(e){window.addEventListener("storage",function(t){e&&e(t)})}setPrefix(e=""){this.prefix=e}setDate(t,i,r,s){var a=e(r=r||/* @__PURE__ */new Date);return this.set(t,i,a,s)}set(e,i,s,a){s=s||0;var n=t(),o={value:i,time:s,now:n,endTime:n+s};e=r(this.prefix,e);var l=a?window.sessionStorage:window.localStorage;l&&l.setItem(e,JSON.stringify(o))}setValue(i,s,a,n){key=r(this.prefix,i);var o=a?window.sessionStorage:window.localStorage,l=o.getItem(key);if(l){var d=JSON.parse(l),w=t();if(d.time>0&&w>d.endTime)o.removeItem(key);else{if(d.value=s,n){var m=e(n);w=t(),d.endTime=w+m}o.setItem(key,JSON.stringify(d))}}else this.set(i,s,0,a)}get(e,i){e=r(this.prefix,e);var s=i?window.sessionStorage:window.localStorage;if(!s)return null;var a=s.getItem(e);if(!a)return null;var n=JSON.parse(a),o=t();return n.time>0&&o>n.endTime?(s.removeItem(e),null):n.value}add(e,t,i,r){var s=parseInt(this.get(e,i)||0)+t;return this.setValue(e,s,i,r),s}remove(e,t){e=r(this.prefix,e);var i=t?window.sessionStorage:window.localStorage;i&&i.removeItem(e)}clear(e){(e?window.sessionStorage:window.localStorage).clear()}}const a=new s,n=s;export{a as cache,n as cacheClass};
|
|
@@ -1,154 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isFunction as isFunction$1, isObject, isArray, isString } from "../../typetool/index.es/index.es.js";
|
|
3
|
-
const { isFunction } = index_es;
|
|
4
|
-
window.allvar = window.allvar || {};
|
|
5
|
-
const allvar = window.allvar;
|
|
6
|
-
const config = {
|
|
7
|
-
cachePrefix: "slcms_"
|
|
8
|
-
};
|
|
9
|
-
const wait = function(time) {
|
|
10
|
-
return new Promise(function(resolve, reject) {
|
|
11
|
-
setTimeout(function() {
|
|
12
|
-
resolve();
|
|
13
|
-
}, time);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
const getError = function() {
|
|
17
|
-
return new Error(Array.prototype.slice.apply(arguments));
|
|
18
|
-
};
|
|
19
|
-
const extend = function() {
|
|
20
|
-
var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;
|
|
21
|
-
if (typeof target === "boolean") {
|
|
22
|
-
deep = target;
|
|
23
|
-
target = arguments[i] || {};
|
|
24
|
-
i++;
|
|
25
|
-
}
|
|
26
|
-
if (typeof target !== "object" && !isFunction(target)) {
|
|
27
|
-
target = {};
|
|
28
|
-
}
|
|
29
|
-
if (i === length) {
|
|
30
|
-
target = this;
|
|
31
|
-
i--;
|
|
32
|
-
}
|
|
33
|
-
for (; i < length; i++) {
|
|
34
|
-
if (arguments[i]) {
|
|
35
|
-
options = arguments[i];
|
|
36
|
-
for (name in options) {
|
|
37
|
-
src = target[name];
|
|
38
|
-
copy = options[name];
|
|
39
|
-
if (target === copy) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (deep && copy && (isObject(copy) || (copyIsArray = isArray(copy)))) {
|
|
43
|
-
if (copyIsArray) {
|
|
44
|
-
copyIsArray = false;
|
|
45
|
-
clone = src && isArray(src) ? src : [];
|
|
46
|
-
} else {
|
|
47
|
-
clone = src && isObject(src) ? src : {};
|
|
48
|
-
}
|
|
49
|
-
target[name] = extend(deep, clone, copy);
|
|
50
|
-
} else if (copy !== void 0) {
|
|
51
|
-
target[name] = copy;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
};
|
|
58
|
-
(function() {
|
|
59
|
-
var funcs = [];
|
|
60
|
-
var ready2 = false;
|
|
61
|
-
function handler(e) {
|
|
62
|
-
if (ready2) return;
|
|
63
|
-
if (e.type === "onreadystatechange" && document.readyState !== "complete") {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
for (var i = 0; i < funcs.length; i++) {
|
|
67
|
-
funcs[i].call(document);
|
|
68
|
-
}
|
|
69
|
-
ready2 = true;
|
|
70
|
-
funcs = null;
|
|
71
|
-
}
|
|
72
|
-
if (document.addEventListener) {
|
|
73
|
-
document.addEventListener("DOMContentLoaded", handler, false);
|
|
74
|
-
document.addEventListener("readystatechange", handler, false);
|
|
75
|
-
window.addEventListener("load", handler, false);
|
|
76
|
-
} else if (document.attachEvent) {
|
|
77
|
-
document.attachEvent("onreadystatechange", handler);
|
|
78
|
-
window.attachEvent("onload", handler);
|
|
79
|
-
}
|
|
80
|
-
return function whenReady(fn) {
|
|
81
|
-
if (ready2) {
|
|
82
|
-
fn.call(document);
|
|
83
|
-
} else {
|
|
84
|
-
funcs.push(fn);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
})();
|
|
88
|
-
allvar.jsModuleMap = {};
|
|
89
|
-
allvar.npm_relyMap = {};
|
|
90
|
-
const loadjs = /* @__PURE__ */ (function() {
|
|
91
|
-
const loadOne = function(url, npm_rely) {
|
|
92
|
-
allvar.npm_relyMap[url] = npm_rely;
|
|
93
|
-
return new Promise((resolve) => {
|
|
94
|
-
if (allvar.jsModuleMap[url]) {
|
|
95
|
-
resolve(allvar.jsModuleMap[url]);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
var script = document.createElement("script");
|
|
99
|
-
script.type = "text/javascript";
|
|
100
|
-
script.async = true;
|
|
101
|
-
if (script.readyState) {
|
|
102
|
-
script.onreadystatechange = function() {
|
|
103
|
-
if (script.readyState === "loaded" || script.readyState === "complete") {
|
|
104
|
-
script.onreadystatechange = null;
|
|
105
|
-
resolve(allvar.jsModuleMap[url]);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
} else {
|
|
109
|
-
script.onload = function() {
|
|
110
|
-
resolve(allvar.jsModuleMap[url]);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
script.src = url;
|
|
114
|
-
document.getElementsByTagName("head")[0].appendChild(script);
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
const loadjs2 = async function(urls, npm_relys) {
|
|
118
|
-
if (isString(urls)) {
|
|
119
|
-
urls = [urls];
|
|
120
|
-
}
|
|
121
|
-
if (!isArray(npm_relys)) {
|
|
122
|
-
npm_relys = [npm_relys];
|
|
123
|
-
}
|
|
124
|
-
if (urls.length === 1) {
|
|
125
|
-
return loadOne(urls[0], npm_relys[0]);
|
|
126
|
-
}
|
|
127
|
-
var promiseArr = [];
|
|
128
|
-
for (var i = 0; i < urls.length; i++) {
|
|
129
|
-
const npm_rely = i >= npm_relys.length ? null : npm_relys[i];
|
|
130
|
-
promiseArr.push(loadOne(urls[i], npm_rely));
|
|
131
|
-
}
|
|
132
|
-
const pmall = Promise.all(promiseArr);
|
|
133
|
-
return pmall;
|
|
134
|
-
};
|
|
135
|
-
return loadjs2;
|
|
136
|
-
})();
|
|
137
|
-
window.getNpmRely = function() {
|
|
138
|
-
const url = document.currentScript.src;
|
|
139
|
-
return allvar.npm_relyMap[url];
|
|
140
|
-
};
|
|
141
|
-
window.setJsModule = function(module) {
|
|
142
|
-
const url = document.currentScript.src;
|
|
143
|
-
if (isFunction$1(module)) {
|
|
144
|
-
module = module(getNpmRely());
|
|
145
|
-
}
|
|
146
|
-
allvar.jsModuleMap[url] = module;
|
|
147
|
-
};
|
|
148
|
-
export {
|
|
149
|
-
config,
|
|
150
|
-
extend,
|
|
151
|
-
getError,
|
|
152
|
-
loadjs,
|
|
153
|
-
wait
|
|
154
|
-
};
|
|
1
|
+
import*as e from"../../typetool/index.es/index.es.js";import{isFunction as t,isObject as n,isArray as o,isString as a}from"../../typetool/index.es/index.es.js";const{isFunction:r}=e;window.allvar=window.allvar||{};const c=window.allvar,s={cachePrefix:"slcms_"},d=function(e){return new Promise(function(t,n){setTimeout(function(){t()},e)})},i=function(){return new Error(Array.prototype.slice.apply(arguments))},l=function(){var e,t,a,c,s,d,i=arguments[0]||{},u=1,p=arguments.length,m=!1;for("boolean"==typeof i&&(m=i,i=arguments[u]||{},u++),"object"==typeof i||r(i)||(i={}),u===p&&(i=this,u--);u<p;u++)if(arguments[u])for(t in e=arguments[u])a=i[t],i!==(c=e[t])&&(m&&c&&(n(c)||(s=o(c)))?(s?(s=!1,d=a&&o(a)?a:[]):d=a&&n(a)?a:{},i[t]=l(m,d,c)):void 0!==c&&(i[t]=c));return i};!function(){var e=[],t=!1;function n(n){if(!t&&("onreadystatechange"!==n.type||"complete"===document.readyState)){for(var o=0;o<e.length;o++)e[o].call(document);t=!0,e=null}}document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),document.addEventListener("readystatechange",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",n),window.attachEvent("onload",n))}(),c.jsModuleMap={},c.npm_relyMap={};const u=/* @__PURE__ */function(){const e=function(e,t){return c.npm_relyMap[e]=t,new Promise(t=>{if(c.jsModuleMap[e])t(c.jsModuleMap[e]);else{var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.readyState?n.onreadystatechange=function(){"loaded"!==n.readyState&&"complete"!==n.readyState||(n.onreadystatechange=null,t(c.jsModuleMap[e]))}:n.onload=function(){t(c.jsModuleMap[e])},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}})};return async function(t,n){if(a(t)&&(t=[t]),o(n)||(n=[n]),1===t.length)return e(t[0],n[0]);for(var r=[],c=0;c<t.length;c++){const o=c>=n.length?null:n[c];r.push(e(t[c],o))}return Promise.all(r)}}();window.getNpmRely=function(){const e=document.currentScript.src;return c.npm_relyMap[e]},window.setJsModule=function(e){const n=document.currentScript.src;t(e)&&(e=e(getNpmRely())),c.jsModuleMap[n]=e};export{s as config,l as extend,i as getError,u as loadjs,d as wait};
|