bw-frontend-sdk 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:i}=Symbol,s=(o=Object.create(null),e=>{const n=t.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())});var o;const a=e=>(e=e.toLowerCase(),t=>s(t)===e),c=e=>t=>typeof t===e,{isArray:u}=Array,l=c("undefined");function h(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const d=a("ArrayBuffer");const p=c("string"),f=c("function"),g=c("number"),m=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==s(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||i in e||r in e)},y=a("Date"),b=a("File"),v=a("Blob"),T=a("FileList"),k=a("URLSearchParams"),[E,S,R,P]=["ReadableStream","Request","Response","Headers"].map(a);function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),u(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(h(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(r=0;r<s;r++)o=i[r],t.call(null,e[o],o,e)}}function A(e,t){if(h(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,D=e=>!l(e)&&e!==C;const I=(_="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>_&&e instanceof _);var _;const L=a("HTMLFormElement"),U=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),N=a("RegExp"),x=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};O(n,(n,i)=>{let s;!1!==(s=t(n,i,e))&&(r[i]=s||n)}),Object.defineProperties(e,r)};const j=a("AsyncFunction"),B=(F="function"==typeof setImmediate,K=f(C.postMessage),F?setImmediate:K?(M=`axios@${Math.random()}`,z=[],C.addEventListener("message",({source:e,data:t})=>{e===C&&t===M&&z.length&&z.shift()()},!1),e=>{z.push(e),C.postMessage(M,"*")}):e=>setTimeout(e));var F,K,M,z;const V="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):"undefined"!=typeof process&&process.nextTick||B;var q={isArray:u,isArrayBuffer:d,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=s(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:w,isEmptyObject:e=>{if(!m(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:E,isRequest:S,isResponse:R,isHeaders:P,isUndefined:l,isDate:y,isFile:b,isBlob:v,isRegExp:N,isFunction:f,isStream:e=>m(e)&&f(e.pipe),isURLSearchParams:k,isTypedArray:I,isFileList:T,forEach:O,merge:function e(){const{caseless:t}=D(this)&&this||{},n={},r=(r,i)=>{const s=t&&A(n,i)||i;w(n[s])&&w(r)?n[s]=e(n[s],r):w(r)?n[s]=e({},r):u(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],r);return n},extend:(t,n,r,{allOwnKeys:i}={})=>(O(n,(n,i)=>{r&&f(n)?t[i]=e(n,r):t[i]=n},{allOwnKeys:i}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,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,r,i)=>{let s,o,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)a=s[o],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,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(u(e))return e;let t=e.length;if(!g(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.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:L,hasOwnProperty:U,hasOwnProp:U,reduceDescriptors:x,freezeMethods:e=>{x(e,(t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];f(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 u(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:A,global:C,isContextDefined:D,isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[i]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[r]=e;const i=u(e)?[]:{};return O(e,(e,t)=>{const s=n(e,r+1);!l(s)&&(i[t]=s)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:j,isThenable:e=>e&&(m(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:B,asap:V,isIterable:e=>null!=e&&f(e[r])};function Q(e,t,n,r,i){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),i&&(this.response=i,this.status=i.status?i.status:null)}q.inherits(Q,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:q.toJSONObject(this.config),code:this.code,status:this.status}}});const H=Q.prototype,J={};["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=>{J[e]={value:e}}),Object.defineProperties(Q,J),Object.defineProperty(H,"isAxiosError",{value:!0}),Q.from=(e,t,n,r,i,s)=>{const o=Object.create(H);return q.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),Q.call(o,e.message,t,n,r,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function W(e){return q.isPlainObject(e)||q.isArray(e)}function $(e){return q.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=$(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const G=q.toFlatObject(q,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!q.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=q.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!q.isUndefined(t[e])})).metaTokens,i=n.visitor||u,s=n.dots,o=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&q.isSpecCompliantForm(t);if(!q.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(q.isDate(e))return e.toISOString();if(q.isBoolean(e))return e.toString();if(!a&&q.isBlob(e))throw new Q("Blob is not supported. Use a Buffer instead.");return q.isArrayBuffer(e)||q.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(q.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(q.isArray(e)&&function(e){return q.isArray(e)&&!e.some(W)}(e)||(q.isFileList(e)||q.endsWith(n,"[]"))&&(a=q.toArray(e)))return n=$(n),a.forEach(function(e,r){!q.isUndefined(e)&&null!==e&&t.append(!0===o?X([n],r,s):null===o?n:n+"[]",c(e))}),!1;return!!W(e)||(t.append(X(i,n,s),c(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!q.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!q.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),q.forEach(n,function(n,s){!0===(!(q.isUndefined(n)||null===n)&&i.call(t,n,q.isString(s)?s.trim():s,r,h))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Y(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;q.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(s=i?i(t,n):q.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ie=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){q.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,ue=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=ae&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ue,navigator:ce,origin:he}),...oe};function pe(e){function t(e,n,r,i){let s=e[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&q.isArray(r)?r.length:s,a)return q.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!o;r[s]&&q.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],i)&&q.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}(r[s])),!o}if(q.isFormData(e)&&q.isFunction(e.entries)){const n={};return q.forEachEntry(e,(e,r)=>{t(function(e){return q.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const fe={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=q.isObject(e);i&&q.isHTMLForm(e)&&(e=new FormData(e));if(q.isFormData(e))return r?JSON.stringify(pe(e)):e;if(q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)||q.isReadableStream(e))return e;if(q.isArrayBufferView(e))return e.buffer;if(q.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&q.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=q.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(q.isString(e))try{return(t||JSON.parse)(e),q.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(q.isResponse(e)||q.isReadableStream(e))return e;if(e&&q.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 Q.from(e,Q.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:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};q.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var ge=fe;const me=q.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 we=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:q.isArray(e)?e.map(be):String(e)}function ve(e,t,n,r,i){return q.isFunction(r)?r.call(this,t,n):(i&&(t=n),q.isString(t)?q.isString(r)?-1!==t.indexOf(r):q.isRegExp(r)?r.test(t):void 0:void 0)}class Te{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=ye(t);if(!i)throw new Error("header name must be a non-empty string");const s=q.findKey(r,i);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=be(e))}const s=(e,t)=>q.forEach(e,(e,n)=>i(e,n,t));if(q.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(q.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&me[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(q.isObject(e)&&q.isIterable(e)){let n,r,i={};for(const t of e){if(!q.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?q.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=ye(e)){const n=q.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(q.isFunction(t))return t.call(this,e,n);if(q.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=q.findKey(this,e);return!(!n||void 0===this[n]||t&&!ve(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=ye(e)){const i=q.findKey(n,e);!i||t&&!ve(0,n[i],i,t)||(delete n[i],r=!0)}}return q.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!ve(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return q.forEach(this,(r,i)=>{const s=q.findKey(n,i);if(s)return t[s]=be(r),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();o!==i&&delete t[i],t[o]=be(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return q.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&q.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[we]=this[we]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=q.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return q.isArray(e)?e.forEach(r):r(e),this}}Te.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),q.reduceDescriptors(Te.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),q.freezeMethods(Te);var ke=Te;function Ee(e,t){const n=this||ge,r=t||n,i=ke.from(r.headers);let s=r.data;return q.forEach(e,function(e){s=e.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Se(e){return!(!e||!e.__CANCEL__)}function Re(e,t,n){Q.call(this,null==e?"canceled":e,Q.ERR_CANCELED,t,n),this.name="CanceledError"}function Pe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Q("Request failed with status code "+n.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}q.inherits(Re,Q,{__CANCEL__:!0});const Oe=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[o];i||(i=c),n[s]=a,r[s]=c;let l=o,h=0;for(;l!==s;)h+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-i<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,i=0,s=1e3/t;const o=(t,s=Date.now())=>{i=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=s?o(e,t):(n=e,r||(r=setTimeout(()=>{r=null,o(n)},s-a)))},()=>n&&o(n)]}(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-r,c=i(a);r=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:n,lengthComputable:null!=o,[t?"download":"upload"]:!0})},n)},Ae=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ce=e=>(...t)=>q.asap(()=>e(...t));var De=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ie=de.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];q.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),q.isString(r)&&o.push("path="+r),q.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.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 _e(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 Le=e=>e instanceof ke?{...e}:e;function Ue(e,t){t=t||{};const n={};function r(e,t,n,r){return q.isPlainObject(e)&&q.isPlainObject(t)?q.merge.call({caseless:r},e,t):q.isPlainObject(t)?q.merge({},t):q.isArray(t)?t.slice():t}function i(e,t,n,i){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function s(e,t){if(!q.isUndefined(t))return r(void 0,t)}function o(e,t){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,s){return s in t?r(n,i):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,n)=>i(Le(e),Le(t),0,!0)};return q.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||i,o=s(e[r],t[r],r);q.isUndefined(o)&&s!==a||(n[r]=o)}),n}var Ne=e=>{const t=Ue({},e);let n,{data:r,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=ke.from(a),t.url=re(_e(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),q.isFormData(r))if(de.hasStandardBrowserEnv||de.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(de.hasStandardBrowserEnv&&(i&&q.isFunction(i)&&(i=i(t)),i||!1!==i&&De(t.url))){const e=s&&o&&Ie.read(o);e&&a.set(s,e)}return t};var xe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ne(e);let i=r.data;const s=ke.from(r.headers).normalize();let o,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(o),r.signal&&r.signal.removeEventListener("abort",o)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=ke.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Pe(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new Q("Request aborted",Q.ECONNABORTED,e,g)),g=null)},g.onerror=function(){n(new Q("Network Error",Q.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Q(t,i.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,e,g)),g=null},void 0===i&&s.setContentType(null),"setRequestHeader"in g&&q.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),q.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),h&&"json"!==h&&(g.responseType=r.responseType),p&&([c,l]=Oe(p,!0),g.addEventListener("progress",c)),d&&g.upload&&([a,u]=Oe(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(o=t=>{g&&(n(!t||t.type?new Re(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(o),r.signal&&(r.signal.aborted?o():r.signal.addEventListener("abort",o)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===de.protocols.indexOf(w)?n(new Q("Unsupported protocol "+w+":",Q.ERR_BAD_REQUEST,e)):g.send(i||null)})};var je=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,o();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Q?t:new Re(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,i(new Q(`timeout ${t} of ms exceeded`,Q.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>q.asap(o),a}};const Be=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},Fe=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()}},Ke=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of Fe(e))yield*Be(n,t)}(e,t);let s,o=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=o+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Me="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=Me&&"function"==typeof ReadableStream,Ve=Me&&("function"==typeof TextEncoder?(qe=new TextEncoder,e=>qe.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var qe;const Qe=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},He=ze&&Qe(()=>{let e=!1;const t=new Request(de.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Je=ze&&Qe(()=>q.isReadableStream(new Response("").body)),We={stream:Je&&(e=>e.body)};var $e;Me&&($e=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!We[e]&&(We[e]=q.isFunction($e[e])?t=>t[e]():(t,n)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,n)})}));const Xe=async(e,t)=>{const n=q.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(q.isBlob(e))return e.size;if(q.isSpecCompliantForm(e)){const t=new Request(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return q.isArrayBufferView(e)||q.isArrayBuffer(e)?e.byteLength:(q.isURLSearchParams(e)&&(e+=""),q.isString(e)?(await Ve(e)).byteLength:void 0)})(t):n};const Ge={http:null,xhr:xe,fetch:Me&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ne(e);u=u?(u+"").toLowerCase():"text";let p,f=je([i,s&&s.toAbortSignal()],o);const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(c&&He&&"get"!==n&&"head"!==n&&0!==(m=await Xe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(q.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ae(m,Oe(Ce(c)));r=Ke(n.body,65536,e,t)}}q.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...d,signal:f,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:i?h:void 0});let s=await fetch(p,d);const o=Je&&("stream"===u||"response"===u);if(Je&&(a||o&&g)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=q.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ae(t,Oe(Ce(a),!0))||[];s=new Response(Ke(s.body,65536,n,()=>{r&&r(),g&&g()}),e)}u=u||"text";let w=await We[q.findKey(We,u)||"text"](s,e);return!o&&g&&g(),await new Promise((t,n)=>{Pe(t,n,{data:w,headers:ke.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(t){if(g&&g(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Q("Network Error",Q.ERR_NETWORK,e,p),{cause:t.cause||t});throw Q.from(t,t&&t.code,e,p)}})};q.forEach(Ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ye=e=>`- ${e}`,Ze=e=>q.isFunction(e)||null===e||!1===e;var et=e=>{e=q.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!Ze(n)&&(r=Ge[(t=String(n)).toLowerCase()],void 0===r))throw new Q(`Unknown adapter '${t}'`);if(r)break;i[t||"#"+s]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Q("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ye).join("\n"):" "+Ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Re(null,e)}function nt(e){tt(e),e.headers=ke.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return et(e.adapter||ge.adapter)(e).then(function(t){return tt(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=ke.from(t.headers),t},function(t){return Se(t)||(tt(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=ke.from(t.response.headers))),Promise.reject(t)})}const rt="1.11.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const st={};it.transitional=function(e,t,n){function r(e,t){return"[Axios v"+rt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,s)=>{if(!1===e)throw new Q(r(i," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!st[i]&&(st[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,s)}},it.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ot={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new Q("option "+s+" must be "+n,Q.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Q("Unknown option "+s,Q.ERR_BAD_OPTION)}},validators:it};const at=ot.validators;class ct{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}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=Ue(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&ot.assertOptions(n,{silentJSONParsing:at.transitional(at.boolean),forcedJSONParsing:at.transitional(at.boolean),clarifyTimeoutError:at.transitional(at.boolean)},!1),null!=r&&(q.isFunction(r)?t.paramsSerializer={serialize:r}:ot.assertOptions(r,{encode:at.function,serialize:at.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ot.assertOptions(t,{baseUrl:at.spelling("baseURL"),withXsrfToken:at.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=i&&q.merge(i.common,i[t.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=ke.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[nt.bind(this),void 0];for(e.unshift(...o),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=o.length;let d=t;for(h=0;h<l;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=nt.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return re(_e((e=Ue(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(e){ct.prototype[e]=function(t,n){return this.request(Ue(n||{},{method:e,url:t,data:(n||{}).data}))}}),q.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(Ue(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ct.prototype[e]=t(),ct.prototype[e+"Form"]=t(!0)});var ut=ct;class lt{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,i){n.reason||(n.reason=new Re(e,r,i),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 lt(function(t){e=t}),cancel:e}}}var ht=lt;const dt={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(dt).forEach(([e,t])=>{dt[t]=e});var pt=dt;const ft=function t(n){const r=new ut(n),i=e(ut.prototype.request,r);return q.extend(i,ut.prototype,r,{allOwnKeys:!0}),q.extend(i,r,null,{allOwnKeys:!0}),i.create=function(e){return t(Ue(n,e))},i}(ge);ft.Axios=ut,ft.CanceledError=Re,ft.CancelToken=ht,ft.isCancel=Se,ft.VERSION=rt,ft.toFormData=Y,ft.AxiosError=Q,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return q.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ue,ft.AxiosHeaders=ke,ft.formToJSON=e=>pe(q.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=et,ft.HttpStatusCode=pt,ft.default=ft;const gt=ft.create({timeout:1e4,headers:{"Content-Type":"application/json"}});gt.interceptors.request.use(e=>(e._startTime=performance.now(),e),e=>Promise.reject(e)),gt.interceptors.response.use(e=>{if(e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return e},e=>{if(e.config&&e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return Promise.reject(e)});class mt{constructor(e){this.config=e,this.isReporting=!1}async report(e,t){if(!this.isReporting){this.isReporting=!0;try{const n=this.formatReportData(e,t);this.config.getConfig().customReport?await this.config.getConfig().customReport(e,n):await this.defaultReport(e,n)}catch(e){console.error("上报失败:",e)}finally{this.isReporting=!1}}}formatReportData(e,t){return{...{type:e,timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}},data:Array.isArray(t)?t:[t]}}async defaultReport(e,t){const n=this.config.getReportUrl(),r=this.config.getThirdPartyConfig();n&&await this.reportToBackend(n,t),r&&Object.keys(r).length>0&&await this.reportToThirdParty(r,t)}async reportToBackend(e,t){try{return(await gt.post(e,t)).data}catch(e){throw console.error("后端上报失败:",e),e}}async reportToThirdParty(e,t){const n=[];e.baidu&&window._hmt&&n.push(this.reportToBaidu(e.baidu,t)),e.umeng&&window._um&&n.push(this.reportToUmeng(e.umeng,t)),e.sensors&&window.sensors&&n.push(this.reportToSensors(e.sensors,t)),e.tencent&&window.MTA&&n.push(this.reportToTencent(e.tencent,t)),e.custom&&n.push(this.reportToCustom(e.custom,t));try{await Promise.allSettled(n)}catch(e){console.error("第三方上报失败:",e)}}async reportToBaidu(e,t){window._hmt&&window._hmt.push(["_trackEvent",t.type,JSON.stringify(t.data)])}async reportToUmeng(e,t){window._um&&window._um.push(["track",t.type,t.data])}async reportToSensors(e,t){window.sensors&&window.sensors.track(t.type,t.data[0]||{})}async reportToTencent(e,t){window.MTA&&window.MTA.Event.stat(t.type,t.data[0]||{})}async reportToCustom(e,t){"function"==typeof e.report&&await e.report(t)}}class wt{constructor(e){this.config=e,this.reporter=new mt(e),this.errorQueue=[],this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableErrorTracking&&this.setupErrorListener(),e.enableUnhandledRejection&&this.setupUnhandledRejectionListener(),e.enableResourceError&&this.setupResourceErrorListener(),this.isInitialized=!0}setupErrorListener(){window.addEventListener("error",e=>{this.handleError(e.error||e.message,{type:"javascript",filename:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack})},!0)}setupUnhandledRejectionListener(){window.addEventListener("unhandledrejection",e=>{this.handleError(e.reason,{type:"unhandledrejection",stack:e.reason?.stack})})}setupResourceErrorListener(){window.addEventListener("error",e=>{e.target&&e.target!==window&&this.handleError(`Resource load failed: ${e.target.src||e.target.href}`,{type:"resource",tagName:e.target.tagName,src:e.target.src,href:e.target.href})},!0)}handleError(e,t={}){const n={message:e?.message||e?.toString()||e,stack:e?.stack||t.stack,type:t.type||"unknown",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,...t};this.errorQueue.push(n),this.errorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushErrorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("error",[n])}reportError(e,t={}){this.handleError(e,t)}flushErrorQueue(){this.errorQueue.length>0&&(this.reporter.report("error",[...this.errorQueue]),this.errorQueue=[])}destroy(){this.flushErrorQueue(),this.isInitialized=!1}}class yt{constructor(e){this.config=e,this.reporter=new mt(e),this.eventQueue=[],this.isInitialized=!1,this.clickListener=null,this.pageViewListener=null}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableClickTracking&&this.setupClickTracking(),e.enablePageViewTracking&&this.setupPageViewTracking(),this.setupPeriodicReport(),this.isInitialized=!0}setupClickTracking(){this.clickListener=e=>{const t=e.target,n={type:"click",timestamp:Date.now(),url:window.location.href,element:{tagName:t.tagName,className:t.className,id:t.id,text:t.textContent?.substring(0,50)},position:{x:e.clientX,y:e.clientY}};this.handleEvent("click",n)},document.addEventListener("click",this.clickListener,!0)}setupPageViewTracking(){this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer}),this.pageViewListener=()=>{this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer})},window.addEventListener("popstate",this.pageViewListener);const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.pageViewListener()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.pageViewListener()},0)}.bind(this)}setupPeriodicReport(){const e=this.config.getConfig().reportInterval;e>0&&setInterval(()=>{this.flushEventQueue()},e)}handleEvent(e,t){const n={eventName:e,...t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.eventQueue.push(n),this.eventQueue.length>=this.config.getConfig().maxQueueSize&&this.flushEventQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("event",[n])}reportEvent(e,t={}){this.handleEvent(e,{type:"custom",timestamp:Date.now(),url:window.location.href,...t})}flushEventQueue(){this.eventQueue.length>0&&(this.reporter.report("event",[...this.eventQueue]),this.eventQueue=[])}destroy(){this.flushEventQueue(),this.clickListener&&document.removeEventListener("click",this.clickListener,!0),this.pageViewListener&&window.removeEventListener("popstate",this.pageViewListener),this.isInitialized=!1}}class bt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.pageStartTime=Date.now(),this.performanceQueue=[],this.thirdPartySDKs={},this.metrics={fcp:0,lcp:0,fid:0,cls:0,ttfb:0,domLoad:0,windowLoad:0,resourceLoad:[],apiRequests:[]}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePerformanceTracking&&this.setupPerformanceMonitoring(),e.enableResourceTracking&&this.setupResourceMonitoring(),e.enableApiTracking&&this.setupApiMonitoring(),e.enableInteractionTracking&&this.setupInteractionMonitoring(),this.initThirdPartySDKs(),this.isInitialized=!0}setupPerformanceMonitoring(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.captureDOMLoadTime()}):this.captureDOMLoadTime(),window.addEventListener("load",()=>{this.captureWindowLoadTime(),this.captureWebVitals(),this.reportPerformanceMetrics()}),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupResourceMonitoring(){const e=new PerformanceObserver(e=>{for(const t of e.getEntries())"resource"===t.entryType&&this.handleResourceLoad(t)});try{e.observe({entryTypes:["resource"]})}catch(e){this.setupResourceFallback()}}setupApiMonitoring(){void 0!==window.axios&&(window.axios.interceptors.request.use(e=>(e._startTime=performance.now(),e)),window.axios.interceptors.response.use(e=>{const t=performance.now()-e.config._startTime;return this.handleApiRequest(e.config.url,t,e.status),e},e=>{if(e.config){const t=performance.now()-e.config._startTime;this.handleApiRequest(e.config.url,t,"error")}throw e}))}setupInteractionMonitoring(){let e=0,t=0;const n=r=>{0===e&&(e=performance.now(),t=e-this.metrics.fcp,this.metrics.fid=t,document.removeEventListener("click",n,!0),document.removeEventListener("keydown",n,!0),document.removeEventListener("touchstart",n,!0))};document.addEventListener("click",n,!0),document.addEventListener("keydown",n,!0),document.addEventListener("touchstart",n,!0)}captureDOMLoadTime(){this.metrics.domLoad=performance.now()}captureWindowLoadTime(){this.metrics.windowLoad=performance.now()}captureWebVitals(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.fcp=t.startTime)}).observe({entryTypes:["paint"]})}catch(e){console.warn("FCP监控失败:",e)}if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.metrics.lcp=t.startTime}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP监控失败:",e)}if("PerformanceObserver"in window)try{let e=0;new PerformanceObserver(t=>{for(const n of t.getEntries())n.hadRecentInput||(e+=n.value);this.metrics.cls=e}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS监控失败:",e)}}handleResourceLoad(e){const t={name:e.name,type:e.initiatorType,duration:e.duration,size:e.transferSize,timestamp:Date.now()};this.metrics.resourceLoad.push(t),e.duration>3e3&&this.reportSlowResource(t)}handleApiRequest(e,t,n){const r={url:"string"==typeof e?e:e.toString(),duration:t,status:n,timestamp:Date.now()};this.metrics.apiRequests.push(r),t>5e3&&this.reportSlowApi(r)}handlePageHidden(){this.calculatePageStayTime()}handlePageVisible(){this.pageStartTime=Date.now()}calculatePageStayTime(){const e=Date.now()-this.pageStartTime;this.reportPageStayTime(e)}reportPerformanceMetrics(){const e={type:"performance",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,metrics:this.metrics,user:this.config.getUser(),device:this.getDeviceInfo()};this.performanceQueue.push(e),this.performanceQueue.length>=this.config.getConfig().maxQueueSize&&this.flushPerformanceQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("performance",[e])}reportSlowResource(e){this.reporter.report("slow_resource",[e])}reportSlowApi(e){this.reporter.report("slow_api",[e])}reportPageStayTime(e){const t={type:"page_stay",url:window.location.href,stayTime:e,timestamp:Date.now()};this.reporter.report("page_stay",[t])}getDeviceInfo(){return{screen:{width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth},viewport:{width:window.innerWidth,height:window.innerHeight},connection:navigator.connection?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,memory:navigator.memory?{usedJSHeapSize:navigator.memory.usedJSHeapSize,totalJSHeapSize:navigator.memory.totalJSHeapSize,jsHeapSizeLimit:navigator.memory.jsHeapSizeLimit}:null}}initThirdPartySDKs(){const e=this.config.getThirdPartyConfig();e.baidu&&window._hmt&&(this.thirdPartySDKs.baidu=window._hmt),e.umeng&&window._um&&(this.thirdPartySDKs.umeng=window._um),e.sensors&&window.sensors&&(this.thirdPartySDKs.sensors=window.sensors),e.tencent&&window.MTA&&(this.thirdPartySDKs.tencent=window.MTA)}flushPerformanceQueue(){this.performanceQueue.length>0&&(this.reporter.report("performance",[...this.performanceQueue]),this.performanceQueue=[])}reportPerformance(e={}){const t={type:"custom_performance",timestamp:Date.now(),url:window.location.href,metrics:e,user:this.config.getUser()};this.reporter.report("performance",[t])}getCurrentMetrics(){return{...this.metrics}}destroy(){this.flushPerformanceQueue(),this.isInitialized=!1}}class vt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.behaviorQueue=[],this.sessionId=this.generateSessionId(),this.pageStartTime=Date.now(),this.scrollDepth=0,this.mouseMovements=[],this.keyStrokes=[],this.formInteractions=[],this.behaviors={pageViews:[],clicks:[],scrolls:[],formSubmissions:[],navigation:[],timeOnPage:0}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePageViewTracking&&this.setupPageViewTracking(),e.enableUserInteractionTracking&&this.setupUserInteractionTracking(),e.enableFormTracking&&this.setupFormTracking(),e.enableScrollTracking&&this.setupScrollTracking(),e.enableMouseTracking&&this.setupMouseTracking(),e.enableKeyboardTracking&&this.setupKeyboardTracking(),this.setupTimeTracking(),this.trackReferrer(),this.isInitialized=!0}setupPageViewTracking(){this.trackPageView(),this.setupRouteChangeTracking(),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupRouteChangeTracking(){window.addEventListener("popstate",()=>{this.trackPageView()});const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.trackPageView()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.trackPageView()},0)}.bind(this)}setupUserInteractionTracking(){document.addEventListener("click",e=>{this.trackClick(e)},!0),document.addEventListener("dblclick",e=>{this.trackDoubleClick(e)},!0),document.addEventListener("contextmenu",e=>{this.trackRightClick(e)},!0),"ontouchstart"in window&&document.addEventListener("touchstart",e=>{this.trackTouch(e)},!0)}setupFormTracking(){document.addEventListener("submit",e=>{this.trackFormSubmission(e)},!0),document.addEventListener("change",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldChange(e)},!0),document.addEventListener("focus",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldFocus(e)},!0),document.addEventListener("blur",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldBlur(e)},!0)}setupScrollTracking(){let e;document.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(()=>{const e=window.pageYOffset||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,r=Math.round(e/(t-n)*100);r>this.scrollDepth&&(this.scrollDepth=r,this.trackScroll(r,e))},100)},{passive:!0})}setupMouseTracking(){let e,t=[];document.addEventListener("mousemove",n=>{clearTimeout(e),t.push({x:n.clientX,y:n.clientY,timestamp:Date.now()}),t.length>100&&t.shift(),e=setTimeout(()=>{t.length>10&&(this.trackMouseMovement(t),t=[])},1e3)},{passive:!0})}setupKeyboardTracking(){document.addEventListener("keydown",e=>{"password"!==e.target.type&&this.trackKeyStroke(e)},!0)}setupTimeTracking(){setInterval(()=>{this.behaviors.timeOnPage+=1},1e3),window.addEventListener("beforeunload",()=>{this.reportTimeOnPage()})}trackReferrer(){const e=document.referrer;if(e){const t={type:"referrer",url:e,domain:this.extractDomain(e),timestamp:Date.now()};this.behaviors.navigation.push(t),this.reportBehavior("referrer",t)}}trackPageView(){const e={type:"pageview",url:window.location.href,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer};this.behaviors.pageViews.push(e),this.reportBehavior("pageview",e),this.pageStartTime=Date.now(),this.scrollDepth=0}trackClick(e){const t={type:"click",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id,text:e.target.textContent?.substring(0,50),href:e.target.href},position:{x:e.clientX,y:e.clientY,pageX:e.pageX,pageY:e.pageY},timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.clicks.push(t),this.reportBehavior("click",t)}trackDoubleClick(e){const t={type:"doubleclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("doubleclick",t)}trackRightClick(e){const t={type:"rightclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("rightclick",t)}trackTouch(e){const t={type:"touch",touches:Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY,identifier:e.identifier})),timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("touch",t)}trackFormSubmission(e){const t={type:"form_submission",form:{action:e.target.action,method:e.target.method,id:e.target.id,className:e.target.className},fields:this.getFormFields(e.target),timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.formSubmissions.push(t),this.reportBehavior("form_submission",t)}trackFormFieldChange(e){const t={type:"form_field_change",field:{name:e.target.name,type:e.target.type,value:"password"===e.target.type?"***":e.target.value,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_change",t)}trackFormFieldFocus(e){const t={type:"form_field_focus",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_focus",t)}trackFormFieldBlur(e){const t={type:"form_field_blur",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_blur",t)}trackScroll(e,t){const n={type:"scroll",depth:e,scrollTop:t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("scroll",n)}trackMouseMovement(e){const t={type:"mouse_movement",movements:e,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("mouse_movement",t)}trackKeyStroke(e){const t={type:"keystroke",key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("keystroke",t)}handlePageHidden(){this.reportTimeOnPage()}handlePageVisible(){this.pageStartTime=Date.now()}reportTimeOnPage(){const e={type:"time_on_page",time:this.behaviors.timeOnPage,url:window.location.href,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("time_on_page",e)}reportBehavior(e,t){const n={type:e,data:t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.behaviorQueue.push(n),this.behaviorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushBehaviorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("behavior",[n])}reportCustomBehavior(e,t={}){const n={type:"custom_behavior",eventName:e,...t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("custom_behavior",n)}flushBehaviorQueue(){this.behaviorQueue.length>0&&(this.reporter.report("behavior",[...this.behaviorQueue]),this.behaviorQueue=[])}getFormFields(e){const t=[],n=e.elements;for(let e=0;e<n.length;e++){const r=n[e];r.name&&t.push({name:r.name,type:r.type,value:"password"===r.type?"***":r.value})}return t}extractDomain(e){try{return new URL(e).hostname}catch(t){return e}}generateSessionId(){return"session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}getCurrentBehaviors(){return{...this.behaviors}}getSessionId(){return this.sessionId}destroy(){this.flushBehaviorQueue(),this.reportTimeOnPage(),this.isInitialized=!1}}class Tt{constructor(e){this.config=e,this.integratedSDKs={},this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getThirdPartyConfig();e.baidu&&e.baidu.enabled&&this.initBaiduAnalytics(e.baidu),e.umeng&&e.umeng.enabled&&this.initUmengAnalytics(e.umeng),e.sensors&&e.sensors.enabled&&this.initSensorsAnalytics(e.sensors),e.tencent&&e.tencent.enabled&&this.initTencentAnalytics(e.tencent),e.google&&e.google.enabled&&this.initGoogleAnalytics(e.google),e.custom&&e.custom.enabled&&this.initCustomAnalytics(e.custom),this.isInitialized=!0}initBaiduAnalytics(e){try{window._hmt?(this.integratedSDKs.baidu={name:"baidu",instance:window._hmt,config:e},e.siteId&&window._hmt.push(["_setAccount",e.siteId]),!1!==e.autoPageview&&window._hmt.push(["_trackPageview"]),console.log("百度统计集成成功")):console.warn("百度统计未加载,请检查脚本是否正确引入")}catch(e){console.error("百度统计集成失败:",e)}}initUmengAnalytics(e){try{window._um?(this.integratedSDKs.umeng={name:"umeng",instance:window._um,config:e},e.siteId&&window._um.push(["setAccount",e.siteId]),!1!==e.autoPageview&&window._um.push(["trackPageview"]),console.log("友盟统计集成成功")):console.warn("友盟统计未加载,请检查脚本是否正确引入")}catch(e){console.error("友盟统计集成失败:",e)}}initSensorsAnalytics(e){try{window.sensors?(this.integratedSDKs.sensors={name:"sensors",instance:window.sensors,config:e},e.serverUrl&&window.sensors.setServerUrl(e.serverUrl),e.siteId&&window.sensors.setSiteId(e.siteId),!1!==e.autoPageview&&window.sensors.trackPageview(),console.log("神策数据集成成功")):console.warn("神策数据未加载,请检查脚本是否正确引入")}catch(e){console.error("神策数据集成失败:",e)}}initTencentAnalytics(e){try{window.MTA?(this.integratedSDKs.tencent={name:"tencent",instance:window.MTA,config:e},e.appId&&window.MTA.setAppId(e.appId),!1!==e.autoPageview&&window.MTA.trackPageview(),console.log("腾讯云分析集成成功")):console.warn("腾讯云分析未加载,请检查脚本是否正确引入")}catch(e){console.error("腾讯云分析集成失败:",e)}}initGoogleAnalytics(e){try{window.gtag?(this.integratedSDKs.google={name:"google",instance:window.gtag,config:e},e.measurementId&&window.gtag("config",e.measurementId,{page_title:document.title,page_location:window.location.href}),console.log("Google Analytics集成成功")):console.warn("Google Analytics未加载,请检查脚本是否正确引入")}catch(e){console.error("Google Analytics集成失败:",e)}}initCustomAnalytics(e){try{if("function"==typeof e.init){const t=e.init(e);this.integratedSDKs.custom={name:"custom",instance:t,config:e},console.log("自定义第三方集成成功")}else console.warn("自定义第三方配置缺少init函数")}catch(e){console.error("自定义第三方集成失败:",e)}}reportEvent(e,t={}){Object.values(this.integratedSDKs).forEach(n=>{try{this.reportToSDK(n,e,t)}catch(e){console.error(`上报事件到${n.name}失败:`,e)}})}reportPageView(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPageViewToSDK(t,e)}catch(e){console.error(`上报页面浏览到${t.name}失败:`,e)}})}reportUser(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportUserToSDK(t,e)}catch(e){console.error(`上报用户信息到${t.name}失败:`,e)}})}reportPerformance(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPerformanceToSDK(t,e)}catch(e){console.error(`上报性能指标到${t.name}失败:`,e)}})}reportToSDK(e,t,n){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent",t,JSON.stringify(n)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track",t,n]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track(t,n);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat(t,n);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event",t,n);break;case"custom":e.instance&&"function"==typeof e.instance.track&&e.instance.track(t,n);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPageViewToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackPageview",t.url||window.location.href]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["trackPageview",t.url||window.location.href]);break;case"sensors":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t);break;case"tencent":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t.url||window.location.href);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("config",e.config.measurementId,{page_title:t.title||document.title,page_location:t.url||window.location.href});break;case"custom":e.instance&&"function"==typeof e.instance.trackPageview&&e.instance.trackPageview(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportUserToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&(e.instance.push(["_setUserTag","userId",t.userId]),e.instance.push(["_setUserTag","userType",t.userType]));break;case"umeng":e.instance&&e.instance.push&&(e.instance.push(["setUserTag","userId",t.userId]),e.instance.push(["setUserTag","userType",t.userType]));break;case"sensors":e.instance&&e.instance.setProfile&&e.instance.setProfile(t);break;case"tencent":e.instance&&e.instance.setUserInfo&&e.instance.setUserInfo(t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("set","user_id",t.userId);break;case"custom":e.instance&&"function"==typeof e.instance.setUser&&e.instance.setUser(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPerformanceToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent","performance",JSON.stringify(t)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track","performance",t]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track("performance",t);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat("performance",t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event","performance",t);break;case"custom":e.instance&&"function"==typeof e.instance.trackPerformance&&e.instance.trackPerformance(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}isSDKIntegrated(e){return!!this.integratedSDKs[e]}getIntegratedSDKs(){return Object.keys(this.integratedSDKs)}getSDKInstance(e){return this.integratedSDKs[e]?.instance||null}destroy(){Object.values(this.integratedSDKs).forEach(e=>{try{e.instance&&"function"==typeof e.instance.destroy&&e.instance.destroy()}catch(t){console.error(`销毁${e.name}失败:`,t)}}),this.integratedSDKs={},this.isInitialized=!1}}class kt{constructor(e={}){this.config={appId:e.appId||"",appVersion:e.appVersion||"1.0.0",environment:e.environment||"production",reportUrl:e.reportUrl||"",reportInterval:e.reportInterval||5e3,maxQueueSize:e.maxQueueSize||100,enableErrorTracking:!1!==e.enableErrorTracking,enableUnhandledRejection:!1!==e.enableUnhandledRejection,enableResourceError:!1!==e.enableResourceError,enableEventTracking:!1!==e.enableEventTracking,enableClickTracking:!1!==e.enableClickTracking,enablePageViewTracking:!1!==e.enablePageViewTracking,enablePerformanceTracking:!1!==e.enablePerformanceTracking,enableResourceTracking:!1!==e.enableResourceTracking,enableApiTracking:!1!==e.enableApiTracking,enableInteractionTracking:!1!==e.enableInteractionTracking,enableUserInteractionTracking:!1!==e.enableUserInteractionTracking,enableFormTracking:!1!==e.enableFormTracking,enableScrollTracking:!1!==e.enableScrollTracking,enableMouseTracking:!1!==e.enableMouseTracking,enableKeyboardTracking:!1!==e.enableKeyboardTracking,thirdPartyConfig:e.thirdPartyConfig||{},user:e.user||null,customReport:e.customReport||null},this.user=null}updateConfig(e){this.config={...this.config,...e}}setUser(e){this.user=e}getConfig(){return this.config}getUser(){return this.user}getReportUrl(){return this.config.reportUrl}getThirdPartyConfig(){return this.config.thirdPartyConfig}isErrorTrackingEnabled(){return this.config.enableErrorTracking}isEventTrackingEnabled(){return this.config.enableEventTracking}}"undefined"==typeof window||window.axios||(window.axios=gt);class Et{constructor(e={}){this.config=new kt(e),this.errorTracker=new wt(this.config),this.eventTracker=new yt(this.config),this.performanceTracker=new bt(this.config),this.userBehaviorTracker=new vt(this.config),this.thirdPartyIntegrator=new Tt(this.config),this.init()}init(){this.errorTracker.init(),this.eventTracker.init(),this.performanceTracker.init(),this.userBehaviorTracker.init(),this.thirdPartyIntegrator.init(),console.log("Frontend SDK 初始化完成")}reportError(e,t={}){this.errorTracker.reportError(e,t)}reportEvent(e,t={}){this.eventTracker.reportEvent(e,t)}reportPerformance(e={}){this.performanceTracker.reportPerformance(e)}reportBehavior(e,t={}){this.userBehaviorTracker.reportCustomBehavior(e,t)}setUser(e){this.config.setUser(e),this.thirdPartyIntegrator.reportUser(e)}setConfig(e){this.config.updateConfig(e)}getPerformanceMetrics(){return this.performanceTracker.getCurrentMetrics()}getBehaviorData(){return this.userBehaviorTracker.getCurrentBehaviors()}getSessionId(){return this.userBehaviorTracker.getSessionId()}isThirdPartySDKIntegrated(e){return this.thirdPartyIntegrator.isSDKIntegrated(e)}getIntegratedThirdPartySDKs(){return this.thirdPartyIntegrator.getIntegratedSDKs()}destroy(){this.errorTracker.destroy(),this.eventTracker.destroy(),this.performanceTracker.destroy(),this.userBehaviorTracker.destroy(),this.thirdPartyIntegrator.destroy(),console.log("Frontend SDK 已销毁")}}export{Et as default};
1
+ function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:i}=Symbol,s=(o=Object.create(null),e=>{const n=t.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())});var o;const a=e=>(e=e.toLowerCase(),t=>s(t)===e),c=e=>t=>typeof t===e,{isArray:u}=Array,l=c("undefined");function h(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const d=a("ArrayBuffer");const p=c("string"),f=c("function"),g=c("number"),m=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==s(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||i in e||r in e)},y=a("Date"),b=a("File"),v=a("Blob"),T=a("FileList"),k=a("URLSearchParams"),[E,S,R,P]=["ReadableStream","Request","Response","Headers"].map(a);function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),u(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(h(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(r=0;r<s;r++)o=i[r],t.call(null,e[o],o,e)}}function A(e,t){if(h(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,D=e=>!l(e)&&e!==C;const I=(_="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>_&&e instanceof _);var _;const L=a("HTMLFormElement"),U=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),N=a("RegExp"),x=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};O(n,(n,i)=>{let s;!1!==(s=t(n,i,e))&&(r[i]=s||n)}),Object.defineProperties(e,r)};const j=a("AsyncFunction"),B=(F="function"==typeof setImmediate,K=f(C.postMessage),F?setImmediate:K?(M=`axios@${Math.random()}`,z=[],C.addEventListener("message",({source:e,data:t})=>{e===C&&t===M&&z.length&&z.shift()()},!1),e=>{z.push(e),C.postMessage(M,"*")}):e=>setTimeout(e));var F,K,M,z;const V="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):"undefined"!=typeof process&&process.nextTick||B;var q={isArray:u,isArrayBuffer:d,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=s(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:w,isEmptyObject:e=>{if(!m(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:E,isRequest:S,isResponse:R,isHeaders:P,isUndefined:l,isDate:y,isFile:b,isBlob:v,isRegExp:N,isFunction:f,isStream:e=>m(e)&&f(e.pipe),isURLSearchParams:k,isTypedArray:I,isFileList:T,forEach:O,merge:function e(){const{caseless:t}=D(this)&&this||{},n={},r=(r,i)=>{const s=t&&A(n,i)||i;w(n[s])&&w(r)?n[s]=e(n[s],r):w(r)?n[s]=e({},r):u(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],r);return n},extend:(t,n,r,{allOwnKeys:i}={})=>(O(n,(n,i)=>{r&&f(n)?t[i]=e(n,r):t[i]=n},{allOwnKeys:i}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,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,r,i)=>{let s,o,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)a=s[o],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,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(u(e))return e;let t=e.length;if(!g(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.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:L,hasOwnProperty:U,hasOwnProp:U,reduceDescriptors:x,freezeMethods:e=>{x(e,(t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];f(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 u(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:A,global:C,isContextDefined:D,isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[i]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[r]=e;const i=u(e)?[]:{};return O(e,(e,t)=>{const s=n(e,r+1);!l(s)&&(i[t]=s)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:j,isThenable:e=>e&&(m(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:B,asap:V,isIterable:e=>null!=e&&f(e[r])};function Q(e,t,n,r,i){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),i&&(this.response=i,this.status=i.status?i.status:null)}q.inherits(Q,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:q.toJSONObject(this.config),code:this.code,status:this.status}}});const H=Q.prototype,J={};["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=>{J[e]={value:e}}),Object.defineProperties(Q,J),Object.defineProperty(H,"isAxiosError",{value:!0}),Q.from=(e,t,n,r,i,s)=>{const o=Object.create(H);return q.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),Q.call(o,e.message,t,n,r,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function W(e){return q.isPlainObject(e)||q.isArray(e)}function $(e){return q.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=$(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const G=q.toFlatObject(q,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!q.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=q.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!q.isUndefined(t[e])})).metaTokens,i=n.visitor||u,s=n.dots,o=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&q.isSpecCompliantForm(t);if(!q.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(q.isDate(e))return e.toISOString();if(q.isBoolean(e))return e.toString();if(!a&&q.isBlob(e))throw new Q("Blob is not supported. Use a Buffer instead.");return q.isArrayBuffer(e)||q.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(q.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(q.isArray(e)&&function(e){return q.isArray(e)&&!e.some(W)}(e)||(q.isFileList(e)||q.endsWith(n,"[]"))&&(a=q.toArray(e)))return n=$(n),a.forEach(function(e,r){!q.isUndefined(e)&&null!==e&&t.append(!0===o?X([n],r,s):null===o?n:n+"[]",c(e))}),!1;return!!W(e)||(t.append(X(i,n,s),c(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!q.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!q.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),q.forEach(n,function(n,s){!0===(!(q.isUndefined(n)||null===n)&&i.call(t,n,q.isString(s)?s.trim():s,r,h))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Y(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;q.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(s=i?i(t,n):q.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ie=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){q.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,ue=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=ae&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ue,navigator:ce,origin:he}),...oe};function pe(e){function t(e,n,r,i){let s=e[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&q.isArray(r)?r.length:s,a)return q.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!o;r[s]&&q.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],i)&&q.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}(r[s])),!o}if(q.isFormData(e)&&q.isFunction(e.entries)){const n={};return q.forEachEntry(e,(e,r)=>{t(function(e){return q.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const fe={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=q.isObject(e);i&&q.isHTMLForm(e)&&(e=new FormData(e));if(q.isFormData(e))return r?JSON.stringify(pe(e)):e;if(q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)||q.isReadableStream(e))return e;if(q.isArrayBufferView(e))return e.buffer;if(q.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&q.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=q.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(q.isString(e))try{return(t||JSON.parse)(e),q.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(q.isResponse(e)||q.isReadableStream(e))return e;if(e&&q.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 Q.from(e,Q.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:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};q.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var ge=fe;const me=q.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 we=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:q.isArray(e)?e.map(be):String(e)}function ve(e,t,n,r,i){return q.isFunction(r)?r.call(this,t,n):(i&&(t=n),q.isString(t)?q.isString(r)?-1!==t.indexOf(r):q.isRegExp(r)?r.test(t):void 0:void 0)}class Te{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=ye(t);if(!i)throw new Error("header name must be a non-empty string");const s=q.findKey(r,i);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=be(e))}const s=(e,t)=>q.forEach(e,(e,n)=>i(e,n,t));if(q.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(q.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&me[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(q.isObject(e)&&q.isIterable(e)){let n,r,i={};for(const t of e){if(!q.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?q.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=ye(e)){const n=q.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(q.isFunction(t))return t.call(this,e,n);if(q.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=q.findKey(this,e);return!(!n||void 0===this[n]||t&&!ve(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=ye(e)){const i=q.findKey(n,e);!i||t&&!ve(0,n[i],i,t)||(delete n[i],r=!0)}}return q.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!ve(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return q.forEach(this,(r,i)=>{const s=q.findKey(n,i);if(s)return t[s]=be(r),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();o!==i&&delete t[i],t[o]=be(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return q.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&q.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[we]=this[we]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=q.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return q.isArray(e)?e.forEach(r):r(e),this}}Te.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),q.reduceDescriptors(Te.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),q.freezeMethods(Te);var ke=Te;function Ee(e,t){const n=this||ge,r=t||n,i=ke.from(r.headers);let s=r.data;return q.forEach(e,function(e){s=e.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Se(e){return!(!e||!e.__CANCEL__)}function Re(e,t,n){Q.call(this,null==e?"canceled":e,Q.ERR_CANCELED,t,n),this.name="CanceledError"}function Pe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Q("Request failed with status code "+n.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}q.inherits(Re,Q,{__CANCEL__:!0});const Oe=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[o];i||(i=c),n[s]=a,r[s]=c;let l=o,h=0;for(;l!==s;)h+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-i<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,i=0,s=1e3/t;const o=(t,s=Date.now())=>{i=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=s?o(e,t):(n=e,r||(r=setTimeout(()=>{r=null,o(n)},s-a)))},()=>n&&o(n)]}(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-r,c=i(a);r=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:n,lengthComputable:null!=o,[t?"download":"upload"]:!0})},n)},Ae=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ce=e=>(...t)=>q.asap(()=>e(...t));var De=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ie=de.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];q.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),q.isString(r)&&o.push("path="+r),q.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.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 _e(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 Le=e=>e instanceof ke?{...e}:e;function Ue(e,t){t=t||{};const n={};function r(e,t,n,r){return q.isPlainObject(e)&&q.isPlainObject(t)?q.merge.call({caseless:r},e,t):q.isPlainObject(t)?q.merge({},t):q.isArray(t)?t.slice():t}function i(e,t,n,i){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function s(e,t){if(!q.isUndefined(t))return r(void 0,t)}function o(e,t){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,s){return s in t?r(n,i):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,n)=>i(Le(e),Le(t),0,!0)};return q.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||i,o=s(e[r],t[r],r);q.isUndefined(o)&&s!==a||(n[r]=o)}),n}var Ne=e=>{const t=Ue({},e);let n,{data:r,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=ke.from(a),t.url=re(_e(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),q.isFormData(r))if(de.hasStandardBrowserEnv||de.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(de.hasStandardBrowserEnv&&(i&&q.isFunction(i)&&(i=i(t)),i||!1!==i&&De(t.url))){const e=s&&o&&Ie.read(o);e&&a.set(s,e)}return t};var xe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ne(e);let i=r.data;const s=ke.from(r.headers).normalize();let o,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(o),r.signal&&r.signal.removeEventListener("abort",o)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=ke.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Pe(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new Q("Request aborted",Q.ECONNABORTED,e,g)),g=null)},g.onerror=function(){n(new Q("Network Error",Q.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Q(t,i.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,e,g)),g=null},void 0===i&&s.setContentType(null),"setRequestHeader"in g&&q.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),q.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),h&&"json"!==h&&(g.responseType=r.responseType),p&&([c,l]=Oe(p,!0),g.addEventListener("progress",c)),d&&g.upload&&([a,u]=Oe(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(o=t=>{g&&(n(!t||t.type?new Re(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(o),r.signal&&(r.signal.aborted?o():r.signal.addEventListener("abort",o)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===de.protocols.indexOf(w)?n(new Q("Unsupported protocol "+w+":",Q.ERR_BAD_REQUEST,e)):g.send(i||null)})};var je=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,o();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Q?t:new Re(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,i(new Q(`timeout ${t} of ms exceeded`,Q.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>q.asap(o),a}};const Be=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},Fe=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()}},Ke=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of Fe(e))yield*Be(n,t)}(e,t);let s,o=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=o+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Me="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=Me&&"function"==typeof ReadableStream,Ve=Me&&("function"==typeof TextEncoder?(qe=new TextEncoder,e=>qe.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var qe;const Qe=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},He=ze&&Qe(()=>{let e=!1;const t=new Request(de.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Je=ze&&Qe(()=>q.isReadableStream(new Response("").body)),We={stream:Je&&(e=>e.body)};var $e;Me&&($e=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!We[e]&&(We[e]=q.isFunction($e[e])?t=>t[e]():(t,n)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,n)})}));const Xe=async(e,t)=>{const n=q.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(q.isBlob(e))return e.size;if(q.isSpecCompliantForm(e)){const t=new Request(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return q.isArrayBufferView(e)||q.isArrayBuffer(e)?e.byteLength:(q.isURLSearchParams(e)&&(e+=""),q.isString(e)?(await Ve(e)).byteLength:void 0)})(t):n};const Ge={http:null,xhr:xe,fetch:Me&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ne(e);u=u?(u+"").toLowerCase():"text";let p,f=je([i,s&&s.toAbortSignal()],o);const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(c&&He&&"get"!==n&&"head"!==n&&0!==(m=await Xe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(q.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ae(m,Oe(Ce(c)));r=Ke(n.body,65536,e,t)}}q.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...d,signal:f,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:i?h:void 0});let s=await fetch(p,d);const o=Je&&("stream"===u||"response"===u);if(Je&&(a||o&&g)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=q.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ae(t,Oe(Ce(a),!0))||[];s=new Response(Ke(s.body,65536,n,()=>{r&&r(),g&&g()}),e)}u=u||"text";let w=await We[q.findKey(We,u)||"text"](s,e);return!o&&g&&g(),await new Promise((t,n)=>{Pe(t,n,{data:w,headers:ke.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(t){if(g&&g(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Q("Network Error",Q.ERR_NETWORK,e,p),{cause:t.cause||t});throw Q.from(t,t&&t.code,e,p)}})};q.forEach(Ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ye=e=>`- ${e}`,Ze=e=>q.isFunction(e)||null===e||!1===e;var et=e=>{e=q.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!Ze(n)&&(r=Ge[(t=String(n)).toLowerCase()],void 0===r))throw new Q(`Unknown adapter '${t}'`);if(r)break;i[t||"#"+s]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Q("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ye).join("\n"):" "+Ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Re(null,e)}function nt(e){tt(e),e.headers=ke.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return et(e.adapter||ge.adapter)(e).then(function(t){return tt(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=ke.from(t.headers),t},function(t){return Se(t)||(tt(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=ke.from(t.response.headers))),Promise.reject(t)})}const rt="1.11.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const st={};it.transitional=function(e,t,n){function r(e,t){return"[Axios v"+rt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,s)=>{if(!1===e)throw new Q(r(i," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!st[i]&&(st[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,s)}},it.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ot={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new Q("option "+s+" must be "+n,Q.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Q("Unknown option "+s,Q.ERR_BAD_OPTION)}},validators:it};const at=ot.validators;class ct{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}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=Ue(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&ot.assertOptions(n,{silentJSONParsing:at.transitional(at.boolean),forcedJSONParsing:at.transitional(at.boolean),clarifyTimeoutError:at.transitional(at.boolean)},!1),null!=r&&(q.isFunction(r)?t.paramsSerializer={serialize:r}:ot.assertOptions(r,{encode:at.function,serialize:at.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ot.assertOptions(t,{baseUrl:at.spelling("baseURL"),withXsrfToken:at.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=i&&q.merge(i.common,i[t.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=ke.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[nt.bind(this),void 0];for(e.unshift(...o),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=o.length;let d=t;for(h=0;h<l;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=nt.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return re(_e((e=Ue(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(e){ct.prototype[e]=function(t,n){return this.request(Ue(n||{},{method:e,url:t,data:(n||{}).data}))}}),q.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(Ue(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ct.prototype[e]=t(),ct.prototype[e+"Form"]=t(!0)});var ut=ct;class lt{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,i){n.reason||(n.reason=new Re(e,r,i),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 lt(function(t){e=t}),cancel:e}}}var ht=lt;const dt={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(dt).forEach(([e,t])=>{dt[t]=e});var pt=dt;const ft=function t(n){const r=new ut(n),i=e(ut.prototype.request,r);return q.extend(i,ut.prototype,r,{allOwnKeys:!0}),q.extend(i,r,null,{allOwnKeys:!0}),i.create=function(e){return t(Ue(n,e))},i}(ge);ft.Axios=ut,ft.CanceledError=Re,ft.CancelToken=ht,ft.isCancel=Se,ft.VERSION=rt,ft.toFormData=Y,ft.AxiosError=Q,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return q.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ue,ft.AxiosHeaders=ke,ft.formToJSON=e=>pe(q.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=et,ft.HttpStatusCode=pt,ft.default=ft;const gt=ft.create({timeout:1e4,headers:{"Content-Type":"application/json"}});gt.interceptors.request.use(e=>(e._startTime=performance.now(),e),e=>Promise.reject(e)),gt.interceptors.response.use(e=>{if(e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return e},e=>{if(e.config&&e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return Promise.reject(e)});class mt{constructor(e){this.config=e,this.isReporting=!1}async report(e,t){if(!this.isReporting){this.isReporting=!0;try{const n=this.formatReportData(e,t);this.config.getConfig().customReport?await this.config.getConfig().customReport(e,n):await this.defaultReport(e,n)}catch(e){console.error("上报失败:",e)}finally{this.isReporting=!1}}}formatReportData(e,t){return{...{type:e,timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}},data:Array.isArray(t)?t:[t]}}async defaultReport(e,t){const n=this.config.getReportUrl(),r=this.config.getThirdPartyConfig();n&&await this.reportToBackend(n,t),r&&Object.keys(r).length>0&&await this.reportToThirdParty(r,t)}async reportToBackend(e,t){try{return(await gt.post(e,t)).data}catch(e){throw console.error("后端上报失败:",e),e}}async reportToThirdParty(e,t){const n=[];e.baidu&&window._hmt&&n.push(this.reportToBaidu(e.baidu,t)),e.umeng&&window._um&&n.push(this.reportToUmeng(e.umeng,t)),e.sensors&&window.sensors&&n.push(this.reportToSensors(e.sensors,t)),e.tencent&&window.MTA&&n.push(this.reportToTencent(e.tencent,t)),e.custom&&n.push(this.reportToCustom(e.custom,t));try{await Promise.allSettled(n)}catch(e){console.error("第三方上报失败:",e)}}async reportToBaidu(e,t){window._hmt&&window._hmt.push(["_trackEvent",t.type,JSON.stringify(t.data)])}async reportToUmeng(e,t){window._um&&window._um.push(["track",t.type,t.data])}async reportToSensors(e,t){window.sensors&&window.sensors.track(t.type,t.data[0]||{})}async reportToTencent(e,t){window.MTA&&window.MTA.Event.stat(t.type,t.data[0]||{})}async reportToCustom(e,t){"function"==typeof e.report&&await e.report(t)}}class wt{constructor(e){this.config=e,this.reporter=new mt(e),this.errorQueue=[],this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableErrorTracking&&this.setupErrorListener(),e.enableUnhandledRejection&&this.setupUnhandledRejectionListener(),e.enableResourceError&&this.setupResourceErrorListener(),this.isInitialized=!0}setupErrorListener(){window.addEventListener("error",e=>{this.handleError(e.error||e.message,{type:"javascript",filename:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack})},!0)}setupUnhandledRejectionListener(){window.addEventListener("unhandledrejection",e=>{this.handleError(e.reason,{type:"unhandledrejection",stack:e.reason?.stack})})}setupResourceErrorListener(){window.addEventListener("error",e=>{e.target&&e.target!==window&&this.handleError(`Resource load failed: ${e.target.src||e.target.href}`,{type:"resource",tagName:e.target.tagName,src:e.target.src,href:e.target.href})},!0)}handleError(e,t={}){const n={message:e?.message||e?.toString()||e,stack:e?.stack||t.stack,type:t.type||"unknown",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,...t};this.errorQueue.push(n),this.errorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushErrorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("error",[n])}reportError(e,t={}){this.handleError(e,t)}flushErrorQueue(){this.errorQueue.length>0&&(this.reporter.report("error",[...this.errorQueue]),this.errorQueue=[])}destroy(){this.flushErrorQueue(),this.isInitialized=!1}}class yt{constructor(e){this.config=e,this.reporter=new mt(e),this.eventQueue=[],this.isInitialized=!1,this.clickListener=null,this.pageViewListener=null}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableClickTracking&&this.setupClickTracking(),e.enablePageViewTracking&&this.setupPageViewTracking(),this.setupPeriodicReport(),this.isInitialized=!0}setupClickTracking(){this.clickListener=e=>{const t=e.target,n={type:"click",timestamp:Date.now(),url:window.location.href,element:{tagName:t.tagName,className:t.className,id:t.id,text:t.textContent?.substring(0,50)},position:{x:e.clientX,y:e.clientY}};this.handleEvent("click",n)},document.addEventListener("click",this.clickListener,!0)}setupPageViewTracking(){this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer}),this.pageViewListener=()=>{this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer})},window.addEventListener("popstate",this.pageViewListener);const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.pageViewListener()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.pageViewListener()},0)}.bind(this)}setupPeriodicReport(){const e=this.config.getConfig().reportInterval;e>0&&setInterval(()=>{this.flushEventQueue()},e)}handleEvent(e,t){const n={eventName:e,...t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.eventQueue.push(n),this.eventQueue.length>=this.config.getConfig().maxQueueSize&&this.flushEventQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("event",[n])}reportEvent(e,t={}){this.handleEvent(e,{type:"custom",timestamp:Date.now(),url:window.location.href,...t})}flushEventQueue(){this.eventQueue.length>0&&(this.reporter.report("event",[...this.eventQueue]),this.eventQueue=[])}destroy(){this.flushEventQueue(),this.clickListener&&document.removeEventListener("click",this.clickListener,!0),this.pageViewListener&&window.removeEventListener("popstate",this.pageViewListener),this.isInitialized=!1}}class bt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.pageStartTime=Date.now(),this.performanceQueue=[],this.thirdPartySDKs={},this.metrics={fcp:0,lcp:0,fid:0,cls:0,ttfb:0,domLoad:0,windowLoad:0,resourceLoad:[],apiRequests:[]}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePerformanceTracking&&this.setupPerformanceMonitoring(),e.enableResourceTracking&&this.setupResourceMonitoring(),e.enableApiTracking&&this.setupApiMonitoring(),e.enableInteractionTracking&&this.setupInteractionMonitoring(),this.initThirdPartySDKs(),this.isInitialized=!0}setupPerformanceMonitoring(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.captureDOMLoadTime()}):this.captureDOMLoadTime(),window.addEventListener("load",()=>{this.captureWindowLoadTime(),this.captureWebVitals(),this.reportPerformanceMetrics()}),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupResourceMonitoring(){const e=new PerformanceObserver(e=>{for(const t of e.getEntries())"resource"===t.entryType&&this.handleResourceLoad(t)});try{e.observe({entryTypes:["resource"]})}catch(e){this.setupResourceFallback()}}setupApiMonitoring(){void 0!==window.axios&&(window.axios.interceptors.request.use(e=>(e._startTime=performance.now(),e)),window.axios.interceptors.response.use(e=>{const t=performance.now()-e.config._startTime;return console.log("duration----",e.config.url,t,e.status),this.handleApiRequest(e.config.url,t,e.status),e},e=>{if(e.config){const t=performance.now()-e.config._startTime;console.log("duration----",e.config.url,t,"error"),this.handleApiRequest(e.config.url,t,"error")}throw e}))}setupInteractionMonitoring(){let e=0,t=0;const n=r=>{0===e&&(e=performance.now(),t=e-this.metrics.fcp,this.metrics.fid=t,document.removeEventListener("click",n,!0),document.removeEventListener("keydown",n,!0),document.removeEventListener("touchstart",n,!0))};document.addEventListener("click",n,!0),document.addEventListener("keydown",n,!0),document.addEventListener("touchstart",n,!0)}captureDOMLoadTime(){this.metrics.domLoad=performance.now()}captureWindowLoadTime(){this.metrics.windowLoad=performance.now()}captureWebVitals(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.fcp=t.startTime)}).observe({entryTypes:["paint"]})}catch(e){console.warn("FCP监控失败:",e)}if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.metrics.lcp=t.startTime}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP监控失败:",e)}if("PerformanceObserver"in window)try{let e=0;new PerformanceObserver(t=>{for(const n of t.getEntries())n.hadRecentInput||(e+=n.value);this.metrics.cls=e}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS监控失败:",e)}}handleResourceLoad(e){const t={name:e.name,type:e.initiatorType,duration:e.duration,size:e.transferSize,timestamp:Date.now()};this.metrics.resourceLoad.push(t),e.duration>3e3&&this.reportSlowResource(t)}handleApiRequest(e,t,n){const r={url:"string"==typeof e?e:e.toString(),duration:t,status:n,timestamp:Date.now()};this.metrics.apiRequests.push(r),t>5e3&&this.reportSlowApi(r)}handlePageHidden(){this.calculatePageStayTime()}handlePageVisible(){this.pageStartTime=Date.now()}calculatePageStayTime(){const e=Date.now()-this.pageStartTime;this.reportPageStayTime(e)}reportPerformanceMetrics(){const e={type:"performance",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,metrics:this.metrics,user:this.config.getUser(),device:this.getDeviceInfo()};this.performanceQueue.push(e),this.performanceQueue.length>=this.config.getConfig().maxQueueSize&&this.flushPerformanceQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("performance",[e])}reportSlowResource(e){this.reporter.report("slow_resource",[e])}reportSlowApi(e){this.reporter.report("slow_api",[e])}reportPageStayTime(e){const t={type:"page_stay",url:window.location.href,stayTime:e,timestamp:Date.now()};this.reporter.report("page_stay",[t])}getDeviceInfo(){return{screen:{width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth},viewport:{width:window.innerWidth,height:window.innerHeight},connection:navigator.connection?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,memory:navigator.memory?{usedJSHeapSize:navigator.memory.usedJSHeapSize,totalJSHeapSize:navigator.memory.totalJSHeapSize,jsHeapSizeLimit:navigator.memory.jsHeapSizeLimit}:null}}initThirdPartySDKs(){const e=this.config.getThirdPartyConfig();e.baidu&&window._hmt&&(this.thirdPartySDKs.baidu=window._hmt),e.umeng&&window._um&&(this.thirdPartySDKs.umeng=window._um),e.sensors&&window.sensors&&(this.thirdPartySDKs.sensors=window.sensors),e.tencent&&window.MTA&&(this.thirdPartySDKs.tencent=window.MTA)}flushPerformanceQueue(){this.performanceQueue.length>0&&(this.reporter.report("performance",[...this.performanceQueue]),this.performanceQueue=[])}reportPerformance(e={}){const t={type:"custom_performance",timestamp:Date.now(),url:window.location.href,metrics:e,user:this.config.getUser()};this.reporter.report("performance",[t])}getCurrentMetrics(){return{...this.metrics}}destroy(){this.flushPerformanceQueue(),this.isInitialized=!1}}class vt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.behaviorQueue=[],this.sessionId=this.generateSessionId(),this.pageStartTime=Date.now(),this.scrollDepth=0,this.mouseMovements=[],this.keyStrokes=[],this.formInteractions=[],this.behaviors={pageViews:[],clicks:[],scrolls:[],formSubmissions:[],navigation:[],timeOnPage:0}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePageViewTracking&&this.setupPageViewTracking(),e.enableUserInteractionTracking&&this.setupUserInteractionTracking(),e.enableFormTracking&&this.setupFormTracking(),e.enableScrollTracking&&this.setupScrollTracking(),e.enableMouseTracking&&this.setupMouseTracking(),e.enableKeyboardTracking&&this.setupKeyboardTracking(),this.setupTimeTracking(),this.trackReferrer(),this.isInitialized=!0}setupPageViewTracking(){this.trackPageView(),this.setupRouteChangeTracking(),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupRouteChangeTracking(){window.addEventListener("popstate",()=>{this.trackPageView()});const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.trackPageView()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.trackPageView()},0)}.bind(this)}setupUserInteractionTracking(){document.addEventListener("click",e=>{this.trackClick(e)},!0),document.addEventListener("dblclick",e=>{this.trackDoubleClick(e)},!0),document.addEventListener("contextmenu",e=>{this.trackRightClick(e)},!0),"ontouchstart"in window&&document.addEventListener("touchstart",e=>{this.trackTouch(e)},!0)}setupFormTracking(){document.addEventListener("submit",e=>{this.trackFormSubmission(e)},!0),document.addEventListener("change",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldChange(e)},!0),document.addEventListener("focus",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldFocus(e)},!0),document.addEventListener("blur",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldBlur(e)},!0)}setupScrollTracking(){let e;document.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(()=>{const e=window.pageYOffset||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,r=Math.round(e/(t-n)*100);r>this.scrollDepth&&(this.scrollDepth=r,this.trackScroll(r,e))},100)},{passive:!0})}setupMouseTracking(){let e,t=[];document.addEventListener("mousemove",n=>{clearTimeout(e),t.push({x:n.clientX,y:n.clientY,timestamp:Date.now()}),t.length>100&&t.shift(),e=setTimeout(()=>{t.length>10&&(this.trackMouseMovement(t),t=[])},1e3)},{passive:!0})}setupKeyboardTracking(){document.addEventListener("keydown",e=>{"password"!==e.target.type&&this.trackKeyStroke(e)},!0)}setupTimeTracking(){setInterval(()=>{this.behaviors.timeOnPage+=1},1e3),window.addEventListener("beforeunload",()=>{this.reportTimeOnPage()})}trackReferrer(){const e=document.referrer;if(e){const t={type:"referrer",url:e,domain:this.extractDomain(e),timestamp:Date.now()};this.behaviors.navigation.push(t),this.reportBehavior("referrer",t)}}trackPageView(){const e={type:"pageview",url:window.location.href,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer};this.behaviors.pageViews.push(e),this.reportBehavior("pageview",e),this.pageStartTime=Date.now(),this.scrollDepth=0}trackClick(e){const t={type:"click",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id,text:e.target.textContent?.substring(0,50),href:e.target.href},position:{x:e.clientX,y:e.clientY,pageX:e.pageX,pageY:e.pageY},timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.clicks.push(t),this.reportBehavior("click",t)}trackDoubleClick(e){const t={type:"doubleclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("doubleclick",t)}trackRightClick(e){const t={type:"rightclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("rightclick",t)}trackTouch(e){const t={type:"touch",touches:Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY,identifier:e.identifier})),timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("touch",t)}trackFormSubmission(e){const t={type:"form_submission",form:{action:e.target.action,method:e.target.method,id:e.target.id,className:e.target.className},fields:this.getFormFields(e.target),timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.formSubmissions.push(t),this.reportBehavior("form_submission",t)}trackFormFieldChange(e){const t={type:"form_field_change",field:{name:e.target.name,type:e.target.type,value:"password"===e.target.type?"***":e.target.value,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_change",t)}trackFormFieldFocus(e){const t={type:"form_field_focus",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_focus",t)}trackFormFieldBlur(e){const t={type:"form_field_blur",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_blur",t)}trackScroll(e,t){const n={type:"scroll",depth:e,scrollTop:t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("scroll",n)}trackMouseMovement(e){const t={type:"mouse_movement",movements:e,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("mouse_movement",t)}trackKeyStroke(e){const t={type:"keystroke",key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("keystroke",t)}handlePageHidden(){this.reportTimeOnPage()}handlePageVisible(){this.pageStartTime=Date.now()}reportTimeOnPage(){const e={type:"time_on_page",time:this.behaviors.timeOnPage,url:window.location.href,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("time_on_page",e)}reportBehavior(e,t){const n={type:e,data:t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.behaviorQueue.push(n),this.behaviorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushBehaviorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("behavior",[n])}reportCustomBehavior(e,t={}){const n={type:"custom_behavior",eventName:e,...t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("custom_behavior",n)}flushBehaviorQueue(){this.behaviorQueue.length>0&&(this.reporter.report("behavior",[...this.behaviorQueue]),this.behaviorQueue=[])}getFormFields(e){const t=[],n=e.elements;for(let e=0;e<n.length;e++){const r=n[e];r.name&&t.push({name:r.name,type:r.type,value:"password"===r.type?"***":r.value})}return t}extractDomain(e){try{return new URL(e).hostname}catch(t){return e}}generateSessionId(){return"session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}getCurrentBehaviors(){return{...this.behaviors}}getSessionId(){return this.sessionId}destroy(){this.flushBehaviorQueue(),this.reportTimeOnPage(),this.isInitialized=!1}}class Tt{constructor(e){this.config=e,this.integratedSDKs={},this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getThirdPartyConfig();e.baidu&&e.baidu.enabled&&this.initBaiduAnalytics(e.baidu),e.umeng&&e.umeng.enabled&&this.initUmengAnalytics(e.umeng),e.sensors&&e.sensors.enabled&&this.initSensorsAnalytics(e.sensors),e.tencent&&e.tencent.enabled&&this.initTencentAnalytics(e.tencent),e.google&&e.google.enabled&&this.initGoogleAnalytics(e.google),e.custom&&e.custom.enabled&&this.initCustomAnalytics(e.custom),this.isInitialized=!0}initBaiduAnalytics(e){try{window._hmt?(this.integratedSDKs.baidu={name:"baidu",instance:window._hmt,config:e},e.siteId&&window._hmt.push(["_setAccount",e.siteId]),!1!==e.autoPageview&&window._hmt.push(["_trackPageview"]),console.log("百度统计集成成功")):console.warn("百度统计未加载,请检查脚本是否正确引入")}catch(e){console.error("百度统计集成失败:",e)}}initUmengAnalytics(e){try{window._um?(this.integratedSDKs.umeng={name:"umeng",instance:window._um,config:e},e.siteId&&window._um.push(["setAccount",e.siteId]),!1!==e.autoPageview&&window._um.push(["trackPageview"]),console.log("友盟统计集成成功")):console.warn("友盟统计未加载,请检查脚本是否正确引入")}catch(e){console.error("友盟统计集成失败:",e)}}initSensorsAnalytics(e){try{window.sensors?(this.integratedSDKs.sensors={name:"sensors",instance:window.sensors,config:e},e.serverUrl&&window.sensors.setServerUrl(e.serverUrl),e.siteId&&window.sensors.setSiteId(e.siteId),!1!==e.autoPageview&&window.sensors.trackPageview(),console.log("神策数据集成成功")):console.warn("神策数据未加载,请检查脚本是否正确引入")}catch(e){console.error("神策数据集成失败:",e)}}initTencentAnalytics(e){try{window.MTA?(this.integratedSDKs.tencent={name:"tencent",instance:window.MTA,config:e},e.appId&&window.MTA.setAppId(e.appId),!1!==e.autoPageview&&window.MTA.trackPageview(),console.log("腾讯云分析集成成功")):console.warn("腾讯云分析未加载,请检查脚本是否正确引入")}catch(e){console.error("腾讯云分析集成失败:",e)}}initGoogleAnalytics(e){try{window.gtag?(this.integratedSDKs.google={name:"google",instance:window.gtag,config:e},e.measurementId&&window.gtag("config",e.measurementId,{page_title:document.title,page_location:window.location.href}),console.log("Google Analytics集成成功")):console.warn("Google Analytics未加载,请检查脚本是否正确引入")}catch(e){console.error("Google Analytics集成失败:",e)}}initCustomAnalytics(e){try{if("function"==typeof e.init){const t=e.init(e);this.integratedSDKs.custom={name:"custom",instance:t,config:e},console.log("自定义第三方集成成功")}else console.warn("自定义第三方配置缺少init函数")}catch(e){console.error("自定义第三方集成失败:",e)}}reportEvent(e,t={}){Object.values(this.integratedSDKs).forEach(n=>{try{this.reportToSDK(n,e,t)}catch(e){console.error(`上报事件到${n.name}失败:`,e)}})}reportPageView(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPageViewToSDK(t,e)}catch(e){console.error(`上报页面浏览到${t.name}失败:`,e)}})}reportUser(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportUserToSDK(t,e)}catch(e){console.error(`上报用户信息到${t.name}失败:`,e)}})}reportPerformance(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPerformanceToSDK(t,e)}catch(e){console.error(`上报性能指标到${t.name}失败:`,e)}})}reportToSDK(e,t,n){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent",t,JSON.stringify(n)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track",t,n]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track(t,n);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat(t,n);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event",t,n);break;case"custom":e.instance&&"function"==typeof e.instance.track&&e.instance.track(t,n);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPageViewToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackPageview",t.url||window.location.href]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["trackPageview",t.url||window.location.href]);break;case"sensors":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t);break;case"tencent":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t.url||window.location.href);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("config",e.config.measurementId,{page_title:t.title||document.title,page_location:t.url||window.location.href});break;case"custom":e.instance&&"function"==typeof e.instance.trackPageview&&e.instance.trackPageview(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportUserToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&(e.instance.push(["_setUserTag","userId",t.userId]),e.instance.push(["_setUserTag","userType",t.userType]));break;case"umeng":e.instance&&e.instance.push&&(e.instance.push(["setUserTag","userId",t.userId]),e.instance.push(["setUserTag","userType",t.userType]));break;case"sensors":e.instance&&e.instance.setProfile&&e.instance.setProfile(t);break;case"tencent":e.instance&&e.instance.setUserInfo&&e.instance.setUserInfo(t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("set","user_id",t.userId);break;case"custom":e.instance&&"function"==typeof e.instance.setUser&&e.instance.setUser(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPerformanceToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent","performance",JSON.stringify(t)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track","performance",t]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track("performance",t);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat("performance",t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event","performance",t);break;case"custom":e.instance&&"function"==typeof e.instance.trackPerformance&&e.instance.trackPerformance(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}isSDKIntegrated(e){return!!this.integratedSDKs[e]}getIntegratedSDKs(){return Object.keys(this.integratedSDKs)}getSDKInstance(e){return this.integratedSDKs[e]?.instance||null}destroy(){Object.values(this.integratedSDKs).forEach(e=>{try{e.instance&&"function"==typeof e.instance.destroy&&e.instance.destroy()}catch(t){console.error(`销毁${e.name}失败:`,t)}}),this.integratedSDKs={},this.isInitialized=!1}}class kt{constructor(e={}){this.config={appId:e.appId||"",appVersion:e.appVersion||"1.0.0",environment:e.environment||"production",reportUrl:e.reportUrl||"",reportInterval:e.reportInterval||5e3,maxQueueSize:e.maxQueueSize||100,enableErrorTracking:!1!==e.enableErrorTracking,enableUnhandledRejection:!1!==e.enableUnhandledRejection,enableResourceError:!1!==e.enableResourceError,enableEventTracking:!1!==e.enableEventTracking,enableClickTracking:!1!==e.enableClickTracking,enablePageViewTracking:!1!==e.enablePageViewTracking,enablePerformanceTracking:!1!==e.enablePerformanceTracking,enableResourceTracking:!1!==e.enableResourceTracking,enableApiTracking:!1!==e.enableApiTracking,enableInteractionTracking:!1!==e.enableInteractionTracking,enableUserInteractionTracking:!1!==e.enableUserInteractionTracking,enableFormTracking:!1!==e.enableFormTracking,enableScrollTracking:!1!==e.enableScrollTracking,enableMouseTracking:!1!==e.enableMouseTracking,enableKeyboardTracking:!1!==e.enableKeyboardTracking,thirdPartyConfig:e.thirdPartyConfig||{},user:e.user||null,customReport:e.customReport||null},this.user=null}updateConfig(e){this.config={...this.config,...e}}setUser(e){this.user=e}getConfig(){return this.config}getUser(){return this.user}getReportUrl(){return this.config.reportUrl}getThirdPartyConfig(){return this.config.thirdPartyConfig}isErrorTrackingEnabled(){return this.config.enableErrorTracking}isEventTrackingEnabled(){return this.config.enableEventTracking}}"undefined"==typeof window||window.axios||(window.axios=gt);class Et{constructor(e={}){this.config=new kt(e),this.errorTracker=new wt(this.config),this.eventTracker=new yt(this.config),this.performanceTracker=new bt(this.config),this.userBehaviorTracker=new vt(this.config),this.thirdPartyIntegrator=new Tt(this.config),this.init()}init(){this.errorTracker.init(),this.eventTracker.init(),this.performanceTracker.init(),this.userBehaviorTracker.init(),this.thirdPartyIntegrator.init(),console.log("Frontend SDK 初始化完成")}reportError(e,t={}){this.errorTracker.reportError(e,t)}reportEvent(e,t={}){this.eventTracker.reportEvent(e,t)}reportPerformance(e={}){this.performanceTracker.reportPerformance(e)}reportBehavior(e,t={}){this.userBehaviorTracker.reportCustomBehavior(e,t)}setUser(e){this.config.setUser(e),this.thirdPartyIntegrator.reportUser(e)}setConfig(e){this.config.updateConfig(e)}getPerformanceMetrics(){return this.performanceTracker.getCurrentMetrics()}getBehaviorData(){return this.userBehaviorTracker.getCurrentBehaviors()}getSessionId(){return this.userBehaviorTracker.getSessionId()}isThirdPartySDKIntegrated(e){return this.thirdPartyIntegrator.isSDKIntegrated(e)}getIntegratedThirdPartySDKs(){return this.thirdPartyIntegrator.getIntegratedSDKs()}destroy(){this.errorTracker.destroy(),this.eventTracker.destroy(),this.performanceTracker.destroy(),this.userBehaviorTracker.destroy(),this.thirdPartyIntegrator.destroy(),console.log("Frontend SDK 已销毁")}}export{Et as default};
2
2
  //# sourceMappingURL=index.esm.js.map