appmesh 3.1.3 → 3.1.5
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/README.md +2 -1
- package/dist/appmesh.esm.js +1 -1
- package/package.json +4 -3
- package/src/appmesh.js +183 -33
- package/src/appmesh_tcp.js +43 -42
- package/src/refresh_token_provider.js +189 -0
- package/src/token_provider.js +56 -0
package/README.md
CHANGED
|
@@ -181,13 +181,14 @@ new AppMeshWorker(baseURL, sslConfig, options);
|
|
|
181
181
|
**Parameters:**
|
|
182
182
|
|
|
183
183
|
- `baseURL` (string, optional) - App Mesh service URL. Default: `'https://127.0.0.1:6060'`
|
|
184
|
-
- `sslConfig` (object, optional) - SSL configuration
|
|
184
|
+
- `sslConfig` (object, optional) - SSL configuration. `false` disables verification; `null`/`undefined` verifies against the bundled App Mesh CA or system roots
|
|
185
185
|
- `ca` - CA certificate (Buffer or string path)
|
|
186
186
|
- `cert` - Client certificate (Buffer or string path)
|
|
187
187
|
- `key` - Client private key (Buffer or string path)
|
|
188
188
|
- `rejectUnauthorized` (boolean) - Verify SSL certificate. Default: `true`
|
|
189
189
|
- `options` (object, optional)
|
|
190
190
|
- `logger` - Custom logger instance. Default: `console`
|
|
191
|
+
- `client` - Pre-built `AppMeshClient` instance to reuse. When supplied, `baseURL` and `sslConfig` are ignored, and the worker shares the caller's bearer.
|
|
191
192
|
|
|
192
193
|
##### Methods
|
|
193
194
|
|
package/dist/appmesh.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),840:()=>import("./840.appmesh.esm.js"),894:()=>import("./894.appmesh.esm.js")},t={792:0},r=e=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e;var s,a,c=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);c<r.length;c++)a=r[c],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0};n.f.j=(o,i)=>{let s=n.o(t,o)?t[o]:void 0;if(0!==s)if(s)i.push(s[1]);else{let n=e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e});n=Promise.race([n,new Promise(e=>s=t[o]=[e])]),i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>qe,hasStandardBrowserEnv:()=>He,hasStandardBrowserWebWorkerEnv:()=>Me,navigator:()=>Ie,origin:()=>ze});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:c}=Symbol,u=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),f=(e,t,n)=>e===Object.prototype||!n&&null===t,p=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=s(n);if(f(n,o,n===e))return!1;if(u(n,t))return!0;n=o}return!1},d=(h=Object.create(null),e=>{const t=i.call(e);return h[t]||(h[t]=t.slice(8,-1).toLowerCase())});var h;const m=e=>(e=e.toLowerCase(),t=>d(t)===e),y=e=>t=>typeof t===e,{isArray:g}=Array,b=y("undefined");function w(e){return null!==e&&!b(e)&&null!==e.constructor&&!b(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=m("ArrayBuffer");const _=y("string"),O=y("function"),E=y("number"),R=e=>null!==e&&"object"==typeof e,S=e=>{if(!R(e))return!1;const t=s(e);return!(null!==t&&t!==Object.prototype&&null!==s(t)||p(e,c)||p(e,a))},P=m("Date"),T=m("File"),A=m("Blob"),j=m("FileList"),C=m("Set");const k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},N=void 0!==k.FormData?k.FormData:void 0,U=m("URLSearchParams"),[x,D,L,F]=["ReadableStream","Request","Response","Headers"].map(m);function B(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),g(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function q(e,t){if(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,H=e=>!b(e)&&e!==I;const M=(z="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>z&&e instanceof z);var z;const $=m("HTMLFormElement"),{propertyIsEnumerable:J}=Object.prototype,W=m("RegExp"),K=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};B(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const X=m("AsyncFunction"),V=(G="function"==typeof setImmediate,Y=O(I.postMessage),G?setImmediate:Y?(Q=`axios@${Math.random()}`,Z=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===Q&&Z.length&&Z.shift()()},!1),e=>{Z.push(e),I.postMessage(Q,"*")}):e=>setTimeout(e));var G,Y,Q,Z;const ee="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||V,te=e=>null!=e&&O(e[a]),ne={isArray:g,isArrayBuffer:v,isBuffer:w,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!O(e.append))return!1;const n=d(e);return"formdata"===n||"object"===n&&O(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&v(e.buffer),t},isString:_,isNumber:E,isBoolean:e=>!0===e||!1===e,isObject:R,isPlainObject:S,isEmptyObject:e=>{if(!R(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:x,isRequest:D,isResponse:L,isHeaders:F,isUndefined:b,isDate:P,isFile:T,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:A,isRegExp:W,isFunction:O,isStream:e=>R(e)&&O(e.pipe),isURLSearchParams:U,isTypedArray:M,isFileList:j,forEach:B,merge:function e(...t){const{caseless:n,skipUndefined:r}=H(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=n&&"string"==typeof i&&q(o,i)||i,a=u(o,s)?o[s]:void 0;S(a)&&S(t)?o[s]=e(a,t):S(t)?o[s]=e({},t):g(t)?o[s]=t.slice():r&&b(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(B(n,i),"object"!=typeof n||g(n))continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];J.call(n,t)&&i(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(B(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),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,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{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],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:d,kindOfTest:m,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(g(e))return e;let t=e.length;if(!E(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.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:$,hasOwnProperty:u,hasOwnProp:u,hasOwnInPrototypeChain:p,getSafeProp:(e,t)=>null!=e&&p(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=s(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(l(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:s(i);if(f(i,a,i===e))break;const c=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&c.push(...Object.getOwnPropertySymbols(i));for(const t of c)l(t)||u(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:K,freezeMethods:e=>{K(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];O(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 g(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:q,global:I,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&O(e.append)&&"FormData"===e[c]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(R(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),C(e)){r=[];for(const t of e){const e=n(t);!b(e)&&r.push(e)}}else r=g(e)?[]:{},B(e,(e,t)=>{const o=n(e);!b(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:X,isThenable:e=>e&&(R(e)||O(e))&&O(e.then)&&O(e.catch),setImmediate:V,asap:ee,isIterable:te,isSafeIterable:e=>null!=e&&p(e,a)&&te(e)},re=ne.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 oe=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ie=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function se(e,t){return ne.isArray(e)?e.map(e=>se(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function ae(e){const t=Object.create(null);return ne.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>se(e,ie))(e)}),t}const ce=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function le(e){return!1===e||null==e?e:ne.isArray(e)?e.map(le):(e=>se(e,oe))(String(e))}const fe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function pe(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}function de(e,t,n,r,o){return ne.isFunction(r)?r.call(this,t,n):(o&&(t=n),ne.isString(t)?ne.isString(r)?-1!==t.indexOf(r):ne.isRegExp(r)?r.test(t):void 0:void 0)}class he{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ue(t);if(!o)return;const i=ne.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=le(e))}const i=(e,t)=>ne.forEach(e,(e,n)=>o(e,n,t));if(ne.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ne.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim();const i=ne.hasOwnProp(t,n);!n||i&&ne.hasOwnProp(re,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(ne.isObject(e)&&ne.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!ne.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],ne.hasOwnProp(o,r)?(n=o[r],o[r]=ne.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ue(e)){const n=ne.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(ne.isFunction(t))return t.call(this,e,n);if(ne.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=ne.findKey(this,e);return!(!n||void 0===this[n]||t&&!de(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=ne.findKey(n,e);!o||t&&!de(0,n[o],o,t)||(delete n[o],r=!0)}}return ne.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!de(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ne.forEach(this,(r,o)=>{const i=ne.findKey(n,o);if(i)return t[i]=le(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=le(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ne.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ne.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(){const e=this.get("set-cookie");return ne.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let r=0,o=!1,i=!1;function s(e){const o=pe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=pe(o.slice(0,i));if(!fe.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const c=pe(o.slice(i+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let r=1;r<t;r++){const o=e.charCodeAt(r);if(34===o)return e;if(92===o&&(r+=1,r>=t))return e;n+=e[r]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(s(e),r=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ce]=this[ce]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=ne.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return ne.isArray(e)?e.forEach(r):r(e),this}}he.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(he.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ne.freezeMethods(he);const me=he,ye="[REDACTED ****]";function ge(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(ne.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof me&&(e=e.toJSON()),r.push(e),ne.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);ne.isUndefined(r)||(t[n]=r)});else{if(!ne.isPlainObject(e)&&function(e){if(ne.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ne.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?ye:o(i);ne.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function be(e){try{return String(e)}catch(e){return""}}class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&ne.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?be(e.message):be(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new we(s,t||e.code,n,r,o);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&ne.hasOwnProp(e,"redact")?e.redact:void 0,n=ne.isArray(t)&&t.length>0?ge(e,t):ne.toJSONObject(e);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:n,code:this.code,status:this.status}}}we.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",we.ERR_BAD_OPTION="ERR_BAD_OPTION",we.ECONNABORTED="ECONNABORTED",we.ETIMEDOUT="ETIMEDOUT",we.ECONNREFUSED="ECONNREFUSED",we.ERR_NETWORK="ERR_NETWORK",we.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",we.ERR_DEPRECATED="ERR_DEPRECATED",we.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",we.ERR_BAD_REQUEST="ERR_BAD_REQUEST",we.ERR_CANCELED="ERR_CANCELED",we.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",we.ERR_INVALID_URL="ERR_INVALID_URL",we.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ve=we;function _e(e){return ne.isPlainObject(e)||ne.isArray(e)}function Oe(e){return ne.endsWith(e,"[]")?e.slice(0,-2):e}function Ee(e,t,n){return e?e.concat(t).map(function(e,t){return e=Oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Re=ne.toFlatObject(ne,{},null,function(e){return/^is[A-Z]/.test(e)});const Se=function(e,t,n){if(!ne.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=ne.getSafeProp(n,e);return ne.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||h,s=r("dots",!1),a=r("indexes",!1),c=r("Blob")||"undefined"!=typeof Blob&&Blob,u=r("maxDepth",100),l=c&&ne.isSpecCompliantForm(t),f=[];if(!ne.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(ne.isDate(e))return e.toISOString();if(ne.isBoolean(e))return e.toString();if(!l&&ne.isBlob(e))throw new ve("Blob is not supported. Use a Buffer instead.");if(ne.isArrayBuffer(e)||ne.isTypedArray(e)){if(l&&"function"==typeof c)return new c([e]);throw new ve("Blob is not supported. Use a Buffer instead.",ve.ERR_NOT_SUPPORT)}return e}function d(e){if(e>u)throw new ve("Object is too deeply nested ("+e+" levels). Max depth: "+u,ve.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(e,n,r){let i=e;if(ne.isReactNative(t)&&ne.isReactNativeBlob(e))return t.append(Ee(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(ne.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!ne.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),d(t+n.length-1),r})}(e,1);else if(ne.isArray(e)&&function(e){return ne.isArray(e)&&!e.some(_e)}(e)||(ne.isFileList(e)||ne.endsWith(n,"[]"))&&(i=ne.toArray(e)))return n=Oe(n),i.forEach(function(e,r){!ne.isUndefined(e)&&null!==e&&t.append(!0===a?Ee([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!_e(e)||(t.append(Ee(r,n,s),p(e)),!1)}const m=Object.assign(Re,{defaultVisitor:h,convertValue:p,isVisitable:_e});if(!ne.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!ne.isUndefined(n)){if(d(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),ne.forEach(n,function(n,s){!0===(!(ne.isUndefined(n)||null===n)&&i.call(t,n,ne.isString(s)?s.trim():s,r,m))&&e(n,r?r.concat(s):[s],o+1)}),f.pop()}}(e),t};function Pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Te(e,t){this._pairs=[],e&&Se(e,this,t)}const Ae=Te.prototype;Ae.append=function(e,t){this._pairs.push([e,t])},Ae.toString=function(e){const t=e?t=>e.call(this,t,Pe):Pe;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const je=Te;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ke(e,t,n){if(!t)return e;e=e||"";const r=ne.isFunction(n)?{serialize:n}:n,o=ne.getSafeProp(r,"encode")||Ce,i=ne.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):ne.isURLSearchParams(t)?t.toString():new je(t,r).toString(o),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}const Ne=Symbol("internals");function Ue(e){return e?e.length:0}function xe(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function De(e,t){const n=e.handlers,r=Ue(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(e,r){n[e.index]!==e.handler&&t.handlerEntries.delete(r)}):t.handlerEntries.clear()),t.handlersLength=r}const Le=class{constructor(){this.handlers=[],this[Ne]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const r={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},o=this[Ne];null==this.handlers&&(this.handlers=[]),De(this,o);const i=o.nextId++;return this.handlers.push(r),o.handlerEntries.set(i,{handler:r,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,i}eject(e){const t=this[Ne];De(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(xe(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],De(this,this[Ne]))}forEach(e){const t=this[Ne];De(this,t),t.iterationDepth++;try{ne.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(De(this,t),xe(this.handlers),t.handlersLength=Ue(this.handlers))}}},Fe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:je,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},qe="undefined"!=typeof window&&"undefined"!=typeof document,Ie="object"==typeof navigator&&navigator||void 0,He=qe&&(!Ie||["ReactNative","NativeScript","NS"].indexOf(Ie.product)<0),Me="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ze=qe&&window.location.href||"http://localhost",$e={...r,...Be};function Je(e){if(e>100)throw new ve("FormData field is too deeply nested ("+e+" levels). Max depth: 100",ve.ERR_FORM_DATA_DEPTH_EXCEEDED)}const We=function(e){function t(e,n,r,o){Je(o);let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&ne.isArray(r)?r.length:i,a)return ne.hasOwnProp(r,i)?r[i]=ne.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!s;ne.hasOwnProp(r,i)&&ne.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ne.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(ne.isFormData(e)&&ne.isFunction(e.entries)){const n={};return ne.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)Je(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),n}return null},Ke=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Xe=(e,t)=>null!=e&&ne.hasOwnProp(e,t)?e[t]:void 0;const Ve={transitional:Fe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ne.isObject(e);o&&ne.isHTMLForm(e)&&(e=new FormData(e));if(ne.isFormData(e))return r?JSON.stringify(We(e)):e;if(ne.isArrayBuffer(e)||ne.isBuffer(e)||ne.isStream(e)||ne.isFile(e)||ne.isBlob(e)||ne.isReadableStream(e))return e;if(ne.isArrayBufferView(e))return e.buffer;if(ne.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Xe(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Se(e,new $e.classes.URLSearchParams,{visitor:function(e,t,n,r){return $e.isNode&&ne.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=ne.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Xe(this,"env"),r=n&&n.FormData;return Se(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ne.isString(e))try{return(t||JSON.parse)(e),ne.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Xe(this,"transitional")||Ve.transitional,n=t&&t.forcedJSONParsing,r=Xe(this,"responseType"),o="json"===r;if(ne.isResponse(e)||ne.isReadableStream(e))return e;if(e&&ne.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Xe(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ve.from(e,ve.ERR_BAD_RESPONSE,this,null,Xe(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(Ke,e=>{Ve.headers[e]={}});const Ge=Ve;function Ye(e,t){const n=this||Ge,r=t||n,o=me.from(r.headers);let i=r.data;return ne.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Qe(e){return!(!e||!e.__CANCEL__)}const Ze=class extends ve{constructor(e,t,n){super(e??"canceled",ve.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function et(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ve("Request failed with status code "+n.status,n.status>=400&&n.status<500?ve.ERR_BAD_REQUEST:ve.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const tt=/[\t\n\r]/g;function nt(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(tt,"")}function rt(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const ot=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const p=u&&c-u;return p?Math.round(1e3*f/p):void 0}};const it=function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n),(...e)=>s(e)]},st=(e,t,n=3)=>{let r=0;const o=ot(50,250);return it(n=>{if(!n||!ne.isNumber(n.loaded))return;const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=Math.max(0,null!=s?Math.min(i,s):i),c=Math.max(0,a-r),u=o(c);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},at=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ct=(e,t=ne.asap)=>(...n)=>t(()=>e(...n)),ut=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,lt=$e.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ne.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),ne.isString(r)&&a.push(`path=${r}`),ne.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),ne.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)try{return decodeURIComponent(r.slice(o+1))}catch(e){return r.slice(o+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const ft=/^https?:(?!\/\/)/i;function pt(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${ye}@`),n=t.indexOf("#"),r=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${ye}`);return-1===n?r:`${r}#${o=t.slice(n+1),o?o.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${ye}`):o}`;var o}function dt(e,t){if("string"==typeof e){const n=nt(e);if(ft.test(n))throw new ve(`Invalid URL ${JSON.stringify(pt(n))}: missing "//" after protocol`,ve.ERR_INVALID_URL,t)}}function ht(e,t,n,r){dt(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(dt(e,r),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const mt=e=>e instanceof me?{...e}:e;function yt(e,t){e=e||{},t=t||{};const n=Object.create(null);function r(e,t,n,r){return ne.isPlainObject(e)&&ne.isPlainObject(t)?ne.merge.call({caseless:r},e,t):ne.isPlainObject(t)?ne.merge({},t):ne.isArray(t)?t.slice():t}function o(e,t,n,o){return ne.isUndefined(t)?ne.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ne.isUndefined(t))return r(void 0,t)}function s(e,t){return ne.isUndefined(t)?ne.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return ne.hasOwnProp(t,i)?r(n,o):ne.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(mt(e),mt(t),0,!0)};var u;return ne.forEach((u={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(u).concat(Object.getOwnPropertySymbols(u).filter(e=>Object.getOwnPropertyDescriptor(u,e).enumerable)):Object.keys(u)),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ne.hasOwnProp(c,r)?c[r]:o,s=i(ne.hasOwnProp(e,r)?e[r]:void 0,ne.hasOwnProp(t,r)?t[r]:void 0,r);ne.isUndefined(s)&&i!==a||(n[r]=s)}),ne.hasOwnProp(t,"validateStatus")&&ne.isUndefined(t.validateStatus)&&!1===function(n){const r=ne.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!ne.isUndefined(r)){if(!ne.isPlainObject(r))return;if(ne.hasOwnProp(r,n))return r[n]}const o=ne.hasOwnProp(e,"transitional")?e.transitional:void 0;if(ne.isPlainObject(o)&&ne.hasOwnProp(o,n))return o[n]}("validateStatusUndefinedResolves")&&(ne.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const gt=["content-type","content-length"];const bt=function(e){const t=yt({},e),n=e=>ne.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),s=n("xsrfCookieName");let a=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=me.from(a),t.url=ke(ht(u,f,l,t),n("params"),n("paramsSerializer")),c){const t=ne.getSafeProp(c,"username")||"",n=ne.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw ve.from(t,ve.ERR_BAD_OPTION_VALUE,e)}}if(ne.isFormData(r)){const e=ne.getSafeProp(r,"getHeaders");$e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||ne.isReactNative(r)?a.setContentType(void 0):ne.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{gt.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,e.call(r),n("formDataHeaderPolicy"))}if($e.hasStandardBrowserEnv){ne.isFunction(o)&&(o=o(t));if(!0===o||null==o&&ut(t.url)){const e=i&&s&<.read(s);e&&a.set(i,e)}}return t},wt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=bt(e);let o=r.data;const i=me.from(r.headers).normalize();let s,a,c,u,l,f,{responseType:p,onUploadProgress:d,onDownloadProgress:h}=r;function m(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let y=new XMLHttpRequest;function g(o){if(!y)return;if(!(0!==y.status||"file"===(rt(nt(r.url))||rt($e.origin))||y.responseURL&&y.responseURL.startsWith("file:")))return n(new ve("Request aborted",ve.ECONNABORTED,e,y)),m(),void(y=null);try{o?f&&f(o):l&&l()}catch(e){setTimeout(()=>{throw e})}if(!y)return;const i=me.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());et(function(e){t(e),m()},function(e){n(e),m()},{data:p&&"text"!==p&&"json"!==p?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:i,config:e,request:y}),y=null}y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout,"onloadend"in y?y.onloadend=g:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&y.responseURL.startsWith("file:"))&&setTimeout(g)},y.onabort=function(){y&&(n(new ve("Request aborted",ve.ECONNABORTED,e,y)),m(),y=null)},y.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ve(r,ve.ERR_NETWORK,e,y);o.event=t||null,n(o),m(),y=null},y.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Fe;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ve(t,o.clarifyTimeoutError?ve.ETIMEDOUT:ve.ECONNABORTED,e,y)),m(),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&ne.forEach(ae(i),function(e,t){y.setRequestHeader(t,e)}),ne.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),p&&"json"!==p&&(y.responseType=r.responseType),h&&([c,l,f]=st(h,!0),y.addEventListener("progress",c)),d&&y.upload&&([a,u]=st(d),y.upload.addEventListener("progress",a),y.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{y&&(n(!t||t.type?new Ze(null,e,y):t),y.abort(),m(),y=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const b=rt(r.url);if(b&&!$e.protocols.includes(b))return n(new ve("Unsupported protocol "+b+":",ve.ERR_BAD_REQUEST,e)),void m();y.send(o||null)})},vt=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ve?t:new Ze(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new ve(`timeout of ${t}ms exceeded`,ve.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>{r||(e.aborted?o.call(e):e.addEventListener("abort",o,{once:!0}))});const{signal:a}=n;return a.unsubscribe=()=>ne.asap(s),a},_t=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ot=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()}},Et=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Ot(e))yield*_t(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Rt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,St=(e,t,n)=>t+2<n&&Rt(e.charCodeAt(t+1))&&Rt(e.charCodeAt(t+2)),Pt=e=>e<=57?e-48:(223&e)-55,Tt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,At=e=>9===e||10===e||12===e||13===e||32===e,jt=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Ct=e=>{const t=e.length;let n=0,r=0,o=!1;for(let i=0;i<t;i++){let s=e.charCodeAt(i);37===s&&St(e,i,t)&&(s=16*Pt(e.charCodeAt(i+1))+Pt(e.charCodeAt(i+2)),i+=2),At(s)||(61!==s?!Tt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?jt(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},kt=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const r=e.slice(5,n),o=e.slice(n+1);if(/;base64/i.test(r))return t(o);let i=0;for(let e=0,t=o.length;e<t;e++){const n=o.charCodeAt(e);if(37===n&&St(o,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=o.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const Nt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Ut}=ne,xt=e=>{if(!ne.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Dt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Lt=e=>{const t=void 0!==ne.global&&null!==ne.global?ne.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=ne.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:s}=e,a=o?Ut(o):"function"==typeof fetch,c=Ut(i),u=Ut(s);if(!a)return!1;const l=a&&Ut(n),f=a&&("function"==typeof r?(p=new r,e=>p.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var p;const d=c&&l&&Dt(()=>{let e=!1;const t=new i($e.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),h=u&&l&&Dt(()=>ne.isReadableStream(new s("").body)),m={stream:h&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ve(`Response type '${e}' is not supported`,ve.ERR_NOT_SUPPORT,n)})});const y=async e=>{if(null==e)return 0;if(ne.isBlob(e))return e.size;if(ne.isSpecCompliantForm(e)){const t=new i($e.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ne.isArrayBufferView(e)||ne.isArrayBuffer(e)?e.byteLength:(ne.isURLSearchParams(e)&&(e+=""),ne.isString(e)?(await f(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:a,signal:u,cancelToken:f,timeout:p,onDownloadProgress:g,onUploadProgress:b,responseType:w,headers:v,withCredentials:_="same-origin",fetchOptions:O,maxContentLength:E,maxBodyLength:R,maxRedirects:S}=bt(e);const P=ne.isNumber(E)&&E>-1,T=ne.isNumber(R)&&R>-1;let A=o||fetch;w=w?(w+"").toLowerCase():"text";let j=vt([u,f&&f.toAbortSignal()],p),C=null;const k=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let N,U=null;const x=()=>new ve("Request body larger than maxBodyLength limit",ve.ERR_BAD_REQUEST,e,C);try{let o;const u=(L="auth",ne.hasOwnProp(e,L)?e[L]:void 0);if(u){const e=ne.getSafeProp(u,"username")||"";o={username:e,password:ne.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,$e.origin);if(!o&&(e.username||e.password)){const t=xt(e.username);o={username:t,password:xt(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(o&&(v.delete("authorization"),v.set("Authorization","Basic "+btoa((D=(o.username||"")+":"+(o.password||""),encodeURIComponent(D).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),P&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return kt(-1===t?e:e.slice(0,t),Ct)}(t);if(n>E)throw new ve("maxContentLength size of "+E+" exceeded",ve.ERR_BAD_RESPONSE,e,C)}if(T&&"get"!==n&&"head"!==n){const e=await y(a);if("number"==typeof e&&isFinite(e)&&(N=e,e>R))throw x()}const f=T&&(ne.isReadableStream(a)||ne.isStream(a)),p=(e,t,n)=>Et(e,65536,e=>{if(T&&e>R)throw U=x();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(b||f)){if(N=N??await(async(e,t)=>{const n=ne.toFiniteNumber(e.getContentLength());return n??y(t)})(v,a),0!==N||f){let e,n=new i(t,{method:"POST",body:a,duplex:"half"});if(ne.isFormData(a)&&(e=n.headers.get("content-type"))&&v.setContentType(e),n.body){const[e,t]=b&&at(N,st(ct(b)))||[];a=p(n.body,e,t)}}}else if(f&&!c&&l&&"get"!==n&&"head"!==n)a=p(a);else if(f&&c&&!d&&"get"!==n&&"head"!==n)throw new ve("Stream request bodies are not supported by the current fetch implementation",ve.ERR_NOT_SUPPORT,e,C);ne.isString(_)||(_=_?"include":"omit");const F=c&&"credentials"in i.prototype;if(ne.isFormData(a)){const e=v.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&v.delete("content-type")}v.set("User-Agent","axios/1.20.0",!1);const B=null==O?O:Object.assign(Object.create(null),O);B&&(delete B.body,delete B.headers,delete B.method,delete B.signal,delete B.duplex,delete B.credentials);const q=Object.assign(Object.create(null),B,{signal:j,method:n.toUpperCase(),headers:ae(v.normalize()),body:a,duplex:"half",credentials:F?_:void 0});c&&(ne.forEach(Nt,(e,t)=>{void 0===q[t]&&(q[t]=e)}),void 0===q.signal&&(q.signal=null),void 0===q.body&&(q.body=null)),0===S&&(q.redirect="manual",B&&(B.redirect="manual")),C=c&&new i(t,q);let I=await(c?A(C,B):A(t,q));const H=me.from(I.headers);if(P){const t=ne.toFiniteNumber(H.getContentLength());if(null!=t&&t>E)throw new ve("maxContentLength size of "+E+" exceeded",ve.ERR_BAD_RESPONSE,e,C)}const M=h&&("stream"===w||"response"===w);if(h&&I.body&&(g||P||M&&k)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=I[e]});const n=ne.toFiniteNumber(H.getContentLength()),[r,o]=g&&at(n,st(ct(g),!0))||[];let i=0;const a=t=>{if(P&&(i=t,i>E))throw new ve("maxContentLength size of "+E+" exceeded",ve.ERR_BAD_RESPONSE,e,C);r&&r(t)};I=new s(Et(I.body,65536,a,()=>{o&&o(),k&&k()}),t)}w=w||"text";let z=await m[ne.findKey(m,w)||"text"](I,e);if(P&&!h&&!M){let t;if(null!=z&&("number"==typeof z.byteLength?t=z.byteLength:"number"==typeof z.size?t=z.size:"string"==typeof z&&(t="function"==typeof r?(new r).encode(z).byteLength:z.length)),"number"==typeof t&&t>E)throw new ve("maxContentLength size of "+E+" exceeded",ve.ERR_BAD_RESPONSE,e,C)}return!M&&k&&k(),await new Promise((t,n)=>{et(t,n,{data:z,headers:me.from(I.headers),status:I.status,statusText:I.statusText,config:e,request:C})})}catch(t){if(k&&k(),j&&j.aborted&&j.reason instanceof ve){const n=j.reason;throw n.config=e,C&&(n.request=C),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(U)throw C&&!U.request&&(U.request=C),U;if(t instanceof ve)throw C&&!t.request&&(t.request=C),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new ve("Network Error",ve.ERR_NETWORK,e,C,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw ve.from(t,t&&t.code,e,C,t&&t.response)}var D,L}},Ft=new Map,Bt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,u=Ft;for(;c--;)s=i[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Lt(t)),u=a;return a},qt=(Bt(),{http:null,xhr:wt,fetch:{get:Bt}});ne.forEach(qt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const It=e=>`- ${e}`,Ht=e=>ne.isFunction(e)||null===e||!1===e;const Mt={getAdapter:function(e,t){e=ne.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ht(r)&&(o=qt[(n=String(r)).toLowerCase()],void 0===o))throw new ve(`Unknown adapter '${n}'`);if(o&&(ne.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).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(It).join("\n"):" "+It(e[0]):"as no adapter specified";throw new ve("There is no suitable adapter to dispatch the request "+t,ve.ERR_NOT_SUPPORT)}return o},adapters:qt};function zt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ze(null,e)}function $t(e){const t=ne.toSafeFlatObject(e);zt(t),t.headers=me.from(ne.getSafeProp(t,"headers")),t.data=Ye.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Mt.getAdapter(t.adapter||Ge.adapter,t)(t).then(function(e){zt(t),t.response=e;try{e.data=Ye.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=me.from(e.headers),e},function(e){if(!Qe(e)&&(zt(t),e&&e.response)){t.response=e.response;try{e.response.data=Ye.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=me.from(e.response.headers)}return Promise.reject(e)})}const Jt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Jt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Wt={};Jt.transitional=function(e,t,n){function r(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ve(r(o," has been removed"+(t?" in "+t:"")),ve.ERR_DEPRECATED);return t&&!Wt[o]&&(Wt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Jt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Kt={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new ve("options must be an object",ve.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new ve("option "+i+" must be "+n,ve.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ve("Unknown option "+i,ve.ERR_BAD_OPTION)}},validators:Jt},Xt=Kt.validators;class Vt{constructor(e){this.defaults=e||{},this.interceptors={request:new Le,response:new Le}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let r="";if("string"==typeof n){const e=n.indexOf("\n");r=-1===e?"":n.slice(e+1)}if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),o=-1===n?"":r.slice(n+1);String(e.stack).endsWith(o)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=yt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Kt.assertOptions(n,{silentJSONParsing:Xt.transitional(Xt.boolean),forcedJSONParsing:Xt.transitional(Xt.boolean),clarifyTimeoutError:Xt.transitional(Xt.boolean),legacyInterceptorReqResOrdering:Xt.transitional(Xt.boolean),advertiseZstdAcceptEncoding:Xt.transitional(Xt.boolean),validateStatusUndefinedResolves:Xt.transitional(Xt.boolean)},!1),null!=r&&(ne.isFunction(r)?t.paramsSerializer={serialize:r}:Kt.assertOptions(r,{encode:Xt.function,serialize:Xt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Kt.assertOptions(t,{baseUrl:Xt.spelling("baseURL"),withXsrfToken:Xt.spelling("withXSRFToken")},!0),t.method=(ne.getSafeProp(t,"method")||ne.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=o&&ne.merge(o.common,o[t.method]);o&&ne.forEach(Ke.concat("common"),e=>{delete o[e]}),t.headers=me.concat(i,o);const s=[];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||Fe;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,f=0;if(!a){const e=[$t.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);f<l;)u=u.then(e[f++],e[f++]);return u}l=s.length;let p=t;for(;f<l;){const e=s[f++],t=s[f++];try{p=e?e(p):p}catch(e){if(!t){u=Promise.reject(e);break}try{const n=t.call(this,e);ne.isThenable(n)&&(u=Promise.resolve(n).then(()=>$t.call(this,p)))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=$t.call(this,p)}catch(e){u=Promise.reject(e)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(e){return ke(ht((e=yt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}ne.forEach(["delete","get","head","options"],function(e){Vt.prototype[e]=function(t,n){return this.request(yt(n||{},{method:e,url:t,data:n&&ne.hasOwnProp(n,"data")?n.data:void 0}))}}),ne.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(yt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Vt.prototype[e]=t(),"query"!==e&&(Vt.prototype[e+"Form"]=t(!0))});const Gt=Vt;class Yt{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,o){n.reason||(n.reason=new Ze(e,r,o),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 Yt(function(t){e=t}),cancel:e}}}const Qt=Yt;const Zt={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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Zt).forEach(([e,t])=>{void 0===Zt[t]&&(Zt[t]=e)});const en=Zt;const tn=function e(t){const n=new Gt(t),r=o(Gt.prototype.request,n);return ne.extend(r,Gt.prototype,n,{allOwnKeys:!0}),ne.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(yt(t,n))},r}(Ge);tn.Axios=Gt,tn.CanceledError=Ze,tn.CancelToken=Qt,tn.isCancel=Qe,tn.VERSION="1.20.0",tn.toFormData=Se,tn.AxiosError=ve,tn.Cancel=tn.CanceledError,tn.all=function(e){return Promise.all(e)},tn.spread=function(e){return function(t){return e.apply(null,t)}},tn.isAxiosError=function(e){return ne.isObject(e)&&!0===e.isAxiosError},tn.mergeConfig=yt,tn.AxiosHeaders=me,tn.formToJSON=e=>We(ne.isHTMLForm(e)?new FormData(e):e),tn.getAdapter=Mt.getAdapter,tn.HttpStatusCode=en,tn.default=tn;const nn=tn;function rn(e){return rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rn(e)}function on(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return sn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function d(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=p.p,h=i[2];n>3?(o=h===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,p.v=r,p.n=i[1]):d<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,p.n=h,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,h){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),a=l,c=h;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(sn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,sn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,sn(f,"constructor",u),sn(u,"constructor",c),c.displayName="GeneratorFunction",sn(u,o,"GeneratorFunction"),sn(f),sn(f,o,"Generator"),sn(f,r,function(){return this}),sn(f,"toString",function(){return"[object Generator]"}),(on=function(){return{w:i,m:p}})()}function sn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}sn=function(e,t,n,r){function i(t,n){sn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},sn(e,t,n,r)}function an(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ln(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?un(Object(n),!0).forEach(function(t){fn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):un(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fn(e,t,n){return(t=yn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pn(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function dn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){pn(i,r,o,s,a,"next",e)}function a(e){pn(i,r,o,s,a,"throw",e)}s(void 0)})}}function hn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,yn(r.key),r)}}function mn(e,t,n){return t&&hn(e.prototype,t),n&&hn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yn(e){var t=function(e,t){if("object"!=rn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==rn(t)?t:t+""}function gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bn(e,t,n){return t=En(t),function(e,t){if(t&&("object"==rn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_n()?Reflect.construct(t,n||[],En(e).constructor):t.apply(e,n))}function wn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&On(e,t)}function vn(e){var t="function"==typeof Map?new Map:void 0;return vn=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(_n())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&On(o,n.prototype),o}(e,arguments,En(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),On(n,e)},vn(e)}function _n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_n=function(){return!!e})()}function On(e,t){return On=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},On(e,t)}function En(e){return En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},En(e)}var Rn=null,Sn=null,Pn=null,Tn=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path"}),An=Object.freeze({isNode:!("undefined"!=typeof window&&void 0!==window.document)}),jn=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return gn(this,e),(n=bn(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return wn(e,vn(Error)),mn(e)}(),Cn=function(){function e(t){var n;return gn(this,e),(n=bn(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return wn(e,jn),mn(e)}(),kn=function(){function e(t){var n;return gn(this,e),(n=bn(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return wn(e,jn),mn(e)}(),Nn=function(e,t){An.isNode?process.stdout.write(e):console.log(e)};function Un(e){if("number"==typeof e)return e;if("string"!=typeof e)throw new Error("Invalid input type. Expected number or ISO 8601 duration string.");if(/^\d+$/.test(e))return parseInt(e,10);if(!e.trim())throw new Error("Duration string cannot be empty");if(!e.startsWith("P"))throw new Error("Invalid ISO8601 duration: must start with P");var t="\\d+",n="".concat(t,"(?:[\\.,]").concat(t,")?"),r="(".concat(t,"Y)?(").concat(t,"M)?(").concat(t,"W)?(").concat(t,"D)?"),o="T(".concat(n,"H)?(").concat(n,"M)?(").concat(n,"S)?"),i="P(?:".concat(r,"(?:").concat(o,")?)"),s=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(i));if(!a)throw new RangeError("invalid duration: "+e);var c=a.slice(1);if(0===c.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(c.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var u=c.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*u.years,l+=2592e3*u.months,l+=604800*u.weeks,l+=86400*u.days,l+=3600*u.hours,l+=60*u.minutes,l+=u.seconds}function xn(e,t){if(e){var n=t.toLowerCase(),r=Object.keys(e).find(function(e){return e.toLowerCase()===n});return void 0===r?void 0:e[r]}}function Dn(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(xn(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new jn("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function Ln(e){return Fn.apply(this,arguments)}function Fn(){return(Fn=dn(on().m(function e(t){var r,o,i,s;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=parseInt(t,10),isNaN(r)||String(r)!==t.trim()){e.n=1;break}return e.a(2,r);case 1:return e.p=1,e.n=2,n.e(994).then(()=>n.t(994,19));case 2:if(o=e.v,i=o.spawnSync,0===(s=i("id",["-u",t],{encoding:"utf8",timeout:3e3})).status&&s.stdout){e.n=3;break}return e.a(2,null);case 3:return e.a(2,parseInt(s.stdout.trim(),10));case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}function Bn(e){return qn.apply(this,arguments)}function qn(){return(qn=dn(on().m(function e(t){var r,o,i,s,a;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=parseInt(t,10),isNaN(r)||String(r)!==t.trim()){e.n=1;break}return e.a(2,r);case 1:return e.p=1,e.n=2,n.e(994).then(()=>n.t(994,19));case 2:if(o=e.v,i=o.spawnSync,0===(s=i("getent",["group",t],{encoding:"utf8",timeout:3e3})).status&&s.stdout){e.n=3;break}return e.a(2,null);case 3:return a=s.stdout.trim().split(":"),e.a(2,a.length>=3?parseInt(a[2],10):null);case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}var In="/opt/appmesh/ssl/ca.pem";function Hn(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:Sn.readFileSync(e)}function Mn(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return Sn.existsSync(In)?{ca:Sn.readFileSync(In),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=ln({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=Hn(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var zn=function(){return mn(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:An.isNode?"https://127.0.0.1:6060":window.location.origin,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;gn(this,e),this.baseURL=r,this.forwardingHost=null,this._token=null;var i={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[Dn]};this._sslConfig=o,this._client=nn.create(i),An.isNode&&!Pn&&(Pn=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=an(e,2),n=t[0],r=t[1];Rn=n.default||n,Sn=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(e){return e.headers=ln(ln({},e.headers),t._commonHeaders()),e},function(e){var t=new jn("Request configuration error: "+(e.message||"Unknown error"));return Promise.reject(t)}),this._client.interceptors.response.use(function(e){return e},function(e){var t,n,r,o;if(e instanceof jn)return Promise.reject(e);var i=new jn("Request failed: "+(e.message||"Unknown error"),null!==(t=null===(n=e.response)||void 0===n?void 0:n.status)&&void 0!==t?t:null,null!==(r=null===(o=e.response)||void 0===o?void 0:o.data)&&void 0!==r?r:null);return i.cause=e,Promise.reject(i)})},[{key:"set_bearer_token",value:function(e){var t="string"==typeof e?e.trim():"";this._handleTokenUpdate(t||null)}},{key:"set_token",value:function(e){this.set_bearer_token(e)}},{key:"clear_bearer_token",value:function(){this._handleTokenUpdate(null)}},{key:"_getAccessToken",value:function(){return this._token||null}},{key:"_handleTokenUpdate",value:function(e){this._token=e||null}},{key:"get_auth_config",value:(q=dn(on().m(function e(){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return q.apply(this,arguments)})},{key:"get_current_principal",value:(B=dn(on().m(function e(){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"list_apps",value:(F=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return F.apply(this,arguments)})},{key:"get_app",value:(L=dn(on().m(function e(t){var n;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"check_app_health",value:(D=dn(on().m(function e(t){var n;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"add_app",value:(x=dn(on().m(function e(t,n){var r;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return x.apply(this,arguments)})},{key:"delete_app",value:(U=dn(on().m(function e(t){var n,r;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("delete","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,200===n.status);case 2:if(e.p=2,404!==(r=e.v).statusCode){e.n=3;break}return e.a(2,!1);case 3:throw r;case 4:return e.a(2)}},e,this,[[0,2]])})),function(e){return U.apply(this,arguments)})},{key:"enable_app",value:(N=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/enable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"disable_app",value:(k=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return k.apply(this,arguments)})},{key:"get_app_output",value:(C=dn(on().m(function e(t){var n,r,o,i,s,a,c,u,l,f,p=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:0,r=p.length>3&&void 0!==p[3]?p[3]:10240,o=p.length>4&&void 0!==p[4]?p[4]:"",i=p.length>5&&void 0!==p[5]?p[5]:0,s={stdout_position:(p.length>1&&void 0!==p[1]?p[1]:0).toString(),stdout_index:n.toString(),stdout_maxsize:r.toString(),process_uuid:o,timeout:Un(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,c=xn(a.headers,"X-Output-Position"),u=xn(a.headers,"X-Exit-Code"),l=c?parseInt(c,10):null,f=u?parseInt(u,10):null,e.a(2,new $n(a.status,a.data,l,f))}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"run_app_sync",value:(j=dn(on().m(function e(t){var n,r,o,i,s,a,c,u=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:Nn,r=u.length>2&&void 0!==u[2]?u[2]:Tn.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=u.length>3&&void 0!==u[3]?u[3]:Tn.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i={timeout:Un(r),lifecycle:Un(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:i});case 1:return s=e.v,a=null,200===s.status?(n&&n(s.data,0),(c=xn(s.headers,"X-Exit-Code"))&&(a=parseInt(c,10))):n&&n(s.data,0),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"run_app_async",value:(A=dn(on().m(function e(t){var n,r,o,i,s=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:Tn.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:Tn.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:Un(n),lifecycle:Un(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new Jn(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"wait_for_async_run",value:(T=dn(on().m(function e(t){var n,r,o,i,s,a,c=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:Nn,r=c.length>2&&void 0!==c[2]?c[2]:0,!t){e.n=7;break}o=0,i=new Date,s=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.get_app_output(t.appName,o,0,20480,t.procUid,s);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.delete_app(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-i)/1e3>r)){e.n=5;break}return e.a(3,7);case 5:return e.n=6,new Promise(function(e){return setTimeout(e,100)});case 6:e.n=1;break;case 7:return e.a(2,null)}},e,this)})),function(e){return T.apply(this,arguments)})},{key:"run_task",value:(P=dn(on().m(function e(t,n){var r,o,i=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:return(r=i.length>2&&void 0!==i[2]?i[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return P.apply(this,arguments)})},{key:"cancel_task",value:(S=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return S.apply(this,arguments)})},{key:"download_file",value:(R=dn(on().m(function e(t){var r,o,i,s,a,c,u,l,f,p,d,h,m,y,g,b,w=arguments;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:return o=w.length>2&&void 0!==w[2]&&w[2],(r=w.length>1&&void 0!==w[1]?w[1]:null)||(r=t.split(/[\\/]/).pop()),i=fn({},Tn.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:i,config:{responseType:"arraybuffer"}});case 1:if(200===(s=e.v).status){e.n=2;break}throw new jn("Failed to download file: ".concat(t),s.status,s.data);case 2:if(!An.isNode){e.n=15;break}return e.n=3,n.e(840).then(()=>n.t(840,19));case 3:return a=e.v,e.p=4,e.n=5,a.writeFile(r,Buffer.from(s.data));case 5:if(!o||"win32"===process.platform){e.n=12;break}if(c=s.headers,e.p=6,!(u=c["x-file-mode"])){e.n=7;break}return e.n=7,a.chmod(r,parseInt(u,10));case 7:if(l=c["x-file-user"],f=c["x-file-group"],!l||!f){e.n=10;break}return e.n=8,Ln(l);case 8:return p=e.v,e.n=9,Bn(f);case 9:if(d=e.v,null===p||null===d){e.n=10;break}return e.n=10,a.chown(r,p,d);case 10:e.n=12;break;case 11:e.p=11,g=e.v,console.warn("Warning: Unable to apply file attributes to",r,g.message);case 12:e.n=14;break;case 13:throw e.p=13,b=e.v,new jn("Failed to write file to ".concat(r,": ").concat(b.message),s.status);case 14:e.n=16;break;case 15:h=new Blob([s.data]),m=window.URL.createObjectURL(h),(y=document.createElement("a")).style.display="none",y.href=m,y.download=r.split("/").pop(),document.body.appendChild(y),y.click(),window.URL.revokeObjectURL(m),document.body.removeChild(y);case 16:return e.a(2)}},e,this,[[6,11],[4,13]])})),function(e){return R.apply(this,arguments)})},{key:"upload_file",value:(E=dn(on().m(function e(t){var r,o,i,s,a,c,u,l,f,p,d=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:if(o=d.length>2&&void 0!==d[2]&&d[2],(r=d.length>1&&void 0!==d[1]?d[1]:null)||(r=t.split(/[\\/]/).pop()),i=fn({},Tn.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(r)),!An.isNode){e.n=3;break}return e.n=1,n.e(894).then(()=>n.t(894,19));case 1:return a=e.v.default,e.n=2,n.e(603).then(()=>n.t(603,19));case 2:c=e.v,s=new a,u=r.split("/").pop(),s.append("filename",u),(l=c.statSync(t)).size<10485760?(f=c.readFileSync(t),s.append("file",f,{filename:t.split("/").pop()})):s.append("file",c.createReadStream(t)),o&&(i["X-File-Mode"]=(511&l.mode).toString()),Object.assign(i,s.getHeaders()),e.n=7;break;case 3:if(s=new FormData,!(t instanceof File)){e.n=4;break}p=t.name,e.n=6;break;case 4:if(!(t instanceof Blob)){e.n=5;break}p=r.split("/").pop(),e.n=6;break;case 5:throw new jn("In browser, localFile must be File or Blob");case 6:s.append("filename",p),s.append("file",t);case 7:return e.n=8,this._request("post","/appmesh/file/upload",s,{headers:i,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 8:return e.a(2)}},e,this)})),function(e){return E.apply(this,arguments)})},{key:"get_host_resources",value:(O=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/resources");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return O.apply(this,arguments)})},{key:"get_config",value:(_=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/config");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return _.apply(this,arguments)})},{key:"set_config",value:(v=dn(on().m(function e(t){var n;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return v.apply(this,arguments)})},{key:"set_log_level",value:(w=dn(on().m(function e(){var t,n,r=arguments;return on().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.set_config({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return w.apply(this,arguments)})},{key:"add_label",value:(b=dn(on().m(function e(t,n){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return b.apply(this,arguments)})},{key:"delete_label",value:(g=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"list_labels",value:(y=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return y.apply(this,arguments)})},{key:"list_principals",value:(m=dn(on().m(function e(){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principals");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"update_principal",value:(h=dn(on().m(function e(t,n){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return h.apply(this,arguments)})},{key:"delete_principal",value:(d=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"get_current_user",value:(p=dn(on().m(function e(){return on().w(function(e){for(;;)if(0===e.n)return e.a(2,this.get_current_principal())},e,this)})),function(){return p.apply(this,arguments)})},{key:"list_permissions",value:(f=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"get_principal_permissions",value:(l=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return l.apply(this,arguments)})},{key:"get_user_permissions",value:(u=dn(on().m(function e(){return on().w(function(e){for(;;)if(0===e.n)return e.a(2,this.get_principal_permissions())},e,this)})),function(){return u.apply(this,arguments)})},{key:"list_roles",value:(c=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"update_role",value:(a=dn(on().m(function e(t,n){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return a.apply(this,arguments)})},{key:"delete_role",value:(s=dn(on().m(function e(t){return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"get_metrics",value:(i=dn(on().m(function e(){var t;return on().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"subscribe",value:(o=dn(on().m(function e(){return on().w(function(e){for(;;)switch(e.n){case 0:throw new jn("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"unsubscribe",value:(r=dn(on().m(function e(){return on().w(function(e){for(;;)switch(e.n){case 0:throw new jn("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return r.apply(this,arguments)})},{key:"request",value:(t=dn(on().m(function e(t,n){var r,o,i=arguments;return on().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"_commonHeaders",value:function(){var e={};An.isNode&&(e[Tn.HTTP_USER_AGENT_HEADER_NAME]=Tn.HTTP_USER_AGENT);var t=this._getAccessToken();if(t&&(e[Tn.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(t)),this.forwardingHost)if(this.forwardingHost.includes(":"))e[Tn.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost;else{var n=new URL(this.baseURL),r="https:"===n.protocol?"443":"80",o=n.port||r;e[Tn.HTTP_HEADER_KEY_X_TARGET_HOST]="".concat(this.forwardingHost,":").concat(o)}return e}},{key:"_request",value:(e=dn(on().m(function e(t,n){var r,o,i,s,a,c,u,l,f,p,d,h,m=arguments;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=m.length>2&&void 0!==m[2]?m[2]:null,o=m.length>3&&void 0!==m[3]?m[3]:{},!An.isNode||!Pn||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Pn;case 1:Rn&&(this._client.defaults.httpsAgent=new Rn.Agent(ln(ln({},Mn(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return i=o.headers,s=void 0===i?{}:i,a=o.params,c=void 0===a?{}:a,u=o.config,l=void 0===u?{}:u,e.p=3,f=ln(ln({method:t,url:n,withCredentials:!1},l),{},{headers:ln({},s),params:ln({},c)}),null!==r&&(f.data=r),e.n=4,this._client(f);case 4:if(!((p=e.v).status<200||p.status>=300)){e.n=5;break}throw d=this._extractErrorMessage(p.data),new jn(d,p.status,p.data);case 5:return e.a(2,p);case 6:throw e.p=6,h=e.v,this.onError(h);case 7:return e.a(2)}},e,this,[[3,6]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===rn(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return console.log("AppMeshClient error:",e),e instanceof jn?e:new jn(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,c,u,l,f,p,d,h,m,y,g,b,w,v,_,O,E,R,S,P,T,A,j,C,k,N,U,x,D,L,F,B,q}(),$n=mn(function e(t,n,r,o){gn(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),Jn=function(){return mn(function e(t,n,r){gn(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"with_forwarding_host",value:(t=dn(on().m(function e(t){var n;return on().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=this._client.forwardingHost,this._client.forwardingHost=this._forwardingHost,e.p=1,e.n=2,t();case 2:return e.a(2,e.v);case 3:return e.p=3,this._client.forwardingHost=n,e.f(3);case 4:return e.a(2)}},e,this,[[1,,3,4]])})),function(e){return t.apply(this,arguments)})},{key:"wait",value:(e=dn(on().m(function e(){var t,n,r=this,o=arguments;return on().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:Nn,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.with_forwarding_host(function(){return r._client.wait_for_async_run(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Wn=zn;export{zn as AppMeshClient,jn as AppMeshError,$n as AppOutput,Cn as AppRemovedError,Jn as AppRun,In as DEFAULT_CA_FILE,kn as TransportDisconnectedError,Wn as default};
|
|
1
|
+
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),840:()=>import("./840.appmesh.esm.js"),894:()=>import("./894.appmesh.esm.js")},t={792:0},r=e=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e;var s,a,c=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);c<r.length;c++)a=r[c],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0};n.f.j=(o,i)=>{let s=n.o(t,o)?t[o]:void 0;if(0!==s)if(s)i.push(s[1]);else{let n=e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e});n=Promise.race([n,new Promise(e=>s=t[o]=[e])]),i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>qe,hasStandardBrowserEnv:()=>He,hasStandardBrowserWebWorkerEnv:()=>Me,navigator:()=>Ie,origin:()=>ze});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:c}=Symbol,u=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),f=(e,t,n)=>e===Object.prototype||!n&&null===t,p=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=s(n);if(f(n,o,n===e))return!1;if(u(n,t))return!0;n=o}return!1},h=(d=Object.create(null),e=>{const t=i.call(e);return d[t]||(d[t]=t.slice(8,-1).toLowerCase())});var d;const y=e=>(e=e.toLowerCase(),t=>h(t)===e),m=e=>t=>typeof t===e,{isArray:b}=Array,g=m("undefined");function w(e){return null!==e&&!g(e)&&null!==e.constructor&&!g(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=y("ArrayBuffer");const _=m("string"),E=m("function"),O=m("number"),R=e=>null!==e&&"object"==typeof e,S=e=>{if(!R(e))return!1;const t=s(e);return!(null!==t&&t!==Object.prototype&&null!==s(t)||p(e,c)||p(e,a))},T=y("Date"),k=y("File"),P=y("Blob"),A=y("FileList"),j=y("Set");const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},N=void 0!==C.FormData?C.FormData:void 0,x=y("URLSearchParams"),[U,D,L,F]=["ReadableStream","Request","Response","Headers"].map(y);function B(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),b(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function q(e,t){if(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,H=e=>!g(e)&&e!==I;const M=(z="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>z&&e instanceof z);var z;const G=y("HTMLFormElement"),{propertyIsEnumerable:W}=Object.prototype,$=y("RegExp"),J=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};B(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const K=y("AsyncFunction"),X=(V="function"==typeof setImmediate,Y=E(I.postMessage),V?setImmediate:Y?(Q=`axios@${Math.random()}`,Z=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===Q&&Z.length&&Z.shift()()},!1),e=>{Z.push(e),I.postMessage(Q,"*")}):e=>setTimeout(e));var V,Y,Q,Z;const ee="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||X,te=e=>null!=e&&E(e[a]),ne={isArray:b,isArrayBuffer:v,isBuffer:w,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!E(e.append))return!1;const n=h(e);return"formdata"===n||"object"===n&&E(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&v(e.buffer),t},isString:_,isNumber:O,isBoolean:e=>!0===e||!1===e,isObject:R,isPlainObject:S,isEmptyObject:e=>{if(!R(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:U,isRequest:D,isResponse:L,isHeaders:F,isUndefined:g,isDate:T,isFile:k,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:P,isRegExp:$,isFunction:E,isStream:e=>R(e)&&E(e.pipe),isURLSearchParams:x,isTypedArray:M,isFileList:A,forEach:B,merge:function e(...t){const{caseless:n,skipUndefined:r}=H(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=n&&"string"==typeof i&&q(o,i)||i,a=u(o,s)?o[s]:void 0;S(a)&&S(t)?o[s]=e(a,t):S(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&g(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(B(n,i),"object"!=typeof n||b(n))continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];W.call(n,t)&&i(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(B(t,(t,r)=>{n&&E(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),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,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{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],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:h,kindOfTest:y,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(b(e))return e;let t=e.length;if(!O(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.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:G,hasOwnProperty:u,hasOwnProp:u,hasOwnInPrototypeChain:p,getSafeProp:(e,t)=>null!=e&&p(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=s(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(l(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:s(i);if(f(i,a,i===e))break;const c=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&c.push(...Object.getOwnPropertySymbols(i));for(const t of c)l(t)||u(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:J,freezeMethods:e=>{J(e,(t,n)=>{if(E(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];E(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 b(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:q,global:I,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[c]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(R(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),j(e)){r=[];for(const t of e){const e=n(t);!g(e)&&r.push(e)}}else r=b(e)?[]:{},B(e,(e,t)=>{const o=n(e);!g(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:K,isThenable:e=>e&&(R(e)||E(e))&&E(e.then)&&E(e.catch),setImmediate:X,asap:ee,isIterable:te,isSafeIterable:e=>null!=e&&p(e,a)&&te(e)},re=ne.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 oe=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ie=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function se(e,t){return ne.isArray(e)?e.map(e=>se(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function ae(e){const t=Object.create(null);return ne.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>se(e,ie))(e)}),t}const ce=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function le(e){return!1===e||null==e?e:ne.isArray(e)?e.map(le):(e=>se(e,oe))(String(e))}const fe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function pe(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}function he(e,t,n,r,o){return ne.isFunction(r)?r.call(this,t,n):(o&&(t=n),ne.isString(t)?ne.isString(r)?-1!==t.indexOf(r):ne.isRegExp(r)?r.test(t):void 0:void 0)}class de{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ue(t);if(!o)return;const i=ne.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=le(e))}const i=(e,t)=>ne.forEach(e,(e,n)=>o(e,n,t));if(ne.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ne.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim();const i=ne.hasOwnProp(t,n);!n||i&&ne.hasOwnProp(re,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(ne.isObject(e)&&ne.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!ne.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],ne.hasOwnProp(o,r)?(n=o[r],o[r]=ne.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ue(e)){const n=ne.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(ne.isFunction(t))return t.call(this,e,n);if(ne.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=ne.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=ne.findKey(n,e);!o||t&&!he(0,n[o],o,t)||(delete n[o],r=!0)}}return ne.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!he(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ne.forEach(this,(r,o)=>{const i=ne.findKey(n,o);if(i)return t[i]=le(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=le(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ne.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ne.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(){const e=this.get("set-cookie");return ne.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let r=0,o=!1,i=!1;function s(e){const o=pe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=pe(o.slice(0,i));if(!fe.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const c=pe(o.slice(i+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let r=1;r<t;r++){const o=e.charCodeAt(r);if(34===o)return e;if(92===o&&(r+=1,r>=t))return e;n+=e[r]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(s(e),r=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ce]=this[ce]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=ne.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return ne.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ne.freezeMethods(de);const ye=de,me="[REDACTED ****]";function be(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(ne.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ye&&(e=e.toJSON()),r.push(e),ne.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);ne.isUndefined(r)||(t[n]=r)});else{if(!ne.isPlainObject(e)&&function(e){if(ne.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ne.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?me:o(i);ne.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function ge(e){try{return String(e)}catch(e){return""}}class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&ne.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?ge(e.message):ge(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new we(s,t||e.code,n,r,o);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&ne.hasOwnProp(e,"redact")?e.redact:void 0,n=ne.isArray(t)&&t.length>0?be(e,t):ne.toJSONObject(e);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:n,code:this.code,status:this.status}}}we.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",we.ERR_BAD_OPTION="ERR_BAD_OPTION",we.ECONNABORTED="ECONNABORTED",we.ETIMEDOUT="ETIMEDOUT",we.ECONNREFUSED="ECONNREFUSED",we.ERR_NETWORK="ERR_NETWORK",we.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",we.ERR_DEPRECATED="ERR_DEPRECATED",we.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",we.ERR_BAD_REQUEST="ERR_BAD_REQUEST",we.ERR_CANCELED="ERR_CANCELED",we.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",we.ERR_INVALID_URL="ERR_INVALID_URL",we.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ve=we;function _e(e){return ne.isPlainObject(e)||ne.isArray(e)}function Ee(e){return ne.endsWith(e,"[]")?e.slice(0,-2):e}function Oe(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ee(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Re=ne.toFlatObject(ne,{},null,function(e){return/^is[A-Z]/.test(e)});const Se=function(e,t,n){if(!ne.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=ne.getSafeProp(n,e);return ne.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||d,s=r("dots",!1),a=r("indexes",!1),c=r("Blob")||"undefined"!=typeof Blob&&Blob,u=r("maxDepth",100),l=c&&ne.isSpecCompliantForm(t),f=[];if(!ne.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(ne.isDate(e))return e.toISOString();if(ne.isBoolean(e))return e.toString();if(!l&&ne.isBlob(e))throw new ve("Blob is not supported. Use a Buffer instead.");if(ne.isArrayBuffer(e)||ne.isTypedArray(e)){if(l&&"function"==typeof c)return new c([e]);throw new ve("Blob is not supported. Use a Buffer instead.",ve.ERR_NOT_SUPPORT)}return e}function h(e){if(e>u)throw new ve("Object is too deeply nested ("+e+" levels). Max depth: "+u,ve.ERR_FORM_DATA_DEPTH_EXCEEDED)}function d(e,n,r){let i=e;if(ne.isReactNative(t)&&ne.isReactNativeBlob(e))return t.append(Oe(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(ne.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!ne.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),h(t+n.length-1),r})}(e,1);else if(ne.isArray(e)&&function(e){return ne.isArray(e)&&!e.some(_e)}(e)||(ne.isFileList(e)||ne.endsWith(n,"[]"))&&(i=ne.toArray(e)))return n=Ee(n),i.forEach(function(e,r){!ne.isUndefined(e)&&null!==e&&t.append(!0===a?Oe([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!_e(e)||(t.append(Oe(r,n,s),p(e)),!1)}const y=Object.assign(Re,{defaultVisitor:d,convertValue:p,isVisitable:_e});if(!ne.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!ne.isUndefined(n)){if(h(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),ne.forEach(n,function(n,s){!0===(!(ne.isUndefined(n)||null===n)&&i.call(t,n,ne.isString(s)?s.trim():s,r,y))&&e(n,r?r.concat(s):[s],o+1)}),f.pop()}}(e),t};function Te(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function ke(e,t){this._pairs=[],e&&Se(e,this,t)}const Pe=ke.prototype;Pe.append=function(e,t){this._pairs.push([e,t])},Pe.toString=function(e){const t=e?t=>e.call(this,t,Te):Te;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ae=ke;function je(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ce(e,t,n){if(!t)return e;e=e||"";const r=ne.isFunction(n)?{serialize:n}:n,o=ne.getSafeProp(r,"encode")||je,i=ne.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):ne.isURLSearchParams(t)?t.toString():new Ae(t,r).toString(o),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}const Ne=Symbol("internals");function xe(e){return e?e.length:0}function Ue(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function De(e,t){const n=e.handlers,r=xe(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(e,r){n[e.index]!==e.handler&&t.handlerEntries.delete(r)}):t.handlerEntries.clear()),t.handlersLength=r}const Le=class{constructor(){this.handlers=[],this[Ne]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const r={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},o=this[Ne];null==this.handlers&&(this.handlers=[]),De(this,o);const i=o.nextId++;return this.handlers.push(r),o.handlerEntries.set(i,{handler:r,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,i}eject(e){const t=this[Ne];De(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(Ue(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],De(this,this[Ne]))}forEach(e){const t=this[Ne];De(this,t),t.iterationDepth++;try{ne.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(De(this,t),Ue(this.handlers),t.handlersLength=xe(this.handlers))}}},Fe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ae,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},qe="undefined"!=typeof window&&"undefined"!=typeof document,Ie="object"==typeof navigator&&navigator||void 0,He=qe&&(!Ie||["ReactNative","NativeScript","NS"].indexOf(Ie.product)<0),Me="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ze=qe&&window.location.href||"http://localhost",Ge={...r,...Be};function We(e){if(e>100)throw new ve("FormData field is too deeply nested ("+e+" levels). Max depth: 100",ve.ERR_FORM_DATA_DEPTH_EXCEEDED)}const $e=function(e){function t(e,n,r,o){We(o);let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&ne.isArray(r)?r.length:i,a)return ne.hasOwnProp(r,i)?r[i]=ne.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!s;ne.hasOwnProp(r,i)&&ne.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ne.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(ne.isFormData(e)&&ne.isFunction(e.entries)){const n={};return ne.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)We(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),n}return null},Je=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ke=(e,t)=>null!=e&&ne.hasOwnProp(e,t)?e[t]:void 0;const Xe={transitional:Fe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ne.isObject(e);o&&ne.isHTMLForm(e)&&(e=new FormData(e));if(ne.isFormData(e))return r?JSON.stringify($e(e)):e;if(ne.isArrayBuffer(e)||ne.isBuffer(e)||ne.isStream(e)||ne.isFile(e)||ne.isBlob(e)||ne.isReadableStream(e))return e;if(ne.isArrayBufferView(e))return e.buffer;if(ne.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ke(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Se(e,new Ge.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ge.isNode&&ne.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=ne.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ke(this,"env"),r=n&&n.FormData;return Se(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ne.isString(e))try{return(t||JSON.parse)(e),ne.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ke(this,"transitional")||Xe.transitional,n=t&&t.forcedJSONParsing,r=Ke(this,"responseType"),o="json"===r;if(ne.isResponse(e)||ne.isReadableStream(e))return e;if(e&&ne.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ke(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ve.from(e,ve.ERR_BAD_RESPONSE,this,null,Ke(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ge.classes.FormData,Blob:Ge.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(Je,e=>{Xe.headers[e]={}});const Ve=Xe;function Ye(e,t){const n=this||Ve,r=t||n,o=ye.from(r.headers);let i=r.data;return ne.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Qe(e){return!(!e||!e.__CANCEL__)}const Ze=class extends ve{constructor(e,t,n){super(e??"canceled",ve.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function et(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ve("Request failed with status code "+n.status,n.status>=400&&n.status<500?ve.ERR_BAD_REQUEST:ve.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const tt=/[\t\n\r]/g;function nt(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(tt,"")}function rt(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const ot=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const p=u&&c-u;return p?Math.round(1e3*f/p):void 0}};const it=function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n),(...e)=>s(e)]},st=(e,t,n=3)=>{let r=0;const o=ot(50,250);return it(n=>{if(!n||!ne.isNumber(n.loaded))return;const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=Math.max(0,null!=s?Math.min(i,s):i),c=Math.max(0,a-r),u=o(c);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},at=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ct=(e,t=ne.asap)=>(...n)=>t(()=>e(...n)),ut=Ge.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ge.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ge.origin),Ge.navigator&&/(msie|trident)/i.test(Ge.navigator.userAgent)):()=>!0,lt=Ge.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ne.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),ne.isString(r)&&a.push(`path=${r}`),ne.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),ne.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)try{return decodeURIComponent(r.slice(o+1))}catch(e){return r.slice(o+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const ft=/^https?:(?!\/\/)/i;function pt(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${me}@`),n=t.indexOf("#"),r=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${me}`);return-1===n?r:`${r}#${o=t.slice(n+1),o?o.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${me}`):o}`;var o}function ht(e,t){if("string"==typeof e){const n=nt(e);if(ft.test(n))throw new ve(`Invalid URL ${JSON.stringify(pt(n))}: missing "//" after protocol`,ve.ERR_INVALID_URL,t)}}function dt(e,t,n,r){ht(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(ht(e,r),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const yt=e=>e instanceof ye?{...e}:e;function mt(e,t){e=e||{},t=t||{};const n=Object.create(null);function r(e,t,n,r){return ne.isPlainObject(e)&&ne.isPlainObject(t)?ne.merge.call({caseless:r},e,t):ne.isPlainObject(t)?ne.merge({},t):ne.isArray(t)?t.slice():t}function o(e,t,n,o){return ne.isUndefined(t)?ne.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ne.isUndefined(t))return r(void 0,t)}function s(e,t){return ne.isUndefined(t)?ne.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return ne.hasOwnProp(t,i)?r(n,o):ne.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(yt(e),yt(t),0,!0)};var u;return ne.forEach((u={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(u).concat(Object.getOwnPropertySymbols(u).filter(e=>Object.getOwnPropertyDescriptor(u,e).enumerable)):Object.keys(u)),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ne.hasOwnProp(c,r)?c[r]:o,s=i(ne.hasOwnProp(e,r)?e[r]:void 0,ne.hasOwnProp(t,r)?t[r]:void 0,r);ne.isUndefined(s)&&i!==a||(n[r]=s)}),ne.hasOwnProp(t,"validateStatus")&&ne.isUndefined(t.validateStatus)&&!1===function(n){const r=ne.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!ne.isUndefined(r)){if(!ne.isPlainObject(r))return;if(ne.hasOwnProp(r,n))return r[n]}const o=ne.hasOwnProp(e,"transitional")?e.transitional:void 0;if(ne.isPlainObject(o)&&ne.hasOwnProp(o,n))return o[n]}("validateStatusUndefinedResolves")&&(ne.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const bt=["content-type","content-length"];const gt=function(e){const t=mt({},e),n=e=>ne.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),s=n("xsrfCookieName");let a=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ye.from(a),t.url=Ce(dt(u,f,l,t),n("params"),n("paramsSerializer")),c){const t=ne.getSafeProp(c,"username")||"",n=ne.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw ve.from(t,ve.ERR_BAD_OPTION_VALUE,e)}}if(ne.isFormData(r)){const e=ne.getSafeProp(r,"getHeaders");Ge.hasStandardBrowserEnv||Ge.hasStandardBrowserWebWorkerEnv||ne.isReactNative(r)?a.setContentType(void 0):ne.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{bt.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,e.call(r),n("formDataHeaderPolicy"))}if(Ge.hasStandardBrowserEnv){ne.isFunction(o)&&(o=o(t));if(!0===o||null==o&&ut(t.url)){const e=i&&s&<.read(s);e&&a.set(i,e)}}return t},wt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=gt(e);let o=r.data;const i=ye.from(r.headers).normalize();let s,a,c,u,l,f,{responseType:p,onUploadProgress:h,onDownloadProgress:d}=r;function y(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function b(o){if(!m)return;if(!(0!==m.status||"file"===(rt(nt(r.url))||rt(Ge.origin))||m.responseURL&&m.responseURL.startsWith("file:")))return n(new ve("Request aborted",ve.ECONNABORTED,e,m)),y(),void(m=null);try{o?f&&f(o):l&&l()}catch(e){setTimeout(()=>{throw e})}if(!m)return;const i=ye.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());et(function(e){t(e),y()},function(e){n(e),y()},{data:p&&"text"!==p&&"json"!==p?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:i,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(b)},m.onabort=function(){m&&(n(new ve("Request aborted",ve.ECONNABORTED,e,m)),y(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ve(r,ve.ERR_NETWORK,e,m);o.event=t||null,n(o),y(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Fe;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ve(t,o.clarifyTimeoutError?ve.ETIMEDOUT:ve.ECONNABORTED,e,m)),y(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ne.forEach(ae(i),function(e,t){m.setRequestHeader(t,e)}),ne.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),p&&"json"!==p&&(m.responseType=r.responseType),d&&([c,l,f]=st(d,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,u]=st(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new Ze(null,e,m):t),m.abort(),y(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const g=rt(r.url);if(g&&!Ge.protocols.includes(g))return n(new ve("Unsupported protocol "+g+":",ve.ERR_BAD_REQUEST,e)),void y();m.send(o||null)})},vt=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ve?t:new Ze(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new ve(`timeout of ${t}ms exceeded`,ve.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>{r||(e.aborted?o.call(e):e.addEventListener("abort",o,{once:!0}))});const{signal:a}=n;return a.unsubscribe=()=>ne.asap(s),a},_t=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Et=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()}},Ot=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Et(e))yield*_t(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Rt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,St=(e,t,n)=>t+2<n&&Rt(e.charCodeAt(t+1))&&Rt(e.charCodeAt(t+2)),Tt=e=>e<=57?e-48:(223&e)-55,kt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Pt=e=>9===e||10===e||12===e||13===e||32===e,At=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},jt=e=>{const t=e.length;let n=0,r=0,o=!1;for(let i=0;i<t;i++){let s=e.charCodeAt(i);37===s&&St(e,i,t)&&(s=16*Tt(e.charCodeAt(i+1))+Tt(e.charCodeAt(i+2)),i+=2),Pt(s)||(61!==s?!kt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?At(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Ct=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const r=e.slice(5,n),o=e.slice(n+1);if(/;base64/i.test(r))return t(o);let i=0;for(let e=0,t=o.length;e<t;e++){const n=o.charCodeAt(e);if(37===n&&St(o,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=o.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const Nt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:xt}=ne,Ut=e=>{if(!ne.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Dt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Lt=e=>{const t=void 0!==ne.global&&null!==ne.global?ne.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=ne.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:s}=e,a=o?xt(o):"function"==typeof fetch,c=xt(i),u=xt(s);if(!a)return!1;const l=a&&xt(n),f=a&&("function"==typeof r?(p=new r,e=>p.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var p;const h=c&&l&&Dt(()=>{let e=!1;const t=new i(Ge.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),d=u&&l&&Dt(()=>ne.isReadableStream(new s("").body)),y={stream:d&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!y[e]&&(y[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ve(`Response type '${e}' is not supported`,ve.ERR_NOT_SUPPORT,n)})});const m=async e=>{if(null==e)return 0;if(ne.isBlob(e))return e.size;if(ne.isSpecCompliantForm(e)){const t=new i(Ge.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ne.isArrayBufferView(e)||ne.isArrayBuffer(e)?e.byteLength:(ne.isURLSearchParams(e)&&(e+=""),ne.isString(e)?(await f(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:a,signal:u,cancelToken:f,timeout:p,onDownloadProgress:b,onUploadProgress:g,responseType:w,headers:v,withCredentials:_="same-origin",fetchOptions:E,maxContentLength:O,maxBodyLength:R,maxRedirects:S}=gt(e);const T=ne.isNumber(O)&&O>-1,k=ne.isNumber(R)&&R>-1;let P=o||fetch;w=w?(w+"").toLowerCase():"text";let A=vt([u,f&&f.toAbortSignal()],p),j=null;const C=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let N,x=null;const U=()=>new ve("Request body larger than maxBodyLength limit",ve.ERR_BAD_REQUEST,e,j);try{let o;const u=(L="auth",ne.hasOwnProp(e,L)?e[L]:void 0);if(u){const e=ne.getSafeProp(u,"username")||"";o={username:e,password:ne.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,Ge.origin);if(!o&&(e.username||e.password)){const t=Ut(e.username);o={username:t,password:Ut(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(o&&(v.delete("authorization"),v.set("Authorization","Basic "+btoa((D=(o.username||"")+":"+(o.password||""),encodeURIComponent(D).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Ct(-1===t?e:e.slice(0,t),jt)}(t);if(n>O)throw new ve("maxContentLength size of "+O+" exceeded",ve.ERR_BAD_RESPONSE,e,j)}if(k&&"get"!==n&&"head"!==n){const e=await m(a);if("number"==typeof e&&isFinite(e)&&(N=e,e>R))throw U()}const f=k&&(ne.isReadableStream(a)||ne.isStream(a)),p=(e,t,n)=>Ot(e,65536,e=>{if(k&&e>R)throw x=U();t&&t(e)},n);if(h&&"get"!==n&&"head"!==n&&(g||f)){if(N=N??await(async(e,t)=>{const n=ne.toFiniteNumber(e.getContentLength());return n??m(t)})(v,a),0!==N||f){let e,n=new i(t,{method:"POST",body:a,duplex:"half"});if(ne.isFormData(a)&&(e=n.headers.get("content-type"))&&v.setContentType(e),n.body){const[e,t]=g&&at(N,st(ct(g)))||[];a=p(n.body,e,t)}}}else if(f&&!c&&l&&"get"!==n&&"head"!==n)a=p(a);else if(f&&c&&!h&&"get"!==n&&"head"!==n)throw new ve("Stream request bodies are not supported by the current fetch implementation",ve.ERR_NOT_SUPPORT,e,j);ne.isString(_)||(_=_?"include":"omit");const F=c&&"credentials"in i.prototype;if(ne.isFormData(a)){const e=v.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&v.delete("content-type")}v.set("User-Agent","axios/1.20.0",!1);const B=null==E?E:Object.assign(Object.create(null),E);B&&(delete B.body,delete B.headers,delete B.method,delete B.signal,delete B.duplex,delete B.credentials);const q=Object.assign(Object.create(null),B,{signal:A,method:n.toUpperCase(),headers:ae(v.normalize()),body:a,duplex:"half",credentials:F?_:void 0});c&&(ne.forEach(Nt,(e,t)=>{void 0===q[t]&&(q[t]=e)}),void 0===q.signal&&(q.signal=null),void 0===q.body&&(q.body=null)),0===S&&(q.redirect="manual",B&&(B.redirect="manual")),j=c&&new i(t,q);let I=await(c?P(j,B):P(t,q));const H=ye.from(I.headers);if(T){const t=ne.toFiniteNumber(H.getContentLength());if(null!=t&&t>O)throw new ve("maxContentLength size of "+O+" exceeded",ve.ERR_BAD_RESPONSE,e,j)}const M=d&&("stream"===w||"response"===w);if(d&&I.body&&(b||T||M&&C)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=I[e]});const n=ne.toFiniteNumber(H.getContentLength()),[r,o]=b&&at(n,st(ct(b),!0))||[];let i=0;const a=t=>{if(T&&(i=t,i>O))throw new ve("maxContentLength size of "+O+" exceeded",ve.ERR_BAD_RESPONSE,e,j);r&&r(t)};I=new s(Ot(I.body,65536,a,()=>{o&&o(),C&&C()}),t)}w=w||"text";let z=await y[ne.findKey(y,w)||"text"](I,e);if(T&&!d&&!M){let t;if(null!=z&&("number"==typeof z.byteLength?t=z.byteLength:"number"==typeof z.size?t=z.size:"string"==typeof z&&(t="function"==typeof r?(new r).encode(z).byteLength:z.length)),"number"==typeof t&&t>O)throw new ve("maxContentLength size of "+O+" exceeded",ve.ERR_BAD_RESPONSE,e,j)}return!M&&C&&C(),await new Promise((t,n)=>{et(t,n,{data:z,headers:ye.from(I.headers),status:I.status,statusText:I.statusText,config:e,request:j})})}catch(t){if(C&&C(),A&&A.aborted&&A.reason instanceof ve){const n=A.reason;throw n.config=e,j&&(n.request=j),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(x)throw j&&!x.request&&(x.request=j),x;if(t instanceof ve)throw j&&!t.request&&(t.request=j),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new ve("Network Error",ve.ERR_NETWORK,e,j,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw ve.from(t,t&&t.code,e,j,t&&t.response)}var D,L}},Ft=new Map,Bt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,u=Ft;for(;c--;)s=i[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Lt(t)),u=a;return a},qt=(Bt(),{http:null,xhr:wt,fetch:{get:Bt}});ne.forEach(qt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const It=e=>`- ${e}`,Ht=e=>ne.isFunction(e)||null===e||!1===e;const Mt={getAdapter:function(e,t){e=ne.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ht(r)&&(o=qt[(n=String(r)).toLowerCase()],void 0===o))throw new ve(`Unknown adapter '${n}'`);if(o&&(ne.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).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(It).join("\n"):" "+It(e[0]):"as no adapter specified";throw new ve("There is no suitable adapter to dispatch the request "+t,ve.ERR_NOT_SUPPORT)}return o},adapters:qt};function zt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ze(null,e)}function Gt(e){const t=ne.toSafeFlatObject(e);zt(t),t.headers=ye.from(ne.getSafeProp(t,"headers")),t.data=Ye.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Mt.getAdapter(t.adapter||Ve.adapter,t)(t).then(function(e){zt(t),t.response=e;try{e.data=Ye.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=ye.from(e.headers),e},function(e){if(!Qe(e)&&(zt(t),e&&e.response)){t.response=e.response;try{e.response.data=Ye.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=ye.from(e.response.headers)}return Promise.reject(e)})}const Wt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Wt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const $t={};Wt.transitional=function(e,t,n){function r(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ve(r(o," has been removed"+(t?" in "+t:"")),ve.ERR_DEPRECATED);return t&&!$t[o]&&($t[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Wt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Jt={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new ve("options must be an object",ve.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new ve("option "+i+" must be "+n,ve.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ve("Unknown option "+i,ve.ERR_BAD_OPTION)}},validators:Wt},Kt=Jt.validators;class Xt{constructor(e){this.defaults=e||{},this.interceptors={request:new Le,response:new Le}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let r="";if("string"==typeof n){const e=n.indexOf("\n");r=-1===e?"":n.slice(e+1)}if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),o=-1===n?"":r.slice(n+1);String(e.stack).endsWith(o)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=mt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Jt.assertOptions(n,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean),legacyInterceptorReqResOrdering:Kt.transitional(Kt.boolean),advertiseZstdAcceptEncoding:Kt.transitional(Kt.boolean),validateStatusUndefinedResolves:Kt.transitional(Kt.boolean)},!1),null!=r&&(ne.isFunction(r)?t.paramsSerializer={serialize:r}:Jt.assertOptions(r,{encode:Kt.function,serialize:Kt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Jt.assertOptions(t,{baseUrl:Kt.spelling("baseURL"),withXsrfToken:Kt.spelling("withXSRFToken")},!0),t.method=(ne.getSafeProp(t,"method")||ne.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=o&&ne.merge(o.common,o[t.method]);o&&ne.forEach(Je.concat("common"),e=>{delete o[e]}),t.headers=ye.concat(i,o);const s=[];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||Fe;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,f=0;if(!a){const e=[Gt.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);f<l;)u=u.then(e[f++],e[f++]);return u}l=s.length;let p=t;for(;f<l;){const e=s[f++],t=s[f++];try{p=e?e(p):p}catch(e){if(!t){u=Promise.reject(e);break}try{const n=t.call(this,e);ne.isThenable(n)&&(u=Promise.resolve(n).then(()=>Gt.call(this,p)))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=Gt.call(this,p)}catch(e){u=Promise.reject(e)}for(f=0,l=c.length;f<l;)u=u.then(c[f++],c[f++]);return u}getUri(e){return Ce(dt((e=mt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}ne.forEach(["delete","get","head","options"],function(e){Xt.prototype[e]=function(t,n){return this.request(mt(n||{},{method:e,url:t,data:n&&ne.hasOwnProp(n,"data")?n.data:void 0}))}}),ne.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(mt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Xt.prototype[e]=t(),"query"!==e&&(Xt.prototype[e+"Form"]=t(!0))});const Vt=Xt;class Yt{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,o){n.reason||(n.reason=new Ze(e,r,o),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 Yt(function(t){e=t}),cancel:e}}}const Qt=Yt;const Zt={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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Zt).forEach(([e,t])=>{void 0===Zt[t]&&(Zt[t]=e)});const en=Zt;const tn=function e(t){const n=new Vt(t),r=o(Vt.prototype.request,n);return ne.extend(r,Vt.prototype,n,{allOwnKeys:!0}),ne.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(mt(t,n))},r}(Ve);tn.Axios=Vt,tn.CanceledError=Ze,tn.CancelToken=Qt,tn.isCancel=Qe,tn.VERSION="1.20.0",tn.toFormData=Se,tn.AxiosError=ve,tn.Cancel=tn.CanceledError,tn.all=function(e){return Promise.all(e)},tn.spread=function(e){return function(t){return e.apply(null,t)}},tn.isAxiosError=function(e){return ne.isObject(e)&&!0===e.isAxiosError},tn.mergeConfig=mt,tn.AxiosHeaders=ye,tn.formToJSON=e=>$e(ne.isHTMLForm(e)?new FormData(e):e),tn.getAdapter=Mt.getAdapter,tn.HttpStatusCode=en,tn.default=tn;const nn=tn;function rn(e){return rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rn(e)}function on(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return sn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(sn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,sn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,sn(f,"constructor",u),sn(u,"constructor",c),c.displayName="GeneratorFunction",sn(u,o,"GeneratorFunction"),sn(f),sn(f,o,"Generator"),sn(f,r,function(){return this}),sn(f,"toString",function(){return"[object Generator]"}),(on=function(){return{w:i,m:p}})()}function sn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}sn=function(e,t,n,r){function i(t,n){sn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},sn(e,t,n,r)}function an(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function cn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,un(r.key),r)}}function un(e){var t=function(e,t){if("object"!=rn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==rn(t)?t:t+""}var ln=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._token=e._validate(t)},t=[{key:"getAccessToken",value:(r=on().m(function e(){return on().w(function(e){for(;;)if(0===e.n)return e.a(2,this._token)},e,this)}),o=function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function s(e){an(i,n,o,s,a,"next",e)}function a(e){an(i,n,o,s,a,"throw",e)}s(void 0)})},function(){return o.apply(this,arguments)})},{key:"canRefresh",value:function(){return!1}},{key:"clear",value:function(){this._token=null}}],n=[{key:"_validate",value:function(e){if("string"!=typeof e||!e.trim())throw new TypeError("bearer token must be a non-empty string");return e.trim()}}],t&&cn(e.prototype,t),n&&cn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}();function fn(e){return fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fn(e)}function pn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return hn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(hn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,hn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,hn(f,"constructor",u),hn(u,"constructor",c),c.displayName="GeneratorFunction",hn(u,o,"GeneratorFunction"),hn(f),hn(f,o,"Generator"),hn(f,r,function(){return this}),hn(f,"toString",function(){return"[object Generator]"}),(pn=function(){return{w:i,m:p}})()}function hn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}hn=function(e,t,n,r){function i(t,n){hn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},hn(e,t,n,r)}function dn(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function yn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){dn(i,r,o,s,a,"next",e)}function a(e){dn(i,r,o,s,a,"throw",e)}s(void 0)})}}function mn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,bn(r.key),r)}}function bn(e){var t=function(e,t){if("object"!=fn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=fn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==fn(t)?t:t+""}var gn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var wn=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.tokenUrl,r=t.clientId,o=void 0===r?"appmesh-cli":r,i=t.accessToken,s=t.refreshToken,a=t.expiresIn,c=void 0===a?0:a,u=t.httpClient;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._tokenUrl=function(e){var t;try{t=new URL(e)}catch(e){throw new TypeError("tokenUrl must be a valid URL")}if("https:"===t.protocol)return e;if("http:"===t.protocol&&gn.has(t.hostname.toLowerCase()))return e;throw new TypeError("tokenUrl must use https, or http only for loopback hosts (127.0.0.1, localhost, ::1)")}(n),this._clientId=o,this._accessToken=i||null,this._refreshToken=s||null,this._http=u||nn.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(c)},t=[{key:"getAccessToken",value:(s=yn(pn().m(function e(){return pn().w(function(e){for(;;)switch(e.n){case 0:if(!(null===this._accessToken&&this._refreshToken||this._isExpiringSoon())){e.n=1;break}return e.n=1,this._refresh();case 1:if(null!==this._accessToken||this._refreshToken){e.n=2;break}throw new Error("no access token available: the provider holds no credentials");case 2:return e.a(2,this._accessToken)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"canRefresh",value:function(){return!!this._refreshToken}},{key:"refreshAccessToken",value:(i=yn(pn().m(function e(t){return pn().w(function(e){for(;;)switch(e.n){case 0:if(!t||t===this._accessToken){e.n=1;break}return e.a(2,this._accessToken);case 1:return e.n=2,this._refresh();case 2:return e.a(2,this._accessToken)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"clear",value:function(){this._accessToken=null,this._refreshToken=null,this._expiresAtMs=0,this._lifetimeMs=0}},{key:"_setExpiry",value:function(e){var t=Number(e);Number.isFinite(t)&&t>0?(this._lifetimeMs=1e3*t,this._expiresAtMs=Date.now()+this._lifetimeMs):(this._lifetimeMs=0,this._expiresAtMs=0)}},{key:"_isExpiringSoon",value:function(){if(!this._expiresAtMs||!this._refreshToken)return!1;var e=Math.max(3e4,.1*this._lifetimeMs);return Date.now()>=this._expiresAtMs-e}},{key:"_refresh",value:(o=yn(pn().m(function e(){var t=this;return pn().w(function(e){for(;;)if(0===e.n)return this._inflightRefresh||(this._inflightRefresh=this._performRefresh().finally(function(){t._inflightRefresh=null})),e.a(2,this._inflightRefresh)},e,this)})),function(){return o.apply(this,arguments)})},{key:"_performRefresh",value:(r=yn(pn().m(function e(){var t,n,r,o,i;return pn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this._refreshToken){e.n=1;break}throw new Error("cannot refresh: no refresh token available");case 1:return t=new URLSearchParams({grant_type:"refresh_token",refresh_token:this._refreshToken,client_id:this._clientId}),e.p=2,e.n=3,this._http.post(this._tokenUrl,t.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"},validateStatus:function(){return!0}});case 3:n=e.v,e.n=5;break;case 4:throw e.p=4,i=e.v,new Error("token refresh request failed: ".concat(i.message||"unknown error"));case 5:if(r=n.status,"invalid_grant"!==(o=n.data&&"object"===fn(n.data)?n.data:{}).error){e.n=6;break}throw this.clear(),new Error("token refresh rejected by the server (invalid_grant)");case 6:if(!(r<200||r>=300||o.error)){e.n=7;break}throw new Error("token refresh failed with status ".concat(r).concat(o.error?": ".concat(o.error):""));case 7:if("string"==typeof o.access_token&&o.access_token){e.n=8;break}throw new Error("token refresh response did not include an access_token");case 8:this._accessToken=o.access_token,"string"==typeof o.refresh_token&&o.refresh_token&&(this._refreshToken=o.refresh_token),this._setExpiry(o.expires_in);case 9:return e.a(2)}},e,this,[[2,4]])})),function(){return r.apply(this,arguments)})}],t&&mn(e.prototype,t),n&&mn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i,s}();function vn(e){return vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vn(e)}function _n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return En(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(En(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,En(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,En(f,"constructor",u),En(u,"constructor",c),c.displayName="GeneratorFunction",En(u,o,"GeneratorFunction"),En(f),En(f,o,"Generator"),En(f,r,function(){return this}),En(f,"toString",function(){return"[object Generator]"}),(_n=function(){return{w:i,m:p}})()}function En(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}En=function(e,t,n,r){function i(t,n){En(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},En(e,t,n,r)}function On(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach(function(t){kn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kn(e,t,n){return(t=Nn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pn(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function An(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Pn(i,r,o,s,a,"next",e)}function a(e){Pn(i,r,o,s,a,"throw",e)}s(void 0)})}}function jn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Nn(r.key),r)}}function Cn(e,t,n){return t&&jn(e.prototype,t),n&&jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nn(e){var t=function(e,t){if("object"!=vn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=vn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==vn(t)?t:t+""}function xn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Un(e,t,n){return t=qn(t),function(e,t){if(t&&("object"==vn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Fn()?Reflect.construct(t,n||[],qn(e).constructor):t.apply(e,n))}function Dn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Bn(e,t)}function Ln(e){var t="function"==typeof Map?new Map:void 0;return Ln=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(Fn())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Bn(o,n.prototype),o}(e,arguments,qn(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Bn(n,e)},Ln(e)}function Fn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Fn=function(){return!!e})()}function Bn(e,t){return Bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Bn(e,t)}function qn(e){return qn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qn(e)}var In=null,Hn=null,Mn=null,zn=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path"}),Gn=Object.freeze({isNode:!("undefined"!=typeof window&&void 0!==window.document)}),Wn=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return xn(this,e),(n=Un(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return Dn(e,Ln(Error)),Cn(e)}(),$n=function(){function e(t){var n;return xn(this,e),(n=Un(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Dn(e,Wn),Cn(e)}(),Jn=function(){function e(t){var n;return xn(this,e),(n=Un(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Dn(e,Wn),Cn(e)}(),Kn=function(e,t){Gn.isNode?process.stdout.write(e):console.log(e)};function Xn(e){if("number"==typeof e)return e;if("string"!=typeof e)throw new Error("Invalid input type. Expected number or ISO 8601 duration string.");if(/^\d+$/.test(e))return parseInt(e,10);if(!e.trim())throw new Error("Duration string cannot be empty");if(!e.startsWith("P"))throw new Error("Invalid ISO8601 duration: must start with P");var t="\\d+",n="".concat(t,"(?:[\\.,]").concat(t,")?"),r="(".concat(t,"Y)?(").concat(t,"M)?(").concat(t,"W)?(").concat(t,"D)?"),o="T(".concat(n,"H)?(").concat(n,"M)?(").concat(n,"S)?"),i="P(?:".concat(r,"(?:").concat(o,")?)"),s=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(i));if(!a)throw new RangeError("invalid duration: "+e);var c=a.slice(1);if(0===c.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(c.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var u=c.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*u.years,l+=2592e3*u.months,l+=604800*u.weeks,l+=86400*u.days,l+=3600*u.hours,l+=60*u.minutes,l+=u.seconds}function Vn(e,t){if(e){var n=t.toLowerCase(),r=Object.keys(e).find(function(e){return e.toLowerCase()===n});return void 0===r?void 0:e[r]}}function Yn(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(Vn(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new Wn("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function Qn(e){return Zn.apply(this,arguments)}function Zn(){return(Zn=An(_n().m(function e(t){var r,o,i,s;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=parseInt(t,10),isNaN(r)||String(r)!==t.trim()){e.n=1;break}return e.a(2,r);case 1:return e.p=1,e.n=2,n.e(994).then(()=>n.t(994,19));case 2:if(o=e.v,i=o.spawnSync,0===(s=i("id",["-u",t],{encoding:"utf8",timeout:3e3})).status&&s.stdout){e.n=3;break}return e.a(2,null);case 3:return e.a(2,parseInt(s.stdout.trim(),10));case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}function er(e){return tr.apply(this,arguments)}function tr(){return(tr=An(_n().m(function e(t){var n,r;return _n().w(function(e){for(;;)switch(e.n){case 0:if(n=parseInt(t,10),isNaN(n)||String(n)!==t.trim()){e.n=1;break}return e.a(2,n);case 1:return e.n=2,nr("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function nr(e,t){return rr.apply(this,arguments)}function rr(){return(rr=An(_n().m(function e(t,r){var o,i,s,a,c,u,l,f,p,h,d;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.e(994).then(()=>n.t(994,19));case 1:if(o=e.v,i=o.spawnSync,0!==(s=i("getent",["group",String(r)],{encoding:"utf8",timeout:3e3})).status||!s.stdout){e.n=2;break}return a=s.stdout.trim().split(":"),c=a.length>=3?parseInt(a[2],10):NaN,e.a(2,a[0]&&!isNaN(c)?{name:a[0],gid:c}:null);case 2:if(0===(u=i("dscacheutil",["-q","group","-a",t,String(r)],{encoding:"utf8",timeout:3e3})).status&&u.stdout){e.n=3;break}return e.a(2,null);case 3:if(l=u.stdout.split("\n"),f=l.find(function(e){return e.startsWith("name:")}),p=l.find(function(e){return e.startsWith("gid:")}),f&&p){e.n=4;break}return e.a(2,null);case 4:return h=f.slice(5).trim(),d=parseInt(p.slice(4).trim(),10),e.a(2,h&&!isNaN(d)?{name:h,gid:d}:null);case 5:return e.p=5,e.v,e.a(2,null)}},e,null,[[0,5]])}))).apply(this,arguments)}function or(e){return ir.apply(this,arguments)}function ir(){return(ir=An(_n().m(function e(t){var r,o,i,s;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.e(994).then(()=>n.t(994,19));case 1:if(r=e.v,o=r.spawnSync,0===(i=o("id",["-un",String(t)],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=2;break}return e.a(2,null);case 2:return s=i.stdout.trim(),e.a(2,s||null);case 3:return e.p=3,e.v,e.a(2,null)}},e,null,[[0,3]])}))).apply(this,arguments)}function sr(e){return ar.apply(this,arguments)}function ar(){return(ar=An(_n().m(function e(t){var n;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,nr("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var cr="/opt/appmesh/ssl/ca.pem";function ur(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function lr(e){if(!e)return null;var t="function"==typeof e.get?e.get(zn.HTTP_HEADER_KEY_AUTH):e[zn.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function fr(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:Hn.readFileSync(e)}function pr(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return Hn.existsSync(cr)?{ca:Hn.readFileSync(cr),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=Tn({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=fr(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var hr=function(){return Cn(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gn.isNode?"https://127.0.0.1:6060":window.location.origin,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;xn(this,e),this.baseURL=r,this.forwardingHost=null,this._tokenProvider=null,i&&this.set_token_provider(i);var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[Yn]};this._sslConfig=o,this._client=nn.create(s),Gn.isNode&&!Mn&&(Mn=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=On(e,2),n=t[0],r=t[1];In=n.default||n,Hn=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=An(_n().m(function e(n){var r,o;return _n().w(function(e){for(;;)switch(e.n){case 0:return r=Tn,o=Tn({},n.headers),e.n=1,t._commonHeaders();case 1:return n.headers=r(o,e.v),e.a(2,n)}},e)}));return function(t){return e.apply(this,arguments)}}(),function(e){var t=new Wn("Request configuration error: "+(e.message||"Unknown error"));return Promise.reject(t)}),this._client.interceptors.response.use(function(e){return t._handleUnauthorizedRetry(e)},function(e){var t,n,r,o;if(e instanceof Wn)return Promise.reject(e);var i=new Wn("Request failed: "+(e.message||"Unknown error"),null!==(t=null===(n=e.response)||void 0===n?void 0:n.status)&&void 0!==t?t:null,null!==(r=null===(o=e.response)||void 0===o?void 0:o.data)&&void 0!==r?r:null);return i.cause=e,Promise.reject(i)})},[{key:"set_token_provider",value:function(e){if(!e||"function"!=typeof e.getAccessToken)throw new TypeError("tokenProvider must implement async getAccessToken()");this._tokenProvider=e}},{key:"set_bearer_token",value:function(e){null!=e?this.set_token_provider(new ln(e)):this.clear_bearer_token()}},{key:"set_token",value:function(e){this.set_bearer_token(e)}},{key:"clear_bearer_token",value:function(){var e=this._tokenProvider;e&&"function"==typeof e.clear&&e.clear(),this._tokenProvider=null}},{key:"_getAccessToken",value:(M=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:if(!this._tokenProvider){e.n=2;break}return e.n=1,this._tokenProvider.getAccessToken();case 1:t=e.v,e.n=3;break;case 2:t=null;case 3:return e.a(2,t)}},e,this)})),function(){return M.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(H=An(_n().m(function e(t){var n,r,o,i,s,a,c,u;return _n().w(function(e){for(;;)switch(e.n){case 0:if(r=t.config||{},o=this._tokenProvider,401===t.status&&!r.__appmeshRetried&&o){e.n=1;break}return e.a(2,t);case 1:if("function"!=typeof o.canRefresh){e.n=3;break}return e.n=2,o.canRefresh();case 2:c=e.v,e.n=4;break;case 3:c=!!o.canRefresh;case 4:if(c&&"function"==typeof o.refreshAccessToken&&ur(r.data)){e.n=5;break}return e.a(2,t);case 5:if(null===(n=lr(r.headers))||void 0===n){e.n=6;break}u=n,e.n=8;break;case 6:return e.n=7,this._getAccessToken();case 7:u=e.v;case 8:return i=u,e.n=9,o.refreshAccessToken(i);case 9:if("string"==typeof(s=e.v)&&s.trim()){e.n=10;break}return e.a(2,t);case 10:return r.__appmeshRetried=!0,a="Bearer ".concat(s.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(zn.HTTP_HEADER_KEY_AUTH,a):r.headers=Tn(Tn({},r.headers),{},kn({},zn.HTTP_HEADER_KEY_AUTH,a)),e.a(2,this._client(r))}},e,this)})),function(e){return H.apply(this,arguments)})},{key:"get_auth_config",value:(I=An(_n().m(function e(){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return I.apply(this,arguments)})},{key:"get_current_principal",value:(q=An(_n().m(function e(){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return q.apply(this,arguments)})},{key:"list_apps",value:(B=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"get_app",value:(F=An(_n().m(function e(t){var n;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"check_app_health",value:(L=An(_n().m(function e(t){var n;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"add_app",value:(D=An(_n().m(function e(t,n){var r;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"delete_app",value:(U=An(_n().m(function e(t){var n,r;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("delete","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,200===n.status);case 2:if(e.p=2,404!==(r=e.v).statusCode){e.n=3;break}return e.a(2,!1);case 3:throw r;case 4:return e.a(2)}},e,this,[[0,2]])})),function(e){return U.apply(this,arguments)})},{key:"enable_app",value:(x=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/enable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"disable_app",value:(N=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"get_app_output",value:(C=An(_n().m(function e(t){var n,r,o,i,s,a,c,u,l,f,p=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:0,r=p.length>3&&void 0!==p[3]?p[3]:10240,o=p.length>4&&void 0!==p[4]?p[4]:"",i=p.length>5&&void 0!==p[5]?p[5]:0,s={stdout_position:(p.length>1&&void 0!==p[1]?p[1]:0).toString(),stdout_index:n.toString(),stdout_maxsize:r.toString(),process_uuid:o,timeout:Xn(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,c=Vn(a.headers,"X-Output-Position"),u=Vn(a.headers,"X-Exit-Code"),l=c?parseInt(c,10):null,f=u?parseInt(u,10):null,e.a(2,new dr(a.status,a.data,l,f))}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"run_app_sync",value:(j=An(_n().m(function e(t){var n,r,o,i,s,a,c,u=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:Kn,r=u.length>2&&void 0!==u[2]?u[2]:zn.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=u.length>3&&void 0!==u[3]?u[3]:zn.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i={timeout:Xn(r),lifecycle:Xn(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:i});case 1:return s=e.v,a=null,200===s.status?(n&&n(s.data,0),(c=Vn(s.headers,"X-Exit-Code"))&&(a=parseInt(c,10))):n&&n(s.data,0),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"run_app_async",value:(A=An(_n().m(function e(t){var n,r,o,i,s=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:zn.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:zn.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:Xn(n),lifecycle:Xn(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new yr(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"wait_for_async_run",value:(P=An(_n().m(function e(t){var n,r,o,i,s,a,c=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:Kn,r=c.length>2&&void 0!==c[2]?c[2]:0,!t){e.n=7;break}o=0,i=new Date,s=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.get_app_output(t.appName,o,0,20480,t.procUid,s);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.delete_app(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-i)/1e3>r)){e.n=5;break}return e.a(3,7);case 5:return e.n=6,new Promise(function(e){return setTimeout(e,100)});case 6:e.n=1;break;case 7:return e.a(2,null)}},e,this)})),function(e){return P.apply(this,arguments)})},{key:"run_task",value:(k=An(_n().m(function e(t,n){var r,o,i=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:return(r=i.length>2&&void 0!==i[2]?i[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return k.apply(this,arguments)})},{key:"cancel_task",value:(T=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return T.apply(this,arguments)})},{key:"download_file",value:(S=An(_n().m(function e(t){var r,o,i,s,a,c,u,l,f,p,h,d,y,m,b,g,w=arguments;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:return o=w.length>2&&void 0!==w[2]&&w[2],(r=w.length>1&&void 0!==w[1]?w[1]:null)||(r=t.split(/[\\/]/).pop()),i=kn({},zn.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:i,config:{responseType:"arraybuffer"}});case 1:if(200===(s=e.v).status){e.n=2;break}throw new Wn("Failed to download file: ".concat(t),s.status,s.data);case 2:if(!Gn.isNode){e.n=15;break}return e.n=3,n.e(840).then(()=>n.t(840,19));case 3:return a=e.v,e.p=4,e.n=5,a.writeFile(r,Buffer.from(s.data));case 5:if(!o||"win32"===process.platform){e.n=12;break}if(c=s.headers,e.p=6,!(u=c["x-file-mode"])){e.n=7;break}return e.n=7,a.chmod(r,parseInt(u,10));case 7:if(l=c["x-file-user"],f=c["x-file-group"],!l||!f){e.n=10;break}return e.n=8,Qn(l);case 8:return p=e.v,e.n=9,er(f);case 9:if(h=e.v,null===p||null===h){e.n=10;break}return e.n=10,a.chown(r,p,h);case 10:e.n=12;break;case 11:e.p=11,b=e.v,console.warn("Warning: Unable to apply file attributes to",r,b.message);case 12:e.n=14;break;case 13:throw e.p=13,g=e.v,new Wn("Failed to write file to ".concat(r,": ").concat(g.message),s.status);case 14:e.n=16;break;case 15:d=new Blob([s.data]),y=window.URL.createObjectURL(d),(m=document.createElement("a")).style.display="none",m.href=y,m.download=r.split("/").pop(),document.body.appendChild(m),m.click(),window.URL.revokeObjectURL(y),document.body.removeChild(m);case 16:return e.a(2)}},e,this,[[6,11],[4,13]])})),function(e){return S.apply(this,arguments)})},{key:"upload_file",value:(R=An(_n().m(function e(t){var r,o,i,s,a,c,u,l,f,p,h,d,y,m=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:if(o=m.length>2&&void 0!==m[2]&&m[2],r=m.length>1&&void 0!==m[1]?m[1]:null){e.n=2;break}if(i="string"==typeof t?t:t&&t.name){e.n=1;break}throw new Wn("filePath is required when localFile is a Blob without a name");case 1:r=i.split(/[\\/]/).pop();case 2:if(s=kn({},zn.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(r)),!Gn.isNode){e.n=8;break}return e.n=3,n.e(894).then(()=>n.t(894,19));case 3:return c=e.v.default,e.n=4,n.e(603).then(()=>n.t(603,19));case 4:if(u=e.v,a=new c,l=r.split("/").pop(),a.append("filename",l),(f=u.statSync(t)).size<10485760?(p=u.readFileSync(t),a.append("file",p,{filename:t.split("/").pop()})):a.append("file",u.createReadStream(t)),!o){e.n=7;break}return s["X-File-Mode"]=(511&f.mode).toString(),e.n=5,or(f.uid);case 5:return h=e.v,e.n=6,sr(f.gid);case 6:d=e.v,s["X-File-User"]=h||String(f.uid),s["X-File-Group"]=d||String(f.gid);case 7:Object.assign(s,a.getHeaders()),e.n=12;break;case 8:if(a=new FormData,!(t instanceof File)){e.n=9;break}y=t.name,e.n=11;break;case 9:if(!(t instanceof Blob)){e.n=10;break}y=r.split("/").pop(),e.n=11;break;case 10:throw new Wn("In browser, localFile must be File or Blob");case 11:a.append("filename",y),a.append("file",t);case 12:return e.n=13,this._request("post","/appmesh/file/upload",a,{headers:s,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 13:return e.a(2)}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"get_host_resources",value:(O=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/resources");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return O.apply(this,arguments)})},{key:"get_config",value:(E=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/config");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"set_config",value:(_=An(_n().m(function e(t){var n;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return _.apply(this,arguments)})},{key:"set_log_level",value:(v=An(_n().m(function e(){var t,n,r=arguments;return _n().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.set_config({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return v.apply(this,arguments)})},{key:"add_label",value:(w=An(_n().m(function e(t,n){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return w.apply(this,arguments)})},{key:"delete_label",value:(g=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"list_labels",value:(b=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return b.apply(this,arguments)})},{key:"list_principals",value:(m=An(_n().m(function e(){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principals");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"update_principal",value:(y=An(_n().m(function e(t,n){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return y.apply(this,arguments)})},{key:"delete_principal",value:(d=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"get_current_user",value:(h=An(_n().m(function e(){return _n().w(function(e){for(;;)if(0===e.n)return e.a(2,this.get_current_principal())},e,this)})),function(){return h.apply(this,arguments)})},{key:"list_permissions",value:(p=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"get_principal_permissions",value:(f=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"get_user_permissions",value:(l=An(_n().m(function e(){return _n().w(function(e){for(;;)if(0===e.n)return e.a(2,this.get_principal_permissions())},e,this)})),function(){return l.apply(this,arguments)})},{key:"list_roles",value:(u=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"update_role",value:(c=An(_n().m(function e(t,n){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return c.apply(this,arguments)})},{key:"delete_role",value:(a=An(_n().m(function e(t){return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"get_metrics",value:(s=An(_n().m(function e(){var t;return _n().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"subscribe",value:(i=An(_n().m(function e(){return _n().w(function(e){for(;;)switch(e.n){case 0:throw new Wn("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return i.apply(this,arguments)})},{key:"unsubscribe",value:(o=An(_n().m(function e(){return _n().w(function(e){for(;;)switch(e.n){case 0:throw new Wn("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"request",value:(r=An(_n().m(function e(t,n){var r,o,i=arguments;return _n().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_commonHeaders",value:(t=An(_n().m(function e(){var t,n,r,o,i;return _n().w(function(e){for(;;)switch(e.n){case 0:return t={},Gn.isNode&&(t[zn.HTTP_USER_AGENT_HEADER_NAME]=zn.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[zn.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(this.forwardingHost.includes(":")?t[zn.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost:(r=new URL(this.baseURL),o="https:"===r.protocol?"443":"80",i=r.port||o,t[zn.HTTP_HEADER_KEY_X_TARGET_HOST]="".concat(this.forwardingHost,":").concat(i))),e.a(2,t)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_request",value:(e=An(_n().m(function e(t,n){var r,o,i,s,a,c,u,l,f,p,h,d,y=arguments;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},!Gn.isNode||!Mn||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Mn;case 1:In&&(this._client.defaults.httpsAgent=new In.Agent(Tn(Tn({},pr(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return i=o.headers,s=void 0===i?{}:i,a=o.params,c=void 0===a?{}:a,u=o.config,l=void 0===u?{}:u,e.p=3,f=Tn(Tn({method:t,url:n,withCredentials:!1},l),{},{headers:Tn({},s),params:Tn({},c)}),null!==r&&(f.data=r),e.n=4,this._client(f);case 4:if(!((p=e.v).status<200||p.status>=300)){e.n=5;break}throw h=this._extractErrorMessage(p.data),new Wn(h,p.status,p.data);case 5:return e.a(2,p);case 6:throw e.p=6,d=e.v,this.onError(d);case 7:return e.a(2)}},e,this,[[3,6]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===vn(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof Wn?e:new Wn(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,c,u,l,f,p,h,d,y,m,b,g,w,v,_,E,O,R,S,T,k,P,A,j,C,N,x,U,D,L,F,B,q,I,H,M}(),dr=Cn(function e(t,n,r,o){xn(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),yr=function(){return Cn(function e(t,n,r){xn(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"with_forwarding_host",value:(t=An(_n().m(function e(t){var n;return _n().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=this._client.forwardingHost,this._client.forwardingHost=this._forwardingHost,e.p=1,e.n=2,t();case 2:return e.a(2,e.v);case 3:return e.p=3,this._client.forwardingHost=n,e.f(3);case 4:return e.a(2)}},e,this,[[1,,3,4]])})),function(e){return t.apply(this,arguments)})},{key:"wait",value:(e=An(_n().m(function e(){var t,n,r=this,o=arguments;return _n().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:Kn,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.with_forwarding_host(function(){return r._client.wait_for_async_run(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const mr=hr;export{hr as AppMeshClient,Wn as AppMeshError,dr as AppOutput,$n as AppRemovedError,yr as AppRun,cr as DEFAULT_CA_FILE,wn as RefreshTokenProvider,ln as StaticAccessTokenProvider,Jn as TransportDisconnectedError,er as _resolveGid,sr as _resolveGroupName,Qn as _resolveUid,or as _resolveUserName,mr as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appmesh",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"description": "JavaScript SDK for App Mesh (https://github.com/laoshanxi/app-mesh)",
|
|
5
5
|
"main": "./src/appmesh.js",
|
|
6
6
|
"module": "./dist/appmesh.esm.js",
|
|
@@ -60,10 +60,11 @@
|
|
|
60
60
|
"npm": ">=6.0.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"axios": "^1.8.4"
|
|
63
|
+
"axios": "^1.8.4",
|
|
64
|
+
"form-data": "^4.0.0"
|
|
64
65
|
},
|
|
65
66
|
"optionalDependencies": {
|
|
66
|
-
"msgpack-lite": "^0.
|
|
67
|
+
"msgpack-lite": "^0.2.0",
|
|
67
68
|
"uuid": "^13.0.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
package/src/appmesh.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// appmesh.js
|
|
2
2
|
import axios from 'axios';
|
|
3
|
+
import { StaticAccessTokenProvider } from './token_provider.js';
|
|
4
|
+
import { RefreshTokenProvider } from './refresh_token_provider.js';
|
|
3
5
|
|
|
4
6
|
// Lazy-resolved Node.js https/fs modules (null in browser)
|
|
5
7
|
let _https = null;
|
|
@@ -226,21 +228,93 @@ async function _resolveUid(user) {
|
|
|
226
228
|
async function _resolveGid(group) {
|
|
227
229
|
const num = parseInt(group, 10);
|
|
228
230
|
if (!isNaN(num) && String(num) === group.trim()) return num;
|
|
231
|
+
const record = await _lookupGroup('name', group);
|
|
232
|
+
return record ? record.gid : null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Read one group record from the OS directory service (Node.js/Unix only).
|
|
237
|
+
* Linux answers through getent; macOS ships no getent and is queried through its
|
|
238
|
+
* directory service instead, so both lookups need the fallback to work there.
|
|
239
|
+
* @param {'name'|'gid'} key - Field to look the group up by
|
|
240
|
+
* @param {string} value - Group name or numeric GID
|
|
241
|
+
* @returns {Promise<{name: string, gid: number}|null>} Parsed record, or null when unresolved
|
|
242
|
+
* @private
|
|
243
|
+
*/
|
|
244
|
+
async function _lookupGroup(key, value) {
|
|
229
245
|
try {
|
|
230
246
|
const { spawnSync } = await import('child_process');
|
|
231
|
-
//
|
|
232
|
-
const result = spawnSync('getent', ['group',
|
|
247
|
+
// Linux: "name:x:gid:members", accepting either a name or a numeric gid
|
|
248
|
+
const result = spawnSync('getent', ['group', String(value)], { encoding: 'utf8', timeout: 3000 });
|
|
249
|
+
if (result.status === 0 && result.stdout) {
|
|
250
|
+
const parts = result.stdout.trim().split(':');
|
|
251
|
+
const gid = parts.length >= 3 ? parseInt(parts[2], 10) : NaN;
|
|
252
|
+
return parts[0] && !isNaN(gid) ? { name: parts[0], gid } : null;
|
|
253
|
+
}
|
|
254
|
+
// macOS: "name: staff" / "gid: 20" lines, and empty output when unknown
|
|
255
|
+
const macResult = spawnSync('dscacheutil', ['-q', 'group', '-a', key, String(value)], { encoding: 'utf8', timeout: 3000 });
|
|
256
|
+
if (macResult.status !== 0 || !macResult.stdout) return null;
|
|
257
|
+
const lines = macResult.stdout.split('\n');
|
|
258
|
+
const nameLine = lines.find(entry => entry.startsWith('name:'));
|
|
259
|
+
const gidLine = lines.find(entry => entry.startsWith('gid:'));
|
|
260
|
+
if (!nameLine || !gidLine) return null;
|
|
261
|
+
const name = nameLine.slice('name:'.length).trim();
|
|
262
|
+
const gid = parseInt(gidLine.slice('gid:'.length).trim(), 10);
|
|
263
|
+
return name && !isNaN(gid) ? { name, gid } : null;
|
|
264
|
+
} catch (_) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Resolve a numeric UID to a user name (Node.js/Unix only).
|
|
271
|
+
* @param {number|string} uid - Numeric UID
|
|
272
|
+
* @returns {Promise<string|null>} User name or null if unresolvable
|
|
273
|
+
* @private
|
|
274
|
+
*/
|
|
275
|
+
async function _resolveUserName(uid) {
|
|
276
|
+
try {
|
|
277
|
+
const { spawnSync } = await import('child_process');
|
|
278
|
+
// `id -un` accepts a numeric UID on Linux and macOS; getent is Linux-only.
|
|
279
|
+
const result = spawnSync('id', ['-un', String(uid)], { encoding: 'utf8', timeout: 3000 });
|
|
233
280
|
if (result.status !== 0 || !result.stdout) return null;
|
|
234
|
-
const
|
|
235
|
-
return
|
|
281
|
+
const name = result.stdout.trim();
|
|
282
|
+
return name || null;
|
|
236
283
|
} catch (_) {
|
|
237
284
|
return null;
|
|
238
285
|
}
|
|
239
286
|
}
|
|
240
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Resolve a numeric GID to a group name (Node.js/Unix only).
|
|
290
|
+
* @param {number|string} gid - Numeric GID
|
|
291
|
+
* @returns {Promise<string|null>} Group name or null if unresolvable
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
async function _resolveGroupName(gid) {
|
|
295
|
+
const record = await _lookupGroup('gid', gid);
|
|
296
|
+
return record ? record.name : null;
|
|
297
|
+
}
|
|
298
|
+
|
|
241
299
|
// Default App Mesh CA bundle, preferred when no sslConfig is given and the file exists
|
|
242
300
|
const DEFAULT_CA_FILE = '/opt/appmesh/ssl/ca.pem';
|
|
243
301
|
|
|
302
|
+
// Only these body types can be safely replayed on a retry after a 401 response
|
|
303
|
+
function _isReplayableBody(data) {
|
|
304
|
+
return data === undefined || data === null || typeof data === 'string' ||
|
|
305
|
+
(typeof Buffer !== 'undefined' && Buffer.isBuffer(data));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Extract the bearer token a rejected request carried, so a provider's refresh
|
|
309
|
+
// can dedup concurrent 401s against the token that was actually sent
|
|
310
|
+
function _extractBearerToken(headers) {
|
|
311
|
+
if (!headers) return null;
|
|
312
|
+
const value = typeof headers.get === 'function'
|
|
313
|
+
? headers.get(CONSTANTS.HTTP_HEADER_KEY_AUTH)
|
|
314
|
+
: (headers[CONSTANTS.HTTP_HEADER_KEY_AUTH] || headers.authorization);
|
|
315
|
+
return (typeof value === 'string' && value.startsWith('Bearer ')) ? value.slice('Bearer '.length) : null;
|
|
316
|
+
}
|
|
317
|
+
|
|
244
318
|
// PEM material: Buffers/inline PEM pass through; any other string is a file path —
|
|
245
319
|
// a missing path is a hard error, never a silent no-verify fallback.
|
|
246
320
|
function _loadPem(value) {
|
|
@@ -274,6 +348,10 @@ class AppMeshClient {
|
|
|
274
348
|
* against the App Mesh default CA (/opt/appmesh/ssl/ca.pem) if installed, else the system CAs;
|
|
275
349
|
* `false` disables verification; an object supplies custom `ca`/`cert`/`key` (Buffer, inline
|
|
276
350
|
* PEM, or file path — a missing path is a hard error).
|
|
351
|
+
* @param {Object} [tokenProvider] - Optional duck-typed token provider
|
|
352
|
+
* (`{ async getAccessToken(), canRefresh(), async refreshAccessToken(rejectedToken), clear() }`,
|
|
353
|
+
* see token_provider.js). When it can refresh, a request rejected with HTTP 401 is retried
|
|
354
|
+
* once with the refreshed token.
|
|
277
355
|
* @example
|
|
278
356
|
* const sslConfig = {
|
|
279
357
|
* cert: fs.readFileSync("client.pem"),
|
|
@@ -282,16 +360,19 @@ class AppMeshClient {
|
|
|
282
360
|
* rejectUnauthorized: true
|
|
283
361
|
* };
|
|
284
362
|
*/
|
|
285
|
-
constructor(baseURL = ENV.isNode ? 'https://127.0.0.1:6060' : window.location.origin, sslConfig = null) {
|
|
363
|
+
constructor(baseURL = ENV.isNode ? 'https://127.0.0.1:6060' : window.location.origin, sslConfig = null, tokenProvider = null) {
|
|
286
364
|
// Base URL for API requests
|
|
287
365
|
this.baseURL = baseURL;
|
|
288
366
|
|
|
289
367
|
// Host to forward requests to
|
|
290
368
|
this.forwardingHost = null;
|
|
291
369
|
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
this.
|
|
370
|
+
// Token provider: single source of truth for the access token; transports
|
|
371
|
+
// read from it via _getAccessToken()
|
|
372
|
+
this._tokenProvider = null;
|
|
373
|
+
if (tokenProvider) {
|
|
374
|
+
this.set_token_provider(tokenProvider);
|
|
375
|
+
}
|
|
295
376
|
|
|
296
377
|
// Configure axios instance
|
|
297
378
|
const axiosConfig = {
|
|
@@ -317,9 +398,9 @@ class AppMeshClient {
|
|
|
317
398
|
|
|
318
399
|
// Request interceptor
|
|
319
400
|
this._client.interceptors.request.use(
|
|
320
|
-
config => {
|
|
401
|
+
async config => {
|
|
321
402
|
// Apply common headers
|
|
322
|
-
config.headers = { ...config.headers, ...this._commonHeaders() };
|
|
403
|
+
config.headers = { ...config.headers, ...(await this._commonHeaders()) };
|
|
323
404
|
return config;
|
|
324
405
|
},
|
|
325
406
|
error => {
|
|
@@ -331,7 +412,7 @@ class AppMeshClient {
|
|
|
331
412
|
|
|
332
413
|
// Response interceptor
|
|
333
414
|
this._client.interceptors.response.use(
|
|
334
|
-
response => response,
|
|
415
|
+
response => this._handleUnauthorizedRetry(response),
|
|
335
416
|
error => {
|
|
336
417
|
// Typed SDK errors (e.g. JSON parse failures from transformResponse) pass through unchanged
|
|
337
418
|
if (error instanceof AppMeshError) {
|
|
@@ -345,10 +426,26 @@ class AppMeshClient {
|
|
|
345
426
|
);
|
|
346
427
|
}
|
|
347
428
|
|
|
348
|
-
/**
|
|
429
|
+
/**
|
|
430
|
+
* Attach a refresh-capable token provider. The provider is duck-typed: it must
|
|
431
|
+
* implement `async getAccessToken()`; `canRefresh()`, `async refreshAccessToken(rejectedToken)`
|
|
432
|
+
* and `clear()` follow the contract in token_provider.js.
|
|
433
|
+
* @param {Object} provider - Token provider
|
|
434
|
+
*/
|
|
435
|
+
set_token_provider(provider) {
|
|
436
|
+
if (!provider || typeof provider.getAccessToken !== 'function') {
|
|
437
|
+
throw new TypeError('tokenProvider must implement async getAccessToken()');
|
|
438
|
+
}
|
|
439
|
+
this._tokenProvider = provider;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** Attach a caller-owned, non-refreshing access token in memory. */
|
|
349
443
|
set_bearer_token(token) {
|
|
350
|
-
|
|
351
|
-
|
|
444
|
+
if (token === null || token === undefined) {
|
|
445
|
+
this.clear_bearer_token();
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
this.set_token_provider(new StaticAccessTokenProvider(token));
|
|
352
449
|
}
|
|
353
450
|
|
|
354
451
|
/** Source-compatible alias for set_bearer_token(). */
|
|
@@ -358,17 +455,56 @@ class AppMeshClient {
|
|
|
358
455
|
|
|
359
456
|
/** Remove the locally attached bearer without contacting Engine or the authentication service. */
|
|
360
457
|
clear_bearer_token() {
|
|
361
|
-
this.
|
|
458
|
+
const provider = this._tokenProvider;
|
|
459
|
+
if (provider && typeof provider.clear === 'function') {
|
|
460
|
+
provider.clear();
|
|
461
|
+
}
|
|
462
|
+
this._tokenProvider = null;
|
|
362
463
|
}
|
|
363
464
|
|
|
364
|
-
/** Return the current in-memory access token. */
|
|
365
|
-
_getAccessToken() {
|
|
366
|
-
return this.
|
|
465
|
+
/** Return the current in-memory access token from the attached provider. */
|
|
466
|
+
async _getAccessToken() {
|
|
467
|
+
return this._tokenProvider ? await this._tokenProvider.getAccessToken() : null;
|
|
367
468
|
}
|
|
368
469
|
|
|
369
|
-
/**
|
|
370
|
-
|
|
371
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Retry a request once after a 401 when the attached provider can refresh.
|
|
472
|
+
*
|
|
473
|
+
* Only replayable bodies (undefined/string/Buffer) are retried — streaming or
|
|
474
|
+
* multipart bodies fail with the original 401. The provider's
|
|
475
|
+
* `refreshAccessToken(rejectedToken)` is called at most once per request
|
|
476
|
+
* (guarded by `config.__appmeshRetried`); a second 401 surfaces unchanged so
|
|
477
|
+
* `_request` raises the standard typed error.
|
|
478
|
+
*
|
|
479
|
+
* @private
|
|
480
|
+
* @param {Object} response - Axios response (validateStatus passes every status here)
|
|
481
|
+
* @returns {Promise<Object>} The original response or the retried response
|
|
482
|
+
*/
|
|
483
|
+
async _handleUnauthorizedRetry(response) {
|
|
484
|
+
const config = response.config || {};
|
|
485
|
+
const provider = this._tokenProvider;
|
|
486
|
+
if (response.status !== 401 || config.__appmeshRetried || !provider) {
|
|
487
|
+
return response;
|
|
488
|
+
}
|
|
489
|
+
const canRefresh = typeof provider.canRefresh === 'function' ? await provider.canRefresh() : !!provider.canRefresh;
|
|
490
|
+
if (!canRefresh || typeof provider.refreshAccessToken !== 'function' || !_isReplayableBody(config.data)) {
|
|
491
|
+
return response;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const rejectedToken = _extractBearerToken(config.headers) ?? (await this._getAccessToken());
|
|
495
|
+
const newToken = await provider.refreshAccessToken(rejectedToken);
|
|
496
|
+
if (typeof newToken !== 'string' || !newToken.trim()) {
|
|
497
|
+
return response;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
config.__appmeshRetried = true;
|
|
501
|
+
const authorization = `Bearer ${newToken.trim()}`;
|
|
502
|
+
if (config.headers && typeof config.headers.set === 'function') {
|
|
503
|
+
config.headers.set(CONSTANTS.HTTP_HEADER_KEY_AUTH, authorization);
|
|
504
|
+
} else {
|
|
505
|
+
config.headers = { ...config.headers, [CONSTANTS.HTTP_HEADER_KEY_AUTH]: authorization };
|
|
506
|
+
}
|
|
507
|
+
return this._client(config);
|
|
372
508
|
}
|
|
373
509
|
|
|
374
510
|
/** Return Engine's public OAuth/OIDC configuration. */
|
|
@@ -712,11 +848,18 @@ class AppMeshClient {
|
|
|
712
848
|
* Upload a file to the remote server.
|
|
713
849
|
* @param {string|File} localFile - Local file path/object
|
|
714
850
|
* @param {string} [filePath=null] - Remote target path; defaults to the basename of localFile
|
|
715
|
-
* @param {boolean} [applyAttrs=false] - In Node.js, send local permission bits
|
|
716
|
-
*
|
|
851
|
+
* @param {boolean} [applyAttrs=false] - In Node.js, send local permission bits plus
|
|
852
|
+
* user/group (names when resolvable locally, numeric ids otherwise)
|
|
717
853
|
*/
|
|
718
854
|
async upload_file(localFile, filePath = null, applyAttrs = false) {
|
|
719
|
-
if (!filePath)
|
|
855
|
+
if (!filePath) {
|
|
856
|
+
// Node.js passes a path string; browser passes a File (use its name)
|
|
857
|
+
const sourceName = typeof localFile === 'string' ? localFile : localFile && localFile.name;
|
|
858
|
+
if (!sourceName) {
|
|
859
|
+
throw new AppMeshError('filePath is required when localFile is a Blob without a name');
|
|
860
|
+
}
|
|
861
|
+
filePath = sourceName.split(/[\\/]/).pop();
|
|
862
|
+
}
|
|
720
863
|
const headers = { [CONSTANTS.HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath) };
|
|
721
864
|
let formData;
|
|
722
865
|
|
|
@@ -742,9 +885,13 @@ class AppMeshClient {
|
|
|
742
885
|
// Add file attributes
|
|
743
886
|
if (applyAttrs) {
|
|
744
887
|
headers["X-File-Mode"] = (stat.mode & 0o777).toString(); // Only permission bits
|
|
745
|
-
//
|
|
746
|
-
//
|
|
747
|
-
//
|
|
888
|
+
// Send user/group names when resolvable; the daemon also accepts
|
|
889
|
+
// all-digit values (os::chown -> getUidByName numeric fallback, and
|
|
890
|
+
// the Go agent's ApplyFileAttributes), so fall back to numeric ids.
|
|
891
|
+
const username = await _resolveUserName(stat.uid);
|
|
892
|
+
const groupName = await _resolveGroupName(stat.gid);
|
|
893
|
+
headers["X-File-User"] = username || String(stat.uid);
|
|
894
|
+
headers["X-File-Group"] = groupName || String(stat.gid);
|
|
748
895
|
}
|
|
749
896
|
|
|
750
897
|
// Add form-data headers
|
|
@@ -963,16 +1110,16 @@ class AppMeshClient {
|
|
|
963
1110
|
/**
|
|
964
1111
|
* Generate common request headers
|
|
965
1112
|
* @private
|
|
966
|
-
* @returns {Object} Headers object
|
|
1113
|
+
* @returns {Promise<Object>} Headers object
|
|
967
1114
|
*/
|
|
968
|
-
_commonHeaders() {
|
|
1115
|
+
async _commonHeaders() {
|
|
969
1116
|
const headers = {};
|
|
970
1117
|
// Add user agent in Node.js
|
|
971
1118
|
if (ENV.isNode) {
|
|
972
1119
|
headers[CONSTANTS.HTTP_USER_AGENT_HEADER_NAME] = CONSTANTS.HTTP_USER_AGENT;
|
|
973
1120
|
}
|
|
974
1121
|
|
|
975
|
-
const token = this._getAccessToken();
|
|
1122
|
+
const token = await this._getAccessToken();
|
|
976
1123
|
if (token) {
|
|
977
1124
|
headers[CONSTANTS.HTTP_HEADER_KEY_AUTH] = `Bearer ${token}`;
|
|
978
1125
|
}
|
|
@@ -1086,13 +1233,14 @@ class AppMeshClient {
|
|
|
1086
1233
|
}
|
|
1087
1234
|
|
|
1088
1235
|
/**
|
|
1089
|
-
* Comprehensive error handler for all client errors
|
|
1236
|
+
* Comprehensive error handler for all client errors.
|
|
1237
|
+
* The default implementation only normalizes the error type; override this
|
|
1238
|
+
* method to add logging or user-facing reporting.
|
|
1090
1239
|
* @protected
|
|
1091
1240
|
* @param {Error} error - The caught error
|
|
1092
1241
|
* @returns {AppMeshError} Standardized AppMeshError
|
|
1093
1242
|
*/
|
|
1094
1243
|
onError(error) {
|
|
1095
|
-
console.log("AppMeshClient error:", error);
|
|
1096
1244
|
return error instanceof AppMeshError ? error : new AppMeshError(error.message || 'Unknown error');
|
|
1097
1245
|
}
|
|
1098
1246
|
}
|
|
@@ -1173,5 +1321,7 @@ class AppRun {
|
|
|
1173
1321
|
}
|
|
1174
1322
|
|
|
1175
1323
|
// Export the main classes
|
|
1176
|
-
export { AppMeshClient, AppOutput, AppRun, AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE };
|
|
1324
|
+
export { AppMeshClient, AppOutput, AppRun, AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE, StaticAccessTokenProvider, RefreshTokenProvider };
|
|
1325
|
+
// Exported for the TCP client (Node.js only); not part of the browser-facing API
|
|
1326
|
+
export { _resolveUid, _resolveGid, _resolveUserName, _resolveGroupName };
|
|
1177
1327
|
export default AppMeshClient;
|
package/src/appmesh_tcp.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
import tls from 'tls'
|
|
5
5
|
import fs from 'fs'
|
|
6
6
|
import os from 'os'
|
|
7
|
+
import { once } from 'events'
|
|
7
8
|
import { v1 as uuidv1 } from 'uuid'
|
|
8
9
|
import msgpack from 'msgpack-lite'
|
|
9
|
-
import AppMeshClient, { AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE } from './appmesh.js'
|
|
10
|
+
import AppMeshClient, { AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE, _resolveUid, _resolveGid, _resolveUserName, _resolveGroupName } from './appmesh.js'
|
|
10
11
|
|
|
11
12
|
// Constants
|
|
12
13
|
const TCP_BLOCK_SIZE = 16 * 1024 - 128 // TLS-optimized chunk size
|
|
@@ -334,9 +335,6 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
334
335
|
// Pass dummy baseURL to parent - not used for TCP communication
|
|
335
336
|
super('https://127.0.0.1:6060', sslConfig)
|
|
336
337
|
this.tcpTransport = new TCPTransport(tcpAddress, sslConfig)
|
|
337
|
-
|
|
338
|
-
// Store the caller-owned bearer explicitly for TCP requests.
|
|
339
|
-
this._token = ''
|
|
340
338
|
}
|
|
341
339
|
|
|
342
340
|
/**
|
|
@@ -353,28 +351,6 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
353
351
|
}
|
|
354
352
|
}
|
|
355
353
|
|
|
356
|
-
/**
|
|
357
|
-
* Get the current access token.
|
|
358
|
-
* @returns {string} Current JWT token
|
|
359
|
-
* @private
|
|
360
|
-
* @override
|
|
361
|
-
*/
|
|
362
|
-
_getAccessToken () {
|
|
363
|
-
return this._token
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Handle caller-owned bearer updates for TCP.
|
|
368
|
-
*
|
|
369
|
-
* @param {string} token - New JWT token
|
|
370
|
-
* @private
|
|
371
|
-
* @override
|
|
372
|
-
*/
|
|
373
|
-
_handleTokenUpdate (token) {
|
|
374
|
-
super._handleTokenUpdate(token)
|
|
375
|
-
this._token = token || ''
|
|
376
|
-
}
|
|
377
|
-
|
|
378
354
|
/**
|
|
379
355
|
* Send an App Mesh request over TCP transport and normalize the response shape.
|
|
380
356
|
* @private
|
|
@@ -396,7 +372,7 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
396
372
|
request.headers[HTTP_HEADER_KEY_USER_AGENT] = HTTP_USER_AGENT_TCP
|
|
397
373
|
|
|
398
374
|
// Add authentication token if available
|
|
399
|
-
const token = this._getAccessToken()
|
|
375
|
+
const token = await this._getAccessToken()
|
|
400
376
|
if (token) {
|
|
401
377
|
request.headers[HTTP_HEADER_KEY_AUTH] = `Bearer ${token}`
|
|
402
378
|
}
|
|
@@ -468,6 +444,21 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
468
444
|
config: options
|
|
469
445
|
}
|
|
470
446
|
|
|
447
|
+
// Mirror the HTTP transport: one refresh-and-retry after a 401 when the
|
|
448
|
+
// attached provider can refresh. TCP bodies are serialized Buffers built
|
|
449
|
+
// from the caller's body, so every request is replayable here.
|
|
450
|
+
if (result.status === 401 && !options.__appmeshRetried) {
|
|
451
|
+
const provider = this._tokenProvider
|
|
452
|
+
const canRefresh = provider &&
|
|
453
|
+
(typeof provider.canRefresh === 'function' ? await provider.canRefresh() : !!provider.canRefresh)
|
|
454
|
+
if (canRefresh && typeof provider.refreshAccessToken === 'function') {
|
|
455
|
+
const newToken = await provider.refreshAccessToken(token || null)
|
|
456
|
+
if (typeof newToken === 'string' && newToken.trim()) {
|
|
457
|
+
return this._request(method, path, body, { ...options, __appmeshRetried: true })
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
471
462
|
// Mirror the HTTP transport: never swallow a non-2xx into a success value.
|
|
472
463
|
if (result.status < 200 || result.status >= 300) {
|
|
473
464
|
const errMsg = this._extractErrorMessage(result.data)
|
|
@@ -577,7 +568,10 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
577
568
|
if (!chunk || chunk.length === 0) {
|
|
578
569
|
break
|
|
579
570
|
}
|
|
580
|
-
|
|
571
|
+
// Honor stream backpressure so large downloads do not buffer in memory
|
|
572
|
+
if (!writeStream.write(chunk)) {
|
|
573
|
+
await once(writeStream, 'drain')
|
|
574
|
+
}
|
|
581
575
|
}
|
|
582
576
|
} finally {
|
|
583
577
|
// Await the flush so the file is complete on disk before this resolves.
|
|
@@ -595,16 +589,18 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
595
589
|
fs.chmodSync(localFile, parseInt(response.headers['X-File-Mode'], 10))
|
|
596
590
|
}
|
|
597
591
|
if (response.headers['X-File-User'] && response.headers['X-File-Group']) {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
592
|
+
// The daemon sends user/group *names* (os::fileStat); resolve them to
|
|
593
|
+
// numeric uid/gid locally before chown, same as the HTTP transport.
|
|
594
|
+
const uid = await _resolveUid(response.headers['X-File-User'])
|
|
595
|
+
const gid = await _resolveGid(response.headers['X-File-Group'])
|
|
596
|
+
if (uid !== null && gid !== null) {
|
|
597
|
+
try {
|
|
598
|
+
fs.chownSync(localFile, uid, gid)
|
|
599
|
+
} catch (err) {
|
|
600
|
+
console.warn(
|
|
601
|
+
`Warning: Unable to change owner/group of ${localFile}. Operation requires elevated privileges.`
|
|
602
|
+
)
|
|
603
|
+
}
|
|
608
604
|
}
|
|
609
605
|
}
|
|
610
606
|
}
|
|
@@ -615,8 +611,8 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
615
611
|
*
|
|
616
612
|
* @param {string} localFile - Local file path
|
|
617
613
|
* @param {string} [filePath=null] - Remote destination path; defaults to the basename of localFile
|
|
618
|
-
* @param {boolean} [applyAttrs=false] - Send local mode
|
|
619
|
-
* recreate permissions and ownership when supported
|
|
614
|
+
* @param {boolean} [applyAttrs=false] - Send local mode and best-effort user/group name
|
|
615
|
+
* metadata so the server can recreate permissions and ownership when supported
|
|
620
616
|
* @override
|
|
621
617
|
*/
|
|
622
618
|
async upload_file (localFile, filePath = null, applyAttrs = false) {
|
|
@@ -635,8 +631,13 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
635
631
|
if (applyAttrs) {
|
|
636
632
|
const stats = fs.statSync(localFile)
|
|
637
633
|
headers['X-File-Mode'] = (stats.mode & 0o777).toString()
|
|
638
|
-
|
|
639
|
-
|
|
634
|
+
// Send user/group names when resolvable; the daemon also accepts
|
|
635
|
+
// all-digit values (Utility::applyFilePermission -> os::chown ->
|
|
636
|
+
// getUidByName numeric fallback), so fall back to numeric ids.
|
|
637
|
+
const username = await _resolveUserName(stats.uid)
|
|
638
|
+
const groupName = await _resolveGroupName(stats.gid)
|
|
639
|
+
headers['X-File-User'] = username || String(stats.uid)
|
|
640
|
+
headers['X-File-Group'] = groupName || String(stats.gid)
|
|
640
641
|
}
|
|
641
642
|
|
|
642
643
|
const response = await this._request('post', '/appmesh/file/upload', null, {
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// refresh_token_provider.js
|
|
2
|
+
//
|
|
3
|
+
// Built-in OAuth2 refresh-token provider for App Mesh SDK clients.
|
|
4
|
+
//
|
|
5
|
+
// The caller hands the provider an access_token + refresh_token pair (e.g. from
|
|
6
|
+
// an earlier `appmesh-cli login`) and the provider keeps the access token fresh:
|
|
7
|
+
// it refreshes proactively before expiry and reactively when Engine rejects a
|
|
8
|
+
// token with HTTP 401. Implements the duck-typed provider contract documented
|
|
9
|
+
// in token_provider.js.
|
|
10
|
+
|
|
11
|
+
import axios from 'axios';
|
|
12
|
+
|
|
13
|
+
const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '::1', '[::1]']);
|
|
14
|
+
const MIN_REFRESH_MARGIN_MS = 30000;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Validate the token endpoint URL: https is always allowed; http is allowed
|
|
18
|
+
* only for loopback hosts (local development and tests).
|
|
19
|
+
* @param {string} tokenUrl - Token endpoint URL
|
|
20
|
+
* @returns {string} The validated URL
|
|
21
|
+
* @throws {TypeError} If the URL is invalid or uses insecure transport
|
|
22
|
+
*/
|
|
23
|
+
function validateTokenUrl(tokenUrl) {
|
|
24
|
+
let url;
|
|
25
|
+
try {
|
|
26
|
+
url = new URL(tokenUrl);
|
|
27
|
+
} catch (_) {
|
|
28
|
+
throw new TypeError('tokenUrl must be a valid URL');
|
|
29
|
+
}
|
|
30
|
+
if (url.protocol === 'https:') {
|
|
31
|
+
return tokenUrl;
|
|
32
|
+
}
|
|
33
|
+
if (url.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
|
|
34
|
+
return tokenUrl;
|
|
35
|
+
}
|
|
36
|
+
throw new TypeError('tokenUrl must use https, or http only for loopback hosts (127.0.0.1, localhost, ::1)');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Token provider that owns an access_token + refresh_token pair and refreshes
|
|
41
|
+
* the access token through the OAuth2 refresh_token grant.
|
|
42
|
+
*/
|
|
43
|
+
class RefreshTokenProvider {
|
|
44
|
+
/**
|
|
45
|
+
* @param {Object} options
|
|
46
|
+
* @param {string} options.tokenUrl - Token endpoint URL (https, or http on loopback only)
|
|
47
|
+
* @param {string} [options.clientId='appmesh-cli'] - OAuth2 client id sent with the grant
|
|
48
|
+
* @param {string} [options.accessToken] - Current access token
|
|
49
|
+
* @param {string} [options.refreshToken] - Refresh token used to obtain new access tokens
|
|
50
|
+
* @param {number} [options.expiresIn=0] - Access token lifetime in seconds; 0/unknown means refresh only on 401
|
|
51
|
+
* @param {Object} [options.httpClient] - Axios instance override (TLS configuration, tests)
|
|
52
|
+
* @throws {TypeError} If tokenUrl is not https and not a loopback http URL
|
|
53
|
+
*/
|
|
54
|
+
constructor({ tokenUrl, clientId = 'appmesh-cli', accessToken, refreshToken, expiresIn = 0, httpClient } = {}) {
|
|
55
|
+
this._tokenUrl = validateTokenUrl(tokenUrl);
|
|
56
|
+
this._clientId = clientId;
|
|
57
|
+
this._accessToken = accessToken || null;
|
|
58
|
+
this._refreshToken = refreshToken || null;
|
|
59
|
+
this._http = httpClient || axios.create({ timeout: 30000 });
|
|
60
|
+
this._inflightRefresh = null;
|
|
61
|
+
this._expiresAtMs = 0;
|
|
62
|
+
this._lifetimeMs = 0;
|
|
63
|
+
this._setExpiry(expiresIn);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Return the current access token, refreshing it first when none is stored
|
|
68
|
+
* or it is inside the expiry margin (max of 30s and 10% of the token
|
|
69
|
+
* lifetime). Concurrent refreshes are serialized through a shared in-flight
|
|
70
|
+
* promise.
|
|
71
|
+
* @returns {Promise<string|null>} The current access token
|
|
72
|
+
* @throws {Error} If the provider holds neither an access token nor a refresh token
|
|
73
|
+
*/
|
|
74
|
+
async getAccessToken() {
|
|
75
|
+
if ((this._accessToken === null && this._refreshToken) || this._isExpiringSoon()) {
|
|
76
|
+
await this._refresh();
|
|
77
|
+
}
|
|
78
|
+
if (this._accessToken === null && !this._refreshToken) {
|
|
79
|
+
throw new Error('no access token available: the provider holds no credentials');
|
|
80
|
+
}
|
|
81
|
+
return this._accessToken;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** A refresh is possible while a refresh token is stored. */
|
|
85
|
+
canRefresh() {
|
|
86
|
+
return !!this._refreshToken;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Refresh after Engine rejected a token with HTTP 401. If `rejectedToken`
|
|
91
|
+
* does not match the current access token, a racing caller already refreshed
|
|
92
|
+
* and the current token is returned without a new grant.
|
|
93
|
+
* @param {string|null} rejectedToken - The access token Engine rejected
|
|
94
|
+
* @returns {Promise<string|null>} The (possibly refreshed) access token
|
|
95
|
+
*/
|
|
96
|
+
async refreshAccessToken(rejectedToken) {
|
|
97
|
+
if (rejectedToken && rejectedToken !== this._accessToken) {
|
|
98
|
+
return this._accessToken;
|
|
99
|
+
}
|
|
100
|
+
await this._refresh();
|
|
101
|
+
return this._accessToken;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Forget both tokens; canRefresh() reports false afterwards. */
|
|
105
|
+
clear() {
|
|
106
|
+
this._accessToken = null;
|
|
107
|
+
this._refreshToken = null;
|
|
108
|
+
this._expiresAtMs = 0;
|
|
109
|
+
this._lifetimeMs = 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_setExpiry(expiresIn) {
|
|
113
|
+
const seconds = Number(expiresIn);
|
|
114
|
+
if (Number.isFinite(seconds) && seconds > 0) {
|
|
115
|
+
this._lifetimeMs = seconds * 1000;
|
|
116
|
+
this._expiresAtMs = Date.now() + this._lifetimeMs;
|
|
117
|
+
} else {
|
|
118
|
+
this._lifetimeMs = 0;
|
|
119
|
+
this._expiresAtMs = 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_isExpiringSoon() {
|
|
124
|
+
if (!this._expiresAtMs || !this._refreshToken) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const margin = Math.max(MIN_REFRESH_MARGIN_MS, this._lifetimeMs * 0.1);
|
|
128
|
+
return Date.now() >= this._expiresAtMs - margin;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Single-flight refresh: the first caller starts the grant, concurrent
|
|
133
|
+
* callers join the same in-flight promise.
|
|
134
|
+
*/
|
|
135
|
+
async _refresh() {
|
|
136
|
+
if (!this._inflightRefresh) {
|
|
137
|
+
this._inflightRefresh = this._performRefresh().finally(() => {
|
|
138
|
+
this._inflightRefresh = null;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return this._inflightRefresh;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async _performRefresh() {
|
|
145
|
+
if (!this._refreshToken) {
|
|
146
|
+
throw new Error('cannot refresh: no refresh token available');
|
|
147
|
+
}
|
|
148
|
+
const body = new URLSearchParams({
|
|
149
|
+
grant_type: 'refresh_token',
|
|
150
|
+
refresh_token: this._refreshToken,
|
|
151
|
+
client_id: this._clientId
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
let response;
|
|
155
|
+
try {
|
|
156
|
+
response = await this._http.post(this._tokenUrl, body.toString(), {
|
|
157
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
158
|
+
validateStatus: () => true
|
|
159
|
+
});
|
|
160
|
+
} catch (error) {
|
|
161
|
+
// Network-level failure: keep the stored tokens so a later call can retry.
|
|
162
|
+
throw new Error(`token refresh request failed: ${error.message || 'unknown error'}`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const status = response.status;
|
|
166
|
+
const data = response.data && typeof response.data === 'object' ? response.data : {};
|
|
167
|
+
if (data.error === 'invalid_grant') {
|
|
168
|
+
// The refresh token is dead (revoked, expired, reused): drop both tokens.
|
|
169
|
+
this.clear();
|
|
170
|
+
throw new Error('token refresh rejected by the server (invalid_grant)');
|
|
171
|
+
}
|
|
172
|
+
if (status < 200 || status >= 300 || data.error) {
|
|
173
|
+
throw new Error(`token refresh failed with status ${status}${data.error ? `: ${data.error}` : ''}`);
|
|
174
|
+
}
|
|
175
|
+
if (typeof data.access_token !== 'string' || !data.access_token) {
|
|
176
|
+
throw new Error('token refresh response did not include an access_token');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this._accessToken = data.access_token;
|
|
180
|
+
// Rotate the refresh token only when the server issues a new one; servers
|
|
181
|
+
// with a reuse interval (e.g. Dex) omit it and the old one stays valid.
|
|
182
|
+
if (typeof data.refresh_token === 'string' && data.refresh_token) {
|
|
183
|
+
this._refreshToken = data.refresh_token;
|
|
184
|
+
}
|
|
185
|
+
this._setExpiry(data.expires_in);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { RefreshTokenProvider };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// token_provider.js
|
|
2
|
+
//
|
|
3
|
+
// Access-token provider contract for App Mesh SDK clients.
|
|
4
|
+
//
|
|
5
|
+
// Providers own token acquisition and refresh. Engine clients consume only the
|
|
6
|
+
// resulting access token and never receive passwords, refresh tokens, or OAuth
|
|
7
|
+
// authorization responses.
|
|
8
|
+
//
|
|
9
|
+
// A provider is duck-typed (no base class required):
|
|
10
|
+
// {
|
|
11
|
+
// async getAccessToken() -> string|null // current access token
|
|
12
|
+
// canRefresh() -> boolean // optional, default false
|
|
13
|
+
// async refreshAccessToken(rejected) -> string|null // called at most once per 401
|
|
14
|
+
// clear() -> void // optional
|
|
15
|
+
// }
|
|
16
|
+
//
|
|
17
|
+
// `refreshAccessToken(rejectedToken)` is called at most once after Engine rejects
|
|
18
|
+
// a provider-managed token with HTTP 401. Implementations should use
|
|
19
|
+
// `rejectedToken` to avoid duplicate refreshes when requests race.
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* In-memory provider for a caller-supplied access token. Cannot refresh.
|
|
23
|
+
*/
|
|
24
|
+
class StaticAccessTokenProvider {
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} token - Non-empty access token
|
|
27
|
+
* @throws {TypeError} If the token is not a non-empty string
|
|
28
|
+
*/
|
|
29
|
+
constructor(token) {
|
|
30
|
+
this._token = StaticAccessTokenProvider._validate(token);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static _validate(token) {
|
|
34
|
+
if (typeof token !== 'string' || !token.trim()) {
|
|
35
|
+
throw new TypeError('bearer token must be a non-empty string');
|
|
36
|
+
}
|
|
37
|
+
return token.trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Return the current access token. */
|
|
41
|
+
async getAccessToken() {
|
|
42
|
+
return this._token;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A static token cannot replace a rejected or expiring token. */
|
|
46
|
+
canRefresh() {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Forget the in-memory token. */
|
|
51
|
+
clear() {
|
|
52
|
+
this._token = null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { StaticAccessTokenProvider };
|