appmesh 3.1.20 → 3.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -445,4 +445,4 @@ await server.sendTaskResult(JSON.stringify(result));
445
445
 
446
446
  ## Behavioral contract
447
447
 
448
- Cross-SDK client guarantees (event demuxer ordering, `__disconnected__` event, buffering caps, timeout/cleanup policy, and bearer authentication) are defined in [SDKContract.md](https://github.com/laoshanxi/app-mesh/blob/main/docs/source/SDKContract.md).
448
+ Cross-SDK client guarantees (event demuxer ordering, `__disconnected__` event, buffering caps, timeout/cleanup policy, and bearer authentication) are defined in [SDKContract.md](https://github.com/laoshanxi/app-mesh/blob/main/docs/source/interfaces/SDKContract.md).
@@ -1 +1 @@
1
- var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s=Object.create(null);t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),582:()=>import("./582.appmesh.esm.js"),770:()=>import("./770.appmesh.esm.js")},t={792:0},r=e=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e;var s,a,u=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);u<r.length;u++)a=r[u],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0};n.f.j=(o,i)=>{let s=n.o(t,o)?t[o]:void 0;if(0!==s)if(s)i.push(s[1]);else{const n=Promise.race([e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e}),new Promise(e=>s=t[o]=[e])]);i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>He,hasStandardBrowserEnv:()=>Me,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>qe,origin:()=>Xe});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),f=(e,t,n)=>e===Object.prototype||!n&&null===t,p=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=s(n);if(f(n,o,n===e))return!1;if(c(n,t))return!0;n=o}return!1},h=(d=Object.create(null),e=>{const t=i.call(e);return d[t]||(d[t]=t.slice(8,-1).toLowerCase())});var d;const y=e=>(e=e.toLowerCase(),t=>h(t)===e),m=e=>t=>typeof t===e,{isArray:b}=Array,v=m("undefined");function g(e){return null!==e&&!v(e)&&null!==e.constructor&&!v(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w=y("ArrayBuffer");const _=m("string"),E=m("function"),O=m("number"),S=e=>null!==e&&"object"==typeof e,T=e=>{if(!S(e))return!1;const t=s(e);return(null===t||t===Object.prototype||null===s(t))&&(f(e,t,!0)||!c(e,u)&&!c(e,a))},R=y("Date"),k=y("File"),P=y("Blob"),A=y("FileList"),j=y("Set");const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},N=void 0!==C.FormData?C.FormData:void 0,U=y("URLSearchParams"),[x,D,L,F]=["ReadableStream","Request","Response","Headers"].map(y);function B(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),b(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(g(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,H=e=>!v(e)&&e!==I;const q=(M="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>M&&e instanceof M);var M;const z=y("HTMLFormElement"),{propertyIsEnumerable:X}=Object.prototype,K=y("RegExp"),W=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};B(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Y=y("AsyncFunction"),G=($="function"==typeof setImmediate,J=E(I.postMessage),$?setImmediate:J?(V=`axios@${Math.random()}`,Q=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===V&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),I.postMessage(V,"*")}):e=>setTimeout(e));var $,J,V,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||G,ee=e=>null!=e&&E(e[a]),te={isArray:b,isArrayBuffer:w,isBuffer:g,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!E(e.append))return!1;const n=h(e);return"formdata"===n||"object"===n&&E(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&w(e.buffer),t},isString:_,isNumber:O,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:T,isEmptyObject:e=>{if(!S(e)||g(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:x,isRequest:D,isResponse:L,isHeaders:F,isUndefined:v,isDate:R,isFile:k,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:P,isRegExp:K,isFunction:E,isStream:e=>S(e)&&E(e.pipe),isURLSearchParams:U,isTypedArray:q,isFileList:A,forEach:B,merge:function e(...t){const{caseless:n,skipUndefined:r}=H(this)&&this||{},o={},i=n?Object.create(null):null,s=(t,n)=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;let s=n;if(i&&"string"==typeof n){const e=n.toLowerCase(),t=i[e];void 0!==t&&c(o,t)?s=t:i[e]=n}const a=c(o,s)?o[s]:void 0;T(a)&&T(t)?o[s]=e(a,t):T(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&v(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||g(n))continue;if(B(n,s),"object"!=typeof n||b(n)||!Object.getOwnPropertySymbols)continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];X.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(B(t,(t,r)=>{n&&E(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:h,kindOfTest:y,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(b(e))return e;let t=e.length;if(!Number.isSafeInteger(t)||t<0||t>4294967295)return null;const n=new Set,r=new Set;let o=e;for(;null!=o&&n.size<t;){if(r.has(o))return null;r.add(o);const i=s(o);if(f(o,i,o===e))break;Object.getOwnPropertyNames(o).forEach(e=>{const r=+e;Number.isInteger(r)&&r>=0&&r<t&&String(r)===e&&c(o,e)&&n.add(r)}),o=i}if(n.size!==t)return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:z,hasOwnProperty:c,hasOwnProp:c,hasOwnInPrototypeChain:p,getSafeProp:(e,t)=>null!=e&&p(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=s(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(l(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:s(i);if(f(i,a,i===e))break;const u=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&u.push(...Object.getOwnPropertySymbols(i));for(const t of u)l(t)||c(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:W,freezeMethods:e=>{W(e,(t,n)=>{if(E(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];E(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return b(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:function(e,t){if(g(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null},global:I,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(g(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),j(e)){r=[];for(const t of e){const e=n(t);!v(e)&&r.push(e)}}else r=b(e)?[]:{},B(e,(e,t)=>{const o=n(e);!v(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:Y,isThenable:e=>e&&(S(e)||E(e))&&E(e.then)&&E(e.catch),setImmediate:G,asap:Z,isIterable:ee,isSafeIterable:e=>null!=e&&p(e,a)&&ee(e)},ne=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const re=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),oe=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ie(e,t){return te.isArray(e)?e.map(e=>ie(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function se(e){const t=Object.create(null);return te.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>ie(e,oe))(e)}),t}const ae=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:te.isArray(e)?e.map(ce):(e=>ie(e,re))(String(e))}const le=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function fe(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}const pe=e=>"__proto__"===e?"__Proto__":e;function he(e,t,n,r,o){return te.isFunction(r)?r.call(e,t,n):(o&&(t=n),te.isString(t)?te.isString(r)?-1!==t.indexOf(r):te.isRegExp(r)?r.test(t):void 0:void 0)}class de{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ue(t);if(!o)return;const i=te.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[pe(i||t)]=ce(e))}const i=(e,t)=>te.forEach(e,(e,n)=>o(e,n,t));if(te.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(te.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t=Object.create(null);let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim();const i=te.hasOwnProp(t,n);!n||i&&te.hasOwnProp(ne,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(te.isObject(e)&&te.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!te.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],te.hasOwnProp(o,r)?(n=o[r],o[r]=te.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ue(e)){const n=te.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(te.isFunction(t))return t.call(this,e,n);if(te.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=te.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(this,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=te.findKey(n,e);!o||t&&!he(n,n[o],o,t)||(delete n[o],r=!0)}}return te.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!he(this,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n=Object.create(null);return te.forEach(this,(r,o)=>{const i=te.findKey(n,o);if(i)return t[i]=ce(r),void delete t[o];const s=pe(e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim());s!==o&&delete t[o],t[s]=ce(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return te.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&te.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){const e=this.get("set-cookie");return te.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let r=0,o=!1,i=!1;function s(e){const o=fe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=fe(o.slice(0,i));if(!le.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const u=fe(o.slice(i+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let r=1;r<t;r++){const o=e.charCodeAt(r);if(34===o)return e;if(92===o&&(r+=1,r>=t))return e;n+=e[r]}return n}(u)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(s(e),r=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ae]=this[ae]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=te.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return te.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),te.freezeMethods(de);const ye=de,me="[REDACTED ****]";function be(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(te.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ye&&(e=e.toJSON()),r.push(e),te.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);te.isUndefined(r)||(t[n]=r)});else{if(!te.isPlainObject(e)&&function(e){if(te.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(te.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?me:o(i);te.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function ve(e){try{return String(e)}catch(e){return""}}const ge=Symbol("causeStack");class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&te.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?ve(e.message):ve(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new we(s,t||e.code,n,r,o);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,function(e,t){try{const n=t&&t.stack;if("string"!=typeof n||!n)return;const r=e.stack;if("string"!=typeof r||!r)return;const o="\nCaused by: "+n;e.stack=r+o,Object.defineProperty(e,ge,{__proto__:null,value:o})}catch(e){}}(a,e),null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&te.hasOwnProp(e,"redact")?e.redact:void 0,n=te.isArray(t)&&t.length>0?be(e,t):te.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}we.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",we.ERR_BAD_OPTION="ERR_BAD_OPTION",we.ECONNABORTED="ECONNABORTED",we.ETIMEDOUT="ETIMEDOUT",we.ECONNREFUSED="ECONNREFUSED",we.ERR_NETWORK="ERR_NETWORK",we.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",we.ERR_DEPRECATED="ERR_DEPRECATED",we.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",we.ERR_BAD_REQUEST="ERR_BAD_REQUEST",we.ERR_CANCELED="ERR_CANCELED",we.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",we.ERR_INVALID_URL="ERR_INVALID_URL",we.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _e=we;function Ee(e){return te.isPlainObject(e)||te.isArray(e)}function Oe(e){return te.endsWith(e,"[]")?e.slice(0,-2):e}function Se(e,t,n){return e?e.concat(t).map(function(e,t){return e=Oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Te=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Re=function(e,t,n){if(!te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=te.getSafeProp(n,e);return te.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||d,s=r("dots",!1),a=r("indexes",!1),u=r("Blob")||"undefined"!=typeof Blob&&Blob,c=r("maxDepth",100),l=u&&te.isSpecCompliantForm(t),f=[];if(!te.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(te.isDate(e))return e.toISOString();if(te.isBoolean(e))return e.toString();if(!l&&te.isBlob(e))throw new _e("Blob is not supported. Use a Buffer instead.");if(te.isArrayBuffer(e)||te.isTypedArray(e)){if(l&&"function"==typeof u)return new u([e]);throw new _e("Blob is not supported. Use a Buffer instead.",_e.ERR_NOT_SUPPORT)}return e}function h(e){if(e>c)throw new _e("Object is too deeply nested ("+e+" levels). Max depth: "+c,_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function d(e,n,r){let i=e;if(te.isReactNative(t)&&te.isReactNativeBlob(e))return t.append(Se(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(te.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(c===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!te.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),h(t+n.length-1),r})}(e,1);else if(te.isArray(e)&&function(e){return te.isArray(e)&&!e.some(Ee)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Oe(n),i.forEach(function(e,r){!te.isUndefined(e)&&null!==e&&t.append(!0===a?Se([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!Ee(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(Te,{defaultVisitor:d,convertValue:p,isVisitable:Ee});if(!te.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!te.isUndefined(n)){if(h(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),te.forEach(n,function(n,s){!0===(!(te.isUndefined(n)||null===n)&&i.call(t,n,te.isString(s)?s.trim():s,r,y))&&e(n,r?r.concat(s):[s],o+1)}),f.pop()}}(e),t};function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Pe(e,t){this._pairs=[],e&&Re(e,this,t)}const Ae=Pe.prototype;Ae.append=function(e,t){this._pairs.push([e,t])},Ae.toString=function(e){const t=e?t=>e.call(this,t,ke):ke;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const je=Pe;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ne(e,t,n){if(!t)return e;e=e||"";const r=te.isFunction(n)?{serialize:n}:n,o=te.getSafeProp(r,"encode")||Ce,i=te.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):te.isURLSearchParams(t)?t.toString():new je(t,r).toString(o),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}const Ue=Symbol("internals");function xe(e){return e?e.length:0}function De(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Le(e,t){const n=e.handlers,r=xe(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(e,r){n[e.index]!==e.handler&&t.handlerEntries.delete(r)}):t.handlerEntries.clear()),t.handlersLength=r}const Fe=class{constructor(){this.handlers=[],this[Ue]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const r={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},o=this[Ue];null==this.handlers&&(this.handlers=[]),Le(this,o);const i=o.nextId++;return this.handlers.push(r),o.handlerEntries.set(i,{handler:r,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,i}eject(e){const t=this[Ue];Le(this,t);const n=function(e){return"string"==typeof e&&""!==e&&String(Number(e))===e?Number(e):e}(e),r=t.handlerEntries.get(n);if(r){if(t.handlerEntries.delete(n),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,t.iterationDepth||(De(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Le(this,this[Ue]))}forEach(e){const t=this[Ue];Le(this,t),t.iterationDepth++;try{te.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Le(this,t),De(this.handlers),t.handlersLength=xe(this.handlers))}}},Be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0,encodeBasicAuthUsername:!1},Ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:je,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},He="undefined"!=typeof window&&"undefined"!=typeof document,qe="object"==typeof navigator&&navigator||void 0,Me=He&&(!qe||["ReactNative","NativeScript","NS"].indexOf(qe.product)<0),ze="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Xe=He&&window.location.href||"http://localhost",Ke={...r,...Ie};function We(e){if(e>100)throw new _e("FormData field is too deeply nested ("+e+" levels). Max depth: 100",_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ye(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}function Ge(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Ye(e):e}const $e=function(e){function t(e,n,r,o){We(o);let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&te.isArray(r)?r.length:i,a)return te.hasOwnProp(r,i)?(r[i]=Ge(r[i]),r[i]=te.isArray(r[i])?r[i].concat(n):[r[i],n]):r[i]=n,!s;te.hasOwnProp(r,i)&&te.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&te.isArray(r[i])&&(r[i]=Ye(r[i])),!s}if(te.isFormData(e)&&te.isFunction(e.entries)){const n={};return te.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)We(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),function(e){const t=[e];for(;t.length;){const e=t.pop();Object.keys(e).forEach(n=>{const r=e[n]=Ge(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Je=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ve=(e,t)=>null!=e&&te.hasOwnProp(e,t)?e[t]:void 0;const Qe={transitional:Be,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=te.isObject(e);o&&te.isHTMLForm(e)&&(e=new FormData(e));if(te.isFormData(e))return r?JSON.stringify($e(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ve(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Re(e,new Ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ke.isNode&&te.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ve(this,"env"),r=n&&n.FormData;return Re(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(te.isString(e))try{return(t||JSON.parse)(e),te.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ve(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ve(this,"responseType"),o="json"===r;if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ve(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ve(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ke.classes.FormData,Blob:Ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(Je,e=>{Qe.headers[e]={}});const Ze=Qe;function et(e,t){const n=this||Ze,r=t||n,o=ye.from(r.headers);let i=r.data;return te.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function tt(e){return!(!e||!e.__CANCEL__)}const nt=class extends _e{constructor(e,t,n){super(e??"canceled",_e.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function rt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new _e("Request failed with status code "+n.status,n.status>=400&&n.status<500?_e.ERR_BAD_REQUEST:_e.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ot=/[\t\n\r]/g;function it(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(ot,"")}function st(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1].toLowerCase()||""}const at=e=>{try{return decodeURIComponent(e)}catch(t){return e}},ut=Ke.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];te.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),te.isString(r)&&a.push(`path=${r}`),te.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),te.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie;if(!t)return null;const n=t.split(";");for(let t=0;t<n.length;t++){const r=n[t].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)return at(r.slice(o+1))}return null},async readAsync(e){try{const t="undefined"!=typeof window&&window.cookieStore;if(t&&te.isFunction(t.get)){const n=await t.get(e);return n?at(n.value):null}}catch(e){}return this.read(e)},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,readAsync:async()=>null,remove(){}};const ct=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const lt=function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n),(...e)=>s(e)]},ft=(e,t,n=3)=>{let r=0;const o=ct(50,250);return lt(n=>{if(!n||!te.isNumber(n.loaded))return;const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=Math.max(0,null!=s?Math.min(i,s):i),u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:u,rate:c||void 0,estimated:c&&s?(s-a)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ht=(e,t=te.asap)=>(...n)=>t(()=>e(...n)),dt=Ke.hasStandardBrowserEnv?(e=>t=>(t=new URL(t,document.baseURI||Ke.origin),e.protocol===t.protocol&&e.host===t.host&&e.port===t.port))(new URL(Ke.origin)):()=>!0;const yt=/^https?:(?!\/\/)/i;function mt(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${me}@`),n=t.indexOf("#"),r=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${me}`);return-1===n?r:`${r}#${o=t.slice(n+1),o?o.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${me}`):o}`;var o}function bt(e,t){if("string"==typeof e){const n=it(e);if(yt.test(n))throw new _e(`Invalid URL ${JSON.stringify(mt(n))}: missing "//" after protocol`,_e.ERR_INVALID_URL,t)}}function vt(e,t,n,r){bt(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(bt(e,r),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const gt=e=>e instanceof ye?{...e}:e,wt=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>{const n=Object.getOwnPropertyDescriptor(e,t);return n&&n.enumerable})):Object.keys(e);function _t(e,t,n,r){return te.isPlainObject(e)&&te.isPlainObject(t)?te.merge.call({caseless:r},e,t):te.isPlainObject(t)?te.merge({},t):te.isArray(t)?t.slice():t}function Et(e,t,n,r){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e,0,r):_t(e,t,0,r)}function Ot(e,t){if(!te.isUndefined(t))return _t(void 0,t)}function St(e,t){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e):_t(void 0,t)}function Tt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Rt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),kt={url:Ot,method:Ot,data:Ot,baseURL:St,transformRequest:St,transformResponse:St,params:function(e,t){const n=[],r=new WeakMap,o={};function i(e,t){if(!te.isPlainObject(t))return te.isArray(t)?t.slice():t;const i=te.isPlainObject(e)?e:o;let s=r.get(t);if(s||(s=new WeakMap,r.set(t,s)),s.has(i))return s.get(i);const a={};return s.set(i,a),n.push({base:i,source:t,result:a}),a}const s=te.isUndefined(t)?i(void 0,e):i(e,t);for(;n.length;){const{base:e,source:t,result:r}=n.pop(),o=new Set(wt(e)),s=new Set(wt(t));new Set([...o,...s]).forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;const a=s.has(n),u=a?t[n]:void 0,c=a&&!te.isPlainObject(u)||!o.has(n)?void 0:e[n];r[n]=a?i(c,u):i(void 0,c)})}return function(e){const t=[{value:e}],n=new WeakSet,r=new WeakSet;for(;t.length;){const{value:e,done:o}=t.pop();if(!te.isPlainObject(e)&&!te.isArray(e))continue;if(o){n.delete(e);continue}if(n.has(e))throw new _e("Circular reference detected in params",_e.ERR_BAD_OPTION_VALUE);if(r.has(e))continue;r.add(e),n.add(e),t.push({value:e,done:!0});const i=Object.keys(e);Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertySymbols(e).forEach(t=>{const n=Object.getOwnPropertyDescriptor(e,t);n&&n.enumerable&&i.push(t)}),i.forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n){const r=Object.getOwnPropertyDescriptor(e,n);r&&te.hasOwnProp(r,"value")&&t.push({value:r.value})}else t.push({value:e[n]})})}}(s),s},paramsSerializer:St,timeout:St,timeoutErrorMessage:St,withCredentials:St,withXSRFToken:St,adapter:St,responseType:St,xsrfCookieName:St,xsrfHeaderName:St,onUploadProgress:St,onDownloadProgress:St,decompress:St,maxContentLength:St,maxBodyLength:St,beforeRedirect:St,transport:St,httpAgent:St,httpsAgent:St,cancelToken:St,socketPath:St,allowedSocketPaths:St,responseEncoding:St,validateStatus:Tt,headers:function(e,t,n){return Et(gt(e),gt(t),0,!0)}};function Pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Rt);const r=wt({...e,...t});for(let o=0,i=r.length;o<i;o++){const i=r[o];if("__proto__"===i||"constructor"===i||"prototype"===i)continue;const s=te.hasOwnProp(kt,i)?kt[i]:Et,a=te.hasOwnProp(e,i)?e[i]:void 0,u=te.hasOwnProp(t,i)?t[i]:void 0,c=s===Tt?s(a,u,i,e,t):s(a,u,i);te.isUndefined(c)&&s!==Tt||(n[i]=c)}return te.hasOwnProp(t,"validateStatus")&&te.isUndefined(t.validateStatus)&&!1===function(e,t,n){const r=te.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!te.isUndefined(r)){if(!te.isPlainObject(r))return;if(te.hasOwnProp(r,n))return r[n]}const o=te.hasOwnProp(e,"transitional")?e.transitional:void 0;if(te.isPlainObject(o)&&te.hasOwnProp(o,n))return o[n]}(e,t,"validateStatusUndefinedResolves")&&(te.hasOwnProp(e,"validateStatus")?n.validateStatus=_t(void 0,e.validateStatus):delete n.validateStatus),n}const At=["content-type","content-length"];const jt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Ct=e=>ut.read(e);const Nt=function(e,t=Ct){const n=Pt({},e),r=e=>te.hasOwnProp(n,e)?n[e]:void 0,o=r("data");let i=r("withXSRFToken");const s=r("xsrfHeaderName"),a=r("xsrfCookieName");let u=r("headers");const c=r("auth"),l=r("baseURL"),f=r("allowAbsoluteUrls"),p=r("url");if(n.headers=u=ye.from(u),n.url=Ne(vt(l,p,f,n),r("params"),r("paramsSerializer")),c){const t=te.getSafeProp(c,"username")||"",n=te.getSafeProp(c,"password")||"",o=r("transitional"),i=o&&te.hasOwnProp(o,"encodeBasicAuthUsername")&&!0===o.encodeBasicAuthUsername;try{u.set("Authorization","Basic "+btoa((i?jt(t):t)+":"+(n?jt(n):"")))}catch(t){throw _e.from(t,_e.ERR_BAD_OPTION_VALUE,e)}}if(te.isFormData(o)){const e=te.getSafeProp(o,"getHeaders");Ke.hasStandardBrowserEnv||Ke.hasStandardBrowserWebWorkerEnv||te.isReactNative(o)?u.setContentType(void 0):te.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{At.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(u,e.call(o),r("formDataHeaderPolicy"))}if(Ke.hasStandardBrowserEnv){te.isFunction(i)&&(i=i(n));if(!0===i||null==i&&dt(n.url)){const e=s&&a&&t(a);e&&u.set(s,e)}}return n},Ut="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){let r,o;try{const e=Ke.hasStandardBrowserEnv&&"undefined"!=typeof window&&window.cookieStore;r=e&&te.isFunction(e.get)}catch(e){}const i=Nt(e,r?e=>(o=e,null):void 0);let s=i.data;const a=ye.from(i.headers).normalize();let u,c,l,f,p,h,d,{responseType:y,onUploadProgress:m,onDownloadProgress:b}=i;function v(){clearTimeout(c);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}g&&(f&&g.removeEventListener("progress",f),g.upload&&(l&&g.upload.removeEventListener("progress",l),p&&g.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(st(it(i.url))||st(Ke.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),void(g=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const o=ye.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());rt(function(e){t(e),v()},function(e){n(e),v()},{data:y&&"text"!==y&&"json"!==y?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:o,config:e,request:g}),g=null}if(g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new _e("Request aborted",_e.ECONNABORTED,e,g)),v(),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,g);o.event=t||null,n(o),v(),g=null},g.ontimeout=function(){if(!g)return;let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||Be;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new _e(t,r.clarifyTimeoutError?_e.ETIMEDOUT:_e.ECONNABORTED,e,g)),v(),g=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),y&&"json"!==y&&(g.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),g.addEventListener("progress",f)),m&&g.upload&&([l,p]=ft(m),g.upload.addEventListener("progress",l),g.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(u=t=>{if(!g)return;n(!t||t.type?new nt(null,e,g):t);const r=g;v(),g=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(u),!g)return;i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u))}if(!g)return;const _=st(i.url);if(_&&!Ke.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void v();const E=()=>{g&&("setRequestHeader"in g&&te.forEach(se(a),function(e,t){g.setRequestHeader(t,e)}),g.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=g.timeout>0?t()+Number(g.timeout):void 0,s=()=>{if(!g)return;const e=g;e.ontimeout(),e.abort()};if(void 0!==r){const e=()=>{const n=r-t();n>0?c=setTimeout(e,Math.min(n,2147483647)):s()};e()}ut.readAsync(o).then(e=>{if(g)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}E()}}).catch(t=>{g&&(n(_e.from(t,null,e,g)),v(),g=null)})}else E()})},xt=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof _e?t:new nt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new _e(`timeout of ${t}ms exceeded`,_e.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{const t=te.getSafeProp(e,"unsubscribe");te.isFunction(t)?t.call(e,o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>{r||(e.aborted?o.call(e):e.addEventListener("abort",o,{once:!0}))});const{signal:a}=n;return a.unsubscribe=()=>te.asap(s),a},Dt=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Lt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ft=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Lt(e))yield*Dt(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Bt="\r\n",It=e=>String(e).replace(/\r\n|\r|\n/g,Bt),Ht=e=>String(e).replace(/[\r\n"]/g,e=>"\r"===e?"%0D":"\n"===e?"%0A":"%22"),qt=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);!t||13!==o&&10!==o?o<128?n++:o<2048?n+=2:o>=55296&&o<=56319&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r++):n+=3:(13===o&&10===e.charCodeAt(r+1)&&r++,n+=2)}return n};class Mt extends TypeError{constructor(e,t){super(e),this.name="FormDataError",this.reason=t}}function zt(e,t,n,r,o){if(!te.isFunction(t))throw new _e("Blob is not supported",_e.ERR_NOT_SUPPORT);if(void 0===o)if(te.isFunction(Ke.generateString))o="axios-"+Ke.generateString(36,"0123456789abcdef");else{const e=te.global.crypto;if(!e||!te.isFunction(e.getRandomValues))throw new _e("Random byte generation is not supported",_e.ERR_NOT_SUPPORT);const t=new Uint8Array(18);e.getRandomValues(t),o="axios-"+Array.from(t,e=>("0"+e.toString(16)).slice(-2)).join("")}try{return function(e,t,n,r,o){if(!te.isFunction(t))throw new Mt("Blob is not supported","blob");if(!te.isString(o)||!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(o)||/ $/.test(o))throw new Mt("Invalid multipart boundary","boundary");const i="--"+o+"--"+Bt;let s=i.length;const a=[],u=e=>{if(s+e>n)throw r()};u(0);for(const[t,n]of e){const e=te.isString(n),r=e?qt(n,!0):n.size;if(!Number.isFinite(r)||r<0)throw new Mt("Unsupported FormData part size","part");u(r+qt(t,!0)+(!e&&n.name?qt(n.name,!1):0)+(!e&&n.type?qt(n.type,!1):0));let i="--"+o+'\r\nContent-Disposition: form-data; name="'+Ht(It(t))+'"';e||(i+='; filename="'+Ht(te.isString(n.name)?n.name:"blob")+'"\r\nContent-Type: '+String(n.type||"application/octet-stream").replace(/[\r\n]/g,"")),i+=Bt+Bt;const c=qt(i,!1)+r+2;u(c),s+=c,a.push({header:i,value:n,isString:e})}const c=[];for(const e of a)c.push(e.header,e.isString?It(e.value):e.value,Bt);return c.push(i),new t(c,{type:"multipart/form-data; boundary="+o})}(e,t,n,r,o)}catch(e){if(e instanceof Mt){const t="boundary"===e.reason?_e.ERR_BAD_OPTION_VALUE:_e.ERR_BAD_REQUEST;throw new _e(e.message,t)}throw e}}const Xt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kt=(e,t,n)=>t+2<n&&Xt(e.charCodeAt(t+1))&&Xt(e.charCodeAt(t+2)),Wt=e=>e<=57?e-48:(223&e)-55,Yt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Gt=e=>9===e||10===e||12===e||13===e||32===e,$t=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Jt=e=>{const t=e.length;let n=0,r=0,o=!1;for(let i=0;i<t;i++){let s=e.charCodeAt(i);37===s&&Kt(e,i,t)&&(s=16*Wt(e.charCodeAt(i+1))+Wt(e.charCodeAt(i+2)),i+=2),Gt(s)||(61!==s?!Yt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?$t(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Vt=(e,t,n)=>{if(!e||"string"!=typeof e)return 0;if(!/^data:/i.test(e))return 0;const r=e.indexOf(",");if(r<0)return 0;const o=e.slice(5,r),i=e.slice(r+1);if(n.test(o))return t(i);let s=0;for(let e=0,t=i.length;e<t;e++){const n=i.charCodeAt(e);if(37===n&&Kt(i,e,t))s+=1,e+=2;else if(n<128)s+=1;else if(n<2048)s+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(s+=4,e++):s+=3}else s+=3}return s};const Qt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Zt}=te,en=e=>{if(!te.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},tn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nn=e=>{const t=void 0!==te.global&&null!==te.global?te.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=te.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response,Blob:t.Blob},e);const o=te.hasOwnProp(e,"fetch")?e.fetch:void 0,{Request:i,Response:s,Blob:a}=e,u=o?Zt(o):"function"==typeof fetch,c=Zt(i),l=Zt(s);if(!u)return!1;const f=u&&Zt(n),p=u&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const d=c&&f&&tn(()=>{let e=!1;const t=new i(Ke.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),y=l&&f&&tn(()=>te.isReadableStream(new s("").body)),m=Object.assign(Object.create(null),Qt);c&&!tn(()=>new i(Ke.origin,m))&&(delete m.cache,tn(()=>new i(Ke.origin,m))||(m.cache=Qt.cache));const b={stream:y&&(e=>e.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!b[e]&&(b[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new _e(`Response type '${e}' is not supported`,_e.ERR_NOT_SUPPORT,n)})});const v=async e=>null==e?0:te.isBlob(e)?e.size:te.isArrayBufferView(e)||te.isArrayBuffer(e)?e.byteLength:(te.isURLSearchParams(e)&&(e+=""),te.isString(e)?(await p(e)).byteLength:void 0);return async e=>{let{url:t,method:n,data:u,signal:l,cancelToken:p,timeout:h,onDownloadProgress:g,onUploadProgress:w,responseType:_,headers:E,withCredentials:O="same-origin",fetchOptions:S,maxContentLength:T,maxBodyLength:R,maxRedirects:k}=Nt(e);const P=te.isNumber(T)&&T>-1,A=te.isNumber(R)&&R>-1,j=t=>te.hasOwnProp(e,t)?e[t]:void 0;let C=o||fetch;_=_?(_+"").toLowerCase():"text";let N=xt([l,p&&p.toAbortSignal()],h),U=null;const x=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let D,L=null,F=null;const B=()=>new _e("Request body larger than maxBodyLength limit",_e.ERR_BAD_REQUEST,e,U);try{let o;const l=j("auth");if(l){const e=te.getSafeProp(l,"username")||"";o={username:e,password:te.getSafeProp(l,"password")||""}}let p;if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){if(p=new URL(t,Ke.origin),!o&&(p.username||p.password)){const e=en(p.username);o={username:e,password:en(p.password)}}(p.username||p.password)&&(p.username="",p.password="",t=p.href)}if(o&&(E.delete("authorization"),E.set("Authorization","Basic "+btoa((I=(o.username||"")+":"+(o.password||""),encodeURIComponent(I).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),P&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Vt(-1===t?e:e.slice(0,t),Jt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const h=te.isSpecCompliantForm(u)&&ye.from(j("headers")).getContentType();let H;if(te.isString(h)&&/^multipart\/form-data(?:\s*;|$)/i.test(h.trim())){const e=ye.parseParameters(h);te.hasOwnProp(e,"boundary")&&(H=e.boundary)}if(te.isSpecCompliantForm(u)&&"get"!==n&&"head"!==n&&(A||w&&d||void 0!==H)&&(u=zt(u,a,A?R:1/0,B,H),E.setContentType(void 0===H?u.type:h),D=u.size),A&&"get"!==n&&"head"!==n){const e=await v(u);if("number"==typeof e&&isFinite(e)&&(D=e,e>R))throw B()}const q=A&&(te.isReadableStream(u)||te.isStream(u)),M=(e,t,n)=>Ft(e,65536,e=>{if(A&&e>R)throw L=B();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(w||q)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??v(t)})(E,u),0!==D||q){let e,n=new i(t,{method:"POST",body:u,duplex:"half"});if(te.isFormData(u)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=w&&pt(D,ft(ht(w)))||[];u=M(n.body,e,t)}}}else if(q&&!c&&f&&"get"!==n&&"head"!==n)u=M(u);else if(q&&c&&!d&&"get"!==n&&"head"!==n)throw new _e("Stream request bodies are not supported by the current fetch implementation",_e.ERR_NOT_SUPPORT,e,U);te.isString(O)||(O=O?"include":"omit");const z=c&&"credentials"in i.prototype;if(te.isFormData(u)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/1.21.1",!1);const X=null==S?S:Object.assign(Object.create(null),S);X&&(delete X.body,delete X.headers,delete X.method,delete X.signal,delete X.duplex,delete X.credentials);const K=Object.assign(Object.create(null),X,{signal:N,method:n.toUpperCase(),headers:se(E.normalize()),body:u,duplex:"half",credentials:z?O:void 0});c&&(te.forEach(m,(e,t)=>{void 0===K[t]&&(K[t]=e)}),void 0===K.signal&&(K.signal=null),void 0===K.body&&(K.body=null)),0===k&&(K.redirect="manual",X&&(X.redirect="manual")),U=c&&new i(t,K);let W=await(c?C(U,X):C(t,K));const Y=ye.from(W.headers);if(P){const t=te.toFiniteNumber(Y.getContentLength());if(null!=t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const G=y&&("stream"===_||"response"===_);if(y&&W.body&&(g||P||G&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=W[e]});const n=te.toFiniteNumber(Y.getContentLength()),[r,o]=g&&pt(n,ft(ht(g),!0))||[];let i=0;const a=t=>{if(P&&(i=t,i>T))throw F=new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};W=new s(Ft(W.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let $=await b[te.findKey(b,_)||"text"](W,e);if(P&&!y&&!G){let t;if(null!=$&&("number"==typeof $.byteLength?t=$.byteLength:"number"==typeof $.size?t=$.size:"string"==typeof $&&(t="function"==typeof r?(new r).encode($).byteLength:$.length)),"number"==typeof t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!G&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:$,headers:ye.from(W.headers),status:W.status,statusText:W.statusText,config:e,request:U})})}catch(t){if(x&&x(),N&&N.aborted&&N.reason instanceof _e){const n=N.reason;throw n.config=e,U&&(n.request=U),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(L)throw U&&!L.request&&(L.request=U),L;if(F)throw F;if(t instanceof _e)throw U&&!t.request&&(t.request=U),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new _e("Network Error",_e.ERR_NETWORK,e,U,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw _e.from(t,t&&t.code,e,U,t&&t.response)}var I}},rn=new Map,on=e=>{const t=Object.create(null),n=e&&te.hasOwnProp(e,"env")&&e.env;["fetch","Request","Response","Blob"].forEach(e=>{n&&te.hasOwnProp(n,e)&&(t[e]=n[e])});const{fetch:r,Request:o,Response:i,Blob:s}=t,a=[o,i,r,s];let u,c,l=a.length,f=rn;for(;l--;)u=a[l],c=f.get(u),void 0===c&&f.set(u,c=l?new Map:nn(t)),f=c;return c},sn=(on(),{http:null,xhr:Ut,fetch:{get:on}});te.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const an=e=>`- ${e}`,un=e=>te.isFunction(e)||null===e||!1===e;const cn={getAdapter:function(e,t){e=te.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!un(r)&&(o=sn[(n=String(r)).toLowerCase()],void 0===o))throw new _e(`Unknown adapter '${n}'`);if(o&&(te.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(an).join("\n"):" "+an(e[0]):"as no adapter specified";throw new _e("There is no suitable adapter to dispatch the request "+t,_e.ERR_NOT_SUPPORT)}return o},adapters:sn};function ln(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nt(null,e)}function fn(e,t){return Math.max(0,Math.round(e()-t))}function pn(e){const t=te.toSafeFlatObject(e);ln(t),t.headers=ye.from(te.getSafeProp(t,"headers")),t.data=et.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);const n=cn.getAdapter(t.adapter||Ze.adapter,t),r="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,o=r();return n(t).then(function(e){ln(t),e.duration=fn(r,o),t.response=e;try{e.data=et.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=ye.from(e.headers),e},function(e){if(!tt(e)&&(ln(t),e&&e.response)){e.response.duration=fn(r,o),t.response=e.response;try{e.response.data=et.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=ye.from(e.response.headers)}return Promise.reject(e)})}const hn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const dn={};hn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.21.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new _e(r(o," has been removed"+(t?" in "+t:"")),_e.ERR_DEPRECATED);return t&&!dn[o]&&(dn[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},hn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const yn={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new _e("options must be an object",_e.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new _e("option "+i+" must be "+n,_e.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new _e("Unknown option "+i,_e.ERR_BAD_OPTION)}},validators:hn},mn=yn.validators,bn=e=>{if(null==e||te.isPlainObject(e)||e instanceof ye)return!0;try{return te.isObject(e)&&"AxiosHeaders"===te.getSafeProp(e,Symbol.toStringTag)&&["toJSON","set","get","has","delete","clear","normalize","concat","toString",Symbol.iterator].every(t=>te.isFunction(te.getSafeProp(e,t)))}catch(e){return!1}};class vn{constructor(e){this.defaults=e||{},this.interceptors={request:new Fe,response:new Fe}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let r="";if("string"==typeof n){const e=n.indexOf("\n");r=-1===e?"":n.slice(e+1)}if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),o=-1===n?r:r.slice(n+1),i=String(e.stack),s=function(e,t){const n=te.hasOwnProp(e,ge)&&e[ge];return n&&t.endsWith(n)?t.length-n.length:-1}(e,i),a=-1===s?i:i.slice(0,s),u=-1===s?"":i.slice(s);a.endsWith(o)||(e.stack=a+"\n"+r+u)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Pt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&yn.assertOptions(n,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean),advertiseZstdAcceptEncoding:mn.transitional(mn.boolean),validateStatusUndefinedResolves:mn.transitional(mn.boolean),encodeBasicAuthUsername:mn.transitional(mn.boolean)},!1),null!=r&&(te.isFunction(r)?t.paramsSerializer={serialize:r}:yn.assertOptions(r,{encode:mn.function,serialize:mn.function},!0)),void 0!==t.allowAbsoluteUrls||(te.hasOwnProp(this.defaults,"allowAbsoluteUrls")&&void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yn.assertOptions(t,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),t.method=(te.getSafeProp(t,"method")||te.getSafeProp(this.defaults,"method")||"get").toLowerCase();const i=te.getSafeProp(o,"common"),s=te.getSafeProp(o,t.method),a=o&&te.merge(bn(i)?i:void 0,bn(s)?s:void 0);o&&te.forEach(Je.concat("common"),e=>{bn(te.getSafeProp(o,e))&&delete o[e]}),t.headers=ye.concat(a,o);const u=[];let c=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;c=c&&e.synchronous;const n=t.transitional||Be;n&&n.legacyInterceptorReqResOrdering?u.unshift(e.fulfilled,e.rejected):u.push(e.fulfilled,e.rejected)});const l=[];let f;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let p,h=0;if(!c){const e=[pn.bind(this),void 0];for(e.unshift(...u),e.push(...l),p=e.length,f=Promise.resolve(t);h<p;)f=f.then(e[h++],e[h++]);return f}p=u.length;let d=t;for(;h<p;){const e=u[h++],t=u[h++];try{d=e?e(d):d}catch(e){if(!t){f=Promise.reject(e);break}try{const n=t.call(this,e);te.isThenable(n)&&(f=Promise.resolve(n).then(()=>pn.call(this,d)))}catch(e){f=Promise.reject(e)}break}}if(!f)try{f=pn.call(this,d)}catch(e){f=Promise.reject(e)}for(h=0,p=l.length;h<p;)f=f.then(l[h++],l[h++]);return f}getUri(e){return Ne(vt((e=Pt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){vn.prototype[e]=async function(t,n){return this.request(Pt(n||{},{method:e,url:t,data:n&&te.hasOwnProp(n,"data")?n.data:void 0}))}}),te.forEach(["post","put","patch","query"],function(e){function t(t){return async function(n,r,o){return this.request(Pt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}vn.prototype[e]=t(),"query"!==e&&(vn.prototype[e+"Form"]=t(!0))});const gn=vn;class wn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new nt(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new wn(function(t){e=t}),cancel:e}}}const _n=wn;const En={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(En).forEach(([e,t])=>{void 0===En[t]&&(En[t]=e)});const On=En;const Sn=function e(t){const n=new gn(t),r=o(gn.prototype.request,n);return te.extend(r,gn.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Pt(t,n))},r}(Ze);Sn.Axios=gn,Sn.CanceledError=nt,Sn.CancelToken=_n,Sn.isCancel=tt,Sn.VERSION="1.21.1",Sn.toFormData=Re,Sn.AxiosError=_e,Sn.Cancel=Sn.CanceledError,Sn.all=function(e){return Promise.all(e)},Sn.spread=function(e){return function(t){return e.apply(null,t)}},Sn.isAxiosError=function(e){return te.isObject(e)&&!0===e.isAxiosError},Sn.mergeConfig=Pt,Sn.AxiosHeaders=ye,Sn.formToJSON=e=>$e(te.isHTMLForm(e)?new FormData(e):e),Sn.getAdapter=cn.getAdapter,Sn.HttpStatusCode=On,Sn.default=Sn;const Tn=Sn;function Rn(e){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rn(e)}function kn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Pn(c,"_invoke",function(n,r,o){var i,a,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Pn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Pn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Pn(f,"constructor",c),Pn(c,"constructor",u),u.displayName="GeneratorFunction",Pn(c,o,"GeneratorFunction"),Pn(f),Pn(f,o,"Generator"),Pn(f,r,function(){return this}),Pn(f,"toString",function(){return"[object Generator]"}),(kn=function(){return{w:i,m:p}})()}function Pn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Pn=function(e,t,n,r){function i(t,n){Pn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Pn(e,t,n,r)}function An(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function jn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Cn(r.key),r)}}function Cn(e){var t=function(e,t){if("object"!=Rn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Rn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Rn(t)?t:t+""}var Nn=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._token=e._validate(t)},t=[{key:"getAccessToken",value:(r=kn().m(function e(){return kn().w(function(e){for(;;)if(0===e.n)return e.a(2,this._token)},e,this)}),o=function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function s(e){An(i,n,o,s,a,"next",e)}function a(e){An(i,n,o,s,a,"throw",e)}s(void 0)})},function(){return o.apply(this,arguments)})},{key:"canRefresh",value:function(){return!1}},{key:"clear",value:function(){this._token=null}}],n=[{key:"_validate",value:function(e){if("string"!=typeof e||!e.trim())throw new TypeError("bearer token must be a non-empty string");return e.trim()}}],t&&jn(e.prototype,t),n&&jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}();function Un(e){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Un(e)}function xn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Dn(c,"_invoke",function(n,r,o){var i,a,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Dn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Dn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Dn(f,"constructor",c),Dn(c,"constructor",u),u.displayName="GeneratorFunction",Dn(c,o,"GeneratorFunction"),Dn(f),Dn(f,o,"Generator"),Dn(f,r,function(){return this}),Dn(f,"toString",function(){return"[object Generator]"}),(xn=function(){return{w:i,m:p}})()}function Dn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Dn=function(e,t,n,r){function i(t,n){Dn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Dn(e,t,n,r)}function Ln(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Fn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Ln(i,r,o,s,a,"next",e)}function a(e){Ln(i,r,o,s,a,"throw",e)}s(void 0)})}}function Bn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,In(r.key),r)}}function In(e){var t=function(e,t){if("object"!=Un(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Un(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Un(t)?t:t+""}var Hn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var qn=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.tokenUrl,r=t.clientId,o=void 0===r?"appmesh-cli":r,i=t.accessToken,s=t.refreshToken,a=t.expiresIn,u=void 0===a?0:a,c=t.httpClient;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._tokenUrl=function(e){var t;try{t=new URL(e)}catch(e){throw new TypeError("tokenUrl must be a valid URL")}if("https:"===t.protocol)return e;if("http:"===t.protocol&&Hn.has(t.hostname.toLowerCase()))return e;throw new TypeError("tokenUrl must use https, or http only for loopback hosts (127.0.0.1, localhost, ::1)")}(n),this._clientId=o,this._accessToken=i||null,this._refreshToken=s||null,this._http=c||Tn.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(u)},t=[{key:"getAccessToken",value:(s=Fn(xn().m(function e(){return xn().w(function(e){for(;;)switch(e.n){case 0:if(!(null===this._accessToken&&this._refreshToken||this._isExpiringSoon())){e.n=1;break}return e.n=1,this._refresh();case 1:if(null!==this._accessToken||this._refreshToken){e.n=2;break}throw new Error("no access token available: the provider holds no credentials");case 2:return e.a(2,this._accessToken)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"canRefresh",value:function(){return!!this._refreshToken}},{key:"refreshAccessToken",value:(i=Fn(xn().m(function e(t){return xn().w(function(e){for(;;)switch(e.n){case 0:if(!t||t===this._accessToken){e.n=1;break}return e.a(2,this._accessToken);case 1:return e.n=2,this._refresh();case 2:return e.a(2,this._accessToken)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"clear",value:function(){this._accessToken=null,this._refreshToken=null,this._expiresAtMs=0,this._lifetimeMs=0}},{key:"_setExpiry",value:function(e){var t=Number(e);Number.isFinite(t)&&t>0?(this._lifetimeMs=1e3*t,this._expiresAtMs=Date.now()+this._lifetimeMs):(this._lifetimeMs=0,this._expiresAtMs=0)}},{key:"_isExpiringSoon",value:function(){if(!this._expiresAtMs||!this._refreshToken)return!1;var e=Math.max(3e4,.1*this._lifetimeMs);return Date.now()>=this._expiresAtMs-e}},{key:"_refresh",value:(o=Fn(xn().m(function e(){var t=this;return xn().w(function(e){for(;;)if(0===e.n)return this._inflightRefresh||(this._inflightRefresh=this._performRefresh().finally(function(){t._inflightRefresh=null})),e.a(2,this._inflightRefresh)},e,this)})),function(){return o.apply(this,arguments)})},{key:"_performRefresh",value:(r=Fn(xn().m(function e(){var t,n,r,o,i;return xn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this._refreshToken){e.n=1;break}throw new Error("cannot refresh: no refresh token available");case 1:return t=new URLSearchParams({grant_type:"refresh_token",refresh_token:this._refreshToken,client_id:this._clientId}),e.p=2,e.n=3,this._http.post(this._tokenUrl,t.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"},validateStatus:function(){return!0}});case 3:n=e.v,e.n=5;break;case 4:throw e.p=4,i=e.v,new Error("token refresh request failed: ".concat(i.message||"unknown error"));case 5:if(r=n.status,"invalid_grant"!==(o=n.data&&"object"===Un(n.data)?n.data:{}).error){e.n=6;break}throw this.clear(),new Error("token refresh rejected by the server (invalid_grant)");case 6:if(!(r<200||r>=300||o.error)){e.n=7;break}throw new Error("token refresh failed with status ".concat(r).concat(o.error?": ".concat(o.error):""));case 7:if("string"==typeof o.access_token&&o.access_token){e.n=8;break}throw new Error("token refresh response did not include an access_token");case 8:this._accessToken=o.access_token,"string"==typeof o.refresh_token&&o.refresh_token&&(this._refreshToken=o.refresh_token),this._setExpiry(o.expires_in);case 9:return e.a(2)}},e,this,[[2,4]])})),function(){return r.apply(this,arguments)})}],t&&Bn(e.prototype,t),n&&Bn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i,s}();function Mn(e){return Mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(e)}function zn(e){var t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==t||t===("undefined"!=typeof Symbol&&[][Symbol.iterator])||t===[]["@@iterator"]))return e;if(null!=t){for(var n,r=[],o=t.call(e);!(n=o.next()).done;)r.push(n.value);return r}}(e);return t===e?Wn(e):t||Kn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xn(e,t){return function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Kn(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Yn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Gn(c,"_invoke",function(n,r,o){var i,a,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Gn(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Gn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Gn(f,"constructor",c),Gn(c,"constructor",u),u.displayName="GeneratorFunction",Gn(c,o,"GeneratorFunction"),Gn(f),Gn(f,o,"Generator"),Gn(f,r,function(){return this}),Gn(f,"toString",function(){return"[object Generator]"}),(Yn=function(){return{w:i,m:p}})()}function Gn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Gn=function(e,t,n,r){function i(t,n){Gn(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Gn(e,t,n,r)}function $n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Jn(r.key),r)}}function Jn(e){var t=function(e,t){if("object"!=Mn(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=Mn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Mn(t)?t:t+""}function Vn(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Qn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Vn(i,r,o,s,a,"next",e)}function a(e){Vn(i,r,o,s,a,"throw",e)}s(void 0)})}}var Zn=null;function er(){return tr.apply(this,arguments)}function tr(){return(tr=Qn(Yn().m(function e(){var t;return Yn().w(function(e){for(;;)switch(e.n){case 0:if(!Zn){e.n=1;break}return e.a(2,Zn);case 1:return e.n=2,import("node:crypto");case 2:return t=e.v,Zn=t.default&&t.default.createHmac?t.default:t,e.a(2,Zn)}},e)}))).apply(this,arguments)}var nr=new Set(["/appmesh/file/download","/appmesh/file/upload","/appmesh/file/delete"]),rr=/^\/appmesh\/app\/[^/]+\/(output|task)\/stream$/,or=Object.freeze({KEY_ID:"X-Request-Key",TIMESTAMP:"X-Timestamp",NONCE:"X-Nonce",SIGNATURE:"X-Signature"});function ir(e){if("string"!=typeof e)return!1;var t=sr(e);return nr.has(t)||rr.test(t)}function sr(e){return"/appmesh/file/download/ws"===e?"/appmesh/file/download":"/appmesh/file/upload/ws"===e?"/appmesh/file/upload":e}var ar=function(){return e=function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"string"!=typeof t||""===t.trim())throw new TypeError("keyId must be a non-empty string");if("string"!=typeof n||""===n)throw new TypeError("secret must be a non-empty string");Object.defineProperty(this,"_keyId",{value:t,writable:!0}),Object.defineProperty(this,"_secret",{value:n,writable:!0})},t=[{key:"keyId",get:function(){return this._keyId}},{key:"attach",value:(i=Qn(Yn().m(function e(t,n,r,o,i,s,a){var u,c,l,f,p,h,d,y,m;return Yn().w(function(e){for(;;)switch(e.n){case 0:if(u=s||String(Math.floor(Date.now()/1e3)),p=a){e.n=2;break}return e.n=1,this.randomNonce();case 1:p=e.v;case 2:return c=p,l=sr(r),h=ur,d=n,y=l,m=o,e.n=3,cr(l,i);case 3:return f=h(d,y,m,e.v,u,c),t[or.KEY_ID]=this._keyId,t[or.TIMESTAMP]=u,t[or.NONCE]=c,e.n=4,this.sign(f);case 4:t[or.SIGNATURE]=e.v;case 5:return e.a(2)}},e,this)})),function(e,t,n,r,o,s,a){return i.apply(this,arguments)})},{key:"randomNonce",value:(o=Qn(Yn().m(function e(){var t;return Yn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return t=e.v,e.a(2,t.randomBytes(16).toString("hex"))}},e)})),function(){return o.apply(this,arguments)})},{key:"sign",value:(r=Qn(Yn().m(function e(t){var n;return Yn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,er();case 1:return n=e.v,e.a(2,n.createHmac("sha256",this._secret).update(t,"utf8").digest("hex"))}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"toString",value:function(){return"RequestSigner[keyId=".concat(this._keyId,"]")}}],t&&$n(e.prototype,t),n&&$n(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i}();function ur(e,t,n,r,o,i){if(!e||!t)throw new TypeError("method and path are required");return[e,t,n||"",r,o,i].join("\n")}function cr(e,t){return lr.apply(this,arguments)}function lr(){return(lr=Qn(Yn().m(function e(t,n){var r,o;return Yn().w(function(e){for(;;)switch(e.n){case 0:return r=null==n||ir(t)?Buffer.alloc(0):Buffer.from(n),e.n=1,er();case 1:return o=e.v,e.a(2,o.createHash("sha256").update(r).digest("hex"))}},e)}))).apply(this,arguments)}function fr(e){if(!e)return"";for(var t=Object.create(null),n=0;n<e.length;){var r=e.indexOf("&",n),o=r<0?e.slice(n):e.slice(n,r),i=o.indexOf("="),s=i<0?o:o.slice(0,i),a=i<0?"":o.slice(i+1),u=pr(s);if(Object.prototype.hasOwnProperty.call(t,u)||(t[u]=pr(a)),r<0)break;n=r+1}var c=Object.entries(t);return c.sort(function(e,t){var n=Buffer.compare(Buffer.from(e[0],"utf8"),Buffer.from(t[0],"utf8"));return 0!==n?n:Buffer.compare(Buffer.from(e[1],"utf8"),Buffer.from(t[1],"utf8"))}),c.map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)}).join("&")}function pr(e){if(!e.includes("%"))return e;for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(37===r){var o=e.charCodeAt(n+1),i=e.charCodeAt(n+2),s=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102};if(!s(o)||!s(i))return e;t.push(parseInt(e.slice(n+1,n+3),16)),n+=2}else if(r<128)t.push(r);else{var a=Buffer.from(e[n],"utf8");t.push.apply(t,zn(a))}}return Buffer.from(t).toString("utf8")}function hr(e){return e?Object.entries(e).filter(function(e){var t=Xn(e,2)[1];return null!=t}).map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return"".concat(encodeURIComponent(String(n)),"=").concat(encodeURIComponent(String(r)))}).join("&"):""}function dr(e){return dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dr(e)}function yr(e,t){return function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Sr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return br(c,"_invoke",function(n,r,o){var i,a,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,s}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,i=l[t],h=p.p,d=i[2];n>3?(o=d===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,a=0))}if(o||n>1)return s;throw f=!0,r}return function(o,l,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,d),a=l,u=d;(t=a<2?e:u)||!f;){i||(a?(a>1&&(p.n=a<3?-1:u),h(a,u)):p.v=u);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==s)break}catch(t){i=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,i),!0),c}var s={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(br(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,br(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,br(f,"constructor",c),br(c,"constructor",u),u.displayName="GeneratorFunction",br(c,o,"GeneratorFunction"),br(f),br(f,o,"Generator"),br(f,r,function(){return this}),br(f,"toString",function(){return"[object Generator]"}),(mr=function(){return{w:i,m:p}})()}function br(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}br=function(e,t,n,r){function i(t,n){br(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},br(e,t,n,r)}function vr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vr(Object(n),!0).forEach(function(t){wr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wr(e,t,n){return(t=Pr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _r(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function Er(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){_r(i,r,o,s,a,"next",e)}function a(e){_r(i,r,o,s,a,"throw",e)}s(void 0)})}}function Or(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Sr(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function Sr(e,t){if(e){if("string"==typeof e)return Tr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tr(e,t):void 0}}function Tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Rr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pr(r.key),r)}}function kr(e,t,n){return t&&Rr(e.prototype,t),n&&Rr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pr(e){var t=function(e,t){if("object"!=dr(e)||!e)return e;var n;if("undefined"!=typeof Symbol&&void 0!==(n=e[Symbol.toPrimitive])){var r=n.call(e,t||"default");if("object"!=dr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==dr(t)?t:t+""}function Ar(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jr(e,t,n){return t=Dr(t),function(e,t){if(t&&("object"==dr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Ur()?Reflect.construct(t,n||[],Dr(e).constructor):t.apply(e,n))}function Cr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xr(e,t)}function Nr(e){var t="function"==typeof Map?new Map:void 0;return Nr=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(Ur())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&xr(o,n.prototype),o}(e,arguments,Dr(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),xr(n,e)},Nr(e)}function Ur(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ur=function(){return!!e})()}function xr(e,t){return xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xr(e,t)}function Dr(e){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dr(e)}function Lr(e){return new Ir(e,0)}function Fr(e){return function(){return new Br(e.apply(this,arguments))}}function Br(e){var t,n;function r(t,n){try{var i=e[t](n),s=i.value,a=s instanceof Ir;Promise.resolve(a?s.v:s).then(function(n){if(a){var u="return"===t&&s.k?t:"next";if(!s.k||n.done)return r(u,n);n=e[u](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,s){var a={key:e,arg:o,resolve:i,reject:s,next:null};n?n=n.next=a:(t=n=a,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function Ir(e,t){this.v=e,this.k=t}function Hr(e){var t,n,r,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new qr(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function qr(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return qr=function(e){this.s=e,this.n=e.next},qr.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.throw;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new qr(e)}Br.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Br.prototype.next=function(e){return this._invoke("next",e)},Br.prototype.throw=function(e){return this._invoke("throw",e)},Br.prototype.return=function(e){return this._invoke("return",e)};var Mr=null,zr=null,Xr=null,Kr=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",SYNC_RUN_OUTPUT_PAGE_BYTES:5242880,SYNC_RUN_TRUNCATED_RETENTION_SECONDS:600,HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path",HTTP_HEADER_KEY_X_FILE_OVERWRITE:"X-File-Overwrite",HTTP_HEADER_KEY_X_FILE_MODE:"X-File-Mode",HTTP_HEADER_KEY_X_FILE_USER:"X-File-User",HTTP_HEADER_KEY_X_FILE_GROUP:"X-File-Group",HTTP_HEADER_KEY_X_OUTPUT_POSITION:"X-Output-Position",HTTP_HEADER_KEY_X_EXIT_CODE:"X-Exit-Code",HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED:"X-Output-Truncated",HTTP_HEADER_KEY_X_APP_NAME:"X-App-Name",HTTP_HEADER_KEY_X_INPUT_CLOSE:"X-Input-Close",HTTP_HEADER_KEY_X_SUBSCRIPTION_ID:"X-Subscription-Id",HTTP_HEADER_KEY_X_APPMESH_PROCESS_KEY:"X-AppMesh-Process-Key"}),Wr=Object.freeze({isNode:!("undefined"!=typeof window&&"undefined"!==window.document)}),Yr=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Gr(e,t){var n=String(e||""),r=String(t||""),o=r;if(n&&!Yr.test(r)){for(var i=n.length;i>0&&47===n.charCodeAt(i-1);)i--;o=r?n.slice(0,i)+"/"+r.replace(/^\/+/,""):n}try{return new URL(o).pathname}catch(e){try{return new URL(o,"http://localhost").pathname}catch(e){return r}}}var $r=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Ar(this,e),(n=jr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return Cr(e,Nr(Error)),kr(e)}(),Jr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Cr(e,$r),kr(e)}(),Vr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Cr(e,$r),kr(e)}(),Qr=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Ar(this,e),(n=jr(this,e,[t,r,null,"REQUEST"])).name="AppMeshRequestError",n}return Cr(e,$r),kr(e)}(),Zr=function(){function e(t){var n;return Ar(this,e),(n=jr(this,e,[t,null,null,"TIMEOUT"])).name="AppMeshTimeoutError",n}return Cr(e,$r),kr(e)}(),eo=function(e,t){Wr.isNode?process.stdout.write(e):console.log(e)};function to(e){if("number"==typeof e)return e;if("string"!=typeof e)throw new Error("Invalid input type. Expected number or ISO 8601 duration string.");if(/^\d+$/.test(e))return parseInt(e,10);if(!e.trim())throw new Error("Duration string cannot be empty");if(!e.startsWith("P"))throw new Error("Invalid ISO8601 duration: must start with P");var t="\\d+",n="".concat(t,"(?:[\\.,]").concat(t,")?"),r="(".concat(t,"Y)?(").concat(t,"M)?(").concat(t,"W)?(").concat(t,"D)?"),o="T(".concat(n,"H)?(").concat(n,"M)?(").concat(n,"S)?"),i="P(?:".concat(r,"(?:").concat(o,")?)"),s=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(i));if(!a)throw new RangeError("invalid duration: "+e);var u=a.slice(1);if(0===u.filter(function(e){return null!=e}).length)throw new RangeError("invalid duration: "+e);if(u.filter(function(e){return/\./.test(e||"")}).length>1)throw new RangeError("only the smallest unit can be fractional");var c=u.reduce(function(e,t,n){return e[s[n]]=parseFloat(t||"0")||0,e},{}),l=0;return l+=31536e3*c.years,l+=2592e3*c.months,l+=604800*c.weeks,l+=86400*c.days,l+=3600*c.hours,l+=60*c.minutes,l+=c.seconds}function no(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):(new TextEncoder).encode(null==e?"":String(e))}function ro(e){if("undefined"!=typeof Buffer)return Buffer.concat(e.map(function(e){return Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)}));var t,n=0,r=Or(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.byteLength}}catch(e){r.e(e)}finally{r.f()}var o,i=new Uint8Array(n),s=0,a=Or(e);try{for(a.s();!(o=a.n()).done;){var u=o.value;i.set(u,s),s+=u.byteLength}}catch(e){a.e(e)}finally{a.f()}return i}function oo(e){return ao(e.headers,"content-type")||(null==e.contentType?void 0:e.contentType)}function io(e){var t=/charset\s*=\s*"?([\w!#$%&*+\-.^`|~]+)"?/i.exec(String(e||""));return t?t[1]:null}function so(e,t){for(var n=0,r=[t,"utf-8"];n<r.length;n++){var o=r[n];if(o)try{return new TextDecoder(o).decode(e)}catch(e){}}return new TextDecoder("utf-8").decode(e)}function ao(e,t){if(e){var n=t.toLowerCase(),r=Object.keys(e).find(function(e){return e.toLowerCase()===n});return void 0===r?void 0:e[r]}}function uo(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(ao(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new $r("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function co(e){return lo.apply(this,arguments)}function lo(){return(lo=Er(mr().m(function e(t){var r,o,i,s;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=parseInt(t,10),isNaN(r)||String(r)!==t.trim()){e.n=1;break}return e.a(2,r);case 1:return e.p=1,e.n=2,n.e(994).then(()=>n.t(994,19));case 2:if(o=e.v,i=o.spawnSync,0===(s=i("id",["-u",t],{encoding:"utf8",timeout:3e3})).status&&s.stdout){e.n=3;break}return e.a(2,null);case 3:return e.a(2,parseInt(s.stdout.trim(),10));case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}function fo(e){return po.apply(this,arguments)}function po(){return(po=Er(mr().m(function e(t){var n,r;return mr().w(function(e){for(;;)switch(e.n){case 0:if(n=parseInt(t,10),isNaN(n)||String(n)!==t.trim()){e.n=1;break}return e.a(2,n);case 1:return e.n=2,ho("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function ho(e,t){return yo.apply(this,arguments)}function yo(){return(yo=Er(mr().m(function e(t,r){var o,i,s,a,u,c,l,f,p,h,d;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.e(994).then(()=>n.t(994,19));case 1:if(o=e.v,i=o.spawnSync,0!==(s=i("getent",["group",String(r)],{encoding:"utf8",timeout:3e3})).status||!s.stdout){e.n=2;break}return a=s.stdout.trim().split(":"),u=a.length>=3?parseInt(a[2],10):NaN,e.a(2,a[0]&&!isNaN(u)?{name:a[0],gid:u}:null);case 2:if(0===(c=i("dscacheutil",["-q","group","-a",t,String(r)],{encoding:"utf8",timeout:3e3})).status&&c.stdout){e.n=3;break}return e.a(2,null);case 3:if(l=c.stdout.split("\n"),f=l.find(function(e){return e.startsWith("name:")}),p=l.find(function(e){return e.startsWith("gid:")}),f&&p){e.n=4;break}return e.a(2,null);case 4:return h=f.slice(5).trim(),d=parseInt(p.slice(4).trim(),10),e.a(2,h&&!isNaN(d)?{name:h,gid:d}:null);case 5:return e.p=5,e.v,e.a(2,null)}},e,null,[[0,5]])}))).apply(this,arguments)}function mo(e){return bo.apply(this,arguments)}function bo(){return(bo=Er(mr().m(function e(t){var r,o,i,s;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.e(994).then(()=>n.t(994,19));case 1:if(r=e.v,o=r.spawnSync,0===(i=o("id",["-un",String(t)],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=2;break}return e.a(2,null);case 2:return s=i.stdout.trim(),e.a(2,s||null);case 3:return e.p=3,e.v,e.a(2,null)}},e,null,[[0,3]])}))).apply(this,arguments)}function vo(e){return go.apply(this,arguments)}function go(){return(go=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ho("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var wo="/opt/appmesh/ssl/ca.pem";function _o(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function Eo(e){if(!e)return null;var t="function"==typeof e.get?e.get(Kr.HTTP_HEADER_KEY_AUTH):e[Kr.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function Oo(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:zr.readFileSync(e)}function So(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return zr.existsSync(wo)?{ca:zr.readFileSync(wo),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=gr({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=Oo(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var To=kr(function e(t){var n,r,o,i,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ar(this,e),this.reason=t,this.exitCode=null!==(n=a.exitCode)&&void 0!==n?n:null,this.position=null!==(r=a.position)&&void 0!==r?r:null,this.status=null!==(o=a.status)&&void 0!==o?o:null,this.message=null!==(i=a.message)&&void 0!==i?i:null,this.result=null!==(s=a.result)&&void 0!==s?s:null});function Ro(e){return ko.apply(this,arguments)}function ko(){return(ko=Fr(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:n=new TextDecoder("utf-8"),r="",o="message",i=[],s=!1,a=!1,e.p=1,c=Hr(t);case 2:return e.n=3,Lr(c.next());case 3:if(!(s=!(l=e.v).done)){e.n=12;break}f=l.value,r+="string"==typeof f?f:n.decode(f,{stream:!0}),p=void 0;case 4:if(!((p=r.indexOf("\n"))>=0)){e.n=11;break}if(h=r.slice(0,p).replace(/\r$/,""),r=r.slice(p+1),""!==h){e.n=9;break}if(!("message"!==o||i.length>0)){e.n=8;break}if(d=i.join("\n"),y={},!d){e.n=7;break}e.p=5,y=JSON.parse(d),e.n=7;break;case 6:throw e.p=6,m=e.v,new $r("malformed SSE frame (".concat(o,"): ").concat(m.message));case 7:return e.n=8,[o,y];case 8:o="message",i=[],e.n=10;break;case 9:h.startsWith(":")||(h.startsWith("event:")?o=h.slice(6).trim():h.startsWith("data:")&&i.push(h.slice(5).trimStart()));case 10:e.n=4;break;case 11:s=!1,e.n=2;break;case 12:e.n=14;break;case 13:e.p=13,b=e.v,a=!0,u=b;case 14:if(e.p=14,e.p=15,!s||null==c.return){e.n=16;break}return e.n=16,Lr(c.return());case 16:if(e.p=16,!a){e.n=17;break}throw u;case 17:return e.f(16);case 18:return e.f(14);case 19:return e.a(2)}},e,null,[[15,,16,18],[5,6],[1,13,14,19]])}))).apply(this,arguments)}function Po(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new To(String(null!==(t=e.reason)&&void 0!==t?t:"closed"),gr({exitCode:e.exit_code,position:e.position,status:e.status,message:e.message},n))}function Ao(e){var t;if("error"===e.reason)throw new Qr(e.message||"stream failed with an error",null!==(t=e.status)&&void 0!==t?t:null);if("timeout"===e.reason)throw new Zr(e.message||"stream timed out");if(!["exit","removed","eof","final","disconnected","closed"].includes(e.reason))throw new $r("stream ended with unknown reason: ".concat(e.reason))}var jo=function(){return kr(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Wr.isNode?"https://127.0.0.1:6060":window.location.origin,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Ar(this,e),this.baseURL=r,this.forwardingHost=null,this._requestSigner=null,this._tokenProvider=null,i&&this.setTokenProvider(i);var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0},transformResponse:[uo]};this._sslConfig=o,this._client=Tn.create(s),Wr.isNode&&!Xr&&(Xr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=yr(e,2),n=t[0],r=t[1];Mr=n.default||n,zr=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Er(mr().m(function e(n){var r,o;return mr().w(function(e){for(;;)switch(e.n){case 0:return r=gr,o=gr({},n.headers),e.n=1,t._commonHeaders();case 1:return n.headers=r(o,e.v),e.a(2,n)}},e)}));return function(t){return e.apply(this,arguments)}}(),function(e){var t=new $r("Request configuration error: "+(e.message||"Unknown error"));return Promise.reject(t)}),this._client.interceptors.response.use(function(e){return t._handleUnauthorizedRetry(e)},function(e){var t,n,r,o;if(e instanceof $r)return Promise.reject(e);var i=new $r("Request failed: "+(e.message||"Unknown error"),null!==(t=null===(n=e.response)||void 0===n?void 0:n.status)&&void 0!==t?t:null,null!==(r=null===(o=e.response)||void 0===o?void 0:o.data)&&void 0!==r?r:null);return i.cause=e,Promise.reject(i)})},[{key:"setTokenProvider",value:function(e){if(!e||"function"!=typeof e.getAccessToken)throw new TypeError("tokenProvider must implement async getAccessToken()");this._tokenProvider=e}},{key:"setBearerToken",value:function(e){null!=e?this.setTokenProvider(new Nn(e)):this.clearBearerToken()}},{key:"setToken",value:function(e){this.setBearerToken(e)}},{key:"clearBearerToken",value:function(){var e=this._tokenProvider;e&&"function"==typeof e.clear&&e.clear(),this._tokenProvider=null}},{key:"enableRequestSignature",value:function(e,t){this._requestSigner=new ar(e,t)}},{key:"disableRequestSignature",value:function(){this._requestSigner=null}},{key:"isRequestSignatureEnabled",value:function(){return null!==this._requestSigner}},{key:"_applyRequestSignature",value:(Y=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h;return mr().w(function(e){for(;;)switch(e.n){case 0:if((n=this._requestSigner)&&t){e.n=1;break}return e.a(2);case 1:return r=Gr(t.baseURL||this._client.defaults.baseURL||this.baseURL,t.url),o="",t.params&&"object"===dr(t.params)&&Object.keys(t.params).length>0&&(t.paramsSerializer=hr,o=fr(hr(t.params))),i=this._headerValue(t.headers,"content-type"),s=ir(r)?Buffer.alloc(0):this._wireBodyBytes(t.data,i),a=String(t.method||"get").toUpperCase(),u={},e.n=2,n.attach(u,a,r,o,s);case 2:for(c=0,l=Object.entries(u);c<l.length;c++)f=yr(l[c],2),p=f[0],h=f[1],t.headers&&"function"==typeof t.headers.set?t.headers.set(p,h):t.headers=gr(gr({},t.headers),{},wr({},p,h));case 3:return e.a(2)}},e,this)})),function(e){return Y.apply(this,arguments)})},{key:"_headerValue",value:function(e,t){if(e){if("function"==typeof e.get)return e.get(t);var n=Object.keys(e).find(function(e){return e.toLowerCase()===t.toLowerCase()});return void 0===n?void 0:e[n]}}},{key:"_wireBodyBytes",value:function(e,t){if(null==e)return Buffer.alloc(0);if("string"==typeof e){if(String(t||"").toLowerCase().includes("application/json"))try{return JSON.parse(e),Buffer.from(e.trim(),"utf8")}catch(t){if("SyntaxError"!==t.name)throw t;return Buffer.from(JSON.stringify(e),"utf8")}return Buffer.from(e,"utf8")}if(Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer)return Buffer.from(e);if("object"===dr(e))return Buffer.from(JSON.stringify(e),"utf8");throw new $r("cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies")}},{key:"_getAccessToken",value:(W=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:if(!this._tokenProvider){e.n=2;break}return e.n=1,this._tokenProvider.getAccessToken();case 1:t=e.v,e.n=3;break;case 2:t=null;case 3:return e.a(2,t)}},e,this)})),function(){return W.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(K=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f;return mr().w(function(e){for(;;)switch(e.n){case 0:if(r=t.config||{},o=this._tokenProvider,401===t.status&&!r.__appmeshRetried&&o){e.n=1;break}return e.a(2,t);case 1:if("function"!=typeof o.canRefresh){e.n=3;break}return e.n=2,o.canRefresh();case 2:l=e.v,e.n=4;break;case 3:l=!!o.canRefresh;case 4:if(l&&"function"==typeof o.refreshAccessToken&&_o(r.data)){e.n=5;break}return e.a(2,t);case 5:if(!this._requestSigner){e.n=6;break}if(i=t.headers||{},(s="function"==typeof i.get?i.get("WWW-Authenticate"):i["WWW-Authenticate"]||i["www-authenticate"])&&s.includes("invalid_token")){e.n=6;break}return e.a(2,t);case 6:if(null===(n=Eo(r.headers))||void 0===n){e.n=7;break}f=n,e.n=9;break;case 7:return e.n=8,this._getAccessToken();case 8:f=e.v;case 9:return a=f,e.n=10,o.refreshAccessToken(a);case 10:if("string"==typeof(u=e.v)&&u.trim()){e.n=11;break}return e.a(2,t);case 11:if(r.__appmeshRetried=!0,c="Bearer ".concat(u.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set(Kr.HTTP_HEADER_KEY_AUTH,c):r.headers=gr(gr({},r.headers),{},wr({},Kr.HTTP_HEADER_KEY_AUTH,c)),!this._requestSigner){e.n=12;break}return e.n=12,this._applyRequestSignature(r);case 12:return e.a(2,this._client(r))}},e,this)})),function(e){return K.apply(this,arguments)})},{key:"getAuthConfig",value:(X=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return X.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(z=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return z.apply(this,arguments)})},{key:"listApps",value:(M=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return M.apply(this,arguments)})},{key:"getApp",value:(q=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return q.apply(this,arguments)})},{key:"checkAppHealth",value:(H=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return H.apply(this,arguments)})},{key:"addApp",value:(I=Er(mr().m(function e(t,n){var r;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return I.apply(this,arguments)})},{key:"deleteApp",value:(B=Er(mr().m(function e(t){var n,r;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("delete","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,200===n.status);case 2:if(e.p=2,404!==(r=e.v).statusCode){e.n=3;break}return e.a(2,!1);case 3:throw r;case 4:return e.a(2)}},e,this,[[0,2]])})),function(e){return B.apply(this,arguments)})},{key:"enableApp",value:(F=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/enable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return F.apply(this,arguments)})},{key:"disableApp",value:(L=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"getAppOutput",value:(D=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return n=p.length>2&&void 0!==p[2]?p[2]:0,r=p.length>3&&void 0!==p[3]?p[3]:10240,o=p.length>4&&void 0!==p[4]?p[4]:"",i=p.length>5&&void 0!==p[5]?p[5]:0,s={stdout_position:(p.length>1&&void 0!==p[1]?p[1]:0).toString(),stdout_index:n.toString(),stdout_maxsize:r.toString(),process_uuid:o,timeout:to(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,u=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_POSITION),c=ao(a.headers,Kr.HTTP_HEADER_KEY_X_EXIT_CODE),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new Co(a.status,a.data,l,f))}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"runAppSync",value:(x=Er(mr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return n=d.length>1&&void 0!==d[1]?d[1]:eo,r=d.length>2&&void 0!==d[2]?d[2]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=d.length>3&&void 0!==d[3]?d[3]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i=d.length>4&&void 0!==d[4]?d[4]:null,s={timeout:to(r),lifecycle:to(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:s,config:{responseType:"arraybuffer"}});case 1:if(a=e.v,u=null,200!==a.status){e.n=3;break}if((c=ao(a.headers,Kr.HTTP_HEADER_KEY_X_EXIT_CODE))&&(u=parseInt(c,10)),l=ao(a.headers,Kr.HTTP_HEADER_KEY_X_APP_NAME),f=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED),!l||"1"!==String(f)){e.n=3;break}return p=ao(a.headers,Kr.HTTP_HEADER_KEY_X_OUTPUT_POSITION),e.n=2,this._readTruncatedRunOutput(a,l,i,p?parseInt(p,10):NaN);case 2:return h=e.v,n&&n(h,0),e.a(2,u);case 3:return n&&n(so(no(a.data),io(oo(a))),0),e.a(2,u)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"_readTruncatedRunOutput",value:(U=Er(mr().m(function e(t,n,r,o){var i,s,a,u,c,l;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:i=[no(t.data)],Number.isFinite(o)||(o=i[0].byteLength),(s=function(){var e=i.reduce(function(e,t){return e+t.byteLength},0);if(null!=r&&e>r)throw new Qr("run output exceeds maxOutputBytes=".concat(r,"; the rest stays readable on application ")+"'".concat(n,"' for ").concat(Kr.SYNC_RUN_TRUNCATED_RETENTION_SECONDS," seconds"),t.status)})(),a=!1,e.p=1;case 2:return e.n=3,this._request("get","/appmesh/app/".concat(n,"/output"),null,{params:{stdout_position:String(o)},config:{responseType:"arraybuffer"}});case 3:if(u=e.v,c=no(u.data),i.push(c),o+=c.byteLength,s(),!(c.byteLength<Kr.SYNC_RUN_OUTPUT_PAGE_BYTES)){e.n=4;break}return a=!0,e.a(3,5);case 4:e.n=2;break;case 5:if(e.p=5,!a){e.n=9;break}return e.p=6,e.n=7,this.deleteApp(n);case 7:e.n=9;break;case 8:e.p=8,l=e.v,console.warn("Warning: Failed to remove sync run application '".concat(n,"':"),l.message);case 9:return e.f(5);case 10:return e.a(2,so(ro(i),io(oo(t))))}},e,this,[[6,8],[1,,5,10]])})),function(e,t,n,r){return U.apply(this,arguments)})},{key:"runAppAsync",value:(N=Er(mr().m(function e(t){var n,r,o,i,s=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:to(n),lifecycle:to(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return i=e.v,e.a(2,new No(this,i.data.name,i.data.process_uuid))}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"waitForAsyncRun",value:(C=Er(mr().m(function e(t){var n,r,o,i,s,a,u=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:eo,r=u.length>2&&void 0!==u[2]?u[2]:0,!t){e.n=7;break}o=0,i=new Date,s=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.getAppOutput(t.appName,o,0,20480,t.procUid,s);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.deleteApp(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-i)/1e3>r)){e.n=5;break}return e.a(3,7);case 5:return e.n=6,new Promise(function(e){return setTimeout(e,100)});case 6:e.n=1;break;case 7:return e.a(2,null)}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"runTask",value:(j=Er(mr().m(function e(t,n){var r,o,i=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return(r=i.length>2&&void 0!==i[2]?i[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"cancelTask",value:(A=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"followOutput",value:function(e){var t=this;return Fr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return mr().m(function r(){var o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k;return mr().w(function(r){for(;;)switch(r.p=r.n){case 0:return o=n.stdoutPosition,i=void 0===o?0:o,s=n.processUuid,a=void 0===s?"":s,u=n.follow,c=void 0===u||u,l=n.timeout,f=void 0===l?3600:l,p={stdout_position:String(i),follow:c?"true":"false",timeout:String(f)},a&&(p.process_uuid=a),r.n=1,Lr(t._sseRequest("get","/appmesh/app/".concat(e,"/output/stream"),{params:p}));case 1:h=r.v,d=null,r.p=2,y=!1,m=!1,r.p=3,v=Hr(Ro(h.data));case 4:return r.n=5,Lr(v.next());case 5:if(!(y=!(g=r.v).done)){r.n=9;break}if(w=yr(g.value,2),_=w[0],E=w[1],"stdout"!==_){r.n=7;break}return r.n=6,String(null!==(O=E.output)&&void 0!==O?O:"");case 6:r.n=8;break;case 7:if("end"!==_){r.n=8;break}return d=Po(E),r.a(3,9);case 8:y=!1,r.n=4;break;case 9:r.n=11;break;case 10:r.p=10,R=r.v,m=!0,b=R;case 11:if(r.p=11,r.p=12,!y||null==v.return){r.n=13;break}return r.n=13,Lr(v.return());case 13:if(r.p=13,!m){r.n=14;break}throw b;case 14:return r.f(13);case 15:return r.f(11);case 16:r.n=18;break;case 17:throw r.p=17,k=r.v,t.onError(k);case 18:return r.p=18,null===(S=h.data)||void 0===S||null===(T=S.destroy)||void 0===T||T.call(S),r.f(18);case 19:return null===d&&(d=new To("closed")),Ao(d),r.a(2,d)}},r,null,[[12,,13,15],[3,10,11,16],[2,17,18,19]])})()}).apply(this,arguments)}},{key:"runTaskStream",value:function(e,t){var n=this;return Fr(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mr().m(function o(){var i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S;return mr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i=r.timeout,a=(s=void 0===i?300:i)&&s>0?{timeout:String(s)}:{},o.n=1,Lr(n._sseRequest("post","/appmesh/app/".concat(e,"/task/stream"),{params:a,body:t}));case 1:u=o.v,c=null,l=null,o.p=2,f=!1,p=!1,o.p=3,d=Hr(Ro(u.data));case 4:return o.n=5,Lr(d.next());case 5:if(!(f=!(y=o.v).done)){o.n=10;break}if(m=yr(y.value,2),b=m[0],v=m[1],"partial"!==b){o.n=7;break}return o.n=6,String(null!==(g=v.data)&&void 0!==g?g:"");case 6:o.n=9;break;case 7:if("final"!==b){o.n=8;break}l=null!==(w=v.result)&&void 0!==w?w:null,o.n=9;break;case 8:if("end"!==b){o.n=9;break}return c=Po(v,{result:l}),o.a(3,10);case 9:f=!1,o.n=4;break;case 10:o.n=12;break;case 11:o.p=11,O=o.v,p=!0,h=O;case 12:if(o.p=12,o.p=13,!f||null==d.return){o.n=14;break}return o.n=14,Lr(d.return());case 14:if(o.p=14,!p){o.n=15;break}throw h;case 15:return o.f(14);case 16:return o.f(12);case 17:o.n=19;break;case 18:throw o.p=18,S=o.v,n.onError(S);case 19:return o.p=19,null===(_=u.data)||void 0===_||null===(E=_.destroy)||void 0===E||E.call(_),o.f(19);case 20:return null===c&&(c=new To("closed",{result:l})),Ao(c),o.a(2,c)}},o,null,[[13,,14,16],[3,11,12,17],[2,18,19,20]])})()}).apply(this,arguments)}},{key:"streamRun",value:function(e){var t=this;return Fr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kr.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kr.DEFAULT_RUN_APP_LIFECYCLE_SECONDS;return mr().m(function o(){var i,s,a,u,c;return mr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i="string"==typeof e?{command:e,shell:!0}:e,o.n=1,Lr(t.runAppAsync(i,n,r));case 1:return s=o.v,o.p=2,u=t.followOutput(s.appName,{processUuid:s.procUid,follow:!0,timeout:Math.max(to(n),to(r))}),o.n=3,Lr(u.next());case 3:c=o.v;case 4:if(c.done){o.n=7;break}return o.n=5,c.value;case 5:return o.n=6,Lr(u.next());case 6:c=o.v,o.n=4;break;case 7:a=c.value;case 8:return o.p=8,o.p=9,o.n=10,Lr(t.deleteApp(s.appName));case 10:o.n=12;break;case 11:o.p=11,o.v;case 12:return o.f(8);case 13:return o.a(2,a)}},o,null,[[9,11],[2,,8,13]])})()}).apply(this,arguments)}},{key:"sendInput",value:(P=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return s=(i=h.length>2&&void 0!==h[2]?h[2]:{}).close,a=void 0!==s&&s,u=i.processUuid,c=void 0===u?"":u,l=a?wr({},Kr.HTTP_HEADER_KEY_X_INPUT_CLOSE,"true"):{},f=c?{process_uuid:c}:{},e.n=1,this._request("post","/appmesh/app/".concat(t,"/input"),n,{headers:l,params:f});case 1:return p=e.v,e.a(2,parseInt(null!==(r=null===(o=p.data)||void 0===o?void 0:o.bytes_written)&&void 0!==r?r:0,10))}},e,this)})),function(e,t){return P.apply(this,arguments)})},{key:"downloadFile",value:(k=Er(mr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k,P,A=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return a=A.length>2&&void 0!==A[2]&&A[2],(s=A.length>1&&void 0!==A[1]?A[1]:null)||(s=t.split(/[\\/]/).pop()),u=wr({},Kr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:u,config:{responseType:Wr.isNode?"stream":"arraybuffer"}});case 1:if(c=e.v,l=Wr.isNode?"":c.data,200!==c.status||null!==(r=c.headers)&&void 0!==r&&r["content-disposition"]||!String(null!==(o=null===(i=c.headers)||void 0===i?void 0:i["content-type"])&&void 0!==o?o:"").toLowerCase().includes("json")){e.n=2;break}throw Wr.isNode&&c.data.destroy(),new $r("File download is not supported by this server surface: ".concat(t),c.status,l);case 2:if(200===c.status){e.n=3;break}throw new $r("Failed to download file: ".concat(t),c.status,l);case 3:if(!Wr.isNode){e.n=20;break}return e.n=4,n.e(603).then(()=>n.t(603,19));case 4:return f=e.v,e.n=5,n.e(582).then(()=>n.t(582,19));case 5:return p=e.v,h=p.promisify,R=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=R(e.v.pipeline),y=f.promises,e.p=7,e.n=8,d(c.data,f.createWriteStream(s));case 8:if(!a||"win32"===process.platform){e.n=17;break}if(m=c.headers,e.p=9,!(b=m["x-file-mode"])){e.n=12;break}if(v=parseInt(b,10),!(Number.isInteger(v)&&v>=0&&v<=511)){e.n=11;break}return e.n=10,y.chmod(s,v);case 10:e.n=12;break;case 11:console.warn("Warning: Invalid x-file-mode value:",b);case 12:if(g=m["x-file-user"],w=m["x-file-group"],!g||!w){e.n=15;break}return e.n=13,co(g);case 13:return _=e.v,e.n=14,fo(w);case 14:if(E=e.v,null===_||null===E){e.n=15;break}return e.n=15,y.chown(s,_,E);case 15:e.n=17;break;case 16:e.p=16,k=e.v,console.warn("Warning: Unable to apply file attributes to",s,k.message);case 17:e.n=19;break;case 18:throw e.p=18,P=e.v,new $r("Failed to write file to ".concat(s,": ").concat(P.message),c.status);case 19:e.n=21;break;case 20:O=new Blob([c.data]),S=window.URL.createObjectURL(O),(T=document.createElement("a")).style.display="none",T.href=S,T.download=s.split("/").pop(),document.body.appendChild(T),T.click(),window.URL.revokeObjectURL(S),document.body.removeChild(T);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return k.apply(this,arguments)})},{key:"uploadFile",value:(R=Er(mr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:if(s=b.length>2&&void 0!==b[2]&&b[2],a=b.length>3&&void 0!==b[3]&&b[3],i=b.length>1&&void 0!==b[1]?b[1]:null){e.n=2;break}if(u="string"==typeof t?t:t&&t.name){e.n=1;break}throw new $r("filePath is required when localFile is a Blob without a name");case 1:i=u.split(/[\\/]/).pop();case 2:if(c=wr({},Kr.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),a&&(c[Kr.HTTP_HEADER_KEY_X_FILE_OVERWRITE]="true"),!Wr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(f=e.v,p=f.statSync(t),!s){e.n=6;break}return c["X-File-Mode"]=(511&p.mode).toString(),e.n=4,mo(p.uid);case 4:return h=e.v,e.n=5,vo(p.gid);case 5:d=e.v,c["X-File-User"]=h||String(p.uid),c["X-File-Group"]=d||String(p.gid);case 6:l=p.size<10485760?f.readFileSync(t):f.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}l=t,e.n=9;break;case 8:throw new $r("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",l,{headers:c,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(y=e.v).status||201===y.status){e.n=11;break}throw new $r("Failed to upload file: ".concat(i),y.status,y.data);case 11:if(m=String(null!==(r=null===(o=y.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===y.status&&m.includes("json")&&y.data&&"object"===dr(y.data)&&"message"in y.data)){e.n=12;break}throw new $r("File upload is not supported by this server surface: ".concat(i),y.status,y.data);case 12:return e.a(2)}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"getHostResources",value:(T=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/resources");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return T.apply(this,arguments)})},{key:"getConfig",value:(S=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/config");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return S.apply(this,arguments)})},{key:"setConfig",value:(O=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"setLogLevel",value:(E=Er(mr().m(function e(){var t,n,r=arguments;return mr().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.setConfig({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"addLabel",value:(_=Er(mr().m(function e(t,n){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return _.apply(this,arguments)})},{key:"deleteLabel",value:(w=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return w.apply(this,arguments)})},{key:"listLabels",value:(g=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return g.apply(this,arguments)})},{key:"listPrincipals",value:(v=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principals");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return v.apply(this,arguments)})},{key:"updatePrincipal",value:(b=Er(mr().m(function e(t,n){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return b.apply(this,arguments)})},{key:"deletePrincipal",value:(m=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"getCurrentUser",value:(y=Er(mr().m(function e(){return mr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return y.apply(this,arguments)})},{key:"listPermissions",value:(d=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return d.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(h=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return h.apply(this,arguments)})},{key:"getUserPermissions",value:(p=Er(mr().m(function e(){return mr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return p.apply(this,arguments)})},{key:"listRoles",value:(f=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"updateRole",value:(l=Er(mr().m(function e(t,n){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return l.apply(this,arguments)})},{key:"deleteRole",value:(c=Er(mr().m(function e(t){return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return c.apply(this,arguments)})},{key:"getMetrics",value:(u=Er(mr().m(function e(){var t;return mr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"subscribe",value:(a=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:throw new $r("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return a.apply(this,arguments)})},{key:"unsubscribe",value:(s=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:throw new $r("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return s.apply(this,arguments)})},{key:"request",value:(i=Er(mr().m(function e(t,n){var r,o,i=arguments;return mr().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"_commonHeaders",value:(o=Er(mr().m(function e(){var t,n;return mr().w(function(e){for(;;)switch(e.n){case 0:return t={},Wr.isNode&&(t[Kr.HTTP_USER_AGENT_HEADER_NAME]=Kr.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[Kr.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[Kr.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_request",value:(r=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},e.n=1,this._ensureHttpsAgent();case 1:if(i=o.headers,s=void 0===i?{}:i,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=2,f=gr(gr({method:t,url:n,withCredentials:!1},l),{},{headers:gr({},s),params:gr({},u)}),null!==r&&(f.data=r),!this._requestSigner){e.n=3;break}return e.n=3,this._applyRequestSignature(f);case 3:return e.n=4,this._client(f);case 4:if(!((p=e.v).status<200||p.status>=300)){e.n=5;break}throw h=this._extractErrorMessage(p.data),new $r(h,p.status,p.data);case 5:return e.a(2,p);case 6:throw e.p=6,d=e.v,this.onError(d);case 7:return e.a(2)}},e,this,[[2,6]])})),function(e,t){return r.apply(this,arguments)})},{key:"_ensureHttpsAgent",value:(t=Er(mr().m(function e(){return mr().w(function(e){for(;;)switch(e.n){case 0:if(!Wr.isNode||!Xr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Xr;case 1:Mr&&(this._client.defaults.httpsAgent=new Mr.Agent(gr(gr({},So(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_sseRequest",value:(e=Er(mr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E=arguments;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=E.length>2&&void 0!==E[2]?E[2]:{},e.n=1,this._ensureHttpsAgent();case 1:if(o=r.params,i=void 0===o?{}:o,s=r.headers,a=void 0===s?{}:s,u=r.body,c={method:t,url:n,withCredentials:!1,responseType:"stream",timeout:0,headers:gr({},a),params:gr({},i)},null!=u&&(c.data=u),!this._requestSigner){e.n=2;break}return e.n=2,this._applyRequestSignature(c);case 2:return e.p=2,e.n=3,this._client(c);case 3:l=e.v,e.n=5;break;case 4:throw e.p=4,w=e.v,this.onError(w);case 5:if(200===l.status){e.n=21;break}f="",e.p=6,p=[],h=!1,d=!1,e.p=7,m=Hr(l.data);case 8:return e.n=9,m.next();case 9:if(!(h=!(b=e.v).done)){e.n=11;break}v=b.value,p.push(v);case 10:h=!1,e.n=8;break;case 11:e.n=13;break;case 12:e.p=12,_=e.v,d=!0,y=_;case 13:if(e.p=13,e.p=14,!h||null==m.return){e.n=15;break}return e.n=15,m.return();case 15:if(e.p=15,!d){e.n=16;break}throw y;case 16:return e.f(15);case 17:return e.f(13);case 18:f=Buffer.concat(p).toString("utf8"),e.n=20;break;case 19:e.p=19,e.v;case 20:throw g=f?this._extractErrorMessage(f):"SSE request failed with status ".concat(l.status),this.forwardingHost&&(400===l.status?g+="; streaming through node forwarding (forwardingHost=".concat(this.forwardingHost,") is relayed by")+" the agent REST listener (default port 6060): point the client at it, not at the engine listener":404!==l.status&&405!==l.status||(g+="; a forwarded stream needs X-Target-Host to name the target without its TCP port"+" (forwardingHost=".concat(this.forwardingHost,"): use a bare host or the target's agent REST port (6060)"))),new $r(g,l.status,f||null);case 21:return e.a(2,l)}},e,this,[[14,,15,17],[7,12,13,18],[6,19],[2,4]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return this._extractErrorMessage(e.toString("utf8"));if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===dr(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return e instanceof $r?e:new $r(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,v,g,w,_,E,O,S,T,R,k,P,A,j,C,N,U,x,D,L,F,B,I,H,q,M,z,X,K,W,Y}(),Co=kr(function e(t,n,r,o){Ar(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),No=function(){return kr(function e(t,n,r){Ar(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"withForwardingHost",value:(t=Er(mr().m(function e(t){var n;return mr().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=this._client.forwardingHost,this._client.forwardingHost=this._forwardingHost,e.p=1,e.n=2,t();case 2:return e.a(2,e.v);case 3:return e.p=3,this._client.forwardingHost=n,e.f(3);case 4:return e.a(2)}},e,this,[[1,,3,4]])})),function(e){return t.apply(this,arguments)})},{key:"wait",value:(e=Er(mr().m(function e(){var t,n,r=this,o=arguments;return mr().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:eo,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.withForwardingHost(function(){return r._client.waitForAsyncRun(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Uo=jo;export{jo as AppMeshClient,$r as AppMeshError,Qr as AppMeshRequestError,Zr as AppMeshTimeoutError,Co as AppOutput,Jr as AppRemovedError,No as AppRun,Kr as CONSTANTS,wo as DEFAULT_CA_FILE,qn as RefreshTokenProvider,ar as RequestSigner,To as SseEnd,Nn as StaticAccessTokenProvider,Vr as TransportDisconnectedError,fo as _resolveGid,vo as _resolveGroupName,co as _resolveUid,mo as _resolveUserName,Uo as default};
1
+ var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.m=e,(()=>{const e=Object.getPrototypeOf;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const i=Object.create(null);n.r(i);const s=Object.create(null);t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>r[e]);return s.default=()=>r,n.d(i,s),i}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>{const t=[];return n.f.j(e,t),Promise.all(t)},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{Object.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})},(()=>{const e={994:()=>import("./994.appmesh.esm.js"),453:()=>import("./453.appmesh.esm.js"),603:()=>import("./603.appmesh.esm.js"),582:()=>import("./582.appmesh.esm.js"),770:()=>import("./770.appmesh.esm.js")},t={792:0},r=e=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:i}=e;var s,a,u=0;for(s in o)n.o(o,s)&&(n.m[s]=o[s]);for(i&&i(n);u<r.length;u++)a=r[u],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0};n.f.j=(o,i)=>{let s=n.o(t,o)?t[o]:void 0;if(0!==s)if(s)i.push(s[1]);else{const n=Promise.race([e[o]().then(r,e=>{throw 0!==t[o]&&(t[o]=void 0),e}),new Promise(e=>s=t[o]=[e])]);i.push(s[1]=n)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>He,hasStandardBrowserEnv:()=>Me,hasStandardBrowserWebWorkerEnv:()=>ze,navigator:()=>qe,origin:()=>Xe});const{toString:i}=Object.prototype,{getPrototypeOf:s}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),f=(e,t,n)=>e===Object.prototype||!n&&null===t,p=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=s(n);if(f(n,o,n===e))return!1;if(c(n,t))return!0;n=o}return!1},h=(d=Object.create(null),e=>{const t=i.call(e);return d[t]||(d[t]=t.slice(8,-1).toLowerCase())});var d;const y=e=>(e=e.toLowerCase(),t=>h(t)===e),m=e=>t=>typeof t===e,{isArray:b}=Array,g=m("undefined");function v(e){return null!==e&&!g(e)&&null!==e.constructor&&!g(e.constructor)&&E(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const w=y("ArrayBuffer");const _=m("string"),E=m("function"),O=m("number"),S=e=>null!==e&&"object"==typeof e,T=e=>{if(!S(e))return!1;const t=s(e);return(null===t||t===Object.prototype||null===s(t))&&(f(e,t,!0)||!c(e,u)&&!c(e,a))},R=y("Date"),k=y("File"),P=y("Blob"),A=y("FileList"),j=y("Set");const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},N=void 0!==C.FormData?C.FormData:void 0,U=y("URLSearchParams"),[x,D,L,B]=["ReadableStream","Request","Response","Headers"].map(y);function F(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(v(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}const I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,H=e=>!g(e)&&e!==I;const q=(M="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>M&&e instanceof M);var M;const z=y("HTMLFormElement"),{propertyIsEnumerable:X}=Object.prototype,K=y("RegExp"),W=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};F(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Y=y("AsyncFunction"),G=($="function"==typeof setImmediate,J=E(I.postMessage),$?setImmediate:J?(V=`axios@${Math.random()}`,Q=[],I.addEventListener("message",({source:e,data:t})=>{e===I&&t===V&&Q.length&&Q.shift()()},!1),e=>{Q.push(e),I.postMessage(V,"*")}):e=>setTimeout(e));var $,J,V,Q;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(I):"undefined"!=typeof process&&process.nextTick||G,ee=e=>null!=e&&E(e[a]),te={isArray:b,isArrayBuffer:w,isBuffer:v,isFormData:e=>{if(!e)return!1;if(N&&e instanceof N)return!0;const t=s(e);if(!t||t===Object.prototype)return!1;if(!E(e.append))return!1;const n=h(e);return"formdata"===n||"object"===n&&E(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&w(e.buffer),t},isString:_,isNumber:O,isBoolean:e=>!0===e||!1===e,isObject:S,isPlainObject:T,isEmptyObject:e=>{if(!S(e)||v(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:B,isUndefined:g,isDate:R,isFile:k,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:P,isRegExp:K,isFunction:E,isStream:e=>S(e)&&E(e.pipe),isURLSearchParams:U,isTypedArray:q,isFileList:A,forEach:F,merge:function e(...t){const{caseless:n,skipUndefined:r}=H(this)&&this||{},o={},i=n?Object.create(null):null,s=(t,n)=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;let s=n;if(i&&"string"==typeof n){const e=n.toLowerCase(),t=i[e];void 0!==t&&c(o,t)?s=t:i[e]=n}const a=c(o,s)?o[s]:void 0;T(a)&&T(t)?o[s]=e(a,t):T(t)?o[s]=e({},t):b(t)?o[s]=t.slice():r&&g(t)||(o[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||v(n))continue;if(F(n,s),"object"!=typeof n||b(n)||!Object.getOwnPropertySymbols)continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];X.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(F(t,(t,r)=>{n&&E(t)?Object.defineProperty(e,r,{__proto__:null,value:o(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:h,kindOfTest:y,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(b(e))return e;let t=e.length;if(!Number.isSafeInteger(t)||t<0||t>4294967295)return null;const n=new Set,r=new Set;let o=e;for(;null!=o&&n.size<t;){if(r.has(o))return null;r.add(o);const i=s(o);if(f(o,i,o===e))break;Object.getOwnPropertyNames(o).forEach(e=>{const r=+e;Number.isInteger(r)&&r>=0&&r<t&&String(r)===e&&c(o,e)&&n.add(r)}),o=i}if(n.size!==t)return null;const i=new Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:z,hasOwnProperty:c,hasOwnProp:c,hasOwnInPrototypeChain:p,getSafeProp:(e,t)=>null!=e&&p(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=s(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(l(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:s(i);if(f(i,a,i===e))break;const u=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&u.push(...Object.getOwnPropertySymbols(i));for(const t of u)l(t)||c(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:W,freezeMethods:e=>{W(e,(t,n)=>{if(E(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];E(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return b(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:function(e,t){if(v(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null},global:I,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&E(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(S(e)){if(t.has(e))return;if(v(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)?[]:{},F(e,(e,t)=>{const o=n(e);!g(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:Y,isThenable:e=>e&&(S(e)||E(e))&&E(e.then)&&E(e.catch),setImmediate:G,asap:Z,isIterable:ee,isSafeIterable:e=>null!=e&&p(e,a)&&ee(e)},ne=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const re=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),oe=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ie(e,t){return te.isArray(e)?e.map(e=>ie(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function se(e){const t=Object.create(null);return te.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>ie(e,oe))(e)}),t}const ae=Symbol("internals");function ue(e){return e&&String(e).trim().toLowerCase()}function ce(e){return!1===e||null==e?e:te.isArray(e)?e.map(ce):(e=>ie(e,re))(String(e))}const le=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function fe(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}const pe=e=>"__proto__"===e?"__Proto__":e;function he(e,t,n,r,o){return te.isFunction(r)?r.call(e,t,n):(o&&(t=n),te.isString(t)?te.isString(r)?-1!==t.indexOf(r):te.isRegExp(r)?r.test(t):void 0:void 0)}class de{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ue(t);if(!o)return;const i=te.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[pe(i||t)]=ce(e))}const i=(e,t)=>te.forEach(e,(e,n)=>o(e,n,t));if(te.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(te.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t=Object.create(null);let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim();const i=te.hasOwnProp(t,n);!n||i&&te.hasOwnProp(ne,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t})(e),t);else if(te.isObject(e)&&te.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!te.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],te.hasOwnProp(o,r)?(n=o[r],o[r]=te.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ue(e)){const n=te.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(te.isFunction(t))return t.call(this,e,n);if(te.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ue(e)){const n=te.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(this,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ue(e)){const o=te.findKey(n,e);!o||t&&!he(n,n[o],o,t)||(delete n[o],r=!0)}}return te.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!he(this,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n=Object.create(null);return te.forEach(this,(r,o)=>{const i=te.findKey(n,o);if(i)return t[i]=ce(r),void delete t[o];const s=pe(e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim());s!==o&&delete t[o],t[s]=ce(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return te.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&te.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){const e=this.get("set-cookie");return te.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let r=0,o=!1,i=!1;function s(e){const o=fe(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const s=fe(o.slice(0,i));if(!le.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const u=fe(o.slice(i+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let r=1;r<t;r++){const o=e.charCodeAt(r);if(34===o)return e;if(92===o&&(r+=1,r>=t))return e;n+=e[r]}return n}(u)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(s(e),r=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ae]=this[ae]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ue(e);t[r]||(!function(e,t){const n=te.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return te.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Content-Encoding","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 ve=Symbol("causeStack");class we extends Error{static from(e,t,n,r,o,i){let s=e.message;!s&&te.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?ge(e.message):ge(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new we(s,t||e.code,n,r,o);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,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,ve,{__proto__:null,value:o})}catch(e){}}(a,e),null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&te.hasOwnProp(e,"redact")?e.redact:void 0,n=te.isArray(t)&&t.length>0?be(e,t):te.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}we.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",we.ERR_BAD_OPTION="ERR_BAD_OPTION",we.ECONNABORTED="ECONNABORTED",we.ETIMEDOUT="ETIMEDOUT",we.ECONNREFUSED="ECONNREFUSED",we.ERR_NETWORK="ERR_NETWORK",we.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",we.ERR_DEPRECATED="ERR_DEPRECATED",we.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",we.ERR_BAD_REQUEST="ERR_BAD_REQUEST",we.ERR_CANCELED="ERR_CANCELED",we.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",we.ERR_INVALID_URL="ERR_INVALID_URL",we.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _e=we;function Ee(e){return te.isPlainObject(e)||te.isArray(e)}function Oe(e){return te.endsWith(e,"[]")?e.slice(0,-2):e}function Se(e,t,n){return e?e.concat(t).map(function(e,t){return e=Oe(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Te=te.toFlatObject(te,{},null,function(e){return/^is[A-Z]/.test(e)});const Re=function(e,t,n){if(!te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=te.getSafeProp(n,e);return te.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||d,s=r("dots",!1),a=r("indexes",!1),u=r("Blob")||"undefined"!=typeof Blob&&Blob,c=r("maxDepth",100),l=u&&te.isSpecCompliantForm(t),f=[];if(!te.isFunction(i))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(te.isDate(e))return e.toISOString();if(te.isBoolean(e))return e.toString();if(!l&&te.isBlob(e))throw new _e("Blob is not supported. Use a Buffer instead.");if(te.isArrayBuffer(e)||te.isTypedArray(e)){if(l&&"function"==typeof u)return new u([e]);throw new _e("Blob is not supported. Use a Buffer instead.",_e.ERR_NOT_SUPPORT)}return e}function h(e){if(e>c)throw new _e("Object is too deeply nested ("+e+" levels). Max depth: "+c,_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function d(e,n,r){let i=e;if(te.isReactNative(t)&&te.isReactNativeBlob(e))return t.append(Se(r,n,s),p(e)),!1;if(e&&!r&&"object"==typeof e)if(te.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(c===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!te.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),h(t+n.length-1),r})}(e,1);else if(te.isArray(e)&&function(e){return te.isArray(e)&&!e.some(Ee)}(e)||(te.isFileList(e)||te.endsWith(n,"[]"))&&(i=te.toArray(e)))return n=Oe(n),i.forEach(function(e,r){!te.isUndefined(e)&&null!==e&&t.append(!0===a?Se([n],r,s):null===a?n:n+"[]",p(e))}),!1;return!!Ee(e)||(t.append(Se(r,n,s),p(e)),!1)}const y=Object.assign(Te,{defaultVisitor:d,convertValue:p,isVisitable:Ee});if(!te.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!te.isUndefined(n)){if(h(o),-1!==f.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));f.push(n),te.forEach(n,function(n,s){!0===(!(te.isUndefined(n)||null===n)&&i.call(t,n,te.isString(s)?s.trim():s,r,y))&&e(n,r?r.concat(s):[s],o+1)}),f.pop()}}(e),t};function ke(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Pe(e,t){this._pairs=[],e&&Re(e,this,t)}const Ae=Pe.prototype;Ae.append=function(e,t){this._pairs.push([e,t])},Ae.toString=function(e){const t=e?t=>e.call(this,t,ke):ke;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const je=Pe;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ne(e,t,n){if(!t)return e;e=e||"";const r=te.isFunction(n)?{serialize:n}:n,o=te.getSafeProp(r,"encode")||Ce,i=te.getSafeProp(r,"serialize");let s;if(s=i?i(t,r):te.isURLSearchParams(t)?t.toString():new je(t,r).toString(o),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}const Ue=Symbol("internals");function xe(e){return e?e.length:0}function De(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Le(e,t){const n=e.handlers,r=xe(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(e,r){n[e.index]!==e.handler&&t.handlerEntries.delete(r)}):t.handlerEntries.clear()),t.handlersLength=r}const Be=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||!te.hasOwnInPrototypeChain(n,"synchronous"))&&n.synchronous,runWhen:n&&te.hasOwnInPrototypeChain(n,"runWhen")?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))}}},Fe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0,encodeBasicAuthUsername:!1},Ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:je,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},He="undefined"!=typeof window&&"undefined"!=typeof document,qe="object"==typeof navigator&&navigator||void 0,Me=He&&(!qe||["ReactNative","NativeScript","NS"].indexOf(qe.product)<0),ze="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Xe=He&&window.location.href||"http://localhost",Ke={...r,...Ie};function We(e){if(e>100)throw new _e("FormData field is too deeply nested ("+e+" levels). Max depth: 100",_e.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ye(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}function Ge(e){if(!te.isArray(e))return e;const t=Object.keys(e);return t.length!==e.length||t.some((e,t)=>e!==String(t))?Ye(e):e}const $e=function(e){function t(e,n,r,o){We(o);let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&te.isArray(r)?r.length:i,a)return te.hasOwnProp(r,i)?(r[i]=Ge(r[i]),r[i]=te.isArray(r[i])?r[i].concat(n):[r[i],n]):r[i]=n,!s;te.hasOwnProp(r,i)&&te.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&te.isArray(r[i])&&(r[i]=Ye(r[i])),!s}if(te.isFormData(e)&&te.isFunction(e.entries)){const n={};return te.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)We(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),function(e){const t=[e];for(;t.length;){const e=t.pop();Object.keys(e).forEach(n=>{const r=e[n]=Ge(e[n]);(te.isArray(r)||te.isPlainObject(r))&&t.push(r)})}return e}(n)}return null},Je=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ve=(e,t)=>null!=e&&te.hasOwnProp(e,t)?e[t]:void 0;const Qe={transitional:Fe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=te.isObject(e);o&&te.isHTMLForm(e)&&(e=new FormData(e));if(te.isFormData(e))return r?JSON.stringify($e(e)):e;if(te.isArrayBuffer(e)||te.isBuffer(e)||te.isStream(e)||te.isFile(e)||te.isBlob(e)||te.isReadableStream(e))return e;if(te.isArrayBufferView(e))return e.buffer;if(te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ve(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Re(e,new Ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ke.isNode&&te.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=te.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ve(this,"env"),r=n&&n.FormData;return Re(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(te.isString(e))try{return(t||JSON.parse)(e),te.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ve(this,"transitional")||Qe.transitional,n=t&&t.forcedJSONParsing,r=Ve(this,"responseType"),o="json"===r;if(te.isResponse(e)||te.isReadableStream(e))return e;if(e&&te.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ve(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _e.from(e,_e.ERR_BAD_RESPONSE,this,null,Ve(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ke.classes.FormData,Blob:Ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(Je,e=>{Qe.headers[e]={}});const Ze=Qe;function et(e,t){const n=this||Ze,r=t||n,o=ye.from(r.headers);let i=r.data;return te.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function tt(e){return!(!e||!e.__CANCEL__)}const nt=class extends _e{constructor(e,t,n){super(e??"canceled",_e.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function rt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new _e("Request failed with status code "+n.status,n.status>=400&&n.status<500?_e.ERR_BAD_REQUEST:_e.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ot=/[\t\n\r]/g;function it(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(ot,"")}function st(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1].toLowerCase()||""}const at=e=>{try{return decodeURIComponent(e)}catch(t){return e}},ut=Ke.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];te.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),te.isString(r)&&a.push(`path=${r}`),te.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),te.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie;if(!t)return null;const n=t.split(";");for(let t=0;t<n.length;t++){const r=n[t].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)return at(r.slice(o+1))}return null},async readAsync(e){try{const t="undefined"!=typeof window&&window.cookieStore;if(t&&te.isFunction(t.get)){const n=await t.get(e);return n?at(n.value):null}}catch(e){}return this.read(e)},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,readAsync:async()=>null,remove(){}};const ct=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=r[s];o||(o=u),n[i]=a,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const lt=function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n),(...e)=>s(e)]},ft=(e,t,n=3)=>{let r=0;const o=ct(50,250);return lt(n=>{if(!n||!te.isNumber(n.loaded))return;const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=Math.max(0,null!=s?Math.min(i,s):i),u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:u,rate:c||void 0,estimated:c&&s?(s-a)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ht=(e,t=te.asap)=>(...n)=>t(()=>e(...n)),dt=Ke.hasStandardBrowserEnv?(e=>t=>(t=new URL(t,document.baseURI||Ke.origin),e.protocol===t.protocol&&e.host===t.host&&e.port===t.port))(new URL(Ke.origin)):()=>!0;const yt=/^https?:(?!\/\/)/i;function mt(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${me}@`),n=t.indexOf("#"),r=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${me}`);return-1===n?r:`${r}#${o=t.slice(n+1),o?o.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${me}`):o}`;var o}function bt(e,t){if("string"==typeof e){const n=it(e);if(yt.test(n))throw new _e(`Invalid URL ${JSON.stringify(mt(n))}: missing "//" after protocol`,_e.ERR_INVALID_URL,t)}}function 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 0===n?"/"+t.replace(/^[/\\\t\n\r]+/,""):e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const vt=e=>e instanceof ye?{...e}:e,wt=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>{const n=Object.getOwnPropertyDescriptor(e,t);return n&&n.enumerable})):Object.keys(e);function _t(e,t,n,r){return te.isPlainObject(e)&&te.isPlainObject(t)?te.merge.call({caseless:r},e,t):te.isPlainObject(t)?te.merge({},t):te.isArray(t)?t.slice():t}function Et(e,t,n,r){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e,0,r):_t(e,t,0,r)}function Ot(e,t){if(!te.isUndefined(t))return _t(void 0,t)}function St(e,t){return te.isUndefined(t)?te.isUndefined(e)?void 0:_t(void 0,e):_t(void 0,t)}function Tt(e,t,n,r,o){return te.hasOwnProp(o,n)?_t(e,t):te.hasOwnProp(r,n)?_t(void 0,e):void 0}const Rt=Object.freeze({__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0}),kt={url:Ot,method:Ot,data:Ot,baseURL:St,transformRequest:St,transformResponse:St,params:function(e,t){const n=[],r=new WeakMap,o={};function i(e,t){if(!te.isPlainObject(t))return te.isArray(t)?t.slice():t;const i=te.isPlainObject(e)?e:o;let s=r.get(t);if(s||(s=new WeakMap,r.set(t,s)),s.has(i))return s.get(i);const a={};return s.set(i,a),n.push({base:i,source:t,result:a}),a}const s=te.isUndefined(t)?i(void 0,e):i(e,t);for(;n.length;){const{base:e,source:t,result:r}=n.pop(),o=new Set(wt(e)),s=new Set(wt(t));new Set([...o,...s]).forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n)return;const a=s.has(n),u=a?t[n]:void 0,c=a&&!te.isPlainObject(u)||!o.has(n)?void 0:e[n];r[n]=a?i(c,u):i(void 0,c)})}return function(e){const t=[{value:e}],n=new WeakSet,r=new WeakSet;for(;t.length;){const{value:e,done:o}=t.pop();if(!te.isPlainObject(e)&&!te.isArray(e))continue;if(o){n.delete(e);continue}if(n.has(e))throw new _e("Circular reference detected in params",_e.ERR_BAD_OPTION_VALUE);if(r.has(e))continue;r.add(e),n.add(e),t.push({value:e,done:!0});const i=Object.keys(e);Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertySymbols(e).forEach(t=>{const n=Object.getOwnPropertyDescriptor(e,t);n&&n.enumerable&&i.push(t)}),i.forEach(n=>{if("__proto__"===n||"constructor"===n||"prototype"===n){const r=Object.getOwnPropertyDescriptor(e,n);r&&te.hasOwnProp(r,"value")&&t.push({value:r.value})}else t.push({value:e[n]})})}}(s),s},paramsSerializer:St,timeout:St,timeoutErrorMessage:St,withCredentials:St,withXSRFToken:St,adapter:St,responseType:St,xsrfCookieName:St,xsrfHeaderName:St,onUploadProgress:St,onDownloadProgress:St,decompress:St,maxContentLength:St,maxBodyLength:St,beforeRedirect:St,transport:St,httpAgent:St,httpsAgent:St,cancelToken:St,socketPath:St,allowedSocketPaths:St,responseEncoding:St,validateStatus:Tt,headers:function(e,t,n){return Et(vt(e),vt(t),0,!0)}};function Pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",Rt);const r=wt({...e,...t});for(let o=0,i=r.length;o<i;o++){const i=r[o];if("__proto__"===i||"constructor"===i||"prototype"===i)continue;const s=te.hasOwnProp(kt,i)?kt[i]:Et,a=te.hasOwnProp(e,i)?e[i]:void 0,u=te.hasOwnProp(t,i)?t[i]:void 0,c=s===Tt?s(a,u,i,e,t):s(a,u,i);te.isUndefined(c)&&s!==Tt||(n[i]=c)}return te.hasOwnProp(t,"validateStatus")&&te.isUndefined(t.validateStatus)&&!1===function(e,t,n){const r=te.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!te.isUndefined(r)){if(!te.isPlainObject(r))return;if(te.hasOwnProp(r,n))return r[n]}const o=te.hasOwnProp(e,"transitional")?e.transitional:void 0;if(te.isPlainObject(o)&&te.hasOwnProp(o,n))return o[n]}(e,t,"validateStatusUndefinedResolves")&&(te.hasOwnProp(e,"validateStatus")?n.validateStatus=_t(void 0,e.validateStatus):delete n.validateStatus),n}const At=["content-type","content-length"];const jt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Ct=e=>ut.read(e);const Nt=function(e,t=Ct){const n=Pt({},e),r=e=>te.hasOwnProp(n,e)?n[e]:void 0,o=r("data");let i=r("withXSRFToken");const s=r("xsrfHeaderName"),a=r("xsrfCookieName");let u=r("headers");const c=r("auth"),l=r("baseURL"),f=r("allowAbsoluteUrls"),p=r("url");if(n.headers=u=ye.from(u),n.url=Ne(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");Ke.hasStandardBrowserEnv||Ke.hasStandardBrowserWebWorkerEnv||te.isReactNative(o)?u.setContentType(void 0):te.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{At.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(u,e.call(o),r("formDataHeaderPolicy"))}if(Ke.hasStandardBrowserEnv){te.isFunction(i)&&(i=i(n));if(!0===i||null==i&&dt(n.url)){const e=s&&a&&t(a);e&&u.set(s,e)}}return n},Ut="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){let r,o;try{const e=Ke.hasStandardBrowserEnv&&"undefined"!=typeof window&&window.cookieStore;r=e&&te.isFunction(e.get)}catch(e){}const i=Nt(e,r?e=>(o=e,null):void 0);let s=i.data;const a=ye.from(i.headers).normalize();let u,c,l,f,p,h,d,{responseType:y,onUploadProgress:m,onDownloadProgress:b}=i;function g(){clearTimeout(c);try{p&&p()}catch(e){setTimeout(()=>{throw e})}try{h&&h()}catch(e){setTimeout(()=>{throw e})}v&&(f&&v.removeEventListener("progress",f),v.upload&&(l&&v.upload.removeEventListener("progress",l),p&&v.upload.removeEventListener("loadend",p))),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;function w(r){if(!v)return;if(!(0!==v.status||"file"===(st(it(i.url))||st(Ke.origin))||v.responseURL&&v.responseURL.startsWith("file:")))return n(new _e("Request aborted",_e.ECONNABORTED,e,v)),g(),void(v=null);try{r?d&&d(r):h&&h()}catch(e){setTimeout(()=>{throw e})}if(!v)return;const o=ye.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());rt(function(e){t(e),g()},function(e){n(e),g()},{data:y&&"text"!==y&&"json"!==y?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:o,config:e,request:v}),v=null}if(v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout,"onloadend"in v?v.onloadend=w:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&v.responseURL.startsWith("file:"))&&setTimeout(w)},v.onabort=function(){v&&(n(new _e("Request aborted",_e.ECONNABORTED,e,v)),g(),v=null)},v.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _e(r,_e.ERR_NETWORK,e,v);o.event=t||null,n(o),g(),v=null},v.ontimeout=function(){if(!v)return;let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||Fe;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new _e(t,r.clarifyTimeoutError?_e.ETIMEDOUT:_e.ECONNABORTED,e,v)),g(),v=null},void 0===s&&a.setContentType(null),te.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),y&&"json"!==y&&(v.responseType=i.responseType),b&&([f,h,d]=ft(b,!0),v.addEventListener("progress",f)),m&&v.upload&&([l,p]=ft(m),v.upload.addEventListener("progress",l),v.upload.addEventListener("loadend",p)),i.cancelToken||i.signal){if(u=t=>{if(!v)return;n(!t||t.type?new nt(null,e,v):t);const r=v;g(),v=null,r.abort()},i.cancelToken&&i.cancelToken.subscribe(u),!v)return;i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u))}if(!v)return;const _=st(i.url);if(_&&!Ke.protocols.includes(_))return n(new _e("Unsupported protocol "+_+":",_e.ERR_BAD_REQUEST,e)),void g();const E=()=>{v&&("setRequestHeader"in v&&te.forEach(se(a),function(e,t){v.setRequestHeader(t,e)}),v.send(s||null))};if(o){const t="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,r=v.timeout>0?t()+Number(v.timeout):void 0,s=()=>{if(!v)return;const e=v;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(v)if(void 0!==r&&t()>=r)s();else{if(e){const t=te.hasOwnProp(i,"xsrfHeaderName")&&i.xsrfHeaderName;a.set(t,e)}E()}}).catch(t=>{v&&(n(_e.from(t,null,e,v)),g(),v=null)})}else E()})},xt=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof _e?t:new nt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new _e(`timeout of ${t}ms exceeded`,_e.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{const t=te.getSafeProp(e,"unsubscribe");te.isFunction(t)?t.call(e,o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>{r||(e.aborted?o.call(e):e.addEventListener("abort",o,{once:!0}))});const{signal:a}=n;return a.unsubscribe=()=>te.asap(s),a},Dt=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Lt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Bt=(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 o.return().catch(()=>{}),a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Ft="\r\n",It=e=>String(e).replace(/\r\n|\r|\n/g,Ft),Ht=e=>String(e).replace(/[\r\n"]/g,e=>"\r"===e?"%0D":"\n"===e?"%0A":"%22"),qt=(e,t)=>{let n=0;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);!t||13!==o&&10!==o?o<128?n++:o<2048?n+=2:o>=55296&&o<=56319&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r++):n+=3:(13===o&&10===e.charCodeAt(r+1)&&r++,n+=2)}return n};class Mt extends TypeError{constructor(e,t){super(e),this.name="FormDataError",this.reason=t}}function zt(e,t,n,r,o){if(!te.isFunction(t))throw new _e("Blob is not supported",_e.ERR_NOT_SUPPORT);if(void 0===o)if(te.isFunction(Ke.generateString))o="axios-"+Ke.generateString(36,"0123456789abcdef");else{const e=te.global.crypto;if(!e||!te.isFunction(e.getRandomValues))throw new _e("Random byte generation is not supported",_e.ERR_NOT_SUPPORT);const t=new Uint8Array(18);e.getRandomValues(t),o="axios-"+Array.from(t,e=>("0"+e.toString(16)).slice(-2)).join("")}try{return function(e,t,n,r,o){if(!te.isFunction(t))throw new Mt("Blob is not supported","blob");if(!te.isString(o)||!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(o)||/ $/.test(o))throw new Mt("Invalid multipart boundary","boundary");const i="--"+o+"--"+Ft;let s=i.length;const a=[],u=e=>{if(s+e>n)throw r()};u(0);for(const[t,n]of e){const e=te.isString(n),r=e?qt(n,!0):n.size;if(!Number.isFinite(r)||r<0)throw new Mt("Unsupported FormData part size","part");u(r+qt(t,!0)+(!e&&n.name?qt(n.name,!1):0)+(!e&&n.type?qt(n.type,!1):0));let i="--"+o+'\r\nContent-Disposition: form-data; name="'+Ht(It(t))+'"';e||(i+='; filename="'+Ht(te.isString(n.name)?n.name:"blob")+'"\r\nContent-Type: '+String(n.type||"application/octet-stream").replace(/[\r\n]/g,"")),i+=Ft+Ft;const c=qt(i,!1)+r+2;u(c),s+=c,a.push({header:i,value:n,isString:e})}const c=[];for(const e of a)c.push(e.header,e.isString?It(e.value):e.value,Ft);return c.push(i),new t(c,{type:"multipart/form-data; boundary="+o})}(e,t,n,r,o)}catch(e){if(e instanceof Mt){const t="boundary"===e.reason?_e.ERR_BAD_OPTION_VALUE:_e.ERR_BAD_REQUEST;throw new _e(e.message,t)}throw e}}const Xt=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kt=(e,t,n)=>t+2<n&&Xt(e.charCodeAt(t+1))&&Xt(e.charCodeAt(t+2)),Wt=e=>e<=57?e-48:(223&e)-55,Yt=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Gt=e=>9===e||10===e||12===e||13===e||32===e,$t=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Jt=e=>{const t=e.length;let n=0,r=0,o=!1;for(let i=0;i<t;i++){let s=e.charCodeAt(i);37===s&&Kt(e,i,t)&&(s=16*Wt(e.charCodeAt(i+1))+Wt(e.charCodeAt(i+2)),i+=2),Gt(s)||(61!==s?!Yt(s)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?$t(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Vt=(e,t,n)=>{if(!e||"string"!=typeof e)return 0;if(!/^data:/i.test(e))return 0;const r=e.indexOf(",");if(r<0)return 0;const o=e.slice(5,r),i=e.slice(r+1);if(n.test(o))return t(i);let s=0;for(let e=0,t=i.length;e<t;e++){const n=i.charCodeAt(e);if(37===n&&Kt(i,e,t))s+=1,e+=2;else if(n<128)s+=1;else if(n<2048)s+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(s+=4,e++):s+=3}else s+=3}return s};const Qt={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Zt}=te,en=e=>{if(!te.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},tn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nn=e=>{try{if(null!==e&&("object"==typeof e||"function"==typeof e)){const t=e.then;Zt(t)&&t.call(e,void 0,te.noop)}}catch(e){}},rn=e=>{const t=void 0!==te.global&&null!==te.global?te.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=te.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response,Blob:t.Blob},e);const o=te.hasOwnProp(e,"fetch")?e.fetch:void 0,{Request:i,Response:s,Blob:a}=e,u=o?Zt(o):"function"==typeof fetch,c=Zt(i),l=Zt(s);if(!u)return!1;const f=u&&Zt(n),p=u&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const d=c&&f&&tn(()=>{let e=!1;const t=new i(Ke.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&nn(t.body.cancel()),e&&!r}),y=l&&f&&tn(()=>{const e=new s("").body;try{return te.isReadableStream(e)}finally{(e=>{if(null!=e)try{const t=e.cancel;Zt(t)&&nn(t.call(e))}catch(e){}})(e)}}),m=Object.assign(Object.create(null),Qt);c&&!tn(()=>new i(Ke.origin,m))&&(delete m.cache,tn(()=>new i(Ke.origin,m))||(m.cache=Qt.cache));const b={stream:y&&(e=>e.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!b[e]&&(b[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new _e(`Response type '${e}' is not supported`,_e.ERR_NOT_SUPPORT,n)})});const 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:v,onUploadProgress:w,responseType:_,headers:E,withCredentials:O="same-origin",fetchOptions:S,maxContentLength:T,maxBodyLength:R,maxRedirects:k}=Nt(e);const P=te.isNumber(T)&&T>-1,A=te.isNumber(R)&&R>-1,j=t=>te.hasOwnProp(e,t)?e[t]:void 0;let C=o||fetch;_=_?(_+"").toLowerCase():"text";let N=xt([l,p&&p.toAbortSignal()],h),U=null;const x=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let D,L=null,B=null;const F=()=>new _e("Request body larger than maxBodyLength limit",_e.ERR_BAD_REQUEST,e,U);try{let o;const l=j("auth");if(l){const e=te.getSafeProp(l,"username")||"";o={username:e,password:te.getSafeProp(l,"password")||""}}let p;if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){if(p=new URL(t,Ke.origin),!o&&(p.username||p.password)){const e=en(p.username);o={username:e,password:en(p.password)}}(p.username||p.password)&&(p.username="",p.password="",t=p.href)}if(o&&(E.delete("authorization"),E.set("Authorization","Basic "+btoa((I=(o.username||"")+":"+(o.password||""),encodeURIComponent(I).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),P&&p&&"data:"===p.protocol){const t=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Vt(-1===t?e:e.slice(0,t),Jt,/; *base64[\t\n\f\r ]*$/i)}(p.href);if(t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const h=te.isSpecCompliantForm(u)&&ye.from(j("headers")).getContentType();let H;if(te.isString(h)&&/^multipart\/form-data(?:\s*;|$)/i.test(h.trim())){const e=ye.parseParameters(h);te.hasOwnProp(e,"boundary")&&(H=e.boundary)}if(te.isSpecCompliantForm(u)&&"get"!==n&&"head"!==n&&(A||w&&d||void 0!==H)&&(u=zt(u,a,A?R:1/0,F,H),E.setContentType(void 0===H?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>R))throw F()}const q=A&&(te.isReadableStream(u)||te.isStream(u)),M=(e,t,n)=>Bt(e,65536,e=>{if(A&&e>R)throw L=F();t&&t(e)},n);if(d&&"get"!==n&&"head"!==n&&(w||q)){if(D=D??await(async(e,t)=>{const n=te.toFiniteNumber(e.getContentLength());return n??g(t)})(E,u),0!==D||q){let e,n=new i(t,{method:"POST",body:u,duplex:"half"});if(te.isFormData(u)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=w&&pt(D,ft(ht(w)))||[];u=M(n.body,e,t)}}}else if(q&&!c&&f&&"get"!==n&&"head"!==n)u=M(u);else if(q&&c&&!d&&"get"!==n&&"head"!==n)throw new _e("Stream request bodies are not supported by the current fetch implementation",_e.ERR_NOT_SUPPORT,e,U);te.isString(O)||(O=O?"include":"omit");const z=c&&"credentials"in i.prototype;if(te.isFormData(u)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/1.22.0",!1);const X=null==S?S:Object.assign(Object.create(null),S);X&&(delete X.body,delete X.headers,delete X.method,delete X.signal,delete X.duplex,delete X.credentials);const K=Object.assign(Object.create(null),X,{signal:N,method:n.toUpperCase(),headers:se(E.normalize()),body:u,duplex:"half",credentials:z?O:void 0});c&&(te.forEach(m,(e,t)=>{void 0===K[t]&&(K[t]=e)}),void 0===K.signal&&(K.signal=null),void 0===K.body&&(K.body=null)),0===k&&(K.redirect="manual",X&&(X.redirect="manual")),U=c&&new i(t,K);let W=await(c?C(U,X):C(t,K));const Y=ye.from(W.headers);if(P){const t=te.toFiniteNumber(Y.getContentLength());if(null!=t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}const G=y&&("stream"===_||"response"===_);if(y&&W.body&&(v||P||G&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=W[e]});const n=te.toFiniteNumber(Y.getContentLength()),[r,o]=v&&pt(n,ft(ht(v),!0))||[];let i=0;const a=t=>{if(P&&(i=t,i>T))throw B=new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U);r&&r(t)};W=new s(Bt(W.body,65536,a,()=>{o&&o(),x&&x()}),t)}_=_||"text";let $=await b[te.findKey(b,_)||"text"](W,e);if(P&&!y&&!G){let t;if(null!=$&&("number"==typeof $.byteLength?t=$.byteLength:"number"==typeof $.size?t=$.size:"string"==typeof $&&(t="function"==typeof r?(new r).encode($).byteLength:$.length)),"number"==typeof t&&t>T)throw new _e("maxContentLength size of "+T+" exceeded",_e.ERR_BAD_RESPONSE,e,U)}return!G&&x&&x(),await new Promise((t,n)=>{rt(t,n,{data:$,headers:ye.from(W.headers),status:W.status,statusText:W.statusText,config:e,request:U})})}catch(t){if(x&&x(),N&&N.aborted&&N.reason instanceof _e){const n=N.reason;throw n.config=e,U&&(n.request=U),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(L)throw U&&!L.request&&(L.request=U),L;if(B)throw B;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}},on=new Map,sn=new WeakSet,an=e=>{const t=rn(e);return t&&sn.add(t),t},un=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=on;for(;l--;)u=a[l],c=f.get(u),void 0===c&&f.set(u,c=l?new Map:an(t)),f=c;return c},cn=(un(),{http:null,xhr:Ut,fetch:{get:un}});te.forEach(cn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const ln=e=>`- ${e}`,fn=e=>te.isFunction(e)||null===e||!1===e;const pn={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,!fn(r)&&(o=cn[(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(ln).join("\n"):" "+ln(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},isBuiltinAdapter:function(e){return!!e&&(e===cn.xhr||e===cn.http||(e=>sn.has(e))(e))},adapters:cn};function hn(e,t){const n=te.getSafeProp(e,"url");if(null!=n)return;if(te.getSafeProp(e,"baseURL"))return;const r=t(),o=pn.adapters.http;if((!o||r!==o||!te.getSafeProp(e,"socketPath"))&&pn.isBuiltinAdapter(r))throw new _e(`Invalid URL: url cannot be ${null===n?"null":"undefined"} when baseURL is not set`,_e.ERR_INVALID_URL,e)}function dn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nt(null,e)}function yn(e,t){return Math.max(0,Math.round(e()-t))}function mn(e){const t=te.toSafeFlatObject(e);dn(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=pn.getAdapter(t.adapter||Ze.adapter,t);hn(t,()=>n);const r="undefined"!=typeof performance&&te.isFunction(performance.now)?()=>performance.now():Date.now,o=r();return n(t).then(function(e){dn(t),e.duration=yn(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)&&(dn(t),e&&e.response)){e.response.duration=yn(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 bn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{bn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const gn={};bn.transitional=function(e,t,n){function r(e,t){return"[Axios v1.22.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&&!gn[o]&&(gn[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)}},bn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const vn={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:bn},wn=vn.validators,_n=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 En{constructor(e){this.defaults=e||{},this.interceptors={request:new Be,response:new Be}}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,ve)&&e[ve];return n&&t.endsWith(n)?t.length-n.length:-1}(e,i),a=-1===s?i:i.slice(0,s),u=-1===s?"":i.slice(s);a.endsWith(o)||(e.stack=a+"\n"+r+u)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Pt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&vn.assertOptions(n,{silentJSONParsing:wn.transitional(wn.boolean),forcedJSONParsing:wn.transitional(wn.boolean),clarifyTimeoutError:wn.transitional(wn.boolean),legacyInterceptorReqResOrdering:wn.transitional(wn.boolean),advertiseZstdAcceptEncoding:wn.transitional(wn.boolean),validateStatusUndefinedResolves:wn.transitional(wn.boolean),encodeBasicAuthUsername:wn.transitional(wn.boolean)},!1),null!=r&&(te.isFunction(r)?t.paramsSerializer={serialize:r}:vn.assertOptions(r,{encode:wn.function,serialize:wn.function},!0)),void 0!==t.allowAbsoluteUrls||(te.hasOwnProp(this.defaults,"allowAbsoluteUrls")&&void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),vn.assertOptions(t,{baseUrl:wn.spelling("baseURL"),withXsrfToken:wn.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(_n(i)?i:void 0,_n(s)?s:void 0);o&&te.forEach(Je.concat("common"),e=>{_n(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||Fe;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=[mn.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(()=>mn.call(this,d)))}catch(e){f=Promise.reject(e)}break}}if(!f)try{f=mn.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){hn(e=Pt(this.defaults,e),()=>pn.getAdapter(e.adapter||Ze.adapter,e));return Ne(gt(e.baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}te.forEach(["delete","get","head","options"],function(e){En.prototype[e]=async function(t,n){return this.request(Pt(n||{},{method:e,url:t,data:n&&te.hasOwnProp(n,"data")?n.data:void 0}))}}),te.forEach(["post","put","patch","query"],function(e){function t(t){return async function(n,r,o){return this.request(Pt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}En.prototype[e]=t(),"query"!==e&&(En.prototype[e+"Form"]=t(!0))});const On=En;class Sn{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 Sn(function(t){e=t}),cancel:e}}}const Tn=Sn;const Rn={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(Rn).forEach(([e,t])=>{void 0===Rn[t]&&(Rn[t]=e)});const kn=Rn;const Pn=function e(t){const n=new On(t),r=o(On.prototype.request,n);return te.extend(r,On.prototype,n,{allOwnKeys:!0}),te.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Pt(t,n))},r}(Ze);Pn.Axios=On,Pn.CanceledError=nt,Pn.CancelToken=Tn,Pn.isCancel=tt,Pn.VERSION="1.22.0",Pn.toFormData=Re,Pn.AxiosError=_e,Pn.Cancel=Pn.CanceledError,Pn.all=function(e){return Promise.all(e)},Pn.spread=function(e){return function(t){return e.apply(null,t)}},Pn.isAxiosError=function(e){return te.isObject(e)&&!0===e.isAxiosError},Pn.mergeConfig=Pt,Pn.AxiosHeaders=ye,Pn.formToJSON=e=>$e(te.isHTMLForm(e)?new FormData(e):e),Pn.getAdapter=pn.getAdapter,Pn.HttpStatusCode=kn,Pn.default=Pn;const An=Pn;function jn(e){return jn="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},jn(e)}function Cn(){/*! 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 Nn(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]())):(Nn(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,Nn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Nn(f,"constructor",c),Nn(c,"constructor",u),u.displayName="GeneratorFunction",Nn(c,o,"GeneratorFunction"),Nn(f),Nn(f,o,"Generator"),Nn(f,r,function(){return this}),Nn(f,"toString",function(){return"[object Generator]"}),(Cn=function(){return{w:i,m:p}})()}function Nn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Nn=function(e,t,n,r){function i(t,n){Nn(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))},Nn(e,t,n,r)}function Un(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 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,Dn(r.key),r)}}function Dn(e){var t=function(e,t){if("object"!=jn(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"!=jn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==jn(t)?t:t+""}var Ln=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._token=e._validate(t)},t=[{key:"getAccessToken",value:(r=Cn().m(function e(){return Cn().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){Un(i,n,o,s,a,"next",e)}function a(e){Un(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&&xn(e.prototype,t),n&&xn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o}();function Bn(e){return Bn="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},Bn(e)}function Fn(){/*! 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 In(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]())):(In(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,In(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,In(f,"constructor",c),In(c,"constructor",u),u.displayName="GeneratorFunction",In(c,o,"GeneratorFunction"),In(f),In(f,o,"Generator"),In(f,r,function(){return this}),In(f,"toString",function(){return"[object Generator]"}),(Fn=function(){return{w:i,m:p}})()}function In(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}In=function(e,t,n,r){function i(t,n){In(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))},In(e,t,n,r)}function Hn(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){Hn(i,r,o,s,a,"next",e)}function a(e){Hn(i,r,o,s,a,"throw",e)}s(void 0)})}}function Mn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,zn(r.key),r)}}function zn(e){var t=function(e,t){if("object"!=Bn(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"!=Bn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Bn(t)?t:t+""}var Xn=new Set(["127.0.0.1","localhost","::1","[::1]"]);var Kn=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&&Xn.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||An.create({timeout:3e4}),this._inflightRefresh=null,this._expiresAtMs=0,this._lifetimeMs=0,this._setExpiry(u)},t=[{key:"getAccessToken",value:(s=qn(Fn().m(function e(){return Fn().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=qn(Fn().m(function e(t){return Fn().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=qn(Fn().m(function e(){var t=this;return Fn().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=qn(Fn().m(function e(){var t,n,r,o,i;return Fn().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"===Bn(n.data)?n.data:{}).error){e.n=6;break}throw this.clear(),new Error("token refresh rejected by the server (invalid_grant)");case 6:if(!(r<200||r>=300||o.error)){e.n=7;break}throw new Error("token refresh failed with status ".concat(r).concat(o.error?": ".concat(o.error):""));case 7:if("string"==typeof o.access_token&&o.access_token){e.n=8;break}throw new Error("token refresh response did not include an access_token");case 8:this._accessToken=o.access_token,"string"==typeof o.refresh_token&&o.refresh_token&&(this._refreshToken=o.refresh_token),this._setExpiry(o.expires_in);case 9:return e.a(2)}},e,this,[[2,4]])})),function(){return r.apply(this,arguments)})}],t&&Mn(e.prototype,t),n&&Mn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i,s}();function Wn(e){return Wn="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},Wn(e)}function Yn(e){var t=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==t||t===("undefined"!=typeof Symbol&&[][Symbol.iterator])||t===[]["@@iterator"]))return e;if(null!=t){for(var n,r=[],o=t.call(e);!(n=o.next()).done;)r.push(n.value);return r}}(e);return t===e?Jn(e):t||$n(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,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||$n(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 $n(e,t){if(e){if("string"==typeof e)return Jn(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)?Jn(e,t):void 0}}function Jn(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 Vn(){/*! 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 Qn(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]())):(Qn(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,Qn(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Qn(f,"constructor",c),Qn(c,"constructor",u),u.displayName="GeneratorFunction",Qn(c,o,"GeneratorFunction"),Qn(f),Qn(f,o,"Generator"),Qn(f,r,function(){return this}),Qn(f,"toString",function(){return"[object Generator]"}),(Vn=function(){return{w:i,m:p}})()}function Qn(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Qn=function(e,t,n,r){function i(t,n){Qn(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))},Qn(e,t,n,r)}function Zn(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 er(e){var t=function(e,t){if("object"!=Wn(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"!=Wn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Wn(t)?t:t+""}function tr(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 nr(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){tr(i,r,o,s,a,"next",e)}function a(e){tr(i,r,o,s,a,"throw",e)}s(void 0)})}}var rr=null;function or(){return ir.apply(this,arguments)}function ir(){return(ir=nr(Vn().m(function e(){var t;return Vn().w(function(e){for(;;)switch(e.n){case 0:if(!rr){e.n=1;break}return e.a(2,rr);case 1:return e.n=2,import("node:crypto");case 2:return t=e.v,rr=t.default&&t.default.createHmac?t.default:t,e.a(2,rr)}},e)}))).apply(this,arguments)}var sr=new Set(["/appmesh/file/download","/appmesh/file/upload","/appmesh/file/delete"]),ar=/^\/appmesh\/app\/[^/]+\/(output|task)\/stream$/,ur=Object.freeze({KEY_ID:"X-Request-Key",TIMESTAMP:"X-Timestamp",NONCE:"X-Nonce",SIGNATURE:"X-Signature"});function cr(e){if("string"!=typeof e)return!1;var t=lr(e);return sr.has(t)||ar.test(t)}function lr(e){return"/appmesh/file/download/ws"===e?"/appmesh/file/download":"/appmesh/file/upload/ws"===e?"/appmesh/file/upload":e}var fr=function(){return e=function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"string"!=typeof t||""===t.trim())throw new TypeError("keyId must be a non-empty string");if("string"!=typeof n||""===n)throw new TypeError("secret must be a non-empty string");Object.defineProperty(this,"_keyId",{value:t,writable:!0}),Object.defineProperty(this,"_secret",{value:n,writable:!0})},t=[{key:"keyId",get:function(){return this._keyId}},{key:"attach",value:(i=nr(Vn().m(function e(t,n,r,o,i,s,a){var u,c,l,f,p,h,d,y,m,b,g;return Vn().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=lr(r),h=pr,d=n,y=l,m=o,e.n=3,hr(l,i);case 3:return f=h(d,y,m,e.v,u,c),t[ur.KEY_ID]=this._keyId,t[ur.TIMESTAMP]=u,t[ur.NONCE]=c,b=t,g=ur.SIGNATURE,e.n=4,this.sign(f);case 4:b[g]=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=nr(Vn().m(function e(){var t;return Vn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,or();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=nr(Vn().m(function e(t){var n;return Vn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,or();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&&Zn(e.prototype,t),n&&Zn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,o,i}();function pr(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 hr(e,t){return dr.apply(this,arguments)}function dr(){return(dr=nr(Vn().m(function e(t,n){var r,o;return Vn().w(function(e){for(;;)switch(e.n){case 0:return r=null==n||cr(t)?Buffer.alloc(0):Buffer.from(n),e.n=1,or();case 1:return o=e.v,e.a(2,o.createHash("sha256").update(r).digest("hex"))}},e)}))).apply(this,arguments)}function yr(e){if(!e)return"";for(var t=Object.create(null),n=0;n<e.length;){var r=e.indexOf("&",n),o=r<0?e.slice(n):e.slice(n,r),i=o.indexOf("="),s=i<0?o:o.slice(0,i),a=i<0?"":o.slice(i+1),u=mr(s);if(Object.prototype.hasOwnProperty.call(t,u)||(t[u]=mr(a)),r<0)break;n=r+1}var c=Object.entries(t);return c.sort(function(e,t){var n=Buffer.compare(Buffer.from(e[0],"utf8"),Buffer.from(t[0],"utf8"));return 0!==n?n:Buffer.compare(Buffer.from(e[1],"utf8"),Buffer.from(t[1],"utf8"))}),c.map(function(e){var t=Gn(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)}).join("&")}function mr(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,Yn(a))}}return Buffer.from(t).toString("utf8")}function br(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 gr(e){return gr="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},gr(e)}function vr(e,t){return function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(Array.isArray(e)&&(null==n||n===("undefined"!=typeof Symbol&&[][Symbol.iterator])||n===[]["@@iterator"]))return e;if(null!=n){var r,o,i,s,a=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||Pr(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 wr(){/*! 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 _r(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]())):(_r(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,_r(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,_r(f,"constructor",c),_r(c,"constructor",u),u.displayName="GeneratorFunction",_r(c,o,"GeneratorFunction"),_r(f),_r(f,o,"Generator"),_r(f,r,function(){return this}),_r(f,"toString",function(){return"[object Generator]"}),(wr=function(){return{w:i,m:p}})()}function _r(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}_r=function(e,t,n,r){function i(t,n){_r(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))},_r(e,t,n,r)}function Er(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 Or(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(n),!0).forEach(function(t){Sr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Sr(e,t,n){return(t=Nr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tr(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 Rr(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){Tr(i,r,o,s,a,"next",e)}function a(e){Tr(i,r,o,s,a,"throw",e)}s(void 0)})}}function kr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Pr(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function Pr(e,t){if(e){if("string"==typeof e)return Ar(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)?Ar(e,t):void 0}}function Ar(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 jr(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,Nr(r.key),r)}}function Cr(e,t,n){return t&&jr(e.prototype,t),n&&jr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nr(e){var t=function(e,t){if("object"!=gr(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"!=gr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==gr(t)?t:t+""}function Ur(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xr(e,t,n){return t=Ir(t),function(e,t){if(t&&("object"==gr(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,Br()?Reflect.construct(t,n||[],Ir(e).constructor):t.apply(e,n))}function Dr(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&&Fr(e,t)}function Lr(e){var t="function"==typeof Map?new Map:void 0;return Lr=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(Br())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Fr(o,n.prototype),o}(e,arguments,Ir(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Fr(n,e)},Lr(e)}function Br(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Br=function(){return!!e})()}function Fr(e,t){return Fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fr(e,t)}function Ir(e){return Ir=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ir(e)}function Hr(e){return new zr(e,0)}function qr(e){return function(){return new Mr(e.apply(this,arguments))}}function Mr(e){var t,n;function r(t,n){try{var i=e[t](n),s=i.value,a=s instanceof zr;Promise.resolve(a?s.v:s).then(function(n){if(a){var u="return"===t&&s.k?t:"next";if(!s.k||n.done)return r(u,n);n=e[u](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,s){var a={key:e,arg:o,resolve:i,reject:s,next:null};n?n=n.next=a:(t=n=a,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function zr(e,t){this.v=e,this.k=t}function Xr(e){var t,n,r,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new Kr(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Kr(e){function t(e,t){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var r,o=e.done,i=e.value;try{r=Promise.resolve(i)}catch(e){if(t&&!o)try{n(t)}catch(e){}return Promise.reject(e)}return r.then(function(e){return{value:e,done:o}},t&&!o?function(e){try{n(t)}catch(e){}throw e}:void 0)}function n(e){var t=e.return;null!=t&&t.call(e)}return Kr=function(e){this.s=e,this.n=e.next},Kr.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments),this.s)},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(){var e=this.s,r=e.throw;return void 0===r?new Promise(function(t,r){n(e),r(new TypeError("The iterator does not provide a 'throw' method"))}):t(r.apply(e,arguments),e)}},new Kr(e)}Mr.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Mr.prototype.next=function(e){return this._invoke("next",e)},Mr.prototype.throw=function(e){return this._invoke("throw",e)},Mr.prototype.return=function(e){return this._invoke("return",e)};var Wr=null,Yr=null,Gr=null,$r=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",SYNC_RUN_OUTPUT_PAGE_BYTES:5242880,SYNC_RUN_TRUNCATED_RETENTION_SECONDS:600,HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path",HTTP_HEADER_KEY_X_FILE_OVERWRITE:"X-File-Overwrite",HTTP_HEADER_KEY_X_FILE_MODE:"X-File-Mode",HTTP_HEADER_KEY_X_FILE_USER:"X-File-User",HTTP_HEADER_KEY_X_FILE_GROUP:"X-File-Group",HTTP_HEADER_KEY_X_OUTPUT_POSITION:"X-Output-Position",HTTP_HEADER_KEY_X_EXIT_CODE:"X-Exit-Code",HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED:"X-Output-Truncated",HTTP_HEADER_KEY_X_APP_NAME:"X-App-Name",HTTP_HEADER_KEY_X_INPUT_CLOSE:"X-Input-Close",HTTP_HEADER_KEY_X_SUBSCRIPTION_ID:"X-Subscription-Id",HTTP_HEADER_KEY_X_APPMESH_PROCESS_KEY:"X-AppMesh-Process-Key"}),Jr=Object.freeze({isNode:!("undefined"!=typeof window&&"undefined"!==window.document)}),Vr=/^([a-z][a-z\d+\-.]*:)?\/\//i;function Qr(e,t){var n=String(e||""),r=String(t||""),o=r;if(n&&!Vr.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 Zr=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 Ur(this,e),(n=xr(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=i,n.timestamp=(new Date).toISOString(),n}return Dr(e,Lr(Error)),Cr(e)}(),eo=function(){function e(t){var n;return Ur(this,e),(n=xr(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Dr(e,Zr),Cr(e)}(),to=function(){function e(t){var n;return Ur(this,e),(n=xr(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Dr(e,Zr),Cr(e)}(),no=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Ur(this,e),(n=xr(this,e,[t,r,null,"REQUEST"])).name="AppMeshRequestError",n}return Dr(e,Zr),Cr(e)}(),ro=function(){function e(t){var n;return Ur(this,e),(n=xr(this,e,[t,null,null,"TIMEOUT"])).name="AppMeshTimeoutError",n}return Dr(e,Zr),Cr(e)}(),oo=function(e,t){Jr.isNode?process.stdout.write(e):console.log(e)};function io(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 so(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?new Uint8Array(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):(new TextEncoder).encode(null==e?"":String(e))}function ao(e){if("undefined"!=typeof Buffer)return Buffer.concat(e.map(function(e){return Buffer.isBuffer(e)?e:Buffer.from(e.buffer,e.byteOffset,e.byteLength)}));var t,n=0,r=kr(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.byteLength}}catch(e){r.e(e)}finally{r.f()}var o,i=new Uint8Array(n),s=0,a=kr(e);try{for(a.s();!(o=a.n()).done;){var u=o.value;i.set(u,s),s+=u.byteLength}}catch(e){a.e(e)}finally{a.f()}return i}function uo(e){return fo(e.headers,"content-type")||(null==e.contentType?void 0:e.contentType)}function co(e){var t=/charset\s*=\s*"?([\w!#$%&*+\-.^`|~]+)"?/i.exec(String(e||""));return t?t[1]:null}function lo(e,t){for(var n=0,r=[t,"utf-8"];n<r.length;n++){var o=r[n];if(o)try{return new TextDecoder(o).decode(e)}catch(e){}}return new TextDecoder("utf-8").decode(e)}function fo(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 po(e,t,n){if("string"!=typeof e||""===e)return e;if(!String(fo(t,"content-type")||"").toLowerCase().includes("json"))return e;try{return JSON.parse(e)}catch(t){throw new Zr("Response body is not valid JSON: ".concat(t.message),null!=n?n:null,e,"JSON_PARSE")}}function ho(e){return yo.apply(this,arguments)}function yo(){return(yo=Rr(wr().m(function e(t){var r,o,i,s;return wr().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 mo(e){return bo.apply(this,arguments)}function bo(){return(bo=Rr(wr().m(function e(t){var n,r;return wr().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,go("name",t);case 2:return r=e.v,e.a(2,r?r.gid:null)}},e)}))).apply(this,arguments)}function go(e,t){return vo.apply(this,arguments)}function vo(){return(vo=Rr(wr().m(function e(t,r){var o,i,s,a,u,c,l,f,p,h,d;return wr().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 wo(e){return _o.apply(this,arguments)}function _o(){return(_o=Rr(wr().m(function e(t){var r,o,i,s;return wr().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 Eo(e){return Oo.apply(this,arguments)}function Oo(){return(Oo=Rr(wr().m(function e(t){var n;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,go("gid",t);case 1:return n=e.v,e.a(2,n?n.name:null)}},e)}))).apply(this,arguments)}var So="/opt/appmesh/ssl/ca.pem";function To(e){return null==e||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)}function Ro(e){if(!e)return null;var t="function"==typeof e.get?e.get($r.HTTP_HEADER_KEY_AUTH):e[$r.HTTP_HEADER_KEY_AUTH]||e.authorization;return"string"==typeof t&&t.startsWith("Bearer ")?t.slice(7):null}function ko(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:Yr.readFileSync(e)}function Po(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return Yr.existsSync(So)?{ca:Yr.readFileSync(So),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=Or({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=ko(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var Ao=Cr(function e(t){var n,r,o,i,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ur(this,e),this.reason=t,this.exitCode=null!==(n=a.exitCode)&&void 0!==n?n:null,this.position=null!==(r=a.position)&&void 0!==r?r:null,this.status=null!==(o=a.status)&&void 0!==o?o:null,this.message=null!==(i=a.message)&&void 0!==i?i:null,this.result=null!==(s=a.result)&&void 0!==s?s:null});function jo(e){return Co.apply(this,arguments)}function Co(){return(Co=qr(wr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:n=new TextDecoder("utf-8"),r="",o="message",i=[],s=!1,a=!1,e.p=1,c=Xr(t);case 2:return e.n=3,Hr(c.next());case 3:if(!(s=!(l=e.v).done)){e.n=12;break}f=l.value,r+="string"==typeof f?f:n.decode(f,{stream:!0}),p=void 0;case 4:if(!((p=r.indexOf("\n"))>=0)){e.n=11;break}if(h=r.slice(0,p).replace(/\r$/,""),r=r.slice(p+1),""!==h){e.n=9;break}if(!("message"!==o||i.length>0)){e.n=8;break}if(d=i.join("\n"),y={},!d){e.n=7;break}e.p=5,y=JSON.parse(d),e.n=7;break;case 6:throw e.p=6,m=e.v,new Zr("malformed SSE frame (".concat(o,"): ").concat(m.message));case 7:return e.n=8,[o,y];case 8:o="message",i=[],e.n=10;break;case 9:h.startsWith(":")||(h.startsWith("event:")?o=h.slice(6).trim():h.startsWith("data:")&&i.push(h.slice(5).trimStart()));case 10:e.n=4;break;case 11:s=!1,e.n=2;break;case 12:e.n=14;break;case 13:e.p=13,b=e.v,a=!0,u=b;case 14:if(e.p=14,e.p=15,!s||null==c.return){e.n=16;break}return e.n=16,Hr(c.return());case 16:if(e.p=16,!a){e.n=17;break}throw u;case 17:return e.f(16);case 18:return e.f(14);case 19:return e.a(2)}},e,null,[[15,,16,18],[5,6],[1,13,14,19]])}))).apply(this,arguments)}function No(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Ao(String(null!==(t=e.reason)&&void 0!==t?t:"closed"),Or({exitCode:e.exit_code,position:e.position,status:e.status,message:e.message},n))}function Uo(e){var t;if("error"===e.reason)throw new no(e.message||"stream failed with an error",null!==(t=e.status)&&void 0!==t?t:null);if("timeout"===e.reason)throw new ro(e.message||"stream timed out");if(!["exit","removed","eof","final","disconnected","closed"].includes(e.reason))throw new Zr("stream ended with unknown reason: ".concat(e.reason))}var xo=function(){return Cr(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Jr.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;Ur(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:[po]};this._sslConfig=o,this._client=An.create(s),Jr.isNode&&!Gr&&(Gr=Promise.all([n.e(453).then(()=>n.t(453,19)),n.e(603).then(()=>n.t(603,19))]).then(function(e){var t=vr(e,2),n=t[0],r=t[1];Wr=n.default||n,Yr=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(){var e=Rr(wr().m(function e(n){var r,o,i;return wr().w(function(e){for(;;)switch(e.n){case 0:return r=n,o=Or,i=Or({},n.headers),e.n=1,t._commonHeaders();case 1:return r.headers=o(i,e.v),e.a(2,n)}},e)}));return function(t){return e.apply(this,arguments)}}(),function(e){var t=new Zr("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 Zr)return Promise.reject(e);var i=new Zr("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 Ln(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 fr(e,t)}},{key:"disableRequestSignature",value:function(){this._requestSigner=null}},{key:"isRequestSignatureEnabled",value:function(){return null!==this._requestSigner}},{key:"_applyRequestSignature",value:(Y=Rr(wr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h;return wr().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=Qr(t.baseURL||this._client.defaults.baseURL||this.baseURL,t.url),o="",t.params&&"object"===gr(t.params)&&Object.keys(t.params).length>0&&(t.paramsSerializer=br,o=yr(br(t.params))),i=this._headerValue(t.headers,"content-type"),s=cr(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=vr(l[c],2),p=f[0],h=f[1],t.headers&&"function"==typeof t.headers.set?t.headers.set(p,h):t.headers=Or(Or({},t.headers),{},Sr({},p,h));case 3:return e.a(2)}},e,this)})),function(e){return Y.apply(this,arguments)})},{key:"_headerValue",value:function(e,t){if(e){if("function"==typeof e.get)return e.get(t);var n=Object.keys(e).find(function(e){return e.toLowerCase()===t.toLowerCase()});return void 0===n?void 0:e[n]}}},{key:"_wireBodyBytes",value:function(e,t){if(null==e)return Buffer.alloc(0);if("string"==typeof e){if(String(t||"").toLowerCase().includes("application/json"))try{return JSON.parse(e),Buffer.from(e.trim(),"utf8")}catch(t){if("SyntaxError"!==t.name)throw t;return Buffer.from(JSON.stringify(e),"utf8")}return Buffer.from(e,"utf8")}if(Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer)return Buffer.from(e);if("object"===gr(e))return Buffer.from(JSON.stringify(e),"utf8");throw new Zr("cannot sign a streaming request body; only the /appmesh/file/* endpoints accept unbound bodies")}},{key:"_getAccessToken",value:(W=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:if(!this._tokenProvider){e.n=2;break}return e.n=1,this._tokenProvider.getAccessToken();case 1:t=e.v,e.n=3;break;case 2:t=null;case 3:return e.a(2,t)}},e,this)})),function(){return W.apply(this,arguments)})},{key:"_handleUnauthorizedRetry",value:(K=Rr(wr().m(function e(t){var n,r,o,i,s,a,u,c,l,f;return wr().w(function(e){for(;;)switch(e.n){case 0:if(r=t.config||{},o=this._tokenProvider,401===t.status&&!r.__appmeshRetried&&o){e.n=1;break}return e.a(2,t);case 1:if("function"!=typeof o.canRefresh){e.n=3;break}return e.n=2,o.canRefresh();case 2:l=e.v,e.n=4;break;case 3:l=!!o.canRefresh;case 4:if(l&&"function"==typeof o.refreshAccessToken&&To(r.data)){e.n=5;break}return e.a(2,t);case 5:if(!this._requestSigner){e.n=6;break}if(i=t.headers||{},(s="function"==typeof i.get?i.get("WWW-Authenticate"):i["WWW-Authenticate"]||i["www-authenticate"])&&s.includes("invalid_token")){e.n=6;break}return e.a(2,t);case 6:if(null===(n=Ro(r.headers))||void 0===n){e.n=7;break}f=n,e.n=9;break;case 7:return e.n=8,this._getAccessToken();case 8:f=e.v;case 9:return a=f,e.n=10,o.refreshAccessToken(a);case 10:if("string"==typeof(u=e.v)&&u.trim()){e.n=11;break}return e.a(2,t);case 11:if(r.__appmeshRetried=!0,c="Bearer ".concat(u.trim()),r.headers&&"function"==typeof r.headers.set?r.headers.set($r.HTTP_HEADER_KEY_AUTH,c):r.headers=Or(Or({},r.headers),{},Sr({},$r.HTTP_HEADER_KEY_AUTH,c)),!this._requestSigner){e.n=12;break}return e.n=12,this._applyRequestSignature(r);case 12:return e.a(2,this._client(r))}},e,this)})),function(e){return K.apply(this,arguments)})},{key:"getAuthConfig",value:(X=Rr(wr().m(function e(){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/auth/config");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return X.apply(this,arguments)})},{key:"getCurrentPrincipal",value:(z=Rr(wr().m(function e(){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self");case 1:return e.a(2,e.v.data)}},e,this)})),function(){return z.apply(this,arguments)})},{key:"listApps",value:(M=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return M.apply(this,arguments)})},{key:"getApp",value:(q=Rr(wr().m(function e(t){var n;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return q.apply(this,arguments)})},{key:"checkAppHealth",value:(H=Rr(wr().m(function e(t){var n;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/app/".concat(t,"/health"));case 1:return n=e.v,e.a(2,0===parseInt(n.data,10))}},e,this)})),function(e){return H.apply(this,arguments)})},{key:"addApp",value:(I=Rr(wr().m(function e(t,n){var r;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/app/".concat(t),n);case 1:return r=e.v,e.a(2,r.data)}},e,this)})),function(e,t){return I.apply(this,arguments)})},{key:"deleteApp",value:(F=Rr(wr().m(function e(t){var n,r;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("delete","/appmesh/app/".concat(t));case 1:return n=e.v,e.a(2,200===n.status);case 2:if(e.p=2,404!==(r=e.v).statusCode){e.n=3;break}return e.a(2,!1);case 3:throw r;case 4:return e.a(2)}},e,this,[[0,2]])})),function(e){return F.apply(this,arguments)})},{key:"enableApp",value:(B=Rr(wr().m(function e(t){return wr().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 B.apply(this,arguments)})},{key:"disableApp",value:(L=Rr(wr().m(function e(t){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return L.apply(this,arguments)})},{key:"getAppOutput",value:(D=Rr(wr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p=arguments;return wr().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:io(i).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:s});case 1:return a=e.v,u=fo(a.headers,$r.HTTP_HEADER_KEY_X_OUTPUT_POSITION),c=fo(a.headers,$r.HTTP_HEADER_KEY_X_EXIT_CODE),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new Do(a.status,a.data,l,f))}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"runAppSync",value:(x=Rr(wr().m(function e(t){var n,r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:return n=y.length>1&&void 0!==y[1]?y[1]:oo,r=y.length>2&&void 0!==y[2]?y[2]:$r.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=y.length>3&&void 0!==y[3]?y[3]:$r.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,i=y.length>4&&void 0!==y[4]?y[4]:null,s={timeout:io(r),lifecycle:io(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:s,config:{responseType:"arraybuffer"}});case 1:if(a=e.v,u=null,200!==a.status){e.n=3;break}if((c=fo(a.headers,$r.HTTP_HEADER_KEY_X_EXIT_CODE))&&(u=parseInt(c,10)),l=fo(a.headers,$r.HTTP_HEADER_KEY_X_APP_NAME),f=fo(a.headers,$r.HTTP_HEADER_KEY_X_OUTPUT_TRUNCATED),!l||"1"!==String(f)){e.n=3;break}return p=fo(a.headers,$r.HTTP_HEADER_KEY_X_OUTPUT_POSITION),e.n=2,this._readTruncatedRunOutput(a,l,i,p?parseInt(p,10):NaN);case 2:return h=e.v,n&&n(h,0),e.a(2,u);case 3:if(d=so(a.data),!(null!=i&&d.byteLength>i)){e.n=4;break}throw new no("run output exceeds maxOutputBytes=".concat(i," (").concat(d.byteLength," bytes)"),a.status);case 4:return n&&n(lo(d,co(uo(a))),0),e.a(2,u)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"_readTruncatedRunOutput",value:(U=Rr(wr().m(function e(t,n,r,o){var i,s,a,u,c,l;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:i=[so(t.data)],Number.isFinite(o)||(o=i[0].byteLength),(s=function(){var e=i.reduce(function(e,t){return e+t.byteLength},0);if(null!=r&&e>r)throw new no("run output exceeds maxOutputBytes=".concat(r,"; the rest stays readable on application ")+"'".concat(n,"' for ").concat($r.SYNC_RUN_TRUNCATED_RETENTION_SECONDS," seconds"),t.status)})(),a=!1,e.p=1;case 2:return e.n=3,this._request("get","/appmesh/app/".concat(n,"/output"),null,{params:{stdout_position:String(o)},config:{responseType:"arraybuffer"}});case 3:if(u=e.v,c=so(u.data),i.push(c),o+=c.byteLength,s(),!(c.byteLength<$r.SYNC_RUN_OUTPUT_PAGE_BYTES)){e.n=4;break}return a=!0,e.a(3,5);case 4:e.n=2;break;case 5:if(e.p=5,!a){e.n=9;break}return e.p=6,e.n=7,this.deleteApp(n);case 7:e.n=9;break;case 8:e.p=8,l=e.v,console.warn("Warning: Failed to remove sync run application '".concat(n,"':"),l.message);case 9:return e.f(5);case 10:return e.a(2,lo(ao(i),co(uo(t))))}},e,this,[[6,8],[1,,5,10]])})),function(e,t,n,r){return U.apply(this,arguments)})},{key:"runAppAsync",value:(N=Rr(wr().m(function e(t){var n,r,o,i,s=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:$r.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=s.length>2&&void 0!==s[2]?s[2]:$r.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:io(n),lifecycle:io(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 N.apply(this,arguments)})},{key:"waitForAsyncRun",value:(C=Rr(wr().m(function e(t){var n,r,o,i,s,a,u=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:oo,r=u.length>2&&void 0!==u[2]?u[2]:0,!t){e.n=7;break}o=0,i=new Date,s=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.getAppOutput(t.appName,o,0,20480,t.procUid,s);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.deleteApp(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-i)/1e3>r)){e.n=5;break}return e.a(3,7);case 5:return e.n=6,new Promise(function(e){return setTimeout(e,100)});case 6:e.n=1;break;case 7:return e.a(2,null)}},e,this)})),function(e){return C.apply(this,arguments)})},{key:"runTask",value:(j=Rr(wr().m(function e(t,n){var r,o,i=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:return(r=i.length>2&&void 0!==i[2]?i[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return j.apply(this,arguments)})},{key:"cancelTask",value:(A=Rr(wr().m(function e(t){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return A.apply(this,arguments)})},{key:"followOutput",value:function(e){var t=this;return qr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return wr().m(function r(){var o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,v,w,_,E,O,S,T,R,k;return wr().w(function(r){for(;;)switch(r.p=r.n){case 0:return o=n.stdoutPosition,i=void 0===o?0:o,s=n.processUuid,a=void 0===s?"":s,u=n.follow,c=void 0===u||u,l=n.timeout,f=void 0===l?3600:l,p={stdout_position:String(i),follow:c?"true":"false",timeout:String(f)},a&&(p.process_uuid=a),r.n=1,Hr(t._sseRequest("get","/appmesh/app/".concat(e,"/output/stream"),{params:p}));case 1:h=r.v,d=null,r.p=2,y=!1,m=!1,r.p=3,g=Xr(jo(h.data));case 4:return r.n=5,Hr(g.next());case 5:if(!(y=!(v=r.v).done)){r.n=9;break}if(w=vr(v.value,2),_=w[0],E=w[1],"stdout"!==_){r.n=7;break}return r.n=6,String(null!==(O=E.output)&&void 0!==O?O:"");case 6:r.n=8;break;case 7:if("end"!==_){r.n=8;break}return d=No(E),r.a(3,9);case 8:y=!1,r.n=4;break;case 9:r.n=11;break;case 10:r.p=10,R=r.v,m=!0,b=R;case 11:if(r.p=11,r.p=12,!y||null==g.return){r.n=13;break}return r.n=13,Hr(g.return());case 13:if(r.p=13,!m){r.n=14;break}throw b;case 14:return r.f(13);case 15:return r.f(11);case 16:r.n=18;break;case 17:throw r.p=17,k=r.v,t.onError(k);case 18:return r.p=18,null===(S=h.data)||void 0===S||null===(T=S.destroy)||void 0===T||T.call(S),r.f(18);case 19:return null===d&&(d=new Ao("closed")),Uo(d),r.a(2,d)}},r,null,[[12,,13,15],[3,10,11,16],[2,17,18,19]])})()}).apply(this,arguments)}},{key:"runTaskStream",value:function(e,t){var n=this;return qr(function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return wr().m(function o(){var i,s,a,u,c,l,f,p,h,d,y,m,b,g,v,w,_,E,O,S;return wr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i=r.timeout,a=(s=void 0===i?300:i)&&s>0?{timeout:String(s)}:{},o.n=1,Hr(n._sseRequest("post","/appmesh/app/".concat(e,"/task/stream"),{params:a,body:t}));case 1:u=o.v,c=null,l=null,o.p=2,f=!1,p=!1,o.p=3,d=Xr(jo(u.data));case 4:return o.n=5,Hr(d.next());case 5:if(!(f=!(y=o.v).done)){o.n=10;break}if(m=vr(y.value,2),b=m[0],g=m[1],"partial"!==b){o.n=7;break}return o.n=6,String(null!==(v=g.data)&&void 0!==v?v:"");case 6:o.n=9;break;case 7:if("final"!==b){o.n=8;break}l=null!==(w=g.result)&&void 0!==w?w:null,o.n=9;break;case 8:if("end"!==b){o.n=9;break}return c=No(g,{result:l}),o.a(3,10);case 9:f=!1,o.n=4;break;case 10:o.n=12;break;case 11:o.p=11,O=o.v,p=!0,h=O;case 12:if(o.p=12,o.p=13,!f||null==d.return){o.n=14;break}return o.n=14,Hr(d.return());case 14:if(o.p=14,!p){o.n=15;break}throw h;case 15:return o.f(14);case 16:return o.f(12);case 17:o.n=19;break;case 18:throw o.p=18,S=o.v,n.onError(S);case 19:return o.p=19,null===(_=u.data)||void 0===_||null===(E=_.destroy)||void 0===E||E.call(_),o.f(19);case 20:return null===c&&(c=new Ao("closed",{result:l})),Uo(c),o.a(2,c)}},o,null,[[13,,14,16],[3,11,12,17],[2,18,19,20]])})()}).apply(this,arguments)}},{key:"streamRun",value:function(e){var t=this;return qr(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$r.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$r.DEFAULT_RUN_APP_LIFECYCLE_SECONDS;return wr().m(function o(){var i,s,a,u,c;return wr().w(function(o){for(;;)switch(o.p=o.n){case 0:return i="string"==typeof e?{command:e,shell:!0}:e,o.n=1,Hr(t.runAppAsync(i,n,r));case 1:return s=o.v,o.p=2,u=t.followOutput(s.appName,{processUuid:s.procUid,follow:!0,timeout:Math.max(io(n),io(r))}),o.n=3,Hr(u.next());case 3:c=o.v;case 4:if(c.done){o.n=7;break}return o.n=5,c.value;case 5:return o.n=6,Hr(u.next());case 6:c=o.v,o.n=4;break;case 7:a=c.value;case 8:return o.p=8,o.p=9,o.n=10,Hr(t.deleteApp(s.appName));case 10:o.n=12;break;case 11:o.p=11,o.v;case 12:return o.f(8);case 13:return o.a(2,a)}},o,null,[[9,11],[2,,8,13]])})()}).apply(this,arguments)}},{key:"sendInput",value:(P=Rr(wr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:return s=(i=h.length>2&&void 0!==h[2]?h[2]:{}).close,a=void 0!==s&&s,u=i.processUuid,c=void 0===u?"":u,l=a?Sr({},$r.HTTP_HEADER_KEY_X_INPUT_CLOSE,"true"):{},f=c?{process_uuid:c}:{},e.n=1,this._request("post","/appmesh/app/".concat(t,"/input"),n,{headers:l,params:f});case 1:return p=e.v,e.a(2,parseInt(null!==(r=null===(o=p.data)||void 0===o?void 0:o.bytes_written)&&void 0!==r?r:0,10))}},e,this)})),function(e,t){return P.apply(this,arguments)})},{key:"downloadFile",value:(k=Rr(wr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,v,w,_,E,O,S,T,R,k,P,A=arguments;return wr().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=Sr({},$r.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:u,config:{responseType:Jr.isNode?"stream":"arraybuffer"}});case 1:if(c=e.v,l=Jr.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 Jr.isNode&&c.data.destroy(),new Zr("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 Zr("Failed to download file: ".concat(t),c.status,l);case 3:if(!Jr.isNode){e.n=20;break}return e.n=4,n.e(603).then(()=>n.t(603,19));case 4:return f=e.v,e.n=5,n.e(582).then(()=>n.t(582,19));case 5:return p=e.v,h=p.promisify,R=h,e.n=6,n.e(770).then(()=>n.t(770,19));case 6:return d=R(e.v.pipeline),y=f.promises,e.p=7,e.n=8,d(c.data,f.createWriteStream(s));case 8:if(!a||"win32"===process.platform){e.n=17;break}if(m=c.headers,e.p=9,!(b=m["x-file-mode"])){e.n=12;break}if(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(v=m["x-file-user"],w=m["x-file-group"],!v||!w){e.n=15;break}return e.n=13,ho(v);case 13:return _=e.v,e.n=14,mo(w);case 14:if(E=e.v,null===_||null===E){e.n=15;break}return e.n=15,y.chown(s,_,E);case 15:e.n=17;break;case 16:e.p=16,k=e.v,console.warn("Warning: Unable to apply file attributes to",s,k.message);case 17:e.n=19;break;case 18:throw e.p=18,P=e.v,new Zr("Failed to write file to ".concat(s,": ").concat(P.message),c.status);case 19:e.n=21;break;case 20:O=new Blob([c.data]),S=window.URL.createObjectURL(O),(T=document.createElement("a")).style.display="none",T.href=S,T.download=s.split("/").pop(),document.body.appendChild(T),T.click(),window.URL.revokeObjectURL(S),document.body.removeChild(T);case 21:return e.a(2)}},e,this,[[9,16],[7,18]])})),function(e){return k.apply(this,arguments)})},{key:"uploadFile",value:(R=Rr(wr().m(function e(t){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:if(s=b.length>2&&void 0!==b[2]&&b[2],a=b.length>3&&void 0!==b[3]&&b[3],i=b.length>1&&void 0!==b[1]?b[1]:null){e.n=2;break}if(u="string"==typeof t?t:t&&t.name){e.n=1;break}throw new Zr("filePath is required when localFile is a Blob without a name");case 1:i=u.split(/[\\/]/).pop();case 2:if(c=Sr({},$r.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(i)),a&&(c[$r.HTTP_HEADER_KEY_X_FILE_OVERWRITE]="true"),!Jr.isNode){e.n=7;break}return e.n=3,n.e(603).then(()=>n.t(603,19));case 3:if(f=e.v,p=f.statSync(t),!s){e.n=6;break}return c["X-File-Mode"]=(511&p.mode).toString(),e.n=4,wo(p.uid);case 4:return h=e.v,e.n=5,Eo(p.gid);case 5:d=e.v,c["X-File-User"]=h||String(p.uid),c["X-File-Group"]=d||String(p.gid);case 6:l=p.size<10485760?f.readFileSync(t):f.createReadStream(t),e.n=9;break;case 7:if(!(t instanceof File||t instanceof Blob)){e.n=8;break}l=t,e.n=9;break;case 8:throw new Zr("In browser, localFile must be File or Blob");case 9:return e.n=10,this._request("post","/appmesh/file/upload",l,{headers:c,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 10:if(200===(y=e.v).status||201===y.status){e.n=11;break}throw new Zr("Failed to upload file: ".concat(i),y.status,y.data);case 11:if(m=String(null!==(r=null===(o=y.headers)||void 0===o?void 0:o["content-type"])&&void 0!==r?r:"").toLowerCase(),!(200===y.status&&m.includes("json")&&y.data&&"object"===gr(y.data)&&"message"in y.data)){e.n=12;break}throw new Zr("File upload is not supported by this server surface: ".concat(i),y.status,y.data);case 12:return e.a(2)}},e,this)})),function(e){return R.apply(this,arguments)})},{key:"getHostResources",value:(T=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/resources");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return T.apply(this,arguments)})},{key:"getConfig",value:(S=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/config");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return S.apply(this,arguments)})},{key:"setConfig",value:(O=Rr(wr().m(function e(t){var n;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/config",t);case 1:return n=e.v,e.a(2,n.data)}},e,this)})),function(e){return O.apply(this,arguments)})},{key:"setLogLevel",value:(E=Rr(wr().m(function e(){var t,n,r=arguments;return wr().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.setConfig({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"addLabel",value:(_=Rr(wr().m(function e(t,n){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/label/".concat(t),null,{params:{value:n}});case 1:return e.a(2,!0)}},e,this)})),function(e,t){return _.apply(this,arguments)})},{key:"deleteLabel",value:(w=Rr(wr().m(function e(t){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/label/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return w.apply(this,arguments)})},{key:"listLabels",value:(v=Rr(wr().m(function e(){var t;return wr().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 v.apply(this,arguments)})},{key:"listPrincipals",value:(g=Rr(wr().m(function e(){return wr().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 g.apply(this,arguments)})},{key:"updatePrincipal",value:(b=Rr(wr().m(function e(t,n){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/principal/".concat(encodeURIComponent(t)),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return b.apply(this,arguments)})},{key:"deletePrincipal",value:(m=Rr(wr().m(function e(t){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/principal/".concat(encodeURIComponent(t)));case 1:return e.a(2,!0)}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"getCurrentUser",value:(y=Rr(wr().m(function e(){return wr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getCurrentPrincipal())},e,this)})),function(){return y.apply(this,arguments)})},{key:"listPermissions",value:(d=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return d.apply(this,arguments)})},{key:"getPrincipalPermissions",value:(h=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/principal/self/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return h.apply(this,arguments)})},{key:"getUserPermissions",value:(p=Rr(wr().m(function e(){return wr().w(function(e){for(;;)if(0===e.n)return e.a(2,this.getPrincipalPermissions())},e,this)})),function(){return p.apply(this,arguments)})},{key:"listRoles",value:(f=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"updateRole",value:(l=Rr(wr().m(function e(t,n){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return l.apply(this,arguments)})},{key:"deleteRole",value:(c=Rr(wr().m(function e(t){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/role/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return c.apply(this,arguments)})},{key:"getMetrics",value:(u=Rr(wr().m(function e(){var t;return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"subscribe",value:(a=Rr(wr().m(function e(){return wr().w(function(e){for(;;)switch(e.n){case 0:throw new Zr("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return a.apply(this,arguments)})},{key:"unsubscribe",value:(s=Rr(wr().m(function e(){return wr().w(function(e){for(;;)switch(e.n){case 0:throw new Zr("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return s.apply(this,arguments)})},{key:"request",value:(i=Rr(wr().m(function e(t,n){var r,o,i=arguments;return wr().w(function(e){for(;;)if(0===e.n)return r=i.length>2&&void 0!==i[2]?i[2]:null,o=i.length>3&&void 0!==i[3]?i[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"_commonHeaders",value:(o=Rr(wr().m(function e(){var t,n;return wr().w(function(e){for(;;)switch(e.n){case 0:return t={},Jr.isNode&&(t[$r.HTTP_USER_AGENT_HEADER_NAME]=$r.HTTP_USER_AGENT),e.n=1,this._getAccessToken();case 1:return(n=e.v)&&(t[$r.HTTP_HEADER_KEY_AUTH]="Bearer ".concat(n)),this.forwardingHost&&(t[$r.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost),e.a(2,t)}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_request",value:(r=Rr(wr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y=arguments;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:null,o=y.length>3&&void 0!==y[3]?y[3]:{},e.n=1,this._ensureHttpsAgent();case 1:if(i=o.headers,s=void 0===i?{}:i,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=2,f=Or(Or({method:t,url:n,withCredentials:!1},l),{},{headers:Or({},s),params:Or({},u)}),null!==r&&(f.data=r),!this._requestSigner){e.n=3;break}return e.n=3,this._applyRequestSignature(f);case 3:return e.n=4,this._client(f);case 4:if(!((p=e.v).status<200||p.status>=300)){e.n=5;break}throw h=this._extractErrorMessage(p.data),new Zr(h,p.status,p.data);case 5:return e.a(2,p);case 6:throw e.p=6,d=e.v,this.onError(d);case 7:return e.a(2)}},e,this,[[2,6]])})),function(e,t){return r.apply(this,arguments)})},{key:"_ensureHttpsAgent",value:(t=Rr(wr().m(function e(){return wr().w(function(e){for(;;)switch(e.n){case 0:if(!Jr.isNode||!Gr||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,Gr;case 1:Wr&&(this._client.defaults.httpsAgent=new Wr.Agent(Or(Or({},Po(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return e.a(2)}},e,this)})),function(){return t.apply(this,arguments)})},{key:"_sseRequest",value:(e=Rr(wr().m(function e(t,n){var r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,v,w,_,E=arguments;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=E.length>2&&void 0!==E[2]?E[2]:{},e.n=1,this._ensureHttpsAgent();case 1:if(o=r.params,i=void 0===o?{}:o,s=r.headers,a=void 0===s?{}:s,u=r.body,c={method:t,url:n,withCredentials:!1,responseType:"stream",timeout:0,headers:Or({},a),params:Or({},i)},null!=u&&(c.data=u),!this._requestSigner){e.n=2;break}return e.n=2,this._applyRequestSignature(c);case 2:return e.p=2,e.n=3,this._client(c);case 3:l=e.v,e.n=5;break;case 4:throw e.p=4,w=e.v,this.onError(w);case 5:if(200===l.status){e.n=21;break}f="",e.p=6,p=[],h=!1,d=!1,e.p=7,m=Xr(l.data);case 8:return e.n=9,m.next();case 9:if(!(h=!(b=e.v).done)){e.n=11;break}g=b.value,p.push(g);case 10:h=!1,e.n=8;break;case 11:e.n=13;break;case 12:e.p=12,_=e.v,d=!0,y=_;case 13:if(e.p=13,e.p=14,!h||null==m.return){e.n=15;break}return e.n=15,m.return();case 15:if(e.p=15,!d){e.n=16;break}throw y;case 16:return e.f(15);case 17:return e.f(13);case 18:f=Buffer.concat(p).toString("utf8"),e.n=20;break;case 19:e.p=19,e.v;case 20:throw v=f?this._extractErrorMessage(f):"SSE request failed with status ".concat(l.status),this.forwardingHost&&(400===l.status?v+="; streaming through node forwarding (forwardingHost=".concat(this.forwardingHost,") is relayed by")+" the agent REST listener (default port 6060): point the client at it, not at the engine listener":404!==l.status&&405!==l.status||(v+="; a forwarded stream needs X-Target-Host to name the target without its TCP port"+" (forwardingHost=".concat(this.forwardingHost,"): use a bare host or the target's agent REST port (6060)"))),new Zr(v,l.status,f||null);case 21:return e.a(2,l)}},e,this,[[14,,15,17],[7,12,13,18],[6,19],[2,4]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return this._extractErrorMessage(e.toString("utf8"));if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);return t?this._extractJsonErrorText(t):"Unknown error"}catch(e){return"Binary response error (could not decode)"}return"string"==typeof e?this._extractJsonErrorText(e):"object"===gr(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"_extractJsonErrorText",value:function(e){try{var t=JSON.parse(e);return t&&"object"===gr(t)?t.message||t.error||e:"string"==typeof t?t:e}catch(t){return e}}},{key:"onError",value:function(e){return e instanceof Zr?e:new Zr(e.message||"Unknown error")}}]);var e,t,r,o,i,s,a,u,c,l,f,p,h,d,y,m,b,g,v,w,_,E,O,S,T,R,k,P,A,j,C,N,U,x,D,L,B,F,I,H,q,M,z,X,K,W,Y}(),Do=Cr(function e(t,n,r,o){Ur(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 Cr(function e(t,n,r){Ur(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"withForwardingHost",value:(t=Rr(wr().m(function e(t){var n;return wr().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=Rr(wr().m(function e(){var t,n,r=this,o=arguments;return wr().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:oo,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 Bo=xo;export{xo as AppMeshClient,Zr as AppMeshError,no as AppMeshRequestError,ro as AppMeshTimeoutError,Do as AppOutput,eo as AppRemovedError,Lo as AppRun,$r as CONSTANTS,So as DEFAULT_CA_FILE,Kn as RefreshTokenProvider,fr as RequestSigner,Ao as SseEnd,Ln as StaticAccessTokenProvider,to as TransportDisconnectedError,mo as _resolveGid,Eo as _resolveGroupName,ho as _resolveUid,wo as _resolveUserName,Bo as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appmesh",
3
- "version": "3.1.20",
3
+ "version": "3.1.21",
4
4
  "description": "JavaScript SDK for App Mesh (https://github.com/laoshanxi/app-mesh)",
5
5
  "main": "./src/appmesh.js",
6
6
  "module": "./dist/appmesh.esm.js",
package/src/appmesh.js CHANGED
@@ -1094,8 +1094,16 @@ class AppMeshClient {
1094
1094
  }
1095
1095
  }
1096
1096
 
1097
+ const bytes = _toBytes(response.data);
1098
+ if (maxOutputBytes !== null && maxOutputBytes !== undefined && bytes.byteLength > maxOutputBytes) {
1099
+ throw new AppMeshRequestError(
1100
+ `run output exceeds maxOutputBytes=${maxOutputBytes} (${bytes.byteLength} bytes)`,
1101
+ response.status
1102
+ );
1103
+ }
1104
+
1097
1105
  if (stdoutHandler) {
1098
- stdoutHandler(_decodeBytes(_toBytes(response.data), _charsetOf(_responseContentType(response))), 0);
1106
+ stdoutHandler(_decodeBytes(bytes, _charsetOf(_responseContentType(response))), 0);
1099
1107
  }
1100
1108
 
1101
1109
  return exitCode;
@@ -1932,24 +1940,14 @@ class AppMeshClient {
1932
1940
  try {
1933
1941
  const textDecoder = new TextDecoder("utf-8");
1934
1942
  const text = textDecoder.decode(responseData);
1935
- try {
1936
- const parsedJson = JSON.parse(text);
1937
- return parsedJson.message || parsedJson.error || "Binary response error";
1938
- } catch (e) {
1939
- return text; // not json, return raw text
1940
- }
1943
+ return text ? this._extractJsonErrorText(text) : "Unknown error";
1941
1944
  } catch (e) {
1942
1945
  return 'Binary response error (could not decode)';
1943
1946
  }
1944
1947
  }
1945
1948
 
1946
1949
  if (typeof responseData === 'string') {
1947
- try {
1948
- const parsedJson = JSON.parse(responseData);
1949
- return parsedJson.message || parsedJson.error || responseData;
1950
- } catch (e) {
1951
- return responseData;
1952
- }
1950
+ return this._extractJsonErrorText(responseData);
1953
1951
  }
1954
1952
 
1955
1953
  if (typeof responseData === 'object') {
@@ -1959,6 +1957,21 @@ class AppMeshClient {
1959
1957
  return String(responseData);
1960
1958
  }
1961
1959
 
1960
+ _extractJsonErrorText(text) {
1961
+ try {
1962
+ const parsed = JSON.parse(text);
1963
+ if (parsed && typeof parsed === 'object') {
1964
+ return parsed.message || parsed.error || text;
1965
+ }
1966
+ if (typeof parsed === 'string') {
1967
+ return parsed;
1968
+ }
1969
+ return text;
1970
+ } catch (e) {
1971
+ return text;
1972
+ }
1973
+ }
1974
+
1962
1975
  /**
1963
1976
  * Comprehensive error handler for all client errors.
1964
1977
  * The default implementation only normalizes the error type; override this
@@ -8,7 +8,7 @@ import { once } from 'events'
8
8
  import { v1 as uuidv1 } from 'uuid'
9
9
  import msgpack from 'msgpack-lite'
10
10
  import AppMeshClient, {
11
- AppMeshError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE, CONSTANTS,
11
+ AppMeshError, AppMeshRequestError, AppRemovedError, TransportDisconnectedError, DEFAULT_CA_FILE, CONSTANTS,
12
12
  _resolveUid, _resolveGid, _resolveUserName, _resolveGroupName,
13
13
  } from './appmesh.js'
14
14
  import { canonicalQuery } from './request_signature.js'
@@ -615,15 +615,17 @@ class AppMeshClientTCP extends AppMeshClient {
615
615
  * @override
616
616
  */
617
617
  async _request (method, path, body = null, options = {}) {
618
- // A subscribe upgrade in progress owns the read side; wait for it so this
619
- // request is routed by UUID instead of racing the new reader for frames
620
- // (the subscribe ack could otherwise resolve this request, stranding
621
- // subscribe). The wait precedes construction so signatures stay fresh.
622
- if (this._demuxerStarting) {
618
+ return this._requestOnTransport(null, method, path, body, options)
619
+ }
620
+
621
+ // Use the primary transport when ephemeralTransport is null, else bypass the demuxer.
622
+ async _requestOnTransport (ephemeralTransport, method, path, body = null, options = {}) {
623
+ const transport = ephemeralTransport || this.tcpTransport
624
+ if (!ephemeralTransport && this._demuxerStarting) {
623
625
  await this._demuxerEnablePromise
624
626
  }
625
- if (!this.tcpTransport.connected()) {
626
- await this.tcpTransport.connect()
627
+ if (!transport.connected()) {
628
+ await transport.connect()
627
629
  }
628
630
 
629
631
  // Build request message
@@ -684,13 +686,21 @@ class AppMeshClientTCP extends AppMeshClient {
684
686
  const serialized = request.serialize()
685
687
 
686
688
  let response
687
- if (this._demuxer && this._demuxer._running) {
689
+ if (ephemeralTransport) {
690
+ transport.sendMessage(serialized)
691
+ const respData = await transport.receiveMessage()
692
+ if (!respData || respData.length === 0) {
693
+ transport.close()
694
+ throw new Error('Socket connection broken')
695
+ }
696
+ response = new ResponseMessage().deserialize(respData)
697
+ } else if (this._demuxer && this._demuxer._running) {
688
698
  // Live demuxer: route response by UUID. A stopped demuxer can never resolve
689
699
  // waiters, so fall back to the direct read below. Contract S7: register the
690
700
  // waiter BEFORE writing request bytes so a fast response can't be dropped.
691
701
  const respPromise = this._demuxer.registerRequest(request.uuid)
692
702
  try {
693
- this.tcpTransport.sendMessage(serialized)
703
+ transport.sendMessage(serialized)
694
704
  } catch (e) {
695
705
  respPromise.catch(() => {}) // never dispatched; silence a later stop() rejection
696
706
  this._demuxer.unregisterRequest(request.uuid)
@@ -709,10 +719,10 @@ class AppMeshClientTCP extends AppMeshClient {
709
719
  // subscribe waits for this response before starting the demuxer.
710
720
  this._directReads++
711
721
  try {
712
- this.tcpTransport.sendMessage(serialized)
713
- const respData = await this.tcpTransport.receiveMessage()
722
+ transport.sendMessage(serialized)
723
+ const respData = await transport.receiveMessage()
714
724
  if (!respData || respData.length === 0) {
715
- this.tcpTransport.close()
725
+ transport.close()
716
726
  throw new Error('Socket connection broken')
717
727
  }
718
728
  response = new ResponseMessage().deserialize(respData)
@@ -745,7 +755,7 @@ class AppMeshClientTCP extends AppMeshClient {
745
755
  if (canRefresh && typeof provider.refreshAccessToken === 'function') {
746
756
  const newToken = await provider.refreshAccessToken(token || null)
747
757
  if (typeof newToken === 'string' && newToken.trim()) {
748
- return this._request(method, path, body, { ...options, __appmeshRetried: true })
758
+ return this._requestOnTransport(ephemeralTransport, method, path, body, { ...options, __appmeshRetried: true })
749
759
  }
750
760
  }
751
761
  }
@@ -900,77 +910,79 @@ class AppMeshClientTCP extends AppMeshClient {
900
910
  * @override
901
911
  */
902
912
  async downloadFile(filePath, localFile = null, applyAttrs = false) {
903
- this._ensureNoActiveDemuxer()
904
913
  if (!localFile) localFile = filePath.split(/[\\/]/).pop()
905
914
  const headers = {
906
915
  [HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath),
907
916
  [HTTP_HEADER_KEY_X_RECV_FILE_SOCKET]: 'true'
908
917
  }
909
918
 
910
- const response = await this._request(
911
- 'get',
912
- '/appmesh/file/download',
913
- null,
914
- {
915
- headers
919
+ const ephemeral = this._hasActiveDemuxer() ? this._newFileTransport() : null
920
+ const transport = ephemeral || this.tcpTransport
921
+ try {
922
+ const response = ephemeral
923
+ ? await this._requestOnTransport(ephemeral, 'get', '/appmesh/file/download', null, { headers })
924
+ : await this._request('get', '/appmesh/file/download', null, { headers })
925
+
926
+ if (!response.headers[HTTP_HEADER_KEY_X_RECV_FILE_SOCKET]) {
927
+ throw new Error(
928
+ `Server did not respond with socket transfer option: ${HTTP_HEADER_KEY_X_RECV_FILE_SOCKET}`
929
+ )
916
930
  }
917
- )
918
-
919
- if (!response.headers[HTTP_HEADER_KEY_X_RECV_FILE_SOCKET]) {
920
- throw new Error(
921
- `Server did not respond with socket transfer option: ${HTTP_HEADER_KEY_X_RECV_FILE_SOCKET}`
922
- )
923
- }
924
931
 
925
- // Receive file chunks
926
- const writeStream = fs.createWriteStream(localFile)
927
- try {
928
- while (true) {
929
- const chunk = await this.tcpTransport.receiveMessage()
930
- if (!chunk || chunk.length === 0) {
931
- break
932
- }
933
- // Honor stream backpressure so large downloads do not buffer in memory
934
- if (!writeStream.write(chunk)) {
935
- await once(writeStream, 'drain')
932
+ // Receive file chunks
933
+ const writeStream = fs.createWriteStream(localFile)
934
+ try {
935
+ while (true) {
936
+ const chunk = await transport.receiveMessage()
937
+ if (!chunk || chunk.length === 0) {
938
+ break
939
+ }
940
+ // Honor stream backpressure so large downloads do not buffer in memory
941
+ if (!writeStream.write(chunk)) {
942
+ await once(writeStream, 'drain')
943
+ }
936
944
  }
945
+ } finally {
946
+ // Await the flush so the file is complete on disk before this resolves.
947
+ await new Promise((resolve, reject) => {
948
+ writeStream.once('finish', resolve)
949
+ writeStream.once('error', reject)
950
+ writeStream.end()
951
+ })
937
952
  }
938
- } finally {
939
- // Await the flush so the file is complete on disk before this resolves.
940
- await new Promise((resolve, reject) => {
941
- writeStream.once('finish', resolve)
942
- writeStream.once('error', reject)
943
- writeStream.end()
944
- })
945
- }
946
953
 
947
- // Apply file attributes on Unix systems
948
- if (applyAttrs && process.platform !== 'win32') {
949
- // Mode is sent as a decimal string (matches the HTTP transport and Python SDK)
950
- if (response.headers[HTTP_HEADER_KEY_X_FILE_MODE]) {
951
- const mode = parseInt(response.headers[HTTP_HEADER_KEY_X_FILE_MODE], 10)
952
- // A malformed or out-of-range remote value must not fail the finished download
953
- if (Number.isInteger(mode) && mode >= 0 && mode <= 0o777) {
954
- fs.chmodSync(localFile, mode)
955
- } else {
956
- console.warn(`Warning: Invalid X-File-Mode value: ${response.headers[HTTP_HEADER_KEY_X_FILE_MODE]}`)
954
+ // Apply file attributes on Unix systems
955
+ if (applyAttrs && process.platform !== 'win32') {
956
+ // Mode is sent as a decimal string (matches the HTTP transport and Python SDK)
957
+ if (response.headers[HTTP_HEADER_KEY_X_FILE_MODE]) {
958
+ const mode = parseInt(response.headers[HTTP_HEADER_KEY_X_FILE_MODE], 10)
959
+ // A malformed or out-of-range remote value must not fail the finished download
960
+ if (Number.isInteger(mode) && mode >= 0 && mode <= 0o777) {
961
+ fs.chmodSync(localFile, mode)
962
+ } else {
963
+ console.warn(`Warning: Invalid X-File-Mode value: ${response.headers[HTTP_HEADER_KEY_X_FILE_MODE]}`)
964
+ }
957
965
  }
958
- }
959
- if (response.headers[HTTP_HEADER_KEY_X_FILE_USER] && response.headers[HTTP_HEADER_KEY_X_FILE_GROUP]) {
960
- // The daemon sends user/group *names* (os::fileStat); resolve them to
961
- // numeric uid/gid locally before chown, same as the HTTP transport.
962
- const uid = await _resolveUid(response.headers[HTTP_HEADER_KEY_X_FILE_USER])
963
- const gid = await _resolveGid(response.headers[HTTP_HEADER_KEY_X_FILE_GROUP])
964
- if (uid !== null && gid !== null) {
965
- try {
966
- fs.chownSync(localFile, uid, gid)
967
- } catch (err) {
968
- console.warn(
969
- `Warning: Unable to change owner/group of ${localFile}. Operation requires elevated privileges.`
970
- )
966
+ if (response.headers[HTTP_HEADER_KEY_X_FILE_USER] && response.headers[HTTP_HEADER_KEY_X_FILE_GROUP]) {
967
+ // The daemon sends user/group *names* (os::fileStat); resolve them to
968
+ // numeric uid/gid locally before chown, same as the HTTP transport.
969
+ const uid = await _resolveUid(response.headers[HTTP_HEADER_KEY_X_FILE_USER])
970
+ const gid = await _resolveGid(response.headers[HTTP_HEADER_KEY_X_FILE_GROUP])
971
+ if (uid !== null && gid !== null) {
972
+ try {
973
+ fs.chownSync(localFile, uid, gid)
974
+ } catch (err) {
975
+ console.warn(
976
+ `Warning: Unable to change owner/group of ${localFile}. Operation requires elevated privileges.`
977
+ )
978
+ }
971
979
  }
972
980
  }
973
981
  }
982
+ } finally {
983
+ if (ephemeral) {
984
+ ephemeral.close()
985
+ }
974
986
  }
975
987
  }
976
988
 
@@ -986,7 +998,6 @@ class AppMeshClientTCP extends AppMeshClient {
986
998
  * @override
987
999
  */
988
1000
  async uploadFile(localFile, filePath = null, applyAttrs = false, overwrite = false) {
989
- this._ensureNoActiveDemuxer()
990
1001
  if (!filePath) filePath = localFile.split(/[\\/]/).pop()
991
1002
  if (!fs.existsSync(localFile)) {
992
1003
  throw new Error(`Local file not found: ${localFile}`)
@@ -995,7 +1006,8 @@ class AppMeshClientTCP extends AppMeshClient {
995
1006
  const headers = {
996
1007
  [HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath),
997
1008
  'Content-Type': 'text/plain',
998
- [HTTP_HEADER_KEY_X_SEND_FILE_SOCKET]: 'true'
1009
+ [HTTP_HEADER_KEY_X_SEND_FILE_SOCKET]: 'true',
1010
+ 'X-File-Upload-Ack': 'true'
999
1011
  }
1000
1012
  if (overwrite) {
1001
1013
  headers[HTTP_HEADER_KEY_X_FILE_OVERWRITE] = 'true'
@@ -1014,27 +1026,70 @@ class AppMeshClientTCP extends AppMeshClient {
1014
1026
  headers[HTTP_HEADER_KEY_X_FILE_GROUP] = groupName || String(stats.gid)
1015
1027
  }
1016
1028
 
1017
- const response = await this._request('post', '/appmesh/file/upload', null, {
1018
- headers
1019
- })
1029
+ const ephemeral = this._hasActiveDemuxer() ? this._newFileTransport() : null
1030
+ const transport = ephemeral || this.tcpTransport
1031
+ try {
1032
+ const response = ephemeral
1033
+ ? await this._requestOnTransport(ephemeral, 'post', '/appmesh/file/upload', null, { headers })
1034
+ : await this._request('post', '/appmesh/file/upload', null, { headers })
1035
+
1036
+ if (!response.headers[HTTP_HEADER_KEY_X_SEND_FILE_SOCKET]) {
1037
+ throw new Error(
1038
+ `Server did not respond with socket transfer option: ${HTTP_HEADER_KEY_X_SEND_FILE_SOCKET}`
1039
+ )
1040
+ }
1020
1041
 
1021
- if (!response.headers[HTTP_HEADER_KEY_X_SEND_FILE_SOCKET]) {
1022
- throw new Error(
1023
- `Server did not respond with socket transfer option: ${HTTP_HEADER_KEY_X_SEND_FILE_SOCKET}`
1024
- )
1025
- }
1042
+ // Send file chunks
1043
+ const readStream = fs.createReadStream(localFile, {
1044
+ highWaterMark: TCP_BLOCK_SIZE
1045
+ })
1026
1046
 
1027
- // Send file chunks
1028
- const readStream = fs.createReadStream(localFile, {
1029
- highWaterMark: TCP_BLOCK_SIZE
1030
- })
1047
+ for await (const chunk of readStream) {
1048
+ transport.sendMessage(chunk)
1049
+ }
1031
1050
 
1032
- for await (const chunk of readStream) {
1033
- this.tcpTransport.sendMessage(chunk)
1034
- }
1051
+ // Send EOF signal
1052
+ transport.sendMessage([])
1035
1053
 
1036
- // Send EOF signal
1037
- this.tcpTransport.sendMessage([])
1054
+ const ackOpt = _headerValue(response.headers, 'X-File-Upload-Ack')
1055
+ if (ackOpt && String(ackOpt).toLowerCase() === 'true') {
1056
+ const ackData = await transport.receiveMessage()
1057
+ if (!ackData) {
1058
+ throw new AppMeshRequestError('Upload commit acknowledgment failed: connection closed', 502)
1059
+ }
1060
+ const ack = msgpack.decode(ackData)
1061
+ if (ack.http_status !== 200) {
1062
+ const msg = this._extractErrorMessage(ack.body)
1063
+ throw new AppMeshRequestError(`HTTP ${ack.http_status}: ${msg}`, ack.http_status)
1064
+ }
1065
+ } else {
1066
+ // Flush buffered writes on an ephemeral socket before destroy() in finally.
1067
+ const sock = ephemeral && ephemeral.socket
1068
+ if (sock && typeof sock.end === 'function' && !sock.destroyed) {
1069
+ await new Promise((resolve, reject) => {
1070
+ const cleanup = () => {
1071
+ sock.removeListener('error', onError)
1072
+ sock.removeListener('close', onDone)
1073
+ }
1074
+ const onDone = () => {
1075
+ cleanup()
1076
+ resolve()
1077
+ }
1078
+ const onError = (err) => {
1079
+ cleanup()
1080
+ reject(err)
1081
+ }
1082
+ sock.once('error', onError)
1083
+ sock.once('close', onDone)
1084
+ sock.end(onDone)
1085
+ })
1086
+ }
1087
+ }
1088
+ } finally {
1089
+ if (ephemeral) {
1090
+ ephemeral.close()
1091
+ }
1092
+ }
1038
1093
  }
1039
1094
 
1040
1095
  /**
@@ -1118,17 +1173,12 @@ class AppMeshClientTCP extends AppMeshClient {
1118
1173
  return result
1119
1174
  }
1120
1175
 
1121
- /**
1122
- * Reject TCP file transfers while the event demuxer owns the read side: the
1123
- * demuxer read loop would steal the raw (non-msgpack) chunk frames and
1124
- * corrupt the transfer (mirrors the Python SDK).
1125
- * @private
1126
- */
1127
- _ensureNoActiveDemuxer () {
1128
- if (this._demuxer && this._demuxer._running) {
1129
- throw new Error('file transfer is not supported while an event subscription is active over the same TCP ' +
1130
- 'connection; use a separate client instance')
1131
- }
1176
+ _hasActiveDemuxer () {
1177
+ return Boolean((this._demuxer && this._demuxer._running) || this._demuxerStarting)
1178
+ }
1179
+
1180
+ _newFileTransport () {
1181
+ return new TCPTransport(this.tcpTransport.address, this.tcpTransport.sslConfig)
1132
1182
  }
1133
1183
 
1134
1184
  /**