1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2026-02-03 23:23:09 +00:00
Classworks/assets/dataProvider-Cg4CSn_f.js

7 lines
50 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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