appmesh 3.1.19 → 3.1.20
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 +30 -0
- package/dist/appmesh.esm.js +1 -1
- package/package.json +2 -2
- package/src/appmesh.js +185 -7
- package/src/appmesh_tcp.js +76 -20
package/README.md
CHANGED
|
@@ -27,6 +27,36 @@ const client = new AppMeshClient();
|
|
|
27
27
|
client.setBearerToken(process.env.APPMESH_BEARER_TOKEN);
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
#### Run an app synchronously
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// Resolves to the exit code (null when the daemon sent none); the stdout handler
|
|
34
|
+
// receives the complete output in one call.
|
|
35
|
+
const exitCode = await client.runAppSync({ command: "cat big.log", shell: true }, (output) => process.stdout.write(output));
|
|
36
|
+
// Optional 5th parameter: reject instead of returning when the output grows past a byte ceiling.
|
|
37
|
+
await client.runAppSync(app, (output) => process.stdout.write(output), 30, 60, 10 * 1024 * 1024);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
One `runAppSync` reply carries at most 5 MiB of output. When the output fills a page,
|
|
41
|
+
the SDK pages the rest from the daemon (in raw bytes, decoded once in the charset of the
|
|
42
|
+
first reply) and only then calls the stdout handler, so the complete output is always
|
|
43
|
+
delivered. The same applies to `AppMeshClientTCP`. When the output grows past
|
|
44
|
+
`maxOutputBytes` the call rejects with `AppMeshRequestError` (the message names the run
|
|
45
|
+
instance that keeps the remaining output readable for 600 seconds) instead of returning a
|
|
46
|
+
partial result; the instance is left in place for the daemon to clean up.
|
|
47
|
+
|
|
48
|
+
#### Forwarding and streaming in a cluster
|
|
49
|
+
|
|
50
|
+
`client.forwardingHost` (the `X-Target-Host` header) applies to every call, the streaming
|
|
51
|
+
ones included (`runTaskStream`, `followOutput`, `streamRun`): the task runs on the target
|
|
52
|
+
node and its stream is served from there, and a target the gateway cannot reach rejects
|
|
53
|
+
the call with 502 like any other forwarded request. `AppMeshClientTCP` streams over a
|
|
54
|
+
direct HTTPS side channel: a forwarded stream on it dials the agent REST listener on the
|
|
55
|
+
same host (`agentPort`, default 6060), because the engine listener itself answers a
|
|
56
|
+
forwarded stream with 400. An `AppMeshClient` whose base URL points at the engine listener
|
|
57
|
+
(default port 6063) therefore cannot forward a stream: the call rejects with a 400 whose
|
|
58
|
+
message says so; use the agent REST listener (default port 6060) as the base URL.
|
|
59
|
+
|
|
30
60
|
#### Browser (VUE Example)
|
|
31
61
|
|
|
32
62
|
```js
|
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=Object.create(null);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.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),582:()=>import("./582.appmesh.esm.js"),770:()=>import("./770.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,u=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);u<r.length;u++)a=r[u],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{const n=Promise.race([e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e}),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:()=>Me,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>He,origin:()=>Xe});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({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(c(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,v=m("undefined");function g(e){return null!==e&&!v(e)&&null!==e.constructor&&!v(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w=y("ArrayBuffer");const _=m("string"),E=m("function"),O=m("number"),S=e=>null!==e&&"object"==typeof e,k=e=>{if(!S(e))return!1;const t=s(e);return(null===t||t===Object.prototype||null===s(t))&&(f(e,t,!0)||!c(e,u)&&!c(e,a))},R=y("Date"),T=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,U=y("URLSearchParams"),[x,D,L,F]=["ReadableStream","Request","Response","Headers"].map(y);function I(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(g(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)}}const B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=e=>!v(e)&&e!==B;const H=(M="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>M&&e instanceof M);var M;const z=y("HTMLFormElement"),{propertyIsEnumerable:X}=Object.prototype,W=y("RegExp"),K=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};I(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const G=y("AsyncFunction"),$=(J="function"==typeof setImmediate,Y=E(B.postMessage),J?setImmediate:Y?(V=`axios@${Math.random()}`,Q=[],B.addEventListener("message",({source:e,data:t})=>{e===B&&t===V&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),B.postMessage(V,"*")}):e=>setTimeout(e));var J,Y,V,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(B):"undefined"!=typeof process&&process.nextTick||$,ee=e=>null!=e&&E(e[a]),te={isArray:b,isArrayBuffer:w,isBuffer:g,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&&w(e.buffer),t},isString:_,isNumber:O,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:k,isEmptyObject:e=>{if(!S(e)||g(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:v,isDate:R,isFile:T,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:P,isRegExp:W,isFunction:E,isStream:e=>S(e)&&E(e.pipe),isURLSearchParams:U,isTypedArray:H,isFileList:A,forEach:I,merge:function e(...t){const{caseless:n,skipUndefined:r}=q(this)&&this||{},o={},i=n?Object.create(null):null,s=(t,n)=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;let s=n;if(i&&"string"==typeof n){const e=n.toLowerCase(),t=i[e];void 0!==t&&c(o,t)?s=t:i[e]=n}const a=c(o,s)?o[s]:void 0;k(a)&&k(t)?o[s]=e(a,t):k(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&v(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||g(n))continue;if(I(n,s),"object"!=typeof n||b(n)||!Object.getOwnPropertySymbols)continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];X.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(I(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 u={};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)||u[a]||(t[a]=e[a],u[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(!Number.isSafeInteger(t)||t<0||t>4294967295)return null;const n=new Set,r=new Set;let o=e;for(;null!=o&&n.size<t;){if(r.has(o))return null;r.add(o);const i=s(o);if(f(o,i,o===e))break;Object.getOwnPropertyNames(o).forEach(e=>{const r=+e;Number.isInteger(r)&&r>=0&&r<t&&String(r)===e&&c(o,e)&&n.add(r)}),o=i}if(n.size!==t)return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},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:z,hasOwnProperty:c,hasOwnProp:c,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 u=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&u.push(...Object.getOwnPropertySymbols(i));for(const t of u)l(t)||c(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:K,freezeMethods:e=>{K(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:function(e,t){if(g(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},global:B,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(g(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);!v(e)&&r.push(e)}}else r=b(e)?[]:{},I(e,(e,t)=>{const o=n(e);!v(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:G,isThenable:e=>e&&(S(e)||E(e))&&E(e.then)&&E(e.catch),setImmediate:$,asap:Z,isIterable:ee,isSafeIterable:e=>null!=e&&p(e,a)&&ee(e)},ne=te.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 re=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),oe=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ie(e,t){return te.isArray(e)?e.map(e=>ie(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 se(e){const t=Object.create(null);return te.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>ie(e,oe))(e)}),t}const ae=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:te.isArray(e)?e.map(ce):(e=>ie(e,re))(String(e))}const le=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function fe(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)}const pe=e=>"__proto__"===e?"__Proto__":e;function he(e,t,n,r,o){return te.isFunction(r)?r.call(e,t,n):(o&&(t=n),te.isString(t)?te.isString(r)?-1!==t.indexOf(r):te.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=te.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[pe(i||t)]=ce(e))}const i=(e,t)=>te.forEach(e,(e,n)=>o(e,n,t));if(te.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(te.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t=Object.create(null);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=te.hasOwnProp(t,n);!n||i&&te.hasOwnProp(ne,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(te.isObject(e)&&te.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!te.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],te.hasOwnProp(o,r)?(n=o[r],o[r]=te.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=te.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(te.isFunction(t))return t.call(this,e,n);if(te.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=te.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(this,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=te.findKey(n,e);!o||t&&!he(n,n[o],o,t)||(delete n[o],r=!0)}}return te.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(this,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n=Object.create(null);return te.forEach(this,(r,o)=>{const i=te.findKey(n,o);if(i)return t[i]=ce(r),void delete t[o];const s=pe(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]=ce(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return te.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&te.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 te.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=fe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=fe(o.slice(0,i));if(!le.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const u=fe(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}(u)}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[ae]=this[ae]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=te.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 te.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),te.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(te.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ye&&(e=e.toJSON()),r.push(e),te.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);te.isUndefined(r)||(t[n]=r)});else{if(!te.isPlainObject(e)&&function(e){if(te.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(te.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);te.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function ve(e){try{return String(e)}catch(e){return""}}const ge=Symbol("causeStack");class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&te.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?ve(e.message):ve(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,function(e,t){try{const n=t&&t.stack;if("string"!=typeof n||!n)return;const r=e.stack;if("string"!=typeof r||!r)return;const o="\nCaused by: "+n;e.stack=r+o,Object.defineProperty(e,ge,{__proto__:null,value:o})}catch(e){}}(a,e),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&&te.hasOwnProp(e,"redact")?e.redact:void 0,n=te.isArray(t)&&t.length>0?be(e,t):te.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 _e=we;function Ee(e){return te.isPlainObject(e)||te.isArray(e)}function Oe(e){return te.endsWith(e,"[]")?e.slice(0,-2):e}function Se(e,t,n){return e?e.concat(t).map(function(e,t){return e=Oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ke=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Re=function(e,t,n){if(!te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=te.getSafeProp(n,e);return te.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||d,s=r("dots",!1),a=r("indexes",!1),u=r("Blob")||"undefined"!=typeof Blob&&Blob,c=r("maxDepth",100),l=u&&te.isSpecCompliantForm(t),f=[];if(!te.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(te.isDate(e))return e.toISOString();if(te.isBoolean(e))return e.toString();if(!l&&te.isBlob(e))throw new _e("Blob is not supported. Use a Buffer instead.");if(te.isArrayBuffer(e)||te.isTypedArray(e)){if(l&&"function"==typeof u)return new u([e]);throw new _e("Blob is not supported. Use a Buffer instead.",_e.ERR_NOT_SUPPORT)}return e}function h(e){if(e>c)throw new _e("Object is too deeply nested ("+e+" levels). Max depth: "+c,_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function d(e,n,r){let i=e;if(te.isReactNative(t)&&te.isReactNativeBlob(e))return t.append(Se(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(te.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(c===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!te.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(te.isArray(e)&&function(e){return te.isArray(e)&&!e.some(Ee)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Oe(n),i.forEach(function(e,r){!te.isUndefined(e)&&null!==e&&t.append(!0===a?Se([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!Ee(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(ke,{defaultVisitor:d,convertValue:p,isVisitable:Ee});if(!te.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!te.isUndefined(n)){if(h(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),te.forEach(n,function(n,s){!0===(!(te.isUndefined(n)||null===n)&&i.call(t,n,te.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 Pe(e,t){this._pairs=[],e&&Re(e,this,t)}const Ae=Pe.prototype;Ae.append=function(e,t){this._pairs.push([e,t])},Ae.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 je=Pe;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ne(e,t,n){if(!t)return e;e=e||"";const r=te.isFunction(n)?{serialize:n}:n,o=te.getSafeProp(r,"encode")||Ce,i=te.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):te.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 Ue=Symbol("internals");function xe(e){return e?e.length:0}function De(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Le(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 Fe=class{constructor(){this.handlers=[],this[Ue]={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[Ue];null==this.handlers&&(this.handlers=[]),Le(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[Ue];Le(this,t);const n=function(e){return"string"==typeof e&&""!==e&&String(Number(e))===e?Number(e):e}(e),r=t.handlerEntries.get(n);if(r){if(t.handlerEntries.delete(n),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,t.iterationDepth||(De(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Le(this,this[Ue]))}forEach(e){const t=this[Ue];Le(this,t),t.iterationDepth++;try{te.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Le(this,t),De(this.handlers),t.handlersLength=xe(this.handlers))}}},Ie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0,encodeBasicAuthUsername:!1},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,He="object"==typeof navigator&&navigator||void 0,Me=qe&&(!He||["ReactNative","NativeScript","NS"].indexOf(He.product)<0),ze="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Xe=qe&&window.location.href||"http://localhost",We={...r,...Be};function Ke(e){if(e>100)throw new _e("FormData field is too deeply nested ("+e+" levels). Max depth: 100",_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ge(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}function $e(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Ge(e):e}const Je=function(e){function t(e,n,r,o){Ke(o);let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&te.isArray(r)?r.length:i,a)return te.hasOwnProp(r,i)?(r[i]=$e(r[i]),r[i]=te.isArray(r[i])?r[i].concat(n):[r[i],n]):r[i]=n,!s;te.hasOwnProp(r,i)&&te.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&te.isArray(r[i])&&(r[i]=Ge(r[i])),!s}if(te.isFormData(e)&&te.isFunction(e.entries)){const n={};return te.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)Ke(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),function(e){const t=[e];for(;t.length;){const e=t.pop();Object.keys(e).forEach(n=>{const r=e[n]=$e(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Ye=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ve=(e,t)=>null!=e&&te.hasOwnProp(e,t)?e[t]:void 0;const Qe={transitional:Ie,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=te.isObject(e);o&&te.isHTMLForm(e)&&(e=new FormData(e));if(te.isFormData(e))return r?JSON.stringify(Je(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ve(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Re(e,new We.classes.URLSearchParams,{visitor:function(e,t,n,r){return We.isNode&&te.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ve(this,"env"),r=n&&n.FormData;return Re(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(te.isString(e))try{return(t||JSON.parse)(e),te.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ve(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ve(this,"responseType"),o="json"===r;if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ve(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ve(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:We.classes.FormData,Blob:We.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(Ye,e=>{Qe.headers[e]={}});const Ze=Qe;function et(e,t){const n=this||Ze,r=t||n,o=ye.from(r.headers);let i=r.data;return te.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function tt(e){return!(!e||!e.__CANCEL__)}const nt=class extends _e{constructor(e,t,n){super(e??"canceled",_e.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function rt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new _e("Request failed with status code "+n.status,n.status>=400&&n.status<500?_e.ERR_BAD_REQUEST:_e.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ot=/[\t\n\r]/g;function it(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(ot,"")}function st(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1].toLowerCase()||""}const at=e=>{try{return decodeURIComponent(e)}catch(t){return e}},ut=We.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];te.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),te.isString(r)&&a.push(`path=${r}`),te.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),te.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie;if(!t)return null;const n=t.split(";");for(let t=0;t<n.length;t++){const r=n[t].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)return at(r.slice(o+1))}return null},async readAsync(e){try{const t="undefined"!=typeof window&&window.cookieStore;if(t&&te.isFunction(t.get)){const n=await t.get(e);return n?at(n.value):null}}catch(e){}return this.read(e)},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,readAsync:async()=>null,remove(){}};const ct=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 u=Date.now(),c=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const lt=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)]},ft=(e,t,n=3)=>{let r=0;const o=ct(50,250);return lt(n=>{if(!n||!te.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),u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:u,rate:c||void 0,estimated:c&&s?(s-a)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ht=(e,t=te.asap)=>(...n)=>t(()=>e(...n)),dt=We.hasStandardBrowserEnv?(e=>t=>(t=new URL(t,document.baseURI||We.origin),e.protocol===t.protocol&&e.host===t.host&&e.port===t.port))(new URL(We.origin)):()=>!0;const yt=/^https?:(?!\/\/)/i;function mt(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 bt(e,t){if("string"==typeof e){const n=it(e);if(yt.test(n))throw new _e(`Invalid URL ${JSON.stringify(mt(n))}: missing "//" after protocol`,_e.ERR_INVALID_URL,t)}}function vt(e,t,n,r){bt(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(bt(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 gt=e=>e instanceof ye?{...e}:e,wt=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>{const n=Object.getOwnPropertyDescriptor(e,t);return n&&n.enumerable})):Object.keys(e);function _t(e,t,n,r){return te.isPlainObject(e)&&te.isPlainObject(t)?te.merge.call({caseless:r},e,t):te.isPlainObject(t)?te.merge({},t):te.isArray(t)?t.slice():t}function Et(e,t,n,r){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e,0,r):_t(e,t,0,r)}function Ot(e,t){if(!te.isUndefined(t))return _t(void 0,t)}function St(e,t){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e):_t(void 0,t)}function kt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Rt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),Tt={url:Ot,method:Ot,data:Ot,baseURL:St,transformRequest:St,transformResponse:St,params:function(e,t){const n=[],r=new WeakMap,o={};function i(e,t){if(!te.isPlainObject(t))return te.isArray(t)?t.slice():t;const i=te.isPlainObject(e)?e:o;let s=r.get(t);if(s||(s=new WeakMap,r.set(t,s)),s.has(i))return s.get(i);const a={};return s.set(i,a),n.push({base:i,source:t,result:a}),a}const s=te.isUndefined(t)?i(void 0,e):i(e,t);for(;n.length;){const{base:e,source:t,result:r}=n.pop(),o=new Set(wt(e)),s=new Set(wt(t));new Set([...o,...s]).forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;const a=s.has(n),u=a?t[n]:void 0,c=a&&!te.isPlainObject(u)||!o.has(n)?void 0:e[n];r[n]=a?i(c,u):i(void 0,c)})}return function(e){const t=[{value:e}],n=new WeakSet,r=new WeakSet;for(;t.length;){const{value:e,done:o}=t.pop();if(!te.isPlainObject(e)&&!te.isArray(e))continue;if(o){n.delete(e);continue}if(n.has(e))throw new _e("Circular reference detected in params",_e.ERR_BAD_OPTION_VALUE);if(r.has(e))continue;r.add(e),n.add(e),t.push({value:e,done:!0});const i=Object.keys(e);Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertySymbols(e).forEach(t=>{const n=Object.getOwnPropertyDescriptor(e,t);n&&n.enumerable&&i.push(t)}),i.forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n){const r=Object.getOwnPropertyDescriptor(e,n);r&&te.hasOwnProp(r,"value")&&t.push({value:r.value})}else t.push({value:e[n]})})}}(s),s},paramsSerializer:St,timeout:St,timeoutErrorMessage:St,withCredentials:St,withXSRFToken:St,adapter:St,responseType:St,xsrfCookieName:St,xsrfHeaderName:St,onUploadProgress:St,onDownloadProgress:St,decompress:St,maxContentLength:St,maxBodyLength:St,beforeRedirect:St,transport:St,httpAgent:St,httpsAgent:St,cancelToken:St,socketPath:St,allowedSocketPaths:St,responseEncoding:St,validateStatus:kt,headers:function(e,t,n){return Et(gt(e),gt(t),0,!0)}};function Pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Rt);const r=wt({...e,...t});for(let o=0,i=r.length;o<i;o++){const i=r[o];if("__proto__"===i||"constructor"===i||"prototype"===i)continue;const s=te.hasOwnProp(Tt,i)?Tt[i]:Et,a=te.hasOwnProp(e,i)?e[i]:void 0,u=te.hasOwnProp(t,i)?t[i]:void 0,c=s===kt?s(a,u,i,e,t):s(a,u,i);te.isUndefined(c)&&s!==kt||(n[i]=c)}return te.hasOwnProp(t,"validateStatus")&&te.isUndefined(t.validateStatus)&&!1===function(e,t,n){const r=te.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!te.isUndefined(r)){if(!te.isPlainObject(r))return;if(te.hasOwnProp(r,n))return r[n]}const o=te.hasOwnProp(e,"transitional")?e.transitional:void 0;if(te.isPlainObject(o)&&te.hasOwnProp(o,n))return o[n]}(e,t,"validateStatusUndefinedResolves")&&(te.hasOwnProp(e,"validateStatus")?n.validateStatus=_t(void 0,e.validateStatus):delete n.validateStatus),n}const At=["content-type","content-length"];const jt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Ct=e=>ut.read(e);const Nt=function(e,t=Ct){const n=Pt({},e),r=e=>te.hasOwnProp(n,e)?n[e]:void 0,o=r("data");let i=r("withXSRFToken");const s=r("xsrfHeaderName"),a=r("xsrfCookieName");let u=r("headers");const c=r("auth"),l=r("baseURL"),f=r("allowAbsoluteUrls"),p=r("url");if(n.headers=u=ye.from(u),n.url=Ne(vt(l,p,f,n),r("params"),r("paramsSerializer")),c){const t=te.getSafeProp(c,"username")||"",n=te.getSafeProp(c,"password")||"",o=r("transitional"),i=o&&te.hasOwnProp(o,"encodeBasicAuthUsername")&&!0===o.encodeBasicAuthUsername;try{u.set("Authorization","Basic "+btoa((i?jt(t):t)+":"+(n?jt(n):"")))}catch(t){throw _e.from(t,_e.ERR_BAD_OPTION_VALUE,e)}}if(te.isFormData(o)){const e=te.getSafeProp(o,"getHeaders");We.hasStandardBrowserEnv||We.hasStandardBrowserWebWorkerEnv||te.isReactNative(o)?u.setContentType(void 0):te.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{At.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(u,e.call(o),r("formDataHeaderPolicy"))}if(We.hasStandardBrowserEnv){te.isFunction(i)&&(i=i(n));if(!0===i||null==i&&dt(n.url)){const e=s&&a&&t(a);e&&u.set(s,e)}}return n},Ut="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){let r,o;try{const e=We.hasStandardBrowserEnv&&"undefined"!=typeof window&&window.cookieStore;r=e&&te.isFunction(e.get)}catch(e){}const i=Nt(e,r?e=>(o=e,null):void 0);let s=i.data;const a=ye.from(i.headers).normalize();let u,c,l,f,p,h,d,{responseType:y,onUploadProgress:m,onDownloadProgress:b}=i;function v(){clearTimeout(c);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}g&&(f&&g.removeEventListener("progress",f),g.upload&&(l&&g.upload.removeEventListener("progress",l),p&&g.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(st(it(i.url))||st(We.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),void(g=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const o=ye.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());rt(function(e){t(e),v()},function(e){n(e),v()},{data:y&&"text"!==y&&"json"!==y?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:o,config:e,request:g}),g=null}if(g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,g);o.event=t||null,n(o),v(),g=null},g.ontimeout=function(){if(!g)return;let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||Ie;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new _e(t,r.clarifyTimeoutError?_e.ETIMEDOUT:_e.ECONNABORTED,e,g)),v(),g=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),y&&"json"!==y&&(g.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),g.addEventListener("progress",f)),m&&g.upload&&([l,p]=ft(m),g.upload.addEventListener("progress",l),g.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(u=t=>{if(!g)return;n(!t||t.type?new nt(null,e,g):t);const r=g;v(),g=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(u),!g)return;i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u))}if(!g)return;const _=st(i.url);if(_&&!We.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void v();const E=()=>{g&&("setRequestHeader"in g&&te.forEach(se(a),function(e,t){g.setRequestHeader(t,e)}),g.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=g.timeout>0?t()+Number(g.timeout):void 0,s=()=>{if(!g)return;const e=g;e.ontimeout(),e.abort()};if(void 0!==r){const e=()=>{const n=r-t();n>0?c=setTimeout(e,Math.min(n,2147483647)):s()};e()}ut.readAsync(o).then(e=>{if(g)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}E()}}).catch(t=>{g&&(n(_e.from(t,null,e,g)),v(),g=null)})}else E()})},xt=(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 _e?t:new nt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new _e(`timeout of ${t}ms exceeded`,_e.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{const t=te.getSafeProp(e,"unsubscribe");te.isFunction(t)?t.call(e,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=()=>te.asap(s),a},Dt=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},Lt=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()}},Ft=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Lt(e))yield*Dt(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})},It="\r\n",Bt=e=>String(e).replace(/\r\n|\r|\n/g,It),qt=e=>String(e).replace(/[\r\n"]/g,e=>"\r"===e?"%0D":"\n"===e?"%0A":"%22"),Ht=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);!t||13!==o&&10!==o?o<128?n++:o<2048?n+=2:o>=55296&&o<=56319&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r++):n+=3:(13===o&&10===e.charCodeAt(r+1)&&r++,n+=2)}return n};class Mt extends TypeError{constructor(e,t){super(e),this.name="FormDataError",this.reason=t}}function zt(e,t,n,r,o){if(!te.isFunction(t))throw new _e("Blob is not supported",_e.ERR_NOT_SUPPORT);if(void 0===o)if(te.isFunction(We.generateString))o="axios-"+We.generateString(36,"0123456789abcdef");else{const e=te.global.crypto;if(!e||!te.isFunction(e.getRandomValues))throw new _e("Random byte generation is not supported",_e.ERR_NOT_SUPPORT);const t=new Uint8Array(18);e.getRandomValues(t),o="axios-"+Array.from(t,e=>("0"+e.toString(16)).slice(-2)).join("")}try{return function(e,t,n,r,o){if(!te.isFunction(t))throw new Mt("Blob is not supported","blob");if(!te.isString(o)||!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(o)||/ $/.test(o))throw new Mt("Invalid multipart boundary","boundary");const i="--"+o+"--"+It;let s=i.length;const a=[],u=e=>{if(s+e>n)throw r()};u(0);for(const[t,n]of e){const e=te.isString(n),r=e?Ht(n,!0):n.size;if(!Number.isFinite(r)||r<0)throw new Mt("Unsupported FormData part size","part");u(r+Ht(t,!0)+(!e&&n.name?Ht(n.name,!1):0)+(!e&&n.type?Ht(n.type,!1):0));let i="--"+o+'\r\nContent-Disposition: form-data; name="'+qt(Bt(t))+'"';e||(i+='; filename="'+qt(te.isString(n.name)?n.name:"blob")+'"\r\nContent-Type: '+String(n.type||"application/octet-stream").replace(/[\r\n]/g,"")),i+=It+It;const c=Ht(i,!1)+r+2;u(c),s+=c,a.push({header:i,value:n,isString:e})}const c=[];for(const e of a)c.push(e.header,e.isString?Bt(e.value):e.value,It);return c.push(i),new t(c,{type:"multipart/form-data; boundary="+o})}(e,t,n,r,o)}catch(e){if(e instanceof Mt){const t="boundary"===e.reason?_e.ERR_BAD_OPTION_VALUE:_e.ERR_BAD_REQUEST;throw new _e(e.message,t)}throw e}}const Xt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Wt=(e,t,n)=>t+2<n&&Xt(e.charCodeAt(t+1))&&Xt(e.charCodeAt(t+2)),Kt=e=>e<=57?e-48:(223&e)-55,Gt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,$t=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)},Yt=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&&Wt(e,i,t)&&(s=16*Kt(e.charCodeAt(i+1))+Kt(e.charCodeAt(i+2)),i+=2),$t(s)||(61!==s?!Gt(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)},Vt=(e,t,n)=>{if(!e||"string"!=typeof e)return 0;if(!/^data:/i.test(e))return 0;const r=e.indexOf(",");if(r<0)return 0;const o=e.slice(5,r),i=e.slice(r+1);if(n.test(o))return t(i);let s=0;for(let e=0,t=i.length;e<t;e++){const n=i.charCodeAt(e);if(37===n&&Wt(i,e,t))s+=1,e+=2;else if(n<128)s+=1;else if(n<2048)s+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(s+=4,e++):s+=3}else s+=3}return s};const Qt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Zt}=te,en=e=>{if(!te.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},tn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nn=e=>{const t=void 0!==te.global&&null!==te.global?te.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=te.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response,Blob:t.Blob},e);const o=te.hasOwnProp(e,"fetch")?e.fetch:void 0,{Request:i,Response:s,Blob:a}=e,u=o?Zt(o):"function"==typeof fetch,c=Zt(i),l=Zt(s);if(!u)return!1;const f=u&&Zt(n),p=u&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const d=c&&f&&tn(()=>{let e=!1;const t=new i(We.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}),y=l&&f&&tn(()=>te.isReadableStream(new s("").body)),m=Object.assign(Object.create(null),Qt);c&&!tn(()=>new i(We.origin,m))&&(delete m.cache,tn(()=>new i(We.origin,m))||(m.cache=Qt.cache));const b={stream:y&&(e=>e.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!b[e]&&(b[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new _e(`Response type '${e}' is not supported`,_e.ERR_NOT_SUPPORT,n)})});const v=async e=>null==e?0:te.isBlob(e)?e.size:te.isArrayBufferView(e)||te.isArrayBuffer(e)?e.byteLength:(te.isURLSearchParams(e)&&(e+=""),te.isString(e)?(await p(e)).byteLength:void 0);return async e=>{let{url:t,method:n,data:u,signal:l,cancelToken:p,timeout:h,onDownloadProgress:g,onUploadProgress:w,responseType:_,headers:E,withCredentials:O="same-origin",fetchOptions:S,maxContentLength:k,maxBodyLength:R,maxRedirects:T}=Nt(e);const P=te.isNumber(k)&&k>-1,A=te.isNumber(R)&&R>-1,j=t=>te.hasOwnProp(e,t)?e[t]:void 0;let C=o||fetch;_=_?(_+"").toLowerCase():"text";let N=xt([l,p&&p.toAbortSignal()],h),U=null;const x=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let D,L=null,F=null;const I=()=>new _e("Request body larger than maxBodyLength limit",_e.ERR_BAD_REQUEST,e,U);try{let o;const l=j("auth");if(l){const e=te.getSafeProp(l,"username")||"";o={username:e,password:te.getSafeProp(l,"password")||""}}let p;if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){if(p=new URL(t,We.origin),!o&&(p.username||p.password)){const e=en(p.username);o={username:e,password:en(p.password)}}(p.username||p.password)&&(p.username="",p.password="",t=p.href)}if(o&&(E.delete("authorization"),E.set("Authorization","Basic "+btoa((B=(o.username||"")+":"+(o.password||""),encodeURIComponent(B).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),P&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Vt(-1===t?e:e.slice(0,t),Yt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>k)throw new _e("maxContentLength size of "+k+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const h=te.isSpecCompliantForm(u)&&ye.from(j("headers")).getContentType();let q;if(te.isString(h)&&/^multipart\/form-data(?:\s*;|$)/i.test(h.trim())){const e=ye.parseParameters(h);te.hasOwnProp(e,"boundary")&&(q=e.boundary)}if(te.isSpecCompliantForm(u)&&"get"!==n&&"head"!==n&&(A||w&&d||void 0!==q)&&(u=zt(u,a,A?R:1/0,I,q),E.setContentType(void 0===q?u.type:h),D=u.size),A&&"get"!==n&&"head"!==n){const e=await v(u);if("number"==typeof e&&isFinite(e)&&(D=e,e>R))throw I()}const H=A&&(te.isReadableStream(u)||te.isStream(u)),M=(e,t,n)=>Ft(e,65536,e=>{if(A&&e>R)throw L=I();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(w||H)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??v(t)})(E,u),0!==D||H){let e,n=new i(t,{method:"POST",body:u,duplex:"half"});if(te.isFormData(u)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=w&&pt(D,ft(ht(w)))||[];u=M(n.body,e,t)}}}else if(H&&!c&&f&&"get"!==n&&"head"!==n)u=M(u);else if(H&&c&&!d&&"get"!==n&&"head"!==n)throw new _e("Stream request bodies are not supported by the current fetch implementation",_e.ERR_NOT_SUPPORT,e,U);te.isString(O)||(O=O?"include":"omit");const z=c&&"credentials"in i.prototype;if(te.isFormData(u)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/1.21.1",!1);const X=null==S?S:Object.assign(Object.create(null),S);X&&(delete X.body,delete X.headers,delete X.method,delete X.signal,delete X.duplex,delete X.credentials);const W=Object.assign(Object.create(null),X,{signal:N,method:n.toUpperCase(),headers:se(E.normalize()),body:u,duplex:"half",credentials:z?O:void 0});c&&(te.forEach(m,(e,t)=>{void 0===W[t]&&(W[t]=e)}),void 0===W.signal&&(W.signal=null),void 0===W.body&&(W.body=null)),0===T&&(W.redirect="manual",X&&(X.redirect="manual")),U=c&&new i(t,W);let K=await(c?C(U,X):C(t,W));const G=ye.from(K.headers);if(P){const t=te.toFiniteNumber(G.getContentLength());if(null!=t&&t>k)throw new _e("maxContentLength size of "+k+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const $=y&&("stream"===_||"response"===_);if(y&&K.body&&(g||P||$&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=K[e]});const n=te.toFiniteNumber(G.getContentLength()),[r,o]=g&&pt(n,ft(ht(g),!0))||[];let i=0;const a=t=>{if(P&&(i=t,i>k))throw F=new _e("maxContentLength size of "+k+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};K=new s(Ft(K.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let J=await b[te.findKey(b,_)||"text"](K,e);if(P&&!y&&!$){let t;if(null!=J&&("number"==typeof J.byteLength?t=J.byteLength:"number"==typeof J.size?t=J.size:"string"==typeof J&&(t="function"==typeof r?(new r).encode(J).byteLength:J.length)),"number"==typeof t&&t>k)throw new _e("maxContentLength size of "+k+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!$&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:J,headers:ye.from(K.headers),status:K.status,statusText:K.statusText,config:e,request:U})})}catch(t){if(x&&x(),N&&N.aborted&&N.reason instanceof _e){const n=N.reason;throw n.config=e,U&&(n.request=U),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(L)throw U&&!L.request&&(L.request=U),L;if(F)throw F;if(t instanceof _e)throw U&&!t.request&&(t.request=U),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new _e("Network Error",_e.ERR_NETWORK,e,U,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw _e.from(t,t&&t.code,e,U,t&&t.response)}var B}},rn=new Map,on=e=>{const t=Object.create(null),n=e&&te.hasOwnProp(e,"env")&&e.env;["fetch","Request","Response","Blob"].forEach(e=>{n&&te.hasOwnProp(n,e)&&(t[e]=n[e])});const{fetch:r,Request:o,Response:i,Blob:s}=t,a=[o,i,r,s];let u,c,l=a.length,f=rn;for(;l--;)u=a[l],c=f.get(u),void 0===c&&f.set(u,c=l?new Map:nn(t)),f=c;return c},sn=(on(),{http:null,xhr:Ut,fetch:{get:on}});te.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const an=e=>`- ${e}`,un=e=>te.isFunction(e)||null===e||!1===e;const cn={getAdapter:function(e,t){e=te.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,!un(r)&&(o=sn[(n=String(r)).toLowerCase()],void 0===o))throw new _e(`Unknown adapter '${n}'`);if(o&&(te.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(an).join("\n"):" "+an(e[0]):"as no adapter specified";throw new _e("There is no suitable adapter to dispatch the request "+t,_e.ERR_NOT_SUPPORT)}return o},adapters:sn};function ln(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nt(null,e)}function fn(e,t){return Math.max(0,Math.round(e()-t))}function pn(e){const t=te.toSafeFlatObject(e);ln(t),t.headers=ye.from(te.getSafeProp(t,"headers")),t.data=et.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);const n=cn.getAdapter(t.adapter||Ze.adapter,t),r="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,o=r();return n(t).then(function(e){ln(t),e.duration=fn(r,o),t.response=e;try{e.data=et.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=ye.from(e.headers),e},function(e){if(!tt(e)&&(ln(t),e&&e.response)){e.response.duration=fn(r,o),t.response=e.response;try{e.response.data=et.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=ye.from(e.response.headers)}return Promise.reject(e)})}const hn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const dn={};hn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.21.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new _e(r(o," has been removed"+(t?" in "+t:"")),_e.ERR_DEPRECATED);return t&&!dn[o]&&(dn[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)}},hn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const yn={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new _e("options must be an object",_e.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 _e("option "+i+" must be "+n,_e.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new _e("Unknown option "+i,_e.ERR_BAD_OPTION)}},validators:hn},mn=yn.validators,bn=e=>{if(null==e||te.isPlainObject(e)||e instanceof ye)return!0;try{return te.isObject(e)&&"AxiosHeaders"===te.getSafeProp(e,Symbol.toStringTag)&&["toJSON","set","get","has","delete","clear","normalize","concat","toString",Symbol.iterator].every(t=>te.isFunction(te.getSafeProp(e,t)))}catch(e){return!1}};class vn{constructor(e){this.defaults=e||{},this.interceptors={request:new Fe,response:new Fe}}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:r.slice(n+1),i=String(e.stack),s=function(e,t){const n=te.hasOwnProp(e,ge)&&e[ge];return n&&t.endsWith(n)?t.length-n.length:-1}(e,i),a=-1===s?i:i.slice(0,s),u=-1===s?"":i.slice(s);a.endsWith(o)||(e.stack=a+"\n"+r+u)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Pt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&yn.assertOptions(n,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean),encodeBasicAuthUsername:mn.transitional(mn.boolean)},!1),null!=r&&(te.isFunction(r)?t.paramsSerializer={serialize:r}:yn.assertOptions(r,{encode:mn.function,serialize:mn.function},!0)),void 0!==t.allowAbsoluteUrls||(te.hasOwnProp(this.defaults,"allowAbsoluteUrls")&&void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yn.assertOptions(t,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),t.method=(te.getSafeProp(t,"method")||te.getSafeProp(this.defaults,"method")||"get").toLowerCase();const i=te.getSafeProp(o,"common"),s=te.getSafeProp(o,t.method),a=o&&te.merge(bn(i)?i:void 0,bn(s)?s:void 0);o&&te.forEach(Ye.concat("common"),e=>{bn(te.getSafeProp(o,e))&&delete o[e]}),t.headers=ye.concat(a,o);const u=[];let c=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;c=c&&e.synchronous;const n=t.transitional||Ie;n&&n.legacyInterceptorReqResOrdering?u.unshift(e.fulfilled,e.rejected):u.push(e.fulfilled,e.rejected)});const l=[];let f;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let p,h=0;if(!c){const e=[pn.bind(this),void 0];for(e.unshift(...u),e.push(...l),p=e.length,f=Promise.resolve(t);h<p;)f=f.then(e[h++],e[h++]);return f}p=u.length;let d=t;for(;h<p;){const e=u[h++],t=u[h++];try{d=e?e(d):d}catch(e){if(!t){f=Promise.reject(e);break}try{const n=t.call(this,e);te.isThenable(n)&&(f=Promise.resolve(n).then(()=>pn.call(this,d)))}catch(e){f=Promise.reject(e)}break}}if(!f)try{f=pn.call(this,d)}catch(e){f=Promise.reject(e)}for(h=0,p=l.length;h<p;)f=f.then(l[h++],l[h++]);return f}getUri(e){return Ne(vt((e=Pt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){vn.prototype[e]=async function(t,n){return this.request(Pt(n||{},{method:e,url:t,data:n&&te.hasOwnProp(n,"data")?n.data:void 0}))}}),te.forEach(["post","put","patch","query"],function(e){function t(t){return async function(n,r,o){return this.request(Pt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}vn.prototype[e]=t(),"query"!==e&&(vn.prototype[e+"Form"]=t(!0))});const gn=vn;class wn{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 nt(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 wn(function(t){e=t}),cancel:e}}}const _n=wn;const En={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(En).forEach(([e,t])=>{void 0===En[t]&&(En[t]=e)});const On=En;const Sn=function e(t){const n=new gn(t),r=o(gn.prototype.request,n);return te.extend(r,gn.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Pt(t,n))},r}(Ze);Sn.Axios=gn,Sn.CanceledError=nt,Sn.CancelToken=_n,Sn.isCancel=tt,Sn.VERSION="1.21.1",Sn.toFormData=Re,Sn.AxiosError=_e,Sn.Cancel=Sn.CanceledError,Sn.all=function(e){return Promise.all(e)},Sn.spread=function(e){return function(t){return e.apply(null,t)}},Sn.isAxiosError=function(e){return te.isObject(e)&&!0===e.isAxiosError},Sn.mergeConfig=Pt,Sn.AxiosHeaders=ye,Sn.formToJSON=e=>Je(te.isHTMLForm(e)?new FormData(e):e),Sn.getAdapter=cn.getAdapter,Sn.HttpStatusCode=On,Sn.default=Sn;const kn=Sn;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 Tn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Pn(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Pn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Pn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Pn(f,"constructor",c),Pn(c,"constructor",u),u.displayName="GeneratorFunction",Pn(c,o,"GeneratorFunction"),Pn(f),Pn(f,o,"Generator"),Pn(f,r,function(){return this}),Pn(f,"toString",function(){return"[object Generator]"}),(Tn=function(){return{w:i,m:p}})()}function Pn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Pn=function(e,t,n,r){function i(t,n){Pn(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))},Pn(e,t,n,r)}function An(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}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,Cn(r.key),r)}}function Cn(e){var t=function(e,t){if("object"!=Rn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){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 Nn=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=Tn().m(function e(){return Tn().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&&jn(e.prototype,t),n&&jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}();function Un(e){return Un="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},Un(e)}function xn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Dn(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Dn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Dn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Dn(f,"constructor",c),Dn(c,"constructor",u),u.displayName="GeneratorFunction",Dn(c,o,"GeneratorFunction"),Dn(f),Dn(f,o,"Generator"),Dn(f,r,function(){return this}),Dn(f,"toString",function(){return"[object Generator]"}),(xn=function(){return{w:i,m:p}})()}function Dn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Dn=function(e,t,n,r){function i(t,n){Dn(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))},Dn(e,t,n,r)}function Ln(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Fn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Ln(i,r,o,s,a,"next",e)}function a(e){Ln(i,r,o,s,a,"throw",e)}s(void 0)})}}function In(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"!=Un(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Un(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Un(t)?t:t+""}var qn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var Hn=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,u=void 0===a?0:a,c=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&&qn.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=c||kn.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(u)},t=[{key:"getAccessToken",value:(s=Fn(xn().m(function e(){return xn().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=Fn(xn().m(function e(t){return xn().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=Fn(xn().m(function e(){var t=this;return xn().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=Fn(xn().m(function e(){var t,n,r,o,i;return xn().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"===Un(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&&In(e.prototype,t),n&&In(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i,s}();function Mn(e){return Mn="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},Mn(e)}function zn(e){return function(e){if(Array.isArray(e))return Kn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xn(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=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Wn(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 Wn(e,t){if(e){if("string"==typeof e)return Kn(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)?Kn(e,t):void 0}}function Kn(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 Gn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return $n(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):($n(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,$n(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,$n(f,"constructor",c),$n(c,"constructor",u),u.displayName="GeneratorFunction",$n(c,o,"GeneratorFunction"),$n(f),$n(f,o,"Generator"),$n(f,r,function(){return this}),$n(f,"toString",function(){return"[object Generator]"}),(Gn=function(){return{w:i,m:p}})()}function $n(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}$n=function(e,t,n,r){function i(t,n){$n(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))},$n(e,t,n,r)}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,Yn(r.key),r)}}function Yn(e){var t=function(e,t){if("object"!=Mn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Mn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Mn(t)?t:t+""}function Vn(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Qn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Vn(i,r,o,s,a,"next",e)}function a(e){Vn(i,r,o,s,a,"throw",e)}s(void 0)})}}var Zn=null;function er(){return tr.apply(this,arguments)}function tr(){return(tr=Qn(Gn().m(function e(){var t;return Gn().w(function(e){for(;;)switch(e.n){case 0:if(!Zn){e.n=1;break}return e.a(2,Zn);case 1:return e.n=2,import("node:crypto");case 2:return t=e.v,Zn=t.default&&t.default.createHmac?t.default:t,e.a(2,Zn)}},e)}))).apply(this,arguments)}var nr=new Set(["/appmesh/file/download","/appmesh/file/upload","/appmesh/file/delete"]),rr=/^\/appmesh\/app\/[^/]+\/(output|task)\/stream$/,or=Object.freeze({KEY_ID:"X-Request-Key",TIMESTAMP:"X-Timestamp",NONCE:"X-Nonce",SIGNATURE:"X-Signature"});function ir(e){if("string"!=typeof e)return!1;var t=sr(e);return nr.has(t)||rr.test(t)}function sr(e){return"/appmesh/file/download/ws"===e?"/appmesh/file/download":"/appmesh/file/upload/ws"===e?"/appmesh/file/upload":e}var ar=function(){return e=function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"string"!=typeof t||""===t.trim())throw new TypeError("keyId must be a non-empty string");if("string"!=typeof n||""===n)throw new TypeError("secret must be a non-empty string");Object.defineProperty(this,"_keyId",{value:t,writable:!0}),Object.defineProperty(this,"_secret",{value:n,writable:!0})},t=[{key:"keyId",get:function(){return this._keyId}},{key:"attach",value:(i=Qn(Gn().m(function e(t,n,r,o,i,s,a){var u,c,l,f,p,h,d,y,m;return Gn().w(function(e){for(;;)switch(e.n){case 0:if(u=s||String(Math.floor(Date.now()/1e3)),p=a){e.n=2;break}return e.n=1,this.randomNonce();case 1:p=e.v;case 2:return c=p,l=sr(r),h=ur,d=n,y=l,m=o,e.n=3,cr(l,i);case 3:return f=h(d,y,m,e.v,u,c),t[or.KEY_ID]=this._keyId,t[or.TIMESTAMP]=u,t[or.NONCE]=c,e.n=4,this.sign(f);case 4:t[or.SIGNATURE]=e.v;case 5:return e.a(2)}},e,this)})),function(e,t,n,r,o,s,a){return i.apply(this,arguments)})},{key:"randomNonce",value:(o=Qn(Gn().m(function e(){var t;return Gn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return t=e.v,e.a(2,t.randomBytes(16).toString("hex"))}},e)})),function(){return o.apply(this,arguments)})},{key:"sign",value:(r=Qn(Gn().m(function e(t){var n;return Gn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return n=e.v,e.a(2,n.createHmac("sha256",this._secret).update(t,"utf8").digest("hex"))}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"toString",value:function(){return"RequestSigner[keyId=".concat(this._keyId,"]")}}],t&&Jn(e.prototype,t),n&&Jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i}();function ur(e,t,n,r,o,i){if(!e||!t)throw new TypeError("method and path are required");return[e,t,n||"",r,o,i].join("\n")}function cr(e,t){return lr.apply(this,arguments)}function lr(){return(lr=Qn(Gn().m(function e(t,n){var r,o;return Gn().w(function(e){for(;;)switch(e.n){case 0:return r=null==n||ir(t)?Buffer.alloc(0):Buffer.from(n),e.n=1,er();case 1:return o=e.v,e.a(2,o.createHash("sha256").update(r).digest("hex"))}},e)}))).apply(this,arguments)}function fr(e){if(!e)return"";for(var t=Object.create(null),n=0;n<e.length;){var r=e.indexOf("&",n),o=r<0?e.slice(n):e.slice(n,r),i=o.indexOf("="),s=i<0?o:o.slice(0,i),a=i<0?"":o.slice(i+1),u=pr(s);if(Object.prototype.hasOwnProperty.call(t,u)||(t[u]=pr(a)),r<0)break;n=r+1}var c=Object.entries(t);return c.sort(function(e,t){var n=Buffer.compare(Buffer.from(e[0],"utf8"),Buffer.from(t[0],"utf8"));return 0!==n?n:Buffer.compare(Buffer.from(e[1],"utf8"),Buffer.from(t[1],"utf8"))}),c.map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)}).join("&")}function pr(e){if(!e.includes("%"))return e;for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(37===r){var o=e.charCodeAt(n+1),i=e.charCodeAt(n+2),s=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102};if(!s(o)||!s(i))return e;t.push(parseInt(e.slice(n+1,n+3),16)),n+=2}else if(r<128)t.push(r);else{var a=Buffer.from(e[n],"utf8");t.push.apply(t,zn(a))}}return Buffer.from(t).toString("utf8")}function hr(e){return e?Object.entries(e).filter(function(e){var t=Xn(e,2)[1];return null!=t}).map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(encodeURIComponent(String(n)),"=").concat(encodeURIComponent(String(r)))}).join("&"):""}function dr(e){return dr="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},dr(e)}function yr(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=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mr(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)?mr(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 mr(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 br(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return vr(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(vr(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,vr(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,vr(f,"constructor",c),vr(c,"constructor",u),u.displayName="GeneratorFunction",vr(c,o,"GeneratorFunction"),vr(f),vr(f,o,"Generator"),vr(f,r,function(){return this}),vr(f,"toString",function(){return"[object Generator]"}),(br=function(){return{w:i,m:p}})()}function vr(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}vr=function(e,t,n,r){function i(t,n){vr(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))},vr(e,t,n,r)}function gr(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 wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gr(Object(n),!0).forEach(function(t){_r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _r(e,t,n){return(t=Rr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Er(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Or(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Er(i,r,o,s,a,"next",e)}function a(e){Er(i,r,o,s,a,"throw",e)}s(void 0)})}}function Sr(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,Rr(r.key),r)}}function kr(e,t,n){return t&&Sr(e.prototype,t),n&&Sr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rr(e){var t=function(e,t){if("object"!=dr(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=dr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==dr(t)?t:t+""}function Tr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pr(e,t,n){return t=Ur(t),function(e,t){if(t&&("object"==dr(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,Cr()?Reflect.construct(t,n||[],Ur(e).constructor):t.apply(e,n))}function Ar(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&&Nr(e,t)}function jr(e){var t="function"==typeof Map?new Map:void 0;return jr=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(Cr())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Nr(o,n.prototype),o}(e,arguments,Ur(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Nr(n,e)},jr(e)}function Cr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Cr=function(){return!!e})()}function Nr(e,t){return Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Nr(e,t)}function Ur(e){return Ur=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ur(e)}function xr(e){return new Fr(e,0)}function Dr(e){return function(){return new Lr(e.apply(this,arguments))}}function Lr(e){var t,n;function r(t,n){try{var i=e[t](n),s=i.value,a=s instanceof Fr;Promise.resolve(a?s.v:s).then(function(n){if(a){var u="return"===t&&s.k?t:"next";if(!s.k||n.done)return r(u,n);n=e[u](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,s){var a={key:e,arg:o,resolve:i,reject:s,next:null};n?n=n.next=a:(t=n=a,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function Fr(e,t){this.v=e,this.k=t}function Ir(e){var t,n,r,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new Br(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Br(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Br=function(e){this.s=e,this.n=e.next},Br.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.throw;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new Br(e)}Lr.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Lr.prototype.next=function(e){return this._invoke("next",e)},Lr.prototype.throw=function(e){return this._invoke("throw",e)},Lr.prototype.return=function(e){return this._invoke("return",e)};var qr=null,Hr=null,Mr=null,zr=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",HTTP_HEADER_KEY_X_FILE_OVERWRITE:"X-File-Overwrite",HTTP_HEADER_KEY_X_FILE_MODE:"X-File-Mode",HTTP_HEADER_KEY_X_FILE_USER:"X-File-User",HTTP_HEADER_KEY_X_FILE_GROUP:"X-File-Group",HTTP_HEADER_KEY_X_OUTPUT_POSITION:"X-Output-Position",HTTP_HEADER_KEY_X_EXIT_CODE:"X-Exit-Code",HTTP_HEADER_KEY_X_INPUT_CLOSE:"X-Input-Close",HTTP_HEADER_KEY_X_SUBSCRIPTION_ID:"X-Subscription-Id",HTTP_HEADER_KEY_X_APPMESH_PROCESS_KEY:"X-AppMesh-Process-Key"}),Xr=Object.freeze({isNode:!("undefined"!=typeof window&&"undefined"!==window.document)}),Wr=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Kr(e,t){var n=String(e||""),r=String(t||""),o=r;if(n&&!Wr.test(r)){for(var i=n.length;i>0&&47===n.charCodeAt(i-1);)i--;o=r?n.slice(0,i)+"/"+r.replace(/^\/+/,""):n}try{return new URL(o).pathname}catch(e){try{return new URL(o,"http://localhost").pathname}catch(e){return r}}}var Gr=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 Tr(this,e),(n=Pr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return Ar(e,jr(Error)),kr(e)}(),$r=function(){function e(t){var n;return Tr(this,e),(n=Pr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Ar(e,Gr),kr(e)}(),Jr=function(){function e(t){var n;return Tr(this,e),(n=Pr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Ar(e,Gr),kr(e)}(),Yr=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Tr(this,e),(n=Pr(this,e,[t,r,null,"REQUEST"])).name="AppMeshRequestError",n}return Ar(e,Gr),kr(e)}(),Vr=function(){function e(t){var n;return Tr(this,e),(n=Pr(this,e,[t,null,null,"TIMEOUT"])).name="AppMeshTimeoutError",n}return Ar(e,Gr),kr(e)}(),Qr=function(e,t){Xr.isNode?process.stdout.write(e):console.log(e)};function Zr(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 u=a.slice(1);if(0===u.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(u.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var c=u.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*c.years,l+=2592e3*c.months,l+=604800*c.weeks,l+=86400*c.days,l+=3600*c.hours,l+=60*c.minutes,l+=c.seconds}function eo(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 to(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(eo(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new Gr("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function no(e){return ro.apply(this,arguments)}function ro(){return(ro=Or(br().m(function e(t){var r,o,i,s;return br().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 oo(e){return io.apply(this,arguments)}function io(){return(io=Or(br().m(function e(t){var n,r;return br().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,so("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function so(e,t){return ao.apply(this,arguments)}function ao(){return(ao=Or(br().m(function e(t,r){var o,i,s,a,u,c,l,f,p,h,d;return br().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(":"),u=a.length>=3?parseInt(a[2],10):NaN,e.a(2,a[0]&&!isNaN(u)?{name:a[0],gid:u}:null);case 2:if(0===(c=i("dscacheutil",["-q","group","-a",t,String(r)],{encoding:"utf8",timeout:3e3})).status&&c.stdout){e.n=3;break}return e.a(2,null);case 3:if(l=c.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 uo(e){return co.apply(this,arguments)}function co(){return(co=Or(br().m(function e(t){var r,o,i,s;return br().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 lo(e){return fo.apply(this,arguments)}function fo(){return(fo=Or(br().m(function e(t){var n;return br().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,so("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var po="/opt/appmesh/ssl/ca.pem";function ho(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function yo(e){if(!e)return null;var t="function"==typeof e.get?e.get(zr.HTTP_HEADER_KEY_AUTH):e[zr.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function mo(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:Hr.readFileSync(e)}function bo(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return Hr.existsSync(po)?{ca:Hr.readFileSync(po),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=wr({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=mo(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var vo=kr(function e(t){var n,r,o,i,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Tr(this,e),this.reason=t,this.exitCode=null!==(n=a.exitCode)&&void 0!==n?n:null,this.position=null!==(r=a.position)&&void 0!==r?r:null,this.status=null!==(o=a.status)&&void 0!==o?o:null,this.message=null!==(i=a.message)&&void 0!==i?i:null,this.result=null!==(s=a.result)&&void 0!==s?s:null});function go(e){return wo.apply(this,arguments)}function wo(){return(wo=Dr(br().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b;return br().w(function(e){for(;;)switch(e.p=e.n){case 0:n=new TextDecoder("utf-8"),r="",o="message",i=[],s=!1,a=!1,e.p=1,c=Ir(t);case 2:return e.n=3,xr(c.next());case 3:if(!(s=!(l=e.v).done)){e.n=12;break}f=l.value,r+="string"==typeof f?f:n.decode(f,{stream:!0}),p=void 0;case 4:if(!((p=r.indexOf("\n"))>=0)){e.n=11;break}if(h=r.slice(0,p).replace(/\r$/,""),r=r.slice(p+1),""!==h){e.n=9;break}if(!("message"!==o||i.length>0)){e.n=8;break}if(d=i.join("\n"),y={},!d){e.n=7;break}e.p=5,y=JSON.parse(d),e.n=7;break;case 6:throw e.p=6,m=e.v,new Gr("malformed SSE frame (".concat(o,"): ").concat(m.message));case 7:return e.n=8,[o,y];case 8:o="message",i=[],e.n=10;break;case 9:h.startsWith(":")||(h.startsWith("event:")?o=h.slice(6).trim():h.startsWith("data:")&&i.push(h.slice(5).trimStart()));case 10:e.n=4;break;case 11:s=!1,e.n=2;break;case 12:e.n=14;break;case 13:e.p=13,b=e.v,a=!0,u=b;case 14:if(e.p=14,e.p=15,!s||null==c.return){e.n=16;break}return e.n=16,xr(c.return());case 16:if(e.p=16,!a){e.n=17;break}throw u;case 17:return e.f(16);case 18:return e.f(14);case 19:return e.a(2)}},e,null,[[15,,16,18],[5,6],[1,13,14,19]])}))).apply(this,arguments)}function _o(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new vo(String(null!==(t=e.reason)&&void 0!==t?t:"closed"),wr({exitCode:e.exit_code,position:e.position,status:e.status,message:e.message},n))}function Eo(e){var t;if("error"===e.reason)throw new Yr(e.message||"stream failed with an error",null!==(t=e.status)&&void 0!==t?t:null);if("timeout"===e.reason)throw new Vr(e.message||"stream timed out");if(!["exit","removed","eof","final","disconnected","closed"].includes(e.reason))throw new Gr("stream ended with unknown reason: ".concat(e.reason))}var Oo=function(){return kr(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xr.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;Tr(this,e),this.baseURL=r,this.forwardingHost=null,this._requestSigner=null,this._tokenProvider=null,i&&this.setTokenProvider(i);var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[to]};this._sslConfig=o,this._client=kn.create(s),Xr.isNode&&!Mr&&(Mr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=yr(e,2),n=t[0],r=t[1];qr=n.default||n,Hr=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Or(br().m(function e(n){var r,o;return br().w(function(e){for(;;)switch(e.n){case 0:return r=wr,o=wr({},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 Gr("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 Gr)return Promise.reject(e);var i=new Gr("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:"setTokenProvider",value:function(e){if(!e||"function"!=typeof e.getAccessToken)throw new TypeError("tokenProvider must implement async getAccessToken()");this._tokenProvider=e}},{key:"setBearerToken",value:function(e){null!=e?this.setTokenProvider(new Nn(e)):this.clearBearerToken()}},{key:"setToken",value:function(e){this.setBearerToken(e)}},{key:"clearBearerToken",value:function(){var e=this._tokenProvider;e&&"function"==typeof e.clear&&e.clear(),this._tokenProvider=null}},{key:"enableRequestSignature",value:function(e,t){this._requestSigner=new ar(e,t)}},{key:"disableRequestSignature",value:function(){this._requestSigner=null}},{key:"isRequestSignatureEnabled",value:function(){return null!==this._requestSigner}},{key:"_applyRequestSignature",value:(K=Or(br().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h;return br().w(function(e){for(;;)switch(e.n){case 0:if((n=this._requestSigner)&&t){e.n=1;break}return e.a(2);case 1:return r=Kr(t.baseURL||this._client.defaults.baseURL||this.baseURL,t.url),o="",t.params&&"object"===dr(t.params)&&Object.keys(t.params).length>0&&(t.paramsSerializer=hr,o=fr(hr(t.params))),i=this._headerValue(t.headers,"content-type"),s=ir(r)?Buffer.alloc(0):this._wireBodyBytes(t.data,i),a=String(t.method||"get").toUpperCase(),u={},e.n=2,n.attach(u,a,r,o,s);case 2:for(c=0,l=Object.entries(u);c<l.length;c++)f=yr(l[c],2),p=f[0],h=f[1],t.headers&&"function"==typeof t.headers.set?t.headers.set(p,h):t.headers=wr(wr({},t.headers),{},_r({},p,h));case 3:return e.a(2)}},e,this)})),function(e){return K.apply(this,arguments)})},{key:"_headerValue",value:function(e,t){if(e){if("function"==typeof e.get)return e.get(t);var n=Object.keys(e).find(function(e){return e.toLowerCase()===t.toLowerCase()});return void 0===n?void 0:e[n]}}},{key:"_wireBodyBytes",value:function(e,t){if(null==e)return Buffer.alloc(0);if("string"==typeof e){if(String(t||"").toLowerCase().includes("application/json"))try{return JSON.parse(e),Buffer.from(e.trim(),"utf8")}catch(t){if("SyntaxError"!==t.name)throw t;return Buffer.from(JSON.stringify(e),"utf8")}return Buffer.from(e,"utf8")}if(Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer)return Buffer.from(e);if("object"===dr(e))return Buffer.from(JSON.stringify(e),"utf8");throw new Gr("cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies")}},{key:"_getAccessToken",value:(W=Or(br().m(function e(){var t;return br().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 W.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(X=Or(br().m(function e(t){var n,r,o,i,s,a,u,c,l,f;return br().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:l=e.v,e.n=4;break;case 3:l=!!o.canRefresh;case 4:if(l&&"function"==typeof o.refreshAccessToken&&ho(r.data)){e.n=5;break}return e.a(2,t);case 5:if(!this._requestSigner){e.n=6;break}if(i=t.headers||{},(s="function"==typeof i.get?i.get("WWW-Authenticate"):i["WWW-Authenticate"]||i["www-authenticate"])&&s.includes("invalid_token")){e.n=6;break}return e.a(2,t);case 6:if(null===(n=yo(r.headers))||void 0===n){e.n=7;break}f=n,e.n=9;break;case 7:return e.n=8,this._getAccessToken();case 8:f=e.v;case 9:return a=f,e.n=10,o.refreshAccessToken(a);case 10:if("string"==typeof(u=e.v)&&u.trim()){e.n=11;break}return e.a(2,t);case 11:if(r.__appmeshRetried=!0,c="Bearer ".concat(u.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(zr.HTTP_HEADER_KEY_AUTH,c):r.headers=wr(wr({},r.headers),{},_r({},zr.HTTP_HEADER_KEY_AUTH,c)),!this._requestSigner){e.n=12;break}return e.n=12,this._applyRequestSignature(r);case 12:return e.a(2,this._client(r))}},e,this)})),function(e){return X.apply(this,arguments)})},{key:"getAuthConfig",value:(z=Or(br().m(function e(){return br().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 z.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(M=Or(br().m(function e(){return br().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 M.apply(this,arguments)})},{key:"listApps",value:(H=Or(br().m(function e(){var t;return br().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 H.apply(this,arguments)})},{key:"getApp",value:(q=Or(br().m(function e(t){var n;return br().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 q.apply(this,arguments)})},{key:"checkAppHealth",value:(B=Or(br().m(function e(t){var n;return br().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 B.apply(this,arguments)})},{key:"addApp",value:(I=Or(br().m(function e(t,n){var r;return br().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 I.apply(this,arguments)})},{key:"deleteApp",value:(F=Or(br().m(function e(t){var n,r;return br().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 F.apply(this,arguments)})},{key:"enableApp",value:(L=Or(br().m(function e(t){return br().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 L.apply(this,arguments)})},{key:"disableApp",value:(D=Or(br().m(function e(t){return br().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 D.apply(this,arguments)})},{key:"getAppOutput",value:(x=Or(br().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p=arguments;return br().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:Zr(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,u=eo(a.headers,zr.HTTP_HEADER_KEY_X_OUTPUT_POSITION),c=eo(a.headers,zr.HTTP_HEADER_KEY_X_EXIT_CODE),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new So(a.status,a.data,l,f))}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"runAppSync",value:(U=Or(br().m(function e(t){var n,r,o,i,s,a,u,c=arguments;return br().w(function(e){for(;;)switch(e.n){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:Qr,r=c.length>2&&void 0!==c[2]?c[2]:zr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=c.length>3&&void 0!==c[3]?c[3]:zr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i={timeout:Zr(r),lifecycle:Zr(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:i});case 1:return s=e.v,a=null,n&&n(s.data,0),200===s.status&&(u=eo(s.headers,zr.HTTP_HEADER_KEY_X_EXIT_CODE))&&(a=parseInt(u,10)),e.a(2,a)}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"runAppAsync",value:(N=Or(br().m(function e(t){var n,r,o,i,s=arguments;return br().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:zr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:zr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:Zr(n),lifecycle:Zr(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new ko(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"waitForAsyncRun",value:(C=Or(br().m(function e(t){var n,r,o,i,s,a,u=arguments;return br().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:Qr,r=u.length>2&&void 0!==u[2]?u[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.getAppOutput(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.deleteApp(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 C.apply(this,arguments)})},{key:"runTask",value:(j=Or(br().m(function e(t,n){var r,o,i=arguments;return br().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 j.apply(this,arguments)})},{key:"cancelTask",value:(A=Or(br().m(function e(t){return br().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 A.apply(this,arguments)})},{key:"followOutput",value:function(e){var t=this;return Dr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return br().m(function r(){var o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,k,R,T;return br().w(function(r){for(;;)switch(r.p=r.n){case 0:return o=n.stdoutPosition,i=void 0===o?0:o,s=n.processUuid,a=void 0===s?"":s,u=n.follow,c=void 0===u||u,l=n.timeout,f=void 0===l?3600:l,p={stdout_position:String(i),follow:c?"true":"false",timeout:String(f)},a&&(p.process_uuid=a),r.n=1,xr(t._sseRequest("get","/appmesh/app/".concat(e,"/output/stream"),{params:p}));case 1:h=r.v,d=null,r.p=2,y=!1,m=!1,r.p=3,v=Ir(go(h.data));case 4:return r.n=5,xr(v.next());case 5:if(!(y=!(g=r.v).done)){r.n=9;break}if(w=yr(g.value,2),_=w[0],E=w[1],"stdout"!==_){r.n=7;break}return r.n=6,String(null!==(O=E.output)&&void 0!==O?O:"");case 6:r.n=8;break;case 7:if("end"!==_){r.n=8;break}return d=_o(E),r.a(3,9);case 8:y=!1,r.n=4;break;case 9:r.n=11;break;case 10:r.p=10,R=r.v,m=!0,b=R;case 11:if(r.p=11,r.p=12,!y||null==v.return){r.n=13;break}return r.n=13,xr(v.return());case 13:if(r.p=13,!m){r.n=14;break}throw b;case 14:return r.f(13);case 15:return r.f(11);case 16:r.n=18;break;case 17:throw r.p=17,T=r.v,t.onError(T);case 18:return r.p=18,null===(S=h.data)||void 0===S||null===(k=S.destroy)||void 0===k||k.call(S),r.f(18);case 19:return null===d&&(d=new vo("closed")),Eo(d),r.a(2,d)}},r,null,[[12,,13,15],[3,10,11,16],[2,17,18,19]])})()}).apply(this,arguments)}},{key:"runTaskStream",value:function(e,t){var n=this;return Dr(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return br().m(function o(){var i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S;return br().w(function(o){for(;;)switch(o.p=o.n){case 0:return i=r.timeout,a=(s=void 0===i?300:i)&&s>0?{timeout:String(s)}:{},o.n=1,xr(n._sseRequest("post","/appmesh/app/".concat(e,"/task/stream"),{params:a,body:t}));case 1:u=o.v,c=null,l=null,o.p=2,f=!1,p=!1,o.p=3,d=Ir(go(u.data));case 4:return o.n=5,xr(d.next());case 5:if(!(f=!(y=o.v).done)){o.n=10;break}if(m=yr(y.value,2),b=m[0],v=m[1],"partial"!==b){o.n=7;break}return o.n=6,String(null!==(g=v.data)&&void 0!==g?g:"");case 6:o.n=9;break;case 7:if("final"!==b){o.n=8;break}l=null!==(w=v.result)&&void 0!==w?w:null,o.n=9;break;case 8:if("end"!==b){o.n=9;break}return c=_o(v,{result:l}),o.a(3,10);case 9:f=!1,o.n=4;break;case 10:o.n=12;break;case 11:o.p=11,O=o.v,p=!0,h=O;case 12:if(o.p=12,o.p=13,!f||null==d.return){o.n=14;break}return o.n=14,xr(d.return());case 14:if(o.p=14,!p){o.n=15;break}throw h;case 15:return o.f(14);case 16:return o.f(12);case 17:o.n=19;break;case 18:throw o.p=18,S=o.v,n.onError(S);case 19:return o.p=19,null===(_=u.data)||void 0===_||null===(E=_.destroy)||void 0===E||E.call(_),o.f(19);case 20:return null===c&&(c=new vo("closed",{result:l})),Eo(c),o.a(2,c)}},o,null,[[13,,14,16],[3,11,12,17],[2,18,19,20]])})()}).apply(this,arguments)}},{key:"streamRun",value:function(e){var t=this;return Dr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS;return br().m(function o(){var i,s,a,u,c;return br().w(function(o){for(;;)switch(o.p=o.n){case 0:return i="string"==typeof e?{command:e,shell:!0}:e,o.n=1,xr(t.runAppAsync(i,n,r));case 1:return s=o.v,o.p=2,u=t.followOutput(s.appName,{processUuid:s.procUid,follow:!0,timeout:Math.max(Zr(n),Zr(r))}),o.n=3,xr(u.next());case 3:c=o.v;case 4:if(c.done){o.n=7;break}return o.n=5,c.value;case 5:return o.n=6,xr(u.next());case 6:c=o.v,o.n=4;break;case 7:a=c.value;case 8:return o.p=8,o.p=9,o.n=10,xr(t.deleteApp(s.appName));case 10:o.n=12;break;case 11:o.p=11,o.v;case 12:return o.f(8);case 13:return o.a(2,a)}},o,null,[[9,11],[2,,8,13]])})()}).apply(this,arguments)}},{key:"sendInput",value:(P=Or(br().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h=arguments;return br().w(function(e){for(;;)switch(e.n){case 0:return s=(i=h.length>2&&void 0!==h[2]?h[2]:{}).close,a=void 0!==s&&s,u=i.processUuid,c=void 0===u?"":u,l=a?_r({},zr.HTTP_HEADER_KEY_X_INPUT_CLOSE,"true"):{},f=c?{process_uuid:c}:{},e.n=1,this._request("post","/appmesh/app/".concat(t,"/input"),n,{headers:l,params:f});case 1:return p=e.v,e.a(2,parseInt(null!==(r=null===(o=p.data)||void 0===o?void 0:o.bytes_written)&&void 0!==r?r:0,10))}},e,this)})),function(e,t){return P.apply(this,arguments)})},{key:"downloadFile",value:(T=Or(br().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,k,R,T,P,A=arguments;return br().w(function(e){for(;;)switch(e.p=e.n){case 0:return a=A.length>2&&void 0!==A[2]&&A[2],(s=A.length>1&&void 0!==A[1]?A[1]:null)||(s=t.split(/[\\/]/).pop()),u=_r({},zr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:u,config:{responseType:Xr.isNode?"stream":"arraybuffer"}});case 1:if(c=e.v,l=Xr.isNode?"":c.data,200!==c.status||null!==(r=c.headers)&&void 0!==r&&r["content-disposition"]||!String(null!==(o=null===(i=c.headers)||void 0===i?void 0:i["content-type"])&&void 0!==o?o:"").toLowerCase().includes("json")){e.n=2;break}throw Xr.isNode&&c.data.destroy(),new Gr("File download is not supported by this server surface: ".concat(t),c.status,l);case 2:if(200===c.status){e.n=3;break}throw new Gr("Failed to download file: ".concat(t),c.status,l);case 3:if(!Xr.isNode){e.n=20;break}return e.n=4,n.e(603).then(()=>n.t(603,19));case 4:return f=e.v,e.n=5,n.e(582).then(()=>n.t(582,19));case 5:return p=e.v,h=p.promisify,R=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=R(e.v.pipeline),y=f.promises,e.p=7,e.n=8,d(c.data,f.createWriteStream(s));case 8:if(!a||"win32"===process.platform){e.n=17;break}if(m=c.headers,e.p=9,!(b=m["x-file-mode"])){e.n=12;break}if(v=parseInt(b,10),!(Number.isInteger(v)&&v>=0&&v<=511)){e.n=11;break}return e.n=10,y.chmod(s,v);case 10:e.n=12;break;case 11:console.warn("Warning: Invalid x-file-mode value:",b);case 12:if(g=m["x-file-user"],w=m["x-file-group"],!g||!w){e.n=15;break}return e.n=13,no(g);case 13:return _=e.v,e.n=14,oo(w);case 14:if(E=e.v,null===_||null===E){e.n=15;break}return e.n=15,y.chown(s,_,E);case 15:e.n=17;break;case 16:e.p=16,T=e.v,console.warn("Warning: Unable to apply file attributes to",s,T.message);case 17:e.n=19;break;case 18:throw e.p=18,P=e.v,new Gr("Failed to write file to ".concat(s,": ").concat(P.message),c.status);case 19:e.n=21;break;case 20:O=new Blob([c.data]),S=window.URL.createObjectURL(O),(k=document.createElement("a")).style.display="none",k.href=S,k.download=s.split("/").pop(),document.body.appendChild(k),k.click(),window.URL.revokeObjectURL(S),document.body.removeChild(k);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return T.apply(this,arguments)})},{key:"uploadFile",value:(R=Or(br().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b=arguments;return br().w(function(e){for(;;)switch(e.n){case 0:if(s=b.length>2&&void 0!==b[2]&&b[2],a=b.length>3&&void 0!==b[3]&&b[3],i=b.length>1&&void 0!==b[1]?b[1]:null){e.n=2;break}if(u="string"==typeof t?t:t&&t.name){e.n=1;break}throw new Gr("filePath is required when localFile is a Blob without a name");case 1:i=u.split(/[\\/]/).pop();case 2:if(c=_r({},zr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),a&&(c[zr.HTTP_HEADER_KEY_X_FILE_OVERWRITE]="true"),!Xr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(f=e.v,p=f.statSync(t),!s){e.n=6;break}return c["X-File-Mode"]=(511&p.mode).toString(),e.n=4,uo(p.uid);case 4:return h=e.v,e.n=5,lo(p.gid);case 5:d=e.v,c["X-File-User"]=h||String(p.uid),c["X-File-Group"]=d||String(p.gid);case 6:l=p.size<10485760?f.readFileSync(t):f.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}l=t,e.n=9;break;case 8:throw new Gr("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",l,{headers:c,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(y=e.v).status||201===y.status){e.n=11;break}throw new Gr("Failed to upload file: ".concat(i),y.status,y.data);case 11:if(m=String(null!==(r=null===(o=y.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===y.status&&m.includes("json")&&y.data&&"object"===dr(y.data)&&"message"in y.data)){e.n=12;break}throw new Gr("File upload is not supported by this server surface: ".concat(i),y.status,y.data);case 12:return e.a(2)}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"getHostResources",value:(k=Or(br().m(function e(){var t;return br().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 k.apply(this,arguments)})},{key:"getConfig",value:(S=Or(br().m(function e(){var t;return br().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 S.apply(this,arguments)})},{key:"setConfig",value:(O=Or(br().m(function e(t){var n;return br().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 O.apply(this,arguments)})},{key:"setLogLevel",value:(E=Or(br().m(function e(){var t,n,r=arguments;return br().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.setConfig({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"addLabel",value:(_=Or(br().m(function e(t,n){return br().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 _.apply(this,arguments)})},{key:"deleteLabel",value:(w=Or(br().m(function e(t){return br().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 w.apply(this,arguments)})},{key:"listLabels",value:(g=Or(br().m(function e(){var t;return br().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 g.apply(this,arguments)})},{key:"listPrincipals",value:(v=Or(br().m(function e(){return br().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 v.apply(this,arguments)})},{key:"updatePrincipal",value:(b=Or(br().m(function e(t,n){return br().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 b.apply(this,arguments)})},{key:"deletePrincipal",value:(m=Or(br().m(function e(t){return br().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 m.apply(this,arguments)})},{key:"getCurrentUser",value:(y=Or(br().m(function e(){return br().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return y.apply(this,arguments)})},{key:"listPermissions",value:(d=Or(br().m(function e(){var t;return br().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 d.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(h=Or(br().m(function e(){var t;return br().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 h.apply(this,arguments)})},{key:"getUserPermissions",value:(p=Or(br().m(function e(){return br().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return p.apply(this,arguments)})},{key:"listRoles",value:(f=Or(br().m(function e(){var t;return br().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 f.apply(this,arguments)})},{key:"updateRole",value:(l=Or(br().m(function e(t,n){return br().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 l.apply(this,arguments)})},{key:"deleteRole",value:(c=Or(br().m(function e(t){return br().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 c.apply(this,arguments)})},{key:"getMetrics",value:(u=Or(br().m(function e(){var t;return br().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 u.apply(this,arguments)})},{key:"subscribe",value:(a=Or(br().m(function e(){return br().w(function(e){for(;;)switch(e.n){case 0:throw new Gr("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 a.apply(this,arguments)})},{key:"unsubscribe",value:(s=Or(br().m(function e(){return br().w(function(e){for(;;)switch(e.n){case 0:throw new Gr("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 s.apply(this,arguments)})},{key:"request",value:(i=Or(br().m(function e(t,n){var r,o,i=arguments;return br().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 i.apply(this,arguments)})},{key:"_commonHeaders",value:(o=Or(br().m(function e(){var t,n;return br().w(function(e){for(;;)switch(e.n){case 0:return t={},Xr.isNode&&(t[zr.HTTP_USER_AGENT_HEADER_NAME]=zr.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[zr.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[zr.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_request",value:(r=Or(br().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return br().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},e.n=1,this._ensureHttpsAgent();case 1:if(i=o.headers,s=void 0===i?{}:i,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=2,f=wr(wr({method:t,url:n,withCredentials:!1},l),{},{headers:wr({},s),params:wr({},u)}),null!==r&&(f.data=r),!this._requestSigner){e.n=3;break}return e.n=3,this._applyRequestSignature(f);case 3:return 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 Gr(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,[[2,6]])})),function(e,t){return r.apply(this,arguments)})},{key:"_ensureHttpsAgent",value:(t=Or(br().m(function e(){return br().w(function(e){for(;;)switch(e.n){case 0:if(!Xr.isNode||!Mr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Mr;case 1:qr&&(this._client.defaults.httpsAgent=new qr.Agent(wr(wr({},bo(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_sseRequest",value:(e=Or(br().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E=arguments;return br().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=E.length>2&&void 0!==E[2]?E[2]:{},e.n=1,this._ensureHttpsAgent();case 1:if(o=r.params,i=void 0===o?{}:o,s=r.headers,a=void 0===s?{}:s,u=r.body,c={method:t,url:n,withCredentials:!1,responseType:"stream",timeout:0,headers:wr({},a),params:wr({},i)},null!=u&&(c.data=u),!this._requestSigner){e.n=2;break}return e.n=2,this._applyRequestSignature(c);case 2:return e.p=2,e.n=3,this._client(c);case 3:l=e.v,e.n=5;break;case 4:throw e.p=4,w=e.v,this.onError(w);case 5:if(200===l.status){e.n=21;break}f="",e.p=6,p=[],h=!1,d=!1,e.p=7,m=Ir(l.data);case 8:return e.n=9,m.next();case 9:if(!(h=!(b=e.v).done)){e.n=11;break}v=b.value,p.push(v);case 10:h=!1,e.n=8;break;case 11:e.n=13;break;case 12:e.p=12,_=e.v,d=!0,y=_;case 13:if(e.p=13,e.p=14,!h||null==m.return){e.n=15;break}return e.n=15,m.return();case 15:if(e.p=15,!d){e.n=16;break}throw y;case 16:return e.f(15);case 17:return e.f(13);case 18:f=Buffer.concat(p).toString("utf8"),e.n=20;break;case 19:e.p=19,e.v;case 20:throw g=f?this._extractErrorMessage(f):"SSE request failed with status ".concat(l.status),new Gr(g,l.status,f||null);case 21:return e.a(2,l)}},e,this,[[14,,15,17],[7,12,13,18],[6,19],[2,4]])})),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"===dr(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof Gr?e:new Gr(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,k,R,T,P,A,j,C,N,U,x,D,L,F,I,B,q,H,M,z,X,W,K}(),So=kr(function e(t,n,r,o){Tr(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),ko=function(){return kr(function e(t,n,r){Tr(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"withForwardingHost",value:(t=Or(br().m(function e(t){var n;return br().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=Or(br().m(function e(){var t,n,r=this,o=arguments;return br().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:Qr,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.withForwardingHost(function(){return r._client.waitForAsyncRun(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Ro=Oo;export{Oo as AppMeshClient,Gr as AppMeshError,Yr as AppMeshRequestError,Vr as AppMeshTimeoutError,So as AppOutput,$r as AppRemovedError,ko as AppRun,zr as CONSTANTS,po as DEFAULT_CA_FILE,Hn as RefreshTokenProvider,ar as RequestSigner,vo as SseEnd,Nn as StaticAccessTokenProvider,Jr as TransportDisconnectedError,oo as _resolveGid,lo as _resolveGroupName,no as _resolveUid,uo as _resolveUserName,Ro 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=Object.create(null);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.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),582:()=>import("./582.appmesh.esm.js"),770:()=>import("./770.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,u=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);u<r.length;u++)a=r[u],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{const n=Promise.race([e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e}),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:()=>He,hasStandardBrowserEnv:()=>Me,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>qe,origin:()=>Xe});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({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(c(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,v=m("undefined");function g(e){return null!==e&&!v(e)&&null!==e.constructor&&!v(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w=y("ArrayBuffer");const _=m("string"),E=m("function"),O=m("number"),S=e=>null!==e&&"object"==typeof e,T=e=>{if(!S(e))return!1;const t=s(e);return(null===t||t===Object.prototype||null===s(t))&&(f(e,t,!0)||!c(e,u)&&!c(e,a))},R=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,U=y("URLSearchParams"),[x,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(g(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)}}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,H=e=>!v(e)&&e!==I;const q=(M="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>M&&e instanceof M);var M;const z=y("HTMLFormElement"),{propertyIsEnumerable:X}=Object.prototype,K=y("RegExp"),W=(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 Y=y("AsyncFunction"),G=($="function"==typeof setImmediate,J=E(I.postMessage),$?setImmediate:J?(V=`axios@${Math.random()}`,Q=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===V&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),I.postMessage(V,"*")}):e=>setTimeout(e));var $,J,V,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||G,ee=e=>null!=e&&E(e[a]),te={isArray:b,isArrayBuffer:w,isBuffer:g,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&&w(e.buffer),t},isString:_,isNumber:O,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:T,isEmptyObject:e=>{if(!S(e)||g(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:v,isDate:R,isFile:k,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:P,isRegExp:K,isFunction:E,isStream:e=>S(e)&&E(e.pipe),isURLSearchParams:U,isTypedArray:q,isFileList:A,forEach:B,merge:function e(...t){const{caseless:n,skipUndefined:r}=H(this)&&this||{},o={},i=n?Object.create(null):null,s=(t,n)=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;let s=n;if(i&&"string"==typeof n){const e=n.toLowerCase(),t=i[e];void 0!==t&&c(o,t)?s=t:i[e]=n}const a=c(o,s)?o[s]:void 0;T(a)&&T(t)?o[s]=e(a,t):T(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&v(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||g(n))continue;if(B(n,s),"object"!=typeof n||b(n)||!Object.getOwnPropertySymbols)continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];X.call(n,t)&&s(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 u={};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)||u[a]||(t[a]=e[a],u[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(!Number.isSafeInteger(t)||t<0||t>4294967295)return null;const n=new Set,r=new Set;let o=e;for(;null!=o&&n.size<t;){if(r.has(o))return null;r.add(o);const i=s(o);if(f(o,i,o===e))break;Object.getOwnPropertyNames(o).forEach(e=>{const r=+e;Number.isInteger(r)&&r>=0&&r<t&&String(r)===e&&c(o,e)&&n.add(r)}),o=i}if(n.size!==t)return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},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:z,hasOwnProperty:c,hasOwnProp:c,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 u=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&u.push(...Object.getOwnPropertySymbols(i));for(const t of u)l(t)||c(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:W,freezeMethods:e=>{W(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:function(e,t){if(g(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},global:I,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(g(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);!v(e)&&r.push(e)}}else r=b(e)?[]:{},B(e,(e,t)=>{const o=n(e);!v(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:Y,isThenable:e=>e&&(S(e)||E(e))&&E(e.then)&&E(e.catch),setImmediate:G,asap:Z,isIterable:ee,isSafeIterable:e=>null!=e&&p(e,a)&&ee(e)},ne=te.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 re=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),oe=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ie(e,t){return te.isArray(e)?e.map(e=>ie(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 se(e){const t=Object.create(null);return te.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>ie(e,oe))(e)}),t}const ae=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:te.isArray(e)?e.map(ce):(e=>ie(e,re))(String(e))}const le=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function fe(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)}const pe=e=>"__proto__"===e?"__Proto__":e;function he(e,t,n,r,o){return te.isFunction(r)?r.call(e,t,n):(o&&(t=n),te.isString(t)?te.isString(r)?-1!==t.indexOf(r):te.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=te.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[pe(i||t)]=ce(e))}const i=(e,t)=>te.forEach(e,(e,n)=>o(e,n,t));if(te.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(te.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t=Object.create(null);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=te.hasOwnProp(t,n);!n||i&&te.hasOwnProp(ne,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(te.isObject(e)&&te.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!te.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],te.hasOwnProp(o,r)?(n=o[r],o[r]=te.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=te.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(te.isFunction(t))return t.call(this,e,n);if(te.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=te.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(this,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=te.findKey(n,e);!o||t&&!he(n,n[o],o,t)||(delete n[o],r=!0)}}return te.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(this,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n=Object.create(null);return te.forEach(this,(r,o)=>{const i=te.findKey(n,o);if(i)return t[i]=ce(r),void delete t[o];const s=pe(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]=ce(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return te.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&te.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 te.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=fe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=fe(o.slice(0,i));if(!le.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const u=fe(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}(u)}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[ae]=this[ae]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=te.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 te.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),te.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(te.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ye&&(e=e.toJSON()),r.push(e),te.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);te.isUndefined(r)||(t[n]=r)});else{if(!te.isPlainObject(e)&&function(e){if(te.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(te.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);te.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function ve(e){try{return String(e)}catch(e){return""}}const ge=Symbol("causeStack");class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&te.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?ve(e.message):ve(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,function(e,t){try{const n=t&&t.stack;if("string"!=typeof n||!n)return;const r=e.stack;if("string"!=typeof r||!r)return;const o="\nCaused by: "+n;e.stack=r+o,Object.defineProperty(e,ge,{__proto__:null,value:o})}catch(e){}}(a,e),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&&te.hasOwnProp(e,"redact")?e.redact:void 0,n=te.isArray(t)&&t.length>0?be(e,t):te.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 _e=we;function Ee(e){return te.isPlainObject(e)||te.isArray(e)}function Oe(e){return te.endsWith(e,"[]")?e.slice(0,-2):e}function Se(e,t,n){return e?e.concat(t).map(function(e,t){return e=Oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Te=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Re=function(e,t,n){if(!te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=te.getSafeProp(n,e);return te.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||d,s=r("dots",!1),a=r("indexes",!1),u=r("Blob")||"undefined"!=typeof Blob&&Blob,c=r("maxDepth",100),l=u&&te.isSpecCompliantForm(t),f=[];if(!te.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(te.isDate(e))return e.toISOString();if(te.isBoolean(e))return e.toString();if(!l&&te.isBlob(e))throw new _e("Blob is not supported. Use a Buffer instead.");if(te.isArrayBuffer(e)||te.isTypedArray(e)){if(l&&"function"==typeof u)return new u([e]);throw new _e("Blob is not supported. Use a Buffer instead.",_e.ERR_NOT_SUPPORT)}return e}function h(e){if(e>c)throw new _e("Object is too deeply nested ("+e+" levels). Max depth: "+c,_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function d(e,n,r){let i=e;if(te.isReactNative(t)&&te.isReactNativeBlob(e))return t.append(Se(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(te.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(c===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!te.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(te.isArray(e)&&function(e){return te.isArray(e)&&!e.some(Ee)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Oe(n),i.forEach(function(e,r){!te.isUndefined(e)&&null!==e&&t.append(!0===a?Se([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!Ee(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(Te,{defaultVisitor:d,convertValue:p,isVisitable:Ee});if(!te.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!te.isUndefined(n)){if(h(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),te.forEach(n,function(n,s){!0===(!(te.isUndefined(n)||null===n)&&i.call(t,n,te.isString(s)?s.trim():s,r,y))&&e(n,r?r.concat(s):[s],o+1)}),f.pop()}}(e),t};function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Pe(e,t){this._pairs=[],e&&Re(e,this,t)}const Ae=Pe.prototype;Ae.append=function(e,t){this._pairs.push([e,t])},Ae.toString=function(e){const t=e?t=>e.call(this,t,ke):ke;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const je=Pe;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ne(e,t,n){if(!t)return e;e=e||"";const r=te.isFunction(n)?{serialize:n}:n,o=te.getSafeProp(r,"encode")||Ce,i=te.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):te.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 Ue=Symbol("internals");function xe(e){return e?e.length:0}function De(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Le(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 Fe=class{constructor(){this.handlers=[],this[Ue]={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[Ue];null==this.handlers&&(this.handlers=[]),Le(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[Ue];Le(this,t);const n=function(e){return"string"==typeof e&&""!==e&&String(Number(e))===e?Number(e):e}(e),r=t.handlerEntries.get(n);if(r){if(t.handlerEntries.delete(n),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,t.iterationDepth||(De(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Le(this,this[Ue]))}forEach(e){const t=this[Ue];Le(this,t),t.iterationDepth++;try{te.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Le(this,t),De(this.handlers),t.handlersLength=xe(this.handlers))}}},Be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0,encodeBasicAuthUsername:!1},Ie={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"]},He="undefined"!=typeof window&&"undefined"!=typeof document,qe="object"==typeof navigator&&navigator||void 0,Me=He&&(!qe||["ReactNative","NativeScript","NS"].indexOf(qe.product)<0),ze="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Xe=He&&window.location.href||"http://localhost",Ke={...r,...Ie};function We(e){if(e>100)throw new _e("FormData field is too deeply nested ("+e+" levels). Max depth: 100",_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ye(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}function Ge(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Ye(e):e}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&&te.isArray(r)?r.length:i,a)return te.hasOwnProp(r,i)?(r[i]=Ge(r[i]),r[i]=te.isArray(r[i])?r[i].concat(n):[r[i],n]):r[i]=n,!s;te.hasOwnProp(r,i)&&te.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&te.isArray(r[i])&&(r[i]=Ye(r[i])),!s}if(te.isFormData(e)&&te.isFunction(e.entries)){const n={};return te.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)}),function(e){const t=[e];for(;t.length;){const e=t.pop();Object.keys(e).forEach(n=>{const r=e[n]=Ge(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Je=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ve=(e,t)=>null!=e&&te.hasOwnProp(e,t)?e[t]:void 0;const Qe={transitional:Be,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=te.isObject(e);o&&te.isHTMLForm(e)&&(e=new FormData(e));if(te.isFormData(e))return r?JSON.stringify($e(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ve(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Re(e,new Ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ke.isNode&&te.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ve(this,"env"),r=n&&n.FormData;return Re(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(te.isString(e))try{return(t||JSON.parse)(e),te.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ve(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ve(this,"responseType"),o="json"===r;if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ve(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ve(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ke.classes.FormData,Blob:Ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(Je,e=>{Qe.headers[e]={}});const Ze=Qe;function et(e,t){const n=this||Ze,r=t||n,o=ye.from(r.headers);let i=r.data;return te.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function tt(e){return!(!e||!e.__CANCEL__)}const nt=class extends _e{constructor(e,t,n){super(e??"canceled",_e.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function rt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new _e("Request failed with status code "+n.status,n.status>=400&&n.status<500?_e.ERR_BAD_REQUEST:_e.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ot=/[\t\n\r]/g;function it(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(ot,"")}function st(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1].toLowerCase()||""}const at=e=>{try{return decodeURIComponent(e)}catch(t){return e}},ut=Ke.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];te.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),te.isString(r)&&a.push(`path=${r}`),te.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),te.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie;if(!t)return null;const n=t.split(";");for(let t=0;t<n.length;t++){const r=n[t].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)return at(r.slice(o+1))}return null},async readAsync(e){try{const t="undefined"!=typeof window&&window.cookieStore;if(t&&te.isFunction(t.get)){const n=await t.get(e);return n?at(n.value):null}}catch(e){}return this.read(e)},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,readAsync:async()=>null,remove(){}};const ct=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 u=Date.now(),c=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const lt=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)]},ft=(e,t,n=3)=>{let r=0;const o=ct(50,250);return lt(n=>{if(!n||!te.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),u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:u,rate:c||void 0,estimated:c&&s?(s-a)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ht=(e,t=te.asap)=>(...n)=>t(()=>e(...n)),dt=Ke.hasStandardBrowserEnv?(e=>t=>(t=new URL(t,document.baseURI||Ke.origin),e.protocol===t.protocol&&e.host===t.host&&e.port===t.port))(new URL(Ke.origin)):()=>!0;const yt=/^https?:(?!\/\/)/i;function mt(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 bt(e,t){if("string"==typeof e){const n=it(e);if(yt.test(n))throw new _e(`Invalid URL ${JSON.stringify(mt(n))}: missing "//" after protocol`,_e.ERR_INVALID_URL,t)}}function vt(e,t,n,r){bt(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(bt(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 gt=e=>e instanceof ye?{...e}:e,wt=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>{const n=Object.getOwnPropertyDescriptor(e,t);return n&&n.enumerable})):Object.keys(e);function _t(e,t,n,r){return te.isPlainObject(e)&&te.isPlainObject(t)?te.merge.call({caseless:r},e,t):te.isPlainObject(t)?te.merge({},t):te.isArray(t)?t.slice():t}function Et(e,t,n,r){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e,0,r):_t(e,t,0,r)}function Ot(e,t){if(!te.isUndefined(t))return _t(void 0,t)}function St(e,t){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e):_t(void 0,t)}function Tt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Rt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),kt={url:Ot,method:Ot,data:Ot,baseURL:St,transformRequest:St,transformResponse:St,params:function(e,t){const n=[],r=new WeakMap,o={};function i(e,t){if(!te.isPlainObject(t))return te.isArray(t)?t.slice():t;const i=te.isPlainObject(e)?e:o;let s=r.get(t);if(s||(s=new WeakMap,r.set(t,s)),s.has(i))return s.get(i);const a={};return s.set(i,a),n.push({base:i,source:t,result:a}),a}const s=te.isUndefined(t)?i(void 0,e):i(e,t);for(;n.length;){const{base:e,source:t,result:r}=n.pop(),o=new Set(wt(e)),s=new Set(wt(t));new Set([...o,...s]).forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;const a=s.has(n),u=a?t[n]:void 0,c=a&&!te.isPlainObject(u)||!o.has(n)?void 0:e[n];r[n]=a?i(c,u):i(void 0,c)})}return function(e){const t=[{value:e}],n=new WeakSet,r=new WeakSet;for(;t.length;){const{value:e,done:o}=t.pop();if(!te.isPlainObject(e)&&!te.isArray(e))continue;if(o){n.delete(e);continue}if(n.has(e))throw new _e("Circular reference detected in params",_e.ERR_BAD_OPTION_VALUE);if(r.has(e))continue;r.add(e),n.add(e),t.push({value:e,done:!0});const i=Object.keys(e);Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertySymbols(e).forEach(t=>{const n=Object.getOwnPropertyDescriptor(e,t);n&&n.enumerable&&i.push(t)}),i.forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n){const r=Object.getOwnPropertyDescriptor(e,n);r&&te.hasOwnProp(r,"value")&&t.push({value:r.value})}else t.push({value:e[n]})})}}(s),s},paramsSerializer:St,timeout:St,timeoutErrorMessage:St,withCredentials:St,withXSRFToken:St,adapter:St,responseType:St,xsrfCookieName:St,xsrfHeaderName:St,onUploadProgress:St,onDownloadProgress:St,decompress:St,maxContentLength:St,maxBodyLength:St,beforeRedirect:St,transport:St,httpAgent:St,httpsAgent:St,cancelToken:St,socketPath:St,allowedSocketPaths:St,responseEncoding:St,validateStatus:Tt,headers:function(e,t,n){return Et(gt(e),gt(t),0,!0)}};function Pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Rt);const r=wt({...e,...t});for(let o=0,i=r.length;o<i;o++){const i=r[o];if("__proto__"===i||"constructor"===i||"prototype"===i)continue;const s=te.hasOwnProp(kt,i)?kt[i]:Et,a=te.hasOwnProp(e,i)?e[i]:void 0,u=te.hasOwnProp(t,i)?t[i]:void 0,c=s===Tt?s(a,u,i,e,t):s(a,u,i);te.isUndefined(c)&&s!==Tt||(n[i]=c)}return te.hasOwnProp(t,"validateStatus")&&te.isUndefined(t.validateStatus)&&!1===function(e,t,n){const r=te.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!te.isUndefined(r)){if(!te.isPlainObject(r))return;if(te.hasOwnProp(r,n))return r[n]}const o=te.hasOwnProp(e,"transitional")?e.transitional:void 0;if(te.isPlainObject(o)&&te.hasOwnProp(o,n))return o[n]}(e,t,"validateStatusUndefinedResolves")&&(te.hasOwnProp(e,"validateStatus")?n.validateStatus=_t(void 0,e.validateStatus):delete n.validateStatus),n}const At=["content-type","content-length"];const jt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Ct=e=>ut.read(e);const Nt=function(e,t=Ct){const n=Pt({},e),r=e=>te.hasOwnProp(n,e)?n[e]:void 0,o=r("data");let i=r("withXSRFToken");const s=r("xsrfHeaderName"),a=r("xsrfCookieName");let u=r("headers");const c=r("auth"),l=r("baseURL"),f=r("allowAbsoluteUrls"),p=r("url");if(n.headers=u=ye.from(u),n.url=Ne(vt(l,p,f,n),r("params"),r("paramsSerializer")),c){const t=te.getSafeProp(c,"username")||"",n=te.getSafeProp(c,"password")||"",o=r("transitional"),i=o&&te.hasOwnProp(o,"encodeBasicAuthUsername")&&!0===o.encodeBasicAuthUsername;try{u.set("Authorization","Basic "+btoa((i?jt(t):t)+":"+(n?jt(n):"")))}catch(t){throw _e.from(t,_e.ERR_BAD_OPTION_VALUE,e)}}if(te.isFormData(o)){const e=te.getSafeProp(o,"getHeaders");Ke.hasStandardBrowserEnv||Ke.hasStandardBrowserWebWorkerEnv||te.isReactNative(o)?u.setContentType(void 0):te.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{At.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(u,e.call(o),r("formDataHeaderPolicy"))}if(Ke.hasStandardBrowserEnv){te.isFunction(i)&&(i=i(n));if(!0===i||null==i&&dt(n.url)){const e=s&&a&&t(a);e&&u.set(s,e)}}return n},Ut="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){let r,o;try{const e=Ke.hasStandardBrowserEnv&&"undefined"!=typeof window&&window.cookieStore;r=e&&te.isFunction(e.get)}catch(e){}const i=Nt(e,r?e=>(o=e,null):void 0);let s=i.data;const a=ye.from(i.headers).normalize();let u,c,l,f,p,h,d,{responseType:y,onUploadProgress:m,onDownloadProgress:b}=i;function v(){clearTimeout(c);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}g&&(f&&g.removeEventListener("progress",f),g.upload&&(l&&g.upload.removeEventListener("progress",l),p&&g.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(st(it(i.url))||st(Ke.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),void(g=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const o=ye.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());rt(function(e){t(e),v()},function(e){n(e),v()},{data:y&&"text"!==y&&"json"!==y?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:o,config:e,request:g}),g=null}if(g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,g);o.event=t||null,n(o),v(),g=null},g.ontimeout=function(){if(!g)return;let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||Be;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new _e(t,r.clarifyTimeoutError?_e.ETIMEDOUT:_e.ECONNABORTED,e,g)),v(),g=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),y&&"json"!==y&&(g.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),g.addEventListener("progress",f)),m&&g.upload&&([l,p]=ft(m),g.upload.addEventListener("progress",l),g.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(u=t=>{if(!g)return;n(!t||t.type?new nt(null,e,g):t);const r=g;v(),g=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(u),!g)return;i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u))}if(!g)return;const _=st(i.url);if(_&&!Ke.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void v();const E=()=>{g&&("setRequestHeader"in g&&te.forEach(se(a),function(e,t){g.setRequestHeader(t,e)}),g.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=g.timeout>0?t()+Number(g.timeout):void 0,s=()=>{if(!g)return;const e=g;e.ontimeout(),e.abort()};if(void 0!==r){const e=()=>{const n=r-t();n>0?c=setTimeout(e,Math.min(n,2147483647)):s()};e()}ut.readAsync(o).then(e=>{if(g)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}E()}}).catch(t=>{g&&(n(_e.from(t,null,e,g)),v(),g=null)})}else E()})},xt=(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 _e?t:new nt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new _e(`timeout of ${t}ms exceeded`,_e.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{const t=te.getSafeProp(e,"unsubscribe");te.isFunction(t)?t.call(e,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=()=>te.asap(s),a},Dt=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},Lt=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()}},Ft=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Lt(e))yield*Dt(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})},Bt="\r\n",It=e=>String(e).replace(/\r\n|\r|\n/g,Bt),Ht=e=>String(e).replace(/[\r\n"]/g,e=>"\r"===e?"%0D":"\n"===e?"%0A":"%22"),qt=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);!t||13!==o&&10!==o?o<128?n++:o<2048?n+=2:o>=55296&&o<=56319&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r++):n+=3:(13===o&&10===e.charCodeAt(r+1)&&r++,n+=2)}return n};class Mt extends TypeError{constructor(e,t){super(e),this.name="FormDataError",this.reason=t}}function zt(e,t,n,r,o){if(!te.isFunction(t))throw new _e("Blob is not supported",_e.ERR_NOT_SUPPORT);if(void 0===o)if(te.isFunction(Ke.generateString))o="axios-"+Ke.generateString(36,"0123456789abcdef");else{const e=te.global.crypto;if(!e||!te.isFunction(e.getRandomValues))throw new _e("Random byte generation is not supported",_e.ERR_NOT_SUPPORT);const t=new Uint8Array(18);e.getRandomValues(t),o="axios-"+Array.from(t,e=>("0"+e.toString(16)).slice(-2)).join("")}try{return function(e,t,n,r,o){if(!te.isFunction(t))throw new Mt("Blob is not supported","blob");if(!te.isString(o)||!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(o)||/ $/.test(o))throw new Mt("Invalid multipart boundary","boundary");const i="--"+o+"--"+Bt;let s=i.length;const a=[],u=e=>{if(s+e>n)throw r()};u(0);for(const[t,n]of e){const e=te.isString(n),r=e?qt(n,!0):n.size;if(!Number.isFinite(r)||r<0)throw new Mt("Unsupported FormData part size","part");u(r+qt(t,!0)+(!e&&n.name?qt(n.name,!1):0)+(!e&&n.type?qt(n.type,!1):0));let i="--"+o+'\r\nContent-Disposition: form-data; name="'+Ht(It(t))+'"';e||(i+='; filename="'+Ht(te.isString(n.name)?n.name:"blob")+'"\r\nContent-Type: '+String(n.type||"application/octet-stream").replace(/[\r\n]/g,"")),i+=Bt+Bt;const c=qt(i,!1)+r+2;u(c),s+=c,a.push({header:i,value:n,isString:e})}const c=[];for(const e of a)c.push(e.header,e.isString?It(e.value):e.value,Bt);return c.push(i),new t(c,{type:"multipart/form-data; boundary="+o})}(e,t,n,r,o)}catch(e){if(e instanceof Mt){const t="boundary"===e.reason?_e.ERR_BAD_OPTION_VALUE:_e.ERR_BAD_REQUEST;throw new _e(e.message,t)}throw e}}const Xt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kt=(e,t,n)=>t+2<n&&Xt(e.charCodeAt(t+1))&&Xt(e.charCodeAt(t+2)),Wt=e=>e<=57?e-48:(223&e)-55,Yt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Gt=e=>9===e||10===e||12===e||13===e||32===e,$t=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&&Kt(e,i,t)&&(s=16*Wt(e.charCodeAt(i+1))+Wt(e.charCodeAt(i+2)),i+=2),Gt(s)||(61!==s?!Yt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?$t(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Vt=(e,t,n)=>{if(!e||"string"!=typeof e)return 0;if(!/^data:/i.test(e))return 0;const r=e.indexOf(",");if(r<0)return 0;const o=e.slice(5,r),i=e.slice(r+1);if(n.test(o))return t(i);let s=0;for(let e=0,t=i.length;e<t;e++){const n=i.charCodeAt(e);if(37===n&&Kt(i,e,t))s+=1,e+=2;else if(n<128)s+=1;else if(n<2048)s+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(s+=4,e++):s+=3}else s+=3}return s};const Qt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Zt}=te,en=e=>{if(!te.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},tn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nn=e=>{const t=void 0!==te.global&&null!==te.global?te.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=te.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response,Blob:t.Blob},e);const o=te.hasOwnProp(e,"fetch")?e.fetch:void 0,{Request:i,Response:s,Blob:a}=e,u=o?Zt(o):"function"==typeof fetch,c=Zt(i),l=Zt(s);if(!u)return!1;const f=u&&Zt(n),p=u&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const d=c&&f&&tn(()=>{let e=!1;const t=new i(Ke.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}),y=l&&f&&tn(()=>te.isReadableStream(new s("").body)),m=Object.assign(Object.create(null),Qt);c&&!tn(()=>new i(Ke.origin,m))&&(delete m.cache,tn(()=>new i(Ke.origin,m))||(m.cache=Qt.cache));const b={stream:y&&(e=>e.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!b[e]&&(b[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new _e(`Response type '${e}' is not supported`,_e.ERR_NOT_SUPPORT,n)})});const v=async e=>null==e?0:te.isBlob(e)?e.size:te.isArrayBufferView(e)||te.isArrayBuffer(e)?e.byteLength:(te.isURLSearchParams(e)&&(e+=""),te.isString(e)?(await p(e)).byteLength:void 0);return async e=>{let{url:t,method:n,data:u,signal:l,cancelToken:p,timeout:h,onDownloadProgress:g,onUploadProgress:w,responseType:_,headers:E,withCredentials:O="same-origin",fetchOptions:S,maxContentLength:T,maxBodyLength:R,maxRedirects:k}=Nt(e);const P=te.isNumber(T)&&T>-1,A=te.isNumber(R)&&R>-1,j=t=>te.hasOwnProp(e,t)?e[t]:void 0;let C=o||fetch;_=_?(_+"").toLowerCase():"text";let N=xt([l,p&&p.toAbortSignal()],h),U=null;const x=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let D,L=null,F=null;const B=()=>new _e("Request body larger than maxBodyLength limit",_e.ERR_BAD_REQUEST,e,U);try{let o;const l=j("auth");if(l){const e=te.getSafeProp(l,"username")||"";o={username:e,password:te.getSafeProp(l,"password")||""}}let p;if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){if(p=new URL(t,Ke.origin),!o&&(p.username||p.password)){const e=en(p.username);o={username:e,password:en(p.password)}}(p.username||p.password)&&(p.username="",p.password="",t=p.href)}if(o&&(E.delete("authorization"),E.set("Authorization","Basic "+btoa((I=(o.username||"")+":"+(o.password||""),encodeURIComponent(I).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),P&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Vt(-1===t?e:e.slice(0,t),Jt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const h=te.isSpecCompliantForm(u)&&ye.from(j("headers")).getContentType();let H;if(te.isString(h)&&/^multipart\/form-data(?:\s*;|$)/i.test(h.trim())){const e=ye.parseParameters(h);te.hasOwnProp(e,"boundary")&&(H=e.boundary)}if(te.isSpecCompliantForm(u)&&"get"!==n&&"head"!==n&&(A||w&&d||void 0!==H)&&(u=zt(u,a,A?R:1/0,B,H),E.setContentType(void 0===H?u.type:h),D=u.size),A&&"get"!==n&&"head"!==n){const e=await v(u);if("number"==typeof e&&isFinite(e)&&(D=e,e>R))throw B()}const q=A&&(te.isReadableStream(u)||te.isStream(u)),M=(e,t,n)=>Ft(e,65536,e=>{if(A&&e>R)throw L=B();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(w||q)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??v(t)})(E,u),0!==D||q){let e,n=new i(t,{method:"POST",body:u,duplex:"half"});if(te.isFormData(u)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=w&&pt(D,ft(ht(w)))||[];u=M(n.body,e,t)}}}else if(q&&!c&&f&&"get"!==n&&"head"!==n)u=M(u);else if(q&&c&&!d&&"get"!==n&&"head"!==n)throw new _e("Stream request bodies are not supported by the current fetch implementation",_e.ERR_NOT_SUPPORT,e,U);te.isString(O)||(O=O?"include":"omit");const z=c&&"credentials"in i.prototype;if(te.isFormData(u)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/1.21.1",!1);const X=null==S?S:Object.assign(Object.create(null),S);X&&(delete X.body,delete X.headers,delete X.method,delete X.signal,delete X.duplex,delete X.credentials);const K=Object.assign(Object.create(null),X,{signal:N,method:n.toUpperCase(),headers:se(E.normalize()),body:u,duplex:"half",credentials:z?O:void 0});c&&(te.forEach(m,(e,t)=>{void 0===K[t]&&(K[t]=e)}),void 0===K.signal&&(K.signal=null),void 0===K.body&&(K.body=null)),0===k&&(K.redirect="manual",X&&(X.redirect="manual")),U=c&&new i(t,K);let W=await(c?C(U,X):C(t,K));const Y=ye.from(W.headers);if(P){const t=te.toFiniteNumber(Y.getContentLength());if(null!=t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const G=y&&("stream"===_||"response"===_);if(y&&W.body&&(g||P||G&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=W[e]});const n=te.toFiniteNumber(Y.getContentLength()),[r,o]=g&&pt(n,ft(ht(g),!0))||[];let i=0;const a=t=>{if(P&&(i=t,i>T))throw F=new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};W=new s(Ft(W.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let $=await b[te.findKey(b,_)||"text"](W,e);if(P&&!y&&!G){let t;if(null!=$&&("number"==typeof $.byteLength?t=$.byteLength:"number"==typeof $.size?t=$.size:"string"==typeof $&&(t="function"==typeof r?(new r).encode($).byteLength:$.length)),"number"==typeof t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!G&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:$,headers:ye.from(W.headers),status:W.status,statusText:W.statusText,config:e,request:U})})}catch(t){if(x&&x(),N&&N.aborted&&N.reason instanceof _e){const n=N.reason;throw n.config=e,U&&(n.request=U),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(L)throw U&&!L.request&&(L.request=U),L;if(F)throw F;if(t instanceof _e)throw U&&!t.request&&(t.request=U),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new _e("Network Error",_e.ERR_NETWORK,e,U,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw _e.from(t,t&&t.code,e,U,t&&t.response)}var I}},rn=new Map,on=e=>{const t=Object.create(null),n=e&&te.hasOwnProp(e,"env")&&e.env;["fetch","Request","Response","Blob"].forEach(e=>{n&&te.hasOwnProp(n,e)&&(t[e]=n[e])});const{fetch:r,Request:o,Response:i,Blob:s}=t,a=[o,i,r,s];let u,c,l=a.length,f=rn;for(;l--;)u=a[l],c=f.get(u),void 0===c&&f.set(u,c=l?new Map:nn(t)),f=c;return c},sn=(on(),{http:null,xhr:Ut,fetch:{get:on}});te.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const an=e=>`- ${e}`,un=e=>te.isFunction(e)||null===e||!1===e;const cn={getAdapter:function(e,t){e=te.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,!un(r)&&(o=sn[(n=String(r)).toLowerCase()],void 0===o))throw new _e(`Unknown adapter '${n}'`);if(o&&(te.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(an).join("\n"):" "+an(e[0]):"as no adapter specified";throw new _e("There is no suitable adapter to dispatch the request "+t,_e.ERR_NOT_SUPPORT)}return o},adapters:sn};function ln(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nt(null,e)}function fn(e,t){return Math.max(0,Math.round(e()-t))}function pn(e){const t=te.toSafeFlatObject(e);ln(t),t.headers=ye.from(te.getSafeProp(t,"headers")),t.data=et.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);const n=cn.getAdapter(t.adapter||Ze.adapter,t),r="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,o=r();return n(t).then(function(e){ln(t),e.duration=fn(r,o),t.response=e;try{e.data=et.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=ye.from(e.headers),e},function(e){if(!tt(e)&&(ln(t),e&&e.response)){e.response.duration=fn(r,o),t.response=e.response;try{e.response.data=et.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=ye.from(e.response.headers)}return Promise.reject(e)})}const hn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const dn={};hn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.21.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new _e(r(o," has been removed"+(t?" in "+t:"")),_e.ERR_DEPRECATED);return t&&!dn[o]&&(dn[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)}},hn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const yn={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new _e("options must be an object",_e.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 _e("option "+i+" must be "+n,_e.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new _e("Unknown option "+i,_e.ERR_BAD_OPTION)}},validators:hn},mn=yn.validators,bn=e=>{if(null==e||te.isPlainObject(e)||e instanceof ye)return!0;try{return te.isObject(e)&&"AxiosHeaders"===te.getSafeProp(e,Symbol.toStringTag)&&["toJSON","set","get","has","delete","clear","normalize","concat","toString",Symbol.iterator].every(t=>te.isFunction(te.getSafeProp(e,t)))}catch(e){return!1}};class vn{constructor(e){this.defaults=e||{},this.interceptors={request:new Fe,response:new Fe}}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:r.slice(n+1),i=String(e.stack),s=function(e,t){const n=te.hasOwnProp(e,ge)&&e[ge];return n&&t.endsWith(n)?t.length-n.length:-1}(e,i),a=-1===s?i:i.slice(0,s),u=-1===s?"":i.slice(s);a.endsWith(o)||(e.stack=a+"\n"+r+u)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Pt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&yn.assertOptions(n,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean),encodeBasicAuthUsername:mn.transitional(mn.boolean)},!1),null!=r&&(te.isFunction(r)?t.paramsSerializer={serialize:r}:yn.assertOptions(r,{encode:mn.function,serialize:mn.function},!0)),void 0!==t.allowAbsoluteUrls||(te.hasOwnProp(this.defaults,"allowAbsoluteUrls")&&void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yn.assertOptions(t,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),t.method=(te.getSafeProp(t,"method")||te.getSafeProp(this.defaults,"method")||"get").toLowerCase();const i=te.getSafeProp(o,"common"),s=te.getSafeProp(o,t.method),a=o&&te.merge(bn(i)?i:void 0,bn(s)?s:void 0);o&&te.forEach(Je.concat("common"),e=>{bn(te.getSafeProp(o,e))&&delete o[e]}),t.headers=ye.concat(a,o);const u=[];let c=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;c=c&&e.synchronous;const n=t.transitional||Be;n&&n.legacyInterceptorReqResOrdering?u.unshift(e.fulfilled,e.rejected):u.push(e.fulfilled,e.rejected)});const l=[];let f;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let p,h=0;if(!c){const e=[pn.bind(this),void 0];for(e.unshift(...u),e.push(...l),p=e.length,f=Promise.resolve(t);h<p;)f=f.then(e[h++],e[h++]);return f}p=u.length;let d=t;for(;h<p;){const e=u[h++],t=u[h++];try{d=e?e(d):d}catch(e){if(!t){f=Promise.reject(e);break}try{const n=t.call(this,e);te.isThenable(n)&&(f=Promise.resolve(n).then(()=>pn.call(this,d)))}catch(e){f=Promise.reject(e)}break}}if(!f)try{f=pn.call(this,d)}catch(e){f=Promise.reject(e)}for(h=0,p=l.length;h<p;)f=f.then(l[h++],l[h++]);return f}getUri(e){return Ne(vt((e=Pt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){vn.prototype[e]=async function(t,n){return this.request(Pt(n||{},{method:e,url:t,data:n&&te.hasOwnProp(n,"data")?n.data:void 0}))}}),te.forEach(["post","put","patch","query"],function(e){function t(t){return async function(n,r,o){return this.request(Pt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}vn.prototype[e]=t(),"query"!==e&&(vn.prototype[e+"Form"]=t(!0))});const gn=vn;class wn{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 nt(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 wn(function(t){e=t}),cancel:e}}}const _n=wn;const En={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(En).forEach(([e,t])=>{void 0===En[t]&&(En[t]=e)});const On=En;const Sn=function e(t){const n=new gn(t),r=o(gn.prototype.request,n);return te.extend(r,gn.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Pt(t,n))},r}(Ze);Sn.Axios=gn,Sn.CanceledError=nt,Sn.CancelToken=_n,Sn.isCancel=tt,Sn.VERSION="1.21.1",Sn.toFormData=Re,Sn.AxiosError=_e,Sn.Cancel=Sn.CanceledError,Sn.all=function(e){return Promise.all(e)},Sn.spread=function(e){return function(t){return e.apply(null,t)}},Sn.isAxiosError=function(e){return te.isObject(e)&&!0===e.isAxiosError},Sn.mergeConfig=Pt,Sn.AxiosHeaders=ye,Sn.formToJSON=e=>$e(te.isHTMLForm(e)?new FormData(e):e),Sn.getAdapter=cn.getAdapter,Sn.HttpStatusCode=On,Sn.default=Sn;const Tn=Sn;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 kn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Pn(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Pn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Pn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Pn(f,"constructor",c),Pn(c,"constructor",u),u.displayName="GeneratorFunction",Pn(c,o,"GeneratorFunction"),Pn(f),Pn(f,o,"Generator"),Pn(f,r,function(){return this}),Pn(f,"toString",function(){return"[object Generator]"}),(kn=function(){return{w:i,m:p}})()}function Pn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Pn=function(e,t,n,r){function i(t,n){Pn(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))},Pn(e,t,n,r)}function An(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}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,Cn(r.key),r)}}function Cn(e){var t=function(e,t){if("object"!=Rn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){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 Nn=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=kn().m(function e(){return kn().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&&jn(e.prototype,t),n&&jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}();function Un(e){return Un="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},Un(e)}function xn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Dn(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Dn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Dn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Dn(f,"constructor",c),Dn(c,"constructor",u),u.displayName="GeneratorFunction",Dn(c,o,"GeneratorFunction"),Dn(f),Dn(f,o,"Generator"),Dn(f,r,function(){return this}),Dn(f,"toString",function(){return"[object Generator]"}),(xn=function(){return{w:i,m:p}})()}function Dn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Dn=function(e,t,n,r){function i(t,n){Dn(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))},Dn(e,t,n,r)}function Ln(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Fn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Ln(i,r,o,s,a,"next",e)}function a(e){Ln(i,r,o,s,a,"throw",e)}s(void 0)})}}function Bn(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,In(r.key),r)}}function In(e){var t=function(e,t){if("object"!=Un(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Un(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Un(t)?t:t+""}var Hn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var qn=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,u=void 0===a?0:a,c=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&&Hn.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=c||Tn.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(u)},t=[{key:"getAccessToken",value:(s=Fn(xn().m(function e(){return xn().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=Fn(xn().m(function e(t){return xn().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=Fn(xn().m(function e(){var t=this;return xn().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=Fn(xn().m(function e(){var t,n,r,o,i;return xn().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"===Un(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&&Bn(e.prototype,t),n&&Bn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i,s}();function Mn(e){return Mn="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},Mn(e)}function zn(e){var t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==t||t===("undefined"!=typeof Symbol&&[][Symbol.iterator])||t===[]["@@iterator"]))return e;if(null!=t){for(var n,r=[],o=t.call(e);!(n=o.next()).done;)r.push(n.value);return r}}(e);return t===e?Wn(e):t||Kn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xn(e,t){return function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Kn(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 Kn(e,t){if(e){if("string"==typeof e)return Wn(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)?Wn(e,t):void 0}}function Wn(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 Yn(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Gn(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Gn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Gn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Gn(f,"constructor",c),Gn(c,"constructor",u),u.displayName="GeneratorFunction",Gn(c,o,"GeneratorFunction"),Gn(f),Gn(f,o,"Generator"),Gn(f,r,function(){return this}),Gn(f,"toString",function(){return"[object Generator]"}),(Yn=function(){return{w:i,m:p}})()}function Gn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Gn=function(e,t,n,r){function i(t,n){Gn(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))},Gn(e,t,n,r)}function $n(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,Jn(r.key),r)}}function Jn(e){var t=function(e,t){if("object"!=Mn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Mn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Mn(t)?t:t+""}function Vn(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Qn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Vn(i,r,o,s,a,"next",e)}function a(e){Vn(i,r,o,s,a,"throw",e)}s(void 0)})}}var Zn=null;function er(){return tr.apply(this,arguments)}function tr(){return(tr=Qn(Yn().m(function e(){var t;return Yn().w(function(e){for(;;)switch(e.n){case 0:if(!Zn){e.n=1;break}return e.a(2,Zn);case 1:return e.n=2,import("node:crypto");case 2:return t=e.v,Zn=t.default&&t.default.createHmac?t.default:t,e.a(2,Zn)}},e)}))).apply(this,arguments)}var nr=new Set(["/appmesh/file/download","/appmesh/file/upload","/appmesh/file/delete"]),rr=/^\/appmesh\/app\/[^/]+\/(output|task)\/stream$/,or=Object.freeze({KEY_ID:"X-Request-Key",TIMESTAMP:"X-Timestamp",NONCE:"X-Nonce",SIGNATURE:"X-Signature"});function ir(e){if("string"!=typeof e)return!1;var t=sr(e);return nr.has(t)||rr.test(t)}function sr(e){return"/appmesh/file/download/ws"===e?"/appmesh/file/download":"/appmesh/file/upload/ws"===e?"/appmesh/file/upload":e}var ar=function(){return e=function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"string"!=typeof t||""===t.trim())throw new TypeError("keyId must be a non-empty string");if("string"!=typeof n||""===n)throw new TypeError("secret must be a non-empty string");Object.defineProperty(this,"_keyId",{value:t,writable:!0}),Object.defineProperty(this,"_secret",{value:n,writable:!0})},t=[{key:"keyId",get:function(){return this._keyId}},{key:"attach",value:(i=Qn(Yn().m(function e(t,n,r,o,i,s,a){var u,c,l,f,p,h,d,y,m;return Yn().w(function(e){for(;;)switch(e.n){case 0:if(u=s||String(Math.floor(Date.now()/1e3)),p=a){e.n=2;break}return e.n=1,this.randomNonce();case 1:p=e.v;case 2:return c=p,l=sr(r),h=ur,d=n,y=l,m=o,e.n=3,cr(l,i);case 3:return f=h(d,y,m,e.v,u,c),t[or.KEY_ID]=this._keyId,t[or.TIMESTAMP]=u,t[or.NONCE]=c,e.n=4,this.sign(f);case 4:t[or.SIGNATURE]=e.v;case 5:return e.a(2)}},e,this)})),function(e,t,n,r,o,s,a){return i.apply(this,arguments)})},{key:"randomNonce",value:(o=Qn(Yn().m(function e(){var t;return Yn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return t=e.v,e.a(2,t.randomBytes(16).toString("hex"))}},e)})),function(){return o.apply(this,arguments)})},{key:"sign",value:(r=Qn(Yn().m(function e(t){var n;return Yn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return n=e.v,e.a(2,n.createHmac("sha256",this._secret).update(t,"utf8").digest("hex"))}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"toString",value:function(){return"RequestSigner[keyId=".concat(this._keyId,"]")}}],t&&$n(e.prototype,t),n&&$n(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i}();function ur(e,t,n,r,o,i){if(!e||!t)throw new TypeError("method and path are required");return[e,t,n||"",r,o,i].join("\n")}function cr(e,t){return lr.apply(this,arguments)}function lr(){return(lr=Qn(Yn().m(function e(t,n){var r,o;return Yn().w(function(e){for(;;)switch(e.n){case 0:return r=null==n||ir(t)?Buffer.alloc(0):Buffer.from(n),e.n=1,er();case 1:return o=e.v,e.a(2,o.createHash("sha256").update(r).digest("hex"))}},e)}))).apply(this,arguments)}function fr(e){if(!e)return"";for(var t=Object.create(null),n=0;n<e.length;){var r=e.indexOf("&",n),o=r<0?e.slice(n):e.slice(n,r),i=o.indexOf("="),s=i<0?o:o.slice(0,i),a=i<0?"":o.slice(i+1),u=pr(s);if(Object.prototype.hasOwnProperty.call(t,u)||(t[u]=pr(a)),r<0)break;n=r+1}var c=Object.entries(t);return c.sort(function(e,t){var n=Buffer.compare(Buffer.from(e[0],"utf8"),Buffer.from(t[0],"utf8"));return 0!==n?n:Buffer.compare(Buffer.from(e[1],"utf8"),Buffer.from(t[1],"utf8"))}),c.map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)}).join("&")}function pr(e){if(!e.includes("%"))return e;for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(37===r){var o=e.charCodeAt(n+1),i=e.charCodeAt(n+2),s=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102};if(!s(o)||!s(i))return e;t.push(parseInt(e.slice(n+1,n+3),16)),n+=2}else if(r<128)t.push(r);else{var a=Buffer.from(e[n],"utf8");t.push.apply(t,zn(a))}}return Buffer.from(t).toString("utf8")}function hr(e){return e?Object.entries(e).filter(function(e){var t=Xn(e,2)[1];return null!=t}).map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(encodeURIComponent(String(n)),"=").concat(encodeURIComponent(String(r)))}).join("&"):""}function dr(e){return dr="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},dr(e)}function yr(e,t){return function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Sr(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 mr(){/*! 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 u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return br(c,"_invoke",function(n,r,o){var i,a,u,c=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,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=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(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(br(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,br(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,br(f,"constructor",c),br(c,"constructor",u),u.displayName="GeneratorFunction",br(c,o,"GeneratorFunction"),br(f),br(f,o,"Generator"),br(f,r,function(){return this}),br(f,"toString",function(){return"[object Generator]"}),(mr=function(){return{w:i,m:p}})()}function br(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}br=function(e,t,n,r){function i(t,n){br(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))},br(e,t,n,r)}function vr(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 gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vr(Object(n),!0).forEach(function(t){wr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wr(e,t,n){return(t=Pr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _r(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Er(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){_r(i,r,o,s,a,"next",e)}function a(e){_r(i,r,o,s,a,"throw",e)}s(void 0)})}}function Or(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Sr(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function Sr(e,t){if(e){if("string"==typeof e)return Tr(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)?Tr(e,t):void 0}}function Tr(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 Rr(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,Pr(r.key),r)}}function kr(e,t,n){return t&&Rr(e.prototype,t),n&&Rr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pr(e){var t=function(e,t){if("object"!=dr(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=dr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==dr(t)?t:t+""}function Ar(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jr(e,t,n){return t=Dr(t),function(e,t){if(t&&("object"==dr(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,Ur()?Reflect.construct(t,n||[],Dr(e).constructor):t.apply(e,n))}function Cr(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&&xr(e,t)}function Nr(e){var t="function"==typeof Map?new Map:void 0;return Nr=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(Ur())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&xr(o,n.prototype),o}(e,arguments,Dr(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),xr(n,e)},Nr(e)}function Ur(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ur=function(){return!!e})()}function xr(e,t){return xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xr(e,t)}function Dr(e){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dr(e)}function Lr(e){return new Ir(e,0)}function Fr(e){return function(){return new Br(e.apply(this,arguments))}}function Br(e){var t,n;function r(t,n){try{var i=e[t](n),s=i.value,a=s instanceof Ir;Promise.resolve(a?s.v:s).then(function(n){if(a){var u="return"===t&&s.k?t:"next";if(!s.k||n.done)return r(u,n);n=e[u](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,s){var a={key:e,arg:o,resolve:i,reject:s,next:null};n?n=n.next=a:(t=n=a,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function Ir(e,t){this.v=e,this.k=t}function Hr(e){var t,n,r,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new qr(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function qr(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return qr=function(e){this.s=e,this.n=e.next},qr.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.throw;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new qr(e)}Br.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Br.prototype.next=function(e){return this._invoke("next",e)},Br.prototype.throw=function(e){return this._invoke("throw",e)},Br.prototype.return=function(e){return this._invoke("return",e)};var Mr=null,zr=null,Xr=null,Kr=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",SYNC_RUN_OUTPUT_PAGE_BYTES:5242880,SYNC_RUN_TRUNCATED_RETENTION_SECONDS:600,HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path",HTTP_HEADER_KEY_X_FILE_OVERWRITE:"X-File-Overwrite",HTTP_HEADER_KEY_X_FILE_MODE:"X-File-Mode",HTTP_HEADER_KEY_X_FILE_USER:"X-File-User",HTTP_HEADER_KEY_X_FILE_GROUP:"X-File-Group",HTTP_HEADER_KEY_X_OUTPUT_POSITION:"X-Output-Position",HTTP_HEADER_KEY_X_EXIT_CODE:"X-Exit-Code",HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED:"X-Output-Truncated",HTTP_HEADER_KEY_X_APP_NAME:"X-App-Name",HTTP_HEADER_KEY_X_INPUT_CLOSE:"X-Input-Close",HTTP_HEADER_KEY_X_SUBSCRIPTION_ID:"X-Subscription-Id",HTTP_HEADER_KEY_X_APPMESH_PROCESS_KEY:"X-AppMesh-Process-Key"}),Wr=Object.freeze({isNode:!("undefined"!=typeof window&&"undefined"!==window.document)}),Yr=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Gr(e,t){var n=String(e||""),r=String(t||""),o=r;if(n&&!Yr.test(r)){for(var i=n.length;i>0&&47===n.charCodeAt(i-1);)i--;o=r?n.slice(0,i)+"/"+r.replace(/^\/+/,""):n}try{return new URL(o).pathname}catch(e){try{return new URL(o,"http://localhost").pathname}catch(e){return r}}}var $r=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 Ar(this,e),(n=jr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return Cr(e,Nr(Error)),kr(e)}(),Jr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Cr(e,$r),kr(e)}(),Vr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Cr(e,$r),kr(e)}(),Qr=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Ar(this,e),(n=jr(this,e,[t,r,null,"REQUEST"])).name="AppMeshRequestError",n}return Cr(e,$r),kr(e)}(),Zr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"TIMEOUT"])).name="AppMeshTimeoutError",n}return Cr(e,$r),kr(e)}(),eo=function(e,t){Wr.isNode?process.stdout.write(e):console.log(e)};function to(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 u=a.slice(1);if(0===u.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(u.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var c=u.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*c.years,l+=2592e3*c.months,l+=604800*c.weeks,l+=86400*c.days,l+=3600*c.hours,l+=60*c.minutes,l+=c.seconds}function no(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):(new TextEncoder).encode(null==e?"":String(e))}function ro(e){if("undefined"!=typeof Buffer)return Buffer.concat(e.map(function(e){return Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)}));var t,n=0,r=Or(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.byteLength}}catch(e){r.e(e)}finally{r.f()}var o,i=new Uint8Array(n),s=0,a=Or(e);try{for(a.s();!(o=a.n()).done;){var u=o.value;i.set(u,s),s+=u.byteLength}}catch(e){a.e(e)}finally{a.f()}return i}function oo(e){return ao(e.headers,"content-type")||(null==e.contentType?void 0:e.contentType)}function io(e){var t=/charset\s*=\s*"?([\w!#$%&*+\-.^`|~]+)"?/i.exec(String(e||""));return t?t[1]:null}function so(e,t){for(var n=0,r=[t,"utf-8"];n<r.length;n++){var o=r[n];if(o)try{return new TextDecoder(o).decode(e)}catch(e){}}return new TextDecoder("utf-8").decode(e)}function ao(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 uo(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(ao(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new $r("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function co(e){return lo.apply(this,arguments)}function lo(){return(lo=Er(mr().m(function e(t){var r,o,i,s;return mr().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 fo(e){return po.apply(this,arguments)}function po(){return(po=Er(mr().m(function e(t){var n,r;return mr().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,ho("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function ho(e,t){return yo.apply(this,arguments)}function yo(){return(yo=Er(mr().m(function e(t,r){var o,i,s,a,u,c,l,f,p,h,d;return mr().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(":"),u=a.length>=3?parseInt(a[2],10):NaN,e.a(2,a[0]&&!isNaN(u)?{name:a[0],gid:u}:null);case 2:if(0===(c=i("dscacheutil",["-q","group","-a",t,String(r)],{encoding:"utf8",timeout:3e3})).status&&c.stdout){e.n=3;break}return e.a(2,null);case 3:if(l=c.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 mo(e){return bo.apply(this,arguments)}function bo(){return(bo=Er(mr().m(function e(t){var r,o,i,s;return mr().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 vo(e){return go.apply(this,arguments)}function go(){return(go=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ho("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var wo="/opt/appmesh/ssl/ca.pem";function _o(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function Eo(e){if(!e)return null;var t="function"==typeof e.get?e.get(Kr.HTTP_HEADER_KEY_AUTH):e[Kr.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function Oo(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:zr.readFileSync(e)}function So(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return zr.existsSync(wo)?{ca:zr.readFileSync(wo),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=gr({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=Oo(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var To=kr(function e(t){var n,r,o,i,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ar(this,e),this.reason=t,this.exitCode=null!==(n=a.exitCode)&&void 0!==n?n:null,this.position=null!==(r=a.position)&&void 0!==r?r:null,this.status=null!==(o=a.status)&&void 0!==o?o:null,this.message=null!==(i=a.message)&&void 0!==i?i:null,this.result=null!==(s=a.result)&&void 0!==s?s:null});function Ro(e){return ko.apply(this,arguments)}function ko(){return(ko=Fr(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:n=new TextDecoder("utf-8"),r="",o="message",i=[],s=!1,a=!1,e.p=1,c=Hr(t);case 2:return e.n=3,Lr(c.next());case 3:if(!(s=!(l=e.v).done)){e.n=12;break}f=l.value,r+="string"==typeof f?f:n.decode(f,{stream:!0}),p=void 0;case 4:if(!((p=r.indexOf("\n"))>=0)){e.n=11;break}if(h=r.slice(0,p).replace(/\r$/,""),r=r.slice(p+1),""!==h){e.n=9;break}if(!("message"!==o||i.length>0)){e.n=8;break}if(d=i.join("\n"),y={},!d){e.n=7;break}e.p=5,y=JSON.parse(d),e.n=7;break;case 6:throw e.p=6,m=e.v,new $r("malformed SSE frame (".concat(o,"): ").concat(m.message));case 7:return e.n=8,[o,y];case 8:o="message",i=[],e.n=10;break;case 9:h.startsWith(":")||(h.startsWith("event:")?o=h.slice(6).trim():h.startsWith("data:")&&i.push(h.slice(5).trimStart()));case 10:e.n=4;break;case 11:s=!1,e.n=2;break;case 12:e.n=14;break;case 13:e.p=13,b=e.v,a=!0,u=b;case 14:if(e.p=14,e.p=15,!s||null==c.return){e.n=16;break}return e.n=16,Lr(c.return());case 16:if(e.p=16,!a){e.n=17;break}throw u;case 17:return e.f(16);case 18:return e.f(14);case 19:return e.a(2)}},e,null,[[15,,16,18],[5,6],[1,13,14,19]])}))).apply(this,arguments)}function Po(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new To(String(null!==(t=e.reason)&&void 0!==t?t:"closed"),gr({exitCode:e.exit_code,position:e.position,status:e.status,message:e.message},n))}function Ao(e){var t;if("error"===e.reason)throw new Qr(e.message||"stream failed with an error",null!==(t=e.status)&&void 0!==t?t:null);if("timeout"===e.reason)throw new Zr(e.message||"stream timed out");if(!["exit","removed","eof","final","disconnected","closed"].includes(e.reason))throw new $r("stream ended with unknown reason: ".concat(e.reason))}var jo=function(){return kr(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wr.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;Ar(this,e),this.baseURL=r,this.forwardingHost=null,this._requestSigner=null,this._tokenProvider=null,i&&this.setTokenProvider(i);var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[uo]};this._sslConfig=o,this._client=Tn.create(s),Wr.isNode&&!Xr&&(Xr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=yr(e,2),n=t[0],r=t[1];Mr=n.default||n,zr=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Er(mr().m(function e(n){var r,o;return mr().w(function(e){for(;;)switch(e.n){case 0:return r=gr,o=gr({},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 $r("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 $r)return Promise.reject(e);var i=new $r("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:"setTokenProvider",value:function(e){if(!e||"function"!=typeof e.getAccessToken)throw new TypeError("tokenProvider must implement async getAccessToken()");this._tokenProvider=e}},{key:"setBearerToken",value:function(e){null!=e?this.setTokenProvider(new Nn(e)):this.clearBearerToken()}},{key:"setToken",value:function(e){this.setBearerToken(e)}},{key:"clearBearerToken",value:function(){var e=this._tokenProvider;e&&"function"==typeof e.clear&&e.clear(),this._tokenProvider=null}},{key:"enableRequestSignature",value:function(e,t){this._requestSigner=new ar(e,t)}},{key:"disableRequestSignature",value:function(){this._requestSigner=null}},{key:"isRequestSignatureEnabled",value:function(){return null!==this._requestSigner}},{key:"_applyRequestSignature",value:(Y=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h;return mr().w(function(e){for(;;)switch(e.n){case 0:if((n=this._requestSigner)&&t){e.n=1;break}return e.a(2);case 1:return r=Gr(t.baseURL||this._client.defaults.baseURL||this.baseURL,t.url),o="",t.params&&"object"===dr(t.params)&&Object.keys(t.params).length>0&&(t.paramsSerializer=hr,o=fr(hr(t.params))),i=this._headerValue(t.headers,"content-type"),s=ir(r)?Buffer.alloc(0):this._wireBodyBytes(t.data,i),a=String(t.method||"get").toUpperCase(),u={},e.n=2,n.attach(u,a,r,o,s);case 2:for(c=0,l=Object.entries(u);c<l.length;c++)f=yr(l[c],2),p=f[0],h=f[1],t.headers&&"function"==typeof t.headers.set?t.headers.set(p,h):t.headers=gr(gr({},t.headers),{},wr({},p,h));case 3:return e.a(2)}},e,this)})),function(e){return Y.apply(this,arguments)})},{key:"_headerValue",value:function(e,t){if(e){if("function"==typeof e.get)return e.get(t);var n=Object.keys(e).find(function(e){return e.toLowerCase()===t.toLowerCase()});return void 0===n?void 0:e[n]}}},{key:"_wireBodyBytes",value:function(e,t){if(null==e)return Buffer.alloc(0);if("string"==typeof e){if(String(t||"").toLowerCase().includes("application/json"))try{return JSON.parse(e),Buffer.from(e.trim(),"utf8")}catch(t){if("SyntaxError"!==t.name)throw t;return Buffer.from(JSON.stringify(e),"utf8")}return Buffer.from(e,"utf8")}if(Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer)return Buffer.from(e);if("object"===dr(e))return Buffer.from(JSON.stringify(e),"utf8");throw new $r("cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies")}},{key:"_getAccessToken",value:(W=Er(mr().m(function e(){var t;return mr().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 W.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(K=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f;return mr().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:l=e.v,e.n=4;break;case 3:l=!!o.canRefresh;case 4:if(l&&"function"==typeof o.refreshAccessToken&&_o(r.data)){e.n=5;break}return e.a(2,t);case 5:if(!this._requestSigner){e.n=6;break}if(i=t.headers||{},(s="function"==typeof i.get?i.get("WWW-Authenticate"):i["WWW-Authenticate"]||i["www-authenticate"])&&s.includes("invalid_token")){e.n=6;break}return e.a(2,t);case 6:if(null===(n=Eo(r.headers))||void 0===n){e.n=7;break}f=n,e.n=9;break;case 7:return e.n=8,this._getAccessToken();case 8:f=e.v;case 9:return a=f,e.n=10,o.refreshAccessToken(a);case 10:if("string"==typeof(u=e.v)&&u.trim()){e.n=11;break}return e.a(2,t);case 11:if(r.__appmeshRetried=!0,c="Bearer ".concat(u.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(Kr.HTTP_HEADER_KEY_AUTH,c):r.headers=gr(gr({},r.headers),{},wr({},Kr.HTTP_HEADER_KEY_AUTH,c)),!this._requestSigner){e.n=12;break}return e.n=12,this._applyRequestSignature(r);case 12:return e.a(2,this._client(r))}},e,this)})),function(e){return K.apply(this,arguments)})},{key:"getAuthConfig",value:(X=Er(mr().m(function e(){return mr().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 X.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(z=Er(mr().m(function e(){return mr().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 z.apply(this,arguments)})},{key:"listApps",value:(M=Er(mr().m(function e(){var t;return mr().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 M.apply(this,arguments)})},{key:"getApp",value:(q=Er(mr().m(function e(t){var n;return mr().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 q.apply(this,arguments)})},{key:"checkAppHealth",value:(H=Er(mr().m(function e(t){var n;return mr().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 H.apply(this,arguments)})},{key:"addApp",value:(I=Er(mr().m(function e(t,n){var r;return mr().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 I.apply(this,arguments)})},{key:"deleteApp",value:(B=Er(mr().m(function e(t){var n,r;return mr().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 B.apply(this,arguments)})},{key:"enableApp",value:(F=Er(mr().m(function e(t){return mr().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 F.apply(this,arguments)})},{key:"disableApp",value:(L=Er(mr().m(function e(t){return mr().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 L.apply(this,arguments)})},{key:"getAppOutput",value:(D=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p=arguments;return mr().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:to(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,u=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_POSITION),c=ao(a.headers,Kr.HTTP_HEADER_KEY_X_EXIT_CODE),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new Co(a.status,a.data,l,f))}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"runAppSync",value:(x=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return n=d.length>1&&void 0!==d[1]?d[1]:eo,r=d.length>2&&void 0!==d[2]?d[2]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=d.length>3&&void 0!==d[3]?d[3]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i=d.length>4&&void 0!==d[4]?d[4]:null,s={timeout:to(r),lifecycle:to(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:s,config:{responseType:"arraybuffer"}});case 1:if(a=e.v,u=null,200!==a.status){e.n=3;break}if((c=ao(a.headers,Kr.HTTP_HEADER_KEY_X_EXIT_CODE))&&(u=parseInt(c,10)),l=ao(a.headers,Kr.HTTP_HEADER_KEY_X_APP_NAME),f=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED),!l||"1"!==String(f)){e.n=3;break}return p=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_POSITION),e.n=2,this._readTruncatedRunOutput(a,l,i,p?parseInt(p,10):NaN);case 2:return h=e.v,n&&n(h,0),e.a(2,u);case 3:return n&&n(so(no(a.data),io(oo(a))),0),e.a(2,u)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"_readTruncatedRunOutput",value:(U=Er(mr().m(function e(t,n,r,o){var i,s,a,u,c,l;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:i=[no(t.data)],Number.isFinite(o)||(o=i[0].byteLength),(s=function(){var e=i.reduce(function(e,t){return e+t.byteLength},0);if(null!=r&&e>r)throw new Qr("run output exceeds maxOutputBytes=".concat(r,"; the rest stays readable on application ")+"'".concat(n,"' for ").concat(Kr.SYNC_RUN_TRUNCATED_RETENTION_SECONDS," seconds"),t.status)})(),a=!1,e.p=1;case 2:return e.n=3,this._request("get","/appmesh/app/".concat(n,"/output"),null,{params:{stdout_position:String(o)},config:{responseType:"arraybuffer"}});case 3:if(u=e.v,c=no(u.data),i.push(c),o+=c.byteLength,s(),!(c.byteLength<Kr.SYNC_RUN_OUTPUT_PAGE_BYTES)){e.n=4;break}return a=!0,e.a(3,5);case 4:e.n=2;break;case 5:if(e.p=5,!a){e.n=9;break}return e.p=6,e.n=7,this.deleteApp(n);case 7:e.n=9;break;case 8:e.p=8,l=e.v,console.warn("Warning: Failed to remove sync run application '".concat(n,"':"),l.message);case 9:return e.f(5);case 10:return e.a(2,so(ro(i),io(oo(t))))}},e,this,[[6,8],[1,,5,10]])})),function(e,t,n,r){return U.apply(this,arguments)})},{key:"runAppAsync",value:(N=Er(mr().m(function e(t){var n,r,o,i,s=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:to(n),lifecycle:to(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new No(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"waitForAsyncRun",value:(C=Er(mr().m(function e(t){var n,r,o,i,s,a,u=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:eo,r=u.length>2&&void 0!==u[2]?u[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.getAppOutput(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.deleteApp(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 C.apply(this,arguments)})},{key:"runTask",value:(j=Er(mr().m(function e(t,n){var r,o,i=arguments;return mr().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 j.apply(this,arguments)})},{key:"cancelTask",value:(A=Er(mr().m(function e(t){return mr().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 A.apply(this,arguments)})},{key:"followOutput",value:function(e){var t=this;return Fr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return mr().m(function r(){var o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k;return mr().w(function(r){for(;;)switch(r.p=r.n){case 0:return o=n.stdoutPosition,i=void 0===o?0:o,s=n.processUuid,a=void 0===s?"":s,u=n.follow,c=void 0===u||u,l=n.timeout,f=void 0===l?3600:l,p={stdout_position:String(i),follow:c?"true":"false",timeout:String(f)},a&&(p.process_uuid=a),r.n=1,Lr(t._sseRequest("get","/appmesh/app/".concat(e,"/output/stream"),{params:p}));case 1:h=r.v,d=null,r.p=2,y=!1,m=!1,r.p=3,v=Hr(Ro(h.data));case 4:return r.n=5,Lr(v.next());case 5:if(!(y=!(g=r.v).done)){r.n=9;break}if(w=yr(g.value,2),_=w[0],E=w[1],"stdout"!==_){r.n=7;break}return r.n=6,String(null!==(O=E.output)&&void 0!==O?O:"");case 6:r.n=8;break;case 7:if("end"!==_){r.n=8;break}return d=Po(E),r.a(3,9);case 8:y=!1,r.n=4;break;case 9:r.n=11;break;case 10:r.p=10,R=r.v,m=!0,b=R;case 11:if(r.p=11,r.p=12,!y||null==v.return){r.n=13;break}return r.n=13,Lr(v.return());case 13:if(r.p=13,!m){r.n=14;break}throw b;case 14:return r.f(13);case 15:return r.f(11);case 16:r.n=18;break;case 17:throw r.p=17,k=r.v,t.onError(k);case 18:return r.p=18,null===(S=h.data)||void 0===S||null===(T=S.destroy)||void 0===T||T.call(S),r.f(18);case 19:return null===d&&(d=new To("closed")),Ao(d),r.a(2,d)}},r,null,[[12,,13,15],[3,10,11,16],[2,17,18,19]])})()}).apply(this,arguments)}},{key:"runTaskStream",value:function(e,t){var n=this;return Fr(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mr().m(function o(){var i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S;return mr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i=r.timeout,a=(s=void 0===i?300:i)&&s>0?{timeout:String(s)}:{},o.n=1,Lr(n._sseRequest("post","/appmesh/app/".concat(e,"/task/stream"),{params:a,body:t}));case 1:u=o.v,c=null,l=null,o.p=2,f=!1,p=!1,o.p=3,d=Hr(Ro(u.data));case 4:return o.n=5,Lr(d.next());case 5:if(!(f=!(y=o.v).done)){o.n=10;break}if(m=yr(y.value,2),b=m[0],v=m[1],"partial"!==b){o.n=7;break}return o.n=6,String(null!==(g=v.data)&&void 0!==g?g:"");case 6:o.n=9;break;case 7:if("final"!==b){o.n=8;break}l=null!==(w=v.result)&&void 0!==w?w:null,o.n=9;break;case 8:if("end"!==b){o.n=9;break}return c=Po(v,{result:l}),o.a(3,10);case 9:f=!1,o.n=4;break;case 10:o.n=12;break;case 11:o.p=11,O=o.v,p=!0,h=O;case 12:if(o.p=12,o.p=13,!f||null==d.return){o.n=14;break}return o.n=14,Lr(d.return());case 14:if(o.p=14,!p){o.n=15;break}throw h;case 15:return o.f(14);case 16:return o.f(12);case 17:o.n=19;break;case 18:throw o.p=18,S=o.v,n.onError(S);case 19:return o.p=19,null===(_=u.data)||void 0===_||null===(E=_.destroy)||void 0===E||E.call(_),o.f(19);case 20:return null===c&&(c=new To("closed",{result:l})),Ao(c),o.a(2,c)}},o,null,[[13,,14,16],[3,11,12,17],[2,18,19,20]])})()}).apply(this,arguments)}},{key:"streamRun",value:function(e){var t=this;return Fr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS;return mr().m(function o(){var i,s,a,u,c;return mr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i="string"==typeof e?{command:e,shell:!0}:e,o.n=1,Lr(t.runAppAsync(i,n,r));case 1:return s=o.v,o.p=2,u=t.followOutput(s.appName,{processUuid:s.procUid,follow:!0,timeout:Math.max(to(n),to(r))}),o.n=3,Lr(u.next());case 3:c=o.v;case 4:if(c.done){o.n=7;break}return o.n=5,c.value;case 5:return o.n=6,Lr(u.next());case 6:c=o.v,o.n=4;break;case 7:a=c.value;case 8:return o.p=8,o.p=9,o.n=10,Lr(t.deleteApp(s.appName));case 10:o.n=12;break;case 11:o.p=11,o.v;case 12:return o.f(8);case 13:return o.a(2,a)}},o,null,[[9,11],[2,,8,13]])})()}).apply(this,arguments)}},{key:"sendInput",value:(P=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return s=(i=h.length>2&&void 0!==h[2]?h[2]:{}).close,a=void 0!==s&&s,u=i.processUuid,c=void 0===u?"":u,l=a?wr({},Kr.HTTP_HEADER_KEY_X_INPUT_CLOSE,"true"):{},f=c?{process_uuid:c}:{},e.n=1,this._request("post","/appmesh/app/".concat(t,"/input"),n,{headers:l,params:f});case 1:return p=e.v,e.a(2,parseInt(null!==(r=null===(o=p.data)||void 0===o?void 0:o.bytes_written)&&void 0!==r?r:0,10))}},e,this)})),function(e,t){return P.apply(this,arguments)})},{key:"downloadFile",value:(k=Er(mr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k,P,A=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return a=A.length>2&&void 0!==A[2]&&A[2],(s=A.length>1&&void 0!==A[1]?A[1]:null)||(s=t.split(/[\\/]/).pop()),u=wr({},Kr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:u,config:{responseType:Wr.isNode?"stream":"arraybuffer"}});case 1:if(c=e.v,l=Wr.isNode?"":c.data,200!==c.status||null!==(r=c.headers)&&void 0!==r&&r["content-disposition"]||!String(null!==(o=null===(i=c.headers)||void 0===i?void 0:i["content-type"])&&void 0!==o?o:"").toLowerCase().includes("json")){e.n=2;break}throw Wr.isNode&&c.data.destroy(),new $r("File download is not supported by this server surface: ".concat(t),c.status,l);case 2:if(200===c.status){e.n=3;break}throw new $r("Failed to download file: ".concat(t),c.status,l);case 3:if(!Wr.isNode){e.n=20;break}return e.n=4,n.e(603).then(()=>n.t(603,19));case 4:return f=e.v,e.n=5,n.e(582).then(()=>n.t(582,19));case 5:return p=e.v,h=p.promisify,R=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=R(e.v.pipeline),y=f.promises,e.p=7,e.n=8,d(c.data,f.createWriteStream(s));case 8:if(!a||"win32"===process.platform){e.n=17;break}if(m=c.headers,e.p=9,!(b=m["x-file-mode"])){e.n=12;break}if(v=parseInt(b,10),!(Number.isInteger(v)&&v>=0&&v<=511)){e.n=11;break}return e.n=10,y.chmod(s,v);case 10:e.n=12;break;case 11:console.warn("Warning: Invalid x-file-mode value:",b);case 12:if(g=m["x-file-user"],w=m["x-file-group"],!g||!w){e.n=15;break}return e.n=13,co(g);case 13:return _=e.v,e.n=14,fo(w);case 14:if(E=e.v,null===_||null===E){e.n=15;break}return e.n=15,y.chown(s,_,E);case 15:e.n=17;break;case 16:e.p=16,k=e.v,console.warn("Warning: Unable to apply file attributes to",s,k.message);case 17:e.n=19;break;case 18:throw e.p=18,P=e.v,new $r("Failed to write file to ".concat(s,": ").concat(P.message),c.status);case 19:e.n=21;break;case 20:O=new Blob([c.data]),S=window.URL.createObjectURL(O),(T=document.createElement("a")).style.display="none",T.href=S,T.download=s.split("/").pop(),document.body.appendChild(T),T.click(),window.URL.revokeObjectURL(S),document.body.removeChild(T);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return k.apply(this,arguments)})},{key:"uploadFile",value:(R=Er(mr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:if(s=b.length>2&&void 0!==b[2]&&b[2],a=b.length>3&&void 0!==b[3]&&b[3],i=b.length>1&&void 0!==b[1]?b[1]:null){e.n=2;break}if(u="string"==typeof t?t:t&&t.name){e.n=1;break}throw new $r("filePath is required when localFile is a Blob without a name");case 1:i=u.split(/[\\/]/).pop();case 2:if(c=wr({},Kr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),a&&(c[Kr.HTTP_HEADER_KEY_X_FILE_OVERWRITE]="true"),!Wr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(f=e.v,p=f.statSync(t),!s){e.n=6;break}return c["X-File-Mode"]=(511&p.mode).toString(),e.n=4,mo(p.uid);case 4:return h=e.v,e.n=5,vo(p.gid);case 5:d=e.v,c["X-File-User"]=h||String(p.uid),c["X-File-Group"]=d||String(p.gid);case 6:l=p.size<10485760?f.readFileSync(t):f.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}l=t,e.n=9;break;case 8:throw new $r("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",l,{headers:c,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(y=e.v).status||201===y.status){e.n=11;break}throw new $r("Failed to upload file: ".concat(i),y.status,y.data);case 11:if(m=String(null!==(r=null===(o=y.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===y.status&&m.includes("json")&&y.data&&"object"===dr(y.data)&&"message"in y.data)){e.n=12;break}throw new $r("File upload is not supported by this server surface: ".concat(i),y.status,y.data);case 12:return e.a(2)}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"getHostResources",value:(T=Er(mr().m(function e(){var t;return mr().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 T.apply(this,arguments)})},{key:"getConfig",value:(S=Er(mr().m(function e(){var t;return mr().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 S.apply(this,arguments)})},{key:"setConfig",value:(O=Er(mr().m(function e(t){var n;return mr().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 O.apply(this,arguments)})},{key:"setLogLevel",value:(E=Er(mr().m(function e(){var t,n,r=arguments;return mr().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.setConfig({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"addLabel",value:(_=Er(mr().m(function e(t,n){return mr().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 _.apply(this,arguments)})},{key:"deleteLabel",value:(w=Er(mr().m(function e(t){return mr().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 w.apply(this,arguments)})},{key:"listLabels",value:(g=Er(mr().m(function e(){var t;return mr().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 g.apply(this,arguments)})},{key:"listPrincipals",value:(v=Er(mr().m(function e(){return mr().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 v.apply(this,arguments)})},{key:"updatePrincipal",value:(b=Er(mr().m(function e(t,n){return mr().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 b.apply(this,arguments)})},{key:"deletePrincipal",value:(m=Er(mr().m(function e(t){return mr().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 m.apply(this,arguments)})},{key:"getCurrentUser",value:(y=Er(mr().m(function e(){return mr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return y.apply(this,arguments)})},{key:"listPermissions",value:(d=Er(mr().m(function e(){var t;return mr().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 d.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(h=Er(mr().m(function e(){var t;return mr().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 h.apply(this,arguments)})},{key:"getUserPermissions",value:(p=Er(mr().m(function e(){return mr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return p.apply(this,arguments)})},{key:"listRoles",value:(f=Er(mr().m(function e(){var t;return mr().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 f.apply(this,arguments)})},{key:"updateRole",value:(l=Er(mr().m(function e(t,n){return mr().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 l.apply(this,arguments)})},{key:"deleteRole",value:(c=Er(mr().m(function e(t){return mr().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 c.apply(this,arguments)})},{key:"getMetrics",value:(u=Er(mr().m(function e(){var t;return mr().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 u.apply(this,arguments)})},{key:"subscribe",value:(a=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:throw new $r("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 a.apply(this,arguments)})},{key:"unsubscribe",value:(s=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:throw new $r("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 s.apply(this,arguments)})},{key:"request",value:(i=Er(mr().m(function e(t,n){var r,o,i=arguments;return mr().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 i.apply(this,arguments)})},{key:"_commonHeaders",value:(o=Er(mr().m(function e(){var t,n;return mr().w(function(e){for(;;)switch(e.n){case 0:return t={},Wr.isNode&&(t[Kr.HTTP_USER_AGENT_HEADER_NAME]=Kr.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[Kr.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[Kr.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_request",value:(r=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},e.n=1,this._ensureHttpsAgent();case 1:if(i=o.headers,s=void 0===i?{}:i,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=2,f=gr(gr({method:t,url:n,withCredentials:!1},l),{},{headers:gr({},s),params:gr({},u)}),null!==r&&(f.data=r),!this._requestSigner){e.n=3;break}return e.n=3,this._applyRequestSignature(f);case 3:return 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 $r(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,[[2,6]])})),function(e,t){return r.apply(this,arguments)})},{key:"_ensureHttpsAgent",value:(t=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:if(!Wr.isNode||!Xr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Xr;case 1:Mr&&(this._client.defaults.httpsAgent=new Mr.Agent(gr(gr({},So(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_sseRequest",value:(e=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=E.length>2&&void 0!==E[2]?E[2]:{},e.n=1,this._ensureHttpsAgent();case 1:if(o=r.params,i=void 0===o?{}:o,s=r.headers,a=void 0===s?{}:s,u=r.body,c={method:t,url:n,withCredentials:!1,responseType:"stream",timeout:0,headers:gr({},a),params:gr({},i)},null!=u&&(c.data=u),!this._requestSigner){e.n=2;break}return e.n=2,this._applyRequestSignature(c);case 2:return e.p=2,e.n=3,this._client(c);case 3:l=e.v,e.n=5;break;case 4:throw e.p=4,w=e.v,this.onError(w);case 5:if(200===l.status){e.n=21;break}f="",e.p=6,p=[],h=!1,d=!1,e.p=7,m=Hr(l.data);case 8:return e.n=9,m.next();case 9:if(!(h=!(b=e.v).done)){e.n=11;break}v=b.value,p.push(v);case 10:h=!1,e.n=8;break;case 11:e.n=13;break;case 12:e.p=12,_=e.v,d=!0,y=_;case 13:if(e.p=13,e.p=14,!h||null==m.return){e.n=15;break}return e.n=15,m.return();case 15:if(e.p=15,!d){e.n=16;break}throw y;case 16:return e.f(15);case 17:return e.f(13);case 18:f=Buffer.concat(p).toString("utf8"),e.n=20;break;case 19:e.p=19,e.v;case 20:throw g=f?this._extractErrorMessage(f):"SSE request failed with status ".concat(l.status),this.forwardingHost&&(400===l.status?g+="; streaming through node forwarding (forwardingHost=".concat(this.forwardingHost,") is relayed by")+" the agent REST listener (default port 6060): point the client at it, not at the engine listener":404!==l.status&&405!==l.status||(g+="; a forwarded stream needs X-Target-Host to name the target without its TCP port"+" (forwardingHost=".concat(this.forwardingHost,"): use a bare host or the target's agent REST port (6060)"))),new $r(g,l.status,f||null);case 21:return e.a(2,l)}},e,this,[[14,,15,17],[7,12,13,18],[6,19],[2,4]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return this._extractErrorMessage(e.toString("utf8"));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"===dr(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof $r?e:new $r(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k,P,A,j,C,N,U,x,D,L,F,B,I,H,q,M,z,X,K,W,Y}(),Co=kr(function e(t,n,r,o){Ar(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),No=function(){return kr(function e(t,n,r){Ar(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"withForwardingHost",value:(t=Er(mr().m(function e(t){var n;return mr().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=Er(mr().m(function e(){var t,n,r=this,o=arguments;return mr().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:eo,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.withForwardingHost(function(){return r._client.waitForAsyncRun(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Uo=jo;export{jo as AppMeshClient,$r as AppMeshError,Qr as AppMeshRequestError,Zr as AppMeshTimeoutError,Co as AppOutput,Jr as AppRemovedError,No as AppRun,Kr as CONSTANTS,wo as DEFAULT_CA_FILE,qn as RefreshTokenProvider,ar as RequestSigner,To as SseEnd,Nn as StaticAccessTokenProvider,Vr as TransportDisconnectedError,fo as _resolveGid,vo as _resolveGroupName,co as _resolveUid,mo as _resolveUserName,Uo as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appmesh",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.20",
|
|
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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
10
10
|
"lint": "prettier --write .",
|
|
11
|
-
"test": "node test/unit_test.js && node test/subscribe_test.js && node test/appmesh_test.js",
|
|
11
|
+
"test": "node test/unit_test.js && node test/syncrun_test.js && node test/subscribe_test.js && node test/stream_forward_test.js && node test/appmesh_test.js",
|
|
12
12
|
"test:subscribe": "node test/subscribe_test.js",
|
|
13
13
|
"build": "webpack --config webpack.config.cjs --mode production",
|
|
14
14
|
"prepare": "npm run build",
|
package/src/appmesh.js
CHANGED
|
@@ -17,6 +17,10 @@ const CONSTANTS = Object.freeze({
|
|
|
17
17
|
HTTP_USER_AGENT: "appmesh/javascript",
|
|
18
18
|
DEFAULT_RUN_APP_TIMEOUT_SECONDS: "P2D",
|
|
19
19
|
DEFAULT_RUN_APP_LIFECYCLE_SECONDS: "P2DT12H",
|
|
20
|
+
// A sync-run reply of this size is a full page; the daemon keeps that run for
|
|
21
|
+
// SYNC_RUN_TRUNCATED_RETENTION_SECONDS so the client can read the rest.
|
|
22
|
+
SYNC_RUN_OUTPUT_PAGE_BYTES: 5 * 1024 * 1024,
|
|
23
|
+
SYNC_RUN_TRUNCATED_RETENTION_SECONDS: 600,
|
|
20
24
|
HTTP_HEADER_KEY_AUTH: "Authorization",
|
|
21
25
|
HTTP_HEADER_KEY_X_TARGET_HOST: "X-Target-Host",
|
|
22
26
|
HTTP_HEADER_KEY_X_FILE_PATH: "X-File-Path",
|
|
@@ -26,6 +30,8 @@ const CONSTANTS = Object.freeze({
|
|
|
26
30
|
HTTP_HEADER_KEY_X_FILE_GROUP: "X-File-Group",
|
|
27
31
|
HTTP_HEADER_KEY_X_OUTPUT_POSITION: "X-Output-Position",
|
|
28
32
|
HTTP_HEADER_KEY_X_EXIT_CODE: "X-Exit-Code",
|
|
33
|
+
HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED: "X-Output-Truncated",
|
|
34
|
+
HTTP_HEADER_KEY_X_APP_NAME: "X-App-Name",
|
|
29
35
|
HTTP_HEADER_KEY_X_INPUT_CLOSE: "X-Input-Close",
|
|
30
36
|
HTTP_HEADER_KEY_X_SUBSCRIPTION_ID: "X-Subscription-Id",
|
|
31
37
|
HTTP_HEADER_KEY_X_APPMESH_PROCESS_KEY: "X-AppMesh-Process-Key",
|
|
@@ -224,6 +230,82 @@ function parseDuration(duration) {
|
|
|
224
230
|
return seconds;
|
|
225
231
|
}
|
|
226
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Normalize a response body to raw bytes. Buffer stays a Buffer (Node, also the TCP
|
|
235
|
+
* transport); ArrayBuffer / typed arrays become a Uint8Array view over the same memory;
|
|
236
|
+
* anything else (a string from a stubbed transport) is UTF-8 encoded.
|
|
237
|
+
* @param {*} data - Response body
|
|
238
|
+
* @returns {Uint8Array} Raw body bytes
|
|
239
|
+
* @private
|
|
240
|
+
*/
|
|
241
|
+
function _toBytes(data) {
|
|
242
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(data)) return data;
|
|
243
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
244
|
+
if (ArrayBuffer.isView(data)) return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
245
|
+
return new TextEncoder().encode(data == null ? "" : String(data));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Concatenate raw byte chunks.
|
|
250
|
+
* @param {Uint8Array[]} chunks - Byte chunks (Buffers or Uint8Arrays)
|
|
251
|
+
* @returns {Uint8Array} One contiguous byte sequence
|
|
252
|
+
* @private
|
|
253
|
+
*/
|
|
254
|
+
function _concatBytes(chunks) {
|
|
255
|
+
if (typeof Buffer !== "undefined") {
|
|
256
|
+
return Buffer.concat(chunks.map(c => Buffer.isBuffer(c) ? c : Buffer.from(c.buffer, c.byteOffset, c.byteLength)));
|
|
257
|
+
}
|
|
258
|
+
let total = 0;
|
|
259
|
+
for (const chunk of chunks) total += chunk.byteLength;
|
|
260
|
+
const joined = new Uint8Array(total);
|
|
261
|
+
let offset = 0;
|
|
262
|
+
for (const chunk of chunks) {
|
|
263
|
+
joined.set(chunk, offset);
|
|
264
|
+
offset += chunk.byteLength;
|
|
265
|
+
}
|
|
266
|
+
return joined;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The Content-Type of a response: the header, or (framed transport) the body type
|
|
271
|
+
* the daemon put in the message instead of a header.
|
|
272
|
+
* @param {Object} response - Response object
|
|
273
|
+
* @returns {*} Content-Type value or undefined
|
|
274
|
+
* @private
|
|
275
|
+
*/
|
|
276
|
+
function _responseContentType(response) {
|
|
277
|
+
return _getHeader(response.headers, "content-type") || (response.contentType == null ? undefined : response.contentType);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The charset of a Content-Type header value, or null when none is declared.
|
|
282
|
+
* @param {*} contentType - Content-Type header value
|
|
283
|
+
* @returns {string|null} Charset label as sent by the server
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
function _charsetOf(contentType) {
|
|
287
|
+
const match = /charset\s*=\s*"?([\w!#$%&*+\-.^`|~]+)"?/i.exec(String(contentType || ""));
|
|
288
|
+
return match ? match[1] : null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Decode bytes in the given charset (UTF-8 when null or unsupported by this runtime).
|
|
293
|
+
* Malformed sequences are replaced, like axios's own text decoding.
|
|
294
|
+
* @param {Uint8Array} bytes - Raw bytes
|
|
295
|
+
* @param {string|null} charset - Charset label
|
|
296
|
+
* @returns {string} Decoded text
|
|
297
|
+
* @private
|
|
298
|
+
*/
|
|
299
|
+
function _decodeBytes(bytes, charset) {
|
|
300
|
+
for (const label of [charset, "utf-8"]) {
|
|
301
|
+
if (!label) continue;
|
|
302
|
+
try {
|
|
303
|
+
return new TextDecoder(label).decode(bytes);
|
|
304
|
+
} catch (error) { /* unsupported label: fall back to UTF-8 */ }
|
|
305
|
+
}
|
|
306
|
+
return new TextDecoder("utf-8").decode(bytes);
|
|
307
|
+
}
|
|
308
|
+
|
|
227
309
|
/**
|
|
228
310
|
* Case-insensitive header lookup (axios lowercases names; the TCP transport keeps the daemon's case).
|
|
229
311
|
* @param {Object} headers - Response headers
|
|
@@ -966,36 +1048,114 @@ class AppMeshClient {
|
|
|
966
1048
|
|
|
967
1049
|
/**
|
|
968
1050
|
* Run an app synchronously and stream the returned stdout body to `stdoutHandler`.
|
|
1051
|
+
*
|
|
1052
|
+
* A reply is at most one page (SYNC_RUN_OUTPUT_PAGE_BYTES). A full page is followed by
|
|
1053
|
+
* the rest, read from the output endpoint: `stdoutHandler` gets the complete output once.
|
|
969
1054
|
* @param {Object} app - App configuration
|
|
970
1055
|
* @param {Function} [stdoutHandler=defaultOutputHandler] - Stdout handler callback(data, position)
|
|
971
1056
|
* @param {number|string} [maxTime] - Max runtime
|
|
972
1057
|
* @param {number|string} [lifecycle] - Lifecycle time
|
|
1058
|
+
* @param {number|null} [maxOutputBytes=null] - Ceiling on the total output in bytes
|
|
1059
|
+
* (`null`: unlimited). Exceeding it rejects; the run instance is then left in place.
|
|
973
1060
|
* @returns {Promise<number|null>} Exit code parsed from `X-Exit-Code`, or `null` when absent
|
|
1061
|
+
* @throws {AppMeshRequestError} The output exceeds `maxOutputBytes`.
|
|
974
1062
|
*/
|
|
975
1063
|
async runAppSync(app, stdoutHandler = defaultOutputHandler, maxTime = CONSTANTS.DEFAULT_RUN_APP_TIMEOUT_SECONDS,
|
|
976
|
-
lifecycle = CONSTANTS.DEFAULT_RUN_APP_LIFECYCLE_SECONDS) {
|
|
1064
|
+
lifecycle = CONSTANTS.DEFAULT_RUN_APP_LIFECYCLE_SECONDS, maxOutputBytes = null) {
|
|
977
1065
|
const params = {
|
|
978
1066
|
timeout: parseDuration(maxTime),
|
|
979
1067
|
lifecycle: parseDuration(lifecycle)
|
|
980
1068
|
};
|
|
981
1069
|
|
|
982
|
-
|
|
1070
|
+
// Raw bytes: pages are joined as bytes and decoded once (a character may span pages).
|
|
1071
|
+
const response = await this._request("post", "/appmesh/app/syncrun", app, {
|
|
1072
|
+
params, config: { responseType: "arraybuffer" }
|
|
1073
|
+
});
|
|
983
1074
|
let exitCode = null;
|
|
984
1075
|
|
|
985
|
-
if (stdoutHandler) {
|
|
986
|
-
stdoutHandler(response.data, 0);
|
|
987
|
-
}
|
|
988
1076
|
if (response.status === 200) {
|
|
989
1077
|
// axios lowercases header names; the TCP transport keeps the daemon's exact case
|
|
990
1078
|
const exitCodeHeader = _getHeader(response.headers, CONSTANTS.HTTP_HEADER_KEY_X_EXIT_CODE);
|
|
991
1079
|
if (exitCodeHeader) {
|
|
992
1080
|
exitCode = parseInt(exitCodeHeader, 10);
|
|
993
1081
|
}
|
|
1082
|
+
// A full page keeps the run instance alive for the client to page the rest.
|
|
1083
|
+
// Older daemons send neither header: the reply is the whole output.
|
|
1084
|
+
const runName = _getHeader(response.headers, CONSTANTS.HTTP_HEADER_KEY_X_APP_NAME);
|
|
1085
|
+
const truncated = _getHeader(response.headers, CONSTANTS.HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED);
|
|
1086
|
+
if (runName && String(truncated) === "1") {
|
|
1087
|
+
const positionHeader = _getHeader(response.headers, CONSTANTS.HTTP_HEADER_KEY_X_OUTPUT_POSITION);
|
|
1088
|
+
const output = await this._readTruncatedRunOutput(response, runName, maxOutputBytes,
|
|
1089
|
+
positionHeader ? parseInt(positionHeader, 10) : NaN);
|
|
1090
|
+
if (stdoutHandler) {
|
|
1091
|
+
stdoutHandler(output, 0);
|
|
1092
|
+
}
|
|
1093
|
+
return exitCode;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
if (stdoutHandler) {
|
|
1098
|
+
stdoutHandler(_decodeBytes(_toBytes(response.data), _charsetOf(_responseContentType(response))), 0);
|
|
994
1099
|
}
|
|
995
1100
|
|
|
996
1101
|
return exitCode;
|
|
997
1102
|
}
|
|
998
1103
|
|
|
1104
|
+
/**
|
|
1105
|
+
* Page the output that follows a full sync-run reply and delete the run instance.
|
|
1106
|
+
* @param {Object} first - The sync-run response: raw bytes in `data`, charset in `Content-Type`
|
|
1107
|
+
* @param {string} runName - Run instance name (`X-App-Name`)
|
|
1108
|
+
* @param {number|null} maxOutputBytes - Byte ceiling, `null` for no limit
|
|
1109
|
+
* @param {number} position - Byte offset to continue from (`X-Output-Position` of the reply)
|
|
1110
|
+
* @returns {Promise<string>} The complete output, decoded once in the charset of `first`
|
|
1111
|
+
* @throws {AppMeshRequestError} The output exceeds `maxOutputBytes`; the run is kept.
|
|
1112
|
+
* @private
|
|
1113
|
+
*/
|
|
1114
|
+
async _readTruncatedRunOutput(first, runName, maxOutputBytes, position) {
|
|
1115
|
+
const chunks = [_toBytes(first.data)];
|
|
1116
|
+
if (!Number.isFinite(position)) {
|
|
1117
|
+
// No offset header: continue right after the first page.
|
|
1118
|
+
position = chunks[0].byteLength;
|
|
1119
|
+
}
|
|
1120
|
+
const exceeds = () => {
|
|
1121
|
+
const total = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
|
1122
|
+
if (maxOutputBytes !== null && maxOutputBytes !== undefined && total > maxOutputBytes) {
|
|
1123
|
+
throw new AppMeshRequestError(
|
|
1124
|
+
`run output exceeds maxOutputBytes=${maxOutputBytes}; the rest stays readable on application ` +
|
|
1125
|
+
`'${runName}' for ${CONSTANTS.SYNC_RUN_TRUNCATED_RETENTION_SECONDS} seconds`,
|
|
1126
|
+
first.status);
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
exceeds();
|
|
1130
|
+
let complete = false;
|
|
1131
|
+
try {
|
|
1132
|
+
while (true) {
|
|
1133
|
+
const page = await this._request("get", `/appmesh/app/${runName}/output`, null, {
|
|
1134
|
+
params: { stdout_position: String(position) }, config: { responseType: "arraybuffer" }
|
|
1135
|
+
});
|
|
1136
|
+
const bytes = _toBytes(page.data);
|
|
1137
|
+
chunks.push(bytes);
|
|
1138
|
+
// Offset advances by raw bytes; the ceiling is checked before the short page ends the loop.
|
|
1139
|
+
position += bytes.byteLength;
|
|
1140
|
+
exceeds();
|
|
1141
|
+
if (bytes.byteLength < CONSTANTS.SYNC_RUN_OUTPUT_PAGE_BYTES) {
|
|
1142
|
+
complete = true;
|
|
1143
|
+
break;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
} finally {
|
|
1147
|
+
// Best effort: the daemon removes the run when the retention ends.
|
|
1148
|
+
if (complete) {
|
|
1149
|
+
try {
|
|
1150
|
+
await this.deleteApp(runName);
|
|
1151
|
+
} catch (error) {
|
|
1152
|
+
console.warn(`Warning: Failed to remove sync run application '${runName}':`, error.message);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return _decodeBytes(_concatBytes(chunks), _charsetOf(_responseContentType(first)));
|
|
1157
|
+
}
|
|
1158
|
+
|
|
999
1159
|
/**
|
|
1000
1160
|
* Run an app asynchronously and return a handle for later polling.
|
|
1001
1161
|
* @param {Object} app - App config
|
|
@@ -1688,7 +1848,9 @@ class AppMeshClient {
|
|
|
1688
1848
|
/**
|
|
1689
1849
|
* Open a server-sent-events stream as a streamed response. Plain HTTP by design: SSE
|
|
1690
1850
|
* frames cannot ride a framed (TCP/WSS) transport, so framed subclasses redirect this
|
|
1691
|
-
* hook to direct HTTPS (the WSS file data side-channel shape).
|
|
1851
|
+
* hook to direct HTTPS (the WSS file data side-channel shape). `forwardingHost` is carried
|
|
1852
|
+
* like on any request: the agent REST listener (default port 6060) relays the stream; the
|
|
1853
|
+
* engine's own listener answers a forwarded stream with 400.
|
|
1692
1854
|
*
|
|
1693
1855
|
* @private
|
|
1694
1856
|
* @param {string} method - HTTP method ('get' or 'post')
|
|
@@ -1731,9 +1893,20 @@ class AppMeshClient {
|
|
|
1731
1893
|
for await (const chunk of response.data) chunks.push(chunk);
|
|
1732
1894
|
detail = Buffer.concat(chunks).toString("utf8");
|
|
1733
1895
|
} catch (_) { /* socket already gone — raise a status-only error */ }
|
|
1734
|
-
|
|
1896
|
+
let message = detail
|
|
1735
1897
|
? this._extractErrorMessage(detail)
|
|
1736
1898
|
: `SSE request failed with status ${response.status}`;
|
|
1899
|
+
if (this.forwardingHost) {
|
|
1900
|
+
if (response.status === 400) {
|
|
1901
|
+
// Only the engine's own listener refuses X-Target-Host on a stream route.
|
|
1902
|
+
message += `; streaming through node forwarding (forwardingHost=${this.forwardingHost}) is relayed by` +
|
|
1903
|
+
` the agent REST listener (default port 6060): point the client at it, not at the engine listener`;
|
|
1904
|
+
} else if (response.status === 404 || response.status === 405) {
|
|
1905
|
+
// A forwarded stream that lands on the target's TCP listener finds no stream route.
|
|
1906
|
+
message += `; a forwarded stream needs X-Target-Host to name the target without its TCP port` +
|
|
1907
|
+
` (forwardingHost=${this.forwardingHost}): use a bare host or the target's agent REST port (6060)`;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1737
1910
|
throw new AppMeshError(message, response.status, detail || null);
|
|
1738
1911
|
}
|
|
1739
1912
|
return response;
|
|
@@ -1750,6 +1923,11 @@ class AppMeshClient {
|
|
|
1750
1923
|
return "Unknown error";
|
|
1751
1924
|
}
|
|
1752
1925
|
|
|
1926
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(responseData)) {
|
|
1927
|
+
// Binary-typed body over the TCP transport: same handling as an ArrayBuffer.
|
|
1928
|
+
return this._extractErrorMessage(responseData.toString("utf8"));
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1753
1931
|
if (responseData instanceof ArrayBuffer) {
|
|
1754
1932
|
try {
|
|
1755
1933
|
const textDecoder = new TextDecoder("utf-8");
|
package/src/appmesh_tcp.js
CHANGED
|
@@ -549,17 +549,22 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
549
549
|
* (null=default CA, object=custom ca/cert/key, false=insecure).
|
|
550
550
|
* @param {Array<string, number>|{host: string, port: number}} [tcpAddress=['127.0.0.1', 6062]] - TCP server address
|
|
551
551
|
* @param {number} [restPort=6063] - REST port of the same daemon for the streaming side channel
|
|
552
|
-
* (followOutput / runTaskStream); also honored as a `restPort` key on the
|
|
552
|
+
* (followOutput / runTaskStream / streamRun) for local streams; also honored as a `restPort` key on the
|
|
553
|
+
* `{host, port}` address object
|
|
554
|
+
* @param {number} [agentPort=6060] - Agent REST port on the same host for the streaming side channel when
|
|
555
|
+
* `forwardingHost` is set (the engine listener does not stream through node forwarding, the agent relays it);
|
|
556
|
+
* also honored as an `agentPort` key on the `{host, port}` address object
|
|
553
557
|
*/
|
|
554
|
-
constructor (sslConfig = null, tcpAddress = ['127.0.0.1', 6062], restPort = null) {
|
|
558
|
+
constructor (sslConfig = null, tcpAddress = ['127.0.0.1', 6062], restPort = null, agentPort = null) {
|
|
555
559
|
// Accept the address-first object form: new AppMeshClientTCP({host, port}, sslConfig)
|
|
556
560
|
if (_isAddressObject(sslConfig)) {
|
|
557
561
|
const addr = sslConfig
|
|
558
562
|
sslConfig = (Array.isArray(tcpAddress) || _isAddressObject(tcpAddress)) ? null : tcpAddress
|
|
559
563
|
tcpAddress = addr
|
|
560
564
|
}
|
|
561
|
-
if (_isAddressObject(tcpAddress)
|
|
562
|
-
restPort = tcpAddress.restPort
|
|
565
|
+
if (_isAddressObject(tcpAddress)) {
|
|
566
|
+
if (restPort == null) restPort = tcpAddress.restPort
|
|
567
|
+
if (agentPort == null) agentPort = tcpAddress.agentPort
|
|
563
568
|
}
|
|
564
569
|
tcpAddress = _normalizeTcpAddress(tcpAddress)
|
|
565
570
|
|
|
@@ -576,7 +581,10 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
576
581
|
// The SSE side channel (_sseRequest) dials the daemon's REST listener on the same host.
|
|
577
582
|
this._restHost = tcpAddress[0]
|
|
578
583
|
this._restPort = restPort ?? 6063
|
|
584
|
+
// A forwarded stream dials the agent REST listener instead (see _ensureRestChannel).
|
|
585
|
+
this._agentPort = agentPort ?? 6060
|
|
579
586
|
this._restChannelClient = null
|
|
587
|
+
this._agentChannelClient = null
|
|
580
588
|
}
|
|
581
589
|
|
|
582
590
|
/**
|
|
@@ -591,11 +599,14 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
591
599
|
this.tcpTransport.close()
|
|
592
600
|
this.tcpTransport = null
|
|
593
601
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
602
|
+
for (const channel of [this._restChannelClient, this._agentChannelClient]) {
|
|
603
|
+
if (channel) {
|
|
604
|
+
// Release the streaming side channel's keep-alive sockets.
|
|
605
|
+
channel._client.defaults.httpsAgent?.destroy?.()
|
|
606
|
+
}
|
|
598
607
|
}
|
|
608
|
+
this._restChannelClient = null
|
|
609
|
+
this._agentChannelClient = null
|
|
599
610
|
}
|
|
600
611
|
|
|
601
612
|
/**
|
|
@@ -632,9 +643,7 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
632
643
|
}
|
|
633
644
|
|
|
634
645
|
if (this.forwardingHost) {
|
|
635
|
-
request.headers[HTTP_HEADER_KEY_X_TARGET_HOST] = this.
|
|
636
|
-
? this.forwardingHost
|
|
637
|
-
: `${this.forwardingHost}:${this.tcpTransport.address[1]}`
|
|
646
|
+
request.headers[HTTP_HEADER_KEY_X_TARGET_HOST] = this._forwardTargetHeader()
|
|
638
647
|
}
|
|
639
648
|
|
|
640
649
|
if (options.headers) {
|
|
@@ -713,10 +722,13 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
713
722
|
}
|
|
714
723
|
|
|
715
724
|
// Convert to standard response format matching axios structure
|
|
725
|
+
const ctKey = Object.keys(response.headers || {}).find(k => k.toLowerCase() === 'content-type')
|
|
716
726
|
const result = {
|
|
717
727
|
status: response.httpStatus,
|
|
718
728
|
statusText: this._getStatusText(response.httpStatus),
|
|
719
729
|
headers: response.headers,
|
|
730
|
+
// The daemon puts the MIME type in body_msg_type, not a header; expose it like axios's.
|
|
731
|
+
contentType: response.bodyMsgType || (ctKey ? response.headers[ctKey] : undefined),
|
|
720
732
|
data: this._decodeBody(response, options),
|
|
721
733
|
config: options
|
|
722
734
|
}
|
|
@@ -809,29 +821,73 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
809
821
|
}
|
|
810
822
|
|
|
811
823
|
/**
|
|
812
|
-
*
|
|
824
|
+
* The X-Target-Host value every request of this client carries, the framed ones and the
|
|
825
|
+
* streaming side channel alike: as given when it has a port, else the target's port is the
|
|
826
|
+
* one this client dials.
|
|
827
|
+
* @private
|
|
828
|
+
*/
|
|
829
|
+
_forwardTargetHeader () {
|
|
830
|
+
if (!this.forwardingHost) return null
|
|
831
|
+
return this.forwardingHost.includes(':')
|
|
832
|
+
? this.forwardingHost
|
|
833
|
+
: `${this.forwardingHost}:${this.tcpTransport.address[1]}`
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Lazily build the direct-HTTPS client the streaming side channel uses, and keep its token
|
|
838
|
+
* provider, signer and forward target in step with this client.
|
|
839
|
+
* @private
|
|
840
|
+
*/
|
|
841
|
+
_syncSideChannel (client) {
|
|
842
|
+
// Re-sync on every use so a later setBearerToken()/enableRequestSignature() reaches the side channel too.
|
|
843
|
+
if (this._tokenProvider && client._tokenProvider !== this._tokenProvider) {
|
|
844
|
+
client.setTokenProvider(this._tokenProvider)
|
|
845
|
+
}
|
|
846
|
+
if (client._requestSigner !== this._requestSigner) {
|
|
847
|
+
client._requestSigner = this._requestSigner
|
|
848
|
+
}
|
|
849
|
+
// Sent as given on the agent hop, without the TCP port the framed requests append:
|
|
850
|
+
// an explicit port names the target's TCP listener, which does not serve streams.
|
|
851
|
+
const target = this.forwardingHost || null
|
|
852
|
+
if (client.forwardingHost !== target) client.forwardingHost = target
|
|
853
|
+
return client
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* The side-channel client a local stream dials: the engine's REST listener on the same host.
|
|
813
858
|
* @private
|
|
814
859
|
*/
|
|
815
860
|
_ensureRestChannel () {
|
|
816
861
|
if (!this._restChannelClient) {
|
|
817
862
|
this._restChannelClient = new AppMeshClient(`https://${this._restHost}:${this._restPort}`, this._sslConfig)
|
|
818
863
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
864
|
+
return this._syncSideChannel(this._restChannelClient)
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* The side-channel client a forwarded stream dials: the agent REST listener on the same
|
|
869
|
+
* host. The engine listener answers X-Target-Host on a stream route with 400, the agent
|
|
870
|
+
* relays the stream through node forwarding, so the target node runs the task.
|
|
871
|
+
* @private
|
|
872
|
+
*/
|
|
873
|
+
_ensureAgentChannel () {
|
|
874
|
+
if (!this._agentChannelClient) {
|
|
875
|
+
this._agentChannelClient = new AppMeshClient(`https://${this._restHost}:${this._agentPort}`, this._sslConfig)
|
|
822
876
|
}
|
|
823
|
-
return this.
|
|
877
|
+
return this._syncSideChannel(this._agentChannelClient)
|
|
824
878
|
}
|
|
825
879
|
|
|
826
880
|
/**
|
|
827
|
-
* Open an SSE stream over direct HTTPS
|
|
828
|
-
*
|
|
829
|
-
*
|
|
881
|
+
* Open an SSE stream over direct HTTPS: the framed transport answers one buffered frame and
|
|
882
|
+
* cannot carry a chunked event stream (bypassed like the WSS file data channel); plain
|
|
883
|
+
* request/response routes stay on the framed transport. A forwarded stream (`forwardingHost`
|
|
884
|
+
* set) goes to the agent REST listener with X-Target-Host, a local one to the engine listener.
|
|
830
885
|
* @private
|
|
831
886
|
* @override
|
|
832
887
|
*/
|
|
833
888
|
async _sseRequest (method, path, options = {}) {
|
|
834
|
-
|
|
889
|
+
const channel = this.forwardingHost ? this._ensureAgentChannel() : this._ensureRestChannel()
|
|
890
|
+
return channel._sseRequest(method, path, options)
|
|
835
891
|
}
|
|
836
892
|
|
|
837
893
|
/**
|