lgsso-sdk 1.2.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4074,31 +4074,55 @@ function getCookie(name) {
4074
4074
  }
4075
4075
 
4076
4076
  /**
4077
- * 设置Cookie
4077
+ * 设置Cookie(支持指定根域名)
4078
4078
  * @param {string} name Cookie名称
4079
4079
  * @param {string} value Cookie值
4080
- * @param {Object} options 配置(过期时间、路径等)
4080
+ * @param {Object} options 配置(expires: 过期天数/Date, path: 路径, domain: 域名)
4081
4081
  */
4082
4082
  function setCookie(name, value, options = {}) {
4083
4083
  if (!isBrowser()) return;
4084
4084
  let cookieStr = `${name}=${encodeURIComponent(value)}`;
4085
- cookieStr += `; path=${options.path || '/'}`; // 默认根路径
4085
+
4086
+ // 路径:默认根路径,确保全站可用
4087
+ cookieStr += `; path=${options.path || '/'}`;
4088
+
4089
+ // 域名:指定根域名.zlgx.com(适配你的场景)
4090
+ // 优先级:用户传入的domain > 默认根域名.zlgx.com
4091
+ const targetDomain = options.domain || '.zlgx.com';
4092
+ cookieStr += `; domain=${targetDomain}`;
4093
+
4094
+ // 过期时间(默认1天)
4086
4095
  if (options.expires) {
4087
4096
  const expires = typeof options.expires === 'number'
4088
4097
  ? new Date(Date.now() + options.expires * 86400000)
4089
4098
  : options.expires;
4090
4099
  cookieStr += `; expires=${expires.toUTCString()}`;
4091
4100
  }
4101
+
4102
+ // 可选:HTTPS环境下添加Secure(仅HTTPS传输)
4103
+ if (options.secure || window.location.protocol === 'https:') {
4104
+ cookieStr += '; Secure';
4105
+ }
4106
+
4107
+ // 可选:防止XSS攻击的HttpOnly(注意:HttpOnly的Cookie无法通过JS读取)
4108
+ if (options.httpOnly) {
4109
+ cookieStr += '; HttpOnly';
4110
+ }
4111
+
4092
4112
  document.cookie = cookieStr;
4093
4113
  }
4094
4114
 
