appmesh 3.1.11 → 3.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appmesh.esm.js +1 -1
- package/package.json +1 -1
- package/src/appmesh.js +172 -3
- package/src/appmesh_tcp.js +11 -0
- package/src/request_signature.js +251 -0
package/dist/appmesh.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),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,c=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);c<r.length;c++)a=r[c],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0};n.f.j=(o,i)=>{let s=n.o(t,o)?t[o]:void 0;if(0!==s)if(s)i.push(s[1]);else{let n=e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e});n=Promise.race([n,new Promise(e=>s=t[o]=[e])]),i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>qe,hasStandardBrowserEnv:()=>Me,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>He,origin:()=>We});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:c}=Symbol,u=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),f=(e,t,n)=>e===Object.prototype||!n&&null===t,p=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=s(n);if(f(n,o,n===e))return!1;if(u(n,t))return!0;n=o}return!1},h=(d=Object.create(null),e=>{const t=i.call(e);return d[t]||(d[t]=t.slice(8,-1).toLowerCase())});var d;const y=e=>(e=e.toLowerCase(),t=>h(t)===e),m=e=>t=>typeof t===e,{isArray:b}=Array,g=m("undefined");function w(e){return null!==e&&!g(e)&&null!==e.constructor&&!g(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=y("ArrayBuffer");const _=m("string"),O=m("function"),E=m("number"),S=e=>null!==e&&"object"==typeof e,R=e=>{if(!S(e))return!1;const t=s(e);return(null===t||t===Object.prototype||null===s(t))&&(f(e,t,!0)||!u(e,c)&&!u(e,a))},P=y("Date"),T=y("File"),k=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(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=e=>!g(e)&&e!==I;const H=(M="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>M&&e instanceof M);var M;const z=y("HTMLFormElement"),{propertyIsEnumerable:W}=Object.prototype,$=y("RegExp"),G=(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 J=y("AsyncFunction"),K=(X="function"==typeof setImmediate,V=O(I.postMessage),X?setImmediate:V?(Y=`axios@${Math.random()}`,Q=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===Y&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),I.postMessage(Y,"*")}):e=>setTimeout(e));var X,V,Y,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||K,ee=e=>null!=e&&O(e[a]),te={isArray:b,isArrayBuffer:v,isBuffer:w,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!O(e.append))return!1;const n=h(e);return"formdata"===n||"object"===n&&O(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&v(e.buffer),t},isString:_,isNumber:E,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:R,isEmptyObject:e=>{if(!S(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:x,isRequest:D,isResponse:L,isHeaders:F,isUndefined:g,isDate:P,isFile:T,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:k,isRegExp:$,isFunction:O,isStream:e=>S(e)&&O(e.pipe),isURLSearchParams:U,isTypedArray:H,isFileList:A,forEach:B,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&&u(o,t)?s=t:i[e]=n}const a=u(o,s)?o[s]:void 0;R(a)&&R(t)?o[s]=e(a,t):R(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&g(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(B(n,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];W.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(B(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf: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&&u(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:u,hasOwnProp:u,hasOwnInPrototypeChain:p,getSafeProp:(e,t)=>null!=e&&p(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=s(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(l(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:s(i);if(f(i,a,i===e))break;const c=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&c.push(...Object.getOwnPropertySymbols(i));for(const t of c)l(t)||u(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:G,freezeMethods:e=>{G(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];O(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return 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(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null},global:I,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&O(e.append)&&"FormData"===e[c]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),j(e)){r=[];for(const t of e){const e=n(t);!g(e)&&r.push(e)}}else r=b(e)?[]:{},B(e,(e,t)=>{const o=n(e);!g(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:J,isThenable:e=>e&&(S(e)||O(e))&&O(e.then)&&O(e.catch),setImmediate:K,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 ce(e){return e&&String(e).trim().toLowerCase()}function ue(e){return!1===e||null==e?e:te.isArray(e)?e.map(ue):(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=ce(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)]=ue(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=ce(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=ce(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=ce(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]=ue(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]=ue(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 c=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}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(s(e),r=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ae]=this[ae]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ce(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 ge(e){try{return String(e)}catch(e){return""}}const we=Symbol("causeStack");class ve 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?ge(e.message):ge(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new ve(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,we,{__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}}}ve.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ve.ERR_BAD_OPTION="ERR_BAD_OPTION",ve.ECONNABORTED="ECONNABORTED",ve.ETIMEDOUT="ETIMEDOUT",ve.ECONNREFUSED="ECONNREFUSED",ve.ERR_NETWORK="ERR_NETWORK",ve.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ve.ERR_DEPRECATED="ERR_DEPRECATED",ve.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ve.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ve.ERR_CANCELED="ERR_CANCELED",ve.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ve.ERR_INVALID_URL="ERR_INVALID_URL",ve.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _e=ve;function Oe(e){return te.isPlainObject(e)||te.isArray(e)}function Ee(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=Ee(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Re=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Pe=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),c=r("Blob")||"undefined"!=typeof Blob&&Blob,u=r("maxDepth",100),l=c&&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 c)return new c([e]);throw new _e("Blob is not supported. Use a Buffer instead.",_e.ERR_NOT_SUPPORT)}return e}function h(e){if(e>u)throw new _e("Object is too deeply nested ("+e+" levels). Max depth: "+u,_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(u===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(Oe)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Ee(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!!Oe(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(Re,{defaultVisitor:d,convertValue:p,isVisitable:Oe});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 ke(e,t){this._pairs=[],e&&Pe(e,this,t)}const Ae=ke.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=ke;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"]},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,We=qe&&window.location.href||"http://localhost",$e={...r,...Ie};function Ge(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 Je(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 Ke(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Je(e):e}const Xe=function(e){function t(e,n,r,o){Ge(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]=Ke(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]=Je(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));)Ge(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]=Ke(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Ve=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ye=(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(Xe(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=Ye(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Pe(e,new $e.classes.URLSearchParams,{visitor:function(e,t,n,r){return $e.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=Ye(this,"env"),r=n&&n.FormData;return Pe(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=Ye(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ye(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,Ye(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ye(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(Ve,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}},ct=$e.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 ut=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const p=u&&c-u;return p?Math.round(1e3*f/p):void 0}};const 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=ut(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),c=Math.max(0,a-r),u=o(c);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},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=$e.hasStandardBrowserEnv?(e=>t=>(t=new URL(t,document.baseURI||$e.origin),e.protocol===t.protocol&&e.host===t.host&&e.port===t.port))(new URL($e.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 gt(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 wt=e=>e instanceof ye?{...e}:e,vt=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 Ot(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 Et(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 Rt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Pt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),Tt={url:Et,method:Et,data:Et,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(vt(e)),s=new Set(vt(t));new Set([...o,...s]).forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;const a=s.has(n),c=a?t[n]:void 0,u=a&&!te.isPlainObject(c)||!o.has(n)?void 0:e[n];r[n]=a?i(u,c):i(void 0,u)})}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:Rt,headers:function(e,t,n){return Ot(wt(e),wt(t),0,!0)}};function kt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Pt);const r=vt({...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]:Ot,a=te.hasOwnProp(e,i)?e[i]:void 0,c=te.hasOwnProp(t,i)?t[i]:void 0,u=s===Rt?s(a,c,i,e,t):s(a,c,i);te.isUndefined(u)&&s!==Rt||(n[i]=u)}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=>ct.read(e);const Nt=function(e,t=Ct){const n=kt({},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 c=r("headers");const u=r("auth"),l=r("baseURL"),f=r("allowAbsoluteUrls"),p=r("url");if(n.headers=c=ye.from(c),n.url=Ne(gt(l,p,f,n),r("params"),r("paramsSerializer")),u){const t=te.getSafeProp(u,"username")||"",n=te.getSafeProp(u,"password")||"",o=r("transitional"),i=o&&te.hasOwnProp(o,"encodeBasicAuthUsername")&&!0===o.encodeBasicAuthUsername;try{c.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");$e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||te.isReactNative(o)?c.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)}(c,e.call(o),r("formDataHeaderPolicy"))}if($e.hasStandardBrowserEnv){te.isFunction(i)&&(i=i(n));if(!0===i||null==i&&dt(n.url)){const e=s&&a&&t(a);e&&c.set(s,e)}}return n},Ut="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){let r,o;try{const e=$e.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 c,u,l,f,p,h,d,{responseType:y,onUploadProgress:m,onDownloadProgress:b}=i;function g(){clearTimeout(u);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}w&&(f&&w.removeEventListener("progress",f),w.upload&&(l&&w.upload.removeEventListener("progress",l),p&&w.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(c),i.signal&&i.signal.removeEventListener("abort",c)}let w=new XMLHttpRequest;function v(r){if(!w)return;if(!(0!==w.status||"file"===(st(it(i.url))||st($e.origin))||w.responseURL&&w.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,w)),g(),void(w=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!w)return;const o=ye.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders());rt(function(e){t(e),g()},function(e){n(e),g()},{data:y&&"text"!==y&&"json"!==y?w.response:w.responseText,status:w.status,statusText:w.statusText,headers:o,config:e,request:w}),w=null}if(w.open(i.method.toUpperCase(),i.url,!0),w.timeout=i.timeout,"onloadend"in w?w.onloadend=v:w.onreadystatechange=function(){w&&4===w.readyState&&(0!==w.status||w.responseURL&&w.responseURL.startsWith("file:"))&&setTimeout(v)},w.onabort=function(){w&&(n(new _e("Request aborted",_e.ECONNABORTED,e,w)),g(),w=null)},w.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,w);o.event=t||null,n(o),g(),w=null},w.ontimeout=function(){if(!w)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,w)),g(),w=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(w.withCredentials=!!i.withCredentials),y&&"json"!==y&&(w.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),w.addEventListener("progress",f)),m&&w.upload&&([l,p]=ft(m),w.upload.addEventListener("progress",l),w.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(c=t=>{if(!w)return;n(!t||t.type?new nt(null,e,w):t);const r=w;g(),w=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(c),!w)return;i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c))}if(!w)return;const _=st(i.url);if(_&&!$e.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void g();const O=()=>{w&&("setRequestHeader"in w&&te.forEach(se(a),function(e,t){w.setRequestHeader(t,e)}),w.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=w.timeout>0?t()+Number(w.timeout):void 0,s=()=>{if(!w)return;const e=w;e.ontimeout(),e.abort()};if(void 0!==r){const e=()=>{const n=r-t();n>0?u=setTimeout(e,Math.min(n,2147483647)):s()};e()}ct.readAsync(o).then(e=>{if(w)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}O()}}).catch(t=>{w&&(n(_e.from(t,null,e,w)),g(),w=null)})}else O()})},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),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($e.generateString))o="axios-"+$e.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=[],c=e=>{if(s+e>n)throw r()};c(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");c(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(It(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+=Bt+Bt;const u=Ht(i,!1)+r+2;c(u),s+=u,a.push({header:i,value:n,isString:e})}const u=[];for(const e of a)u.push(e.header,e.isString?It(e.value):e.value,Bt);return u.push(i),new t(u,{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 Wt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,$t=(e,t,n)=>t+2<n&&Wt(e.charCodeAt(t+1))&&Wt(e.charCodeAt(t+2)),Gt=e=>e<=57?e-48:(223&e)-55,Jt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Kt=e=>9===e||10===e||12===e||13===e||32===e,Xt=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)},Vt=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&&$t(e,i,t)&&(s=16*Gt(e.charCodeAt(i+1))+Gt(e.charCodeAt(i+2)),i+=2),Kt(s)||(61!==s?!Jt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?Xt(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Yt=(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&&$t(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,c=o?Zt(o):"function"==typeof fetch,u=Zt(i),l=Zt(s);if(!c)return!1;const f=c&&Zt(n),p=c&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const d=u&&f&&tn(()=>{let e=!1;const t=new i($e.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),y=l&&f&&tn(()=>te.isReadableStream(new s("").body)),m=Object.assign(Object.create(null),Qt);u&&!tn(()=>new i($e.origin,m))&&(delete m.cache,tn(()=>new i($e.origin,m))||(m.cache=Qt.cache));const b={stream:y&&(e=>e.body)};c&&["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 g=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:c,signal:l,cancelToken:p,timeout:h,onDownloadProgress:w,onUploadProgress:v,responseType:_,headers:O,withCredentials:E="same-origin",fetchOptions:S,maxContentLength:R,maxBodyLength:P,maxRedirects:T}=Nt(e);const k=te.isNumber(R)&&R>-1,A=te.isNumber(P)&&P>-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,$e.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&&(O.delete("authorization"),O.set("Authorization","Basic "+btoa((I=(o.username||"")+":"+(o.password||""),encodeURIComponent(I).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),k&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Yt(-1===t?e:e.slice(0,t),Vt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>R)throw new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const h=te.isSpecCompliantForm(c)&&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(c)&&"get"!==n&&"head"!==n&&(A||v&&d||void 0!==q)&&(c=zt(c,a,A?P:1/0,B,q),O.setContentType(void 0===q?c.type:h),D=c.size),A&&"get"!==n&&"head"!==n){const e=await g(c);if("number"==typeof e&&isFinite(e)&&(D=e,e>P))throw B()}const H=A&&(te.isReadableStream(c)||te.isStream(c)),M=(e,t,n)=>Ft(e,65536,e=>{if(A&&e>P)throw L=B();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(v||H)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??g(t)})(O,c),0!==D||H){let e,n=new i(t,{method:"POST",body:c,duplex:"half"});if(te.isFormData(c)&&(e=n.headers.get("content-type"))&&O.setContentType(e),n.body){const[e,t]=v&&pt(D,ft(ht(v)))||[];c=M(n.body,e,t)}}}else if(H&&!u&&f&&"get"!==n&&"head"!==n)c=M(c);else if(H&&u&&!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(E)||(E=E?"include":"omit");const z=u&&"credentials"in i.prototype;if(te.isFormData(c)){const e=O.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&O.delete("content-type")}O.set("User-Agent","axios/1.21.0",!1);const W=null==S?S:Object.assign(Object.create(null),S);W&&(delete W.body,delete W.headers,delete W.method,delete W.signal,delete W.duplex,delete W.credentials);const $=Object.assign(Object.create(null),W,{signal:N,method:n.toUpperCase(),headers:se(O.normalize()),body:c,duplex:"half",credentials:z?E:void 0});u&&(te.forEach(m,(e,t)=>{void 0===$[t]&&($[t]=e)}),void 0===$.signal&&($.signal=null),void 0===$.body&&($.body=null)),0===T&&($.redirect="manual",W&&(W.redirect="manual")),U=u&&new i(t,$);let G=await(u?C(U,W):C(t,$));const J=ye.from(G.headers);if(k){const t=te.toFiniteNumber(J.getContentLength());if(null!=t&&t>R)throw new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const K=y&&("stream"===_||"response"===_);if(y&&G.body&&(w||k||K&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=G[e]});const n=te.toFiniteNumber(J.getContentLength()),[r,o]=w&&pt(n,ft(ht(w),!0))||[];let i=0;const a=t=>{if(k&&(i=t,i>R))throw F=new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};G=new s(Ft(G.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let X=await b[te.findKey(b,_)||"text"](G,e);if(k&&!y&&!K){let t;if(null!=X&&("number"==typeof X.byteLength?t=X.byteLength:"number"==typeof X.size?t=X.size:"string"==typeof X&&(t="function"==typeof r?(new r).encode(X).byteLength:X.length)),"number"==typeof t&&t>R)throw new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!K&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:X,headers:ye.from(G.headers),status:G.status,statusText:G.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 c,u,l=a.length,f=rn;for(;l--;)c=a[l],u=f.get(c),void 0===u&&f.set(c,u=l?new Map:nn(t)),f=u;return u},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}`,cn=e=>te.isFunction(e)||null===e||!1===e;const un={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,!cn(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){return Math.max(0,Date.now()-e)}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=un.getAdapter(t.adapter||Ze.adapter,t),r=Date.now();return n(t).then(function(e){ln(t),e.duration=fn(r),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),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.0] 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 gn{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,we)&&e[we];return n&&t.endsWith(n)?t.length-n.length:-1}(e,i),a=-1===s?i:i.slice(0,s),c=-1===s?"":i.slice(s);a.endsWith(o)||(e.stack=a+"\n"+r+c)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=kt(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(Ve.concat("common"),e=>{bn(te.getSafeProp(o,e))&&delete o[e]}),t.headers=ye.concat(a,o);const c=[];let u=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;u=u&&e.synchronous;const n=t.transitional||Be;n&&n.legacyInterceptorReqResOrdering?c.unshift(e.fulfilled,e.rejected):c.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(!u){const e=[pn.bind(this),void 0];for(e.unshift(...c),e.push(...l),p=e.length,f=Promise.resolve(t);h<p;)f=f.then(e[h++],e[h++]);return f}p=c.length;let d=t;for(;h<p;){const e=c[h++],t=c[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(gt((e=kt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){gn.prototype[e]=async function(t,n){return this.request(kt(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(kt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}gn.prototype[e]=t(),"query"!==e&&(gn.prototype[e+"Form"]=t(!0))});const wn=gn;class vn{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 vn(function(t){e=t}),cancel:e}}}const _n=vn;const On={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(On).forEach(([e,t])=>{void 0===On[t]&&(On[t]=e)});const En=On;const Sn=function e(t){const n=new wn(t),r=o(wn.prototype.request,n);return te.extend(r,wn.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(kt(t,n))},r}(Ze);Sn.Axios=wn,Sn.CanceledError=nt,Sn.CancelToken=_n,Sn.isCancel=tt,Sn.VERSION="1.21.0",Sn.toFormData=Pe,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=kt,Sn.AxiosHeaders=ye,Sn.formToJSON=e=>Xe(te.isHTMLForm(e)?new FormData(e):e),Sn.getAdapter=un.getAdapter,Sn.HttpStatusCode=En,Sn.default=Sn;const Rn=Sn;function Pn(e){return Pn="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},Pn(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 c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return kn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(kn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,kn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,kn(f,"constructor",u),kn(u,"constructor",c),c.displayName="GeneratorFunction",kn(u,o,"GeneratorFunction"),kn(f),kn(f,o,"Generator"),kn(f,r,function(){return this}),kn(f,"toString",function(){return"[object Generator]"}),(Tn=function(){return{w:i,m:p}})()}function kn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}kn=function(e,t,n,r){function i(t,n){kn(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))},kn(e,t,n,r)}function An(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function 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"!=Pn(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"!=Pn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Pn(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 c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return Dn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Dn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Dn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Dn(f,"constructor",u),Dn(u,"constructor",c),c.displayName="GeneratorFunction",Dn(u,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),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).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 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,c=void 0===a?0:a,u=t.httpClient;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._tokenUrl=function(e){var t;try{t=new URL(e)}catch(e){throw new TypeError("tokenUrl must be a valid URL")}if("https:"===t.protocol)return e;if("http:"===t.protocol&&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=u||Rn.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(c)},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(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,u=Object.create(c.prototype);return Wn(u,"_invoke",function(n,r,o){var i,a,c,u=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,c=d;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Wn(t={},r,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Wn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,Wn(f,"constructor",u),Wn(u,"constructor",c),c.displayName="GeneratorFunction",Wn(u,o,"GeneratorFunction"),Wn(f),Wn(f,o,"Generator"),Wn(f,r,function(){return this}),Wn(f,"toString",function(){return"[object Generator]"}),(zn=function(){return{w:i,m:p}})()}function Wn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Wn=function(e,t,n,r){function i(t,n){Wn(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))},Wn(e,t,n,r)}function $n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gn(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)?Gn(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 Gn(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 Jn(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 Kn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jn(Object(n),!0).forEach(function(t){Xn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xn(e,t,n){return(t=er(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vn(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function Yn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Vn(i,r,o,s,a,"next",e)}function a(e){Vn(i,r,o,s,a,"throw",e)}s(void 0)})}}function Qn(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,er(r.key),r)}}function Zn(e,t,n){return t&&Qn(e.prototype,t),n&&Qn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function er(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 tr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nr(e,t,n){return t=ar(t),function(e,t){if(t&&("object"==Mn(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,ir()?Reflect.construct(t,n||[],ar(e).constructor):t.apply(e,n))}function rr(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&&sr(e,t)}function or(e){var t="function"==typeof Map?new Map:void 0;return or=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(ir())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&sr(o,n.prototype),o}(e,arguments,ar(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),sr(n,e)},or(e)}function ir(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ir=function(){return!!e})()}function sr(e,t){return sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sr(e,t)}function ar(e){return ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ar(e)}var cr=null,ur=null,lr=null,fr=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"}),pr=Object.freeze({isNode:!("undefined"!=typeof window&&void 0!==window.document)}),hr=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=nr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return rr(e,or(Error)),Zn(e)}(),dr=function(){function e(t){var n;return tr(this,e),(n=nr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return rr(e,hr),Zn(e)}(),yr=function(){function e(t){var n;return tr(this,e),(n=nr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return rr(e,hr),Zn(e)}(),mr=function(e,t){pr.isNode?process.stdout.write(e):console.log(e)};function br(e){if("number"==typeof e)return e;if("string"!=typeof e)throw new Error("Invalid input type. Expected number or ISO 8601 duration string.");if(/^\d+$/.test(e))return parseInt(e,10);if(!e.trim())throw new Error("Duration string cannot be empty");if(!e.startsWith("P"))throw new Error("Invalid ISO8601 duration: must start with P");var t="\\d+",n="".concat(t,"(?:[\\.,]").concat(t,")?"),r="(".concat(t,"Y)?(").concat(t,"M)?(").concat(t,"W)?(").concat(t,"D)?"),o="T(".concat(n,"H)?(").concat(n,"M)?(").concat(n,"S)?"),i="P(?:".concat(r,"(?:").concat(o,")?)"),s=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(i));if(!a)throw new RangeError("invalid duration: "+e);var c=a.slice(1);if(0===c.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(c.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var u=c.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*u.years,l+=2592e3*u.months,l+=604800*u.weeks,l+=86400*u.days,l+=3600*u.hours,l+=60*u.minutes,l+=u.seconds}function gr(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 wr(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(gr(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new hr("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function vr(e){return _r.apply(this,arguments)}function _r(){return(_r=Yn(zn().m(function e(t){var r,o,i,s;return zn().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 Or(e){return Er.apply(this,arguments)}function Er(){return(Er=Yn(zn().m(function e(t){var n,r;return zn().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,Sr("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function Sr(e,t){return Rr.apply(this,arguments)}function Rr(){return(Rr=Yn(zn().m(function e(t,r){var o,i,s,a,c,u,l,f,p,h,d;return zn().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.e(994).then(()=>n.t(994,19));case 1:if(o=e.v,i=o.spawnSync,0!==(s=i("getent",["group",String(r)],{encoding:"utf8",timeout:3e3})).status||!s.stdout){e.n=2;break}return a=s.stdout.trim().split(":"),c=a.length>=3?parseInt(a[2],10):NaN,e.a(2,a[0]&&!isNaN(c)?{name:a[0],gid:c}:null);case 2:if(0===(u=i("dscacheutil",["-q","group","-a",t,String(r)],{encoding:"utf8",timeout:3e3})).status&&u.stdout){e.n=3;break}return e.a(2,null);case 3:if(l=u.stdout.split("\n"),f=l.find(function(e){return e.startsWith("name:")}),p=l.find(function(e){return e.startsWith("gid:")}),f&&p){e.n=4;break}return e.a(2,null);case 4:return h=f.slice(5).trim(),d=parseInt(p.slice(4).trim(),10),e.a(2,h&&!isNaN(d)?{name:h,gid:d}:null);case 5:return e.p=5,e.v,e.a(2,null)}},e,null,[[0,5]])}))).apply(this,arguments)}function Pr(e){return Tr.apply(this,arguments)}function Tr(){return(Tr=Yn(zn().m(function e(t){var r,o,i,s;return zn().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 kr(e){return Ar.apply(this,arguments)}function Ar(){return(Ar=Yn(zn().m(function e(t){var n;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Sr("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var jr="/opt/appmesh/ssl/ca.pem";function Cr(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function Nr(e){if(!e)return null;var t="function"==typeof e.get?e.get(fr.HTTP_HEADER_KEY_AUTH):e[fr.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function Ur(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:ur.readFileSync(e)}function xr(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return ur.existsSync(jr)?{ca:ur.readFileSync(jr),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=Kn({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=Ur(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var Dr=function(){return Zn(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pr.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._tokenProvider=null,i&&this.setTokenProvider(i);var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[wr]};this._sslConfig=o,this._client=Rn.create(s),pr.isNode&&!lr&&(lr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=$n(e,2),n=t[0],r=t[1];cr=n.default||n,ur=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Yn(zn().m(function e(n){var r,o;return zn().w(function(e){for(;;)switch(e.n){case 0:return r=Kn,o=Kn({},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 hr("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 hr)return Promise.reject(e);var i=new hr("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:"_getAccessToken",value:(M=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:if(!this._tokenProvider){e.n=2;break}return e.n=1,this._tokenProvider.getAccessToken();case 1:t=e.v,e.n=3;break;case 2:t=null;case 3:return e.a(2,t)}},e,this)})),function(){return M.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(H=Yn(zn().m(function e(t){var n,r,o,i,s,a,c,u;return zn().w(function(e){for(;;)switch(e.n){case 0:if(r=t.config||{},o=this._tokenProvider,401===t.status&&!r.__appmeshRetried&&o){e.n=1;break}return e.a(2,t);case 1:if("function"!=typeof o.canRefresh){e.n=3;break}return e.n=2,o.canRefresh();case 2:c=e.v,e.n=4;break;case 3:c=!!o.canRefresh;case 4:if(c&&"function"==typeof o.refreshAccessToken&&Cr(r.data)){e.n=5;break}return e.a(2,t);case 5:if(null===(n=Nr(r.headers))||void 0===n){e.n=6;break}u=n,e.n=8;break;case 6:return e.n=7,this._getAccessToken();case 7:u=e.v;case 8:return i=u,e.n=9,o.refreshAccessToken(i);case 9:if("string"==typeof(s=e.v)&&s.trim()){e.n=10;break}return e.a(2,t);case 10:return r.__appmeshRetried=!0,a="Bearer ".concat(s.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(fr.HTTP_HEADER_KEY_AUTH,a):r.headers=Kn(Kn({},r.headers),{},Xn({},fr.HTTP_HEADER_KEY_AUTH,a)),e.a(2,this._client(r))}},e,this)})),function(e){return H.apply(this,arguments)})},{key:"getAuthConfig",value:(q=Yn(zn().m(function e(){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return q.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(I=Yn(zn().m(function e(){return zn().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 I.apply(this,arguments)})},{key:"listApps",value:(B=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"getApp",value:(F=Yn(zn().m(function e(t){var n;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"checkAppHealth",value:(L=Yn(zn().m(function e(t){var n;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"addApp",value:(D=Yn(zn().m(function e(t,n){var r;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"deleteApp",value:(x=Yn(zn().m(function e(t){var n,r;return zn().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 x.apply(this,arguments)})},{key:"enableApp",value:(U=Yn(zn().m(function e(t){return zn().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 U.apply(this,arguments)})},{key:"disableApp",value:(N=Yn(zn().m(function e(t){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"getAppOutput",value:(C=Yn(zn().m(function e(t){var n,r,o,i,s,a,c,u,l,f,p=arguments;return zn().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:br(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,c=gr(a.headers,"X-Output-Position"),u=gr(a.headers,"X-Exit-Code"),l=c?parseInt(c,10):null,f=u?parseInt(u,10):null,e.a(2,new Lr(a.status,a.data,l,f))}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"runAppSync",value:(j=Yn(zn().m(function e(t){var n,r,o,i,s,a,c,u=arguments;return zn().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:mr,r=u.length>2&&void 0!==u[2]?u[2]:fr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=u.length>3&&void 0!==u[3]?u[3]:fr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i={timeout:br(r),lifecycle:br(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&&(c=gr(s.headers,"X-Exit-Code"))&&(a=parseInt(c,10)),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"runAppAsync",value:(A=Yn(zn().m(function e(t){var n,r,o,i,s=arguments;return zn().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:fr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:fr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:br(n),lifecycle:br(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new Fr(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"waitForAsyncRun",value:(k=Yn(zn().m(function e(t){var n,r,o,i,s,a,c=arguments;return zn().w(function(e){for(;;)switch(e.n){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:mr,r=c.length>2&&void 0!==c[2]?c[2]:0,!t){e.n=7;break}o=0,i=new Date,s=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.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 k.apply(this,arguments)})},{key:"runTask",value:(T=Yn(zn().m(function e(t,n){var r,o,i=arguments;return zn().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 T.apply(this,arguments)})},{key:"cancelTask",value:(P=Yn(zn().m(function e(t){return zn().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 P.apply(this,arguments)})},{key:"downloadFile",value:(R=Yn(zn().m(function e(t){var r,o,i,s,a,c,u,l,f,p,h,d,y,m,b,g,w,v,_,O,E,S,R,P,T,k,A=arguments;return zn().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()),c=Xn({},fr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:c,config:{responseType:pr.isNode?"stream":"arraybuffer"}});case 1:if(u=e.v,l=pr.isNode?"":u.data,200!==u.status||null!==(r=u.headers)&&void 0!==r&&r["content-disposition"]||!String(null!==(o=null===(i=u.headers)||void 0===i?void 0:i["content-type"])&&void 0!==o?o:"").toLowerCase().includes("json")){e.n=2;break}throw pr.isNode&&u.data.destroy(),new hr("File download is not supported by this server surface: ".concat(t),u.status,l);case 2:if(200===u.status){e.n=3;break}throw new hr("Failed to download file: ".concat(t),u.status,l);case 3:if(!pr.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,P=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=P(e.v.pipeline),y=f.promises,e.p=7,e.n=8,d(u.data,f.createWriteStream(s));case 8:if(!a||"win32"===process.platform){e.n=17;break}if(m=u.headers,e.p=9,!(b=m["x-file-mode"])){e.n=12;break}if(g=parseInt(b,10),!(Number.isInteger(g)&&g>=0&&g<=511)){e.n=11;break}return e.n=10,y.chmod(s,g);case 10:e.n=12;break;case 11:console.warn("Warning: Invalid x-file-mode value:",b);case 12:if(w=m["x-file-user"],v=m["x-file-group"],!w||!v){e.n=15;break}return e.n=13,vr(w);case 13:return _=e.v,e.n=14,Or(v);case 14:if(O=e.v,null===_||null===O){e.n=15;break}return e.n=15,y.chown(s,_,O);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,k=e.v,new hr("Failed to write file to ".concat(s,": ").concat(k.message),u.status);case 19:e.n=21;break;case 20:E=new Blob([u.data]),S=window.URL.createObjectURL(E),(R=document.createElement("a")).style.display="none",R.href=S,R.download=s.split("/").pop(),document.body.appendChild(R),R.click(),window.URL.revokeObjectURL(S),document.body.removeChild(R);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return R.apply(this,arguments)})},{key:"uploadFile",value:(S=Yn(zn().m(function e(t){var r,o,i,s,a,c,u,l,f,p,h,d,y,m=arguments;return zn().w(function(e){for(;;)switch(e.n){case 0:if(s=m.length>2&&void 0!==m[2]&&m[2],i=m.length>1&&void 0!==m[1]?m[1]:null){e.n=2;break}if(a="string"==typeof t?t:t&&t.name){e.n=1;break}throw new hr("filePath is required when localFile is a Blob without a name");case 1:i=a.split(/[\\/]/).pop();case 2:if(c=Xn({},fr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),!pr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(l=e.v,f=l.statSync(t),!s){e.n=6;break}return c["X-File-Mode"]=(511&f.mode).toString(),e.n=4,Pr(f.uid);case 4:return p=e.v,e.n=5,kr(f.gid);case 5:h=e.v,c["X-File-User"]=p||String(f.uid),c["X-File-Group"]=h||String(f.gid);case 6:u=f.size<10485760?l.readFileSync(t):l.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}u=t,e.n=9;break;case 8:throw new hr("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",u,{headers:c,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(d=e.v).status||201===d.status){e.n=11;break}throw new hr("Failed to upload file: ".concat(i),d.status,d.data);case 11:if(y=String(null!==(r=null===(o=d.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===d.status&&y.includes("json")&&d.data&&"object"===Mn(d.data)&&"message"in d.data)){e.n=12;break}throw new hr("File upload is not supported by this server surface: ".concat(i),d.status,d.data);case 12:return e.a(2)}},e,this)})),function(e){return S.apply(this,arguments)})},{key:"getHostResources",value:(E=Yn(zn().m(function e(){var t;return zn().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 E.apply(this,arguments)})},{key:"getConfig",value:(O=Yn(zn().m(function e(){var t;return zn().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 O.apply(this,arguments)})},{key:"setConfig",value:(_=Yn(zn().m(function e(t){var n;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return _.apply(this,arguments)})},{key:"setLogLevel",value:(v=Yn(zn().m(function e(){var t,n,r=arguments;return zn().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 v.apply(this,arguments)})},{key:"addLabel",value:(w=Yn(zn().m(function e(t,n){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return w.apply(this,arguments)})},{key:"deleteLabel",value:(g=Yn(zn().m(function e(t){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"listLabels",value:(b=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return b.apply(this,arguments)})},{key:"listPrincipals",value:(m=Yn(zn().m(function e(){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principals");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"updatePrincipal",value:(y=Yn(zn().m(function e(t,n){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return y.apply(this,arguments)})},{key:"deletePrincipal",value:(d=Yn(zn().m(function e(t){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"getCurrentUser",value:(h=Yn(zn().m(function e(){return zn().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return h.apply(this,arguments)})},{key:"listPermissions",value:(p=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(f=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"getUserPermissions",value:(l=Yn(zn().m(function e(){return zn().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return l.apply(this,arguments)})},{key:"listRoles",value:(u=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"updateRole",value:(c=Yn(zn().m(function e(t,n){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return c.apply(this,arguments)})},{key:"deleteRole",value:(a=Yn(zn().m(function e(t){return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"getMetrics",value:(s=Yn(zn().m(function e(){var t;return zn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"subscribe",value:(i=Yn(zn().m(function e(){return zn().w(function(e){for(;;)switch(e.n){case 0:throw new hr("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return i.apply(this,arguments)})},{key:"unsubscribe",value:(o=Yn(zn().m(function e(){return zn().w(function(e){for(;;)switch(e.n){case 0:throw new hr("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"request",value:(r=Yn(zn().m(function e(t,n){var r,o,i=arguments;return zn().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_commonHeaders",value:(t=Yn(zn().m(function e(){var t,n;return zn().w(function(e){for(;;)switch(e.n){case 0:return t={},pr.isNode&&(t[fr.HTTP_USER_AGENT_HEADER_NAME]=fr.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[fr.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[fr.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_request",value:(e=Yn(zn().m(function e(t,n){var r,o,i,s,a,c,u,l,f,p,h,d,y=arguments;return zn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},!pr.isNode||!lr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,lr;case 1:cr&&(this._client.defaults.httpsAgent=new cr.Agent(Kn(Kn({},xr(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return i=o.headers,s=void 0===i?{}:i,a=o.params,c=void 0===a?{}:a,u=o.config,l=void 0===u?{}:u,e.p=3,f=Kn(Kn({method:t,url:n,withCredentials:!1},l),{},{headers:Kn({},s),params:Kn({},c)}),null!==r&&(f.data=r),e.n=4,this._client(f);case 4:if(!((p=e.v).status<200||p.status>=300)){e.n=5;break}throw h=this._extractErrorMessage(p.data),new hr(h,p.status,p.data);case 5:return e.a(2,p);case 6:throw e.p=6,d=e.v,this.onError(d);case 7:return e.a(2)}},e,this,[[3,6]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===Mn(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof hr?e:new hr(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,c,u,l,f,p,h,d,y,m,b,g,w,v,_,O,E,S,R,P,T,k,A,j,C,N,U,x,D,L,F,B,I,q,H,M}(),Lr=Zn(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}),Fr=function(){return Zn(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=Yn(zn().m(function e(t){var n;return zn().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=Yn(zn().m(function e(){var t,n,r=this,o=arguments;return zn().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:mr,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 Br=Dr;export{Dr as AppMeshClient,hr as AppMeshError,Lr as AppOutput,dr as AppRemovedError,Fr as AppRun,jr as DEFAULT_CA_FILE,Hn as RefreshTokenProvider,Nn as StaticAccessTokenProvider,yr as TransportDisconnectedError,Or as _resolveGid,kr as _resolveGroupName,vr as _resolveUid,Pr as _resolveUserName,Br as default};
|
|
1
|
+
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),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{let n=e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e});n=Promise.race([n,new Promise(e=>s=t[o]=[e])]),i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>qe,hasStandardBrowserEnv:()=>He,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>Me,origin:()=>Ge});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,g=m("undefined");function w(e){return null!==e&&!g(e)&&null!==e.constructor&&!g(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=y("ArrayBuffer");const _=m("string"),O=m("function"),E=m("number"),S=e=>null!==e&&"object"==typeof e,R=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))},P=y("Date"),T=y("File"),k=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(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=e=>!g(e)&&e!==I;const M=(H="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>H&&e instanceof H);var H;const z=y("HTMLFormElement"),{propertyIsEnumerable:G}=Object.prototype,W=y("RegExp"),$=(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 J=y("AsyncFunction"),K=(X="function"==typeof setImmediate,V=O(I.postMessage),X?setImmediate:V?(Y=`axios@${Math.random()}`,Q=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===Y&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),I.postMessage(Y,"*")}):e=>setTimeout(e));var X,V,Y,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||K,ee=e=>null!=e&&O(e[a]),te={isArray:b,isArrayBuffer:v,isBuffer:w,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!O(e.append))return!1;const n=h(e);return"formdata"===n||"object"===n&&O(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&v(e.buffer),t},isString:_,isNumber:E,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:R,isEmptyObject:e=>{if(!S(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:x,isRequest:D,isResponse:L,isHeaders:F,isUndefined:g,isDate:P,isFile:T,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:k,isRegExp:W,isFunction:O,isStream:e=>S(e)&&O(e.pipe),isURLSearchParams:U,isTypedArray:M,isFileList:A,forEach:B,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;R(a)&&R(t)?o[s]=e(a,t):R(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&g(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(B(n,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];G.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(B(t,(t,r)=>{n&&O(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const 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:$,freezeMethods:e=>{$(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];O(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return 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(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null},global:I,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&O(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),j(e)){r=[];for(const t of e){const e=n(t);!g(e)&&r.push(e)}}else r=b(e)?[]:{},B(e,(e,t)=>{const o=n(e);!g(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:J,isThenable:e=>e&&(S(e)||O(e))&&O(e.then)&&O(e.catch),setImmediate:K,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 ge(e){try{return String(e)}catch(e){return""}}const we=Symbol("causeStack");class ve 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?ge(e.message):ge(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new ve(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,we,{__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}}}ve.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ve.ERR_BAD_OPTION="ERR_BAD_OPTION",ve.ECONNABORTED="ECONNABORTED",ve.ETIMEDOUT="ETIMEDOUT",ve.ECONNREFUSED="ECONNREFUSED",ve.ERR_NETWORK="ERR_NETWORK",ve.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ve.ERR_DEPRECATED="ERR_DEPRECATED",ve.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ve.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ve.ERR_CANCELED="ERR_CANCELED",ve.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ve.ERR_INVALID_URL="ERR_INVALID_URL",ve.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _e=ve;function Oe(e){return te.isPlainObject(e)||te.isArray(e)}function Ee(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=Ee(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Re=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Pe=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(Oe)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Ee(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!!Oe(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(Re,{defaultVisitor:d,convertValue:p,isVisitable:Oe});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 ke(e,t){this._pairs=[],e&&Pe(e,this,t)}const Ae=ke.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=ke;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"]},qe="undefined"!=typeof window&&"undefined"!=typeof document,Me="object"==typeof navigator&&navigator||void 0,He=qe&&(!Me||["ReactNative","NativeScript","NS"].indexOf(Me.product)<0),ze="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ge=qe&&window.location.href||"http://localhost",We={...r,...Ie};function $e(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 Je(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 Ke(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Je(e):e}const Xe=function(e){function t(e,n,r,o){$e(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]=Ke(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]=Je(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));)$e(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]=Ke(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Ve=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ye=(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(Xe(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=Ye(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Pe(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=Ye(this,"env"),r=n&&n.FormData;return Pe(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=Ye(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ye(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,Ye(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ye(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(Ve,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 gt(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 wt=e=>e instanceof ye?{...e}:e,vt=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 Ot(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 Et(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 Rt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Pt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),Tt={url:Et,method:Et,data:Et,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(vt(e)),s=new Set(vt(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:Rt,headers:function(e,t,n){return Ot(wt(e),wt(t),0,!0)}};function kt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Pt);const r=vt({...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]:Ot,a=te.hasOwnProp(e,i)?e[i]:void 0,u=te.hasOwnProp(t,i)?t[i]:void 0,c=s===Rt?s(a,u,i,e,t):s(a,u,i);te.isUndefined(c)&&s!==Rt||(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=kt({},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(gt(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 g(){clearTimeout(c);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}w&&(f&&w.removeEventListener("progress",f),w.upload&&(l&&w.upload.removeEventListener("progress",l),p&&w.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let w=new XMLHttpRequest;function v(r){if(!w)return;if(!(0!==w.status||"file"===(st(it(i.url))||st(We.origin))||w.responseURL&&w.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,w)),g(),void(w=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!w)return;const o=ye.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders());rt(function(e){t(e),g()},function(e){n(e),g()},{data:y&&"text"!==y&&"json"!==y?w.response:w.responseText,status:w.status,statusText:w.statusText,headers:o,config:e,request:w}),w=null}if(w.open(i.method.toUpperCase(),i.url,!0),w.timeout=i.timeout,"onloadend"in w?w.onloadend=v:w.onreadystatechange=function(){w&&4===w.readyState&&(0!==w.status||w.responseURL&&w.responseURL.startsWith("file:"))&&setTimeout(v)},w.onabort=function(){w&&(n(new _e("Request aborted",_e.ECONNABORTED,e,w)),g(),w=null)},w.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,w);o.event=t||null,n(o),g(),w=null},w.ontimeout=function(){if(!w)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,w)),g(),w=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(w.withCredentials=!!i.withCredentials),y&&"json"!==y&&(w.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),w.addEventListener("progress",f)),m&&w.upload&&([l,p]=ft(m),w.upload.addEventListener("progress",l),w.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(u=t=>{if(!w)return;n(!t||t.type?new nt(null,e,w):t);const r=w;g(),w=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(u),!w)return;i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u))}if(!w)return;const _=st(i.url);if(_&&!We.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void g();const O=()=>{w&&("setRequestHeader"in w&&te.forEach(se(a),function(e,t){w.setRequestHeader(t,e)}),w.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=w.timeout>0?t()+Number(w.timeout):void 0,s=()=>{if(!w)return;const e=w;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(w)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}O()}}).catch(t=>{w&&(n(_e.from(t,null,e,w)),g(),w=null)})}else O()})},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),qt=e=>String(e).replace(/[\r\n"]/g,e=>"\r"===e?"%0D":"\n"===e?"%0A":"%22"),Mt=(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 Ht 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 Ht("Blob is not supported","blob");if(!te.isString(o)||!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(o)||/ $/.test(o))throw new Ht("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?Mt(n,!0):n.size;if(!Number.isFinite(r)||r<0)throw new Ht("Unsupported FormData part size","part");u(r+Mt(t,!0)+(!e&&n.name?Mt(n.name,!1):0)+(!e&&n.type?Mt(n.type,!1):0));let i="--"+o+'\r\nContent-Disposition: form-data; name="'+qt(It(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+=Bt+Bt;const c=Mt(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 Ht){const t="boundary"===e.reason?_e.ERR_BAD_OPTION_VALUE:_e.ERR_BAD_REQUEST;throw new _e(e.message,t)}throw e}}const Gt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Wt=(e,t,n)=>t+2<n&&Gt(e.charCodeAt(t+1))&&Gt(e.charCodeAt(t+2)),$t=e=>e<=57?e-48:(223&e)-55,Jt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Kt=e=>9===e||10===e||12===e||13===e||32===e,Xt=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)},Vt=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*$t(e.charCodeAt(i+1))+$t(e.charCodeAt(i+2)),i+=2),Kt(s)||(61!==s?!Jt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?Xt(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Yt=(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 g=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:w,onUploadProgress:v,responseType:_,headers:O,withCredentials:E="same-origin",fetchOptions:S,maxContentLength:R,maxBodyLength:P,maxRedirects:T}=Nt(e);const k=te.isNumber(R)&&R>-1,A=te.isNumber(P)&&P>-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,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&&(O.delete("authorization"),O.set("Authorization","Basic "+btoa((I=(o.username||"")+":"+(o.password||""),encodeURIComponent(I).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),k&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Yt(-1===t?e:e.slice(0,t),Vt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>R)throw new _e("maxContentLength size of "+R+" 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||v&&d||void 0!==q)&&(u=zt(u,a,A?P:1/0,B,q),O.setContentType(void 0===q?u.type:h),D=u.size),A&&"get"!==n&&"head"!==n){const e=await g(u);if("number"==typeof e&&isFinite(e)&&(D=e,e>P))throw B()}const M=A&&(te.isReadableStream(u)||te.isStream(u)),H=(e,t,n)=>Ft(e,65536,e=>{if(A&&e>P)throw L=B();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(v||M)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??g(t)})(O,u),0!==D||M){let e,n=new i(t,{method:"POST",body:u,duplex:"half"});if(te.isFormData(u)&&(e=n.headers.get("content-type"))&&O.setContentType(e),n.body){const[e,t]=v&&pt(D,ft(ht(v)))||[];u=H(n.body,e,t)}}}else if(M&&!c&&f&&"get"!==n&&"head"!==n)u=H(u);else if(M&&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(E)||(E=E?"include":"omit");const z=c&&"credentials"in i.prototype;if(te.isFormData(u)){const e=O.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&O.delete("content-type")}O.set("User-Agent","axios/1.21.1",!1);const G=null==S?S:Object.assign(Object.create(null),S);G&&(delete G.body,delete G.headers,delete G.method,delete G.signal,delete G.duplex,delete G.credentials);const W=Object.assign(Object.create(null),G,{signal:N,method:n.toUpperCase(),headers:se(O.normalize()),body:u,duplex:"half",credentials:z?E: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",G&&(G.redirect="manual")),U=c&&new i(t,W);let $=await(c?C(U,G):C(t,W));const J=ye.from($.headers);if(k){const t=te.toFiniteNumber(J.getContentLength());if(null!=t&&t>R)throw new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const K=y&&("stream"===_||"response"===_);if(y&&$.body&&(w||k||K&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=$[e]});const n=te.toFiniteNumber(J.getContentLength()),[r,o]=w&&pt(n,ft(ht(w),!0))||[];let i=0;const a=t=>{if(k&&(i=t,i>R))throw F=new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};$=new s(Ft($.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let X=await b[te.findKey(b,_)||"text"]($,e);if(k&&!y&&!K){let t;if(null!=X&&("number"==typeof X.byteLength?t=X.byteLength:"number"==typeof X.size?t=X.size:"string"==typeof X&&(t="function"==typeof r?(new r).encode(X).byteLength:X.length)),"number"==typeof t&&t>R)throw new _e("maxContentLength size of "+R+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!K&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:X,headers:ye.from($.headers),status:$.status,statusText:$.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 gn{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,we)&&e[we];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=kt(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(Ve.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(gt((e=kt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){gn.prototype[e]=async function(t,n){return this.request(kt(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(kt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}gn.prototype[e]=t(),"query"!==e&&(gn.prototype[e+"Form"]=t(!0))});const wn=gn;class vn{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 vn(function(t){e=t}),cancel:e}}}const _n=vn;const On={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(On).forEach(([e,t])=>{void 0===On[t]&&(On[t]=e)});const En=On;const Sn=function e(t){const n=new wn(t),r=o(wn.prototype.request,n);return te.extend(r,wn.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(kt(t,n))},r}(Ze);Sn.Axios=wn,Sn.CanceledError=nt,Sn.CancelToken=_n,Sn.isCancel=tt,Sn.VERSION="1.21.1",Sn.toFormData=Pe,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=kt,Sn.AxiosHeaders=ye,Sn.formToJSON=e=>Xe(te.isHTMLForm(e)?new FormData(e):e),Sn.getAdapter=cn.getAdapter,Sn.HttpStatusCode=En,Sn.default=Sn;const Rn=Sn;function Pn(e){return Pn="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},Pn(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 kn(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]())):(kn(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,kn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,kn(f,"constructor",c),kn(c,"constructor",u),u.displayName="GeneratorFunction",kn(c,o,"GeneratorFunction"),kn(f),kn(f,o,"Generator"),kn(f,r,function(){return this}),kn(f,"toString",function(){return"[object Generator]"}),(Tn=function(){return{w:i,m:p}})()}function kn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}kn=function(e,t,n,r){function i(t,n){kn(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))},kn(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"!=Pn(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"!=Pn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Pn(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 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 qn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var Mn=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||Rn.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 Hn(e){return Hn="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},Hn(e)}function zn(e){return function(e){if(Array.isArray(e))return $n(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 Gn(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 $n(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)?$n(e,t):void 0}}function $n(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 Jn(){/*! 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 Kn(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]())):(Kn(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,Kn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Kn(f,"constructor",c),Kn(c,"constructor",u),u.displayName="GeneratorFunction",Kn(c,o,"GeneratorFunction"),Kn(f),Kn(f,o,"Generator"),Kn(f,r,function(){return this}),Kn(f,"toString",function(){return"[object Generator]"}),(Jn=function(){return{w:i,m:p}})()}function Kn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Kn=function(e,t,n,r){function i(t,n){Kn(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))},Kn(e,t,n,r)}function Xn(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,Vn(r.key),r)}}function Vn(e){var t=function(e,t){if("object"!=Hn(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"!=Hn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Hn(t)?t:t+""}function Yn(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){Yn(i,r,o,s,a,"next",e)}function a(e){Yn(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(Jn().m(function e(){var t;return Jn().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=Object.freeze({KEY_ID:"X-Request-Key",TIMESTAMP:"X-Timestamp",NONCE:"X-Nonce",SIGNATURE:"X-Signature"});function or(e){return"string"==typeof e&&nr.has(ir(e))}function ir(e){return"/appmesh/file/download/ws"===e?"/appmesh/file/download":"/appmesh/file/upload/ws"===e?"/appmesh/file/upload":e}var sr=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");this._keyId=t,this._secret=n},t=[{key:"keyId",get:function(){return this._keyId}},{key:"attach",value:(i=Qn(Jn().m(function e(t,n,r,o,i,s,a){var u,c,l,f,p,h,d,y,m;return Jn().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=ir(r),h=ar,d=n,y=l,m=o,e.n=3,ur(l,i);case 3:return f=h(d,y,m,e.v,u,c),t[rr.KEY_ID]=this._keyId,t[rr.TIMESTAMP]=u,t[rr.NONCE]=c,e.n=4,this.sign(f);case 4:t[rr.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(Jn().m(function e(){var t;return Jn().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(Jn().m(function e(t){var n;return Jn().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&&Xn(e.prototype,t),n&&Xn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i}();function ar(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 ur(e,t){return cr.apply(this,arguments)}function cr(){return(cr=Qn(Jn().m(function e(t,n){var r,o;return Jn().w(function(e){for(;;)switch(e.n){case 0:return r=null==n||or(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 lr(e){if(!e)return"";var t,n={},r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Wn(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}}}}(e.split("&"));try{for(r.s();!(t=r.n()).done;){var o=t.value;if(""!==o){var i=o.indexOf("="),s=i<0?o:o.slice(0,i),a=i<0?"":o.slice(i+1);s in n||(n[s]=a)}}}catch(e){r.e(e)}finally{r.f()}var u=Object.entries(n).map(function(e){var t=Gn(e,2),n=t[0],r=t[1];return[fr(n),fr(r)]});return u.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"))}),u.map(function(e){var t=Gn(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)}).join("&")}function fr(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 pr(e){return e?Object.entries(e).filter(function(e){var t=Gn(e,2)[1];return null!=t}).map(function(e){var t=Gn(e,2),n=t[0],r=t[1];return"".concat(encodeURIComponent(String(n)),"=").concat(encodeURIComponent(String(r)))}).join("&"):""}function hr(e){return hr="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},hr(e)}function dr(){/*! 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 yr(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]())):(yr(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,yr(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,yr(f,"constructor",c),yr(c,"constructor",u),u.displayName="GeneratorFunction",yr(c,o,"GeneratorFunction"),yr(f),yr(f,o,"Generator"),yr(f,r,function(){return this}),yr(f,"toString",function(){return"[object Generator]"}),(dr=function(){return{w:i,m:p}})()}function yr(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}yr=function(e,t,n,r){function i(t,n){yr(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))},yr(e,t,n,r)}function mr(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 br(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)?br(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 br(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 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){vr(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 vr(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 _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 Or(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 Er(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 Sr(e,t,n){return t&&Er(e.prototype,t),n&&Er(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rr(e){var t=function(e,t){if("object"!=hr(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"!=hr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hr(t)?t:t+""}function Pr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tr(e,t,n){return t=Nr(t),function(e,t){if(t&&("object"==hr(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,jr()?Reflect.construct(t,n||[],Nr(e).constructor):t.apply(e,n))}function kr(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&&Cr(e,t)}function Ar(e){var t="function"==typeof Map?new Map:void 0;return Ar=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(jr())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Cr(o,n.prototype),o}(e,arguments,Nr(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Cr(n,e)},Ar(e)}function jr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(jr=function(){return!!e})()}function Cr(e,t){return Cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cr(e,t)}function Nr(e){return Nr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nr(e)}var Ur=null,xr=null,Dr=null,Lr=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"}),Fr=Object.freeze({isNode:!("undefined"!=typeof window&&"undefined"!==window.document)}),Br=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Ir(e,t){var n=String(e||""),r=String(t||""),o=r;if(n&&!Br.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 qr=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 Pr(this,e),(n=Tr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return kr(e,Ar(Error)),Sr(e)}(),Mr=function(){function e(t){var n;return Pr(this,e),(n=Tr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return kr(e,qr),Sr(e)}(),Hr=function(){function e(t){var n;return Pr(this,e),(n=Tr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return kr(e,qr),Sr(e)}(),zr=function(e,t){Fr.isNode?process.stdout.write(e):console.log(e)};function Gr(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 Wr(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 $r(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(Wr(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new qr("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function Jr(e){return Kr.apply(this,arguments)}function Kr(){return(Kr=Or(dr().m(function e(t){var r,o,i,s;return dr().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 Xr(e){return Vr.apply(this,arguments)}function Vr(){return(Vr=Or(dr().m(function e(t){var n,r;return dr().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,Yr("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function Yr(e,t){return Qr.apply(this,arguments)}function Qr(){return(Qr=Or(dr().m(function e(t,r){var o,i,s,a,u,c,l,f,p,h,d;return dr().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 Zr(e){return eo.apply(this,arguments)}function eo(){return(eo=Or(dr().m(function e(t){var r,o,i,s;return dr().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 to(e){return no.apply(this,arguments)}function no(){return(no=Or(dr().m(function e(t){var n;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Yr("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var ro="/opt/appmesh/ssl/ca.pem";function oo(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function io(e){if(!e)return null;var t="function"==typeof e.get?e.get(Lr.HTTP_HEADER_KEY_AUTH):e[Lr.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function so(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:xr.readFileSync(e)}function ao(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return xr.existsSync(ro)?{ca:xr.readFileSync(ro),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]=so(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var uo=function(){return Sr(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fr.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;Pr(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:[$r]};this._sslConfig=o,this._client=Rn.create(s),Fr.isNode&&!Dr&&(Dr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=mr(e,2),n=t[0],r=t[1];Ur=n.default||n,xr=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Or(dr().m(function e(n){var r,o;return dr().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 qr("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 qr)return Promise.reject(e);var i=new qr("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 sr(e,t)}},{key:"disableRequestSignature",value:function(){this._requestSigner=null}},{key:"isRequestSignatureEnabled",value:function(){return null!==this._requestSigner}},{key:"_applyRequestSignature",value:(z=Or(dr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h;return dr().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=Ir(t.baseURL||this._client.defaults.baseURL||this.baseURL,t.url),o="",t.params&&"object"===hr(t.params)&&Object.keys(t.params).length>0&&(t.paramsSerializer=pr,o=lr(pr(t.params))),i=this._headerValue(t.headers,"content-type"),s=or(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=mr(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),{},vr({},p,h));case 3:return e.a(2)}},e,this)})),function(e){return z.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"===hr(e))return Buffer.from(JSON.stringify(e),"utf8");throw new qr("cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies")}},{key:"_getAccessToken",value:(H=Or(dr().m(function e(){var t;return dr().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 H.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(M=Or(dr().m(function e(t){var n,r,o,i,s,a,u,c;return dr().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:u=e.v,e.n=4;break;case 3:u=!!o.canRefresh;case 4:if(u&&"function"==typeof o.refreshAccessToken&&oo(r.data)){e.n=5;break}return e.a(2,t);case 5:if(null===(n=io(r.headers))||void 0===n){e.n=6;break}c=n,e.n=8;break;case 6:return e.n=7,this._getAccessToken();case 7:c=e.v;case 8:return i=c,e.n=9,o.refreshAccessToken(i);case 9:if("string"==typeof(s=e.v)&&s.trim()){e.n=10;break}return e.a(2,t);case 10:if(r.__appmeshRetried=!0,a="Bearer ".concat(s.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(Lr.HTTP_HEADER_KEY_AUTH,a):r.headers=wr(wr({},r.headers),{},vr({},Lr.HTTP_HEADER_KEY_AUTH,a)),!this._requestSigner){e.n=11;break}return e.n=11,this._applyRequestSignature(r);case 11:return e.a(2,this._client(r))}},e,this)})),function(e){return M.apply(this,arguments)})},{key:"getAuthConfig",value:(q=Or(dr().m(function e(){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return q.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(I=Or(dr().m(function e(){return dr().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 I.apply(this,arguments)})},{key:"listApps",value:(B=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"getApp",value:(F=Or(dr().m(function e(t){var n;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"checkAppHealth",value:(L=Or(dr().m(function e(t){var n;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"addApp",value:(D=Or(dr().m(function e(t,n){var r;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return D.apply(this,arguments)})},{key:"deleteApp",value:(x=Or(dr().m(function e(t){var n,r;return dr().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 x.apply(this,arguments)})},{key:"enableApp",value:(U=Or(dr().m(function e(t){return dr().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 U.apply(this,arguments)})},{key:"disableApp",value:(N=Or(dr().m(function e(t){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"getAppOutput",value:(C=Or(dr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p=arguments;return dr().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:Gr(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,u=Wr(a.headers,"X-Output-Position"),c=Wr(a.headers,"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 C.apply(this,arguments)})},{key:"runAppSync",value:(j=Or(dr().m(function e(t){var n,r,o,i,s,a,u,c=arguments;return dr().w(function(e){for(;;)switch(e.n){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:zr,r=c.length>2&&void 0!==c[2]?c[2]:Lr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=c.length>3&&void 0!==c[3]?c[3]:Lr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i={timeout:Gr(r),lifecycle:Gr(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=Wr(s.headers,"X-Exit-Code"))&&(a=parseInt(u,10)),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"runAppAsync",value:(A=Or(dr().m(function e(t){var n,r,o,i,s=arguments;return dr().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:Lr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:Lr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:Gr(n),lifecycle:Gr(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new lo(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"waitForAsyncRun",value:(k=Or(dr().m(function e(t){var n,r,o,i,s,a,u=arguments;return dr().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:zr,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 k.apply(this,arguments)})},{key:"runTask",value:(T=Or(dr().m(function e(t,n){var r,o,i=arguments;return dr().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 T.apply(this,arguments)})},{key:"cancelTask",value:(P=Or(dr().m(function e(t){return dr().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 P.apply(this,arguments)})},{key:"downloadFile",value:(R=Or(dr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,w,v,_,O,E,S,R,P,T,k,A=arguments;return dr().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=vr({},Lr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:u,config:{responseType:Fr.isNode?"stream":"arraybuffer"}});case 1:if(c=e.v,l=Fr.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 Fr.isNode&&c.data.destroy(),new qr("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 qr("Failed to download file: ".concat(t),c.status,l);case 3:if(!Fr.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,P=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=P(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(g=parseInt(b,10),!(Number.isInteger(g)&&g>=0&&g<=511)){e.n=11;break}return e.n=10,y.chmod(s,g);case 10:e.n=12;break;case 11:console.warn("Warning: Invalid x-file-mode value:",b);case 12:if(w=m["x-file-user"],v=m["x-file-group"],!w||!v){e.n=15;break}return e.n=13,Jr(w);case 13:return _=e.v,e.n=14,Xr(v);case 14:if(O=e.v,null===_||null===O){e.n=15;break}return e.n=15,y.chown(s,_,O);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,k=e.v,new qr("Failed to write file to ".concat(s,": ").concat(k.message),c.status);case 19:e.n=21;break;case 20:E=new Blob([c.data]),S=window.URL.createObjectURL(E),(R=document.createElement("a")).style.display="none",R.href=S,R.download=s.split("/").pop(),document.body.appendChild(R),R.click(),window.URL.revokeObjectURL(S),document.body.removeChild(R);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return R.apply(this,arguments)})},{key:"uploadFile",value:(S=Or(dr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m=arguments;return dr().w(function(e){for(;;)switch(e.n){case 0:if(s=m.length>2&&void 0!==m[2]&&m[2],i=m.length>1&&void 0!==m[1]?m[1]:null){e.n=2;break}if(a="string"==typeof t?t:t&&t.name){e.n=1;break}throw new qr("filePath is required when localFile is a Blob without a name");case 1:i=a.split(/[\\/]/).pop();case 2:if(u=vr({},Lr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),!Fr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(l=e.v,f=l.statSync(t),!s){e.n=6;break}return u["X-File-Mode"]=(511&f.mode).toString(),e.n=4,Zr(f.uid);case 4:return p=e.v,e.n=5,to(f.gid);case 5:h=e.v,u["X-File-User"]=p||String(f.uid),u["X-File-Group"]=h||String(f.gid);case 6:c=f.size<10485760?l.readFileSync(t):l.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}c=t,e.n=9;break;case 8:throw new qr("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",c,{headers:u,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(d=e.v).status||201===d.status){e.n=11;break}throw new qr("Failed to upload file: ".concat(i),d.status,d.data);case 11:if(y=String(null!==(r=null===(o=d.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===d.status&&y.includes("json")&&d.data&&"object"===hr(d.data)&&"message"in d.data)){e.n=12;break}throw new qr("File upload is not supported by this server surface: ".concat(i),d.status,d.data);case 12:return e.a(2)}},e,this)})),function(e){return S.apply(this,arguments)})},{key:"getHostResources",value:(E=Or(dr().m(function e(){var t;return dr().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 E.apply(this,arguments)})},{key:"getConfig",value:(O=Or(dr().m(function e(){var t;return dr().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 O.apply(this,arguments)})},{key:"setConfig",value:(_=Or(dr().m(function e(t){var n;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return _.apply(this,arguments)})},{key:"setLogLevel",value:(v=Or(dr().m(function e(){var t,n,r=arguments;return dr().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 v.apply(this,arguments)})},{key:"addLabel",value:(w=Or(dr().m(function e(t,n){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return w.apply(this,arguments)})},{key:"deleteLabel",value:(g=Or(dr().m(function e(t){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"listLabels",value:(b=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return b.apply(this,arguments)})},{key:"listPrincipals",value:(m=Or(dr().m(function e(){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principals");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return m.apply(this,arguments)})},{key:"updatePrincipal",value:(y=Or(dr().m(function e(t,n){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return y.apply(this,arguments)})},{key:"deletePrincipal",value:(d=Or(dr().m(function e(t){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"getCurrentUser",value:(h=Or(dr().m(function e(){return dr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return h.apply(this,arguments)})},{key:"listPermissions",value:(p=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(f=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"getUserPermissions",value:(l=Or(dr().m(function e(){return dr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return l.apply(this,arguments)})},{key:"listRoles",value:(c=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"updateRole",value:(u=Or(dr().m(function e(t,n){return dr().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 u.apply(this,arguments)})},{key:"deleteRole",value:(a=Or(dr().m(function e(t){return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"getMetrics",value:(s=Or(dr().m(function e(){var t;return dr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"subscribe",value:(i=Or(dr().m(function e(){return dr().w(function(e){for(;;)switch(e.n){case 0:throw new qr("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return i.apply(this,arguments)})},{key:"unsubscribe",value:(o=Or(dr().m(function e(){return dr().w(function(e){for(;;)switch(e.n){case 0:throw new qr("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"request",value:(r=Or(dr().m(function e(t,n){var r,o,i=arguments;return dr().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_commonHeaders",value:(t=Or(dr().m(function e(){var t,n;return dr().w(function(e){for(;;)switch(e.n){case 0:return t={},Fr.isNode&&(t[Lr.HTTP_USER_AGENT_HEADER_NAME]=Lr.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[Lr.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[Lr.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_request",value:(e=Or(dr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return dr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},!Fr.isNode||!Dr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Dr;case 1:Ur&&(this._client.defaults.httpsAgent=new Ur.Agent(wr(wr({},ao(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2: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=3,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=4;break}return e.n=4,this._applyRequestSignature(f);case 4:return e.n=5,this._client(f);case 5:if(!((p=e.v).status<200||p.status>=300)){e.n=6;break}throw h=this._extractErrorMessage(p.data),new qr(h,p.status,p.data);case 6:return e.a(2,p);case 7:throw e.p=7,d=e.v,this.onError(d);case 8:return e.a(2)}},e,this,[[3,7]])})),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"===hr(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof qr?e:new qr(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,w,v,_,O,E,S,R,P,T,k,A,j,C,N,U,x,D,L,F,B,I,q,M,H,z}(),co=Sr(function e(t,n,r,o){Pr(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),lo=function(){return Sr(function e(t,n,r){Pr(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"withForwardingHost",value:(t=Or(dr().m(function e(t){var n;return dr().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(dr().m(function e(){var t,n,r=this,o=arguments;return dr().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:zr,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 fo=uo;export{uo as AppMeshClient,qr as AppMeshError,co as AppOutput,Mr as AppRemovedError,lo as AppRun,ro as DEFAULT_CA_FILE,Mn as RefreshTokenProvider,sr as RequestSigner,Nn as StaticAccessTokenProvider,Hr as TransportDisconnectedError,Xr as _resolveGid,to as _resolveGroupName,Jr as _resolveUid,Zr as _resolveUserName,fo as default};
|
package/package.json
CHANGED
package/src/appmesh.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { StaticAccessTokenProvider } from './token_provider.js';
|
|
4
4
|
import { RefreshTokenProvider } from './refresh_token_provider.js';
|
|
5
|
+
import {
|
|
6
|
+
RequestSigner, canonicalQueryFromEncoded, serializeQueryPurePercent, isEmptyBodyExemptPath,
|
|
7
|
+
} from './request_signature.js';
|
|
5
8
|
|
|
6
9
|
// Lazy-resolved Node.js https/fs modules (null in browser)
|
|
7
10
|
let _https = null;
|
|
@@ -21,9 +24,46 @@ const CONSTANTS = Object.freeze({
|
|
|
21
24
|
|
|
22
25
|
// Environment detection
|
|
23
26
|
const ENV = Object.freeze({
|
|
24
|
-
isNode: !(typeof window !== 'undefined' &&
|
|
27
|
+
isNode: !(typeof window !== 'undefined' && window.document !== 'undefined')
|
|
25
28
|
});
|
|
26
29
|
|
|
30
|
+
// Same absolute-URL test as axios's helpers/isAbsoluteURL.js: "<scheme>://" or
|
|
31
|
+
// a protocol-relative "//" URL bypasses baseURL combination.
|
|
32
|
+
const _ABSOLUTE_URL_RE = /^([a-z][a-z\d+\-.]*:)?\/\//i;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The encoded request path exactly as axios puts it on the wire: axios combines
|
|
36
|
+
* baseURL + url by concatenation (core/buildFullPath.js + helpers/combineURLs.js
|
|
37
|
+
* — a baseURL path PREFIX stays in the path), then the Node adapter parses the
|
|
38
|
+
* result with `new URL(fullPath)` and sends `parsed.pathname`. Signing this
|
|
39
|
+
* value (instead of the caller-supplied raw url) makes the signed path the wire
|
|
40
|
+
* path: a space or non-ASCII character is percent-encoded on the wire and in
|
|
41
|
+
* the signature alike, and a baseURL path prefix is included.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
function _wireRequestPath(baseURL, url) {
|
|
45
|
+
const base = String(baseURL || '');
|
|
46
|
+
const rel = String(url || '');
|
|
47
|
+
let fullPath = rel;
|
|
48
|
+
if (base && !_ABSOLUTE_URL_RE.test(rel)) {
|
|
49
|
+
// combineURLs: strip trailing '/' from the base, leading '/' from the url.
|
|
50
|
+
let end = base.length;
|
|
51
|
+
while (end > 0 && base.charCodeAt(end - 1) === 47 /* / */) end--;
|
|
52
|
+
fullPath = rel ? base.slice(0, end) + '/' + rel.replace(/^\/+/, '') : base;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return new URL(fullPath).pathname;
|
|
56
|
+
} catch (_) {
|
|
57
|
+
try {
|
|
58
|
+
// Path-only url (no baseURL, no scheme): axios supplies a synthetic base
|
|
59
|
+
// for such URLs; mirror that so the pathname is still computed.
|
|
60
|
+
return new URL(fullPath, 'http://localhost').pathname;
|
|
61
|
+
} catch (_e) {
|
|
62
|
+
return rel;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
27
67
|
/**
|
|
28
68
|
* Custom error for AppMesh with enhanced debugging
|
|
29
69
|
*/
|
|
@@ -367,6 +407,9 @@ class AppMeshClient {
|
|
|
367
407
|
// Host to forward requests to
|
|
368
408
|
this.forwardingHost = null;
|
|
369
409
|
|
|
410
|
+
// Opt-in HMAC request signer (REST.RequestSignature hardening); null when disabled
|
|
411
|
+
this._requestSigner = null;
|
|
412
|
+
|
|
370
413
|
// Token provider: single source of truth for the access token; transports
|
|
371
414
|
// read from it via _getAccessToken()
|
|
372
415
|
this._tokenProvider = null;
|
|
@@ -461,6 +504,118 @@ class AppMeshClient {
|
|
|
461
504
|
this._tokenProvider = null;
|
|
462
505
|
}
|
|
463
506
|
|
|
507
|
+
/**
|
|
508
|
+
* Enable HMAC request signing on every subsequent request (opt-in) with a
|
|
509
|
+
* per-principal API key (`POST /appmesh/security/apikeys`). Each request then
|
|
510
|
+
* carries the `X-Request-Key`, `X-Timestamp`, `X-Nonce` and `X-Signature`
|
|
511
|
+
* headers (Node.js only). The signature is an integrity layer on top of the
|
|
512
|
+
* bearer, not a replacement for it. The secret is kept in memory only and
|
|
513
|
+
* never logged.
|
|
514
|
+
* @param {string} keyId - API key id
|
|
515
|
+
* @param {string} secret - API key secret
|
|
516
|
+
*/
|
|
517
|
+
enableRequestSignature(keyId, secret) {
|
|
518
|
+
this._requestSigner = new RequestSigner(keyId, secret);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** Disable request signing; subsequent requests carry no signature headers. */
|
|
522
|
+
disableRequestSignature() {
|
|
523
|
+
this._requestSigner = null;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** Whether `enableRequestSignature` is currently active on this client. */
|
|
527
|
+
isRequestSignatureEnabled() {
|
|
528
|
+
return this._requestSigner !== null;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Attach the four signature headers to a prepared axios request config.
|
|
533
|
+
* The path is signed exactly as axios puts it on the wire (`_wireRequestPath`:
|
|
534
|
+
* percent-encoded, baseURL path prefix included) and the canonical query is
|
|
535
|
+
* derived from the exact wire query: signing forces a pure percent-encoded
|
|
536
|
+
* params serialization so the daemon's %-only decode yields exactly the
|
|
537
|
+
* signed values. The body is serialized the way axios will put it on the
|
|
538
|
+
* wire. The streamed file endpoints sign the empty-string hash (the WSS
|
|
539
|
+
* data-channel "/ws" routes sign the stripped route, canonicalSigningPath).
|
|
540
|
+
* @private
|
|
541
|
+
*/
|
|
542
|
+
async _applyRequestSignature(config) {
|
|
543
|
+
const signer = this._requestSigner;
|
|
544
|
+
if (!signer || !config) return;
|
|
545
|
+
|
|
546
|
+
// Sign the wire path, not the caller's raw url: axios re-quotes the path
|
|
547
|
+
// (space → %20) and keeps the baseURL path prefix, so the daemon verifies
|
|
548
|
+
// a different path than the raw one whenever either differs.
|
|
549
|
+
const path = _wireRequestPath(config.baseURL || this._client.defaults.baseURL || this.baseURL, config.url);
|
|
550
|
+
let canonicalQuery = '';
|
|
551
|
+
if (config.params && typeof config.params === 'object' && Object.keys(config.params).length > 0) {
|
|
552
|
+
// Deterministic wire form: pure percent encoding, null/undefined skipped.
|
|
553
|
+
config.paramsSerializer = serializeQueryPurePercent;
|
|
554
|
+
canonicalQuery = canonicalQueryFromEncoded(serializeQueryPurePercent(config.params));
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const contentType = this._headerValue(config.headers, 'content-type');
|
|
558
|
+
const bodyBytes = isEmptyBodyExemptPath(path)
|
|
559
|
+
? Buffer.alloc(0)
|
|
560
|
+
: this._wireBodyBytes(config.data, contentType);
|
|
561
|
+
|
|
562
|
+
const method = String(config.method || 'get').toUpperCase();
|
|
563
|
+
const headers = {};
|
|
564
|
+
await signer.attach(headers, method, path, canonicalQuery, bodyBytes);
|
|
565
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
566
|
+
if (config.headers && typeof config.headers.set === 'function') {
|
|
567
|
+
config.headers.set(name, value);
|
|
568
|
+
} else {
|
|
569
|
+
config.headers = { ...config.headers, [name]: value };
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Case-insensitive lookup on a plain header object or AxiosHeaders.
|
|
576
|
+
* @private
|
|
577
|
+
*/
|
|
578
|
+
_headerValue(headers, name) {
|
|
579
|
+
if (!headers) return undefined;
|
|
580
|
+
if (typeof headers.get === 'function') return headers.get(name);
|
|
581
|
+
const key = Object.keys(headers).find(k => k.toLowerCase() === name.toLowerCase());
|
|
582
|
+
return key === undefined ? undefined : headers[key];
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* The body bytes as axios will serialize them for the wire, mirroring the
|
|
587
|
+
* default transformRequest: plain objects (and JSON-typed strings) become
|
|
588
|
+
* JSON, other strings pass through, buffers pass through. A body that cannot
|
|
589
|
+
* be replayed byte-for-byte (stream, File, FormData) cannot be signed.
|
|
590
|
+
* @private
|
|
591
|
+
*/
|
|
592
|
+
_wireBodyBytes(data, contentType) {
|
|
593
|
+
if (data === null || data === undefined) {
|
|
594
|
+
return Buffer.alloc(0);
|
|
595
|
+
}
|
|
596
|
+
if (typeof data === 'string') {
|
|
597
|
+
if (String(contentType || '').toLowerCase().includes('application/json')) {
|
|
598
|
+
// axios trims a JSON-parseable string body and re-encodes a non-JSON one.
|
|
599
|
+
try {
|
|
600
|
+
JSON.parse(data);
|
|
601
|
+
return Buffer.from(data.trim(), 'utf8');
|
|
602
|
+
} catch (error) {
|
|
603
|
+
if (error.name !== 'SyntaxError') throw error;
|
|
604
|
+
return Buffer.from(JSON.stringify(data), 'utf8');
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return Buffer.from(data, 'utf8');
|
|
608
|
+
}
|
|
609
|
+
if (Buffer.isBuffer(data) || data instanceof Uint8Array || data instanceof ArrayBuffer) {
|
|
610
|
+
return Buffer.from(data);
|
|
611
|
+
}
|
|
612
|
+
if (typeof data === 'object') {
|
|
613
|
+
return Buffer.from(JSON.stringify(data), 'utf8');
|
|
614
|
+
}
|
|
615
|
+
throw new AppMeshError(
|
|
616
|
+
'cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies');
|
|
617
|
+
}
|
|
618
|
+
|
|
464
619
|
/** Return the current in-memory access token from the attached provider. */
|
|
465
620
|
async _getAccessToken() {
|
|
466
621
|
return this._tokenProvider ? await this._tokenProvider.getAccessToken() : null;
|
|
@@ -503,6 +658,11 @@ class AppMeshClient {
|
|
|
503
658
|
} else {
|
|
504
659
|
config.headers = { ...config.headers, [CONSTANTS.HTTP_HEADER_KEY_AUTH]: authorization };
|
|
505
660
|
}
|
|
661
|
+
// The retry is a new request: it needs a fresh signature (a replayed nonce
|
|
662
|
+
// would be rejected by the daemon's replay protection).
|
|
663
|
+
if (this._requestSigner) {
|
|
664
|
+
await this._applyRequestSignature(config);
|
|
665
|
+
}
|
|
506
666
|
return this._client(config);
|
|
507
667
|
}
|
|
508
668
|
|
|
@@ -562,6 +722,10 @@ class AppMeshClient {
|
|
|
562
722
|
* working_dir: "",
|
|
563
723
|
* enabled: 1,
|
|
564
724
|
* docker_image: "",
|
|
725
|
+
* docker_ports: [], // docker run -p spelling: "[hostIp:]hostPort:containerPort[/protocol]"
|
|
726
|
+
* docker_volumes: [], // docker run -v spelling
|
|
727
|
+
* docker_network: null, // host, bridge, none or a network name
|
|
728
|
+
* docker_backend: null, // "api" (default) or "cli"
|
|
565
729
|
* stdout_backup_count: 3,
|
|
566
730
|
* start_time: "",
|
|
567
731
|
* end_time: "",
|
|
@@ -575,7 +739,7 @@ class AppMeshClient {
|
|
|
575
739
|
* env: {},
|
|
576
740
|
* secret_env: {},
|
|
577
741
|
* pid: null,
|
|
578
|
-
* resource_limit: { cpu_shares: null, memory_mb: null, memory_virt_mb: null },
|
|
742
|
+
* resource_limit: { cpu_shares: null, cpu: null, memory_mb: null, memory_virt_mb: null }, // cpu = fractional cores (NanoCPUs)
|
|
579
743
|
* behavior: { exit: "standby", exit_code_actions: { "0": "keepalive" } }
|
|
580
744
|
* };
|
|
581
745
|
* await client.addApp("ping", appConfig);
|
|
@@ -1183,6 +1347,11 @@ class AppMeshClient {
|
|
|
1183
1347
|
requestConfig.data = body;
|
|
1184
1348
|
}
|
|
1185
1349
|
|
|
1350
|
+
// Opt-in request signature: attach the four headers to this exact request.
|
|
1351
|
+
if (this._requestSigner) {
|
|
1352
|
+
await this._applyRequestSignature(requestConfig);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1186
1355
|
const response = await this._client(requestConfig);
|
|
1187
1356
|
if (response.status < 200 || response.status >= 300) {
|
|
1188
1357
|
const errMsg = this._extractErrorMessage(response.data);
|
|
@@ -1328,7 +1497,7 @@ class AppRun {
|
|
|
1328
1497
|
// Export the main classes
|
|
1329
1498
|
export {
|
|
1330
1499
|
AppMeshClient, AppOutput, AppRun, AppMeshError, AppRemovedError, TransportDisconnectedError,
|
|
1331
|
-
DEFAULT_CA_FILE, StaticAccessTokenProvider, RefreshTokenProvider
|
|
1500
|
+
DEFAULT_CA_FILE, StaticAccessTokenProvider, RefreshTokenProvider, RequestSigner
|
|
1332
1501
|
};
|
|
1333
1502
|
// Exported for the TCP client (Node.js only); not part of the browser-facing API
|
|
1334
1503
|
export { _resolveUid, _resolveGid, _resolveUserName, _resolveGroupName };
|
package/src/appmesh_tcp.js
CHANGED
|
@@ -11,6 +11,7 @@ import AppMeshClient, {
|
|
|
11
11
|
AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE,
|
|
12
12
|
_resolveUid, _resolveGid, _resolveUserName, _resolveGroupName,
|
|
13
13
|
} from './appmesh.js'
|
|
14
|
+
import { canonicalQuery } from './request_signature.js'
|
|
14
15
|
|
|
15
16
|
// Constants
|
|
16
17
|
const TCP_BLOCK_SIZE = 16 * 1024 - 128 // TLS-optimized chunk size
|
|
@@ -628,6 +629,16 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
628
629
|
}
|
|
629
630
|
}
|
|
630
631
|
|
|
632
|
+
// Opt-in request signature (REST.RequestSignature hardening): the frame
|
|
633
|
+
// carries the four headers; the hash covers the exact frame body (the
|
|
634
|
+
// streamed file endpoints sign the empty-string hash). Signed exactly as
|
|
635
|
+
// framed: method and URI as sent, query map values as decoded on the daemon side.
|
|
636
|
+
if (this._requestSigner) {
|
|
637
|
+
await this._requestSigner.attach(
|
|
638
|
+
request.headers, request.httpMethod, request.requestUri,
|
|
639
|
+
canonicalQuery(request.query), request.body)
|
|
640
|
+
}
|
|
641
|
+
|
|
631
642
|
// Send request
|
|
632
643
|
const serialized = request.serialize()
|
|
633
644
|
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// request_signature.js - opt-in HMAC-SHA256 request signing (anti-tamper layer)
|
|
2
|
+
//
|
|
3
|
+
// Mirrors the daemon verifier in src/daemon/security/RequestSignature.{h,cpp}
|
|
4
|
+
// byte-for-byte. The canonical string is:
|
|
5
|
+
// METHOD + "\n" + path + "\n" + sortedQuery + "\n" + sha256hex(body) + "\n" + timestamp + "\n" + nonce
|
|
6
|
+
// - path: the request path without the query, exactly as sent (not
|
|
7
|
+
// percent-decoded). The WSS data-channel file routes sign the route WITHOUT
|
|
8
|
+
// the trailing "/ws" (the suffix selects the transfer channel, not the
|
|
9
|
+
// signed resource — daemon RequestHardening::canonicalFileRoute)
|
|
10
|
+
// - sortedQuery: decoded k=v pairs joined with '&', sorted by key then value, empty
|
|
11
|
+
// string when there is no query (%XX-decoding only; '+' stays literal)
|
|
12
|
+
// - body: lowercase hex SHA-256 of the raw body bytes; no body hashes the empty string
|
|
13
|
+
// - streamed file endpoints (/appmesh/file/download|upload|delete) sign the
|
|
14
|
+
// empty-string body hash (documented exemption: the file content is not bound)
|
|
15
|
+
//
|
|
16
|
+
// The secret is never logged and never exposed through a getter or toString().
|
|
17
|
+
// Node.js only: signing uses node:crypto (no npm dependencies).
|
|
18
|
+
|
|
19
|
+
let _crypto = null
|
|
20
|
+
|
|
21
|
+
async function nodeCrypto () {
|
|
22
|
+
if (_crypto) return _crypto
|
|
23
|
+
// The specifier is indirect and webpackIgnore keeps the browser bundle from
|
|
24
|
+
// trying to resolve the Node builtin; the import only runs where signing is
|
|
25
|
+
// used (Node.js).
|
|
26
|
+
const specifier = 'node:crypto'
|
|
27
|
+
const mod = await import(/* webpackIgnore: true */ specifier)
|
|
28
|
+
_crypto = mod.default && mod.default.createHmac ? mod.default : mod
|
|
29
|
+
return _crypto
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Streamed file routes: the signature binds method/path/query/timestamp/nonce, not the bytes.
|
|
33
|
+
* The exact daemon set (RequestHardening::canonicalFileRoute) — subpaths are not exempt. */
|
|
34
|
+
const EMPTY_BODY_EXEMPT_PATHS = new Set(['/appmesh/file/download', '/appmesh/file/upload', '/appmesh/file/delete'])
|
|
35
|
+
|
|
36
|
+
/** Header names (must match HTTP_HEADER_KEY_* in src/common/Utility.h). */
|
|
37
|
+
export const REQUEST_SIGNATURE_HEADERS = Object.freeze({
|
|
38
|
+
KEY_ID: 'X-Request-Key',
|
|
39
|
+
TIMESTAMP: 'X-Timestamp',
|
|
40
|
+
NONCE: 'X-Nonce',
|
|
41
|
+
SIGNATURE: 'X-Signature'
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
/** True for the streamed file endpoints that sign the empty-string body hash. */
|
|
45
|
+
export function isEmptyBodyExemptPath (path) {
|
|
46
|
+
if (typeof path !== 'string') return false
|
|
47
|
+
return EMPTY_BODY_EXEMPT_PATHS.has(canonicalSigningPath(path))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The canonical path the daemon signs: the trailing "/ws" of the WSS HTTPS
|
|
52
|
+
* data-channel file routes selects the transfer channel, not the signed
|
|
53
|
+
* resource, so it is dropped (daemon RequestHardening::canonicalFileRoute;
|
|
54
|
+
* docs/source/Security.md, "Request replay protection and signatures").
|
|
55
|
+
* Every other path passes through unchanged.
|
|
56
|
+
*/
|
|
57
|
+
export function canonicalSigningPath (path) {
|
|
58
|
+
if (path === '/appmesh/file/download/ws') return '/appmesh/file/download'
|
|
59
|
+
if (path === '/appmesh/file/upload/ws') return '/appmesh/file/upload'
|
|
60
|
+
return path
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function toHexLower (buffer) {
|
|
64
|
+
return Buffer.from(buffer).toString('hex')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Opt-in request signer for one per-principal API key
|
|
69
|
+
* (POST /appmesh/security/apikeys). The signature is an integrity layer on top
|
|
70
|
+
* of the bearer, not a replacement for it.
|
|
71
|
+
*/
|
|
72
|
+
export class RequestSigner {
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} keyId - API key id sent as X-Request-Key
|
|
75
|
+
* @param {string} secret - API key secret (kept private, never logged)
|
|
76
|
+
*/
|
|
77
|
+
constructor (keyId, secret) {
|
|
78
|
+
if (typeof keyId !== 'string' || keyId.trim() === '') {
|
|
79
|
+
throw new TypeError('keyId must be a non-empty string')
|
|
80
|
+
}
|
|
81
|
+
if (typeof secret !== 'string' || secret === '') {
|
|
82
|
+
throw new TypeError('secret must be a non-empty string')
|
|
83
|
+
}
|
|
84
|
+
this._keyId = keyId
|
|
85
|
+
this._secret = secret
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The API key id this signer advertises. */
|
|
89
|
+
get keyId () {
|
|
90
|
+
return this._keyId
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Attach the four signature headers to a request header object, generating a
|
|
95
|
+
* fresh unix-seconds timestamp and a random unique nonce.
|
|
96
|
+
*
|
|
97
|
+
* @param {Object} headers - request header object (mutated)
|
|
98
|
+
* @param {string} method - HTTP method exactly as sent on the wire
|
|
99
|
+
* @param {string} path - request path without query, exactly as sent; the
|
|
100
|
+
* WSS data-channel file routes ("/appmesh/file/{upload,download}/ws") are
|
|
101
|
+
* signed under the route without the trailing "/ws" (canonicalSigningPath)
|
|
102
|
+
* @param {string} canonicalQuery - already-canonicalized query ('' when none)
|
|
103
|
+
* @param {Buffer|Uint8Array|null} body - raw body bytes; null means no body;
|
|
104
|
+
* ignored for the streamed file endpoints, which always sign the empty hash
|
|
105
|
+
* @param {string} [timestamp] - override (tests / known-answer vectors)
|
|
106
|
+
* @param {string} [nonce] - override (tests / known-answer vectors)
|
|
107
|
+
*/
|
|
108
|
+
async attach (headers, method, path, canonicalQuery, body, timestamp, nonce) {
|
|
109
|
+
const ts = timestamp || String(Math.floor(Date.now() / 1000))
|
|
110
|
+
const n = nonce || (await this.randomNonce())
|
|
111
|
+
const signPath = canonicalSigningPath(path)
|
|
112
|
+
const canonical = canonicalString(method, signPath, canonicalQuery, await sha256HexFor(signPath, body), ts, n)
|
|
113
|
+
headers[REQUEST_SIGNATURE_HEADERS.KEY_ID] = this._keyId
|
|
114
|
+
headers[REQUEST_SIGNATURE_HEADERS.TIMESTAMP] = ts
|
|
115
|
+
headers[REQUEST_SIGNATURE_HEADERS.NONCE] = n
|
|
116
|
+
headers[REQUEST_SIGNATURE_HEADERS.SIGNATURE] = await this.sign(canonical)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A random per-request nonce (hex; the daemon accepts up to 128 chars, no whitespace). */
|
|
120
|
+
async randomNonce () {
|
|
121
|
+
const crypto = await nodeCrypto()
|
|
122
|
+
return crypto.randomBytes(16).toString('hex')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Lowercase hex HMAC-SHA256 of the canonical string under this signer's secret. */
|
|
126
|
+
async sign (canonical) {
|
|
127
|
+
const crypto = await nodeCrypto()
|
|
128
|
+
return crypto.createHmac('sha256', this._secret).update(canonical, 'utf8').digest('hex')
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Redacted: never exposes the secret. */
|
|
132
|
+
toString () {
|
|
133
|
+
return `RequestSigner[keyId=${this._keyId}]`
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** The exact canonical string both sides must build byte-for-byte. */
|
|
138
|
+
export function canonicalString (method, path, query, bodySha256Hex, timestamp, nonce) {
|
|
139
|
+
if (!method || !path) throw new TypeError('method and path are required')
|
|
140
|
+
return [method, path, query || '', bodySha256Hex, timestamp, nonce].join('\n')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Empty-string body hash (the streamed-file-endpoint exemption value). */
|
|
144
|
+
export const EMPTY_BODY_SHA256 =
|
|
145
|
+
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Lowercase hex SHA-256 of the raw body bytes, applying the streamed-file
|
|
149
|
+
* exemption: those endpoints sign the empty-string hash regardless of body.
|
|
150
|
+
*/
|
|
151
|
+
export async function bodySha256Hex (path, body) {
|
|
152
|
+
return sha256HexFor(path, body)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function sha256HexFor (path, body) {
|
|
156
|
+
const bytes = (body === null || body === undefined || isEmptyBodyExemptPath(path))
|
|
157
|
+
? Buffer.alloc(0)
|
|
158
|
+
: Buffer.from(body)
|
|
159
|
+
const crypto = await nodeCrypto()
|
|
160
|
+
return crypto.createHash('sha256').update(bytes).digest('hex')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Sorted 'k=v&k2=v2' form used in the canonical string. Inputs are the decoded
|
|
165
|
+
* parameter pairs (the TCP query map, or values decoded from the wire query).
|
|
166
|
+
* Pairs are sorted by key, then by value.
|
|
167
|
+
*/
|
|
168
|
+
export function canonicalQuery (params) {
|
|
169
|
+
if (!params) return ''
|
|
170
|
+
const pairs = Object.entries(params)
|
|
171
|
+
.filter(([, v]) => v !== null && v !== undefined)
|
|
172
|
+
.map(([k, v]) => [String(k), String(v)])
|
|
173
|
+
// Order by UTF-8 bytes, matching the daemon (not UTF-16 code units).
|
|
174
|
+
pairs.sort((a, b) => {
|
|
175
|
+
const byKey = Buffer.compare(Buffer.from(a[0], 'utf8'), Buffer.from(b[0], 'utf8'))
|
|
176
|
+
return byKey !== 0 ? byKey : Buffer.compare(Buffer.from(a[1], 'utf8'), Buffer.from(b[1], 'utf8'))
|
|
177
|
+
})
|
|
178
|
+
return pairs.map(([k, v]) => `${k}=${v}`).join('&')
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Canonical query built from the encoded query string exactly as it goes on the
|
|
183
|
+
* wire (HTTP transport). Mirrors the daemon parser: split on '&', split each
|
|
184
|
+
* pair at the first '=', decode each component with %XX-only decoding ('+'
|
|
185
|
+
* stays literal, a malformed escape keeps the whole raw component, a duplicate
|
|
186
|
+
* key keeps its first occurrence), then sort.
|
|
187
|
+
*/
|
|
188
|
+
export function canonicalQueryFromEncoded (encodedQuery) {
|
|
189
|
+
if (!encodedQuery) return ''
|
|
190
|
+
const decoded = {}
|
|
191
|
+
for (const pair of encodedQuery.split('&')) {
|
|
192
|
+
if (pair === '') continue
|
|
193
|
+
const eq = pair.indexOf('=')
|
|
194
|
+
const key = eq < 0 ? pair : pair.slice(0, eq)
|
|
195
|
+
const value = eq < 0 ? '' : pair.slice(eq + 1)
|
|
196
|
+
// std::map::emplace semantics on the daemon: the first value for a key wins.
|
|
197
|
+
if (!(key in decoded)) {
|
|
198
|
+
decoded[key] = value
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// The daemon decodes after collecting; decode now, then sort the decoded pairs.
|
|
202
|
+
const decodedPairs = Object.entries(decoded).map(([k, v]) => [percentDecode(k), percentDecode(v)])
|
|
203
|
+
// Order by UTF-8 bytes, matching the daemon (not UTF-16 code units: a
|
|
204
|
+
// non-BMP character sorts before U+E000..U+FFFF in UTF-16, after it in UTF-8).
|
|
205
|
+
decodedPairs.sort((a, b) => {
|
|
206
|
+
const byKey = Buffer.compare(Buffer.from(a[0], 'utf8'), Buffer.from(b[0], 'utf8'))
|
|
207
|
+
return byKey !== 0 ? byKey : Buffer.compare(Buffer.from(a[1], 'utf8'), Buffer.from(b[1], 'utf8'))
|
|
208
|
+
})
|
|
209
|
+
return decodedPairs.map(([k, v]) => `${k}=${v}`).join('&')
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** %XX-only decode; a malformed escape keeps the whole raw value (daemon behavior). */
|
|
213
|
+
function percentDecode (value) {
|
|
214
|
+
if (!value.includes('%')) return value
|
|
215
|
+
const bytes = []
|
|
216
|
+
for (let i = 0; i < value.length; i++) {
|
|
217
|
+
const c = value.charCodeAt(i)
|
|
218
|
+
if (c === 0x25 /* % */) {
|
|
219
|
+
const hi = value.charCodeAt(i + 1)
|
|
220
|
+
const lo = value.charCodeAt(i + 2)
|
|
221
|
+
const hex = (h) => (h >= 0x30 && h <= 0x39) || (h >= 0x41 && h <= 0x46) || (h >= 0x61 && h <= 0x66)
|
|
222
|
+
if (!hex(hi) || !hex(lo)) {
|
|
223
|
+
// Malformed escape: the daemon keeps the raw value verbatim.
|
|
224
|
+
return value
|
|
225
|
+
}
|
|
226
|
+
bytes.push(parseInt(value.slice(i + 1, i + 3), 16))
|
|
227
|
+
i += 2
|
|
228
|
+
} else if (c < 0x80) {
|
|
229
|
+
bytes.push(c)
|
|
230
|
+
} else {
|
|
231
|
+
// Non-ASCII in the raw component: keep its UTF-8 bytes.
|
|
232
|
+
const part = Buffer.from(value[i], 'utf8')
|
|
233
|
+
bytes.push(...part)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return Buffer.from(bytes).toString('utf8')
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Pure percent-encoded query serialization used when signing is enabled, so the
|
|
241
|
+
* query on the wire decodes back (daemon-side, %XX-only) to exactly the values
|
|
242
|
+
* the signature was computed from. null/undefined parameters are skipped
|
|
243
|
+
* (matching axios's default serializer).
|
|
244
|
+
*/
|
|
245
|
+
export function serializeQueryPurePercent (params) {
|
|
246
|
+
if (!params) return ''
|
|
247
|
+
return Object.entries(params)
|
|
248
|
+
.filter(([, v]) => v !== null && v !== undefined)
|
|
249
|
+
.map(([k, v]) => `${encodeURIComponent(String(k))}=${encodeURIComponent(String(v))}`)
|
|
250
|
+
.join('&')
|
|
251
|
+
}
|