morningfast-plus 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morningfast-plus",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "type": "module",
5
5
  "description": "A library based on Vue 3 and Element Plus",
6
6
  "author": "jishu_app@morningfast.com",
package/shared/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=Object.defineProperty,t=(t,r)=>{let n={};for(var s in t)e(n,s,{get:t[s],enumerable:!0});return r&&e(n,Symbol.toStringTag,{value:"Module"}),n};let r=require("element-plus");function n(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{if(document.execCommand("copy"))return!0}catch(r){return!1}document.body.removeChild(t)}var s=null,o="",i={},a={},c="",l="",u=void 0,d=null,f={accessKeyId:"",accessKeySecret:"",stsToken:"",region:"",bucket:"",refreshSTSTokenInterval:9999999};const h=new Proxy(f,{get:(e,t)=>e[t],set:()=>!1});async function p(){const e=await(await fetch(o,{headers:new Headers({"Content-Type":"application/json",...i||{}}),body:JSON.stringify(a||{}),method:"POST",credentials:"include"})).json();return e?.data?.accessKeySecret&&e?.data?.securityToken?e?.data:null}function m(e){f.accessKeyId=e.accessKeyId||f.accessKeyId,f.accessKeySecret=e.accessKeySecret||f.accessKeySecret,f.stsToken=e.securityToken||f.stsToken,f.region=e.region||f.region,f.bucket=e.bucket||f.bucket,c=e.accessUrl||c,l=e.uploadUrl||l,f.refreshSTSTokenInterval=(0,r.dayjs)(e.expiration).diff((0,r.dayjs)(),"millisecond"),f.refreshSTSToken=u||(async()=>{const e=await p();return f.refreshSTSTokenInterval=(0,r.dayjs)(e?.expiration).diff((0,r.dayjs)(),"millisecond"),{accessKeyId:e?.accessKeyId||"",accessKeySecret:e?.accessKeySecret||"",stsToken:e?.securityToken||""}}),d=new s(f)}async function y(e,t){const r=await d.put(`${t}/${e.name}`,e,{timeout:(new Date).getTime()+18e4});return r.name=r.name?.split("/").pop()||e.name,"https:"===window.location.protocol&&(r.url=r.url.replace("http://","https://")),c&&l&&(r.url=r.url.replace(c,l)),r}function g(e,t){return function(){return e.apply(t,arguments)}}var b,{toString:w}=Object.prototype,{getPrototypeOf:S}=Object,{iterator:v,toStringTag:E}=Symbol,O=(b=Object.create(null),e=>{const t=w.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())}),T=e=>(e=e.toLowerCase(),t=>O(t)===e),R=e=>t=>typeof t===e,{isArray:x}=Array,k=R("undefined");function A(e){return null!==e&&!k(e)&&null!==e.constructor&&!k(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var C=T("ArrayBuffer");var j=R("string"),_=R("function"),P=R("number"),N=e=>null!==e&&"object"==typeof e,D=e=>{if("object"!==O(e))return!1;const t=S(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||E in e||v in e)},L=T("Date"),U=T("File"),I=T("Blob"),F=T("FileList"),M=T("URLSearchParams"),[B,$,q,K]=["ReadableStream","Request","Response","Headers"].map(T);function z(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),x(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(A(e))return;const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(n=0;n<o;n++)i=s[n],t.call(null,e[i],i,e)}}function J(e,t){if(A(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}var H="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,V=e=>!k(e)&&e!==H;var W,X=(W="undefined"!=typeof Uint8Array&&S(Uint8Array),e=>W&&e instanceof W),Q=T("HTMLFormElement"),G=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Z=T("RegExp"),Y=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};z(r,(r,s)=>{let o;!1!==(o=t(r,s,e))&&(n[s]=o||r)}),Object.defineProperties(e,n)};var ee,te,re,ne,se=T("AsyncFunction"),oe=(ee="function"==typeof setImmediate,te=_(H.postMessage),ee?setImmediate:te?(re=`axios@${Math.random()}`,ne=[],H.addEventListener("message",({source:e,data:t})=>{e===H&&t===re&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),H.postMessage(re,"*")}):e=>setTimeout(e)),ie="undefined"!=typeof queueMicrotask?queueMicrotask.bind(H):"undefined"!=typeof process&&process.nextTick||oe,ae={isArray:x,isArrayBuffer:C,isBuffer:A,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||_(e.append)&&("formdata"===(t=O(e))||"object"===t&&_(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&C(e.buffer),t},isString:j,isNumber:P,isBoolean:e=>!0===e||!1===e,isObject:N,isPlainObject:D,isEmptyObject:e=>{if(!N(e)||A(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:B,isRequest:$,isResponse:q,isHeaders:K,isUndefined:k,isDate:L,isFile:U,isBlob:I,isRegExp:Z,isFunction:_,isStream:e=>N(e)&&_(e.pipe),isURLSearchParams:M,isTypedArray:X,isFileList:F,forEach:z,merge:function e(){const{caseless:t,skipUndefined:r}=V(this)&&this||{},n={},s=(s,o)=>{const i=t&&J(n,o)||o;D(n[i])&&D(s)?n[i]=e(n[i],s):D(s)?n[i]=e({},s):x(s)?n[i]=s.slice():r&&k(s)||(n[i]=s)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&z(arguments[o],s);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(z(t,(t,n)=>{r&&_(t)?e[n]=g(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&S(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:O,kindOfTest:T,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(x(e))return e;let t=e.length;if(!P(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[v]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Q,hasOwnProperty:G,hasOwnProp:G,reduceDescriptors:Y,freezeMethods:e=>{Y(e,(t,r)=>{if(_(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];_(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return x(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:J,global:H,isContextDefined:V,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[E]&&e[v])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(N(e)){if(t.indexOf(e)>=0)return;if(A(e))return e;if(!("toJSON"in e)){t[n]=e;const s=x(e)?[]:{};return z(e,(e,t)=>{const o=r(e,n+1);!k(o)&&(s[t]=o)}),t[n]=void 0,s}}return e};return r(e,0)},isAsyncFn:se,isThenable:e=>e&&(N(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:oe,asap:ie,isIterable:e=>null!=e&&_(e[v])};function ce(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)}ae.inherits(ce,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:ae.toJSONObject(this.config),code:this.code,status:this.status}}});var le=ce.prototype,ue={};["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=>{ue[e]={value:e}}),Object.defineProperties(ce,ue),Object.defineProperty(le,"isAxiosError",{value:!0}),ce.from=(e,t,r,n,s,o)=>{const i=Object.create(le);ae.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return ce.call(i,a,c,r,n,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};var de=ce;function fe(e){return ae.isPlainObject(e)||ae.isArray(e)}function he(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function pe(e,t,r){return e?e.concat(t).map(function(e,t){return e=he(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}var me=ae.toFlatObject(ae,{},null,function(e){return/^is[A-Z]/.test(e)});var ye=function(e,t,r){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=ae.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ae.isUndefined(t[e])})).metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ae.isDate(e))return e.toISOString();if(ae.isBoolean(e))return e.toString();if(!a&&ae.isBlob(e))throw new de("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(e)||ae.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(ae.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ae.isArray(e)&&function(e){return ae.isArray(e)&&!e.some(fe)}(e)||(ae.isFileList(e)||ae.endsWith(r,"[]"))&&(a=ae.toArray(e)))return r=he(r),a.forEach(function(e,n){!ae.isUndefined(e)&&null!==e&&t.append(!0===i?pe([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!fe(e)||(t.append(pe(s,r,o),c(e)),!1)}const u=[],d=Object.assign(me,{defaultVisitor:l,convertValue:c,isVisitable:fe});if(!ae.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ae.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),ae.forEach(r,function(r,o){!0===(!(ae.isUndefined(r)||null===r)&&s.call(t,r,ae.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t};function ge(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function be(e,t){this._pairs=[],e&&ye(e,this,t)}var we=be.prototype;we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){const t=e?function(t){return e.call(this,t,ge)}:ge;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Se=be;function ve(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ee(e,t,r){if(!t)return e;const n=r&&r.encode||ve;ae.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(o=s?s(t,r):ae.isURLSearchParams(t)?t.toString():new Se(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var Oe=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ae.forEach(this.handlers,function(t){null!==t&&e(t)})}},Te={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Re={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Se,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},xe=t({hasBrowserEnv:()=>ke,hasStandardBrowserEnv:()=>Ce,hasStandardBrowserWebWorkerEnv:()=>je,navigator:()=>Ae,origin:()=>_e},1),ke="undefined"!=typeof window&&"undefined"!=typeof document,Ae="object"==typeof navigator&&navigator||void 0,Ce=ke&&(!Ae||["ReactNative","NativeScript","NS"].indexOf(Ae.product)<0),je="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,_e=ke&&window.location.href||"http://localhost",Pe={...xe,...Re};var Ne=function(e){function t(e,r,n,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&ae.isArray(n)?n.length:o,a?(ae.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i):(n[o]&&ae.isObject(n[o])||(n[o]=[]),t(e,r,n[o],s)&&ae.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const r={};return ae.forEachEntry(e,(e,n)=>{t(function(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null};var De={transitional:Te,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=ae.isObject(e);if(s&&ae.isHTMLForm(e)&&(e=new FormData(e)),ae.isFormData(e))return n?JSON.stringify(Ne(e)):e;if(ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)||ae.isReadableStream(e))return e;if(ae.isArrayBufferView(e))return e.buffer;if(ae.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ye(e,new Pe.classes.URLSearchParams,{visitor:function(e,t,r,n){return Pe.isNode&&ae.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ae.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ye(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(n){if("SyntaxError"!==n.name)throw n}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||De.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ae.isResponse(e)||ae.isReadableStream(e))return e;if(e&&ae.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(s){if(r){if("SyntaxError"===s.name)throw de.from(s,de.ERR_BAD_RESPONSE,this,null,this.response);throw s}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pe.classes.FormData,Blob:Pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{De.headers[e]={}});var Le=De,Ue=ae.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"]),Ie=Symbol("internals");function Fe(e){return e&&String(e).trim().toLowerCase()}function Me(e){return!1===e||null==e?e:ae.isArray(e)?e.map(Me):String(e)}function Be(e,t,r,n,s){return ae.isFunction(n)?n.call(this,t,r):(s&&(t=r),ae.isString(t)?ae.isString(n)?-1!==t.indexOf(n):ae.isRegExp(n)?n.test(t):void 0:void 0)}var $e=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Fe(t);if(!s)throw new Error("header name must be a non-empty string");const o=ae.findKey(n,s);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Me(e))}const o=(e,t)=>ae.forEach(e,(e,r)=>s(e,r,t));if(ae.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ae.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&Ue[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(ae.isObject(e)&&ae.isIterable(e)){let r,n,s={};for(const t of e){if(!ae.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[n=t[0]]=(r=s[n])?ae.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,r);return this}get(e,t){if(e=Fe(e)){const r=ae.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(ae.isFunction(t))return t.call(this,e,r);if(ae.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fe(e)){const r=ae.findKey(this,e);return!(!r||void 0===this[r]||t&&!Be(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Fe(e)){const s=ae.findKey(r,e);!s||t&&!Be(0,r[s],s,t)||(delete r[s],n=!0)}}return ae.isArray(e)?e.forEach(s):s(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const s=t[r];e&&!Be(0,this[s],s,e,!0)||(delete this[s],n=!0)}return n}normalize(e){const t=this,r={};return ae.forEach(this,(n,s)=>{const o=ae.findKey(r,s);if(o)return t[o]=Me(n),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(s):String(s).trim();i!==s&&delete t[s],t[i]=Me(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ae.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ae.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Ie]=this[Ie]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Fe(e);t[n]||(!function(e,t){const r=ae.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})})}(r,e),t[n]=!0)}return ae.isArray(e)?e.forEach(n):n(e),this}};$e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ae.reduceDescriptors($e.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),ae.freezeMethods($e);var qe=$e;function Ke(e,t){const r=this||Le,n=t||r,s=qe.from(n.headers);let o=n.data;return ae.forEach(e,function(e){o=e.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function ze(e){return!(!e||!e.__CANCEL__)}function Je(e,t,r){de.call(this,null==e?"canceled":e,de.ERR_CANCELED,t,r),this.name="CanceledError"}ae.inherits(Je,de,{__CANCEL__:!0});var He=Je;function Ve(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new de("Request failed with status code "+r.status,[de.ERR_BAD_REQUEST,de.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}var We=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];s||(s=c),r[o]=a,n[o]=c;let u=i,d=0;for(;u!==o;)d+=r[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}};var Xe=function(e,t){let r,n,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-a)))},()=>r&&i(r)]};const Qe=(e,t,r=3)=>{let n=0;const s=We(50,250);return Xe(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,a=o-n,c=s(a);n=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},Ge=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ze=e=>(...t)=>ae.asap(()=>e(...t));var Ye,et,tt=Pe.hasStandardBrowserEnv?(Ye=new URL(Pe.origin),et=Pe.navigator&&/(msie|trident)/i.test(Pe.navigator.userAgent),e=>(e=new URL(e,Pe.origin),Ye.protocol===e.protocol&&Ye.host===e.host&&(et||Ye.port===e.port))):()=>!0,rt=Pe.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ae.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),ae.isString(n)&&a.push(`path=${n}`),ae.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),ae.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)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:()=>null,remove(){}};function nt(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var st=e=>e instanceof qe?{...e}:e;function ot(e,t){t=t||{};const r={};function n(e,t,r,n){return ae.isPlainObject(e)&&ae.isPlainObject(t)?ae.merge.call({caseless:n},e,t):ae.isPlainObject(t)?ae.merge({},t):ae.isArray(t)?t.slice():t}function s(e,t,r,s){return ae.isUndefined(t)?ae.isUndefined(e)?void 0:n(void 0,e,0,s):n(e,t,0,s)}function o(e,t){if(!ae.isUndefined(t))return n(void 0,t)}function i(e,t){return ae.isUndefined(t)?ae.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,o){return o in t?n(r,s):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>s(st(e),st(t),0,!0)};return ae.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||s,i=o(e[n],t[n],n);ae.isUndefined(i)&&o!==a||(r[n]=i)}),r}var it=e=>{const t=ot({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=qe.from(i),t.url=Ee(nt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ae.isFormData(r))if(Pe.hasStandardBrowserEnv||Pe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(ae.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Pe.hasStandardBrowserEnv&&(n&&ae.isFunction(n)&&(n=n(t)),n||!1!==n&&tt(t.url))){const e=s&&o&&rt.read(o);e&&i.set(s,e)}return t},at="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=it(e);let s=n.data;const o=qe.from(n.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const n=qe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ve(function(e){t(e),p()},function(e){r(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(r(new de("Request aborted",de.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new de(t&&t.message?t.message:"Network Error",de.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const s=n.transitional||Te;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new de(t,s.clarifyTimeoutError?de.ETIMEDOUT:de.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&ae.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ae.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),h&&([c,u]=Qe(h,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,l]=Qe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new He(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===Pe.protocols.indexOf(g)?r(new de("Unsupported protocol "+g+":",de.ERR_BAD_REQUEST,e)):m.send(s||null)})},ct=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const s=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof de?t:new He(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new de(`timeout ${t} of ms exceeded`,de.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>ae.asap(i),a}};const lt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,s=0;for(;s<r;)n=s+t,yield e.slice(s,n),s=n};var ut=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}};const dt=(e,t,r,n)=>{const s=async function*(e,t){for await(const r of ut(e))yield*lt(r,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await s.next();if(t)return a(),void e.close();let o=n.byteLength;r&&r(i+=o),e.enqueue(new Uint8Array(n))}catch(t){throw a(t),t}},cancel:e=>(a(e),s.return())},{highWaterMark:2})};var{isFunction:ft}=ae,ht=(({Request:e,Response:t})=>({Request:e,Response:t}))(ae.global),{ReadableStream:pt,TextEncoder:mt}=ae.global,yt=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},gt=e=>{e=ae.merge.call({skipUndefined:!0},ht,e);const{fetch:t,Request:r,Response:n}=e,s=t?ft(t):"function"==typeof fetch,o=ft(r),i=ft(n);if(!s)return!1;const a=s&&ft(pt),c=s&&("function"==typeof mt?(l=new mt,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=o&&a&&yt(()=>{let e=!1;const t=new r(Pe.origin,{body:new pt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&yt(()=>ae.isReadableStream(new n("").body)),f={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new de(`Response type '${e}' is not supported`,de.ERR_NOT_SUPPORT,r)})});const h=async(e,t)=>{const n=ae.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:ae.isBlob(e)?e.size:ae.isSpecCompliantForm(e)?(await new r(Pe.origin,{method:"POST",body:e}).arrayBuffer()).byteLength:ae.isArrayBufferView(e)||ae.isArrayBuffer(e)?e.byteLength:(ae.isURLSearchParams(e)&&(e+=""),ae.isString(e)?(await c(e)).byteLength:void 0))(t):n};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:b,withCredentials:w="same-origin",fetchOptions:S}=it(e),v=t||fetch;g=g?(g+"").toLowerCase():"text";let E=ct([c,l&&l.toAbortSignal()],p),O=null;const T=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let R;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(R=await h(b,a))){let e,t=new r(s,{method:"POST",body:a,duplex:"half"});if(ae.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=Ge(R,Qe(Ze(y)));a=dt(t.body,65536,e,r)}}ae.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in r.prototype,c={...S,signal:E,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new r(s,c);let l=await(o?v(O,S):v(s,c));const p=d&&("stream"===g||"response"===g);if(d&&(m||p&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=ae.toFiniteNumber(l.headers.get("content-length")),[r,s]=m&&Ge(t,Qe(Ze(m),!0))||[];l=new n(dt(l.body,65536,r,()=>{s&&s(),T&&T()}),e)}g=g||"text";let x=await f[ae.findKey(f,g)||"text"](l,e);return!p&&T&&T(),await new Promise((t,r)=>{Ve(t,r,{data:x,headers:qe.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(x){if(T&&T(),x&&"TypeError"===x.name&&/Load failed|fetch/i.test(x.message))throw Object.assign(new de("Network Error",de.ERR_NETWORK,e,O),{cause:x.cause||x});throw de.from(x,x&&x.code,e,O)}}},bt=new Map;const wt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i,a,c=o.length,l=bt;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:gt(t)),l=a;return a};wt();var St={http:null,xhr:at,fetch:{get:wt}};ae.forEach(St,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});var vt=e=>`- ${e}`,Et=e=>ae.isFunction(e)||null===e||!1===e;var Ot={getAdapter:function(e,t){e=ae.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],s=n,!Et(n)&&(s=St[(r=String(n)).toLowerCase()],void 0===s))throw new de(`Unknown adapter '${r}'`);if(s&&(ae.isFunction(s)||(s=s.get(t))))break;o[r||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new de("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(vt).join("\n"):" "+vt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:St};function Tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new He(null,e)}function Rt(e){return Tt(e),e.headers=qe.from(e.headers),e.data=Ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ot.getAdapter(e.adapter||Le.adapter,e)(e).then(function(t){return Tt(e),t.data=Ke.call(e,e.transformResponse,t),t.headers=qe.from(t.headers),t},function(t){return ze(t)||(Tt(e),t&&t.response&&(t.response.data=Ke.call(e,e.transformResponse,t.response),t.response.headers=qe.from(t.response.headers))),Promise.reject(t)})}const xt="1.13.2";var kt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{kt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var At={};kt.transitional=function(e,t,r){return(n,s,o)=>{if(!1===e)throw new de(function(e,t){return"[Axios v"+xt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(s," has been removed"+(t?" in "+t:"")),de.ERR_DEPRECATED);return t&&!At[s]&&(At[s]=!0),!e||e(n,s,o)}},kt.spelling=function(e){return(e,t)=>!0};var Ct={assertOptions:function(e,t,r){if("object"!=typeof e)throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new de("option "+o+" must be "+r,de.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new de("Unknown option "+o,de.ERR_BAD_OPTION)}},validators:kt},jt=Ct.validators,_t=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Oe,response:new Oe}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{r.stack?t&&!String(r.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+t):r.stack=t}catch(n){}}throw r}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ot(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;void 0!==r&&Ct.assertOptions(r,{silentJSONParsing:jt.transitional(jt.boolean),forcedJSONParsing:jt.transitional(jt.boolean),clarifyTimeoutError:jt.transitional(jt.boolean)},!1),null!=n&&(ae.isFunction(n)?t.paramsSerializer={serialize:n}:Ct.assertOptions(n,{encode:jt.function,serialize:jt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ct.assertOptions(t,{baseUrl:jt.spelling("baseURL"),withXsrfToken:jt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&ae.merge(s.common,s[t.method]);s&&ae.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=qe.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[Rt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(h){t.call(this,h);break}}try{l=Rt.call(this,f)}catch(h){return Promise.reject(h)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Ee(nt((e=ot(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ae.forEach(["delete","get","head","options"],function(e){_t.prototype[e]=function(t,r){return this.request(ot(r||{},{method:e,url:t,data:(r||{}).data}))}}),ae.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,s){return this.request(ot(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}_t.prototype[e]=t(),_t.prototype[e+"Form"]=t(!0)});var Pt=_t,Nt=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,s){r.reason||(r.reason=new He(e,n,s),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};var Dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Dt).forEach(([e,t])=>{Dt[t]=e});var Lt=Dt;var Ut=function e(t){const r=new Pt(t),n=g(Pt.prototype.request,r);return ae.extend(n,Pt.prototype,r,{allOwnKeys:!0}),ae.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ot(t,r))},n}(Le);Ut.Axios=Pt,Ut.CanceledError=He,Ut.CancelToken=Nt,Ut.isCancel=ze,Ut.VERSION=xt,Ut.toFormData=ye,Ut.AxiosError=de,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return ae.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=ot,Ut.AxiosHeaders=qe,Ut.formToJSON=e=>Ne(ae.isHTMLForm(e)?new FormData(e):e),Ut.getAdapter=Ot.getAdapter,Ut.HttpStatusCode=Lt,Ut.default=Ut;var It=Ut;var Ft=null,Mt=null;var Bt=class{constructor(){}static success(e="",t=""){}static info(e="",t=""){}static warn(e="",t=""){}static danger(e="",t=""){}static error(e="",t=""){}};const $t={String:"string",Number:"number",Boolean:"boolean",Json:"json",Null:"null"};var qt=class{constructor(e){this.structure=[],this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data"},this.notError=!1,this.inited=!1,this.data=[],this.name=e.name,this.db=e.db,this.structure=e.structure,this.service=e.service,this.keyMap=e?.keyMap??this.keyMap,this.open()}get structureMap(){return this.structure.reduce((e,t)=>(e[t.name]=t,e),{})}async open(){this.validate(),this.extractPrimaryKey()}close(){this.structure=[]}validate(){if(!this.name)throw new Error("表名称不能为空");if(!this.structure)throw new Error(`表 ${this.name} 的结构未定义`);const e=this.structure.filter(e=>e.primaryKey);if(e.length>1)throw new Error(`表 ${this.name} 只能有一个主键,但找到了 ${e.length} 个, 分别是: ${e.map(e=>e.name).join(", ")}`);for(const t of this.structure){if(!t.name)throw new Error(`表 ${this.name} 的某个字段名称不能为空`);if(!$t[t.type])throw new Error(`表 ${this.name} 的字段 ${t.name} 的类型 ${t.type} 无效`)}this.notError=!0}extractPrimaryKey(){this.primaryKey=this.structure.find(e=>e.primaryKey)?.name}updateStructure(e){this.structure=e,this.notError=!1,this.validate()}async fetchAsyncData(){const e=await(this.service?.queryTable(this.db,this.name));e&&(this.inited=!0,this.id=e?.[this.keyMap?.id],this.data=e?.[this.keyMap?.config_data]??[])}async getData(e=!1){return!e&&this.inited||await this.fetchAsyncData(),this.data}};const Kt=["=",">","<",">=","<=","!=","like"];var zt=class{constructor(e){this.steps=[],this._run=e}start(){const e={collect:{select:void 0,insertInto:void 0,update:void 0,replaceInto:void 0,delete:void 0,from:void 0,where:void 0,limit:void 0},sentence:{DML:void 0}};return this.steps.push(e),this.currentStep=e,this}run(){return this._run(this)}validate(e,t,r){const n=this.currentStep;if(n?.collect?.[e])return n.error=`当前步骤已存在「${e}」操作,无法重复操作,请先调用start()重置「Action」再进行操作`,Bt.error("Action",n.error),!n.error;for(let s=0;s<(t?.length||0);s++){const r=t[s];if(n?.collect?.[r])break;if(s===(t?.length||0)-1)return n.error=`${e}操作缺少必要的依赖关系,请先进行「${t.join("/")}」操作`,Bt.error("Action",n.error),!n?.error}for(let s=0;s<(r?.length||0);s++){const t=r[s];if(n?.collect?.[t])return n.error=`「${e}」操作与「${t}」操作冲突,请只保留其中一个操作重试`,Bt.error("Action",n.error),!n.error}return!n.error}select(e){return this.validate("select",[],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.select=e,this.currentStep.sentence.DML="select",this):this}insertInto(e,t,r){return this.validate("insertInto",[],["select","update","delete","replaceInto"])?(this.currentStep.collect.insertInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="insertInto",this):this}update(e,t,r){return this.validate("update",[],["select","insertInto","delete","replaceInto"])?(this.currentStep.collect.update={table:e,fields:t,values:r},this.currentStep.sentence.DML="update",this):this}replaceInto(e,t,r){return this.validate("replaceInto",[],["select","insertInto","update","delete"])?(this.currentStep.collect.replaceInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="replaceInto",this):this}delete(){return this.validate("delete",[],["select","insertInto","update","replaceInto","limit"])?(this.currentStep.collect.delete=!0,this.currentStep.sentence.DML="delete",this):this}from(e){return this.validate("from",["select","insertInto","update","delete","replaceInto"])?(this.currentStep.collect.from=e,this):this}where(e,t="AND"){if(!this.validate("where",[],["insertInto","replaceInto"]))return this;if(!e?.length)return this;const r=this.currentStep,n={segments:[],relationship:t};for(let s=0;s<e.length;s++){const t=e[s],[o,i,a]=t?.split(" ").map(e=>e.trim());if(!o||!i||void 0===a)throw r.error=`条件语句 "${t}" 格式错误,请使用 "字段 操作符 值" 的格式`,new Error(r.error);if(!Kt.includes(i))throw r.error=`条件语句 "${t}" 中的操作符 "${i}" 不受支持,请使用 ${Kt.join(", ")} 之一`,new Error(r.error);let c;if(a.startsWith("'")&&a.endsWith("'"))c=a.slice(1,-1);else if(isNaN(Number(a)))if("true"===a.toLowerCase()||"false"===a.toLowerCase())c="true"===a.toLowerCase();else{if(isNaN(Date.parse(a)))throw r.error=`条件语句 "${t}" 中的值 "${a}" 格式错误,无法解析为字符串、数字、布尔值或日期`,new Error(r.error);c=new Date(a)}else c=Number(a);n.segments.push({leftField:o,operator:i,rightValue:c})}return this.currentStep.collect.where=n,this}limit(e){return this.validate("limit",["select"],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.limit=e,this):this}},Jt=class{get execution(){return window.structuredClone(this.__executions?.[this.__executions?.length-1])}get result(){return this.__executions?.[this.__executions?.length-1]?.result}constructor(e){this.tables=new Map,this.locks=new Map,this.views=new Map,this.name="",this.closed=!1,this.name=e.name,this.service=e.service,this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}open(){this.closed=!1}close(){this.closed?Bt.error("校验失败",`数据库 ${this.name} 已经关闭,无需重复关闭.`):(delete this.service,delete this.__executions,this.tables.forEach(e=>e.close()),this.tables.clear(),this.locks.forEach(e=>e.close()),this.locks.clear(),this.views.forEach(e=>e.close()),this.views.clear(),this.closed=!0)}useTable(e,t){return this.tables.has(e)||this.tables.set(e,new qt({name:e,db:this.name,structure:t||[],service:this.service,keyMap:this.keyMap})),this.tables.get(e)}createErrorReturn(e){return{error:e.error||""}}start(){return new zt(this.run.bind(this)).start()}async run(e){const t=[];for(let n=0;n<e.steps.length;n++){const s=e.steps[n];if(s?.error){t.push(this.createErrorReturn(s));continue}if(!s?.sentence.DML){s.error="当前步骤没有明确的DML操作,无法执行,请先执行DML操作 (select/insertInto/update/replaceInto/delete)",t.push(this.createErrorReturn(s));continue}const o=s.collect?.from||(s.collect?.[s.sentence.DML])?.table,i=this.tables.get(o);if(!i||!i?.notError){s.error=`表 ${o} 不存在或错误,请先检查表.`,Bt.error("校验失败",s.error),t.push(this.createErrorReturn(s));continue}const a=0===n?await(i?.getData()):window.structuredClone(t?.[n-1]?.result||[]),c=window.structuredClone(a),l={id:i?.id,DML:s.sentence.DML,where:s.collect.where,limit:s.collect.limit||0,from:o,rawData:a,result:[]};t.push(l);try{switch(s.sentence.DML){case"select":l.result=this.runOnSelect(c,i,e);break;case"insertInto":l.result=this.runOnInsertInto(c,i,e);break;case"update":l.result=this.runOnUpdate(c,i,e);break;case"replaceInto":l.result=this.runOnReplaceInto(c,i,e);break;case"delete":l.result=this.runOnDelete(c,i,e)}}catch(r){s.error=r?.message,Bt.error("run 任务执行失败",s.error),t.push(this.createErrorReturn(s))}}return this.__executions=t,{acs:t,result:t?.[t.length-1]?.result||[],fetch:this.fetch.bind(this)}}validateTableStructure(e,t){if(t.includes("*"))return!0;const r=e.structureMap;for(let n=0;n<t.length;n++){const e=t[n];if(!r[e])return Bt.error("Table Structure",`表结构中不存在字段「${e}」,请检查表结构定义或查询字段是否正确`),!1}return!0}runOnSelect(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.select||[]))throw new Error("表结构验证失败");if(!e?.length)return[];r.currentStep?.collect.where&&(e=this.applicationConditions(e,r.currentStep.collect.where));let n=[...e];return r.currentStep?.collect?.select?.includes("*")||(n=e?.map(e=>{const t={};return(r.currentStep?.collect.select||[]).forEach(r=>{t[r]=e[r]}),t})),Number(r.currentStep?.collect?.limit)>0?n?.slice(0,r.currentStep?.collect.limit):n||[]}generateRow(e,t){if(!["insertInto","replaceInto"].includes(t?.currentStep?.sentence?.DML))return void Bt.error("generateRow",`当前操作 ${t?.currentStep?.sentence?.DML} 不支持生成数据行,请检查 SQL 语句`);const r=t.currentStep?.collect?.[t?.currentStep?.sentence?.DML];let n={};return r?.fields.forEach((e,t)=>{n[e]=r?.values[t]}),Object.keys(e.structureMap).forEach(t=>{if(void 0===n[t]){const r=e.structureMap[t];"function"==typeof r.default?n[t]=r.default():n[t]=r.default}}),n}runOnInsertInto(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.insertInto?.fields||[]))throw new Error("表结构验证失败");if(r.currentStep?.collect.insertInto?.fields.length!==r.currentStep?.collect.insertInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");const n=this.generateRow(t,r);return n&&e.push(n),e}runOnUpdate(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.update?.fields||[]))throw new Error("表结构验证失败");return this.applicationConditions(e,r.currentStep?.collect.where).forEach(e=>{r.currentStep?.collect.update?.fields.forEach((t,n)=>{e[t]=r.currentStep?.collect.update?.values[n]})}),e}runOnReplaceInto(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.replaceInto?.fields||[]))throw new Error("表结构验证失败");if(r.currentStep?.collect.replaceInto?.fields.length!==r.currentStep?.collect.replaceInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");if(!t?.primaryKey)throw new Error(`表 ${t.name} 没有定义主键,无法执行 replaceInto 操作,请检查表结构定义`);const n=r.currentStep?.collect?.replaceInto?.fields?.findIndex(e=>e===t.primaryKey);if(-1===n){const n=this.generateRow(t,r);return n&&e.push(n),e}const s=r.currentStep?.collect?.replaceInto?.values?.[n],o=e.findIndex(e=>e[t.primaryKey]===s),i=-1!==o?window.structuredClone(e.splice(o,1)[0]):void 0;return i&&(r.currentStep?.collect.replaceInto?.fields.forEach((e,t)=>{i[e]=r.currentStep?.collect.replaceInto?.values[t]}),e.push(i)),e}runOnDelete(e,t,r){return r.currentStep?.collect?.where?(this.applicationConditions(e,r.currentStep?.collect.where).forEach(t=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)}),e):[]}applicationConditions(e,t){if(!t||!t.segments.length)return e;const r=new Set;return"AND"===t?.relationship&&e?.forEach(e=>r.add(e)),t?.segments?.forEach(n=>{if("AND"===t?.relationship){const e=Array.from(r);r.clear(),e.filter(e=>this.isConditionPass(e,n)&&r.add(e))}else"OR"===t?.relationship&&e?.forEach(e=>this.isConditionPass(e,n)&&r.add(e))}),Array.from(r)}isConditionPass(e,t){if(void 0===e[t.leftField])return!1;switch(t.operator){case"=":return e[t.leftField]===t.rightValue;case">":return e[t.leftField]>t.rightValue;case"<":return e[t.leftField]<t.rightValue;case">=":return e[t.leftField]>=t.rightValue;case"<=":return e[t.leftField]<=t.rightValue;case"!=":return e[t.leftField]!==t.rightValue;case"like":return"string"==typeof e[t.leftField]&&"string"==typeof t.rightValue&&new RegExp("^"+t.rightValue.replace(/%/g,".*").replace(/_/g,".")+"$").test(e[t.leftField]);default:return!1}}async fetch(){const e=this.execution;if(!e)return Bt.error("fetch 失败","没有可用的执行结果,请确保已经执行了 SQL 语句并且有结果返回."),!1;const t=e.from,r=this.tables.get(t);if(!r)return Bt.error("fetch 失败",`表 ${t} 不存在,请检查 SQL 语句中的表名是否正确.`),!1;if(!r?.id){const e=!!(await(this.service?.createTable(this.name,this.execution?.from,this.execution?.result)));return await(r?.getData(!0)),e}switch(e.DML){case"update":case"replaceInto":return!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result)));case"delete":return e?.result?.length?!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result))):!!(await(this.service?.deleteTable(this.name,e?.from,r.id)));default:return!1}}},Ht=class{constructor(e){this.urls=e.urls,this.authToken=e.authToken||"",this.identifier=e.identifier||"",this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}globalParams(e,t){return{[this.keyMap.config_type]:e,[this.keyMap.config_name]:this.identifier?`${t}|${this.identifier}`:t}}async fetch(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.authToken},body:JSON.stringify(t)});if(!r.ok)throw new Error(`指令执行失败. 响应码: ${r.status}, 响应消息: ${r.statusText}`);const n=await r.json();if(200!==n.code)throw new Error(`指令执行失败. 响应码: ${n.code}, 响应消息: ${n.message}`);return n.data}async createTable(e,t,r){try{return await this.fetch(this.urls.create,{...this.globalParams(e,t),[this.keyMap.config_data]:JSON.stringify(r)}),!0}catch(n){return!1}}async updateTable(e,t,r,n){try{return await this.fetch(this.urls.update,{...this.globalParams(e,t),[this.keyMap.id]:r,[this.keyMap.config_data]:JSON.stringify(n)}),!0}catch(s){return!1}}async deleteTable(e,t,r){try{return await this.fetch(this.urls.delete,{...this.globalParams(e,t),[this.keyMap.id]:r}),!0}catch(n){return!1}}async queryTable(e,t){return(await this.fetch(this.urls.query,{...this.globalParams(e,t)}))?.[0]}};exports.Database=Jt,exports.IntegratedDb=class{constructor(e){this.databases=new Map,this.validateConfig(e),this.config=e,this.service=new Ht({urls:e.link.url,authToken:e.link.authToken,keyMap:e.fetchKeyMap,identifier:e.identifier})}validateConfig(e){if(!e.link?.url)throw new Error("IntegratedDb必须配置连接地址,请查看配置项中「link.url」是否为空");e.link?.authToken||Bt.warn("IntegratedDb","未传入「link.authToken」参数,连接存在无安全校验风险,请添加「link.authToken」以消除该警告")}openDb(e){return this.databases.has(e)||this.databases.set(e,new Jt({name:e,service:this.service,keyMap:this.config.fetchKeyMap})),this.databases.get(e)?.open(),this.databases.get(e)}closeDb(e){if(void 0===e)return this.databases.forEach(e=>e.close()),void this.databases.clear();this.databases.has(e)?(this.databases.get(e)?.close(),this.databases.delete(e)):Bt.warn("IntegratedDb",`尝试关闭数据库「${e}」,但该数据库未打开或已关闭,请检查数据库名称是否正确`)}},exports.Service=Ht,exports.copyText=async function(e,t){return Boolean(t?n(e):async function(e){try{return await(navigator?.clipboard?.writeText?.(e)),!0}catch(t){return n(e)}}(e))},exports.deleteUrlParams=function(e,t=!0){const r=new URLSearchParams(location.search);r?.delete(e);const n=r.toString();t&&history.replaceState(history.state,"",`${location.pathname}${n?`?${n}`:""}`)},exports.downloadFile=function(e,t){return new Promise(r=>{fetch(e).then(e=>e.blob()).then(e=>{const n=document.createElement("a"),s=t?.name;n.href=URL.createObjectURL(e),n.download=s,n.click(),n.remove(),URL.revokeObjectURL(n.href),r(!0)}).catch(e=>{r(!1)})})},exports.downloadFilesAsZip=async function(e,t="archive.zip"){await async function(){return Ft||(Ft=(await import("jszip")).default),Ft}(),await async function(){if(!Mt){const e=await import("file-saver");Mt={saveAs:e.saveAs||e.default||e.default?.saveAs}}return Mt}();const r=new Ft,n=[],s={},o=e=>{if(s[e]){s[e]++;const t=e.lastIndexOf(".");return-1!==t?`${e.substring(0,t)}(${s[e]})${e.substring(t)}`:`${e}(${s[e]})`}return s[e]=1,e};for(const a of e)if("string"==typeof a){const e=a,t=o(e.substring(e.lastIndexOf("/")+1)||"unknown_file");n.push(It.get(e,{responseType:"blob"}).then(e=>{r.file(t,e.data)}).catch(e=>{r.file(`${t}.error.txt`,`Download failed: ${e.message}`)}))}else{const{name:e,url:t,data:s,folder:i}=a,c=o(e),l=i?r.folder(i):r;if(!l)continue;void 0!==s?l.file(c,s):t&&n.push(It.get(t,{responseType:"blob"}).then(e=>{l.file(c,e.data)}).catch(e=>{l.file(`${c}.error.txt`,`Download failed: ${e.message}`)}))}await Promise.all(n);const i=await r.generateAsync({type:"blob"});i&&Mt?.saveAs(i,t)},exports.getFilenameWithoutExtension=function(e){const t=e.match(/\/([^\/]+)\.[\w]+$/);return t&&t[1]?t[1]:""},exports.getOsser=function(){return d},exports.getUrlParams=function(e){return new URLSearchParams(location.search)?.get(e)||""},exports.initUploadOss=async function(e,t,r,n){return await async function(){s=(await import("ali-oss")).default}(),!!s&&(u=n,"string"==typeof e?await async function(e,t,r){o=e||o,a=t||a,i=r||i;const n=await p();return!!n&&(m(n),!0)}(e,t,r):(f.refreshSTSTokenInterval=9999999,m(e),!0))},exports.ossConfiguration=h,exports.setUrlParams=function(e,t,r=!0){const n=new URLSearchParams(location.search);void 0!==n.get(e)?n.set(e,t):n.append(e,t);const s=n.toString();return r&&history.replaceState(history.state,"",`${location.pathname}?${s}`),n.toString()},exports.sleep=function(e){return new Promise(t=>setTimeout(t,e))},exports.uploadFileToOss=y,exports.uploadFilesToOss=async function(e,t){const r=e.map(e=>y(e,t));return await Promise.all(r)},exports.uuid=function(){return`${window.crypto.randomUUID()}-${Date.now()}`};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=Object.defineProperty,t=(t,r)=>{let n={};for(var s in t)e(n,s,{get:t[s],enumerable:!0});return r&&e(n,Symbol.toStringTag,{value:"Module"}),n};let r=require("element-plus");function n(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{if(document.execCommand("copy"))return!0}catch(r){return!1}document.body.removeChild(t)}var s=null,o="",i={},a={},c="",l="",u=void 0,d=null,f={accessKeyId:"",accessKeySecret:"",stsToken:"",region:"",bucket:"",refreshSTSTokenInterval:9999999};const h=new Proxy(f,{get:(e,t)=>e[t],set:()=>!1});async function p(){const e=await(await fetch(o,{headers:new Headers({"Content-Type":"application/json",...i||{}}),body:JSON.stringify(a||{}),method:"POST",credentials:"include"})).json();return e?.data?.accessKeySecret&&e?.data?.securityToken?e?.data:null}function m(e){f.accessKeyId=e.accessKeyId||f.accessKeyId,f.accessKeySecret=e.accessKeySecret||f.accessKeySecret,f.stsToken=e.securityToken||f.stsToken,f.region=e.region||f.region,f.bucket=e.bucket||f.bucket,c=e.accessUrl||c,l=e.uploadUrl||l,f.refreshSTSTokenInterval=(0,r.dayjs)(e.expiration).diff((0,r.dayjs)(),"millisecond"),f.refreshSTSToken=u||(async()=>{const e=await p();return f.refreshSTSTokenInterval=(0,r.dayjs)(e?.expiration).diff((0,r.dayjs)(),"millisecond"),{accessKeyId:e?.accessKeyId||"",accessKeySecret:e?.accessKeySecret||"",stsToken:e?.securityToken||""}}),d=new s(f)}async function y(e,t){const r=await d.put(`${t}/${e.name}`,e,{timeout:(new Date).getTime()+18e4});return r.name=r.name?.split("/").pop()||e.name,"https:"===window.location.protocol&&(r.url=r.url.replace("http://","https://")),c&&l&&(r.url=r.url.replace(c,l)),r}function g(e,t){return function(){return e.apply(t,arguments)}}var b,{toString:w}=Object.prototype,{getPrototypeOf:v}=Object,{iterator:E,toStringTag:S}=Symbol,O=(b=Object.create(null),e=>{const t=w.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())}),T=e=>(e=e.toLowerCase(),t=>O(t)===e),R=e=>t=>typeof t===e,{isArray:x}=Array,k=R("undefined");function A(e){return null!==e&&!k(e)&&null!==e.constructor&&!k(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var C=T("ArrayBuffer");var j=R("string"),_=R("function"),P=R("number"),N=e=>null!==e&&"object"==typeof e,D=e=>{if("object"!==O(e))return!1;const t=v(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||S in e||E in e)},L=T("Date"),U=T("File"),I=T("Blob"),F=T("FileList"),M=T("URLSearchParams"),[B,$,q,K]=["ReadableStream","Request","Response","Headers"].map(T);function z(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),x(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(A(e))return;const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(n=0;n<o;n++)i=s[n],t.call(null,e[i],i,e)}}function J(e,t){if(A(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}var H="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,V=e=>!k(e)&&e!==H;var W,X=(W="undefined"!=typeof Uint8Array&&v(Uint8Array),e=>W&&e instanceof W),Q=T("HTMLFormElement"),G=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Z=T("RegExp"),Y=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};z(r,(r,s)=>{let o;!1!==(o=t(r,s,e))&&(n[s]=o||r)}),Object.defineProperties(e,n)};var ee,te,re,ne,se=T("AsyncFunction"),oe=(ee="function"==typeof setImmediate,te=_(H.postMessage),ee?setImmediate:te?(re=`axios@${Math.random()}`,ne=[],H.addEventListener("message",({source:e,data:t})=>{e===H&&t===re&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),H.postMessage(re,"*")}):e=>setTimeout(e)),ie="undefined"!=typeof queueMicrotask?queueMicrotask.bind(H):"undefined"!=typeof process&&process.nextTick||oe,ae={isArray:x,isArrayBuffer:C,isBuffer:A,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||_(e.append)&&("formdata"===(t=O(e))||"object"===t&&_(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&C(e.buffer),t},isString:j,isNumber:P,isBoolean:e=>!0===e||!1===e,isObject:N,isPlainObject:D,isEmptyObject:e=>{if(!N(e)||A(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:B,isRequest:$,isResponse:q,isHeaders:K,isUndefined:k,isDate:L,isFile:U,isBlob:I,isRegExp:Z,isFunction:_,isStream:e=>N(e)&&_(e.pipe),isURLSearchParams:M,isTypedArray:X,isFileList:F,forEach:z,merge:function e(){const{caseless:t,skipUndefined:r}=V(this)&&this||{},n={},s=(s,o)=>{const i=t&&J(n,o)||o;D(n[i])&&D(s)?n[i]=e(n[i],s):D(s)?n[i]=e({},s):x(s)?n[i]=s.slice():r&&k(s)||(n[i]=s)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&z(arguments[o],s);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(z(t,(t,n)=>{r&&_(t)?e[n]=g(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&v(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:O,kindOfTest:T,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(x(e))return e;let t=e.length;if(!P(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[E]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Q,hasOwnProperty:G,hasOwnProp:G,reduceDescriptors:Y,freezeMethods:e=>{Y(e,(t,r)=>{if(_(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];_(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return x(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:J,global:H,isContextDefined:V,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[S]&&e[E])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(N(e)){if(t.indexOf(e)>=0)return;if(A(e))return e;if(!("toJSON"in e)){t[n]=e;const s=x(e)?[]:{};return z(e,(e,t)=>{const o=r(e,n+1);!k(o)&&(s[t]=o)}),t[n]=void 0,s}}return e};return r(e,0)},isAsyncFn:se,isThenable:e=>e&&(N(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:oe,asap:ie,isIterable:e=>null!=e&&_(e[E])};function ce(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)}ae.inherits(ce,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:ae.toJSONObject(this.config),code:this.code,status:this.status}}});var le=ce.prototype,ue={};["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=>{ue[e]={value:e}}),Object.defineProperties(ce,ue),Object.defineProperty(le,"isAxiosError",{value:!0}),ce.from=(e,t,r,n,s,o)=>{const i=Object.create(le);ae.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return ce.call(i,a,c,r,n,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};var de=ce;function fe(e){return ae.isPlainObject(e)||ae.isArray(e)}function he(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function pe(e,t,r){return e?e.concat(t).map(function(e,t){return e=he(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}var me=ae.toFlatObject(ae,{},null,function(e){return/^is[A-Z]/.test(e)});var ye=function(e,t,r){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=ae.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ae.isUndefined(t[e])})).metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ae.isDate(e))return e.toISOString();if(ae.isBoolean(e))return e.toString();if(!a&&ae.isBlob(e))throw new de("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(e)||ae.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(ae.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ae.isArray(e)&&function(e){return ae.isArray(e)&&!e.some(fe)}(e)||(ae.isFileList(e)||ae.endsWith(r,"[]"))&&(a=ae.toArray(e)))return r=he(r),a.forEach(function(e,n){!ae.isUndefined(e)&&null!==e&&t.append(!0===i?pe([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!fe(e)||(t.append(pe(s,r,o),c(e)),!1)}const u=[],d=Object.assign(me,{defaultVisitor:l,convertValue:c,isVisitable:fe});if(!ae.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ae.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),ae.forEach(r,function(r,o){!0===(!(ae.isUndefined(r)||null===r)&&s.call(t,r,ae.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t};function ge(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function be(e,t){this._pairs=[],e&&ye(e,this,t)}var we=be.prototype;we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){const t=e?function(t){return e.call(this,t,ge)}:ge;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ve=be;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Se(e,t,r){if(!t)return e;const n=r&&r.encode||Ee;ae.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(o=s?s(t,r):ae.isURLSearchParams(t)?t.toString():new ve(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var Oe=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ae.forEach(this.handlers,function(t){null!==t&&e(t)})}},Te={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Re={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ve,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},xe=t({hasBrowserEnv:()=>ke,hasStandardBrowserEnv:()=>Ce,hasStandardBrowserWebWorkerEnv:()=>je,navigator:()=>Ae,origin:()=>_e},1),ke="undefined"!=typeof window&&"undefined"!=typeof document,Ae="object"==typeof navigator&&navigator||void 0,Ce=ke&&(!Ae||["ReactNative","NativeScript","NS"].indexOf(Ae.product)<0),je="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,_e=ke&&window.location.href||"http://localhost",Pe={...xe,...Re};var Ne=function(e){function t(e,r,n,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&ae.isArray(n)?n.length:o,a?(ae.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i):(n[o]&&ae.isObject(n[o])||(n[o]=[]),t(e,r,n[o],s)&&ae.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const r={};return ae.forEachEntry(e,(e,n)=>{t(function(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null};var De={transitional:Te,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=ae.isObject(e);if(s&&ae.isHTMLForm(e)&&(e=new FormData(e)),ae.isFormData(e))return n?JSON.stringify(Ne(e)):e;if(ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)||ae.isReadableStream(e))return e;if(ae.isArrayBufferView(e))return e.buffer;if(ae.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ye(e,new Pe.classes.URLSearchParams,{visitor:function(e,t,r,n){return Pe.isNode&&ae.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ae.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ye(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(n){if("SyntaxError"!==n.name)throw n}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||De.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ae.isResponse(e)||ae.isReadableStream(e))return e;if(e&&ae.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(s){if(r){if("SyntaxError"===s.name)throw de.from(s,de.ERR_BAD_RESPONSE,this,null,this.response);throw s}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pe.classes.FormData,Blob:Pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{De.headers[e]={}});var Le=De,Ue=ae.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"]),Ie=Symbol("internals");function Fe(e){return e&&String(e).trim().toLowerCase()}function Me(e){return!1===e||null==e?e:ae.isArray(e)?e.map(Me):String(e)}function Be(e,t,r,n,s){return ae.isFunction(n)?n.call(this,t,r):(s&&(t=r),ae.isString(t)?ae.isString(n)?-1!==t.indexOf(n):ae.isRegExp(n)?n.test(t):void 0:void 0)}var $e=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Fe(t);if(!s)throw new Error("header name must be a non-empty string");const o=ae.findKey(n,s);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Me(e))}const o=(e,t)=>ae.forEach(e,(e,r)=>s(e,r,t));if(ae.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ae.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&Ue[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(ae.isObject(e)&&ae.isIterable(e)){let r,n,s={};for(const t of e){if(!ae.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[n=t[0]]=(r=s[n])?ae.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,r);return this}get(e,t){if(e=Fe(e)){const r=ae.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(ae.isFunction(t))return t.call(this,e,r);if(ae.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fe(e)){const r=ae.findKey(this,e);return!(!r||void 0===this[r]||t&&!Be(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Fe(e)){const s=ae.findKey(r,e);!s||t&&!Be(0,r[s],s,t)||(delete r[s],n=!0)}}return ae.isArray(e)?e.forEach(s):s(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const s=t[r];e&&!Be(0,this[s],s,e,!0)||(delete this[s],n=!0)}return n}normalize(e){const t=this,r={};return ae.forEach(this,(n,s)=>{const o=ae.findKey(r,s);if(o)return t[o]=Me(n),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(s):String(s).trim();i!==s&&delete t[s],t[i]=Me(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ae.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ae.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Ie]=this[Ie]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Fe(e);t[n]||(!function(e,t){const r=ae.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})})}(r,e),t[n]=!0)}return ae.isArray(e)?e.forEach(n):n(e),this}};$e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ae.reduceDescriptors($e.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),ae.freezeMethods($e);var qe=$e;function Ke(e,t){const r=this||Le,n=t||r,s=qe.from(n.headers);let o=n.data;return ae.forEach(e,function(e){o=e.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function ze(e){return!(!e||!e.__CANCEL__)}function Je(e,t,r){de.call(this,null==e?"canceled":e,de.ERR_CANCELED,t,r),this.name="CanceledError"}ae.inherits(Je,de,{__CANCEL__:!0});var He=Je;function Ve(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new de("Request failed with status code "+r.status,[de.ERR_BAD_REQUEST,de.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}var We=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];s||(s=c),r[o]=a,n[o]=c;let u=i,d=0;for(;u!==o;)d+=r[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}};var Xe=function(e,t){let r,n,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-a)))},()=>r&&i(r)]};const Qe=(e,t,r=3)=>{let n=0;const s=We(50,250);return Xe(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,a=o-n,c=s(a);n=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},Ge=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ze=e=>(...t)=>ae.asap(()=>e(...t));var Ye,et,tt=Pe.hasStandardBrowserEnv?(Ye=new URL(Pe.origin),et=Pe.navigator&&/(msie|trident)/i.test(Pe.navigator.userAgent),e=>(e=new URL(e,Pe.origin),Ye.protocol===e.protocol&&Ye.host===e.host&&(et||Ye.port===e.port))):()=>!0,rt=Pe.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ae.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),ae.isString(n)&&a.push(`path=${n}`),ae.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),ae.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)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:()=>null,remove(){}};function nt(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var st=e=>e instanceof qe?{...e}:e;function ot(e,t){t=t||{};const r={};function n(e,t,r,n){return ae.isPlainObject(e)&&ae.isPlainObject(t)?ae.merge.call({caseless:n},e,t):ae.isPlainObject(t)?ae.merge({},t):ae.isArray(t)?t.slice():t}function s(e,t,r,s){return ae.isUndefined(t)?ae.isUndefined(e)?void 0:n(void 0,e,0,s):n(e,t,0,s)}function o(e,t){if(!ae.isUndefined(t))return n(void 0,t)}function i(e,t){return ae.isUndefined(t)?ae.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,o){return o in t?n(r,s):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>s(st(e),st(t),0,!0)};return ae.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||s,i=o(e[n],t[n],n);ae.isUndefined(i)&&o!==a||(r[n]=i)}),r}var it=e=>{const t=ot({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=qe.from(i),t.url=Se(nt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ae.isFormData(r))if(Pe.hasStandardBrowserEnv||Pe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(ae.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Pe.hasStandardBrowserEnv&&(n&&ae.isFunction(n)&&(n=n(t)),n||!1!==n&&tt(t.url))){const e=s&&o&&rt.read(o);e&&i.set(s,e)}return t},at="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=it(e);let s=n.data;const o=qe.from(n.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const n=qe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ve(function(e){t(e),p()},function(e){r(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(r(new de("Request aborted",de.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new de(t&&t.message?t.message:"Network Error",de.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const s=n.transitional||Te;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new de(t,s.clarifyTimeoutError?de.ETIMEDOUT:de.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&ae.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ae.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),h&&([c,u]=Qe(h,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,l]=Qe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new He(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===Pe.protocols.indexOf(g)?r(new de("Unsupported protocol "+g+":",de.ERR_BAD_REQUEST,e)):m.send(s||null)})},ct=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const s=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof de?t:new He(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new de(`timeout ${t} of ms exceeded`,de.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>ae.asap(i),a}};const lt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,s=0;for(;s<r;)n=s+t,yield e.slice(s,n),s=n};var ut=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}};const dt=(e,t,r,n)=>{const s=async function*(e,t){for await(const r of ut(e))yield*lt(r,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await s.next();if(t)return a(),void e.close();let o=n.byteLength;r&&r(i+=o),e.enqueue(new Uint8Array(n))}catch(t){throw a(t),t}},cancel:e=>(a(e),s.return())},{highWaterMark:2})};var{isFunction:ft}=ae,ht=(({Request:e,Response:t})=>({Request:e,Response:t}))(ae.global),{ReadableStream:pt,TextEncoder:mt}=ae.global,yt=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},gt=e=>{e=ae.merge.call({skipUndefined:!0},ht,e);const{fetch:t,Request:r,Response:n}=e,s=t?ft(t):"function"==typeof fetch,o=ft(r),i=ft(n);if(!s)return!1;const a=s&&ft(pt),c=s&&("function"==typeof mt?(l=new mt,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=o&&a&&yt(()=>{let e=!1;const t=new r(Pe.origin,{body:new pt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&yt(()=>ae.isReadableStream(new n("").body)),f={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new de(`Response type '${e}' is not supported`,de.ERR_NOT_SUPPORT,r)})});const h=async(e,t)=>{const n=ae.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:ae.isBlob(e)?e.size:ae.isSpecCompliantForm(e)?(await new r(Pe.origin,{method:"POST",body:e}).arrayBuffer()).byteLength:ae.isArrayBufferView(e)||ae.isArrayBuffer(e)?e.byteLength:(ae.isURLSearchParams(e)&&(e+=""),ae.isString(e)?(await c(e)).byteLength:void 0))(t):n};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:b,withCredentials:w="same-origin",fetchOptions:v}=it(e),E=t||fetch;g=g?(g+"").toLowerCase():"text";let S=ct([c,l&&l.toAbortSignal()],p),O=null;const T=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let R;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(R=await h(b,a))){let e,t=new r(s,{method:"POST",body:a,duplex:"half"});if(ae.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=Ge(R,Qe(Ze(y)));a=dt(t.body,65536,e,r)}}ae.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in r.prototype,c={...v,signal:S,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new r(s,c);let l=await(o?E(O,v):E(s,c));const p=d&&("stream"===g||"response"===g);if(d&&(m||p&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=ae.toFiniteNumber(l.headers.get("content-length")),[r,s]=m&&Ge(t,Qe(Ze(m),!0))||[];l=new n(dt(l.body,65536,r,()=>{s&&s(),T&&T()}),e)}g=g||"text";let x=await f[ae.findKey(f,g)||"text"](l,e);return!p&&T&&T(),await new Promise((t,r)=>{Ve(t,r,{data:x,headers:qe.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(x){if(T&&T(),x&&"TypeError"===x.name&&/Load failed|fetch/i.test(x.message))throw Object.assign(new de("Network Error",de.ERR_NETWORK,e,O),{cause:x.cause||x});throw de.from(x,x&&x.code,e,O)}}},bt=new Map;const wt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i,a,c=o.length,l=bt;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:gt(t)),l=a;return a};wt();var vt={http:null,xhr:at,fetch:{get:wt}};ae.forEach(vt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});var Et=e=>`- ${e}`,St=e=>ae.isFunction(e)||null===e||!1===e;var Ot={getAdapter:function(e,t){e=ae.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],s=n,!St(n)&&(s=vt[(r=String(n)).toLowerCase()],void 0===s))throw new de(`Unknown adapter '${r}'`);if(s&&(ae.isFunction(s)||(s=s.get(t))))break;o[r||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new de("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Et).join("\n"):" "+Et(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:vt};function Tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new He(null,e)}function Rt(e){return Tt(e),e.headers=qe.from(e.headers),e.data=Ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ot.getAdapter(e.adapter||Le.adapter,e)(e).then(function(t){return Tt(e),t.data=Ke.call(e,e.transformResponse,t),t.headers=qe.from(t.headers),t},function(t){return ze(t)||(Tt(e),t&&t.response&&(t.response.data=Ke.call(e,e.transformResponse,t.response),t.response.headers=qe.from(t.response.headers))),Promise.reject(t)})}const xt="1.13.2";var kt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{kt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var At={};kt.transitional=function(e,t,r){return(n,s,o)=>{if(!1===e)throw new de(function(e,t){return"[Axios v"+xt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(s," has been removed"+(t?" in "+t:"")),de.ERR_DEPRECATED);return t&&!At[s]&&(At[s]=!0),!e||e(n,s,o)}},kt.spelling=function(e){return(e,t)=>!0};var Ct={assertOptions:function(e,t,r){if("object"!=typeof e)throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new de("option "+o+" must be "+r,de.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new de("Unknown option "+o,de.ERR_BAD_OPTION)}},validators:kt},jt=Ct.validators,_t=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Oe,response:new Oe}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{r.stack?t&&!String(r.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+t):r.stack=t}catch(n){}}throw r}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ot(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;void 0!==r&&Ct.assertOptions(r,{silentJSONParsing:jt.transitional(jt.boolean),forcedJSONParsing:jt.transitional(jt.boolean),clarifyTimeoutError:jt.transitional(jt.boolean)},!1),null!=n&&(ae.isFunction(n)?t.paramsSerializer={serialize:n}:Ct.assertOptions(n,{encode:jt.function,serialize:jt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ct.assertOptions(t,{baseUrl:jt.spelling("baseURL"),withXsrfToken:jt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&ae.merge(s.common,s[t.method]);s&&ae.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=qe.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[Rt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(h){t.call(this,h);break}}try{l=Rt.call(this,f)}catch(h){return Promise.reject(h)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Se(nt((e=ot(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ae.forEach(["delete","get","head","options"],function(e){_t.prototype[e]=function(t,r){return this.request(ot(r||{},{method:e,url:t,data:(r||{}).data}))}}),ae.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,s){return this.request(ot(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}_t.prototype[e]=t(),_t.prototype[e+"Form"]=t(!0)});var Pt=_t,Nt=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,s){r.reason||(r.reason=new He(e,n,s),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};var Dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Dt).forEach(([e,t])=>{Dt[t]=e});var Lt=Dt;var Ut=function e(t){const r=new Pt(t),n=g(Pt.prototype.request,r);return ae.extend(n,Pt.prototype,r,{allOwnKeys:!0}),ae.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ot(t,r))},n}(Le);Ut.Axios=Pt,Ut.CanceledError=He,Ut.CancelToken=Nt,Ut.isCancel=ze,Ut.VERSION=xt,Ut.toFormData=ye,Ut.AxiosError=de,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return ae.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=ot,Ut.AxiosHeaders=qe,Ut.formToJSON=e=>Ne(ae.isHTMLForm(e)?new FormData(e):e),Ut.getAdapter=Ot.getAdapter,Ut.HttpStatusCode=Lt,Ut.default=Ut;var It=Ut;var Ft=null,Mt=null;var Bt=class{constructor(){}static success(e="",t=""){}static info(e="",t=""){}static warn(e="",t=""){}static danger(e="",t=""){}static error(e="",t=""){}};const $t={String:"string",Number:"number",Boolean:"boolean",Json:"json",Null:"null"};var qt=class{constructor(e){this.structure=[],this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data"},this.notError=!1,this.inited=!1,this.data=[],this.name=e.name,this.db=e.db,this.structure=e.structure,this.service=e.service,this.keyMap=e?.keyMap??this.keyMap,this.open()}get structureMap(){return this.structure.reduce((e,t)=>(e[t.name]=t,e),{})}async open(){this.validate(),this.extractPrimaryKey()}close(){this.structure=[]}validate(){if(!this.name)throw new Error("表名称不能为空");if(!this.structure)throw new Error(`表 ${this.name} 的结构未定义`);const e=this.structure.filter(e=>e.primaryKey);if(e.length>1)throw new Error(`表 ${this.name} 只能有一个主键,但找到了 ${e.length} 个, 分别是: ${e.map(e=>e.name).join(", ")}`);for(const t of this.structure){if(!t.name)throw new Error(`表 ${this.name} 的某个字段名称不能为空`);if(!$t[t.type])throw new Error(`表 ${this.name} 的字段 ${t.name} 的类型 ${t.type} 无效`)}this.notError=!0}extractPrimaryKey(){this.primaryKey=this.structure.find(e=>e.primaryKey)?.name}updateStructure(e){this.structure=e,this.notError=!1,this.validate()}async fetchAsyncData(){const e=await(this.service?.queryTable(this.db,this.name));e&&(this.inited=!0,this.id=e?.[this.keyMap?.id],this.data=e?.[this.keyMap?.config_data]??[])}async getData(e=!1){return!e&&this.inited||await this.fetchAsyncData(),this.data}};const Kt=["=",">","<",">=","<=","!=","like"];var zt=class{constructor(e){this.steps=[],this._run=e}start(){const e={collect:{select:void 0,insertInto:void 0,update:void 0,replaceInto:void 0,delete:void 0,from:void 0,where:void 0,limit:void 0},sentence:{DML:void 0}};return this.steps.push(e),this.currentStep=e,this}run(){return this._run(this)}validate(e,t,r){const n=this.currentStep;if(n?.collect?.[e])return n.error=`当前步骤已存在「${e}」操作,无法重复操作,请先调用start()重置「Action」再进行操作`,Bt.error("Action",n.error),!n.error;for(let s=0;s<(t?.length||0);s++){const r=t[s];if(n?.collect?.[r])break;if(s===(t?.length||0)-1)return n.error=`${e}操作缺少必要的依赖关系,请先进行「${t.join("/")}」操作`,Bt.error("Action",n.error),!n?.error}for(let s=0;s<(r?.length||0);s++){const t=r[s];if(n?.collect?.[t])return n.error=`「${e}」操作与「${t}」操作冲突,请只保留其中一个操作重试`,Bt.error("Action",n.error),!n.error}return!n.error}select(e){return this.validate("select",[],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.select=e,this.currentStep.sentence.DML="select",this):this}insertInto(e,t,r){return this.validate("insertInto",[],["select","update","delete","replaceInto"])?(this.currentStep.collect.insertInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="insertInto",this):this}update(e,t,r){return this.validate("update",[],["select","insertInto","delete","replaceInto"])?(this.currentStep.collect.update={table:e,fields:t,values:r},this.currentStep.sentence.DML="update",this):this}replaceInto(e,t,r){return this.validate("replaceInto",[],["select","insertInto","update","delete"])?(this.currentStep.collect.replaceInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="replaceInto",this):this}delete(){return this.validate("delete",[],["select","insertInto","update","replaceInto","limit"])?(this.currentStep.collect.delete=!0,this.currentStep.sentence.DML="delete",this):this}from(e){return this.validate("from",["select","insertInto","update","delete","replaceInto"])?(this.currentStep.collect.from=e,this):this}where(e,t="AND"){if(!this.validate("where",[],["insertInto","replaceInto"]))return this;if(!e?.length)return this;const r=this.currentStep,n={segments:[],relationship:t};for(let s=0;s<e.length;s++){const t=e[s],[o,i,a]=t?.split(" ").map(e=>e.trim());if(!o||!i||void 0===a)throw r.error=`条件语句 "${t}" 格式错误,请使用 "字段 操作符 值" 的格式`,new Error(r.error);if(!Kt.includes(i))throw r.error=`条件语句 "${t}" 中的操作符 "${i}" 不受支持,请使用 ${Kt.join(", ")} 之一`,new Error(r.error);let c;if(a.startsWith("'")&&a.endsWith("'"))c=a.slice(1,-1);else if(isNaN(Number(a)))if("true"===a.toLowerCase()||"false"===a.toLowerCase())c="true"===a.toLowerCase();else{if(isNaN(Date.parse(a)))throw r.error=`条件语句 "${t}" 中的值 "${a}" 格式错误,无法解析为字符串、数字、布尔值或日期`,new Error(r.error);c=new Date(a)}else c=Number(a);n.segments.push({leftField:o,operator:i,rightValue:c})}return this.currentStep.collect.where=n,this}limit(e){return this.validate("limit",["select"],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.limit=e,this):this}},Jt=class{get execution(){return window.structuredClone(this.__executions?.[this.__executions?.length-1])}get result(){return this.__executions?.[this.__executions?.length-1]?.result}constructor(e){this.tables=new Map,this.locks=new Map,this.views=new Map,this.name="",this.closed=!1,this.name=e.name,this.service=e.service,this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}open(){this.closed=!1}close(){this.closed?Bt.error("校验失败",`数据库 ${this.name} 已经关闭,无需重复关闭.`):(delete this.service,delete this.__executions,this.tables.forEach(e=>e.close()),this.tables.clear(),this.locks.forEach(e=>e.close()),this.locks.clear(),this.views.forEach(e=>e.close()),this.views.clear(),this.closed=!0)}useTable(e,t){return this.tables.has(e)||this.tables.set(e,new qt({name:e,db:this.name,structure:t||[],service:this.service,keyMap:this.keyMap})),this.tables.get(e)}createErrorReturn(e){return{error:e.error||""}}start(){return new zt(this.run.bind(this)).start()}async run(e){const t=[];for(let n=0;n<e.steps.length;n++){const s=e.steps[n];if(s?.error){t.push(this.createErrorReturn(s));continue}if(!s?.sentence.DML){s.error="当前步骤没有明确的DML操作,无法执行,请先执行DML操作 (select/insertInto/update/replaceInto/delete)",t.push(this.createErrorReturn(s));continue}const o=s.collect?.from||(s.collect?.[s.sentence.DML])?.table,i=this.tables.get(o);if(!i||!i?.notError){s.error=`表 ${o} 不存在或错误,请先检查表.`,Bt.error("校验失败",s.error),t.push(this.createErrorReturn(s));continue}const a=0===n?await(i?.getData()):window.structuredClone(t?.[n-1]?.result||[]),c=window.structuredClone(a),l={id:i?.id,DML:s.sentence.DML,where:s.collect.where,limit:s.collect.limit||0,from:o,rawData:a,result:[]};t.push(l);try{switch(s.sentence.DML){case"select":l.result=this.runOnSelect(c,i,s);break;case"insertInto":l.result=this.runOnInsertInto(c,i,s);break;case"update":l.result=this.runOnUpdate(c,i,s);break;case"replaceInto":l.result=this.runOnReplaceInto(c,i,s);break;case"delete":l.result=this.runOnDelete(c,i,s)}}catch(r){s.error=r?.message,Bt.error("run 任务执行失败",s.error),t.push(this.createErrorReturn(s))}}return this.__executions=t,{acs:t,result:t?.[t.length-1]?.result||[],fetch:this.fetch.bind(this)}}validateTableStructure(e,t){if(t.includes("*"))return!0;const r=e.structureMap;for(let n=0;n<t.length;n++){const e=t[n];if(!r[e])return Bt.error("Table Structure",`表结构中不存在字段「${e}」,请检查表结构定义或查询字段是否正确`),!1}return!0}runOnSelect(e,t,r){if(!this.validateTableStructure(t,r?.collect.select||[]))throw new Error("表结构验证失败");if(!e?.length)return[];r?.collect.where&&(e=this.applicationConditions(e,r.collect.where));let n=[...e];return r?.collect?.select?.includes("*")||(n=e?.map(e=>{const t={};return(r?.collect.select||[]).forEach(r=>{t[r]=e[r]}),t})),Number(r?.collect?.limit)>0?n?.slice(0,r?.collect.limit):n||[]}generateRow(e,t){if(!["insertInto","replaceInto"].includes(t?.sentence?.DML))return void Bt.error("generateRow",`当前操作 ${t?.sentence?.DML} 不支持生成数据行,请检查 SQL 语句`);const r=t?.collect?.[t?.sentence?.DML];let n={};return r?.fields.forEach((e,t)=>{n[e]=r?.values[t]}),Object.keys(e.structureMap).forEach(t=>{if(void 0===n[t]){const r=e.structureMap[t];"function"==typeof r.default?n[t]=r.default():n[t]=r.default}}),n}runOnInsertInto(e,t,r){if(!this.validateTableStructure(t,r?.collect.insertInto?.fields||[]))throw new Error("表结构验证失败");if(r?.collect.insertInto?.fields.length!==r?.collect.insertInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");const n=this.generateRow(t,r);return n&&e.push(n),e}runOnUpdate(e,t,r){if(!this.validateTableStructure(t,r?.collect.update?.fields||[]))throw new Error("表结构验证失败");return this.applicationConditions(e,r?.collect.where).forEach(e=>{r?.collect.update?.fields.forEach((t,n)=>{e[t]=r?.collect.update?.values[n]})}),e}runOnReplaceInto(e,t,r){if(!this.validateTableStructure(t,r?.collect.replaceInto?.fields||[]))throw new Error("表结构验证失败");if(r?.collect.replaceInto?.fields.length!==r?.collect.replaceInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");if(!t?.primaryKey)throw new Error(`表 ${t.name} 没有定义主键,无法执行 replaceInto 操作,请检查表结构定义`);const n=r?.collect?.replaceInto?.fields?.findIndex(e=>e===t.primaryKey);if(-1===n){const n=this.generateRow(t,r);return n&&e.push(n),e}const s=r?.collect?.replaceInto?.values?.[n],o=e.findIndex(e=>e[t.primaryKey]===s),i=-1!==o?window.structuredClone(e.splice(o,1)[0]):void 0;return i&&(r?.collect.replaceInto?.fields.forEach((e,t)=>{i[e]=r?.collect.replaceInto?.values[t]}),e.push(i)),e}runOnDelete(e,t,r){return r?.collect?.where?(this.applicationConditions(e,r?.collect?.where).forEach(t=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)}),e):[]}applicationConditions(e,t){if(!t||!t.segments.length)return e;const r=new Set;return"AND"===t?.relationship&&e?.forEach(e=>r.add(e)),t?.segments?.forEach(n=>{if("AND"===t?.relationship){const e=Array.from(r);r.clear(),e.filter(e=>this.isConditionPass(e,n)&&r.add(e))}else"OR"===t?.relationship&&e?.forEach(e=>this.isConditionPass(e,n)&&r.add(e))}),Array.from(r)}isConditionPass(e,t){if(void 0===e[t.leftField])return!1;switch(t.operator){case"=":return e[t.leftField]===t.rightValue;case">":return e[t.leftField]>t.rightValue;case"<":return e[t.leftField]<t.rightValue;case">=":return e[t.leftField]>=t.rightValue;case"<=":return e[t.leftField]<=t.rightValue;case"!=":return e[t.leftField]!==t.rightValue;case"like":return"string"==typeof e[t.leftField]&&"string"==typeof t.rightValue&&new RegExp("^"+t.rightValue.replace(/%/g,".*").replace(/_/g,".")+"$").test(e[t.leftField]);default:return!1}}async fetch(){const e=this.execution;if(!e)return Bt.error("fetch 失败","没有可用的执行结果,请确保已经执行了 SQL 语句并且有结果返回."),!1;const t=e.from,r=this.tables.get(t);if(!r)return Bt.error("fetch 失败",`表 ${t} 不存在,请检查 SQL 语句中的表名是否正确.`),!1;if(!r?.id){const e=!!(await(this.service?.createTable(this.name,this.execution?.from,this.execution?.result)));return await(r?.getData(!0)),e}switch(e.DML){case"update":case"replaceInto":return!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result)));case"delete":return e?.result?.length?!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result))):!!(await(this.service?.deleteTable(this.name,e?.from,r.id)));default:return!1}}},Ht=class{constructor(e){this.urls=e.urls,this.authToken=e.authToken||"",this.identifier=e.identifier||"",this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}globalParams(e,t){return{[this.keyMap.config_type]:e,[this.keyMap.config_name]:this.identifier?`${t}|${this.identifier}`:t}}async fetch(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.authToken},body:JSON.stringify(t)});if(!r.ok)throw new Error(`指令执行失败. 响应码: ${r.status}, 响应消息: ${r.statusText}`);const n=await r.json();if(200!==n.code)throw new Error(`指令执行失败. 响应码: ${n.code}, 响应消息: ${n.message}`);return n.data}async createTable(e,t,r){try{return await this.fetch(this.urls.create,{...this.globalParams(e,t),[this.keyMap.config_data]:JSON.stringify(r)}),!0}catch(n){return!1}}async updateTable(e,t,r,n){try{return await this.fetch(this.urls.update,{...this.globalParams(e,t),[this.keyMap.id]:r,[this.keyMap.config_data]:JSON.stringify(n)}),!0}catch(s){return!1}}async deleteTable(e,t,r){try{return await this.fetch(this.urls.delete,{...this.globalParams(e,t),[this.keyMap.id]:r}),!0}catch(n){return!1}}async queryTable(e,t){return(await this.fetch(this.urls.query,{...this.globalParams(e,t)}))?.[0]}};exports.Database=Jt,exports.IntegratedDb=class{constructor(e){this.databases=new Map,this.validateConfig(e),this.config=e,this.service=new Ht({urls:e.link.url,authToken:e.link.authToken,keyMap:e.fetchKeyMap,identifier:e.identifier})}validateConfig(e){if(!e.link?.url)throw new Error("IntegratedDb必须配置连接地址,请查看配置项中「link.url」是否为空");e.link?.authToken||Bt.warn("IntegratedDb","未传入「link.authToken」参数,连接存在无安全校验风险,请添加「link.authToken」以消除该警告")}openDb(e){return this.databases.has(e)||this.databases.set(e,new Jt({name:e,service:this.service,keyMap:this.config.fetchKeyMap})),this.databases.get(e)?.open(),this.databases.get(e)}closeDb(e){if(void 0===e)return this.databases.forEach(e=>e.close()),void this.databases.clear();this.databases.has(e)?(this.databases.get(e)?.close(),this.databases.delete(e)):Bt.warn("IntegratedDb",`尝试关闭数据库「${e}」,但该数据库未打开或已关闭,请检查数据库名称是否正确`)}},exports.Service=Ht,exports.copyText=async function(e,t){return Boolean(t?n(e):async function(e){try{return await(navigator?.clipboard?.writeText?.(e)),!0}catch(t){return n(e)}}(e))},exports.deleteUrlParams=function(e,t=!0){const r=new URLSearchParams(location.search);r?.delete(e);const n=r.toString();t&&history.replaceState(history.state,"",`${location.pathname}${n?`?${n}`:""}`)},exports.downloadFile=function(e,t){return new Promise(r=>{fetch(e).then(e=>e.blob()).then(e=>{const n=document.createElement("a"),s=t?.name;n.href=URL.createObjectURL(e),n.download=s,n.click(),n.remove(),URL.revokeObjectURL(n.href),r(!0)}).catch(e=>{r(!1)})})},exports.downloadFilesAsZip=async function(e,t="archive.zip"){await async function(){return Ft||(Ft=(await import("jszip")).default),Ft}(),await async function(){if(!Mt){const e=await import("file-saver");Mt={saveAs:e.saveAs||e.default||e.default?.saveAs}}return Mt}();const r=new Ft,n=[],s={},o=e=>{if(s[e]){s[e]++;const t=e.lastIndexOf(".");return-1!==t?`${e.substring(0,t)}(${s[e]})${e.substring(t)}`:`${e}(${s[e]})`}return s[e]=1,e};for(const a of e)if("string"==typeof a){const e=a,t=o(e.substring(e.lastIndexOf("/")+1)||"unknown_file");n.push(It.get(e,{responseType:"blob"}).then(e=>{r.file(t,e.data)}).catch(e=>{r.file(`${t}.error.txt`,`Download failed: ${e.message}`)}))}else{const{name:e,url:t,data:s,folder:i}=a,c=o(e),l=i?r.folder(i):r;if(!l)continue;void 0!==s?l.file(c,s):t&&n.push(It.get(t,{responseType:"blob"}).then(e=>{l.file(c,e.data)}).catch(e=>{l.file(`${c}.error.txt`,`Download failed: ${e.message}`)}))}await Promise.all(n);const i=await r.generateAsync({type:"blob"});i&&Mt?.saveAs(i,t)},exports.getFilenameWithoutExtension=function(e){const t=e.match(/\/([^\/]+)\.[\w]+$/);return t&&t[1]?t[1]:""},exports.getOsser=function(){return d},exports.getUrlParams=function(e){return new URLSearchParams(location.search)?.get(e)||""},exports.initUploadOss=async function(e,t,r,n){return await async function(){s=(await import("ali-oss")).default}(),!!s&&(u=n,"string"==typeof e?await async function(e,t,r){o=e||o,a=t||a,i=r||i;const n=await p();return!!n&&(m(n),!0)}(e,t,r):(f.refreshSTSTokenInterval=9999999,m(e),!0))},exports.ossConfiguration=h,exports.setUrlParams=function(e,t,r=!0){const n=new URLSearchParams(location.search);void 0!==n.get(e)?n.set(e,t):n.append(e,t);const s=n.toString();return r&&history.replaceState(history.state,"",`${location.pathname}?${s}`),n.toString()},exports.sleep=function(e){return new Promise(t=>setTimeout(t,e))},exports.uploadFileToOss=y,exports.uploadFilesToOss=async function(e,t){const r=e.map(e=>y(e,t));return await Promise.all(r)},exports.uuid=function(){return`${window.crypto.randomUUID()}-${Date.now()}`};
package/shared/index.mjs CHANGED
@@ -1 +1 @@
1
- import{dayjs as e}from"element-plus";var t=Object.defineProperty,r=(e,r)=>{let n={};for(var s in e)t(n,s,{get:e[s],enumerable:!0});return r&&t(n,Symbol.toStringTag,{value:"Module"}),n};function n(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{if(document.execCommand("copy"))return!0}catch(r){return!1}document.body.removeChild(t)}async function s(e,t){return Boolean(t?n(e):async function(e){try{return await(navigator?.clipboard?.writeText?.(e)),!0}catch(t){return n(e)}}(e))}var o=null,i="",a={},c={},l="",u="",f=void 0,d=null,h={accessKeyId:"",accessKeySecret:"",stsToken:"",region:"",bucket:"",refreshSTSTokenInterval:9999999};const p=new Proxy(h,{get:(e,t)=>e[t],set:()=>!1});async function m(){const e=await(await fetch(i,{headers:new Headers({"Content-Type":"application/json",...a||{}}),body:JSON.stringify(c||{}),method:"POST",credentials:"include"})).json();return e?.data?.accessKeySecret&&e?.data?.securityToken?e?.data:null}function y(t){h.accessKeyId=t.accessKeyId||h.accessKeyId,h.accessKeySecret=t.accessKeySecret||h.accessKeySecret,h.stsToken=t.securityToken||h.stsToken,h.region=t.region||h.region,h.bucket=t.bucket||h.bucket,l=t.accessUrl||l,u=t.uploadUrl||u,h.refreshSTSTokenInterval=e(t.expiration).diff(e(),"millisecond"),h.refreshSTSToken=f||(async()=>{const t=await m();return h.refreshSTSTokenInterval=e(t?.expiration).diff(e(),"millisecond"),{accessKeyId:t?.accessKeyId||"",accessKeySecret:t?.accessKeySecret||"",stsToken:t?.securityToken||""}}),d=new o(h)}async function g(e,t,r,n){return await async function(){o=(await import("ali-oss")).default}(),!!o&&(f=n,"string"==typeof e?await async function(e,t,r){i=e||i,c=t||c,a=r||a;const n=await m();return!!n&&(y(n),!0)}(e,t,r):(h.refreshSTSTokenInterval=9999999,y(e),!0))}function w(){return d}async function b(e,t){const r=await d.put(`${t}/${e.name}`,e,{timeout:/* @__PURE__ */(new Date).getTime()+18e4});return r.name=r.name?.split("/").pop()||e.name,"https:"===window.location.protocol&&(r.url=r.url.replace("http://","https://")),l&&u&&(r.url=r.url.replace(l,u)),r}async function S(e,t){const r=e.map(e=>b(e,t));return await Promise.all(r)}function v(e){return new Promise(t=>setTimeout(t,e))}function E(e,t){return function(){return e.apply(t,arguments)}}var O,{toString:R}=Object.prototype,{getPrototypeOf:T}=Object,{iterator:k,toStringTag:A}=Symbol,x=(O=Object.create(null),e=>{const t=R.call(e);return O[t]||(O[t]=t.slice(8,-1).toLowerCase())}),C=e=>(e=e.toLowerCase(),t=>x(t)===e),_=e=>t=>typeof t===e,{isArray:j}=Array,N=_("undefined");function L(e){return null!==e&&!N(e)&&null!==e.constructor&&!N(e.constructor)&&I(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var P=C("ArrayBuffer");var D=_("string"),I=_("function"),U=_("number"),F=e=>null!==e&&"object"==typeof e,M=e=>{if("object"!==x(e))return!1;const t=T(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||A in e||k in e)},B=C("Date"),$=C("File"),q=C("Blob"),K=C("FileList"),z=C("URLSearchParams"),[J,H,V,W]=["ReadableStream","Request","Response","Headers"].map(C);function X(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),j(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(L(e))return;const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(n=0;n<o;n++)i=s[n],t.call(null,e[i],i,e)}}function Q(e,t){if(L(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}var G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Z=e=>!N(e)&&e!==G;var Y,ee=(Y="undefined"!=typeof Uint8Array&&T(Uint8Array),e=>Y&&e instanceof Y),te=C("HTMLFormElement"),re=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ne=C("RegExp"),se=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};X(r,(r,s)=>{let o;!1!==(o=t(r,s,e))&&(n[s]=o||r)}),Object.defineProperties(e,n)};var oe,ie,ae,ce,le=C("AsyncFunction"),ue=(oe="function"==typeof setImmediate,ie=I(G.postMessage),oe?setImmediate:ie?(ae=`axios@${Math.random()}`,ce=[],G.addEventListener("message",({source:e,data:t})=>{e===G&&t===ae&&ce.length&&ce.shift()()},!1),e=>{ce.push(e),G.postMessage(ae,"*")}):e=>setTimeout(e)),fe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(G):"undefined"!=typeof process&&process.nextTick||ue,de={isArray:j,isArrayBuffer:P,isBuffer:L,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||I(e.append)&&("formdata"===(t=x(e))||"object"===t&&I(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&P(e.buffer),t},isString:D,isNumber:U,isBoolean:e=>!0===e||!1===e,isObject:F,isPlainObject:M,isEmptyObject:e=>{if(!F(e)||L(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:J,isRequest:H,isResponse:V,isHeaders:W,isUndefined:N,isDate:B,isFile:$,isBlob:q,isRegExp:ne,isFunction:I,isStream:e=>F(e)&&I(e.pipe),isURLSearchParams:z,isTypedArray:ee,isFileList:K,forEach:X,merge:function e(){const{caseless:t,skipUndefined:r}=Z(this)&&this||{},n={},s=(s,o)=>{const i=t&&Q(n,o)||o;M(n[i])&&M(s)?n[i]=e(n[i],s):M(s)?n[i]=e({},s):j(s)?n[i]=s.slice():r&&N(s)||(n[i]=s)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&X(arguments[o],s);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(X(t,(t,n)=>{r&&I(t)?e[n]=E(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&T(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:x,kindOfTest:C,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(j(e))return e;let t=e.length;if(!U(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[k]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:te,hasOwnProperty:re,hasOwnProp:re,reduceDescriptors:se,freezeMethods:e=>{se(e,(t,r)=>{if(I(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];I(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return j(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Q,global:G,isContextDefined:Z,isSpecCompliantForm:function(e){return!!(e&&I(e.append)&&"FormData"===e[A]&&e[k])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(F(e)){if(t.indexOf(e)>=0)return;if(L(e))return e;if(!("toJSON"in e)){t[n]=e;const s=j(e)?[]:{};return X(e,(e,t)=>{const o=r(e,n+1);!N(o)&&(s[t]=o)}),t[n]=void 0,s}}return e};return r(e,0)},isAsyncFn:le,isThenable:e=>e&&(F(e)||I(e))&&I(e.then)&&I(e.catch),setImmediate:ue,asap:fe,isIterable:e=>null!=e&&I(e[k])};function he(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=/* @__PURE__ */(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)}de.inherits(he,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:de.toJSONObject(this.config),code:this.code,status:this.status}}});var pe=he.prototype,me={};["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=>{me[e]={value:e}}),Object.defineProperties(he,me),Object.defineProperty(pe,"isAxiosError",{value:!0}),he.from=(e,t,r,n,s,o)=>{const i=Object.create(pe);de.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return he.call(i,a,c,r,n,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};var ye=he;function ge(e){return de.isPlainObject(e)||de.isArray(e)}function we(e){return de.endsWith(e,"[]")?e.slice(0,-2):e}function be(e,t,r){return e?e.concat(t).map(function(e,t){return e=we(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}var Se=de.toFlatObject(de,{},null,function(e){return/^is[A-Z]/.test(e)});var ve=function(e,t,r){if(!de.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=de.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!de.isUndefined(t[e])})).metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(de.isDate(e))return e.toISOString();if(de.isBoolean(e))return e.toString();if(!a&&de.isBlob(e))throw new ye("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(e)||de.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(de.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(de.isArray(e)&&function(e){return de.isArray(e)&&!e.some(ge)}(e)||(de.isFileList(e)||de.endsWith(r,"[]"))&&(a=de.toArray(e)))return r=we(r),a.forEach(function(e,n){!de.isUndefined(e)&&null!==e&&t.append(!0===i?be([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!ge(e)||(t.append(be(s,r,o),c(e)),!1)}const u=[],f=Object.assign(Se,{defaultVisitor:l,convertValue:c,isVisitable:ge});if(!de.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!de.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),de.forEach(r,function(r,o){!0===(!(de.isUndefined(r)||null===r)&&s.call(t,r,de.isString(o)?o.trim():o,n,f))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t};function Ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Oe(e,t){this._pairs=[],e&&ve(e,this,t)}var Re=Oe.prototype;Re.append=function(e,t){this._pairs.push([e,t])},Re.toString=function(e){const t=e?function(t){return e.call(this,t,Ee)}:Ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Te=Oe;function ke(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ae(e,t,r){if(!t)return e;const n=r&&r.encode||ke;de.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(o=s?s(t,r):de.isURLSearchParams(t)?t.toString():new Te(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var xe=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){de.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ce={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_e={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},je=/* @__PURE__ */r({hasBrowserEnv:()=>Ne,hasStandardBrowserEnv:()=>Pe,hasStandardBrowserWebWorkerEnv:()=>De,navigator:()=>Le,origin:()=>Ie},1),Ne="undefined"!=typeof window&&"undefined"!=typeof document,Le="object"==typeof navigator&&navigator||void 0,Pe=Ne&&(!Le||["ReactNative","NativeScript","NS"].indexOf(Le.product)<0),De="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ie=Ne&&window.location.href||"http://localhost",Ue={...je,..._e};var Fe=function(e){function t(e,r,n,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&de.isArray(n)?n.length:o,a?(de.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i):(n[o]&&de.isObject(n[o])||(n[o]=[]),t(e,r,n[o],s)&&de.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i)}if(de.isFormData(e)&&de.isFunction(e.entries)){const r={};return de.forEachEntry(e,(e,n)=>{t(function(e){return de.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null};var Me={transitional:Ce,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=de.isObject(e);if(s&&de.isHTMLForm(e)&&(e=new FormData(e)),de.isFormData(e))return n?JSON.stringify(Fe(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ve(e,new Ue.classes.URLSearchParams,{visitor:function(e,t,r,n){return Ue.isNode&&de.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=de.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ve(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(de.isString(e))try{return(t||JSON.parse)(e),de.trim(e)}catch(n){if("SyntaxError"!==n.name)throw n}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Me.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(s){if(r){if("SyntaxError"===s.name)throw ye.from(s,ye.ERR_BAD_RESPONSE,this,null,this.response);throw s}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],e=>{Me.headers[e]={}});var Be=Me,$e=de.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"]),qe=Symbol("internals");function Ke(e){return e&&String(e).trim().toLowerCase()}function ze(e){return!1===e||null==e?e:de.isArray(e)?e.map(ze):String(e)}function Je(e,t,r,n,s){return de.isFunction(n)?n.call(this,t,r):(s&&(t=r),de.isString(t)?de.isString(n)?-1!==t.indexOf(n):de.isRegExp(n)?n.test(t):void 0:void 0)}var He=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Ke(t);if(!s)throw new Error("header name must be a non-empty string");const o=de.findKey(n,s);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=ze(e))}const o=(e,t)=>de.forEach(e,(e,r)=>s(e,r,t));if(de.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(de.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&$e[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(de.isObject(e)&&de.isIterable(e)){let r,n,s={};for(const t of e){if(!de.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[n=t[0]]=(r=s[n])?de.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,r);return this}get(e,t){if(e=Ke(e)){const r=de.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(de.isFunction(t))return t.call(this,e,r);if(de.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ke(e)){const r=de.findKey(this,e);return!(!r||void 0===this[r]||t&&!Je(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Ke(e)){const s=de.findKey(r,e);!s||t&&!Je(0,r[s],s,t)||(delete r[s],n=!0)}}return de.isArray(e)?e.forEach(s):s(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const s=t[r];e&&!Je(0,this[s],s,e,!0)||(delete this[s],n=!0)}return n}normalize(e){const t=this,r={};return de.forEach(this,(n,s)=>{const o=de.findKey(r,s);if(o)return t[o]=ze(n),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(s):String(s).trim();i!==s&&delete t[s],t[i]=ze(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&de.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[qe]=this[qe]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Ke(e);t[n]||(!function(e,t){const r=de.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})})}(r,e),t[n]=!0)}return de.isArray(e)?e.forEach(n):n(e),this}};He.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(He.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),de.freezeMethods(He);var Ve=He;function We(e,t){const r=this||Be,n=t||r,s=Ve.from(n.headers);let o=n.data;return de.forEach(e,function(e){o=e.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Xe(e){return!(!e||!e.__CANCEL__)}function Qe(e,t,r){ye.call(this,null==e?"canceled":e,ye.ERR_CANCELED,t,r),this.name="CanceledError"}de.inherits(Qe,ye,{__CANCEL__:!0});var Ge=Qe;function Ze(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ye("Request failed with status code "+r.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}var Ye=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];s||(s=c),r[o]=a,n[o]=c;let u=i,f=0;for(;u!==o;)f+=r[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=l&&c-l;return d?Math.round(1e3*f/d):void 0}};var et=function(e,t){let r,n,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-a)))},()=>r&&i(r)]};const tt=(e,t,r=3)=>{let n=0;const s=Ye(50,250);return et(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,a=o-n,c=s(a);n=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},rt=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},nt=e=>(...t)=>de.asap(()=>e(...t));var st,ot,it=Ue.hasStandardBrowserEnv?(st=new URL(Ue.origin),ot=Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent),e=>(e=new URL(e,Ue.origin),st.protocol===e.protocol&&st.host===e.host&&(ot||st.port===e.port))):()=>!0,at=Ue.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];de.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),de.isString(n)&&a.push(`path=${n}`),de.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),de.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(/* @__PURE__ */new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function ct(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var lt=e=>e instanceof Ve?{...e}:e;function ut(e,t){t=t||{};const r={};function n(e,t,r,n){return de.isPlainObject(e)&&de.isPlainObject(t)?de.merge.call({caseless:n},e,t):de.isPlainObject(t)?de.merge({},t):de.isArray(t)?t.slice():t}function s(e,t,r,s){return de.isUndefined(t)?de.isUndefined(e)?void 0:n(void 0,e,0,s):n(e,t,0,s)}function o(e,t){if(!de.isUndefined(t))return n(void 0,t)}function i(e,t){return de.isUndefined(t)?de.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,o){return o in t?n(r,s):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>s(lt(e),lt(t),0,!0)};return de.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||s,i=o(e[n],t[n],n);de.isUndefined(i)&&o!==a||(r[n]=i)}),r}var ft=e=>{const t=ut({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Ve.from(i),t.url=Ae(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),de.isFormData(r))if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(de.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Ue.hasStandardBrowserEnv&&(n&&de.isFunction(n)&&(n=n(t)),n||!1!==n&&it(t.url))){const e=s&&o&&at.read(o);e&&i.set(s,e)}return t},dt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=ft(e);let s=n.data;const o=Ve.from(n.headers).normalize();let i,a,c,l,u,{responseType:f,onUploadProgress:d,onDownloadProgress:h}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const n=Ve.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ze(function(e){t(e),p()},function(e){r(e),p()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(r(new ye("Request aborted",ye.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new ye(t&&t.message?t.message:"Network Error",ye.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const s=n.transitional||Ce;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ye(t,s.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&de.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),de.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),f&&"json"!==f&&(m.responseType=n.responseType),h&&([c,u]=tt(h,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=tt(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new Ge(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===Ue.protocols.indexOf(g)?r(new ye("Unsupported protocol "+g+":",ye.ERR_BAD_REQUEST,e)):m.send(s||null)})},ht=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const s=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ye?t:new Ge(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new ye(`timeout ${t} of ms exceeded`,ye.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>de.asap(i),a}};const pt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,s=0;for(;s<r;)n=s+t,yield e.slice(s,n),s=n};var mt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}};const yt=(e,t,r,n)=>{const s=async function*(e,t){for await(const r of mt(e))yield*pt(r,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await s.next();if(t)return a(),void e.close();let o=n.byteLength;r&&r(i+=o),e.enqueue(new Uint8Array(n))}catch(t){throw a(t),t}},cancel:e=>(a(e),s.return())},{highWaterMark:2})};var{isFunction:gt}=de,wt=(({Request:e,Response:t})=>({Request:e,Response:t}))(de.global),{ReadableStream:bt,TextEncoder:St}=de.global,vt=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},Et=e=>{e=de.merge.call({skipUndefined:!0},wt,e);const{fetch:t,Request:r,Response:n}=e,s=t?gt(t):"function"==typeof fetch,o=gt(r),i=gt(n);if(!s)return!1;const a=s&&gt(bt),c=s&&("function"==typeof St?(l=new St,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=o&&a&&vt(()=>{let e=!1;const t=new r(Ue.origin,{body:new bt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),f=i&&a&&vt(()=>de.isReadableStream(new n("").body)),d={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new ye(`Response type '${e}' is not supported`,ye.ERR_NOT_SUPPORT,r)})});const h=async(e,t)=>{const n=de.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:de.isBlob(e)?e.size:de.isSpecCompliantForm(e)?(await new r(Ue.origin,{method:"POST",body:e}).arrayBuffer()).byteLength:de.isArrayBufferView(e)||de.isArrayBuffer(e)?e.byteLength:(de.isURLSearchParams(e)&&(e+=""),de.isString(e)?(await c(e)).byteLength:void 0))(t):n};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:w,withCredentials:b="same-origin",fetchOptions:S}=ft(e),v=t||fetch;g=g?(g+"").toLowerCase():"text";let E=ht([c,l&&l.toAbortSignal()],p),O=null;const R=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let T;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(T=await h(w,a))){let e,t=new r(s,{method:"POST",body:a,duplex:"half"});if(de.isFormData(a)&&(e=t.headers.get("content-type"))&&w.setContentType(e),t.body){const[e,r]=rt(T,tt(nt(y)));a=yt(t.body,65536,e,r)}}de.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...S,signal:E,method:i.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};O=o&&new r(s,c);let l=await(o?v(O,S):v(s,c));const p=f&&("stream"===g||"response"===g);if(f&&(m||p&&R)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=de.toFiniteNumber(l.headers.get("content-length")),[r,s]=m&&rt(t,tt(nt(m),!0))||[];l=new n(yt(l.body,65536,r,()=>{s&&s(),R&&R()}),e)}g=g||"text";let k=await d[de.findKey(d,g)||"text"](l,e);return!p&&R&&R(),await new Promise((t,r)=>{Ze(t,r,{data:k,headers:Ve.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(k){if(R&&R(),k&&"TypeError"===k.name&&/Load failed|fetch/i.test(k.message))throw Object.assign(new ye("Network Error",ye.ERR_NETWORK,e,O),{cause:k.cause||k});throw ye.from(k,k&&k.code,e,O)}}},Ot=/* @__PURE__ */new Map;const Rt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i,a,c=o.length,l=Ot;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?/* @__PURE__ */new Map:Et(t)),l=a;return a};Rt();var Tt={http:null,xhr:dt,fetch:{get:Rt}};de.forEach(Tt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});var kt=e=>`- ${e}`,At=e=>de.isFunction(e)||null===e||!1===e;var xt={getAdapter:function(e,t){e=de.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],s=n,!At(n)&&(s=Tt[(r=String(n)).toLowerCase()],void 0===s))throw new ye(`Unknown adapter '${r}'`);if(s&&(de.isFunction(s)||(s=s.get(t))))break;o[r||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ye("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(kt).join("\n"):" "+kt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:Tt};function Ct(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ge(null,e)}function _t(e){return Ct(e),e.headers=Ve.from(e.headers),e.data=We.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(e.adapter||Be.adapter,e)(e).then(function(t){return Ct(e),t.data=We.call(e,e.transformResponse,t),t.headers=Ve.from(t.headers),t},function(t){return Xe(t)||(Ct(e),t&&t.response&&(t.response.data=We.call(e,e.transformResponse,t.response),t.response.headers=Ve.from(t.response.headers))),Promise.reject(t)})}const jt="1.13.2";var Nt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Nt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var Lt={};Nt.transitional=function(e,t,r){return(n,s,o)=>{if(!1===e)throw new ye(function(e,t){return"[Axios v"+jt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(s," has been removed"+(t?" in "+t:"")),ye.ERR_DEPRECATED);return t&&!Lt[s]&&(Lt[s]=!0),!e||e(n,s,o)}},Nt.spelling=function(e){return(e,t)=>!0};var Pt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new ye("option "+o+" must be "+r,ye.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ye("Unknown option "+o,ye.ERR_BAD_OPTION)}},validators:Nt},Dt=Pt.validators,It=class{constructor(e){this.defaults=e||{},this.interceptors={request:new xe,response:new xe}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=/* @__PURE__ */new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{r.stack?t&&!String(r.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+t):r.stack=t}catch(n){}}throw r}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ut(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;void 0!==r&&Pt.assertOptions(r,{silentJSONParsing:Dt.transitional(Dt.boolean),forcedJSONParsing:Dt.transitional(Dt.boolean),clarifyTimeoutError:Dt.transitional(Dt.boolean)},!1),null!=n&&(de.isFunction(n)?t.paramsSerializer={serialize:n}:Pt.assertOptions(n,{encode:Dt.function,serialize:Dt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Pt.assertOptions(t,{baseUrl:Dt.spelling("baseURL"),withXsrfToken:Dt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&de.merge(s.common,s[t.method]);s&&de.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Ve.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,f=0;if(!a){const e=[_t.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);f<u;)l=l.then(e[f++],e[f++]);return l}u=i.length;let d=t;for(;f<u;){const e=i[f++],t=i[f++];try{d=e(d)}catch(h){t.call(this,h);break}}try{l=_t.call(this,d)}catch(h){return Promise.reject(h)}for(f=0,u=c.length;f<u;)l=l.then(c[f++],c[f++]);return l}getUri(e){return Ae(ct((e=ut(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,r){return this.request(ut(r||{},{method:e,url:t,data:(r||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,s){return this.request(ut(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});var Ut=It,Ft=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,s){r.reason||(r.reason=new Ge(e,n,s),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};var Mt={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(Mt).forEach(([e,t])=>{Mt[t]=e});var Bt=Mt;var $t=function e(t){const r=new Ut(t),n=E(Ut.prototype.request,r);return de.extend(n,Ut.prototype,r,{allOwnKeys:!0}),de.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ut(t,r))},n}(Be);$t.Axios=Ut,$t.CanceledError=Ge,$t.CancelToken=Ft,$t.isCancel=Xe,$t.VERSION=jt,$t.toFormData=ve,$t.AxiosError=ye,$t.Cancel=$t.CanceledError,$t.all=function(e){return Promise.all(e)},$t.spread=function(e){return function(t){return e.apply(null,t)}},$t.isAxiosError=function(e){return de.isObject(e)&&!0===e.isAxiosError},$t.mergeConfig=ut,$t.AxiosHeaders=Ve,$t.formToJSON=e=>Fe(de.isHTMLForm(e)?new FormData(e):e),$t.getAdapter=xt.getAdapter,$t.HttpStatusCode=Bt,$t.default=$t;var qt=$t;function Kt(e,t){return new Promise(r=>{fetch(e).then(e=>e.blob()).then(e=>{const n=document.createElement("a"),s=t?.name;n.href=URL.createObjectURL(e),n.download=s,n.click(),n.remove(),URL.revokeObjectURL(n.href),r(!0)}).catch(e=>{r(!1)})})}var zt=null,Jt=null;async function Ht(e,t="archive.zip"){await async function(){return zt||(zt=(await import("jszip")).default),zt}(),await async function(){if(!Jt){const e=await import("file-saver");Jt={saveAs:e.saveAs||e.default||e.default?.saveAs}}return Jt}();const r=new zt,n=[],s={},o=e=>{if(s[e]){s[e]++;const t=e.lastIndexOf(".");return-1!==t?`${e.substring(0,t)}(${s[e]})${e.substring(t)}`:`${e}(${s[e]})`}return s[e]=1,e};for(const a of e)if("string"==typeof a){const e=a,t=o(e.substring(e.lastIndexOf("/")+1)||"unknown_file");n.push(qt.get(e,{responseType:"blob"}).then(e=>{r.file(t,e.data)}).catch(e=>{r.file(`${t}.error.txt`,`Download failed: ${e.message}`)}))}else{const{name:e,url:t,data:s,folder:i}=a,c=o(e),l=i?r.folder(i):r;if(!l)continue;void 0!==s?l.file(c,s):t&&n.push(qt.get(t,{responseType:"blob"}).then(e=>{l.file(c,e.data)}).catch(e=>{l.file(`${c}.error.txt`,`Download failed: ${e.message}`)}))}await Promise.all(n);const i=await r.generateAsync({type:"blob"});i&&Jt?.saveAs(i,t)}function Vt(e){return new URLSearchParams(location.search)?.get(e)||""}function Wt(e,t=!0){const r=new URLSearchParams(location.search);r?.delete(e);const n=r.toString();t&&history.replaceState(history.state,"",`${location.pathname}${n?`?${n}`:""}`)}function Xt(e,t,r=!0){const n=new URLSearchParams(location.search);void 0!==n.get(e)?n.set(e,t):n.append(e,t);const s=n.toString();return r&&history.replaceState(history.state,"",`${location.pathname}?${s}`),n.toString()}function Qt(e){const t=e.match(/\/([^\/]+)\.[\w]+$/);return t&&t[1]?t[1]:""}var Gt=class{constructor(){}static success(e="",t=""){}static info(e="",t=""){}static warn(e="",t=""){}static danger(e="",t=""){}static error(e="",t=""){}};const Zt={String:"string",Number:"number",Boolean:"boolean",Json:"json",Null:"null"};var Yt=class{constructor(e){this.structure=[],this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data"},this.notError=!1,this.inited=!1,this.data=[],this.name=e.name,this.db=e.db,this.structure=e.structure,this.service=e.service,this.keyMap=e?.keyMap??this.keyMap,this.open()}get structureMap(){return this.structure.reduce((e,t)=>(e[t.name]=t,e),{})}async open(){this.validate(),this.extractPrimaryKey()}close(){this.structure=[]}validate(){if(!this.name)throw new Error("表名称不能为空");if(!this.structure)throw new Error(`表 ${this.name} 的结构未定义`);const e=this.structure.filter(e=>e.primaryKey);if(e.length>1)throw new Error(`表 ${this.name} 只能有一个主键,但找到了 ${e.length} 个, 分别是: ${e.map(e=>e.name).join(", ")}`);for(const t of this.structure){if(!t.name)throw new Error(`表 ${this.name} 的某个字段名称不能为空`);if(!Zt[t.type])throw new Error(`表 ${this.name} 的字段 ${t.name} 的类型 ${t.type} 无效`)}this.notError=!0}extractPrimaryKey(){this.primaryKey=this.structure.find(e=>e.primaryKey)?.name}updateStructure(e){this.structure=e,this.notError=!1,this.validate()}async fetchAsyncData(){const e=await(this.service?.queryTable(this.db,this.name));e&&(this.inited=!0,this.id=e?.[this.keyMap?.id],this.data=e?.[this.keyMap?.config_data]??[])}async getData(e=!1){return!e&&this.inited||await this.fetchAsyncData(),this.data}};const er=["=",">","<",">=","<=","!=","like"];var tr=class{constructor(e){this.steps=[],this._run=e}start(){const e={collect:{select:void 0,insertInto:void 0,update:void 0,replaceInto:void 0,delete:void 0,from:void 0,where:void 0,limit:void 0},sentence:{DML:void 0}};return this.steps.push(e),this.currentStep=e,this}run(){return this._run(this)}validate(e,t,r){const n=this.currentStep;if(n?.collect?.[e])return n.error=`当前步骤已存在「${e}」操作,无法重复操作,请先调用start()重置「Action」再进行操作`,Gt.error("Action",n.error),!n.error;for(let s=0;s<(t?.length||0);s++){const r=t[s];if(n?.collect?.[r])break;if(s===(t?.length||0)-1)return n.error=`${e}操作缺少必要的依赖关系,请先进行「${t.join("/")}」操作`,Gt.error("Action",n.error),!n?.error}for(let s=0;s<(r?.length||0);s++){const t=r[s];if(n?.collect?.[t])return n.error=`「${e}」操作与「${t}」操作冲突,请只保留其中一个操作重试`,Gt.error("Action",n.error),!n.error}return!n.error}select(e){return this.validate("select",[],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.select=e,this.currentStep.sentence.DML="select",this):this}insertInto(e,t,r){return this.validate("insertInto",[],["select","update","delete","replaceInto"])?(this.currentStep.collect.insertInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="insertInto",this):this}update(e,t,r){return this.validate("update",[],["select","insertInto","delete","replaceInto"])?(this.currentStep.collect.update={table:e,fields:t,values:r},this.currentStep.sentence.DML="update",this):this}replaceInto(e,t,r){return this.validate("replaceInto",[],["select","insertInto","update","delete"])?(this.currentStep.collect.replaceInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="replaceInto",this):this}delete(){return this.validate("delete",[],["select","insertInto","update","replaceInto","limit"])?(this.currentStep.collect.delete=!0,this.currentStep.sentence.DML="delete",this):this}from(e){return this.validate("from",["select","insertInto","update","delete","replaceInto"])?(this.currentStep.collect.from=e,this):this}where(e,t="AND"){if(!this.validate("where",[],["insertInto","replaceInto"]))return this;if(!e?.length)return this;const r=this.currentStep,n={segments:[],relationship:t};for(let s=0;s<e.length;s++){const t=e[s],[o,i,a]=t?.split(" ").map(e=>e.trim());if(!o||!i||void 0===a)throw r.error=`条件语句 "${t}" 格式错误,请使用 "字段 操作符 值" 的格式`,new Error(r.error);if(!er.includes(i))throw r.error=`条件语句 "${t}" 中的操作符 "${i}" 不受支持,请使用 ${er.join(", ")} 之一`,new Error(r.error);let c;if(a.startsWith("'")&&a.endsWith("'"))c=a.slice(1,-1);else if(isNaN(Number(a)))if("true"===a.toLowerCase()||"false"===a.toLowerCase())c="true"===a.toLowerCase();else{if(isNaN(Date.parse(a)))throw r.error=`条件语句 "${t}" 中的值 "${a}" 格式错误,无法解析为字符串、数字、布尔值或日期`,new Error(r.error);c=new Date(a)}else c=Number(a);n.segments.push({leftField:o,operator:i,rightValue:c})}return this.currentStep.collect.where=n,this}limit(e){return this.validate("limit",["select"],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.limit=e,this):this}},rr=class{get execution(){return window.structuredClone(this.__executions?.[this.__executions?.length-1])}get result(){return this.__executions?.[this.__executions?.length-1]?.result}constructor(e){this.tables=/* @__PURE__ */new Map,this.locks=/* @__PURE__ */new Map,this.views=/* @__PURE__ */new Map,this.name="",this.closed=!1,this.name=e.name,this.service=e.service,this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}open(){this.closed=!1}close(){this.closed?Gt.error("校验失败",`数据库 ${this.name} 已经关闭,无需重复关闭.`):(delete this.service,delete this.__executions,this.tables.forEach(e=>e.close()),this.tables.clear(),this.locks.forEach(e=>e.close()),this.locks.clear(),this.views.forEach(e=>e.close()),this.views.clear(),this.closed=!0)}useTable(e,t){return this.tables.has(e)||this.tables.set(e,new Yt({name:e,db:this.name,structure:t||[],service:this.service,keyMap:this.keyMap})),this.tables.get(e)}createErrorReturn(e){return{error:e.error||""}}start(){return new tr(this.run.bind(this)).start()}async run(e){const t=[];for(let n=0;n<e.steps.length;n++){const s=e.steps[n];if(s?.error){t.push(this.createErrorReturn(s));continue}if(!s?.sentence.DML){s.error="当前步骤没有明确的DML操作,无法执行,请先执行DML操作 (select/insertInto/update/replaceInto/delete)",t.push(this.createErrorReturn(s));continue}const o=s.collect?.from||(s.collect?.[s.sentence.DML])?.table,i=this.tables.get(o);if(!i||!i?.notError){s.error=`表 ${o} 不存在或错误,请先检查表.`,Gt.error("校验失败",s.error),t.push(this.createErrorReturn(s));continue}const a=0===n?await(i?.getData()):window.structuredClone(t?.[n-1]?.result||[]),c=window.structuredClone(a),l={id:i?.id,DML:s.sentence.DML,where:s.collect.where,limit:s.collect.limit||0,from:o,rawData:a,result:[]};t.push(l);try{switch(s.sentence.DML){case"select":l.result=this.runOnSelect(c,i,e);break;case"insertInto":l.result=this.runOnInsertInto(c,i,e);break;case"update":l.result=this.runOnUpdate(c,i,e);break;case"replaceInto":l.result=this.runOnReplaceInto(c,i,e);break;case"delete":l.result=this.runOnDelete(c,i,e)}}catch(r){s.error=r?.message,Gt.error("run 任务执行失败",s.error),t.push(this.createErrorReturn(s))}}return this.__executions=t,{acs:t,result:t?.[t.length-1]?.result||[],fetch:this.fetch.bind(this)}}validateTableStructure(e,t){if(t.includes("*"))return!0;const r=e.structureMap;for(let n=0;n<t.length;n++){const e=t[n];if(!r[e])return Gt.error("Table Structure",`表结构中不存在字段「${e}」,请检查表结构定义或查询字段是否正确`),!1}return!0}runOnSelect(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.select||[]))throw new Error("表结构验证失败");if(!e?.length)return[];r.currentStep?.collect.where&&(e=this.applicationConditions(e,r.currentStep.collect.where));let n=[...e];return r.currentStep?.collect?.select?.includes("*")||(n=e?.map(e=>{const t={};return(r.currentStep?.collect.select||[]).forEach(r=>{t[r]=e[r]}),t})),Number(r.currentStep?.collect?.limit)>0?n?.slice(0,r.currentStep?.collect.limit):n||[]}generateRow(e,t){if(!["insertInto","replaceInto"].includes(t?.currentStep?.sentence?.DML))return void Gt.error("generateRow",`当前操作 ${t?.currentStep?.sentence?.DML} 不支持生成数据行,请检查 SQL 语句`);const r=t.currentStep?.collect?.[t?.currentStep?.sentence?.DML];let n={};return r?.fields.forEach((e,t)=>{n[e]=r?.values[t]}),Object.keys(e.structureMap).forEach(t=>{if(void 0===n[t]){const r=e.structureMap[t];"function"==typeof r.default?n[t]=r.default():n[t]=r.default}}),n}runOnInsertInto(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.insertInto?.fields||[]))throw new Error("表结构验证失败");if(r.currentStep?.collect.insertInto?.fields.length!==r.currentStep?.collect.insertInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");const n=this.generateRow(t,r);return n&&e.push(n),e}runOnUpdate(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.update?.fields||[]))throw new Error("表结构验证失败");return this.applicationConditions(e,r.currentStep?.collect.where).forEach(e=>{r.currentStep?.collect.update?.fields.forEach((t,n)=>{e[t]=r.currentStep?.collect.update?.values[n]})}),e}runOnReplaceInto(e,t,r){if(!this.validateTableStructure(t,r.currentStep?.collect.replaceInto?.fields||[]))throw new Error("表结构验证失败");if(r.currentStep?.collect.replaceInto?.fields.length!==r.currentStep?.collect.replaceInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");if(!t?.primaryKey)throw new Error(`表 ${t.name} 没有定义主键,无法执行 replaceInto 操作,请检查表结构定义`);const n=r.currentStep?.collect?.replaceInto?.fields?.findIndex(e=>e===t.primaryKey);if(-1===n){const n=this.generateRow(t,r);return n&&e.push(n),e}const s=r.currentStep?.collect?.replaceInto?.values?.[n],o=e.findIndex(e=>e[t.primaryKey]===s),i=-1!==o?window.structuredClone(e.splice(o,1)[0]):void 0;return i&&(r.currentStep?.collect.replaceInto?.fields.forEach((e,t)=>{i[e]=r.currentStep?.collect.replaceInto?.values[t]}),e.push(i)),e}runOnDelete(e,t,r){return r.currentStep?.collect?.where?(this.applicationConditions(e,r.currentStep?.collect.where).forEach(t=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)}),e):[]}applicationConditions(e,t){if(!t||!t.segments.length)return e;const r=/* @__PURE__ */new Set;return"AND"===t?.relationship&&e?.forEach(e=>r.add(e)),t?.segments?.forEach(n=>{if("AND"===t?.relationship){const e=Array.from(r);r.clear(),e.filter(e=>this.isConditionPass(e,n)&&r.add(e))}else"OR"===t?.relationship&&e?.forEach(e=>this.isConditionPass(e,n)&&r.add(e))}),Array.from(r)}isConditionPass(e,t){if(void 0===e[t.leftField])return!1;switch(t.operator){case"=":return e[t.leftField]===t.rightValue;case">":return e[t.leftField]>t.rightValue;case"<":return e[t.leftField]<t.rightValue;case">=":return e[t.leftField]>=t.rightValue;case"<=":return e[t.leftField]<=t.rightValue;case"!=":return e[t.leftField]!==t.rightValue;case"like":return"string"==typeof e[t.leftField]&&"string"==typeof t.rightValue&&/* @__PURE__ */new RegExp("^"+t.rightValue.replace(/%/g,".*").replace(/_/g,".")+"$").test(e[t.leftField]);default:return!1}}async fetch(){const e=this.execution;if(!e)return Gt.error("fetch 失败","没有可用的执行结果,请确保已经执行了 SQL 语句并且有结果返回."),!1;const t=e.from,r=this.tables.get(t);if(!r)return Gt.error("fetch 失败",`表 ${t} 不存在,请检查 SQL 语句中的表名是否正确.`),!1;if(!r?.id){const e=!!(await(this.service?.createTable(this.name,this.execution?.from,this.execution?.result)));return await(r?.getData(!0)),e}switch(e.DML){case"update":case"replaceInto":return!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result)));case"delete":return e?.result?.length?!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result))):!!(await(this.service?.deleteTable(this.name,e?.from,r.id)));default:return!1}}},nr=class{constructor(e){this.urls=e.urls,this.authToken=e.authToken||"",this.identifier=e.identifier||"",this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}globalParams(e,t){return{[this.keyMap.config_type]:e,[this.keyMap.config_name]:this.identifier?`${t}|${this.identifier}`:t}}async fetch(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.authToken},body:JSON.stringify(t)});if(!r.ok)throw new Error(`指令执行失败. 响应码: ${r.status}, 响应消息: ${r.statusText}`);const n=await r.json();if(200!==n.code)throw new Error(`指令执行失败. 响应码: ${n.code}, 响应消息: ${n.message}`);return n.data}async createTable(e,t,r){try{return await this.fetch(this.urls.create,{...this.globalParams(e,t),[this.keyMap.config_data]:JSON.stringify(r)}),!0}catch(n){return!1}}async updateTable(e,t,r,n){try{return await this.fetch(this.urls.update,{...this.globalParams(e,t),[this.keyMap.id]:r,[this.keyMap.config_data]:JSON.stringify(n)}),!0}catch(s){return!1}}async deleteTable(e,t,r){try{return await this.fetch(this.urls.delete,{...this.globalParams(e,t),[this.keyMap.id]:r}),!0}catch(n){return!1}}async queryTable(e,t){return(await this.fetch(this.urls.query,{...this.globalParams(e,t)}))?.[0]}};function sr(){return`${window.crypto.randomUUID()}-${Date.now()}`}var or=class{constructor(e){this.databases=/* @__PURE__ */new Map,this.validateConfig(e),this.config=e,this.service=new nr({urls:e.link.url,authToken:e.link.authToken,keyMap:e.fetchKeyMap,identifier:e.identifier})}validateConfig(e){if(!e.link?.url)throw new Error("IntegratedDb必须配置连接地址,请查看配置项中「link.url」是否为空");e.link?.authToken||Gt.warn("IntegratedDb","未传入「link.authToken」参数,连接存在无安全校验风险,请添加「link.authToken」以消除该警告")}openDb(e){return this.databases.has(e)||this.databases.set(e,new rr({name:e,service:this.service,keyMap:this.config.fetchKeyMap})),this.databases.get(e)?.open(),this.databases.get(e)}closeDb(e){if(void 0===e)return this.databases.forEach(e=>e.close()),void this.databases.clear();this.databases.has(e)?(this.databases.get(e)?.close(),this.databases.delete(e)):Gt.warn("IntegratedDb",`尝试关闭数据库「${e}」,但该数据库未打开或已关闭,请检查数据库名称是否正确`)}};export{rr as Database,or as IntegratedDb,nr as Service,s as copyText,Wt as deleteUrlParams,Kt as downloadFile,Ht as downloadFilesAsZip,Qt as getFilenameWithoutExtension,w as getOsser,Vt as getUrlParams,g as initUploadOss,p as ossConfiguration,Xt as setUrlParams,v as sleep,b as uploadFileToOss,S as uploadFilesToOss,sr as uuid};
1
+ import{dayjs as e}from"element-plus";var t=Object.defineProperty,r=(e,r)=>{let n={};for(var s in e)t(n,s,{get:e[s],enumerable:!0});return r&&t(n,Symbol.toStringTag,{value:"Module"}),n};function n(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{if(document.execCommand("copy"))return!0}catch(r){return!1}document.body.removeChild(t)}async function s(e,t){return Boolean(t?n(e):async function(e){try{return await(navigator?.clipboard?.writeText?.(e)),!0}catch(t){return n(e)}}(e))}var o=null,i="",a={},c={},l="",u="",f=void 0,d=null,h={accessKeyId:"",accessKeySecret:"",stsToken:"",region:"",bucket:"",refreshSTSTokenInterval:9999999};const p=new Proxy(h,{get:(e,t)=>e[t],set:()=>!1});async function m(){const e=await(await fetch(i,{headers:new Headers({"Content-Type":"application/json",...a||{}}),body:JSON.stringify(c||{}),method:"POST",credentials:"include"})).json();return e?.data?.accessKeySecret&&e?.data?.securityToken?e?.data:null}function y(t){h.accessKeyId=t.accessKeyId||h.accessKeyId,h.accessKeySecret=t.accessKeySecret||h.accessKeySecret,h.stsToken=t.securityToken||h.stsToken,h.region=t.region||h.region,h.bucket=t.bucket||h.bucket,l=t.accessUrl||l,u=t.uploadUrl||u,h.refreshSTSTokenInterval=e(t.expiration).diff(e(),"millisecond"),h.refreshSTSToken=f||(async()=>{const t=await m();return h.refreshSTSTokenInterval=e(t?.expiration).diff(e(),"millisecond"),{accessKeyId:t?.accessKeyId||"",accessKeySecret:t?.accessKeySecret||"",stsToken:t?.securityToken||""}}),d=new o(h)}async function g(e,t,r,n){return await async function(){o=(await import("ali-oss")).default}(),!!o&&(f=n,"string"==typeof e?await async function(e,t,r){i=e||i,c=t||c,a=r||a;const n=await m();return!!n&&(y(n),!0)}(e,t,r):(h.refreshSTSTokenInterval=9999999,y(e),!0))}function w(){return d}async function b(e,t){const r=await d.put(`${t}/${e.name}`,e,{timeout:/* @__PURE__ */(new Date).getTime()+18e4});return r.name=r.name?.split("/").pop()||e.name,"https:"===window.location.protocol&&(r.url=r.url.replace("http://","https://")),l&&u&&(r.url=r.url.replace(l,u)),r}async function v(e,t){const r=e.map(e=>b(e,t));return await Promise.all(r)}function E(e){return new Promise(t=>setTimeout(t,e))}function S(e,t){return function(){return e.apply(t,arguments)}}var O,{toString:R}=Object.prototype,{getPrototypeOf:T}=Object,{iterator:k,toStringTag:A}=Symbol,x=(O=Object.create(null),e=>{const t=R.call(e);return O[t]||(O[t]=t.slice(8,-1).toLowerCase())}),C=e=>(e=e.toLowerCase(),t=>x(t)===e),_=e=>t=>typeof t===e,{isArray:j}=Array,N=_("undefined");function L(e){return null!==e&&!N(e)&&null!==e.constructor&&!N(e.constructor)&&I(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var P=C("ArrayBuffer");var D=_("string"),I=_("function"),U=_("number"),F=e=>null!==e&&"object"==typeof e,M=e=>{if("object"!==x(e))return!1;const t=T(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||A in e||k in e)},B=C("Date"),$=C("File"),q=C("Blob"),K=C("FileList"),z=C("URLSearchParams"),[J,H,V,W]=["ReadableStream","Request","Response","Headers"].map(C);function X(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),j(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(L(e))return;const s=r?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(n=0;n<o;n++)i=s[n],t.call(null,e[i],i,e)}}function Q(e,t){if(L(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}var G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Z=e=>!N(e)&&e!==G;var Y,ee=(Y="undefined"!=typeof Uint8Array&&T(Uint8Array),e=>Y&&e instanceof Y),te=C("HTMLFormElement"),re=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ne=C("RegExp"),se=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};X(r,(r,s)=>{let o;!1!==(o=t(r,s,e))&&(n[s]=o||r)}),Object.defineProperties(e,n)};var oe,ie,ae,ce,le=C("AsyncFunction"),ue=(oe="function"==typeof setImmediate,ie=I(G.postMessage),oe?setImmediate:ie?(ae=`axios@${Math.random()}`,ce=[],G.addEventListener("message",({source:e,data:t})=>{e===G&&t===ae&&ce.length&&ce.shift()()},!1),e=>{ce.push(e),G.postMessage(ae,"*")}):e=>setTimeout(e)),fe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(G):"undefined"!=typeof process&&process.nextTick||ue,de={isArray:j,isArrayBuffer:P,isBuffer:L,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||I(e.append)&&("formdata"===(t=x(e))||"object"===t&&I(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&P(e.buffer),t},isString:D,isNumber:U,isBoolean:e=>!0===e||!1===e,isObject:F,isPlainObject:M,isEmptyObject:e=>{if(!F(e)||L(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:J,isRequest:H,isResponse:V,isHeaders:W,isUndefined:N,isDate:B,isFile:$,isBlob:q,isRegExp:ne,isFunction:I,isStream:e=>F(e)&&I(e.pipe),isURLSearchParams:z,isTypedArray:ee,isFileList:K,forEach:X,merge:function e(){const{caseless:t,skipUndefined:r}=Z(this)&&this||{},n={},s=(s,o)=>{const i=t&&Q(n,o)||o;M(n[i])&&M(s)?n[i]=e(n[i],s):M(s)?n[i]=e({},s):j(s)?n[i]=s.slice():r&&N(s)||(n[i]=s)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&X(arguments[o],s);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(X(t,(t,n)=>{r&&I(t)?e[n]=S(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&T(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:x,kindOfTest:C,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(j(e))return e;let t=e.length;if(!U(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[k]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:te,hasOwnProperty:re,hasOwnProp:re,reduceDescriptors:se,freezeMethods:e=>{se(e,(t,r)=>{if(I(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];I(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return j(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Q,global:G,isContextDefined:Z,isSpecCompliantForm:function(e){return!!(e&&I(e.append)&&"FormData"===e[A]&&e[k])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(F(e)){if(t.indexOf(e)>=0)return;if(L(e))return e;if(!("toJSON"in e)){t[n]=e;const s=j(e)?[]:{};return X(e,(e,t)=>{const o=r(e,n+1);!N(o)&&(s[t]=o)}),t[n]=void 0,s}}return e};return r(e,0)},isAsyncFn:le,isThenable:e=>e&&(F(e)||I(e))&&I(e.then)&&I(e.catch),setImmediate:ue,asap:fe,isIterable:e=>null!=e&&I(e[k])};function he(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=/* @__PURE__ */(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)}de.inherits(he,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:de.toJSONObject(this.config),code:this.code,status:this.status}}});var pe=he.prototype,me={};["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=>{me[e]={value:e}}),Object.defineProperties(he,me),Object.defineProperty(pe,"isAxiosError",{value:!0}),he.from=(e,t,r,n,s,o)=>{const i=Object.create(pe);de.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return he.call(i,a,c,r,n,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};var ye=he;function ge(e){return de.isPlainObject(e)||de.isArray(e)}function we(e){return de.endsWith(e,"[]")?e.slice(0,-2):e}function be(e,t,r){return e?e.concat(t).map(function(e,t){return e=we(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}var ve=de.toFlatObject(de,{},null,function(e){return/^is[A-Z]/.test(e)});var Ee=function(e,t,r){if(!de.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=de.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!de.isUndefined(t[e])})).metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&de.isSpecCompliantForm(t);if(!de.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(de.isDate(e))return e.toISOString();if(de.isBoolean(e))return e.toString();if(!a&&de.isBlob(e))throw new ye("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(e)||de.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(de.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(de.isArray(e)&&function(e){return de.isArray(e)&&!e.some(ge)}(e)||(de.isFileList(e)||de.endsWith(r,"[]"))&&(a=de.toArray(e)))return r=we(r),a.forEach(function(e,n){!de.isUndefined(e)&&null!==e&&t.append(!0===i?be([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!ge(e)||(t.append(be(s,r,o),c(e)),!1)}const u=[],f=Object.assign(ve,{defaultVisitor:l,convertValue:c,isVisitable:ge});if(!de.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!de.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),de.forEach(r,function(r,o){!0===(!(de.isUndefined(r)||null===r)&&s.call(t,r,de.isString(o)?o.trim():o,n,f))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t};function Se(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Oe(e,t){this._pairs=[],e&&Ee(e,this,t)}var Re=Oe.prototype;Re.append=function(e,t){this._pairs.push([e,t])},Re.toString=function(e){const t=e?function(t){return e.call(this,t,Se)}:Se;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Te=Oe;function ke(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ae(e,t,r){if(!t)return e;const n=r&&r.encode||ke;de.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let o;if(o=s?s(t,r):de.isURLSearchParams(t)?t.toString():new Te(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var xe=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){de.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ce={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_e={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},je=/* @__PURE__ */r({hasBrowserEnv:()=>Ne,hasStandardBrowserEnv:()=>Pe,hasStandardBrowserWebWorkerEnv:()=>De,navigator:()=>Le,origin:()=>Ie},1),Ne="undefined"!=typeof window&&"undefined"!=typeof document,Le="object"==typeof navigator&&navigator||void 0,Pe=Ne&&(!Le||["ReactNative","NativeScript","NS"].indexOf(Le.product)<0),De="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ie=Ne&&window.location.href||"http://localhost",Ue={...je,..._e};var Fe=function(e){function t(e,r,n,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&de.isArray(n)?n.length:o,a?(de.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i):(n[o]&&de.isObject(n[o])||(n[o]=[]),t(e,r,n[o],s)&&de.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i)}if(de.isFormData(e)&&de.isFunction(e.entries)){const r={};return de.forEachEntry(e,(e,n)=>{t(function(e){return de.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null};var Me={transitional:Ce,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=de.isObject(e);if(s&&de.isHTMLForm(e)&&(e=new FormData(e)),de.isFormData(e))return n?JSON.stringify(Fe(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ee(e,new Ue.classes.URLSearchParams,{visitor:function(e,t,r,n){return Ue.isNode&&de.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=de.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ee(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(de.isString(e))try{return(t||JSON.parse)(e),de.trim(e)}catch(n){if("SyntaxError"!==n.name)throw n}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Me.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(s){if(r){if("SyntaxError"===s.name)throw ye.from(s,ye.ERR_BAD_RESPONSE,this,null,this.response);throw s}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],e=>{Me.headers[e]={}});var Be=Me,$e=de.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"]),qe=Symbol("internals");function Ke(e){return e&&String(e).trim().toLowerCase()}function ze(e){return!1===e||null==e?e:de.isArray(e)?e.map(ze):String(e)}function Je(e,t,r,n,s){return de.isFunction(n)?n.call(this,t,r):(s&&(t=r),de.isString(t)?de.isString(n)?-1!==t.indexOf(n):de.isRegExp(n)?n.test(t):void 0:void 0)}var He=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Ke(t);if(!s)throw new Error("header name must be a non-empty string");const o=de.findKey(n,s);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=ze(e))}const o=(e,t)=>de.forEach(e,(e,r)=>s(e,r,t));if(de.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(de.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&$e[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(de.isObject(e)&&de.isIterable(e)){let r,n,s={};for(const t of e){if(!de.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[n=t[0]]=(r=s[n])?de.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,r);return this}get(e,t){if(e=Ke(e)){const r=de.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(de.isFunction(t))return t.call(this,e,r);if(de.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ke(e)){const r=de.findKey(this,e);return!(!r||void 0===this[r]||t&&!Je(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Ke(e)){const s=de.findKey(r,e);!s||t&&!Je(0,r[s],s,t)||(delete r[s],n=!0)}}return de.isArray(e)?e.forEach(s):s(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const s=t[r];e&&!Je(0,this[s],s,e,!0)||(delete this[s],n=!0)}return n}normalize(e){const t=this,r={};return de.forEach(this,(n,s)=>{const o=de.findKey(r,s);if(o)return t[o]=ze(n),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(s):String(s).trim();i!==s&&delete t[s],t[i]=ze(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&de.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[qe]=this[qe]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Ke(e);t[n]||(!function(e,t){const r=de.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})})}(r,e),t[n]=!0)}return de.isArray(e)?e.forEach(n):n(e),this}};He.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(He.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),de.freezeMethods(He);var Ve=He;function We(e,t){const r=this||Be,n=t||r,s=Ve.from(n.headers);let o=n.data;return de.forEach(e,function(e){o=e.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Xe(e){return!(!e||!e.__CANCEL__)}function Qe(e,t,r){ye.call(this,null==e?"canceled":e,ye.ERR_CANCELED,t,r),this.name="CanceledError"}de.inherits(Qe,ye,{__CANCEL__:!0});var Ge=Qe;function Ze(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ye("Request failed with status code "+r.status,[ye.ERR_BAD_REQUEST,ye.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}var Ye=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];s||(s=c),r[o]=a,n[o]=c;let u=i,f=0;for(;u!==o;)f+=r[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=l&&c-l;return d?Math.round(1e3*f/d):void 0}};var et=function(e,t){let r,n,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-a)))},()=>r&&i(r)]};const tt=(e,t,r=3)=>{let n=0;const s=Ye(50,250);return et(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,a=o-n,c=s(a);n=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},rt=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},nt=e=>(...t)=>de.asap(()=>e(...t));var st,ot,it=Ue.hasStandardBrowserEnv?(st=new URL(Ue.origin),ot=Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent),e=>(e=new URL(e,Ue.origin),st.protocol===e.protocol&&st.host===e.host&&(ot||st.port===e.port))):()=>!0,at=Ue.hasStandardBrowserEnv?{write(e,t,r,n,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];de.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),de.isString(n)&&a.push(`path=${n}`),de.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),de.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(/* @__PURE__ */new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function ct(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var lt=e=>e instanceof Ve?{...e}:e;function ut(e,t){t=t||{};const r={};function n(e,t,r,n){return de.isPlainObject(e)&&de.isPlainObject(t)?de.merge.call({caseless:n},e,t):de.isPlainObject(t)?de.merge({},t):de.isArray(t)?t.slice():t}function s(e,t,r,s){return de.isUndefined(t)?de.isUndefined(e)?void 0:n(void 0,e,0,s):n(e,t,0,s)}function o(e,t){if(!de.isUndefined(t))return n(void 0,t)}function i(e,t){return de.isUndefined(t)?de.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,o){return o in t?n(r,s):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>s(lt(e),lt(t),0,!0)};return de.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||s,i=o(e[n],t[n],n);de.isUndefined(i)&&o!==a||(r[n]=i)}),r}var ft=e=>{const t=ut({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Ve.from(i),t.url=Ae(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),de.isFormData(r))if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(de.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(Ue.hasStandardBrowserEnv&&(n&&de.isFunction(n)&&(n=n(t)),n||!1!==n&&it(t.url))){const e=s&&o&&at.read(o);e&&i.set(s,e)}return t},dt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=ft(e);let s=n.data;const o=Ve.from(n.headers).normalize();let i,a,c,l,u,{responseType:f,onUploadProgress:d,onDownloadProgress:h}=n;function p(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const n=Ve.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ze(function(e){t(e),p()},function(e){r(e),p()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(r(new ye("Request aborted",ye.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new ye(t&&t.message?t.message:"Network Error",ye.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const s=n.transitional||Ce;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ye(t,s.clarifyTimeoutError?ye.ETIMEDOUT:ye.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&de.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),de.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),f&&"json"!==f&&(m.responseType=n.responseType),h&&([c,u]=tt(h,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=tt(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new Ge(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);g&&-1===Ue.protocols.indexOf(g)?r(new ye("Unsupported protocol "+g+":",ye.ERR_BAD_REQUEST,e)):m.send(s||null)})},ht=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const s=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ye?t:new Ge(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new ye(`timeout ${t} of ms exceeded`,ye.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>de.asap(i),a}};const pt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,s=0;for(;s<r;)n=s+t,yield e.slice(s,n),s=n};var mt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}};const yt=(e,t,r,n)=>{const s=async function*(e,t){for await(const r of mt(e))yield*pt(r,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await s.next();if(t)return a(),void e.close();let o=n.byteLength;r&&r(i+=o),e.enqueue(new Uint8Array(n))}catch(t){throw a(t),t}},cancel:e=>(a(e),s.return())},{highWaterMark:2})};var{isFunction:gt}=de,wt=(({Request:e,Response:t})=>({Request:e,Response:t}))(de.global),{ReadableStream:bt,TextEncoder:vt}=de.global,Et=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},St=e=>{e=de.merge.call({skipUndefined:!0},wt,e);const{fetch:t,Request:r,Response:n}=e,s=t?gt(t):"function"==typeof fetch,o=gt(r),i=gt(n);if(!s)return!1;const a=s&&gt(bt),c=s&&("function"==typeof vt?(l=new vt,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=o&&a&&Et(()=>{let e=!1;const t=new r(Ue.origin,{body:new bt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),f=i&&a&&Et(()=>de.isReadableStream(new n("").body)),d={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new ye(`Response type '${e}' is not supported`,ye.ERR_NOT_SUPPORT,r)})});const h=async(e,t)=>{const n=de.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:de.isBlob(e)?e.size:de.isSpecCompliantForm(e)?(await new r(Ue.origin,{method:"POST",body:e}).arrayBuffer()).byteLength:de.isArrayBufferView(e)||de.isArrayBuffer(e)?e.byteLength:(de.isURLSearchParams(e)&&(e+=""),de.isString(e)?(await c(e)).byteLength:void 0))(t):n};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:p,onDownloadProgress:m,onUploadProgress:y,responseType:g,headers:w,withCredentials:b="same-origin",fetchOptions:v}=ft(e),E=t||fetch;g=g?(g+"").toLowerCase():"text";let S=ht([c,l&&l.toAbortSignal()],p),O=null;const R=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let T;try{if(y&&u&&"get"!==i&&"head"!==i&&0!==(T=await h(w,a))){let e,t=new r(s,{method:"POST",body:a,duplex:"half"});if(de.isFormData(a)&&(e=t.headers.get("content-type"))&&w.setContentType(e),t.body){const[e,r]=rt(T,tt(nt(y)));a=yt(t.body,65536,e,r)}}de.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...v,signal:S,method:i.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};O=o&&new r(s,c);let l=await(o?E(O,v):E(s,c));const p=f&&("stream"===g||"response"===g);if(f&&(m||p&&R)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=de.toFiniteNumber(l.headers.get("content-length")),[r,s]=m&&rt(t,tt(nt(m),!0))||[];l=new n(yt(l.body,65536,r,()=>{s&&s(),R&&R()}),e)}g=g||"text";let k=await d[de.findKey(d,g)||"text"](l,e);return!p&&R&&R(),await new Promise((t,r)=>{Ze(t,r,{data:k,headers:Ve.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(k){if(R&&R(),k&&"TypeError"===k.name&&/Load failed|fetch/i.test(k.message))throw Object.assign(new ye("Network Error",ye.ERR_NETWORK,e,O),{cause:k.cause||k});throw ye.from(k,k&&k.code,e,O)}}},Ot=/* @__PURE__ */new Map;const Rt=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,o=[n,s,r];let i,a,c=o.length,l=Ot;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?/* @__PURE__ */new Map:St(t)),l=a;return a};Rt();var Tt={http:null,xhr:dt,fetch:{get:Rt}};de.forEach(Tt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});var kt=e=>`- ${e}`,At=e=>de.isFunction(e)||null===e||!1===e;var xt={getAdapter:function(e,t){e=de.isArray(e)?e:[e];const{length:r}=e;let n,s;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],s=n,!At(n)&&(s=Tt[(r=String(n)).toLowerCase()],void 0===s))throw new ye(`Unknown adapter '${r}'`);if(s&&(de.isFunction(s)||(s=s.get(t))))break;o[r||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new ye("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(kt).join("\n"):" "+kt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:Tt};function Ct(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ge(null,e)}function _t(e){return Ct(e),e.headers=Ve.from(e.headers),e.data=We.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(e.adapter||Be.adapter,e)(e).then(function(t){return Ct(e),t.data=We.call(e,e.transformResponse,t),t.headers=Ve.from(t.headers),t},function(t){return Xe(t)||(Ct(e),t&&t.response&&(t.response.data=We.call(e,e.transformResponse,t.response),t.response.headers=Ve.from(t.response.headers))),Promise.reject(t)})}const jt="1.13.2";var Nt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Nt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var Lt={};Nt.transitional=function(e,t,r){return(n,s,o)=>{if(!1===e)throw new ye(function(e,t){return"[Axios v"+jt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}(s," has been removed"+(t?" in "+t:"")),ye.ERR_DEPRECATED);return t&&!Lt[s]&&(Lt[s]=!0),!e||e(n,s,o)}},Nt.spelling=function(e){return(e,t)=>!0};var Pt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ye("options must be an object",ye.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new ye("option "+o+" must be "+r,ye.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ye("Unknown option "+o,ye.ERR_BAD_OPTION)}},validators:Nt},Dt=Pt.validators,It=class{constructor(e){this.defaults=e||{},this.interceptors={request:new xe,response:new xe}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=/* @__PURE__ */new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{r.stack?t&&!String(r.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+t):r.stack=t}catch(n){}}throw r}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ut(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;void 0!==r&&Pt.assertOptions(r,{silentJSONParsing:Dt.transitional(Dt.boolean),forcedJSONParsing:Dt.transitional(Dt.boolean),clarifyTimeoutError:Dt.transitional(Dt.boolean)},!1),null!=n&&(de.isFunction(n)?t.paramsSerializer={serialize:n}:Pt.assertOptions(n,{encode:Dt.function,serialize:Dt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Pt.assertOptions(t,{baseUrl:Dt.spelling("baseURL"),withXsrfToken:Dt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&de.merge(s.common,s[t.method]);s&&de.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Ve.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,f=0;if(!a){const e=[_t.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);f<u;)l=l.then(e[f++],e[f++]);return l}u=i.length;let d=t;for(;f<u;){const e=i[f++],t=i[f++];try{d=e(d)}catch(h){t.call(this,h);break}}try{l=_t.call(this,d)}catch(h){return Promise.reject(h)}for(f=0,u=c.length;f<u;)l=l.then(c[f++],c[f++]);return l}getUri(e){return Ae(ct((e=ut(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,r){return this.request(ut(r||{},{method:e,url:t,data:(r||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,s){return this.request(ut(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});var Ut=It,Ft=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,s){r.reason||(r.reason=new Ge(e,n,s),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};var Mt={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(Mt).forEach(([e,t])=>{Mt[t]=e});var Bt=Mt;var $t=function e(t){const r=new Ut(t),n=S(Ut.prototype.request,r);return de.extend(n,Ut.prototype,r,{allOwnKeys:!0}),de.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ut(t,r))},n}(Be);$t.Axios=Ut,$t.CanceledError=Ge,$t.CancelToken=Ft,$t.isCancel=Xe,$t.VERSION=jt,$t.toFormData=Ee,$t.AxiosError=ye,$t.Cancel=$t.CanceledError,$t.all=function(e){return Promise.all(e)},$t.spread=function(e){return function(t){return e.apply(null,t)}},$t.isAxiosError=function(e){return de.isObject(e)&&!0===e.isAxiosError},$t.mergeConfig=ut,$t.AxiosHeaders=Ve,$t.formToJSON=e=>Fe(de.isHTMLForm(e)?new FormData(e):e),$t.getAdapter=xt.getAdapter,$t.HttpStatusCode=Bt,$t.default=$t;var qt=$t;function Kt(e,t){return new Promise(r=>{fetch(e).then(e=>e.blob()).then(e=>{const n=document.createElement("a"),s=t?.name;n.href=URL.createObjectURL(e),n.download=s,n.click(),n.remove(),URL.revokeObjectURL(n.href),r(!0)}).catch(e=>{r(!1)})})}var zt=null,Jt=null;async function Ht(e,t="archive.zip"){await async function(){return zt||(zt=(await import("jszip")).default),zt}(),await async function(){if(!Jt){const e=await import("file-saver");Jt={saveAs:e.saveAs||e.default||e.default?.saveAs}}return Jt}();const r=new zt,n=[],s={},o=e=>{if(s[e]){s[e]++;const t=e.lastIndexOf(".");return-1!==t?`${e.substring(0,t)}(${s[e]})${e.substring(t)}`:`${e}(${s[e]})`}return s[e]=1,e};for(const a of e)if("string"==typeof a){const e=a,t=o(e.substring(e.lastIndexOf("/")+1)||"unknown_file");n.push(qt.get(e,{responseType:"blob"}).then(e=>{r.file(t,e.data)}).catch(e=>{r.file(`${t}.error.txt`,`Download failed: ${e.message}`)}))}else{const{name:e,url:t,data:s,folder:i}=a,c=o(e),l=i?r.folder(i):r;if(!l)continue;void 0!==s?l.file(c,s):t&&n.push(qt.get(t,{responseType:"blob"}).then(e=>{l.file(c,e.data)}).catch(e=>{l.file(`${c}.error.txt`,`Download failed: ${e.message}`)}))}await Promise.all(n);const i=await r.generateAsync({type:"blob"});i&&Jt?.saveAs(i,t)}function Vt(e){return new URLSearchParams(location.search)?.get(e)||""}function Wt(e,t=!0){const r=new URLSearchParams(location.search);r?.delete(e);const n=r.toString();t&&history.replaceState(history.state,"",`${location.pathname}${n?`?${n}`:""}`)}function Xt(e,t,r=!0){const n=new URLSearchParams(location.search);void 0!==n.get(e)?n.set(e,t):n.append(e,t);const s=n.toString();return r&&history.replaceState(history.state,"",`${location.pathname}?${s}`),n.toString()}function Qt(e){const t=e.match(/\/([^\/]+)\.[\w]+$/);return t&&t[1]?t[1]:""}var Gt=class{constructor(){}static success(e="",t=""){}static info(e="",t=""){}static warn(e="",t=""){}static danger(e="",t=""){}static error(e="",t=""){}};const Zt={String:"string",Number:"number",Boolean:"boolean",Json:"json",Null:"null"};var Yt=class{constructor(e){this.structure=[],this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data"},this.notError=!1,this.inited=!1,this.data=[],this.name=e.name,this.db=e.db,this.structure=e.structure,this.service=e.service,this.keyMap=e?.keyMap??this.keyMap,this.open()}get structureMap(){return this.structure.reduce((e,t)=>(e[t.name]=t,e),{})}async open(){this.validate(),this.extractPrimaryKey()}close(){this.structure=[]}validate(){if(!this.name)throw new Error("表名称不能为空");if(!this.structure)throw new Error(`表 ${this.name} 的结构未定义`);const e=this.structure.filter(e=>e.primaryKey);if(e.length>1)throw new Error(`表 ${this.name} 只能有一个主键,但找到了 ${e.length} 个, 分别是: ${e.map(e=>e.name).join(", ")}`);for(const t of this.structure){if(!t.name)throw new Error(`表 ${this.name} 的某个字段名称不能为空`);if(!Zt[t.type])throw new Error(`表 ${this.name} 的字段 ${t.name} 的类型 ${t.type} 无效`)}this.notError=!0}extractPrimaryKey(){this.primaryKey=this.structure.find(e=>e.primaryKey)?.name}updateStructure(e){this.structure=e,this.notError=!1,this.validate()}async fetchAsyncData(){const e=await(this.service?.queryTable(this.db,this.name));e&&(this.inited=!0,this.id=e?.[this.keyMap?.id],this.data=e?.[this.keyMap?.config_data]??[])}async getData(e=!1){return!e&&this.inited||await this.fetchAsyncData(),this.data}};const er=["=",">","<",">=","<=","!=","like"];var tr=class{constructor(e){this.steps=[],this._run=e}start(){const e={collect:{select:void 0,insertInto:void 0,update:void 0,replaceInto:void 0,delete:void 0,from:void 0,where:void 0,limit:void 0},sentence:{DML:void 0}};return this.steps.push(e),this.currentStep=e,this}run(){return this._run(this)}validate(e,t,r){const n=this.currentStep;if(n?.collect?.[e])return n.error=`当前步骤已存在「${e}」操作,无法重复操作,请先调用start()重置「Action」再进行操作`,Gt.error("Action",n.error),!n.error;for(let s=0;s<(t?.length||0);s++){const r=t[s];if(n?.collect?.[r])break;if(s===(t?.length||0)-1)return n.error=`${e}操作缺少必要的依赖关系,请先进行「${t.join("/")}」操作`,Gt.error("Action",n.error),!n?.error}for(let s=0;s<(r?.length||0);s++){const t=r[s];if(n?.collect?.[t])return n.error=`「${e}」操作与「${t}」操作冲突,请只保留其中一个操作重试`,Gt.error("Action",n.error),!n.error}return!n.error}select(e){return this.validate("select",[],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.select=e,this.currentStep.sentence.DML="select",this):this}insertInto(e,t,r){return this.validate("insertInto",[],["select","update","delete","replaceInto"])?(this.currentStep.collect.insertInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="insertInto",this):this}update(e,t,r){return this.validate("update",[],["select","insertInto","delete","replaceInto"])?(this.currentStep.collect.update={table:e,fields:t,values:r},this.currentStep.sentence.DML="update",this):this}replaceInto(e,t,r){return this.validate("replaceInto",[],["select","insertInto","update","delete"])?(this.currentStep.collect.replaceInto={table:e,fields:t,values:r},this.currentStep.sentence.DML="replaceInto",this):this}delete(){return this.validate("delete",[],["select","insertInto","update","replaceInto","limit"])?(this.currentStep.collect.delete=!0,this.currentStep.sentence.DML="delete",this):this}from(e){return this.validate("from",["select","insertInto","update","delete","replaceInto"])?(this.currentStep.collect.from=e,this):this}where(e,t="AND"){if(!this.validate("where",[],["insertInto","replaceInto"]))return this;if(!e?.length)return this;const r=this.currentStep,n={segments:[],relationship:t};for(let s=0;s<e.length;s++){const t=e[s],[o,i,a]=t?.split(" ").map(e=>e.trim());if(!o||!i||void 0===a)throw r.error=`条件语句 "${t}" 格式错误,请使用 "字段 操作符 值" 的格式`,new Error(r.error);if(!er.includes(i))throw r.error=`条件语句 "${t}" 中的操作符 "${i}" 不受支持,请使用 ${er.join(", ")} 之一`,new Error(r.error);let c;if(a.startsWith("'")&&a.endsWith("'"))c=a.slice(1,-1);else if(isNaN(Number(a)))if("true"===a.toLowerCase()||"false"===a.toLowerCase())c="true"===a.toLowerCase();else{if(isNaN(Date.parse(a)))throw r.error=`条件语句 "${t}" 中的值 "${a}" 格式错误,无法解析为字符串、数字、布尔值或日期`,new Error(r.error);c=new Date(a)}else c=Number(a);n.segments.push({leftField:o,operator:i,rightValue:c})}return this.currentStep.collect.where=n,this}limit(e){return this.validate("limit",["select"],["insertInto","update","delete","replaceInto"])?(this.currentStep.collect.limit=e,this):this}},rr=class{get execution(){return window.structuredClone(this.__executions?.[this.__executions?.length-1])}get result(){return this.__executions?.[this.__executions?.length-1]?.result}constructor(e){this.tables=/* @__PURE__ */new Map,this.locks=/* @__PURE__ */new Map,this.views=/* @__PURE__ */new Map,this.name="",this.closed=!1,this.name=e.name,this.service=e.service,this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}open(){this.closed=!1}close(){this.closed?Gt.error("校验失败",`数据库 ${this.name} 已经关闭,无需重复关闭.`):(delete this.service,delete this.__executions,this.tables.forEach(e=>e.close()),this.tables.clear(),this.locks.forEach(e=>e.close()),this.locks.clear(),this.views.forEach(e=>e.close()),this.views.clear(),this.closed=!0)}useTable(e,t){return this.tables.has(e)||this.tables.set(e,new Yt({name:e,db:this.name,structure:t||[],service:this.service,keyMap:this.keyMap})),this.tables.get(e)}createErrorReturn(e){return{error:e.error||""}}start(){return new tr(this.run.bind(this)).start()}async run(e){const t=[];for(let n=0;n<e.steps.length;n++){const s=e.steps[n];if(s?.error){t.push(this.createErrorReturn(s));continue}if(!s?.sentence.DML){s.error="当前步骤没有明确的DML操作,无法执行,请先执行DML操作 (select/insertInto/update/replaceInto/delete)",t.push(this.createErrorReturn(s));continue}const o=s.collect?.from||(s.collect?.[s.sentence.DML])?.table,i=this.tables.get(o);if(!i||!i?.notError){s.error=`表 ${o} 不存在或错误,请先检查表.`,Gt.error("校验失败",s.error),t.push(this.createErrorReturn(s));continue}const a=0===n?await(i?.getData()):window.structuredClone(t?.[n-1]?.result||[]),c=window.structuredClone(a),l={id:i?.id,DML:s.sentence.DML,where:s.collect.where,limit:s.collect.limit||0,from:o,rawData:a,result:[]};t.push(l);try{switch(s.sentence.DML){case"select":l.result=this.runOnSelect(c,i,s);break;case"insertInto":l.result=this.runOnInsertInto(c,i,s);break;case"update":l.result=this.runOnUpdate(c,i,s);break;case"replaceInto":l.result=this.runOnReplaceInto(c,i,s);break;case"delete":l.result=this.runOnDelete(c,i,s)}}catch(r){s.error=r?.message,Gt.error("run 任务执行失败",s.error),t.push(this.createErrorReturn(s))}}return this.__executions=t,{acs:t,result:t?.[t.length-1]?.result||[],fetch:this.fetch.bind(this)}}validateTableStructure(e,t){if(t.includes("*"))return!0;const r=e.structureMap;for(let n=0;n<t.length;n++){const e=t[n];if(!r[e])return Gt.error("Table Structure",`表结构中不存在字段「${e}」,请检查表结构定义或查询字段是否正确`),!1}return!0}runOnSelect(e,t,r){if(!this.validateTableStructure(t,r?.collect.select||[]))throw new Error("表结构验证失败");if(!e?.length)return[];r?.collect.where&&(e=this.applicationConditions(e,r.collect.where));let n=[...e];return r?.collect?.select?.includes("*")||(n=e?.map(e=>{const t={};return(r?.collect.select||[]).forEach(r=>{t[r]=e[r]}),t})),Number(r?.collect?.limit)>0?n?.slice(0,r?.collect.limit):n||[]}generateRow(e,t){if(!["insertInto","replaceInto"].includes(t?.sentence?.DML))return void Gt.error("generateRow",`当前操作 ${t?.sentence?.DML} 不支持生成数据行,请检查 SQL 语句`);const r=t?.collect?.[t?.sentence?.DML];let n={};return r?.fields.forEach((e,t)=>{n[e]=r?.values[t]}),Object.keys(e.structureMap).forEach(t=>{if(void 0===n[t]){const r=e.structureMap[t];"function"==typeof r.default?n[t]=r.default():n[t]=r.default}}),n}runOnInsertInto(e,t,r){if(!this.validateTableStructure(t,r?.collect.insertInto?.fields||[]))throw new Error("表结构验证失败");if(r?.collect.insertInto?.fields.length!==r?.collect.insertInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");const n=this.generateRow(t,r);return n&&e.push(n),e}runOnUpdate(e,t,r){if(!this.validateTableStructure(t,r?.collect.update?.fields||[]))throw new Error("表结构验证失败");return this.applicationConditions(e,r?.collect.where).forEach(e=>{r?.collect.update?.fields.forEach((t,n)=>{e[t]=r?.collect.update?.values[n]})}),e}runOnReplaceInto(e,t,r){if(!this.validateTableStructure(t,r?.collect.replaceInto?.fields||[]))throw new Error("表结构验证失败");if(r?.collect.replaceInto?.fields.length!==r?.collect.replaceInto?.values.length)throw new Error("插入数据的字段数量与值数量不匹配");if(!t?.primaryKey)throw new Error(`表 ${t.name} 没有定义主键,无法执行 replaceInto 操作,请检查表结构定义`);const n=r?.collect?.replaceInto?.fields?.findIndex(e=>e===t.primaryKey);if(-1===n){const n=this.generateRow(t,r);return n&&e.push(n),e}const s=r?.collect?.replaceInto?.values?.[n],o=e.findIndex(e=>e[t.primaryKey]===s),i=-1!==o?window.structuredClone(e.splice(o,1)[0]):void 0;return i&&(r?.collect.replaceInto?.fields.forEach((e,t)=>{i[e]=r?.collect.replaceInto?.values[t]}),e.push(i)),e}runOnDelete(e,t,r){return r?.collect?.where?(this.applicationConditions(e,r?.collect?.where).forEach(t=>{const r=e.indexOf(t);-1!==r&&e.splice(r,1)}),e):[]}applicationConditions(e,t){if(!t||!t.segments.length)return e;const r=/* @__PURE__ */new Set;return"AND"===t?.relationship&&e?.forEach(e=>r.add(e)),t?.segments?.forEach(n=>{if("AND"===t?.relationship){const e=Array.from(r);r.clear(),e.filter(e=>this.isConditionPass(e,n)&&r.add(e))}else"OR"===t?.relationship&&e?.forEach(e=>this.isConditionPass(e,n)&&r.add(e))}),Array.from(r)}isConditionPass(e,t){if(void 0===e[t.leftField])return!1;switch(t.operator){case"=":return e[t.leftField]===t.rightValue;case">":return e[t.leftField]>t.rightValue;case"<":return e[t.leftField]<t.rightValue;case">=":return e[t.leftField]>=t.rightValue;case"<=":return e[t.leftField]<=t.rightValue;case"!=":return e[t.leftField]!==t.rightValue;case"like":return"string"==typeof e[t.leftField]&&"string"==typeof t.rightValue&&/* @__PURE__ */new RegExp("^"+t.rightValue.replace(/%/g,".*").replace(/_/g,".")+"$").test(e[t.leftField]);default:return!1}}async fetch(){const e=this.execution;if(!e)return Gt.error("fetch 失败","没有可用的执行结果,请确保已经执行了 SQL 语句并且有结果返回."),!1;const t=e.from,r=this.tables.get(t);if(!r)return Gt.error("fetch 失败",`表 ${t} 不存在,请检查 SQL 语句中的表名是否正确.`),!1;if(!r?.id){const e=!!(await(this.service?.createTable(this.name,this.execution?.from,this.execution?.result)));return await(r?.getData(!0)),e}switch(e.DML){case"update":case"replaceInto":return!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result)));case"delete":return e?.result?.length?!!(await(this.service?.updateTable(this.name,e?.from,r.id,e.result))):!!(await(this.service?.deleteTable(this.name,e?.from,r.id)));default:return!1}}},nr=class{constructor(e){this.urls=e.urls,this.authToken=e.authToken||"",this.identifier=e.identifier||"",this.keyMap={id:"id",config_type:"config_type",config_name:"config_name",config_data:"config_data",...e?.keyMap||{}}}globalParams(e,t){return{[this.keyMap.config_type]:e,[this.keyMap.config_name]:this.identifier?`${t}|${this.identifier}`:t}}async fetch(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.authToken},body:JSON.stringify(t)});if(!r.ok)throw new Error(`指令执行失败. 响应码: ${r.status}, 响应消息: ${r.statusText}`);const n=await r.json();if(200!==n.code)throw new Error(`指令执行失败. 响应码: ${n.code}, 响应消息: ${n.message}`);return n.data}async createTable(e,t,r){try{return await this.fetch(this.urls.create,{...this.globalParams(e,t),[this.keyMap.config_data]:JSON.stringify(r)}),!0}catch(n){return!1}}async updateTable(e,t,r,n){try{return await this.fetch(this.urls.update,{...this.globalParams(e,t),[this.keyMap.id]:r,[this.keyMap.config_data]:JSON.stringify(n)}),!0}catch(s){return!1}}async deleteTable(e,t,r){try{return await this.fetch(this.urls.delete,{...this.globalParams(e,t),[this.keyMap.id]:r}),!0}catch(n){return!1}}async queryTable(e,t){return(await this.fetch(this.urls.query,{...this.globalParams(e,t)}))?.[0]}};function sr(){return`${window.crypto.randomUUID()}-${Date.now()}`}var or=class{constructor(e){this.databases=/* @__PURE__ */new Map,this.validateConfig(e),this.config=e,this.service=new nr({urls:e.link.url,authToken:e.link.authToken,keyMap:e.fetchKeyMap,identifier:e.identifier})}validateConfig(e){if(!e.link?.url)throw new Error("IntegratedDb必须配置连接地址,请查看配置项中「link.url」是否为空");e.link?.authToken||Gt.warn("IntegratedDb","未传入「link.authToken」参数,连接存在无安全校验风险,请添加「link.authToken」以消除该警告")}openDb(e){return this.databases.has(e)||this.databases.set(e,new rr({name:e,service:this.service,keyMap:this.config.fetchKeyMap})),this.databases.get(e)?.open(),this.databases.get(e)}closeDb(e){if(void 0===e)return this.databases.forEach(e=>e.close()),void this.databases.clear();this.databases.has(e)?(this.databases.get(e)?.close(),this.databases.delete(e)):Gt.warn("IntegratedDb",`尝试关闭数据库「${e}」,但该数据库未打开或已关闭,请检查数据库名称是否正确`)}};export{rr as Database,or as IntegratedDb,nr as Service,s as copyText,Wt as deleteUrlParams,Kt as downloadFile,Ht as downloadFilesAsZip,Qt as getFilenameWithoutExtension,w as getOsser,Vt as getUrlParams,g as initUploadOss,p as ossConfiguration,Xt as setUrlParams,E as sleep,b as uploadFileToOss,v as uploadFilesToOss,sr as uuid};
@@ -44,8 +44,8 @@ export interface TActionRun {
44
44
  (action: Action): Promise<TIntegratedDbRunReturn>;
45
45
  }
46
46
  export declare class Action {
47
+ private currentStep;
47
48
  steps: TActionStep[];
48
- currentStep: TActionStep | undefined;
49
49
  private _run;
50
50
  constructor(run: TActionRun);
51
51
  start(): this;