4095
- /**
4096
- * 删除指定名称的Cookie
4097
- * @param {string} name Cookie名称
4098
- */
4099
- function removeCookie(name) {
4115
+ function removeCookie(name, options = {}) {
4100
4116
  if (!isBrowser()) return;
4101
- setCookie(name, '', { expires: -1 });
4117
+ setCookie(
4118
+ name,
4119
+ '',
4120
+ {
4121
+ expires: -1, // 立即过期
4122
+ path: options.path || '/',
4123
+ domain: options.domain || '.zlgx.com' // 必须和设置时一致
4124
+ }
4125
+ );
4102
4126
  }
4103
4127
 
4104
4128
  /**
@@ -4070,31 +4070,55 @@ function getCookie(name) {
4070
4070
  }
4071
4071
 
4072
4072
  /**
4073
- * 设置Cookie
4073
+ * 设置Cookie(支持指定根域名)
4074
4074
  * @param {string} name Cookie名称
4075
4075
  * @param {string} value Cookie值
4076
- * @param {Object} options 配置(过期时间、路径等)
4076
+ * @param {Object} options 配置(expires: 过期天数/Date, path: 路径, domain: 域名)
4077
4077
  */
4078
4078
  function setCookie(name, value, options = {}) {
4079
4079
  if (!isBrowser()) return;
4080
4080
  let cookieStr = `${name}=${encodeURIComponent(value)}`;
4081
- cookieStr += `; path=${options.path || '/'}`; // 默认根路径
4081
+
4082
+ // 路径:默认根路径,确保全站可用
4083
+ cookieStr += `; path=${options.path || '/'}`;
4084
+
4085
+ // 域名:指定根域名.zlgx.com(适配你的场景)
4086
+ // 优先级:用户传入的domain > 默认根域名.zlgx.com
4087
+ const targetDomain = options.domain || '.zlgx.com';
4088
+ cookieStr += `; domain=${targetDomain}`;
4089
+
4090
+ // 过期时间(默认1天)
4082
4091
  if (options.expires) {
4083
4092
  const expires = typeof options.expires === 'number'
4084
4093
  ? new Date(Date.now() + options.expires * 86400000)
4085
4094
  : options.expires;
4086
4095
  cookieStr += `; expires=${expires.toUTCString()}`;
4087
4096
  }
4097
+
4098
+ // 可选:HTTPS环境下添加Secure(仅HTTPS传输)
4099
+ if (options.secure || window.location.protocol === 'https:') {
4100
+ cookieStr += '; Secure';
4101
+ }
4102
+
4103
+ // 可选:防止XSS攻击的HttpOnly(注意:HttpOnly的Cookie无法通过JS读取)
4104
+ if (options.httpOnly) {
4105
+ cookieStr += '; HttpOnly';
4106
+ }
4107
+
4088
4108
  document.cookie = cookieStr;
4089
4109
  }
4090
4110
 
4091
- /**
4092
- * 删除指定名称的Cookie
4093
- * @param {string} name Cookie名称
4094
- */
4095
- function removeCookie(name) {
4111
+ function removeCookie(name, options = {}) {
4096
4112
  if (!isBrowser()) return;
4097
- setCookie(name, '', { expires: -1 });
4113
+ setCookie(
4114
+ name,
4115
+ '',
4116
+ {
4117
+ expires: -1, // 立即过期
4118
+ path: options.path || '/',
4119
+ domain: options.domain || '.zlgx.com' // 必须和设置时一致
4120
+ }
4121
+ );
4098
4122
  }
4099
4123
 
4100
4124
  /**
package/dist/lgsso-sdk.js CHANGED
@@ -4076,31 +4076,55 @@
4076
4076
  }
4077
4077
 
4078
4078
  /**
4079
- * 设置Cookie
4079
+ * 设置Cookie(支持指定根域名)
4080
4080
  * @param {string} name Cookie名称
4081
4081
  * @param {string} value Cookie值
4082
- * @param {Object} options 配置(过期时间、路径等)
4082
+ * @param {Object} options 配置(expires: 过期天数/Date, path: 路径, domain: 域名)
4083
4083
  */
4084
4084
  function setCookie(name, value, options = {}) {
4085
4085
  if (!isBrowser()) return;
4086
4086
  let cookieStr = `${name}=${encodeURIComponent(value)}`;
4087
- cookieStr += `; path=${options.path || '/'}`; // 默认根路径
4087
+
4088
+ // 路径:默认根路径,确保全站可用
4089
+ cookieStr += `; path=${options.path || '/'}`;
4090
+
4091
+ // 域名:指定根域名.zlgx.com(适配你的场景)
4092
+ // 优先级:用户传入的domain > 默认根域名.zlgx.com
4093
+ const targetDomain = options.domain || '.zlgx.com';
4094
+ cookieStr += `; domain=${targetDomain}`;
4095
+
4096
+ // 过期时间(默认1天)
4088
4097
  if (options.expires) {
4089
4098
  const expires = typeof options.expires === 'number'
4090
4099
  ? new Date(Date.now() + options.expires * 86400000)
4091
4100
  : options.expires;
4092
4101
  cookieStr += `; expires=${expires.toUTCString()}`;
4093
4102
  }
4103
+
4104
+ // 可选:HTTPS环境下添加Secure(仅HTTPS传输)
4105
+ if (options.secure || window.location.protocol === 'https:') {
4106
+ cookieStr += '; Secure';
4107
+ }
4108
+
4109
+ // 可选:防止XSS攻击的HttpOnly(注意:HttpOnly的Cookie无法通过JS读取)
4110
+ if (options.httpOnly) {
4111
+ cookieStr += '; HttpOnly';
4112
+ }
4113
+
4094
4114
  document.cookie = cookieStr;
4095
4115
  }
4096
4116
 
4097
- /**
4098
- * 删除指定名称的Cookie
4099
- * @param {string} name Cookie名称
4100
- */
4101
- function removeCookie(name) {
4117
+ function removeCookie(name, options = {}) {
4102
4118
  if (!isBrowser()) return;
4103
- setCookie(name, '', { expires: -1 });
4119
+ setCookie(
4120
+ name,
4121
+ '',
4122
+ {
4123
+ expires: -1, // 立即过期
4124
+ path: options.path || '/',
4125
+ domain: options.domain || '.zlgx.com' // 必须和设置时一致
4126
+ }
4127
+ );
4104
4128
  }
4105
4129
 
4106
4130
  /**
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lgsso={})}(this,function(e){"use strict";function t(){return"undefined"!=typeof window&&"undefined"!=typeof document}function n(e,n){if(!t())return null;const r=n||window.location.href,o=new URL(r);let s=o.searchParams.get(e);if(null!==s)return s;if(o.hash.includes("?")){const t=o.hash.split("?")[1];return new URLSearchParams(t).get(e)}return null}function r(){return t()?window.location.href:""}function o(e,t){return function(){return e.apply(t,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:a,toStringTag:c}=Symbol,u=(l=Object.create(null),e=>{const t=s.call(e);return l[t]||(l[t]=t.slice(8,-1).toLowerCase())});var l;const d=e=>(e=e.toLowerCase(),t=>u(t)===e),f=e=>t=>typeof t===e,{isArray:p}=Array,h=f("undefined");function m(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&w(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const y=d("ArrayBuffer");const g=f("string"),w=f("function"),b=f("number"),E=e=>null!==e&&"object"==typeof e,O=e=>{if("object"!==u(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||c in e||a in e)},R=d("Date"),T=d("File"),S=d("Blob"),A=d("FileList"),C=d("URLSearchParams"),[v,P,U,k]=["ReadableStream","Request","Response","Headers"].map(d);function x(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),p(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(m(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function _(e,t){if(m(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=e=>!h(e)&&e!==j;const L=(F="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>F&&e instanceof F);var F;const B=d("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),K=d("RegExp"),q=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};x(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const I=d("AsyncFunction"),M=($="function"==typeof setImmediate,z=w(j.postMessage),$?setImmediate:z?(H=`axios@${Math.random()}`,J=[],j.addEventListener("message",({source:e,data:t})=>{e===j&&t===H&&J.length&&J.shift()()},!1),e=>{J.push(e),j.postMessage(H,"*")}):e=>setTimeout(e));var $,z,H,J;const W="undefined"!=typeof queueMicrotask?queueMicrotask.bind(j):"undefined"!=typeof process&&process.nextTick||M;var V={isArray:p,isArrayBuffer:y,isBuffer:m,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||w(e.append)&&("formdata"===(t=u(e))||"object"===t&&w(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&y(e.buffer),t},isString:g,isNumber:b,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:O,isEmptyObject:e=>{if(!E(e)||m(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:v,isRequest:P,isResponse:U,isHeaders:k,isUndefined:h,isDate:R,isFile:T,isBlob:S,isRegExp:K,isFunction:w,isStream:e=>E(e)&&w(e.pipe),isURLSearchParams:C,isTypedArray:L,isFileList:A,forEach:x,merge:function e(){const{caseless:t}=N(this)&&this||{},n={},r=(r,o)=>{const s=t&&_(n,o)||o;O(n[s])&&O(r)?n[s]=e(n[s],r):O(r)?n[s]=e({},r):p(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&x(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(x(t,(t,r)=>{n&&w(t)?e[r]=o(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:u,kindOfTest:d,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(p(e))return e;let t=e.length;if(!b(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:B,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:q,freezeMethods:e=>{q(e,(t,n)=>{if(w(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];w(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return p(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:_,global:j,isContextDefined:N,isSpecCompliantForm:function(e){return!!(e&&w(e.append)&&"FormData"===e[c]&&e[a])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(E(e)){if(t.indexOf(e)>=0)return;if(m(e))return e;if(!("toJSON"in e)){t[r]=e;const o=p(e)?[]:{};return x(e,(e,t)=>{const s=n(e,r+1);!h(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:I,isThenable:e=>e&&(E(e)||w(e))&&w(e.then)&&w(e.catch),setImmediate:M,asap:W,isIterable:e=>null!=e&&w(e[a])};function G(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}V.inherits(G,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}});const X=G.prototype,Q={};["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"].forEach(e=>{Q[e]={value:e}}),Object.defineProperties(G,Q),Object.defineProperty(X,"isAxiosError",{value:!0}),G.from=(e,t,n,r,o,s)=>{const i=Object.create(X);return V.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),G.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function Z(e){return V.isPlainObject(e)||V.isArray(e)}function Y(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function ee(e,t,n){return e?e.concat(t).map(function(e,t){return e=Y(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const te=V.toFlatObject(V,{},null,function(e){return/^is[A-Z]/.test(e)});function ne(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!V.isUndefined(t[e])})).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(V.isDate(e))return e.toISOString();if(V.isBoolean(e))return e.toString();if(!a&&V.isBlob(e))throw new G("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(e)||V.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(V.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(V.isArray(e)&&function(e){return V.isArray(e)&&!e.some(Z)}(e)||(V.isFileList(e)||V.endsWith(n,"[]"))&&(a=V.toArray(e)))return n=Y(n),a.forEach(function(e,r){!V.isUndefined(e)&&null!==e&&t.append(!0===i?ee([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!Z(e)||(t.append(ee(o,n,s),c(e)),!1)}const l=[],d=Object.assign(te,{defaultVisitor:u,convertValue:c,isVisitable:Z});if(!V.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!V.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),V.forEach(n,function(n,s){!0===(!(V.isUndefined(n)||null===n)&&o.call(t,n,V.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function oe(e,t){this._pairs=[],e&&ne(e,this,t)}const se=oe.prototype;function ie(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ae(e,t,n){if(!t)return e;const r=n&&n.encode||ie;V.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):V.isURLSearchParams(t)?t.toString():new oe(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}se.append=function(e,t){this._pairs.push([e,t])},se.toString=function(e){const t=e?function(t){return e.call(this,t,re)}:re;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ce=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){V.forEach(this.handlers,function(t){null!==t&&e(t)})}},ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},le={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:oe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const de="undefined"!=typeof window&&"undefined"!=typeof document,fe="object"==typeof navigator&&navigator||void 0,pe=de&&(!fe||["ReactNative","NativeScript","NS"].indexOf(fe.product)<0),he="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,me=de&&window.location.href||"http://localhost";var ye={...Object.freeze({__proto__:null,hasBrowserEnv:de,hasStandardBrowserEnv:pe,hasStandardBrowserWebWorkerEnv:he,navigator:fe,origin:me}),...le};function ge(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&V.isArray(r)?r.length:s,a)return V.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&V.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&V.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(e,r)=>{t(function(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const we={transitional:ue,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=V.isObject(e);o&&V.isHTMLForm(e)&&(e=new FormData(e));if(V.isFormData(e))return r?JSON.stringify(ge(e)):e;if(V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)||V.isReadableStream(e))return e;if(V.isArrayBufferView(e))return e.buffer;if(V.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ne(e,new ye.classes.URLSearchParams,{visitor:function(e,t,n,r){return ye.isNode&&V.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=V.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ne(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||we.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(V.isResponse(e)||V.isReadableStream(e))return e;if(e&&V.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw G.from(e,G.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ye.classes.FormData,Blob:ye.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{we.headers[e]={}});var be=we;const Ee=V.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"]);const Oe=Symbol("internals");function Re(e){return e&&String(e).trim().toLowerCase()}function Te(e){return!1===e||null==e?e:V.isArray(e)?e.map(Te):String(e)}function Se(e,t,n,r,o){return V.isFunction(r)?r.call(this,t,n):(o&&(t=n),V.isString(t)?V.isString(r)?-1!==t.indexOf(r):V.isRegExp(r)?r.test(t):void 0:void 0)}class Ae{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Re(t);if(!o)throw new Error("header name must be a non-empty string");const s=V.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Te(e))}const s=(e,t)=>V.forEach(e,(e,n)=>o(e,n,t));if(V.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(V.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ee[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(V.isObject(e)&&V.isIterable(e)){let n,r,o={};for(const t of e){if(!V.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?V.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Re(e)){const n=V.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(V.isFunction(t))return t.call(this,e,n);if(V.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Re(e)){const n=V.findKey(this,e);return!(!n||void 0===this[n]||t&&!Se(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Re(e)){const o=V.findKey(n,e);!o||t&&!Se(0,n[o],o,t)||(delete n[o],r=!0)}}return V.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Se(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return V.forEach(this,(r,o)=>{const s=V.findKey(n,o);if(s)return t[s]=Te(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=Te(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return V.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&V.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Oe]=this[Oe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Re(e);t[r]||(!function(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return V.isArray(e)?e.forEach(r):r(e),this}}Ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),V.reduceDescriptors(Ae.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),V.freezeMethods(Ae);var Ce=Ae;function ve(e,t){const n=this||be,r=t||n,o=Ce.from(r.headers);let s=r.data;return V.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Pe(e){return!(!e||!e.__CANCEL__)}function Ue(e,t,n){G.call(this,null==e?"canceled":e,G.ERR_CANCELED,t,n),this.name="CanceledError"}function ke(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}V.inherits(Ue,G,{__CANCEL__:!0});const xe=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},je=e=>(...t)=>V.asap(()=>e(...t));var Ne=ye.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ye.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ye.origin),ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent)):()=>!0,Le=ye.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),V.isString(r)&&i.push("path="+r),V.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Fe(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Be=e=>e instanceof Ce?{...e}:e;function De(e,t){t=t||{};const n={};function r(e,t,n,r){return V.isPlainObject(e)&&V.isPlainObject(t)?V.merge.call({caseless:r},e,t):V.isPlainObject(t)?V.merge({},t):V.isArray(t)?t.slice():t}function o(e,t,n,o){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!V.isUndefined(t))return r(void 0,t)}function i(e,t){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Be(e),Be(t),0,!0)};return V.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||o,i=s(e[r],t[r],r);V.isUndefined(i)&&s!==a||(n[r]=i)}),n}var Ke=e=>{const t=De({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Ce.from(a),t.url=ae(Fe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),V.isFormData(r))if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(ye.hasStandardBrowserEnv&&(o&&V.isFunction(o)&&(o=o(t)),o||!1!==o&&Ne(t.url))){const e=s&&i&&Le.read(i);e&&a.set(s,e)}return t};var qe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ke(e);let o=r.data;const s=Ce.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Ce.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ke(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new G("Request aborted",G.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new G("Network Error",G.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ue;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new G(t,o.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&V.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),V.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=xe(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=xe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Ue(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===ye.protocols.indexOf(g)?n(new G("Unsupported protocol "+g+":",G.ERR_BAD_REQUEST,e)):m.send(o||null)})};var Ie=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof G?t:new Ue(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new G(`timeout ${t} of ms exceeded`,G.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>V.asap(i),a}};const Me=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},$e=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},ze=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of $e(e))yield*Me(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},He="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Je=He&&"function"==typeof ReadableStream,We=He&&("function"==typeof TextEncoder?(Ve=new TextEncoder,e=>Ve.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ve;const Ge=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Xe=Je&&Ge(()=>{let e=!1;const t=new Request(ye.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Qe=Je&&Ge(()=>V.isReadableStream(new Response("").body)),Ze={stream:Qe&&(e=>e.body)};var Ye;He&&(Ye=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ze[e]&&(Ze[e]=V.isFunction(Ye[e])?t=>t[e]():(t,n)=>{throw new G(`Response type '${e}' is not supported`,G.ERR_NOT_SUPPORT,n)})}));const et=async(e,t)=>{const n=V.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e)){const t=new Request(ye.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return V.isArrayBufferView(e)||V.isArrayBuffer(e)?e.byteLength:(V.isURLSearchParams(e)&&(e+=""),V.isString(e)?(await We(e)).byteLength:void 0)})(t):n};var tt=He&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Ke(e);u=u?(u+"").toLowerCase():"text";let p,h=Ie([o,s&&s.toAbortSignal()],i);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let y;try{if(c&&Xe&&"get"!==n&&"head"!==n&&0!==(y=await et(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(V.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=_e(y,xe(je(c)));r=ze(n.body,65536,e,t)}}V.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;p=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(p,f);const i=Qe&&("stream"===u||"response"===u);if(Qe&&(a||i&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=V.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&_e(t,xe(je(a),!0))||[];s=new Response(ze(s.body,65536,n,()=>{r&&r(),m&&m()}),e)}u=u||"text";let g=await Ze[V.findKey(Ze,u)||"text"](s,e);return!i&&m&&m(),await new Promise((t,n)=>{ke(t,n,{data:g,headers:Ce.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new G("Network Error",G.ERR_NETWORK,e,p),{cause:t.cause||t});throw G.from(t,t&&t.code,e,p)}});const nt={http:null,xhr:qe,fetch:tt};V.forEach(nt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const rt=e=>`- ${e}`,ot=e=>V.isFunction(e)||null===e||!1===e;var st=e=>{e=V.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!ot(n)&&(r=nt[(t=String(n)).toLowerCase()],void 0===r))throw new G(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new G("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(rt).join("\n"):" "+rt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function it(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ue(null,e)}function at(e){it(e),e.headers=Ce.from(e.headers),e.data=ve.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return st(e.adapter||be.adapter)(e).then(function(t){return it(e),t.data=ve.call(e,e.transformResponse,t),t.headers=Ce.from(t.headers),t},function(t){return Pe(t)||(it(e),t&&t.response&&(t.response.data=ve.call(e,e.transformResponse,t.response),t.response.headers=Ce.from(t.response.headers))),Promise.reject(t)})}const ct="1.11.0",ut={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ut[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const lt={};ut.transitional=function(e,t,n){function r(e,t){return"[Axios v"+ct+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new G(r(o," has been removed"+(t?" in "+t:"")),G.ERR_DEPRECATED);return t&&!lt[o]&&(lt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},ut.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var dt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new G("option "+s+" must be "+n,G.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new G("Unknown option "+s,G.ERR_BAD_OPTION)}},validators:ut};const ft=dt.validators;class pt{constructor(e){this.defaults=e||{},this.interceptors={request:new ce,response:new ce}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=De(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&dt.assertOptions(n,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},!1),null!=r&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:dt.assertOptions(r,{encode:ft.function,serialize:ft.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),dt.assertOptions(t,{baseUrl:ft.spelling("baseURL"),withXsrfToken:ft.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&V.merge(o.common,o[t.method]);o&&V.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ce.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[at.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=at.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return ae(Fe((e=De(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}V.forEach(["delete","get","head","options"],function(e){pt.prototype[e]=function(t,n){return this.request(De(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(De(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}pt.prototype[e]=t(),pt.prototype[e+"Form"]=t(!0)});var ht=pt;class mt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Ue(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new mt(function(t){e=t}),cancel:e}}}var yt=mt;const gt={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(gt).forEach(([e,t])=>{gt[t]=e});var wt=gt;const bt=function e(t){const n=new ht(t),r=o(ht.prototype.request,n);return V.extend(r,ht.prototype,n,{allOwnKeys:!0}),V.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(De(t,n))},r}(be);bt.Axios=ht,bt.CanceledError=Ue,bt.CancelToken=yt,bt.isCancel=Pe,bt.VERSION=ct,bt.toFormData=ne,bt.AxiosError=G,bt.Cancel=bt.CanceledError,bt.all=function(e){return Promise.all(e)},bt.spread=function(e){return function(t){return e.apply(null,t)}},bt.isAxiosError=function(e){return V.isObject(e)&&!0===e.isAxiosError},bt.mergeConfig=De,bt.AxiosHeaders=Ce,bt.formToJSON=e=>ge(V.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=st,bt.HttpStatusCode=wt,bt.default=bt;var Et=bt;async function Ot(e,{method:n="GET",data:r={},headers:o={},timeout:s=5e3}={}){return t()?"fetch"in window&&"AbortController"in window?async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i=new AbortController,a=setTimeout(()=>i.abort(),s),c={method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},signal:i.signal};"GET"!==c.method&&r&&(c.body=JSON.stringify(r));try{const t=await fetch(e,c);if(clearTimeout(a),!t.ok)return{code:t.status,msg:`HTTP请求失败: ${t.statusText}`,success:!1};try{return await t.json()}catch(e){return{code:-201,msg:"响应数据不是有效的JSON格式",success:!1}}}catch(e){return clearTimeout(a),"AbortError"===e.name?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:n,data:r,headers:o,timeout:s}):async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i={url:e,method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},timeout:s,["GET"===n.toUpperCase()?"params":"data"]:r};try{return(await Et(i)).data}catch(e){return"ECONNABORTED"===e.code?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:e.response?{code:e.response.status,msg:`HTTP请求失败: ${e.response.statusText}`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:n,data:r,headers:o,timeout:s}):{code:-200,msg:"request方法只能在浏览器环境使用",success:!1}}function Rt(e){if(!t())return null;const n=document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));return n?decodeURIComponent(n[2]):null}function Tt(e,n,r={}){if(!t())return;let o=`${e}=${encodeURIComponent(n)}`;if(o+=`; path=${r.path||"/"}`,r.expires){o+=`; expires=${("number"==typeof r.expires?new Date(Date.now()+864e5*r.expires):r.expires).toUTCString()}`}document.cookie=o}function St(e,t,n="platType"){if(!e||!t)return e;try{const r=new URL(e);return r.searchParams.set(n,t),r.toString()}catch(r){const o=e.includes("?")?"&":"?";return`${e}${o}${n}=${t}`}}const At={accessCodeKey:"accessCode",tokenKey:"scm_token",timeout:5e3,headers:{},tokenApi:"",refreshCodeApi:"",logoutApi:"",logOutUrl:"",storage:localStorage,oldPwdKey:"oldPwd",newPwdKey:"newPwd",changePasswordApi:"",sendCaptchaCodeApi:"",typeKey:"type",codeKey:"code",platTypeKey:"platType"};let Ct=null;function vt(){return{async init(e={}){try{if(Ct=function(e,t){if(!t)return{...e};const n={...e};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(At,e),function(e){if("string"!=typeof e.accessCodeKey||""===e.accessCodeKey.trim())throw new Error("accessCodeKey必须是有效的字符串");if("string"!=typeof e.tokenKey||""===e.tokenKey.trim())throw new Error("tokenKey必须是有效的字符串");if(e.storage&&("function"!=typeof e.storage.setItem||"function"!=typeof e.storage.getItem))throw new Error("storage必须实现setItem和getItem方法")}(Ct),t()){const e=n(Ct.platTypeKey);e&&Tt(Ct.platTypeKey,e)}const o=n(Ct.accessCodeKey);if(!Ct.tokenApi)return{code:-100,msg:"缺少tokenApi配置",success:!1};if(o){const e=await Ot(Ct.tokenApi,{method:"POST",data:{accessCode:o},headers:Ct.headers,timeout:Ct.timeout});return 0===e.code&&e.data&&(Ct.storage.setItem(Ct.tokenKey,e.data),function(e){if(!t())return;const n=Array.isArray(e)?e:[e];if(0===n.length)return;const r=new URL(window.location.href);let o;if(r.hash.includes("?")){const[e,t]=r.hash.split("?"),s=new URLSearchParams(t);n.forEach(e=>{s.has(e)&&s.delete(e)});const i=s.toString()?`${e}?${s.toString()}`:e;i!==r.hash&&(r.hash=i,o=r.toString())}else{const e=new URLSearchParams(r.search);let t=!1;n.forEach(n=>{e.has(n)&&(e.delete(n),t=!0)}),t&&(r.search=e.toString(),o=r.toString())}o&&o!==window.location.href&&window.location.replace(o)}([Ct.accessCodeKey,Ct.platTypeKey])),e}if(!this.getToken()&&t()&&Ct.logOutUrl){const e=Rt(Ct.platTypeKey);let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return{code:0,msg:"初始化成功",success:!0}}catch(e){return{code:-100,msg:`初始化失败: ${e.message}`,success:!1}}},getToken:()=>Ct&&t()?Ct.storage.getItem(Ct.tokenKey):null,removeToken(){Ct&&t()&&Ct.storage.removeItem(Ct.tokenKey)},async logout(){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!Ct.logoutApi)return{code:-102,msg:"未配置logoutApi",success:!1};const e=Rt(Ct.platTypeKey);var n;n=Ct.platTypeKey,t()&&Tt(n,"",{expires:-1});const o=this.getToken();if(!o){if(this.removeToken(),t()&&Ct.logOutUrl){let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return{code:0,msg:"已成功清除token",success:!0}}try{const n=await Ot(Ct.logoutApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:o},timeout:Ct.timeout});if(this.removeToken(),t()&&Ct.logOutUrl){let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return n}catch(e){return{code:-103,msg:`退出失败: ${e.message}`,success:!1}}},async toUrl(e,n="_self"){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!e)return{code:-104,msg:"请提供跳转地址",success:!1};(function(){if(!t())return!1;const e=navigator.userAgent.toLowerCase(),n=navigator.platform.toLowerCase(),r=navigator.maxTouchPoints||0,o=screen.width/screen.height,s=/iphone|ipod/.test(e)&&!window.MSStream,i=n.includes("ipad")||e.includes("macintosh")&&r>0&&!n.includes("mac")&&!window.MSStream||e.includes("ipados")||r>=5&&!n.includes("android")&&o>.7&&o<1.4;return s||i})()&&(n="_self");const r=Rt(Ct.platTypeKey);if("screen"===r&&(n="_self"),!["_self","_blank"].includes(n))return{code:-108,msg:'target参数必须是"_self"或"_blank"',success:!1};if(!Ct.refreshCodeApi)return{code:-105,msg:"未配置refreshCodeApi",success:!1};const o=this.getToken();if(!o){if(t()&&Ct.logOutUrl){let t=e;r&&(t=St(t,r,Ct.platTypeKey));let o=new URL(Ct.logOutUrl);o.searchParams.set("redirect_uri",encodeURIComponent(t));const s=o.toString();"_blank"===n?window.open(s,"_blank"):window.location.href=s}return{code:-106,msg:"未找到有效token",success:!1}}try{const s=await Ot(Ct.refreshCodeApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:o},timeout:Ct.timeout});if(0===s.code&&s.data&&t()){const t=new URL(e);t.searchParams.set(Ct.accessCodeKey,s.data);const r=t.toString();"_blank"===n?window.open(r,"_blank"):window.location.href=r}else{let t=e;r&&(t=St(t,r,Ct.platTypeKey));let o=new URL(Ct.logOutUrl);o.searchParams.set("redirect_uri",encodeURIComponent(t));const s=o.toString();"_blank"===n?window.open(s,"_blank"):window.location.href=s}return s}catch(t){let o=e;r&&(o=St(o,r,Ct.platTypeKey));let s=new URL(Ct.logOutUrl);s.searchParams.set("redirect_uri",encodeURIComponent(o));const i=s.toString();return"_blank"===n?window.open(i,"_blank"):window.location.href=i,{code:-107,msg:`跳转失败: ${t.message}`,success:!1}}},async getAccessCode(){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};const e=this.getToken();return e?Ct.refreshCodeApi?Ot(Ct.refreshCodeApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:e},timeout:Ct.timeout}):{code:-105,msg:"未配置refreshCodeApi",success:!1}:{code:-106,msg:"未找到有效token",success:!1}},getConfig:()=>({...Ct}),async changePassword(e={}){if(!e[Ct.oldPwdKey]&&"CAPTCHA"!==e[Ct.typeKey])return{code:-1,msg:"请输入旧密码",success:!1};if(!e[Ct.newPwdKey])return{code:-1,msg:"请输入新密码",success:!1};if("CAPTCHA"===e[Ct.typeKey]&&!e[Ct.codeKey])return{code:-1,msg:"请输入验证码",success:!1};const t=this.getToken();return Ot(Ct.changePasswordApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:t},timeout:Ct.timeout,data:{[Ct.oldPwdKey]:e[Ct.oldPwdKey],[Ct.newPwdKey]:e[Ct.newPwdKey],...e}})},async getPhoneCode(){const e=this.getToken();return Ot(Ct.sendCaptchaCodeApi,{method:"GET",headers:{...Ct.headers,[Ct.tokenKey]:e},timeout:Ct.timeout})}}}const Pt=vt();e.createSSO=vt,e.default=Pt,e.lgsso=Pt,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lgsso={})}(this,function(e){"use strict";function t(){return"undefined"!=typeof window&&"undefined"!=typeof document}function n(e,n){if(!t())return null;const r=n||window.location.href,o=new URL(r);let s=o.searchParams.get(e);if(null!==s)return s;if(o.hash.includes("?")){const t=o.hash.split("?")[1];return new URLSearchParams(t).get(e)}return null}function r(){return t()?window.location.href:""}function o(e,t){return function(){return e.apply(t,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:a,toStringTag:c}=Symbol,u=(l=Object.create(null),e=>{const t=s.call(e);return l[t]||(l[t]=t.slice(8,-1).toLowerCase())});var l;const d=e=>(e=e.toLowerCase(),t=>u(t)===e),f=e=>t=>typeof t===e,{isArray:p}=Array,h=f("undefined");function m(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&w(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const y=d("ArrayBuffer");const g=f("string"),w=f("function"),b=f("number"),E=e=>null!==e&&"object"==typeof e,O=e=>{if("object"!==u(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||c in e||a in e)},R=d("Date"),T=d("File"),S=d("Blob"),A=d("FileList"),C=d("URLSearchParams"),[v,P,U,k]=["ReadableStream","Request","Response","Headers"].map(d);function x(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),p(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(m(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function _(e,t){if(m(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=e=>!h(e)&&e!==j;const L=(F="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>F&&e instanceof F);var F;const B=d("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),K=d("RegExp"),q=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};x(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const I=d("AsyncFunction"),M=($="function"==typeof setImmediate,z=w(j.postMessage),$?setImmediate:z?(H=`axios@${Math.random()}`,J=[],j.addEventListener("message",({source:e,data:t})=>{e===j&&t===H&&J.length&&J.shift()()},!1),e=>{J.push(e),j.postMessage(H,"*")}):e=>setTimeout(e));var $,z,H,J;const W="undefined"!=typeof queueMicrotask?queueMicrotask.bind(j):"undefined"!=typeof process&&process.nextTick||M;var V={isArray:p,isArrayBuffer:y,isBuffer:m,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||w(e.append)&&("formdata"===(t=u(e))||"object"===t&&w(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&y(e.buffer),t},isString:g,isNumber:b,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:O,isEmptyObject:e=>{if(!E(e)||m(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:v,isRequest:P,isResponse:U,isHeaders:k,isUndefined:h,isDate:R,isFile:T,isBlob:S,isRegExp:K,isFunction:w,isStream:e=>E(e)&&w(e.pipe),isURLSearchParams:C,isTypedArray:L,isFileList:A,forEach:x,merge:function e(){const{caseless:t}=N(this)&&this||{},n={},r=(r,o)=>{const s=t&&_(n,o)||o;O(n[s])&&O(r)?n[s]=e(n[s],r):O(r)?n[s]=e({},r):p(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&x(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(x(t,(t,r)=>{n&&w(t)?e[r]=o(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:u,kindOfTest:d,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(p(e))return e;let t=e.length;if(!b(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:B,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:q,freezeMethods:e=>{q(e,(t,n)=>{if(w(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];w(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return p(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:_,global:j,isContextDefined:N,isSpecCompliantForm:function(e){return!!(e&&w(e.append)&&"FormData"===e[c]&&e[a])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(E(e)){if(t.indexOf(e)>=0)return;if(m(e))return e;if(!("toJSON"in e)){t[r]=e;const o=p(e)?[]:{};return x(e,(e,t)=>{const s=n(e,r+1);!h(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:I,isThenable:e=>e&&(E(e)||w(e))&&w(e.then)&&w(e.catch),setImmediate:M,asap:W,isIterable:e=>null!=e&&w(e[a])};function G(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}V.inherits(G,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}});const X=G.prototype,Q={};["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"].forEach(e=>{Q[e]={value:e}}),Object.defineProperties(G,Q),Object.defineProperty(X,"isAxiosError",{value:!0}),G.from=(e,t,n,r,o,s)=>{const i=Object.create(X);return V.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),G.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function Z(e){return V.isPlainObject(e)||V.isArray(e)}function Y(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function ee(e,t,n){return e?e.concat(t).map(function(e,t){return e=Y(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const te=V.toFlatObject(V,{},null,function(e){return/^is[A-Z]/.test(e)});function ne(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!V.isUndefined(t[e])})).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(V.isDate(e))return e.toISOString();if(V.isBoolean(e))return e.toString();if(!a&&V.isBlob(e))throw new G("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(e)||V.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(V.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(V.isArray(e)&&function(e){return V.isArray(e)&&!e.some(Z)}(e)||(V.isFileList(e)||V.endsWith(n,"[]"))&&(a=V.toArray(e)))return n=Y(n),a.forEach(function(e,r){!V.isUndefined(e)&&null!==e&&t.append(!0===i?ee([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!Z(e)||(t.append(ee(o,n,s),c(e)),!1)}const l=[],d=Object.assign(te,{defaultVisitor:u,convertValue:c,isVisitable:Z});if(!V.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!V.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),V.forEach(n,function(n,s){!0===(!(V.isUndefined(n)||null===n)&&o.call(t,n,V.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function oe(e,t){this._pairs=[],e&&ne(e,this,t)}const se=oe.prototype;function ie(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ae(e,t,n){if(!t)return e;const r=n&&n.encode||ie;V.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):V.isURLSearchParams(t)?t.toString():new oe(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}se.append=function(e,t){this._pairs.push([e,t])},se.toString=function(e){const t=e?function(t){return e.call(this,t,re)}:re;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ce=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){V.forEach(this.handlers,function(t){null!==t&&e(t)})}},ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},le={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:oe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const de="undefined"!=typeof window&&"undefined"!=typeof document,fe="object"==typeof navigator&&navigator||void 0,pe=de&&(!fe||["ReactNative","NativeScript","NS"].indexOf(fe.product)<0),he="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,me=de&&window.location.href||"http://localhost";var ye={...Object.freeze({__proto__:null,hasBrowserEnv:de,hasStandardBrowserEnv:pe,hasStandardBrowserWebWorkerEnv:he,navigator:fe,origin:me}),...le};function ge(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&V.isArray(r)?r.length:s,a)return V.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&V.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&V.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(e,r)=>{t(function(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const we={transitional:ue,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=V.isObject(e);o&&V.isHTMLForm(e)&&(e=new FormData(e));if(V.isFormData(e))return r?JSON.stringify(ge(e)):e;if(V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)||V.isReadableStream(e))return e;if(V.isArrayBufferView(e))return e.buffer;if(V.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ne(e,new ye.classes.URLSearchParams,{visitor:function(e,t,n,r){return ye.isNode&&V.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=V.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ne(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||we.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(V.isResponse(e)||V.isReadableStream(e))return e;if(e&&V.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw G.from(e,G.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ye.classes.FormData,Blob:ye.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{we.headers[e]={}});var be=we;const Ee=V.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"]);const Oe=Symbol("internals");function Re(e){return e&&String(e).trim().toLowerCase()}function Te(e){return!1===e||null==e?e:V.isArray(e)?e.map(Te):String(e)}function Se(e,t,n,r,o){return V.isFunction(r)?r.call(this,t,n):(o&&(t=n),V.isString(t)?V.isString(r)?-1!==t.indexOf(r):V.isRegExp(r)?r.test(t):void 0:void 0)}class Ae{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Re(t);if(!o)throw new Error("header name must be a non-empty string");const s=V.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Te(e))}const s=(e,t)=>V.forEach(e,(e,n)=>o(e,n,t));if(V.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(V.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ee[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(V.isObject(e)&&V.isIterable(e)){let n,r,o={};for(const t of e){if(!V.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?V.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Re(e)){const n=V.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(V.isFunction(t))return t.call(this,e,n);if(V.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Re(e)){const n=V.findKey(this,e);return!(!n||void 0===this[n]||t&&!Se(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Re(e)){const o=V.findKey(n,e);!o||t&&!Se(0,n[o],o,t)||(delete n[o],r=!0)}}return V.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Se(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return V.forEach(this,(r,o)=>{const s=V.findKey(n,o);if(s)return t[s]=Te(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=Te(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return V.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&V.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Oe]=this[Oe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Re(e);t[r]||(!function(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return V.isArray(e)?e.forEach(r):r(e),this}}Ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),V.reduceDescriptors(Ae.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),V.freezeMethods(Ae);var Ce=Ae;function ve(e,t){const n=this||be,r=t||n,o=Ce.from(r.headers);let s=r.data;return V.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Pe(e){return!(!e||!e.__CANCEL__)}function Ue(e,t,n){G.call(this,null==e?"canceled":e,G.ERR_CANCELED,t,n),this.name="CanceledError"}function ke(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new G("Request failed with status code "+n.status,[G.ERR_BAD_REQUEST,G.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}V.inherits(Ue,G,{__CANCEL__:!0});const xe=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},je=e=>(...t)=>V.asap(()=>e(...t));var Ne=ye.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ye.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ye.origin),ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent)):()=>!0,Le=ye.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),V.isString(r)&&i.push("path="+r),V.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Fe(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Be=e=>e instanceof Ce?{...e}:e;function De(e,t){t=t||{};const n={};function r(e,t,n,r){return V.isPlainObject(e)&&V.isPlainObject(t)?V.merge.call({caseless:r},e,t):V.isPlainObject(t)?V.merge({},t):V.isArray(t)?t.slice():t}function o(e,t,n,o){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!V.isUndefined(t))return r(void 0,t)}function i(e,t){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Be(e),Be(t),0,!0)};return V.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||o,i=s(e[r],t[r],r);V.isUndefined(i)&&s!==a||(n[r]=i)}),n}var Ke=e=>{const t=De({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Ce.from(a),t.url=ae(Fe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),V.isFormData(r))if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(ye.hasStandardBrowserEnv&&(o&&V.isFunction(o)&&(o=o(t)),o||!1!==o&&Ne(t.url))){const e=s&&i&&Le.read(i);e&&a.set(s,e)}return t};var qe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ke(e);let o=r.data;const s=Ce.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Ce.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ke(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new G("Request aborted",G.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new G("Network Error",G.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ue;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new G(t,o.clarifyTimeoutError?G.ETIMEDOUT:G.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&V.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),V.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=xe(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=xe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Ue(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===ye.protocols.indexOf(g)?n(new G("Unsupported protocol "+g+":",G.ERR_BAD_REQUEST,e)):m.send(o||null)})};var Ie=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof G?t:new Ue(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new G(`timeout ${t} of ms exceeded`,G.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>V.asap(i),a}};const Me=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},$e=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},ze=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of $e(e))yield*Me(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},He="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Je=He&&"function"==typeof ReadableStream,We=He&&("function"==typeof TextEncoder?(Ve=new TextEncoder,e=>Ve.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ve;const Ge=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Xe=Je&&Ge(()=>{let e=!1;const t=new Request(ye.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Qe=Je&&Ge(()=>V.isReadableStream(new Response("").body)),Ze={stream:Qe&&(e=>e.body)};var Ye;He&&(Ye=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ze[e]&&(Ze[e]=V.isFunction(Ye[e])?t=>t[e]():(t,n)=>{throw new G(`Response type '${e}' is not supported`,G.ERR_NOT_SUPPORT,n)})}));const et=async(e,t)=>{const n=V.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e)){const t=new Request(ye.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return V.isArrayBufferView(e)||V.isArrayBuffer(e)?e.byteLength:(V.isURLSearchParams(e)&&(e+=""),V.isString(e)?(await We(e)).byteLength:void 0)})(t):n};var tt=He&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Ke(e);u=u?(u+"").toLowerCase():"text";let p,h=Ie([o,s&&s.toAbortSignal()],i);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let y;try{if(c&&Xe&&"get"!==n&&"head"!==n&&0!==(y=await et(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(V.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=_e(y,xe(je(c)));r=ze(n.body,65536,e,t)}}V.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;p=new Request(t,{...f,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(p,f);const i=Qe&&("stream"===u||"response"===u);if(Qe&&(a||i&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=V.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&_e(t,xe(je(a),!0))||[];s=new Response(ze(s.body,65536,n,()=>{r&&r(),m&&m()}),e)}u=u||"text";let g=await Ze[V.findKey(Ze,u)||"text"](s,e);return!i&&m&&m(),await new Promise((t,n)=>{ke(t,n,{data:g,headers:Ce.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new G("Network Error",G.ERR_NETWORK,e,p),{cause:t.cause||t});throw G.from(t,t&&t.code,e,p)}});const nt={http:null,xhr:qe,fetch:tt};V.forEach(nt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const rt=e=>`- ${e}`,ot=e=>V.isFunction(e)||null===e||!1===e;var st=e=>{e=V.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!ot(n)&&(r=nt[(t=String(n)).toLowerCase()],void 0===r))throw new G(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new G("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(rt).join("\n"):" "+rt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function it(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ue(null,e)}function at(e){it(e),e.headers=Ce.from(e.headers),e.data=ve.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return st(e.adapter||be.adapter)(e).then(function(t){return it(e),t.data=ve.call(e,e.transformResponse,t),t.headers=Ce.from(t.headers),t},function(t){return Pe(t)||(it(e),t&&t.response&&(t.response.data=ve.call(e,e.transformResponse,t.response),t.response.headers=Ce.from(t.response.headers))),Promise.reject(t)})}const ct="1.11.0",ut={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ut[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const lt={};ut.transitional=function(e,t,n){function r(e,t){return"[Axios v"+ct+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new G(r(o," has been removed"+(t?" in "+t:"")),G.ERR_DEPRECATED);return t&&!lt[o]&&(lt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},ut.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var dt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new G("options must be an object",G.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new G("option "+s+" must be "+n,G.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new G("Unknown option "+s,G.ERR_BAD_OPTION)}},validators:ut};const ft=dt.validators;class pt{constructor(e){this.defaults=e||{},this.interceptors={request:new ce,response:new ce}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=De(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&dt.assertOptions(n,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},!1),null!=r&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:dt.assertOptions(r,{encode:ft.function,serialize:ft.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),dt.assertOptions(t,{baseUrl:ft.spelling("baseURL"),withXsrfToken:ft.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&V.merge(o.common,o[t.method]);o&&V.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ce.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[at.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=at.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return ae(Fe((e=De(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}V.forEach(["delete","get","head","options"],function(e){pt.prototype[e]=function(t,n){return this.request(De(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(De(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}pt.prototype[e]=t(),pt.prototype[e+"Form"]=t(!0)});var ht=pt;class mt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Ue(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new mt(function(t){e=t}),cancel:e}}}var yt=mt;const gt={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(gt).forEach(([e,t])=>{gt[t]=e});var wt=gt;const bt=function e(t){const n=new ht(t),r=o(ht.prototype.request,n);return V.extend(r,ht.prototype,n,{allOwnKeys:!0}),V.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(De(t,n))},r}(be);bt.Axios=ht,bt.CanceledError=Ue,bt.CancelToken=yt,bt.isCancel=Pe,bt.VERSION=ct,bt.toFormData=ne,bt.AxiosError=G,bt.Cancel=bt.CanceledError,bt.all=function(e){return Promise.all(e)},bt.spread=function(e){return function(t){return e.apply(null,t)}},bt.isAxiosError=function(e){return V.isObject(e)&&!0===e.isAxiosError},bt.mergeConfig=De,bt.AxiosHeaders=Ce,bt.formToJSON=e=>ge(V.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=st,bt.HttpStatusCode=wt,bt.default=bt;var Et=bt;async function Ot(e,{method:n="GET",data:r={},headers:o={},timeout:s=5e3}={}){return t()?"fetch"in window&&"AbortController"in window?async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i=new AbortController,a=setTimeout(()=>i.abort(),s),c={method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},signal:i.signal};"GET"!==c.method&&r&&(c.body=JSON.stringify(r));try{const t=await fetch(e,c);if(clearTimeout(a),!t.ok)return{code:t.status,msg:`HTTP请求失败: ${t.statusText}`,success:!1};try{return await t.json()}catch(e){return{code:-201,msg:"响应数据不是有效的JSON格式",success:!1}}}catch(e){return clearTimeout(a),"AbortError"===e.name?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:n,data:r,headers:o,timeout:s}):async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i={url:e,method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},timeout:s,["GET"===n.toUpperCase()?"params":"data"]:r};try{return(await Et(i)).data}catch(e){return"ECONNABORTED"===e.code?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:e.response?{code:e.response.status,msg:`HTTP请求失败: ${e.response.statusText}`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:n,data:r,headers:o,timeout:s}):{code:-200,msg:"request方法只能在浏览器环境使用",success:!1}}function Rt(e){if(!t())return null;const n=document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));return n?decodeURIComponent(n[2]):null}function Tt(e,n,r={}){if(!t())return;let o=`${e}=${encodeURIComponent(n)}`;o+=`; path=${r.path||"/"}`;if(o+=`; domain=${r.domain||".zlgx.com"}`,r.expires){o+=`; expires=${("number"==typeof r.expires?new Date(Date.now()+864e5*r.expires):r.expires).toUTCString()}`}(r.secure||"https:"===window.location.protocol)&&(o+="; Secure"),r.httpOnly&&(o+="; HttpOnly"),document.cookie=o}function St(e,t,n="platType"){if(!e||!t)return e;try{const r=new URL(e);return r.searchParams.set(n,t),r.toString()}catch(r){const o=e.includes("?")?"&":"?";return`${e}${o}${n}=${t}`}}const At={accessCodeKey:"accessCode",tokenKey:"scm_token",timeout:5e3,headers:{},tokenApi:"",refreshCodeApi:"",logoutApi:"",logOutUrl:"",storage:localStorage,oldPwdKey:"oldPwd",newPwdKey:"newPwd",changePasswordApi:"",sendCaptchaCodeApi:"",typeKey:"type",codeKey:"code",platTypeKey:"platType"};let Ct=null;function vt(){return{async init(e={}){try{if(Ct=function(e,t){if(!t)return{...e};const n={...e};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(At,e),function(e){if("string"!=typeof e.accessCodeKey||""===e.accessCodeKey.trim())throw new Error("accessCodeKey必须是有效的字符串");if("string"!=typeof e.tokenKey||""===e.tokenKey.trim())throw new Error("tokenKey必须是有效的字符串");if(e.storage&&("function"!=typeof e.storage.setItem||"function"!=typeof e.storage.getItem))throw new Error("storage必须实现setItem和getItem方法")}(Ct),t()){const e=n(Ct.platTypeKey);e&&Tt(Ct.platTypeKey,e)}const o=n(Ct.accessCodeKey);if(!Ct.tokenApi)return{code:-100,msg:"缺少tokenApi配置",success:!1};if(o){const e=await Ot(Ct.tokenApi,{method:"POST",data:{accessCode:o},headers:Ct.headers,timeout:Ct.timeout});return 0===e.code&&e.data&&(Ct.storage.setItem(Ct.tokenKey,e.data),function(e){if(!t())return;const n=Array.isArray(e)?e:[e];if(0===n.length)return;const r=new URL(window.location.href);let o;if(r.hash.includes("?")){const[e,t]=r.hash.split("?"),s=new URLSearchParams(t);n.forEach(e=>{s.has(e)&&s.delete(e)});const i=s.toString()?`${e}?${s.toString()}`:e;i!==r.hash&&(r.hash=i,o=r.toString())}else{const e=new URLSearchParams(r.search);let t=!1;n.forEach(n=>{e.has(n)&&(e.delete(n),t=!0)}),t&&(r.search=e.toString(),o=r.toString())}o&&o!==window.location.href&&window.location.replace(o)}([Ct.accessCodeKey,Ct.platTypeKey])),e}if(!this.getToken()&&t()&&Ct.logOutUrl){const e=Rt(Ct.platTypeKey);let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return{code:0,msg:"初始化成功",success:!0}}catch(e){return{code:-100,msg:`初始化失败: ${e.message}`,success:!1}}},getToken:()=>Ct&&t()?Ct.storage.getItem(Ct.tokenKey):null,removeToken(){Ct&&t()&&Ct.storage.removeItem(Ct.tokenKey)},async logout(){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!Ct.logoutApi)return{code:-102,msg:"未配置logoutApi",success:!1};const e=Rt(Ct.platTypeKey);!function(e,n={}){t()&&Tt(e,"",{expires:-1,path:n.path||"/",domain:n.domain||".zlgx.com"})}(Ct.platTypeKey);const n=this.getToken();if(!n){if(this.removeToken(),t()&&Ct.logOutUrl){let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return{code:0,msg:"已成功清除token",success:!0}}try{const o=await Ot(Ct.logoutApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:n},timeout:Ct.timeout});if(this.removeToken(),t()&&Ct.logOutUrl){let t=r();e&&(t=St(t,e,Ct.platTypeKey));let n=new URL(Ct.logOutUrl);n.searchParams.set("redirect_uri",encodeURIComponent(t)),window.location.href=n.toString()}return o}catch(e){return{code:-103,msg:`退出失败: ${e.message}`,success:!1}}},async toUrl(e,n="_self"){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!e)return{code:-104,msg:"请提供跳转地址",success:!1};(function(){if(!t())return!1;const e=navigator.userAgent.toLowerCase(),n=navigator.platform.toLowerCase(),r=navigator.maxTouchPoints||0,o=screen.width/screen.height,s=/iphone|ipod/.test(e)&&!window.MSStream,i=n.includes("ipad")||e.includes("macintosh")&&r>0&&!n.includes("mac")&&!window.MSStream||e.includes("ipados")||r>=5&&!n.includes("android")&&o>.7&&o<1.4;return s||i})()&&(n="_self");const r=Rt(Ct.platTypeKey);if("screen"===r&&(n="_self"),!["_self","_blank"].includes(n))return{code:-108,msg:'target参数必须是"_self"或"_blank"',success:!1};if(!Ct.refreshCodeApi)return{code:-105,msg:"未配置refreshCodeApi",success:!1};const o=this.getToken();if(!o){if(t()&&Ct.logOutUrl){let t=e;r&&(t=St(t,r,Ct.platTypeKey));let o=new URL(Ct.logOutUrl);o.searchParams.set("redirect_uri",encodeURIComponent(t));const s=o.toString();"_blank"===n?window.open(s,"_blank"):window.location.href=s}return{code:-106,msg:"未找到有效token",success:!1}}try{const s=await Ot(Ct.refreshCodeApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:o},timeout:Ct.timeout});if(0===s.code&&s.data&&t()){const t=new URL(e);t.searchParams.set(Ct.accessCodeKey,s.data);const r=t.toString();"_blank"===n?window.open(r,"_blank"):window.location.href=r}else{let t=e;r&&(t=St(t,r,Ct.platTypeKey));let o=new URL(Ct.logOutUrl);o.searchParams.set("redirect_uri",encodeURIComponent(t));const s=o.toString();"_blank"===n?window.open(s,"_blank"):window.location.href=s}return s}catch(t){let o=e;r&&(o=St(o,r,Ct.platTypeKey));let s=new URL(Ct.logOutUrl);s.searchParams.set("redirect_uri",encodeURIComponent(o));const i=s.toString();return"_blank"===n?window.open(i,"_blank"):window.location.href=i,{code:-107,msg:`跳转失败: ${t.message}`,success:!1}}},async getAccessCode(){if(!Ct)return{code:-101,msg:"请先调用init方法初始化",success:!1};const e=this.getToken();return e?Ct.refreshCodeApi?Ot(Ct.refreshCodeApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:e},timeout:Ct.timeout}):{code:-105,msg:"未配置refreshCodeApi",success:!1}:{code:-106,msg:"未找到有效token",success:!1}},getConfig:()=>({...Ct}),async changePassword(e={}){if(!e[Ct.oldPwdKey]&&"CAPTCHA"!==e[Ct.typeKey])return{code:-1,msg:"请输入旧密码",success:!1};if(!e[Ct.newPwdKey])return{code:-1,msg:"请输入新密码",success:!1};if("CAPTCHA"===e[Ct.typeKey]&&!e[Ct.codeKey])return{code:-1,msg:"请输入验证码",success:!1};const t=this.getToken();return Ot(Ct.changePasswordApi,{method:"POST",headers:{...Ct.headers,[Ct.tokenKey]:t},timeout:Ct.timeout,data:{[Ct.oldPwdKey]:e[Ct.oldPwdKey],[Ct.newPwdKey]:e[Ct.newPwdKey],...e}})},async getPhoneCode(){const e=this.getToken();return Ot(Ct.sendCaptchaCodeApi,{method:"GET",headers:{...Ct.headers,[Ct.tokenKey]:e},timeout:Ct.timeout})}}}const Pt=vt();e.createSSO=vt,e.default=Pt,e.lgsso=Pt,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=lgsso-sdk.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lgsso-sdk",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "无框架依赖的单点登录SDK",
6
6
  "main": "dist/lgsso-sdk.cjs",
package/src/sso.js CHANGED
@@ -14,31 +14,55 @@ function getCookie(name) {
14
14
  }
15
15
 
16
16
  /**
17
- * 设置Cookie
17
+ * 设置Cookie(支持指定根域名)
18
18
  * @param {string} name Cookie名称
19
19
  * @param {string} value Cookie值
20
- * @param {Object} options 配置(过期时间、路径等)
20
+ * @param {Object} options 配置(expires: 过期天数/Date, path: 路径, domain: 域名)
21
21
  */
22
22
  function setCookie(name, value, options = {}) {
23
23
  if (!isBrowser()) return;
24
24
  let cookieStr = `${name}=${encodeURIComponent(value)}`;
25
- cookieStr += `; path=${options.path || '/'}`; // 默认根路径
25
+
26
+ // 路径:默认根路径,确保全站可用
27
+ cookieStr += `; path=${options.path || '/'}`;
28
+
29
+ // 域名:指定根域名.zlgx.com(适配你的场景)
30
+ // 优先级:用户传入的domain > 默认根域名.zlgx.com
31
+ const targetDomain = options.domain || '.zlgx.com';
32
+ cookieStr += `; domain=${targetDomain}`;
33
+
34
+ // 过期时间(默认1天)
26
35
  if (options.expires) {
27
36
  const expires = typeof options.expires === 'number'
28
37
  ? new Date(Date.now() + options.expires * 86400000)
29
38
  : options.expires;
30
39
  cookieStr += `; expires=${expires.toUTCString()}`;
31
40
  }
41
+
42
+ // 可选:HTTPS环境下添加Secure(仅HTTPS传输)
43
+ if (options.secure || window.location.protocol === 'https:') {
44
+ cookieStr += '; Secure';
45
+ }
46
+
47
+ // 可选:防止XSS攻击的HttpOnly(注意:HttpOnly的Cookie无法通过JS读取)
48
+ if (options.httpOnly) {
49
+ cookieStr += '; HttpOnly';
50
+ }
51
+
32
52
  document.cookie = cookieStr;
33
53
  }
34
54
 
35
- /**
36
- * 删除指定名称的Cookie
37
- * @param {string} name Cookie名称
38
- */
39
- function removeCookie(name) {
55
+ function removeCookie(name, options = {}) {
40
56
  if (!isBrowser()) return;
41
- setCookie(name, '', { expires: -1 });
57
+ setCookie(
58
+ name,
59
+ '',
60
+ {
61
+ expires: -1, // 立即过期
62
+ path: options.path || '/',
63
+ domain: options.domain || '.zlgx.com' // 必须和设置时一致
64
+ }
65
+ );
42
66
  }
43
67
 
44
68
  /**