seatable-html-page-sdk 0.0.11-beta.1 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/sdk.js +1 -1
- package/es/sdk.js.map +1 -1
- package/lib/sdk.js +1 -1
- package/lib/sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLPageSDK=t()}(this,function(){"use strict";function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:s}=Symbol,o=(i=Object.create(null),e=>{const n=t.call(e);return i[n]||(i[n]=n.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>o(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined");function d(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const p=a("ArrayBuffer");const f=c("string"),h=c("function"),m=c("number"),g=e=>null!==e&&"object"==typeof e,y=e=>{if("object"!==o(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||r in e)},b=a("Date"),w=a("File"),E=a("Blob"),R=a("FileList"),v=a("URLSearchParams"),[O,T,S,A]=["ReadableStream","Request","Response","Headers"].map(a);function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(d(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function P(e,t){if(d(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=e=>!u(e)&&e!==U;const k=(x="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>x&&e instanceof x);var x;const C=a("HTMLFormElement"),j=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),L=a("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const D=a("AsyncFunction"),I=(q="function"==typeof setImmediate,B=h(U.postMessage),q?setImmediate:B?(M=`axios@${Math.random()}`,$=[],U.addEventListener("message",({source:e,data:t})=>{e===U&&t===M&&$.length&&$.shift()()},!1),e=>{$.push(e),U.postMessage(M,"*")}):e=>setTimeout(e));var q,B,M,$;const K="undefined"!=typeof queueMicrotask?queueMicrotask.bind(U):"undefined"!=typeof process&&process.nextTick||I;var z={isArray:l,isArrayBuffer:p,isBuffer:d,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=o(e))||"object"===t&&h(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:f,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:g,isPlainObject:y,isEmptyObject:e=>{if(!g(e)||d(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:O,isRequest:T,isResponse:S,isHeaders:A,isUndefined:u,isDate:b,isFile:w,isBlob:E,isRegExp:L,isFunction:h,isStream:e=>g(e)&&h(e.pipe),isURLSearchParams:v,isTypedArray:k,isFileList:R,forEach:_,merge:function e(){const{caseless:t,skipUndefined:n}=N(this)&&this||{},r={},s=(s,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&P(r,o)||o;y(r[i])&&y(s)?r[i]=e(r[i],s):y(s)?r[i]=e({},s):l(s)?r[i]=s.slice():n&&u(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],s);return r},extend:(t,n,r,{allOwnKeys:s}={})=>(_(n,(n,s)=>{r&&h(n)?Object.defineProperty(t,s,{value:e(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,s)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],s&&!s(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let s;for(;(s=n.next())&&!s.done;){const n=s.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:C,hasOwnProperty:j,hasOwnProp:j,reduceDescriptors:F,freezeMethods:e=>{F(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:P,global:U,isContextDefined:N,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[s]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(g(e)){if(t.indexOf(e)>=0)return;if(d(e))return e;if(!("toJSON"in e)){t[r]=e;const s=l(e)?[]:{};return _(e,(e,t)=>{const o=n(e,r+1);!u(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:D,isThenable:e=>e&&(g(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:I,asap:K,isIterable:e=>null!=e&&h(e[r])};class H extends Error{static from(e,t,n,r,s,o){const i=new H(e.message,t||e.code,n,r,s);return i.cause=e,i.name=e.name,o&&Object.assign(i,o),i}constructor(e,t,n,r,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){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:z.toJSONObject(this.config),code:this.code,status:this.status}}}H.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",H.ERR_BAD_OPTION="ERR_BAD_OPTION",H.ECONNABORTED="ECONNABORTED",H.ETIMEDOUT="ETIMEDOUT",H.ERR_NETWORK="ERR_NETWORK",H.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",H.ERR_DEPRECATED="ERR_DEPRECATED",H.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",H.ERR_BAD_REQUEST="ERR_BAD_REQUEST",H.ERR_CANCELED="ERR_CANCELED",H.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",H.ERR_INVALID_URL="ERR_INVALID_URL";var W=H;function J(e){return z.isPlainObject(e)||z.isArray(e)}function V(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=V(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const G=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(z.isBoolean(e))return e.toString();if(!a&&z.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(J)}(e)||(z.isFileList(e)||z.endsWith(n,"[]"))&&(a=z.toArray(e)))return n=V(n),a.forEach(function(e,r){!z.isUndefined(e)&&null!==e&&t.append(!0===i?X([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!J(e)||(t.append(X(s,n,o),c(e)),!1)}const u=[],d=Object.assign(G,{defaultVisitor:l,convertValue:c,isVisitable:J});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!z.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),z.forEach(n,function(n,o){!0===(!(z.isUndefined(n)||null===n)&&s.call(t,n,z.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Q(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Z(e,t){this._pairs=[],e&&Y(e,this,t)}const ee=Z.prototype;function te(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ne(e,t,n){if(!t)return e;const r=n&&n.encode||te,s=z.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(i=o?o(t,s):z.isURLSearchParams(t)?t.toString():new Z(t,s).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ee.append=function(e,t){this._pairs.push([e,t])},ee.toString=function(e){const t=e?function(t){return e.call(this,t,Q)}:Q;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var re=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},oe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Z,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ie="undefined"!=typeof window&&"undefined"!=typeof document,ae="object"==typeof navigator&&navigator||void 0,ce=ie&&(!ae||["ReactNative","NativeScript","NS"].indexOf(ae.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ue=ie&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ie,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ce,navigator:ae,origin:ue}),...oe};function pe(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&z.isArray(r)?r.length:o,a)return z.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&z.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&z.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(e,r)=>{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const fe={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=z.isObject(e);s&&z.isHTMLForm(e)&&(e=new FormData(e));if(z.isFormData(e))return r?JSON.stringify(pe(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var he=fe;const me=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ge=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:z.isArray(e)?e.map(be):String(e)}function we(e,t,n,r,s){return z.isFunction(r)?r.call(this,t,n):(s&&(t=n),z.isString(t)?z.isString(r)?-1!==t.indexOf(r):z.isRegExp(r)?r.test(t):void 0:void 0)}class Ee{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=ye(t);if(!s)throw new Error("header name must be a non-empty string");const o=z.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=be(e))}const o=(e,t)=>z.forEach(e,(e,n)=>s(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&me[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(z.isObject(e)&&z.isIterable(e)){let n,r,s={};for(const t of e){if(!z.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?z.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=ye(e)){const n=z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=z.findKey(this,e);return!(!n||void 0===this[n]||t&&!we(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=ye(e)){const s=z.findKey(n,e);!s||t&&!we(0,n[s],s,t)||(delete n[s],r=!0)}}return z.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!we(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return z.forEach(this,(r,s)=>{const o=z.findKey(n,s);if(o)return t[o]=be(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=be(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ge]=this[ge]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}}Ee.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(Ee.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(Ee);var Re=Ee;function ve(e,t){const n=this||he,r=t||n,s=Re.from(r.headers);let o=r.data;return z.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Oe(e){return!(!e||!e.__CANCEL__)}var Te=class extends W{constructor(e,t,n){super(null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Se(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const Ae=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=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:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pe=e=>(...t)=>z.asap(()=>e(...t));var Ue=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ne=de.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];z.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),z.isString(r)&&a.push(`path=${r}`),z.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),z.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 ke(e,t,n){let r=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const xe=e=>e instanceof Re?{...e}:e;function Ce(e,t){t=t||{};const n={};function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function s(e,t,n,s){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!z.isUndefined(t))return r(void 0,t)}function i(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):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,n)=>s(xe(e),xe(t),0,!0)};return z.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const o=z.hasOwnProp(c,r)?c[r]:s,i=o(e[r],t[r],r);z.isUndefined(i)&&o!==a||(n[r]=i)}),n}var je=e=>{const t=Ce({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Re.from(i),t.url=ne(ke(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(n))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(de.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||!1!==r&&Ue(t.url))){const e=s&&o&&Ne.read(o);e&&i.set(s,e)}return t};var Le="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=je(e);let s=r.data;const o=Re.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Se(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",s=new W(r,W.ERR_NETWORK,e,m);s.event=t||null,n(s),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,s.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&z.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,u]=Ae(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=Ae(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Te(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===de.protocols.indexOf(y)?n(new W("Unsupported protocol "+y+":",W.ERR_BAD_REQUEST,e)):m.send(s||null)})};var Fe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new Te(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new W(`timeout of ${t}ms exceeded`,W.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}=r;return a.unsubscribe=()=>z.asap(i),a}};const De=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Ie=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},qe=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of Ie(e))yield*De(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Be}=z,Me=(({Request:e,Response:t})=>({Request:e,Response:t}))(z.global),{ReadableStream:$e,TextEncoder:Ke}=z.global,ze=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},He=e=>{e=z.merge.call({skipUndefined:!0},Me,e);const{fetch:t,Request:n,Response:r}=e,s=t?Be(t):"function"==typeof fetch,o=Be(n),i=Be(r);if(!s)return!1;const a=s&&Be($e),c=s&&("function"==typeof Ke?(l=new Ke,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&ze(()=>{let e=!1;const t=new n(de.origin,{body:new $e,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&ze(()=>z.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new n(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:h,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:E}=je(e),R=t||fetch;y=y?(y+"").toLowerCase():"text";let v=Fe([c,l&&l.toAbortSignal()],h),O=null;const T=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let S;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(S=await f(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(z.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=_e(S,Ae(Pe(g)));a=qe(t.body,65536,e,n)}}z.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...E,signal:v,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new n(s,c);let l=await(o?R(O,E):R(s,c));const h=d&&("stream"===y||"response"===y);if(d&&(m||h&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=z.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&_e(t,Ae(Pe(m),!0))||[];l=new r(qe(l.body,65536,n,()=>{s&&s(),T&&T()}),e)}y=y||"text";let A=await p[z.findKey(p,y)||"text"](l,e);return!h&&T&&T(),await new Promise((t,n)=>{Se(t,n,{data:A,headers:Re.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t});throw W.from(t,t&&t.code,e,O,t&&t.response)}}},We=new Map,Je=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=We;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:He(t)),l=a;return a};Je();const Ve={http:null,xhr:Le,fetch:{get:Je}};z.forEach(Ve,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Xe=e=>`- ${e}`,Ge=e=>z.isFunction(e)||null===e||!1===e;var Ye={getAdapter:function(e,t){e=z.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!Ge(r)&&(s=Ve[(n=String(r)).toLowerCase()],void 0===s))throw new W(`Unknown adapter '${n}'`);if(s&&(z.isFunction(s)||(s=s.get(t))))break;o[n||"#"+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"));let t=n?e.length>1?"since :\n"+e.map(Xe).join("\n"):" "+Xe(e[0]):"as no adapter specified";throw new W("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return s},adapters:Ve};function Qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Te(null,e)}function Ze(e){Qe(e),e.headers=Re.from(e.headers),e.data=ve.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ye.getAdapter(e.adapter||he.adapter,e)(e).then(function(t){return Qe(e),t.data=ve.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t},function(t){return Oe(t)||(Qe(e),t&&t.response&&(t.response.data=ve.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)})}const et="1.13.5",tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};tt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new W(r(s," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!nt[s]&&(nt[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},tt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var rt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new W("option "+o+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+o,W.ERR_BAD_OPTION)}},validators:tt};const st=rt.validators;class ot{constructor(e){this.defaults=e||{},this.interceptors={request:new re,response:new re}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ce(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&rt.assertOptions(n,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean),legacyInterceptorReqResOrdering:st.transitional(st.boolean)},!1),null!=r&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:rt.assertOptions(r,{encode:st.function,serialize:st.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rt.assertOptions(t,{baseUrl:st.spelling("baseURL"),withXsrfToken:st.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[t.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Re.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||se;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(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=[Ze.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 p=t;for(;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=Ze.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ne(ke((e=Ce(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}z.forEach(["delete","get","head","options"],function(e){ot.prototype[e]=function(t,n){return this.request(Ce(n||{},{method:e,url:t,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ce(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ot.prototype[e]=t(),ot.prototype[e+"Form"]=t(!0)});var it=ot;class at{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Te(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new at(function(t){e=t}),cancel:e}}}var ct=at;const lt={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(lt).forEach(([e,t])=>{lt[t]=e});var ut=lt;const dt=function t(n){const r=new it(n),s=e(it.prototype.request,r);return z.extend(s,it.prototype,r,{allOwnKeys:!0}),z.extend(s,r,null,{allOwnKeys:!0}),s.create=function(e){return t(Ce(n,e))},s}(he);dt.Axios=it,dt.CanceledError=Te,dt.CancelToken=ct,dt.isCancel=Oe,dt.VERSION=et,dt.toFormData=Y,dt.AxiosError=W,dt.Cancel=dt.CanceledError,dt.all=function(e){return Promise.all(e)},dt.spread=function(e){return function(t){return e.apply(null,t)}},dt.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},dt.mergeConfig=Ce,dt.AxiosHeaders=Re,dt.formToJSON=e=>pe(z.isHTMLForm(e)?new FormData(e):e),dt.getAdapter=Ye.getAdapter,dt.HttpStatusCode=ut,dt.default=dt;var pt=dt;class ft{async initWithAccountToken(e){let{server:t,accountToken:n,appUuid:r}=e;if(this.initServer(t),this.appUuid=r,this.server&&this.appUuid)try{const e=await pt.get(`${this.server}api/v2.1/universal-apps/${this.appUuid}/access-token/`,{headers:{Authorization:"Token "+n}});this.accessToken=e.data?.access_token||"",this.createReq()}catch(e){console.log("Authorization failed")}}init(e){let{server:t,accessToken:n,appUuid:r}=e;this.initServer(t),this.accessToken=n||"",this.appUuid=r,this.accessToken&&this.server&&this.appUuid&&this.createReq()}initServer(e){e&&(this.server=e.endsWith("/")?e:`${e}/`)}createReq(){this.req=pt.create({baseURL:this.server,headers:{Authorization:"Token "+this.accessToken}})}_sendDelete(e,t){return this.req.delete(e,{headers:{"Content-Type":"application/json"},data:t})}_sendPut(e,t){return this.req.put(e,t,{headers:{"Content-Type":"application/json"}})}listRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,start:n,limit:r};return this.req.get(s,{params:o})}addRow(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,row_data:n};return this.req.post(r,s)}addRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,s={page_id:e,table_name:t,rows_data:n};return this.req.post(r,s)}updateRow(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,row_id:n,row_data:r};return this._sendPut(s,o)}updateRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,s={page_id:e,table_name:t,rows_data:n};return this._sendPut(r,s)}deleteRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_ids:n};return this._sendDelete(r,s)}getUploadLink(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";const n=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-upload-link/`;return this.req.get(n,{params:{page_id:e,upload_type:t}})}uploadAsset(e,t){return pt.create()({method:"post",url:`${e}?ret-json=1`,data:t})}async upload(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"file",r=null;try{r=await this.getUploadLink(e,n)}catch(e){throw new Error(`Failed to get upload link: ${e.message}`)}if(!r||!r.data)throw new Error("Failed to get upload link: empty response");const{upload_link:s,parent_path:o,img_relative_path:i,file_relative_path:a,asset_parent_url:c}=r.data,l="image"===n?i:a,u=new FormData;u.append("parent_dir",o),u.append("relative_path",l),u.append("file",t,t.name);let d=null;try{d=await this.uploadAsset(s,u)}catch(e){throw new Error(`Failed to get upload link: ${e.message}`)}const p=d?.data?.[0];if(!p)throw new Error("Failed to upload file: empty response");const f=`${c}/${l}/${encodeURIComponent(p.name)}`;return{name:p.name,size:p.size,type:n,url:f}}}const ht="HTML_PAGE_REQUEST",mt="HTML_PAGE_RESPONSE",gt="HTML_PAGE_EVENT",yt="WINDOW_EVENT",bt="get_server",wt="get_access_token",Et="get_app_uuid",Rt="get_page_id",vt="app",Ot="iframe",Tt=["click","dblclick","mousemove","mouseenter","mouseleave","mousedown","mouseup","contextmenu"],St=["keydown","keyup","keypress"],At=["dragstart","dragover","drag","dragend","dragenter","dragleave","drop"],_t=["mousemove","dragover"],Pt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ut=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(72*Math.random()));return n},Nt=e=>{let{eventType:t,event:n}=e;return Tt.includes(t)?{type:t,x:n.x,y:n.y,button:n.button,buttons:n.buttons}:St.includes(t)?{type:t,key:n.key,code:n.code,keyCode:n.keyCode,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,altKey:n.altKey,metaKey:n.metaKey,repeat:n.repeat}:At.includes(t)?{type:t,x:n.x,y:n.y}:null};class kt{constructor(e){this.options=e||{},this.selfWindow=window.parent===window.self,this.targetOrigin=this.options.targetOrigin||"*",this.pendingRequests={},this.eventHandlers={},this.timeout=this.options.timeout||1e4,this.setupMessageListener()}generatorRequestId(){let e=Ut();for(;Pt(this.pendingRequests,e);)e=Ut();return e}setupMessageListener(){this.selfWindow||(window.addEventListener("message",this.handleMessage.bind(this)),this.setEventsListener())}postWindowEvent(e){e&&window.parent.postMessage({type:yt,params:{event_data:{...e,source:Ot}}},this.targetOrigin)}setEventsListener(){let e=null,t=null;[...Tt,...St,...At].forEach(n=>{window.addEventListener(n,r=>{if(r.source!==vt)return _t.includes(n)?(t=Nt({eventType:n,event:r}),void(null===e&&(e=requestAnimationFrame(()=>{t&&(this.postWindowEvent(t),t=null,e=null)})))):void this.postWindowEvent(Nt({eventType:n,event:r}))},!0)})}async request(e,t){if(this.selfWindow)return new Promise(e=>{e(null)});const n=this.generatorRequestId();return new Promise((r,s)=>{this.pendingRequests[n]={resolve:r,reject:s},window.parent.postMessage({type:ht,requestId:n,method:e,params:t},this.targetOrigin);const o=setTimeout(()=>{Pt(this.pendingRequests,n)&&(delete this.pendingRequests[n],s(new Error(`Request timeout: ${e}`)))},this.timeout),i=this.pendingRequests[n];i&&(i.timeoutId=o)})}handleMessage(e){const{type:t,requestId:n,data:r,error:s,eventType:o,payload:i}=e.data;if(t===mt){const e=this.pendingRequests[n];e&&(clearTimeout(e.timeoutId),delete this.pendingRequests[n],s?e.reject(new Error(s)):e.resolve(r?JSON.parse(r):null))}else if(t===gt)this.emitEvent(o,i);else if(t===yt){const e=r.event_data;if(!e)return;let t,n;if(St.includes(e.type))t=new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,key:e.key,code:e.code,keyCode:e.keyCode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,view:window}),n=document.activeElement||document.body;else if(Tt.includes(e.type)){t=new MouseEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}else if(At.includes(e.type)){t=new DragEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}if(!n||!t)return;t.source=e.source,n.dispatchEvent(t)}}on(e,t){return Pt(this.eventHandlers,e)||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t),()=>this.off(e,t)}off(e,t){const n=this.eventHandlers[e];if(n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}emitEvent(e,t){(this.eventHandlers[e]||[]).forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}destroy(){this.pendingRequests.forEach(e=>{clearTimeout(e.timeoutId),e.reject(new Error("Adapter destroyed"))}),this.pendingRequests={},this.eventHandlers={}}}return class{constructor(e){this.options=e||{},this.iframeAdapter=new kt(e)}async init(){if(this.options||(this.options={}),this.htmlPageAPI=new ft,this.options.server||(this.options.server=await this.iframeAdapter.request(bt)),this.options.appUuid||(this.options.appUuid=await this.iframeAdapter.request(Et)),this.options.pageId||(this.options.pageId=await this.iframeAdapter.request(Rt)),this.options.accountToken){const{server:e,accountToken:t,appUuid:n}=this.options;await this.htmlPageAPI.initWithAccountToken({server:e,accountToken:t,appUuid:n})}else{this.options.accessToken||(this.options.accessToken=await this.iframeAdapter.request(wt));const{server:e,accessToken:t,appUuid:n}=this.options;this.htmlPageAPI.init({server:e,accessToken:t,appUuid:n})}}listRows(e){let{tableName:t,start:n,limit:r}=e;return this.htmlPageAPI.listRows(this.options.pageId,t,n,r)}addRow(e){let{tableName:t,rowData:n}=e;return this.htmlPageAPI.addRow(this.options.pageId,t,n)}updateRow(e){let{tableName:t,rowId:n,rowData:r}=e;this.htmlPageAPI.updateRow(this.options.pageId,t,n,r)}deleteRow(e){let{tableName:t,rowId:n}=e;const r=[n];return this.batchDeleteRows({tableName:t,rowsIds:r})}batchAddRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.addRows(this.options.pageId,t,n)}batchUpdateRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.updateRows(this.options.pageId,t,n)}batchDeleteRows(e){let{tableName:t,rowsIds:n}=e;return this.htmlPageAPI.deleteRows(this.options.pageId,t,n)}uploadFile(e){let{file:t}=e;return this.htmlPageAPI.upload(this.options.pageId,t)}uploadImage(e){let{file:t}=e;return this.htmlPageAPI.upload(this.options.pageId,t,"image")}}});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLPageSDK=t()}(this,function(){"use strict";function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:s}=Symbol,o=(i=Object.create(null),e=>{const n=t.call(e);return i[n]||(i[n]=n.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>o(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined");function d(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const p=a("ArrayBuffer");const f=c("string"),h=c("function"),m=c("number"),g=e=>null!==e&&"object"==typeof e,y=e=>{if("object"!==o(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||r in e)},b=a("Date"),w=a("File"),E=a("Blob"),R=a("FileList"),v=a("URLSearchParams"),[O,T,S,A]=["ReadableStream","Request","Response","Headers"].map(a);function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(d(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function P(e,t){if(d(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,N=e=>!u(e)&&e!==U;const k=(x="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>x&&e instanceof x);var x;const C=a("HTMLFormElement"),j=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),L=a("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const D=a("AsyncFunction"),I=(q="function"==typeof setImmediate,B=h(U.postMessage),q?setImmediate:B?(M=`axios@${Math.random()}`,$=[],U.addEventListener("message",({source:e,data:t})=>{e===U&&t===M&&$.length&&$.shift()()},!1),e=>{$.push(e),U.postMessage(M,"*")}):e=>setTimeout(e));var q,B,M,$;const K="undefined"!=typeof queueMicrotask?queueMicrotask.bind(U):"undefined"!=typeof process&&process.nextTick||I;var z={isArray:l,isArrayBuffer:p,isBuffer:d,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=o(e))||"object"===t&&h(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:f,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:g,isPlainObject:y,isEmptyObject:e=>{if(!g(e)||d(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:O,isRequest:T,isResponse:S,isHeaders:A,isUndefined:u,isDate:b,isFile:w,isBlob:E,isRegExp:L,isFunction:h,isStream:e=>g(e)&&h(e.pipe),isURLSearchParams:v,isTypedArray:k,isFileList:R,forEach:_,merge:function e(){const{caseless:t,skipUndefined:n}=N(this)&&this||{},r={},s=(s,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&P(r,o)||o;y(r[i])&&y(s)?r[i]=e(r[i],s):y(s)?r[i]=e({},s):l(s)?r[i]=s.slice():n&&u(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],s);return r},extend:(t,n,r,{allOwnKeys:s}={})=>(_(n,(n,s)=>{r&&h(n)?Object.defineProperty(t,s,{value:e(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,s)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],s&&!s(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let s;for(;(s=n.next())&&!s.done;){const n=s.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:C,hasOwnProperty:j,hasOwnProp:j,reduceDescriptors:F,freezeMethods:e=>{F(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:P,global:U,isContextDefined:N,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[s]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(g(e)){if(t.indexOf(e)>=0)return;if(d(e))return e;if(!("toJSON"in e)){t[r]=e;const s=l(e)?[]:{};return _(e,(e,t)=>{const o=n(e,r+1);!u(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:D,isThenable:e=>e&&(g(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:I,asap:K,isIterable:e=>null!=e&&h(e[r])};class H extends Error{static from(e,t,n,r,s,o){const i=new H(e.message,t||e.code,n,r,s);return i.cause=e,i.name=e.name,o&&Object.assign(i,o),i}constructor(e,t,n,r,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){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:z.toJSONObject(this.config),code:this.code,status:this.status}}}H.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",H.ERR_BAD_OPTION="ERR_BAD_OPTION",H.ECONNABORTED="ECONNABORTED",H.ETIMEDOUT="ETIMEDOUT",H.ERR_NETWORK="ERR_NETWORK",H.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",H.ERR_DEPRECATED="ERR_DEPRECATED",H.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",H.ERR_BAD_REQUEST="ERR_BAD_REQUEST",H.ERR_CANCELED="ERR_CANCELED",H.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",H.ERR_INVALID_URL="ERR_INVALID_URL";var W=H;function J(e){return z.isPlainObject(e)||z.isArray(e)}function V(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=V(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const G=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(z.isDate(e))return e.toISOString();if(z.isBoolean(e))return e.toString();if(!a&&z.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(e)||z.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(z.isArray(e)&&function(e){return z.isArray(e)&&!e.some(J)}(e)||(z.isFileList(e)||z.endsWith(n,"[]"))&&(a=z.toArray(e)))return n=V(n),a.forEach(function(e,r){!z.isUndefined(e)&&null!==e&&t.append(!0===i?X([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!J(e)||(t.append(X(s,n,o),c(e)),!1)}const u=[],d=Object.assign(G,{defaultVisitor:l,convertValue:c,isVisitable:J});if(!z.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!z.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),z.forEach(n,function(n,o){!0===(!(z.isUndefined(n)||null===n)&&s.call(t,n,z.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Q(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Z(e,t){this._pairs=[],e&&Y(e,this,t)}const ee=Z.prototype;function te(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ne(e,t,n){if(!t)return e;const r=n&&n.encode||te,s=z.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(i=o?o(t,s):z.isURLSearchParams(t)?t.toString():new Z(t,s).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ee.append=function(e,t){this._pairs.push([e,t])},ee.toString=function(e){const t=e?function(t){return e.call(this,t,Q)}:Q;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var re=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){z.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},oe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Z,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ie="undefined"!=typeof window&&"undefined"!=typeof document,ae="object"==typeof navigator&&navigator||void 0,ce=ie&&(!ae||["ReactNative","NativeScript","NS"].indexOf(ae.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ue=ie&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ie,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ce,navigator:ae,origin:ue}),...oe};function pe(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&z.isArray(r)?r.length:o,a)return z.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&z.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&z.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(e,r)=>{t(function(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const fe={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=z.isObject(e);s&&z.isHTMLForm(e)&&(e=new FormData(e));if(z.isFormData(e))return r?JSON.stringify(pe(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var he=fe;const me=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ge=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:z.isArray(e)?e.map(be):String(e)}function we(e,t,n,r,s){return z.isFunction(r)?r.call(this,t,n):(s&&(t=n),z.isString(t)?z.isString(r)?-1!==t.indexOf(r):z.isRegExp(r)?r.test(t):void 0:void 0)}class Ee{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=ye(t);if(!s)throw new Error("header name must be a non-empty string");const o=z.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=be(e))}const o=(e,t)=>z.forEach(e,(e,n)=>s(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&me[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(z.isObject(e)&&z.isIterable(e)){let n,r,s={};for(const t of e){if(!z.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?z.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=ye(e)){const n=z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=z.findKey(this,e);return!(!n||void 0===this[n]||t&&!we(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=ye(e)){const s=z.findKey(n,e);!s||t&&!we(0,n[s],s,t)||(delete n[s],r=!0)}}return z.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!we(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return z.forEach(this,(r,s)=>{const o=z.findKey(n,s);if(o)return t[o]=be(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=be(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ge]=this[ge]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}}Ee.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(Ee.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(Ee);var Re=Ee;function ve(e,t){const n=this||he,r=t||n,s=Re.from(r.headers);let o=r.data;return z.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Oe(e){return!(!e||!e.__CANCEL__)}var Te=class extends W{constructor(e,t,n){super(null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Se(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const Ae=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=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:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pe=e=>(...t)=>z.asap(()=>e(...t));var Ue=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ne=de.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];z.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),z.isString(r)&&a.push(`path=${r}`),z.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),z.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 ke(e,t,n){let r=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const xe=e=>e instanceof Re?{...e}:e;function Ce(e,t){t=t||{};const n={};function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function s(e,t,n,s){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!z.isUndefined(t))return r(void 0,t)}function i(e,t){return z.isUndefined(t)?z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):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,n)=>s(xe(e),xe(t),0,!0)};return z.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const o=z.hasOwnProp(c,r)?c[r]:s,i=o(e[r],t[r],r);z.isUndefined(i)&&o!==a||(n[r]=i)}),n}var je=e=>{const t=Ce({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Re.from(i),t.url=ne(ke(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(n))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(de.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||!1!==r&&Ue(t.url))){const e=s&&o&&Ne.read(o);e&&i.set(s,e)}return t};var Le="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=je(e);let s=r.data;const o=Re.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Se(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",s=new W(r,W.ERR_NETWORK,e,m);s.event=t||null,n(s),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,s.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&z.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,u]=Ae(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=Ae(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Te(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===de.protocols.indexOf(y)?n(new W("Unsupported protocol "+y+":",W.ERR_BAD_REQUEST,e)):m.send(s||null)})};var Fe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new Te(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new W(`timeout of ${t}ms exceeded`,W.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}=r;return a.unsubscribe=()=>z.asap(i),a}};const De=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Ie=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},qe=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of Ie(e))yield*De(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Be}=z,Me=(({Request:e,Response:t})=>({Request:e,Response:t}))(z.global),{ReadableStream:$e,TextEncoder:Ke}=z.global,ze=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},He=e=>{e=z.merge.call({skipUndefined:!0},Me,e);const{fetch:t,Request:n,Response:r}=e,s=t?Be(t):"function"==typeof fetch,o=Be(n),i=Be(r);if(!s)return!1;const a=s&&Be($e),c=s&&("function"==typeof Ke?(l=new Ke,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&ze(()=>{let e=!1;const t=new n(de.origin,{body:new $e,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&ze(()=>z.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e)){const t=new n(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return z.isArrayBufferView(e)||z.isArrayBuffer(e)?e.byteLength:(z.isURLSearchParams(e)&&(e+=""),z.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:h,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:E}=je(e),R=t||fetch;y=y?(y+"").toLowerCase():"text";let v=Fe([c,l&&l.toAbortSignal()],h),O=null;const T=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let S;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(S=await f(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(z.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=_e(S,Ae(Pe(g)));a=qe(t.body,65536,e,n)}}z.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...E,signal:v,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};O=o&&new n(s,c);let l=await(o?R(O,E):R(s,c));const h=d&&("stream"===y||"response"===y);if(d&&(m||h&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=z.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&_e(t,Ae(Pe(m),!0))||[];l=new r(qe(l.body,65536,n,()=>{s&&s(),T&&T()}),e)}y=y||"text";let A=await p[z.findKey(p,y)||"text"](l,e);return!h&&T&&T(),await new Promise((t,n)=>{Se(t,n,{data:A,headers:Re.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t});throw W.from(t,t&&t.code,e,O,t&&t.response)}}},We=new Map,Je=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=We;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:He(t)),l=a;return a};Je();const Ve={http:null,xhr:Le,fetch:{get:Je}};z.forEach(Ve,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Xe=e=>`- ${e}`,Ge=e=>z.isFunction(e)||null===e||!1===e;var Ye={getAdapter:function(e,t){e=z.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!Ge(r)&&(s=Ve[(n=String(r)).toLowerCase()],void 0===s))throw new W(`Unknown adapter '${n}'`);if(s&&(z.isFunction(s)||(s=s.get(t))))break;o[n||"#"+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"));let t=n?e.length>1?"since :\n"+e.map(Xe).join("\n"):" "+Xe(e[0]):"as no adapter specified";throw new W("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return s},adapters:Ve};function Qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Te(null,e)}function Ze(e){Qe(e),e.headers=Re.from(e.headers),e.data=ve.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ye.getAdapter(e.adapter||he.adapter,e)(e).then(function(t){return Qe(e),t.data=ve.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t},function(t){return Oe(t)||(Qe(e),t&&t.response&&(t.response.data=ve.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)})}const et="1.13.5",tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};tt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new W(r(s," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!nt[s]&&(nt[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},tt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var rt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new W("option "+o+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+o,W.ERR_BAD_OPTION)}},validators:tt};const st=rt.validators;class ot{constructor(e){this.defaults=e||{},this.interceptors={request:new re,response:new re}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ce(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&rt.assertOptions(n,{silentJSONParsing:st.transitional(st.boolean),forcedJSONParsing:st.transitional(st.boolean),clarifyTimeoutError:st.transitional(st.boolean),legacyInterceptorReqResOrdering:st.transitional(st.boolean)},!1),null!=r&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:rt.assertOptions(r,{encode:st.function,serialize:st.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rt.assertOptions(t,{baseUrl:st.spelling("baseURL"),withXsrfToken:st.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&z.merge(s.common,s[t.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Re.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||se;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(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=[Ze.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 p=t;for(;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=Ze.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ne(ke((e=Ce(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}z.forEach(["delete","get","head","options"],function(e){ot.prototype[e]=function(t,n){return this.request(Ce(n||{},{method:e,url:t,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ce(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ot.prototype[e]=t(),ot.prototype[e+"Form"]=t(!0)});var it=ot;class at{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Te(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new at(function(t){e=t}),cancel:e}}}var ct=at;const lt={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(lt).forEach(([e,t])=>{lt[t]=e});var ut=lt;const dt=function t(n){const r=new it(n),s=e(it.prototype.request,r);return z.extend(s,it.prototype,r,{allOwnKeys:!0}),z.extend(s,r,null,{allOwnKeys:!0}),s.create=function(e){return t(Ce(n,e))},s}(he);dt.Axios=it,dt.CanceledError=Te,dt.CancelToken=ct,dt.isCancel=Oe,dt.VERSION=et,dt.toFormData=Y,dt.AxiosError=W,dt.Cancel=dt.CanceledError,dt.all=function(e){return Promise.all(e)},dt.spread=function(e){return function(t){return e.apply(null,t)}},dt.isAxiosError=function(e){return z.isObject(e)&&!0===e.isAxiosError},dt.mergeConfig=Ce,dt.AxiosHeaders=Re,dt.formToJSON=e=>pe(z.isHTMLForm(e)?new FormData(e):e),dt.getAdapter=Ye.getAdapter,dt.HttpStatusCode=ut,dt.default=dt;var pt=dt;class ft{async initWithAccountToken(e){let{server:t,accountToken:n,appUuid:r}=e;if(this.initServer(t),this.appUuid=r,this.server&&this.appUuid)try{const e=await pt.get(`${this.server}api/v2.1/universal-apps/${this.appUuid}/access-token/`,{headers:{Authorization:"Token "+n}});this.accessToken=e.data?.access_token||"",this.createReq()}catch(e){console.log("Authorization failed")}}init(e){let{server:t,accessToken:n,appUuid:r}=e;this.initServer(t),this.accessToken=n||"",this.appUuid=r,this.accessToken&&this.server&&this.appUuid&&this.createReq()}initServer(e){e&&(this.server=e.endsWith("/")?e:`${e}/`)}createReq(){this.req=pt.create({baseURL:this.server,headers:{Authorization:"Token "+this.accessToken}})}_sendDelete(e,t){return this.req.delete(e,{headers:{"Content-Type":"application/json"},data:t})}_sendPut(e,t){return this.req.put(e,t,{headers:{"Content-Type":"application/json"}})}listRows(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,start:n,limit:r};return this.req.get(s,{params:o})}addRow(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,row_data:n};return this.req.post(r,s)}addRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,s={page_id:e,table_name:t,rows_data:n};return this.req.post(r,s)}updateRow(e,t,n,r){const s=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,o={page_id:e,table_name:t,row_id:n,row_data:r};return this._sendPut(s,o)}updateRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/batch/`,s={page_id:e,table_name:t,rows_data:n};return this._sendPut(r,s)}deleteRows(e,t,n){const r=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-rows/`,s={page_id:e,table_name:t,rows_ids:n};return this._sendDelete(r,s)}getUploadLink(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"file";const n=`${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-upload-link/`;return this.req.get(n,{params:{page_id:e,upload_type:t}})}uploadAsset(e,t){return pt.create()({method:"post",url:`${e}?ret-json=1`,data:t})}async upload(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"file",r=null;try{r=await this.getUploadLink(e,n)}catch(e){throw new Error(`Failed to get upload link: ${e.message}`)}if(!r||!r.data)throw new Error("Failed to get upload link: empty response");const{upload_link:s,parent_path:o,img_relative_path:i,file_relative_path:a,asset_parent_url:c}=r.data,l="image"===n?i:a,u=new FormData;u.append("parent_dir",o),u.append("relative_path",l),u.append("file",t,t.name);let d=null;try{d=await this.uploadAsset(s,u)}catch(e){throw new Error(`Failed to get upload link: ${e.message}`)}const p=d?.data?.[0];if(!p)throw new Error("Failed to upload file: empty response");const f=`${c}/${l}/${encodeURIComponent(p.name)}`;return{name:p.name,size:p.size,type:n,url:f}}}const ht="HTML_PAGE_REQUEST",mt="HTML_PAGE_RESPONSE",gt="HTML_PAGE_EVENT",yt="WINDOW_EVENT",bt="get_server",wt="get_access_token",Et="get_app_uuid",Rt="get_page_id",vt="app",Ot="iframe",Tt=["click","dblclick","mousemove","mouseenter","mouseleave","mousedown","mouseup","contextmenu"],St=["keydown","keyup","keypress"],At=["dragstart","dragover","drag","dragend","dragenter","dragleave","drop"],_t=["mousemove","dragover"],Pt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ut=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:4,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(72*Math.random()));return n},Nt=e=>{let{eventType:t,event:n}=e;return Tt.includes(t)?{type:t,x:n.x,y:n.y,button:n.button,buttons:n.buttons}:St.includes(t)?{type:t,key:n.key,code:n.code,keyCode:n.keyCode,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,altKey:n.altKey,metaKey:n.metaKey,repeat:n.repeat}:At.includes(t)?{type:t,x:n.x,y:n.y}:null};class kt{constructor(e){this.options=e||{},this.selfWindow=window.parent===window.self,this.targetOrigin=this.options.targetOrigin||"*",this.pendingRequests={},this.eventHandlers={},this.timeout=this.options.timeout||1e4,this.setupMessageListener()}generatorRequestId(){let e=Ut();for(;Pt(this.pendingRequests,e);)e=Ut();return e}setupMessageListener(){this.selfWindow||(window.addEventListener("message",this.handleMessage.bind(this)),this.setEventsListener())}postWindowEvent(e){e&&window.parent.postMessage({type:yt,params:{event_data:{...e,source:Ot}}},this.targetOrigin)}setEventsListener(){let e=null,t=null;[...Tt,...St,...At].forEach(n=>{window.addEventListener(n,r=>{if(r.source!==vt)return _t.includes(n)?(t=Nt({eventType:n,event:r}),void(null===e&&(e=requestAnimationFrame(()=>{t&&(this.postWindowEvent(t),t=null,e=null)})))):void this.postWindowEvent(Nt({eventType:n,event:r}))},!0)})}async request(e,t){if(this.selfWindow)return new Promise(e=>{e(null)});const n=this.generatorRequestId();return new Promise((r,s)=>{this.pendingRequests[n]={resolve:r,reject:s},window.parent.postMessage({type:ht,requestId:n,method:e,params:t},this.targetOrigin);const o=setTimeout(()=>{Pt(this.pendingRequests,n)&&(delete this.pendingRequests[n],s(new Error(`Request timeout: ${e}`)))},this.timeout),i=this.pendingRequests[n];i&&(i.timeoutId=o)})}handleMessage(e){const{type:t,requestId:n,data:r,error:s,eventType:o,payload:i}=e.data;if(t===mt){const e=this.pendingRequests[n];e&&(clearTimeout(e.timeoutId),delete this.pendingRequests[n],s?e.reject(new Error(s)):e.resolve(r?JSON.parse(r):null))}else if(t===gt)this.emitEvent(o,i);else if(t===yt){const e=r.event_data;if(!e)return;let t,n;if(St.includes(e.type))t=new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,key:e.key,code:e.code,keyCode:e.keyCode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,view:window}),n=document.activeElement||document.body;else if(Tt.includes(e.type)){t=new MouseEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}else if(At.includes(e.type)){t=new DragEvent(e.type,{bubbles:!0,cancelable:!0,view:window,clientX:e.x,clientY:e.y,screenX:e.x,screenY:e.y,button:e.button,buttons:e.buttons});n=document.elementFromPoint(e.x,e.y)||document.body}if(!n||!t)return;t.source=e.source,n.dispatchEvent(t)}}on(e,t){return Pt(this.eventHandlers,e)||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t),()=>this.off(e,t)}off(e,t){const n=this.eventHandlers[e];if(n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}emitEvent(e,t){(this.eventHandlers[e]||[]).forEach(n=>{try{n(t)}catch(t){console.error(`Error in event handler for ${e}:`,t)}})}destroy(){this.pendingRequests.forEach(e=>{clearTimeout(e.timeoutId),e.reject(new Error("Adapter destroyed"))}),this.pendingRequests={},this.eventHandlers={}}}return class{constructor(e){this.options=e||{},this.iframeAdapter=new kt(e)}async init(){if(this.options||(this.options={}),this.htmlPageAPI=new ft,this.options.server||(this.options.server=await this.iframeAdapter.request(bt)),this.options.appUuid||(this.options.appUuid=await this.iframeAdapter.request(Et)),this.options.pageId||(this.options.pageId=await this.iframeAdapter.request(Rt)),this.options.accountToken){const{server:e,accountToken:t,appUuid:n}=this.options;await this.htmlPageAPI.initWithAccountToken({server:e,accountToken:t,appUuid:n})}else{this.options.accessToken||(this.options.accessToken=await this.iframeAdapter.request(wt));const{server:e,accessToken:t,appUuid:n}=this.options;this.htmlPageAPI.init({server:e,accessToken:t,appUuid:n})}}listRows(e){let{tableName:t,start:n,limit:r}=e;return this.htmlPageAPI.listRows(this.options.pageId,t,n,r)}addRow(e){let{tableName:t,rowData:n}=e;return this.htmlPageAPI.addRow(this.options.pageId,t,n)}updateRow(e){let{tableName:t,rowId:n,rowData:r}=e;return this.htmlPageAPI.updateRow(this.options.pageId,t,n,r)}deleteRow(e){let{tableName:t,rowId:n}=e;const r=[n];return this.batchDeleteRows({tableName:t,rowsIds:r})}batchAddRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.addRows(this.options.pageId,t,n)}batchUpdateRows(e){let{tableName:t,rowsData:n}=e;return this.htmlPageAPI.updateRows(this.options.pageId,t,n)}batchDeleteRows(e){let{tableName:t,rowsIds:n}=e;return this.htmlPageAPI.deleteRows(this.options.pageId,t,n)}uploadFile(e){let{file:t}=e;return this.htmlPageAPI.upload(this.options.pageId,t)}uploadImage(e){let{file:t}=e;return this.htmlPageAPI.upload(this.options.pageId,t,"image")}}});
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|