appmesh 1.3.0 → 1.3.2
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 +8 -8
- package/dist/appmesh.esm.js +1 -1
- package/package.json +7 -2
- package/src/appmesh.js +45 -65
- package/src/appmesh_tcp.js +20 -36
- package/src/{server.js → worker.js} +6 -29
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Server-side SDK for building App Mesh applications in Node.js. This SDK enables
|
|
|
61
61
|
The `appmesh` package supports **both browser and Node.js** environments:
|
|
62
62
|
|
|
63
63
|
- **Client SDK** (`appmesh`) - Works in both browser and Node.js
|
|
64
|
-
- **Server SDK** (`appmesh/
|
|
64
|
+
- **Server SDK** (`appmesh/worker`) - **Node.js only** (not bundled for browser)
|
|
65
65
|
|
|
66
66
|
This ensures the browser build remains lightweight and doesn't include Node.js-specific server code.
|
|
67
67
|
|
|
@@ -92,7 +92,7 @@ npm install msgpack-lite uuid
|
|
|
92
92
|
#### Basic HTTP Server
|
|
93
93
|
|
|
94
94
|
```javascript
|
|
95
|
-
import { AppMeshWorker, ProcessSupersededError } from "appmesh/
|
|
95
|
+
import { AppMeshWorker, ProcessSupersededError } from "appmesh/worker";
|
|
96
96
|
|
|
97
97
|
const server = new AppMeshWorker();
|
|
98
98
|
|
|
@@ -120,7 +120,7 @@ try {
|
|
|
120
120
|
#### With SSL Configuration
|
|
121
121
|
|
|
122
122
|
```javascript
|
|
123
|
-
import { AppMeshWorker } from "appmesh/
|
|
123
|
+
import { AppMeshWorker } from "appmesh/worker";
|
|
124
124
|
import fs from "fs";
|
|
125
125
|
|
|
126
126
|
const sslConfig = {
|
|
@@ -138,7 +138,7 @@ const server = new AppMeshWorker("https://127.0.0.1:6060", sslConfig);
|
|
|
138
138
|
**Dependencies:** `npm install msgpack-lite uuid`
|
|
139
139
|
|
|
140
140
|
```javascript
|
|
141
|
-
import { AppMeshWorkerTCP, withServer } from "appmesh/
|
|
141
|
+
import { AppMeshWorkerTCP, withServer } from "appmesh/worker";
|
|
142
142
|
import fs from "fs";
|
|
143
143
|
|
|
144
144
|
const sslConfig = {
|
|
@@ -290,7 +290,7 @@ await withServer(
|
|
|
290
290
|
#### JSON Processing
|
|
291
291
|
|
|
292
292
|
```javascript
|
|
293
|
-
import { AppMeshWorker } from "appmesh/
|
|
293
|
+
import { AppMeshWorker } from "appmesh/worker";
|
|
294
294
|
|
|
295
295
|
const server = new AppMeshWorker();
|
|
296
296
|
|
|
@@ -319,7 +319,7 @@ try {
|
|
|
319
319
|
#### Binary Data Processing
|
|
320
320
|
|
|
321
321
|
```javascript
|
|
322
|
-
import { AppMeshWorker } from "appmesh/
|
|
322
|
+
import { AppMeshWorker } from "appmesh/worker";
|
|
323
323
|
import crypto from "crypto";
|
|
324
324
|
|
|
325
325
|
const server = new AppMeshWorker();
|
|
@@ -339,7 +339,7 @@ await server.send_task_result(JSON.stringify(result));
|
|
|
339
339
|
#### Long-Running Task
|
|
340
340
|
|
|
341
341
|
```javascript
|
|
342
|
-
import { AppMeshWorker } from "appmesh/
|
|
342
|
+
import { AppMeshWorker } from "appmesh/worker";
|
|
343
343
|
|
|
344
344
|
const server = new AppMeshWorker();
|
|
345
345
|
|
|
@@ -387,7 +387,7 @@ console.log("Result:", result);
|
|
|
387
387
|
|
|
388
388
|
```javascript
|
|
389
389
|
// Server side (running as App Mesh application)
|
|
390
|
-
import { AppMeshWorker } from "appmesh/
|
|
390
|
+
import { AppMeshWorker } from "appmesh/worker";
|
|
391
391
|
|
|
392
392
|
const server = new AppMeshWorker();
|
|
393
393
|
|
package/dist/appmesh.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.m=e,(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;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 s=Object.create(null);n.r(s);const i={};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=>i[e]=()=>r[e]);return i.default=()=>r,n.d(s,i),s}})(),n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],s=t[r++];n.o(e,o)?0===s&&r++:0===s?Object.defineProperty(e,o,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,o,{enumerable:!0,get:s})}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>e+".appmesh.esm.js",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=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={792:0},t=t=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:s}=t;var i,a,u=0;for(i in o)n.o(o,i)&&(n.m[i]=o[i]);for(s&&s(n);u<r.length;u++)a=r[u],n.o(e,a)&&e[a]&&e[a][0](),e[r[u]]=0};n.f.j=(r,o)=>{let s=n.o(e,r)?e[r]:void 0;if(0!==s)if(s)o.push(s[1]);else{let i=import("./"+n.u(r)).then(t,t=>{throw 0!==e[r]&&(e[r]=void 0),t});i=Promise.race([i,new Promise(t=>s=e[r]=[t])]),o.push(s[1]=i)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>Pe,hasStandardBrowserEnv:()=>Ce,hasStandardBrowserWebWorkerEnv:()=>Ne,navigator:()=>ke,origin:()=>je});const{toString:s}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=(e,t)=>{let n=e;const r=[];for(;null!=n&&n!==Object.prototype;){if(-1!==r.indexOf(n))return!1;if(r.push(n),c(n,t))return!0;n=i(n)}return!1},f=(p=Object.create(null),e=>{const t=s.call(e);return p[t]||(p[t]=t.slice(8,-1).toLowerCase())});var p;const h=e=>(e=e.toLowerCase(),t=>f(t)===e),d=e=>t=>typeof t===e,{isArray:m}=Array,y=d("undefined");function w(e){return null!==e&&!y(e)&&null!==e.constructor&&!y(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const g=h("ArrayBuffer");const b=d("string"),_=d("function"),v=d("number"),E=e=>null!==e&&"object"==typeof e,O=e=>{if(!E(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==i(t)||l(e,u)||l(e,a))},R=h("Date"),T=h("File"),S=h("Blob"),A=h("FileList");const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},k=void 0!==P.FormData?P.FormData:void 0,C=h("URLSearchParams"),[N,j,U,D]=["ReadableStream","Request","Response","Headers"].map(h);function x(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),m(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function L(e,t){if(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=e=>!y(e)&&e!==F;const I=(B="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>B&&e instanceof B);var B;const H=h("HTMLFormElement"),{propertyIsEnumerable:M}=Object.prototype,z=h("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};x(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const K=h("AsyncFunction"),J=(W="function"==typeof setImmediate,V=_(F.postMessage),W?setImmediate:V?(G=`axios@${Math.random()}`,$=[],F.addEventListener("message",({source:e,data:t})=>{e===F&&t===G&&$.length&&$.shift()()},!1),e=>{$.push(e),F.postMessage(G,"*")}):e=>setTimeout(e));var W,V,G,$;const Y="undefined"!=typeof queueMicrotask?queueMicrotask.bind(F):"undefined"!=typeof process&&process.nextTick||J,Q=e=>null!=e&&_(e[a]),Z={isArray:m,isArrayBuffer:g,isBuffer:w,isFormData:e=>{if(!e)return!1;if(k&&e instanceof k)return!0;const t=i(e);if(!t||t===Object.prototype)return!1;if(!_(e.append))return!1;const n=f(e);return"formdata"===n||"object"===n&&_(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&g(e.buffer),t},isString:b,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:O,isEmptyObject:e=>{if(!E(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:N,isRequest:j,isResponse:U,isHeaders:D,isUndefined:y,isDate:R,isFile:T,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:S,isRegExp:z,isFunction:_,isStream:e=>E(e)&&_(e.pipe),isURLSearchParams:C,isTypedArray:I,isFileList:A,forEach:x,merge:function e(...t){const{caseless:n,skipUndefined:r}=q(this)&&this||{},o={},s=(t,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=n&&"string"==typeof s&&L(o,s)||s,a=c(o,i)?o[i]:void 0;O(a)&&O(t)?o[i]=e(a,t):O(t)?o[i]=e({},t):m(t)?o[i]=t.slice():r&&y(t)||(o[i]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(x(n,s),"object"!=typeof n||m(n))continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];M.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(x(t,(t,r)=>{n&&_(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,s,a;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:f,kindOfTest:h,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(m(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:H,hasOwnProperty:c,hasOwnProp:c,hasOwnInPrototypeChain:l,getSafeProp:(e,t)=>null!=e&&l(e,t)?e[t]:void 0,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(_(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];_(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 m(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:L,global:F,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(E(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){t.add(e);const r=m(e)?[]:{};return x(e,(e,t)=>{const o=n(e);!y(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:K,isThenable:e=>e&&(E(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:J,asap:Y,isIterable:Q,isSafeIterable:e=>null!=e&&l(e,a)&&Q(e)},ee=Z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const te=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ne=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function re(e,t){return Z.isArray(e)?e.map(e=>re(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 oe(e){const t=Object.create(null);return Z.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>re(e,ne))(e)}),t}const se=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:Z.isArray(e)?e.map(ae):(e=>re(e,te))(String(e))}function ue(e,t,n,r,o){return Z.isFunction(r)?r.call(this,t,n):(o&&(t=n),Z.isString(t)?Z.isString(r)?-1!==t.indexOf(r):Z.isRegExp(r)?r.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ie(t);if(!o)return;const s=Z.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=ae(e))}const s=(e,t)=>Z.forEach(e,(e,n)=>o(e,n,t));if(Z.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(Z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ee[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Z.isObject(e)&&Z.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!Z.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],Z.hasOwnProp(o,r)?(n=o[r],o[r]=Z.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ie(e)){const n=Z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Z.isFunction(t))return t.call(this,e,n);if(Z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const n=Z.findKey(this,e);return!(!n||void 0===this[n]||t&&!ue(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ie(e)){const o=Z.findKey(n,e);!o||t&&!ue(0,n[o],o,t)||(delete n[o],r=!0)}}return Z.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&&!ue(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Z.forEach(this,(r,o)=>{const s=Z.findKey(n,o);if(s)return t[s]=ae(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=ae(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[se]=this[se]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ie(e);t[r]||(!function(e,t){const n=Z.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 Z.isArray(e)?e.forEach(r):r(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Z.reduceDescriptors(ce.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Z.freezeMethods(ce);const le=ce;function fe(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(Z.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof le&&(e=e.toJSON()),r.push(e),Z.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);Z.isUndefined(r)||(t[n]=r)});else{if(!Z.isPlainObject(e)&&function(e){if(Z.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Z.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,s]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(s);Z.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class pe extends Error{static from(e,t,n,r,o,s){const i=new pe(e.message,t||e.code,n,r,o);return Object.defineProperty(i,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),i.name=e.name,null!=e.status&&null==i.status&&(i.status=e.status),s&&Object.assign(i,s),i}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&&Z.hasOwnProp(e,"redact")?e.redact:void 0,n=Z.isArray(t)&&t.length>0?fe(e,t):Z.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}}}pe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",pe.ERR_BAD_OPTION="ERR_BAD_OPTION",pe.ECONNABORTED="ECONNABORTED",pe.ETIMEDOUT="ETIMEDOUT",pe.ECONNREFUSED="ECONNREFUSED",pe.ERR_NETWORK="ERR_NETWORK",pe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",pe.ERR_DEPRECATED="ERR_DEPRECATED",pe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",pe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",pe.ERR_CANCELED="ERR_CANCELED",pe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",pe.ERR_INVALID_URL="ERR_INVALID_URL",pe.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const he=pe;function de(e){return Z.isPlainObject(e)||Z.isArray(e)}function me(e){return Z.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,n){return e?e.concat(t).map(function(e,t){return e=me(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const we=Z.toFlatObject(Z,{},null,function(e){return/^is[A-Z]/.test(e)});const ge=function(e,t,n){if(!Z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Z.isUndefined(t[e])})).metaTokens,o=n.visitor||h,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,u=void 0===n.maxDepth?100:n.maxDepth,c=a&&Z.isSpecCompliantForm(t),l=[];if(!Z.isFunction(o))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Z.isDate(e))return e.toISOString();if(Z.isBoolean(e))return e.toString();if(!c&&Z.isBlob(e))throw new he("Blob is not supported. Use a Buffer instead.");if(Z.isArrayBuffer(e)||Z.isTypedArray(e)){if(c&&"function"==typeof a)return new a([e]);if("undefined"!=typeof Buffer)return Buffer.from(e);throw new he("Blob is not supported. Use a Buffer instead.",he.ERR_NOT_SUPPORT)}return e}function p(e){if(e>u)throw new he("Object is too deeply nested ("+e+" levels). Max depth: "+u,he.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(e,n,o){let a=e;if(Z.isReactNative(t)&&Z.isReactNativeBlob(e))return t.append(ye(o,n,s),f(e)),!1;if(e&&!o&&"object"==typeof e)if(Z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!Z.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),p(t+n.length-1),r})}(e,1);else if(Z.isArray(e)&&function(e){return Z.isArray(e)&&!e.some(de)}(e)||(Z.isFileList(e)||Z.endsWith(n,"[]"))&&(a=Z.toArray(e)))return n=me(n),a.forEach(function(e,r){!Z.isUndefined(e)&&null!==e&&t.append(!0===i?ye([n],r,s):null===i?n:n+"[]",f(e))}),!1;return!!de(e)||(t.append(ye(o,n,s),f(e)),!1)}const d=Object.assign(we,{defaultVisitor:h,convertValue:f,isVisitable:de});if(!Z.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!Z.isUndefined(n)){if(p(s),-1!==l.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));l.push(n),Z.forEach(n,function(n,i){!0===(!(Z.isUndefined(n)||null===n)&&o.call(t,n,Z.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i],s+1)}),l.pop()}}(e),t};function be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function _e(e,t){this._pairs=[],e&&ge(e,this,t)}const ve=_e.prototype;ve.append=function(e,t){this._pairs.push([e,t])},ve.toString=function(e){const t=e?t=>e.call(this,t,be):be;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ee=_e;function Oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Re(e,t,n){if(!t)return e;e=e||"";const r=Z.isFunction(n)?{serialize:n}:n,o=Z.getSafeProp(r,"encode")||Oe,s=Z.getSafeProp(r,"serialize");let i;if(i=s?s(t,r):Z.isURLSearchParams(t)?t.toString():new Ee(t,r).toString(o),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const Te=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Z.forEach(this.handlers,function(t){null!==t&&e(t)})}},Se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Pe="undefined"!=typeof window&&"undefined"!=typeof document,ke="object"==typeof navigator&&navigator||void 0,Ce=Pe&&(!ke||["ReactNative","NativeScript","NS"].indexOf(ke.product)<0),Ne="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,je=Pe&&window.location.href||"http://localhost",Ue={...r,...Ae};function De(e){if(e>100)throw new he("FormData field is too deeply nested ("+e+" levels). Max depth: 100",he.ERR_FORM_DATA_DEPTH_EXCEEDED)}const xe=function(e){function t(e,n,r,o){De(o);let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&Z.isArray(r)?r.length:s,a)return Z.hasOwnProp(r,s)?r[s]=Z.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i;Z.hasOwnProp(r,s)&&Z.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&Z.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(Z.isFormData(e)&&Z.isFunction(e.entries)){const n={};return Z.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;null!==(r=n.exec(e));)De(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),n}return null},Le=(e,t)=>null!=e&&Z.hasOwnProp(e,t)?e[t]:void 0;const Fe={transitional:Se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Z.isObject(e);o&&Z.isHTMLForm(e)&&(e=new FormData(e));if(Z.isFormData(e))return r?JSON.stringify(xe(e)):e;if(Z.isArrayBuffer(e)||Z.isBuffer(e)||Z.isStream(e)||Z.isFile(e)||Z.isBlob(e)||Z.isReadableStream(e))return e;if(Z.isArrayBufferView(e))return e.buffer;if(Z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){const t=Le(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ge(e,new Ue.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ue.isNode&&Z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=Z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Le(this,"env"),r=n&&n.FormData;return ge(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Z.isString(e))try{return(t||JSON.parse)(e),Z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Le(this,"transitional")||Fe.transitional,n=t&&t.forcedJSONParsing,r=Le(this,"responseType"),o="json"===r;if(Z.isResponse(e)||Z.isReadableStream(e))return e;if(e&&Z.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Le(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw he.from(e,he.ERR_BAD_RESPONSE,this,null,Le(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Z.forEach(["delete","get","head","post","put","patch","query"],e=>{Fe.headers[e]={}});const qe=Fe;function Ie(e,t){const n=this||qe,r=t||n,o=le.from(r.headers);let s=r.data;return Z.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Be(e){return!(!e||!e.__CANCEL__)}const He=class extends he{constructor(e,t,n){super(e??"canceled",he.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Me(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new he("Request failed with status code "+n.status,n.status>=400&&n.status<500?he.ERR_BAD_REQUEST:he.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ze=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=r[i];o||(o=u),n[s]=a,r[s]=u;let l=i,f=0;for(;l!==s;)f+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const Xe=function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]},Ke=(e,t,n=3)=>{let r=0;const o=ze(50,250);return Xe(n=>{if(!n||"number"!=typeof n.loaded)return;const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:i,progress:i?a/i:void 0,bytes:u,rate:c||void 0,estimated:c&&i?(i-a)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Je=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},We=e=>(...t)=>Z.asap(()=>e(...t)),Ve=Ue.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ue.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ue.origin),Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent)):()=>!0,Ge=Ue.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Z.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Z.isString(r)&&a.push(`path=${r}`),Z.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),Z.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)try{return decodeURIComponent(r.slice(o+1))}catch(e){return r.slice(o+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const $e=/^https?:(?!\/\/)/i,Ye=/[\t\n\r]/g;function Qe(e,t){if("string"==typeof e&&$e.test(function(e){return function(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}(e).replace(Ye,"")}(e)))throw new he('Invalid URL: missing "//" after protocol',he.ERR_INVALID_URL,t)}function Ze(e,t,n,r){Qe(t,r);let o=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(o||!1===n)?(Qe(e,r),function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t)):t}const et=e=>e instanceof le?{...e}:e;function tt(e,t){e=e||{},t=t||{};const n=Object.create(null);function r(e,t,n,r){return Z.isPlainObject(e)&&Z.isPlainObject(t)?Z.merge.call({caseless:r},e,t):Z.isPlainObject(t)?Z.merge({},t):Z.isArray(t)?t.slice():t}function o(e,t,n,o){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!Z.isUndefined(t))return r(void 0,t)}function i(e,t){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return Z.hasOwnProp(t,s)?r(n,o):Z.hasOwnProp(e,s)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(et(e),et(t),0,!0)};return Z.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=Z.hasOwnProp(u,r)?u[r]:o,i=s(Z.hasOwnProp(e,r)?e[r]:void 0,Z.hasOwnProp(t,r)?t[r]:void 0,r);Z.isUndefined(i)&&s!==a||(n[r]=i)}),Z.hasOwnProp(t,"validateStatus")&&Z.isUndefined(t.validateStatus)&&!1===function(n){const r=Z.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!Z.isUndefined(r)){if(!Z.isPlainObject(r))return;if(Z.hasOwnProp(r,n))return r[n]}const o=Z.hasOwnProp(e,"transitional")?e.transitional:void 0;if(Z.isPlainObject(o)&&Z.hasOwnProp(o,n))return o[n]}("validateStatusUndefinedResolves")&&(Z.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const nt=["content-type","content-length"];const rt=function(e){const t=tt({},e),n=e=>Z.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const s=n("xsrfHeaderName"),i=n("xsrfCookieName");let a=n("headers");const u=n("auth"),c=n("baseURL"),l=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=le.from(a),t.url=Re(Ze(c,f,l,t),n("params"),n("paramsSerializer")),u){const t=Z.getSafeProp(u,"username")||"",n=Z.getSafeProp(u,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw he.from(t,he.ERR_BAD_OPTION_VALUE,e)}}if(Z.isFormData(r)&&(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv||Z.isReactNative(r)?a.setContentType(void 0):Z.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{nt.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,r.getHeaders(),n("formDataHeaderPolicy"))),Ue.hasStandardBrowserEnv){Z.isFunction(o)&&(o=o(t));if(!0===o||null==o&&Ve(t.url)){const e=s&&i&&Ge.read(i);e&&a.set(s,e)}}return t},ot="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=rt(e);let o=r.data;const s=le.from(r.headers).normalize();let i,a,u,c,l,{responseType:f,onUploadProgress:p,onDownloadProgress:h}=r;function d(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=le.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Me(function(e){t(e),d()},function(e){n(e),d()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new he("Request aborted",he.ECONNABORTED,e,m)),d(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new he(r,he.ERR_NETWORK,e,m);o.event=t||null,n(o),d(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new he(t,o.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,m)),d(),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&Z.forEach(oe(s),function(e,t){m.setRequestHeader(t,e)}),Z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),h&&([u,l]=Ke(h,!0),m.addEventListener("progress",u)),p&&m.upload&&([a,c]=Ke(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new He(null,e,m):t),m.abort(),d(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const w=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);if(w&&!Ue.protocols.includes(w))return n(new he("Unsupported protocol "+w+":",he.ERR_BAD_REQUEST,e)),void d();m.send(o||null)})},st=(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,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof he?t:new He(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new he(`timeout of ${t}ms exceeded`,he.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o,{once:!0}));const{signal:a}=n;return a.unsubscribe=()=>Z.asap(i),a},it=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},at=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()}},ut=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of at(e))yield*it(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!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 s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},ct=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,lt=(e,t,n)=>t+2<n&&ct(e.charCodeAt(t+1))&&ct(e.charCodeAt(t+2));const{isFunction:ft}=Z,pt=e=>{if(!Z.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},ht=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},dt=e=>{const t=void 0!==Z.global&&null!==Z.global?Z.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Z.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:s,Response:i}=e,a=o?ft(o):"function"==typeof fetch,u=ft(s),c=ft(i);if(!a)return!1;const l=a&&ft(n),f=a&&("function"==typeof r?(p=new r,e=>p.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var p;const h=u&&l&&ht(()=>{let e=!1;const t=new s(Ue.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),d=c&&l&&ht(()=>Z.isReadableStream(new i("").body)),m={stream:d&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new he(`Response type '${e}' is not supported`,he.ERR_NOT_SUPPORT,n)})});const y=async e=>{if(null==e)return 0;if(Z.isBlob(e))return e.size;if(Z.isSpecCompliantForm(e)){const t=new s(Ue.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Z.isArrayBufferView(e)||Z.isArrayBuffer(e)?e.byteLength:(Z.isURLSearchParams(e)&&(e+=""),Z.isString(e)?(await f(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:a,signal:c,cancelToken:f,timeout:p,onDownloadProgress:w,onUploadProgress:g,responseType:b,headers:_,withCredentials:v="same-origin",fetchOptions:E,maxContentLength:O,maxBodyLength:R}=rt(e);const T=Z.isNumber(O)&&O>-1,S=Z.isNumber(R)&&R>-1;let A=o||fetch;b=b?(b+"").toLowerCase():"text";let P=st([c,f&&f.toAbortSignal()],p),k=null;const C=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let N,j=null;const U=()=>new he("Request body larger than maxBodyLength limit",he.ERR_BAD_REQUEST,e,k);try{let o;const c=(x="auth",Z.hasOwnProp(e,x)?e[x]:void 0);if(c){const e=Z.getSafeProp(c,"username")||"";o={username:e,password:Z.getSafeProp(c,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,Ue.origin);if(!o&&(e.username||e.password)){const t=pt(e.username);o={username:t,password:pt(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(o&&(_.delete("authorization"),_.set("Authorization","Basic "+btoa((D=(o.username||"")+":"+(o.password||""),encodeURIComponent(D).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n<t;n++)if(37===r.charCodeAt(n)&&n+2<t){const t=r.charCodeAt(n+1),o=r.charCodeAt(n+2);ct(t)&&ct(o)&&(e-=2,n+=2)}let n=0,o=t-1;const s=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):s(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||s(o))&&n++;const i=3*Math.floor(e/4)-(n||0);return i>0?i:0}let o=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);if(37===n&<(r,e,t))o+=1,e+=2;else if(n<128)o+=1;else if(n<2048)o+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=r.charCodeAt(e+1);t>=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}if(S&&"get"!==n&&"head"!==n){const e=await y(a);if("number"==typeof e&&isFinite(e)&&(N=e,e>R))throw U()}const f=S&&(Z.isReadableStream(a)||Z.isStream(a)),p=(e,t,n)=>ut(e,65536,e=>{if(S&&e>R)throw j=U();t&&t(e)},n);if(h&&"get"!==n&&"head"!==n&&(g||f)){if(N=N??await(async(e,t)=>{const n=Z.toFiniteNumber(e.getContentLength());return n??y(t)})(_,a),0!==N||f){let e,n=new s(t,{method:"POST",body:a,duplex:"half"});if(Z.isFormData(a)&&(e=n.headers.get("content-type"))&&_.setContentType(e),n.body){const[e,t]=g&&Je(N,Ke(We(g)))||[];a=p(n.body,e,t)}}}else if(f&&!u&&l&&"get"!==n&&"head"!==n)a=p(a);else if(f&&u&&!h&&"get"!==n&&"head"!==n)throw new he("Stream request bodies are not supported by the current fetch implementation",he.ERR_NOT_SUPPORT,e,k);Z.isString(v)||(v=v?"include":"omit");const L=u&&"credentials"in s.prototype;if(Z.isFormData(a)){const e=_.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&_.delete("content-type")}_.set("User-Agent","axios/1.18.1",!1);const F={...E,signal:P,method:n.toUpperCase(),headers:oe(_.normalize()),body:a,duplex:"half",credentials:L?v:void 0};k=u&&new s(t,F);let q=await(u?A(k,E):A(t,F));const I=le.from(q.headers);if(T){const t=Z.toFiniteNumber(I.getContentLength());if(null!=t&&t>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}const B=d&&("stream"===b||"response"===b);if(d&&q.body&&(w||T||B&&C)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=q[e]});const n=Z.toFiniteNumber(I.getContentLength()),[r,o]=w&&Je(n,Ke(We(w),!0))||[];let s=0;const a=t=>{if(T&&(s=t,s>O))throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k);r&&r(t)};q=new i(ut(q.body,65536,a,()=>{o&&o(),C&&C()}),t)}b=b||"text";let H=await m[Z.findKey(m,b)||"text"](q,e);if(T&&!d&&!B){let t;if(null!=H&&("number"==typeof H.byteLength?t=H.byteLength:"number"==typeof H.size?t=H.size:"string"==typeof H&&(t="function"==typeof r?(new r).encode(H).byteLength:H.length)),"number"==typeof t&&t>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}return!B&&C&&C(),await new Promise((t,n)=>{Me(t,n,{data:H,headers:le.from(q.headers),status:q.status,statusText:q.statusText,config:e,request:k})})}catch(t){if(C&&C(),P&&P.aborted&&P.reason instanceof he){const n=P.reason;throw n.config=e,k&&(n.request=k),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(j)throw k&&!j.request&&(j.request=k),j;if(t instanceof he)throw k&&!t.request&&(t.request=k),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new he("Network Error",he.ERR_NETWORK,e,k,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw he.from(t,t&&t.code,e,k,t&&t.response)}var D,x}},mt=new Map,yt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,u=s.length,c=mt;for(;u--;)i=s[u],a=c.get(i),void 0===a&&c.set(i,a=u?new Map:dt(t)),c=a;return a},wt=(yt(),{http:null,xhr:ot,fetch:{get:yt}});Z.forEach(wt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const gt=e=>`- ${e}`,bt=e=>Z.isFunction(e)||null===e||!1===e;const _t={getAdapter:function(e,t){e=Z.isArray(e)?e:[e];const{length:n}=e;let r,o;const s={};for(let i=0;i<n;i++){let n;if(r=e[i],o=r,!bt(r)&&(o=wt[(n=String(r)).toLowerCase()],void 0===o))throw new he(`Unknown adapter '${n}'`);if(o&&(Z.isFunction(o)||(o=o.get(t))))break;s[n||"#"+i]=o}if(!o){const e=Object.entries(s).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(gt).join("\n"):" "+gt(e[0]):"as no adapter specified";throw new he("There is no suitable adapter to dispatch the request "+t,he.ERR_NOT_SUPPORT)}return o},adapters:wt};function vt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new He(null,e)}function Et(e){vt(e),e.headers=le.from(e.headers),e.data=Ie.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _t.getAdapter(e.adapter||qe.adapter,e)(e).then(function(t){vt(e),e.response=t;try{t.data=Ie.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=le.from(t.headers),t},function(t){if(!Be(t)&&(vt(e),t&&t.response)){e.response=t.response;try{t.response.data=Ie.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=le.from(t.response.headers)}return Promise.reject(t)})}const Ot={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ot[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Rt={};Ot.transitional=function(e,t,n){function r(e,t){return"[Axios v1.18.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new he(r(o," has been removed"+(t?" in "+t:"")),he.ERR_DEPRECATED);return t&&!Rt[o]&&(Rt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},Ot.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Tt={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new he("options must be an object",he.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new he("option "+s+" must be "+n,he.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new he("Unknown option "+s,he.ERR_BAD_OPTION)}},validators:Ot},St=Tt.validators;class At{constructor(e){this.defaults=e||{},this.interceptors={request:new Te,response:new Te}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=tt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Tt.assertOptions(n,{silentJSONParsing:St.transitional(St.boolean),forcedJSONParsing:St.transitional(St.boolean),clarifyTimeoutError:St.transitional(St.boolean),legacyInterceptorReqResOrdering:St.transitional(St.boolean),advertiseZstdAcceptEncoding:St.transitional(St.boolean),validateStatusUndefinedResolves:St.transitional(St.boolean)},!1),null!=r&&(Z.isFunction(r)?t.paramsSerializer={serialize:r}:Tt.assertOptions(r,{encode:St.function,serialize:St.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Tt.assertOptions(t,{baseUrl:St.spelling("baseURL"),withXsrfToken:St.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&Z.merge(o.common,o[t.method]);o&&Z.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=le.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||Se;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const u=[];let c;this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});let l,f=0;if(!a){const e=[Et.bind(this),void 0];for(e.unshift(...i),e.push(...u),l=e.length,c=Promise.resolve(t);f<l;)c=c.then(e[f++],e[f++]);return c}l=i.length;let p=t;for(;f<l;){const e=i[f++],t=i[f++];try{p=e(p)}catch(e){t.call(this,e);break}}try{c=Et.call(this,p)}catch(e){return Promise.reject(e)}for(f=0,l=u.length;f<l;)c=c.then(u[f++],u[f++]);return c}getUri(e){return Re(Ze((e=tt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}Z.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(t,n){return this.request(tt(n||{},{method:e,url:t,data:n&&Z.hasOwnProp(n,"data")?n.data:void 0}))}}),Z.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(tt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}At.prototype[e]=t(),"query"!==e&&(At.prototype[e+"Form"]=t(!0))});const Pt=At;class kt{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 He(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 kt(function(t){e=t}),cancel:e}}}const Ct=kt;const Nt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Nt).forEach(([e,t])=>{Nt[t]=e});const jt=Nt;const Ut=function e(t){const n=new Pt(t),r=o(Pt.prototype.request,n);return Z.extend(r,Pt.prototype,n,{allOwnKeys:!0}),Z.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(tt(t,n))},r}(qe);Ut.Axios=Pt,Ut.CanceledError=He,Ut.CancelToken=Ct,Ut.isCancel=Be,Ut.VERSION="1.18.1",Ut.toFormData=ge,Ut.AxiosError=he,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return Z.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=tt,Ut.AxiosHeaders=le,Ut.formToJSON=e=>xe(Z.isHTMLForm(e)?new FormData(e):e),Ut.getAdapter=_t.getAdapter,Ut.HttpStatusCode=jt,Ut.default=Ut;const Dt=Ut;function xt(){/*! 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 s(n,r,o,s){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Lt(c,"_invoke",function(n,r,o){var s,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 s=t,a=0,u=e,p.n=n,i}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,s=l[t],h=p.p,d=s[2];n>3?(o=d===r)&&(u=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=e):s[0]<=h&&((o=n<2&&h<s[1])?(a=0,p.v=r,p.n=s[1]):h<d&&(o=n<3||s[0]>r||r>d)&&(s[4]=n,s[5]=r,p.n=d,a=0))}if(o||n>1)return i;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;){s||(a?a<3?(a>1&&(p.n=-1),h(a,u)):p.n=u:p.v=u);try{if(c=2,s){if(a||(o="next"),t=s[o]){if(!(t=t.call(s,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=s.return)&&t.call(s),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);s=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==i)break}catch(t){s=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,s),!0),c}var i={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Lt(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,Lt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Lt(f,"constructor",c),Lt(c,"constructor",u),u.displayName="GeneratorFunction",Lt(c,o,"GeneratorFunction"),Lt(f),Lt(f,o,"Generator"),Lt(f,r,function(){return this}),Lt(f,"toString",function(){return"[object Generator]"}),(xt=function(){return{w:s,m:p}})()}function Lt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Lt=function(e,t,n,r){function s(t,n){Lt(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:(s("next",0),s("throw",1),s("return",2))},Lt(e,t,n,r)}function Ft(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,s,i,a=[],u=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=s.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&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qt(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)?qt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qt(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 It(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 Bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?It(Object(n),!0).forEach(function(t){Ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):It(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ht(e,t,n){return(t=Wt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(e,t,n,r,o,s,i){try{var a=e[s](i),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function zt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function i(e){Mt(s,r,o,i,a,"next",e)}function a(e){Mt(s,r,o,i,a,"throw",e)}i(void 0)})}}function Xt(e){return Xt="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},Xt(e)}function Kt(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,Wt(r.key),r)}}function Jt(e,t,n){return t&&Kt(e.prototype,t),n&&Kt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wt(e){var t=function(e,t){if("object"!=Xt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Xt(t)?t:t+""}function Vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gt(e,t,n){return t=en(t),function(e,t){if(t&&("object"==Xt(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,Qt()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))}function $t(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&&Zt(e,t)}function Yt(e){var t="function"==typeof Map?new Map:void 0;return Yt=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(Qt())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Zt(o,n.prototype),o}(e,arguments,en(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Zt(n,e)},Yt(e)}function Qt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Qt=function(){return!!e})()}function Zt(e,t){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zt(e,t)}function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},en(e)}var tn=null,nn=null,rn=null,on=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",HTTP_STATUS_PRECONDITION_REQUIRED:428,DEFAULT_TOKEN_EXPIRE_SECONDS:"P1W",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",DEFAULT_JWT_AUDIENCE:"appmesh-service",HTTP_HEADER_NAME_CSRF_TOKEN:"X-CSRF-Token",HTTP_COOKIE_NAME_CSRF_TOKEN:"appmesh_csrf_token",HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path"}),sn=Object.freeze({isNode:!("undefined"!=typeof window&&void 0!==window.document)}),an=sn.isNode?{encode:function(e){return Buffer.from(e).toString("base64")},decode:function(e){return Buffer.from(e,"base64").toString()}}:{encode:function(e){return btoa(e)},decode:function(e){return atob(e)}},un=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,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Vt(this,e),(n=Gt(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=s,n.timestamp=(new Date).toISOString(),n}return $t(e,Yt(Error)),Jt(e)}(),cn=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Vt(this,e),(n=Gt(this,e,[t,428,r,"TOTP_REQUIRED"])).name="TotpRequiredError";var o=r;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){o=null}return n.totpChallenge=o&&"object"===Xt(o)&&"string"==typeof o.totp_challenge?o.totp_challenge:null,n}return $t(e,un),Jt(e)}(),ln=function(){function e(t){var n;return Vt(this,e),(n=Gt(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return $t(e,un),Jt(e)}(),fn=function(){function e(t){var n;return Vt(this,e),(n=Gt(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return $t(e,un),Jt(e)}(),pn=function(e,t){sn.isNode?process.stdout.write(e):console.log(e)};function hn(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)?"),s="P(?:".concat(r,"(?:").concat(o,")?)"),i=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(s));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[i[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 dn(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 mn(e){return yn.apply(this,arguments)}function yn(){return(yn=zt(xt().m(function e(t){var r,o,s,i;return xt().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.bind(n,994,19));case 2:if(o=e.v,s=o.spawnSync,0===(i=s("id",["-u",t],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=3;break}return e.a(2,null);case 3:return e.a(2,parseInt(i.stdout.trim(),10));case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}function wn(e){return gn.apply(this,arguments)}function gn(){return(gn=zt(xt().m(function e(t){var r,o,s,i,a;return xt().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.bind(n,994,19));case 2:if(o=e.v,s=o.spawnSync,0===(i=s("getent",["group",t],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=3;break}return e.a(2,null);case 3:return a=i.stdout.trim().split(":"),e.a(2,a.length>=3?parseInt(a[2],10):null);case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}var bn="/opt/appmesh/ssl/ca.pem";function _n(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:nn.readFileSync(e)}function vn(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return nn.existsSync(bn)?{ca:nn.readFileSync(bn),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=Bt({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=_n(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var En=function(){return Jt(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn.isNode?"https://127.0.0.1:6060":window.location.origin,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Vt(this,e),this.baseURL=r,this.forwardingHost=null,this._token=null;var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0}};this._sslConfig=o,this._client=Dt.create(s),sn.isNode&&!rn&&(rn=Promise.all([n.e(453).then(n.t.bind(n,453,19)),n.e(603).then(n.t.bind(n,603,19))]).then(function(e){var t=Ft(e,2),n=t[0],r=t[1];tn=n.default||n,nn=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(e){return e.headers=Bt(Bt({},e.headers),t._commonHeaders()),e},function(e){var t=new un("Request configuration error: "+(e.message||"Unknown error"));return Promise.reject(t)}),this._client.interceptors.response.use(function(e){return e},function(e){var t,n,r,o,s=new un("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 s.cause=e,Promise.reject(s)})},[{key:"login",value:(V=zt(xt().m(function e(t,n){var r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(r=u.length>2&&void 0!==u[2]?u[2]:null,o=u.length>3&&void 0!==u[3]?u[3]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,s=u.length>4&&void 0!==u[4]?u[4]:on.DEFAULT_JWT_AUDIENCE,t&&n){e.n=1;break}throw new un("Username and password are required",400,null,"INVALID_CREDENTIALS");case 1:return i=an.encode("".concat(t,":").concat(n)),a=Ht(Ht({},on.HTTP_HEADER_KEY_AUTH,"Basic ".concat(i)),"X-Set-Cookie","true"),r&&(a["X-Totp-Code"]=r),o&&(a["X-Expire-Seconds"]=hn(o)),s&&(a["X-Audience"]=s),e.n=2,this._request("post","/appmesh/login",null,{headers:a});case 2:return e.a(2)}},e,this)})),function(e,t){return V.apply(this,arguments)})},{key:"authenticate",value:(W=zt(xt().m(function e(t){var n,r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:null,r=u.length>2&&void 0!==u[2]?u[2]:on.DEFAULT_JWT_AUDIENCE,o=!(u.length>3&&void 0!==u[3])||u[3],s={Authorization:"Bearer ".concat(t)},n&&(s["X-Permission"]=n),r&&(s["X-Audience"]=r),o&&(s["X-Set-Cookie"]="true"),e.n=1,this._request("post","/appmesh/auth",null,{headers:s});case 1:return i=e.v,a="string"==typeof i.data?i.data:JSON.stringify(i.data),e.a(2,{success:!0,responseText:a})}},e,this)})),function(e){return W.apply(this,arguments)})},{key:"set_token",value:function(e){sn.isNode?this._handleTokenUpdate(e):console.warn("set_token() is not supported in browser mode (auth cookie is HttpOnly). Use authenticate() instead.")}},{key:"_getAccessToken",value:function(){return this._token||null}},{key:"_handleTokenUpdate",value:function(e){var t="appmesh_auth_token";if(this._token=e||null,sn.isNode&&this._token){var n=(this._client.defaults.headers.Cookie||"").split("; ").filter(function(e){return e&&!e.startsWith(t+"=")});n.push("".concat(t,"=").concat(this._token)),this._client.defaults.headers.Cookie=n.join("; ")}this._autoRefreshJwt=this._token,this._autoRefreshEnabled&&this._scheduleTokenRefresh()}},{key:"logout",value:(J=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("post","/appmesh/self/logoff");case 1:e.n=3;break;case 2:e.p=2,t=e.v,console.error("Failed to logoff:",t.message);case 3:return e.p=3,sn.isNode&&this._client.defaults.httpsAgent&&this._client.defaults.httpsAgent.destroy(),this._stopAutoRefresh(),this._token=null,sn.isNode?this._client.defaults.headers.Cookie=null:document.cookie="".concat(on.HTTP_COOKIE_NAME_CSRF_TOKEN,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; SameSite=Strict; Secure"),e.f(3);case 4:return e.a(2)}},e,this,[[0,2,3,4]])})),function(){return J.apply(this,arguments)})},{key:"set_auto_refresh_token",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._stopAutoRefresh(),this._autoRefreshEnabled=e,e&&(this._autoRefreshJwt=t||this._getAccessToken()||null,this._scheduleTokenRefresh())}},{key:"_stopAutoRefresh",value:function(){this._autoRefreshEnabled=!1,this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null)}},{key:"_scheduleTokenRefresh",value:function(){var e=this;if(this._autoRefreshEnabled){this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null);var t=300,n=this._autoRefreshJwt||this._getAccessToken();if(n){var r=function(e){try{var t=e.split(".");if(3!==t.length)return null;var n=JSON.parse(an.decode(t[1].replace(/-/g,"+").replace(/_/g,"/")));return"number"==typeof n.exp?n.exp:null}catch(e){return null}}(n);if(r){var o=r-Math.floor(Date.now()/1e3);t=o<=30?1:Math.min(o-30,300)}}this._refreshTimer=setTimeout(zt(xt().m(function t(){var n;return xt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e._autoRefreshEnabled){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,e.renew_token();case 2:t.n=4;break;case 3:t.p=3,n=t.v,console.warn("Auto-refresh: token renewal failed:",n.message);case 4:e._scheduleTokenRefresh();case 5:return t.a(2)}},t,null,[[1,3]])})),1e3*t),this._refreshTimer.unref&&this._refreshTimer.unref()}}},{key:"renew_token",value:(K=zt(xt().m(function e(){var t,n,r=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,n={},t&&(n["X-Expire-Seconds"]=hn(t)),e.n=1,this._request("post","/appmesh/token/renew",null,{headers:n});case 1:return e.a(2)}},e,this)})),function(){return K.apply(this,arguments)})},{key:"get_totp_uri",value:(X=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/totp/secret");case 1:return t=e.v,e.a(2,an.decode(t.data.mfa_uri))}},e,this)})),function(){return X.apply(this,arguments)})},{key:"enable_totp",value:(z=zt(xt().m(function e(t){var n;return xt().w(function(e){for(;;)switch(e.n){case 0:return n={"X-Totp-Code":t},e.n=1,this._request("post","/appmesh/totp/setup",null,{headers:n});case 1:return e.a(2)}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"validate_totp",value:(M=zt(xt().m(function e(t,n,r){var o,s,i,a=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return o=a.length>3&&void 0!==a[3]?a[3]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,s={user_name:t,totp_code:r,totp_challenge:n,expire_seconds:hn(o)},i={"X-Set-Cookie":"true"},e.n=1,this._request("post","/appmesh/totp/validate",s,{headers:i});case 1:return e.a(2)}},e,this)})),function(e,t,n){return M.apply(this,arguments)})},{key:"disable_totp",value:(H=zt(xt().m(function e(){var t,n=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:"self",e.n=1,this._request("post","/appmesh/totp/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(){return H.apply(this,arguments)})},{key:"list_apps",value:(B=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"get_app",value:(I=zt(xt().m(function e(t){var n;return xt().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 I.apply(this,arguments)})},{key:"check_app_health",value:(q=zt(xt().m(function e(t){var n;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,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));case 2:return e.p=2,e.v,e.a(2,!1)}},e,this,[[0,2]])})),function(e){return q.apply(this,arguments)})},{key:"add_app",value:(F=zt(xt().m(function e(t,n){var r;return xt().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 F.apply(this,arguments)})},{key:"delete_app",value:(L=zt(xt().m(function e(t){var n,r;return xt().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 L.apply(this,arguments)})},{key:"enable_app",value:(x=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/enable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"disable_app",value:(D=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"get_app_output",value:(U=zt(xt().m(function e(t){var n,r,o,s,i,a,u,c,l,f,p=arguments;return xt().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]:"",s=p.length>5&&void 0!==p[5]?p[5]:0,i={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:hn(s).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:i});case 1:return a=e.v,u=dn(a.headers,"X-Output-Position"),c=dn(a.headers,"X-Exit-Code"),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new On(a.status,a.data,l,f))}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"run_app_sync",value:(j=zt(xt().m(function e(t){var n,r,o,s,i,a,u,c=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:pn,r=c.length>2&&void 0!==c[2]?c[2]:on.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=c.length>3&&void 0!==c[3]?c[3]:on.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,s={timeout:hn(r),lifecycle:hn(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:s});case 1:return i=e.v,a=null,200===i.status?(n&&n(i.data,0),(u=dn(i.headers,"X-Exit-Code"))&&(a=parseInt(u,10))):n&&n(i.data,0),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"run_app_async",value:(N=zt(xt().m(function e(t){var n,r,o,s,i=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:on.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=i.length>2&&void 0!==i[2]?i[2]:on.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:hn(n),lifecycle:hn(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return s=e.v,e.a(2,new Rn(this,s.data.name,s.data.process_uuid))}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"wait_for_async_run",value:(C=zt(xt().m(function e(t){var n,r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:pn,r=u.length>2&&void 0!==u[2]?u[2]:0,!t){e.n=7;break}o=0,s=new Date,i=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.get_app_output(t.appName,o,0,20480,t.procUid,i);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.delete_app(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-s)/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:"run_task",value:(k=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return(r=s.length>2&&void 0!==s[2]?s[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return k.apply(this,arguments)})},{key:"cancel_task",value:(P=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return P.apply(this,arguments)})},{key:"download_file",value:(A=zt(xt().m(function e(t,r){var o,s,i,a,u,c,l,f,p,h,d,m,y,w,g,b=arguments;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return o=!(b.length>2&&void 0!==b[2])||b[2],s=Ht({},on.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:s,config:{responseType:"arraybuffer"}});case 1:if(200===(i=e.v).status){e.n=2;break}throw new un("Failed to download file: ".concat(t),i.status,i.data);case 2:if(!sn.isNode){e.n=15;break}return e.n=3,n.e(840).then(n.t.bind(n,840,19));case 3:return a=e.v,e.p=4,e.n=5,a.writeFile(r,Buffer.from(i.data));case 5:if(!o||"win32"===process.platform){e.n=12;break}if(u=i.headers,e.p=6,!(c=u["x-file-mode"])){e.n=7;break}return e.n=7,a.chmod(r,parseInt(c,10));case 7:if(l=u["x-file-user"],f=u["x-file-group"],!l||!f){e.n=10;break}return e.n=8,mn(l);case 8:return p=e.v,e.n=9,wn(f);case 9:if(h=e.v,null===p||null===h){e.n=10;break}return e.n=10,a.chown(r,p,h);case 10:e.n=12;break;case 11:e.p=11,w=e.v,console.warn("Warning: Unable to apply file attributes to",r,w.message);case 12:e.n=14;break;case 13:throw e.p=13,g=e.v,new un("Failed to write file to ".concat(r,": ").concat(g.message),i.status);case 14:e.n=16;break;case 15:d=new Blob([i.data]),m=window.URL.createObjectURL(d),(y=document.createElement("a")).style.display="none",y.href=m,y.download=r.split("/").pop(),document.body.appendChild(y),y.click(),window.URL.revokeObjectURL(m),document.body.removeChild(y);case 16:return e.a(2)}},e,this,[[6,11],[4,13]])})),function(e,t){return A.apply(this,arguments)})},{key:"upload_file",value:(S=zt(xt().m(function e(t,r){var o,s,i,a,u,c,l,f,p,h=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(o=!(h.length>2&&void 0!==h[2])||h[2],s=Ht({},on.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(r)),!sn.isNode){e.n=3;break}return e.n=1,n.e(894).then(n.t.bind(n,894,19));case 1:return a=e.v.default,e.n=2,n.e(603).then(n.t.bind(n,603,19));case 2:u=e.v,i=new a,c=r.split("/").pop(),i.append("filename",c),(l=u.statSync(t)).size<10485760?(f=u.readFileSync(t),i.append("file",f,{filename:t.split("/").pop()})):i.append("file",u.createReadStream(t)),o&&(s["X-File-Mode"]=(511&l.mode).toString()),Object.assign(s,i.getHeaders()),e.n=7;break;case 3:if(i=new FormData,!(t instanceof File)){e.n=4;break}p=t.name,e.n=6;break;case 4:if(!(t instanceof Blob)){e.n=5;break}p=r.split("/").pop(),e.n=6;break;case 5:throw new un("In browser, localFile must be File or Blob");case 6:i.append("filename",p),i.append("file",t);case 7:return e.n=8,this._request("post","/appmesh/file/upload",i,{headers:s,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 8:return e.a(2)}},e,this)})),function(e,t){return S.apply(this,arguments)})},{key:"get_host_resources",value:(T=zt(xt().m(function e(){var t;return xt().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:"get_config",value:(R=zt(xt().m(function e(){var t;return xt().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 R.apply(this,arguments)})},{key:"set_config",value:(O=zt(xt().m(function e(t){var n;return xt().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:"set_log_level",value:(E=zt(xt().m(function e(){var t,n,r=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.set_config({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"add_label",value:(v=zt(xt().m(function e(t,n){return xt().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 v.apply(this,arguments)})},{key:"delete_label",value:(_=zt(xt().m(function e(t){return xt().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 _.apply(this,arguments)})},{key:"list_labels",value:(b=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return b.apply(this,arguments)})},{key:"update_password",value:(g=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return r=s.length>2&&void 0!==s[2]?s[2]:"self",o={old_password:an.encode(t),new_password:an.encode(n)},e.n=1,this._request("post","/appmesh/user/".concat(r,"/passwd"),o);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return g.apply(this,arguments)})},{key:"add_user",value:(w=zt(xt().m(function e(t,n){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/user/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return w.apply(this,arguments)})},{key:"delete_user",value:(y=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/user/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return y.apply(this,arguments)})},{key:"lock_user",value:(m=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/user/".concat(t,"/lock"));case 1:return e.a(2,!0)}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"unlock_user",value:(d=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/user/".concat(t,"/unlock"));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"list_users",value:(h=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/users");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return h.apply(this,arguments)})},{key:"get_current_user",value:(p=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/self");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"list_groups",value:(f=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/groups");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"list_permissions",value:(l=zt(xt().m(function e(){var t;return xt().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 l.apply(this,arguments)})},{key:"get_user_permissions",value:(c=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"list_roles",value:(u=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"update_role",value:(a=zt(xt().m(function e(t,n){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return a.apply(this,arguments)})},{key:"delete_role",value:(i=zt(xt().m(function e(t){return xt().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 i.apply(this,arguments)})},{key:"get_metrics",value:(s=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"subscribe",value:(o=zt(xt().m(function e(){return xt().w(function(e){for(;;)switch(e.n){case 0:throw new un("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"unsubscribe",value:(r=zt(xt().m(function e(){return xt().w(function(e){for(;;)switch(e.n){case 0:throw new un("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return r.apply(this,arguments)})},{key:"request",value:(t=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)if(0===e.n)return r=s.length>2&&void 0!==s[2]?s[2]:null,o=s.length>3&&void 0!==s[3]?s[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"_commonHeaders",value:function(){var e={};sn.isNode&&(e[on.HTTP_USER_AGENT_HEADER_NAME]=on.HTTP_USER_AGENT);var t=function(e){if(!e)return null;var t=e.split("; ").find(function(e){return e.startsWith(on.HTTP_COOKIE_NAME_CSRF_TOKEN+"=")});return t?t.split("=")[1]:null};if(sn.isNode){var n=t(this._client.defaults.headers.Cookie);n&&(e[on.HTTP_HEADER_NAME_CSRF_TOKEN]=n)}else{var r=t(document.cookie);r&&(e[on.HTTP_HEADER_NAME_CSRF_TOKEN]=r)}if(this.forwardingHost)if(this.forwardingHost.includes(":"))e[on.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost;else{var o=new URL(this.baseURL),s="https:"===o.protocol?"443":"80",i=o.port||s;e[on.HTTP_HEADER_KEY_X_TARGET_HOST]="".concat(this.forwardingHost,":").concat(i)}return e}},{key:"_request",value:(e=zt(xt().m(function e(t,n){var r,o,s,i,a,u,c,l,f,p,h,d,m,y,w=arguments;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=w.length>2&&void 0!==w[2]?w[2]:null,o=w.length>3&&void 0!==w[3]?w[3]:{},!sn.isNode||!rn||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,rn;case 1:tn&&(this._client.defaults.httpsAgent=new tn.Agent(Bt(Bt({},vn(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return s=o.headers,i=void 0===s?{}:s,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=3,f=Bt(Bt({method:t,url:n,withCredentials:!0},l),{},{headers:Bt({},i),params:Bt({},u)}),null!==r&&(f.data=r),e.n=4,this._client(f);case 4:if(200===(p=e.v).status){e.n=6;break}if(h=this._extractErrorMessage(p.data),p.status!==on.HTTP_STATUS_PRECONDITION_REQUIRED){e.n=5;break}throw new cn(h,p.data);case 5:throw new un(h,p.status,p.data);case 6:return sn.isNode&&p.headers["Set-Cookie".toLowerCase()]&&(d=Array.isArray(p.headers["Set-Cookie".toLowerCase()])?p.headers["Set-Cookie".toLowerCase()]:[p.headers["Set-Cookie".toLowerCase()]],this._client.defaults.headers.Cookie=d.join("; "),(m=d.map(function(e){return e.split(";")[0].trim()}).find(function(e){return e.startsWith("appmesh_auth_token=")}))&&this._handleTokenUpdate(m.substring(19))),e.a(2,p);case 7:if(e.p=7,!((y=e.v)instanceof un&&y.statusCode===on.HTTP_STATUS_PRECONDITION_REQUIRED)){e.n=8;break}throw y;case 8:throw this.onError(y);case 9:return e.a(2)}},e,this,[[3,7]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===Xt(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return console.log("AppMeshClient error:",e),e instanceof un?e:new un(e.message||"Unknown error")}}]);var e,t,r,o,s,i,a,u,c,l,f,p,h,d,m,y,w,g,b,_,v,E,O,R,T,S,A,P,k,C,N,j,U,D,x,L,F,q,I,B,H,M,z,X,K,J,W,V}(),On=Jt(function e(t,n,r,o){Vt(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),Rn=function(){return Jt(function e(t,n,r){Vt(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"with_forwarding_host",value:(t=zt(xt().m(function e(t){var n;return xt().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=zt(xt().m(function e(){var t,n,r=this,o=arguments;return xt().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:pn,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.with_forwarding_host(function(){return r._client.wait_for_async_run(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Tn=En;export{En as AppMeshClient,un as AppMeshError,On as AppOutput,ln as AppRemovedError,Rn as AppRun,bn as DEFAULT_CA_FILE,cn as TotpRequiredError,fn as TransportDisconnectedError,Tn as default};
|
|
1
|
+
var e={};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.m=e,(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;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 s=Object.create(null);n.r(s);const i={};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=>i[e]=()=>r[e]);return i.default=()=>r,n.d(s,i),s}})(),n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],s=t[r++];n.o(e,o)?0===s&&r++:0===s?Object.defineProperty(e,o,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,o,{enumerable:!0,get:s})}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>e+".appmesh.esm.js",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=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{const e={792:0},t=t=>{let{__webpack_esm_ids__:r,__webpack_esm_modules__:o,__webpack_esm_runtime__:s}=t;var i,a,u=0;for(i in o)n.o(o,i)&&(n.m[i]=o[i]);for(s&&s(n);u<r.length;u++)a=r[u],n.o(e,a)&&e[a]&&e[a][0](),e[r[u]]=0};n.f.j=(r,o)=>{let s=n.o(e,r)?e[r]:void 0;if(0!==s)if(s)o.push(s[1]);else{let i=import("./"+n.u(r)).then(t,t=>{throw 0!==e[r]&&(e[r]=void 0),t});i=Promise.race([i,new Promise(t=>s=e[r]=[t])]),o.push(s[1]=i)}}})();var r={};function o(e,t){return function(){return e.apply(t,arguments)}}n.r(r),n.d(r,{hasBrowserEnv:()=>Pe,hasStandardBrowserEnv:()=>Ce,hasStandardBrowserWebWorkerEnv:()=>Ne,navigator:()=>ke,origin:()=>je});const{toString:s}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:a,toStringTag:u}=Symbol,c=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),l=(e,t)=>{let n=e;const r=[];for(;null!=n&&n!==Object.prototype;){if(-1!==r.indexOf(n))return!1;if(r.push(n),c(n,t))return!0;n=i(n)}return!1},f=(p=Object.create(null),e=>{const t=s.call(e);return p[t]||(p[t]=t.slice(8,-1).toLowerCase())});var p;const h=e=>(e=e.toLowerCase(),t=>f(t)===e),d=e=>t=>typeof t===e,{isArray:m}=Array,y=d("undefined");function w(e){return null!==e&&!y(e)&&null!==e.constructor&&!y(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const g=h("ArrayBuffer");const b=d("string"),_=d("function"),v=d("number"),E=e=>null!==e&&"object"==typeof e,O=e=>{if(!E(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==i(t)||l(e,u)||l(e,a))},R=h("Date"),S=h("File"),T=h("Blob"),A=h("FileList");const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},k=void 0!==P.FormData?P.FormData:void 0,C=h("URLSearchParams"),[N,j,U,D]=["ReadableStream","Request","Response","Headers"].map(h);function x(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),m(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(w(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function L(e,t){if(w(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=e=>!y(e)&&e!==F;const I=(B="undefined"!=typeof Uint8Array&&i(Uint8Array),e=>B&&e instanceof B);var B;const H=h("HTMLFormElement"),{propertyIsEnumerable:M}=Object.prototype,z=h("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};x(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const J=h("AsyncFunction"),W=(K="function"==typeof setImmediate,V=_(F.postMessage),K?setImmediate:V?($=`axios@${Math.random()}`,G=[],F.addEventListener("message",({source:e,data:t})=>{e===F&&t===$&&G.length&&G.shift()()},!1),e=>{G.push(e),F.postMessage($,"*")}):e=>setTimeout(e));var K,V,$,G;const Y="undefined"!=typeof queueMicrotask?queueMicrotask.bind(F):"undefined"!=typeof process&&process.nextTick||W,Q=e=>null!=e&&_(e[a]),Z={isArray:m,isArrayBuffer:g,isBuffer:w,isFormData:e=>{if(!e)return!1;if(k&&e instanceof k)return!0;const t=i(e);if(!t||t===Object.prototype)return!1;if(!_(e.append))return!1;const n=f(e);return"formdata"===n||"object"===n&&_(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&g(e.buffer),t},isString:b,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:E,isPlainObject:O,isEmptyObject:e=>{if(!E(e)||w(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:N,isRequest:j,isResponse:U,isHeaders:D,isUndefined:y,isDate:R,isFile:S,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:T,isRegExp:z,isFunction:_,isStream:e=>E(e)&&_(e.pipe),isURLSearchParams:C,isTypedArray:I,isFileList:A,forEach:x,merge:function e(...t){const{caseless:n,skipUndefined:r}=q(this)&&this||{},o={},s=(t,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=n&&"string"==typeof s&&L(o,s)||s,a=c(o,i)?o[i]:void 0;O(a)&&O(t)?o[i]=e(a,t):O(t)?o[i]=e({},t):m(t)?o[i]=t.slice():r&&y(t)||(o[i]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||w(n))continue;if(x(n,s),"object"!=typeof n||m(n))continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];M.call(n,t)&&s(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(x(t,(t,r)=>{n&&_(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,s,a;const u={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:f,kindOfTest:h,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(m(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[a]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:H,hasOwnProperty:c,hasOwnProp:c,hasOwnInPrototypeChain:l,getSafeProp:(e,t)=>null!=e&&l(e,t)?e[t]:void 0,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(_(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];_(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 m(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:L,global:F,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[u]&&e[a])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(E(e)){if(t.has(e))return;if(w(e))return e;if(!("toJSON"in e)){t.add(e);const r=m(e)?[]:{};return x(e,(e,t)=>{const o=n(e);!y(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:J,isThenable:e=>e&&(E(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:W,asap:Y,isIterable:Q,isSafeIterable:e=>null!=e&&l(e,a)&&Q(e)},ee=Z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const te=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ne=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function re(e,t){return Z.isArray(e)?e.map(e=>re(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 oe(e){const t=Object.create(null);return Z.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>re(e,ne))(e)}),t}const se=Symbol("internals");function ie(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:Z.isArray(e)?e.map(ae):(e=>re(e,te))(String(e))}function ue(e,t,n,r,o){return Z.isFunction(r)?r.call(this,t,n):(o&&(t=n),Z.isString(t)?Z.isString(r)?-1!==t.indexOf(r):Z.isRegExp(r)?r.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ie(t);if(!o)return;const s=Z.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=ae(e))}const s=(e,t)=>Z.forEach(e,(e,n)=>o(e,n,t));if(Z.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(Z.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ee[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Z.isObject(e)&&Z.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!Z.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],Z.hasOwnProp(o,r)?(n=o[r],o[r]=Z.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ie(e)){const n=Z.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Z.isFunction(t))return t.call(this,e,n);if(Z.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ie(e)){const n=Z.findKey(this,e);return!(!n||void 0===this[n]||t&&!ue(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ie(e)){const o=Z.findKey(n,e);!o||t&&!ue(0,n[o],o,t)||(delete n[o],r=!0)}}return Z.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&&!ue(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Z.forEach(this,(r,o)=>{const s=Z.findKey(n,o);if(s)return t[s]=ae(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=ae(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Z.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Z.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[se]=this[se]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ie(e);t[r]||(!function(e,t){const n=Z.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 Z.isArray(e)?e.forEach(r):r(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Z.reduceDescriptors(ce.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Z.freezeMethods(ce);const le=ce;function fe(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(Z.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof le&&(e=e.toJSON()),r.push(e),Z.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);Z.isUndefined(r)||(t[n]=r)});else{if(!Z.isPlainObject(e)&&function(e){if(Z.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Z.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,s]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(s);Z.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class pe extends Error{static from(e,t,n,r,o,s){const i=new pe(e.message,t||e.code,n,r,o);return Object.defineProperty(i,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),i.name=e.name,null!=e.status&&null==i.status&&(i.status=e.status),s&&Object.assign(i,s),i}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&&Z.hasOwnProp(e,"redact")?e.redact:void 0,n=Z.isArray(t)&&t.length>0?fe(e,t):Z.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}}}pe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",pe.ERR_BAD_OPTION="ERR_BAD_OPTION",pe.ECONNABORTED="ECONNABORTED",pe.ETIMEDOUT="ETIMEDOUT",pe.ECONNREFUSED="ECONNREFUSED",pe.ERR_NETWORK="ERR_NETWORK",pe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",pe.ERR_DEPRECATED="ERR_DEPRECATED",pe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",pe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",pe.ERR_CANCELED="ERR_CANCELED",pe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",pe.ERR_INVALID_URL="ERR_INVALID_URL",pe.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const he=pe;function de(e){return Z.isPlainObject(e)||Z.isArray(e)}function me(e){return Z.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,n){return e?e.concat(t).map(function(e,t){return e=me(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const we=Z.toFlatObject(Z,{},null,function(e){return/^is[A-Z]/.test(e)});const ge=function(e,t,n){if(!Z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Z.isUndefined(t[e])})).metaTokens,o=n.visitor||h,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,u=void 0===n.maxDepth?100:n.maxDepth,c=a&&Z.isSpecCompliantForm(t),l=[];if(!Z.isFunction(o))throw new TypeError("visitor must be a function");function f(e){if(null===e)return"";if(Z.isDate(e))return e.toISOString();if(Z.isBoolean(e))return e.toString();if(!c&&Z.isBlob(e))throw new he("Blob is not supported. Use a Buffer instead.");if(Z.isArrayBuffer(e)||Z.isTypedArray(e)){if(c&&"function"==typeof a)return new a([e]);if("undefined"!=typeof Buffer)return Buffer.from(e);throw new he("Blob is not supported. Use a Buffer instead.",he.ERR_NOT_SUPPORT)}return e}function p(e){if(e>u)throw new he("Object is too deeply nested ("+e+" levels). Max depth: "+u,he.ERR_FORM_DATA_DEPTH_EXCEEDED)}function h(e,n,o){let a=e;if(Z.isReactNative(t)&&Z.isReactNativeBlob(e))return t.append(ye(o,n,s),f(e)),!1;if(e&&!o&&"object"==typeof e)if(Z.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!Z.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),p(t+n.length-1),r})}(e,1);else if(Z.isArray(e)&&function(e){return Z.isArray(e)&&!e.some(de)}(e)||(Z.isFileList(e)||Z.endsWith(n,"[]"))&&(a=Z.toArray(e)))return n=me(n),a.forEach(function(e,r){!Z.isUndefined(e)&&null!==e&&t.append(!0===i?ye([n],r,s):null===i?n:n+"[]",f(e))}),!1;return!!de(e)||(t.append(ye(o,n,s),f(e)),!1)}const d=Object.assign(we,{defaultVisitor:h,convertValue:f,isVisitable:de});if(!Z.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!Z.isUndefined(n)){if(p(s),-1!==l.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));l.push(n),Z.forEach(n,function(n,i){!0===(!(Z.isUndefined(n)||null===n)&&o.call(t,n,Z.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i],s+1)}),l.pop()}}(e),t};function be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function _e(e,t){this._pairs=[],e&&ge(e,this,t)}const ve=_e.prototype;ve.append=function(e,t){this._pairs.push([e,t])},ve.toString=function(e){const t=e?t=>e.call(this,t,be):be;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ee=_e;function Oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Re(e,t,n){if(!t)return e;e=e||"";const r=Z.isFunction(n)?{serialize:n}:n,o=Z.getSafeProp(r,"encode")||Oe,s=Z.getSafeProp(r,"serialize");let i;if(i=s?s(t,r):Z.isURLSearchParams(t)?t.toString():new Ee(t,r).toString(o),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const Se=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Z.forEach(this.handlers,function(t){null!==t&&e(t)})}},Te={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Pe="undefined"!=typeof window&&"undefined"!=typeof document,ke="object"==typeof navigator&&navigator||void 0,Ce=Pe&&(!ke||["ReactNative","NativeScript","NS"].indexOf(ke.product)<0),Ne="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,je=Pe&&window.location.href||"http://localhost",Ue={...r,...Ae};function De(e){if(e>100)throw new he("FormData field is too deeply nested ("+e+" levels). Max depth: 100",he.ERR_FORM_DATA_DEPTH_EXCEEDED)}const xe=function(e){function t(e,n,r,o){De(o);let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&Z.isArray(r)?r.length:s,a)return Z.hasOwnProp(r,s)?r[s]=Z.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i;Z.hasOwnProp(r,s)&&Z.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&Z.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(Z.isFormData(e)&&Z.isFunction(e.entries)){const n={};return Z.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;null!==(r=n.exec(e));)De(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),n}return null},Le=(e,t)=>null!=e&&Z.hasOwnProp(e,t)?e[t]:void 0;const Fe={transitional:Te,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Z.isObject(e);o&&Z.isHTMLForm(e)&&(e=new FormData(e));if(Z.isFormData(e))return r?JSON.stringify(xe(e)):e;if(Z.isArrayBuffer(e)||Z.isBuffer(e)||Z.isStream(e)||Z.isFile(e)||Z.isBlob(e)||Z.isReadableStream(e))return e;if(Z.isArrayBufferView(e))return e.buffer;if(Z.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){const t=Le(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ge(e,new Ue.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ue.isNode&&Z.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=Z.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Le(this,"env"),r=n&&n.FormData;return ge(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Z.isString(e))try{return(t||JSON.parse)(e),Z.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Le(this,"transitional")||Fe.transitional,n=t&&t.forcedJSONParsing,r=Le(this,"responseType"),o="json"===r;if(Z.isResponse(e)||Z.isReadableStream(e))return e;if(e&&Z.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Le(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw he.from(e,he.ERR_BAD_RESPONSE,this,null,Le(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Z.forEach(["delete","get","head","post","put","patch","query"],e=>{Fe.headers[e]={}});const qe=Fe;function Ie(e,t){const n=this||qe,r=t||n,o=le.from(r.headers);let s=r.data;return Z.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Be(e){return!(!e||!e.__CANCEL__)}const He=class extends he{constructor(e,t,n){super(e??"canceled",he.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Me(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new he("Request failed with status code "+n.status,n.status>=400&&n.status<500?he.ERR_BAD_REQUEST:he.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ze=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=r[i];o||(o=u),n[s]=a,r[s]=u;let l=i,f=0;for(;l!==s;)f+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const p=c&&u-c;return p?Math.round(1e3*f/p):void 0}};const Xe=function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]},Je=(e,t,n=3)=>{let r=0;const o=ze(50,250);return Xe(n=>{if(!n||"number"!=typeof n.loaded)return;const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,u=Math.max(0,a-r),c=o(u);r=Math.max(r,a);e({loaded:a,total:i,progress:i?a/i:void 0,bytes:u,rate:c||void 0,estimated:c&&i?(i-a)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},We=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ke=e=>(...t)=>Z.asap(()=>e(...t)),Ve=Ue.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ue.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ue.origin),Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent)):()=>!0,$e=Ue.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Z.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Z.isString(r)&&a.push(`path=${r}`),Z.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),Z.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)try{return decodeURIComponent(r.slice(o+1))}catch(e){return r.slice(o+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const Ge=/^https?:(?!\/\/)/i,Ye=/[\t\n\r]/g;function Qe(e,t){if("string"==typeof e&&Ge.test(function(e){return function(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}(e).replace(Ye,"")}(e)))throw new he('Invalid URL: missing "//" after protocol',he.ERR_INVALID_URL,t)}function Ze(e,t,n,r){Qe(t,r);let o=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(o||!1===n)?(Qe(e,r),function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t)):t}const et=e=>e instanceof le?{...e}:e;function tt(e,t){e=e||{},t=t||{};const n=Object.create(null);function r(e,t,n,r){return Z.isPlainObject(e)&&Z.isPlainObject(t)?Z.merge.call({caseless:r},e,t):Z.isPlainObject(t)?Z.merge({},t):Z.isArray(t)?t.slice():t}function o(e,t,n,o){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!Z.isUndefined(t))return r(void 0,t)}function i(e,t){return Z.isUndefined(t)?Z.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return Z.hasOwnProp(t,s)?r(n,o):Z.hasOwnProp(e,s)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(et(e),et(t),0,!0)};return Z.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=Z.hasOwnProp(u,r)?u[r]:o,i=s(Z.hasOwnProp(e,r)?e[r]:void 0,Z.hasOwnProp(t,r)?t[r]:void 0,r);Z.isUndefined(i)&&s!==a||(n[r]=i)}),Z.hasOwnProp(t,"validateStatus")&&Z.isUndefined(t.validateStatus)&&!1===function(n){const r=Z.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!Z.isUndefined(r)){if(!Z.isPlainObject(r))return;if(Z.hasOwnProp(r,n))return r[n]}const o=Z.hasOwnProp(e,"transitional")?e.transitional:void 0;if(Z.isPlainObject(o)&&Z.hasOwnProp(o,n))return o[n]}("validateStatusUndefinedResolves")&&(Z.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const nt=["content-type","content-length"];const rt=function(e){const t=tt({},e),n=e=>Z.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const s=n("xsrfHeaderName"),i=n("xsrfCookieName");let a=n("headers");const u=n("auth"),c=n("baseURL"),l=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=le.from(a),t.url=Re(Ze(c,f,l,t),n("params"),n("paramsSerializer")),u){const t=Z.getSafeProp(u,"username")||"",n=Z.getSafeProp(u,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw he.from(t,he.ERR_BAD_OPTION_VALUE,e)}}if(Z.isFormData(r)&&(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv||Z.isReactNative(r)?a.setContentType(void 0):Z.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{nt.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,r.getHeaders(),n("formDataHeaderPolicy"))),Ue.hasStandardBrowserEnv){Z.isFunction(o)&&(o=o(t));if(!0===o||null==o&&Ve(t.url)){const e=s&&i&&$e.read(i);e&&a.set(s,e)}}return t},ot="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=rt(e);let o=r.data;const s=le.from(r.headers).normalize();let i,a,u,c,l,{responseType:f,onUploadProgress:p,onDownloadProgress:h}=r;function d(){c&&c(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=le.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Me(function(e){t(e),d()},function(e){n(e),d()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new he("Request aborted",he.ECONNABORTED,e,m)),d(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new he(r,he.ERR_NETWORK,e,m);o.event=t||null,n(o),d(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Te;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new he(t,o.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,m)),d(),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&Z.forEach(oe(s),function(e,t){m.setRequestHeader(t,e)}),Z.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),h&&([u,l]=Je(h,!0),m.addEventListener("progress",u)),p&&m.upload&&([a,c]=Je(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new He(null,e,m):t),m.abort(),d(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const w=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);if(w&&!Ue.protocols.includes(w))return n(new he("Unsupported protocol "+w+":",he.ERR_BAD_REQUEST,e)),void d();m.send(o||null)})},st=(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,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof he?t:new He(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new he(`timeout of ${t}ms exceeded`,he.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o,{once:!0}));const{signal:a}=n;return a.unsubscribe=()=>Z.asap(i),a},it=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},at=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()}},ut=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of at(e))yield*it(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!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 s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},ct=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,lt=(e,t,n)=>t+2<n&&ct(e.charCodeAt(t+1))&&ct(e.charCodeAt(t+2));const{isFunction:ft}=Z,pt=e=>{if(!Z.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},ht=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},dt=e=>{const t=void 0!==Z.global&&null!==Z.global?Z.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Z.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:s,Response:i}=e,a=o?ft(o):"function"==typeof fetch,u=ft(s),c=ft(i);if(!a)return!1;const l=a&&ft(n),f=a&&("function"==typeof r?(p=new r,e=>p.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var p;const h=u&&l&&ht(()=>{let e=!1;const t=new s(Ue.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),d=c&&l&&ht(()=>Z.isReadableStream(new i("").body)),m={stream:d&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new he(`Response type '${e}' is not supported`,he.ERR_NOT_SUPPORT,n)})});const y=async e=>{if(null==e)return 0;if(Z.isBlob(e))return e.size;if(Z.isSpecCompliantForm(e)){const t=new s(Ue.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Z.isArrayBufferView(e)||Z.isArrayBuffer(e)?e.byteLength:(Z.isURLSearchParams(e)&&(e+=""),Z.isString(e)?(await f(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:a,signal:c,cancelToken:f,timeout:p,onDownloadProgress:w,onUploadProgress:g,responseType:b,headers:_,withCredentials:v="same-origin",fetchOptions:E,maxContentLength:O,maxBodyLength:R}=rt(e);const S=Z.isNumber(O)&&O>-1,T=Z.isNumber(R)&&R>-1;let A=o||fetch;b=b?(b+"").toLowerCase():"text";let P=st([c,f&&f.toAbortSignal()],p),k=null;const C=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let N,j=null;const U=()=>new he("Request body larger than maxBodyLength limit",he.ERR_BAD_REQUEST,e,k);try{let o;const c=(x="auth",Z.hasOwnProp(e,x)?e[x]:void 0);if(c){const e=Z.getSafeProp(c,"username")||"";o={username:e,password:Z.getSafeProp(c,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,Ue.origin);if(!o&&(e.username||e.password)){const t=pt(e.username);o={username:t,password:pt(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(o&&(_.delete("authorization"),_.set("Authorization","Basic "+btoa((D=(o.username||"")+":"+(o.password||""),encodeURIComponent(D).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),S&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n<t;n++)if(37===r.charCodeAt(n)&&n+2<t){const t=r.charCodeAt(n+1),o=r.charCodeAt(n+2);ct(t)&&ct(o)&&(e-=2,n+=2)}let n=0,o=t-1;const s=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):s(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||s(o))&&n++;const i=3*Math.floor(e/4)-(n||0);return i>0?i:0}let o=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);if(37===n&<(r,e,t))o+=1,e+=2;else if(n<128)o+=1;else if(n<2048)o+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=r.charCodeAt(e+1);t>=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}if(T&&"get"!==n&&"head"!==n){const e=await y(a);if("number"==typeof e&&isFinite(e)&&(N=e,e>R))throw U()}const f=T&&(Z.isReadableStream(a)||Z.isStream(a)),p=(e,t,n)=>ut(e,65536,e=>{if(T&&e>R)throw j=U();t&&t(e)},n);if(h&&"get"!==n&&"head"!==n&&(g||f)){if(N=N??await(async(e,t)=>{const n=Z.toFiniteNumber(e.getContentLength());return n??y(t)})(_,a),0!==N||f){let e,n=new s(t,{method:"POST",body:a,duplex:"half"});if(Z.isFormData(a)&&(e=n.headers.get("content-type"))&&_.setContentType(e),n.body){const[e,t]=g&&We(N,Je(Ke(g)))||[];a=p(n.body,e,t)}}}else if(f&&!u&&l&&"get"!==n&&"head"!==n)a=p(a);else if(f&&u&&!h&&"get"!==n&&"head"!==n)throw new he("Stream request bodies are not supported by the current fetch implementation",he.ERR_NOT_SUPPORT,e,k);Z.isString(v)||(v=v?"include":"omit");const L=u&&"credentials"in s.prototype;if(Z.isFormData(a)){const e=_.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&_.delete("content-type")}_.set("User-Agent","axios/1.18.1",!1);const F={...E,signal:P,method:n.toUpperCase(),headers:oe(_.normalize()),body:a,duplex:"half",credentials:L?v:void 0};k=u&&new s(t,F);let q=await(u?A(k,E):A(t,F));const I=le.from(q.headers);if(S){const t=Z.toFiniteNumber(I.getContentLength());if(null!=t&&t>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}const B=d&&("stream"===b||"response"===b);if(d&&q.body&&(w||S||B&&C)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=q[e]});const n=Z.toFiniteNumber(I.getContentLength()),[r,o]=w&&We(n,Je(Ke(w),!0))||[];let s=0;const a=t=>{if(S&&(s=t,s>O))throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k);r&&r(t)};q=new i(ut(q.body,65536,a,()=>{o&&o(),C&&C()}),t)}b=b||"text";let H=await m[Z.findKey(m,b)||"text"](q,e);if(S&&!d&&!B){let t;if(null!=H&&("number"==typeof H.byteLength?t=H.byteLength:"number"==typeof H.size?t=H.size:"string"==typeof H&&(t="function"==typeof r?(new r).encode(H).byteLength:H.length)),"number"==typeof t&&t>O)throw new he("maxContentLength size of "+O+" exceeded",he.ERR_BAD_RESPONSE,e,k)}return!B&&C&&C(),await new Promise((t,n)=>{Me(t,n,{data:H,headers:le.from(q.headers),status:q.status,statusText:q.statusText,config:e,request:k})})}catch(t){if(C&&C(),P&&P.aborted&&P.reason instanceof he){const n=P.reason;throw n.config=e,k&&(n.request=k),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(j)throw k&&!j.request&&(j.request=k),j;if(t instanceof he)throw k&&!t.request&&(t.request=k),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new he("Network Error",he.ERR_NETWORK,e,k,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw he.from(t,t&&t.code,e,k,t&&t.response)}var D,x}},mt=new Map,yt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,u=s.length,c=mt;for(;u--;)i=s[u],a=c.get(i),void 0===a&&c.set(i,a=u?new Map:dt(t)),c=a;return a},wt=(yt(),{http:null,xhr:ot,fetch:{get:yt}});Z.forEach(wt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const gt=e=>`- ${e}`,bt=e=>Z.isFunction(e)||null===e||!1===e;const _t={getAdapter:function(e,t){e=Z.isArray(e)?e:[e];const{length:n}=e;let r,o;const s={};for(let i=0;i<n;i++){let n;if(r=e[i],o=r,!bt(r)&&(o=wt[(n=String(r)).toLowerCase()],void 0===o))throw new he(`Unknown adapter '${n}'`);if(o&&(Z.isFunction(o)||(o=o.get(t))))break;s[n||"#"+i]=o}if(!o){const e=Object.entries(s).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(gt).join("\n"):" "+gt(e[0]):"as no adapter specified";throw new he("There is no suitable adapter to dispatch the request "+t,he.ERR_NOT_SUPPORT)}return o},adapters:wt};function vt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new He(null,e)}function Et(e){vt(e),e.headers=le.from(e.headers),e.data=Ie.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _t.getAdapter(e.adapter||qe.adapter,e)(e).then(function(t){vt(e),e.response=t;try{t.data=Ie.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=le.from(t.headers),t},function(t){if(!Be(t)&&(vt(e),t&&t.response)){e.response=t.response;try{t.response.data=Ie.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=le.from(t.response.headers)}return Promise.reject(t)})}const Ot={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ot[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Rt={};Ot.transitional=function(e,t,n){function r(e,t){return"[Axios v1.18.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new he(r(o," has been removed"+(t?" in "+t:"")),he.ERR_DEPRECATED);return t&&!Rt[o]&&(Rt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},Ot.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const St={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new he("options must be an object",he.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0;if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new he("option "+s+" must be "+n,he.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new he("Unknown option "+s,he.ERR_BAD_OPTION)}},validators:Ot},Tt=St.validators;class At{constructor(e){this.defaults=e||{},this.interceptors={request:new Se,response:new Se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=tt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&St.assertOptions(n,{silentJSONParsing:Tt.transitional(Tt.boolean),forcedJSONParsing:Tt.transitional(Tt.boolean),clarifyTimeoutError:Tt.transitional(Tt.boolean),legacyInterceptorReqResOrdering:Tt.transitional(Tt.boolean),advertiseZstdAcceptEncoding:Tt.transitional(Tt.boolean),validateStatusUndefinedResolves:Tt.transitional(Tt.boolean)},!1),null!=r&&(Z.isFunction(r)?t.paramsSerializer={serialize:r}:St.assertOptions(r,{encode:Tt.function,serialize:Tt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),St.assertOptions(t,{baseUrl:Tt.spelling("baseURL"),withXsrfToken:Tt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&Z.merge(o.common,o[t.method]);o&&Z.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=le.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||Te;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const u=[];let c;this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});let l,f=0;if(!a){const e=[Et.bind(this),void 0];for(e.unshift(...i),e.push(...u),l=e.length,c=Promise.resolve(t);f<l;)c=c.then(e[f++],e[f++]);return c}l=i.length;let p=t;for(;f<l;){const e=i[f++],t=i[f++];try{p=e(p)}catch(e){t.call(this,e);break}}try{c=Et.call(this,p)}catch(e){return Promise.reject(e)}for(f=0,l=u.length;f<l;)c=c.then(u[f++],u[f++]);return c}getUri(e){return Re(Ze((e=tt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}Z.forEach(["delete","get","head","options"],function(e){At.prototype[e]=function(t,n){return this.request(tt(n||{},{method:e,url:t,data:n&&Z.hasOwnProp(n,"data")?n.data:void 0}))}}),Z.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(tt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}At.prototype[e]=t(),"query"!==e&&(At.prototype[e+"Form"]=t(!0))});const Pt=At;class kt{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 He(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 kt(function(t){e=t}),cancel:e}}}const Ct=kt;const Nt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Nt).forEach(([e,t])=>{Nt[t]=e});const jt=Nt;const Ut=function e(t){const n=new Pt(t),r=o(Pt.prototype.request,n);return Z.extend(r,Pt.prototype,n,{allOwnKeys:!0}),Z.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(tt(t,n))},r}(qe);Ut.Axios=Pt,Ut.CanceledError=He,Ut.CancelToken=Ct,Ut.isCancel=Be,Ut.VERSION="1.18.1",Ut.toFormData=ge,Ut.AxiosError=he,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return Z.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=tt,Ut.AxiosHeaders=le,Ut.formToJSON=e=>xe(Z.isHTMLForm(e)?new FormData(e):e),Ut.getAdapter=_t.getAdapter,Ut.HttpStatusCode=jt,Ut.default=Ut;const Dt=Ut;function xt(){/*! 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 s(n,r,o,s){var u=r&&r.prototype instanceof a?r:a,c=Object.create(u.prototype);return Lt(c,"_invoke",function(n,r,o){var s,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 s=t,a=0,u=e,p.n=n,i}};function h(n,r){for(a=n,u=r,t=0;!f&&c&&!o&&t<l.length;t++){var o,s=l[t],h=p.p,d=s[2];n>3?(o=d===r)&&(u=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=e):s[0]<=h&&((o=n<2&&h<s[1])?(a=0,p.v=r,p.n=s[1]):h<d&&(o=n<3||s[0]>r||r>d)&&(s[4]=n,s[5]=r,p.n=d,a=0))}if(o||n>1)return i;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;){s||(a?a<3?(a>1&&(p.n=-1),h(a,u)):p.n=u:p.v=u);try{if(c=2,s){if(a||(o="next"),t=s[o]){if(!(t=t.call(s,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=s.return)&&t.call(s),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);s=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==i)break}catch(t){s=e,a=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,o,s),!0),c}var i={};function a(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Lt(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,Lt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,Lt(f,"constructor",c),Lt(c,"constructor",u),u.displayName="GeneratorFunction",Lt(c,o,"GeneratorFunction"),Lt(f),Lt(f,o,"Generator"),Lt(f,r,function(){return this}),Lt(f,"toString",function(){return"[object Generator]"}),(xt=function(){return{w:s,m:p}})()}function Lt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Lt=function(e,t,n,r){function s(t,n){Lt(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:(s("next",0),s("throw",1),s("return",2))},Lt(e,t,n,r)}function Ft(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,s,i,a=[],u=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=s.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&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qt(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)?qt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qt(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 It(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 Bt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?It(Object(n),!0).forEach(function(t){Ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):It(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ht(e,t,n){return(t=Kt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mt(e,t,n,r,o,s,i){try{var a=e[s](i),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function zt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function i(e){Mt(s,r,o,i,a,"next",e)}function a(e){Mt(s,r,o,i,a,"throw",e)}i(void 0)})}}function Xt(e){return Xt="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},Xt(e)}function Jt(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,Kt(r.key),r)}}function Wt(e,t,n){return t&&Jt(e.prototype,t),n&&Jt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kt(e){var t=function(e,t){if("object"!=Xt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Xt(t)?t:t+""}function Vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(e,t,n){return t=en(t),function(e,t){if(t&&("object"==Xt(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,Qt()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))}function Gt(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&&Zt(e,t)}function Yt(e){var t="function"==typeof Map?new Map:void 0;return Yt=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(Qt())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Zt(o,n.prototype),o}(e,arguments,en(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Zt(n,e)},Yt(e)}function Qt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Qt=function(){return!!e})()}function Zt(e,t){return Zt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zt(e,t)}function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},en(e)}var tn=null,nn=null,rn=null,on=Object.freeze({HTTP_USER_AGENT_HEADER_NAME:"User-Agent",HTTP_USER_AGENT:"appmesh/javascript",HTTP_STATUS_PRECONDITION_REQUIRED:428,DEFAULT_TOKEN_EXPIRE_SECONDS:"P1W",DEFAULT_RUN_APP_TIMEOUT_SECONDS:"P2D",DEFAULT_RUN_APP_LIFECYCLE_SECONDS:"P2DT12H",DEFAULT_JWT_AUDIENCE:"appmesh-service",HTTP_HEADER_KEY_AUTH:"Authorization",HTTP_HEADER_KEY_X_TARGET_HOST:"X-Target-Host",HTTP_HEADER_KEY_X_FILE_PATH:"X-File-Path"}),sn=Object.freeze({isNode:!("undefined"!=typeof window&&void 0!==window.document)}),an=sn.isNode?{encode:function(e){return Buffer.from(e).toString("base64")},decode:function(e){return Buffer.from(e,"base64").toString()}}:{encode:function(e){return btoa(e)},decode:function(e){return atob(e)}},un=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,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return Vt(this,e),(n=$t(this,e,[t])).name="AppMeshError",n.statusCode=r,n.responseData=o,n.errorCode=s,n.timestamp=(new Date).toISOString(),n}return Gt(e,Yt(Error)),Wt(e)}(),cn=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Vt(this,e),(n=$t(this,e,[t,428,r,"TOTP_REQUIRED"])).name="TotpRequiredError";var o=r;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){o=null}return n.totpChallenge=o&&"object"===Xt(o)&&"string"==typeof o.totp_challenge?o.totp_challenge:null,n}return Gt(e,un),Wt(e)}(),ln=function(){function e(t){var n;return Vt(this,e),(n=$t(this,e,[t,null,null,"APP_REMOVED"])).name="AppRemovedError",n}return Gt(e,un),Wt(e)}(),fn=function(){function e(t){var n;return Vt(this,e),(n=$t(this,e,[t,null,null,"TRANSPORT_DISCONNECTED"])).name="TransportDisconnectedError",n}return Gt(e,un),Wt(e)}(),pn=function(e,t){sn.isNode?process.stdout.write(e):console.log(e)};function hn(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)?"),s="P(?:".concat(r,"(?:").concat(o,")?)"),i=["years","months","weeks","days","hours","minutes","seconds"],a=e.replace(/,/g,".").match(new RegExp(s));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[i[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 dn(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 mn(e){return yn.apply(this,arguments)}function yn(){return(yn=zt(xt().m(function e(t){var r,o,s,i;return xt().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.bind(n,994,19));case 2:if(o=e.v,s=o.spawnSync,0===(i=s("id",["-u",t],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=3;break}return e.a(2,null);case 3:return e.a(2,parseInt(i.stdout.trim(),10));case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}function wn(e){return gn.apply(this,arguments)}function gn(){return(gn=zt(xt().m(function e(t){var r,o,s,i,a;return xt().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.bind(n,994,19));case 2:if(o=e.v,s=o.spawnSync,0===(i=s("getent",["group",t],{encoding:"utf8",timeout:3e3})).status&&i.stdout){e.n=3;break}return e.a(2,null);case 3:return a=i.stdout.trim().split(":"),e.a(2,a.length>=3?parseInt(a[2],10):null);case 4:return e.p=4,e.v,e.a(2,null)}},e,null,[[1,4]])}))).apply(this,arguments)}var bn="/opt/appmesh/ssl/ca.pem";function _n(e){return"string"!=typeof e||e.includes("-----BEGIN")?e:nn.readFileSync(e)}function vn(e){if(!1===e)return{rejectUnauthorized:!1};if(!e)return nn.existsSync(bn)?{ca:nn.readFileSync(bn),rejectUnauthorized:!0}:{rejectUnauthorized:!0};for(var t=Bt({},e),n=0,r=["ca","cert","key"];n<r.length;n++){var o=r[n];t[o]&&(t[o]=_n(t[o]))}return"boolean"!=typeof t.rejectUnauthorized&&(t.rejectUnauthorized=!0),t}var En=function(){return Wt(function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn.isNode?"https://127.0.0.1:6060":window.location.origin,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Vt(this,e),this.baseURL=r,this.forwardingHost=null,this._token=null;var s={baseURL:r,timeout:3e5,validateStatus:function(e){return!0}};this._sslConfig=o,this._client=Dt.create(s),sn.isNode&&!rn&&(rn=Promise.all([n.e(453).then(n.t.bind(n,453,19)),n.e(603).then(n.t.bind(n,603,19))]).then(function(e){var t=Ft(e,2),n=t[0],r=t[1];tn=n.default||n,nn=r.default||r}).catch(function(){})),this._client.interceptors.request.use(function(e){return e.headers=Bt(Bt({},e.headers),t._commonHeaders()),e},function(e){var t=new un("Request configuration error: "+(e.message||"Unknown error"));return Promise.reject(t)}),this._client.interceptors.response.use(function(e){return e},function(e){var t,n,r,o,s=new un("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 s.cause=e,Promise.reject(s)})},[{key:"login",value:(V=zt(xt().m(function e(t,n){var r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(r=u.length>2&&void 0!==u[2]?u[2]:null,o=u.length>3&&void 0!==u[3]?u[3]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,s=u.length>4&&void 0!==u[4]?u[4]:on.DEFAULT_JWT_AUDIENCE,t&&n){e.n=1;break}throw new un("Username and password are required",400,null,"INVALID_CREDENTIALS");case 1:return i=an.encode("".concat(t,":").concat(n)),a=Ht(Ht({},on.HTTP_HEADER_KEY_AUTH,"Basic ".concat(i)),"X-Set-Cookie","true"),r&&(a["X-Totp-Code"]=r),o&&(a["X-Expire-Seconds"]=hn(o)),s&&(a["X-Audience"]=s),e.n=2,this._request("post","/appmesh/login",null,{headers:a});case 2:return e.a(2)}},e,this)})),function(e,t){return V.apply(this,arguments)})},{key:"authenticate",value:(K=zt(xt().m(function e(t){var n,r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:null,r=u.length>2&&void 0!==u[2]?u[2]:on.DEFAULT_JWT_AUDIENCE,o=!(u.length>3&&void 0!==u[3])||u[3],s={Authorization:"Bearer ".concat(t)},n&&(s["X-Permission"]=n),r&&(s["X-Audience"]=r),o&&(s["X-Set-Cookie"]="true"),e.n=1,this._request("post","/appmesh/auth",null,{headers:s});case 1:return i=e.v,a="string"==typeof i.data?i.data:JSON.stringify(i.data),e.a(2,{success:!0,responseText:a})}},e,this)})),function(e){return K.apply(this,arguments)})},{key:"set_token",value:function(e){sn.isNode?this._handleTokenUpdate(e):console.warn("set_token() is not supported in browser mode (auth cookie is HttpOnly). Use authenticate() instead.")}},{key:"_getAccessToken",value:function(){return this._token||null}},{key:"_handleTokenUpdate",value:function(e){var t="appmesh_auth_token";if(this._token=e||null,sn.isNode&&this._token){var n=(this._client.defaults.headers.Cookie||"").split("; ").filter(function(e){return e&&!e.startsWith(t+"=")});n.push("".concat(t,"=").concat(this._token)),this._client.defaults.headers.Cookie=n.join("; ")}this._autoRefreshJwt=this._token,this._autoRefreshEnabled&&this._scheduleTokenRefresh()}},{key:"logout",value:(W=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request("post","/appmesh/self/logoff");case 1:e.n=3;break;case 2:e.p=2,t=e.v,console.error("Failed to logoff:",t.message);case 3:return e.p=3,sn.isNode&&this._client.defaults.httpsAgent&&this._client.defaults.httpsAgent.destroy(),this._stopAutoRefresh(),this._token=null,sn.isNode&&(this._client.defaults.headers.Cookie=null),e.f(3);case 4:return e.a(2)}},e,this,[[0,2,3,4]])})),function(){return W.apply(this,arguments)})},{key:"set_auto_refresh_token",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._stopAutoRefresh(),this._autoRefreshEnabled=e,e&&(this._autoRefreshJwt=t||this._getAccessToken()||null,this._scheduleTokenRefresh())}},{key:"_stopAutoRefresh",value:function(){this._autoRefreshEnabled=!1,this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null)}},{key:"_scheduleTokenRefresh",value:function(){var e=this;if(this._autoRefreshEnabled){this._refreshTimer&&(clearTimeout(this._refreshTimer),this._refreshTimer=null);var t=300,n=this._autoRefreshJwt||this._getAccessToken();if(n){var r=function(e){try{var t=e.split(".");if(3!==t.length)return null;var n=JSON.parse(an.decode(t[1].replace(/-/g,"+").replace(/_/g,"/")));return"number"==typeof n.exp?n.exp:null}catch(e){return null}}(n);if(r){var o=r-Math.floor(Date.now()/1e3);t=o<=30?1:Math.min(o-30,300)}}this._refreshTimer=setTimeout(zt(xt().m(function t(){var n;return xt().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e._autoRefreshEnabled){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,e.renew_token();case 2:t.n=4;break;case 3:t.p=3,n=t.v,console.warn("Auto-refresh: token renewal failed:",n.message);case 4:e._scheduleTokenRefresh();case 5:return t.a(2)}},t,null,[[1,3]])})),1e3*t),this._refreshTimer.unref&&this._refreshTimer.unref()}}},{key:"renew_token",value:(J=zt(xt().m(function e(){var t,n,r=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,n={},t&&(n["X-Expire-Seconds"]=hn(t)),e.n=1,this._request("post","/appmesh/token/renew",null,{headers:n});case 1:return e.a(2)}},e,this)})),function(){return J.apply(this,arguments)})},{key:"get_totp_uri",value:(X=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/totp/secret");case 1:return t=e.v,e.a(2,an.decode(t.data.mfa_uri))}},e,this)})),function(){return X.apply(this,arguments)})},{key:"enable_totp",value:(z=zt(xt().m(function e(t){var n;return xt().w(function(e){for(;;)switch(e.n){case 0:return n={"X-Totp-Code":t},e.n=1,this._request("post","/appmesh/totp/setup",null,{headers:n});case 1:return e.a(2)}},e,this)})),function(e){return z.apply(this,arguments)})},{key:"validate_totp",value:(M=zt(xt().m(function e(t,n,r){var o,s,i,a=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return o=a.length>3&&void 0!==a[3]?a[3]:on.DEFAULT_TOKEN_EXPIRE_SECONDS,s={user_name:t,totp_code:r,totp_challenge:n,expire_seconds:hn(o)},i={"X-Set-Cookie":"true"},e.n=1,this._request("post","/appmesh/totp/validate",s,{headers:i});case 1:return e.a(2)}},e,this)})),function(e,t,n){return M.apply(this,arguments)})},{key:"disable_totp",value:(H=zt(xt().m(function e(){var t,n=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:"self",e.n=1,this._request("post","/appmesh/totp/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(){return H.apply(this,arguments)})},{key:"list_apps",value:(B=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/applications");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return B.apply(this,arguments)})},{key:"get_app",value:(I=zt(xt().m(function e(t){var n;return xt().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 I.apply(this,arguments)})},{key:"check_app_health",value:(q=zt(xt().m(function e(t){var n,r;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,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));case 2:if(e.p=2,null==(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 q.apply(this,arguments)})},{key:"add_app",value:(F=zt(xt().m(function e(t,n){var r;return xt().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 F.apply(this,arguments)})},{key:"delete_app",value:(L=zt(xt().m(function e(t){var n,r;return xt().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 L.apply(this,arguments)})},{key:"enable_app",value:(x=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/enable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return x.apply(this,arguments)})},{key:"disable_app",value:(D=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/app/".concat(t,"/disable"));case 1:return e.a(2,!0)}},e,this)})),function(e){return D.apply(this,arguments)})},{key:"get_app_output",value:(U=zt(xt().m(function e(t){var n,r,o,s,i,a,u,c,l,f,p=arguments;return xt().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]:"",s=p.length>5&&void 0!==p[5]?p[5]:0,i={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:hn(s).toString()},e.n=1,this._request("get","/appmesh/app/".concat(t,"/output"),null,{params:i});case 1:return a=e.v,u=dn(a.headers,"X-Output-Position"),c=dn(a.headers,"X-Exit-Code"),l=u?parseInt(u,10):null,f=c?parseInt(c,10):null,e.a(2,new On(a.status,a.data,l,f))}},e,this)})),function(e){return U.apply(this,arguments)})},{key:"run_app_sync",value:(j=zt(xt().m(function e(t){var n,r,o,s,i,a,u,c=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:pn,r=c.length>2&&void 0!==c[2]?c[2]:on.DEFAULT_RUN_APP_TIMEOUT_SECONDS,o=c.length>3&&void 0!==c[3]?c[3]:on.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,s={timeout:hn(r),lifecycle:hn(o)},e.n=1,this._request("post","/appmesh/app/syncrun",t,{params:s});case 1:return i=e.v,a=null,200===i.status?(n&&n(i.data,0),(u=dn(i.headers,"X-Exit-Code"))&&(a=parseInt(u,10))):n&&n(i.data,0),e.a(2,a)}},e,this)})),function(e){return j.apply(this,arguments)})},{key:"run_app_async",value:(N=zt(xt().m(function e(t){var n,r,o,s,i=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:on.DEFAULT_RUN_APP_TIMEOUT_SECONDS,r=i.length>2&&void 0!==i[2]?i[2]:on.DEFAULT_RUN_APP_LIFECYCLE_SECONDS,o={timeout:hn(n),lifecycle:hn(r)},e.n=1,this._request("post","/appmesh/app/run",t,{params:o});case 1:return s=e.v,e.a(2,new Rn(this,s.data.name,s.data.process_uuid))}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"wait_for_async_run",value:(C=zt(xt().m(function e(t){var n,r,o,s,i,a,u=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:pn,r=u.length>2&&void 0!==u[2]?u[2]:0,!t){e.n=7;break}o=0,s=new Date,i=1;case 1:if(!(t.procUid.length>0)){e.n=7;break}return e.n=2,this.get_app_output(t.appName,o,0,20480,t.procUid,i);case 2:if((a=e.v).output&&n&&n(a.output,o),null!==a.outPosition&&(o=a.outPosition),null===a.exitCode){e.n=4;break}return e.n=3,this.delete_app(t.appName);case 3:return e.a(2,a.exitCode);case 4:if(!(r>0&&(new Date-s)/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:"run_task",value:(k=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return(r=s.length>2&&void 0!==s[2]?s[2]:300)<=0&&(r=300),e.n=1,this._request("post","/appmesh/app/".concat(t,"/task"),n,{params:{timeout:r.toString()}});case 1:return o=e.v,e.a(2,o.data)}},e,this)})),function(e,t){return k.apply(this,arguments)})},{key:"cancel_task",value:(P=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/app/".concat(t,"/task"));case 1:return e.a(2,!0)}},e,this)})),function(e){return P.apply(this,arguments)})},{key:"download_file",value:(A=zt(xt().m(function e(t){var r,o,s,i,a,u,c,l,f,p,h,d,m,y,w,g,b=arguments;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:return o=!(b.length>2&&void 0!==b[2])||b[2],(r=b.length>1&&void 0!==b[1]?b[1]:null)||(r=t.split(/[\\/]/).pop()),s=Ht({},on.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(t)),e.n=1,this._request("get","/appmesh/file/download",null,{headers:s,config:{responseType:"arraybuffer"}});case 1:if(200===(i=e.v).status){e.n=2;break}throw new un("Failed to download file: ".concat(t),i.status,i.data);case 2:if(!sn.isNode){e.n=15;break}return e.n=3,n.e(840).then(n.t.bind(n,840,19));case 3:return a=e.v,e.p=4,e.n=5,a.writeFile(r,Buffer.from(i.data));case 5:if(!o||"win32"===process.platform){e.n=12;break}if(u=i.headers,e.p=6,!(c=u["x-file-mode"])){e.n=7;break}return e.n=7,a.chmod(r,parseInt(c,10));case 7:if(l=u["x-file-user"],f=u["x-file-group"],!l||!f){e.n=10;break}return e.n=8,mn(l);case 8:return p=e.v,e.n=9,wn(f);case 9:if(h=e.v,null===p||null===h){e.n=10;break}return e.n=10,a.chown(r,p,h);case 10:e.n=12;break;case 11:e.p=11,w=e.v,console.warn("Warning: Unable to apply file attributes to",r,w.message);case 12:e.n=14;break;case 13:throw e.p=13,g=e.v,new un("Failed to write file to ".concat(r,": ").concat(g.message),i.status);case 14:e.n=16;break;case 15:d=new Blob([i.data]),m=window.URL.createObjectURL(d),(y=document.createElement("a")).style.display="none",y.href=m,y.download=r.split("/").pop(),document.body.appendChild(y),y.click(),window.URL.revokeObjectURL(m),document.body.removeChild(y);case 16:return e.a(2)}},e,this,[[6,11],[4,13]])})),function(e){return A.apply(this,arguments)})},{key:"upload_file",value:(T=zt(xt().m(function e(t){var r,o,s,i,a,u,c,l,f,p,h=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:if(o=!(h.length>2&&void 0!==h[2])||h[2],(r=h.length>1&&void 0!==h[1]?h[1]:null)||(r=t.split(/[\\/]/).pop()),s=Ht({},on.HTTP_HEADER_KEY_X_FILE_PATH,encodeURIComponent(r)),!sn.isNode){e.n=3;break}return e.n=1,n.e(894).then(n.t.bind(n,894,19));case 1:return a=e.v.default,e.n=2,n.e(603).then(n.t.bind(n,603,19));case 2:u=e.v,i=new a,c=r.split("/").pop(),i.append("filename",c),(l=u.statSync(t)).size<10485760?(f=u.readFileSync(t),i.append("file",f,{filename:t.split("/").pop()})):i.append("file",u.createReadStream(t)),o&&(s["X-File-Mode"]=(511&l.mode).toString()),Object.assign(s,i.getHeaders()),e.n=7;break;case 3:if(i=new FormData,!(t instanceof File)){e.n=4;break}p=t.name,e.n=6;break;case 4:if(!(t instanceof Blob)){e.n=5;break}p=r.split("/").pop(),e.n=6;break;case 5:throw new un("In browser, localFile must be File or Blob");case 6:i.append("filename",p),i.append("file",t);case 7:return e.n=8,this._request("post","/appmesh/file/upload",i,{headers:s,config:{maxBodyLength:1/0,maxContentLength:1/0}});case 8:return e.a(2)}},e,this)})),function(e){return T.apply(this,arguments)})},{key:"get_host_resources",value:(S=zt(xt().m(function e(){var t;return xt().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 S.apply(this,arguments)})},{key:"get_config",value:(R=zt(xt().m(function e(){var t;return xt().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 R.apply(this,arguments)})},{key:"set_config",value:(O=zt(xt().m(function e(t){var n;return xt().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:"set_log_level",value:(E=zt(xt().m(function e(){var t,n,r=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"DEBUG",e.n=1,this.set_config({BaseConfig:{LogLevel:t}});case 1:return n=e.v,e.a(2,n.BaseConfig.LogLevel)}},e,this)})),function(){return E.apply(this,arguments)})},{key:"add_label",value:(v=zt(xt().m(function e(t,n){return xt().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 v.apply(this,arguments)})},{key:"delete_label",value:(_=zt(xt().m(function e(t){return xt().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 _.apply(this,arguments)})},{key:"list_labels",value:(b=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/labels");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return b.apply(this,arguments)})},{key:"update_password",value:(g=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)switch(e.n){case 0:return r=s.length>2&&void 0!==s[2]?s[2]:"self",o={old_password:an.encode(t),new_password:an.encode(n)},e.n=1,this._request("post","/appmesh/user/".concat(r,"/passwd"),o);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return g.apply(this,arguments)})},{key:"add_user",value:(w=zt(xt().m(function e(t,n){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("put","/appmesh/user/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return w.apply(this,arguments)})},{key:"delete_user",value:(y=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("delete","/appmesh/user/".concat(t));case 1:return e.a(2,!0)}},e,this)})),function(e){return y.apply(this,arguments)})},{key:"lock_user",value:(m=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/user/".concat(t,"/lock"));case 1:return e.a(2,!0)}},e,this)})),function(e){return m.apply(this,arguments)})},{key:"unlock_user",value:(d=zt(xt().m(function e(t){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/user/".concat(t,"/unlock"));case 1:return e.a(2,!0)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"list_users",value:(h=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/users");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return h.apply(this,arguments)})},{key:"get_current_user",value:(p=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/self");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"list_groups",value:(f=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/groups");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"list_permissions",value:(l=zt(xt().m(function e(){var t;return xt().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 l.apply(this,arguments)})},{key:"get_user_permissions",value:(c=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/user/permissions");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return c.apply(this,arguments)})},{key:"list_roles",value:(u=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/roles");case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return u.apply(this,arguments)})},{key:"update_role",value:(a=zt(xt().m(function e(t,n){return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("post","/appmesh/role/".concat(t),n);case 1:return e.a(2,!0)}},e,this)})),function(e,t){return a.apply(this,arguments)})},{key:"delete_role",value:(i=zt(xt().m(function e(t){return xt().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 i.apply(this,arguments)})},{key:"get_metrics",value:(s=zt(xt().m(function e(){var t;return xt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._request("get","/appmesh/metrics",null,{config:{responseType:"text"}});case 1:return t=e.v,e.a(2,t.data)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"subscribe",value:(o=zt(xt().m(function e(){return xt().w(function(e){for(;;)switch(e.n){case 0:throw new un("subscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return o.apply(this,arguments)})},{key:"unsubscribe",value:(r=zt(xt().m(function e(){return xt().w(function(e){for(;;)switch(e.n){case 0:throw new un("unsubscribe requires the TCP client (AppMeshClientTCP, imported from 'appmesh/tcp'); the HTTP client does not support event subscriptions");case 1:return e.a(2)}},e)})),function(){return r.apply(this,arguments)})},{key:"request",value:(t=zt(xt().m(function e(t,n){var r,o,s=arguments;return xt().w(function(e){for(;;)if(0===e.n)return r=s.length>2&&void 0!==s[2]?s[2]:null,o=s.length>3&&void 0!==s[3]?s[3]:{},e.a(2,this._request(t,n,r,o))},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"_commonHeaders",value:function(){var e={};if(sn.isNode&&(e[on.HTTP_USER_AGENT_HEADER_NAME]=on.HTTP_USER_AGENT),this.forwardingHost)if(this.forwardingHost.includes(":"))e[on.HTTP_HEADER_KEY_X_TARGET_HOST]=this.forwardingHost;else{var t=new URL(this.baseURL),n="https:"===t.protocol?"443":"80",r=t.port||n;e[on.HTTP_HEADER_KEY_X_TARGET_HOST]="".concat(this.forwardingHost,":").concat(r)}return e}},{key:"_request",value:(e=zt(xt().m(function e(t,n){var r,o,s,i,a,u,c,l,f,p,h,d,m,y,w=arguments;return xt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=w.length>2&&void 0!==w[2]?w[2]:null,o=w.length>3&&void 0!==w[3]?w[3]:{},!sn.isNode||!rn||this._client.defaults.httpsAgent){e.n=2;break}return e.n=1,rn;case 1:tn&&(this._client.defaults.httpsAgent=new tn.Agent(Bt(Bt({},vn(this._sslConfig)),{},{keepAlive:!0,keepAliveMsecs:3e3})));case 2:return s=o.headers,i=void 0===s?{}:s,a=o.params,u=void 0===a?{}:a,c=o.config,l=void 0===c?{}:c,e.p=3,f=Bt(Bt({method:t,url:n,withCredentials:!0},l),{},{headers:Bt({},i),params:Bt({},u)}),null!==r&&(f.data=r),e.n=4,this._client(f);case 4:if(200===(p=e.v).status){e.n=6;break}if(h=this._extractErrorMessage(p.data),p.status!==on.HTTP_STATUS_PRECONDITION_REQUIRED){e.n=5;break}throw new cn(h,p.data);case 5:throw new un(h,p.status,p.data);case 6:return sn.isNode&&p.headers["Set-Cookie".toLowerCase()]&&(d=Array.isArray(p.headers["Set-Cookie".toLowerCase()])?p.headers["Set-Cookie".toLowerCase()]:[p.headers["Set-Cookie".toLowerCase()]],this._client.defaults.headers.Cookie=d.join("; "),(m=d.map(function(e){return e.split(";")[0].trim()}).find(function(e){return e.startsWith("appmesh_auth_token=")}))&&this._handleTokenUpdate(m.substring(19))),e.a(2,p);case 7:if(e.p=7,!((y=e.v)instanceof un&&y.statusCode===on.HTTP_STATUS_PRECONDITION_REQUIRED)){e.n=8;break}throw y;case 8:throw this.onError(y);case 9:return e.a(2)}},e,this,[[3,7]])})),function(t,n){return e.apply(this,arguments)})},{key:"_extractErrorMessage",value:function(e){if(!e)return"Unknown error";if(e instanceof ArrayBuffer)try{var t=new TextDecoder("utf-8").decode(e);try{var n=JSON.parse(t);return n.message||n.error||"Binary response error"}catch(e){return t}}catch(e){return"Binary response error (could not decode)"}if("string"==typeof e)try{var r=JSON.parse(e);return r.message||r.error||e}catch(t){return e}return"object"===Xt(e)?e.message||e.error||JSON.stringify(e):String(e)}},{key:"onError",value:function(e){return console.log("AppMeshClient error:",e),e instanceof un?e:new un(e.message||"Unknown error")}}]);var e,t,r,o,s,i,a,u,c,l,f,p,h,d,m,y,w,g,b,_,v,E,O,R,S,T,A,P,k,C,N,j,U,D,x,L,F,q,I,B,H,M,z,X,J,W,K,V}(),On=Wt(function e(t,n,r,o){Vt(this,e),this.statusCode=Number(t),this.output=String(n),this.outPosition=null!==r?Number(r):null,this.exitCode=null!==o?Number(o):null}),Rn=function(){return Wt(function e(t,n,r){Vt(this,e),this.appName=n,this.procUid=r,this._client=t,this._forwardingHost=t.forwardingHost},[{key:"with_forwarding_host",value:(t=zt(xt().m(function e(t){var n;return xt().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=zt(xt().m(function e(){var t,n,r=this,o=arguments;return xt().w(function(e){for(;;)if(0===e.n)return t=o.length>0&&void 0!==o[0]?o[0]:pn,n=o.length>1&&void 0!==o[1]?o[1]:0,e.a(2,this.with_forwarding_host(function(){return r._client.wait_for_async_run(r,t,n)}))},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t}();const Sn=En;export{En as AppMeshClient,un as AppMeshError,On as AppOutput,ln as AppRemovedError,Rn as AppRun,bn as DEFAULT_CA_FILE,cn as TotpRequiredError,fn as TransportDisconnectedError,Sn as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appmesh",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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",
|
|
@@ -23,8 +23,13 @@
|
|
|
23
23
|
"import": "./dist/appmesh.esm.js",
|
|
24
24
|
"default": "./dist/appmesh.esm.js"
|
|
25
25
|
},
|
|
26
|
+
"./worker": {
|
|
27
|
+
"node": "./src/worker.js",
|
|
28
|
+
"import": null,
|
|
29
|
+
"default": null
|
|
30
|
+
},
|
|
26
31
|
"./server": {
|
|
27
|
-
"node": "./src/
|
|
32
|
+
"node": "./src/worker.js",
|
|
28
33
|
"import": null,
|
|
29
34
|
"default": null
|
|
30
35
|
},
|
package/src/appmesh.js
CHANGED
|
@@ -15,8 +15,6 @@ const CONSTANTS = Object.freeze({
|
|
|
15
15
|
DEFAULT_RUN_APP_TIMEOUT_SECONDS: "P2D",
|
|
16
16
|
DEFAULT_RUN_APP_LIFECYCLE_SECONDS: "P2DT12H",
|
|
17
17
|
DEFAULT_JWT_AUDIENCE: "appmesh-service",
|
|
18
|
-
HTTP_HEADER_NAME_CSRF_TOKEN: "X-CSRF-Token",
|
|
19
|
-
HTTP_COOKIE_NAME_CSRF_TOKEN: "appmesh_csrf_token",
|
|
20
18
|
HTTP_HEADER_KEY_AUTH: "Authorization",
|
|
21
19
|
HTTP_HEADER_KEY_X_TARGET_HOST: "X-Target-Host",
|
|
22
20
|
HTTP_HEADER_KEY_X_FILE_PATH: "X-File-Path",
|
|
@@ -498,11 +496,10 @@ class AppMeshClient {
|
|
|
498
496
|
this._stopAutoRefresh();
|
|
499
497
|
this._token = null;
|
|
500
498
|
|
|
501
|
-
//
|
|
499
|
+
// Clear the outgoing auth cookie (Node); the browser's HttpOnly auth cookie is cleared
|
|
500
|
+
// server-side on logoff.
|
|
502
501
|
if (ENV.isNode) {
|
|
503
502
|
this._client.defaults.headers.Cookie = null;
|
|
504
|
-
} else {
|
|
505
|
-
document.cookie = `${CONSTANTS.HTTP_COOKIE_NAME_CSRF_TOKEN}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; SameSite=Strict; Secure`;
|
|
506
503
|
}
|
|
507
504
|
}
|
|
508
505
|
}
|
|
@@ -660,59 +657,53 @@ class AppMeshClient {
|
|
|
660
657
|
/**
|
|
661
658
|
* Check app health status
|
|
662
659
|
* @param {string} name - App name
|
|
663
|
-
* @returns {boolean} True if healthy
|
|
660
|
+
* @returns {boolean} True if healthy; false if the daemon reports unhealthy (non-200 or missing app)
|
|
661
|
+
* @throws {AppMeshError} On network/transport failure (no HTTP status received)
|
|
664
662
|
*/
|
|
665
663
|
async check_app_health(name) {
|
|
666
664
|
try {
|
|
667
665
|
const response = await this._request("get", `/appmesh/app/${name}/health`);
|
|
668
666
|
return parseInt(response.data, 10) === 0;
|
|
669
|
-
} catch (
|
|
670
|
-
|
|
667
|
+
} catch (error) {
|
|
668
|
+
if (error.statusCode != null) {
|
|
669
|
+
return false; // non-200 or missing app → not healthy
|
|
670
|
+
}
|
|
671
|
+
throw error; // network/transport failure → propagate
|
|
671
672
|
}
|
|
672
673
|
}
|
|
673
674
|
|
|
674
675
|
/**
|
|
675
|
-
* Add or update application
|
|
676
|
+
* Add or update an application.
|
|
676
677
|
* @param {string} name - App name
|
|
677
|
-
* @param {Object} appJson - App configuration
|
|
678
|
-
* @example
|
|
679
|
-
* {
|
|
680
|
-
* "name": "",
|
|
681
|
-
* "command": "",
|
|
682
|
-
* "shell": false,
|
|
683
|
-
* "session_login": false,
|
|
684
|
-
* "description": "",
|
|
685
|
-
* "metadata": "",
|
|
686
|
-
* "working_dir": "",
|
|
687
|
-
* "status": 1,
|
|
688
|
-
* "docker_image": "",
|
|
689
|
-
* "stdout_cache_num": 3,
|
|
690
|
-
* "start_time": "",
|
|
691
|
-
* "end_time": "",
|
|
692
|
-
* "interval": null,
|
|
693
|
-
* "cron": false,
|
|
694
|
-
* "daily_limitation": {
|
|
695
|
-
* "daily_start": "",
|
|
696
|
-
* "daily_end": ""
|
|
697
|
-
* },
|
|
698
|
-
* "retention": null,
|
|
699
|
-
* "health_check_cmd": null,
|
|
700
|
-
* "permission": null,
|
|
701
|
-
* "envs": [],
|
|
702
|
-
* "sec_env": [],
|
|
703
|
-
* "pid": null,
|
|
704
|
-
* "resource_limit": {
|
|
705
|
-
* "cpu_shares": null,
|
|
706
|
-
* "memory_mb": null,
|
|
707
|
-
* "memory_virt_mb": null
|
|
708
|
-
* },
|
|
709
|
-
* "behavior": {
|
|
710
|
-
* "exit": "standby",
|
|
711
|
-
* "control": {
|
|
712
|
-
* "0": "keepalive"
|
|
713
|
-
* }
|
|
714
|
-
* }
|
|
678
|
+
* @param {Object} appJson - App configuration; see the App schema in openapi.yaml for all fields
|
|
715
679
|
* @returns {Promise<Object>} Registered app
|
|
680
|
+
* @example
|
|
681
|
+
* const appConfig = {
|
|
682
|
+
* name: "ping",
|
|
683
|
+
* command: "ping github.com -w 3",
|
|
684
|
+
* shell: false,
|
|
685
|
+
* session_login: false,
|
|
686
|
+
* description: "",
|
|
687
|
+
* metadata: "",
|
|
688
|
+
* working_dir: "",
|
|
689
|
+
* status: 1,
|
|
690
|
+
* docker_image: "",
|
|
691
|
+
* stdout_cache_num: 3,
|
|
692
|
+
* start_time: "",
|
|
693
|
+
* end_time: "",
|
|
694
|
+
* start_interval_seconds: null,
|
|
695
|
+
* cron: false,
|
|
696
|
+
* daily_limitation: { daily_start: "", daily_end: "" },
|
|
697
|
+
* retention: null,
|
|
698
|
+
* health_check_cmd: null,
|
|
699
|
+
* permission: null,
|
|
700
|
+
* env: {},
|
|
701
|
+
* sec_env: {},
|
|
702
|
+
* pid: null,
|
|
703
|
+
* resource_limit: { cpu_shares: null, memory_mb: null, memory_virt_mb: null },
|
|
704
|
+
* behavior: { exit: "standby", control: { "0": "keepalive" } }
|
|
705
|
+
* };
|
|
706
|
+
* await client.add_app("ping", appConfig);
|
|
716
707
|
*/
|
|
717
708
|
async add_app(name, appJson) {
|
|
718
709
|
const response = await this._request("put", `/appmesh/app/${name}`, appJson);
|
|
@@ -913,11 +904,13 @@ class AppMeshClient {
|
|
|
913
904
|
* and `applyAttrs` has no effect.
|
|
914
905
|
*
|
|
915
906
|
* @param {string} filePath - Remote file path
|
|
916
|
-
* @param {string} localFile - Local file path (Node.js) or suggested filename (browser)
|
|
907
|
+
* @param {string} [localFile=null] - Local file path (Node.js) or suggested filename (browser);
|
|
908
|
+
* defaults to the basename of filePath
|
|
917
909
|
* @param {boolean} [applyAttrs=true] - Node.js only: apply returned mode and best-effort
|
|
918
910
|
* owner/group metadata on non-Windows platforms
|
|
919
911
|
*/
|
|
920
|
-
async download_file(filePath, localFile, applyAttrs = true) {
|
|
912
|
+
async download_file(filePath, localFile = null, applyAttrs = true) {
|
|
913
|
+
if (!localFile) localFile = filePath.split(/[\\/]/).pop();
|
|
921
914
|
const headers = { [CONSTANTS.HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath) };
|
|
922
915
|
const response = await this._request("get", "/appmesh/file/download", null, {
|
|
923
916
|
headers,
|
|
@@ -978,11 +971,12 @@ class AppMeshClient {
|
|
|
978
971
|
/**
|
|
979
972
|
* Upload a file to the remote server.
|
|
980
973
|
* @param {string|File} localFile - Local file path/object
|
|
981
|
-
* @param {string} filePath - Remote target path
|
|
974
|
+
* @param {string} [filePath=null] - Remote target path; defaults to the basename of localFile
|
|
982
975
|
* @param {boolean} [applyAttrs] - In Node.js, send local permission bits; user/group metadata is
|
|
983
976
|
* not currently populated by this SDK
|
|
984
977
|
*/
|
|
985
|
-
async upload_file(localFile, filePath, applyAttrs = true) {
|
|
978
|
+
async upload_file(localFile, filePath = null, applyAttrs = true) {
|
|
979
|
+
if (!filePath) filePath = localFile.split(/[\\/]/).pop();
|
|
986
980
|
const headers = { [CONSTANTS.HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath) };
|
|
987
981
|
let formData;
|
|
988
982
|
|
|
@@ -1298,20 +1292,6 @@ class AppMeshClient {
|
|
|
1298
1292
|
headers[CONSTANTS.HTTP_USER_AGENT_HEADER_NAME] = CONSTANTS.HTTP_USER_AGENT;
|
|
1299
1293
|
}
|
|
1300
1294
|
|
|
1301
|
-
// Add CSRF token from cookies to headers
|
|
1302
|
-
const getCsrfToken = (cookieStr) => {
|
|
1303
|
-
if (!cookieStr) return null;
|
|
1304
|
-
const match = cookieStr.split('; ').find(c => c.startsWith(CONSTANTS.HTTP_COOKIE_NAME_CSRF_TOKEN + '='));
|
|
1305
|
-
return match ? match.split('=')[1] : null;
|
|
1306
|
-
};
|
|
1307
|
-
if (ENV.isNode) {
|
|
1308
|
-
const token = getCsrfToken(this._client.defaults.headers.Cookie);
|
|
1309
|
-
if (token) headers[CONSTANTS.HTTP_HEADER_NAME_CSRF_TOKEN] = token;
|
|
1310
|
-
} else {
|
|
1311
|
-
const token = getCsrfToken(document.cookie);
|
|
1312
|
-
if (token) headers[CONSTANTS.HTTP_HEADER_NAME_CSRF_TOKEN] = token;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
1295
|
// Add forwarding host if specified
|
|
1316
1296
|
if (this.forwardingHost) {
|
|
1317
1297
|
if (this.forwardingHost.includes(":")) {
|
package/src/appmesh_tcp.js
CHANGED
|
@@ -31,14 +31,7 @@ const LOGOFF_PATH = '/appmesh/self/logoff'
|
|
|
31
31
|
/**
|
|
32
32
|
* TCP transport for secure TLS connections and framed App Mesh messages.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
* - `null`/`undefined` (default): verify the server certificate against the App Mesh default
|
|
36
|
-
* CA (/opt/appmesh/ssl/ca.pem) if installed, otherwise the system CAs.
|
|
37
|
-
* - object: custom TLS material — `ca`/`cert`/`key` (Buffer or file path) with an optional
|
|
38
|
-
* `rejectUnauthorized` flag (defaults to `true`). An unreadable CA/cert/key path is a hard
|
|
39
|
-
* error (`fs.readFileSync` throws), never a silent fallback to no-verification.
|
|
40
|
-
* - `false`: explicit insecure mode — server certificate verification is disabled.
|
|
41
|
-
* This is the only way to disable verification besides `rejectUnauthorized: false`.
|
|
34
|
+
* @param {Object|false|null} [sslConfig=null] - TLS config; same tri-state as AppMeshClient (null=default CA, object=custom ca/cert/key, false=insecure).
|
|
42
35
|
*/
|
|
43
36
|
class TCPTransport {
|
|
44
37
|
/**
|
|
@@ -250,13 +243,15 @@ class RequestMessage {
|
|
|
250
243
|
* Serialize message to msgpack format
|
|
251
244
|
*/
|
|
252
245
|
serialize () {
|
|
246
|
+
// Coerce header/query values to strings; the daemon expects map<string,string>.
|
|
247
|
+
const strMap = (o) => Object.fromEntries(Object.entries(o || {}).map(([k, v]) => [k, String(v)]))
|
|
253
248
|
const data = {
|
|
254
249
|
uuid: this.uuid,
|
|
255
250
|
http_method: this.httpMethod,
|
|
256
251
|
request_uri: this.requestUri,
|
|
257
252
|
client_addr: this.clientAddr,
|
|
258
|
-
headers: this.headers,
|
|
259
|
-
query: this.query,
|
|
253
|
+
headers: strMap(this.headers),
|
|
254
|
+
query: strMap(this.query),
|
|
260
255
|
body: this.body
|
|
261
256
|
}
|
|
262
257
|
return msgpack.encode(data)
|
|
@@ -331,16 +326,7 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
331
326
|
* `new AppMeshClientTCP(sslConfig, {host, port})` — the address may be an explicit
|
|
332
327
|
* `{host, port}` object in either position.
|
|
333
328
|
*
|
|
334
|
-
*
|
|
335
|
-
* App Mesh default CA (/opt/appmesh/ssl/ca.pem) if installed, otherwise the system CAs; an
|
|
336
|
-
* object supplies custom TLS material (an unreadable ca/cert/key path is a hard error, never
|
|
337
|
-
* a silent no-verify fallback); `false` is the explicit insecure no-verification mode.
|
|
338
|
-
*
|
|
339
|
-
* @param {Object|false|null} [sslConfig=null] - SSL configuration (or `{host, port}` address)
|
|
340
|
-
* @param {Buffer|string} [sslConfig.ca] - CA certificate
|
|
341
|
-
* @param {Buffer|string} [sslConfig.cert] - Client certificate
|
|
342
|
-
* @param {Buffer|string} [sslConfig.key] - Client key
|
|
343
|
-
* @param {boolean} [sslConfig.rejectUnauthorized=true] - Whether to verify SSL
|
|
329
|
+
* @param {Object|false|null} [sslConfig=null] - TLS config; same tri-state as AppMeshClient (null=default CA, object=custom ca/cert/key, false=insecure).
|
|
344
330
|
* @param {Array<string, number>|{host: string, port: number}} [tcpAddress=['127.0.0.1', 6059]] - TCP server address
|
|
345
331
|
*/
|
|
346
332
|
constructor (sslConfig = null, tcpAddress = ['127.0.0.1', 6059]) {
|
|
@@ -594,12 +580,13 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
594
580
|
* Download a file through the TCP file-socket side channel.
|
|
595
581
|
*
|
|
596
582
|
* @param {string} filePath - Remote file path
|
|
597
|
-
* @param {string} localFile - Local destination path
|
|
583
|
+
* @param {string} [localFile=null] - Local destination path; defaults to the basename of filePath
|
|
598
584
|
* @param {boolean} [applyAttrs=true] - Apply returned mode and best-effort owner/group metadata
|
|
599
585
|
* on non-Windows Node.js hosts
|
|
600
586
|
* @override
|
|
601
587
|
*/
|
|
602
|
-
async download_file (filePath, localFile, applyAttrs = true) {
|
|
588
|
+
async download_file (filePath, localFile = null, applyAttrs = true) {
|
|
589
|
+
if (!localFile) localFile = filePath.split(/[\\/]/).pop()
|
|
603
590
|
const headers = {
|
|
604
591
|
[HTTP_HEADER_KEY_X_FILE_PATH]: encodeURIComponent(filePath),
|
|
605
592
|
[HTTP_HEADER_KEY_X_RECV_FILE_SOCKET]: 'true'
|
|
@@ -631,7 +618,12 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
631
618
|
writeStream.write(chunk)
|
|
632
619
|
}
|
|
633
620
|
} finally {
|
|
634
|
-
|
|
621
|
+
// Await the flush so the file is complete on disk before this resolves.
|
|
622
|
+
await new Promise((resolve, reject) => {
|
|
623
|
+
writeStream.once('finish', resolve)
|
|
624
|
+
writeStream.once('error', reject)
|
|
625
|
+
writeStream.end()
|
|
626
|
+
})
|
|
635
627
|
}
|
|
636
628
|
|
|
637
629
|
// Apply file attributes on Unix systems
|
|
@@ -660,12 +652,13 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
660
652
|
* Upload a file through the TCP file-socket side channel.
|
|
661
653
|
*
|
|
662
654
|
* @param {string} localFile - Local file path
|
|
663
|
-
* @param {string} filePath - Remote destination path
|
|
655
|
+
* @param {string} [filePath=null] - Remote destination path; defaults to the basename of localFile
|
|
664
656
|
* @param {boolean} [applyAttrs=true] - Send local mode/uid/gid metadata so the server can
|
|
665
657
|
* recreate permissions and ownership when supported
|
|
666
658
|
* @override
|
|
667
659
|
*/
|
|
668
|
-
async upload_file (localFile, filePath, applyAttrs = true) {
|
|
660
|
+
async upload_file (localFile, filePath = null, applyAttrs = true) {
|
|
661
|
+
if (!filePath) filePath = localFile.split(/[\\/]/).pop()
|
|
669
662
|
if (!fs.existsSync(localFile)) {
|
|
670
663
|
throw new Error(`Local file not found: ${localFile}`)
|
|
671
664
|
}
|
|
@@ -791,22 +784,13 @@ class AppMeshClientTCP extends AppMeshClient {
|
|
|
791
784
|
}
|
|
792
785
|
|
|
793
786
|
/**
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
* Instead of polling get_app_output in a loop, subscribes to STDOUT/EXIT/REMOVED
|
|
797
|
-
* events and does a one-shot backfill to cover output emitted before the subscribe
|
|
798
|
-
* took effect. Deduplicates by byte-position offset.
|
|
799
|
-
*
|
|
800
|
-
* No sentinel exit codes (real exit codes may be negative for signal kills):
|
|
801
|
-
* non-EXIT terminations throw typed errors; null means caller-side timeout only.
|
|
802
|
-
*
|
|
787
|
+
* Wait for an async run to finish over TCP, streaming incremental output.
|
|
803
788
|
* @param {AppRun} run - AppRun object
|
|
804
789
|
* @param {Function} [stdoutHandler] - Stdout handler callback(data, position)
|
|
805
790
|
* @param {number} [timeout=0] - Max wait time in seconds (0 = unlimited)
|
|
806
791
|
* @returns {Promise<number|null>} Exit code, or null on timeout
|
|
807
792
|
* @throws {AppRemovedError} If the app was removed before its exit was observed.
|
|
808
|
-
* @throws {TransportDisconnectedError} If the
|
|
809
|
-
* or the daemon delivered an unparseable exit code.
|
|
793
|
+
* @throws {TransportDisconnectedError} If the transport disconnected while waiting, or the daemon delivered an unparseable exit code.
|
|
810
794
|
*/
|
|
811
795
|
async wait_for_async_run (run, stdoutHandler, timeout = 0) {
|
|
812
796
|
if (!run || !run.appName) return null
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// worker.js - App Mesh Worker SDK for Node.js
|
|
2
2
|
// This is a Node.js-only module - not included in browser builds
|
|
3
3
|
|
|
4
4
|
// Environment check - only works in Node.js
|
|
@@ -57,7 +57,7 @@ const _DEFER_CLIENT = Symbol('appmesh.deferClient')
|
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* // HTTP Worker Example
|
|
60
|
-
* import { AppMeshWorker } from 'appmesh/
|
|
60
|
+
* import { AppMeshWorker } from 'appmesh/worker';
|
|
61
61
|
*
|
|
62
62
|
* const worker = new AppMeshWorker();
|
|
63
63
|
* const payload = await worker.fetch_task();
|
|
@@ -66,7 +66,7 @@ const _DEFER_CLIENT = Symbol('appmesh.deferClient')
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* // TCP Worker Example
|
|
69
|
-
* import { AppMeshWorkerTCP } from 'appmesh/
|
|
69
|
+
* import { AppMeshWorkerTCP } from 'appmesh/worker';
|
|
70
70
|
*
|
|
71
71
|
* const worker = new AppMeshWorkerTCP();
|
|
72
72
|
* try {
|
|
@@ -176,11 +176,6 @@ class AppMeshWorker {
|
|
|
176
176
|
* @throws {ProcessSupersededError} The daemon reported HTTP 412 — this process key was
|
|
177
177
|
* superseded by a newer process instance; the caller should stop serving (an app
|
|
178
178
|
* entry point typically catches this and exits).
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* const worker = new AppMeshWorker();
|
|
182
|
-
* const payload = await worker.fetch_task();
|
|
183
|
-
* console.log('Received payload:', payload);
|
|
184
179
|
*/
|
|
185
180
|
async fetch_task () {
|
|
186
181
|
const { processKey, appName } = this._getRuntimeEnv()
|
|
@@ -244,11 +239,6 @@ class AppMeshWorker {
|
|
|
244
239
|
* @param {string|Buffer} result - Result payload to be delivered back to the client as-is
|
|
245
240
|
* @returns {Promise<void>}
|
|
246
241
|
* @throws {Error} If the task return fails
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* const worker = new AppMeshWorker();
|
|
250
|
-
* const result = { status: 'success', data: processedData };
|
|
251
|
-
* await worker.send_task_result(JSON.stringify(result));
|
|
252
242
|
*/
|
|
253
243
|
async send_task_result (result) {
|
|
254
244
|
const { processKey, appName } = this._getRuntimeEnv()
|
|
@@ -292,7 +282,7 @@ class AppMeshWorker {
|
|
|
292
282
|
* @extends AppMeshWorker
|
|
293
283
|
*
|
|
294
284
|
* @example
|
|
295
|
-
* import { AppMeshWorkerTCP } from 'appmesh/
|
|
285
|
+
* import { AppMeshWorkerTCP } from 'appmesh/worker';
|
|
296
286
|
*
|
|
297
287
|
* const worker = new AppMeshWorkerTCP();
|
|
298
288
|
* try {
|
|
@@ -319,12 +309,7 @@ class AppMeshWorkerTCP extends AppMeshWorker {
|
|
|
319
309
|
* @param {Array<string, number>|{host: string, port: number}} [tcpAddress=['127.0.0.1', 6059]] - TCP server address
|
|
320
310
|
* @param {Object} [options={}] - Additional options
|
|
321
311
|
* @param {Object} [options.logger=console] - Logger instance
|
|
322
|
-
* @param {AppMeshClientTCP} [options.client] -
|
|
323
|
-
* When supplied, `sslConfig` and `tcpAddress` are ignored and the worker shares the caller's
|
|
324
|
-
* client (and therefore its token-refresh state). Use this when a single process needs both
|
|
325
|
-
* client and worker roles to avoid two independent `/token/renew` loops fighting each other —
|
|
326
|
-
* the daemon blacklists the previous token on every renew, so the slower refresher gets
|
|
327
|
-
* 401 "Token has been revoked".
|
|
312
|
+
* @param {AppMeshClientTCP} [options.client] - Pre-built client to reuse (shares token-refresh state); see AppMeshWorker for why. When set, sslConfig/tcpAddress are ignored.
|
|
328
313
|
*
|
|
329
314
|
* @example
|
|
330
315
|
* import fs from 'fs';
|
|
@@ -392,14 +377,6 @@ class AppMeshWorkerTCP extends AppMeshWorker {
|
|
|
392
377
|
/**
|
|
393
378
|
* Close the TCP connection and release resources.
|
|
394
379
|
* Should be called when done using the server.
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* const worker = new AppMeshWorkerTCP();
|
|
398
|
-
* try {
|
|
399
|
-
* // Use worker...
|
|
400
|
-
* } finally {
|
|
401
|
-
* worker.close();
|
|
402
|
-
* }
|
|
403
380
|
*/
|
|
404
381
|
close () {
|
|
405
382
|
if (this._client && typeof this._client.close === 'function') {
|
|
@@ -417,7 +394,7 @@ class AppMeshWorkerTCP extends AppMeshWorker {
|
|
|
417
394
|
* @returns {Promise<any>} Result from callback
|
|
418
395
|
*
|
|
419
396
|
* @example
|
|
420
|
-
* import { withServer, AppMeshWorkerTCP } from 'appmesh/
|
|
397
|
+
* import { withServer, AppMeshWorkerTCP } from 'appmesh/worker';
|
|
421
398
|
*
|
|
422
399
|
* await withServer(
|
|
423
400
|
* () => new AppMeshWorkerTCP(),
|