var $ = Object.defineProperty;
var H = (r, e, n) => e in r ? $(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
var C = (r, e, n) => H(r, typeof e != "symbol" ? e + "" : e, n);
function bind(r, e) {
  return function() {
    return r.apply(e, arguments);
  };
}
const { toString: toString$1 } = Object.prototype, { getPrototypeOf } = Object, kindOf = /* @__PURE__ */ ((r) => (e) => {
  const n = toString$1.call(e);
  return r[n] || (r[n] = n.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), kindOfTest = (r) => (r = r.toLowerCase(), (e) => kindOf(e) === r), typeOfTest = (r) => (e) => typeof e === r, { isArray } = Array, isUndefined = typeOfTest("undefined");
function isBuffer(r) {
  return r !== null && !isUndefined(r) && r.constructor !== null && !isUndefined(r.constructor) && isFunction(r.constructor.isBuffer) && r.constructor.isBuffer(r);
}
const isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(r) {
  let e;
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(r) : e = r && r.buffer && isArrayBuffer(r.buffer), e;
}
const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (r) => r !== null && typeof r == "object", isBoolean = (r) => r === !0 || r === !1, isPlainObject = (r) => {
  if (kindOf(r) !== "object")
    return !1;
  const e = getPrototypeOf(r);
  return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Symbol.toStringTag in r) && !(Symbol.iterator in r);
}, isDate = kindOfTest("Date"), isFile = kindOfTest("File"), isBlob = kindOfTest("Blob"), isFileList = kindOfTest("FileList"), isStream = (r) => isObject(r) && isFunction(r.pipe), isFormData = (r) => {
  let e;
  return r && (typeof FormData == "function" && r instanceof FormData || isFunction(r.append) && ((e = kindOf(r)) === "formdata" || // detect form-data instance
  e === "object" && isFunction(r.toString) && r.toString() === "[object FormData]"));
}, isURLSearchParams = kindOfTest("URLSearchParams"), [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest), trim = (r) => r.trim ? r.trim() : r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach(r, e, { allOwnKeys: n = !1 } = {}) {
  if (r === null || typeof r > "u")
    return;
  let i, s;
  if (typeof r != "object" && (r = [r]), isArray(r))
    for (i = 0, s = r.length; i < s; i++)
      e.call(null, r[i], i, r);
  else {
    const o = n ? Object.getOwnPropertyNames(r) : Object.keys(r), a = o.length;
    let u;
    for (i = 0; i < a; i++)
      u = o[i], e.call(null, r[u], u, r);
  }
}
function findKey(r, e) {
  e = e.toLowerCase();
  const n = Object.keys(r);
  let i = n.length, s;
  for (; i-- > 0; )
    if (s = n[i], e === s.toLowerCase())
      return s;
  return null;
}
const _global = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, isContextDefined = (r) => !isUndefined(r) && r !== _global;
function merge() {
  const { caseless: r } = isContextDefined(this) && this || {}, e = {}, n = (i, s) => {
    const o = r && findKey(e, s) || s;
    isPlainObject(e[o]) && isPlainObject(i) ? e[o] = merge(e[o], i) : isPlainObject(i) ? e[o] = merge({}, i) : isArray(i) ? e[o] = i.slice() : e[o] = i;
  };
  for (let i = 0, s = arguments.length; i < s; i++)
    arguments[i] && forEach(arguments[i], n);
  return e;
}
const extend = (r, e, n, { allOwnKeys: i } = {}) => (forEach(e, (s, o) => {
  n && isFunction(s) ? r[o] = bind(s, n) : r[o] = s;
}, { allOwnKeys: i }), r), stripBOM = (r) => (r.charCodeAt(0) === 65279 && (r = r.slice(1)), r), inherits = (r, e, n, i) => {
  r.prototype = Object.create(e.prototype, i), r.prototype.constructor = r, Object.defineProperty(r, "super", {
    value: e.prototype
  }), n && Object.assign(r.prototype, n);
}, toFlatObject = (r, e, n, i) => {
  let s, o, a;
  const u = {};
  if (e = e || {}, r == null) return e;
  do {
    for (s = Object.getOwnPropertyNames(r), o = s.length; o-- > 0; )
      a = s[o], (!i || i(a, r, e)) && !u[a] && (e[a] = r[a], u[a] = !0);
    r = n !== !1 && getPrototypeOf(r);
  } while (r && (!n || n(r, e)) && r !== Object.prototype);
  return e;
}, endsWith = (r, e, n) => {
  r = String(r), (n === void 0 || n > r.length) && (n = r.length), n -= e.length;
  const i = r.indexOf(e, n);
  return i !== -1 && i === n;
}, toArray = (r) => {
  if (!r) return null;
  if (isArray(r)) return r;
  let e = r.length;
  if (!isNumber(e)) return null;
  const n = new Array(e);
  for (; e-- > 0; )
    n[e] = r[e];
  return n;
}, isTypedArray = /* @__PURE__ */ ((r) => (e) => r && e instanceof r)(typeof Uint8Array < "u" && getPrototypeOf(Uint8Array)), forEachEntry = (r, e) => {
  const i = (r && r[Symbol.iterator]).call(r);
  let s;
  for (; (s = i.next()) && !s.done; ) {
    const o = s.value;
    e.call(r, o[0], o[1]);
  }
}, matchAll = (r, e) => {
  let n;
  const i = [];
  for (; (n = r.exec(e)) !== null; )
    i.push(n);
  return i;
}, isHTMLForm = kindOfTest("HTMLFormElement"), toCamelCase = (r) => r.toLowerCase().replace(
  /[-_\s]([a-z\d])(\w*)/g,
  function(n, i, s) {
    return i.toUpperCase() + s;
  }
), hasOwnProperty$1 = (({ hasOwnProperty: r }) => (e, n) => r.call(e, n))(Object.prototype), isRegExp = kindOfTest("RegExp"), reduceDescriptors = (r, e) => {
  const n = Object.getOwnPropertyDescriptors(r), i = {};
  forEach(n, (s, o) => {
    let a;
    (a = e(s, o, r)) !== !1 && (i[o] = a || s);
  }), Object.defineProperties(r, i);
}, freezeMethods = (r) => {
  reduceDescriptors(r, (e, n) => {
    if (isFunction(r) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
      return !1;
    const i = r[n];
    if (isFunction(i)) {
      if (e.enumerable = !1, "writable" in e) {
        e.writable = !1;
        return;
      }
      e.set || (e.set = () => {
        throw Error("Can not rewrite read-only method '" + n + "'");
      });
    }
  });
}, toObjectSet = (r, e) => {
  const n = {}, i = (s) => {
    s.forEach((o) => {
      n[o] = !0;
    });
  };
  return isArray(r) ? i(r) : i(String(r).split(e)), n;
}, noop = () => {
}, toFiniteNumber = (r, e) => r != null && Number.isFinite(r = +r) ? r : e, ALPHA = "abcdefghijklmnopqrstuvwxyz", DIGIT = "0123456789", ALPHABET = {
  DIGIT,
  ALPHA,
  ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
}, generateString = (r = 16, e = ALPHABET.ALPHA_DIGIT) => {
  let n = "";
  const { length: i } = e;
  for (; r--; )
    n += e[Math.random() * i | 0];
  return n;
};
function isSpecCompliantForm(r) {
  return !!(r && isFunction(r.append) && r[Symbol.toStringTag] === "FormData" && r[Symbol.iterator]);
}
const toJSONObject = (r) => {
  const e = new Array(10), n = (i, s) => {
    if (isObject(i)) {
      if (e.indexOf(i) >= 0)
        return;
      if (!("toJSON" in i)) {
        e[s] = i;
        const o = isArray(i) ? [] : {};
        return forEach(i, (a, u) => {
          const l = n(a, s + 1);
          !isUndefined(l) && (o[u] = l);
        }), e[s] = void 0, o;
      }
    }
    return i;
  };
  return n(r, 0);
}, isAsyncFn = kindOfTest("AsyncFunction"), isThenable = (r) => r && (isObject(r) || isFunction(r)) && isFunction(r.then) && isFunction(r.catch), _setImmediate = ((r, e) => r ? setImmediate : e ? ((n, i) => (_global.addEventListener("message", ({ source: s, data: o }) => {
  s === _global && o === n && i.length && i.shift()();
}, !1), (s) => {
  i.push(s), _global.postMessage(n, "*");
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
  typeof setImmediate == "function",
  isFunction(_global.postMessage)
), asap = typeof queueMicrotask < "u" ? queueMicrotask.bind(_global) : typeof process < "u" && process.nextTick || _setImmediate, utils$1 = {
  isArray,
  isArrayBuffer,
  isBuffer,
  isFormData,
  isArrayBufferView,
  isString,
  isNumber,
  isBoolean,
  isObject,
  isPlainObject,
  isReadableStream,
  isRequest,
  isResponse,
  isHeaders,
  isUndefined,
  isDate,
  isFile,
  isBlob,
  isRegExp,
  isFunction,
  isStream,
  isURLSearchParams,
  isTypedArray,
  isFileList,
  forEach,
  merge,
  extend,
  trim,
  stripBOM,
  inherits,
  toFlatObject,
  kindOf,
  kindOfTest,
  endsWith,
  toArray,
  forEachEntry,
  matchAll,
  isHTMLForm,
  hasOwnProperty: hasOwnProperty$1,
  hasOwnProp: hasOwnProperty$1,
  // an alias to avoid ESLint no-prototype-builtins detection
  reduceDescriptors,
  freezeMethods,
  toObjectSet,
  toCamelCase,
  noop,
  toFiniteNumber,
  findKey,
  global: _global,
  isContextDefined,
  ALPHABET,
  generateString,
  isSpecCompliantForm,
  toJSONObject,
  isAsyncFn,
  isThenable,
  setImmediate: _setImmediate,
  asap
};
function AxiosError$1(r, e, n, i, s) {
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = r, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), i && (this.request = i), s && (this.response = s, this.status = s.status ? s.status : null);
}
utils$1.inherits(AxiosError$1, 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: utils$1.toJSONObject(this.config),
      code: this.code,
      status: this.status
    };
  }
});
const prototype$1 = AxiosError$1.prototype, descriptors = {};
[
  "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((r) => {
  descriptors[r] = { value: r };
});
Object.defineProperties(AxiosError$1, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: !0 });
AxiosError$1.from = (r, e, n, i, s, o) => {
  const a = Object.create(prototype$1);
  return utils$1.toFlatObject(r, a, function(l) {
    return l !== Error.prototype;
  }, (u) => u !== "isAxiosError"), AxiosError$1.call(a, r.message, e, n, i, s), a.cause = r, a.name = r.name, o && Object.assign(a, o), a;
};
const httpAdapter = null;
function isVisitable(r) {
  return utils$1.isPlainObject(r) || utils$1.isArray(r);
}
function removeBrackets(r) {
  return utils$1.endsWith(r, "[]") ? r.slice(0, -2) : r;
}
function renderKey(r, e, n) {
  return r ? r.concat(e).map(function(s, o) {
    return s = removeBrackets(s), !n && o ? "[" + s + "]" : s;
  }).join(n ? "." : "") : e;
}
function isFlatArray(r) {
  return utils$1.isArray(r) && !r.some(isVisitable);
}
const predicates = utils$1.toFlatObject(utils$1, {}, null, function(e) {
  return /^is[A-Z]/.test(e);
});
function toFormData$1(r, e, n) {
  if (!utils$1.isObject(r))
    throw new TypeError("target must be an object");
  e = e || new FormData(), n = utils$1.toFlatObject(n, {
    metaTokens: !0,
    dots: !1,
    indexes: !1
  }, !1, function(v, y) {
    return !utils$1.isUndefined(y[v]);
  });
  const i = n.metaTokens, s = n.visitor || d, o = n.dots, a = n.indexes, l = (n.Blob || typeof Blob < "u" && Blob) && utils$1.isSpecCompliantForm(e);
  if (!utils$1.isFunction(s))
    throw new TypeError("visitor must be a function");
  function p(m) {
    if (m === null) return "";
    if (utils$1.isDate(m))
      return m.toISOString();
    if (!l && utils$1.isBlob(m))
      throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
    return utils$1.isArrayBuffer(m) || utils$1.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
  }
  function d(m, v, y) {
    let T = m;
    if (m && !y && typeof m == "object") {
      if (utils$1.endsWith(v, "{}"))
        v = i ? v : v.slice(0, -2), m = JSON.stringify(m);
      else if (utils$1.isArray(m) && isFlatArray(m) || (utils$1.isFileList(m) || utils$1.endsWith(v, "[]")) && (T = utils$1.toArray(m)))
        return v = removeBrackets(v), T.forEach(function(R, D) {
          !(utils$1.isUndefined(R) || R === null) && e.append(
            // eslint-disable-next-line no-nested-ternary
            a === !0 ? renderKey([v], D, o) : a === null ? v : v + "[]",
            p(R)
          );
        }), !1;
    }
    return isVisitable(m) ? !0 : (e.append(renderKey(y, v, o), p(m)), !1);
  }
  const g = [], b = Object.assign(predicates, {
    defaultVisitor: d,
    convertValue: p,
    isVisitable
  });
  function S(m, v) {
    if (!utils$1.isUndefined(m)) {
      if (g.indexOf(m) !== -1)
        throw Error("Circular reference detected in " + v.join("."));
      g.push(m), utils$1.forEach(m, function(T, E) {
        (!(utils$1.isUndefined(T) || T === null) && s.call(
          e,
          T,
          utils$1.isString(E) ? E.trim() : E,
          v,
          b
        )) === !0 && S(T, v ? v.concat(E) : [E]);
      }), g.pop();
    }
  }
  if (!utils$1.isObject(r))
    throw new TypeError("data must be an object");
  return S(r), e;
}
function encode$1(r) {
  const e = {
    "!": "%21",
    "'": "%27",
    "(": "%28",
    ")": "%29",
    "~": "%7E",
    "%20": "+",
    "%00": "\0"
  };
  return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g, function(i) {
    return e[i];
  });
}
function AxiosURLSearchParams(r, e) {
  this._pairs = [], r && toFormData$1(r, this, e);
}
const prototype = AxiosURLSearchParams.prototype;
prototype.append = function(e, n) {
  this._pairs.push([e, n]);
};
prototype.toString = function(e) {
  const n = e ? function(i) {
    return e.call(this, i, encode$1);
  } : encode$1;
  return this._pairs.map(function(s) {
    return n(s[0]) + "=" + n(s[1]);
  }, "").join("&");
};
function encode(r) {
  return encodeURIComponent(r).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function buildURL(r, e, n) {
  if (!e)
    return r;
  const i = n && n.encode || encode;
  utils$1.isFunction(n) && (n = {
    serialize: n
  });
  const s = n && n.serialize;
  let o;
  if (s ? o = s(e, n) : o = utils$1.isURLSearchParams(e) ? e.toString() : new AxiosURLSearchParams(e, n).toString(i), o) {
    const a = r.indexOf("#");
    a !== -1 && (r = r.slice(0, a)), r += (r.indexOf("?") === -1 ? "?" : "&") + o;
  }
  return r;
}
class InterceptorManager {
  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(e, n, i) {
    return this.handlers.push({
      fulfilled: e,
      rejected: n,
      synchronous: i ? i.synchronous : !1,
      runWhen: i ? i.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(e) {
    this.handlers[e] && (this.handlers[e] = 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(e) {
    utils$1.forEach(this.handlers, function(i) {
      i !== null && e(i);
    });
  }
}
const transitionalDefaults = {
  silentJSONParsing: !0,
  forcedJSONParsing: !0,
  clarifyTimeoutError: !1
}, URLSearchParams$1 = typeof URLSearchParams < "u" ? URLSearchParams : AxiosURLSearchParams, FormData$1 = typeof FormData < "u" ? FormData : null, Blob$1 = typeof Blob < "u" ? Blob : null, platform$1 = {
  isBrowser: !0,
  classes: {
    URLSearchParams: URLSearchParams$1,
    FormData: FormData$1,
    Blob: Blob$1
  },
  protocols: ["http", "https", "file", "blob", "url", "data"]
}, hasBrowserEnv = typeof window < "u" && typeof document < "u", _navigator = typeof navigator == "object" && navigator || void 0, hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0), hasStandardBrowserWebWorkerEnv = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", origin = hasBrowserEnv && window.location.href || "http://localhost", utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  hasBrowserEnv,
  hasStandardBrowserEnv,
  hasStandardBrowserWebWorkerEnv,
  navigator: _navigator,
  origin
}, Symbol.toStringTag, { value: "Module" })), platform = {
  ...utils,
  ...platform$1
};
function toURLEncodedForm(r, e) {
  return toFormData$1(r, new platform.classes.URLSearchParams(), Object.assign({
    visitor: function(n, i, s, o) {
      return platform.isNode && utils$1.isBuffer(n) ? (this.append(i, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
    }
  }, e));
}
function parsePropPath(r) {
  return utils$1.matchAll(/\w+|\[(\w*)]/g, r).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
}
function arrayToObject(r) {
  const e = {}, n = Object.keys(r);
  let i;
  const s = n.length;
  let o;
  for (i = 0; i < s; i++)
    o = n[i], e[o] = r[o];
  return e;
}
function formDataToJSON(r) {
  function e(n, i, s, o) {
    let a = n[o++];
    if (a === "__proto__") return !0;
    const u = Number.isFinite(+a), l = o >= n.length;
    return a = !a && utils$1.isArray(s) ? s.length : a, l ? (utils$1.hasOwnProp(s, a) ? s[a] = [s[a], i] : s[a] = i, !u) : ((!s[a] || !utils$1.isObject(s[a])) && (s[a] = []), e(n, i, s[a], o) && utils$1.isArray(s[a]) && (s[a] = arrayToObject(s[a])), !u);
  }
  if (utils$1.isFormData(r) && utils$1.isFunction(r.entries)) {
    const n = {};
    return utils$1.forEachEntry(r, (i, s) => {
      e(parsePropPath(i), s, n, 0);
    }), n;
  }
  return null;
}
function stringifySafely(r, e, n) {
  if (utils$1.isString(r))
    try {
      return (e || JSON.parse)(r), utils$1.trim(r);
    } catch (i) {
      if (i.name !== "SyntaxError")
        throw i;
    }
  return (n || JSON.stringify)(r);
}
const defaults = {
  transitional: transitionalDefaults,
  adapter: ["xhr", "http", "fetch"],
  transformRequest: [function(e, n) {
    const i = n.getContentType() || "", s = i.indexOf("application/json") > -1, o = utils$1.isObject(e);
    if (o && utils$1.isHTMLForm(e) && (e = new FormData(e)), utils$1.isFormData(e))
      return s ? JSON.stringify(formDataToJSON(e)) : e;
    if (utils$1.isArrayBuffer(e) || utils$1.isBuffer(e) || utils$1.isStream(e) || utils$1.isFile(e) || utils$1.isBlob(e) || utils$1.isReadableStream(e))
      return e;
    if (utils$1.isArrayBufferView(e))
      return e.buffer;
    if (utils$1.isURLSearchParams(e))
      return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
    let u;
    if (o) {
      if (i.indexOf("application/x-www-form-urlencoded") > -1)
        return toURLEncodedForm(e, this.formSerializer).toString();
      if ((u = utils$1.isFileList(e)) || i.indexOf("multipart/form-data") > -1) {
        const l = this.env && this.env.FormData;
        return toFormData$1(
          u ? { "files[]": e } : e,
          l && new l(),
          this.formSerializer
        );
      }
    }
    return o || s ? (n.setContentType("application/json", !1), stringifySafely(e)) : e;
  }],
  transformResponse: [function(e) {
    const n = this.transitional || defaults.transitional, i = n && n.forcedJSONParsing, s = this.responseType === "json";
    if (utils$1.isResponse(e) || utils$1.isReadableStream(e))
      return e;
    if (e && utils$1.isString(e) && (i && !this.responseType || s)) {
      const a = !(n && n.silentJSONParsing) && s;
      try {
        return JSON.parse(e);
      } catch (u) {
        if (a)
          throw u.name === "SyntaxError" ? AxiosError$1.from(u, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response) : u;
      }
    }
    return e;
  }],
  /**
   * 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: platform.classes.FormData,
    Blob: platform.classes.Blob
  },
  validateStatus: function(e) {
    return e >= 200 && e < 300;
  },
  headers: {
    common: {
      Accept: "application/json, text/plain, */*",
      "Content-Type": void 0
    }
  }
};
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (r) => {
  defaults.headers[r] = {};
});
const ignoreDuplicateOf = utils$1.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"
]), parseHeaders = (r) => {
  const e = {};
  let n, i, s;
  return r && r.split(`
`).forEach(function(a) {
    s = a.indexOf(":"), n = a.substring(0, s).trim().toLowerCase(), i = a.substring(s + 1).trim(), !(!n || e[n] && ignoreDuplicateOf[n]) && (n === "set-cookie" ? e[n] ? e[n].push(i) : e[n] = [i] : e[n] = e[n] ? e[n] + ", " + i : i);
  }), e;
}, $internals = Symbol("internals");
function normalizeHeader(r) {
  return r && String(r).trim().toLowerCase();
}
function normalizeValue(r) {
  return r === !1 || r == null ? r : utils$1.isArray(r) ? r.map(normalizeValue) : String(r);
}
function parseTokens(r) {
  const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  let i;
  for (; i = n.exec(r); )
    e[i[1]] = i[2];
  return e;
}
const isValidHeaderName = (r) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());
function matchHeaderValue(r, e, n, i, s) {
  if (utils$1.isFunction(i))
    return i.call(this, e, n);
  if (s && (e = n), !!utils$1.isString(e)) {
    if (utils$1.isString(i))
      return e.indexOf(i) !== -1;
    if (utils$1.isRegExp(i))
      return i.test(e);
  }
}
function formatHeader(r) {
  return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, i) => n.toUpperCase() + i);
}
function buildAccessors(r, e) {
  const n = utils$1.toCamelCase(" " + e);
  ["get", "set", "has"].forEach((i) => {
    Object.defineProperty(r, i + n, {
      value: function(s, o, a) {
        return this[i].call(this, e, s, o, a);
      },
      configurable: !0
    });
  });
}
let AxiosHeaders$1 = class {
  constructor(e) {
    e && this.set(e);
  }
  set(e, n, i) {
    const s = this;
    function o(u, l, p) {
      const d = normalizeHeader(l);
      if (!d)
        throw new Error("header name must be a non-empty string");
      const g = utils$1.findKey(s, d);
      (!g || s[g] === void 0 || p === !0 || p === void 0 && s[g] !== !1) && (s[g || l] = normalizeValue(u));
    }
    const a = (u, l) => utils$1.forEach(u, (p, d) => o(p, d, l));
    if (utils$1.isPlainObject(e) || e instanceof this.constructor)
      a(e, n);
    else if (utils$1.isString(e) && (e = e.trim()) && !isValidHeaderName(e))
      a(parseHeaders(e), n);
    else if (utils$1.isHeaders(e))
      for (const [u, l] of e.entries())
        o(l, u, i);
    else
      e != null && o(n, e, i);
    return this;
  }
  get(e, n) {
    if (e = normalizeHeader(e), e) {
      const i = utils$1.findKey(this, e);
      if (i) {
        const s = this[i];
        if (!n)
          return s;
        if (n === !0)
          return parseTokens(s);
        if (utils$1.isFunction(n))
          return n.call(this, s, i);
        if (utils$1.isRegExp(n))
          return n.exec(s);
        throw new TypeError("parser must be boolean|regexp|function");
      }
    }
  }
  has(e, n) {
    if (e = normalizeHeader(e), e) {
      const i = utils$1.findKey(this, e);
      return !!(i && this[i] !== void 0 && (!n || matchHeaderValue(this, this[i], i, n)));
    }
    return !1;
  }
  delete(e, n) {
    const i = this;
    let s = !1;
    function o(a) {
      if (a = normalizeHeader(a), a) {
        const u = utils$1.findKey(i, a);
        u && (!n || matchHeaderValue(i, i[u], u, n)) && (delete i[u], s = !0);
      }
    }
    return utils$1.isArray(e) ? e.forEach(o) : o(e), s;
  }
  clear(e) {
    const n = Object.keys(this);
    let i = n.length, s = !1;
    for (; i--; ) {
      const o = n[i];
      (!e || matchHeaderValue(this, this[o], o, e, !0)) && (delete this[o], s = !0);
    }
    return s;
  }
  normalize(e) {
    const n = this, i = {};
    return utils$1.forEach(this, (s, o) => {
      const a = utils$1.findKey(i, o);
      if (a) {
        n[a] = normalizeValue(s), delete n[o];
        return;
      }
      const u = e ? formatHeader(o) : String(o).trim();
      u !== o && delete n[o], n[u] = normalizeValue(s), i[u] = !0;
    }), this;
  }
  concat(...e) {
    return this.constructor.concat(this, ...e);
  }
  toJSON(e) {
    const n = /* @__PURE__ */ Object.create(null);
    return utils$1.forEach(this, (i, s) => {
      i != null && i !== !1 && (n[s] = e && utils$1.isArray(i) ? i.join(", ") : i);
    }), n;
  }
  [Symbol.iterator]() {
    return Object.entries(this.toJSON())[Symbol.iterator]();
  }
  toString() {
    return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(`
`);
  }
  get [Symbol.toStringTag]() {
    return "AxiosHeaders";
  }
  static from(e) {
    return e instanceof this ? e : new this(e);
  }
  static concat(e, ...n) {
    const i = new this(e);
    return n.forEach((s) => i.set(s)), i;
  }
  static accessor(e) {
    const i = (this[$internals] = this[$internals] = {
      accessors: {}
    }).accessors, s = this.prototype;
    function o(a) {
      const u = normalizeHeader(a);
      i[u] || (buildAccessors(s, a), i[u] = !0);
    }
    return utils$1.isArray(e) ? e.forEach(o) : o(e), this;
  }
};
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: r }, e) => {
  let n = e[0].toUpperCase() + e.slice(1);
  return {
    get: () => r,
    set(i) {
      this[n] = i;
    }
  };
});
utils$1.freezeMethods(AxiosHeaders$1);
function transformData(r, e) {
  const n = this || defaults, i = e || n, s = AxiosHeaders$1.from(i.headers);
  let o = i.data;
  return utils$1.forEach(r, function(u) {
    o = u.call(n, o, s.normalize(), e ? e.status : void 0);
  }), s.normalize(), o;
}
function isCancel$1(r) {
  return !!(r && r.__CANCEL__);
}
function CanceledError$1(r, e, n) {
  AxiosError$1.call(this, r ?? "canceled", AxiosError$1.ERR_CANCELED, e, n), this.name = "CanceledError";
}
utils$1.inherits(CanceledError$1, AxiosError$1, {
  __CANCEL__: !0
});
function settle(r, e, n) {
  const i = n.config.validateStatus;
  !n.status || !i || i(n.status) ? r(n) : e(new AxiosError$1(
    "Request failed with status code " + n.status,
    [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
    n.config,
    n.request,
    n
  ));
}
function parseProtocol(r) {
  const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(r);
  return e && e[1] || "";
}
function speedometer(r, e) {
  r = r || 10;
  const n = new Array(r), i = new Array(r);
  let s = 0, o = 0, a;
  return e = e !== void 0 ? e : 1e3, function(l) {
    const p = Date.now(), d = i[o];
    a || (a = p), n[s] = l, i[s] = p;
    let g = o, b = 0;
    for (; g !== s; )
      b += n[g++], g = g % r;
    if (s = (s + 1) % r, s === o && (o = (o + 1) % r), p - a < e)
      return;
    const S = d && p - d;
    return S ? Math.round(b * 1e3 / S) : void 0;
  };
}
function throttle(r, e) {
  let n = 0, i = 1e3 / e, s, o;
  const a = (p, d = Date.now()) => {
    n = d, s = null, o && (clearTimeout(o), o = null), r.apply(null, p);
  };
  return [(...p) => {
    const d = Date.now(), g = d - n;
    g >= i ? a(p, d) : (s = p, o || (o = setTimeout(() => {
      o = null, a(s);
    }, i - g)));
  }, () => s && a(s)];
}
const progressEventReducer = (r, e, n = 3) => {
  let i = 0;
  const s = speedometer(50, 250);
  return throttle((o) => {
    const a = o.loaded, u = o.lengthComputable ? o.total : void 0, l = a - i, p = s(l), d = a <= u;
    i = a;
    const g = {
      loaded: a,
      total: u,
      progress: u ? a / u : void 0,
      bytes: l,
      rate: p || void 0,
      estimated: p && u && d ? (u - a) / p : void 0,
      event: o,
      lengthComputable: u != null,
      [e ? "download" : "upload"]: !0
    };
    r(g);
  }, n);
}, progressEventDecorator = (r, e) => {
  const n = r != null;
  return [(i) => e[0]({
    lengthComputable: n,
    total: r,
    loaded: i
  }), e[1]];
}, asyncDecorator = (r) => (...e) => utils$1.asap(() => r(...e)), isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, e) => (n) => (n = new URL(n, platform.origin), r.protocol === n.protocol && r.host === n.host && (e || r.port === n.port)))(
  new URL(platform.origin),
  platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => !0, cookies = platform.hasStandardBrowserEnv ? (
  // Standard browser envs support document.cookie
  {
    write(r, e, n, i, s, o) {
      const a = [r + "=" + encodeURIComponent(e)];
      utils$1.isNumber(n) && a.push("expires=" + new Date(n).toGMTString()), utils$1.isString(i) && a.push("path=" + i), utils$1.isString(s) && a.push("domain=" + s), o === !0 && a.push("secure"), document.cookie = a.join("; ");
    },
    read(r) {
      const e = document.cookie.match(new RegExp("(^|;\\s*)(" + r + ")=([^;]*)"));
      return e ? decodeURIComponent(e[3]) : null;
    },
    remove(r) {
      this.write(r, "", Date.now() - 864e5);
    }
  }
) : (
  // Non-standard browser env (web workers, react-native) lack needed support.
  {
    write() {
    },
    read() {
      return null;
    },
    remove() {
    }
  }
);
function isAbsoluteURL(r) {
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(r);
}
function combineURLs(r, e) {
  return e ? r.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : r;
}
function buildFullPath(r, e) {
  return r && !isAbsoluteURL(e) ? combineURLs(r, e) : e;
}
const headersToObject = (r) => r instanceof AxiosHeaders$1 ? { ...r } : r;
function mergeConfig$1(r, e) {
  e = e || {};
  const n = {};
  function i(p, d, g, b) {
    return utils$1.isPlainObject(p) && utils$1.isPlainObject(d) ? utils$1.merge.call({ caseless: b }, p, d) : utils$1.isPlainObject(d) ? utils$1.merge({}, d) : utils$1.isArray(d) ? d.slice() : d;
  }
  function s(p, d, g, b) {
    if (utils$1.isUndefined(d)) {
      if (!utils$1.isUndefined(p))
        return i(void 0, p, g, b);
    } else return i(p, d, g, b);
  }
  function o(p, d) {
    if (!utils$1.isUndefined(d))
      return i(void 0, d);
  }
  function a(p, d) {
    if (utils$1.isUndefined(d)) {
      if (!utils$1.isUndefined(p))
        return i(void 0, p);
    } else return i(void 0, d);
  }
  function u(p, d, g) {
    if (g in e)
      return i(p, d);
    if (g in r)
      return i(void 0, p);
  }
  const l = {
    url: o,
    method: o,
    data: o,
    baseURL: a,
    transformRequest: a,
    transformResponse: a,
    paramsSerializer: a,
    timeout: a,
    timeoutMessage: a,
    withCredentials: a,
    withXSRFToken: a,
    adapter: a,
    responseType: a,
    xsrfCookieName: a,
    xsrfHeaderName: a,
    onUploadProgress: a,
    onDownloadProgress: a,
    decompress: a,
    maxContentLength: a,
    maxBodyLength: a,
    beforeRedirect: a,
    transport: a,
    httpAgent: a,
    httpsAgent: a,
    cancelToken: a,
    socketPath: a,
    responseEncoding: a,
    validateStatus: u,
    headers: (p, d, g) => s(headersToObject(p), headersToObject(d), g, !0)
  };
  return utils$1.forEach(Object.keys(Object.assign({}, r, e)), function(d) {
    const g = l[d] || s, b = g(r[d], e[d], d);
    utils$1.isUndefined(b) && g !== u || (n[d] = b);
  }), n;
}
const resolveConfig = (r) => {
  const e = mergeConfig$1({}, r);
  let { data: n, withXSRFToken: i, xsrfHeaderName: s, xsrfCookieName: o, headers: a, auth: u } = e;
  e.headers = a = AxiosHeaders$1.from(a), e.url = buildURL(buildFullPath(e.baseURL, e.url), r.params, r.paramsSerializer), u && a.set(
    "Authorization",
    "Basic " + btoa((u.username || "") + ":" + (u.password ? unescape(encodeURIComponent(u.password)) : ""))
  );
  let l;
  if (utils$1.isFormData(n)) {
    if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv)
      a.setContentType(void 0);
    else if ((l = a.getContentType()) !== !1) {
      const [p, ...d] = l ? l.split(";").map((g) => g.trim()).filter(Boolean) : [];
      a.setContentType([p || "multipart/form-data", ...d].join("; "));
    }
  }
  if (platform.hasStandardBrowserEnv && (i && utils$1.isFunction(i) && (i = i(e)), i || i !== !1 && isURLSameOrigin(e.url))) {
    const p = s && o && cookies.read(o);
    p && a.set(s, p);
  }
  return e;
}, isXHRAdapterSupported = typeof XMLHttpRequest < "u", xhrAdapter = isXHRAdapterSupported && function(r) {
  return new Promise(function(n, i) {
    const s = resolveConfig(r);
    let o = s.data;
    const a = AxiosHeaders$1.from(s.headers).normalize();
    let { responseType: u, onUploadProgress: l, onDownloadProgress: p } = s, d, g, b, S, m;
    function v() {
      S && S(), m && m(), s.cancelToken && s.cancelToken.unsubscribe(d), s.signal && s.signal.removeEventListener("abort", d);
    }
    let y = new XMLHttpRequest();
    y.open(s.method.toUpperCase(), s.url, !0), y.timeout = s.timeout;
    function T() {
      if (!y)
        return;
      const R = AxiosHeaders$1.from(
        "getAllResponseHeaders" in y && y.getAllResponseHeaders()
      ), x = {
        data: !u || u === "text" || u === "json" ? y.responseText : y.response,
        status: y.status,
        statusText: y.statusText,
        headers: R,
        config: r,
        request: y
      };
      settle(function(O) {
        n(O), v();
      }, function(O) {
        i(O), v();
      }, x), y = null;
    }
    "onloadend" in y ? y.onloadend = T : y.onreadystatechange = function() {
      !y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(T);
    }, y.onabort = function() {
      y && (i(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, r, y)), y = null);
    }, y.onerror = function() {
      i(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, r, y)), y = null;
    }, y.ontimeout = function() {
      let D = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
      const x = s.transitional || transitionalDefaults;
      s.timeoutErrorMessage && (D = s.timeoutErrorMessage), i(new AxiosError$1(
        D,
        x.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
        r,
        y
      )), y = null;
    }, o === void 0 && a.setContentType(null), "setRequestHeader" in y && utils$1.forEach(a.toJSON(), function(D, x) {
      y.setRequestHeader(x, D);
    }), utils$1.isUndefined(s.withCredentials) || (y.withCredentials = !!s.withCredentials), u && u !== "json" && (y.responseType = s.responseType), p && ([b, m] = progressEventReducer(p, !0), y.addEventListener("progress", b)), l && y.upload && ([g, S] = progressEventReducer(l), y.upload.addEventListener("progress", g), y.upload.addEventListener("loadend", S)), (s.cancelToken || s.signal) && (d = (R) => {
      y && (i(!R || R.type ? new CanceledError$1(null, r, y) : R), y.abort(), y = null);
    }, s.cancelToken && s.cancelToken.subscribe(d), s.signal && (s.signal.aborted ? d() : s.signal.addEventListener("abort", d)));
    const E = parseProtocol(s.url);
    if (E && platform.protocols.indexOf(E) === -1) {
      i(new AxiosError$1("Unsupported protocol " + E + ":", AxiosError$1.ERR_BAD_REQUEST, r));
      return;
    }
    y.send(o || null);
  });
}, composeSignals = (r, e) => {
  const { length: n } = r = r ? r.filter(Boolean) : [];
  if (e || n) {
    let i = new AbortController(), s;
    const o = function(p) {
      if (!s) {
        s = !0, u();
        const d = p instanceof Error ? p : this.reason;
        i.abort(d instanceof AxiosError$1 ? d : new CanceledError$1(d instanceof Error ? d.message : d));
      }
    };
    let a = e && setTimeout(() => {
      a = null, o(new AxiosError$1(`timeout ${e} of ms exceeded`, AxiosError$1.ETIMEDOUT));
    }, e);
    const u = () => {
      r && (a && clearTimeout(a), a = null, r.forEach((p) => {
        p.unsubscribe ? p.unsubscribe(o) : p.removeEventListener("abort", o);
      }), r = null);
    };
    r.forEach((p) => p.addEventListener("abort", o));
    const { signal: l } = i;
    return l.unsubscribe = () => utils$1.asap(u), l;
  }
}, streamChunk = function* (r, e) {
  let n = r.byteLength;
  if (n < e) {
    yield r;
    return;
  }
  let i = 0, s;
  for (; i < n; )
    s = i + e, yield r.slice(i, s), i = s;
}, readBytes = async function* (r, e) {
  for await (const n of readStream(r))
    yield* streamChunk(n, e);
}, readStream = async function* (r) {
  if (r[Symbol.asyncIterator]) {
    yield* r;
    return;
  }
  const e = r.getReader();
  try {
    for (; ; ) {
      const { done: n, value: i } = await e.read();
      if (n)
        break;
      yield i;
    }
  } finally {
    await e.cancel();
  }
}, trackStream = (r, e, n, i) => {
  const s = readBytes(r, e);
  let o = 0, a, u = (l) => {
    a || (a = !0, i && i(l));
  };
  return new ReadableStream({
    async pull(l) {
      try {
        const { done: p, value: d } = await s.next();
        if (p) {
          u(), l.close();
          return;
        }
        let g = d.byteLength;
        if (n) {
          let b = o += g;
          n(b);
        }
        l.enqueue(new Uint8Array(d));
      } catch (p) {
        throw u(p), p;
      }
    },
    cancel(l) {
      return u(l), s.return();
    }
  }, {
    highWaterMark: 2
  });
}, isFetchSupported = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", isReadableStreamSupported = isFetchSupported && typeof ReadableStream == "function", encodeText = isFetchSupported && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((r) => (e) => r.encode(e))(new TextEncoder()) : async (r) => new Uint8Array(await new Response(r).arrayBuffer())), test = (r, ...e) => {
  try {
    return !!r(...e);
  } catch {
    return !1;
  }
}, supportsRequestStream = isReadableStreamSupported && test(() => {
  let r = !1;
  const e = new Request(platform.origin, {
    body: new ReadableStream(),
    method: "POST",
    get duplex() {
      return r = !0, "half";
    }
  }).headers.has("Content-Type");
  return r && !e;
}), DEFAULT_CHUNK_SIZE = 64 * 1024, supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body)), resolvers = {
  stream: supportsResponseStream && ((r) => r.body)
};
isFetchSupported && ((r) => {
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
    !resolvers[e] && (resolvers[e] = utils$1.isFunction(r[e]) ? (n) => n[e]() : (n, i) => {
      throw new AxiosError$1(`Response type '${e}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, i);
    });
  });
})(new Response());
const getBodyLength = async (r) => {
  if (r == null)
    return 0;
  if (utils$1.isBlob(r))
    return r.size;
  if (utils$1.isSpecCompliantForm(r))
    return (await new Request(platform.origin, {
      method: "POST",
      body: r
    }).arrayBuffer()).byteLength;
  if (utils$1.isArrayBufferView(r) || utils$1.isArrayBuffer(r))
    return r.byteLength;
  if (utils$1.isURLSearchParams(r) && (r = r + ""), utils$1.isString(r))
    return (await encodeText(r)).byteLength;
}, resolveBodyLength = async (r, e) => {
  const n = utils$1.toFiniteNumber(r.getContentLength());
  return n ?? getBodyLength(e);
}, fetchAdapter = isFetchSupported && (async (r) => {
  let {
    url: e,
    method: n,
    data: i,
    signal: s,
    cancelToken: o,
    timeout: a,
    onDownloadProgress: u,
    onUploadProgress: l,
    responseType: p,
    headers: d,
    withCredentials: g = "same-origin",
    fetchOptions: b
  } = resolveConfig(r);
  p = p ? (p + "").toLowerCase() : "text";
  let S = composeSignals([s, o && o.toAbortSignal()], a), m;
  const v = S && S.unsubscribe && (() => {
    S.unsubscribe();
  });
  let y;
  try {
    if (l && supportsRequestStream && n !== "get" && n !== "head" && (y = await resolveBodyLength(d, i)) !== 0) {
      let x = new Request(e, {
        method: "POST",
        body: i,
        duplex: "half"
      }), w;
      if (utils$1.isFormData(i) && (w = x.headers.get("content-type")) && d.setContentType(w), x.body) {
        const [O, k] = progressEventDecorator(
          y,
          progressEventReducer(asyncDecorator(l))
        );
        i = trackStream(x.body, DEFAULT_CHUNK_SIZE, O, k);
      }
    }
    utils$1.isString(g) || (g = g ? "include" : "omit");
    const T = "credentials" in Request.prototype;
    m = new Request(e, {
      ...b,
      signal: S,
      method: n.toUpperCase(),
      headers: d.normalize().toJSON(),
      body: i,
      duplex: "half",
      credentials: T ? g : void 0
    });
    let E = await fetch(m);
    const R = supportsResponseStream && (p === "stream" || p === "response");
    if (supportsResponseStream && (u || R && v)) {
      const x = {};
      ["status", "statusText", "headers"].forEach((P) => {
        x[P] = E[P];
      });
      const w = utils$1.toFiniteNumber(E.headers.get("content-length")), [O, k] = u && progressEventDecorator(
        w,
        progressEventReducer(asyncDecorator(u), !0)
      ) || [];
      E = new Response(
        trackStream(E.body, DEFAULT_CHUNK_SIZE, O, () => {
          k && k(), v && v();
        }),
        x
      );
    }
    p = p || "text";
    let D = await resolvers[utils$1.findKey(resolvers, p) || "text"](E, r);
    return !R && v && v(), await new Promise((x, w) => {
      settle(x, w, {
        data: D,
        headers: AxiosHeaders$1.from(E.headers),
        status: E.status,
        statusText: E.statusText,
        config: r,
        request: m
      });
    });
  } catch (T) {
    throw v && v(), T && T.name === "TypeError" && /fetch/i.test(T.message) ? Object.assign(
      new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, r, m),
      {
        cause: T.cause || T
      }
    ) : AxiosError$1.from(T, T && T.code, r, m);
  }
}), knownAdapters = {
  http: httpAdapter,
  xhr: xhrAdapter,
  fetch: fetchAdapter
};
utils$1.forEach(knownAdapters, (r, e) => {
  if (r) {
    try {
      Object.defineProperty(r, "name", { value: e });
    } catch {
    }
    Object.defineProperty(r, "adapterName", { value: e });
  }
});
const renderReason = (r) => `- ${r}`, isResolvedHandle = (r) => utils$1.isFunction(r) || r === null || r === !1, adapters = {
  getAdapter: (r) => {
    r = utils$1.isArray(r) ? r : [r];
    const { length: e } = r;
    let n, i;
    const s = {};
    for (let o = 0; o < e; o++) {
      n = r[o];
      let a;
      if (i = n, !isResolvedHandle(n) && (i = knownAdapters[(a = String(n)).toLowerCase()], i === void 0))
        throw new AxiosError$1(`Unknown adapter '${a}'`);
      if (i)
        break;
      s[a || "#" + o] = i;
    }
    if (!i) {
      const o = Object.entries(s).map(
        ([u, l]) => `adapter ${u} ` + (l === !1 ? "is not supported by the environment" : "is not available in the build")
      );
      let a = e ? o.length > 1 ? `since :
` + o.map(renderReason).join(`
`) : " " + renderReason(o[0]) : "as no adapter specified";
      throw new AxiosError$1(
        "There is no suitable adapter to dispatch the request " + a,
        "ERR_NOT_SUPPORT"
      );
    }
    return i;
  },
  adapters: knownAdapters
};
function throwIfCancellationRequested(r) {
  if (r.cancelToken && r.cancelToken.throwIfRequested(), r.signal && r.signal.aborted)
    throw new CanceledError$1(null, r);
}
function dispatchRequest(r) {
  return throwIfCancellationRequested(r), r.headers = AxiosHeaders$1.from(r.headers), r.data = transformData.call(
    r,
    r.transformRequest
  ), ["post", "put", "patch"].indexOf(r.method) !== -1 && r.headers.setContentType("application/x-www-form-urlencoded", !1), adapters.getAdapter(r.adapter || defaults.adapter)(r).then(function(i) {
    return throwIfCancellationRequested(r), i.data = transformData.call(
      r,
      r.transformResponse,
      i
    ), i.headers = AxiosHeaders$1.from(i.headers), i;
  }, function(i) {
    return isCancel$1(i) || (throwIfCancellationRequested(r), i && i.response && (i.response.data = transformData.call(
      r,
      r.transformResponse,
      i.response
    ), i.response.headers = AxiosHeaders$1.from(i.response.headers))), Promise.reject(i);
  });
}
const VERSION$1 = "1.7.9", validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((r, e) => {
  validators$1[r] = function(i) {
    return typeof i === r || "a" + (e < 1 ? "n " : " ") + r;
  };
});
const deprecatedWarnings = {};
validators$1.transitional = function(e, n, i) {
  function s(o, a) {
    return "[Axios v" + VERSION$1 + "] Transitional option '" + o + "'" + a + (i ? ". " + i : "");
  }
  return (o, a, u) => {
    if (e === !1)
      throw new AxiosError$1(
        s(a, " has been removed" + (n ? " in " + n : "")),
        AxiosError$1.ERR_DEPRECATED
      );
    return n && !deprecatedWarnings[a] && (deprecatedWarnings[a] = !0, console.warn(
      s(
        a,
        " has been deprecated since v" + n + " and will be removed in the near future"
      )
    )), e ? e(o, a, u) : !0;
  };
};
validators$1.spelling = function(e) {
  return (n, i) => (console.warn(`${i} is likely a misspelling of ${e}`), !0);
};
function assertOptions(r, e, n) {
  if (typeof r != "object")
    throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
  const i = Object.keys(r);
  let s = i.length;
  for (; s-- > 0; ) {
    const o = i[s], a = e[o];
    if (a) {
      const u = r[o], l = u === void 0 || a(u, o, r);
      if (l !== !0)
        throw new AxiosError$1("option " + o + " must be " + l, AxiosError$1.ERR_BAD_OPTION_VALUE);
      continue;
    }
    if (n !== !0)
      throw new AxiosError$1("Unknown option " + o, AxiosError$1.ERR_BAD_OPTION);
  }
}
const validator = {
  assertOptions,
  validators: validators$1
}, validators = validator.validators;
let Axios$1 = class {
  constructor(e) {
    this.defaults = e, this.interceptors = {
      request: new InterceptorManager(),
      response: new InterceptorManager()
    };
  }
  /**
   * 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(e, n) {
    try {
      return await this._request(e, n);
    } catch (i) {
      if (i instanceof Error) {
        let s = {};
        Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
        const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
        try {
          i.stack ? o && !String(i.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (i.stack += `
` + o) : i.stack = o;
        } catch {
        }
      }
      throw i;
    }
  }
  _request(e, n) {
    typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = mergeConfig$1(this.defaults, n);
    const { transitional: i, paramsSerializer: s, headers: o } = n;
    i !== void 0 && validator.assertOptions(i, {
      silentJSONParsing: validators.transitional(validators.boolean),
      forcedJSONParsing: validators.transitional(validators.boolean),
      clarifyTimeoutError: validators.transitional(validators.boolean)
    }, !1), s != null && (utils$1.isFunction(s) ? n.paramsSerializer = {
      serialize: s
    } : validator.assertOptions(s, {
      encode: validators.function,
      serialize: validators.function
    }, !0)), validator.assertOptions(n, {
      baseUrl: validators.spelling("baseURL"),
      withXsrfToken: validators.spelling("withXSRFToken")
    }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
    let a = o && utils$1.merge(
      o.common,
      o[n.method]
    );
    o && utils$1.forEach(
      ["delete", "get", "head", "post", "put", "patch", "common"],
      (m) => {
        delete o[m];
      }
    ), n.headers = AxiosHeaders$1.concat(a, o);
    const u = [];
    let l = !0;
    this.interceptors.request.forEach(function(v) {
      typeof v.runWhen == "function" && v.runWhen(n) === !1 || (l = l && v.synchronous, u.unshift(v.fulfilled, v.rejected));
    });
    const p = [];
    this.interceptors.response.forEach(function(v) {
      p.push(v.fulfilled, v.rejected);
    });
    let d, g = 0, b;
    if (!l) {
      const m = [dispatchRequest.bind(this), void 0];
      for (m.unshift.apply(m, u), m.push.apply(m, p), b = m.length, d = Promise.resolve(n); g < b; )
        d = d.then(m[g++], m[g++]);
      return d;
    }
    b = u.length;
    let S = n;
    for (g = 0; g < b; ) {
      const m = u[g++], v = u[g++];
      try {
        S = m(S);
      } catch (y) {
        v.call(this, y);
        break;
      }
    }
    try {
      d = dispatchRequest.call(this, S);
    } catch (m) {
      return Promise.reject(m);
    }
    for (g = 0, b = p.length; g < b; )
      d = d.then(p[g++], p[g++]);
    return d;
  }
  getUri(e) {
    e = mergeConfig$1(this.defaults, e);
    const n = buildFullPath(e.baseURL, e.url);
    return buildURL(n, e.params, e.paramsSerializer);
  }
};
utils$1.forEach(["delete", "get", "head", "options"], function(e) {
  Axios$1.prototype[e] = function(n, i) {
    return this.request(mergeConfig$1(i || {}, {
      method: e,
      url: n,
      data: (i || {}).data
    }));
  };
});
utils$1.forEach(["post", "put", "patch"], function(e) {
  function n(i) {
    return function(o, a, u) {
      return this.request(mergeConfig$1(u || {}, {
        method: e,
        headers: i ? {
          "Content-Type": "multipart/form-data"
        } : {},
        url: o,
        data: a
      }));
    };
  }
  Axios$1.prototype[e] = n(), Axios$1.prototype[e + "Form"] = n(!0);
});
let CancelToken$1 = class L {
  constructor(e) {
    if (typeof e != "function")
      throw new TypeError("executor must be a function.");
    let n;
    this.promise = new Promise(function(o) {
      n = o;
    });
    const i = this;
    this.promise.then((s) => {
      if (!i._listeners) return;
      let o = i._listeners.length;
      for (; o-- > 0; )
        i._listeners[o](s);
      i._listeners = null;
    }), this.promise.then = (s) => {
      let o;
      const a = new Promise((u) => {
        i.subscribe(u), o = u;
      }).then(s);
      return a.cancel = function() {
        i.unsubscribe(o);
      }, a;
    }, e(function(o, a, u) {
      i.reason || (i.reason = new CanceledError$1(o, a, u), n(i.reason));
    });
  }
  /**
   * Throws a `CanceledError` if cancellation has been requested.
   */
  throwIfRequested() {
    if (this.reason)
      throw this.reason;
  }
  /**
   * Subscribe to the cancel signal
   */
  subscribe(e) {
    if (this.reason) {
      e(this.reason);
      return;
    }
    this._listeners ? this._listeners.push(e) : this._listeners = [e];
  }
  /**
   * Unsubscribe from the cancel signal
   */
  unsubscribe(e) {
    if (!this._listeners)
      return;
    const n = this._listeners.indexOf(e);
    n !== -1 && this._listeners.splice(n, 1);
  }
  toAbortSignal() {
    const e = new AbortController(), n = (i) => {
      e.abort(i);
    };
    return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal;
  }
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */
  static source() {
    let e;
    return {
      token: new L(function(s) {
        e = s;
      }),
      cancel: e
    };
  }
};
function spread$1(r) {
  return function(n) {
    return r.apply(null, n);
  };
}
function isAxiosError$1(r) {
  return utils$1.isObject(r) && r.isAxiosError === !0;
}
const HttpStatusCode$1 = {
  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(HttpStatusCode$1).forEach(([r, e]) => {
  HttpStatusCode$1[e] = r;
});
function createInstance(r) {
  const e = new Axios$1(r), n = bind(Axios$1.prototype.request, e);
  return utils$1.extend(n, Axios$1.prototype, e, { allOwnKeys: !0 }), utils$1.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(s) {
    return createInstance(mergeConfig$1(r, s));
  }, n;
}
const axios = createInstance(defaults);
axios.Axios = Axios$1;
axios.CanceledError = CanceledError$1;
axios.CancelToken = CancelToken$1;
axios.isCancel = isCancel$1;
axios.VERSION = VERSION$1;
axios.toFormData = toFormData$1;
axios.AxiosError = AxiosError$1;
axios.Cancel = axios.CanceledError;
axios.all = function(e) {
  return Promise.all(e);
};
axios.spread = spread$1;
axios.isAxiosError = isAxiosError$1;
axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = (r) => formDataToJSON(utils$1.isHTMLForm(r) ? new FormData(r) : r);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
const {
  Axios,
  AxiosError,
  CanceledError,
  isCancel,
  CancelToken,
  VERSION,
  all,
  Cancel,
  isAxiosError,
  spread,
  toFormData,
  AxiosHeaders,
  HttpStatusCode,
  formToJSON,
  getAdapter,
  mergeConfig
} = axios, taConfig = {
  dev: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  test: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  uat: {
    appId: "30dc981f6368458e8d1814581fbfebee",
    serverUrl: "https://talogshushu.postar.cn"
  },
  prod: {
    appId: "28d05c6cecaf45cbb9eb6867633e478b",
    serverUrl: "https://talogshushu.postar.cn"
  }
}, servicePath = {
  dev: "http://jghwucyshtgjcbrnxgwe.gtxygroup.com/testterpay/",
  test: "https://jghwucyshtgjcbrnxgwe.gtxygroup.com/syncpromotecs/",
  uat: "https://mktcldxylmyxrhgwzsc.postar.cn/",
  prod: "https://mktcldxylmyxrhgw.postar.cn/"
}, rsaKey = {
  public: "-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2D5Z2SOgofxIp1r4Mhgf5AvN1orm9bPWySpGqnyJgvxLFvp/DbokhYZP9NqYnLvPeilVamIaxJUzw/u2hvQUQ1bPL6TKGAEce9cDfowb+ud90OKYeKnVOm3xMOKu5KaONNMHCa4VCwxS7+ykaGqQ8sm2Kj5WBk2eGzAV30BJ0YQIDAQAB-----END PUBLIC KEY-----",
  private: "-----BEGIN RSA PRIVATE KEY-----MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKBGm6KY2IuHRb+AqJvQtrsaXbFRAfzI6idcaj+0xiHU7T/FHoTjBP/bhIJ2iZiwIJuSHclaLeIGUT12Bzn/TUPMZy+vuATE00BaMYDVXxr/e0dkgZXPwYBL48an9fLx2YtTqaerYCy7KQvtbnyG+7eo9Z9nV/+Hm+KECq3VKdf7AgMBAAECgYBXQ/qLflMxLTcBvOiQ5gQIPaPT3rqJS0+KnNvQ0fmrBAclWIt0aTMYqAovCqGCfCtU6SrErhAbZ7smDrSClIoZSoYkLYdc9aStiyVxmoUQziDHCqd14q62itHyxF2fpmoc3BtOqqCLGDf78w+yP9vuCBhnyCYC47O383tFuVCfcQJBAMsrzYeub9fgUN095Q5UvkyGo0E/XGH9VQM4jtYoLn4yE2JLlqCzi/tAuu8pc1QY/CgMnEsRjmkC2UPg8ca83ekCQQDJ83TIgDKm9ZEu8hi19CXvtArtgzSDa9DvLFuueYxgli0xQNU+l9a+uSFBVmGRT/RcDYI0wzH7Dyfyrdym7yRDAkEAjbyJLdarf9alkzLS0SSdfZWP3rztHg81d4HFY/G0PaWBkFlbQ9D+HtIRlzc7lbe4cdgaUOR2jRvHpmsPQK4RwQJAMQX1cnqUUS1JehDw6LKExwR4pqF0DPcOOBEXjGobJpMuE0e+vDwVuCSuqvKyKpkzI2lwEyjTKDPMqb+E0c05iwJAHryFkEaQ+OZIGizE7nCx9ertNsrPtIHxoi7gzusxk0kfcbDfO+Ck4/zDCaBPUTJwDq8c8lg3PtNV3ezly1+tkQ==-----END RSA PRIVATE KEY-----"
};
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
function int2char(r) {
  return BI_RM.charAt(r);
}
function op_and(r, e) {
  return r & e;
}
function op_or(r, e) {
  return r | e;
}
function op_xor(r, e) {
  return r ^ e;
}
function op_andnot(r, e) {
  return r & ~e;
}
function lbit(r) {
  if (r == 0)
    return -1;
  var e = 0;
  return r & 65535 || (r >>= 16, e += 16), r & 255 || (r >>= 8, e += 8), r & 15 || (r >>= 4, e += 4), r & 3 || (r >>= 2, e += 2), r & 1 || ++e, e;
}
function cbit(r) {
  for (var e = 0; r != 0; )
    r &= r - 1, ++e;
  return e;
}
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b64pad = "=";
function hex2b64(r) {
  var e, n, i = "";
  for (e = 0; e + 3 <= r.length; e += 3)
    n = parseInt(r.substring(e, e + 3), 16), i += b64map.charAt(n >> 6) + b64map.charAt(n & 63);
  for (e + 1 == r.length ? (n = parseInt(r.substring(e, e + 1), 16), i += b64map.charAt(n << 2)) : e + 2 == r.length && (n = parseInt(r.substring(e, e + 2), 16), i += b64map.charAt(n >> 2) + b64map.charAt((n & 3) << 4)); (i.length & 3) > 0; )
    i += b64pad;
  return i;
}
function b64tohex(r) {
  var e = "", n, i = 0, s = 0;
  for (n = 0; n < r.length && r.charAt(n) != b64pad; ++n) {
    var o = b64map.indexOf(r.charAt(n));
    o < 0 || (i == 0 ? (e += int2char(o >> 2), s = o & 3, i = 1) : i == 1 ? (e += int2char(s << 2 | o >> 4), s = o & 15, i = 2) : i == 2 ? (e += int2char(s), e += int2char(o >> 2), s = o & 3, i = 3) : (e += int2char(s << 2 | o >> 4), e += int2char(o & 15), i = 0));
  }
  return i == 1 && (e += int2char(s << 2)), e;
}
var decoder$1, Hex = {
  decode: function(r) {
    var e;
    if (decoder$1 === void 0) {
      var n = "0123456789ABCDEF", i = ` \f
\r	 \u2028\u2029`;
      for (decoder$1 = {}, e = 0; e < 16; ++e)
        decoder$1[n.charAt(e)] = e;
      for (n = n.toLowerCase(), e = 10; e < 16; ++e)
        decoder$1[n.charAt(e)] = e;
      for (e = 0; e < i.length; ++e)
        decoder$1[i.charAt(e)] = -1;
    }
    var s = [], o = 0, a = 0;
    for (e = 0; e < r.length; ++e) {
      var u = r.charAt(e);
      if (u == "=")
        break;
      if (u = decoder$1[u], u != -1) {
        if (u === void 0)
          throw new Error("Illegal character at offset " + e);
        o |= u, ++a >= 2 ? (s[s.length] = o, o = 0, a = 0) : o <<= 4;
      }
    }
    if (a)
      throw new Error("Hex encoding incomplete: 4 bits missing");
    return s;
  }
}, decoder, Base64 = {
  decode: function(r) {
    var e;
    if (decoder === void 0) {
      var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = `= \f
\r	 \u2028\u2029`;
      for (decoder = /* @__PURE__ */ Object.create(null), e = 0; e < 64; ++e)
        decoder[n.charAt(e)] = e;
      for (decoder["-"] = 62, decoder._ = 63, e = 0; e < i.length; ++e)
        decoder[i.charAt(e)] = -1;
    }
    var s = [], o = 0, a = 0;
    for (e = 0; e < r.length; ++e) {
      var u = r.charAt(e);
      if (u == "=")
        break;
      if (u = decoder[u], u != -1) {
        if (u === void 0)
          throw new Error("Illegal character at offset " + e);
        o |= u, ++a >= 4 ? (s[s.length] = o >> 16, s[s.length] = o >> 8 & 255, s[s.length] = o & 255, o = 0, a = 0) : o <<= 6;
      }
    }
    switch (a) {
      case 1:
        throw new Error("Base64 encoding incomplete: at least 2 bits missing");
      case 2:
        s[s.length] = o >> 10;
        break;
      case 3:
        s[s.length] = o >> 16, s[s.length] = o >> 8 & 255;
        break;
    }
    return s;
  },
  re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
  unarmor: function(r) {
    var e = Base64.re.exec(r);
    if (e)
      if (e[1])
        r = e[1];
      else if (e[2])
        r = e[2];
      else
        throw new Error("RegExp out of sync");
    return Base64.decode(r);
  }
}, max = 1e13, Int10 = (
  /** @class */
  function() {
    function r(e) {
      this.buf = [+e || 0];
    }
    return r.prototype.mulAdd = function(e, n) {
      var i = this.buf, s = i.length, o, a;
      for (o = 0; o < s; ++o)
        a = i[o] * e + n, a < max ? n = 0 : (n = 0 | a / max, a -= n * max), i[o] = a;
      n > 0 && (i[o] = n);
    }, r.prototype.sub = function(e) {
      var n = this.buf, i = n.length, s, o;
      for (s = 0; s < i; ++s)
        o = n[s] - e, o < 0 ? (o += max, e = 1) : e = 0, n[s] = o;
      for (; n[n.length - 1] === 0; )
        n.pop();
    }, r.prototype.toString = function(e) {
      if ((e || 10) != 10)
        throw new Error("only base 10 is supported");
      for (var n = this.buf, i = n[n.length - 1].toString(), s = n.length - 2; s >= 0; --s)
        i += (max + n[s]).toString().substring(1);
      return i;
    }, r.prototype.valueOf = function() {
      for (var e = this.buf, n = 0, i = e.length - 1; i >= 0; --i)
        n = n * max + e[i];
      return n;
    }, r.prototype.simplify = function() {
      var e = this.buf;
      return e.length == 1 ? e[0] : this;
    }, r;
  }()
), ellipsis = "…", reTimeS = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, reTimeL = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
function stringCut(r, e) {
  return r.length > e && (r = r.substring(0, e) + ellipsis), r;
}
var Stream = (
  /** @class */
  function() {
    function r(e, n) {
      this.hexDigits = "0123456789ABCDEF", e instanceof r ? (this.enc = e.enc, this.pos = e.pos) : (this.enc = e, this.pos = n);
    }
    return r.prototype.get = function(e) {
      if (e === void 0 && (e = this.pos++), e >= this.enc.length)
        throw new Error("Requesting byte offset ".concat(e, " on a stream of length ").concat(this.enc.length));
      return typeof this.enc == "string" ? this.enc.charCodeAt(e) : this.enc[e];
    }, r.prototype.hexByte = function(e) {
      return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(e & 15);
    }, r.prototype.hexDump = function(e, n, i) {
      for (var s = "", o = e; o < n; ++o)
        if (s += this.hexByte(this.get(o)), i !== !0)
          switch (o & 15) {
            case 7:
              s += "  ";
              break;
            case 15:
              s += `
`;
              break;
            default:
              s += " ";
          }
      return s;
    }, r.prototype.isASCII = function(e, n) {
      for (var i = e; i < n; ++i) {
        var s = this.get(i);
        if (s < 32 || s > 176)
          return !1;
      }
      return !0;
    }, r.prototype.parseStringISO = function(e, n) {
      for (var i = "", s = e; s < n; ++s)
        i += String.fromCharCode(this.get(s));
      return i;
    }, r.prototype.parseStringUTF = function(e, n) {
      for (var i = "", s = e; s < n; ) {
        var o = this.get(s++);
        o < 128 ? i += String.fromCharCode(o) : o > 191 && o < 224 ? i += String.fromCharCode((o & 31) << 6 | this.get(s++) & 63) : i += String.fromCharCode((o & 15) << 12 | (this.get(s++) & 63) << 6 | this.get(s++) & 63);
      }
      return i;
    }, r.prototype.parseStringBMP = function(e, n) {
      for (var i = "", s, o, a = e; a < n; )
        s = this.get(a++), o = this.get(a++), i += String.fromCharCode(s << 8 | o);
      return i;
    }, r.prototype.parseTime = function(e, n, i) {
      var s = this.parseStringISO(e, n), o = (i ? reTimeS : reTimeL).exec(s);
      return o ? (i && (o[1] = +o[1], o[1] += +o[1] < 70 ? 2e3 : 1900), s = o[1] + "-" + o[2] + "-" + o[3] + " " + o[4], o[5] && (s += ":" + o[5], o[6] && (s += ":" + o[6], o[7] && (s += "." + o[7]))), o[8] && (s += " UTC", o[8] != "Z" && (s += o[8], o[9] && (s += ":" + o[9]))), s) : "Unrecognized time: " + s;
    }, r.prototype.parseInteger = function(e, n) {
      for (var i = this.get(e), s = i > 127, o = s ? 255 : 0, a, u = ""; i == o && ++e < n; )
        i = this.get(e);
      if (a = n - e, a === 0)
        return s ? -1 : 0;
      if (a > 4) {
        for (u = i, a <<= 3; !((+u ^ o) & 128); )
          u = +u << 1, --a;
        u = "(" + a + ` bit)
`;
      }
      s && (i = i - 256);
      for (var l = new Int10(i), p = e + 1; p < n; ++p)
        l.mulAdd(256, this.get(p));
      return u + l.toString();
    }, r.prototype.parseBitString = function(e, n, i) {
      for (var s = this.get(e), o = (n - e - 1 << 3) - s, a = "(" + o + ` bit)
`, u = "", l = e + 1; l < n; ++l) {
        for (var p = this.get(l), d = l == n - 1 ? s : 0, g = 7; g >= d; --g)
          u += p >> g & 1 ? "1" : "0";
        if (u.length > i)
          return a + stringCut(u, i);
      }
      return a + u;
    }, r.prototype.parseOctetString = function(e, n, i) {
      if (this.isASCII(e, n))
        return stringCut(this.parseStringISO(e, n), i);
      var s = n - e, o = "(" + s + ` byte)
`;
      i /= 2, s > i && (n = e + i);
      for (var a = e; a < n; ++a)
        o += this.hexByte(this.get(a));
      return s > i && (o += ellipsis), o;
    }, r.prototype.parseOID = function(e, n, i) {
      for (var s = "", o = new Int10(), a = 0, u = e; u < n; ++u) {
        var l = this.get(u);
        if (o.mulAdd(128, l & 127), a += 7, !(l & 128)) {
          if (s === "")
            if (o = o.simplify(), o instanceof Int10)
              o.sub(80), s = "2." + o.toString();
            else {
              var p = o < 80 ? o < 40 ? 0 : 1 : 2;
              s = p + "." + (o - p * 40);
            }
          else
            s += "." + o.toString();
          if (s.length > i)
            return stringCut(s, i);
          o = new Int10(), a = 0;
        }
      }
      return a > 0 && (s += ".incomplete"), s;
    }, r;
  }()
), ASN1 = (
  /** @class */
  function() {
    function r(e, n, i, s, o) {
      if (!(s instanceof ASN1Tag))
        throw new Error("Invalid tag value.");
      this.stream = e, this.header = n, this.length = i, this.tag = s, this.sub = o;
    }
    return r.prototype.typeName = function() {
      switch (this.tag.tagClass) {
        case 0:
          switch (this.tag.tagNumber) {
            case 0:
              return "EOC";
            case 1:
              return "BOOLEAN";
            case 2:
              return "INTEGER";
            case 3:
              return "BIT_STRING";
            case 4:
              return "OCTET_STRING";
            case 5:
              return "NULL";
            case 6:
              return "OBJECT_IDENTIFIER";
            case 7:
              return "ObjectDescriptor";
            case 8:
              return "EXTERNAL";
            case 9:
              return "REAL";
            case 10:
              return "ENUMERATED";
            case 11:
              return "EMBEDDED_PDV";
            case 12:
              return "UTF8String";
            case 16:
              return "SEQUENCE";
            case 17:
              return "SET";
            case 18:
              return "NumericString";
            case 19:
              return "PrintableString";
            // ASCII subset
            case 20:
              return "TeletexString";
            // aka T61String
            case 21:
              return "VideotexString";
            case 22:
              return "IA5String";
            // ASCII
            case 23:
              return "UTCTime";
            case 24:
              return "GeneralizedTime";
            case 25:
              return "GraphicString";
            case 26:
              return "VisibleString";
            // ASCII subset
            case 27:
              return "GeneralString";
            case 28:
              return "UniversalString";
            case 30:
              return "BMPString";
          }
          return "Universal_" + this.tag.tagNumber.toString();
        case 1:
          return "Application_" + this.tag.tagNumber.toString();
        case 2:
          return "[" + this.tag.tagNumber.toString() + "]";
        // Context
        case 3:
          return "Private_" + this.tag.tagNumber.toString();
      }
    }, r.prototype.content = function(e) {
      if (this.tag === void 0)
        return null;
      e === void 0 && (e = 1 / 0);
      var n = this.posContent(), i = Math.abs(this.length);
      if (!this.tag.isUniversal())
        return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(n, n + i, e);
      switch (this.tag.tagNumber) {
        case 1:
          return this.stream.get(n) === 0 ? "false" : "true";
        case 2:
          return this.stream.parseInteger(n, n + i);
        case 3:
          return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(n, n + i, e);
        case 4:
          return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(n, n + i, e);
        // case 0x05: // NULL
        case 6:
          return this.stream.parseOID(n, n + i, e);
        // case 0x07: // ObjectDescriptor
        // case 0x08: // EXTERNAL
        // case 0x09: // REAL
        // case 0x0A: // ENUMERATED
        // case 0x0B: // EMBEDDED_PDV
        case 16:
        // SEQUENCE
        case 17:
          return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)";
        case 12:
          return stringCut(this.stream.parseStringUTF(n, n + i), e);
        case 18:
        // NumericString
        case 19:
        // PrintableString
        case 20:
        // TeletexString
        case 21:
        // VideotexString
        case 22:
        // IA5String
        // case 0x19: // GraphicString
        case 26:
          return stringCut(this.stream.parseStringISO(n, n + i), e);
        case 30:
          return stringCut(this.stream.parseStringBMP(n, n + i), e);
        case 23:
        // UTCTime
        case 24:
          return this.stream.parseTime(n, n + i, this.tag.tagNumber == 23);
      }
      return null;
    }, r.prototype.toString = function() {
      return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
    }, r.prototype.toPrettyString = function(e) {
      e === void 0 && (e = "");
      var n = e + this.typeName() + " @" + this.stream.pos;
      if (this.length >= 0 && (n += "+"), n += this.length, this.tag.tagConstructed ? n += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (n += " (encapsulates)"), n += `
`, this.sub !== null) {
        e += "  ";
        for (var i = 0, s = this.sub.length; i < s; ++i)
          n += this.sub[i].toPrettyString(e);
      }
      return n;
    }, r.prototype.posStart = function() {
      return this.stream.pos;
    }, r.prototype.posContent = function() {
      return this.stream.pos + this.header;
    }, r.prototype.posEnd = function() {
      return this.stream.pos + this.header + Math.abs(this.length);
    }, r.prototype.toHexString = function() {
      return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
    }, r.decodeLength = function(e) {
      var n = e.get(), i = n & 127;
      if (i == n)
        return i;
      if (i > 6)
        throw new Error("Length over 48 bits not supported at position " + (e.pos - 1));
      if (i === 0)
        return null;
      n = 0;
      for (var s = 0; s < i; ++s)
        n = n * 256 + e.get();
      return n;
    }, r.prototype.getHexStringValue = function() {
      var e = this.toHexString(), n = this.header * 2, i = this.length * 2;
      return e.substr(n, i);
    }, r.decode = function(e) {
      var n;
      e instanceof Stream ? n = e : n = new Stream(e, 0);
      var i = new Stream(n), s = new ASN1Tag(n), o = r.decodeLength(n), a = n.pos, u = a - i.pos, l = null, p = function() {
        var g = [];
        if (o !== null) {
          for (var b = a + o; n.pos < b; )
            g[g.length] = r.decode(n);
          if (n.pos != b)
            throw new Error("Content size is not correct for container starting at offset " + a);
        } else
          try {
            for (; ; ) {
              var S = r.decode(n);
              if (S.tag.isEOC())
                break;
              g[g.length] = S;
            }
            o = a - n.pos;
          } catch (m) {
            throw new Error("Exception while decoding undefined length content: " + m);
          }
        return g;
      };
      if (s.tagConstructed)
        l = p();
      else if (s.isUniversal() && (s.tagNumber == 3 || s.tagNumber == 4))
        try {
          if (s.tagNumber == 3 && n.get() != 0)
            throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
          l = p();
          for (var d = 0; d < l.length; ++d)
            if (l[d].tag.isEOC())
              throw new Error("EOC is not supposed to be actual content.");
        } catch {
          l = null;
        }
      if (l === null) {
        if (o === null)
          throw new Error("We can't skip over an invalid tag with undefined length at offset " + a);
        n.pos = a + Math.abs(o);
      }
      return new r(i, u, o, s, l);
    }, r;
  }()
), ASN1Tag = (
  /** @class */
  function() {
    function r(e) {
      var n = e.get();
      if (this.tagClass = n >> 6, this.tagConstructed = (n & 32) !== 0, this.tagNumber = n & 31, this.tagNumber == 31) {
        var i = new Int10();
        do
          n = e.get(), i.mulAdd(128, n & 127);
        while (n & 128);
        this.tagNumber = i.simplify();
      }
    }
    return r.prototype.isUniversal = function() {
      return this.tagClass === 0;
    }, r.prototype.isEOC = function() {
      return this.tagClass === 0 && this.tagNumber === 0;
    }, r;
  }()
), dbits, canary = 244837814094590, j_lm = (canary & 16777215) == 15715070, lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], lplim = (1 << 26) / lowprimes[lowprimes.length - 1], BigInteger = (
  /** @class */
  function() {
    function r(e, n, i) {
      e != null && (typeof e == "number" ? this.fromNumber(e, n, i) : n == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, n));
    }
    return r.prototype.toString = function(e) {
      if (this.s < 0)
        return "-" + this.negate().toString(e);
      var n;
      if (e == 16)
        n = 4;
      else if (e == 8)
        n = 3;
      else if (e == 2)
        n = 1;
      else if (e == 32)
        n = 5;
      else if (e == 4)
        n = 2;
      else
        return this.toRadix(e);
      var i = (1 << n) - 1, s, o = !1, a = "", u = this.t, l = this.DB - u * this.DB % n;
      if (u-- > 0)
        for (l < this.DB && (s = this[u] >> l) > 0 && (o = !0, a = int2char(s)); u >= 0; )
          l < n ? (s = (this[u] & (1 << l) - 1) << n - l, s |= this[--u] >> (l += this.DB - n)) : (s = this[u] >> (l -= n) & i, l <= 0 && (l += this.DB, --u)), s > 0 && (o = !0), o && (a += int2char(s));
      return o ? a : "0";
    }, r.prototype.negate = function() {
      var e = nbi();
      return r.ZERO.subTo(this, e), e;
    }, r.prototype.abs = function() {
      return this.s < 0 ? this.negate() : this;
    }, r.prototype.compareTo = function(e) {
      var n = this.s - e.s;
      if (n != 0)
        return n;
      var i = this.t;
      if (n = i - e.t, n != 0)
        return this.s < 0 ? -n : n;
      for (; --i >= 0; )
        if ((n = this[i] - e[i]) != 0)
          return n;
      return 0;
    }, r.prototype.bitLength = function() {
      return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
    }, r.prototype.mod = function(e) {
      var n = nbi();
      return this.abs().divRemTo(e, null, n), this.s < 0 && n.compareTo(r.ZERO) > 0 && e.subTo(n, n), n;
    }, r.prototype.modPowInt = function(e, n) {
      var i;
      return e < 256 || n.isEven() ? i = new Classic(n) : i = new Montgomery(n), this.exp(e, i);
    }, r.prototype.clone = function() {
      var e = nbi();
      return this.copyTo(e), e;
    }, r.prototype.intValue = function() {
      if (this.s < 0) {
        if (this.t == 1)
          return this[0] - this.DV;
        if (this.t == 0)
          return -1;
      } else {
        if (this.t == 1)
          return this[0];
        if (this.t == 0)
          return 0;
      }
      return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
    }, r.prototype.byteValue = function() {
      return this.t == 0 ? this.s : this[0] << 24 >> 24;
    }, r.prototype.shortValue = function() {
      return this.t == 0 ? this.s : this[0] << 16 >> 16;
    }, r.prototype.signum = function() {
      return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
    }, r.prototype.toByteArray = function() {
      var e = this.t, n = [];
      n[0] = this.s;
      var i = this.DB - e * this.DB % 8, s, o = 0;
      if (e-- > 0)
        for (i < this.DB && (s = this[e] >> i) != (this.s & this.DM) >> i && (n[o++] = s | this.s << this.DB - i); e >= 0; )
          i < 8 ? (s = (this[e] & (1 << i) - 1) << 8 - i, s |= this[--e] >> (i += this.DB - 8)) : (s = this[e] >> (i -= 8) & 255, i <= 0 && (i += this.DB, --e)), s & 128 && (s |= -256), o == 0 && (this.s & 128) != (s & 128) && ++o, (o > 0 || s != this.s) && (n[o++] = s);
      return n;
    }, r.prototype.equals = function(e) {
      return this.compareTo(e) == 0;
    }, r.prototype.min = function(e) {
      return this.compareTo(e) < 0 ? this : e;
    }, r.prototype.max = function(e) {
      return this.compareTo(e) > 0 ? this : e;
    }, r.prototype.and = function(e) {
      var n = nbi();
      return this.bitwiseTo(e, op_and, n), n;
    }, r.prototype.or = function(e) {
      var n = nbi();
      return this.bitwiseTo(e, op_or, n), n;
    }, r.prototype.xor = function(e) {
      var n = nbi();
      return this.bitwiseTo(e, op_xor, n), n;
    }, r.prototype.andNot = function(e) {
      var n = nbi();
      return this.bitwiseTo(e, op_andnot, n), n;
    }, r.prototype.not = function() {
      for (var e = nbi(), n = 0; n < this.t; ++n)
        e[n] = this.DM & ~this[n];
      return e.t = this.t, e.s = ~this.s, e;
    }, r.prototype.shiftLeft = function(e) {
      var n = nbi();
      return e < 0 ? this.rShiftTo(-e, n) : this.lShiftTo(e, n), n;
    }, r.prototype.shiftRight = function(e) {
      var n = nbi();
      return e < 0 ? this.lShiftTo(-e, n) : this.rShiftTo(e, n), n;
    }, r.prototype.getLowestSetBit = function() {
      for (var e = 0; e < this.t; ++e)
        if (this[e] != 0)
          return e * this.DB + lbit(this[e]);
      return this.s < 0 ? this.t * this.DB : -1;
    }, r.prototype.bitCount = function() {
      for (var e = 0, n = this.s & this.DM, i = 0; i < this.t; ++i)
        e += cbit(this[i] ^ n);
      return e;
    }, r.prototype.testBit = function(e) {
      var n = Math.floor(e / this.DB);
      return n >= this.t ? this.s != 0 : (this[n] & 1 << e % this.DB) != 0;
    }, r.prototype.setBit = function(e) {
      return this.changeBit(e, op_or);
    }, r.prototype.clearBit = function(e) {
      return this.changeBit(e, op_andnot);
    }, r.prototype.flipBit = function(e) {
      return this.changeBit(e, op_xor);
    }, r.prototype.add = function(e) {
      var n = nbi();
      return this.addTo(e, n), n;
    }, r.prototype.subtract = function(e) {
      var n = nbi();
      return this.subTo(e, n), n;
    }, r.prototype.multiply = function(e) {
      var n = nbi();
      return this.multiplyTo(e, n), n;
    }, r.prototype.divide = function(e) {
      var n = nbi();
      return this.divRemTo(e, n, null), n;
    }, r.prototype.remainder = function(e) {
      var n = nbi();
      return this.divRemTo(e, null, n), n;
    }, r.prototype.divideAndRemainder = function(e) {
      var n = nbi(), i = nbi();
      return this.divRemTo(e, n, i), [n, i];
    }, r.prototype.modPow = function(e, n) {
      var i = e.bitLength(), s, o = nbv(1), a;
      if (i <= 0)
        return o;
      i < 18 ? s = 1 : i < 48 ? s = 3 : i < 144 ? s = 4 : i < 768 ? s = 5 : s = 6, i < 8 ? a = new Classic(n) : n.isEven() ? a = new Barrett(n) : a = new Montgomery(n);
      var u = [], l = 3, p = s - 1, d = (1 << s) - 1;
      if (u[1] = a.convert(this), s > 1) {
        var g = nbi();
        for (a.sqrTo(u[1], g); l <= d; )
          u[l] = nbi(), a.mulTo(g, u[l - 2], u[l]), l += 2;
      }
      var b = e.t - 1, S, m = !0, v = nbi(), y;
      for (i = nbits(e[b]) - 1; b >= 0; ) {
        for (i >= p ? S = e[b] >> i - p & d : (S = (e[b] & (1 << i + 1) - 1) << p - i, b > 0 && (S |= e[b - 1] >> this.DB + i - p)), l = s; !(S & 1); )
          S >>= 1, --l;
        if ((i -= l) < 0 && (i += this.DB, --b), m)
          u[S].copyTo(o), m = !1;
        else {
          for (; l > 1; )
            a.sqrTo(o, v), a.sqrTo(v, o), l -= 2;
          l > 0 ? a.sqrTo(o, v) : (y = o, o = v, v = y), a.mulTo(v, u[S], o);
        }
        for (; b >= 0 && !(e[b] & 1 << i); )
          a.sqrTo(o, v), y = o, o = v, v = y, --i < 0 && (i = this.DB - 1, --b);
      }
      return a.revert(o);
    }, r.prototype.modInverse = function(e) {
      var n = e.isEven();
      if (this.isEven() && n || e.signum() == 0)
        return r.ZERO;
      for (var i = e.clone(), s = this.clone(), o = nbv(1), a = nbv(0), u = nbv(0), l = nbv(1); i.signum() != 0; ) {
        for (; i.isEven(); )
          i.rShiftTo(1, i), n ? ((!o.isEven() || !a.isEven()) && (o.addTo(this, o), a.subTo(e, a)), o.rShiftTo(1, o)) : a.isEven() || a.subTo(e, a), a.rShiftTo(1, a);
        for (; s.isEven(); )
          s.rShiftTo(1, s), n ? ((!u.isEven() || !l.isEven()) && (u.addTo(this, u), l.subTo(e, l)), u.rShiftTo(1, u)) : l.isEven() || l.subTo(e, l), l.rShiftTo(1, l);
        i.compareTo(s) >= 0 ? (i.subTo(s, i), n && o.subTo(u, o), a.subTo(l, a)) : (s.subTo(i, s), n && u.subTo(o, u), l.subTo(a, l));
      }
      if (s.compareTo(r.ONE) != 0)
        return r.ZERO;
      if (l.compareTo(e) >= 0)
        return l.subtract(e);
      if (l.signum() < 0)
        l.addTo(e, l);
      else
        return l;
      return l.signum() < 0 ? l.add(e) : l;
    }, r.prototype.pow = function(e) {
      return this.exp(e, new NullExp());
    }, r.prototype.gcd = function(e) {
      var n = this.s < 0 ? this.negate() : this.clone(), i = e.s < 0 ? e.negate() : e.clone();
      if (n.compareTo(i) < 0) {
        var s = n;
        n = i, i = s;
      }
      var o = n.getLowestSetBit(), a = i.getLowestSetBit();
      if (a < 0)
        return n;
      for (o < a && (a = o), a > 0 && (n.rShiftTo(a, n), i.rShiftTo(a, i)); n.signum() > 0; )
        (o = n.getLowestSetBit()) > 0 && n.rShiftTo(o, n), (o = i.getLowestSetBit()) > 0 && i.rShiftTo(o, i), n.compareTo(i) >= 0 ? (n.subTo(i, n), n.rShiftTo(1, n)) : (i.subTo(n, i), i.rShiftTo(1, i));
      return a > 0 && i.lShiftTo(a, i), i;
    }, r.prototype.isProbablePrime = function(e) {
      var n, i = this.abs();
      if (i.t == 1 && i[0] <= lowprimes[lowprimes.length - 1]) {
        for (n = 0; n < lowprimes.length; ++n)
          if (i[0] == lowprimes[n])
            return !0;
        return !1;
      }
      if (i.isEven())
        return !1;
      for (n = 1; n < lowprimes.length; ) {
        for (var s = lowprimes[n], o = n + 1; o < lowprimes.length && s < lplim; )
          s *= lowprimes[o++];
        for (s = i.modInt(s); n < o; )
          if (s % lowprimes[n++] == 0)
            return !1;
      }
      return i.millerRabin(e);
    }, r.prototype.copyTo = function(e) {
      for (var n = this.t - 1; n >= 0; --n)
        e[n] = this[n];
      e.t = this.t, e.s = this.s;
    }, r.prototype.fromInt = function(e) {
      this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
    }, r.prototype.fromString = function(e, n) {
      var i;
      if (n == 16)
        i = 4;
      else if (n == 8)
        i = 3;
      else if (n == 256)
        i = 8;
      else if (n == 2)
        i = 1;
      else if (n == 32)
        i = 5;
      else if (n == 4)
        i = 2;
      else {
        this.fromRadix(e, n);
        return;
      }
      this.t = 0, this.s = 0;
      for (var s = e.length, o = !1, a = 0; --s >= 0; ) {
        var u = i == 8 ? +e[s] & 255 : intAt(e, s);
        if (u < 0) {
          e.charAt(s) == "-" && (o = !0);
          continue;
        }
        o = !1, a == 0 ? this[this.t++] = u : a + i > this.DB ? (this[this.t - 1] |= (u & (1 << this.DB - a) - 1) << a, this[this.t++] = u >> this.DB - a) : this[this.t - 1] |= u << a, a += i, a >= this.DB && (a -= this.DB);
      }
      i == 8 && +e[0] & 128 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), o && r.ZERO.subTo(this, this);
    }, r.prototype.clamp = function() {
      for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e; )
        --this.t;
    }, r.prototype.dlShiftTo = function(e, n) {
      var i;
      for (i = this.t - 1; i >= 0; --i)
        n[i + e] = this[i];
      for (i = e - 1; i >= 0; --i)
        n[i] = 0;
      n.t = this.t + e, n.s = this.s;
    }, r.prototype.drShiftTo = function(e, n) {
      for (var i = e; i < this.t; ++i)
        n[i - e] = this[i];
      n.t = Math.max(this.t - e, 0), n.s = this.s;
    }, r.prototype.lShiftTo = function(e, n) {
      for (var i = e % this.DB, s = this.DB - i, o = (1 << s) - 1, a = Math.floor(e / this.DB), u = this.s << i & this.DM, l = this.t - 1; l >= 0; --l)
        n[l + a + 1] = this[l] >> s | u, u = (this[l] & o) << i;
      for (var l = a - 1; l >= 0; --l)
        n[l] = 0;
      n[a] = u, n.t = this.t + a + 1, n.s = this.s, n.clamp();
    }, r.prototype.rShiftTo = function(e, n) {
      n.s = this.s;
      var i = Math.floor(e / this.DB);
      if (i >= this.t) {
        n.t = 0;
        return;
      }
      var s = e % this.DB, o = this.DB - s, a = (1 << s) - 1;
      n[0] = this[i] >> s;
      for (var u = i + 1; u < this.t; ++u)
        n[u - i - 1] |= (this[u] & a) << o, n[u - i] = this[u] >> s;
      s > 0 && (n[this.t - i - 1] |= (this.s & a) << o), n.t = this.t - i, n.clamp();
    }, r.prototype.subTo = function(e, n) {
      for (var i = 0, s = 0, o = Math.min(e.t, this.t); i < o; )
        s += this[i] - e[i], n[i++] = s & this.DM, s >>= this.DB;
      if (e.t < this.t) {
        for (s -= e.s; i < this.t; )
          s += this[i], n[i++] = s & this.DM, s >>= this.DB;
        s += this.s;
      } else {
        for (s += this.s; i < e.t; )
          s -= e[i], n[i++] = s & this.DM, s >>= this.DB;
        s -= e.s;
      }
      n.s = s < 0 ? -1 : 0, s < -1 ? n[i++] = this.DV + s : s > 0 && (n[i++] = s), n.t = i, n.clamp();
    }, r.prototype.multiplyTo = function(e, n) {
      var i = this.abs(), s = e.abs(), o = i.t;
      for (n.t = o + s.t; --o >= 0; )
        n[o] = 0;
      for (o = 0; o < s.t; ++o)
        n[o + i.t] = i.am(0, s[o], n, o, 0, i.t);
      n.s = 0, n.clamp(), this.s != e.s && r.ZERO.subTo(n, n);
    }, r.prototype.squareTo = function(e) {
      for (var n = this.abs(), i = e.t = 2 * n.t; --i >= 0; )
        e[i] = 0;
      for (i = 0; i < n.t - 1; ++i) {
        var s = n.am(i, n[i], e, 2 * i, 0, 1);
        (e[i + n.t] += n.am(i + 1, 2 * n[i], e, 2 * i + 1, s, n.t - i - 1)) >= n.DV && (e[i + n.t] -= n.DV, e[i + n.t + 1] = 1);
      }
      e.t > 0 && (e[e.t - 1] += n.am(i, n[i], e, 2 * i, 0, 1)), e.s = 0, e.clamp();
    }, r.prototype.divRemTo = function(e, n, i) {
      var s = e.abs();
      if (!(s.t <= 0)) {
        var o = this.abs();
        if (o.t < s.t) {
          n != null && n.fromInt(0), i != null && this.copyTo(i);
          return;
        }
        i == null && (i = nbi());
        var a = nbi(), u = this.s, l = e.s, p = this.DB - nbits(s[s.t - 1]);
        p > 0 ? (s.lShiftTo(p, a), o.lShiftTo(p, i)) : (s.copyTo(a), o.copyTo(i));
        var d = a.t, g = a[d - 1];
        if (g != 0) {
          var b = g * (1 << this.F1) + (d > 1 ? a[d - 2] >> this.F2 : 0), S = this.FV / b, m = (1 << this.F1) / b, v = 1 << this.F2, y = i.t, T = y - d, E = n ?? nbi();
          for (a.dlShiftTo(T, E), i.compareTo(E) >= 0 && (i[i.t++] = 1, i.subTo(E, i)), r.ONE.dlShiftTo(d, E), E.subTo(a, a); a.t < d; )
            a[a.t++] = 0;
          for (; --T >= 0; ) {
            var R = i[--y] == g ? this.DM : Math.floor(i[y] * S + (i[y - 1] + v) * m);
            if ((i[y] += a.am(0, R, i, T, 0, d)) < R)
              for (a.dlShiftTo(T, E), i.subTo(E, i); i[y] < --R; )
                i.subTo(E, i);
          }
          n != null && (i.drShiftTo(d, n), u != l && r.ZERO.subTo(n, n)), i.t = d, i.clamp(), p > 0 && i.rShiftTo(p, i), u < 0 && r.ZERO.subTo(i, i);
        }
      }
    }, r.prototype.invDigit = function() {
      if (this.t < 1)
        return 0;
      var e = this[0];
      if (!(e & 1))
        return 0;
      var n = e & 3;
      return n = n * (2 - (e & 15) * n) & 15, n = n * (2 - (e & 255) * n) & 255, n = n * (2 - ((e & 65535) * n & 65535)) & 65535, n = n * (2 - e * n % this.DV) % this.DV, n > 0 ? this.DV - n : -n;
    }, r.prototype.isEven = function() {
      return (this.t > 0 ? this[0] & 1 : this.s) == 0;
    }, r.prototype.exp = function(e, n) {
      if (e > 4294967295 || e < 1)
        return r.ONE;
      var i = nbi(), s = nbi(), o = n.convert(this), a = nbits(e) - 1;
      for (o.copyTo(i); --a >= 0; )
        if (n.sqrTo(i, s), (e & 1 << a) > 0)
          n.mulTo(s, o, i);
        else {
          var u = i;
          i = s, s = u;
        }
      return n.revert(i);
    }, r.prototype.chunkSize = function(e) {
      return Math.floor(Math.LN2 * this.DB / Math.log(e));
    }, r.prototype.toRadix = function(e) {
      if (e == null && (e = 10), this.signum() == 0 || e < 2 || e > 36)
        return "0";
      var n = this.chunkSize(e), i = Math.pow(e, n), s = nbv(i), o = nbi(), a = nbi(), u = "";
      for (this.divRemTo(s, o, a); o.signum() > 0; )
        u = (i + a.intValue()).toString(e).substr(1) + u, o.divRemTo(s, o, a);
      return a.intValue().toString(e) + u;
    }, r.prototype.fromRadix = function(e, n) {
      this.fromInt(0), n == null && (n = 10);
      for (var i = this.chunkSize(n), s = Math.pow(n, i), o = !1, a = 0, u = 0, l = 0; l < e.length; ++l) {
        var p = intAt(e, l);
        if (p < 0) {
          e.charAt(l) == "-" && this.signum() == 0 && (o = !0);
          continue;
        }
        u = n * u + p, ++a >= i && (this.dMultiply(s), this.dAddOffset(u, 0), a = 0, u = 0);
      }
      a > 0 && (this.dMultiply(Math.pow(n, a)), this.dAddOffset(u, 0)), o && r.ZERO.subTo(this, this);
    }, r.prototype.fromNumber = function(e, n, i) {
      if (typeof n == "number")
        if (e < 2)
          this.fromInt(1);
        else
          for (this.fromNumber(e, i), this.testBit(e - 1) || this.bitwiseTo(r.ONE.shiftLeft(e - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(n); )
            this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(r.ONE.shiftLeft(e - 1), this);
      else {
        var s = [], o = e & 7;
        s.length = (e >> 3) + 1, n.nextBytes(s), o > 0 ? s[0] &= (1 << o) - 1 : s[0] = 0, this.fromString(s, 256);
      }
    }, r.prototype.bitwiseTo = function(e, n, i) {
      var s, o, a = Math.min(e.t, this.t);
      for (s = 0; s < a; ++s)
        i[s] = n(this[s], e[s]);
      if (e.t < this.t) {
        for (o = e.s & this.DM, s = a; s < this.t; ++s)
          i[s] = n(this[s], o);
        i.t = this.t;
      } else {
        for (o = this.s & this.DM, s = a; s < e.t; ++s)
          i[s] = n(o, e[s]);
        i.t = e.t;
      }
      i.s = n(this.s, e.s), i.clamp();
    }, r.prototype.changeBit = function(e, n) {
      var i = r.ONE.shiftLeft(e);
      return this.bitwiseTo(i, n, i), i;
    }, r.prototype.addTo = function(e, n) {
      for (var i = 0, s = 0, o = Math.min(e.t, this.t); i < o; )
        s += this[i] + e[i], n[i++] = s & this.DM, s >>= this.DB;
      if (e.t < this.t) {
        for (s += e.s; i < this.t; )
          s += this[i], n[i++] = s & this.DM, s >>= this.DB;
        s += this.s;
      } else {
        for (s += this.s; i < e.t; )
          s += e[i], n[i++] = s & this.DM, s >>= this.DB;
        s += e.s;
      }
      n.s = s < 0 ? -1 : 0, s > 0 ? n[i++] = s : s < -1 && (n[i++] = this.DV + s), n.t = i, n.clamp();
    }, r.prototype.dMultiply = function(e) {
      this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
    }, r.prototype.dAddOffset = function(e, n) {
      if (e != 0) {
        for (; this.t <= n; )
          this[this.t++] = 0;
        for (this[n] += e; this[n] >= this.DV; )
          this[n] -= this.DV, ++n >= this.t && (this[this.t++] = 0), ++this[n];
      }
    }, r.prototype.multiplyLowerTo = function(e, n, i) {
      var s = Math.min(this.t + e.t, n);
      for (i.s = 0, i.t = s; s > 0; )
        i[--s] = 0;
      for (var o = i.t - this.t; s < o; ++s)
        i[s + this.t] = this.am(0, e[s], i, s, 0, this.t);
      for (var o = Math.min(e.t, n); s < o; ++s)
        this.am(0, e[s], i, s, 0, n - s);
      i.clamp();
    }, r.prototype.multiplyUpperTo = function(e, n, i) {
      --n;
      var s = i.t = this.t + e.t - n;
      for (i.s = 0; --s >= 0; )
        i[s] = 0;
      for (s = Math.max(n - this.t, 0); s < e.t; ++s)
        i[this.t + s - n] = this.am(n - s, e[s], i, 0, 0, this.t + s - n);
      i.clamp(), i.drShiftTo(1, i);
    }, r.prototype.modInt = function(e) {
      if (e <= 0)
        return 0;
      var n = this.DV % e, i = this.s < 0 ? e - 1 : 0;
      if (this.t > 0)
        if (n == 0)
          i = this[0] % e;
        else
          for (var s = this.t - 1; s >= 0; --s)
            i = (n * i + this[s]) % e;
      return i;
    }, r.prototype.millerRabin = function(e) {
      var n = this.subtract(r.ONE), i = n.getLowestSetBit();
      if (i <= 0)
        return !1;
      var s = n.shiftRight(i);
      e = e + 1 >> 1, e > lowprimes.length && (e = lowprimes.length);
      for (var o = nbi(), a = 0; a < e; ++a) {
        o.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
        var u = o.modPow(s, this);
        if (u.compareTo(r.ONE) != 0 && u.compareTo(n) != 0) {
          for (var l = 1; l++ < i && u.compareTo(n) != 0; )
            if (u = u.modPowInt(2, this), u.compareTo(r.ONE) == 0)
              return !1;
          if (u.compareTo(n) != 0)
            return !1;
        }
      }
      return !0;
    }, r.prototype.square = function() {
      var e = nbi();
      return this.squareTo(e), e;
    }, r.prototype.gcda = function(e, n) {
      var i = this.s < 0 ? this.negate() : this.clone(), s = e.s < 0 ? e.negate() : e.clone();
      if (i.compareTo(s) < 0) {
        var o = i;
        i = s, s = o;
      }
      var a = i.getLowestSetBit(), u = s.getLowestSetBit();
      if (u < 0) {
        n(i);
        return;
      }
      a < u && (u = a), u > 0 && (i.rShiftTo(u, i), s.rShiftTo(u, s));
      var l = function() {
        (a = i.getLowestSetBit()) > 0 && i.rShiftTo(a, i), (a = s.getLowestSetBit()) > 0 && s.rShiftTo(a, s), i.compareTo(s) >= 0 ? (i.subTo(s, i), i.rShiftTo(1, i)) : (s.subTo(i, s), s.rShiftTo(1, s)), i.signum() > 0 ? setTimeout(l, 0) : (u > 0 && s.lShiftTo(u, s), setTimeout(function() {
          n(s);
        }, 0));
      };
      setTimeout(l, 10);
    }, r.prototype.fromNumberAsync = function(e, n, i, s) {
      if (typeof n == "number")
        if (e < 2)
          this.fromInt(1);
        else {
          this.fromNumber(e, i), this.testBit(e - 1) || this.bitwiseTo(r.ONE.shiftLeft(e - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0);
          var o = this, a = function() {
            o.dAddOffset(2, 0), o.bitLength() > e && o.subTo(r.ONE.shiftLeft(e - 1), o), o.isProbablePrime(n) ? setTimeout(function() {
              s();
            }, 0) : setTimeout(a, 0);
          };
          setTimeout(a, 0);
        }
      else {
        var u = [], l = e & 7;
        u.length = (e >> 3) + 1, n.nextBytes(u), l > 0 ? u[0] &= (1 << l) - 1 : u[0] = 0, this.fromString(u, 256);
      }
    }, r;
  }()
), NullExp = (
  /** @class */
  function() {
    function r() {
    }
    return r.prototype.convert = function(e) {
      return e;
    }, r.prototype.revert = function(e) {
      return e;
    }, r.prototype.mulTo = function(e, n, i) {
      e.multiplyTo(n, i);
    }, r.prototype.sqrTo = function(e, n) {
      e.squareTo(n);
    }, r;
  }()
), Classic = (
  /** @class */
  function() {
    function r(e) {
      this.m = e;
    }
    return r.prototype.convert = function(e) {
      return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
    }, r.prototype.revert = function(e) {
      return e;
    }, r.prototype.reduce = function(e) {
      e.divRemTo(this.m, null, e);
    }, r.prototype.mulTo = function(e, n, i) {
      e.multiplyTo(n, i), this.reduce(i);
    }, r.prototype.sqrTo = function(e, n) {
      e.squareTo(n), this.reduce(n);
    }, r;
  }()
), Montgomery = (
  /** @class */
  function() {
    function r(e) {
      this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
    }
    return r.prototype.convert = function(e) {
      var n = nbi();
      return e.abs().dlShiftTo(this.m.t, n), n.divRemTo(this.m, null, n), e.s < 0 && n.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(n, n), n;
    }, r.prototype.revert = function(e) {
      var n = nbi();
      return e.copyTo(n), this.reduce(n), n;
    }, r.prototype.reduce = function(e) {
      for (; e.t <= this.mt2; )
        e[e.t++] = 0;
      for (var n = 0; n < this.m.t; ++n) {
        var i = e[n] & 32767, s = i * this.mpl + ((i * this.mph + (e[n] >> 15) * this.mpl & this.um) << 15) & e.DM;
        for (i = n + this.m.t, e[i] += this.m.am(0, s, e, n, 0, this.m.t); e[i] >= e.DV; )
          e[i] -= e.DV, e[++i]++;
      }
      e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
    }, r.prototype.mulTo = function(e, n, i) {
      e.multiplyTo(n, i), this.reduce(i);
    }, r.prototype.sqrTo = function(e, n) {
      e.squareTo(n), this.reduce(n);
    }, r;
  }()
), Barrett = (
  /** @class */
  function() {
    function r(e) {
      this.m = e, this.r2 = nbi(), this.q3 = nbi(), BigInteger.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e);
    }
    return r.prototype.convert = function(e) {
      if (e.s < 0 || e.t > 2 * this.m.t)
        return e.mod(this.m);
      if (e.compareTo(this.m) < 0)
        return e;
      var n = nbi();
      return e.copyTo(n), this.reduce(n), n;
    }, r.prototype.revert = function(e) {
      return e;
    }, r.prototype.reduce = function(e) {
      for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; )
        e.dAddOffset(1, this.m.t + 1);
      for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; )
        e.subTo(this.m, e);
    }, r.prototype.mulTo = function(e, n, i) {
      e.multiplyTo(n, i), this.reduce(i);
    }, r.prototype.sqrTo = function(e, n) {
      e.squareTo(n), this.reduce(n);
    }, r;
  }()
);
function nbi() {
  return new BigInteger(null);
}
function parseBigInt(r, e) {
  return new BigInteger(r, e);
}
var inBrowser = typeof navigator < "u";
inBrowser && j_lm && navigator.appName == "Microsoft Internet Explorer" ? (BigInteger.prototype.am = function(e, n, i, s, o, a) {
  for (var u = n & 32767, l = n >> 15; --a >= 0; ) {
    var p = this[e] & 32767, d = this[e++] >> 15, g = l * p + d * u;
    p = u * p + ((g & 32767) << 15) + i[s] + (o & 1073741823), o = (p >>> 30) + (g >>> 15) + l * d + (o >>> 30), i[s++] = p & 1073741823;
  }
  return o;
}, dbits = 30) : inBrowser && j_lm && navigator.appName != "Netscape" ? (BigInteger.prototype.am = function(e, n, i, s, o, a) {
  for (; --a >= 0; ) {
    var u = n * this[e++] + i[s] + o;
    o = Math.floor(u / 67108864), i[s++] = u & 67108863;
  }
  return o;
}, dbits = 26) : (BigInteger.prototype.am = function(e, n, i, s, o, a) {
  for (var u = n & 16383, l = n >> 14; --a >= 0; ) {
    var p = this[e] & 16383, d = this[e++] >> 14, g = l * p + d * u;
    p = u * p + ((g & 16383) << 14) + i[s] + o, o = (p >> 28) + (g >> 14) + l * d, i[s++] = p & 268435455;
  }
  return o;
}, dbits = 28);
BigInteger.prototype.DB = dbits;
BigInteger.prototype.DM = (1 << dbits) - 1;
BigInteger.prototype.DV = 1 << dbits;
var BI_FP = 52;
BigInteger.prototype.FV = Math.pow(2, BI_FP);
BigInteger.prototype.F1 = BI_FP - dbits;
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
var BI_RC = [], rr, vv;
rr = 48;
for (vv = 0; vv <= 9; ++vv)
  BI_RC[rr++] = vv;
rr = 97;
for (vv = 10; vv < 36; ++vv)
  BI_RC[rr++] = vv;
rr = 65;
for (vv = 10; vv < 36; ++vv)
  BI_RC[rr++] = vv;
function intAt(r, e) {
  var n = BI_RC[r.charCodeAt(e)];
  return n ?? -1;
}
function nbv(r) {
  var e = nbi();
  return e.fromInt(r), e;
}
function nbits(r) {
  var e = 1, n;
  return (n = r >>> 16) != 0 && (r = n, e += 16), (n = r >> 8) != 0 && (r = n, e += 8), (n = r >> 4) != 0 && (r = n, e += 4), (n = r >> 2) != 0 && (r = n, e += 2), (n = r >> 1) != 0 && (r = n, e += 1), e;
}
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);
var Arcfour = (
  /** @class */
  function() {
    function r() {
      this.i = 0, this.j = 0, this.S = [];
    }
    return r.prototype.init = function(e) {
      var n, i, s;
      for (n = 0; n < 256; ++n)
        this.S[n] = n;
      for (i = 0, n = 0; n < 256; ++n)
        i = i + this.S[n] + e[n % e.length] & 255, s = this.S[n], this.S[n] = this.S[i], this.S[i] = s;
      this.i = 0, this.j = 0;
    }, r.prototype.next = function() {
      var e;
      return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
    }, r;
  }()
);
function prng_newstate() {
  return new Arcfour();
}
var rng_psize = 256, rng_state, rng_pool = null, rng_pptr;
if (rng_pool == null) {
  rng_pool = [], rng_pptr = 0;
  var t = void 0;
  if (typeof window < "u" && window.crypto && window.crypto.getRandomValues) {
    var z = new Uint32Array(256);
    for (window.crypto.getRandomValues(z), t = 0; t < z.length; ++t)
      rng_pool[rng_pptr++] = z[t] & 255;
  }
  var count = 0, onMouseMoveListener_1 = function(r) {
    if (count = count || 0, count >= 256 || rng_pptr >= rng_psize) {
      window.removeEventListener ? window.removeEventListener("mousemove", onMouseMoveListener_1, !1) : window.detachEvent && window.detachEvent("onmousemove", onMouseMoveListener_1);
      return;
    }
    try {
      var e = r.x + r.y;
      rng_pool[rng_pptr++] = e & 255, count += 1;
    } catch {
    }
  };
  typeof window < "u" && (window.addEventListener ? window.addEventListener("mousemove", onMouseMoveListener_1, !1) : window.attachEvent && window.attachEvent("onmousemove", onMouseMoveListener_1));
}
function rng_get_byte() {
  if (rng_state == null) {
    for (rng_state = prng_newstate(); rng_pptr < rng_psize; ) {
      var r = Math.floor(65536 * Math.random());
      rng_pool[rng_pptr++] = r & 255;
    }
    for (rng_state.init(rng_pool), rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
      rng_pool[rng_pptr] = 0;
    rng_pptr = 0;
  }
  return rng_state.next();
}
var SecureRandom = (
  /** @class */
  function() {
    function r() {
    }
    return r.prototype.nextBytes = function(e) {
      for (var n = 0; n < e.length; ++n)
        e[n] = rng_get_byte();
    }, r;
  }()
);
function pkcs1pad1(r, e) {
  if (e < r.length + 22)
    return console.error("Message too long for RSA"), null;
  for (var n = e - r.length - 6, i = "", s = 0; s < n; s += 2)
    i += "ff";
  var o = "0001" + i + "00" + r;
  return parseBigInt(o, 16);
}
function pkcs1pad2(r, e) {
  if (e < r.length + 11)
    return console.error("Message too long for RSA"), null;
  for (var n = [], i = r.length - 1; i >= 0 && e > 0; ) {
    var s = r.charCodeAt(i--);
    s < 128 ? n[--e] = s : s > 127 && s < 2048 ? (n[--e] = s & 63 | 128, n[--e] = s >> 6 | 192) : (n[--e] = s & 63 | 128, n[--e] = s >> 6 & 63 | 128, n[--e] = s >> 12 | 224);
  }
  n[--e] = 0;
  for (var o = new SecureRandom(), a = []; e > 2; ) {
    for (a[0] = 0; a[0] == 0; )
      o.nextBytes(a);
    n[--e] = a[0];
  }
  return n[--e] = 2, n[--e] = 0, new BigInteger(n);
}
var RSAKey = (
  /** @class */
  function() {
    function r() {
      this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
    }
    return r.prototype.doPublic = function(e) {
      return e.modPowInt(this.e, this.n);
    }, r.prototype.doPrivate = function(e) {
      if (this.p == null || this.q == null)
        return e.modPow(this.d, this.n);
      for (var n = e.mod(this.p).modPow(this.dmp1, this.p), i = e.mod(this.q).modPow(this.dmq1, this.q); n.compareTo(i) < 0; )
        n = n.add(this.p);
      return n.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i);
    }, r.prototype.setPublic = function(e, n) {
      e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16)) : console.error("Invalid RSA public key");
    }, r.prototype.encrypt = function(e) {
      var n = this.n.bitLength() + 7 >> 3, i = pkcs1pad2(e, n);
      if (i == null)
        return null;
      var s = this.doPublic(i);
      if (s == null)
        return null;
      for (var o = s.toString(16), a = o.length, u = 0; u < n * 2 - a; u++)
        o = "0" + o;
      return o;
    }, r.prototype.setPrivate = function(e, n, i) {
      e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16), this.d = parseBigInt(i, 16)) : console.error("Invalid RSA private key");
    }, r.prototype.setPrivateEx = function(e, n, i, s, o, a, u, l) {
      e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16), this.d = parseBigInt(i, 16), this.p = parseBigInt(s, 16), this.q = parseBigInt(o, 16), this.dmp1 = parseBigInt(a, 16), this.dmq1 = parseBigInt(u, 16), this.coeff = parseBigInt(l, 16)) : console.error("Invalid RSA private key");
    }, r.prototype.generate = function(e, n) {
      var i = new SecureRandom(), s = e >> 1;
      this.e = parseInt(n, 16);
      for (var o = new BigInteger(n, 16); ; ) {
        for (; this.p = new BigInteger(e - s, 1, i), !(this.p.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)); )
          ;
        for (; this.q = new BigInteger(s, 1, i), !(this.q.subtract(BigInteger.ONE).gcd(o).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)); )
          ;
        if (this.p.compareTo(this.q) <= 0) {
          var a = this.p;
          this.p = this.q, this.q = a;
        }
        var u = this.p.subtract(BigInteger.ONE), l = this.q.subtract(BigInteger.ONE), p = u.multiply(l);
        if (p.gcd(o).compareTo(BigInteger.ONE) == 0) {
          this.n = this.p.multiply(this.q), this.d = o.modInverse(p), this.dmp1 = this.d.mod(u), this.dmq1 = this.d.mod(l), this.coeff = this.q.modInverse(this.p);
          break;
        }
      }
    }, r.prototype.decrypt = function(e) {
      var n = parseBigInt(e, 16), i = this.doPrivate(n);
      return i == null ? null : pkcs1unpad2(i, this.n.bitLength() + 7 >> 3);
    }, r.prototype.generateAsync = function(e, n, i) {
      var s = new SecureRandom(), o = e >> 1;
      this.e = parseInt(n, 16);
      var a = new BigInteger(n, 16), u = this, l = function() {
        var p = function() {
          if (u.p.compareTo(u.q) <= 0) {
            var b = u.p;
            u.p = u.q, u.q = b;
          }
          var S = u.p.subtract(BigInteger.ONE), m = u.q.subtract(BigInteger.ONE), v = S.multiply(m);
          v.gcd(a).compareTo(BigInteger.ONE) == 0 ? (u.n = u.p.multiply(u.q), u.d = a.modInverse(v), u.dmp1 = u.d.mod(S), u.dmq1 = u.d.mod(m), u.coeff = u.q.modInverse(u.p), setTimeout(function() {
            i();
          }, 0)) : setTimeout(l, 0);
        }, d = function() {
          u.q = nbi(), u.q.fromNumberAsync(o, 1, s, function() {
            u.q.subtract(BigInteger.ONE).gcda(a, function(b) {
              b.compareTo(BigInteger.ONE) == 0 && u.q.isProbablePrime(10) ? setTimeout(p, 0) : setTimeout(d, 0);
            });
          });
        }, g = function() {
          u.p = nbi(), u.p.fromNumberAsync(e - o, 1, s, function() {
            u.p.subtract(BigInteger.ONE).gcda(a, function(b) {
              b.compareTo(BigInteger.ONE) == 0 && u.p.isProbablePrime(10) ? setTimeout(d, 0) : setTimeout(g, 0);
            });
          });
        };
        setTimeout(g, 0);
      };
      setTimeout(l, 0);
    }, r.prototype.sign = function(e, n, i) {
      var s = getDigestHeader(i), o = s + n(e).toString(), a = pkcs1pad1(o, this.n.bitLength() / 4);
      if (a == null)
        return null;
      var u = this.doPrivate(a);
      if (u == null)
        return null;
      var l = u.toString(16);
      return l.length & 1 ? "0" + l : l;
    }, r.prototype.verify = function(e, n, i) {
      var s = parseBigInt(n, 16), o = this.doPublic(s);
      if (o == null)
        return null;
      var a = o.toString(16).replace(/^1f+00/, ""), u = removeDigestHeader(a);
      return u == i(e).toString();
    }, r;
  }()
);
function pkcs1unpad2(r, e) {
  for (var n = r.toByteArray(), i = 0; i < n.length && n[i] == 0; )
    ++i;
  if (n.length - i != e - 1 || n[i] != 2)
    return null;
  for (++i; n[i] != 0; )
    if (++i >= n.length)
      return null;
  for (var s = ""; ++i < n.length; ) {
    var o = n[i] & 255;
    o < 128 ? s += String.fromCharCode(o) : o > 191 && o < 224 ? (s += String.fromCharCode((o & 31) << 6 | n[i + 1] & 63), ++i) : (s += String.fromCharCode((o & 15) << 12 | (n[i + 1] & 63) << 6 | n[i + 2] & 63), i += 2);
  }
  return s;
}
var DIGEST_HEADERS = {
  md2: "3020300c06082a864886f70d020205000410",
  md5: "3020300c06082a864886f70d020505000410",
  sha1: "3021300906052b0e03021a05000414",
  sha224: "302d300d06096086480165030402040500041c",
  sha256: "3031300d060960864801650304020105000420",
  sha384: "3041300d060960864801650304020205000430",
  sha512: "3051300d060960864801650304020305000440",
  ripemd160: "3021300906052b2403020105000414"
};
function getDigestHeader(r) {
  return DIGEST_HEADERS[r] || "";
}
function removeDigestHeader(r) {
  for (var e in DIGEST_HEADERS)
    if (DIGEST_HEADERS.hasOwnProperty(e)) {
      var n = DIGEST_HEADERS[e], i = n.length;
      if (r.substr(0, i) == n)
        return r.substr(i);
    }
  return r;
}
/*!
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
var YAHOO = {};
YAHOO.lang = {
  /**
   * Utility to set up the prototype, constructor and superclass properties to
   * support an inheritance strategy that can chain constructors and methods.
   * Static members will not be inherited.
   *
   * @method extend
   * @static
   * @param {Function} subc   the object to modify
   * @param {Function} superc the object to inherit
   * @param {Object} overrides  additional properties/methods to add to the
   *                              subclass prototype.  These will override the
   *                              matching items obtained from the superclass
   *                              if present.
   */
  extend: function(r, e, n) {
    if (!e || !r)
      throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
    var i = function() {
    };
    if (i.prototype = e.prototype, r.prototype = new i(), r.prototype.constructor = r, r.superclass = e.prototype, e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), n) {
      var s;
      for (s in n)
        r.prototype[s] = n[s];
      var o = function() {
      }, a = ["toString", "valueOf"];
      try {
        /MSIE/.test(navigator.userAgent) && (o = function(u, l) {
          for (s = 0; s < a.length; s = s + 1) {
            var p = a[s], d = l[p];
            typeof d == "function" && d != Object.prototype[p] && (u[p] = d);
          }
        });
      } catch {
      }
      o(r.prototype, n);
    }
  }
};
/**
 * @fileOverview
 * @name asn1-1.0.js
 * @author Kenji Urushima kenji.urushima@gmail.com
 * @version asn1 1.0.13 (2017-Jun-02)
 * @since jsrsasign 2.1
 * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
 */
var KJUR = {};
(typeof KJUR.asn1 > "u" || !KJUR.asn1) && (KJUR.asn1 = {});
KJUR.asn1.ASN1Util = new function() {
  this.integerToByteHex = function(r) {
    var e = r.toString(16);
    return e.length % 2 == 1 && (e = "0" + e), e;
  }, this.bigIntToMinTwosComplementsHex = function(r) {
    var e = r.toString(16);
    if (e.substr(0, 1) != "-")
      e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);
    else {
      var n = e.substr(1), i = n.length;
      i % 2 == 1 ? i += 1 : e.match(/^[0-7]/) || (i += 2);
      for (var s = "", o = 0; o < i; o++)
        s += "f";
      var a = new BigInteger(s, 16), u = a.xor(r).add(BigInteger.ONE);
      e = u.toString(16).replace(/^-/, "");
    }
    return e;
  }, this.getPEMStringFromHex = function(r, e) {
    return hextopem(r, e);
  }, this.newObject = function(r) {
    var e = KJUR, n = e.asn1, i = n.DERBoolean, s = n.DERInteger, o = n.DERBitString, a = n.DEROctetString, u = n.DERNull, l = n.DERObjectIdentifier, p = n.DEREnumerated, d = n.DERUTF8String, g = n.DERNumericString, b = n.DERPrintableString, S = n.DERTeletexString, m = n.DERIA5String, v = n.DERUTCTime, y = n.DERGeneralizedTime, T = n.DERSequence, E = n.DERSet, R = n.DERTaggedObject, D = n.ASN1Util.newObject, x = Object.keys(r);
    if (x.length != 1)
      throw "key of param shall be only one.";
    var w = x[0];
    if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + w + ":") == -1)
      throw "undefined key: " + w;
    if (w == "bool")
      return new i(r[w]);
    if (w == "int")
      return new s(r[w]);
    if (w == "bitstr")
      return new o(r[w]);
    if (w == "octstr")
      return new a(r[w]);
    if (w == "null")
      return new u(r[w]);
    if (w == "oid")
      return new l(r[w]);
    if (w == "enum")
      return new p(r[w]);
    if (w == "utf8str")
      return new d(r[w]);
    if (w == "numstr")
      return new g(r[w]);
    if (w == "prnstr")
      return new b(r[w]);
    if (w == "telstr")
      return new S(r[w]);
    if (w == "ia5str")
      return new m(r[w]);
    if (w == "utctime")
      return new v(r[w]);
    if (w == "gentime")
      return new y(r[w]);
    if (w == "seq") {
      for (var O = r[w], k = [], P = 0; P < O.length; P++) {
        var U = D(O[P]);
        k.push(U);
      }
      return new T({ array: k });
    }
    if (w == "set") {
      for (var O = r[w], k = [], P = 0; P < O.length; P++) {
        var U = D(O[P]);
        k.push(U);
      }
      return new E({ array: k });
    }
    if (w == "tag") {
      var I = r[w];
      if (Object.prototype.toString.call(I) === "[object Array]" && I.length == 3) {
        var N = D(I[2]);
        return new R({
          tag: I[0],
          explicit: I[1],
          obj: N
        });
      } else {
        var B = {};
        if (I.explicit !== void 0 && (B.explicit = I.explicit), I.tag !== void 0 && (B.tag = I.tag), I.obj === void 0)
          throw "obj shall be specified for 'tag'.";
        return B.obj = D(I.obj), new R(B);
      }
    }
  }, this.jsonToASN1HEX = function(r) {
    var e = this.newObject(r);
    return e.getEncodedHex();
  };
}();
KJUR.asn1.ASN1Util.oidHexToInt = function(r) {
  for (var s = "", e = parseInt(r.substr(0, 2), 16), n = Math.floor(e / 40), i = e % 40, s = n + "." + i, o = "", a = 2; a < r.length; a += 2) {
    var u = parseInt(r.substr(a, 2), 16), l = ("00000000" + u.toString(2)).slice(-8);
    if (o = o + l.substr(1, 7), l.substr(0, 1) == "0") {
      var p = new BigInteger(o, 2);
      s = s + "." + p.toString(10), o = "";
    }
  }
  return s;
};
KJUR.asn1.ASN1Util.oidIntToHex = function(r) {
  var e = function(u) {
    var l = u.toString(16);
    return l.length == 1 && (l = "0" + l), l;
  }, n = function(u) {
    var l = "", p = new BigInteger(u, 10), d = p.toString(2), g = 7 - d.length % 7;
    g == 7 && (g = 0);
    for (var b = "", S = 0; S < g; S++)
      b += "0";
    d = b + d;
    for (var S = 0; S < d.length - 1; S += 7) {
      var m = d.substr(S, 7);
      S != d.length - 7 && (m = "1" + m), l += e(parseInt(m, 2));
    }
    return l;
  };
  if (!r.match(/^[0-9.]+$/))
    throw "malformed oid string: " + r;
  var i = "", s = r.split("."), o = parseInt(s[0]) * 40 + parseInt(s[1]);
  i += e(o), s.splice(0, 2);
  for (var a = 0; a < s.length; a++)
    i += n(s[a]);
  return i;
};
KJUR.asn1.ASN1Object = function() {
  var r = "";
  this.getLengthHexFromValue = function() {
    if (typeof this.hV > "u" || this.hV == null)
      throw "this.hV is null or undefined.";
    if (this.hV.length % 2 == 1)
      throw "value hex must be even length: n=" + r.length + ",v=" + this.hV;
    var e = this.hV.length / 2, n = e.toString(16);
    if (n.length % 2 == 1 && (n = "0" + n), e < 128)
      return n;
    var i = n.length / 2;
    if (i > 15)
      throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16);
    var s = 128 + i;
    return s.toString(16) + n;
  }, this.getEncodedHex = function() {
    return (this.hTLV == null || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
  }, this.getValueHex = function() {
    return this.getEncodedHex(), this.hV;
  }, this.getFreshValueHex = function() {
    return "";
  };
};
KJUR.asn1.DERAbstractString = function(r) {
  KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
    return this.s;
  }, this.setString = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(this.s);
  }, this.setStringHex = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof r < "u" && (typeof r == "string" ? this.setString(r) : typeof r.str < "u" ? this.setString(r.str) : typeof r.hex < "u" && this.setStringHex(r.hex));
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractTime = function(r) {
  KJUR.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(e) {
    utc = e.getTime() + e.getTimezoneOffset() * 6e4;
    var n = new Date(utc);
    return n;
  }, this.formatDate = function(e, n, i) {
    var s = this.zeroPadding, o = this.localDateToUTC(e), a = String(o.getFullYear());
    n == "utc" && (a = a.substr(2, 2));
    var u = s(String(o.getMonth() + 1), 2), l = s(String(o.getDate()), 2), p = s(String(o.getHours()), 2), d = s(String(o.getMinutes()), 2), g = s(String(o.getSeconds()), 2), b = a + u + l + p + d + g;
    if (i === !0) {
      var S = o.getMilliseconds();
      if (S != 0) {
        var m = s(String(S), 3);
        m = m.replace(/[0]+$/, ""), b = b + "." + m;
      }
    }
    return b + "Z";
  }, this.zeroPadding = function(e, n) {
    return e.length >= n ? e : new Array(n - e.length + 1).join("0") + e;
  }, this.getString = function() {
    return this.s;
  }, this.setString = function(e) {
    this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(e);
  }, this.setByDateValue = function(e, n, i, s, o, a) {
    var u = new Date(Date.UTC(e, n - 1, i, s, o, a, 0));
    this.setByDate(u);
  }, this.getFreshValueHex = function() {
    return this.hV;
  };
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractStructured = function(r) {
  KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(e) {
    this.hTLV = null, this.isModified = !0, this.asn1Array = e;
  }, this.appendASN1Object = function(e) {
    this.hTLV = null, this.isModified = !0, this.asn1Array.push(e);
  }, this.asn1Array = new Array(), typeof r < "u" && typeof r.array < "u" && (this.asn1Array = r.array);
};
YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBoolean = function() {
  KJUR.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
};
YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
KJUR.asn1.DERInteger = function(r) {
  KJUR.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(e) {
    this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  }, this.setByInteger = function(e) {
    var n = new BigInteger(String(e), 10);
    this.setByBigInteger(n);
  }, this.setValueHex = function(e) {
    this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof r < "u" && (typeof r.bigint < "u" ? this.setByBigInteger(r.bigint) : typeof r.int < "u" ? this.setByInteger(r.int) : typeof r == "number" ? this.setByInteger(r) : typeof r.hex < "u" && this.setValueHex(r.hex));
};
YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBitString = function(r) {
  if (r !== void 0 && typeof r.obj < "u") {
    var e = KJUR.asn1.ASN1Util.newObject(r.obj);
    r.hex = "00" + e.getEncodedHex();
  }
  KJUR.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(n) {
    this.hTLV = null, this.isModified = !0, this.hV = n;
  }, this.setUnusedBitsAndHexValue = function(n, i) {
    if (n < 0 || 7 < n)
      throw "unused bits shall be from 0 to 7: u = " + n;
    var s = "0" + n;
    this.hTLV = null, this.isModified = !0, this.hV = s + i;
  }, this.setByBinaryString = function(n) {
    n = n.replace(/0+$/, "");
    var i = 8 - n.length % 8;
    i == 8 && (i = 0);
    for (var s = 0; s <= i; s++)
      n += "0";
    for (var o = "", s = 0; s < n.length - 1; s += 8) {
      var a = n.substr(s, 8), u = parseInt(a, 2).toString(16);
      u.length == 1 && (u = "0" + u), o += u;
    }
    this.hTLV = null, this.isModified = !0, this.hV = "0" + i + o;
  }, this.setByBooleanArray = function(n) {
    for (var i = "", s = 0; s < n.length; s++)
      n[s] == !0 ? i += "1" : i += "0";
    this.setByBinaryString(i);
  }, this.newFalseArray = function(n) {
    for (var i = new Array(n), s = 0; s < n; s++)
      i[s] = !1;
    return i;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof r < "u" && (typeof r == "string" && r.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(r) : typeof r.hex < "u" ? this.setHexValueIncludingUnusedBits(r.hex) : typeof r.bin < "u" ? this.setByBinaryString(r.bin) : typeof r.array < "u" && this.setByBooleanArray(r.array));
};
YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
KJUR.asn1.DEROctetString = function(r) {
  if (r !== void 0 && typeof r.obj < "u") {
    var e = KJUR.asn1.ASN1Util.newObject(r.obj);
    r.hex = e.getEncodedHex();
  }
  KJUR.asn1.DEROctetString.superclass.constructor.call(this, r), this.hT = "04";
};
YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNull = function() {
  KJUR.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
};
YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
KJUR.asn1.DERObjectIdentifier = function(r) {
  var e = function(i) {
    var s = i.toString(16);
    return s.length == 1 && (s = "0" + s), s;
  }, n = function(i) {
    var s = "", o = new BigInteger(i, 10), a = o.toString(2), u = 7 - a.length % 7;
    u == 7 && (u = 0);
    for (var l = "", p = 0; p < u; p++)
      l += "0";
    a = l + a;
    for (var p = 0; p < a.length - 1; p += 7) {
      var d = a.substr(p, 7);
      p != a.length - 7 && (d = "1" + d), s += e(parseInt(d, 2));
    }
    return s;
  };
  KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(i) {
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = i;
  }, this.setValueOidString = function(i) {
    if (!i.match(/^[0-9.]+$/))
      throw "malformed oid string: " + i;
    var s = "", o = i.split("."), a = parseInt(o[0]) * 40 + parseInt(o[1]);
    s += e(a), o.splice(0, 2);
    for (var u = 0; u < o.length; u++)
      s += n(o[u]);
    this.hTLV = null, this.isModified = !0, this.s = null, this.hV = s;
  }, this.setValueName = function(i) {
    var s = KJUR.asn1.x509.OID.name2oid(i);
    if (s !== "")
      this.setValueOidString(s);
    else
      throw "DERObjectIdentifier oidName undefined: " + i;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, r !== void 0 && (typeof r == "string" ? r.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(r) : this.setValueName(r) : r.oid !== void 0 ? this.setValueOidString(r.oid) : r.hex !== void 0 ? this.setValueHex(r.hex) : r.name !== void 0 && this.setValueName(r.name));
};
YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
KJUR.asn1.DEREnumerated = function(r) {
  KJUR.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(e) {
    this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
  }, this.setByInteger = function(e) {
    var n = new BigInteger(String(e), 10);
    this.setByBigInteger(n);
  }, this.setValueHex = function(e) {
    this.hV = e;
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof r < "u" && (typeof r.int < "u" ? this.setByInteger(r.int) : typeof r == "number" ? this.setByInteger(r) : typeof r.hex < "u" && this.setValueHex(r.hex));
};
YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);
KJUR.asn1.DERUTF8String = function(r) {
  KJUR.asn1.DERUTF8String.superclass.constructor.call(this, r), this.hT = "0c";
};
YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNumericString = function(r) {
  KJUR.asn1.DERNumericString.superclass.constructor.call(this, r), this.hT = "12";
};
YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERPrintableString = function(r) {
  KJUR.asn1.DERPrintableString.superclass.constructor.call(this, r), this.hT = "13";
};
YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERTeletexString = function(r) {
  KJUR.asn1.DERTeletexString.superclass.constructor.call(this, r), this.hT = "14";
};
YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERIA5String = function(r) {
  KJUR.asn1.DERIA5String.superclass.constructor.call(this, r), this.hT = "16";
};
YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERUTCTime = function(r) {
  KJUR.asn1.DERUTCTime.superclass.constructor.call(this, r), this.hT = "17", this.setByDate = function(e) {
    this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
  }, this.getFreshValueHex = function() {
    return typeof this.date > "u" && typeof this.s > "u" && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
  }, r !== void 0 && (r.str !== void 0 ? this.setString(r.str) : typeof r == "string" && r.match(/^[0-9]{12}Z$/) ? this.setString(r) : r.hex !== void 0 ? this.setStringHex(r.hex) : r.date !== void 0 && this.setByDate(r.date));
};
YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERGeneralizedTime = function(r) {
  KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, r), this.hT = "18", this.withMillis = !1, this.setByDate = function(e) {
    this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
  }, this.getFreshValueHex = function() {
    return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
  }, r !== void 0 && (r.str !== void 0 ? this.setString(r.str) : typeof r == "string" && r.match(/^[0-9]{14}Z$/) ? this.setString(r) : r.hex !== void 0 ? this.setStringHex(r.hex) : r.date !== void 0 && this.setByDate(r.date), r.millis === !0 && (this.withMillis = !0));
};
YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERSequence = function(r) {
  KJUR.asn1.DERSequence.superclass.constructor.call(this, r), this.hT = "30", this.getFreshValueHex = function() {
    for (var e = "", n = 0; n < this.asn1Array.length; n++) {
      var i = this.asn1Array[n];
      e += i.getEncodedHex();
    }
    return this.hV = e, this.hV;
  };
};
YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERSet = function(r) {
  KJUR.asn1.DERSet.superclass.constructor.call(this, r), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function() {
    for (var e = new Array(), n = 0; n < this.asn1Array.length; n++) {
      var i = this.asn1Array[n];
      e.push(i.getEncodedHex());
    }
    return this.sortFlag == !0 && e.sort(), this.hV = e.join(""), this.hV;
  }, typeof r < "u" && typeof r.sortflag < "u" && r.sortflag == !1 && (this.sortFlag = !1);
};
YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERTaggedObject = function(r) {
  KJUR.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(e, n, i) {
    this.hT = n, this.isExplicit = e, this.asn1Object = i, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = i.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, n), this.isModified = !1);
  }, this.getFreshValueHex = function() {
    return this.hV;
  }, typeof r < "u" && (typeof r.tag < "u" && (this.hT = r.tag), typeof r.explicit < "u" && (this.isExplicit = r.explicit), typeof r.obj < "u" && (this.asn1Object = r.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
};
YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
var __extends = /* @__PURE__ */ function() {
  var r = function(e, n) {
    return r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, s) {
      i.__proto__ = s;
    } || function(i, s) {
      for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (i[o] = s[o]);
    }, r(e, n);
  };
  return function(e, n) {
    if (typeof n != "function" && n !== null)
      throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
    r(e, n);
    function i() {
      this.constructor = e;
    }
    e.prototype = n === null ? Object.create(n) : (i.prototype = n.prototype, new i());
  };
}(), JSEncryptRSAKey = (
  /** @class */
  function(r) {
    __extends(e, r);
    function e(n) {
      var i = r.call(this) || this;
      return n && (typeof n == "string" ? i.parseKey(n) : (e.hasPrivateKeyProperty(n) || e.hasPublicKeyProperty(n)) && i.parsePropertiesFrom(n)), i;
    }
    return e.prototype.parseKey = function(n) {
      try {
        var i = 0, s = 0, o = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, a = o.test(n) ? Hex.decode(n) : Base64.unarmor(n), u = ASN1.decode(a);
        if (u.sub.length === 3 && (u = u.sub[2].sub[0]), u.sub.length === 9) {
          i = u.sub[1].getHexStringValue(), this.n = parseBigInt(i, 16), s = u.sub[2].getHexStringValue(), this.e = parseInt(s, 16);
          var l = u.sub[3].getHexStringValue();
          this.d = parseBigInt(l, 16);
          var p = u.sub[4].getHexStringValue();
          this.p = parseBigInt(p, 16);
          var d = u.sub[5].getHexStringValue();
          this.q = parseBigInt(d, 16);
          var g = u.sub[6].getHexStringValue();
          this.dmp1 = parseBigInt(g, 16);
          var b = u.sub[7].getHexStringValue();
          this.dmq1 = parseBigInt(b, 16);
          var S = u.sub[8].getHexStringValue();
          this.coeff = parseBigInt(S, 16);
        } else if (u.sub.length === 2)
          if (u.sub[0].sub) {
            var m = u.sub[1], v = m.sub[0];
            i = v.sub[0].getHexStringValue(), this.n = parseBigInt(i, 16), s = v.sub[1].getHexStringValue(), this.e = parseInt(s, 16);
          } else
            i = u.sub[0].getHexStringValue(), this.n = parseBigInt(i, 16), s = u.sub[1].getHexStringValue(), this.e = parseInt(s, 16);
        else
          return !1;
        return !0;
      } catch {
        return !1;
      }
    }, e.prototype.getPrivateBaseKey = function() {
      var n = {
        array: [
          new KJUR.asn1.DERInteger({ int: 0 }),
          new KJUR.asn1.DERInteger({ bigint: this.n }),
          new KJUR.asn1.DERInteger({ int: this.e }),
          new KJUR.asn1.DERInteger({ bigint: this.d }),
          new KJUR.asn1.DERInteger({ bigint: this.p }),
          new KJUR.asn1.DERInteger({ bigint: this.q }),
          new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),
          new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),
          new KJUR.asn1.DERInteger({ bigint: this.coeff })
        ]
      }, i = new KJUR.asn1.DERSequence(n);
      return i.getEncodedHex();
    }, e.prototype.getPrivateBaseKeyB64 = function() {
      return hex2b64(this.getPrivateBaseKey());
    }, e.prototype.getPublicBaseKey = function() {
      var n = new KJUR.asn1.DERSequence({
        array: [
          new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }),
          new KJUR.asn1.DERNull()
        ]
      }), i = new KJUR.asn1.DERSequence({
        array: [
          new KJUR.asn1.DERInteger({ bigint: this.n }),
          new KJUR.asn1.DERInteger({ int: this.e })
        ]
      }), s = new KJUR.asn1.DERBitString({
        hex: "00" + i.getEncodedHex()
      }), o = new KJUR.asn1.DERSequence({
        array: [n, s]
      });
      return o.getEncodedHex();
    }, e.prototype.getPublicBaseKeyB64 = function() {
      return hex2b64(this.getPublicBaseKey());
    }, e.wordwrap = function(n, i) {
      if (i = i || 64, !n)
        return n;
      var s = "(.{1," + i + `})( +|$
?)|(.{1,` + i + "})";
      return n.match(RegExp(s, "g")).join(`
`);
    }, e.prototype.getPrivateKey = function() {
      var n = `-----BEGIN RSA PRIVATE KEY-----
`;
      return n += e.wordwrap(this.getPrivateBaseKeyB64()) + `
`, n += "-----END RSA PRIVATE KEY-----", n;
    }, e.prototype.getPublicKey = function() {
      var n = `-----BEGIN PUBLIC KEY-----
`;
      return n += e.wordwrap(this.getPublicBaseKeyB64()) + `
`, n += "-----END PUBLIC KEY-----", n;
    }, e.hasPublicKeyProperty = function(n) {
      return n = n || {}, n.hasOwnProperty("n") && n.hasOwnProperty("e");
    }, e.hasPrivateKeyProperty = function(n) {
      return n = n || {}, n.hasOwnProperty("n") && n.hasOwnProperty("e") && n.hasOwnProperty("d") && n.hasOwnProperty("p") && n.hasOwnProperty("q") && n.hasOwnProperty("dmp1") && n.hasOwnProperty("dmq1") && n.hasOwnProperty("coeff");
    }, e.prototype.parsePropertiesFrom = function(n) {
      this.n = n.n, this.e = n.e, n.hasOwnProperty("d") && (this.d = n.d, this.p = n.p, this.q = n.q, this.dmp1 = n.dmp1, this.dmq1 = n.dmq1, this.coeff = n.coeff);
    }, e;
  }(RSAKey)
), _a, version = typeof process < "u" ? (_a = process.env) === null || _a === void 0 ? void 0 : _a.npm_package_version : void 0, JSEncrypt$1 = (
  /** @class */
  function() {
    function r(e) {
      e === void 0 && (e = {}), e = e || {}, this.default_key_size = e.default_key_size ? parseInt(e.default_key_size, 10) : 1024, this.default_public_exponent = e.default_public_exponent || "010001", this.log = e.log || !1, this.key = null;
    }
    return r.prototype.setKey = function(e) {
      this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new JSEncryptRSAKey(e);
    }, r.prototype.setPrivateKey = function(e) {
      this.setKey(e);
    }, r.prototype.setPublicKey = function(e) {
      this.setKey(e);
    }, r.prototype.decrypt = function(e) {
      try {
        return this.getKey().decrypt(b64tohex(e));
      } catch {
        return !1;
      }
    }, r.prototype.encrypt = function(e) {
      try {
        return hex2b64(this.getKey().encrypt(e));
      } catch {
        return !1;
      }
    }, r.prototype.sign = function(e, n, i) {
      try {
        return hex2b64(this.getKey().sign(e, n, i));
      } catch {
        return !1;
      }
    }, r.prototype.verify = function(e, n, i) {
      try {
        return this.getKey().verify(e, b64tohex(n), i);
      } catch {
        return !1;
      }
    }, r.prototype.getKey = function(e) {
      if (!this.key) {
        if (this.key = new JSEncryptRSAKey(), e && {}.toString.call(e) === "[object Function]") {
          this.key.generateAsync(this.default_key_size, this.default_public_exponent, e);
          return;
        }
        this.key.generate(this.default_key_size, this.default_public_exponent);
      }
      return this.key;
    }, r.prototype.getPrivateKey = function() {
      return this.getKey().getPrivateKey();
    }, r.prototype.getPrivateKeyB64 = function() {
      return this.getKey().getPrivateBaseKeyB64();
    }, r.prototype.getPublicKey = function() {
      return this.getKey().getPublicKey();
    }, r.prototype.getPublicKeyB64 = function() {
      return this.getKey().getPublicBaseKeyB64();
    }, r.version = version, r;
  }()
);
const MAX_ENCRYPT_BLOCK = 117, MAX_DECRYPT_BLOCK = 128;
function bytesToBase64(r) {
  {
    let e = "";
    for (let n = 0; n < r.length; n++)
      e += String.fromCharCode(r[n]);
    return btoa(e);
  }
}
function concatBytes(r) {
  let e = 0;
  for (const s of r)
    e += s.length;
  const n = new Uint8Array(e);
  let i = 0;
  for (const s of r)
    n.set(s, i), i += s.length;
  return n;
}
function utf8Encode(r) {
  for (var e = [], n = 0; n < r.length; n++) {
    var i = r.charCodeAt(n);
    i < 128 ? e.push(i) : i < 2048 ? e.push(192 | i >> 6, 128 | i & 63) : (i < 55296 || i >= 57344) && e.push(
      224 | i >> 12,
      128 | i >> 6 & 63,
      128 | i & 63
    );
  }
  return new Uint8Array(e);
}
function wxToBase64(r) {
  const e = wx.base64ToArrayBuffer(r);
  return new Uint8Array(e);
}
function h5ToBase64(r) {
  const e = atob(r), n = new Uint8Array(e.length);
  for (let i = 0; i < e.length; i++)
    n[i] = e.charCodeAt(i);
  return n;
}
function arrayBufferToBase64(r) {
  const e = new Uint8Array(r);
  let n = "";
  for (let i = 0; i < e.byteLength; i++)
    n += String.fromCharCode(e[i]);
  return btoa(n);
}
function encrypt(r, e) {
  const n = new JSEncrypt$1();
  n.setPublicKey(e);
  const s = utf8Encode(r).buffer;
  let o = null;
  o = arrayBufferToBase64(s);
  const a = utf8Encode(o);
  let u = [], l = 0, p = 0;
  for (; l < a.length; ) {
    const b = Math.min(
      MAX_ENCRYPT_BLOCK,
      a.length - l
    ), S = a.slice(l, l + b);
    let m = "";
    for (let y = 0; y < S.length; y++)
      m += String.fromCharCode(S[y]);
    const v = n.encrypt(m);
    if (!v)
      throw new Error("分段加密失败");
    try {
      let y = null;
      y = h5ToBase64(v), u.push(y);
    } catch (y) {
      throw console.error("Base64解码错误:", y), y;
    }
    p++, l = p * MAX_ENCRYPT_BLOCK;
  }
  const d = concatBytes(u);
  return bytesToBase64(d);
}
function base64ToArrayBuffer(r) {
  for (r = r.replace(/[\s\r\n]+/g, ""); r.length % 4; )
    r += "=";
  const e = atob(r), n = e.length, i = new Uint8Array(n);
  for (let s = 0; s < n; s++)
    i[s] = e.charCodeAt(s);
  return i;
}
function decodeUTF8(r) {
  let e = "", n = 0;
  for (; n < r.length; ) {
    const i = r[n++];
    if (i < 128)
      e += String.fromCharCode(i);
    else if (i >= 192 && i < 224) {
      const s = r[n++] & 63;
      e += String.fromCharCode((i & 31) << 6 | s);
    } else if (i >= 224 && i < 240) {
      const s = r[n++] & 63, o = r[n++] & 63;
      e += String.fromCharCode((i & 15) << 12 | s << 6 | o);
    } else
      e += "�";
  }
  return e;
}
function decrypt(r) {
  if (!r)
    return console.error("Decrypt error: Input string is null or undefined"), "";
  let e = null;
  e = base64ToArrayBuffer(r);
  try {
    const n = new JSEncrypt$1();
    n.setPrivateKey(rsaKey.private);
    let i = [], s = 0, o = 0;
    for (; s < e.byteLength; ) {
      const u = Math.min(
        MAX_DECRYPT_BLOCK,
        e.byteLength - s
      ), l = e.slice(s, s + u);
      let p = null;
      p = arrayBufferToBase64(l);
      const d = n.decrypt(p);
      d ? i.push(d) : console.error(`块 ${o + 1} 解密失败`), o++, s = o * MAX_DECRYPT_BLOCK;
    }
    const a = i.join("");
    if (a) {
      let u = null;
      u = base64ToArrayBuffer(a);
      let l = "";
      return l = new TextDecoder("utf-8").decode(
        u
      ), l;
    } else
      throw new Error("解密结果为空");
  } catch (n) {
    throw console.error("RSA解密过程失败:", n), n;
  }
}
const c = new Int32Array(4), A = class A {
  constructor() {
    C(this, "_dataLength", 0);
    C(this, "_bufferLength", 0);
    C(this, "_state", new Int32Array(4));
    C(this, "_buffer", new ArrayBuffer(68));
    C(this, "_buffer8");
    C(this, "_buffer32");
    this._buffer8 = new Uint8Array(this._buffer, 0, 68), this._buffer32 = new Uint32Array(this._buffer, 0, 17), this.start();
  }
  static hashStr(e, n = !1) {
    return this.onePassHasher.start().appendStr(e).end(n);
  }
  static hashAsciiStr(e, n = !1) {
    return this.onePassHasher.start().appendAsciiStr(e).end(n);
  }
  static _hex(e) {
    const n = A.hexChars, i = A.hexOut;
    let s, o, a, u;
    for (u = 0; u < 4; u += 1)
      for (o = u * 8, s = e[u], a = 0; a < 8; a += 2)
        i[o + 1 + a] = n.charAt(s & 15), s >>>= 4, i[o + 0 + a] = n.charAt(s & 15), s >>>= 4;
    return i.join("");
  }
  static _md5cycle(e, n) {
    let i = e[0], s = e[1], o = e[2], a = e[3];
    i += (s & o | ~s & a) + n[0] - 680876936 | 0, i = (i << 7 | i >>> 25) + s | 0, a += (i & s | ~i & o) + n[1] - 389564586 | 0, a = (a << 12 | a >>> 20) + i | 0, o += (a & i | ~a & s) + n[2] + 606105819 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & i) + n[3] - 1044525330 | 0, s = (s << 22 | s >>> 10) + o | 0, i += (s & o | ~s & a) + n[4] - 176418897 | 0, i = (i << 7 | i >>> 25) + s | 0, a += (i & s | ~i & o) + n[5] + 1200080426 | 0, a = (a << 12 | a >>> 20) + i | 0, o += (a & i | ~a & s) + n[6] - 1473231341 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & i) + n[7] - 45705983 | 0, s = (s << 22 | s >>> 10) + o | 0, i += (s & o | ~s & a) + n[8] + 1770035416 | 0, i = (i << 7 | i >>> 25) + s | 0, a += (i & s | ~i & o) + n[9] - 1958414417 | 0, a = (a << 12 | a >>> 20) + i | 0, o += (a & i | ~a & s) + n[10] - 42063 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & i) + n[11] - 1990404162 | 0, s = (s << 22 | s >>> 10) + o | 0, i += (s & o | ~s & a) + n[12] + 1804603682 | 0, i = (i << 7 | i >>> 25) + s | 0, a += (i & s | ~i & o) + n[13] - 40341101 | 0, a = (a << 12 | a >>> 20) + i | 0, o += (a & i | ~a & s) + n[14] - 1502002290 | 0, o = (o << 17 | o >>> 15) + a | 0, s += (o & a | ~o & i) + n[15] + 1236535329 | 0, s = (s << 22 | s >>> 10) + o | 0, i += (s & a | o & ~a) + n[1] - 165796510 | 0, i = (i << 5 | i >>> 27) + s | 0, a += (i & o | s & ~o) + n[6] - 1069501632 | 0, a = (a << 9 | a >>> 23) + i | 0, o += (a & s | i & ~s) + n[11] + 643717713 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & i | a & ~i) + n[0] - 373897302 | 0, s = (s << 20 | s >>> 12) + o | 0, i += (s & a | o & ~a) + n[5] - 701558691 | 0, i = (i << 5 | i >>> 27) + s | 0, a += (i & o | s & ~o) + n[10] + 38016083 | 0, a = (a << 9 | a >>> 23) + i | 0, o += (a & s | i & ~s) + n[15] - 660478335 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & i | a & ~i) + n[4] - 405537848 | 0, s = (s << 20 | s >>> 12) + o | 0, i += (s & a | o & ~a) + n[9] + 568446438 | 0, i = (i << 5 | i >>> 27) + s | 0, a += (i & o | s & ~o) + n[14] - 1019803690 | 0, a = (a << 9 | a >>> 23) + i | 0, o += (a & s | i & ~s) + n[3] - 187363961 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & i | a & ~i) + n[8] + 1163531501 | 0, s = (s << 20 | s >>> 12) + o | 0, i += (s & a | o & ~a) + n[13] - 1444681467 | 0, i = (i << 5 | i >>> 27) + s | 0, a += (i & o | s & ~o) + n[2] - 51403784 | 0, a = (a << 9 | a >>> 23) + i | 0, o += (a & s | i & ~s) + n[7] + 1735328473 | 0, o = (o << 14 | o >>> 18) + a | 0, s += (o & i | a & ~i) + n[12] - 1926607734 | 0, s = (s << 20 | s >>> 12) + o | 0, i += (s ^ o ^ a) + n[5] - 378558 | 0, i = (i << 4 | i >>> 28) + s | 0, a += (i ^ s ^ o) + n[8] - 2022574463 | 0, a = (a << 11 | a >>> 21) + i | 0, o += (a ^ i ^ s) + n[11] + 1839030562 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ i) + n[14] - 35309556 | 0, s = (s << 23 | s >>> 9) + o | 0, i += (s ^ o ^ a) + n[1] - 1530992060 | 0, i = (i << 4 | i >>> 28) + s | 0, a += (i ^ s ^ o) + n[4] + 1272893353 | 0, a = (a << 11 | a >>> 21) + i | 0, o += (a ^ i ^ s) + n[7] - 155497632 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ i) + n[10] - 1094730640 | 0, s = (s << 23 | s >>> 9) + o | 0, i += (s ^ o ^ a) + n[13] + 681279174 | 0, i = (i << 4 | i >>> 28) + s | 0, a += (i ^ s ^ o) + n[0] - 358537222 | 0, a = (a << 11 | a >>> 21) + i | 0, o += (a ^ i ^ s) + n[3] - 722521979 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ i) + n[6] + 76029189 | 0, s = (s << 23 | s >>> 9) + o | 0, i += (s ^ o ^ a) + n[9] - 640364487 | 0, i = (i << 4 | i >>> 28) + s | 0, a += (i ^ s ^ o) + n[12] - 421815835 | 0, a = (a << 11 | a >>> 21) + i | 0, o += (a ^ i ^ s) + n[15] + 530742520 | 0, o = (o << 16 | o >>> 16) + a | 0, s += (o ^ a ^ i) + n[2] - 995338651 | 0, s = (s << 23 | s >>> 9) + o | 0, i += (o ^ (s | ~a)) + n[0] - 198630844 | 0, i = (i << 6 | i >>> 26) + s | 0, a += (s ^ (i | ~o)) + n[7] + 1126891415 | 0, a = (a << 10 | a >>> 22) + i | 0, o += (i ^ (a | ~s)) + n[14] - 1416354905 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~i)) + n[5] - 57434055 | 0, s = (s << 21 | s >>> 11) + o | 0, i += (o ^ (s | ~a)) + n[12] + 1700485571 | 0, i = (i << 6 | i >>> 26) + s | 0, a += (s ^ (i | ~o)) + n[3] - 1894986606 | 0, a = (a << 10 | a >>> 22) + i | 0, o += (i ^ (a | ~s)) + n[10] - 1051523 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~i)) + n[1] - 2054922799 | 0, s = (s << 21 | s >>> 11) + o | 0, i += (o ^ (s | ~a)) + n[8] + 1873313359 | 0, i = (i << 6 | i >>> 26) + s | 0, a += (s ^ (i | ~o)) + n[15] - 30611744 | 0, a = (a << 10 | a >>> 22) + i | 0, o += (i ^ (a | ~s)) + n[6] - 1560198380 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~i)) + n[13] + 1309151649 | 0, s = (s << 21 | s >>> 11) + o | 0, i += (o ^ (s | ~a)) + n[4] - 145523070 | 0, i = (i << 6 | i >>> 26) + s | 0, a += (s ^ (i | ~o)) + n[11] - 1120210379 | 0, a = (a << 10 | a >>> 22) + i | 0, o += (i ^ (a | ~s)) + n[2] + 718787259 | 0, o = (o << 15 | o >>> 17) + a | 0, s += (a ^ (o | ~i)) + n[9] - 343485551 | 0, s = (s << 21 | s >>> 11) + o | 0, e[0] = i + e[0] | 0, e[1] = s + e[1] | 0, e[2] = o + e[2] | 0, e[3] = a + e[3] | 0;
  }
  /**
   * Initialise buffer to be hashed
   */
  start() {
    return this._dataLength = 0, this._bufferLength = 0, this._state.set(A.stateIdentity), this;
  }
  // Char to code point to to array conversion:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
  // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
  /**
   * Append a UTF-8 string to the hash buffer
   * @param str String to append
   */
  appendStr(e) {
    const n = this._buffer8, i = this._buffer32;
    let s = this._bufferLength, o, a;
    for (a = 0; a < e.length; a += 1) {
      if (o = e.charCodeAt(a), o < 128)
        n[s++] = o;
      else if (o < 2048)
        n[s++] = (o >>> 6) + 192, n[s++] = o & 63 | 128;
      else if (o < 55296 || o > 56319)
        n[s++] = (o >>> 12) + 224, n[s++] = o >>> 6 & 63 | 128, n[s++] = o & 63 | 128;
      else {
        if (o = (o - 55296) * 1024 + (e.charCodeAt(++a) - 56320) + 65536, o > 1114111)
          throw new Error(
            "Unicode standard supports code points up to U+10FFFF"
          );
        n[s++] = (o >>> 18) + 240, n[s++] = o >>> 12 & 63 | 128, n[s++] = o >>> 6 & 63 | 128, n[s++] = o & 63 | 128;
      }
      s >= 64 && (this._dataLength += 64, A._md5cycle(this._state, i), s -= 64, i[0] = i[16]);
    }
    return this._bufferLength = s, this;
  }
  /**
   * Append an ASCII string to the hash buffer
   * @param str String to append
   */
  appendAsciiStr(e) {
    const n = this._buffer8, i = this._buffer32;
    let s = this._bufferLength, o, a = 0;
    for (; ; ) {
      for (o = Math.min(e.length - a, 64 - s); o--; )
        n[s++] = e.charCodeAt(a++);
      if (s < 64)
        break;
      this._dataLength += 64, A._md5cycle(this._state, i), s = 0;
    }
    return this._bufferLength = s, this;
  }
  /**
   * Append a byte array to the hash buffer
   * @param input array to append
   */
  appendByteArray(e) {
    const n = this._buffer8, i = this._buffer32;
    let s = this._bufferLength, o, a = 0;
    for (; ; ) {
      for (o = Math.min(e.length - a, 64 - s); o--; )
        n[s++] = e[a++];
      if (s < 64)
        break;
      this._dataLength += 64, A._md5cycle(this._state, i), s = 0;
    }
    return this._bufferLength = s, this;
  }
  /**
   * Get the state of the hash buffer
   */
  getState() {
    const e = this._state;
    return {
      buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)),
      buflen: this._bufferLength,
      length: this._dataLength,
      state: [e[0], e[1], e[2], e[3]]
    };
  }
  /**
   * Override the current state of the hash buffer
   * @param state New hash buffer state
   */
  setState(e) {
    const n = e.buffer, i = e.state, s = this._state;
    let o;
    for (this._dataLength = e.length, this._bufferLength = e.buflen, s[0] = i[0], s[1] = i[1], s[2] = i[2], s[3] = i[3], o = 0; o < n.length; o += 1)
      this._buffer8[o] = n.charCodeAt(o);
  }
  /**
   * Hash the current state of the hash buffer and return the result
   * @param raw Whether to return the value as an `Int32Array`
   */
  end(e = !1) {
    const n = this._bufferLength, i = this._buffer8, s = this._buffer32, o = (n >> 2) + 1;
    this._dataLength += n;
    const a = this._dataLength * 8;
    if (i[n] = 128, i[n + 1] = i[n + 2] = i[n + 3] = 0, s.set(A.buffer32Identity.subarray(o), o), n > 55 && (A._md5cycle(this._state, s), s.set(A.buffer32Identity)), a <= 4294967295)
      s[14] = a;
    else {
      const u = a.toString(16).match(/(.*?)(.{0,8})$/);
      if (u === null) return e ? c : "";
      const l = parseInt(u[2], 16), p = parseInt(u[1], 16) || 0;
      s[14] = l, s[15] = p;
    }
    return A._md5cycle(this._state, s), e ? this._state : A._hex(this._state);
  }
};
// Private Static Variables
C(A, "stateIdentity", new Int32Array([
  1732584193,
  -271733879,
  -1732584194,
  271733878
])), C(A, "buffer32Identity", new Int32Array([
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0
])), C(A, "hexChars", "0123456789abcdef"), C(A, "hexOut", []), // Permanent instance is to use for one-call hashing
C(A, "onePassHasher", new A());
let h = A;
if (h.hashStr("hello") !== "5d41402abc4b2a76b9719d911017c592")
  throw new Error("Md5 self test failed.");
function handleParams(r) {
  const e = Date.now().toString(), n = generateNonceStr(), i = {
    ...r,
    timestamp: e,
    nonceStr: n
  }, s = sortParams(i), o = h.hashStr(s).toString().toLowerCase();
  return JSON.stringify({
    timestamp: e,
    data: i,
    nonceStr: n,
    sign: o
  });
}
function generateNonceStr() {
  const r = "abcdefghijklmnopqrstuvwxyz0123456789";
  let e = "";
  for (let n = 0; n < 16; n++)
    e += r.charAt(Math.floor(Math.random() * r.length));
  return e;
}
function sortParams(r) {
  const e = Object.keys(r).sort();
  let n = "";
  return e.forEach((i) => {
    i !== "sign" && (n += `${i}=${r[i]}&`);
  }), n.slice(0, -1);
}
function encryptRequestData(r, e) {
  const n = handleParams(r);
  return encrypt(n, e);
}
function decryptResponseData(r) {
  try {
    if (!r)
      return console.error("Encrypted data is null or undefined"), { error: "加密数据为空" };
    let e = r;
    if (typeof r != "string")
      if (r.data)
        e = r.data;
      else if (r.response && r.response.data)
        e = r.response.data;
      else
        return console.error(
          "Cannot extract encrypted data from response",
          r
        ), { error: "无法从响应中提取加密数据" };
    if (typeof e != "string")
      return console.error("Data to decrypt is not a string:", e), { error: "解密数据不是字符串" };
    const n = decrypt(e);
    try {
      return JSON.parse(n);
    } catch (i) {
      return console.error("Response data JSON parse error:", i), {
        error: "JSON解析失败",
        rawData: n
      };
    }
  } catch (e) {
    return console.error("Response data decrypt error:", e), {
      error: "解密响应数据失败",
      message: e instanceof Error ? e.message : String(e)
    };
  }
}
const setInterceptors = (r) => (r.interceptors.response.use(
  (n) => {
    try {
      const i = decryptResponseData(n.data);
      return i && i.error ? (console.error("解密响应数据失败:", i.error), Promise.reject(new Error(i.error))) : i.code === "000000" ? i.data : (console.error(i), Promise.reject(i));
    } catch (i) {
      return console.error("处理响应时发生错误:", i), Promise.reject(i);
    }
  },
  (n) => {
    var i;
    try {
      const s = decryptResponseData(
        ((i = n.response) == null ? void 0 : i.data) || n.msg
      );
      console.log("解密的错误响应:", s), s && s.error && console.error("解密错误响应失败:", s.error);
    } catch (s) {
      console.error("解密错误响应时发生异常:", s);
    }
    return console.error("请求失败:", n), Promise.reject(n);
  }
), { post: (n, i, s) => r.post(n, i, s) }), createRequest = (r) => {
  const e = axios.create({
    timeout: 5e3,
    baseURL: servicePath[r],
    headers: {
      "Content-Type": "application/json"
    }
  });
  return setInterceptors(e);
}, r_queryInfo = (r, e) => r("openApi/adv/getAdvertisement", e);
var AD_TYPE = /* @__PURE__ */ ((r) => (r.H5 = "1", r.MINI = "2", r.GDT = "4", r.PLUGIN = "5", r.HALF_MINI = "6", r.KL = "9", r))(AD_TYPE || {});
function _typeof(r) {
  return (_typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
    return typeof e;
  } : function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  })(r);
}
function _classCallCheck(r, e) {
  if (!(r instanceof e)) throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(r, e) {
  for (var n = 0; n < e.length; n++) {
    var i = e[n];
    i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(r, i.key, i);
  }
}
function _createClass(r, e, n) {
  return e && _defineProperties(r.prototype, e), n && _defineProperties(r, n), r;
}
(typeof JSON > "u" ? "undefined" : _typeof(JSON)) !== "object" && (JSON = {}), function() {
  var rx_one = /^[\],:{}\s]*$/, rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rx_four = /(?:^|:|,)(?:\s*\[)+/g, rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta, rep;
  function f(r) {
    return r < 10 ? "0" + r : r;
  }
  function this_value() {
    return this.valueOf();
  }
  function quote(r) {
    return rx_escapable.lastIndex = 0, rx_escapable.test(r) ? '"' + r.replace(rx_escapable, function(e) {
      var n = meta[e];
      return typeof n == "string" ? n : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4);
    }) + '"' : '"' + r + '"';
  }
  function str(r, e) {
    var n, i, s, o, a, u = gap, l = e[r];
    switch (l && _typeof(l) === "object" && typeof l.toJSON == "function" && (l = l.toJSON(r)), _typeof(l = typeof rep == "function" ? rep.call(e, r, l) : l)) {
      case "string":
        return quote(l);
      case "number":
        return isFinite(l) ? String(l) : "null";
      case "boolean":
      case "null":
        return String(l);
      case "object":
        if (!l) return "null";
        if (gap += indent, a = [], Object.prototype.toString.apply(l) === "[object Array]") {
          for (o = l.length, n = 0; n < o; n += 1) a[n] = str(n, l) || "null";
          s = a.length === 0 ? "[]" : gap ? `[
` + gap + a.join(`,
` + gap) + `
` + u + "]" : "[" + a.join(",") + "]";
        } else {
          if (rep && _typeof(rep) === "object") for (o = rep.length, n = 0; n < o; n += 1) typeof rep[n] == "string" && (s = str(i = rep[n], l)) && a.push(quote(i) + (gap ? ": " : ":") + s);
          else for (i in l) Object.prototype.hasOwnProperty.call(l, i) && (s = str(i, l)) && a.push(quote(i) + (gap ? ": " : ":") + s);
          s = a.length === 0 ? "{}" : gap ? `{
` + gap + a.join(`,
` + gap) + `
` + u + "}" : "{" + a.join(",") + "}";
        }
        return gap = u, s;
    }
  }
  typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function() {
    return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null;
  }, Boolean.prototype.toJSON = this_value, Number.prototype.toJSON = this_value, String.prototype.toJSON = this_value), typeof JSON.stringify != "function" && (meta = { "\b": "\\b", "	": "\\t", "\n": "\\n", "\f": "\\f", "\r": "\\r", '"': '\\"', "\\": "\\\\" }, JSON.stringify = function(r, e, n) {
    var i;
    if (indent = gap = "", typeof n == "number") for (i = 0; i < n; i += 1) indent += " ";
    else typeof n == "string" && (indent = n);
    if (!(rep = e) || typeof e == "function" || _typeof(e) === "object" && typeof e.length == "number") return str("", { "": r });
    throw new Error("JSON.stringify");
  }), typeof JSON.parse != "function" && (JSON.parse = function(text, reviver) {
    var j;
    function walk(r, e) {
      var n, i, s = r[e];
      if (s && _typeof(s) === "object") for (n in s) Object.prototype.hasOwnProperty.call(s, n) && ((i = walk(s, n)) !== void 0 ? s[n] = i : delete s[n]);
      return reviver.call(r, e, s);
    }
    if (text = String(text), rx_dangerous.lastIndex = 0, rx_dangerous.test(text) && (text = text.replace(rx_dangerous, function(r) {
      return "\\u" + ("0000" + r.charCodeAt(0).toString(16)).slice(-4);
    })), rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({ "": j }, "") : j;
    throw new SyntaxError("JSON.parse");
  });
}();
var Config = { LIB_VERSION: "2.0.4" }, MAX_REFERRER_STRING_LENGTH = 200, ArrayProto = Array.prototype, ObjProto = Object.prototype, slice = ArrayProto.slice, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty, nativeForEach = ArrayProto.forEach, breaker = {}, utmTypes = ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"], _ = { each: function(r, e, n) {
  if (r !== null) {
    if (nativeForEach && r.forEach === nativeForEach) r.forEach(e, n);
    else if (r.length === +r.length) {
      for (var i = 0, s = r.length; i < s; i++) if (i in r && e.call(n, r[i], i, r) === breaker) return;
    } else for (var o in r) if (hasOwnProperty.call(r, o) && e.call(n, r[o], o, r) === breaker) return;
  }
}, extend: function(r) {
  return _.each(slice.call(arguments, 1), function(e) {
    for (var n in e) e[n] !== void 0 && (r[n] = e[n]);
  }), r;
}, formatDate: function(r) {
  function e(n) {
    return n < 10 ? "0" + n : n;
  }
  return r.getFullYear() + "-" + e(r.getMonth() + 1) + "-" + e(r.getDate()) + " " + e(r.getHours()) + ":" + e(r.getMinutes()) + ":" + e(r.getSeconds()) + "." + ((r = r.getMilliseconds()) < 10 ? "00" + r : r < 100 ? "0" + r : r);
}, formatTimeZone: function(r, e) {
  var n;
  return typeof e != "number" ? r : (n = r.getTime(), r = 6e4 * r.getTimezoneOffset(), new Date(n + r + 36e5 * e));
}, formatJsonString: function(r) {
  try {
    return JSON.stringify(r, null, 8);
  } catch {
    return JSON.stringify(r);
  }
}, searchObjDate: function(r, e) {
  (_.check.isObject(r) || _.check.isArray(r)) && _.each(r, function(n, i) {
    _.check.isObject(n) || _.check.isArray(n) ? _.searchObjDate(r[i], e) : _.check.isDate(n) && (r[i] = _.formatDate(_.formatTimeZone(n, e)));
  });
}, check: { isUndefined: function(r) {
  return r === void 0;
}, isObject: function(r) {
  return toString.call(r) === "[object Object]" && r !== null;
}, isEmptyObject: function(r) {
  if (_.check.isObject(r)) {
    for (var e in r) if (hasOwnProperty.call(r, e)) return !1;
    return !0;
  }
  return !1;
}, isArray: function(r) {
  return toString.call(r) === "[object Array]";
}, isString: function(r) {
  return toString.call(r) === "[object String]";
}, isDate: function(r) {
  return toString.call(r) === "[object Date]";
}, isNumber: function(r) {
  return toString.call(r) === "[object Number]";
}, isBoolean: function(r) {
  return toString.call(r) === "[object Boolean]";
}, isJSONString: function(r) {
  try {
    JSON.parse(r);
  } catch {
    return !1;
  }
  return !0;
} } }, Log = (_.UUID = /* @__PURE__ */ (() => {
  function r() {
    for (var e = +/* @__PURE__ */ new Date(), n = 0; e === +/* @__PURE__ */ new Date(); ) n++;
    return e.toString(16) + n.toString(16);
  }
  return function() {
    var e = (e = String(screen.height * screen.width)) && /\d{5,}/.test(e) ? e.toString(16) : String(31242 * Math.random()).replace(".", "").slice(0, 8), e = r() + "-" + Math.random().toString(16).replace(".", "") + "-" + (() => {
      var n, i, s = navigator.userAgent, o = [], a = 0;
      function u(l, p) {
        for (var d = 0, g = 0; g < p.length; g++) d |= o[g] << 8 * g;
        return l ^ d;
      }
      for (n = 0; n < s.length; n++) i = s.charCodeAt(n), o.unshift(255 & i), 4 <= o.length && (a = u(a, o), o = []);
      return (a = 0 < o.length ? u(a, o) : a).toString(16);
    })() + "-" + e + "-" + r();
    return e || (String(Math.random()) + String(Math.random()) + String(Math.random())).slice(2, 15);
  };
})(), _.UUIDv4 = function() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
    var e = 16 * Math.random() | 0;
    return (r == "x" ? e : 3 & e | 8).toString(16);
  });
}, _.getReferrer = function(r) {
  return r = r || document.referrer, typeof r != "string" ? "referrer exception" + String(r) : typeof (r = (r = r.indexOf("https://www.baidu.com/") === 0 ? r.split("?")[0] : r).slice(0, MAX_REFERRER_STRING_LENGTH)) == "string" ? r : "";
}, _.url = /* @__PURE__ */ (() => {
  function r() {
    return new RegExp(/(.*?)\.?([^\.]*?)\.(com|net|org|biz|ws|in|me|co\.uk|co|org\.uk|ltd\.uk|plc\.uk|me\.uk|edu|mil|br\.com|cn\.com|eu\.com|hu\.com|no\.com|qc\.com|sa\.com|se\.com|se\.net|us\.com|uy\.com|ac|co\.ac|gv\.ac|or\.ac|ac\.ac|af|am|as|at|ac\.at|co\.at|gv\.at|or\.at|asn\.au|com\.au|edu\.au|org\.au|net\.au|id\.au|be|ac\.be|adm\.br|adv\.br|am\.br|arq\.br|art\.br|bio\.br|cng\.br|cnt\.br|com\.br|ecn\.br|eng\.br|esp\.br|etc\.br|eti\.br|fm\.br|fot\.br|fst\.br|g12\.br|gov\.br|ind\.br|inf\.br|jor\.br|lel\.br|med\.br|mil\.br|net\.br|nom\.br|ntr\.br|odo\.br|org\.br|ppg\.br|pro\.br|psc\.br|psi\.br|rec\.br|slg\.br|tmp\.br|tur\.br|tv\.br|vet\.br|zlg\.br|br|ab\.ca|bc\.ca|mb\.ca|nb\.ca|nf\.ca|ns\.ca|nt\.ca|on\.ca|pe\.ca|qc\.ca|sk\.ca|yk\.ca|ca|cc|ac\.cn|net\.cn|com\.cn|edu\.cn|gov\.cn|org\.cn|bj\.cn|sh\.cn|tj\.cn|cq\.cn|he\.cn|nm\.cn|ln\.cn|jl\.cn|hl\.cn|js\.cn|zj\.cn|ah\.cn|gd\.cn|gx\.cn|hi\.cn|sc\.cn|gz\.cn|yn\.cn|xz\.cn|sn\.cn|gs\.cn|qh\.cn|nx\.cn|xj\.cn|tw\.cn|hk\.cn|mo\.cn|cn|cx|cz|de|dk|fo|com\.ec|tm\.fr|com\.fr|asso\.fr|presse\.fr|fr|gf|gs|co\.il|net\.il|ac\.il|k12\.il|gov\.il|muni\.il|ac\.in|co\.in|org\.in|ernet\.in|gov\.in|net\.in|res\.in|is|it|ac\.jp|co\.jp|go\.jp|or\.jp|ne\.jp|ac\.kr|co\.kr|go\.kr|ne\.kr|nm\.kr|or\.kr|li|lt|lu|asso\.mc|tm\.mc|com\.mm|org\.mm|net\.mm|edu\.mm|gov\.mm|ms|nl|no|nu|pl|ro|org\.ro|store\.ro|tm\.ro|firm\.ro|www\.ro|arts\.ro|rec\.ro|info\.ro|nom\.ro|nt\.ro|se|si|com\.sg|org\.sg|net\.sg|gov\.sg|sk|st|tf|ac\.th|co\.th|go\.th|mi\.th|net\.th|or\.th|tm|to|com\.tr|edu\.tr|gov\.tr|k12\.tr|net\.tr|org\.tr|com\.tw|org\.tw|net\.tw|ac\.uk|uk\.com|uk\.net|gb\.com|gb\.net|vg|sh|kz|ch|info|ua|gov|name|pro|ie|hk|com\.hk|org\.hk|net\.hk|edu\.hk|us|tk|cd|by|ad|lv|eu\.lv|bz|es|jp|cl|ag|mobi|eu|co\.nz|org\.nz|net\.nz|maori\.nz|iwi\.nz|io|la|md|sc|sg|vc|tw|travel|my|se|tv|pt|com\.pt|edu\.pt|asia|fi|com\.ve|net\.ve|fi|org\.ve|web\.ve|info\.ve|co\.ve|tel|im|gr|ru|net\.ru|org\.ru|hr|com\.hr|ly|xyz)$/);
  }
  function e(i, a) {
    var o = i.charAt(0), a = a.split(o);
    return o === i ? a : a[(i = parseInt(i.substring(1), 10)) < 0 ? a.length + i : i - 1];
  }
  function n(i, s) {
    for (var o, a = i.charAt(0), u = s.split("&"), l = [], p = {}, d = i.substring(1), g = 0, b = u.length; g < b; g++) if ((l = (l = u[g].match(/(.*?)=(.*)/)) || [u[g], u[g], ""])[1].replace(/\s/g, "") !== "") {
      if (l[2] = (o = l[2] || "", _.decodeURIComponent(o.replace(/\+/g, " "))), d === l[1]) return l[2];
      (o = l[1].match(/(.*)\[([0-9]+)\]/)) ? (p[o[1]] = p[o[1]] || [], p[o[1]][o[2]] = l[2]) : p[l[1]] = l[2];
    }
    return a === i ? p : p[d];
  }
  return function(i, s) {
    var o, a = {};
    if (i === "tld?") return r();
    if (s = s || window.location.toString(), !i) return s;
    if (i = i.toString(), o = s.match(/^mailto:([^\/].+)/)) a.protocol = "mailto", a.email = o[1];
    else {
      if ((o = (s = (o = s.match(/(.*?)\/#\!(.*)/)) ? o[1] + o[2] : s).match(/(.*?)#(.*)/)) && (a.hash = o[2], s = o[1]), a.hash && i.match(/^#/)) return n(i, a.hash);
      if ((o = s.match(/(.*?)\?(.*)/)) && (a.query = o[2], s = o[1]), a.query && i.match(/^\?/)) return n(i, a.query);
      if ((o = s.match(/(.*?)\:?\/\/(.*)/)) && (a.protocol = o[1].toLowerCase(), s = o[2]), (o = s.match(/(.*?)(\/.*)/)) && (a.path = o[2], s = o[1]), a.path = (a.path || "").replace(/^([^\/])/, "/$1").replace(/\/$/, ""), (i = i.match(/^[\-0-9]+$/) ? i.replace(/^([^\/])/, "/$1") : i).match(/^\//)) return e(i, a.path.substring(1));
      if ((o = (o = e("/-1", a.path.substring(1))) && o.match(/(.*?)\.(.*)/)) && (a.file = o[0], a.filename = o[1], a.fileext = o[2]), (o = s.match(/(.*)\:([0-9]+)$/)) && (a.port = o[2], s = o[1]), (o = s.match(/(.*?)@(.*)/)) && (a.auth = o[1], s = o[2]), a.auth && (o = a.auth.match(/(.*)\:(.*)/), a.user = o ? o[1] : a.auth, a.pass = o ? o[2] : void 0), a.hostname = s.toLowerCase(), i.charAt(0) === ".") return e(i, a.hostname);
      r() && (o = a.hostname.match(r())) && (a.tld = o[3], a.domain = o[2] ? o[2] + "." + o[3] : void 0, a.sub = o[1] || void 0), s = a.port ? ":" + a.port : "", a.protocol = a.protocol || window.location.protocol.replace(":", ""), a.port = a.port || (a.protocol === "https" ? "443" : "80"), a.protocol = a.protocol || (a.port === "443" ? "https" : "http"), a.basic = a.protocol + "://" + a.hostname + s;
    }
    return i in a ? a[i] : i === "{}" ? a : "";
  };
})(), _.hashCode = function(r) {
  if (typeof r != "string") return 0;
  var e = 0;
  if (r.length !== 0) for (var n = 0; n < r.length; n++) e = (e << 5) - e + r.charCodeAt(n), e &= e;
  return e;
}, _.decodeURIComponent = function(r) {
  var e = "";
  try {
    e = decodeURIComponent(r);
  } catch {
    e = r;
  }
  return e;
}, _.encodeURIComponent = function(r) {
  var e = "";
  try {
    e = encodeURIComponent(r);
  } catch {
    e = r;
  }
  return e;
}, _.utf8Encode = function(r) {
  for (var e, n = "", i = e = 0, s = (r = (r + "").replace(/\r\n/g, `
`).replace(/\r/g, `
`)).length, o = 0; o < s; o++) {
    var a = r.charCodeAt(o), u = null;
    a < 128 ? e++ : u = 127 < a && a < 2048 ? String.fromCharCode(a >> 6 | 192, 63 & a | 128) : String.fromCharCode(a >> 12 | 224, a >> 6 & 63 | 128, 63 & a | 128), u !== null && (i < e && (n += r.substring(i, e)), n += u, i = e = o + 1);
  }
  return i < e && (n += r.substring(i, r.length)), n;
}, _.base64Encode = function(r) {
  var e, n, i, s, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", a = 0, u = 0, l = "", p = [];
  if (!r) return r;
  for (r = _.utf8Encode(r); e = (s = r.charCodeAt(a++) << 16 | r.charCodeAt(a++) << 8 | r.charCodeAt(a++)) >> 12 & 63, n = s >> 6 & 63, i = 63 & s, p[u++] = o.charAt(s >> 18 & 63) + o.charAt(e) + o.charAt(n) + o.charAt(i), a < r.length; ) ;
  switch (l = p.join(""), r.length % 3) {
    case 1:
      l = l.slice(0, -2) + "==";
      break;
    case 2:
      l = l.slice(0, -1) + "=";
  }
  return l;
}, _.cookie = { get: function(r) {
  for (var e = r + "=", n = document.cookie.split(";"), i = 0; i < n.length; i++) {
    for (var s = n[i]; s.charAt(0) === " "; ) s = s.substring(1, s.length);
    if (s.indexOf(e) === 0) return _.decodeURIComponent(s.substring(e.length, s.length));
  }
  return null;
}, set: function(r, e, l, i, s) {
  var o = "", a = "", u = "", l = (l = l === null ? 73e3 : l, i && (o = (i = _.url("domain", location.href)) ? "; domain=." + i : ""), l && (i = /* @__PURE__ */ new Date(), String(l).slice(-1) === "s" ? i.setTime(i.getTime() + 1e3 * Number(String(l).slice(0, -1))) : i.setTime(i.getTime() + 24 * l * 60 * 60 * 1e3), a = "; expires=" + i.toGMTString()), s && (u = "; secure"), r + "=" + encodeURIComponent(e) + a + "; path=/" + o + u);
  return document.cookie = l;
}, remove: function(r, e) {
  _.cookie.set(r, "", -1, e);
} }, _.localStorage = { get: function(r) {
  try {
    return window.localStorage.getItem(r);
  } catch (e) {
    _.localStorage.error(e);
  }
}, parse: function(r) {
  var e;
  try {
    e = JSON.parse(_.localStorage.get(r)) || null;
  } catch (n) {
    _.localStorage.error(n);
  }
  return e;
}, set: function(r, e) {
  try {
    window.localStorage.setItem(r, e);
  } catch (n) {
    _.localStorage.error(n);
  }
}, remove: function(r) {
  try {
    window.localStorage.removeItem(r);
  } catch (e) {
    _.localStorage.error(e);
  }
}, error: function(r) {
  console.error("localStorage error: " + r);
}, isSupported: function() {
  var r = !0;
  try {
    var e = "__thinkingdatasupport__", n = "testIsSupportStorage";
    _.localStorage.set(e, n), _.localStorage.get(e) !== n && (r = !1), _.localStorage.remove(e);
  } catch {
    r = !1;
  }
  return r;
} }, _.stripEmptyProperties = function(r) {
  var e = {};
  return _.each(r, function(n, i) {
    _.check.isString(n) && 0 < n.length && (e[i] = n);
  }), e;
}, _.info = { os: function() {
  var r = navigator.userAgent;
  return /Windows/i.test(r) ? /Phone/.test(r) || /WPDesktop/.test(r) ? "Windows Phone" : "Windows" : /(iPhone|iPad|iPod)/.test(r) ? "iOS" : /Android/.test(r) ? "Android" : /(BlackBerry|PlayBook|BB10)/i.test(r) ? "BlackBerry" : /Mac/i.test(r) ? "Mac OS X" : /Linux/.test(r) ? "Linux" : /CrOS/.test(r) ? "Chrome OS" : "";
}, browser: function() {
  var r = { type: "", version: "" };
  try {
    var e, n, i = navigator.userAgent.toLowerCase(), s = [];
    i.match(/baidubrowser/) !== null ? (r.type = "baidu", s.push(/baidubrowser\/([\d.]+)/)) : i.match(/bidubrowser/) !== null ? (r.type = "baidu", s.push(/bidubrowser\/([\d.]+)/)) : i.match(/edga/) !== null ? (r.type = "edge", s.push(/edga\/([\d.]+)/)) : i.match(/edgios/) !== null ? (r.type = "edge", s.push(/edgios\/([\d.]+)/)) : i.match(/liebaofast/) !== null ? (r.type = "liebao", s.push(/liebaofast\/([\d.]+)/)) : i.match(/sogoumobilebrowser/) !== null ? (r.type = "sogou", s.push(/sogoumobilebrowser\/([\d.]+)/)) : i.match(/lbbrowser/) !== null ? (r.type = "liebao", s.push(/lbbrowser\/([\d.]+)/)) : i.match(/crios/) !== null ? (r.type = "chrome", s.push(/crios\/([\d.]+)/)) : i.match(/qihoobrowser/) !== null ? (r.type = "360", s.push(/qihoobrowser\/([\d.]+)/)) : i.match(/mxios/) !== null ? (r.type = "maxthon", s.push(/mxios\/([\d.]+)/)) : i.match(/fxios/) !== null ? (r.type = "firefox", s.push(/fxios\/([\d.\w]+)/)) : i.match(/edge/) !== null ? (r.type = "edge", s.push(/edge\/([\d.]+)/)) : i.match(/metasr/) !== null ? (r.type = "sogou", s.push(/metasr ([\d.]+)/)) : i.match(/micromessenger/) !== null ? (r.type = "micromessenger", s.push(/micromessenger\/([\d.]+)/)) : i.match(/mqqbrowser/) !== null ? (r.type = "qq", s.push(/mqqbrowser\/([\d.]+)/)) : i.match(/qqbrowserlite/) !== null ? (r.type = "qq", s.push(/qqbrowserlite\/([\d.]+)/)) : i.match(/tencenttraveler/) !== null ? (r.type = "qq", s.push(/tencenttraveler\/([\d.]+)/)) : i.match(/qqbrowser/) !== null ? (r.type = "qq", s.push(/qqbrowser\/([\d.]+)/)) : i.match(/maxthon/) !== null ? (r.type = "maxthon", s.push(/maxthon\/([\d.]+)/)) : i.match(/ubrowser/) !== null ? (r.type = "uc", s.push(/ubrowser\/([\d.]+)/)) : i.match(/ucbrowser/) !== null ? (r.type = "uc", s.push(/ucbrowser\/([\d.]+)/)) : i.match(/firefox/) !== null ? (r.type = "firefox", s.push(/firefox\/([\d.]+)/)) : i.match(/opera/) !== null ? (r.type = "opera", s.push(/opera\/([\d.]+)/)) : i.match(/opr/) !== null ? (r.type = "opera", s.push(/opr\/([\d.]+)/)) : i.match(/chrome/) !== null ? (r.type = "chrome", s.push(/chrome\/([\d.]+)/)) : i.match(/safari/) !== null ? (r.type = "safari", s.push(/version\/([\d.]+)/)) : i.match(/trident/) === null && i.match(/msie/) === null || (r.type = "ie"), r.type === "ie" ? (e = i.match(/trident\/([\d.]+)/) ? i.match(/trident\/([\d.]+)/)[1] : "", n = i.match(/msie ([\d.]+)/) ? i.match(/msie ([\d.]+)/)[1] : "", e !== "" ? r.version = String(parseInt(e) + 4) : n !== "" && (r.version = n)) : s && (r.version = i.match(s[0]) ? i.match(s[0])[1] : "");
  } catch (o) {
    Log.w("getting browser info failed due to ", o);
  }
  return r;
}, properties: function() {
  var r = _.info.browser();
  return _.extend({ "#os": _.info.os(), "#lib_version": Config.LIB_VERSION, "#lib": "js", "#screen_height": screen.height, "#screen_width": screen.width, "#browser": r.type, "#browser_version": r.version, "#system_language": _.check.isString(navigator.language) ? navigator.language : "Value exception", "#ua": _.check.isString(navigator.userAgent) ? navigator.userAgent.toLowerCase() : "Value exception", "#utm": _.getUtm() });
}, pageProperties: function() {
  var r = _.getReferrer();
  return _.stripEmptyProperties({ "#referrer": r, "#referrer_host": r && _.url("hostname", r), "#url": location.href, "#url_path": location.pathname, "#title": document.title });
} }, _.getUtm = function() {
  var r = {};
  return _.each(utmTypes, function(e) {
    var n = _.getQueryParam(location.href, e);
    n.length && (r[e] = n);
  }), JSON.stringify(r);
}, _.getQueryParam = function(r, e) {
  return e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"), r = _.decodeURIComponent(r), e = new RegExp("[\\?&]" + e + "=([^&#]*)").exec(r), e === null || e && typeof e[1] != "string" && e[1].length ? "" : _.decodeURIComponent(e[1]);
}, _.createString = function(r) {
  for (var e = r, n = Math.random().toString(36).substr(2); n.length < e; ) n += Math.random().toString(36).substr(2);
  return n = n.substr(0, r);
}, _.createAesKey = function() {
  return _.createString(16);
}, _.generateEncryptyData = function(r, e) {
  if (e !== void 0) {
    var n = e.publicKey, e = e.version;
    if (n !== void 0 && e !== void 0 && typeof CryptoJS < "u" && typeof JSEncrypt < "u") {
      var i = _.createAesKey();
      try {
        var s = CryptoJS.enc.Utf8.parse(i), o = CryptoJS.enc.Utf8.parse(JSON.stringify(r)), a = CryptoJS.AES.encrypt(o, s, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).toString(), u = new JSEncrypt(), l = (u.setPublicKey(n), u.encrypt(i));
        return l === !1 ? (Log.w("encryption failed"), r) : { pkv: e, ekey: l, payload: a };
      } catch {
        Log.w("encryption failed");
      }
    }
  }
  return r;
}, _.paramType = function(r) {
  return Object.prototype.toString.call(r).replace("[object ", "").replace("]", "");
}, _.addEvent = function(r, e, n, i) {
  if (document.addEventListener) if (this.paramType(r) !== "Array" && this.paramType(r) !== "HTMLCollection" || !r.length || r === window) r.addEventListener(e, n, i);
  else for (var s = 0; s < r.length; s++) this.addEvent(r[s], e, n, i);
  else if (r.length && r !== window) for (var o = 0; o < r.length; o++) this.addEvent(r[o], e, n);
  else r.attachEvent("on" + e, function() {
    return n.call(r, window.event);
  });
}, _.getRandom = function() {
  return (/* @__PURE__ */ new Date()).getTime() + "_" + Math.floor(1e6 * Math.random());
}, _.safeJSONParse = function(r) {
  var e = null;
  try {
    e = JSON.parse(r);
  } catch {
    return r;
  }
  return e;
}, _.saveObjectVal = function(r, e) {
  _.check.isString(e) || (e = JSON.stringify(e)), _.localStorage.set(r, e);
}, _.readObjectVal = function(r) {
  return r = _.localStorage.get(r), r ? _.safeJSONParse(r) : null;
}, _.indexOf = function(r, e) {
  var n = r.indexOf;
  if (n) return n.call(r, e);
  for (var i = 0; i < r.length; i++) if (e === r[i]) return i;
  return -1;
}, _.hasEncrypty = function(r) {
  return !!_.check.isObject() && r.pkv !== "undefined" && r.ekey !== "undefined" && r.payload !== "undefined";
}, _.addSiteEvent = function(r, e, n, i) {
  function s(a) {
    return a && (a.preventDefault = s.preventDefault, a.stopPropagation = s.stopPropagation, a._getPath = s._getPath), a;
  }
  s._getPath = function() {
    var a;
    return this.path || this.composedPath && this.composedPath() || (a = this.target, new o(a).getParents());
  };
  var o = function(a) {
    this.ele = a;
  };
  s.preventDefault = function() {
    this.returnValue = !1;
  }, s.stopPropagation = function() {
    this.cancelBubble = !0;
  }, (function(a, u, l) {
    var p, d, g, b, S, m;
    i === void 0 && u === "click" && (i = !0), a && a.addEventListener ? a.addEventListener(u, function(v) {
      v._getPath = s._getPath, l.call(this, v);
    }, i) : (d = a[p = "on" + u], a[p] = (g = a, b = l, S = d, m = u, function(v) {
      var y, T;
      if (v = v || s(window.event)) return v.target = v.srcElement, y = !0, typeof S == "function" && (T = S(v)), v = b.call(g, v), m !== "beforeunload" ? T !== !1 && v !== !1 && y : void 0;
    }));
  }).apply(null, arguments);
}, _.getURLSearchParams = function(r) {
  for (var e = {}, n = (r = r || "").substring(1).split("&"), i = 0; i < n.length; i++) {
    var s, o = n[i].indexOf("=");
    o !== -1 && (s = n[i].substring(0, o), o = n[i].substring(o + 1), s = _.decodeURIComponent(s), o = _.decodeURIComponent(o), e[s] = o);
  }
  return e;
}, _.urlParse = function(r) {
  function e(n) {
    this._fields = { Username: 4, Password: 5, Port: 7, Protocol: 2, Host: 6, Path: 8, URL: 0, QueryString: 9, Fragment: 10 }, this._values = {}, this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/, n !== void 0 && this._parse(n);
  }
  return e.prototype.setUrl = function(n) {
    this._parse(n);
  }, e.prototype._initValues = function() {
    for (var n in this._fields) this._values[n] = "";
  }, e.prototype.addQueryString = function(n) {
    if (_typeof(n) !== "object") return !1;
    var i, s = this._values.QueryString || "";
    for (i in n) s = new RegExp(i + "[^&]+").test(s) ? s.replace(new RegExp(i + "[^&]+"), i + "=" + n[i]) : s.slice(-1) === "&" ? s + i + "=" + n[i] : s === "" ? i + "=" + n[i] : s + "&" + i + "=" + n[i];
    this._values.QueryString = s;
  }, e.prototype.getUrl = function() {
    var n = "";
    return (n += this._values.Origin) + (this._values.Port ? ":" + this._values.Port : "") + this._values.Path + (this._values.QueryString ? "?" + this._values.QueryString : "") + (this._values.Fragment ? "#" + this._values.Fragment : "");
  }, e.prototype._parse = function(o) {
    this._initValues(), this._regex.exec(o) || Log.i("URLParser::_parse -> Invalid URL");
    var i, o = o.split("#"), s = o[0], o = o.slice(1).join("#"), a = this._regex.exec(s);
    for (i in this._fields) a[this._fields[i]] !== void 0 && (this._values[i] = a[this._fields[i]]);
    this._values.Hostname = this._values.Host.replace(/:\d+$/, ""), this._values.Origin = this._values.Protocol + "://" + this._values.Hostname, this._values.Fragment = o;
  }, new e(r);
}, _.trim = function(r) {
  return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
}, _.URL = function(r) {
  var e, n, i = {};
  if (typeof window.URL == "function" && (() => {
    try {
      return new URL("http://modernizr.com/").href === "http://modernizr.com/";
    } catch {
      return !1;
    }
  })()) (i = new URL(r)).searchParams || (i.searchParams = (n = _.getURLSearchParams(i.search), { get: function(s) {
    return n[s];
  } }));
  else {
    if (_.check.isString(r) || (r = String(r)), r = _.trim(r), /^https?:\/\/.+/.test(r) === !1) return void Log.w("Invalid URL");
    r = _.urlParse(r), i.hash = r._values.Fragment, i.host = r._values.Host ? r._values.Host + (r._values.Port ? ":" + r._values.Port : "") : "", i.href = r._values.URL, i.password = r._values.Password, i.pathname = r._values.Path, i.port = r._values.Port, i.search = r._values.QueryString ? "?" + r._values.QueryString : "", i.username = r._values.Username, i.hostname = r._values.Hostname, i.protocol = r._values.Protocol ? r._values.Protocol + ":" : "", i.origin = r._values.Origin ? r._values.Origin + (r._values.Port ? ":" + r._values.Port : "") : "", i.searchParams = (e = _.getURLSearchParams("?" + r._values.QueryString), { get: function(s) {
      return e[s];
    } });
  }
  return i;
}, (() => {
  function r() {
    _classCallCheck(this, r);
  }
  return _createClass(r, null, [{ key: "i", value: function() {
    if (!this.showLog) return !1;
    if (this.showLog !== !0 && this.showLog !== "string" || (arguments[0] = _.formatJsonString(arguments[0])), (typeof console > "u" ? "undefined" : _typeof(console)) === "object" && console.log) try {
      return console.log.apply(console, arguments);
    } catch {
      console.log(arguments[0]);
    }
  } }, { key: "w", value: function() {
    if (!this.showLog) return !1;
    if (this.showLog !== !0 && this.showLog !== "string" || (arguments[0] = _.formatJsonString(arguments[0])), (typeof console > "u" ? "undefined" : _typeof(console)) === "object" && console.warn) try {
      return console.warn.apply(console, arguments);
    } catch {
      console.warn(arguments[0]);
    }
  } }]), r;
})()), KEY_NAME_MATCH_REGEX = /^[a-zA-Z][a-zA-Z0-9_]{0,49}$/, PropertyChecker = (() => {
  function r() {
    _classCallCheck(this, r);
  }
  return _createClass(r, null, [{ key: "stripProperties", value: function(e) {
    return _.check.isObject(e) && _.each(e, function(n, i) {
      _.check.isString(n) || _.check.isNumber(n) || _.check.isDate(n) || _.check.isBoolean(n) || _.check.isArray(n) || _.check.isObject(n) || Log.w("The format of Data-", i, n, " does not meet the requirements and may not be stored correctly. The attribute value only supports String, Number, Date, Boolean, Array，Object");
    }), e;
  } }, { key: "_checkPropertiesKey", value: function(e) {
    var n = !0;
    return _.each(e, function(i, s) {
      KEY_NAME_MATCH_REGEX.test(s) || (Log.w("invalid key: " + s), n = !1);
    }), n;
  } }, { key: "event", value: function(e) {
    return !(!_.check.isString(e) || !KEY_NAME_MATCH_REGEX.test(e)) || (Log.w("Please check the parameter format, eventName must be an English letter or a string starting with '_', containing letters and numbers with no more than 50 characters: " + e), !1);
  } }, { key: "propertyName", value: function(e) {
    return !(!_.check.isString(e) || !KEY_NAME_MATCH_REGEX.test(e)) || (Log.w("Please check the parameter format, propertyName must be an English letter or a string starting with '_', containing letters and numbers with no more than 50 characters: " + e), !1);
  } }, { key: "properties", value: function(e) {
    return this.stripProperties(e), !e || !(!_.check.isObject(e) || !this._checkPropertiesKey(e) && (Log.w("Please check the parameter format, the key of properties can only start with a letter, contain numbers, letters and underscores _, and the maximum length is 50 characters"), 1));
  } }, { key: "propertiesMust", value: function(e) {
    return this.stripProperties(e), e === void 0 || !_.check.isObject(e) || _.check.isEmptyObject(e) ? (Log.w("properties must be objects and have values"), !1) : !!this._checkPropertiesKey(e) || (Log.w("Please check the parameter format, the key of properties can only start with a letter, contain numbers, letters and underscores _, and the maximum length is 50 characters"), !1);
  } }, { key: "userId", value: function(e) {
    return !(!_.check.isString(e) || !/^.{1,63}$/.test(e)) || (Log.w("User id must be a string that cannot be empty and is less than 64 bits"), !1);
  } }]), r;
})(), MASTER_INSTANCE_NAME = "thinkingdata", DEFAULT_CONFIG = { _name: MASTER_INSTANCE_NAME, appId: "", send_method: "image", persistence: "localStorage", persistencePrefix: "ThinkingDataJSSDK", persistenceEnabled: !0, crossSubDomain: !0, maxReferrerStringLength: 200, showLog: !0, dataSendTimeout: 3e3, useAppTrack: !1, strict: !1, tryCount: 3, enableCalibrationTime: !1, imgUseCrossorigin: !1 }, ThinkingDataPersistence = function(r) {
  this._state = {}, this.crossSubDomain = r.crossSubDomain, this.enabled = r.persistenceEnabled;
  var e, n = null;
  this.enabled && (r.crossSubDomain === !1 ? (e = _.url("sub", location.href), this.name = typeof e == "string" && e !== "" ? r.persistencePrefix + "_" + e : r.persistencePrefix + "_root") : this.name = r.persistencePrefix + "_cross", (e = r.persistence) !== "cookie" && e !== "localStorage" && (Log.i("Unknown persistence type " + e + "; falling back to cookie"), e = r.persistence = "cookie"), e === "localStorage" && _.localStorage.isSupported() ? (this.storage = _.localStorage, (n = _.cookie.get(this.name)) && _.cookie.remove(this.name, this.crossSubDomain)) : (Log.i("localStorage is not support by the browser; falling back to cookie"), this.storage = _.cookie)), this._load(n), this.getDistinctId() || (e = r.uuid || _.UUID(), this._setDeviceId(e), this.setDistinctId(e));
}, TDAnalytics = (ThinkingDataPersistence.prototype._load = function(r) {
  var e;
  this.enabled && ((e = r !== null ? r : this.storage.get(this.name)) !== null && _.check.isJSONString(e) && (this._state = _.extend({}, JSON.parse(e))), r !== null) && this._save();
}, ThinkingDataPersistence.prototype.getDistinctId = function() {
  return this._state.distinct_id;
}, ThinkingDataPersistence.prototype.setDistinctId = function(r) {
  this._set("distinct_id", r);
}, ThinkingDataPersistence.prototype.setEnableTracking = function(r) {
  this._set("enable_tracking", r);
}, ThinkingDataPersistence.prototype.getEnableTracking = function() {
  return !!_.check.isUndefined(this._state.enable_tracking) || this._state.enable_tracking;
}, ThinkingDataPersistence.prototype.clear = function() {
  this._state = {}, this._save();
}, ThinkingDataPersistence.prototype.setOptTracking = function(r) {
  this._set("opt_tracking", r);
}, ThinkingDataPersistence.prototype.getOptTracking = function() {
  return !!_.check.isUndefined(this._state.opt_tracking) || this._state.opt_tracking;
}, ThinkingDataPersistence.prototype.setDistinctId = function(r) {
  this._set("distinct_id", r);
}, ThinkingDataPersistence.prototype.getAccountId = function() {
  return this._state.account_id;
}, ThinkingDataPersistence.prototype.setAccountId = function(r) {
  this._set("account_id", r);
}, ThinkingDataPersistence.prototype.getDeviceId = function() {
  return this._state.device_id;
}, ThinkingDataPersistence.prototype.setSuperProperties = function(r) {
  this._set("super_properties", r);
}, ThinkingDataPersistence.prototype.getSuperProperties = function() {
  return this._state.super_properties || {};
}, ThinkingDataPersistence.prototype.setEventTimer = function(r, e) {
  var n = this._state.event_timers || {};
  n[r] = e, this._set("event_timers", n);
}, ThinkingDataPersistence.prototype.clearEventTimer = function() {
  this._set("event_timers", {});
}, ThinkingDataPersistence.prototype.removeEventTimer = function(r) {
  var e = (this._state.event_timers || {})[r];
  return _.check.isUndefined(e) || (delete this._state.event_timers[r], this._save()), e;
}, ThinkingDataPersistence.prototype._setDeviceId = function(r) {
  this._state.device_id ? Log.w("Current device_id is ", this.getDeviceId(), ", it couldn't been set to: ", r) : this._set("device_id", r);
}, ThinkingDataPersistence.prototype._save = function() {
  this.enabled && this.storage.set(this.name, JSON.stringify(this._state), 73e3, this.crossSubDomain);
}, ThinkingDataPersistence.prototype._set = function(r, e) {
  this._state = this._state || {}, this._state[r] = e, this._save();
}, function() {
}), tabStoragePrefix = (TDAnalytics.prototype.trackLink = function(r, e, n) {
  var i, s, o = this;
  this._isCollectData() && (i = this._getConfig("strict"), !PropertyChecker.properties(n) && i ? Log.w("trackLink failed due to invalid properties.") : r && _.check.isObject(r) && (s = [], _.each(r, function(a, u) {
    a && _.check.isArray(a) && _.each(a, function(l) {
      switch (u) {
        case "tag":
          _.each(document.getElementsByTagName(l), function(d) {
            s.indexOf(d) < 0 && s.push(d);
          });
          break;
        case "class":
          _.each(document.getElementsByClassName(l), function(d) {
            s.indexOf(d) < 0 && s.push(d);
          });
          break;
        case "id":
          var p = document.getElementById(l);
          p !== null && s.indexOf(p) < 0 && s.push(p);
      }
    });
  }), _.each(s, function(a) {
    var u;
    a !== null && ((u = _.extend({}, _.info.pageProperties(), n))["#element_type"] = a.nodeName.toLowerCase(), _.check.isUndefined(u.name) && (u.name = a.getAttribute("td-name") || a.innerHTML || a.value || "Unable to get Identify"), a.addEventListener("click", function() {
      o._sendRequest({ type: "track", event: e, properties: i ? PropertyChecker.stripProperties(u) : u });
    }));
  })));
}, TDAnalytics.prototype.setPageProperty = function(r) {
  this._isCollectData() && (PropertyChecker.properties(r) || !this._getConfig("strict") ? _.extend(this.currentProps, r) : Log.w("Page property setting error"));
}, TDAnalytics.prototype.getPageProperty = function() {
  return this.currentProps;
}, TDAnalytics.prototype.getPresetProperties = function() {
  var e = _.info.properties(), r = {}, e = (r.os = e["#os"], r.screenWidth = e["#screen_width"], r.screenHeight = e["#screen_height"], r.browser = e["#browser"], r.browserVersion = e["#browser_version"], r.deviceId = this.getDeviceId(), 0 - (/* @__PURE__ */ new Date()).getTimezoneOffset() / 60);
  return this._getConfig("zoneOffset") && (e = this._getConfig("zoneOffset")), r.zoneOffset = e, r.toEventPresetProperties = function() {
    return { "#os": r.os, "#screen_width": r.screenWidth, "#screen_height": r.screenHeight, "#browser": r.browser, "#browser_version": r.browserVersion, "#device_id": r.deviceId, "#zone_offset": r.zoneOffset };
  }, r;
}, TDAnalytics.prototype.login = function(r) {
  this._isCollectData() && (typeof r == "number" && (r = String(r)), PropertyChecker.userId(r) || !this._getConfig("strict") ? r !== this.persistence.getAccountId() && (this.persistence.setAccountId(r), Log.i("[ThinkingData] Info: Login SDK, AccountId = " + r)) : Log.e("The parameters of the login API must be strings"));
}, TDAnalytics.prototype.logout = function(r) {
  this._isCollectData() && (r === !0 && (r = _.UUID(), this.persistence.setDistinctId(r)), this.persistence.setAccountId(""), Log.i("[ThinkingData] Info: Logout SDK"));
}, TDAnalytics.prototype.userSet = function(r, e) {
  !this._isCollectData() || !PropertyChecker.propertiesMust(r) && this._getConfig("strict") || this._sendRequest({ type: "user_set", properties: r }, e);
}, TDAnalytics.prototype.userSetOnce = function(r, e) {
  !this._isCollectData() || !PropertyChecker.propertiesMust(r) && this._getConfig("strict") || this._sendRequest({ type: "user_setOnce", properties: r }, e);
}, TDAnalytics.prototype.userUnset = function(r, e) {
  var n;
  !this._isCollectData() || !PropertyChecker.propertyName(r) && this._getConfig("strict") || ((n = {})[r] = 0, this._sendRequest({ type: "user_unset", properties: n }, e));
}, TDAnalytics.prototype.userAdd = function(r, e) {
  var n;
  this._isCollectData() && (_.check.isString(r) && (n = r, (r = {})[n] = 1), PropertyChecker.propertiesMust(r)) && (((i) => {
    for (var s in i) if (!/-*\d+/.test(String(i[s]))) return;
    return 1;
  })(r) || !this._getConfig("strict") ? this._sendRequest({ type: "user_add", properties: r }, e) : Log.w("The property value of useradd api must be a number"));
}, TDAnalytics.prototype.userAppend = function(r, e) {
  this._isCollectData() && (PropertyChecker.propertiesMust(r) && ((n) => {
    for (var i in n) if (!_.check.isArray(n[i])) return;
    return 1;
  })(r) || !this._getConfig("strict") ? this._sendRequest({ type: "user_append", properties: r }, e) : Log.w("The value in the userAppend property can only be Array"));
}, TDAnalytics.prototype.userUniqAppend = function(r, e) {
  this._isCollectData() && (PropertyChecker.propertiesMust(r) && ((n) => {
    for (var i in n) if (!_.check.isArray(n[i])) return;
    return 1;
  })(r) || !this._getConfig("strict") ? this._sendRequest({ type: "user_uniq_append", properties: r }, e) : Log.w("The value in the userUniqAppend property can only be Array"));
}, TDAnalytics.prototype.flush = function() {
  this.batchConsumer && !this._isDebug() && this.batchConsumer.flush();
}, TDAnalytics.prototype.userDel = function(r) {
  this.userDelete(r);
}, TDAnalytics.prototype.userDelete = function(r) {
  this._isCollectData() && this._sendRequest({ type: "user_del" }, r);
}, TDAnalytics.prototype._sendRequest = function(r, e, n) {
  var i, s = _.check.isUndefined(r.time) || !_.check.isDate(r.time) ? /* @__PURE__ */ new Date() : r.time, o = { data: [{ "#type": r.type, "#time": _.formatDate(_.formatTimeZone(s, this._getConfig("zoneOffset"))), "#distinct_id": this.persistence.getDistinctId() }] };
  if (this.persistence.getAccountId() && (o.data[0]["#account_id"] = this.persistence.getAccountId()), r.type === "track" || r.type === "track_update" || r.type === "track_overwrite" ? (o.data[0]["#event_name"] = r.event, r.type === "track_update" || r.type === "track_overwrite" ? o.data[0]["#event_id"] = r.extraId : r.firstCheckId && (o.data[0]["#first_check_id"] = r.firstCheckId), s = 0 - s.getTimezoneOffset() / 60, this._getConfig("zoneOffset") !== void 0 && (s = this._getConfig("zoneOffset")), o.data[0].properties = _.extend({}, { "#device_id": this.persistence.getDeviceId(), "#zone_offset": s }, _.info.properties(), this.getSuperProperties(), this.dynamicProperties ? this.dynamicProperties() : {}, this.getPageProperty()), s = this.persistence.removeEventTimer(r.event), _.check.isUndefined(s) || (s = (/* @__PURE__ */ new Date()).getTime() - s, s = parseFloat((s / 1e3).toFixed(3)), o.data[0].properties["#duration"] = s = 86400 < s ? 86400 : s)) : o.data[0].properties = {}, _.check.isObject(r.properties) && !_.check.isEmptyObject(r.properties) && _.extend(o.data[0].properties, r.properties), _.searchObjDate(o.data[0], this._getConfig("zoneOffset")), this._getConfig("send_method") === "ajax" && (o.data[0] = _.generateEncryptyData(o.data[0], this._getConfig("secretKey"))), o["#app_id"] = this._getConfig("appId"), o["#flush_time"] = _.formatTimeZone(/* @__PURE__ */ new Date(), this._getConfig("zoneOffset")).getTime(), Log.i("[ThinkingData] Info: Enqueue data : "), Log.i(o), this._getConfig("useAppTrack")) {
    var s = window.ThinkingData_APP_JS_Bridge || {};
    if (_typeof(s) === "object" && s.thinkingdata_track) return s.thinkingdata_track(JSON.stringify(o)), void (typeof e == "function" && e());
    if (/td-sdk-ios/.test(navigator.userAgent) && !window.MSStream) return (r = document.createElement("iframe")).setAttribute("src", "thinkinganalytics://trackEvent?event=" + _.encodeURIComponent(JSON.stringify(o))), document.documentElement.appendChild(r), r.parentNode.removeChild(r), r = null, void (typeof e == "function" && e());
    if (window.ThinkingData_APP_Flutter_Bridge) return void window.ThinkingData_APP_Flutter_Bridge.postMessage(JSON.stringify(o));
    if (window.ReactNativeWebView && window.ThinkingData_APP_ReactNative_Bridge) return void window.ThinkingData_APP_ReactNative_Bridge(JSON.stringify({ type: "tdanalytics_reactnative_sdk", event: o }));
  }
  n && (o.data[0]["#uuid"] = _.UUIDv4()), !this.batchConsumer || this._isDebug() || n ? (this._isDebug() ? (i = "&data=" + _.encodeURIComponent(JSON.stringify(o.data[0])) + "&source=client&deviceId=" + this.getDeviceId() + "&appid=" + this._getConfig("appId") + "&version=" + Config.LIB_VERSION, this._getConfig("mode") === "debug_only" && (i += "&dryRun=1")) : (o = JSON.stringify(o), s = _.base64Encode(o), r = "crc=" + _.hashCode(s), i = "&data=" + _.encodeURIComponent(s) + "&ext=" + _.encodeURIComponent(r) + "&version=" + Config.LIB_VERSION), n && (typeof navigator > "u" ? "undefined" : _typeof(navigator)) !== void 0 && navigator.sendBeacon ? (s = new FormData(), this._isDebug() ? (s.append("data", JSON.stringify(o.data[0])), s.append("source", "client"), s.append("deviceId", this.getDeviceId()), s.append("appid", this._getConfig("appId")), s.append("version", Config.LIB_VERSION), this._getConfig("mode") === "debug_only" && s.append("dryRun", 1)) : s.append("data", _.base64Encode(o)), navigator.sendBeacon(this._getConfig("serverUrl"), s)) : this._getConfig("send_method") === "ajax" ? new AjaxTask(i, this._getConfig("serverUrl"), this._getConfig("tryCount"), e, null, this._isDebug(), this._getConfig("dataSendTimeout")).run() : this._sendRequestWithImage(i, e)) : this.batchConsumer.add(o.data[0]);
}, "tab_"), storagePrefix = "ta_jssdk_";
function BatchConsumer(r) {
  this.config = r, this.timer = null, this.batchConfig = _.extend({ size: 6, interval: 6e3, maxLimit: 500 }, this.config.batch), this.batchConfig.size < 1 && (this.batchConfig.size = 1), 30 < this.batchConfig.size && (this.batchConfig.size = 30), this.maxLimit = this.batchConfig.maxLimit, this.batchList = [], this.storageKey = storagePrefix + this.config.appId;
  try {
    var e = JSON.parse(_.localStorage.get(this.storageKey));
    _.check.isArray(e) && (this.batchList = e);
    var n = this.config.persistencePrefix + tabStoragePrefix + this.config.appId, i = JSON.parse(_.localStorage.get(n));
    if (_.check.isArray(i)) {
      for (var s = 0; s < i.length; s++) {
        var o = JSON.parse(_.localStorage.get(i[s]));
        console.log(o), this.batchList.push(o), _.localStorage.remove(i[s]);
      }
      _.localStorage.remove(n);
    }
  } catch (a) {
    Log.e(a);
  }
  this.dataHasChange = !1, this.dataSendTimeStamp = 0;
}
BatchConsumer.prototype = { batchInterval: function() {
  this.loopWrite(), this.loopSend();
}, loopWrite: function() {
  var r = this;
  setTimeout(function() {
    r.batchWrite(), r.loopWrite();
  }, 500);
}, batchWrite: function() {
  this.dataHasChange && (this.dataHasChange = !1, _.localStorage.set(this.storageKey, JSON.stringify(this.batchList)));
}, loopSend: function() {
  var r = this;
  r.timer = setTimeout(function() {
    r.batchSend(), clearTimeout(r.timer), r.loopSend();
  }, this.batchConfig.interval);
}, add: function(r) {
  this.batchList.length > this.maxLimit && this.batchList.shift(), this.batchList.push(r), this.dataHasChange = !0, this.batchList.length > this.batchConfig.size && this.batchSend();
}, batchSend: function() {
  var r, e, n, i = /* @__PURE__ */ new Date();
  this.dataSendTimeStamp !== 0 && i.getTime() - this.dataSendTimeStamp < this.config.dataSendTimeout + 500 || (this.dataSendTimeStamp = i.getTime(), r = (i = 50 < this.batchList.length ? this.batchList.slice(0, 50) : this.batchList).length, e = this, 0 < r && ((n = {}).data = i, n["#app_id"] = this.config.appId, n["#flush_time"] = (/* @__PURE__ */ new Date()).getTime(), Log.i("[ThinkingData] Debug: Send event, Request ="), Log.i(n), i = JSON.stringify(n), n = _.base64Encode(i), i = "crc=" + _.hashCode(n), n = "&data=" + _.encodeURIComponent(n) + "&ext=" + _.encodeURIComponent(i) + "&version=" + Config.LIB_VERSION, new AjaxTask(n, this.config.serverUrl, 0, function() {
    e.batchRemove(r);
  }, function() {
    e.dataSendTimeStamp = 0;
  }, !1, this.config.dataSendTimeout).run()));
}, flush: function() {
  clearTimeout(this.timer), this.batchSend(), this.loopSend();
}, batchRemove: function(r) {
  this.dataSendTimeStamp = 0, this.batchList.splice(0, r), this.dataHasChange = !0, this.batchWrite(), 0 < this.batchList.length && this.flush();
} };
var AjaxTask = (() => {
  function r(e, n, i, s, o, a, u) {
    _classCallCheck(this, r), this.data = e, this.serverUrl = n, this.tryCount = i ?? 3, this.success = s, this.error = o, this.isDebug = a, this.dataSendTimeout = u;
  }
  return _createClass(r, [{ key: "run", value: function() {
    var e, n = null, i = ((n = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")).open("post", this.serverUrl, !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), this);
    e = setTimeout(function() {
      try {
        n && _typeof(n) === "object" && n.abort && n.abort();
      } catch (s) {
        Log.e(s);
      }
      e && (clearTimeout(e), e = null, i.error && i.error(), n.onreadystatechange = null, n.onload = null, n.onerror = null);
    }, this.dataSendTimeout), n.onreadystatechange = function() {
      try {
        var s;
        n.readyState === 4 && (100 <= n.status && n.status < 200 ? Log.i("Ignoring temporary status code 1xx.") : 200 <= n.status && n.status < 300 || n.status === 304 ? (i.success && i.success(), e && (clearTimeout(e), e = null), i.isDebug && ((s = JSON.parse(n.response)).errorLevel !== 0 ? Log.w(s) : Log.i(s))) : (i.error && i.error(), e && (clearTimeout(e), e = null), 0 < i.tryCount && i.onFailed()));
      } catch (o) {
        Log.e(o);
      }
    }, n.send(this.data);
  } }, { key: "onFailed", value: function() {
    0 <= --this.tryCount && this.run();
  } }]), r;
})(), PageLifeCycle = (TDAnalytics.prototype._isDebug = function() {
  return this._getConfig("mode") === "debug" || this._getConfig("mode") === "debug_only";
}, TDAnalytics.prototype._sendRequestWithImage = function(i, e) {
  function n(o) {
    o && !o.hasCalled && (o.hasCalled = !0, o.callback) && o.callback();
  }
  var i = (this._getConfig("serverUrl").indexOf("?") !== -1 ? this._getConfig("serverUrl") : this._getConfig("serverUrl") + "?") + i, s = document.createElement("img");
  s.callback = e, this._getConfig("imgUseCrossorigin") && (s.crossOrigin = "anonymous"), setTimeout(n, this._getConfig("dataSendTimeout"), s), s.onload = function() {
    this.onload = null, n(this);
  }, s.onerror = function() {
    this.onerror = null, n(this);
  }, s.onabort = function() {
    this.onabort = null, n(this);
  }, s.src = i;
}, TDAnalytics.prototype.track = function(r, e, n, i) {
  this._isCollectData() && (r === "ta_page_show" || r === "ta_page_hide" || PropertyChecker.event(r) && PropertyChecker.properties(e) || !this._getConfig("strict")) && this._sendRequest({ type: "track", event: r, time: n, properties: e }, i);
}, TDAnalytics.prototype.trackUpdate = function(r) {
  this._isCollectData() && (_.check.isObject(r) ? (PropertyChecker.event(r.eventName) && PropertyChecker.properties(r.properties) || !this._getConfig("strict")) && this._sendRequest({ type: "track_update", event: r.eventName, time: r.eventTime, properties: r.properties, extraId: r.eventId }, r.callback) : Log.e("The parameter of updateble event does not meet the requirements"));
}, TDAnalytics.prototype.trackOverwrite = function(r) {
  this._isCollectData() && (_.check.isObject(r) ? (PropertyChecker.event(r.eventName) && PropertyChecker.properties(r.properties) || !this._getConfig("strict")) && this._sendRequest({ type: "track_overwrite", event: r.eventName, time: r.eventTime, properties: r.properties, extraId: r.eventId }, r.callback) : Log.e("The parameter of overwritable event  does not meet the requirements"));
}, TDAnalytics.prototype.trackFirstEvent = function(r) {
  this.trackFirst(r);
}, TDAnalytics.prototype.trackFirst = function(r) {
  this._isCollectData() && (_.check.isObject(r) ? (PropertyChecker.event(r.eventName) && PropertyChecker.properties(r.properties) || !this._getConfig("strict")) && this._sendRequest({ type: "track", event: r.eventName, time: r.eventTime, properties: r.properties, firstCheckId: r.firstCheckId || this.getDeviceId() }, r.callback) : Log.e("The parameter of first event does not meet the requirements"));
}, TDAnalytics.prototype.trackWithBeacon = function(r, e, n, i) {
  (r === "ta_page_hide" || PropertyChecker.event(r) && PropertyChecker.properties(e) || !this._getConfig("strict")) && this._sendRequest({ type: "track", event: r, time: n, properties: e }, i, !0);
}, TDAnalytics.prototype.identify = function(r) {
  this.setDistinctId(r);
}, TDAnalytics.prototype.setDistinctId = function(r) {
  this._isCollectData() && (typeof r == "number" && (r = String(r)), PropertyChecker.userId(r) || !this._getConfig("strict") ? r !== this.persistence.getDistinctId() && (this.persistence.setDistinctId(r), Log.i("[ThinkingData] Info: Setting distinct ID, DistinctId = " + r)) : Log.e("The parameter of setDistinctId API requires a string"));
}, TDAnalytics.prototype.getDistinctId = function() {
  return this.persistence.getDistinctId();
}, TDAnalytics.prototype.getDeviceId = function() {
  return this.persistence.getDeviceId();
}, TDAnalytics.prototype._isCollectData = function() {
  return this.persistence.getOptTracking() && this.persistence.getEnableTracking();
}, TDAnalytics.prototype.setSuperProperties = function(r) {
  this._isCollectData() && (PropertyChecker.propertiesMust(r) || !this._getConfig("strict") ? this.persistence.setSuperProperties(_.extend({}, this.getSuperProperties(), r)) : Log.w("The paramater of setSuperProperties API requires object"));
}, TDAnalytics.prototype.getSuperProperties = function() {
  return this.persistence.getSuperProperties();
}, TDAnalytics.prototype.clearSuperProperties = function() {
  this._isCollectData() && this.persistence.setSuperProperties({});
}, TDAnalytics.prototype.unsetSuperProperty = function(r) {
  var e;
  this._isCollectData() && _.check.isString(r) && (delete (e = this.getSuperProperties())[r], this.persistence.setSuperProperties(e));
}, TDAnalytics.prototype.setDynamicSuperProperties = function(r) {
  this._isCollectData() && (typeof r == "function" ? PropertyChecker.properties(r()) || !this._getConfig("strict") ? this.dynamicProperties = r : Log.w("The return value of dynamic properties requires an object") : Log.w("The paramater of setDynamicSuperProperties API requires function type"));
}, TDAnalytics.prototype.timeEvent = function(r) {
  this._isCollectData() && (_.check.isUndefined(r) ? Log.w("No event name provided to timeEvent") : this.persistence.setEventTimer(r, (/* @__PURE__ */ new Date()).getTime()));
}, TDAnalytics.prototype.quick = function(r, e) {
  var n;
  this._isCollectData() && (typeof r == "string" && r === "autoTrack" ? (n = {}, PropertyChecker.properties(e) && _.extend(n, e), this._sendRequest({ type: "track", event: "ta_pageview", properties: _.extend(n, _.info.pageProperties()) })) : typeof r == "string" && r === "siteLinker" ? siteLinker.init(this, e) : Log.w("The quick method does not support the parameter of" + r));
}, TDAnalytics.prototype._setConfig = function(r) {
  _.check.isObject(r) && (_.extend(this.config, r), this._getConfig("persistencePrefix") || (this.config.persistencePrefix = this.config.cookiePrefix), this.persistence);
}, TDAnalytics.prototype._getConfig = function(r) {
  return this.config[r];
}, TDAnalytics.prototype.init = function(r) {
  var e;
  _.check.isUndefined(this.config) ? (this.config = {}, this.currentProps = this.currentProps || {}, this._setConfig(_.extend({}, DEFAULT_CONFIG, r)), this.persistence = new ThinkingDataPersistence(this.config), e = this._getConfig("appId"), _.check.isUndefined(e) || this._setConfig({ appId: e.replace(/\s*/g, "") }), Log.showLog = this._getConfig("showLog"), (e = this._getConfig("send_method")) !== "image" && e !== "ajax" && e !== "beacon" && (Log.i("send_method", e, "is not supported. Changed to image as default value"), this._setConfig({ send_method: "image" })), this._isDebug() ? this._setConfig({ serverUrl: _.url("basic", r.serverUrl) + "/data_debug" }) : this._setConfig({ serverUrl: _.url("basic", r.serverUrl) + "/sync_js" }), this._getConfig("batch") !== void 0 && this._getConfig("batch") !== !1 && _.localStorage.isSupported() && (this.batchConsumer = new BatchConsumer(this.config), this.batchConsumer.batchInterval()), new PageLifeCycle(this, this._getConfig("autoTrack")).start(), e = "normal", this.config.mode && (e = this.config.mode), Log.i("[ThinkingData] Info: TDAnalytics SDK initialize success, AppId = " + this.config.appId + ", ServerUrl = " + this.config.serverUrl + ", Mode = " + e + ", DeviceId = " + this.getDeviceId() + ", Lib = js, LibVersion = " + Config.LIB_VERSION)) : Log.i("The ThinkingData libraray has been initialized.");
}, (() => {
  function r(e, n) {
    _classCallCheck(this, r), this.taLib = e, _.paramType(n) === "Object" && _.paramType(n.pageShow) === "Boolean" ? this.autoPageShow = n.pageShow : this.autoPageShow = !1, _.paramType(n) === "Object" && _.paramType(n.pageHide) === "Boolean" ? this.autoPageHide = n.pageHide : this.autoPageHide = !1;
  }
  return _createClass(r, [{ key: "start", value: function() {
    var e = this;
    e.trackPageShowEvent(), "onvisibilitychange" in document && _.addEvent(document, "visibilitychange", function() {
      document.hidden ? e.trackPageHideEvent() : e.trackPageShowEvent();
    });
  } }, { key: "trackPageShowEvent", value: function() {
    this.autoPageShow && this.taLib.track("ta_page_show", _.info.pageProperties()), this.taLib.timeEvent("ta_page_hide");
  } }, { key: "trackPageHideEvent", value: function() {
    this.autoPageHide && this.taLib.trackWithBeacon("ta_page_hide", _.info.pageProperties());
  } }, { key: "trackPageHideEventOnClose", value: function() {
    this.autoPageHide && this.isPageShow && this.taLib.trackWithBeacon("ta_page_hide", _.info.pageProperties());
  } }]), r;
})()), siteLinker = (TDAnalytics.prototype.initInstance = function(r, i) {
  if (!_.check.isString(r) || !_.check.isUndefined(i) && !_.check.isObject(i)) return Log.w("invalid parameter of initInstance(string, object)."), null;
  if (this._getConfig("_name") !== MASTER_INSTANCE_NAME) return Log.w("This function is allowed for master instance only"), null;
  if (r === MASTER_INSTANCE_NAME || this[r]) return Log.w("The name ", r, " couldn't be used for create new instance."), null;
  _.check.isUndefined(i) && (i = {});
  var n = new TDAnalytics(), i = _.extend({}, this.config, { _name: r, persistenceEnabled: !1, uuid: this.getDeviceId() }, i);
  i.persistenceEnabled && (i.persistencePrefix = i.persistencePrefix + "_" + r), n.init(i), this[r] = n;
}, TDAnalytics.prototype.enableTracking = function(r) {
  typeof r == "boolean" && this.persistence.setEnableTracking(r);
}, TDAnalytics.prototype.optOutTracking = function() {
  this.persistence.setSuperProperties({}), this.persistence.setAccountId(""), this.persistence.clearEventTimer(), this.persistence.setOptTracking(!1);
}, TDAnalytics.prototype.optInTracking = function() {
  this.persistence.setOptTracking(!0);
}, TDAnalytics.prototype.setTrackStatus = function(r) {
  _.check.isObject(r) && (r = r.status, Log.i("[ThinkingData] Info: Change Status to " + r), r === "pause" ? this.enableTracking(!1) : r === "stop" ? this.optOutTracking() : r === "normal" && (this.enableTracking(!0), this.optInTracking()));
}, {});
function initAsModule() {
  return new TDAnalytics();
}
siteLinker.getPartUrl = function(r) {
  var e = this.option.length;
  if (e) {
    for (var n = 0; n < e; n++) if (-1 < r.indexOf(this.option[n].part_url)) return !0;
  }
  return !1;
}, siteLinker.getPartHash = function(r) {
  var e = this.option.length;
  if (e) {
    for (var n = 0; n < e; n++) if (-1 < r.indexOf(this.option[n].part_url)) return this.option[n].after_hash;
  }
  return !1;
}, siteLinker.getCurrenId = function() {
  var r = this.ta.getDistinctId();
  return encodeURIComponent("d" + r);
}, siteLinker.rewriteUrl = function(r, e) {
  var n, i, s, o = /([^?#]+)(\?[^#]*)?(#.*)?/.exec(r), a = "";
  if (o) return n = o[1] || "", i = o[2] || "", o = o[3] || "", a = this.getPartHash(r) ? (s = o.indexOf("_tasdk"), -1 < o.indexOf("?") ? -1 < s ? n + i + "#" + o.substring(1, s) + "_tasdk=" + this.getCurrenId() : n + i + "#" + o.substring(1) + "&_tasdk=" + this.getCurrenId() : n + i + "#" + o.substring(1) + "?_tasdk=" + this.getCurrenId()) : (s = i.indexOf("_tasdk"), /^\?(\w)+/.test(i) ? -1 < s ? n + "?" + i.substring(1, s) + "_tasdk=" + this.getCurrenId() + o : n + "?" + i.substring(1) + "&_tasdk=" + this.getCurrenId() + o : n + "?" + i.substring(1) + "_tasdk=" + this.getCurrenId() + o), e && (e.href = a), a;
}, siteLinker.addClickListen = function() {
  function r(n) {
    var i, s = (n = n.target).tagName.toLowerCase(), o = n.parentNode;
    (s === "a" && n.href || o && o.tagName && o.tagName.toLowerCase() === "a" && o.href) && (s = s === "a" && n.href ? (i = n.href, n) : (i = o.href, o), (n = _.URL(i).protocol) !== "http:" && n !== "https:" || e.getPartUrl(i) && e.rewriteUrl(i, s));
  }
  var e = this;
  _.addSiteEvent(document, "mousedown", r), window.PointerEvent && "maxTouchPoints" in window.navigator && 0 <= window.navigator.maxTouchPoints && _.addSiteEvent(document, "pointerdown", r);
}, siteLinker.getUrlId = function() {
  var r = location.href.match(/_tasdk=([aufd][^\?\#\&\=]+)/);
  return _.check.isArray(r) && r[1] ? decodeURIComponent(r[1]) : "";
}, siteLinker.setRefferId = function() {
  var r, e = this.ta.getDistinctId(), n = this.getUrlId();
  return n !== "" && (r = n.substring(0, 1) === "d", (n = n.substring(1)) !== e) && void (n && r && this.ta.setDistinctId(n));
}, siteLinker.init = function(r, e) {
  this.isInited || (this.isInited = !0, this.ta = r, this.setRefferId(), _.check.isObject(e) && _.check.isArray(e.linker) && 0 < e.linker.length && (this.addClickListen(), this.option = e.linker, this.option = ((n) => {
    for (var i = n.length, s = [], o = 0; o < i; o++) /[A-Za-z0-9]+\./.test(n[o].part_url) && Object.prototype.toString.call(n[o].after_hash) === "[object Boolean]" ? s.push(n[o]) : Log.w("The configuration of linker " + (o + 1) + " is not supported.Please check format");
    return s;
  })(this.option)));
};
var td = initAsModule();
const initTa = ({
  appId: r,
  serverUrl: e
}) => {
  td.init({ appId: r, serverUrl: e });
}, sendAdExposureTa = (r) => {
  const e = Object.fromEntries(
    Object.entries(r).filter(
      ([n, i]) => i !== void 0 && i !== ""
    )
  );
  td.track("ad_exposure_platform", {
    ...e
  });
}, handleTaParams = (r, e, n) => {
  let i = "";
  e.adType == "1" ? i = "H5广告" : e.adType == "6" ? i = "半屏小程序" : i = "广告类型错误";
  const { trafficId: s, orderNumber: o, ...a } = r;
  sendAdExposureTa({
    ...a,
    traffic_master_id: s,
    traffic_master_s_name: e.abbreviation,
    advertising_number: e.adId,
    advertising_name: e.adName,
    advertisers: e.advertisersName,
    taskId: e.taskId,
    adType: i,
    orderNumber: o,
    cashier: "流量主H5收银台"
  });
};
var ERR_CODES = /* @__PURE__ */ ((r) => (r.ERR_Params = "000011", r.ERR_Request = "000012", r.ERR_SupAd = "000013", r.ERR_OpenMiniProgram = "000014", r.ERR_OpenH5 = "000015", r.ERR_requestTraceId = "000016", r))(ERR_CODES || {});
const errCodesHandle = {
  "000011": "流量主ID或订单号不能为空",
  "000012": "请求广告失败",
  "000013": "暂不支持该广告类型",
  "000014": "打开小程序失败",
  "000015": "打开H5失败",
  "000016": "请求流水号不能为空"
}, aliReady = (r) => {
  window.AlipayJSBridge ? r && r() : document.addEventListener("AlipayJSBridgeReady", r, !1);
};
class PayAd {
  constructor(e) {
    C(this, "env");
    C(this, "http");
    this.env = e || "prod", this.http = createRequest(this.env), initTa(taConfig[this.env]);
  }
  async showAd(e, n) {
    var i, s;
    if (!e.trafficId || !e.orderNumber) {
      this.callBackOnError(
        errCodesHandle[ERR_CODES.ERR_Params],
        ERR_CODES.ERR_Params,
        n
      );
      return;
    }
    try {
      const o = await this.getAd(e);
      if (!o) {
        this.callBackOnError(
          errCodesHandle[ERR_CODES.ERR_Request],
          ERR_CODES.ERR_Request,
          n
        );
        return;
      }
      if (o.adType !== "1") {
        this.callBackOnError(
          errCodesHandle[ERR_CODES.ERR_SupAd],
          ERR_CODES.ERR_SupAd,
          n
        );
        return;
      }
      handleTaParams(e, o, 2);
      let a = o.adDefaultUrl;
      if (o.adType === AD_TYPE.H5 && o.adUrl && (a = o.adUrl), a) {
        (i = n == null ? void 0 : n.onSuccess) == null || i.call(n, "success"), a.includes("alipays://") ? window.location.href = "https://ds.alipay.com/?scheme=" + encodeURIComponent(a) : window.location.replace(a);
        return;
      }
      aliReady(function() {
        AlipayJSBridge.call("closeWebview");
      });
    } catch (o) {
      (s = n == null ? void 0 : n.onError) == null || s.call(n, (o == null ? void 0 : o.data) || o);
    }
  }
  callBackOnError(e, n, i) {
    var o;
    const s = {
      data: {
        msg: e,
        code: n
      }
    };
    (o = i == null ? void 0 : i.onError) == null || o.call(i, s);
  }
  getAd(e) {
    const n = {
      adMarkEntry: "1",
      trafficId: e.trafficId,
      //流量主id
      adType: e.adType || "",
      //广告类型
      openId: e.openId || ""
      //用户id
    }, i = encryptRequestData(n, rsaKey.public);
    return r_queryInfo(this.http.post, i);
  }
}
export {
  aliReady,
  PayAd as default
};
