@kivii.com/bridge 1.2.0 → 1.3.0

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.d.ts CHANGED
@@ -19,6 +19,8 @@ declare global {
19
19
  }
20
20
  }
21
21
  export { kivii, Kivii };
22
+ export { IFeature, FEATURE_PROTOCOL_VERSION, createUnsupportedFeatureCall } from './interfaces/IFeature';
23
+ export type { FeatureCall, FeatureCancelReason, FeatureError, FeatureErrorCode, FeatureOpened, FeaturePresentation, FeatureReuse, FeatureResult, FeatureTarget, OpenFeatureRequest, } from './interfaces/IFeature';
22
24
  export { MockRequest } from './modules';
23
25
  export default kivii;
24
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,QAAA,MAAM,KAAK,OAAsB,CAAC;AAWlC;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,KAAK,EAAE,KAAK,CAAC;IAEnB,UAAU,MAAM;QACZ;;WAEG;QACH,KAAK,EAAE,OAAO,KAAK,CAAC;KACvB;CACF;AAGD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,QAAA,MAAM,KAAK,OAAsB,CAAC;AAWlC;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,KAAK,EAAE,KAAK,CAAC;IAEnB,UAAU,MAAM;QACZ;;WAEG;QACH,KAAK,EAAE,OAAO,KAAK,CAAC;KACvB;CACF;AAGD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACzG,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,eAAe,KAAK,CAAC"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Kivii={})}(this,function(e){"use strict";class t{constructor(){this.configs=new Map}init(e){if(e.hooks){d.getInstance().hook.init(e.hooks)}for(const[t,r]of Object.entries(e))"hooks"!==t&&this.set(t,r)}set(e,t){e.includes(".")?this.setNestedValue(e,t):this.configs.set(e,t)}get(e){return e.includes(".")?this.getNestedValue(e):this.configs.get(e)}has(e){return e.includes(".")?void 0!==this.getNestedValue(e):this.configs.has(e)}delete(e){if(e.includes(".")){const t=e.split("."),r=t[0],n=t.slice(1).join(".");if(this.configs.has(r)){const e=this.configs.get(r);if("object"==typeof e&&null!==e)return delete e[n],!0}return!1}return this.configs.delete(e)}clear(){this.configs.clear()}getAll(){const e={};for(const[t,r]of this.configs)e[t]=r;return e}setNestedValue(e,t){const r=e.split("."),n=r[0];let o=this.configs.get(n);o&&"object"==typeof o||(o={},this.configs.set(n,o));let s=o;for(let e=1;e<r.length-1;e++)s[r[e]]&&"object"==typeof s[r[e]]||(s[r[e]]={}),s=s[r[e]];s[r[r.length-1]]=t}getNestedValue(e){const t=e.split("."),r=t[0];let n=this.configs.get(r);for(let e=1;e<t.length;e++){if(!n||"object"!=typeof n||!(t[e]in n))return;n=n[t[e]]}return n}}class r{constructor(){this.interfaceType="IRequest"}async send(e){throw new Error("Method not implemented.")}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}}class n{constructor(){this.interfaceType="ILogger"}debug(e,t){}error(e,t){}info(e,t){}warn(e,t){}}class o{constructor(){this.interfaceType="INavagator"}go(e,t){}push(e,t){}back(){}replace(e,t){}open(e,t){}}class s{constructor(){this.interfaceType="IStorage"}set(e,t){}get(e){return null}remove(e){}clear(){}keys(){return[]}has(e){return!1}}class i{constructor(){this.interfaceType="IDownloader"}async download(e){throw new Error("Method not implemented.")}form(e){throw new Error("Method not implemented.")}}class a{constructor(){this.interfaceType="IHook"}init(e){throw new Error("Method not implemented.")}register(e,t){throw new Error("Method not implemented.")}unregister(e,t){throw new Error("Method not implemented.")}async execute(e,t){throw new Error("Method not implemented.")}has(e){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}}class c{constructor(){this.interfaceType="IOpenTab"}open(e,t){return!1}openPath(e,t){return!1}}function l(e="宿主未提供通用功能调用能力"){const t=function(){const e=Math.random().toString(36).slice(2,10);return`fc-${Date.now().toString(36)}-${e}`}(),r={code:"HOST_UNSUPPORTED",message:e};return{callId:t,opened:Promise.resolve({ok:!1,callId:t,error:r}),result:Promise.resolve({status:"failed",error:r}),cancel(){}}}class u{constructor(){this.interfaceType="IFeature"}invoke(e){return l()}openMenu(e){return l("宿主未提供通用功能调用能力")}}class d{constructor(){this._privateVariables=new Map,this._config=new t,this._navigator=new o,this._logger=new n,this._request=new r,this._downloader=new i,this._storage=new s,this._hook=new a,this._openTab=new c,this._features=new u}get privateVariables(){if(0===this._privateVariables.size)for(const e of Object.keys(this))if(e.startsWith("_")){const t=this[e];"interfaceType"in t&&this._privateVariables.set(t.interfaceType,t)}return this._privateVariables}get config(){return this._config}get navigator(){return this.privateVariables.get(this._navigator.interfaceType)||this._navigator}get logger(){return this.privateVariables.get(this._logger.interfaceType)||this._logger}get request(){return this.privateVariables.get(this._request.interfaceType)||this._request}get downloader(){return this.privateVariables.get(this._downloader.interfaceType)||this._downloader}get storage(){return this.privateVariables.get(this._storage.interfaceType)||this._storage}get hook(){return this.privateVariables.get(this._hook.interfaceType)||this._hook}get openTab(){return this.privateVariables.get(this._openTab.interfaceType)||this._openTab}get features(){return this.privateVariables.get(this._features.interfaceType)||this._features}register(e){if(!("interfaceType"in e))return void this.logger.warn("无法注入实例:实例必须包含 interfaceType 属性");const t=e.interfaceType;this._privateVariables.set(t,e),this.logger.info(`成功注入实例:${t}`)}tryResolve(e){return this.privateVariables.get(e)}static getInstance(){return d._instance||(d._instance=new d),d._instance}}function h(e,t){return function(){return e.apply(t,arguments)}}const{toString:f}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:m,toStringTag:g}=Symbol,y=(b=Object.create(null),e=>{const t=f.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())});var b;const w=e=>(e=e.toLowerCase(),t=>y(t)===e),E=e=>t=>typeof t===e,{isArray:v}=Array,O=E("undefined");function S(e){return null!==e&&!O(e)&&null!==e.constructor&&!O(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const T=w("ArrayBuffer");const R=E("string"),A=E("function"),x=E("number"),k=e=>null!==e&&"object"==typeof e,j=e=>{if("object"!==y(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||g in e||m in e)},_=w("Date"),N=w("File"),P=w("Blob"),C=w("FileList"),U=w("URLSearchParams"),[L,D,F,I]=["ReadableStream","Request","Response","Headers"].map(w);function B(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),v(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(S(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function q(e,t){if(S(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,V=e=>!O(e)&&e!==M;const H=(z="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>z&&e instanceof z);var z;const $=w("HTMLFormElement"),J=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),W=w("RegExp"),K=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};B(r,(r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)}),Object.defineProperties(e,n)};const G=w("AsyncFunction"),X=(Q="function"==typeof setImmediate,Z=A(M.postMessage),Q?setImmediate:Z?(Y=`axios@${Math.random()}`,ee=[],M.addEventListener("message",({source:e,data:t})=>{e===M&&t===Y&&ee.length&&ee.shift()()},!1),e=>{ee.push(e),M.postMessage(Y,"*")}):e=>setTimeout(e));var Q,Z,Y,ee;const te="undefined"!=typeof queueMicrotask?queueMicrotask.bind(M):"undefined"!=typeof process&&process.nextTick||X;var re={isArray:v,isArrayBuffer:T,isBuffer:S,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||A(e.append)&&("formdata"===(t=y(e))||"object"===t&&A(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&T(e.buffer),t},isString:R,isNumber:x,isBoolean:e=>!0===e||!1===e,isObject:k,isPlainObject:j,isEmptyObject:e=>{if(!k(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:L,isRequest:D,isResponse:F,isHeaders:I,isUndefined:O,isDate:_,isFile:N,isBlob:P,isRegExp:W,isFunction:A,isStream:e=>k(e)&&A(e.pipe),isURLSearchParams:U,isTypedArray:H,isFileList:C,forEach:B,merge:function e(){const{caseless:t,skipUndefined:r}=V(this)&&this||{},n={},o=(o,s)=>{const i=t&&q(n,s)||s;j(n[i])&&j(o)?n[i]=e(n[i],o):j(o)?n[i]=e({},o):v(o)?n[i]=o.slice():r&&O(o)||(n[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&B(arguments[e],o);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(B(t,(t,n)=>{r&&A(t)?e[n]=h(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&p(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:y,kindOfTest:w,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(v(e))return e;let t=e.length;if(!x(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[m]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:$,hasOwnProperty:J,hasOwnProp:J,reduceDescriptors:K,freezeMethods:e=>{K(e,(t,r)=>{if(A(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];A(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return v(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:q,global:M,isContextDefined:V,isSpecCompliantForm:function(e){return!!(e&&A(e.append)&&"FormData"===e[g]&&e[m])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(k(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[n]=e;const o=v(e)?[]:{};return B(e,(e,t)=>{const s=r(e,n+1);!O(s)&&(o[t]=s)}),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:G,isThenable:e=>e&&(k(e)||A(e))&&A(e.then)&&A(e.catch),setImmediate:X,asap:te,isIterable:e=>null!=e&&A(e[m])};function ne(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}re.inherits(ne,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:re.toJSONObject(this.config),code:this.code,status:this.status}}});const oe=ne.prototype,se={};["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=>{se[e]={value:e}}),Object.defineProperties(ne,se),Object.defineProperty(oe,"isAxiosError",{value:!0}),ne.from=(e,t,r,n,o,s)=>{const i=Object.create(oe);re.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return ne.call(i,a,c,r,n,o),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",s&&Object.assign(i,s),i};function ie(e){return re.isPlainObject(e)||re.isArray(e)}function ae(e){return re.endsWith(e,"[]")?e.slice(0,-2):e}function ce(e,t,r){return e?e.concat(t).map(function(e,t){return e=ae(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const le=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function ue(e,t,r){if(!re.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=re.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!re.isUndefined(t[e])})).metaTokens,o=r.visitor||l,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&re.isSpecCompliantForm(t);if(!re.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(re.isDate(e))return e.toISOString();if(re.isBoolean(e))return e.toString();if(!a&&re.isBlob(e))throw new ne("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(e)||re.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(re.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(re.isArray(e)&&function(e){return re.isArray(e)&&!e.some(ie)}(e)||(re.isFileList(e)||re.endsWith(r,"[]"))&&(a=re.toArray(e)))return r=ae(r),a.forEach(function(e,n){!re.isUndefined(e)&&null!==e&&t.append(!0===i?ce([r],n,s):null===i?r:r+"[]",c(e))}),!1;return!!ie(e)||(t.append(ce(o,r,s),c(e)),!1)}const u=[],d=Object.assign(le,{defaultVisitor:l,convertValue:c,isVisitable:ie});if(!re.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!re.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),re.forEach(r,function(r,s){!0===(!(re.isUndefined(r)||null===r)&&o.call(t,r,re.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])}),u.pop()}}(e),t}function de(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function he(e,t){this._pairs=[],e&&ue(e,this,t)}const fe=he.prototype;function pe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function me(e,t,r){if(!t)return e;const n=r&&r.encode||pe;re.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(s=o?o(t,r):re.isURLSearchParams(t)?t.toString():new he(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}fe.append=function(e,t){this._pairs.push([e,t])},fe.toString=function(e){const t=e?function(t){return e.call(this,t,de)}:de;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class ge{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(t){null!==t&&e(t)})}}var ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:he,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const we="undefined"!=typeof window&&"undefined"!=typeof document,Ee="object"==typeof navigator&&navigator||void 0,ve=we&&(!Ee||["ReactNative","NativeScript","NS"].indexOf(Ee.product)<0),Oe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Se=we&&window.location.href||"http://localhost";var Te={...Object.freeze({__proto__:null,hasBrowserEnv:we,hasStandardBrowserEnv:ve,hasStandardBrowserWebWorkerEnv:Oe,navigator:Ee,origin:Se}),...be};function Re(e){function t(e,r,n,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&re.isArray(n)?n.length:s,a)return re.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&re.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&re.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(re.isFormData(e)&&re.isFunction(e.entries)){const r={};return re.forEachEntry(e,(e,n)=>{t(function(e){return re.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Ae={transitional:ye,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=re.isObject(e);o&&re.isHTMLForm(e)&&(e=new FormData(e));if(re.isFormData(e))return n?JSON.stringify(Re(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ue(e,new Te.classes.URLSearchParams,{visitor:function(e,t,r,n){return Te.isNode&&re.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ue(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(re.isString(e))try{return(t||JSON.parse)(e),re.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ae.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw ne.from(e,ne.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:Te.classes.FormData,Blob:Te.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],e=>{Ae.headers[e]={}});const xe=re.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 ke=Symbol("internals");function je(e){return e&&String(e).trim().toLowerCase()}function _e(e){return!1===e||null==e?e:re.isArray(e)?e.map(_e):String(e)}function Ne(e,t,r,n,o){return re.isFunction(n)?n.call(this,t,r):(o&&(t=r),re.isString(t)?re.isString(n)?-1!==t.indexOf(n):re.isRegExp(n)?n.test(t):void 0:void 0)}let Pe=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=je(t);if(!o)throw new Error("header name must be a non-empty string");const s=re.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=_e(e))}const s=(e,t)=>re.forEach(e,(e,r)=>o(e,r,t));if(re.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(re.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&xe[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(re.isObject(e)&&re.isIterable(e)){let r,n,o={};for(const t of e){if(!re.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[n=t[0]]=(r=o[n])?re.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,r);return this}get(e,t){if(e=je(e)){const r=re.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(re.isFunction(t))return t.call(this,e,r);if(re.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=je(e)){const r=re.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ne(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=je(e)){const o=re.findKey(r,e);!o||t&&!Ne(0,r[o],o,t)||(delete r[o],n=!0)}}return re.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!Ne(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return re.forEach(this,(n,o)=>{const s=re.findKey(r,o);if(s)return t[s]=_e(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(o):String(o).trim();i!==o&&delete t[o],t[i]=_e(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return re.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&re.isArray(r)?r.join(", "):r)}),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 r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[ke]=this[ke]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=je(e);t[n]||(!function(e,t){const r=re.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})})}(r,e),t[n]=!0)}return re.isArray(e)?e.forEach(n):n(e),this}};function Ce(e,t){const r=this||Ae,n=t||r,o=Pe.from(n.headers);let s=n.data;return re.forEach(e,function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Ue(e){return!(!e||!e.__CANCEL__)}function Le(e,t,r){ne.call(this,null==e?"canceled":e,ne.ERR_CANCELED,t,r),this.name="CanceledError"}function De(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ne("Request failed with status code "+r.status,[ne.ERR_BAD_REQUEST,ne.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}Pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(Pe.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),re.freezeMethods(Pe),re.inherits(Le,ne,{__CANCEL__:!0});const Fe=(e,t,r=3)=>{let n=0;const o=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];o||(o=c),r[s]=a,n[s]=c;let u=i,d=0;for(;u!==s;)d+=r[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const h=l&&c-l;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let r,n,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},s-a)))},()=>r&&i(r)]}(r=>{const s=r.loaded,i=r.lengthComputable?r.total:void 0,a=s-n,c=o(a);n=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},Ie=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Be=e=>(...t)=>re.asap(()=>e(...t));var qe=Te.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Te.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Te.origin),Te.navigator&&/(msie|trident)/i.test(Te.navigator.userAgent)):()=>!0,Me=Te.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];re.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),re.isString(n)&&i.push("path="+n),re.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const He=e=>e instanceof Pe?{...e}:e;function ze(e,t){t=t||{};const r={};function n(e,t,r,n){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge.call({caseless:n},e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function o(e,t,r,o){return re.isUndefined(t)?re.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function s(e,t){if(!re.isUndefined(t))return n(void 0,t)}function i(e,t){return re.isUndefined(t)?re.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>o(He(e),He(t),0,!0)};return re.forEach(Object.keys({...e,...t}),function(n){const s=c[n]||o,i=s(e[n],t[n],n);re.isUndefined(i)&&s!==a||(r[n]=i)}),r}var $e=e=>{const t=ze({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=Pe.from(i),t.url=me(Ve(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),re.isFormData(r))if(Te.hasStandardBrowserEnv||Te.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(re.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Te.hasStandardBrowserEnv&&(n&&re.isFunction(n)&&(n=n(t)),n||!1!==n&&qe(t.url))){const e=o&&s&&Me.read(s);e&&i.set(o,e)}return t};var Je="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=$e(e);let o=n.data;const s=Pe.from(n.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:h,onDownloadProgress:f}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const n=Pe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());De(function(e){t(e),p()},function(e){r(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new ne("Request aborted",ne.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new ne(t&&t.message?t.message:"Network Error",ne.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||ye;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ne(t,o.clarifyTimeoutError?ne.ETIMEDOUT:ne.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&re.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),re.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),f&&([c,u]=Fe(f,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,l]=Fe(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new Le(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);y&&-1===Te.protocols.indexOf(y)?r(new ne("Unsupported protocol "+y+":",ne.ERR_BAD_REQUEST,e)):m.send(o||null)})};const We=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const o=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ne?t:new Le(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new ne(`timeout ${t} of ms exceeded`,ne.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=n;return a.unsubscribe=()=>re.asap(i),a}},Ke=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,o=0;for(;o<r;)n=o+t,yield e.slice(o,n),o=n},Ge=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Xe=(e,t,r,n)=>{const o=async function*(e,t){for await(const r of Ge(e))yield*Ke(r,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=i+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Qe}=re,Ze=(({Request:e,Response:t})=>({Request:e,Response:t}))(re.global),{ReadableStream:Ye,TextEncoder:et}=re.global,tt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},rt=e=>{e=re.merge.call({skipUndefined:!0},Ze,e);const{fetch:t,Request:r,Response:n}=e,o=t?Qe(t):"function"==typeof fetch,s=Qe(r),i=Qe(n);if(!o)return!1;const a=o&&Qe(Ye),c=o&&("function"==typeof et?(l=new et,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=s&&a&&tt(()=>{let e=!1;const t=new r(Te.origin,{body:new Ye,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&tt(()=>re.isReadableStream(new n("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new ne(`Response type '${e}' is not supported`,ne.ERR_NOT_SUPPORT,r)})});const f=async(e,t)=>{const n=re.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(re.isBlob(e))return e.size;if(re.isSpecCompliantForm(e)){const t=new r(Te.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return re.isArrayBufferView(e)||re.isArrayBuffer(e)?e.byteLength:(re.isURLSearchParams(e)&&(e+=""),re.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:o,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:E}=$e(e),v=t||fetch;y=y?(y+"").toLowerCase():"text";let O=We([c,l&&l.toAbortSignal()],p),S=null;const T=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let R;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(R=await f(b,a))){let e,t=new r(o,{method:"POST",body:a,duplex:"half"});if(re.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=Ie(R,Fe(Be(g)));a=Xe(t.body,65536,e,r)}}re.isString(w)||(w=w?"include":"omit");const t=s&&"credentials"in r.prototype,c={...E,signal:O,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};S=s&&new r(o,c);let l=await(s?v(S,E):v(o,c));const p=d&&("stream"===y||"response"===y);if(d&&(m||p&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=re.toFiniteNumber(l.headers.get("content-length")),[r,o]=m&&Ie(t,Fe(Be(m),!0))||[];l=new n(Xe(l.body,65536,r,()=>{o&&o(),T&&T()}),e)}y=y||"text";let A=await h[re.findKey(h,y)||"text"](l,e);return!p&&T&&T(),await new Promise((t,r)=>{De(t,r,{data:A,headers:Pe.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ne("Network Error",ne.ERR_NETWORK,e,S),{cause:t.cause||t});throw ne.from(t,t&&t.code,e,S)}}},nt=new Map,ot=e=>{let t=e?e.env:{};const{fetch:r,Request:n,Response:o}=t,s=[n,o,r];let i,a,c=s.length,l=nt;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:rt(t)),l=a;return a};ot();const st={http:null,xhr:Je,fetch:{get:ot}};re.forEach(st,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const it=e=>`- ${e}`,at=e=>re.isFunction(e)||null===e||!1===e;var ct=(e,t)=>{e=re.isArray(e)?e:[e];const{length:r}=e;let n,o;const s={};for(let i=0;i<r;i++){let r;if(n=e[i],o=n,!at(n)&&(o=st[(r=String(n)).toLowerCase()],void 0===o))throw new ne(`Unknown adapter '${r}'`);if(o&&(re.isFunction(o)||(o=o.get(t))))break;s[r||"#"+i]=o}if(!o){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ne("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(it).join("\n"):" "+it(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function lt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Le(null,e)}function ut(e){lt(e),e.headers=Pe.from(e.headers),e.data=Ce.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ct(e.adapter||Ae.adapter,e)(e).then(function(t){return lt(e),t.data=Ce.call(e,e.transformResponse,t),t.headers=Pe.from(t.headers),t},function(t){return Ue(t)||(lt(e),t&&t.response&&(t.response.data=Ce.call(e,e.transformResponse,t.response),t.response.headers=Pe.from(t.response.headers))),Promise.reject(t)})}const dt="1.12.2",ht={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ht[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ft={};ht.transitional=function(e,t,r){function n(e,t){return"[Axios v"+dt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new ne(n(o," has been removed"+(t?" in "+t:"")),ne.ERR_DEPRECATED);return t&&!ft[o]&&(ft[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}},ht.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var pt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ne("options must be an object",ne.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new ne("option "+s+" must be "+r,ne.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ne("Unknown option "+s,ne.ERR_BAD_OPTION)}},validators:ht};const mt=pt.validators;let gt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ge,response:new ge}}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 r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ze(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;void 0!==r&&pt.assertOptions(r,{silentJSONParsing:mt.transitional(mt.boolean),forcedJSONParsing:mt.transitional(mt.boolean),clarifyTimeoutError:mt.transitional(mt.boolean)},!1),null!=n&&(re.isFunction(n)?t.paramsSerializer={serialize:n}:pt.assertOptions(n,{encode:mt.function,serialize:mt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pt.assertOptions(t,{baseUrl:mt.spelling("baseURL"),withXsrfToken:mt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&re.merge(o.common,o[t.method]);o&&re.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Pe.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[ut.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let h=t;for(;d<u;){const e=i[d++],t=i[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{l=ut.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return me(Ve((e=ze(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){gt.prototype[e]=function(t,r){return this.request(ze(r||{},{method:e,url:t,data:(r||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,o){return this.request(ze(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}gt.prototype[e]=t(),gt.prototype[e+"Form"]=t(!0)});const yt={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(yt).forEach(([e,t])=>{yt[t]=e});const bt=function e(t){const r=new gt(t),n=h(gt.prototype.request,r);return re.extend(n,gt.prototype,r,{allOwnKeys:!0}),re.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ze(t,r))},n}(Ae);bt.Axios=gt,bt.CanceledError=Le,bt.CancelToken=class e{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 r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,o){r.reason||(r.reason=new Le(e,n,o),t(r.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 t;return{token:new e(function(e){t=e}),cancel:t}}},bt.isCancel=Ue,bt.VERSION=dt,bt.toFormData=ue,bt.AxiosError=ne,bt.Cancel=bt.CanceledError,bt.all=function(e){return Promise.all(e)},bt.spread=function(e){return function(t){return e.apply(null,t)}},bt.isAxiosError=function(e){return re.isObject(e)&&!0===e.isAxiosError},bt.mergeConfig=ze,bt.AxiosHeaders=Pe,bt.formToJSON=e=>Re(re.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=ct,bt.HttpStatusCode=yt,bt.default=bt;const{Axios:wt,AxiosError:Et,CanceledError:vt,isCancel:Ot,CancelToken:St,VERSION:Tt,all:Rt,Cancel:At,isAxiosError:xt,spread:kt,toFormData:jt,AxiosHeaders:_t,HttpStatusCode:Nt,formToJSON:Pt,getAdapter:Ct,mergeConfig:Ut}=bt;const Lt=d.getInstance();Lt.register(new class extends n{debug(e,t){this.isLogEnabled()&&console.log(`[DEBUG] ${e}`,t||"")}error(e,t){this.isLogEnabled()&&console.error(`[ERROR] ${e}`,t||"")}info(e,t){this.isLogEnabled()&&console.info(`[INFO] ${e}`,t||"")}warn(e,t){this.isLogEnabled()&&console.warn(`[WARN] ${e}`,t||"")}isLogEnabled(){return!1!==d.getInstance().config.get("logger.enabled")}}),Lt.register(new class extends r{constructor(){super(...arguments),this.interceptorsSetup=!1}get axiosInstance(){return this._axiosInstance||(this._axiosInstance=bt.create()),this._axiosInstance}async send(e){const t=d.getInstance(),r=t.config;this.interceptorsSetup||(this.setupInterceptors(),this.interceptorsSetup=!0);try{let n={...this.getDefaultConfig(r),...this.convertToAxiosConfig(e)};const o=(e.method||"GET").toUpperCase();n=await t.hook.execute(`request.before.method:${o}`,n),n=await t.hook.execute("request.before",n);const s=await this.axiosInstance.request(n);let i=this.convertResponse(s);return i=await t.hook.execute(`request.response.status:${s.status}`,i),i=await t.hook.execute("request.response",i),i}catch(e){let r=this.handleError(e);throw e.response&&(r=await t.hook.execute(`request.error.status:${e.response.status}`,r)),r=await t.hook.execute("request.error",r),r}}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>e,e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,e=>Promise.reject(e))}getDefaultConfig(e){const t={},r=e.get("request.baseURL");r&&(t.baseURL=r);const n=e.get("request.timeout");n&&(t.timeout=n);const o=e.get("request.headers");return o&&(t.headers=o),t}convertToAxiosConfig(e){const t={url:e.url,method:e.method||"GET"};return void 0!==e.timeout&&(t.timeout=e.timeout),e.responseType&&(t.responseType=e.responseType),e.header&&Object.keys(e.header).length>0&&(t.headers=e.header),e.params&&Object.keys(e.params).length>0&&(t.params=e.params),e.data&&Object.keys(e.data).length>0&&(t.data=e.data),e.onDownloadProgress&&(t.onDownloadProgress=e.onDownloadProgress),t}convertResponse(e){const t=e.headers&&"object"==typeof e.headers?{...e.headers}:e.headers;return{data:e.data,status:e.status,statusText:e.statusText,headers:t,config:{url:e.config.url,method:e.config.method,timeout:e.config.timeout}}}handleError(e){if(e.response){const{status:t,statusText:r,data:n,headers:o,config:s}=e.response,i=new Error(`请求失败: ${t} ${r}`);return i.status=t,i.statusText=r,i.data=n,i.headers=o&&"object"==typeof o?{...o}:o,i.config={url:null==s?void 0:s.url,method:null==s?void 0:s.method,timeout:null==s?void 0:s.timeout},i}if(e.request){const t=new Error("网络请求超时或无法连接到服务器");return t.request=e.request,t}return new Error(`请求配置错误: ${e.message}`)}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}}),Lt.register(new class extends s{getNestedValue(e,t){return t.reduce((e,t)=>null==e?void 0:e[t],e)}setNestedValue(e,t,r){const n=t[t.length-1];t.slice(0,-1).reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[n]=r}deleteNestedValue(e,t){if(0===t.length)return!1;const r=t[t.length-1],n=t.slice(0,-1),o=this.getNestedValue(e,n);return!(!o||"object"!=typeof o||!(r in o))&&(delete o[r],!0)}set(e,t){const r=e.split(".");if(1===r.length)localStorage.setItem(e,JSON.stringify(t));else{const e=r[0],n=localStorage.getItem(e);let o;try{o=n?JSON.parse(n):{},("object"!=typeof o||null===o||Array.isArray(o))&&(o={})}catch(e){o={}}this.setNestedValue(o,r.slice(1),t),localStorage.setItem(e,JSON.stringify(o))}}get(e){if(!e){const e={};for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);if(r)try{e[r]=JSON.parse(localStorage.getItem(r))}catch(t){e[r]=localStorage.getItem(r)}}return e}const t=e.split("."),r=t[0],n=localStorage.getItem(r);if(!n)return null;try{const e=JSON.parse(n);return 1===t.length?e:this.getNestedValue(e,t.slice(1))}catch(e){return n}}remove(e){const t=e.split(".");if(1===t.length)localStorage.removeItem(e);else{const e=t[0],r=localStorage.getItem(e);if(r)try{const n=JSON.parse(r);this.deleteNestedValue(n,t.slice(1))&&localStorage.setItem(e,JSON.stringify(n))}catch(e){}}}clear(){localStorage.clear()}keys(){return Object.keys(localStorage)}has(e){const t=e.split("."),r=t[0],n=localStorage.getItem(r);if(!n)return!1;if(1===t.length)return!0;try{const e=JSON.parse(n);return void 0!==this.getNestedValue(e,t.slice(1))}catch(e){return!1}}}),Lt.register(new class extends i{form(e){var t;const r=d.getInstance().config.get("request.baseURL");try{let n=e.url;if(r&&!e.url.startsWith("http://")&&!e.url.startsWith("https://")){const t=r.endsWith("/")||e.url.startsWith("/")?"":"/";n=r+t+e.url}const o=document.createElement("form");if(o.method=e.method||"POST",o.action=n,o.style.display="none",null===(t=e.header)||void 0===t?void 0:t.Authorization){const t=document.createElement("a");t.href=n;const r=new URLSearchParams(t.search);r.set("Authorization",e.header.Authorization),t.search=r.toString(),o.action=t.href}if(e.params){const t=document.createElement("a");t.href=o.action;const r=new URLSearchParams(t.search);Object.entries(e.params).forEach(([e,t])=>{r.set(e,String(t))}),t.search=r.toString(),o.action=t.href}if(e.data&&Object.entries(e.data).forEach(([e,t])=>{const r=document.createElement("input");r.type="hidden",r.name=e,r.value=String(t),o.appendChild(r)}),document.body.appendChild(o),o.submit(),document.body.removeChild(o),e.onSuccess){const t={filename:"Unknown",size:0,type:"application/octet-stream",duration:0,blob:new Blob,url:n,autoDownloaded:!0};e.onSuccess(t)}}catch(t){const r=new Error(`Form download failed: ${t.message}`);throw e.onError&&e.onError(r),r}}async download(e){const t=d.getInstance().request,r=Date.now();try{const n=await t.send({url:e.url,method:e.method||"GET",header:e.header,params:e.params,data:e.data,timeout:e.timeout,responseType:"blob",onDownloadProgress:t=>{if(e.onProgress&&t.total>0){const n=this.calculateProgress(t,r);e.onProgress(n)}}});let o;if(console.log(n.headers),n.data instanceof Blob)o=n.data;else if(n.data instanceof ArrayBuffer){const e=n.headers["content-type"]||"application/octet-stream";o=new Blob([n.data],{type:e})}else{const e=n.headers["content-type"]||"application/octet-stream";o=new Blob([n.data],{type:e})}const s=this.extractFilename(e.filename,n.headers,e.url),i=o.type||"application/octet-stream",a=o.size,c={filename:s,size:a,type:i,duration:Date.now()-r,blob:o,url:e.url};if(!1!==e.autoDownload){const t=e.downloadMethod||"both",r=this.createDownloadLink(c,t);c.downloadUrl=r.url,c.autoDownloaded=r.triggered}return e.onSuccess&&e.onSuccess(c),c}catch(t){let r;throw r=t.response?new Error(`Download failed: ${t.response.status} ${t.response.statusText}`):t.request?new Error("Network timeout or unable to connect to server"):new Error(`Download configuration error: ${t.message}`),e.onError&&e.onError(r),r}}calculateProgress(e,t){const r=e.loaded,n=e.total,o=n>0?Math.round(r/n*100):0,s=(Date.now()-t)/1e3,i=s>0?r/s:0;return{loaded:r,total:n,percentage:o,speed:i,remainingTime:i>0?(n-r)/i:0}}extractFilename(e,t,r){if(e)return e;const n=(null==t?void 0:t["content-disposition"])||(null==t?void 0:t["Content-Disposition"]);if(n){const e=n.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1])return e[1].replace(/['"]/g,"")}if(r)try{let e;e=r.startsWith("http://")||r.startsWith("https://")?new URL(r).pathname:r;const t=e.split("/").pop();if(t&&t.includes("."))return t}catch(e){const t=r.split("/").pop();if(t&&t.includes("."))return t}return`download_${Date.now()}`}createDownloadLink(e,t){try{if(!(e.blob&&e.blob instanceof Blob))throw new Error("Invalid blob data for download");if(0===e.blob.size)throw new Error("Empty blob data");const r=URL.createObjectURL(e.blob);let n=!1;return"link"!==t&&"both"!==t||(this.triggerDownload(r,e.filename),n=!0),{url:r,triggered:n}}catch(e){return console.error("Failed to create download link:",e),{url:"",triggered:!1}}}triggerDownload(e,t){try{const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>{URL.revokeObjectURL(e)},1e3)}catch(e){console.error("Failed to trigger download:",e)}}}),Lt.register(new class extends a{constructor(){super(...arguments),this.interfaceType="IHook",this.registry=new Map}init(e){for(const[t,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>this.register(t,e)):this.register(t,r)}register(e,t){if(!this.isValidHookKey(e))return void this.logWarning(`Invalid hook key: ${e}`);if("function"!=typeof t)return void this.logWarning(`Handler must be a function for hook key: ${e}`);const r=this.registry.get(e)||[];r.push(t),this.registry.set(e,r)}unregister(e,t){if(!t)return void this.registry.delete(e);const r=this.registry.get(e);if(r){const n=r.indexOf(t);n>-1&&r.splice(n,1),0===r.length&&this.registry.delete(e)}}async execute(e,t){const r=this.findMatchingHandlers(e,t);if(0===r.length)return t;let n=t;for(const o of r)try{const e=o(n);n=e instanceof Promise?await e:e,void 0===n&&(n=t)}catch(t){this.logError(`Error executing hook ${e}:`,t)}return n}has(e){return this.registry.has(e)&&this.registry.get(e).length>0}clear(){this.registry.clear()}findMatchingHandlers(e,t){const r=[];for(const[n,o]of this.registry)this.isKeyMatch(n,e,t)&&r.push(...o);return r}isKeyMatch(e,t,r){if(e===t)return!0;const[n,o]=this.parseHookKey(e),[s,i]=this.parseHookKey(t);return n===s&&(!o||!!i&&o.value===i.value)}parseHookKey(e){const t=e.lastIndexOf(":");if(-1===t)return[e,null];const r=e.substring(0,t),n=e.substring(t+1),o=r.split(".");return[r,{field:o[o.length-1],value:n}]}isValidHookKey(e){return"string"==typeof e&&e.length>0}logWarning(e){d.getInstance().logger.warn(`[Hook] ${e}`)}logError(e,t){d.getInstance().logger.error(`[Hook] ${e}`,t)}}),"undefined"!=typeof window&&(window.kivii=Lt),e.Kivii=d,e.MockRequest=class extends r{async send(e){const t=d.getInstance().config.get("mock");if(!t)throw new Error("Mock data not configured");const r=e.url||"",n=r.split("/").filter(e=>e&&""!==e);let o=t;for(const t of n){if(!o||"object"!=typeof o||!(t in o)){o=void 0;break}o="function"==typeof o[t]?o[t]({method:e.method,params:e.params,data:e.data}):o[t]}if(void 0===o)throw new Error(`Mock data not found for URL: ${r}`);return{data:o,status:200,statusText:"OK",headers:{},config:e}}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}},e.default=Lt,e.kivii=Lt,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Kivii={})}(this,function(e){"use strict";class t{constructor(){this.configs=new Map}init(e){if(e.hooks){d.getInstance().hook.init(e.hooks)}for(const[t,r]of Object.entries(e))"hooks"!==t&&this.set(t,r)}set(e,t){e.includes(".")?this.setNestedValue(e,t):this.configs.set(e,t)}get(e){return e.includes(".")?this.getNestedValue(e):this.configs.get(e)}has(e){return e.includes(".")?void 0!==this.getNestedValue(e):this.configs.has(e)}delete(e){if(e.includes(".")){const t=e.split("."),r=t[0],n=t.slice(1).join(".");if(this.configs.has(r)){const e=this.configs.get(r);if("object"==typeof e&&null!==e)return delete e[n],!0}return!1}return this.configs.delete(e)}clear(){this.configs.clear()}getAll(){const e={};for(const[t,r]of this.configs)e[t]=r;return e}setNestedValue(e,t){const r=e.split("."),n=r[0];let o=this.configs.get(n);o&&"object"==typeof o||(o={},this.configs.set(n,o));let s=o;for(let e=1;e<r.length-1;e++)s[r[e]]&&"object"==typeof s[r[e]]||(s[r[e]]={}),s=s[r[e]];s[r[r.length-1]]=t}getNestedValue(e){const t=e.split("."),r=t[0];let n=this.configs.get(r);for(let e=1;e<t.length;e++){if(!n||"object"!=typeof n||!(t[e]in n))return;n=n[t[e]]}return n}}class r{constructor(){this.interfaceType="IRequest"}async send(e){throw new Error("Method not implemented.")}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}}class n{constructor(){this.interfaceType="ILogger"}debug(e,t){}error(e,t){}info(e,t){}warn(e,t){}}class o{constructor(){this.interfaceType="INavagator"}go(e,t){}push(e,t){}back(){}replace(e,t){}open(e,t){}}class s{constructor(){this.interfaceType="IStorage"}set(e,t){}get(e){return null}remove(e){}clear(){}keys(){return[]}has(e){return!1}}class i{constructor(){this.interfaceType="IDownloader"}async download(e){throw new Error("Method not implemented.")}form(e){throw new Error("Method not implemented.")}}class a{constructor(){this.interfaceType="IHook"}init(e){throw new Error("Method not implemented.")}register(e,t){throw new Error("Method not implemented.")}unregister(e,t){throw new Error("Method not implemented.")}async execute(e,t){throw new Error("Method not implemented.")}has(e){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}}class c{constructor(){this.interfaceType="IOpenTab"}open(e,t){return!1}openPath(e,t){return!1}}function l(e="宿主未提供通用功能调用能力"){const t=function(){const e=Math.random().toString(36).slice(2,10);return`fc-${Date.now().toString(36)}-${e}`}(),r={code:"HOST_UNSUPPORTED",message:e};return{callId:t,opened:Promise.resolve({ok:!1,callId:t,error:r}),result:Promise.resolve({status:"failed",error:r}),cancel(){}}}class u{constructor(){this.interfaceType="IFeature"}invoke(e){return l()}openMenu(e){return l("宿主未提供通用功能调用能力")}}class d{constructor(){this._privateVariables=new Map,this._config=new t,this._navigator=new o,this._logger=new n,this._request=new r,this._downloader=new i,this._storage=new s,this._hook=new a,this._openTab=new c,this._features=new u}get privateVariables(){if(0===this._privateVariables.size)for(const e of Object.keys(this))if(e.startsWith("_")){const t=this[e];"interfaceType"in t&&this._privateVariables.set(t.interfaceType,t)}return this._privateVariables}get config(){return this._config}get navigator(){return this.privateVariables.get(this._navigator.interfaceType)||this._navigator}get logger(){return this.privateVariables.get(this._logger.interfaceType)||this._logger}get request(){return this.privateVariables.get(this._request.interfaceType)||this._request}get downloader(){return this.privateVariables.get(this._downloader.interfaceType)||this._downloader}get storage(){return this.privateVariables.get(this._storage.interfaceType)||this._storage}get hook(){return this.privateVariables.get(this._hook.interfaceType)||this._hook}get openTab(){return this.privateVariables.get(this._openTab.interfaceType)||this._openTab}get features(){return this.privateVariables.get(this._features.interfaceType)||this._features}register(e){if(!("interfaceType"in e))return void this.logger.warn("无法注入实例:实例必须包含 interfaceType 属性");const t=e.interfaceType;this._privateVariables.set(t,e),this.logger.info(`成功注入实例:${t}`)}tryResolve(e){return this.privateVariables.get(e)}static getInstance(){return d._instance||(d._instance=new d),d._instance}}function h(e,t){return function(){return e.apply(t,arguments)}}const{toString:f}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:m,toStringTag:g}=Symbol,y=(b=Object.create(null),e=>{const t=f.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())});var b;const w=e=>(e=e.toLowerCase(),t=>y(t)===e),E=e=>t=>typeof t===e,{isArray:v}=Array,O=E("undefined");function S(e){return null!==e&&!O(e)&&null!==e.constructor&&!O(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const T=w("ArrayBuffer");const R=E("string"),A=E("function"),x=E("number"),k=e=>null!==e&&"object"==typeof e,j=e=>{if("object"!==y(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||g in e||m in e)},_=w("Date"),N=w("File"),C=w("Blob"),P=w("FileList"),U=w("URLSearchParams"),[L,D,F,I]=["ReadableStream","Request","Response","Headers"].map(w);function B(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),v(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(S(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function q(e,t){if(S(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,V=e=>!O(e)&&e!==M;const H=(z="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>z&&e instanceof z);var z;const $=w("HTMLFormElement"),J=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),W=w("RegExp"),K=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};B(r,(r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)}),Object.defineProperties(e,n)};const G=w("AsyncFunction"),X=(Q="function"==typeof setImmediate,Z=A(M.postMessage),Q?setImmediate:Z?(Y=`axios@${Math.random()}`,ee=[],M.addEventListener("message",({source:e,data:t})=>{e===M&&t===Y&&ee.length&&ee.shift()()},!1),e=>{ee.push(e),M.postMessage(Y,"*")}):e=>setTimeout(e));var Q,Z,Y,ee;const te="undefined"!=typeof queueMicrotask?queueMicrotask.bind(M):"undefined"!=typeof process&&process.nextTick||X;var re={isArray:v,isArrayBuffer:T,isBuffer:S,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||A(e.append)&&("formdata"===(t=y(e))||"object"===t&&A(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&T(e.buffer),t},isString:R,isNumber:x,isBoolean:e=>!0===e||!1===e,isObject:k,isPlainObject:j,isEmptyObject:e=>{if(!k(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:L,isRequest:D,isResponse:F,isHeaders:I,isUndefined:O,isDate:_,isFile:N,isBlob:C,isRegExp:W,isFunction:A,isStream:e=>k(e)&&A(e.pipe),isURLSearchParams:U,isTypedArray:H,isFileList:P,forEach:B,merge:function e(){const{caseless:t,skipUndefined:r}=V(this)&&this||{},n={},o=(o,s)=>{const i=t&&q(n,s)||s;j(n[i])&&j(o)?n[i]=e(n[i],o):j(o)?n[i]=e({},o):v(o)?n[i]=o.slice():r&&O(o)||(n[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&B(arguments[e],o);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(B(t,(t,n)=>{r&&A(t)?e[n]=h(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&p(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:y,kindOfTest:w,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(v(e))return e;let t=e.length;if(!x(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[m]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:$,hasOwnProperty:J,hasOwnProp:J,reduceDescriptors:K,freezeMethods:e=>{K(e,(t,r)=>{if(A(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];A(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return v(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:q,global:M,isContextDefined:V,isSpecCompliantForm:function(e){return!!(e&&A(e.append)&&"FormData"===e[g]&&e[m])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(k(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[n]=e;const o=v(e)?[]:{};return B(e,(e,t)=>{const s=r(e,n+1);!O(s)&&(o[t]=s)}),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:G,isThenable:e=>e&&(k(e)||A(e))&&A(e.then)&&A(e.catch),setImmediate:X,asap:te,isIterable:e=>null!=e&&A(e[m])};function ne(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}re.inherits(ne,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:re.toJSONObject(this.config),code:this.code,status:this.status}}});const oe=ne.prototype,se={};["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=>{se[e]={value:e}}),Object.defineProperties(ne,se),Object.defineProperty(oe,"isAxiosError",{value:!0}),ne.from=(e,t,r,n,o,s)=>{const i=Object.create(oe);re.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return ne.call(i,a,c,r,n,o),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",s&&Object.assign(i,s),i};function ie(e){return re.isPlainObject(e)||re.isArray(e)}function ae(e){return re.endsWith(e,"[]")?e.slice(0,-2):e}function ce(e,t,r){return e?e.concat(t).map(function(e,t){return e=ae(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const le=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function ue(e,t,r){if(!re.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=re.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!re.isUndefined(t[e])})).metaTokens,o=r.visitor||l,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&re.isSpecCompliantForm(t);if(!re.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(re.isDate(e))return e.toISOString();if(re.isBoolean(e))return e.toString();if(!a&&re.isBlob(e))throw new ne("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(e)||re.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(re.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(re.isArray(e)&&function(e){return re.isArray(e)&&!e.some(ie)}(e)||(re.isFileList(e)||re.endsWith(r,"[]"))&&(a=re.toArray(e)))return r=ae(r),a.forEach(function(e,n){!re.isUndefined(e)&&null!==e&&t.append(!0===i?ce([r],n,s):null===i?r:r+"[]",c(e))}),!1;return!!ie(e)||(t.append(ce(o,r,s),c(e)),!1)}const u=[],d=Object.assign(le,{defaultVisitor:l,convertValue:c,isVisitable:ie});if(!re.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!re.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),re.forEach(r,function(r,s){!0===(!(re.isUndefined(r)||null===r)&&o.call(t,r,re.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])}),u.pop()}}(e),t}function de(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function he(e,t){this._pairs=[],e&&ue(e,this,t)}const fe=he.prototype;function pe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function me(e,t,r){if(!t)return e;const n=r&&r.encode||pe;re.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(s=o?o(t,r):re.isURLSearchParams(t)?t.toString():new he(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}fe.append=function(e,t){this._pairs.push([e,t])},fe.toString=function(e){const t=e?function(t){return e.call(this,t,de)}:de;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class ge{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(t){null!==t&&e(t)})}}var ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:he,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const we="undefined"!=typeof window&&"undefined"!=typeof document,Ee="object"==typeof navigator&&navigator||void 0,ve=we&&(!Ee||["ReactNative","NativeScript","NS"].indexOf(Ee.product)<0),Oe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Se=we&&window.location.href||"http://localhost";var Te={...Object.freeze({__proto__:null,hasBrowserEnv:we,hasStandardBrowserEnv:ve,hasStandardBrowserWebWorkerEnv:Oe,navigator:Ee,origin:Se}),...be};function Re(e){function t(e,r,n,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&re.isArray(n)?n.length:s,a)return re.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&re.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&re.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(re.isFormData(e)&&re.isFunction(e.entries)){const r={};return re.forEachEntry(e,(e,n)=>{t(function(e){return re.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Ae={transitional:ye,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=re.isObject(e);o&&re.isHTMLForm(e)&&(e=new FormData(e));if(re.isFormData(e))return n?JSON.stringify(Re(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ue(e,new Te.classes.URLSearchParams,{visitor:function(e,t,r,n){return Te.isNode&&re.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ue(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(re.isString(e))try{return(t||JSON.parse)(e),re.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ae.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw ne.from(e,ne.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:Te.classes.FormData,Blob:Te.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],e=>{Ae.headers[e]={}});const xe=re.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 ke=Symbol("internals");function je(e){return e&&String(e).trim().toLowerCase()}function _e(e){return!1===e||null==e?e:re.isArray(e)?e.map(_e):String(e)}function Ne(e,t,r,n,o){return re.isFunction(n)?n.call(this,t,r):(o&&(t=r),re.isString(t)?re.isString(n)?-1!==t.indexOf(n):re.isRegExp(n)?n.test(t):void 0:void 0)}let Ce=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=je(t);if(!o)throw new Error("header name must be a non-empty string");const s=re.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=_e(e))}const s=(e,t)=>re.forEach(e,(e,r)=>o(e,r,t));if(re.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(re.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&xe[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(re.isObject(e)&&re.isIterable(e)){let r,n,o={};for(const t of e){if(!re.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[n=t[0]]=(r=o[n])?re.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,r);return this}get(e,t){if(e=je(e)){const r=re.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(re.isFunction(t))return t.call(this,e,r);if(re.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=je(e)){const r=re.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ne(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=je(e)){const o=re.findKey(r,e);!o||t&&!Ne(0,r[o],o,t)||(delete r[o],n=!0)}}return re.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!Ne(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return re.forEach(this,(n,o)=>{const s=re.findKey(r,o);if(s)return t[s]=_e(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(o):String(o).trim();i!==o&&delete t[o],t[i]=_e(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return re.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&re.isArray(r)?r.join(", "):r)}),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 r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[ke]=this[ke]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=je(e);t[n]||(!function(e,t){const r=re.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})})}(r,e),t[n]=!0)}return re.isArray(e)?e.forEach(n):n(e),this}};function Pe(e,t){const r=this||Ae,n=t||r,o=Ce.from(n.headers);let s=n.data;return re.forEach(e,function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Ue(e){return!(!e||!e.__CANCEL__)}function Le(e,t,r){ne.call(this,null==e?"canceled":e,ne.ERR_CANCELED,t,r),this.name="CanceledError"}function De(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ne("Request failed with status code "+r.status,[ne.ERR_BAD_REQUEST,ne.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}Ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(Ce.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),re.freezeMethods(Ce),re.inherits(Le,ne,{__CANCEL__:!0});const Fe=(e,t,r=3)=>{let n=0;const o=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];o||(o=c),r[s]=a,n[s]=c;let u=i,d=0;for(;u!==s;)d+=r[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const h=l&&c-l;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let r,n,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},s-a)))},()=>r&&i(r)]}(r=>{const s=r.loaded,i=r.lengthComputable?r.total:void 0,a=s-n,c=o(a);n=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},Ie=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Be=e=>(...t)=>re.asap(()=>e(...t));var qe=Te.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Te.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Te.origin),Te.navigator&&/(msie|trident)/i.test(Te.navigator.userAgent)):()=>!0,Me=Te.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];re.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),re.isString(n)&&i.push("path="+n),re.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const He=e=>e instanceof Ce?{...e}:e;function ze(e,t){t=t||{};const r={};function n(e,t,r,n){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge.call({caseless:n},e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function o(e,t,r,o){return re.isUndefined(t)?re.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function s(e,t){if(!re.isUndefined(t))return n(void 0,t)}function i(e,t){return re.isUndefined(t)?re.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>o(He(e),He(t),0,!0)};return re.forEach(Object.keys({...e,...t}),function(n){const s=c[n]||o,i=s(e[n],t[n],n);re.isUndefined(i)&&s!==a||(r[n]=i)}),r}var $e=e=>{const t=ze({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=Ce.from(i),t.url=me(Ve(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),re.isFormData(r))if(Te.hasStandardBrowserEnv||Te.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(re.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Te.hasStandardBrowserEnv&&(n&&re.isFunction(n)&&(n=n(t)),n||!1!==n&&qe(t.url))){const e=o&&s&&Me.read(s);e&&i.set(o,e)}return t};var Je="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=$e(e);let o=n.data;const s=Ce.from(n.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:h,onDownloadProgress:f}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const n=Ce.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());De(function(e){t(e),p()},function(e){r(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new ne("Request aborted",ne.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new ne(t&&t.message?t.message:"Network Error",ne.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||ye;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ne(t,o.clarifyTimeoutError?ne.ETIMEDOUT:ne.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&re.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),re.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),f&&([c,u]=Fe(f,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,l]=Fe(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new Le(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);y&&-1===Te.protocols.indexOf(y)?r(new ne("Unsupported protocol "+y+":",ne.ERR_BAD_REQUEST,e)):m.send(o||null)})};const We=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const o=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ne?t:new Le(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new ne(`timeout ${t} of ms exceeded`,ne.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=n;return a.unsubscribe=()=>re.asap(i),a}},Ke=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,o=0;for(;o<r;)n=o+t,yield e.slice(o,n),o=n},Ge=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Xe=(e,t,r,n)=>{const o=async function*(e,t){for await(const r of Ge(e))yield*Ke(r,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=i+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Qe}=re,Ze=(({Request:e,Response:t})=>({Request:e,Response:t}))(re.global),{ReadableStream:Ye,TextEncoder:et}=re.global,tt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},rt=e=>{e=re.merge.call({skipUndefined:!0},Ze,e);const{fetch:t,Request:r,Response:n}=e,o=t?Qe(t):"function"==typeof fetch,s=Qe(r),i=Qe(n);if(!o)return!1;const a=o&&Qe(Ye),c=o&&("function"==typeof et?(l=new et,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=s&&a&&tt(()=>{let e=!1;const t=new r(Te.origin,{body:new Ye,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&tt(()=>re.isReadableStream(new n("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new ne(`Response type '${e}' is not supported`,ne.ERR_NOT_SUPPORT,r)})});const f=async(e,t)=>{const n=re.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(re.isBlob(e))return e.size;if(re.isSpecCompliantForm(e)){const t=new r(Te.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return re.isArrayBufferView(e)||re.isArrayBuffer(e)?e.byteLength:(re.isURLSearchParams(e)&&(e+=""),re.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:o,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:E}=$e(e),v=t||fetch;y=y?(y+"").toLowerCase():"text";let O=We([c,l&&l.toAbortSignal()],p),S=null;const T=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let R;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(R=await f(b,a))){let e,t=new r(o,{method:"POST",body:a,duplex:"half"});if(re.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=Ie(R,Fe(Be(g)));a=Xe(t.body,65536,e,r)}}re.isString(w)||(w=w?"include":"omit");const t=s&&"credentials"in r.prototype,c={...E,signal:O,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};S=s&&new r(o,c);let l=await(s?v(S,E):v(o,c));const p=d&&("stream"===y||"response"===y);if(d&&(m||p&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=re.toFiniteNumber(l.headers.get("content-length")),[r,o]=m&&Ie(t,Fe(Be(m),!0))||[];l=new n(Xe(l.body,65536,r,()=>{o&&o(),T&&T()}),e)}y=y||"text";let A=await h[re.findKey(h,y)||"text"](l,e);return!p&&T&&T(),await new Promise((t,r)=>{De(t,r,{data:A,headers:Ce.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ne("Network Error",ne.ERR_NETWORK,e,S),{cause:t.cause||t});throw ne.from(t,t&&t.code,e,S)}}},nt=new Map,ot=e=>{let t=e?e.env:{};const{fetch:r,Request:n,Response:o}=t,s=[n,o,r];let i,a,c=s.length,l=nt;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:rt(t)),l=a;return a};ot();const st={http:null,xhr:Je,fetch:{get:ot}};re.forEach(st,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const it=e=>`- ${e}`,at=e=>re.isFunction(e)||null===e||!1===e;var ct=(e,t)=>{e=re.isArray(e)?e:[e];const{length:r}=e;let n,o;const s={};for(let i=0;i<r;i++){let r;if(n=e[i],o=n,!at(n)&&(o=st[(r=String(n)).toLowerCase()],void 0===o))throw new ne(`Unknown adapter '${r}'`);if(o&&(re.isFunction(o)||(o=o.get(t))))break;s[r||"#"+i]=o}if(!o){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ne("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(it).join("\n"):" "+it(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function lt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Le(null,e)}function ut(e){lt(e),e.headers=Ce.from(e.headers),e.data=Pe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ct(e.adapter||Ae.adapter,e)(e).then(function(t){return lt(e),t.data=Pe.call(e,e.transformResponse,t),t.headers=Ce.from(t.headers),t},function(t){return Ue(t)||(lt(e),t&&t.response&&(t.response.data=Pe.call(e,e.transformResponse,t.response),t.response.headers=Ce.from(t.response.headers))),Promise.reject(t)})}const dt="1.12.2",ht={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ht[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ft={};ht.transitional=function(e,t,r){function n(e,t){return"[Axios v"+dt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new ne(n(o," has been removed"+(t?" in "+t:"")),ne.ERR_DEPRECATED);return t&&!ft[o]&&(ft[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}},ht.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var pt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ne("options must be an object",ne.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new ne("option "+s+" must be "+r,ne.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ne("Unknown option "+s,ne.ERR_BAD_OPTION)}},validators:ht};const mt=pt.validators;let gt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ge,response:new ge}}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 r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ze(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;void 0!==r&&pt.assertOptions(r,{silentJSONParsing:mt.transitional(mt.boolean),forcedJSONParsing:mt.transitional(mt.boolean),clarifyTimeoutError:mt.transitional(mt.boolean)},!1),null!=n&&(re.isFunction(n)?t.paramsSerializer={serialize:n}:pt.assertOptions(n,{encode:mt.function,serialize:mt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pt.assertOptions(t,{baseUrl:mt.spelling("baseURL"),withXsrfToken:mt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&re.merge(o.common,o[t.method]);o&&re.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Ce.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[ut.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let h=t;for(;d<u;){const e=i[d++],t=i[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{l=ut.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return me(Ve((e=ze(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){gt.prototype[e]=function(t,r){return this.request(ze(r||{},{method:e,url:t,data:(r||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,o){return this.request(ze(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}gt.prototype[e]=t(),gt.prototype[e+"Form"]=t(!0)});const yt={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(yt).forEach(([e,t])=>{yt[t]=e});const bt=function e(t){const r=new gt(t),n=h(gt.prototype.request,r);return re.extend(n,gt.prototype,r,{allOwnKeys:!0}),re.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ze(t,r))},n}(Ae);bt.Axios=gt,bt.CanceledError=Le,bt.CancelToken=class e{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 r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,o){r.reason||(r.reason=new Le(e,n,o),t(r.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 t;return{token:new e(function(e){t=e}),cancel:t}}},bt.isCancel=Ue,bt.VERSION=dt,bt.toFormData=ue,bt.AxiosError=ne,bt.Cancel=bt.CanceledError,bt.all=function(e){return Promise.all(e)},bt.spread=function(e){return function(t){return e.apply(null,t)}},bt.isAxiosError=function(e){return re.isObject(e)&&!0===e.isAxiosError},bt.mergeConfig=ze,bt.AxiosHeaders=Ce,bt.formToJSON=e=>Re(re.isHTMLForm(e)?new FormData(e):e),bt.getAdapter=ct,bt.HttpStatusCode=yt,bt.default=bt;const{Axios:wt,AxiosError:Et,CanceledError:vt,isCancel:Ot,CancelToken:St,VERSION:Tt,all:Rt,Cancel:At,isAxiosError:xt,spread:kt,toFormData:jt,AxiosHeaders:_t,HttpStatusCode:Nt,formToJSON:Ct,getAdapter:Pt,mergeConfig:Ut}=bt;const Lt=d.getInstance();Lt.register(new class extends n{debug(e,t){this.isLogEnabled()&&console.log(`[DEBUG] ${e}`,t||"")}error(e,t){this.isLogEnabled()&&console.error(`[ERROR] ${e}`,t||"")}info(e,t){this.isLogEnabled()&&console.info(`[INFO] ${e}`,t||"")}warn(e,t){this.isLogEnabled()&&console.warn(`[WARN] ${e}`,t||"")}isLogEnabled(){return!1!==d.getInstance().config.get("logger.enabled")}}),Lt.register(new class extends r{constructor(){super(...arguments),this.interceptorsSetup=!1}get axiosInstance(){return this._axiosInstance||(this._axiosInstance=bt.create()),this._axiosInstance}async send(e){const t=d.getInstance(),r=t.config;this.interceptorsSetup||(this.setupInterceptors(),this.interceptorsSetup=!0);try{let n={...this.getDefaultConfig(r),...this.convertToAxiosConfig(e)};const o=(e.method||"GET").toUpperCase();n=await t.hook.execute(`request.before.method:${o}`,n),n=await t.hook.execute("request.before",n);const s=await this.axiosInstance.request(n);let i=this.convertResponse(s);return i=await t.hook.execute(`request.response.status:${s.status}`,i),i=await t.hook.execute("request.response",i),i}catch(e){let r=this.handleError(e);throw e.response&&(r=await t.hook.execute(`request.error.status:${e.response.status}`,r)),r=await t.hook.execute("request.error",r),r}}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>e,e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,e=>Promise.reject(e))}getDefaultConfig(e){const t={},r=e.get("request.baseURL");r&&(t.baseURL=r);const n=e.get("request.timeout");n&&(t.timeout=n);const o=e.get("request.headers");return o&&(t.headers=o),t}convertToAxiosConfig(e){const t={url:e.url,method:e.method||"GET"};return void 0!==e.timeout&&(t.timeout=e.timeout),e.responseType&&(t.responseType=e.responseType),e.header&&Object.keys(e.header).length>0&&(t.headers=e.header),e.params&&Object.keys(e.params).length>0&&(t.params=e.params),e.data&&Object.keys(e.data).length>0&&(t.data=e.data),e.onDownloadProgress&&(t.onDownloadProgress=e.onDownloadProgress),t}convertResponse(e){const t=e.headers&&"object"==typeof e.headers?{...e.headers}:e.headers;return{data:e.data,status:e.status,statusText:e.statusText,headers:t,config:{url:e.config.url,method:e.config.method,timeout:e.config.timeout}}}handleError(e){if(e.response){const{status:t,statusText:r,data:n,headers:o,config:s}=e.response,i=new Error(`请求失败: ${t} ${r}`);return i.status=t,i.statusText=r,i.data=n,i.headers=o&&"object"==typeof o?{...o}:o,i.config={url:null==s?void 0:s.url,method:null==s?void 0:s.method,timeout:null==s?void 0:s.timeout},i}if(e.request){const t=new Error("网络请求超时或无法连接到服务器");return t.request=e.request,t}return new Error(`请求配置错误: ${e.message}`)}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}}),Lt.register(new class extends s{getNestedValue(e,t){return t.reduce((e,t)=>null==e?void 0:e[t],e)}setNestedValue(e,t,r){const n=t[t.length-1];t.slice(0,-1).reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[n]=r}deleteNestedValue(e,t){if(0===t.length)return!1;const r=t[t.length-1],n=t.slice(0,-1),o=this.getNestedValue(e,n);return!(!o||"object"!=typeof o||!(r in o))&&(delete o[r],!0)}set(e,t){const r=e.split(".");if(1===r.length)localStorage.setItem(e,JSON.stringify(t));else{const e=r[0],n=localStorage.getItem(e);let o;try{o=n?JSON.parse(n):{},("object"!=typeof o||null===o||Array.isArray(o))&&(o={})}catch(e){o={}}this.setNestedValue(o,r.slice(1),t),localStorage.setItem(e,JSON.stringify(o))}}get(e){if(!e){const e={};for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);if(r)try{e[r]=JSON.parse(localStorage.getItem(r))}catch(t){e[r]=localStorage.getItem(r)}}return e}const t=e.split("."),r=t[0],n=localStorage.getItem(r);if(!n)return null;try{const e=JSON.parse(n);return 1===t.length?e:this.getNestedValue(e,t.slice(1))}catch(e){return n}}remove(e){const t=e.split(".");if(1===t.length)localStorage.removeItem(e);else{const e=t[0],r=localStorage.getItem(e);if(r)try{const n=JSON.parse(r);this.deleteNestedValue(n,t.slice(1))&&localStorage.setItem(e,JSON.stringify(n))}catch(e){}}}clear(){localStorage.clear()}keys(){return Object.keys(localStorage)}has(e){const t=e.split("."),r=t[0],n=localStorage.getItem(r);if(!n)return!1;if(1===t.length)return!0;try{const e=JSON.parse(n);return void 0!==this.getNestedValue(e,t.slice(1))}catch(e){return!1}}}),Lt.register(new class extends i{form(e){var t;const r=d.getInstance().config.get("request.baseURL");try{let n=e.url;if(r&&!e.url.startsWith("http://")&&!e.url.startsWith("https://")){const t=r.endsWith("/")||e.url.startsWith("/")?"":"/";n=r+t+e.url}const o=document.createElement("form");if(o.method=e.method||"POST",o.action=n,o.style.display="none",null===(t=e.header)||void 0===t?void 0:t.Authorization){const t=document.createElement("a");t.href=n;const r=new URLSearchParams(t.search);r.set("Authorization",e.header.Authorization),t.search=r.toString(),o.action=t.href}if(e.params){const t=document.createElement("a");t.href=o.action;const r=new URLSearchParams(t.search);Object.entries(e.params).forEach(([e,t])=>{r.set(e,String(t))}),t.search=r.toString(),o.action=t.href}if(e.data&&Object.entries(e.data).forEach(([e,t])=>{const r=document.createElement("input");r.type="hidden",r.name=e,r.value=String(t),o.appendChild(r)}),document.body.appendChild(o),o.submit(),document.body.removeChild(o),e.onSuccess){const t={filename:"Unknown",size:0,type:"application/octet-stream",duration:0,blob:new Blob,url:n,autoDownloaded:!0};e.onSuccess(t)}}catch(t){const r=new Error(`Form download failed: ${t.message}`);throw e.onError&&e.onError(r),r}}async download(e){const t=d.getInstance().request,r=Date.now();try{const n=await t.send({url:e.url,method:e.method||"GET",header:e.header,params:e.params,data:e.data,timeout:e.timeout,responseType:"blob",onDownloadProgress:t=>{if(e.onProgress&&t.total>0){const n=this.calculateProgress(t,r);e.onProgress(n)}}});let o;if(console.log(n.headers),n.data instanceof Blob)o=n.data;else if(n.data instanceof ArrayBuffer){const e=n.headers["content-type"]||"application/octet-stream";o=new Blob([n.data],{type:e})}else{const e=n.headers["content-type"]||"application/octet-stream";o=new Blob([n.data],{type:e})}const s=this.extractFilename(e.filename,n.headers,e.url),i=o.type||"application/octet-stream",a=o.size,c={filename:s,size:a,type:i,duration:Date.now()-r,blob:o,url:e.url};if(!1!==e.autoDownload){const t=e.downloadMethod||"both",r=this.createDownloadLink(c,t);c.downloadUrl=r.url,c.autoDownloaded=r.triggered}return e.onSuccess&&e.onSuccess(c),c}catch(t){let r;throw r=t.response?new Error(`Download failed: ${t.response.status} ${t.response.statusText}`):t.request?new Error("Network timeout or unable to connect to server"):new Error(`Download configuration error: ${t.message}`),e.onError&&e.onError(r),r}}calculateProgress(e,t){const r=e.loaded,n=e.total,o=n>0?Math.round(r/n*100):0,s=(Date.now()-t)/1e3,i=s>0?r/s:0;return{loaded:r,total:n,percentage:o,speed:i,remainingTime:i>0?(n-r)/i:0}}extractFilename(e,t,r){if(e)return e;const n=(null==t?void 0:t["content-disposition"])||(null==t?void 0:t["Content-Disposition"]);if(n){const e=n.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1])return e[1].replace(/['"]/g,"")}if(r)try{let e;e=r.startsWith("http://")||r.startsWith("https://")?new URL(r).pathname:r;const t=e.split("/").pop();if(t&&t.includes("."))return t}catch(e){const t=r.split("/").pop();if(t&&t.includes("."))return t}return`download_${Date.now()}`}createDownloadLink(e,t){try{if(!(e.blob&&e.blob instanceof Blob))throw new Error("Invalid blob data for download");if(0===e.blob.size)throw new Error("Empty blob data");const r=URL.createObjectURL(e.blob);let n=!1;return"link"!==t&&"both"!==t||(this.triggerDownload(r,e.filename),n=!0),{url:r,triggered:n}}catch(e){return console.error("Failed to create download link:",e),{url:"",triggered:!1}}}triggerDownload(e,t){try{const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>{URL.revokeObjectURL(e)},1e3)}catch(e){console.error("Failed to trigger download:",e)}}}),Lt.register(new class extends a{constructor(){super(...arguments),this.interfaceType="IHook",this.registry=new Map}init(e){for(const[t,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>this.register(t,e)):this.register(t,r)}register(e,t){if(!this.isValidHookKey(e))return void this.logWarning(`Invalid hook key: ${e}`);if("function"!=typeof t)return void this.logWarning(`Handler must be a function for hook key: ${e}`);const r=this.registry.get(e)||[];r.push(t),this.registry.set(e,r)}unregister(e,t){if(!t)return void this.registry.delete(e);const r=this.registry.get(e);if(r){const n=r.indexOf(t);n>-1&&r.splice(n,1),0===r.length&&this.registry.delete(e)}}async execute(e,t){const r=this.findMatchingHandlers(e,t);if(0===r.length)return t;let n=t;for(const o of r)try{const e=o(n);n=e instanceof Promise?await e:e,void 0===n&&(n=t)}catch(t){this.logError(`Error executing hook ${e}:`,t)}return n}has(e){return this.registry.has(e)&&this.registry.get(e).length>0}clear(){this.registry.clear()}findMatchingHandlers(e,t){const r=[];for(const[n,o]of this.registry)this.isKeyMatch(n,e,t)&&r.push(...o);return r}isKeyMatch(e,t,r){if(e===t)return!0;const[n,o]=this.parseHookKey(e),[s,i]=this.parseHookKey(t);return n===s&&(!o||!!i&&o.value===i.value)}parseHookKey(e){const t=e.lastIndexOf(":");if(-1===t)return[e,null];const r=e.substring(0,t),n=e.substring(t+1),o=r.split(".");return[r,{field:o[o.length-1],value:n}]}isValidHookKey(e){return"string"==typeof e&&e.length>0}logWarning(e){d.getInstance().logger.warn(`[Hook] ${e}`)}logError(e,t){d.getInstance().logger.error(`[Hook] ${e}`,t)}}),"undefined"!=typeof window&&(window.kivii=Lt),e.FEATURE_PROTOCOL_VERSION="1",e.IFeature=u,e.Kivii=d,e.MockRequest=class extends r{async send(e){const t=d.getInstance().config.get("mock");if(!t)throw new Error("Mock data not configured");const r=e.url||"",n=r.split("/").filter(e=>e&&""!==e);let o=t;for(const t of n){if(!o||"object"!=typeof o||!(t in o)){o=void 0;break}o="function"==typeof o[t]?o[t]({method:e.method,params:e.params,data:e.data}):o[t]}if(void 0===o)throw new Error(`Mock data not found for URL: ${r}`);return{data:o,status:200,statusText:"OK",headers:{},config:e}}async get(e,t){return this.send({url:e,method:"GET",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async post(e,t,r){return this.send({url:e,method:"POST",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async put(e,t,r){return this.send({url:e,method:"PUT",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}async delete(e,t){return this.send({url:e,method:"DELETE",header:(null==t?void 0:t.header)||{},params:(null==t?void 0:t.params)||{},data:(null==t?void 0:t.data)||{},timeout:null==t?void 0:t.timeout})}async patch(e,t,r){return this.send({url:e,method:"PATCH",header:(null==r?void 0:r.header)||{},params:(null==r?void 0:r.params)||{},data:t||{},timeout:null==r?void 0:r.timeout})}},e.createUnsupportedFeatureCall=l,e.default=Lt,e.kivii=Lt,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=kivii.bridge.min.js.map