import{k as A,cn as Er,s as Ce}from"./index-CkRKqT62.js";const ve=(e,t)=>t.some(r=>e instanceof r);let it,at;function Rr(){return it||(it=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Sr(){return at||(at=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Fe=new WeakMap,De=new WeakMap,ge=new WeakMap;function Ar(e){const t=new Promise((r,n)=>{const s=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{r(K(e.result)),s()},o=()=>{n(e.error),s()};e.addEventListener("success",i),e.addEventListener("error",o)});return ge.set(t,e),t}function xr(e){if(Fe.has(e))return;const t=new Promise((r,n)=>{const s=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{r(),s()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});Fe.set(e,t)}let Le={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return Fe.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return K(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Pt(e){Le=e(Le)}function Or(e){return Sr().includes(e)?function(...t){return e.apply(Ie(this),t),K(this.request)}:function(...t){return K(e.apply(Ie(this),t))}}function Tr(e){return typeof e=="function"?Or(e):(e instanceof IDBTransaction&&xr(e),ve(e,Rr())?new Proxy(e,Le):e)}function K(e){if(e instanceof IDBRequest)return Ar(e);if(De.has(e))return De.get(e);const t=Tr(e);return t!==e&&(De.set(e,t),ge.set(t,e)),t}const Ie=e=>ge.get(e);function Cr(e,t,{blocked:r,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(e,t),c=K(o);return n&&o.addEventListener("upgradeneeded",f=>{n(K(o.result),f.oldVersion,f.newVersion,K(o.transaction),f)}),r&&o.addEventListener("blocked",f=>r(f.oldVersion,f.newVersion,f)),c.then(f=>{i&&f.addEventListener("close",()=>i()),s&&f.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),c}const Dr=["get","getKey","getAll","getAllKeys","count"],Nr=["put","add","delete","clear"],Ne=new Map;function ct(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ne.get(t))return Ne.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,s=Nr.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(s||Dr.includes(r)))return;const i=async function(o,...c){const f=this.transaction(o,s?"readwrite":"readonly");let u=f.store;return n&&(u=u.index(c.shift())),(await Promise.all([u[r](...c),s&&f.done]))[0]};return Ne.set(t,i),i}Pt(e=>({...e,get:(t,r,n)=>ct(t,r)||e.get(t,r,n),has:(t,r)=>!!ct(t,r)||e.has(t,r)}));const _r=["continue","continuePrimaryKey","advance"],ut={},je=new WeakMap,Bt=new WeakMap,Ur={get(e,t){if(!_r.includes(t))return e[t];let r=ut[t];return r||(r=ut[t]=function(...n){je.set(this,Bt.get(this)[t](...n))}),r}};async function*Pr(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const r=new Proxy(t,Ur);for(Bt.set(r,t),ge.set(r,Ie(t));t;)yield r,t=await(je.get(r)||t.continue()),je.delete(r)}function lt(e,t){return t===Symbol.asyncIterator&&ve(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&ve(e,[IDBIndex,IDBObjectStore])}Pt(e=>({...e,get(t,r,n){return lt(t,r)?Pr:e.get(t,r,n)},has(t,r){return lt(t,r)||e.has(t,r)}}));const Br="ClassworksDB",kr=2,_e=async()=>Cr(Br,kr,{upgrade(e){e.objectStoreNames.contains("kv")||e.createObjectStore("kv"),e.objectStoreNames.contains("system")||e.createObjectStore("system")}}),fe={async loadData(e){try{const r=await(await _e()).get("kv",e);return r?q(JSON.parse(r)):O("数据不存在","NOT_FOUND")}catch(t){return O("读取本地数据失败:"+t)}},async saveData(e,t){try{return await(await _e()).put("kv",JSON.stringify(t),e),q(!0)}catch(r){return O("保存本地数据失败:"+r)}},async loadKeys(e={}){try{const s=await(await _e()).transaction(["kv"],"readonly").objectStore("kv").getAllKeys(),{sortDir:i="asc",limit:o=100,skip:c=0}=e,f=s.sort((y,w)=>i==="desc"?w.localeCompare(y):y.localeCompare(w)),u=f.length,l=f.slice(c,c+o),p={keys:l,total_rows:u,current_page:{limit:o,skip:c,count:l.length},load_more:null};return q(p)}catch(t){return O("获取本地键名列表失败:"+t.message)}}};function kt(e,t){return function(){return e.apply(t,arguments)}}const{toString:vr}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Ee,toStringTag:vt}=Symbol,Re=(e=>t=>{const r=vr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),B=e=>(e=e.toLowerCase(),t=>Re(t)===e),Se=e=>t=>typeof t===e,{isArray:Z}=Array,X=Se("undefined");function se(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&C(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ft=B("ArrayBuffer");function Fr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ft(e.buffer),t}const Lr=Se("string"),C=Se("function"),Lt=Se("number"),oe=e=>e!==null&&typeof e=="object",Ir=e=>e===!0||e===!1,pe=e=>{if(Re(e)!=="object")return!1;const t=Je(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(vt in e)&&!(Ee in e)},jr=e=>{if(!oe(e)||se(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Mr=B("Date"),$r=B("File"),Hr=B("Blob"),qr=B("FileList"),Kr=e=>oe(e)&&C(e.pipe),zr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||C(e.append)&&((t=Re(e))==="formdata"||t==="object"&&C(e.toString)&&e.toString()==="[object FormData]"))},Vr=B("URLSearchParams"),[Jr,Wr,Xr,Zr]=["ReadableStream","Request","Response","Headers"].map(B),Gr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ie(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Z(e))for(n=0,s=e.length;n0;)if(s=r[n],t===s.toLowerCase())return s;return null}const H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,jt=e=>!X(e)&&e!==H;function Me(){const{caseless:e,skipUndefined:t}=jt(this)&&this||{},r={},n=(s,i)=>{const o=e&&It(r,i)||i;pe(r[o])&&pe(s)?r[o]=Me(r[o],s):pe(s)?r[o]=Me({},s):Z(s)?r[o]=s.slice():(!t||!X(s))&&(r[o]=s)};for(let s=0,i=arguments.length;s(ie(t,(s,i)=>{r&&C(s)?e[i]=kt(s,r):e[i]=s},{allOwnKeys:n}),e),Yr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),en=(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)},tn=(e,t,r,n)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&Je(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},rn=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},nn=e=>{if(!e)return null;if(Z(e))return e;let t=e.length;if(!Lt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},sn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Je(Uint8Array)),on=(e,t)=>{const n=(e&&e[Ee]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},an=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},cn=B("HTMLFormElement"),un=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),ft=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ln=B("RegExp"),Mt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ie(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},fn=e=>{Mt(e,(t,r)=>{if(C(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(C(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},dn=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Z(e)?n(e):n(String(e).split(t)),r},hn=()=>{},pn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function mn(e){return!!(e&&C(e.append)&&e[vt]==="FormData"&&e[Ee])}const yn=e=>{const t=new Array(10),r=(n,s)=>{if(oe(n)){if(t.indexOf(n)>=0)return;if(se(n))return n;if(!("toJSON"in n)){t[s]=n;const i=Z(n)?[]:{};return ie(n,(o,c)=>{const f=r(o,s+1);!X(f)&&(i[c]=f)}),t[s]=void 0,i}}return n};return r(e,0)},bn=B("AsyncFunction"),wn=e=>e&&(oe(e)||C(e))&&C(e.then)&&C(e.catch),$t=((e,t)=>e?setImmediate:t?((r,n)=>(H.addEventListener("message",({source:s,data:i})=>{s===H&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),H.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",C(H.postMessage)),gn=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||$t,En=e=>e!=null&&C(e[Ee]),a={isArray:Z,isArrayBuffer:Ft,isBuffer:se,isFormData:zr,isArrayBufferView:Fr,isString:Lr,isNumber:Lt,isBoolean:Ir,isObject:oe,isPlainObject:pe,isEmptyObject:jr,isReadableStream:Jr,isRequest:Wr,isResponse:Xr,isHeaders:Zr,isUndefined:X,isDate:Mr,isFile:$r,isBlob:Hr,isRegExp:ln,isFunction:C,isStream:Kr,isURLSearchParams:Vr,isTypedArray:sn,isFileList:qr,forEach:ie,merge:Me,extend:Qr,trim:Gr,stripBOM:Yr,inherits:en,toFlatObject:tn,kindOf:Re,kindOfTest:B,endsWith:rn,toArray:nn,forEachEntry:on,matchAll:an,isHTMLForm:cn,hasOwnProperty:ft,hasOwnProp:ft,reduceDescriptors:Mt,freezeMethods:fn,toObjectSet:dn,toCamelCase:un,noop:hn,toFiniteNumber:pn,findKey:It,global:H,isContextDefined:jt,isSpecCompliantForm:mn,toJSONObject:yn,isAsyncFn:bn,isThenable:wn,setImmediate:$t,asap:gn,isIterable:En};function b(e,t,r,n,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(b,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:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Ht=b.prototype,qt={};["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=>{qt[e]={value:e}});Object.defineProperties(b,qt);Object.defineProperty(Ht,"isAxiosError",{value:!0});b.from=(e,t,r,n,s,i)=>{const o=Object.create(Ht);a.toFlatObject(e,o,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return b.call(o,c,f,r,n,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const Rn=null;function $e(e){return a.isPlainObject(e)||a.isArray(e)}function Kt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function dt(e,t,r){return e?e.concat(t).map(function(s,i){return s=Kt(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Sn(e){return a.isArray(e)&&!e.some($e)}const An=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function Ae(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!a.isUndefined(h[m])});const n=r.metaTokens,s=r.visitor||l,i=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,m,h){let E=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(m,"{}"))m=n?m:m.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Sn(d)||(a.isFileList(d)||a.endsWith(m,"[]"))&&(E=a.toArray(d)))return m=Kt(m),E.forEach(function(R,T){!(a.isUndefined(R)||R===null)&&t.append(o===!0?dt([m],T,i):o===null?m:m+"[]",u(R))}),!1}return $e(d)?!0:(t.append(dt(h,m,i),u(d)),!1)}const p=[],y=Object.assign(An,{defaultVisitor:l,convertValue:u,isVisitable:$e});function w(d,m){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),a.forEach(d,function(E,N){(!(a.isUndefined(E)||E===null)&&s.call(t,E,a.isString(N)?N.trim():N,m,y))===!0&&w(E,m?m.concat(N):[N])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return w(e),t}function ht(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function We(e,t){this._pairs=[],e&&Ae(e,this,t)}const zt=We.prototype;zt.append=function(t,r){this._pairs.push([t,r])};zt.toString=function(t){const r=t?function(n){return t.call(this,n,ht)}:ht;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function xn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vt(e,t,r){if(!t)return e;const n=r&&r.encode||xn;a.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let i;if(s?i=s(t,r):i=a.isURLSearchParams(t)?t.toString():new We(t,r).toString(n),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class pt{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Jt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},On=typeof URLSearchParams<"u"?URLSearchParams:We,Tn=typeof FormData<"u"?FormData:null,Cn=typeof Blob<"u"?Blob:null,Dn={isBrowser:!0,classes:{URLSearchParams:On,FormData:Tn,Blob:Cn},protocols:["http","https","file","blob","url","data"]},Xe=typeof window<"u"&&typeof document<"u",He=typeof navigator=="object"&&navigator||void 0,Nn=Xe&&(!He||["ReactNative","NativeScript","NS"].indexOf(He.product)<0),_n=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Un=Xe&&window.location.href||"http://localhost",Pn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xe,hasStandardBrowserEnv:Nn,hasStandardBrowserWebWorkerEnv:_n,navigator:He,origin:Un},Symbol.toStringTag,{value:"Module"})),x={...Pn,...Dn};function Bn(e,t){return Ae(e,new x.classes.URLSearchParams,{visitor:function(r,n,s,i){return x.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function kn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function vn(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n=r.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&a.isArray(s[o])&&(s[o]=vn(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const r={};return a.forEachEntry(e,(n,s)=>{t(kn(n),s,r,0)}),r}return null}function Fn(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ae={transitional:Jt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(Wt(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Bn(t,this.formSerializer).toString();if((c=a.isFileList(t))||n.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return Ae(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),Fn(t)):t}],transformResponse:[function(t){const r=this.transitional||ae.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(n&&!this.responseType||s)){const o=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?b.from(c,b.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ae.headers[e]={}});const Ln=a.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"]),In=e=>{const t={};let r,n,s;return e&&e.split(` `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&Ln[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},mt=Symbol("internals");function ee(e){return e&&String(e).trim().toLowerCase()}function me(e){return e===!1||e==null?e:a.isArray(e)?e.map(me):String(e)}function jn(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}const Mn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ue(e,t,r,n,s){if(a.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!a.isString(t)){if(a.isString(n))return t.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(t)}}function $n(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Hn(e,t){const r=a.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let D=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(c,f,u){const l=ee(f);if(!l)throw new Error("header name must be a non-empty string");const p=a.findKey(s,l);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||f]=me(c))}const o=(c,f)=>a.forEach(c,(u,l)=>i(u,l,f));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(a.isString(t)&&(t=t.trim())&&!Mn(t))o(In(t),r);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(f=c[u])?a.isArray(f)?[...f,l[1]]:[f,l[1]]:l[1]}o(c,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=ee(t),t){const n=a.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return jn(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ee(t),t){const n=a.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ue(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=ee(o),o){const c=a.findKey(n,o);c&&(!r||Ue(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||Ue(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return a.forEach(this,(s,i)=>{const o=a.findKey(n,i);if(o){r[o]=me(s),delete r[i];return}const c=t?$n(i):String(i).trim();c!==i&&delete r[i],r[c]=me(s),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[mt]=this[mt]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=ee(o);n[c]||(Hn(s,o),n[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};D.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(D.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});a.freezeMethods(D);function Pe(e,t){const r=this||ae,n=t||r,s=D.from(n.headers);let i=n.data;return a.forEach(e,function(c){i=c.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Xt(e){return!!(e&&e.__CANCEL__)}function G(e,t,r){b.call(this,e??"canceled",b.ERR_CANCELED,t,r),this.name="CanceledError"}a.inherits(G,b,{__CANCEL__:!0});function Zt(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new b("Request failed with status code "+r.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function qn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Kn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),l=n[i];o||(o=u),r[s]=f,n[s]=u;let p=i,y=0;for(;p!==s;)y+=r[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o{r=l,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const l=Date.now(),p=l-r;p>=n?o(u,l):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-p)))},()=>s&&o(s)]}const we=(e,t,r=3)=>{let n=0;const s=Kn(50,250);return zn(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-n,u=s(f),l=o<=c;n=o;const p={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&l?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},r)},yt=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},bt=e=>(...t)=>a.asap(()=>e(...t)),Vn=x.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,x.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0,Jn=x.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Wn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Xn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Gt(e,t,r){let n=!Wn(t);return e&&(n||r==!1)?Xn(e,t):t}const wt=e=>e instanceof D?{...e}:e;function V(e,t){t=t||{};const r={};function n(u,l,p,y){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:y},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,p,y){if(a.isUndefined(l)){if(!a.isUndefined(u))return n(void 0,u,p,y)}else return n(u,l,p,y)}function i(u,l){if(!a.isUndefined(l))return n(void 0,l)}function o(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function c(u,l,p){if(p in t)return n(u,l);if(p in e)return n(void 0,u)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,l,p)=>s(wt(u),wt(l),p,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const p=f[l]||s,y=p(e[l],t[l],l);a.isUndefined(y)&&p!==c||(r[l]=y)}),r}const Qt=e=>{const t=V({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;if(t.headers=o=D.from(o),t.url=Vt(Gt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([l,p])=>{u.includes(l.toLowerCase())&&o.set(l,p)})}}if(x.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(t)),n||n!==!1&&Vn(t.url))){const f=s&&i&&Jn.read(i);f&&o.set(s,f)}return t},Zn=typeof XMLHttpRequest<"u",Gn=Zn&&function(e){return new Promise(function(r,n){const s=Qt(e);let i=s.data;const o=D.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:u}=s,l,p,y,w,d;function m(){w&&w(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function E(){if(!h)return;const R=D.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),U={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:R,config:e,request:h};Zt(function(_){r(_),m()},function(_){n(_),m()},U),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(n(new b("Request aborted",b.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const U=T&&T.message?T.message:"Network Error",j=new b(U,b.ERR_NETWORK,e,h);j.event=T||null,n(j),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const U=s.transitional||Jt;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),n(new b(T,U.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(T,U){h.setRequestHeader(U,T)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([y,d]=we(u,!0),h.addEventListener("progress",y)),f&&h.upload&&([p,w]=we(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(l=R=>{h&&(n(!R||R.type?new G(null,e,h):R),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const N=qn(s.url);if(N&&x.protocols.indexOf(N)===-1){n(new b("Unsupported protocol "+N+":",b.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Qn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,s;const i=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;n.abort(l instanceof b?l:new G(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,i(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:f}=n;return f.unsubscribe=()=>a.asap(c),f}},Yn=function*(e,t){let r=e.byteLength;if(r{const s=es(e,t);let i=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{const{done:u,value:l}=await s.next();if(u){c(),f.close();return}let p=l.byteLength;if(r){let y=i+=p;r(y)}f.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Et=64*1024,{isFunction:de}=a,rs=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,At=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ns=e=>{e=a.merge.call({skipUndefined:!0},rs,e);const{fetch:t,Request:r,Response:n}=e,s=t?de(t):typeof fetch=="function",i=de(r),o=de(n);if(!s)return!1;const c=s&&de(Rt),f=s&&(typeof St=="function"?(d=>m=>d.encode(m))(new St):async d=>new Uint8Array(await new r(d).arrayBuffer())),u=i&&c&&At(()=>{let d=!1;const m=new r(x.origin,{body:new Rt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),l=o&&c&&At(()=>a.isReadableStream(new n("").body)),p={stream:l&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(m,h)=>{let E=m&&m[d];if(E)return E.call(m);throw new b(`Response type '${d}' is not supported`,b.ERR_NOT_SUPPORT,h)})});const y=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new r(x.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},w=async(d,m)=>{const h=a.toFiniteNumber(d.getContentLength());return h??y(m)};return async d=>{let{url:m,method:h,data:E,signal:N,cancelToken:R,timeout:T,onDownloadProgress:U,onUploadProgress:j,responseType:_,headers:Oe,withCredentials:ce="same-origin",fetchOptions:et}=Qt(d),tt=t||fetch;_=_?(_+"").toLowerCase():"text";let ue=Qn([N,R&&R.toAbortSignal()],T),Y=null;const M=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let rt;try{if(j&&u&&h!=="get"&&h!=="head"&&(rt=await w(Oe,E))!==0){let I=new r(m,{method:"POST",body:E,duplex:"half"}),J;if(a.isFormData(E)&&(J=I.headers.get("content-type"))&&Oe.setContentType(J),I.body){const[Te,le]=yt(rt,we(bt(j)));E=gt(I.body,Et,Te,le)}}a.isString(ce)||(ce=ce?"include":"omit");const k=i&&"credentials"in r.prototype,nt={...et,signal:ue,method:h.toUpperCase(),headers:Oe.normalize().toJSON(),body:E,duplex:"half",credentials:k?ce:void 0};Y=i&&new r(m,nt);let L=await(i?tt(Y,et):tt(m,nt));const st=l&&(_==="stream"||_==="response");if(l&&(U||st&&M)){const I={};["status","statusText","headers"].forEach(ot=>{I[ot]=L[ot]});const J=a.toFiniteNumber(L.headers.get("content-length")),[Te,le]=U&&yt(J,we(bt(U),!0))||[];L=new n(gt(L.body,Et,Te,()=>{le&&le(),M&&M()}),I)}_=_||"text";let gr=await p[a.findKey(p,_)||"text"](L,d);return!st&&M&&M(),await new Promise((I,J)=>{Zt(I,J,{data:gr,headers:D.from(L.headers),status:L.status,statusText:L.statusText,config:d,request:Y})})}catch(k){throw M&&M(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,d,Y),{cause:k.cause||k}):b.from(k,k&&k.code,d,Y)}}},ss=new Map,Yt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,c=o,f,u,l=ss;for(;c--;)f=i[c],u=l.get(f),u===void 0&&l.set(f,u=c?new Map:ns(t)),l=u;return u};Yt();const Ze={http:Rn,xhr:Gn,fetch:{get:Yt}};a.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const xt=e=>`- ${e}`,os=e=>a.isFunction(e)||e===null||e===!1;function is(e,t){e=a.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=r?o.length>1?`since : `+o.map(xt).join(` `):" "+xt(o[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const er={getAdapter:is,adapters:Ze};function Be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G(null,e)}function Ot(e){return Be(e),e.headers=D.from(e.headers),e.data=Pe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),er.getAdapter(e.adapter||ae.adapter,e)(e).then(function(n){return Be(e),n.data=Pe.call(e,e.transformResponse,n),n.headers=D.from(n.headers),n},function(n){return Xt(n)||(Be(e),n&&n.response&&(n.response.data=Pe.call(e,e.transformResponse,n.response),n.response.headers=D.from(n.response.headers))),Promise.reject(n)})}const tr="1.13.2",xe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Tt={};xe.transitional=function(t,r,n){function s(i,o){return"[Axios v"+tr+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,c)=>{if(t===!1)throw new b(s(o," has been removed"+(r?" in "+r:"")),b.ERR_DEPRECATED);return r&&!Tt[o]&&(Tt[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,c):!0}};xe.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function as(e,t,r){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=t[i];if(o){const c=e[i],f=c===void 0||o(c,i,e);if(f!==!0)throw new b("option "+i+" must be "+f,b.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const ye={assertOptions:as,validators:xe},v=ye.validators;let z=class{constructor(t){this.defaults=t||{},this.interceptors={request:new pt,response:new pt}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=` `+i):n.stack=i}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=V(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&ye.assertOptions(n,{silentJSONParsing:v.transitional(v.boolean),forcedJSONParsing:v.transitional(v.boolean),clarifyTimeoutError:v.transitional(v.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:ye.assertOptions(s,{encode:v.function,serialize:v.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ye.assertOptions(r,{baseUrl:v.spelling("baseURL"),withXsrfToken:v.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[r.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=D.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,p=0,y;if(!f){const d=[Ot.bind(this),void 0];for(d.unshift(...c),d.push(...u),y=d.length,l=Promise.resolve(r);p{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{n.subscribe(c),i=c}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,c){n.reason||(n.reason=new G(i,o,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new rr(function(s){t=s}),cancel:t}}};function us(e){return function(r){return e.apply(null,r)}}function ls(e){return a.isObject(e)&&e.isAxiosError===!0}const qe={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qe).forEach(([e,t])=>{qe[t]=e});function nr(e){const t=new z(e),r=kt(z.prototype.request,t);return a.extend(r,z.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return nr(V(e,s))},r}const g=nr(ae);g.Axios=z;g.CanceledError=G;g.CancelToken=cs;g.isCancel=Xt;g.VERSION=tr;g.toFormData=Ae;g.AxiosError=b;g.Cancel=g.CanceledError;g.all=function(t){return Promise.all(t)};g.spread=us;g.isAxiosError=ls;g.mergeConfig=V;g.AxiosHeaders=D;g.formToJSON=e=>Wt(a.isHTMLForm(e)?new FormData(e):e);g.getAdapter=er.getAdapter;g.HttpStatusCode=qe;g.default=g;const{Axios:Bs,AxiosError:ks,CanceledError:vs,isCancel:Fs,CancelToken:Ls,VERSION:Is,all:js,Cancel:Ms,isAxiosError:$s,spread:Hs,toFormData:qs,AxiosHeaders:Ks,HttpStatusCode:zs,formToJSON:Vs,getAdapter:Js,mergeConfig:Ws}=g;function fs(e,t){return"headers"in e&&typeof e.headers=="object"&&!Array.isArray(e.headers)?ke(e.headers):"getHeaders"in e&&typeof e.getHeaders=="function"?ke(e.getHeaders()):ke(e)}function ke(e,t){const r=F(e,"ratelimit");if(r)return ms(r);let n;if(F(e,"ratelimit-remaining"))n="ratelimit-";else if(F(e,"x-ratelimit-remaining"))n="x-ratelimit-";else if(F(e,"x-rate-limit-remaining"))n="x-rate-limit-";else return;const s=P(F(e,`${n}limit`)),i=P(F(e,`${n}used`))||P(F(e,`${n}observed`)),o=P(F(e,`${n}remaining`));let c;const f=F(e,`${n}reset`);switch(void 0){case"date":{c=sr(f??"");break}case"unix":{c=Ke(f??"");break}case"seconds":{c=or(f??"");break}case"milliseconds":{c=ys(f??"");break}default:if(f)c=ws(f);else{const l=F(e,"retry-after");l&&(c=Ke(l))}}return{limit:Number.isNaN(s)?i+o:s,used:Number.isNaN(i)?s-o:i,remaining:o,reset:c}}var ds=/limit\s*=\s*(\d+)/i,hs=/remaining\s*=\s*(\d+)/i,ps=/reset\s*=\s*(\d+)/i;function ms(e){var t,r,n;const s=P((t=ds.exec(e))==null?void 0:t[1]),i=P((r=hs.exec(e))==null?void 0:r[1]),o=P((n=ps.exec(e))==null?void 0:n[1]),c=Ge(o);return{limit:s,used:s-i,remaining:i,reset:c}}function Ge(e){const t=new Date;return t.setSeconds(t.getSeconds()+e),t}function P(e){return typeof e=="number"?e:Number.parseInt(e??"",10)}function F(e,t){var r;if("get"in e&&typeof e.get=="function")return(r=e.get(t))!=null?r:void 0;if(t in e&&typeof e[t]=="string")return e[t]}function sr(e){return new Date(e)}function Ke(e){const t=P(e);return new Date(t*1e3)}function or(e){const t=P(e);return Ge(t)}function ys(e){const t=P(e);return Ge(t/1e3)}var bs=/[a-z]/i;function ws(e){if(bs.test(e))return sr(e);const t=P(e);return t&&t>1e9?Ke(t):or(t)}const ir="3.7.8",gs=ir,Q=typeof Buffer=="function",Ct=typeof TextDecoder=="function"?new TextDecoder:void 0,Dt=typeof TextEncoder=="function"?new TextEncoder:void 0,Es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ne=Array.prototype.slice.call(Es),he=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(ne),Rs=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,S=String.fromCharCode.bind(String),Nt=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),ar=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),cr=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),ur=e=>{let t,r,n,s,i="";const o=e.length%3;for(let c=0;c255||(n=e.charCodeAt(c++))>255||(s=e.charCodeAt(c++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,i+=ne[t>>18&63]+ne[t>>12&63]+ne[t>>6&63]+ne[t&63]}return o?i.slice(0,o-3)+"===".substring(o):i},Qe=typeof btoa=="function"?e=>btoa(e):Q?e=>Buffer.from(e,"binary").toString("base64"):ur,ze=Q?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,s=e.length;nt?ar(ze(e)):ze(e),Ss=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?S(192|t>>>6)+S(128|t&63):S(224|t>>>12&15)+S(128|t>>>6&63)+S(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return S(240|t>>>18&7)+S(128|t>>>12&63)+S(128|t>>>6&63)+S(128|t&63)}},As=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,lr=e=>e.replace(As,Ss),_t=Q?e=>Buffer.from(e,"utf8").toString("base64"):Dt?e=>ze(Dt.encode(e)):e=>Qe(lr(e)),W=(e,t=!1)=>t?ar(_t(e)):_t(e),Ut=e=>W(e,!0),xs=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Os=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return S((r>>>10)+55296)+S((r&1023)+56320);case 3:return S((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return S((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},fr=e=>e.replace(xs,Os),dr=e=>{if(e=e.replace(/\s+/g,""),!Rs.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,s=[];for(let i=0;i>16&255)):n===64?s.push(S(t>>16&255,t>>8&255)):s.push(S(t>>16&255,t>>8&255,t&255));return s.join("")},Ye=typeof atob=="function"?e=>atob(cr(e)):Q?e=>Buffer.from(e,"base64").toString("binary"):dr,hr=Q?e=>Nt(Buffer.from(e,"base64")):e=>Nt(Ye(e).split("").map(t=>t.charCodeAt(0))),pr=e=>hr(mr(e)),Ts=Q?e=>Buffer.from(e,"base64").toString("utf8"):Ct?e=>Ct.decode(hr(e)):e=>fr(Ye(e)),mr=e=>cr(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Ve=e=>Ts(mr(e)),Cs=e=>{if(typeof e!="string")return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},yr=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),br=function(){const e=(t,r)=>Object.defineProperty(String.prototype,t,yr(r));e("fromBase64",function(){return Ve(this)}),e("toBase64",function(t){return W(this,t)}),e("toBase64URI",function(){return W(this,!0)}),e("toBase64URL",function(){return W(this,!0)}),e("toUint8Array",function(){return pr(this)})},wr=function(){const e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,yr(r));e("toBase64",function(t){return be(this,t)}),e("toBase64URI",function(){return be(this,!0)}),e("toBase64URL",function(){return be(this,!0)})},Ds=()=>{br(),wr()},Ns={version:ir,VERSION:gs,atob:Ye,atobPolyfill:dr,btoa:Qe,btoaPolyfill:ur,fromBase64:Ve,toBase64:W,encode:W,encodeURI:Ut,encodeURL:Ut,utob:lr,btou:fr,decode:Ve,isValid:Cs,fromUint8Array:be,toUint8Array:pr,extendString:br,extendUint8Array:wr,extendBuiltins:Ds},$=g.create({timeout:1e4});$.interceptors.request.use(e=>{const t=A("server.provider");if(t==="kv-server"||t==="classworkscloud"){const r=A("server.kvToken");if(r)e.headers["x-app-token"]=r;else{const n=A("server.siteKey");n&&(e.headers["x-site-key"]=Ns.encode(n))}}return e},e=>(console.log(e),Promise.reject(e)));$.interceptors.response.use(e=>e,e=>{if(e.response&&e.response.status===429)try{const t=fs(e.response);t&&Er.show(t.reset,e.config.url,e.config.method.toUpperCase())}catch(t){console.error("解析限速头信息失败:",t)}return Promise.reject(e)});const te=()=>{const e={Accept:"application/json"},t=A("server.kvToken"),r=A("server.siteKey");return t?e["x-app-token"]=t:r&&(e["x-site-key"]=r),e},re={async loadNamespaceInfo(){var e,t;try{const r=A("server.domain"),n=await $.get(`${r}/kv/_info`,{headers:te()});return q(n.data)}catch(r){return console.error("获取命名空间信息失败:",r),O(((t=(e=r.response)==null?void 0:e.data)==null?void 0:t.message)||"获取命名空间信息失败","NAMESPACE_ERROR")}},async updateNamespaceInfo(e){var t,r;try{const n=A("server.domain");return await $.put(`${n}/kv/_info`,e,{headers:te()})}catch(n){return O(((r=(t=n.response)==null?void 0:t.data)==null?void 0:r.message)||"更新命名空间信息失败","NAMESPACE_ERROR")}},async loadData(e){var t,r,n;try{const s=A("server.domain"),i=await $.get(`${s}/kv/${e}`,{headers:te()});return q(i.data)}catch(s){return((t=s.response)==null?void 0:t.status)===404?O("数据不存在","NOT_FOUND"):(console.log(s),O(((n=(r=s.response)==null?void 0:r.data)==null?void 0:n.message)||"服务器连接失败","NETWORK_ERROR"))}},async saveData(e,t){var r,n;try{const s=A("server.domain");return await $.post(`${s}/kv/${e}`,t,{headers:te()}),q(!0)}catch(s){return console.log(s),O(((n=(r=s.response)==null?void 0:r.data)==null?void 0:n.message)||"保存失败","SAVE_ERROR")}},async loadKeys(e={}){var t,r,n,s,i;try{const o=A("server.domain"),{sortBy:c="key",sortDir:f="asc",limit:u=100,skip:l=0}=e,p=new URLSearchParams({sortBy:c,sortDir:f,limit:u.toString(),skip:l.toString()}),y=await $.get(`${o}/kv/_keys?${p}`,{headers:te()});return q(y.data)}catch(o){return((t=o.response)==null?void 0:t.status)===404?O("命名空间不存在","NOT_FOUND"):((r=o.response)==null?void 0:r.status)===403?O("无权限访问此命名空间","PERMISSION_DENIED"):((n=o.response)==null?void 0:n.status)===401?O("认证失败","UNAUTHORIZED"):(console.log(o),O(((i=(s=o.response)==null?void 0:s.data)==null?void 0:i.message)||"获取键名列表失败","NETWORK_ERROR"))}}},q=e=>e,O=(e,t="UNKNOWN_ERROR")=>({success:!1,error:{code:t,message:e}}),Xs={loadData:async e=>{const t=A("server.provider");return t==="kv-server"||t==="classworkscloud"?re.loadData(e):fe.loadData(e)},saveData:async(e,t)=>{const r=A("server.provider");return r==="kv-server"||r==="classworkscloud"?re.saveData(e,t):fe.saveData(e,t)},loadKeys:async(e={})=>{const t=A("server.provider");return t==="kv-server"||t==="classworkscloud"?re.loadKeys(e):fe.loadKeys(e)},async getKeyCloudUrl(e,t={}){var s;const{migrateFromLocal:r=!0,autoConfigureCloud:n=!0}=t;try{let i=A("server.domain"),o=A("server.siteKey");const c=A("device.uuid");let f=!1;if(!i||!c)if(n){const y={"server.domain":"https://kv.wuyuan.dev","server.siteKey":""};i||(Ce("server.domain",y["server.domain"]),i=y["server.domain"],f=!0),o||(Ce("server.siteKey",y["server.siteKey"]),o=y["server.siteKey"]),Ce("server.provider","classworkscloud")}else return O("云端配置无效,请检查服务器域名和设备UUID","CONFIG_ERROR");let u=!1;if(r)try{const y=await fe.loadData(e);if(y&&y.success!==!1){const w=await re.loadData(e);if(w&&w.success===!1&&((s=w.error)==null?void 0:s.code)==="NOT_FOUND"){const d=await re.saveData(e,y);d&&d.success!==!1&&(u=!0,console.log(`已成功将键 ${e} 的数据从本地迁移到云端`))}}}catch(y){console.warn(`迁移键 ${e} 的数据时出错:`,y)}const l=A("server.kvToken");return{success:!0,url:`${i}/kv/${e}?token=${l}`,migrated:u,configured:f}}catch(i){return console.error("获取键云端地址时出错:",i),O(i.message||"获取键云端地址失败","CLOUD_URL_ERROR")}}};export{g as a,$ as b,fe as c,Xs as d,Ns as g,re as k,Cr as o};