import { unref as vt, getCurrentScope as Bt, onScopeDispose as jt, ref as ne, watch as xe } from "vue";
import { encryption as qt } from "@das-fed/utils/atob";
import { getConfig as se } from "@das-fed/utils/config";
import { getAccessToken as $, removeAccessToken as Mt, setAccessToken as Ht, getAccessTokenInfo as de } from "@das-fed/utils/token-tools";
import { appendQueryParams as Ce } from "@das-fed/utils/common-tools";
import { removeProcessEngineToken as $t, setProcessEngineToken as zt } from "@das-fed/utils/process-engine-info";
import { setPersonalInfo as st } from "@das-fed/utils/common-info/set-personal-info";
function it(e, t) {
  return function() {
    return e.apply(t, arguments);
  };
}
const { toString: Jt } = Object.prototype, { getPrototypeOf: ke } = Object, { iterator: ie, toStringTag: at } = Symbol, ae = /* @__PURE__ */ ((e) => (t) => {
  const n = Jt.call(t);
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), x = (e) => (e = e.toLowerCase(), (t) => ae(t) === e), ce = (e) => (t) => typeof t === e, { isArray: q } = Array, z = ce("undefined");
function V(e) {
  return e !== null && !z(e) && e.constructor !== null && !z(e.constructor) && A(e.constructor.isBuffer) && e.constructor.isBuffer(e);
}
const ct = x("ArrayBuffer");
function Vt(e) {
  let t;
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && ct(e.buffer), t;
}
const Wt = ce("string"), A = ce("function"), ut = ce("number"), W = (e) => e !== null && typeof e == "object", Kt = (e) => e === !0 || e === !1, Y = (e) => {
  if (ae(e) !== "object")
    return !1;
  const t = ke(e);
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(at in e) && !(ie in e);
}, Qt = (e) => {
  if (!W(e) || V(e))
    return !1;
  try {
    return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
  } catch {
    return !1;
  }
}, Xt = x("Date"), Gt = x("File"), Zt = x("Blob"), Yt = x("FileList"), en = (e) => W(e) && A(e.pipe), tn = (e) => {
  let t;
  return e && (typeof FormData == "function" && e instanceof FormData || A(e.append) && ((t = ae(e)) === "formdata" || // detect form-data instance
  t === "object" && A(e.toString) && e.toString() === "[object FormData]"));
}, nn = x("URLSearchParams"), [rn, on, sn, an] = ["ReadableStream", "Request", "Response", "Headers"].map(x), cn = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function K(e, t, { allOwnKeys: n = !1 } = {}) {
  if (e === null || typeof e > "u")
    return;
  let r, o;
  if (typeof e != "object" && (e = [e]), q(e))
    for (r = 0, o = e.length; r < o; r++)
      t.call(null, e[r], r, e);
  else {
    if (V(e))
      return;
    const s = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = s.length;
    let a;
    for (r = 0; r < i; r++)
      a = s[r], t.call(null, e[a], a, e);
  }
}
function lt(e, t) {
  if (V(e))
    return null;
  t = t.toLowerCase();
  const n = Object.keys(e);
  let r = n.length, o;
  for (; r-- > 0; )
    if (o = n[r], t === o.toLowerCase())
      return o;
  return null;
}
const D = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, ft = (e) => !z(e) && e !== D;
function we() {
  const { caseless: e } = ft(this) && this || {}, t = {}, n = (r, o) => {
    const s = e && lt(t, o) || o;
    Y(t[s]) && Y(r) ? t[s] = we(t[s], r) : Y(r) ? t[s] = we({}, r) : q(r) ? t[s] = r.slice() : t[s] = r;
  };
  for (let r = 0, o = arguments.length; r < o; r++)
    arguments[r] && K(arguments[r], n);
  return t;
}
const un = (e, t, n, { allOwnKeys: r } = {}) => (K(t, (o, s) => {
  n && A(o) ? e[s] = it(o, n) : e[s] = o;
}, { allOwnKeys: r }), e), ln = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), fn = (e, t, n, r) => {
  e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
    value: t.prototype
  }), n && Object.assign(e.prototype, n);
}, dn = (e, t, n, r) => {
  let o, s, i;
  const a = {};
  if (t = t || {}, e == null) return t;
  do {
    for (o = Object.getOwnPropertyNames(e), s = o.length; s-- > 0; )
      i = o[s], (!r || r(i, e, t)) && !a[i] && (t[i] = e[i], a[i] = !0);
    e = n !== !1 && ke(e);
  } while (e && (!n || n(e, t)) && e !== Object.prototype);
  return t;
}, pn = (e, t, n) => {
  e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
  const r = e.indexOf(t, n);
  return r !== -1 && r === n;
}, hn = (e) => {
  if (!e) return null;
  if (q(e)) return e;
  let t = e.length;
  if (!ut(t)) return null;
  const n = new Array(t);
  for (; t-- > 0; )
    n[t] = e[t];
  return n;
}, mn = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ke(Uint8Array)), yn = (e, t) => {
  const r = (e && e[ie]).call(e);
  let o;
  for (; (o = r.next()) && !o.done; ) {
    const s = o.value;
    t.call(e, s[0], s[1]);
  }
}, wn = (e, t) => {
  let n;
  const r = [];
  for (; (n = e.exec(t)) !== null; )
    r.push(n);
  return r;
}, gn = x("HTMLFormElement"), bn = (e) => e.toLowerCase().replace(
  /[-_\s]([a-z\d])(\w*)/g,
  function(n, r, o) {
    return r.toUpperCase() + o;
  }
), Fe = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), En = x("RegExp"), dt = (e, t) => {
  const n = Object.getOwnPropertyDescriptors(e), r = {};
  K(n, (o, s) => {
    let i;
    (i = t(o, s, e)) !== !1 && (r[s] = i || o);
  }), Object.defineProperties(e, r);
}, Rn = (e) => {
  dt(e, (t, n) => {
    if (A(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
      return !1;
    const r = e[n];
    if (A(r)) {
      if (t.enumerable = !1, "writable" in t) {
        t.writable = !1;
        return;
      }
      t.set || (t.set = () => {
        throw Error("Can not rewrite read-only method '" + n + "'");
      });
    }
  });
}, Sn = (e, t) => {
  const n = {}, r = (o) => {
    o.forEach((s) => {
      n[s] = !0;
    });
  };
  return q(e) ? r(e) : r(String(e).split(t)), n;
}, Tn = () => {
}, On = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
function An(e) {
  return !!(e && A(e.append) && e[at] === "FormData" && e[ie]);
}
const _n = (e) => {
  const t = new Array(10), n = (r, o) => {
    if (W(r)) {
      if (t.indexOf(r) >= 0)
        return;
      if (V(r))
        return r;
      if (!("toJSON" in r)) {
        t[o] = r;
        const s = q(r) ? [] : {};
        return K(r, (i, a) => {
          const f = n(i, o + 1);
          !z(f) && (s[a] = f);
        }), t[o] = void 0, s;
      }
    }
    return r;
  };
  return n(e, 0);
}, xn = x("AsyncFunction"), Cn = (e) => e && (W(e) || A(e)) && A(e.then) && A(e.catch), pt = ((e, t) => e ? setImmediate : t ? ((n, r) => (D.addEventListener("message", ({ source: o, data: s }) => {
  o === D && s === n && r.length && r.shift()();
}, !1), (o) => {
  r.push(o), D.postMessage(n, "*");
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
  typeof setImmediate == "function",
  A(D.postMessage)
), kn = typeof queueMicrotask < "u" ? queueMicrotask.bind(D) : typeof process < "u" && process.nextTick || pt, Pn = (e) => e != null && A(e[ie]), c = {
  isArray: q,
  isArrayBuffer: ct,
  isBuffer: V,
  isFormData: tn,
  isArrayBufferView: Vt,
  isString: Wt,
  isNumber: ut,
  isBoolean: Kt,
  isObject: W,
  isPlainObject: Y,
  isEmptyObject: Qt,
  isReadableStream: rn,
  isRequest: on,
  isResponse: sn,
  isHeaders: an,
  isUndefined: z,
  isDate: Xt,
  isFile: Gt,
  isBlob: Zt,
  isRegExp: En,
  isFunction: A,
  isStream: en,
  isURLSearchParams: nn,
  isTypedArray: mn,
  isFileList: Yt,
  forEach: K,
  merge: we,
  extend: un,
  trim: cn,
  stripBOM: ln,
  inherits: fn,
  toFlatObject: dn,
  kindOf: ae,
  kindOfTest: x,
  endsWith: pn,
  toArray: hn,
  forEachEntry: yn,
  matchAll: wn,
  isHTMLForm: gn,
  hasOwnProperty: Fe,
  hasOwnProp: Fe,
  // an alias to avoid ESLint no-prototype-builtins detection
  reduceDescriptors: dt,
  freezeMethods: Rn,
  toObjectSet: Sn,
  toCamelCase: bn,
  noop: Tn,
  toFiniteNumber: On,
  findKey: lt,
  global: D,
  isContextDefined: ft,
  isSpecCompliantForm: An,
  toJSONObject: _n,
  isAsyncFn: xn,
  isThenable: Cn,
  setImmediate: pt,
  asap: kn,
  isIterable: Pn
};
function w(e, t, n, r, o) {
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
}
c.inherits(w, Error, {
  toJSON: function() {
    return {
      // Standard
      message: this.message,
      name: this.name,
      // Microsoft
      description: this.description,
      number: this.number,
      // Mozilla
      fileName: this.fileName,
      lineNumber: this.lineNumber,
      columnNumber: this.columnNumber,
      stack: this.stack,
      // Axios
      config: c.toJSONObject(this.config),
      code: this.code,
      status: this.status
    };
  }
});
const ht = w.prototype, mt = {};
[
  "ERR_BAD_OPTION_VALUE",
  "ERR_BAD_OPTION",
  "ECONNABORTED",
  "ETIMEDOUT",
  "ERR_NETWORK",
  "ERR_FR_TOO_MANY_REDIRECTS",
  "ERR_DEPRECATED",
  "ERR_BAD_RESPONSE",
  "ERR_BAD_REQUEST",
  "ERR_CANCELED",
  "ERR_NOT_SUPPORT",
  "ERR_INVALID_URL"
  // eslint-disable-next-line func-names
].forEach((e) => {
  mt[e] = { value: e };
});
Object.defineProperties(w, mt);
Object.defineProperty(ht, "isAxiosError", { value: !0 });
w.from = (e, t, n, r, o, s) => {
  const i = Object.create(ht);
  return c.toFlatObject(e, i, function(f) {
    return f !== Error.prototype;
  }, (a) => a !== "isAxiosError"), w.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
};
const Ln = null;
function ge(e) {
  return c.isPlainObject(e) || c.isArray(e);
}
function yt(e) {
  return c.endsWith(e, "[]") ? e.slice(0, -2) : e;
}
function De(e, t, n) {
  return e ? e.concat(t).map(function(o, s) {
    return o = yt(o), !n && s ? "[" + o + "]" : o;
  }).join(n ? "." : "") : t;
}
function Un(e) {
  return c.isArray(e) && !e.some(ge);
}
const Nn = c.toFlatObject(c, {}, null, function(t) {
  return /^is[A-Z]/.test(t);
});
function ue(e, t, n) {
  if (!c.isObject(e))
    throw new TypeError("target must be an object");
  t = t || new FormData(), n = c.toFlatObject(n, {
    metaTokens: !0,
    dots: !1,
    indexes: !1
  }, !1, function(y, h) {
    return !c.isUndefined(h[y]);
  });
  const r = n.metaTokens, o = n.visitor || u, s = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && c.isSpecCompliantForm(t);
  if (!c.isFunction(o))
    throw new TypeError("visitor must be a function");
  function l(p) {
    if (p === null) return "";
    if (c.isDate(p))
      return p.toISOString();
    if (c.isBoolean(p))
      return p.toString();
    if (!f && c.isBlob(p))
      throw new w("Blob is not supported. Use a Buffer instead.");
    return c.isArrayBuffer(p) || c.isTypedArray(p) ? f && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
  }
  function u(p, y, h) {
    let E = p;
    if (p && !h && typeof p == "object") {
      if (c.endsWith(y, "{}"))
        y = r ? y : y.slice(0, -2), p = JSON.stringify(p);
      else if (c.isArray(p) && Un(p) || (c.isFileList(p) || c.endsWith(y, "[]")) && (E = c.toArray(p)))
        return y = yt(y), E.forEach(function(S, k) {
          !(c.isUndefined(S) || S === null) && t.append(
            // eslint-disable-next-line no-nested-ternary
            i === !0 ? De([y], k, s) : i === null ? y : y + "[]",
            l(S)
          );
        }), !1;
    }
    return ge(p) ? !0 : (t.append(De(h, y, s), l(p)), !1);
  }
  const d = [], m = Object.assign(Nn, {
    defaultVisitor: u,
    convertValue: l,
    isVisitable: ge
  });
  function g(p, y) {
    if (!c.isUndefined(p)) {
      if (d.indexOf(p) !== -1)
        throw Error("Circular reference detected in " + y.join("."));
      d.push(p), c.forEach(p, function(E, R) {
        (!(c.isUndefined(E) || E === null) && o.call(
          t,
          E,
          c.isString(R) ? R.trim() : R,
          y,
          m
        )) === !0 && g(E, y ? y.concat(R) : [R]);
      }), d.pop();
    }
  }
  if (!c.isObject(e))
    throw new TypeError("data must be an object");
  return g(e), t;
}
function Ie(e) {
  const t = {
    "!": "%21",
    "'": "%27",
    "(": "%28",
    ")": "%29",
    "~": "%7E",
    "%20": "+",
    "%00": "\0"
  };
  return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
    return t[r];
  });
}
function Pe(e, t) {
  this._pairs = [], e && ue(e, this, t);
}
const wt = Pe.prototype;
wt.append = function(t, n) {
  this._pairs.push([t, n]);
};
wt.toString = function(t) {
  const n = t ? function(r) {
    return t.call(this, r, Ie);
  } : Ie;
  return this._pairs.map(function(o) {
    return n(o[0]) + "=" + n(o[1]);
  }, "").join("&");
};
function Fn(e) {
  return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function gt(e, t, n) {
  if (!t)
    return e;
  const r = n && n.encode || Fn;
  c.isFunction(n) && (n = {
    serialize: n
  });
  const o = n && n.serialize;
  let s;
  if (o ? s = o(t, n) : s = c.isURLSearchParams(t) ? t.toString() : new Pe(t, n).toString(r), s) {
    const i = e.indexOf("#");
    i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
  }
  return e;
}
class ve {
  constructor() {
    this.handlers = [];
  }
  /**
   * Add a new interceptor to the stack
   *
   * @param {Function} fulfilled The function to handle `then` for a `Promise`
   * @param {Function} rejected The function to handle `reject` for a `Promise`
   *
   * @return {Number} An ID used to remove interceptor later
   */
  use(t, n, r) {
    return this.handlers.push({
      fulfilled: t,
      rejected: n,
      synchronous: r ? r.synchronous : !1,
      runWhen: r ? r.runWhen : null
    }), this.handlers.length - 1;
  }
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   *
   * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
   */
  eject(t) {
    this.handlers[t] && (this.handlers[t] = null);
  }
  /**
   * Clear all interceptors from the stack
   *
   * @returns {void}
   */
  clear() {
    this.handlers && (this.handlers = []);
  }
  /**
   * Iterate over all the registered interceptors
   *
   * This method is particularly useful for skipping over any
   * interceptors that may have become `null` calling `eject`.
   *
   * @param {Function} fn The function to call for each interceptor
   *
   * @returns {void}
   */
  forEach(t) {
    c.forEach(this.handlers, function(r) {
      r !== null && t(r);
    });
  }
}
const bt = {
  silentJSONParsing: !0,
  forcedJSONParsing: !0,
  clarifyTimeoutError: !1
}, Dn = typeof URLSearchParams < "u" ? URLSearchParams : Pe, In = typeof FormData < "u" ? FormData : null, vn = typeof Blob < "u" ? Blob : null, Bn = {
  isBrowser: !0,
  classes: {
    URLSearchParams: Dn,
    FormData: In,
    Blob: vn
  },
  protocols: ["http", "https", "file", "blob", "url", "data"]
}, Le = typeof window < "u" && typeof document < "u", be = typeof navigator == "object" && navigator || void 0, jn = Le && (!be || ["ReactNative", "NativeScript", "NS"].indexOf(be.product) < 0), qn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Mn = Le && window.location.href || "http://localhost", Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  hasBrowserEnv: Le,
  hasStandardBrowserEnv: jn,
  hasStandardBrowserWebWorkerEnv: qn,
  navigator: be,
  origin: Mn
}, Symbol.toStringTag, { value: "Module" })), T = {
  ...Hn,
  ...Bn
};
function $n(e, t) {
  return ue(e, new T.classes.URLSearchParams(), {
    visitor: function(n, r, o, s) {
      return T.isNode && c.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
    },
    ...t
  });
}
function zn(e) {
  return c.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
}
function Jn(e) {
  const t = {}, n = Object.keys(e);
  let r;
  const o = n.length;
  let s;
  for (r = 0; r < o; r++)
    s = n[r], t[s] = e[s];
  return t;
}
function Et(e) {
  function t(n, r, o, s) {
    let i = n[s++];
    if (i === "__proto__") return !0;
    const a = Number.isFinite(+i), f = s >= n.length;
    return i = !i && c.isArray(o) ? o.length : i, f ? (c.hasOwnProp(o, i) ? o[i] = [o[i], r] : o[i] = r, !a) : ((!o[i] || !c.isObject(o[i])) && (o[i] = []), t(n, r, o[i], s) && c.isArray(o[i]) && (o[i] = Jn(o[i])), !a);
  }
  if (c.isFormData(e) && c.isFunction(e.entries)) {
    const n = {};
    return c.forEachEntry(e, (r, o) => {
      t(zn(r), o, n, 0);
    }), n;
  }
  return null;
}
function Vn(e, t, n) {
  if (c.isString(e))
    try {
      return (t || JSON.parse)(e), c.trim(e);
    } catch (r) {
      if (r.name !== "SyntaxError")
        throw r;
    }
  return (n || JSON.stringify)(e);
}
const Q = {
  transitional: bt,
  adapter: ["xhr", "http", "fetch"],
  transformRequest: [function(t, n) {
    const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, s = c.isObject(t);
    if (s && c.isHTMLForm(t) && (t = new FormData(t)), c.isFormData(t))
      return o ? JSON.stringify(Et(t)) : t;
    if (c.isArrayBuffer(t) || c.isBuffer(t) || c.isStream(t) || c.isFile(t) || c.isBlob(t) || c.isReadableStream(t))
      return t;
    if (c.isArrayBufferView(t))
      return t.buffer;
    if (c.isURLSearchParams(t))
      return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
    let a;
    if (s) {
      if (r.indexOf("application/x-www-form-urlencoded") > -1)
        return $n(t, this.formSerializer).toString();
      if ((a = c.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
        const f = this.env && this.env.FormData;
        return ue(
          a ? { "files[]": t } : t,
          f && new f(),
          this.formSerializer
        );
      }
    }
    return s || o ? (n.setContentType("application/json", !1), Vn(t)) : t;
  }],
  transformResponse: [function(t) {
    const n = this.transitional || Q.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
    if (c.isResponse(t) || c.isReadableStream(t))
      return t;
    if (t && c.isString(t) && (r && !this.responseType || o)) {
      const i = !(n && n.silentJSONParsing) && o;
      try {
        return JSON.parse(t);
      } catch (a) {
        if (i)
          throw a.name === "SyntaxError" ? w.from(a, w.ERR_BAD_RESPONSE, this, null, this.response) : a;
      }
    }
    return t;
  }],
  /**
   * A timeout in milliseconds to abort a request. If set to 0 (default) a
   * timeout is not created.
   */
  timeout: 0,
  xsrfCookieName: "XSRF-TOKEN",
  xsrfHeaderName: "X-XSRF-TOKEN",
  maxContentLength: -1,
  maxBodyLength: -1,
  env: {
    FormData: T.classes.FormData,
    Blob: T.classes.Blob
  },
  validateStatus: function(t) {
    return t >= 200 && t < 300;
  },
  headers: {
    common: {
      Accept: "application/json, text/plain, */*",
      "Content-Type": void 0
    }
  }
};
c.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
  Q.headers[e] = {};
});
const Wn = c.toObjectSet([
  "age",
  "authorization",
  "content-length",
  "content-type",
  "etag",
  "expires",
  "from",
  "host",
  "if-modified-since",
  "if-unmodified-since",
  "last-modified",
  "location",
  "max-forwards",
  "proxy-authorization",
  "referer",
  "retry-after",
  "user-agent"
]), Kn = (e) => {
  const t = {};
  let n, r, o;
  return e && e.split(`
`).forEach(function(i) {
    o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || t[n] && Wn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
  }), t;
}, Be = Symbol("internals");
function H(e) {
  return e && String(e).trim().toLowerCase();
}
function ee(e) {
  return e === !1 || e == null ? e : c.isArray(e) ? e.map(ee) : String(e);
}
function Qn(e) {
  const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  let r;
  for (; r = n.exec(e); )
    t[r[1]] = r[2];
  return t;
}
const Xn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
function pe(e, t, n, r, o) {
  if (c.isFunction(r))
    return r.call(this, t, n);
  if (o && (t = n), !!c.isString(t)) {
    if (c.isString(r))
      return t.indexOf(r) !== -1;
    if (c.isRegExp(r))
      return r.test(t);
  }
}
function Gn(e) {
  return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
}
function Zn(e, t) {
  const n = c.toCamelCase(" " + t);
  ["get", "set", "has"].forEach((r) => {
    Object.defineProperty(e, r + n, {
      value: function(o, s, i) {
        return this[r].call(this, t, o, s, i);
      },
      configurable: !0
    });
  });
}
let _ = class {
  constructor(t) {
    t && this.set(t);
  }
  set(t, n, r) {
    const o = this;
    function s(a, f, l) {
      const u = H(f);
      if (!u)
        throw new Error("header name must be a non-empty string");
      const d = c.findKey(o, u);
      (!d || o[d] === void 0 || l === !0 || l === void 0 && o[d] !== !1) && (o[d || f] = ee(a));
    }
    const i = (a, f) => c.forEach(a, (l, u) => s(l, u, f));
    if (c.isPlainObject(t) || t instanceof this.constructor)
      i(t, n);
    else if (c.isString(t) && (t = t.trim()) && !Xn(t))
      i(Kn(t), n);
    else if (c.isObject(t) && c.isIterable(t)) {
      let a = {}, f, l;
      for (const u of t) {
        if (!c.isArray(u))
          throw TypeError("Object iterator must return a key-value pair");
        a[l = u[0]] = (f = a[l]) ? c.isArray(f) ? [...f, u[1]] : [f, u[1]] : u[1];
      }
      i(a, n);
    } else
      t != null && s(n, t, r);
    return this;
  }
  get(t, n) {
    if (t = H(t), t) {
      const r = c.findKey(this, t);
      if (r) {
        const o = this[r];
        if (!n)
          return o;
        if (n === !0)
          return Qn(o);
        if (c.isFunction(n))
          return n.call(this, o, r);
        if (c.isRegExp(n))
          return n.exec(o);
        throw new TypeError("parser must be boolean|regexp|function");
      }
    }
  }
  has(t, n) {
    if (t = H(t), t) {
      const r = c.findKey(this, t);
      return !!(r && this[r] !== void 0 && (!n || pe(this, this[r], r, n)));
    }
    return !1;
  }
  delete(t, n) {
    const r = this;
    let o = !1;
    function s(i) {
      if (i = H(i), i) {
        const a = c.findKey(r, i);
        a && (!n || pe(r, r[a], a, n)) && (delete r[a], o = !0);
      }
    }
    return c.isArray(t) ? t.forEach(s) : s(t), o;
  }
  clear(t) {
    const n = Object.keys(this);
    let r = n.length, o = !1;
    for (; r--; ) {
      const s = n[r];
      (!t || pe(this, this[s], s, t, !0)) && (delete this[s], o = !0);
    }
    return o;
  }
  normalize(t) {
    const n = this, r = {};
    return c.forEach(this, (o, s) => {
      const i = c.findKey(r, s);
      if (i) {
        n[i] = ee(o), delete n[s];
        return;
      }
      const a = t ? Gn(s) : String(s).trim();
      a !== s && delete n[s], n[a] = ee(o), r[a] = !0;
    }), this;
  }
  concat(...t) {
    return this.constructor.concat(this, ...t);
  }
  toJSON(t) {
    const n = /* @__PURE__ */ Object.create(null);
    return c.forEach(this, (r, o) => {
      r != null && r !== !1 && (n[o] = t && c.isArray(r) ? r.join(", ") : r);
    }), n;
  }
  [Symbol.iterator]() {
    return Object.entries(this.toJSON())[Symbol.iterator]();
  }
  toString() {
    return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
`);
  }
  getSetCookie() {
    return this.get("set-cookie") || [];
  }
  get [Symbol.toStringTag]() {
    return "AxiosHeaders";
  }
  static from(t) {
    return t instanceof this ? t : new this(t);
  }
  static concat(t, ...n) {
    const r = new this(t);
    return n.forEach((o) => r.set(o)), r;
  }
  static accessor(t) {
    const r = (this[Be] = this[Be] = {
      accessors: {}
    }).accessors, o = this.prototype;
    function s(i) {
      const a = H(i);
      r[a] || (Zn(o, i), r[a] = !0);
    }
    return c.isArray(t) ? t.forEach(s) : s(t), this;
  }
};
_.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
c.reduceDescriptors(_.prototype, ({ value: e }, t) => {
  let n = t[0].toUpperCase() + t.slice(1);
  return {
    get: () => e,
    set(r) {
      this[n] = r;
    }
  };
});
c.freezeMethods(_);
function he(e, t) {
  const n = this || Q, r = t || n, o = _.from(r.headers);
  let s = r.data;
  return c.forEach(e, function(a) {
    s = a.call(n, s, o.normalize(), t ? t.status : void 0);
  }), o.normalize(), s;
}
function Rt(e) {
  return !!(e && e.__CANCEL__);
}
function M(e, t, n) {
  w.call(this, e ?? "canceled", w.ERR_CANCELED, t, n), this.name = "CanceledError";
}
c.inherits(M, w, {
  __CANCEL__: !0
});
function St(e, t, n) {
  const r = n.config.validateStatus;
  !n.status || !r || r(n.status) ? e(n) : t(new w(
    "Request failed with status code " + n.status,
    [w.ERR_BAD_REQUEST, w.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
    n.config,
    n.request,
    n
  ));
}
function Yn(e) {
  const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
  return t && t[1] || "";
}
function er(e, t) {
  e = e || 10;
  const n = new Array(e), r = new Array(e);
  let o = 0, s = 0, i;
  return t = t !== void 0 ? t : 1e3, function(f) {
    const l = Date.now(), u = r[s];
    i || (i = l), n[o] = f, r[o] = l;
    let d = s, m = 0;
    for (; d !== o; )
      m += n[d++], d = d % e;
    if (o = (o + 1) % e, o === s && (s = (s + 1) % e), l - i < t)
      return;
    const g = u && l - u;
    return g ? Math.round(m * 1e3 / g) : void 0;
  };
}
function tr(e, t) {
  let n = 0, r = 1e3 / t, o, s;
  const i = (l, u = Date.now()) => {
    n = u, o = null, s && (clearTimeout(s), s = null), e(...l);
  };
  return [(...l) => {
    const u = Date.now(), d = u - n;
    d >= r ? i(l, u) : (o = l, s || (s = setTimeout(() => {
      s = null, i(o);
    }, r - d)));
  }, () => o && i(o)];
}
const re = (e, t, n = 3) => {
  let r = 0;
  const o = er(50, 250);
  return tr((s) => {
    const i = s.loaded, a = s.lengthComputable ? s.total : void 0, f = i - r, l = o(f), u = i <= a;
    r = i;
    const d = {
      loaded: i,
      total: a,
      progress: a ? i / a : void 0,
      bytes: f,
      rate: l || void 0,
      estimated: l && a && u ? (a - i) / l : void 0,
      event: s,
      lengthComputable: a != null,
      [t ? "download" : "upload"]: !0
    };
    e(d);
  }, n);
}, je = (e, t) => {
  const n = e != null;
  return [(r) => t[0]({
    lengthComputable: n,
    total: e,
    loaded: r
  }), t[1]];
}, qe = (e) => (...t) => c.asap(() => e(...t)), nr = T.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, T.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
  new URL(T.origin),
  T.navigator && /(msie|trident)/i.test(T.navigator.userAgent)
) : () => !0, rr = T.hasStandardBrowserEnv ? (
  // Standard browser envs support document.cookie
  {
    write(e, t, n, r, o, s) {
      const i = [e + "=" + encodeURIComponent(t)];
      c.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), c.isString(r) && i.push("path=" + r), c.isString(o) && i.push("domain=" + o), s === !0 && i.push("secure"), document.cookie = i.join("; ");
    },
    read(e) {
      const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
      return t ? decodeURIComponent(t[3]) : null;
    },
    remove(e) {
      this.write(e, "", Date.now() - 864e5);
    }
  }
) : (
  // Non-standard browser env (web workers, react-native) lack needed support.
  {
    write() {
    },
    read() {
      return null;
    },
    remove() {
    }
  }
);
function or(e) {
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
}
function sr(e, t) {
  return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
}
function Tt(e, t, n) {
  let r = !or(t);
  return e && (r || n == !1) ? sr(e, t) : t;
}
const Me = (e) => e instanceof _ ? { ...e } : e;
function B(e, t) {
  t = t || {};
  const n = {};
  function r(l, u, d, m) {
    return c.isPlainObject(l) && c.isPlainObject(u) ? c.merge.call({ caseless: m }, l, u) : c.isPlainObject(u) ? c.merge({}, u) : c.isArray(u) ? u.slice() : u;
  }
  function o(l, u, d, m) {
    if (c.isUndefined(u)) {
      if (!c.isUndefined(l))
        return r(void 0, l, d, m);
    } else return r(l, u, d, m);
  }
  function s(l, u) {
    if (!c.isUndefined(u))
      return r(void 0, u);
  }
  function i(l, u) {
    if (c.isUndefined(u)) {
      if (!c.isUndefined(l))
        return r(void 0, l);
    } else return r(void 0, u);
  }
  function a(l, u, d) {
    if (d in t)
      return r(l, u);
    if (d in e)
      return r(void 0, l);
  }
  const f = {
    url: s,
    method: s,
    data: s,
    baseURL: i,
    transformRequest: i,
    transformResponse: i,
    paramsSerializer: i,
    timeout: i,
    timeoutMessage: i,
    withCredentials: i,
    withXSRFToken: i,
    adapter: i,
    responseType: i,
    xsrfCookieName: i,
    xsrfHeaderName: i,
    onUploadProgress: i,
    onDownloadProgress: i,
    decompress: i,
    maxContentLength: i,
    maxBodyLength: i,
    beforeRedirect: i,
    transport: i,
    httpAgent: i,
    httpsAgent: i,
    cancelToken: i,
    socketPath: i,
    responseEncoding: i,
    validateStatus: a,
    headers: (l, u, d) => o(Me(l), Me(u), d, !0)
  };
  return c.forEach(Object.keys({ ...e, ...t }), function(u) {
    const d = f[u] || o, m = d(e[u], t[u], u);
    c.isUndefined(m) && d !== a || (n[u] = m);
  }), n;
}
const Ot = (e) => {
  const t = B({}, e);
  let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: a } = t;
  t.headers = i = _.from(i), t.url = gt(Tt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), a && i.set(
    "Authorization",
    "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
  );
  let f;
  if (c.isFormData(n)) {
    if (T.hasStandardBrowserEnv || T.hasStandardBrowserWebWorkerEnv)
      i.setContentType(void 0);
    else if ((f = i.getContentType()) !== !1) {
      const [l, ...u] = f ? f.split(";").map((d) => d.trim()).filter(Boolean) : [];
      i.setContentType([l || "multipart/form-data", ...u].join("; "));
    }
  }
  if (T.hasStandardBrowserEnv && (r && c.isFunction(r) && (r = r(t)), r || r !== !1 && nr(t.url))) {
    const l = o && s && rr.read(s);
    l && i.set(o, l);
  }
  return t;
}, ir = typeof XMLHttpRequest < "u", ar = ir && function(e) {
  return new Promise(function(n, r) {
    const o = Ot(e);
    let s = o.data;
    const i = _.from(o.headers).normalize();
    let { responseType: a, onUploadProgress: f, onDownloadProgress: l } = o, u, d, m, g, p;
    function y() {
      g && g(), p && p(), o.cancelToken && o.cancelToken.unsubscribe(u), o.signal && o.signal.removeEventListener("abort", u);
    }
    let h = new XMLHttpRequest();
    h.open(o.method.toUpperCase(), o.url, !0), h.timeout = o.timeout;
    function E() {
      if (!h)
        return;
      const S = _.from(
        "getAllResponseHeaders" in h && h.getAllResponseHeaders()
      ), O = {
        data: !a || a === "text" || a === "json" ? h.responseText : h.response,
        status: h.status,
        statusText: h.statusText,
        headers: S,
        config: e,
        request: h
      };
      St(function(F) {
        n(F), y();
      }, function(F) {
        r(F), y();
      }, O), h = null;
    }
    "onloadend" in h ? h.onloadend = E : h.onreadystatechange = function() {
      !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(E);
    }, h.onabort = function() {
      h && (r(new w("Request aborted", w.ECONNABORTED, e, h)), h = null);
    }, h.onerror = function() {
      r(new w("Network Error", w.ERR_NETWORK, e, h)), h = null;
    }, h.ontimeout = function() {
      let k = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
      const O = o.transitional || bt;
      o.timeoutErrorMessage && (k = o.timeoutErrorMessage), r(new w(
        k,
        O.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
        e,
        h
      )), h = null;
    }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && c.forEach(i.toJSON(), function(k, O) {
      h.setRequestHeader(O, k);
    }), c.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), a && a !== "json" && (h.responseType = o.responseType), l && ([m, p] = re(l, !0), h.addEventListener("progress", m)), f && h.upload && ([d, g] = re(f), h.upload.addEventListener("progress", d), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (u = (S) => {
      h && (r(!S || S.type ? new M(null, e, h) : S), h.abort(), h = null);
    }, o.cancelToken && o.cancelToken.subscribe(u), o.signal && (o.signal.aborted ? u() : o.signal.addEventListener("abort", u)));
    const R = Yn(o.url);
    if (R && T.protocols.indexOf(R) === -1) {
      r(new w("Unsupported protocol " + R + ":", w.ERR_BAD_REQUEST, e));
      return;
    }
    h.send(s || null);
  });
}, cr = (e, t) => {
  const { length: n } = e = e ? e.filter(Boolean) : [];
  if (t || n) {
    let r = new AbortController(), o;
    const s = function(l) {
      if (!o) {
        o = !0, a();
        const u = l instanceof Error ? l : this.reason;
        r.abort(u instanceof w ? u : new M(u instanceof Error ? u.message : u));
      }
    };
    let i = t && setTimeout(() => {
      i = null, s(new w(`timeout ${t} of ms exceeded`, w.ETIMEDOUT));
    }, t);
    const a = () => {
      e && (i && clearTimeout(i), i = null, e.forEach((l) => {
        l.unsubscribe ? l.unsubscribe(s) : l.removeEventListener("abort", s);
      }), e = null);
    };
    e.forEach((l) => l.addEventListener("abort", s));
    const { signal: f } = r;
    return f.unsubscribe = () => c.asap(a), f;
  }
}, ur = function* (e, t) {
  let n = e.byteLength;
  if (n < t) {
    yield e;
    return;
  }
  let r = 0, o;
  for (; r < n; )
    o = r + t, yield e.slice(r, o), r = o;
}, lr = async function* (e, t) {
  for await (const n of fr(e))
    yield* ur(n, t);
}, fr = async function* (e) {
  if (e[Symbol.asyncIterator]) {
    yield* e;
    return;
  }
  const t = e.getReader();
  try {
    for (; ; ) {
      const { done: n, value: r } = await t.read();
      if (n)
        break;
      yield r;
    }
  } finally {
    await t.cancel();
  }
}, He = (e, t, n, r) => {
  const o = lr(e, t);
  let s = 0, i, a = (f) => {
    i || (i = !0, r && r(f));
  };
  return new ReadableStream({
    async pull(f) {
      try {
        const { done: l, value: u } = await o.next();
        if (l) {
          a(), f.close();
          return;
        }
        let d = u.byteLength;
        if (n) {
          let m = s += d;
          n(m);
        }
        f.enqueue(new Uint8Array(u));
      } catch (l) {
        throw a(l), l;
      }
    },
    cancel(f) {
      return a(f), o.return();
    }
  }, {
    highWaterMark: 2
  });
}, le = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", At = le && typeof ReadableStream == "function", dr = le && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), _t = (e, ...t) => {
  try {
    return !!e(...t);
  } catch {
    return !1;
  }
}, pr = At && _t(() => {
  let e = !1;
  const t = new Request(T.origin, {
    body: new ReadableStream(),
    method: "POST",
    get duplex() {
      return e = !0, "half";
    }
  }).headers.has("Content-Type");
  return e && !t;
}), $e = 64 * 1024, Ee = At && _t(() => c.isReadableStream(new Response("").body)), oe = {
  stream: Ee && ((e) => e.body)
};
le && ((e) => {
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
    !oe[t] && (oe[t] = c.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
      throw new w(`Response type '${t}' is not supported`, w.ERR_NOT_SUPPORT, r);
    });
  });
})(new Response());
const hr = async (e) => {
  if (e == null)
    return 0;
  if (c.isBlob(e))
    return e.size;
  if (c.isSpecCompliantForm(e))
    return (await new Request(T.origin, {
      method: "POST",
      body: e
    }).arrayBuffer()).byteLength;
  if (c.isArrayBufferView(e) || c.isArrayBuffer(e))
    return e.byteLength;
  if (c.isURLSearchParams(e) && (e = e + ""), c.isString(e))
    return (await dr(e)).byteLength;
}, mr = async (e, t) => {
  const n = c.toFiniteNumber(e.getContentLength());
  return n ?? hr(t);
}, yr = le && (async (e) => {
  let {
    url: t,
    method: n,
    data: r,
    signal: o,
    cancelToken: s,
    timeout: i,
    onDownloadProgress: a,
    onUploadProgress: f,
    responseType: l,
    headers: u,
    withCredentials: d = "same-origin",
    fetchOptions: m
  } = Ot(e);
  l = l ? (l + "").toLowerCase() : "text";
  let g = cr([o, s && s.toAbortSignal()], i), p;
  const y = g && g.unsubscribe && (() => {
    g.unsubscribe();
  });
  let h;
  try {
    if (f && pr && n !== "get" && n !== "head" && (h = await mr(u, r)) !== 0) {
      let O = new Request(t, {
        method: "POST",
        body: r,
        duplex: "half"
      }), P;
      if (c.isFormData(r) && (P = O.headers.get("content-type")) && u.setContentType(P), O.body) {
        const [F, X] = je(
          h,
          re(qe(f))
        );
        r = He(O.body, $e, F, X);
      }
    }
    c.isString(d) || (d = d ? "include" : "omit");
    const E = "credentials" in Request.prototype;
    p = new Request(t, {
      ...m,
      signal: g,
      method: n.toUpperCase(),
      headers: u.normalize().toJSON(),
      body: r,
      duplex: "half",
      credentials: E ? d : void 0
    });
    let R = await fetch(p, m);
    const S = Ee && (l === "stream" || l === "response");
    if (Ee && (a || S && y)) {
      const O = {};
      ["status", "statusText", "headers"].forEach((Ne) => {
        O[Ne] = R[Ne];
      });
      const P = c.toFiniteNumber(R.headers.get("content-length")), [F, X] = a && je(
        P,
        re(qe(a), !0)
      ) || [];
      R = new Response(
        He(R.body, $e, F, () => {
          X && X(), y && y();
        }),
        O
      );
    }
    l = l || "text";
    let k = await oe[c.findKey(oe, l) || "text"](R, e);
    return !S && y && y(), await new Promise((O, P) => {
      St(O, P, {
        data: k,
        headers: _.from(R.headers),
        status: R.status,
        statusText: R.statusText,
        config: e,
        request: p
      });
    });
  } catch (E) {
    throw y && y(), E && E.name === "TypeError" && /Load failed|fetch/i.test(E.message) ? Object.assign(
      new w("Network Error", w.ERR_NETWORK, e, p),
      {
        cause: E.cause || E
      }
    ) : w.from(E, E && E.code, e, p);
  }
}), Re = {
  http: Ln,
  xhr: ar,
  fetch: yr
};
c.forEach(Re, (e, t) => {
  if (e) {
    try {
      Object.defineProperty(e, "name", { value: t });
    } catch {
    }
    Object.defineProperty(e, "adapterName", { value: t });
  }
});
const ze = (e) => `- ${e}`, wr = (e) => c.isFunction(e) || e === null || e === !1, xt = {
  getAdapter: (e) => {
    e = c.isArray(e) ? e : [e];
    const { length: t } = e;
    let n, r;
    const o = {};
    for (let s = 0; s < t; s++) {
      n = e[s];
      let i;
      if (r = n, !wr(n) && (r = Re[(i = String(n)).toLowerCase()], r === void 0))
        throw new w(`Unknown adapter '${i}'`);
      if (r)
        break;
      o[i || "#" + s] = r;
    }
    if (!r) {
      const s = Object.entries(o).map(
        ([a, f]) => `adapter ${a} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
      );
      let i = t ? s.length > 1 ? `since :
` + s.map(ze).join(`
`) : " " + ze(s[0]) : "as no adapter specified";
      throw new w(
        "There is no suitable adapter to dispatch the request " + i,
        "ERR_NOT_SUPPORT"
      );
    }
    return r;
  },
  adapters: Re
};
function me(e) {
  if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
    throw new M(null, e);
}
function Je(e) {
  return me(e), e.headers = _.from(e.headers), e.data = he.call(
    e,
    e.transformRequest
  ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), xt.getAdapter(e.adapter || Q.adapter)(e).then(function(r) {
    return me(e), r.data = he.call(
      e,
      e.transformResponse,
      r
    ), r.headers = _.from(r.headers), r;
  }, function(r) {
    return Rt(r) || (me(e), r && r.response && (r.response.data = he.call(
      e,
      e.transformResponse,
      r.response
    ), r.response.headers = _.from(r.response.headers))), Promise.reject(r);
  });
}
const Ct = "1.11.0", fe = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
  fe[e] = function(r) {
    return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
  };
});
const Ve = {};
fe.transitional = function(t, n, r) {
  function o(s, i) {
    return "[Axios v" + Ct + "] Transitional option '" + s + "'" + i + (r ? ". " + r : "");
  }
  return (s, i, a) => {
    if (t === !1)
      throw new w(
        o(i, " has been removed" + (n ? " in " + n : "")),
        w.ERR_DEPRECATED
      );
    return n && !Ve[i] && (Ve[i] = !0), t ? t(s, i, a) : !0;
  };
};
fe.spelling = function(t) {
  return (n, r) => !0;
};
function gr(e, t, n) {
  if (typeof e != "object")
    throw new w("options must be an object", w.ERR_BAD_OPTION_VALUE);
  const r = Object.keys(e);
  let o = r.length;
  for (; o-- > 0; ) {
    const s = r[o], i = t[s];
    if (i) {
      const a = e[s], f = a === void 0 || i(a, s, e);
      if (f !== !0)
        throw new w("option " + s + " must be " + f, w.ERR_BAD_OPTION_VALUE);
      continue;
    }
    if (n !== !0)
      throw new w("Unknown option " + s, w.ERR_BAD_OPTION);
  }
}
const te = {
  assertOptions: gr,
  validators: fe
}, C = te.validators;
let I = class {
  constructor(t) {
    this.defaults = t || {}, this.interceptors = {
      request: new ve(),
      response: new ve()
    };
  }
  /**
   * Dispatch a request
   *
   * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
   * @param {?Object} config
   *
   * @returns {Promise} The Promise to be fulfilled
   */
  async request(t, n) {
    try {
      return await this._request(t, n);
    } catch (r) {
      if (r instanceof Error) {
        let o = {};
        Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
        const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
        try {
          r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += `
` + s) : r.stack = s;
        } catch {
        }
      }
      throw r;
    }
  }
  _request(t, n) {
    typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = B(this.defaults, n);
    const { transitional: r, paramsSerializer: o, headers: s } = n;
    r !== void 0 && te.assertOptions(r, {
      silentJSONParsing: C.transitional(C.boolean),
      forcedJSONParsing: C.transitional(C.boolean),
      clarifyTimeoutError: C.transitional(C.boolean)
    }, !1), o != null && (c.isFunction(o) ? n.paramsSerializer = {
      serialize: o
    } : te.assertOptions(o, {
      encode: C.function,
      serialize: C.function
    }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), te.assertOptions(n, {
      baseUrl: C.spelling("baseURL"),
      withXsrfToken: C.spelling("withXSRFToken")
    }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
    let i = s && c.merge(
      s.common,
      s[n.method]
    );
    s && c.forEach(
      ["delete", "get", "head", "post", "put", "patch", "common"],
      (p) => {
        delete s[p];
      }
    ), n.headers = _.concat(i, s);
    const a = [];
    let f = !0;
    this.interceptors.request.forEach(function(y) {
      typeof y.runWhen == "function" && y.runWhen(n) === !1 || (f = f && y.synchronous, a.unshift(y.fulfilled, y.rejected));
    });
    const l = [];
    this.interceptors.response.forEach(function(y) {
      l.push(y.fulfilled, y.rejected);
    });
    let u, d = 0, m;
    if (!f) {
      const p = [Je.bind(this), void 0];
      for (p.unshift(...a), p.push(...l), m = p.length, u = Promise.resolve(n); d < m; )
        u = u.then(p[d++], p[d++]);
      return u;
    }
    m = a.length;
    let g = n;
    for (d = 0; d < m; ) {
      const p = a[d++], y = a[d++];
      try {
        g = p(g);
      } catch (h) {
        y.call(this, h);
        break;
      }
    }
    try {
      u = Je.call(this, g);
    } catch (p) {
      return Promise.reject(p);
    }
    for (d = 0, m = l.length; d < m; )
      u = u.then(l[d++], l[d++]);
    return u;
  }
  getUri(t) {
    t = B(this.defaults, t);
    const n = Tt(t.baseURL, t.url, t.allowAbsoluteUrls);
    return gt(n, t.params, t.paramsSerializer);
  }
};
c.forEach(["delete", "get", "head", "options"], function(t) {
  I.prototype[t] = function(n, r) {
    return this.request(B(r || {}, {
      method: t,
      url: n,
      data: (r || {}).data
    }));
  };
});
c.forEach(["post", "put", "patch"], function(t) {
  function n(r) {
    return function(s, i, a) {
      return this.request(B(a || {}, {
        method: t,
        headers: r ? {
          "Content-Type": "multipart/form-data"
        } : {},
        url: s,
        data: i
      }));
    };
  }
  I.prototype[t] = n(), I.prototype[t + "Form"] = n(!0);
});
let br = class kt {
  constructor(t) {
    if (typeof t != "function")
      throw new TypeError("executor must be a function.");
    let n;
    this.promise = new Promise(function(s) {
      n = s;
    });
    const r = this;
    this.promise.then((o) => {
      if (!r._listeners) return;
      let s = r._listeners.length;
      for (; s-- > 0; )
        r._listeners[s](o);
      r._listeners = null;
    }), this.promise.then = (o) => {
      let s;
      const i = new Promise((a) => {
        r.subscribe(a), s = a;
      }).then(o);
      return i.cancel = function() {
        r.unsubscribe(s);
      }, i;
    }, t(function(s, i, a) {
      r.reason || (r.reason = new M(s, i, a), n(r.reason));
    });
  }
  /**
   * Throws a `CanceledError` if cancellation has been requested.
   */
  throwIfRequested() {
    if (this.reason)
      throw this.reason;
  }
  /**
   * Subscribe to the cancel signal
   */
  subscribe(t) {
    if (this.reason) {
      t(this.reason);
      return;
    }
    this._listeners ? this._listeners.push(t) : this._listeners = [t];
  }
  /**
   * Unsubscribe from the cancel signal
   */
  unsubscribe(t) {
    if (!this._listeners)
      return;
    const n = this._listeners.indexOf(t);
    n !== -1 && this._listeners.splice(n, 1);
  }
  toAbortSignal() {
    const t = new AbortController(), n = (r) => {
      t.abort(r);
    };
    return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
  }
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */
  static source() {
    let t;
    return {
      token: new kt(function(o) {
        t = o;
      }),
      cancel: t
    };
  }
};
function Er(e) {
  return function(n) {
    return e.apply(null, n);
  };
}
function Rr(e) {
  return c.isObject(e) && e.isAxiosError === !0;
}
const Se = {
  Continue: 100,
  SwitchingProtocols: 101,
  Processing: 102,
  EarlyHints: 103,
  Ok: 200,
  Created: 201,
  Accepted: 202,
  NonAuthoritativeInformation: 203,
  NoContent: 204,
  ResetContent: 205,
  PartialContent: 206,
  MultiStatus: 207,
  AlreadyReported: 208,
  ImUsed: 226,
  MultipleChoices: 300,
  MovedPermanently: 301,
  Found: 302,
  SeeOther: 303,
  NotModified: 304,
  UseProxy: 305,
  Unused: 306,
  TemporaryRedirect: 307,
  PermanentRedirect: 308,
  BadRequest: 400,
  Unauthorized: 401,
  PaymentRequired: 402,
  Forbidden: 403,
  NotFound: 404,
  MethodNotAllowed: 405,
  NotAcceptable: 406,
  ProxyAuthenticationRequired: 407,
  RequestTimeout: 408,
  Conflict: 409,
  Gone: 410,
  LengthRequired: 411,
  PreconditionFailed: 412,
  PayloadTooLarge: 413,
  UriTooLong: 414,
  UnsupportedMediaType: 415,
  RangeNotSatisfiable: 416,
  ExpectationFailed: 417,
  ImATeapot: 418,
  MisdirectedRequest: 421,
  UnprocessableEntity: 422,
  Locked: 423,
  FailedDependency: 424,
  TooEarly: 425,
  UpgradeRequired: 426,
  PreconditionRequired: 428,
  TooManyRequests: 429,
  RequestHeaderFieldsTooLarge: 431,
  UnavailableForLegalReasons: 451,
  InternalServerError: 500,
  NotImplemented: 501,
  BadGateway: 502,
  ServiceUnavailable: 503,
  GatewayTimeout: 504,
  HttpVersionNotSupported: 505,
  VariantAlsoNegotiates: 506,
  InsufficientStorage: 507,
  LoopDetected: 508,
  NotExtended: 510,
  NetworkAuthenticationRequired: 511
};
Object.entries(Se).forEach(([e, t]) => {
  Se[t] = e;
});
function Pt(e) {
  const t = new I(e), n = it(I.prototype.request, t);
  return c.extend(n, I.prototype, t, { allOwnKeys: !0 }), c.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
    return Pt(B(e, o));
  }, n;
}
const b = Pt(Q);
b.Axios = I;
b.CanceledError = M;
b.CancelToken = br;
b.isCancel = Rt;
b.VERSION = Ct;
b.toFormData = ue;
b.AxiosError = w;
b.Cancel = b.CanceledError;
b.all = function(t) {
  return Promise.all(t);
};
b.spread = Er;
b.isAxiosError = Rr;
b.mergeConfig = B;
b.AxiosHeaders = _;
b.formToJSON = (e) => Et(c.isHTMLForm(e) ? new FormData(e) : e);
b.getAdapter = xt.getAdapter;
b.HttpStatusCode = Se;
b.default = b;
const {
  Axios: to,
  AxiosError: no,
  CanceledError: ro,
  isCancel: oo,
  CancelToken: so,
  VERSION: io,
  all: ao,
  Cancel: co,
  isAxiosError: uo,
  spread: lo,
  toFormData: fo,
  AxiosHeaders: po,
  HttpStatusCode: ho,
  formToJSON: mo,
  getAdapter: yo,
  mergeConfig: wo
} = b;
/*! js-cookie v3.0.5 | MIT */
function G(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t];
    for (var r in n)
      e[r] = n[r];
  }
  return e;
}
var Sr = {
  read: function(e) {
    return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
  },
  write: function(e) {
    return encodeURIComponent(e).replace(
      /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
      decodeURIComponent
    );
  }
};
function Te(e, t) {
  function n(o, s, i) {
    if (!(typeof document > "u")) {
      i = G({}, t, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
      var a = "";
      for (var f in i)
        i[f] && (a += "; " + f, i[f] !== !0 && (a += "=" + i[f].split(";")[0]));
      return document.cookie = o + "=" + e.write(s, o) + a;
    }
  }
  function r(o) {
    if (!(typeof document > "u" || arguments.length && !o)) {
      for (var s = document.cookie ? document.cookie.split("; ") : [], i = {}, a = 0; a < s.length; a++) {
        var f = s[a].split("="), l = f.slice(1).join("=");
        try {
          var u = decodeURIComponent(f[0]);
          if (i[u] = e.read(l, u), o === u)
            break;
        } catch {
        }
      }
      return o ? i[o] : i;
    }
  }
  return Object.create(
    {
      set: n,
      get: r,
      remove: function(o, s) {
        n(
          o,
          "",
          G({}, s, {
            expires: -1
          })
        );
      },
      withAttributes: function(o) {
        return Te(this.converter, G({}, this.attributes, o));
      },
      withConverter: function(o) {
        return Te(G({}, this.converter, o), this.attributes);
      }
    },
    {
      attributes: { value: Object.freeze(t) },
      converter: { value: Object.freeze(e) }
    }
  );
}
var Tr = Te(Sr, { path: "/" }), We;
const Lt = typeof window < "u", Or = (e) => typeof e == "string", Ke = () => +Date.now(), Oe = () => {
};
Lt && ((We = window == null ? void 0 : window.navigator) != null && We.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Ue(e) {
  return typeof e == "function" ? e() : vt(e);
}
function Ar(e, t) {
  function n(...r) {
    return new Promise((o, s) => {
      Promise.resolve(e(() => t.apply(this, r), { fn: t, thisArg: this, args: r })).then(o).catch(s);
    });
  }
  return n;
}
function _r(e, t = !0, n = !0, r = !1) {
  let o = 0, s, i = !0, a = Oe, f;
  const l = () => {
    s && (clearTimeout(s), s = void 0, a(), a = Oe);
  };
  return (d) => {
    const m = Ue(e), g = Date.now() - o, p = () => f = d();
    return l(), m <= 0 ? (o = Date.now(), p()) : (g > m && (n || !i) ? (o = Date.now(), p()) : t && (f = new Promise((y, h) => {
      a = r ? h : y, s = setTimeout(() => {
        o = Date.now(), i = !0, y(p()), l();
      }, Math.max(0, m - g));
    })), !n && !s && (s = setTimeout(() => i = !0, m)), i = !1, f);
  };
}
function xr(e) {
  return e;
}
function Cr(e) {
  return Bt() ? (jt(e), !0) : !1;
}
function kr(e) {
  var t;
  const n = Ue(e);
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
}
const Ut = Lt ? window : void 0;
function Qe(...e) {
  let t, n, r, o;
  if (Or(e[0]) || Array.isArray(e[0]) ? ([n, r, o] = e, t = Ut) : [t, n, r, o] = e, !t)
    return Oe;
  Array.isArray(n) || (n = [n]), Array.isArray(r) || (r = [r]);
  const s = [], i = () => {
    s.forEach((u) => u()), s.length = 0;
  }, a = (u, d, m, g) => (u.addEventListener(d, m, g), () => u.removeEventListener(d, m, g)), f = xe(() => [kr(t), Ue(o)], ([u, d]) => {
    i(), u && s.push(...n.flatMap((m) => r.map((g) => a(u, m, g, d))));
  }, { immediate: !0, flush: "post" }), l = () => {
    f(), i();
  };
  return Cr(l), l;
}
const Xe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ge = "__vueuse_ssr_handlers__";
Xe[Ge] = Xe[Ge] || {};
const Pr = ["mousemove", "mousedown", "resize", "keydown", "touchstart", "wheel"], Lr = 6e4;
function Ur(e = Lr, t = {}) {
  const {
    initialState: n = !1,
    listenForVisibilityChange: r = !0,
    events: o = Pr,
    window: s = Ut,
    eventFilter: i = _r(50)
  } = t, a = ne(n), f = ne(Ke());
  let l;
  const u = Ar(i, () => {
    a.value = !1, f.value = Ke(), clearTimeout(l), l = setTimeout(() => a.value = !0, e);
  });
  if (s) {
    const d = s.document;
    for (const m of o)
      Qe(s, m, u, { passive: !0 });
    r && Qe(d, "visibilitychange", () => {
      d.hidden || u();
    });
  }
  return l = setTimeout(() => a.value = !0, e), { idle: a, lastActive: f };
}
var Ze;
(function(e) {
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
})(Ze || (Ze = {}));
var Nr = Object.defineProperty, Ye = Object.getOwnPropertySymbols, Fr = Object.prototype.hasOwnProperty, Dr = Object.prototype.propertyIsEnumerable, et = (e, t, n) => t in e ? Nr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Ir = (e, t) => {
  for (var n in t || (t = {}))
    Fr.call(t, n) && et(e, n, t[n]);
  if (Ye)
    for (var n of Ye(t))
      Dr.call(t, n) && et(e, n, t[n]);
  return e;
};
const vr = {
  easeInSine: [0.12, 0, 0.39, 0],
  easeOutSine: [0.61, 1, 0.88, 1],
  easeInOutSine: [0.37, 0, 0.63, 1],
  easeInQuad: [0.11, 0, 0.5, 0],
  easeOutQuad: [0.5, 1, 0.89, 1],
  easeInOutQuad: [0.45, 0, 0.55, 1],
  easeInCubic: [0.32, 0, 0.67, 0],
  easeOutCubic: [0.33, 1, 0.68, 1],
  easeInOutCubic: [0.65, 0, 0.35, 1],
  easeInQuart: [0.5, 0, 0.75, 0],
  easeOutQuart: [0.25, 1, 0.5, 1],
  easeInOutQuart: [0.76, 0, 0.24, 1],
  easeInQuint: [0.64, 0, 0.78, 0],
  easeOutQuint: [0.22, 1, 0.36, 1],
  easeInOutQuint: [0.83, 0, 0.17, 1],
  easeInExpo: [0.7, 0, 0.84, 0],
  easeOutExpo: [0.16, 1, 0.3, 1],
  easeInOutExpo: [0.87, 0, 0.13, 1],
  easeInCirc: [0.55, 0, 1, 0.45],
  easeOutCirc: [0, 0.55, 0.45, 1],
  easeInOutCirc: [0.85, 0, 0.15, 1],
  easeInBack: [0.36, 0, 0.66, -0.56],
  easeOutBack: [0.34, 1.56, 0.64, 1],
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
Ir({
  linear: xr
}, vr);
let Ae;
const Nt = { triggerProxySso: "triggerProxySso" }, Br = () => {
  Ae = (e) => {
    var n;
    const { origin: t } = new URL(location.href);
    (n = window.top) == null || n.postMessage(
      { type: Nt.triggerProxySso, data: { ...e || {}, redirect_uri: `${t}/` } },
      t
    );
  };
}, jr = (e) => {
  window.top === window.self && window.addEventListener("message", (t) => {
    const { type: n, data: r } = t.data;
    n === Nt.triggerProxySso && (e == null || e(r));
  });
};
window.top !== window.self && Br();
let Ft = (e = 21) => {
  let t = "", n = crypto.getRandomValues(new Uint8Array(e));
  for (; e--; ) {
    let r = n[e] & 63;
    r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r < 63 ? t += "_" : t += "-";
  }
  return t;
};
const L = (e) => new URL(location.href).searchParams.get(e), _e = (e) => {
  const t = new URL(window.location.href), n = new URLSearchParams(t.search);
  e.forEach((r) => {
    n.delete(r);
  }), t.search = n.toString(), window.history.replaceState({}, "", t);
}, { baseURL: tt } = se(), nt = {
  feishu: {
    login: "/api/justauth/client/v1/visitor/feishu/login",
    ssoParam: "/api/justauth/client/v1/visitor/sso-param"
  }
}, qr = async () => {
  const e = L("authorizer") || "", t = L("_redirect_url") || "";
  if (_e(["authorizer", "_redirect_url"]), e === "feishu") {
    if (!window.tt) return "";
    const n = async () => {
      const r = nt.feishu.ssoParam;
      return (await b.create().get(r, {
        baseURL: tt,
        params: {
          source: "feishu",
          fieldKey: "appId"
        }
      })).data || "";
    };
    return new Promise(async (r) => {
      const o = async (a) => {
        try {
          const f = nt.feishu.login, l = Ce(t, { ignoreAuth: !0 }), d = (await b.create().get(f, { baseURL: tt, params: { code: a, _redirect_url: l } })).request.responseURL;
          location.replace(d), r();
        } catch {
          v({ ...N, redirect_uri: U }), r();
        }
      }, s = await n(), i = () => {
        window.tt.requestAuthCode({
          appId: s,
          success: (a) => {
            const { code: f } = a;
            o(f);
          },
          fail: (a) => {
            v({ ...N, redirect_uri: U }), r();
          }
        });
      };
      window.tt.requestAccess ? window.tt.requestAccess({
        appID: s,
        scopeList: [],
        success: (a) => {
          const { code: f } = a;
          o(f);
        },
        fail: (a) => {
          const { errno: f } = a;
          f === 103 ? i() : (v({ ...N, redirect_uri: U }), r());
        }
      }) : i();
    });
  }
}, j = {
  oauth: "/api/justauth/oauth-server/v1/visitor/oauth/authorize",
  // 重定向到登录页
  logoutCurpage: "/api/justauth/oauth-server/v1/visitor/logout-curpage",
  // 清除登录信息
  token: "/api/justauth/oauth-server/v1/visitor/oauth/token"
  // 通过code获取token
}, { baseURL: rt, noRedireLogin: Mr = !1 } = se(), U = location.origin + "/home", N = {
  response_type: "code",
  scope: "sever",
  client_id: "sys",
  client_secret: qt("das123"),
  state: +/* @__PURE__ */ new Date()
}, Dt = ne(!1), It = (e) => {
  if (e <= 0) return;
  const { idle: t } = Ur(e);
  xe(
    () => t.value,
    (n) => {
      n === !0 && (Dt.value = !0);
    }
  );
};
localStorage.getItem("idelTime") && It(Number(localStorage.getItem("idelTime")));
let ot = "";
const Hr = async () => {
  const e = L("code") || "", t = L("redirect_url") || "/", n = L("kingdee_token") || "", r = L("loginType") || "";
  if (r && localStorage.setItem("loginType", r), !e) return $();
  const o = ["code", "state", "kingdee_token", "redirect_url", "source"];
  if (e === ot)
    return _e(o), window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t)), $();
  ot = e, _e(o);
  let s = {};
  const i = {
    grant_type: "authorization_code",
    code: e,
    client_id: N.client_id,
    client_secret: N.client_secret,
    redirect_uri: r ? Ce(U, { loginType: r }) : U,
    timestamp: (/* @__PURE__ */ new Date()).getTime(),
    nonce: Ft()
  };
  n && (sessionStorage.setItem("kingdee_token", n), i.redirect_uri = `${i.redirect_uri}?kingdee_token=${n}`);
  try {
    await b.create().get(j.token, { baseURL: rt });
  } catch {
  }
  try {
    s = await b.create().post(
      j.token,
      {},
      {
        baseURL: rt,
        params: i,
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
          "csrf-token": Tr.get("csrf-token")
        }
      }
    );
    const { access_token: a = "", refresh_token: f = "", exp: l = 0, refresh_exp: u = 0 } = s.data, d = {
      accessToken: a,
      accessTokenExpiredAt: Number(l),
      refreshToken: f,
      info: s.data
    };
    J().save(d), await st(a);
    const m = Number(u) - (/* @__PURE__ */ new Date()).getTime();
    return m && m > 0 && (It(m), m && localStorage.setItem("idelTime", m.toString())), t && (window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t))), a;
  } catch {
    return v({ ...N, redirect_uri: U });
  }
}, Z = ne(!1), go = async (e) => {
  if (e.public) return "";
  if (Dt.value)
    return v({ ...N, redirect_uri: U });
  if (Z.value)
    return await new Promise(async (r) => {
      xe(
        () => Z.value,
        (o) => {
          if (!o) {
            const s = $();
            r(s);
          }
        }
      );
    });
  let t = $();
  const { accessTokenExpiredAt: n = 0 } = J().getData();
  Z.value = !0;
  try {
    const r = L("code") || "";
    if ((L("authorizer") || "") === "feishu")
      await qr();
    else if (r)
      t = await Hr();
    else {
      const s = Date.now() + 6e4;
      n > 0 && s > n && (t = await Jr(N));
    }
  } catch {
  } finally {
    Z.value = !1;
  }
  return t;
}, $r = () => {
  let e = !1;
  return localStorage.getItem("thirdLogouSource") === "zhongshen" && (e = !0), e;
}, zr = (e) => {
  if (localStorage.getItem("thirdLogouSource") === "zhongshen") {
    const r = `https://iam.shenyejituan.com:443/idp/profile/OAUTH2/Redirect/GLO?redirctToUrl=${encodeURIComponent(e)}&entityId=AIoT&redirectToLogin=true`;
    localStorage.removeItem("thirdLogouSource"), location.href = r;
  }
};
let ye = !1;
const v = (e) => {
  if (!Mr && !ye) {
    ye = !0;
    try {
      const t = { ...e }, n = localStorage.getItem("loginType") || "";
      n && (t.redirect_uri = Ce(t.redirect_uri, { loginType: n }));
      const { baseURL: r, ssoLocale: o } = se();
      if (Ae) return Ae(t);
      t.logout = "true", o && (t.locale = "locale");
      const s = new URLSearchParams();
      Object.entries(t).forEach(([f, l]) => {
        f !== "client_secret" && s.set(f, String(l));
      });
      const i = s.toString(), a = `${r}${j.oauth}?${i}`;
      if (localStorage.removeItem("idelTime"), sessionStorage.clear(), J().remove(), $r())
        zr(a);
      else {
        try {
          b.create().get(j.logoutCurpage, { baseURL: r });
        } catch {
        }
        window.__isAutoCloseApp = !1, location.replace(a);
      }
    } finally {
      ye = !1;
    }
  }
};
jr(v);
const Jr = async (e) => {
  const { baseURL: t } = se(), { refreshToken: n } = J().getData();
  try {
    await b.create().get(j.token, { baseURL: t });
  } catch {
  }
  try {
    const r = await b.create().post(
      j.token,
      {},
      {
        baseURL: t,
        params: {
          refresh_token: n,
          grant_type: "refresh_token",
          client_id: e.client_id,
          client_secret: e.client_secret,
          timestamp: (/* @__PURE__ */ new Date()).getTime(),
          nonce: Ft()
        }
      }
    ), { access_token: o = "", refresh_token: s = "", exp: i = 0 } = r.data, a = {
      accessToken: o,
      accessTokenExpiredAt: Number(i),
      refreshToken: s,
      info: r.data
    };
    return J().save(a), await st(o), o;
  } catch {
    return v({ ...e, redirect_uri: U });
  }
}, J = () => ({
  getData: () => ({
    accessToken: $(),
    accessTokenExpiredAt: de("accessTokenExpiredAt") ? Number(de("accessTokenExpiredAt")) : 0,
    refreshToken: de("refreshToken")
  }),
  save: (e) => {
    Ht(e.accessToken ?? "", {
      accessTokenExpiredAt: e.accessTokenExpiredAt,
      refreshToken: e.refreshToken
    }), zt(e);
  },
  remove: () => {
    Mt(), $t();
  }
});
export {
  L as getQuery,
  go as getToken,
  Hr as getTokenFromCode,
  N as getTokenParams,
  v as login,
  U as real_uri,
  Jr as refreshToken,
  J as tokenStorage
};
