From d3ed4ec8e680c4a9ba174eeb86cb15b4a4a19067 Mon Sep 17 00:00:00 2001
From: gyq <875626088@qq.com>
Date: Wed, 26 Feb 2025 18:06:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E8=B4=AD=E7=89=A9=E8=BD=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 15 +-
dist-electron/main.js | 1557 +++++++++++--------
src/App.vue | 15 +-
src/api/account.js | 79 +
src/api/order.js | 66 +
src/api/product_new.js | 27 +
src/components/payCard/payCard.vue | 35 +-
src/components/selectVipUser.vue | 94 ++
src/components/skuModal.vue | 140 +-
src/components/updateDialog.vue | 6 +-
src/store/goods.js | 407 +++++
src/store/print.js | 24 +-
src/store/shop.js | 4 +-
src/store/socket.js | 137 +-
src/store/user.js | 24 +-
src/utils/request.js | 34 +-
src/views/home/components/cartOperation.vue | 175 ++-
src/views/home/components/category.vue | 95 --
src/views/home/components/goods.vue | 346 ++---
src/views/home/components/groupModal.vue | 83 +-
src/views/home/components/settleAccount.vue | 125 +-
src/views/home/components/weightModal.vue | 7 +-
src/views/home/index.vue | 526 +++----
src/views/home/test.vue | 39 +-
src/views/login.vue | 110 +-
src/views/table/components/tableInfo.vue | 17 +-
src/views/table/index.vue | 31 +-
27 files changed, 2589 insertions(+), 1629 deletions(-)
create mode 100644 src/api/account.js
create mode 100644 src/api/order.js
create mode 100644 src/api/product_new.js
create mode 100644 src/components/selectVipUser.vue
create mode 100644 src/store/goods.js
delete mode 100644 src/views/home/components/category.vue
diff --git a/.env.development b/.env.development
index e2c3392..781df07 100644
--- a/.env.development
+++ b/.env.development
@@ -2,10 +2,10 @@
ENV = development
# 正式ws
-VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
+# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
#测试ws
-# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
+VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 阿伟本地ws
# VITE_API_WSS = 'ws://192.168.2.17:9998/client'
@@ -20,10 +20,7 @@ VITE_API_PHP_URL = 'https://czgdoumei.sxczgkj.com/index.php/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 阿伟
-# VITE_API_URL = 'http://192.168.2.96:10587/cashier-client'
-
-# 鹏辉
-# VITE_API_URL = 'http://192.168.1.106:10589/cashier-client'
+# VITE_API_URL = 'http://192.168.1.21:9200/'
# 杰哥
# VITE_API_URL = 'http://192.168.1.34:10589/cashier-client'
@@ -38,4 +35,8 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# VITE_API_URL = 'https://36z1017t45.goho.co/cashier-client'
# 正式
-VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
\ No newline at end of file
+# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
+
+# 正式
+VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
+
diff --git a/dist-electron/main.js b/dist-electron/main.js
index 34f5dcf..2d79b0f 100644
--- a/dist-electron/main.js
+++ b/dist-electron/main.js
@@ -67,6 +67,7 @@ const isFormData = (thing) => {
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
};
const isURLSearchParams = kindOfTest("URLSearchParams");
+const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach(obj, fn, { allOwnKeys = false } = {}) {
if (obj === null || typeof obj === "undefined") {
@@ -105,8 +106,7 @@ function findKey(obj, key) {
return null;
}
const _global = (() => {
- if (typeof globalThis !== "undefined")
- return globalThis;
+ if (typeof globalThis !== "undefined") return globalThis;
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
})();
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
@@ -160,8 +160,7 @@ const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
let prop;
const merged = {};
destObj = destObj || {};
- if (sourceObj == null)
- return destObj;
+ if (sourceObj == null) return destObj;
do {
props = Object.getOwnPropertyNames(sourceObj);
i = props.length;
@@ -186,13 +185,10 @@ const endsWith = (str, searchString, position) => {
return lastIndex !== -1 && lastIndex === position;
};
const toArray = (thing) => {
- if (!thing)
- return null;
- if (isArray(thing))
- return thing;
+ if (!thing) return null;
+ if (isArray(thing)) return thing;
let i = thing.length;
- if (!isNumber(i))
- return null;
+ if (!isNumber(i)) return null;
const arr = new Array(i);
while (i-- > 0) {
arr[i] = thing[i];
@@ -249,8 +245,7 @@ const freezeMethods = (obj) => {
return false;
}
const value = obj[name];
- if (!isFunction$1(value))
- return;
+ if (!isFunction$1(value)) return;
descriptor.enumerable = false;
if ("writable" in descriptor) {
descriptor.writable = false;
@@ -276,8 +271,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
const noop$1 = () => {
};
const toFiniteNumber = (value, defaultValue) => {
- value = +value;
- return Number.isFinite(value) ? value : defaultValue;
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
};
const ALPHA = "abcdefghijklmnopqrstuvwxyz";
const DIGIT = "0123456789";
@@ -321,6 +315,26 @@ const toJSONObject = (obj) => {
};
const isAsyncFn = kindOfTest("AsyncFunction");
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
+const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
+ if (setImmediateSupported) {
+ return setImmediate;
+ }
+ return postMessageSupported ? ((token, callbacks) => {
+ _global.addEventListener("message", ({ source, data }) => {
+ if (source === _global && data === token) {
+ callbacks.length && callbacks.shift()();
+ }
+ }, false);
+ return (cb) => {
+ callbacks.push(cb);
+ _global.postMessage(token, "*");
+ };
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
+})(
+ typeof setImmediate === "function",
+ isFunction$1(_global.postMessage)
+);
+const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
const utils$1 = {
isArray,
isArrayBuffer,
@@ -332,6 +346,10 @@ const utils$1 = {
isBoolean,
isObject,
isPlainObject,
+ isReadableStream,
+ isRequest,
+ isResponse,
+ isHeaders,
isUndefined,
isDate,
isFile,
@@ -373,9 +391,11 @@ const utils$1 = {
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
- isThenable
+ isThenable,
+ setImmediate: _setImmediate,
+ asap
};
-function AxiosError(message, code, config, request, response) {
+function AxiosError$1(message, code, config, request, response) {
Error.call(this);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
@@ -387,9 +407,12 @@ function AxiosError(message, code, config, request, response) {
code && (this.code = code);
config && (this.config = config);
request && (this.request = request);
- response && (this.response = response);
+ if (response) {
+ this.response = response;
+ this.status = response.status ? response.status : null;
+ }
}
-utils$1.inherits(AxiosError, Error, {
+utils$1.inherits(AxiosError$1, Error, {
toJSON: function toJSON() {
return {
// Standard
@@ -406,11 +429,11 @@ utils$1.inherits(AxiosError, Error, {
// Axios
config: utils$1.toJSONObject(this.config),
code: this.code,
- status: this.response && this.response.status ? this.response.status : null
+ status: this.status
};
}
});
-const prototype$1 = AxiosError.prototype;
+const prototype$1 = AxiosError$1.prototype;
const descriptors = {};
[
"ERR_BAD_OPTION_VALUE",
@@ -429,16 +452,16 @@ const descriptors = {};
].forEach((code) => {
descriptors[code] = { value: code };
});
-Object.defineProperties(AxiosError, descriptors);
+Object.defineProperties(AxiosError$1, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
-AxiosError.from = (error, code, config, request, response, customProps) => {
+AxiosError$1.from = (error, code, config, request, response, customProps) => {
const axiosError = Object.create(prototype$1);
utils$1.toFlatObject(error, axiosError, function filter2(obj) {
return obj !== Error.prototype;
}, (prop) => {
return prop !== "isAxiosError";
});
- AxiosError.call(axiosError, error.message, code, config, request, response);
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
axiosError.cause = error;
axiosError.name = error.name;
customProps && Object.assign(axiosError, customProps);
@@ -645,8 +668,7 @@ CombinedStream$1.prototype.pause = function() {
if (!this.pauseStreams) {
return;
}
- if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function")
- this._currentStream.pause();
+ if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
this.emit("pause");
};
CombinedStream$1.prototype.resume = function() {
@@ -655,8 +677,7 @@ CombinedStream$1.prototype.resume = function() {
this.writable = true;
this._getNext();
}
- if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function")
- this._currentStream.resume();
+ if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
this.emit("resume");
};
CombinedStream$1.prototype.end = function() {
@@ -11450,8 +11471,7 @@ var mimeDb = require$$0;
}
if (mime2.indexOf("charset") === -1) {
var charset2 = exports.charset(mime2);
- if (charset2)
- mime2 += "; charset=" + charset2.toLowerCase();
+ if (charset2) mime2 += "; charset=" + charset2.toLowerCase();
}
return mime2;
}
@@ -11687,7 +11707,7 @@ FormData$1.prototype.append = function(field, value, options) {
if (typeof value == "number") {
value = "" + value;
}
- if (util.isArray(value)) {
+ if (Array.isArray(value)) {
this._error(new Error("Arrays are not supported."));
return;
}
@@ -11761,8 +11781,7 @@ FormData$1.prototype._multiPartHeader = function(field, value, options) {
}
var header;
for (var prop in headers) {
- if (!headers.hasOwnProperty(prop))
- continue;
+ if (!headers.hasOwnProperty(prop)) continue;
header = headers[prop];
if (header == null) {
continue;
@@ -11967,8 +11986,7 @@ function removeBrackets(key) {
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
}
function renderKey(path2, key, dots) {
- if (!path2)
- return key;
+ if (!path2) return key;
return path2.concat(key).map(function each(token, i) {
token = removeBrackets(token);
return !dots && i ? "[" + token + "]" : token;
@@ -11980,7 +11998,7 @@ function isFlatArray(arr) {
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
return /^is[A-Z]/.test(prop);
});
-function toFormData(obj, formData, options) {
+function toFormData$1(obj, formData, options) {
if (!utils$1.isObject(obj)) {
throw new TypeError("target must be an object");
}
@@ -12002,13 +12020,12 @@ function toFormData(obj, formData, options) {
throw new TypeError("visitor must be a function");
}
function convertValue(value) {
- if (value === null)
- return "";
+ if (value === null) return "";
if (utils$1.isDate(value)) {
return value.toISOString();
}
if (!useBlob && utils$1.isBlob(value)) {
- throw new AxiosError("Blob is not supported. Use a Buffer instead.");
+ throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
}
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
@@ -12046,8 +12063,7 @@ function toFormData(obj, formData, options) {
isVisitable
});
function build(value, path2) {
- if (utils$1.isUndefined(value))
- return;
+ if (utils$1.isUndefined(value)) return;
if (stack.indexOf(value) !== -1) {
throw Error("Circular reference detected in " + path2.join("."));
}
@@ -12088,7 +12104,7 @@ function encode$1(str) {
}
function AxiosURLSearchParams(params, options) {
this._pairs = [];
- params && toFormData(params, this, options);
+ params && toFormData$1(params, this, options);
}
const prototype = AxiosURLSearchParams.prototype;
prototype.append = function append(name, value) {
@@ -12110,6 +12126,11 @@ function buildURL(url2, params, options) {
return url2;
}
const _encode = options && options.encode || encode;
+ if (utils$1.isFunction(options)) {
+ options = {
+ serialize: options
+ };
+ }
const serializeFn = options && options.serialize;
let serializedParams;
if (serializeFn) {
@@ -12203,25 +12224,27 @@ const platform$1 = {
protocols: ["http", "https", "file", "data"]
};
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
-const hasStandardBrowserEnv = ((product) => {
- return hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(product) < 0;
-})(typeof navigator !== "undefined" && navigator.product);
+const _navigator = typeof navigator === "object" && navigator || void 0;
+const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
const hasStandardBrowserWebWorkerEnv = (() => {
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
})();
+const origin = hasBrowserEnv && window.location.href || "http://localhost";
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv,
hasStandardBrowserEnv,
- hasStandardBrowserWebWorkerEnv
+ hasStandardBrowserWebWorkerEnv,
+ navigator: _navigator,
+ origin
}, Symbol.toStringTag, { value: "Module" }));
const platform = {
...utils,
...platform$1
};
function toURLEncodedForm(data, options) {
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
+ return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
visitor: function(value, key, path2, helpers) {
if (platform.isNode && utils$1.isBuffer(value)) {
this.append(key, value.toString("base64"));
@@ -12251,8 +12274,7 @@ function arrayToObject(arr) {
function formDataToJSON(formData) {
function buildPath(path2, value, target, index) {
let name = path2[index++];
- if (name === "__proto__")
- return true;
+ if (name === "__proto__") return true;
const isNumericKey = Number.isFinite(+name);
const isLast = index >= path2.length;
name = !name && utils$1.isArray(target) ? target.length : name;
@@ -12297,7 +12319,7 @@ function stringifySafely(rawValue, parser, encoder) {
}
const defaults = {
transitional: transitionalDefaults,
- adapter: ["xhr", "http"],
+ adapter: ["xhr", "http", "fetch"],
transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || "";
const hasJSONContentType = contentType.indexOf("application/json") > -1;
@@ -12309,7 +12331,7 @@ const defaults = {
if (isFormData2) {
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
}
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
return data;
}
if (utils$1.isArrayBufferView(data)) {
@@ -12326,7 +12348,7 @@ const defaults = {
}
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
const _FormData = this.env && this.env.FormData;
- return toFormData(
+ return toFormData$1(
isFileList2 ? { "files[]": data } : data,
_FormData && new _FormData(),
this.formSerializer
@@ -12343,6 +12365,9 @@ const defaults = {
const transitional2 = this.transitional || defaults.transitional;
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
const JSONRequested = this.responseType === "json";
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
+ return data;
+ }
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
const strictJSONParsing = !silentJSONParsing && JSONRequested;
@@ -12351,7 +12376,7 @@ const defaults = {
} catch (e) {
if (strictJSONParsing) {
if (e.name === "SyntaxError") {
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
}
throw e;
}
@@ -12385,7 +12410,6 @@ const defaults = {
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
defaults.headers[method] = {};
});
-const defaults$1 = defaults;
const ignoreDuplicateOf = utils$1.toObjectSet([
"age",
"authorization",
@@ -12456,8 +12480,7 @@ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
if (isHeaderNameFilter) {
value = header;
}
- if (!utils$1.isString(value))
- return;
+ if (!utils$1.isString(value)) return;
if (utils$1.isString(filter2)) {
return value.indexOf(filter2) !== -1;
}
@@ -12481,7 +12504,7 @@ function buildAccessors(obj, header) {
});
});
}
-class AxiosHeaders {
+let AxiosHeaders$1 = class AxiosHeaders {
constructor(headers) {
headers && this.set(headers);
}
@@ -12502,6 +12525,10 @@ class AxiosHeaders {
setHeaders(header, valueOrRewrite);
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
setHeaders(parseHeaders(header), valueOrRewrite);
+ } else if (utils$1.isHeaders(header)) {
+ for (const [key, value] of header.entries()) {
+ setHeader(value, key, rewrite);
+ }
} else {
header != null && setHeader(valueOrRewrite, header, rewrite);
}
@@ -12632,9 +12659,9 @@ class AxiosHeaders {
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
return this;
}
-}
-AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
-utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
+};
+AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
+utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
let mapped = key[0].toUpperCase() + key.slice(1);
return {
get: () => value,
@@ -12643,10 +12670,9 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
}
};
});
-utils$1.freezeMethods(AxiosHeaders);
-const AxiosHeaders$1 = AxiosHeaders;
+utils$1.freezeMethods(AxiosHeaders$1);
function transformData(fns, response) {
- const config = this || defaults$1;
+ const config = this || defaults;
const context = response || config;
const headers = AxiosHeaders$1.from(context.headers);
let data = context.data;
@@ -12656,14 +12682,14 @@ function transformData(fns, response) {
headers.normalize();
return data;
}
-function isCancel(value) {
+function isCancel$1(value) {
return !!(value && value.__CANCEL__);
}
-function CanceledError(message, config, request) {
- AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
+function CanceledError$1(message, config, request) {
+ AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
this.name = "CanceledError";
}
-utils$1.inherits(CanceledError, AxiosError, {
+utils$1.inherits(CanceledError$1, AxiosError$1, {
__CANCEL__: true
});
function settle(resolve, reject, response) {
@@ -12671,9 +12697,9 @@ function settle(resolve, reject, response) {
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
resolve(response);
} else {
- reject(new AxiosError(
+ reject(new AxiosError$1(
"Request failed with status code " + response.status,
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
response.config,
response.request,
response
@@ -12692,6 +12718,7 @@ function buildFullPath(baseURL, requestedURL) {
}
return requestedURL;
}
+var proxyFromEnv = {};
var parseUrl$1 = require$$0$1.parse;
var DEFAULT_PORTS = {
ftp: 21,
@@ -12754,15 +12781,14 @@ function shouldProxy(hostname, port) {
function getEnv(key) {
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
}
-var getProxyForUrl_1 = getProxyForUrl;
+proxyFromEnv.getProxyForUrl = getProxyForUrl;
var followRedirects$1 = { exports: {} };
var src = { exports: {} };
var browser = { exports: {} };
var ms;
var hasRequiredMs;
function requireMs() {
- if (hasRequiredMs)
- return ms;
+ if (hasRequiredMs) return ms;
hasRequiredMs = 1;
var s = 1e3;
var m = s * 60;
@@ -12879,8 +12905,7 @@ function requireMs() {
var common;
var hasRequiredCommon;
function requireCommon() {
- if (hasRequiredCommon)
- return common;
+ if (hasRequiredCommon) return common;
hasRequiredCommon = 1;
function setup(env) {
createDebug.debug = createDebug;
@@ -12982,50 +13007,64 @@ function requireCommon() {
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
- let i;
- const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
- const len = split.length;
- for (i = 0; i < len; i++) {
- if (!split[i]) {
- continue;
- }
- namespaces = split[i].replace(/\*/g, ".*?");
- if (namespaces[0] === "-") {
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
+ for (const ns of split) {
+ if (ns[0] === "-") {
+ createDebug.skips.push(ns.slice(1));
} else {
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
+ createDebug.names.push(ns);
}
}
}
+ function matchesTemplate(search, template) {
+ let searchIndex = 0;
+ let templateIndex = 0;
+ let starIndex = -1;
+ let matchIndex = 0;
+ while (searchIndex < search.length) {
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
+ if (template[templateIndex] === "*") {
+ starIndex = templateIndex;
+ matchIndex = searchIndex;
+ templateIndex++;
+ } else {
+ searchIndex++;
+ templateIndex++;
+ }
+ } else if (starIndex !== -1) {
+ templateIndex = starIndex + 1;
+ matchIndex++;
+ searchIndex = matchIndex;
+ } else {
+ return false;
+ }
+ }
+ while (templateIndex < template.length && template[templateIndex] === "*") {
+ templateIndex++;
+ }
+ return templateIndex === template.length;
+ }
function disable() {
const namespaces = [
- ...createDebug.names.map(toNamespace),
- ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
+ ...createDebug.names,
+ ...createDebug.skips.map((namespace) => "-" + namespace)
].join(",");
createDebug.enable("");
return namespaces;
}
function enabled(name) {
- if (name[name.length - 1] === "*") {
- return true;
- }
- let i;
- let len;
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
- if (createDebug.skips[i].test(name)) {
+ for (const skip of createDebug.skips) {
+ if (matchesTemplate(name, skip)) {
return false;
}
}
- for (i = 0, len = createDebug.names.length; i < len; i++) {
- if (createDebug.names[i].test(name)) {
+ for (const ns of createDebug.names) {
+ if (matchesTemplate(name, ns)) {
return true;
}
}
return false;
}
- function toNamespace(regexp) {
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
- }
function coerce(val) {
if (val instanceof Error) {
return val.stack || val.message;
@@ -13043,8 +13082,7 @@ function requireCommon() {
}
var hasRequiredBrowser;
function requireBrowser() {
- if (hasRequiredBrowser)
- return browser.exports;
+ if (hasRequiredBrowser) return browser.exports;
hasRequiredBrowser = 1;
(function(module, exports) {
exports.formatArgs = formatArgs;
@@ -13146,10 +13184,11 @@ function requireBrowser() {
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
+ let m;
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
function formatArgs(args) {
@@ -13217,8 +13256,7 @@ var node = { exports: {} };
var hasFlag;
var hasRequiredHasFlag;
function requireHasFlag() {
- if (hasRequiredHasFlag)
- return hasFlag;
+ if (hasRequiredHasFlag) return hasFlag;
hasRequiredHasFlag = 1;
hasFlag = (flag, argv = process.argv) => {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -13231,8 +13269,7 @@ function requireHasFlag() {
var supportsColor_1;
var hasRequiredSupportsColor;
function requireSupportsColor() {
- if (hasRequiredSupportsColor)
- return supportsColor_1;
+ if (hasRequiredSupportsColor) return supportsColor_1;
hasRequiredSupportsColor = 1;
const os$1 = os;
const tty = require$$1$1;
@@ -13333,8 +13370,7 @@ function requireSupportsColor() {
}
var hasRequiredNode;
function requireNode() {
- if (hasRequiredNode)
- return node.exports;
+ if (hasRequiredNode) return node.exports;
hasRequiredNode = 1;
(function(module, exports) {
const tty = require$$1$1;
@@ -13476,7 +13512,7 @@ function requireNode() {
return (/* @__PURE__ */ new Date()).toISOString() + " ";
}
function log(...args) {
- return process.stderr.write(util2.format(...args) + "\n");
+ return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
}
function save(namespaces) {
if (namespaces) {
@@ -13510,8 +13546,7 @@ function requireNode() {
}
var hasRequiredSrc;
function requireSrc() {
- if (hasRequiredSrc)
- return src.exports;
+ if (hasRequiredSrc) return src.exports;
hasRequiredSrc = 1;
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
src.exports = requireBrowser();
@@ -13541,9 +13576,17 @@ var https = require$$4;
var Writable = stream.Writable;
var assert = require$$4$1;
var debug = debug_1;
+(function detectUnsupportedEnvironment() {
+ var looksLikeNode = typeof process !== "undefined";
+ var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined";
+ var looksLikeV8 = isFunction(Error.captureStackTrace);
+ if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) {
+ console.warn("The follow-redirects package should be excluded from browser builds.");
+ }
+})();
var useNativeURL = false;
try {
- assert(new URL$1());
+ assert(new URL$1(""));
} catch (error) {
useNativeURL = error.code === "ERR_INVALID_URL";
}
@@ -13970,7 +14013,9 @@ function removeMatchingHeaders(regex, headers) {
}
function createErrorType(code, message, baseClass) {
function CustomError(properties) {
- Error.captureStackTrace(this, this.constructor);
+ if (isFunction(Error.captureStackTrace)) {
+ Error.captureStackTrace(this, this.constructor);
+ }
Object.assign(this, properties || {});
this.code = code;
this.message = this.cause ? message + ": " + this.cause.message : message;
@@ -14016,7 +14061,7 @@ followRedirects$1.exports = wrap({ http, https });
followRedirects$1.exports.wrap = wrap;
var followRedirectsExports = followRedirects$1.exports;
const followRedirects = /* @__PURE__ */ getDefaultExportFromCjs(followRedirectsExports);
-const VERSION = "1.6.8";
+const VERSION$1 = "1.7.9";
function parseProtocol(url2) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
return match && match[1] || "";
@@ -14032,7 +14077,7 @@ function fromDataURI(uri, asBlob, options) {
uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
const match = DATA_URL_PATTERN.exec(uri);
if (!match) {
- throw new AxiosError("Invalid URL", AxiosError.ERR_INVALID_URL);
+ throw new AxiosError$1("Invalid URL", AxiosError$1.ERR_INVALID_URL);
}
const mime2 = match[1];
const isBase64 = match[2];
@@ -14040,69 +14085,13 @@ function fromDataURI(uri, asBlob, options) {
const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
if (asBlob) {
if (!_Blob) {
- throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT);
+ throw new AxiosError$1("Blob is not supported", AxiosError$1.ERR_NOT_SUPPORT);
}
return new _Blob([buffer], { type: mime2 });
}
return buffer;
}
- throw new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_NOT_SUPPORT);
-}
-function throttle(fn, freq) {
- let timestamp = 0;
- const threshold = 1e3 / freq;
- let timer = null;
- return function throttled(force, args) {
- const now = Date.now();
- if (force || now - timestamp > threshold) {
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- timestamp = now;
- return fn.apply(null, args);
- }
- if (!timer) {
- timer = setTimeout(() => {
- timer = null;
- timestamp = Date.now();
- return fn.apply(null, args);
- }, threshold - (now - timestamp));
- }
- };
-}
-function speedometer(samplesCount, min) {
- samplesCount = samplesCount || 10;
- const bytes = new Array(samplesCount);
- const timestamps = new Array(samplesCount);
- let head = 0;
- let tail = 0;
- let firstSampleTS;
- min = min !== void 0 ? min : 1e3;
- return function push(chunkLength) {
- const now = Date.now();
- const startedAt = timestamps[tail];
- if (!firstSampleTS) {
- firstSampleTS = now;
- }
- bytes[head] = chunkLength;
- timestamps[head] = now;
- let i = tail;
- let bytesCount = 0;
- while (i !== head) {
- bytesCount += bytes[i++];
- i = i % samplesCount;
- }
- head = (head + 1) % samplesCount;
- if (head === tail) {
- tail = (tail + 1) % samplesCount;
- }
- if (now - firstSampleTS < min) {
- return;
- }
- const passed = startedAt && now - startedAt;
- return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
- };
+ throw new AxiosError$1("Unsupported protocol " + protocol, AxiosError$1.ERR_NOT_SUPPORT);
}
const kInternals = Symbol("internals");
class AxiosTransformStream extends stream.Transform {
@@ -14120,11 +14109,8 @@ class AxiosTransformStream extends stream.Transform {
super({
readableHighWaterMark: options.chunkSize
});
- const self2 = this;
const internals = this[kInternals] = {
- length: options.length,
timeWindow: options.timeWindow,
- ticksRate: options.ticksRate,
chunkSize: options.chunkSize,
maxRate: options.maxRate,
minChunkSize: options.minChunkSize,
@@ -14135,7 +14121,6 @@ class AxiosTransformStream extends stream.Transform {
bytes: 0,
onReadCallback: null
};
- const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
this.on("newListener", (event) => {
if (event === "progress") {
if (!internals.isCaptured) {
@@ -14143,31 +14128,6 @@ class AxiosTransformStream extends stream.Transform {
}
}
});
- let bytesNotified = 0;
- internals.updateProgress = throttle(function throttledHandler() {
- const totalBytes = internals.length;
- const bytesTransferred = internals.bytesSeen;
- const progressBytes = bytesTransferred - bytesNotified;
- if (!progressBytes || self2.destroyed)
- return;
- const rate = _speedometer(progressBytes);
- bytesNotified = bytesTransferred;
- process.nextTick(() => {
- self2.emit("progress", {
- "loaded": bytesTransferred,
- "total": totalBytes,
- "progress": totalBytes ? bytesTransferred / totalBytes : void 0,
- "bytes": progressBytes,
- "rate": rate ? rate : void 0,
- "estimated": rate && totalBytes && bytesTransferred <= totalBytes ? (totalBytes - bytesTransferred) / rate : void 0
- });
- });
- }, internals.ticksRate);
- const onFinish = () => {
- internals.updateProgress(true);
- };
- this.once("end", onFinish);
- this.once("error", onFinish);
}
_read(size) {
const internals = this[kInternals];
@@ -14177,7 +14137,6 @@ class AxiosTransformStream extends stream.Transform {
return super._read(size);
}
_transform(chunk, encoding, callback) {
- const self2 = this;
const internals = this[kInternals];
const maxRate = internals.maxRate;
const readableHighWaterMark = this.readableHighWaterMark;
@@ -14185,14 +14144,12 @@ class AxiosTransformStream extends stream.Transform {
const divider = 1e3 / timeWindow;
const bytesThreshold = maxRate / divider;
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
- function pushChunk(_chunk, _callback) {
+ const pushChunk = (_chunk, _callback) => {
const bytes = Buffer.byteLength(_chunk);
internals.bytesSeen += bytes;
internals.bytes += bytes;
- if (internals.isCaptured) {
- internals.updateProgress();
- }
- if (self2.push(_chunk)) {
+ internals.isCaptured && this.emit("progress", internals.bytesSeen);
+ if (this.push(_chunk)) {
process.nextTick(_callback);
} else {
internals.onReadCallback = () => {
@@ -14200,7 +14157,7 @@ class AxiosTransformStream extends stream.Transform {
process.nextTick(_callback);
};
}
- }
+ };
const transformChunk = (_chunk, _callback) => {
const chunkSize = Buffer.byteLength(_chunk);
let chunkRemainder = null;
@@ -14246,12 +14203,7 @@ class AxiosTransformStream extends stream.Transform {
}
});
}
- setLength(length) {
- this[kInternals].length = +length;
- return this;
- }
}
-const AxiosTransformStream$1 = AxiosTransformStream;
const { asyncIterator } = Symbol;
const readBlob = async function* (blob) {
if (blob.stream) {
@@ -14265,7 +14217,7 @@ const readBlob = async function* (blob) {
}
};
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + "-_";
-const textEncoder = new require$$1.TextEncoder();
+const textEncoder = typeof TextEncoder === "function" ? new TextEncoder() : new require$$1.TextEncoder();
const CRLF = "\r\n";
const CRLF_BYTES = textEncoder.encode(CRLF);
const CRLF_BYTES_COUNT = 2;
@@ -14370,6 +14322,104 @@ const callbackify = (fn, reducer) => {
}, cb);
} : fn;
};
+function speedometer(samplesCount, min) {
+ samplesCount = samplesCount || 10;
+ const bytes = new Array(samplesCount);
+ const timestamps = new Array(samplesCount);
+ let head = 0;
+ let tail = 0;
+ let firstSampleTS;
+ min = min !== void 0 ? min : 1e3;
+ return function push(chunkLength) {
+ const now = Date.now();
+ const startedAt = timestamps[tail];
+ if (!firstSampleTS) {
+ firstSampleTS = now;
+ }
+ bytes[head] = chunkLength;
+ timestamps[head] = now;
+ let i = tail;
+ let bytesCount = 0;
+ while (i !== head) {
+ bytesCount += bytes[i++];
+ i = i % samplesCount;
+ }
+ head = (head + 1) % samplesCount;
+ if (head === tail) {
+ tail = (tail + 1) % samplesCount;
+ }
+ if (now - firstSampleTS < min) {
+ return;
+ }
+ const passed = startedAt && now - startedAt;
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
+ };
+}
+function throttle(fn, freq) {
+ let timestamp = 0;
+ let threshold = 1e3 / freq;
+ let lastArgs;
+ let timer;
+ const invoke = (args, now = Date.now()) => {
+ timestamp = now;
+ lastArgs = null;
+ if (timer) {
+ clearTimeout(timer);
+ timer = null;
+ }
+ fn.apply(null, args);
+ };
+ const throttled = (...args) => {
+ const now = Date.now();
+ const passed = now - timestamp;
+ if (passed >= threshold) {
+ invoke(args, now);
+ } else {
+ lastArgs = args;
+ if (!timer) {
+ timer = setTimeout(() => {
+ timer = null;
+ invoke(lastArgs);
+ }, threshold - passed);
+ }
+ }
+ };
+ const flush = () => lastArgs && invoke(lastArgs);
+ return [throttled, flush];
+}
+const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
+ let bytesNotified = 0;
+ const _speedometer = speedometer(50, 250);
+ return throttle((e) => {
+ const loaded = e.loaded;
+ const total = e.lengthComputable ? e.total : void 0;
+ const progressBytes = loaded - bytesNotified;
+ const rate = _speedometer(progressBytes);
+ const inRange = loaded <= total;
+ bytesNotified = loaded;
+ const data = {
+ loaded,
+ total,
+ progress: total ? loaded / total : void 0,
+ bytes: progressBytes,
+ rate: rate ? rate : void 0,
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
+ event: e,
+ lengthComputable: total != null,
+ [isDownloadStream ? "download" : "upload"]: true
+ };
+ listener(data);
+ }, freq);
+};
+const progressEventDecorator = (total, throttled) => {
+ const lengthComputable = total != null;
+ return [(loaded) => throttled[0]({
+ lengthComputable,
+ total,
+ loaded
+ }), throttled[1]];
+};
+const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
const zlibOptions = {
flush: zlib.constants.Z_SYNC_FLUSH,
finishFlush: zlib.constants.Z_SYNC_FLUSH
@@ -14384,6 +14434,10 @@ const isHttps = /https:?/;
const supportedProtocols = platform.protocols.map((protocol) => {
return protocol + ":";
});
+const flushOnFinish = (stream2, [throttled, flush]) => {
+ stream2.on("end", flush).on("error", flush);
+ return throttled;
+};
function dispatchBeforeRedirect(options, responseDetails) {
if (options.beforeRedirects.proxy) {
options.beforeRedirects.proxy(options);
@@ -14395,7 +14449,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
function setProxy(options, configProxy, location) {
let proxy = configProxy;
if (!proxy && proxy !== false) {
- const proxyUrl = getProxyForUrl_1(location);
+ const proxyUrl = proxyFromEnv.getProxyForUrl(location);
if (proxyUrl) {
proxy = new URL(proxyUrl);
}
@@ -14431,8 +14485,7 @@ const wrapAsync = (asyncExecutor) => {
let onDone;
let isDone;
const done = (value, isRejected) => {
- if (isDone)
- return;
+ if (isDone) return;
isDone = true;
onDone && onDone(value, isRejected);
};
@@ -14495,7 +14548,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
}
});
function abort2(reason) {
- emitter.emit("abort", !reason || reason.type ? new CanceledError(null, config, req) : reason);
+ emitter.emit("abort", !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
}
emitter.once("abort", reject);
if (config.cancelToken || config.signal) {
@@ -14505,7 +14558,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
}
}
const fullPath = buildFullPath(config.baseURL, config.url);
- const parsed = new URL(fullPath, "http://localhost");
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : void 0);
const protocol = parsed.protocol || supportedProtocols[0];
if (protocol === "data:") {
let convertedData;
@@ -14522,7 +14575,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
Blob: config.env && config.env.Blob
});
} catch (err) {
- throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
+ throw AxiosError$1.from(err, AxiosError$1.ERR_BAD_REQUEST, config);
}
if (responseType === "text") {
convertedData = convertedData.toString(responseEncoding);
@@ -14541,16 +14594,15 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
});
}
if (supportedProtocols.indexOf(protocol) === -1) {
- return reject(new AxiosError(
+ return reject(new AxiosError$1(
"Unsupported protocol " + protocol,
- AxiosError.ERR_BAD_REQUEST,
+ AxiosError$1.ERR_BAD_REQUEST,
config
));
}
const headers = AxiosHeaders$1.from(config.headers).normalize();
- headers.set("User-Agent", "axios/" + VERSION, false);
- const onDownloadProgress = config.onDownloadProgress;
- const onUploadProgress = config.onUploadProgress;
+ headers.set("User-Agent", "axios/" + VERSION$1, false);
+ const { onUploadProgress, onDownloadProgress } = config;
const maxRate = config.maxRate;
let maxUploadRate = void 0;
let maxDownloadRate = void 0;
@@ -14559,7 +14611,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
data = formDataToStream(data, (formHeaders) => {
headers.set(formHeaders);
}, {
- tag: `axios-${VERSION}-boundary`,
+ tag: `axios-${VERSION$1}-boundary`,
boundary: userBoundary && userBoundary[1] || void 0
});
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
@@ -14571,29 +14623,28 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
} catch (e) {
}
}
- } else if (utils$1.isBlob(data)) {
+ } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
data.size && headers.setContentType(data.type || "application/octet-stream");
headers.setContentLength(data.size || 0);
data = stream.Readable.from(readBlob(data));
} else if (data && !utils$1.isStream(data)) {
- if (Buffer.isBuffer(data))
- ;
+ if (Buffer.isBuffer(data)) ;
else if (utils$1.isArrayBuffer(data)) {
data = Buffer.from(new Uint8Array(data));
} else if (utils$1.isString(data)) {
data = Buffer.from(data, "utf-8");
} else {
- return reject(new AxiosError(
+ return reject(new AxiosError$1(
"Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
- AxiosError.ERR_BAD_REQUEST,
+ AxiosError$1.ERR_BAD_REQUEST,
config
));
}
headers.setContentLength(data.length, false);
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
- return reject(new AxiosError(
+ return reject(new AxiosError$1(
"Request body larger than maxBodyLength limit",
- AxiosError.ERR_BAD_REQUEST,
+ AxiosError$1.ERR_BAD_REQUEST,
config
));
}
@@ -14609,15 +14660,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
if (!utils$1.isStream(data)) {
data = stream.Readable.from(data, { objectMode: false });
}
- data = stream.pipeline([data, new AxiosTransformStream$1({
- length: contentLength,
+ data = stream.pipeline([data, new AxiosTransformStream({
maxRate: utils$1.toFiniteNumber(maxUploadRate)
})], utils$1.noop);
- onUploadProgress && data.on("progress", (progress) => {
- onUploadProgress(Object.assign(progress, {
- upload: true
- }));
- });
+ onUploadProgress && data.on("progress", flushOnFinish(
+ data,
+ progressEventDecorator(
+ contentLength,
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
+ )
+ ));
}
let auth = void 0;
if (config.auth) {
@@ -14665,7 +14717,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
if (config.socketPath) {
options.socketPath = config.socketPath;
} else {
- options.hostname = parsed.hostname;
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
options.port = parsed.port;
setProxy(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
}
@@ -14694,20 +14746,20 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
options.insecureHTTPParser = config.insecureHTTPParser;
}
req = transport.request(options, function handleResponse(res) {
- if (req.destroyed)
- return;
+ if (req.destroyed) return;
const streams = [res];
const responseLength = +res.headers["content-length"];
- if (onDownloadProgress) {
- const transformStream = new AxiosTransformStream$1({
- length: utils$1.toFiniteNumber(responseLength),
+ if (onDownloadProgress || maxDownloadRate) {
+ const transformStream = new AxiosTransformStream({
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
});
- onDownloadProgress && transformStream.on("progress", (progress) => {
- onDownloadProgress(Object.assign(progress, {
- download: true
- }));
- });
+ onDownloadProgress && transformStream.on("progress", flushOnFinish(
+ transformStream,
+ progressEventDecorator(
+ responseLength,
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
+ )
+ ));
streams.push(transformStream);
}
let responseStream = res;
@@ -14760,9 +14812,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
rejected = true;
responseStream.destroy();
- reject(new AxiosError(
+ reject(new AxiosError$1(
"maxContentLength size of " + config.maxContentLength + " exceeded",
- AxiosError.ERR_BAD_RESPONSE,
+ AxiosError$1.ERR_BAD_RESPONSE,
config,
lastRequest
));
@@ -14772,9 +14824,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
if (rejected) {
return;
}
- const err = new AxiosError(
- "maxContentLength size of " + config.maxContentLength + " exceeded",
- AxiosError.ERR_BAD_RESPONSE,
+ const err = new AxiosError$1(
+ "stream has been aborted",
+ AxiosError$1.ERR_BAD_RESPONSE,
config,
lastRequest
);
@@ -14782,9 +14834,8 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
reject(err);
});
responseStream.on("error", function handleStreamError(err) {
- if (req.destroyed)
- return;
- reject(AxiosError.from(err, null, config, lastRequest));
+ if (req.destroyed) return;
+ reject(AxiosError$1.from(err, null, config, lastRequest));
});
responseStream.on("end", function handleStreamEnd() {
try {
@@ -14797,7 +14848,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
}
response.data = responseData;
} catch (err) {
- return reject(AxiosError.from(err, null, config, response.request, response));
+ return reject(AxiosError$1.from(err, null, config, response.request, response));
}
settle(resolve, reject, response);
});
@@ -14814,7 +14865,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
req.destroy(err);
});
req.on("error", function handleRequestError(err) {
- reject(AxiosError.from(err, null, config, req));
+ reject(AxiosError$1.from(err, null, config, req));
});
req.on("socket", function handleRequestSocket(socket) {
socket.setKeepAlive(true, 1e3 * 60);
@@ -14822,25 +14873,24 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
if (config.timeout) {
const timeout = parseInt(config.timeout, 10);
if (Number.isNaN(timeout)) {
- reject(new AxiosError(
+ reject(new AxiosError$1(
"error trying to parse `config.timeout` to int",
- AxiosError.ERR_BAD_OPTION_VALUE,
+ AxiosError$1.ERR_BAD_OPTION_VALUE,
config,
req
));
return;
}
req.setTimeout(timeout, function handleRequestTimeout() {
- if (isDone)
- return;
+ if (isDone) return;
let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
const transitional2 = config.transitional || transitionalDefaults;
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}
- reject(new AxiosError(
+ reject(new AxiosError$1(
timeoutErrorMessage,
- transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
config,
req
));
@@ -14859,7 +14909,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
});
data.on("close", () => {
if (!ended && !errored) {
- abort2(new CanceledError("Request stream has been aborted", config, req));
+ abort2(new CanceledError$1("Request stream has been aborted", config, req));
}
});
data.pipe(req);
@@ -14868,6 +14918,13 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
}
});
};
+const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
+ url2 = new URL(url2, platform.origin);
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
+})(
+ new URL(platform.origin),
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
+) : () => true;
const cookies = platform.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
@@ -14899,312 +14956,11 @@ const cookies = platform.hasStandardBrowserEnv ? (
}
}
);
-const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
- // Standard browser envs have full support of the APIs needed to test
- // whether the request URL is of the same origin as current location.
- function standardBrowserEnv() {
- const msie = /(msie|trident)/i.test(navigator.userAgent);
- const urlParsingNode = document.createElement("a");
- let originURL;
- function resolveURL(url2) {
- let href = url2;
- if (msie) {
- urlParsingNode.setAttribute("href", href);
- href = urlParsingNode.href;
- }
- urlParsingNode.setAttribute("href", href);
- return {
- href: urlParsingNode.href,
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
- host: urlParsingNode.host,
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
- hostname: urlParsingNode.hostname,
- port: urlParsingNode.port,
- pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
- };
- }
- originURL = resolveURL(window.location.href);
- return function isURLSameOrigin2(requestURL) {
- const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
- return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
- };
- }()
-) : (
- // Non standard browser envs (web workers, react-native) lack needed support.
- /* @__PURE__ */ function nonStandardBrowserEnv() {
- return function isURLSameOrigin2() {
- return true;
- };
- }()
-);
-function progressEventReducer(listener, isDownloadStream) {
- let bytesNotified = 0;
- const _speedometer = speedometer(50, 250);
- return (e) => {
- const loaded = e.loaded;
- const total = e.lengthComputable ? e.total : void 0;
- const progressBytes = loaded - bytesNotified;
- const rate = _speedometer(progressBytes);
- const inRange = loaded <= total;
- bytesNotified = loaded;
- const data = {
- loaded,
- total,
- progress: total ? loaded / total : void 0,
- bytes: progressBytes,
- rate: rate ? rate : void 0,
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
- event: e
- };
- data[isDownloadStream ? "download" : "upload"] = true;
- listener(data);
- };
-}
-const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
-const xhrAdapter = isXHRAdapterSupported && function(config) {
- return new Promise(function dispatchXhrRequest(resolve, reject) {
- let requestData = config.data;
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
- let { responseType, withXSRFToken } = config;
- let onCanceled;
- function done() {
- if (config.cancelToken) {
- config.cancelToken.unsubscribe(onCanceled);
- }
- if (config.signal) {
- config.signal.removeEventListener("abort", onCanceled);
- }
- }
- let contentType;
- if (utils$1.isFormData(requestData)) {
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
- requestHeaders.setContentType(false);
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
- const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
- requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; "));
- }
- }
- let request = new XMLHttpRequest();
- if (config.auth) {
- const username = config.auth.username || "";
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
- requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
- }
- const fullPath = buildFullPath(config.baseURL, config.url);
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
- request.timeout = config.timeout;
- function onloadend() {
- if (!request) {
- return;
- }
- const responseHeaders = AxiosHeaders$1.from(
- "getAllResponseHeaders" in request && request.getAllResponseHeaders()
- );
- const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
- const response = {
- data: responseData,
- status: request.status,
- statusText: request.statusText,
- headers: responseHeaders,
- config,
- request
- };
- settle(function _resolve(value) {
- resolve(value);
- done();
- }, function _reject(err) {
- reject(err);
- done();
- }, response);
- request = null;
- }
- if ("onloadend" in request) {
- request.onloadend = onloadend;
- } else {
- request.onreadystatechange = function handleLoad() {
- if (!request || request.readyState !== 4) {
- return;
- }
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
- return;
- }
- setTimeout(onloadend);
- };
- }
- request.onabort = function handleAbort() {
- if (!request) {
- return;
- }
- reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
- request = null;
- };
- request.onerror = function handleError() {
- reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request));
- request = null;
- };
- request.ontimeout = function handleTimeout() {
- let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
- const transitional2 = config.transitional || transitionalDefaults;
- if (config.timeoutErrorMessage) {
- timeoutErrorMessage = config.timeoutErrorMessage;
- }
- reject(new AxiosError(
- timeoutErrorMessage,
- transitional2.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
- config,
- request
- ));
- request = null;
- };
- if (platform.hasStandardBrowserEnv) {
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
- if (xsrfValue) {
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
- }
- }
- }
- requestData === void 0 && requestHeaders.setContentType(null);
- if ("setRequestHeader" in request) {
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
- request.setRequestHeader(key, val);
- });
- }
- if (!utils$1.isUndefined(config.withCredentials)) {
- request.withCredentials = !!config.withCredentials;
- }
- if (responseType && responseType !== "json") {
- request.responseType = config.responseType;
- }
- if (typeof config.onDownloadProgress === "function") {
- request.addEventListener("progress", progressEventReducer(config.onDownloadProgress, true));
- }
- if (typeof config.onUploadProgress === "function" && request.upload) {
- request.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress));
- }
- if (config.cancelToken || config.signal) {
- onCanceled = (cancel) => {
- if (!request) {
- return;
- }
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
- request.abort();
- request = null;
- };
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
- if (config.signal) {
- config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
- }
- }
- const protocol = parseProtocol(fullPath);
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
- reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
- return;
- }
- request.send(requestData || null);
- });
-};
-const knownAdapters = {
- http: httpAdapter,
- xhr: xhrAdapter
-};
-utils$1.forEach(knownAdapters, (fn, value) => {
- if (fn) {
- try {
- Object.defineProperty(fn, "name", { value });
- } catch (e) {
- }
- Object.defineProperty(fn, "adapterName", { value });
- }
-});
-const renderReason = (reason) => `- ${reason}`;
-const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
-const adapters = {
- getAdapter: (adapters2) => {
- adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
- const { length } = adapters2;
- let nameOrAdapter;
- let adapter;
- const rejectedReasons = {};
- for (let i = 0; i < length; i++) {
- nameOrAdapter = adapters2[i];
- let id;
- adapter = nameOrAdapter;
- if (!isResolvedHandle(nameOrAdapter)) {
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
- if (adapter === void 0) {
- throw new AxiosError(`Unknown adapter '${id}'`);
- }
- }
- if (adapter) {
- break;
- }
- rejectedReasons[id || "#" + i] = adapter;
- }
- if (!adapter) {
- const reasons = Object.entries(rejectedReasons).map(
- ([id, state2]) => `adapter ${id} ` + (state2 === false ? "is not supported by the environment" : "is not available in the build")
- );
- let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
- throw new AxiosError(
- `There is no suitable adapter to dispatch the request ` + s,
- "ERR_NOT_SUPPORT"
- );
- }
- return adapter;
- },
- adapters: knownAdapters
-};
-function throwIfCancellationRequested(config) {
- if (config.cancelToken) {
- config.cancelToken.throwIfRequested();
- }
- if (config.signal && config.signal.aborted) {
- throw new CanceledError(null, config);
- }
-}
-function dispatchRequest(config) {
- throwIfCancellationRequested(config);
- config.headers = AxiosHeaders$1.from(config.headers);
- config.data = transformData.call(
- config,
- config.transformRequest
- );
- if (["post", "put", "patch"].indexOf(config.method) !== -1) {
- config.headers.setContentType("application/x-www-form-urlencoded", false);
- }
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
- return adapter(config).then(function onAdapterResolution(response) {
- throwIfCancellationRequested(config);
- response.data = transformData.call(
- config,
- config.transformResponse,
- response
- );
- response.headers = AxiosHeaders$1.from(response.headers);
- return response;
- }, function onAdapterRejection(reason) {
- if (!isCancel(reason)) {
- throwIfCancellationRequested(config);
- if (reason && reason.response) {
- reason.response.data = transformData.call(
- config,
- config.transformResponse,
- reason.response
- );
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
- }
- }
- return Promise.reject(reason);
- });
-}
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
-function mergeConfig(config1, config2) {
+function mergeConfig$1(config1, config2) {
config2 = config2 || {};
const config = {};
- function getMergedValue(target, source, caseless) {
+ function getMergedValue(target, source, prop, caseless) {
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
return utils$1.merge.call({ caseless }, target, source);
} else if (utils$1.isPlainObject(source)) {
@@ -15214,11 +14970,11 @@ function mergeConfig(config1, config2) {
}
return source;
}
- function mergeDeepProperties(a, b, caseless) {
+ function mergeDeepProperties(a, b, prop, caseless) {
if (!utils$1.isUndefined(b)) {
- return getMergedValue(a, b, caseless);
+ return getMergedValue(a, b, prop, caseless);
} else if (!utils$1.isUndefined(a)) {
- return getMergedValue(void 0, a, caseless);
+ return getMergedValue(void 0, a, prop, caseless);
}
}
function valueFromConfig2(a, b) {
@@ -15269,7 +15025,7 @@ function mergeConfig(config1, config2) {
socketPath: defaultToConfig2,
responseEncoding: defaultToConfig2,
validateStatus: mergeDirectKeys,
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
};
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
const merge2 = mergeMap[prop] || mergeDeepProperties;
@@ -15278,6 +15034,527 @@ function mergeConfig(config1, config2) {
});
return config;
}
+const resolveConfig = (config) => {
+ const newConfig = mergeConfig$1({}, config);
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
+ if (auth) {
+ headers.set(
+ "Authorization",
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
+ );
+ }
+ let contentType;
+ if (utils$1.isFormData(data)) {
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
+ headers.setContentType(void 0);
+ } else if ((contentType = headers.getContentType()) !== false) {
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
+ }
+ }
+ if (platform.hasStandardBrowserEnv) {
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
+ if (xsrfValue) {
+ headers.set(xsrfHeaderName, xsrfValue);
+ }
+ }
+ }
+ return newConfig;
+};
+const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
+const xhrAdapter = isXHRAdapterSupported && function(config) {
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
+ const _config = resolveConfig(config);
+ let requestData = _config.data;
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
+ let onCanceled;
+ let uploadThrottled, downloadThrottled;
+ let flushUpload, flushDownload;
+ function done() {
+ flushUpload && flushUpload();
+ flushDownload && flushDownload();
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
+ }
+ let request = new XMLHttpRequest();
+ request.open(_config.method.toUpperCase(), _config.url, true);
+ request.timeout = _config.timeout;
+ function onloadend() {
+ if (!request) {
+ return;
+ }
+ const responseHeaders = AxiosHeaders$1.from(
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
+ );
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
+ const response = {
+ data: responseData,
+ status: request.status,
+ statusText: request.statusText,
+ headers: responseHeaders,
+ config,
+ request
+ };
+ settle(function _resolve(value) {
+ resolve(value);
+ done();
+ }, function _reject(err) {
+ reject(err);
+ done();
+ }, response);
+ request = null;
+ }
+ if ("onloadend" in request) {
+ request.onloadend = onloadend;
+ } else {
+ request.onreadystatechange = function handleLoad() {
+ if (!request || request.readyState !== 4) {
+ return;
+ }
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
+ return;
+ }
+ setTimeout(onloadend);
+ };
+ }
+ request.onabort = function handleAbort() {
+ if (!request) {
+ return;
+ }
+ reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
+ request = null;
+ };
+ request.onerror = function handleError() {
+ reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
+ request = null;
+ };
+ request.ontimeout = function handleTimeout() {
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
+ const transitional2 = _config.transitional || transitionalDefaults;
+ if (_config.timeoutErrorMessage) {
+ timeoutErrorMessage = _config.timeoutErrorMessage;
+ }
+ reject(new AxiosError$1(
+ timeoutErrorMessage,
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
+ config,
+ request
+ ));
+ request = null;
+ };
+ requestData === void 0 && requestHeaders.setContentType(null);
+ if ("setRequestHeader" in request) {
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
+ request.setRequestHeader(key, val);
+ });
+ }
+ if (!utils$1.isUndefined(_config.withCredentials)) {
+ request.withCredentials = !!_config.withCredentials;
+ }
+ if (responseType && responseType !== "json") {
+ request.responseType = _config.responseType;
+ }
+ if (onDownloadProgress) {
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
+ request.addEventListener("progress", downloadThrottled);
+ }
+ if (onUploadProgress && request.upload) {
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
+ request.upload.addEventListener("progress", uploadThrottled);
+ request.upload.addEventListener("loadend", flushUpload);
+ }
+ if (_config.cancelToken || _config.signal) {
+ onCanceled = (cancel) => {
+ if (!request) {
+ return;
+ }
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
+ request.abort();
+ request = null;
+ };
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
+ if (_config.signal) {
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
+ }
+ }
+ const protocol = parseProtocol(_config.url);
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
+ reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
+ return;
+ }
+ request.send(requestData || null);
+ });
+};
+const composeSignals = (signals, timeout) => {
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
+ if (timeout || length) {
+ let controller = new AbortController();
+ let aborted;
+ const onabort = function(reason) {
+ if (!aborted) {
+ aborted = true;
+ unsubscribe();
+ const err = reason instanceof Error ? reason : this.reason;
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
+ }
+ };
+ let timer = timeout && setTimeout(() => {
+ timer = null;
+ onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
+ }, timeout);
+ const unsubscribe = () => {
+ if (signals) {
+ timer && clearTimeout(timer);
+ timer = null;
+ signals.forEach((signal2) => {
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
+ });
+ signals = null;
+ }
+ };
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
+ const { signal } = controller;
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
+ return signal;
+ }
+};
+const streamChunk = function* (chunk, chunkSize) {
+ let len = chunk.byteLength;
+ if (len < chunkSize) {
+ yield chunk;
+ return;
+ }
+ let pos = 0;
+ let end;
+ while (pos < len) {
+ end = pos + chunkSize;
+ yield chunk.slice(pos, end);
+ pos = end;
+ }
+};
+const readBytes = async function* (iterable, chunkSize) {
+ for await (const chunk of readStream(iterable)) {
+ yield* streamChunk(chunk, chunkSize);
+ }
+};
+const readStream = async function* (stream2) {
+ if (stream2[Symbol.asyncIterator]) {
+ yield* stream2;
+ return;
+ }
+ const reader = stream2.getReader();
+ try {
+ for (; ; ) {
+ const { done, value } = await reader.read();
+ if (done) {
+ break;
+ }
+ yield value;
+ }
+ } finally {
+ await reader.cancel();
+ }
+};
+const trackStream = (stream2, chunkSize, onProgress, onFinish) => {
+ const iterator = readBytes(stream2, chunkSize);
+ let bytes = 0;
+ let done;
+ let _onFinish = (e) => {
+ if (!done) {
+ done = true;
+ onFinish && onFinish(e);
+ }
+ };
+ return new ReadableStream({
+ async pull(controller) {
+ try {
+ const { done: done2, value } = await iterator.next();
+ if (done2) {
+ _onFinish();
+ controller.close();
+ return;
+ }
+ let len = value.byteLength;
+ if (onProgress) {
+ let loadedBytes = bytes += len;
+ onProgress(loadedBytes);
+ }
+ controller.enqueue(new Uint8Array(value));
+ } catch (err) {
+ _onFinish(err);
+ throw err;
+ }
+ },
+ cancel(reason) {
+ _onFinish(reason);
+ return iterator.return();
+ }
+ }, {
+ highWaterMark: 2
+ });
+};
+const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
+const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
+const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
+const test = (fn, ...args) => {
+ try {
+ return !!fn(...args);
+ } catch (e) {
+ return false;
+ }
+};
+const supportsRequestStream = isReadableStreamSupported && test(() => {
+ let duplexAccessed = false;
+ const hasContentType = new Request(platform.origin, {
+ body: new ReadableStream(),
+ method: "POST",
+ get duplex() {
+ duplexAccessed = true;
+ return "half";
+ }
+ }).headers.has("Content-Type");
+ return duplexAccessed && !hasContentType;
+});
+const DEFAULT_CHUNK_SIZE = 64 * 1024;
+const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
+const resolvers = {
+ stream: supportsResponseStream && ((res) => res.body)
+};
+isFetchSupported && ((res) => {
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
+ });
+ });
+})(new Response());
+const getBodyLength = async (body) => {
+ if (body == null) {
+ return 0;
+ }
+ if (utils$1.isBlob(body)) {
+ return body.size;
+ }
+ if (utils$1.isSpecCompliantForm(body)) {
+ const _request = new Request(platform.origin, {
+ method: "POST",
+ body
+ });
+ return (await _request.arrayBuffer()).byteLength;
+ }
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
+ return body.byteLength;
+ }
+ if (utils$1.isURLSearchParams(body)) {
+ body = body + "";
+ }
+ if (utils$1.isString(body)) {
+ return (await encodeText(body)).byteLength;
+ }
+};
+const resolveBodyLength = async (headers, body) => {
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
+ return length == null ? getBodyLength(body) : length;
+};
+const fetchAdapter = isFetchSupported && (async (config) => {
+ let {
+ url: url2,
+ method,
+ data,
+ signal,
+ cancelToken,
+ timeout,
+ onDownloadProgress,
+ onUploadProgress,
+ responseType,
+ headers,
+ withCredentials = "same-origin",
+ fetchOptions
+ } = resolveConfig(config);
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
+ let request;
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
+ composedSignal.unsubscribe();
+ });
+ let requestContentLength;
+ try {
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
+ let _request = new Request(url2, {
+ method: "POST",
+ body: data,
+ duplex: "half"
+ });
+ let contentTypeHeader;
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
+ headers.setContentType(contentTypeHeader);
+ }
+ if (_request.body) {
+ const [onProgress, flush] = progressEventDecorator(
+ requestContentLength,
+ progressEventReducer(asyncDecorator(onUploadProgress))
+ );
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
+ }
+ }
+ if (!utils$1.isString(withCredentials)) {
+ withCredentials = withCredentials ? "include" : "omit";
+ }
+ const isCredentialsSupported = "credentials" in Request.prototype;
+ request = new Request(url2, {
+ ...fetchOptions,
+ signal: composedSignal,
+ method: method.toUpperCase(),
+ headers: headers.normalize().toJSON(),
+ body: data,
+ duplex: "half",
+ credentials: isCredentialsSupported ? withCredentials : void 0
+ });
+ let response = await fetch(request);
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
+ const options = {};
+ ["status", "statusText", "headers"].forEach((prop) => {
+ options[prop] = response[prop];
+ });
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
+ responseContentLength,
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
+ ) || [];
+ response = new Response(
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
+ flush && flush();
+ unsubscribe && unsubscribe();
+ }),
+ options
+ );
+ }
+ responseType = responseType || "text";
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
+ !isStreamResponse && unsubscribe && unsubscribe();
+ return await new Promise((resolve, reject) => {
+ settle(resolve, reject, {
+ data: responseData,
+ headers: AxiosHeaders$1.from(response.headers),
+ status: response.status,
+ statusText: response.statusText,
+ config,
+ request
+ });
+ });
+ } catch (err) {
+ unsubscribe && unsubscribe();
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
+ throw Object.assign(
+ new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
+ {
+ cause: err.cause || err
+ }
+ );
+ }
+ throw AxiosError$1.from(err, err && err.code, config, request);
+ }
+});
+const knownAdapters = {
+ http: httpAdapter,
+ xhr: xhrAdapter,
+ fetch: fetchAdapter
+};
+utils$1.forEach(knownAdapters, (fn, value) => {
+ if (fn) {
+ try {
+ Object.defineProperty(fn, "name", { value });
+ } catch (e) {
+ }
+ Object.defineProperty(fn, "adapterName", { value });
+ }
+});
+const renderReason = (reason) => `- ${reason}`;
+const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
+const adapters = {
+ getAdapter: (adapters2) => {
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
+ const { length } = adapters2;
+ let nameOrAdapter;
+ let adapter;
+ const rejectedReasons = {};
+ for (let i = 0; i < length; i++) {
+ nameOrAdapter = adapters2[i];
+ let id;
+ adapter = nameOrAdapter;
+ if (!isResolvedHandle(nameOrAdapter)) {
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
+ if (adapter === void 0) {
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
+ }
+ }
+ if (adapter) {
+ break;
+ }
+ rejectedReasons[id || "#" + i] = adapter;
+ }
+ if (!adapter) {
+ const reasons = Object.entries(rejectedReasons).map(
+ ([id, state2]) => `adapter ${id} ` + (state2 === false ? "is not supported by the environment" : "is not available in the build")
+ );
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
+ throw new AxiosError$1(
+ `There is no suitable adapter to dispatch the request ` + s,
+ "ERR_NOT_SUPPORT"
+ );
+ }
+ return adapter;
+ },
+ adapters: knownAdapters
+};
+function throwIfCancellationRequested(config) {
+ if (config.cancelToken) {
+ config.cancelToken.throwIfRequested();
+ }
+ if (config.signal && config.signal.aborted) {
+ throw new CanceledError$1(null, config);
+ }
+}
+function dispatchRequest(config) {
+ throwIfCancellationRequested(config);
+ config.headers = AxiosHeaders$1.from(config.headers);
+ config.data = transformData.call(
+ config,
+ config.transformRequest
+ );
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
+ }
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
+ return adapter(config).then(function onAdapterResolution(response) {
+ throwIfCancellationRequested(config);
+ response.data = transformData.call(
+ config,
+ config.transformResponse,
+ response
+ );
+ response.headers = AxiosHeaders$1.from(response.headers);
+ return response;
+ }, function onAdapterRejection(reason) {
+ if (!isCancel$1(reason)) {
+ throwIfCancellationRequested(config);
+ if (reason && reason.response) {
+ reason.response.data = transformData.call(
+ config,
+ config.transformResponse,
+ reason.response
+ );
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
+ }
+ }
+ return Promise.reject(reason);
+ });
+}
const validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
validators$1[type] = function validator2(thing) {
@@ -15287,13 +15564,13 @@ const validators$1 = {};
const deprecatedWarnings = {};
validators$1.transitional = function transitional(validator2, version, message) {
function formatMessage(opt, desc) {
- return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
+ return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
}
return (value, opt, opts) => {
if (validator2 === false) {
- throw new AxiosError(
+ throw new AxiosError$1(
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
- AxiosError.ERR_DEPRECATED
+ AxiosError$1.ERR_DEPRECATED
);
}
if (version && !deprecatedWarnings[opt]) {
@@ -15308,9 +15585,15 @@ validators$1.transitional = function transitional(validator2, version, message)
return validator2 ? validator2(value, opt, opts) : true;
};
};
+validators$1.spelling = function spelling(correctSpelling) {
+ return (value, opt) => {
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
+ return true;
+ };
+};
function assertOptions(options, schema, allowUnknown) {
if (typeof options !== "object") {
- throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
+ throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
}
const keys = Object.keys(options);
let i = keys.length;
@@ -15321,12 +15604,12 @@ function assertOptions(options, schema, allowUnknown) {
const value = options[opt];
const result = value === void 0 || validator2(value, opt, options);
if (result !== true) {
- throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
+ throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
}
continue;
}
if (allowUnknown !== true) {
- throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
+ throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
}
}
}
@@ -15335,7 +15618,7 @@ const validator = {
validators: validators$1
};
const validators = validator.validators;
-class Axios {
+let Axios$1 = class Axios {
constructor(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
@@ -15356,13 +15639,16 @@ class Axios {
return await this._request(configOrUrl, config);
} catch (err) {
if (err instanceof Error) {
- let dummy;
- Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
+ let dummy = {};
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
- if (!err.stack) {
- err.stack = stack;
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
- err.stack += "\n" + stack;
+ try {
+ if (!err.stack) {
+ err.stack = stack;
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
+ err.stack += "\n" + stack;
+ }
+ } catch (e) {
}
}
throw err;
@@ -15375,7 +15661,7 @@ class Axios {
} else {
config = configOrUrl || {};
}
- config = mergeConfig(this.defaults, config);
+ config = mergeConfig$1(this.defaults, config);
const { transitional: transitional2, paramsSerializer, headers } = config;
if (transitional2 !== void 0) {
validator.assertOptions(transitional2, {
@@ -15396,6 +15682,10 @@ class Axios {
}, true);
}
}
+ validator.assertOptions(config, {
+ baseUrl: validators.spelling("baseURL"),
+ withXsrfToken: validators.spelling("withXSRFToken")
+ }, true);
config.method = (config.method || this.defaults.method || "get").toLowerCase();
let contextHeaders = headers && utils$1.merge(
headers.common,
@@ -15461,14 +15751,14 @@ class Axios {
return promise;
}
getUri(config) {
- config = mergeConfig(this.defaults, config);
+ config = mergeConfig$1(this.defaults, config);
const fullPath = buildFullPath(config.baseURL, config.url);
return buildURL(fullPath, config.params, config.paramsSerializer);
}
-}
+};
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
- Axios.prototype[method] = function(url2, config) {
- return this.request(mergeConfig(config || {}, {
+ Axios$1.prototype[method] = function(url2, config) {
+ return this.request(mergeConfig$1(config || {}, {
method,
url: url2,
data: (config || {}).data
@@ -15478,7 +15768,7 @@ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoDa
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
function generateHTTPMethod(isForm) {
return function httpMethod(url2, data, config) {
- return this.request(mergeConfig(config || {}, {
+ return this.request(mergeConfig$1(config || {}, {
method,
headers: isForm ? {
"Content-Type": "multipart/form-data"
@@ -15488,11 +15778,10 @@ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method)
}));
};
}
- Axios.prototype[method] = generateHTTPMethod();
- Axios.prototype[method + "Form"] = generateHTTPMethod(true);
+ Axios$1.prototype[method] = generateHTTPMethod();
+ Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
});
-const Axios$1 = Axios;
-class CancelToken {
+let CancelToken$1 = class CancelToken {
constructor(executor) {
if (typeof executor !== "function") {
throw new TypeError("executor must be a function.");
@@ -15503,8 +15792,7 @@ class CancelToken {
});
const token = this;
this.promise.then((cancel) => {
- if (!token._listeners)
- return;
+ if (!token._listeners) return;
let i = token._listeners.length;
while (i-- > 0) {
token._listeners[i](cancel);
@@ -15526,7 +15814,7 @@ class CancelToken {
if (token.reason) {
return;
}
- token.reason = new CanceledError(message, config, request);
+ token.reason = new CanceledError$1(message, config, request);
resolvePromise(token.reason);
});
}
@@ -15564,6 +15852,15 @@ class CancelToken {
this._listeners.splice(index, 1);
}
}
+ toAbortSignal() {
+ const controller = new AbortController();
+ const abort2 = (err) => {
+ controller.abort(err);
+ };
+ this.subscribe(abort2);
+ controller.signal.unsubscribe = () => this.unsubscribe(abort2);
+ return controller.signal;
+ }
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.
@@ -15578,17 +15875,16 @@ class CancelToken {
cancel
};
}
-}
-const CancelToken$1 = CancelToken;
-function spread(callback) {
+};
+function spread$1(callback) {
return function wrap2(arr) {
return callback.apply(null, arr);
};
}
-function isAxiosError(payload) {
+function isAxiosError$1(payload) {
return utils$1.isObject(payload) && payload.isAxiosError === true;
}
-const HttpStatusCode = {
+const HttpStatusCode$1 = {
Continue: 100,
SwitchingProtocols: 101,
Processing: 102,
@@ -15653,40 +15949,57 @@ const HttpStatusCode = {
NotExtended: 510,
NetworkAuthenticationRequired: 511
};
-Object.entries(HttpStatusCode).forEach(([key, value]) => {
- HttpStatusCode[value] = key;
+Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
+ HttpStatusCode$1[value] = key;
});
-const HttpStatusCode$1 = HttpStatusCode;
function createInstance(defaultConfig) {
const context = new Axios$1(defaultConfig);
const instance = bind(Axios$1.prototype.request, context);
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
utils$1.extend(instance, context, null, { allOwnKeys: true });
instance.create = function create(instanceConfig) {
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
};
return instance;
}
-const axios = createInstance(defaults$1);
+const axios = createInstance(defaults);
axios.Axios = Axios$1;
-axios.CanceledError = CanceledError;
+axios.CanceledError = CanceledError$1;
axios.CancelToken = CancelToken$1;
-axios.isCancel = isCancel;
-axios.VERSION = VERSION;
-axios.toFormData = toFormData;
-axios.AxiosError = AxiosError;
+axios.isCancel = isCancel$1;
+axios.VERSION = VERSION$1;
+axios.toFormData = toFormData$1;
+axios.AxiosError = AxiosError$1;
axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
return Promise.all(promises);
};
-axios.spread = spread;
-axios.isAxiosError = isAxiosError;
-axios.mergeConfig = mergeConfig;
+axios.spread = spread$1;
+axios.isAxiosError = isAxiosError$1;
+axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
+const {
+ Axios: Axios2,
+ AxiosError,
+ CanceledError,
+ isCancel,
+ CancelToken: CancelToken2,
+ VERSION,
+ all: all2,
+ Cancel,
+ isAxiosError,
+ spread,
+ toFormData,
+ AxiosHeaders: AxiosHeaders2,
+ HttpStatusCode,
+ formToJSON,
+ getAdapter,
+ mergeConfig
+} = axios;
let win;
electron.app.whenReady().then(() => {
win = new electron.BrowserWindow({
@@ -15825,8 +16138,7 @@ electron.app.whenReady().then(() => {
} else {
electron.app.on("second-instance", (event, commandLine, workingDirectory) => {
if (win) {
- if (win.isMinimized())
- win.restore();
+ if (win.isMinimized()) win.restore();
win.focus();
win.show();
}
@@ -15838,6 +16150,5 @@ electron.app.whenReady().then(() => {
});
});
electron.app.on("window-all-closed", () => {
- if (process.platform !== "darwin")
- electron.app.quit();
+ if (process.platform !== "darwin") electron.app.quit();
});
diff --git a/src/App.vue b/src/App.vue
index 177aa22..38bd4e6 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -33,6 +33,10 @@ import { scanSendMessage } from "@/api/order/index";
import { useGlobal } from "@/store/global.js";
import { useSocket } from "@/store/socket.js";
import { ipcRenderer } from 'electron';
+import { useGoods } from '@/store/goods.js'
+
+const goodsStore = useGoods()
+
const socket = useSocket();
const global = useGlobal();
@@ -165,13 +169,14 @@ async function getBarCode(e) {
}
onMounted(() => {
- document.addEventListener("keydown", (e) => {
- getBarCode(e);
- });
+ // 全局监听叫号
+ // document.addEventListener("keydown", (e) => {
+ // getBarCode(e);
+ // });
// 防止刷新页面长连接丢失
- if (store.userInfo && store.userInfo.shopId) {
- socket.init();
+ if (store.userInfo && store.userInfo.id) {
+ goodsStore.initGoods()
}
ipcRenderer.on('showCloseDialog', (event, arg) => {
diff --git a/src/api/account.js b/src/api/account.js
new file mode 100644
index 0000000..07205ff
--- /dev/null
+++ b/src/api/account.js
@@ -0,0 +1,79 @@
+import request from "@/utils/request.js";
+
+/**
+ * 商户登录
+ * @param {*} data
+ * @returns
+ */
+export function login(data) {
+ return request({
+ method: "post",
+ url: "/account/admin/auth/login",
+ data,
+ });
+}
+
+/**
+ * 验证码获取
+ * @param {*} params
+ * @returns
+ */
+export function captcha(params) {
+ return request({
+ method: "get",
+ url: "/account/admin/auth/captcha",
+ params,
+ });
+}
+
+/**
+ * 店铺详情
+ * @param {*} params
+ * @returns
+ */
+export function shopInfo_detail(params) {
+ return request({
+ method: "get",
+ url: "/account/admin/shopInfo/detail",
+ params,
+ });
+}
+
+/**
+ * 获取店铺用户列表
+ * @param {*} params
+ * @returns
+ */
+export function shopUserList(params) {
+ return request({
+ method: "get",
+ url: "/account/admin/shopUser",
+ params,
+ });
+}
+
+/**
+ * 获取台桌区域
+ * @param {*} params
+ * @returns
+ */
+export function shopArea(params) {
+ return request({
+ method: "get",
+ url: "/account/admin/shopArea",
+ params,
+ });
+}
+
+/**
+ * 获取台桌列表
+ * @param {*} params
+ * @returns
+ */
+export function shopTable(params) {
+ return request({
+ method: "get",
+ url: "/account/admin/shopTable",
+ params,
+ });
+}
diff --git a/src/api/order.js b/src/api/order.js
new file mode 100644
index 0000000..376d52f
--- /dev/null
+++ b/src/api/order.js
@@ -0,0 +1,66 @@
+import request from "@/utils/request.js";
+
+/**
+ * 反扫
+ * @param {*} data
+ * @returns
+ */
+export function microPay(data) {
+ return request({
+ method: "post",
+ url: "/order/pay/microPay",
+ data,
+ });
+}
+
+/**
+ * 现金支付订单
+ * @param {*} data
+ * @returns
+ */
+export function cashPay(data) {
+ return request({
+ method: "post",
+ url: "/order/pay/cashPay",
+ data,
+ });
+}
+
+/**
+ * 查询订单列表
+ * @param {*} data
+ * @returns
+ */
+export function orderList(data) {
+ return request({
+ method: "post",
+ url: "/order/admin/order",
+ data,
+ });
+}
+
+/**
+ * 新增订单
+ * @param {*} data
+ * @returns
+ */
+export function createOrder(data) {
+ return request({
+ method: "post",
+ url: "/order/admin/order/createOrder",
+ data,
+ });
+}
+
+/**
+ * 历史订单(多次下单使用)
+ * @param {*} data
+ * @returns
+ */
+export function historyOrder(params) {
+ return request({
+ method: "get",
+ url: "/order/admin/order/historyOrder",
+ params,
+ });
+}
diff --git a/src/api/product_new.js b/src/api/product_new.js
new file mode 100644
index 0000000..a27c013
--- /dev/null
+++ b/src/api/product_new.js
@@ -0,0 +1,27 @@
+import request from "@/utils/request.js";
+
+/**
+ * 查询分类信息
+ * @param {*} params
+ * @returns
+ */
+export function categoryList(params) {
+ return request({
+ method: "get",
+ url: "/product/admin/prod/category/list",
+ params,
+ });
+}
+
+/**
+ * 查询商品列表
+ * @param {*} params
+ * @returns
+ */
+export function productPage(params) {
+ return request({
+ method: "get",
+ url: "/product/admin/product/list",
+ params,
+ });
+}
diff --git a/src/components/payCard/payCard.vue b/src/components/payCard/payCard.vue
index d26b1ad..829c8aa 100644
--- a/src/components/payCard/payCard.vue
+++ b/src/components/payCard/payCard.vue
@@ -142,7 +142,7 @@
diff --git a/src/components/selectVipUser.vue b/src/components/selectVipUser.vue
new file mode 100644
index 0000000..fdc3bb6
--- /dev/null
+++ b/src/components/selectVipUser.vue
@@ -0,0 +1,94 @@
+
+