genesys-cloud-client-auth 2.0.0 → 2.0.1-patch-1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy-info.json +4 -4
- package/dist/genesys-cloud-client-auth.browser.min.js +1 -1
- package/dist/genesys-cloud-client-auth.browser.min.js.map +1 -1
- package/dist/lib/cjs/version.js +1 -1
- package/dist/lib/es/version.js +1 -1
- package/dist/manifest.json +4 -4
- package/dist/v2/genesys-cloud-client-auth.browser.min.js +1 -1
- package/dist/v2.0.1/genesys-cloud-client-auth.browser.min.js +2 -0
- package/package.json +5 -2
- package/dist/v2.0.0/genesys-cloud-client-auth.browser.min.js +0 -2
package/dist/lib/cjs/version.js
CHANGED
package/dist/lib/es/version.js
CHANGED
package/dist/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
3
|
-
"build": "
|
|
4
|
-
"buildDate": "2026-
|
|
2
|
+
"version": "patch-1",
|
|
3
|
+
"build": "1",
|
|
4
|
+
"buildDate": "2026-08-26T10:53:54.136Z",
|
|
5
5
|
"indexFiles": [
|
|
6
6
|
{
|
|
7
7
|
"file": "index.html"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"file": "/v2/genesys-cloud-client-auth.browser.min.js"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"file": "/v2.0.
|
|
13
|
+
"file": "/v2.0.1/genesys-cloud-client-auth.browser.min.js"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{GenesysCloudClientAuthenticator:()=>Pt,TimeoutError:()=>s,VERSION:()=>r,authenticatorFactory:()=>Nt,default:()=>kt,handleRedirectFromLogin:()=>xt,isIssuedTimeWithinTimeframe:()=>l,isIssuedTimeWithinWindow:()=>u,parseOauthParams:()=>a,tokenWasIssuedAt:()=>d});var n={};e.r(n),e.d(n,{hasBrowserEnv:()=>Oe,hasStandardBrowserEnv:()=>Se,hasStandardBrowserWebWorkerEnv:()=>ve,navigator:()=>Re,origin:()=>Te}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const r="2.0.0",o="color: #f29f2c";class s extends Error{constructor(){super(...arguments),this.name="TIMEOUT_ERROR"}}class i extends Error{constructor(e,t){const n=t&&t instanceof Error;super(n?t.message:t),n&&(this.name=t.name),this.translationKey=e}}const a=(e=window.location.hash)=>{const t={},n={},r=new RegExp("^#*(.+?)=(.+?)$","i");if(e.split("&").forEach(e=>{const n=r.exec(e);n&&(t[n[1]]=decodeURIComponent(decodeURIComponent(n[2].replace(/\+/g,"%20"))))}),t.error)return t;if(t.access_token){if(t.state&&(n.state=t.state),t.expires_in){const e=1e3*parseInt(t.expires_in.replace(/\+/g,"%20"));n.tokenExpiryTime=Date.now()+e,n.tokenExpiryTimeString=new Date(n.tokenExpiryTime).toISOString()}n.accessToken=t.access_token.replace(/\+/g,"%20")}return n},c=(e,t)=>{t?(console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o,t),"object"==typeof t&&console.log(`%c [DEBUG:gc-client-auth:${r}] ^ stringified: ${JSON.stringify(t)}`,o)):console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o)},l=(e,t=691199e3,n=168e4,r=Date.now())=>r-d(e,t)<n,u=(e,t,n)=>l(e,t,n),d=(e,t)=>e-t;function f(e,t){return function(){return e.apply(t,arguments)}}const{toString:h}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:g,toStringTag:m}=Symbol,b=(y=Object.create(null),e=>{const t=h.call(e);return y[t]||(y[t]=t.slice(8,-1).toLowerCase())});var y;const w=e=>(e=e.toLowerCase(),t=>b(t)===e),E=e=>t=>typeof t===e,{isArray:O}=Array,R=E("undefined");function S(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=w("ArrayBuffer"),T=E("string"),_=E("function"),A=E("number"),C=e=>null!==e&&"object"==typeof e,P=e=>{if("object"!==b(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||m in e||g in e)},x=w("Date"),U=w("File"),N=w("Blob"),k=w("FileList"),D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},j=void 0!==D.FormData?D.FormData:void 0,L=w("URLSearchParams"),[I,F,B,M]=["ReadableStream","Request","Response","Headers"].map(w);function q(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),O(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(S(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 $(e,t){if(S(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 z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,H=e=>!R(e)&&e!==z,J=(W="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>W&&e instanceof W);var W;const K=w("HTMLFormElement"),V=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),G=w("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};q(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)},Q=w("AsyncFunction"),Y=(Z="function"==typeof setImmediate,ee=_(z.postMessage),Z?setImmediate:ee?(te=`axios@${Math.random()}`,ne=[],z.addEventListener("message",({source:e,data:t})=>{e===z&&t===te&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),z.postMessage(te,"*")}):e=>setTimeout(e));var Z,ee,te,ne;const re="undefined"!=typeof queueMicrotask?queueMicrotask.bind(z):"undefined"!=typeof process&&process.nextTick||Y,oe={isArray:O,isArrayBuffer:v,isBuffer:S,isFormData:e=>{if(!e)return!1;if(j&&e instanceof j)return!0;const t=p(e);if(!t||t===Object.prototype)return!1;if(!_(e.append))return!1;const n=b(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&&v(e.buffer),t},isString:T,isNumber:A,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:P,isEmptyObject:e=>{if(!C(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:I,isRequest:F,isResponse:B,isHeaders:M,isUndefined:R,isDate:x,isFile:U,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:N,isRegExp:G,isFunction:_,isStream:e=>C(e)&&_(e.pipe),isURLSearchParams:L,isTypedArray:J,isFileList:k,forEach:q,merge:function e(){const{caseless:t,skipUndefined:n}=H(this)&&this||{},r={},o=(o,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=t&&$(r,s)||s;P(r[i])&&P(o)?r[i]=e(r[i],o):P(o)?r[i]=e({},o):O(o)?r[i]=o.slice():n&&R(o)||(r[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&q(arguments[e],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(q(t,(t,r)=>{n&&_(t)?Object.defineProperty(e,r,{value:f(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&p(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:b,kindOfTest:w,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(O(e))return e;let t=e.length;if(!A(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[g]).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:K,hasOwnProperty:V,hasOwnProp:V,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(_(e)&&-1!==["arguments","caller","callee"].indexOf(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 O(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:$,global:z,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[m]&&e[g])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[r]=e;const o=O(e)?[]:{};return q(e,(e,t)=>{const s=n(e,r+1);!R(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Q,isThenable:e=>e&&(C(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:Y,asap:re,isIterable:e=>null!=e&&_(e[g])};class se extends Error{static from(e,t,n,r,o,s){const i=new se(e.message,t||e.code,n,r,o);return i.cause=e,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",{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(){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:oe.toJSONObject(this.config),code:this.code,status:this.status}}}se.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",se.ERR_BAD_OPTION="ERR_BAD_OPTION",se.ECONNABORTED="ECONNABORTED",se.ETIMEDOUT="ETIMEDOUT",se.ERR_NETWORK="ERR_NETWORK",se.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",se.ERR_DEPRECATED="ERR_DEPRECATED",se.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",se.ERR_BAD_REQUEST="ERR_BAD_REQUEST",se.ERR_CANCELED="ERR_CANCELED",se.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",se.ERR_INVALID_URL="ERR_INVALID_URL",se.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ie=se;function ae(e){return oe.isPlainObject(e)||oe.isArray(e)}function ce(e){return oe.endsWith(e,"[]")?e.slice(0,-2):e}function le(e,t,n){return e?e.concat(t).map(function(e,t){return e=ce(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ue=oe.toFlatObject(oe,{},null,function(e){return/^is[A-Z]/.test(e)}),de=function(e,t,n){if(!oe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!oe.isUndefined(t[e])})).metaTokens,o=n.visitor||d,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,l=a&&oe.isSpecCompliantForm(t);if(!oe.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(oe.isDate(e))return e.toISOString();if(oe.isBoolean(e))return e.toString();if(!l&&oe.isBlob(e))throw new ie("Blob is not supported. Use a Buffer instead.");return oe.isArrayBuffer(e)||oe.isTypedArray(e)?l&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,o){let a=e;if(oe.isReactNative(t)&&oe.isReactNativeBlob(e))return t.append(le(o,n,s),u(e)),!1;if(e&&!o&&"object"==typeof e)if(oe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(oe.isArray(e)&&function(e){return oe.isArray(e)&&!e.some(ae)}(e)||(oe.isFileList(e)||oe.endsWith(n,"[]"))&&(a=oe.toArray(e)))return n=ce(n),a.forEach(function(e,r){!oe.isUndefined(e)&&null!==e&&t.append(!0===i?le([n],r,s):null===i?n:n+"[]",u(e))}),!1;return!!ae(e)||(t.append(le(o,n,s),u(e)),!1)}const f=[],h=Object.assign(ue,{defaultVisitor:d,convertValue:u,isVisitable:ae});if(!oe.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!oe.isUndefined(n)){if(s>c)throw new ie("Object is too deeply nested ("+s+" levels). Max depth: "+c,ie.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),oe.forEach(n,function(n,i){!0===(!(oe.isUndefined(n)||null===n)&&o.call(t,n,oe.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i],s+1)}),f.pop()}}(e),t};function fe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function he(e,t){this._pairs=[],e&&de(e,this,t)}const pe=he.prototype;pe.append=function(e,t){this._pairs.push([e,t])},pe.toString=function(e){const t=e?function(t){return e.call(this,t,fe)}:fe;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const ge=he;function me(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function be(e,t,n){if(!t)return e;const r=n&&n.encode||me,o=oe.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let i;if(i=s?s(t,o):oe.isURLSearchParams(t)?t.toString():new ge(t,o).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const ye=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){oe.forEach(this.handlers,function(t){null!==t&&e(t)})}},we={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ee={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ge,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Oe="undefined"!=typeof window&&"undefined"!=typeof document,Re="object"==typeof navigator&&navigator||void 0,Se=Oe&&(!Re||["ReactNative","NativeScript","NS"].indexOf(Re.product)<0),ve="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Te=Oe&&window.location.href||"http://localhost",_e={...n,...Ee},Ae=function(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;return s=!s&&oe.isArray(r)?r.length:s,a?(oe.hasOwnProp(r,s)?r[s]=oe.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i):(r[s]&&oe.isObject(r[s])||(r[s]=[]),t(e,n,r[s],o)&&oe.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(oe.isFormData(e)&&oe.isFunction(e.entries)){const n={};return oe.forEachEntry(e,(e,r)=>{t(function(e){return oe.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Ce=(e,t)=>null!=e&&oe.hasOwnProp(e,t)?e[t]:void 0,Pe={transitional:we,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=oe.isObject(e);if(o&&oe.isHTMLForm(e)&&(e=new FormData(e)),oe.isFormData(e))return r?JSON.stringify(Ae(e)):e;if(oe.isArrayBuffer(e)||oe.isBuffer(e)||oe.isStream(e)||oe.isFile(e)||oe.isBlob(e)||oe.isReadableStream(e))return e;if(oe.isArrayBufferView(e))return e.buffer;if(oe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){const t=Ce(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return de(e,new _e.classes.URLSearchParams,{visitor:function(e,t,n,r){return _e.isNode&&oe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ce(this,"env"),r=n&&n.FormData;return de(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e){if(oe.isString(e))try{return(0,JSON.parse)(e),oe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ce(this,"transitional")||Pe.transitional,n=t&&t.forcedJSONParsing,r=Ce(this,"responseType"),o="json"===r;if(oe.isResponse(e)||oe.isReadableStream(e))return e;if(e&&oe.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ce(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ie.from(e,ie.ERR_BAD_RESPONSE,this,null,Ce(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};oe.forEach(["delete","get","head","post","put","patch"],e=>{Pe.headers[e]={}});const xe=Pe,Ue=oe.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"]),Ne=Symbol("internals"),ke=/[^\x09\x20-\x7E\x80-\xFF]/g;function De(e){return e&&String(e).trim().toLowerCase()}function je(e){return!1===e||null==e?e:oe.isArray(e)?e.map(je):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(ke,""))}function Le(e,t,n,r,o){return oe.isFunction(r)?r.call(this,t,n):(o&&(t=n),oe.isString(t)?oe.isString(r)?-1!==t.indexOf(r):oe.isRegExp(r)?r.test(t):void 0:void 0)}class Ie{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=De(t);if(!o)throw new Error("header name must be a non-empty string");const s=oe.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=je(e))}const s=(e,t)=>oe.forEach(e,(e,n)=>o(e,n,t));if(oe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(oe.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]&&Ue[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(oe.isObject(e)&&oe.isIterable(e)){let n,r,o={};for(const t of e){if(!oe.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?oe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=De(e)){const n=oe.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(oe.isFunction(t))return t.call(this,e,n);if(oe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=De(e)){const n=oe.findKey(this,e);return!(!n||void 0===this[n]||t&&!Le(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=De(e)){const o=oe.findKey(n,e);!o||t&&!Le(0,n[o],o,t)||(delete n[o],r=!0)}}return oe.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&&!Le(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return oe.forEach(this,(r,o)=>{const s=oe.findKey(n,o);if(s)return t[s]=je(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]=je(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return oe.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&oe.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[Ne]=this[Ne]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=De(e);t[r]||(function(e,t){const n=oe.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return oe.isArray(e)?e.forEach(r):r(e),this}}Ie.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(Ie.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),oe.freezeMethods(Ie);const Fe=Ie;function Be(e,t){const n=this||xe,r=t||n,o=Fe.from(r.headers);let s=r.data;return oe.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Me(e){return!(!e||!e.__CANCEL__)}const qe=class extends ie{constructor(e,t,n){super(null==e?"canceled":e,ie.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $e(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ie("Request failed with status code "+n.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const ze=(e,t,n=3)=>{let r=0;const o=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 c=Date.now(),l=r[i];o||(o=c),n[s]=a,r[s]=c;let u=i,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return 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)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,c=Math.max(0,a-r),l=o(c);r=Math.max(r,a),e({loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:l||void 0,estimated:l&&i?(i-a)/l:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},He=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Je=e=>(...t)=>oe.asap(()=>e(...t)),We=_e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,_e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(_e.origin),_e.navigator&&/(msie|trident)/i.test(_e.navigator.userAgent)):()=>!0,Ke=_e.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];oe.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),oe.isString(r)&&a.push(`path=${r}`),oe.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),oe.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ge=e=>e instanceof Fe?{...e}:e;function Xe(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return oe.isPlainObject(e)&&oe.isPlainObject(t)?oe.merge.call({caseless:r},e,t):oe.isPlainObject(t)?oe.merge({},t):oe.isArray(t)?t.slice():t}function o(e,t,n,o){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!oe.isUndefined(t))return r(void 0,t)}function i(e,t){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return oe.hasOwnProp(t,s)?r(n,o):oe.hasOwnProp(e,s)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={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(Ge(e),Ge(t),0,!0)};return oe.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=oe.hasOwnProp(c,r)?c[r]:o,i=s(oe.hasOwnProp(e,r)?e[r]:void 0,oe.hasOwnProp(t,r)?t[r]:void 0,r);oe.isUndefined(i)&&s!==a||(n[r]=i)}),n}const Qe=e=>{const t=Xe({},e),n=e=>oe.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 c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");if(t.headers=a=Fe.from(a),t.url=be(Ve(l,d,u),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),oe.isFormData(r))if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(oe.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(_e.hasStandardBrowserEnv&&(oe.isFunction(o)&&(o=o(t)),!0===o||null==o&&We(t.url))){const e=s&&i&&Ke.read(i);e&&a.set(s,e)}return t},Ye="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Qe(e);let o=r.data;const s=Fe.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=Fe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());$e(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new ie("Request aborted",ie.ECONNABORTED,e,g)),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ie(r,ie.ERR_NETWORK,e,g);o.event=t||null,n(o),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||we;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ie(t,o.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,g)),g=null},void 0===o&&s.setContentType(null),"setRequestHeader"in g&&oe.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),oe.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),d&&"json"!==d&&(g.responseType=r.responseType),h&&([c,u]=ze(h,!0),g.addEventListener("progress",c)),f&&g.upload&&([a,l]=ze(f),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{g&&(n(!t||t.type?new qe(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);b&&-1===_e.protocols.indexOf(b)?n(new ie("Unsupported protocol "+b+":",ie.ERR_BAD_REQUEST,e)):g.send(o||null)})},Ze=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ie?t:new qe(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new ie(`timeout of ${t}ms exceeded`,ie.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));const{signal:a}=r;return a.unsubscribe=()=>oe.asap(i),a}},et=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},tt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of 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()}}(e))yield*et(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})},{isFunction:nt}=oe,rt=(({Request:e,Response:t})=>({Request:e,Response:t}))(oe.global),{ReadableStream:ot,TextEncoder:st}=oe.global,it=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},at=e=>{e=oe.merge.call({skipUndefined:!0},rt,e);const{fetch:t,Request:n,Response:r}=e,o=t?nt(t):"function"==typeof fetch,s=nt(n),i=nt(r);if(!o)return!1;const a=o&&nt(ot),c=o&&("function"==typeof st?(l=new st,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=s&&a&&it(()=>{let e=!1;const t=new n(_e.origin,{body:new ot,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),d=i&&a&&it(()=>oe.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ie(`Response type '${e}' is not supported`,ie.ERR_NOT_SUPPORT,n)})});return async e=>{let{url:o,method:i,data:a,signal:l,cancelToken:h,timeout:p,onDownloadProgress:g,onUploadProgress:m,responseType:b,headers:y,withCredentials:w="same-origin",fetchOptions:E}=Qe(e),O=t||fetch;b=b?(b+"").toLowerCase():"text";let R=Ze([l,h&&h.toAbortSignal()],p),S=null;const v=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let T;try{if(m&&u&&"get"!==i&&"head"!==i&&0!==(T=await(async(e,t)=>{const r=oe.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e)){const t=new n(_e.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return oe.isArrayBufferView(e)||oe.isArrayBuffer(e)?e.byteLength:(oe.isURLSearchParams(e)&&(e+=""),oe.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(y,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(oe.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,n]=He(T,ze(Je(m)));a=tt(t.body,65536,e,n)}}oe.isString(w)||(w=w?"include":"omit");const t=s&&"credentials"in n.prototype;if(oe.isFormData(a)){const e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete("content-type")}const l={...E,signal:R,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};S=s&&new n(o,l);let h=await(s?O(S,E):O(o,l));const p=d&&("stream"===b||"response"===b);if(d&&(g||p&&v)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=h[t]});const t=oe.toFiniteNumber(h.headers.get("content-length")),[n,o]=g&&He(t,ze(Je(g),!0))||[];h=new r(tt(h.body,65536,n,()=>{o&&o(),v&&v()}),e)}b=b||"text";let _=await f[oe.findKey(f,b)||"text"](h,e);return!p&&v&&v(),await new Promise((t,n)=>{$e(t,n,{data:_,headers:Fe.from(h.headers),status:h.status,statusText:h.statusText,config:e,request:S})})}catch(t){if(v&&v(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ie("Network Error",ie.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw ie.from(t,t&&t.code,e,S,t&&t.response)}}},ct=new Map,lt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,c=s.length,l=ct;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:at(t)),l=a;return a},ut=(lt(),{http:null,xhr:Ye,fetch:{get:lt}});oe.forEach(ut,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const dt=e=>`- ${e}`,ft=e=>oe.isFunction(e)||null===e||!1===e,ht=function(e,t){e=oe.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,!ft(r)&&(o=ut[(n=String(r)).toLowerCase()],void 0===o))throw new ie(`Unknown adapter '${n}'`);if(o&&(oe.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(dt).join("\n"):" "+dt(e[0]):"as no adapter specified";throw new ie("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o};function pt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qe(null,e)}function gt(e){return pt(e),e.headers=Fe.from(e.headers),e.data=Be.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ht(e.adapter||xe.adapter,e)(e).then(function(t){return pt(e),t.data=Be.call(e,e.transformResponse,t),t.headers=Fe.from(t.headers),t},function(t){return Me(t)||(pt(e),t&&t.response&&(t.response.data=Be.call(e,e.transformResponse,t.response),t.response.headers=Fe.from(t.response.headers))),Promise.reject(t)})}const mt="1.15.2",bt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{bt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const yt={};bt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+mt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new ie(r(o," has been removed"+(t?" in "+t:"")),ie.ERR_DEPRECATED);return t&&!yt[o]&&(yt[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)}},bt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const wt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ie("options must be an object",ie.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 ie("option "+s+" must be "+n,ie.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ie("Unknown option "+s,ie.ERR_BAD_OPTION)}},validators:bt},Et=wt.validators;class Ot{constructor(e){this.defaults=e||{},this.interceptors={request:new ye,response:new ye}}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=Xe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&wt.assertOptions(n,{silentJSONParsing:Et.transitional(Et.boolean),forcedJSONParsing:Et.transitional(Et.boolean),clarifyTimeoutError:Et.transitional(Et.boolean),legacyInterceptorReqResOrdering:Et.transitional(Et.boolean)},!1),null!=r&&(oe.isFunction(r)?t.paramsSerializer={serialize:r}:wt.assertOptions(r,{encode:Et.function,serialize:Et.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),wt.assertOptions(t,{baseUrl:Et.spelling("baseURL"),withXsrfToken:Et.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&oe.merge(o.common,o[t.method]);o&&oe.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Fe.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||we;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[gt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=gt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return be(Ve((e=Xe(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}oe.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(t,n){return this.request(Xe(n||{},{method:e,url:t,data:(n||{}).data}))}}),oe.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Xe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)});const Rt=Ot;class St{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 qe(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 St(function(t){e=t}),cancel:e}}}const vt=St,Tt={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(Tt).forEach(([e,t])=>{Tt[t]=e});const _t=Tt,At=function e(t){const n=new Rt(t),r=f(Rt.prototype.request,n);return oe.extend(r,Rt.prototype,n,{allOwnKeys:!0}),oe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xe(t,n))},r}(xe);At.Axios=Rt,At.CanceledError=qe,At.CancelToken=vt,At.isCancel=Me,At.VERSION=mt,At.toFormData=de,At.AxiosError=ie,At.Cancel=At.CanceledError,At.all=function(e){return Promise.all(e)},At.spread=function(e){return function(t){return e.apply(null,t)}},At.isAxiosError=function(e){return oe.isObject(e)&&!0===e.isAxiosError},At.mergeConfig=Xe,At.AxiosHeaders=Fe,At.formToJSON=e=>Ae(oe.isHTMLForm(e)?new FormData(e):e),At.getAdapter=ht,At.HttpStatusCode=_t,At.default=At;const Ct=At;class Pt{constructor(e,t={}){this.VERSION=r,this.clientId=e,t.storageKey||(t.storageKey="gc_client_auth_data"),"boolean"!=typeof t.persist&&(t.persist=!1),this.config=Object.assign({},t),this.customHeaders=t.customHeaders,this.setEnvironment(t.environment),this.timeout=16e3,this.authData={},this.authentications={"PureCloud OAuth":{type:"oauth2"}};try{localStorage.setItem("genesys_cloud_local_storage_test","genesys_cloud_local_storage_test"),localStorage.removeItem("genesys_cloud_local_storage_test"),this.hasLocalStorage=!0}catch(e){this.hasLocalStorage=!1}this._loadSettings()}loginImplicitGrant(e={},t){const n=t||a();return new Promise((t,r)=>{e.org&&!e.provider?r(new Error("opts.provider must be set if opts.org is set")):e.provider&&!e.org?r(new Error("opts.org must be set if opts.provider is set")):e.redirectUri||e.usePopupAuth||r(new Error("redirectUri must be provided for implicit grant and not utilizing client-auth app for popup auth")),n&&n.error&&(n.accessToken=void 0,this._saveSettings(n),r(new Error(`[${n.error}] ${n.error_description}`))),n.accessToken&&this._saveSettings(n),this._testTokenAccess().then(()=>(!this.authData.state&&e.state&&(this.authData.state=e.state),t(this.authData))).catch(n=>{this._debug("Error encountered during login. This is normal if the application has not yet been authorized.",n);const o={client_id:encodeURIComponent(this.clientId),response_type:"token"};if(e.redirectUri&&(o.redirect_uri=encodeURIComponent(e.redirectUri)),e.state&&(o.state=encodeURIComponent(e.state)),e.org&&(o.org=encodeURIComponent(e.org)),e.provider&&(o.provider=encodeURIComponent(e.provider)),e.usePopupAuth){if(!this.hasLocalStorage)return r(new Error("localStorage is unavailable. Cannot authenticate via popup window."));this._debug("using popup auth – adding listener"),this._authenticateViaPopup(o,e.popupTimeout||15e3).then(e=>{this._saveSettings(e),t(e)}).catch(r)}else{const e=this._buildAuthUrl("oauth/authorize",o);this._debug("Implicit grant: redirecting to: "+e),window.location.replace(e),r(new Error(`Routing to login: "${e}"`))}})})}setEnvironment(e){e||(e="mypurecloud.com"),(e=e.replace(/\/+$/,"")).startsWith("https://")&&(e=e.substring(8)),e.startsWith("http://")&&(e=e.substring(7)),e.startsWith("api.")&&(e=e.substring(4)),this.environment=e,this.basePath=`https://api.${e}`,this.authUrl=`https://login.${e}`}clearAuthData(){this._saveSettings({accessToken:void 0,state:void 0,tokenExpiryTime:void 0,tokenExpiryTimeString:void 0})}logout(e){this.clearAuthData();const t={client_id:encodeURIComponent(this.clientId)};e&&(t.redirect_uri=encodeURIComponent(e));const n=this._buildAuthUrl("logout",t);window.location.replace(n)}setAccessToken(e){this._saveSettings({accessToken:e})}testAccessToken(e){return this.callApi("/api/v2/tokens/me","get",e)}parseDate(e){return new Date(e.replace(/T/i," "))}paramToString(e){return e?e instanceof Date?e.toJSON():e.toString():""}buildUrl(e,t={}){return e.match(/^\//)||(e=`/${e}`),(this.basePath+e).replace(/\{([\w-]+)\}/g,(e,n)=>{let r;return r=Object.getOwnPropertyDescriptor(t,n)?this.paramToString(t[n]):e,encodeURIComponent(r)})}callApi(e,t,n){var r;const o=this.buildUrl(e),s={Authorization:`Bearer ${n||(null===(r=this.authData)||void 0===r?void 0:r.accessToken)}`,"Content-Type":"application/json"};this.customHeaders&&Object.entries(this.customHeaders).forEach(([e,t])=>{s[e]=t});const i={method:t,url:o,headers:s,timeout:this.timeout};return Ct.request(i)}_debug(e,t){this.config.debugMode&&c(e,t)}_saveSettings(e){try{if(this.authData.accessToken=e.accessToken,this.authentications["PureCloud OAuth"].accessToken=e.accessToken,e.state&&(this.authData.state=e.state),this.authData.error=e.error,this.authData.error_description=e.error_description,e.tokenExpiryTime&&(this.authData.tokenExpiryTime=e.tokenExpiryTime,this.authData.tokenExpiryTimeString=e.tokenExpiryTimeString),!this.config.persist)return void this._debug("persist is not true. Settings will not be saved.");if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be saved.");const t=JSON.parse(JSON.stringify(this.authData));delete t.state,localStorage.setItem(this.config.storageKey,JSON.stringify(t)),this._debug("Auth data saved to local storage",t)}catch(e){console.error(e)}}_getId(e){return`gc-ca_${e=e||globalThis.crypto.randomUUID()}`}_authenticateViaPopup(e,t){const n=this._getId(),r=Object.assign(Object.assign({},e),{storageKey:this.config.storageKey});this.config.debugMode&&(r.debug=!0),localStorage.setItem(n,JSON.stringify(r)),e.state=n,e.redirect_uri||(e.redirect_uri=encodeURIComponent(`https://apps.${this.environment}/client-auth`));const o=this._buildAuthUrl("oauth/authorize",e);return new Promise((r,i)=>{this._debug("Implicit grant: opening new window: "+o),window.open(o,"_blank","width=500px,height=500px,noreferrer,noopener,resizable,scrollbars,status");const a=setTimeout(()=>{this._debug("timeout for loginImplicitGrant using popup",e);const t=new s("Popup authentation timeout. It is possible that the popup was blocked or the login page encountered an error");i(t)},t),c=e=>{if(this._debug("value was just written to storage by another app",{key:e.key,newValue:e.newValue,oldValue:e.oldValue}),e.key===this.config.storageKey){this._debug("keys matched. resolving value",{key:e.key,value:e.newValue}),window.removeEventListener("storage",c),clearTimeout(a);const t=JSON.parse(e.newValue);localStorage.removeItem(n),r(t)}};window.addEventListener("storage",c)})}_testTokenAccess(){return e=this,t=void 0,r=function*(){if(this._loadSettings(),!this.authentications["PureCloud OAuth"].accessToken)throw new i("errorTokenNotSet","No access token provided.");try{yield this.callApi("/api/v2/tokens/me","get")}catch(e){throw this._saveSettings({accessToken:void 0}),e}},new((n=void 0)||(n=Promise))(function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,a)}c((r=r.apply(e,t||[])).next())});var e,t,n,r}_loadSettings(){if(!this.config.persist)return;if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be loaded.");const e=this.authData.state,t=localStorage.getItem(this.config.storageKey);this.authData=t?JSON.parse(t):{},this.authData.accessToken&&this.setAccessToken(this.authData.accessToken),this.authData.state=e}_buildAuthUrl(e,t={}){return Object.keys(t).reduce((e,n)=>t[n]?`${e}&${n}=${t[n]}`:e,`${this.authUrl}/${e}?`)}}const xt=()=>{const e=a();if(e.error)throw new Error(`[${e.error}]: ${e.error_description}`);if(!e.accessToken)throw new i("errorToken","No access token provided.");const t=e.state;if(!t)throw new i("errorStateParam","No state param on redirect. Unable to determine location to save auth data.");const n=JSON.parse(localStorage.getItem(t)||"false");if(!n||!n.storageKey)throw new i("errorParse","Unable to parse information from localStorage.");n.state?e.state=n.state:delete e.state,c(`setting auth data to key: ${n.storageKey}`,e),localStorage.setItem(n.storageKey,JSON.stringify(e)),n.debug?c("In debug mode. Not closing window or removing storageId",{storageId:t,authData:e,href:window.location.href}):(c(`removing temp storage key: ${t}`),localStorage.removeItem(t),c("closing window"),window.close())},Ut=new Map,Nt=(e,t)=>{let n=Ut.get(e);return n||(n=new Pt(e,t),Ut.set(e,n)),n},kt=Nt;window.GenesysCloudClientAuth=t})();
|
|
1
|
+
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{GenesysCloudClientAuthenticator:()=>At,TimeoutError:()=>s,VERSION:()=>r,authenticatorFactory:()=>xt,default:()=>Nt,handleRedirectFromLogin:()=>Ct,isIssuedTimeWithinTimeframe:()=>l,isIssuedTimeWithinWindow:()=>u,parseOauthParams:()=>a,tokenWasIssuedAt:()=>d});var n={};e.r(n),e.d(n,{hasBrowserEnv:()=>Pe,hasStandardBrowserEnv:()=>Ne,hasStandardBrowserWebWorkerEnv:()=>De,navigator:()=>xe,origin:()=>Ue}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const r="2.0.1",o="color: #f29f2c";class s extends Error{constructor(){super(...arguments),this.name="TIMEOUT_ERROR"}}class i extends Error{constructor(e,t){const n=t&&t instanceof Error;super(n?t.message:t),n&&(this.name=t.name),this.translationKey=e}}const a=(e=window.location.hash)=>{const t={},n={},r=new RegExp("^#*(.+?)=(.+?)$","i");if(e.split("&").forEach(e=>{const n=r.exec(e);n&&(t[n[1]]=decodeURIComponent(decodeURIComponent(n[2].replace(/\+/g,"%20"))))}),t.error)return t;if(t.access_token){if(t.state&&(n.state=t.state),t.expires_in){const e=1e3*parseInt(t.expires_in.replace(/\+/g,"%20"));n.tokenExpiryTime=Date.now()+e,n.tokenExpiryTimeString=new Date(n.tokenExpiryTime).toISOString()}n.accessToken=t.access_token.replace(/\+/g,"%20")}return n},c=(e,t)=>{t?(console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o,t),"object"==typeof t&&console.log(`%c [DEBUG:gc-client-auth:${r}] ^ stringified: ${JSON.stringify(t)}`,o)):console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o)},l=(e,t=691199e3,n=168e4,r=Date.now())=>r-d(e,t)<n,u=(e,t,n)=>l(e,t,n),d=(e,t)=>e-t;function f(e,t){return function(){return e.apply(t,arguments)}}const{toString:h}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:g,toStringTag:m}=Symbol,y=(b=Object.create(null),e=>{const t=h.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())});var b;const w=e=>(e=e.toLowerCase(),t=>y(t)===e),E=e=>t=>typeof t===e,{isArray:O}=Array,R=E("undefined");function S(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&T(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _=w("ArrayBuffer"),v=E("string"),T=E("function"),A=E("number"),C=e=>null!==e&&"object"==typeof e,P=e=>{if("object"!==y(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||m in e||g in e)},x=w("Date"),N=w("File"),D=w("Blob"),U=w("FileList"),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},j=void 0!==k.FormData?k.FormData:void 0,L=w("URLSearchParams"),[B,F,I,q]=["ReadableStream","Request","Response","Headers"].map(w);function M(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),O(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(S(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 $(e,t){if(S(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 z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,J=e=>!R(e)&&e!==z,H=(W="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>W&&e instanceof W);var W;const K=w("HTMLFormElement"),V=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),G=w("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};M(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)},Q=w("AsyncFunction"),Y=(Z="function"==typeof setImmediate,ee=T(z.postMessage),Z?setImmediate:ee?(te=`axios@${Math.random()}`,ne=[],z.addEventListener("message",({source:e,data:t})=>{e===z&&t===te&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),z.postMessage(te,"*")}):e=>setTimeout(e));var Z,ee,te,ne;const re="undefined"!=typeof queueMicrotask?queueMicrotask.bind(z):"undefined"!=typeof process&&process.nextTick||Y,oe={isArray:O,isArrayBuffer:_,isBuffer:S,isFormData:e=>{if(!e)return!1;if(j&&e instanceof j)return!0;const t=p(e);if(!t||t===Object.prototype)return!1;if(!T(e.append))return!1;const n=y(e);return"formdata"===n||"object"===n&&T(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer),t},isString:v,isNumber:A,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:P,isEmptyObject:e=>{if(!C(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:B,isRequest:F,isResponse:I,isHeaders:q,isUndefined:R,isDate:x,isFile:N,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:D,isRegExp:G,isFunction:T,isStream:e=>C(e)&&T(e.pipe),isURLSearchParams:L,isTypedArray:H,isFileList:U,forEach:M,merge:function e(...t){const{caseless:n,skipUndefined:r}=J(this)&&this||{},o={},s=(t,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=n&&$(o,s)||s,a=V(o,i)?o[i]:void 0;P(a)&&P(t)?o[i]=e(a,t):P(t)?o[i]=e({},t):O(t)?o[i]=t.slice():r&&R(t)||(o[i]=t)};for(let e=0,n=t.length;e<n;e++)t[e]&&M(t[e],s);return o},extend:(e,t,n,{allOwnKeys:r}={})=>(M(t,(t,r)=>{n&&T(t)?Object.defineProperty(e,r,{__proto__:null,value:f(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,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&p(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:y,kindOfTest:w,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(O(e))return e;let t=e.length;if(!A(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[g]).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:K,hasOwnProperty:V,hasOwnProp:V,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(T(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];T(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 O(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:$,global:z,isContextDefined:J,isSpecCompliantForm:function(e){return!!(e&&T(e.append)&&"FormData"===e[m]&&e[g])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[r]=e;const o=O(e)?[]:{};return M(e,(e,t)=>{const s=n(e,r+1);!R(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Q,isThenable:e=>e&&(C(e)||T(e))&&T(e.then)&&T(e.catch),setImmediate:Y,asap:re,isIterable:e=>null!=e&&T(e[g])},se=oe.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"]),ie=Symbol("internals"),ae=/[^\x09\x20-\x7E\x80-\xFF]/g;function ce(e){return e&&String(e).trim().toLowerCase()}function le(e){return!1===e||null==e?e:oe.isArray(e)?e.map(le):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(ae,""))}function ue(e,t,n,r,o){return oe.isFunction(r)?r.call(this,t,n):(o&&(t=n),oe.isString(t)?oe.isString(r)?-1!==t.indexOf(r):oe.isRegExp(r)?r.test(t):void 0:void 0)}class de{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ce(t);if(!o)throw new Error("header name must be a non-empty string");const s=oe.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=le(e))}const s=(e,t)=>oe.forEach(e,(e,n)=>o(e,n,t));if(oe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(oe.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]&&se[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(oe.isObject(e)&&oe.isIterable(e)){let n,r,o={};for(const t of e){if(!oe.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?oe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ce(e)){const n=oe.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(oe.isFunction(t))return t.call(this,e,n);if(oe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ce(e)){const n=oe.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=ce(e)){const o=oe.findKey(n,e);!o||t&&!ue(0,n[o],o,t)||(delete n[o],r=!0)}}return oe.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 oe.forEach(this,(r,o)=>{const s=oe.findKey(n,o);if(s)return t[s]=le(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]=le(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return oe.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&oe.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[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ce(e);t[r]||(function(e,t){const n=oe.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 oe.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),oe.freezeMethods(de);const fe=de;class he extends Error{static from(e,t,n,r,o,s){const i=new he(e.message,t||e.code,n,r,o);return i.cause=e,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&&oe.hasOwnProp(e,"redact")?e.redact:void 0,n=oe.isArray(t)&&t.length>0?function(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(oe.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof fe&&(e=e.toJSON()),r.push(e),oe.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);oe.isUndefined(r)||(t[n]=r)});else{if(!oe.isPlainObject(e)&&function(e){if(oe.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(oe.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);oe.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}(e,t):oe.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}}}he.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",he.ERR_BAD_OPTION="ERR_BAD_OPTION",he.ECONNABORTED="ECONNABORTED",he.ETIMEDOUT="ETIMEDOUT",he.ECONNREFUSED="ECONNREFUSED",he.ERR_NETWORK="ERR_NETWORK",he.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",he.ERR_DEPRECATED="ERR_DEPRECATED",he.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",he.ERR_BAD_REQUEST="ERR_BAD_REQUEST",he.ERR_CANCELED="ERR_CANCELED",he.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",he.ERR_INVALID_URL="ERR_INVALID_URL",he.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const pe=he;function ge(e){return oe.isPlainObject(e)||oe.isArray(e)}function me(e){return oe.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 be=oe.toFlatObject(oe,{},null,function(e){return/^is[A-Z]/.test(e)}),we=function(e,t,n){if(!oe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!oe.isUndefined(t[e])})).metaTokens,o=n.visitor||d,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,l=a&&oe.isSpecCompliantForm(t);if(!oe.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(oe.isDate(e))return e.toISOString();if(oe.isBoolean(e))return e.toString();if(!l&&oe.isBlob(e))throw new pe("Blob is not supported. Use a Buffer instead.");return oe.isArrayBuffer(e)||oe.isTypedArray(e)?l&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,o){let a=e;if(oe.isReactNative(t)&&oe.isReactNativeBlob(e))return t.append(ye(o,n,s),u(e)),!1;if(e&&!o&&"object"==typeof e)if(oe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(oe.isArray(e)&&function(e){return oe.isArray(e)&&!e.some(ge)}(e)||(oe.isFileList(e)||oe.endsWith(n,"[]"))&&(a=oe.toArray(e)))return n=me(n),a.forEach(function(e,r){!oe.isUndefined(e)&&null!==e&&t.append(!0===i?ye([n],r,s):null===i?n:n+"[]",u(e))}),!1;return!!ge(e)||(t.append(ye(o,n,s),u(e)),!1)}const f=[],h=Object.assign(be,{defaultVisitor:d,convertValue:u,isVisitable:ge});if(!oe.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!oe.isUndefined(n)){if(s>c)throw new pe("Object is too deeply nested ("+s+" levels). Max depth: "+c,pe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),oe.forEach(n,function(n,i){!0===(!(oe.isUndefined(n)||null===n)&&o.call(t,n,oe.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i],s+1)}),f.pop()}}(e),t};function Ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Oe(e,t){this._pairs=[],e&&we(e,this,t)}const Re=Oe.prototype;Re.append=function(e,t){this._pairs.push([e,t])},Re.toString=function(e){const t=e?function(t){return e.call(this,t,Ee)}:Ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Se=Oe;function _e(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ve(e,t,n){if(!t)return e;const r=n&&n.encode||_e,o=oe.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let i;if(i=s?s(t,o):oe.isURLSearchParams(t)?t.toString():new Se(t,o).toString(r),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){oe.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ce={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Se,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,xe="object"==typeof navigator&&navigator||void 0,Ne=Pe&&(!xe||["ReactNative","NativeScript","NS"].indexOf(xe.product)<0),De="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ue=Pe&&window.location.href||"http://localhost",ke={...n,...Ce},je=function(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;return s=!s&&oe.isArray(r)?r.length:s,a?(oe.hasOwnProp(r,s)?r[s]=oe.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i):(r[s]&&oe.isObject(r[s])||(r[s]=[]),t(e,n,r[s],o)&&oe.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(oe.isFormData(e)&&oe.isFunction(e.entries)){const n={};return oe.forEachEntry(e,(e,r)=>{t(function(e){return oe.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Le=(e,t)=>null!=e&&oe.hasOwnProp(e,t)?e[t]:void 0,Be={transitional:Ae,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=oe.isObject(e);if(o&&oe.isHTMLForm(e)&&(e=new FormData(e)),oe.isFormData(e))return r?JSON.stringify(je(e)):e;if(oe.isArrayBuffer(e)||oe.isBuffer(e)||oe.isStream(e)||oe.isFile(e)||oe.isBlob(e)||oe.isReadableStream(e))return e;if(oe.isArrayBufferView(e))return e.buffer;if(oe.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 we(e,new ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return ke.isNode&&oe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Le(this,"env"),r=n&&n.FormData;return we(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e){if(oe.isString(e))try{return(0,JSON.parse)(e),oe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Le(this,"transitional")||Be.transitional,n=t&&t.forcedJSONParsing,r=Le(this,"responseType"),o="json"===r;if(oe.isResponse(e)||oe.isReadableStream(e))return e;if(e&&oe.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 pe.from(e,pe.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:ke.classes.FormData,Blob:ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};oe.forEach(["delete","get","head","post","put","patch","query"],e=>{Be.headers[e]={}});const Fe=Be;function Ie(e,t){const n=this||Fe,r=t||n,o=fe.from(r.headers);let s=r.data;return oe.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function qe(e){return!(!e||!e.__CANCEL__)}const Me=class extends pe{constructor(e,t,n){super(null==e?"canceled":e,pe.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $e(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new pe("Request failed with status code "+n.status,n.status>=400&&n.status<500?pe.ERR_BAD_REQUEST:pe.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ze=(e,t,n=3)=>{let r=0;const o=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 c=Date.now(),l=r[i];o||(o=c),n[s]=a,r[s]=c;let u=i,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return 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)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,c=Math.max(0,a-r),l=o(c);r=Math.max(r,a),e({loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:l||void 0,estimated:l&&i?(i-a)/l: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]]},He=e=>(...t)=>oe.asap(()=>e(...t)),We=ke.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ke.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ke.origin),ke.navigator&&/(msie|trident)/i.test(ke.navigator.userAgent)):()=>!0,Ke=ke.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];oe.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),oe.isString(r)&&a.push(`path=${r}`),oe.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),oe.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)return decodeURIComponent(r.slice(o+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ge=e=>e instanceof fe?{...e}:e;function Xe(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return oe.isPlainObject(e)&&oe.isPlainObject(t)?oe.merge.call({caseless:r},e,t):oe.isPlainObject(t)?oe.merge({},t):oe.isArray(t)?t.slice():t}function o(e,t,n,o){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!oe.isUndefined(t))return r(void 0,t)}function i(e,t){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return oe.hasOwnProp(t,s)?r(n,o):oe.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 c={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(Ge(e),Ge(t),0,!0)};return oe.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=oe.hasOwnProp(c,r)?c[r]:o,i=s(oe.hasOwnProp(e,r)?e[r]:void 0,oe.hasOwnProp(t,r)?t[r]:void 0,r);oe.isUndefined(i)&&s!==a||(n[r]=i)}),n}const Qe=["content-type","content-length"],Ye=e=>{const t=Xe({},e),n=e=>oe.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 c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");var f;if(t.headers=a=fe.from(a),t.url=ve(Ve(l,d,u),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(f=c.password,encodeURIComponent(f).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),oe.isFormData(r)&&(ke.hasStandardBrowserEnv||ke.hasStandardBrowserWebWorkerEnv?a.setContentType(void 0):oe.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{Qe.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,r.getHeaders(),n("formDataHeaderPolicy"))),ke.hasStandardBrowserEnv&&(oe.isFunction(o)&&(o=o(t)),!0===o||null==o&&We(t.url))){const e=s&&i&&Ke.read(i);e&&a.set(s,e)}return t},Ze="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ye(e);let o=r.data;const s=fe.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=fe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());$e(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new pe("Request aborted",pe.ECONNABORTED,e,g)),p(),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new pe(r,pe.ERR_NETWORK,e,g);o.event=t||null,n(o),p(),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ae;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new pe(t,o.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,e,g)),p(),g=null},void 0===o&&s.setContentType(null),"setRequestHeader"in g&&oe.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),oe.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),d&&"json"!==d&&(g.responseType=r.responseType),h&&([c,u]=ze(h,!0),g.addEventListener("progress",c)),f&&g.upload&&([a,l]=ze(f),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{g&&(n(!t||t.type?new Me(null,e,g):t),g.abort(),p(),g=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||ke.protocols.includes(y)?g.send(o||null):n(new pe("Unsupported protocol "+y+":",pe.ERR_BAD_REQUEST,e))})},et=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof pe?t:new Me(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new pe(`timeout of ${t}ms exceeded`,pe.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));const{signal:a}=r;return a.unsubscribe=()=>oe.asap(i),a}},tt=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},nt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of 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()}}(e))yield*tt(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})},rt="1.16.0",{isFunction:ot}=oe,st=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},it=e=>{const t=oe.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=oe.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:s,Response:i}=e,a=o?ot(o):"function"==typeof fetch,c=ot(s),l=ot(i);if(!a)return!1;const u=a&&ot(n),d=a&&("function"==typeof r?(f=new r,e=>f.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var f;const h=c&&u&&st(()=>{let e=!1;const t=new s(ke.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),p=l&&u&&st(()=>oe.isReadableStream(new i("").body)),g={stream:p&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!g[e]&&(g[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new pe(`Response type '${e}' is not supported`,pe.ERR_NOT_SUPPORT,n)})});const m=async(e,t)=>{const n=oe.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e)){const t=new s(ke.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return oe.isArrayBufferView(e)||oe.isArrayBuffer(e)?e.byteLength:(oe.isURLSearchParams(e)&&(e+=""),oe.isString(e)?(await d(e)).byteLength:void 0)})(t):n};return async e=>{let{url:t,method:n,data:a,signal:l,cancelToken:u,timeout:d,onDownloadProgress:f,onUploadProgress:y,responseType:b,headers:w,withCredentials:E="same-origin",fetchOptions:O,maxContentLength:R,maxBodyLength:S}=Ye(e);const _=oe.isNumber(R)&&R>-1,v=oe.isNumber(S)&&S>-1;let T=o||fetch;b=b?(b+"").toLowerCase():"text";let A=et([l,u&&u.toAbortSignal()],d),C=null;const P=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let x;try{if(_&&"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);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(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}if("undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength)return Buffer.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);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>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}if(v&&"get"!==n&&"head"!==n){const t=await m(w,a);if("number"==typeof t&&isFinite(t)&&t>S)throw new pe("Request body larger than maxBodyLength limit",pe.ERR_BAD_REQUEST,e,C)}if(y&&h&&"get"!==n&&"head"!==n&&0!==(x=await m(w,a))){let e,n=new s(t,{method:"POST",body:a,duplex:"half"});if(oe.isFormData(a)&&(e=n.headers.get("content-type"))&&w.setContentType(e),n.body){const[e,t]=Je(x,ze(He(y)));a=nt(n.body,65536,e,t)}}oe.isString(E)||(E=E?"include":"omit");const o=c&&"credentials"in s.prototype;if(oe.isFormData(a)){const e=w.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&w.delete("content-type")}w.set("User-Agent","axios/"+rt,!1);const l={...O,signal:A,method:n.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:o?E:void 0};C=c&&new s(t,l);let u=await(c?T(C,O):T(t,l));if(_){const t=oe.toFiniteNumber(u.headers.get("content-length"));if(null!=t&&t>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}const d=p&&("stream"===b||"response"===b);if(p&&u.body&&(f||_||d&&P)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=u[e]});const n=oe.toFiniteNumber(u.headers.get("content-length")),[r,o]=f&&Je(n,ze(He(f),!0))||[];let s=0;const a=t=>{if(_&&(s=t,s>R))throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C);r&&r(t)};u=new i(nt(u.body,65536,a,()=>{o&&o(),P&&P()}),t)}b=b||"text";let N=await g[oe.findKey(g,b)||"text"](u,e);if(_&&!p&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}return!d&&P&&P(),await new Promise((t,n)=>{$e(t,n,{data:N,headers:fe.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:C})})}catch(t){if(P&&P(),A&&A.aborted&&A.reason instanceof pe){const n=A.reason;throw n.config=e,C&&(n.request=C),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new pe("Network Error",pe.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t});throw pe.from(t,t&&t.code,e,C,t&&t.response)}}},at=new Map,ct=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,c=s.length,l=at;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:it(t)),l=a;return a},lt=(ct(),{http:null,xhr:Ze,fetch:{get:ct}});oe.forEach(lt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const ut=e=>`- ${e}`,dt=e=>oe.isFunction(e)||null===e||!1===e,ft=function(e,t){e=oe.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,!dt(r)&&(o=lt[(n=String(r)).toLowerCase()],void 0===o))throw new pe(`Unknown adapter '${n}'`);if(o&&(oe.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(ut).join("\n"):" "+ut(e[0]):"as no adapter specified";throw new pe("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o};function ht(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Me(null,e)}function pt(e){return ht(e),e.headers=fe.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),ft(e.adapter||Fe.adapter,e)(e).then(function(t){ht(e),e.response=t;try{t.data=Ie.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=fe.from(t.headers),t},function(t){if(!qe(t)&&(ht(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=fe.from(t.response.headers)}return Promise.reject(t)})}const gt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const mt={};gt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+rt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new pe(r(o," has been removed"+(t?" in "+t:"")),pe.ERR_DEPRECATED);return t&&!mt[o]&&(mt[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)}},gt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const yt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new pe("options must be an object",pe.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 pe("option "+s+" must be "+n,pe.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new pe("Unknown option "+s,pe.ERR_BAD_OPTION)}},validators:gt},bt=yt.validators;class wt{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=Xe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&yt.assertOptions(n,{silentJSONParsing:bt.transitional(bt.boolean),forcedJSONParsing:bt.transitional(bt.boolean),clarifyTimeoutError:bt.transitional(bt.boolean),legacyInterceptorReqResOrdering:bt.transitional(bt.boolean)},!1),null!=r&&(oe.isFunction(r)?t.paramsSerializer={serialize:r}:yt.assertOptions(r,{encode:bt.function,serialize:bt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yt.assertOptions(t,{baseUrl:bt.spelling("baseURL"),withXsrfToken:bt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&oe.merge(o.common,o[t.method]);o&&oe.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=fe.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||Ae;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[pt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=pt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ve(Ve((e=Xe(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}oe.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,n){return this.request(Xe(n||{},{method:e,url:t,data:(n||{}).data}))}}),oe.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(Xe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}wt.prototype[e]=t(),"query"!==e&&(wt.prototype[e+"Form"]=t(!0))});const Et=wt;class Ot{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 Me(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 Ot(function(t){e=t}),cancel:e}}}const Rt=Ot,St={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(St).forEach(([e,t])=>{St[t]=e});const _t=St,vt=function e(t){const n=new Et(t),r=f(Et.prototype.request,n);return oe.extend(r,Et.prototype,n,{allOwnKeys:!0}),oe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xe(t,n))},r}(Fe);vt.Axios=Et,vt.CanceledError=Me,vt.CancelToken=Rt,vt.isCancel=qe,vt.VERSION=rt,vt.toFormData=we,vt.AxiosError=pe,vt.Cancel=vt.CanceledError,vt.all=function(e){return Promise.all(e)},vt.spread=function(e){return function(t){return e.apply(null,t)}},vt.isAxiosError=function(e){return oe.isObject(e)&&!0===e.isAxiosError},vt.mergeConfig=Xe,vt.AxiosHeaders=fe,vt.formToJSON=e=>je(oe.isHTMLForm(e)?new FormData(e):e),vt.getAdapter=ft,vt.HttpStatusCode=_t,vt.default=vt;const Tt=vt;class At{constructor(e,t={}){this.VERSION=r,this.clientId=e,t.storageKey||(t.storageKey="gc_client_auth_data"),"boolean"!=typeof t.persist&&(t.persist=!1),this.config=Object.assign({},t),this.customHeaders=t.customHeaders,this.setEnvironment(t.environment),this.timeout=16e3,this.authData={},this.authentications={"PureCloud OAuth":{type:"oauth2"}};try{localStorage.setItem("genesys_cloud_local_storage_test","genesys_cloud_local_storage_test"),localStorage.removeItem("genesys_cloud_local_storage_test"),this.hasLocalStorage=!0}catch(e){this.hasLocalStorage=!1}this._loadSettings()}loginImplicitGrant(e={},t){const n=t||a();return new Promise((t,r)=>{e.org&&!e.provider?r(new Error("opts.provider must be set if opts.org is set")):e.provider&&!e.org?r(new Error("opts.org must be set if opts.provider is set")):e.redirectUri||e.usePopupAuth||r(new Error("redirectUri must be provided for implicit grant and not utilizing client-auth app for popup auth")),n&&n.error&&(n.accessToken=void 0,this._saveSettings(n),r(new Error(`[${n.error}] ${n.error_description}`))),n.accessToken&&this._saveSettings(n),this._testTokenAccess().then(()=>(!this.authData.state&&e.state&&(this.authData.state=e.state),t(this.authData))).catch(n=>{this._debug("Error encountered during login. This is normal if the application has not yet been authorized.",n);const o={client_id:encodeURIComponent(this.clientId),response_type:"token"};if(e.redirectUri&&(o.redirect_uri=encodeURIComponent(e.redirectUri)),e.state&&(o.state=encodeURIComponent(e.state)),e.org&&(o.org=encodeURIComponent(e.org)),e.provider&&(o.provider=encodeURIComponent(e.provider)),e.usePopupAuth){if(!this.hasLocalStorage)return r(new Error("localStorage is unavailable. Cannot authenticate via popup window."));this._debug("using popup auth – adding listener"),this._authenticateViaPopup(o,e.popupTimeout||15e3).then(e=>{this._saveSettings(e),t(e)}).catch(r)}else{const e=this._buildAuthUrl("oauth/authorize",o);this._debug("Implicit grant: redirecting to: "+e),window.location.replace(e),r(new Error(`Routing to login: "${e}"`))}})})}setEnvironment(e){e||(e="mypurecloud.com"),(e=e.replace(/\/+$/,"")).startsWith("https://")&&(e=e.substring(8)),e.startsWith("http://")&&(e=e.substring(7)),e.startsWith("api.")&&(e=e.substring(4)),this.environment=e,this.basePath=`https://api.${e}`,this.authUrl=`https://login.${e}`}clearAuthData(){this._saveSettings({accessToken:void 0,state:void 0,tokenExpiryTime:void 0,tokenExpiryTimeString:void 0})}logout(e){this.clearAuthData();const t={client_id:encodeURIComponent(this.clientId)};e&&(t.redirect_uri=encodeURIComponent(e));const n=this._buildAuthUrl("logout",t);window.location.replace(n)}setAccessToken(e){this._saveSettings({accessToken:e})}testAccessToken(e){return this.callApi("/api/v2/tokens/me","get",e)}parseDate(e){return new Date(e.replace(/T/i," "))}paramToString(e){return e?e instanceof Date?e.toJSON():e.toString():""}buildUrl(e,t={}){return e.match(/^\//)||(e=`/${e}`),(this.basePath+e).replace(/\{([\w-]+)\}/g,(e,n)=>{let r;return r=Object.getOwnPropertyDescriptor(t,n)?this.paramToString(t[n]):e,encodeURIComponent(r)})}callApi(e,t,n){var r;const o=this.buildUrl(e),s={Authorization:`Bearer ${n||(null===(r=this.authData)||void 0===r?void 0:r.accessToken)}`,"Content-Type":"application/json"};this.customHeaders&&Object.entries(this.customHeaders).forEach(([e,t])=>{s[e]=t});const i={method:t,url:o,headers:s,timeout:this.timeout};return Tt.request(i)}_debug(e,t){this.config.debugMode&&c(e,t)}_saveSettings(e){try{if(this.authData.accessToken=e.accessToken,this.authentications["PureCloud OAuth"].accessToken=e.accessToken,e.state&&(this.authData.state=e.state),this.authData.error=e.error,this.authData.error_description=e.error_description,e.tokenExpiryTime&&(this.authData.tokenExpiryTime=e.tokenExpiryTime,this.authData.tokenExpiryTimeString=e.tokenExpiryTimeString),!this.config.persist)return void this._debug("persist is not true. Settings will not be saved.");if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be saved.");const t=JSON.parse(JSON.stringify(this.authData));delete t.state,localStorage.setItem(this.config.storageKey,JSON.stringify(t)),this._debug("Auth data saved to local storage",t)}catch(e){console.error(e)}}_getId(e){return`gc-ca_${e=e||globalThis.crypto.randomUUID()}`}_authenticateViaPopup(e,t){const n=this._getId(),r=Object.assign(Object.assign({},e),{storageKey:this.config.storageKey});this.config.debugMode&&(r.debug=!0),localStorage.setItem(n,JSON.stringify(r)),e.state=n,e.redirect_uri||(e.redirect_uri=encodeURIComponent(`https://apps.${this.environment}/client-auth`));const o=this._buildAuthUrl("oauth/authorize",e);return new Promise((r,i)=>{this._debug("Implicit grant: opening new window: "+o),window.open(o,"_blank","width=500px,height=500px,noreferrer,noopener,resizable,scrollbars,status");const a=setTimeout(()=>{this._debug("timeout for loginImplicitGrant using popup",e);const t=new s("Popup authentation timeout. It is possible that the popup was blocked or the login page encountered an error");i(t)},t),c=e=>{if(this._debug("value was just written to storage by another app",{key:e.key,newValue:e.newValue,oldValue:e.oldValue}),e.key===this.config.storageKey){this._debug("keys matched. resolving value",{key:e.key,value:e.newValue}),window.removeEventListener("storage",c),clearTimeout(a);const t=JSON.parse(e.newValue);localStorage.removeItem(n),r(t)}};window.addEventListener("storage",c)})}_testTokenAccess(){return e=this,t=void 0,r=function*(){if(this._loadSettings(),!this.authentications["PureCloud OAuth"].accessToken)throw new i("errorTokenNotSet","No access token provided.");try{yield this.callApi("/api/v2/tokens/me","get")}catch(e){throw this._saveSettings({accessToken:void 0}),e}},new((n=void 0)||(n=Promise))(function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,a)}c((r=r.apply(e,t||[])).next())});var e,t,n,r}_loadSettings(){if(!this.config.persist)return;if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be loaded.");const e=this.authData.state,t=localStorage.getItem(this.config.storageKey);this.authData=t?JSON.parse(t):{},this.authData.accessToken&&this.setAccessToken(this.authData.accessToken),this.authData.state=e}_buildAuthUrl(e,t={}){return Object.keys(t).reduce((e,n)=>t[n]?`${e}&${n}=${t[n]}`:e,`${this.authUrl}/${e}?`)}}const Ct=()=>{const e=a();if(e.error)throw new Error(`[${e.error}]: ${e.error_description}`);if(!e.accessToken)throw new i("errorToken","No access token provided.");const t=e.state;if(!t)throw new i("errorStateParam","No state param on redirect. Unable to determine location to save auth data.");const n=JSON.parse(localStorage.getItem(t)||"false");if(!n||!n.storageKey)throw new i("errorParse","Unable to parse information from localStorage.");n.state?e.state=n.state:delete e.state,c(`setting auth data to key: ${n.storageKey}`,e),localStorage.setItem(n.storageKey,JSON.stringify(e)),n.debug?c("In debug mode. Not closing window or removing storageId",{storageId:t,authData:e,href:window.location.href}):(c(`removing temp storage key: ${t}`),localStorage.removeItem(t),c("closing window"),window.close())},Pt=new Map,xt=(e,t)=>{let n=Pt.get(e);return n||(n=new At(e,t),Pt.set(e,n)),n},Nt=xt;window.GenesysCloudClientAuth=t})();
|
|
2
2
|
//# sourceMappingURL=genesys-cloud-client-auth.browser.min.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{GenesysCloudClientAuthenticator:()=>At,TimeoutError:()=>s,VERSION:()=>r,authenticatorFactory:()=>xt,default:()=>Nt,handleRedirectFromLogin:()=>Ct,isIssuedTimeWithinTimeframe:()=>l,isIssuedTimeWithinWindow:()=>u,parseOauthParams:()=>a,tokenWasIssuedAt:()=>d});var n={};e.r(n),e.d(n,{hasBrowserEnv:()=>Pe,hasStandardBrowserEnv:()=>Ne,hasStandardBrowserWebWorkerEnv:()=>De,navigator:()=>xe,origin:()=>Ue}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const r="2.0.1",o="color: #f29f2c";class s extends Error{constructor(){super(...arguments),this.name="TIMEOUT_ERROR"}}class i extends Error{constructor(e,t){const n=t&&t instanceof Error;super(n?t.message:t),n&&(this.name=t.name),this.translationKey=e}}const a=(e=window.location.hash)=>{const t={},n={},r=new RegExp("^#*(.+?)=(.+?)$","i");if(e.split("&").forEach(e=>{const n=r.exec(e);n&&(t[n[1]]=decodeURIComponent(decodeURIComponent(n[2].replace(/\+/g,"%20"))))}),t.error)return t;if(t.access_token){if(t.state&&(n.state=t.state),t.expires_in){const e=1e3*parseInt(t.expires_in.replace(/\+/g,"%20"));n.tokenExpiryTime=Date.now()+e,n.tokenExpiryTimeString=new Date(n.tokenExpiryTime).toISOString()}n.accessToken=t.access_token.replace(/\+/g,"%20")}return n},c=(e,t)=>{t?(console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o,t),"object"==typeof t&&console.log(`%c [DEBUG:gc-client-auth:${r}] ^ stringified: ${JSON.stringify(t)}`,o)):console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o)},l=(e,t=691199e3,n=168e4,r=Date.now())=>r-d(e,t)<n,u=(e,t,n)=>l(e,t,n),d=(e,t)=>e-t;function f(e,t){return function(){return e.apply(t,arguments)}}const{toString:h}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:g,toStringTag:m}=Symbol,y=(b=Object.create(null),e=>{const t=h.call(e);return b[t]||(b[t]=t.slice(8,-1).toLowerCase())});var b;const w=e=>(e=e.toLowerCase(),t=>y(t)===e),E=e=>t=>typeof t===e,{isArray:O}=Array,R=E("undefined");function S(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&T(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _=w("ArrayBuffer"),v=E("string"),T=E("function"),A=E("number"),C=e=>null!==e&&"object"==typeof e,P=e=>{if("object"!==y(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||m in e||g in e)},x=w("Date"),N=w("File"),D=w("Blob"),U=w("FileList"),k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},j=void 0!==k.FormData?k.FormData:void 0,L=w("URLSearchParams"),[B,F,I,q]=["ReadableStream","Request","Response","Headers"].map(w);function M(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),O(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(S(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 $(e,t){if(S(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 z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,J=e=>!R(e)&&e!==z,H=(W="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>W&&e instanceof W);var W;const K=w("HTMLFormElement"),V=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),G=w("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};M(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)},Q=w("AsyncFunction"),Y=(Z="function"==typeof setImmediate,ee=T(z.postMessage),Z?setImmediate:ee?(te=`axios@${Math.random()}`,ne=[],z.addEventListener("message",({source:e,data:t})=>{e===z&&t===te&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),z.postMessage(te,"*")}):e=>setTimeout(e));var Z,ee,te,ne;const re="undefined"!=typeof queueMicrotask?queueMicrotask.bind(z):"undefined"!=typeof process&&process.nextTick||Y,oe={isArray:O,isArrayBuffer:_,isBuffer:S,isFormData:e=>{if(!e)return!1;if(j&&e instanceof j)return!0;const t=p(e);if(!t||t===Object.prototype)return!1;if(!T(e.append))return!1;const n=y(e);return"formdata"===n||"object"===n&&T(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer),t},isString:v,isNumber:A,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:P,isEmptyObject:e=>{if(!C(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:B,isRequest:F,isResponse:I,isHeaders:q,isUndefined:R,isDate:x,isFile:N,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:D,isRegExp:G,isFunction:T,isStream:e=>C(e)&&T(e.pipe),isURLSearchParams:L,isTypedArray:H,isFileList:U,forEach:M,merge:function e(...t){const{caseless:n,skipUndefined:r}=J(this)&&this||{},o={},s=(t,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=n&&$(o,s)||s,a=V(o,i)?o[i]:void 0;P(a)&&P(t)?o[i]=e(a,t):P(t)?o[i]=e({},t):O(t)?o[i]=t.slice():r&&R(t)||(o[i]=t)};for(let e=0,n=t.length;e<n;e++)t[e]&&M(t[e],s);return o},extend:(e,t,n,{allOwnKeys:r}={})=>(M(t,(t,r)=>{n&&T(t)?Object.defineProperty(e,r,{__proto__:null,value:f(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,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&p(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:y,kindOfTest:w,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(O(e))return e;let t=e.length;if(!A(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[g]).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:K,hasOwnProperty:V,hasOwnProp:V,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(T(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];T(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 O(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:$,global:z,isContextDefined:J,isSpecCompliantForm:function(e){return!!(e&&T(e.append)&&"FormData"===e[m]&&e[g])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[r]=e;const o=O(e)?[]:{};return M(e,(e,t)=>{const s=n(e,r+1);!R(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Q,isThenable:e=>e&&(C(e)||T(e))&&T(e.then)&&T(e.catch),setImmediate:Y,asap:re,isIterable:e=>null!=e&&T(e[g])},se=oe.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"]),ie=Symbol("internals"),ae=/[^\x09\x20-\x7E\x80-\xFF]/g;function ce(e){return e&&String(e).trim().toLowerCase()}function le(e){return!1===e||null==e?e:oe.isArray(e)?e.map(le):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(ae,""))}function ue(e,t,n,r,o){return oe.isFunction(r)?r.call(this,t,n):(o&&(t=n),oe.isString(t)?oe.isString(r)?-1!==t.indexOf(r):oe.isRegExp(r)?r.test(t):void 0:void 0)}class de{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ce(t);if(!o)throw new Error("header name must be a non-empty string");const s=oe.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=le(e))}const s=(e,t)=>oe.forEach(e,(e,n)=>o(e,n,t));if(oe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(oe.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]&&se[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(oe.isObject(e)&&oe.isIterable(e)){let n,r,o={};for(const t of e){if(!oe.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?oe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ce(e)){const n=oe.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(oe.isFunction(t))return t.call(this,e,n);if(oe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ce(e)){const n=oe.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=ce(e)){const o=oe.findKey(n,e);!o||t&&!ue(0,n[o],o,t)||(delete n[o],r=!0)}}return oe.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 oe.forEach(this,(r,o)=>{const s=oe.findKey(n,o);if(s)return t[s]=le(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]=le(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return oe.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&oe.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[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ce(e);t[r]||(function(e,t){const n=oe.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 oe.isArray(e)?e.forEach(r):r(e),this}}de.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(de.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),oe.freezeMethods(de);const fe=de;class he extends Error{static from(e,t,n,r,o,s){const i=new he(e.message,t||e.code,n,r,o);return i.cause=e,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&&oe.hasOwnProp(e,"redact")?e.redact:void 0,n=oe.isArray(t)&&t.length>0?function(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(oe.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof fe&&(e=e.toJSON()),r.push(e),oe.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);oe.isUndefined(r)||(t[n]=r)});else{if(!oe.isPlainObject(e)&&function(e){if(oe.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(oe.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);oe.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}(e,t):oe.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}}}he.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",he.ERR_BAD_OPTION="ERR_BAD_OPTION",he.ECONNABORTED="ECONNABORTED",he.ETIMEDOUT="ETIMEDOUT",he.ECONNREFUSED="ECONNREFUSED",he.ERR_NETWORK="ERR_NETWORK",he.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",he.ERR_DEPRECATED="ERR_DEPRECATED",he.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",he.ERR_BAD_REQUEST="ERR_BAD_REQUEST",he.ERR_CANCELED="ERR_CANCELED",he.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",he.ERR_INVALID_URL="ERR_INVALID_URL",he.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const pe=he;function ge(e){return oe.isPlainObject(e)||oe.isArray(e)}function me(e){return oe.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 be=oe.toFlatObject(oe,{},null,function(e){return/^is[A-Z]/.test(e)}),we=function(e,t,n){if(!oe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!oe.isUndefined(t[e])})).metaTokens,o=n.visitor||d,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,l=a&&oe.isSpecCompliantForm(t);if(!oe.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(oe.isDate(e))return e.toISOString();if(oe.isBoolean(e))return e.toString();if(!l&&oe.isBlob(e))throw new pe("Blob is not supported. Use a Buffer instead.");return oe.isArrayBuffer(e)||oe.isTypedArray(e)?l&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,o){let a=e;if(oe.isReactNative(t)&&oe.isReactNativeBlob(e))return t.append(ye(o,n,s),u(e)),!1;if(e&&!o&&"object"==typeof e)if(oe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(oe.isArray(e)&&function(e){return oe.isArray(e)&&!e.some(ge)}(e)||(oe.isFileList(e)||oe.endsWith(n,"[]"))&&(a=oe.toArray(e)))return n=me(n),a.forEach(function(e,r){!oe.isUndefined(e)&&null!==e&&t.append(!0===i?ye([n],r,s):null===i?n:n+"[]",u(e))}),!1;return!!ge(e)||(t.append(ye(o,n,s),u(e)),!1)}const f=[],h=Object.assign(be,{defaultVisitor:d,convertValue:u,isVisitable:ge});if(!oe.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!oe.isUndefined(n)){if(s>c)throw new pe("Object is too deeply nested ("+s+" levels). Max depth: "+c,pe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),oe.forEach(n,function(n,i){!0===(!(oe.isUndefined(n)||null===n)&&o.call(t,n,oe.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i],s+1)}),f.pop()}}(e),t};function Ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Oe(e,t){this._pairs=[],e&&we(e,this,t)}const Re=Oe.prototype;Re.append=function(e,t){this._pairs.push([e,t])},Re.toString=function(e){const t=e?function(t){return e.call(this,t,Ee)}:Ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Se=Oe;function _e(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ve(e,t,n){if(!t)return e;const r=n&&n.encode||_e,o=oe.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let i;if(i=s?s(t,o):oe.isURLSearchParams(t)?t.toString():new Se(t,o).toString(r),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){oe.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ce={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Se,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,xe="object"==typeof navigator&&navigator||void 0,Ne=Pe&&(!xe||["ReactNative","NativeScript","NS"].indexOf(xe.product)<0),De="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ue=Pe&&window.location.href||"http://localhost",ke={...n,...Ce},je=function(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;return s=!s&&oe.isArray(r)?r.length:s,a?(oe.hasOwnProp(r,s)?r[s]=oe.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i):(r[s]&&oe.isObject(r[s])||(r[s]=[]),t(e,n,r[s],o)&&oe.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(oe.isFormData(e)&&oe.isFunction(e.entries)){const n={};return oe.forEachEntry(e,(e,r)=>{t(function(e){return oe.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Le=(e,t)=>null!=e&&oe.hasOwnProp(e,t)?e[t]:void 0,Be={transitional:Ae,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=oe.isObject(e);if(o&&oe.isHTMLForm(e)&&(e=new FormData(e)),oe.isFormData(e))return r?JSON.stringify(je(e)):e;if(oe.isArrayBuffer(e)||oe.isBuffer(e)||oe.isStream(e)||oe.isFile(e)||oe.isBlob(e)||oe.isReadableStream(e))return e;if(oe.isArrayBufferView(e))return e.buffer;if(oe.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 we(e,new ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return ke.isNode&&oe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Le(this,"env"),r=n&&n.FormData;return we(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e){if(oe.isString(e))try{return(0,JSON.parse)(e),oe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Le(this,"transitional")||Be.transitional,n=t&&t.forcedJSONParsing,r=Le(this,"responseType"),o="json"===r;if(oe.isResponse(e)||oe.isReadableStream(e))return e;if(e&&oe.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 pe.from(e,pe.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:ke.classes.FormData,Blob:ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};oe.forEach(["delete","get","head","post","put","patch","query"],e=>{Be.headers[e]={}});const Fe=Be;function Ie(e,t){const n=this||Fe,r=t||n,o=fe.from(r.headers);let s=r.data;return oe.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function qe(e){return!(!e||!e.__CANCEL__)}const Me=class extends pe{constructor(e,t,n){super(null==e?"canceled":e,pe.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $e(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new pe("Request failed with status code "+n.status,n.status>=400&&n.status<500?pe.ERR_BAD_REQUEST:pe.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ze=(e,t,n=3)=>{let r=0;const o=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 c=Date.now(),l=r[i];o||(o=c),n[s]=a,r[s]=c;let u=i,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return 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)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,c=Math.max(0,a-r),l=o(c);r=Math.max(r,a),e({loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:l||void 0,estimated:l&&i?(i-a)/l: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]]},He=e=>(...t)=>oe.asap(()=>e(...t)),We=ke.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ke.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ke.origin),ke.navigator&&/(msie|trident)/i.test(ke.navigator.userAgent)):()=>!0,Ke=ke.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];oe.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),oe.isString(r)&&a.push(`path=${r}`),oe.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),oe.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)return decodeURIComponent(r.slice(o+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ge=e=>e instanceof fe?{...e}:e;function Xe(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return oe.isPlainObject(e)&&oe.isPlainObject(t)?oe.merge.call({caseless:r},e,t):oe.isPlainObject(t)?oe.merge({},t):oe.isArray(t)?t.slice():t}function o(e,t,n,o){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!oe.isUndefined(t))return r(void 0,t)}function i(e,t){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return oe.hasOwnProp(t,s)?r(n,o):oe.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 c={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(Ge(e),Ge(t),0,!0)};return oe.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=oe.hasOwnProp(c,r)?c[r]:o,i=s(oe.hasOwnProp(e,r)?e[r]:void 0,oe.hasOwnProp(t,r)?t[r]:void 0,r);oe.isUndefined(i)&&s!==a||(n[r]=i)}),n}const Qe=["content-type","content-length"],Ye=e=>{const t=Xe({},e),n=e=>oe.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 c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");var f;if(t.headers=a=fe.from(a),t.url=ve(Ve(l,d,u),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(f=c.password,encodeURIComponent(f).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),oe.isFormData(r)&&(ke.hasStandardBrowserEnv||ke.hasStandardBrowserWebWorkerEnv?a.setContentType(void 0):oe.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{Qe.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,r.getHeaders(),n("formDataHeaderPolicy"))),ke.hasStandardBrowserEnv&&(oe.isFunction(o)&&(o=o(t)),!0===o||null==o&&We(t.url))){const e=s&&i&&Ke.read(i);e&&a.set(s,e)}return t},Ze="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ye(e);let o=r.data;const s=fe.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=fe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());$e(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new pe("Request aborted",pe.ECONNABORTED,e,g)),p(),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new pe(r,pe.ERR_NETWORK,e,g);o.event=t||null,n(o),p(),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ae;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new pe(t,o.clarifyTimeoutError?pe.ETIMEDOUT:pe.ECONNABORTED,e,g)),p(),g=null},void 0===o&&s.setContentType(null),"setRequestHeader"in g&&oe.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),oe.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),d&&"json"!==d&&(g.responseType=r.responseType),h&&([c,u]=ze(h,!0),g.addEventListener("progress",c)),f&&g.upload&&([a,l]=ze(f),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{g&&(n(!t||t.type?new Me(null,e,g):t),g.abort(),p(),g=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||ke.protocols.includes(y)?g.send(o||null):n(new pe("Unsupported protocol "+y+":",pe.ERR_BAD_REQUEST,e))})},et=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof pe?t:new Me(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new pe(`timeout of ${t}ms exceeded`,pe.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));const{signal:a}=r;return a.unsubscribe=()=>oe.asap(i),a}},tt=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},nt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of 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()}}(e))yield*tt(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})},rt="1.16.0",{isFunction:ot}=oe,st=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},it=e=>{const t=oe.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=oe.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:s,Response:i}=e,a=o?ot(o):"function"==typeof fetch,c=ot(s),l=ot(i);if(!a)return!1;const u=a&&ot(n),d=a&&("function"==typeof r?(f=new r,e=>f.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var f;const h=c&&u&&st(()=>{let e=!1;const t=new s(ke.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),p=l&&u&&st(()=>oe.isReadableStream(new i("").body)),g={stream:p&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!g[e]&&(g[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new pe(`Response type '${e}' is not supported`,pe.ERR_NOT_SUPPORT,n)})});const m=async(e,t)=>{const n=oe.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e)){const t=new s(ke.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return oe.isArrayBufferView(e)||oe.isArrayBuffer(e)?e.byteLength:(oe.isURLSearchParams(e)&&(e+=""),oe.isString(e)?(await d(e)).byteLength:void 0)})(t):n};return async e=>{let{url:t,method:n,data:a,signal:l,cancelToken:u,timeout:d,onDownloadProgress:f,onUploadProgress:y,responseType:b,headers:w,withCredentials:E="same-origin",fetchOptions:O,maxContentLength:R,maxBodyLength:S}=Ye(e);const _=oe.isNumber(R)&&R>-1,v=oe.isNumber(S)&&S>-1;let T=o||fetch;b=b?(b+"").toLowerCase():"text";let A=et([l,u&&u.toAbortSignal()],d),C=null;const P=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let x;try{if(_&&"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);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(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}if("undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength)return Buffer.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);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>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}if(v&&"get"!==n&&"head"!==n){const t=await m(w,a);if("number"==typeof t&&isFinite(t)&&t>S)throw new pe("Request body larger than maxBodyLength limit",pe.ERR_BAD_REQUEST,e,C)}if(y&&h&&"get"!==n&&"head"!==n&&0!==(x=await m(w,a))){let e,n=new s(t,{method:"POST",body:a,duplex:"half"});if(oe.isFormData(a)&&(e=n.headers.get("content-type"))&&w.setContentType(e),n.body){const[e,t]=Je(x,ze(He(y)));a=nt(n.body,65536,e,t)}}oe.isString(E)||(E=E?"include":"omit");const o=c&&"credentials"in s.prototype;if(oe.isFormData(a)){const e=w.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&w.delete("content-type")}w.set("User-Agent","axios/"+rt,!1);const l={...O,signal:A,method:n.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:o?E:void 0};C=c&&new s(t,l);let u=await(c?T(C,O):T(t,l));if(_){const t=oe.toFiniteNumber(u.headers.get("content-length"));if(null!=t&&t>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}const d=p&&("stream"===b||"response"===b);if(p&&u.body&&(f||_||d&&P)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=u[e]});const n=oe.toFiniteNumber(u.headers.get("content-length")),[r,o]=f&&Je(n,ze(He(f),!0))||[];let s=0;const a=t=>{if(_&&(s=t,s>R))throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C);r&&r(t)};u=new i(nt(u.body,65536,a,()=>{o&&o(),P&&P()}),t)}b=b||"text";let N=await g[oe.findKey(g,b)||"text"](u,e);if(_&&!p&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>R)throw new pe("maxContentLength size of "+R+" exceeded",pe.ERR_BAD_RESPONSE,e,C)}return!d&&P&&P(),await new Promise((t,n)=>{$e(t,n,{data:N,headers:fe.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:C})})}catch(t){if(P&&P(),A&&A.aborted&&A.reason instanceof pe){const n=A.reason;throw n.config=e,C&&(n.request=C),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new pe("Network Error",pe.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t});throw pe.from(t,t&&t.code,e,C,t&&t.response)}}},at=new Map,ct=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,c=s.length,l=at;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:it(t)),l=a;return a},lt=(ct(),{http:null,xhr:Ze,fetch:{get:ct}});oe.forEach(lt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const ut=e=>`- ${e}`,dt=e=>oe.isFunction(e)||null===e||!1===e,ft=function(e,t){e=oe.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,!dt(r)&&(o=lt[(n=String(r)).toLowerCase()],void 0===o))throw new pe(`Unknown adapter '${n}'`);if(o&&(oe.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(ut).join("\n"):" "+ut(e[0]):"as no adapter specified";throw new pe("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o};function ht(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Me(null,e)}function pt(e){return ht(e),e.headers=fe.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),ft(e.adapter||Fe.adapter,e)(e).then(function(t){ht(e),e.response=t;try{t.data=Ie.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=fe.from(t.headers),t},function(t){if(!qe(t)&&(ht(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=fe.from(t.response.headers)}return Promise.reject(t)})}const gt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const mt={};gt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+rt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new pe(r(o," has been removed"+(t?" in "+t:"")),pe.ERR_DEPRECATED);return t&&!mt[o]&&(mt[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)}},gt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const yt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new pe("options must be an object",pe.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 pe("option "+s+" must be "+n,pe.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new pe("Unknown option "+s,pe.ERR_BAD_OPTION)}},validators:gt},bt=yt.validators;class wt{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=Xe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&yt.assertOptions(n,{silentJSONParsing:bt.transitional(bt.boolean),forcedJSONParsing:bt.transitional(bt.boolean),clarifyTimeoutError:bt.transitional(bt.boolean),legacyInterceptorReqResOrdering:bt.transitional(bt.boolean)},!1),null!=r&&(oe.isFunction(r)?t.paramsSerializer={serialize:r}:yt.assertOptions(r,{encode:bt.function,serialize:bt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yt.assertOptions(t,{baseUrl:bt.spelling("baseURL"),withXsrfToken:bt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&oe.merge(o.common,o[t.method]);o&&oe.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=fe.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||Ae;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[pt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=pt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ve(Ve((e=Xe(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}oe.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,n){return this.request(Xe(n||{},{method:e,url:t,data:(n||{}).data}))}}),oe.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(Xe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}wt.prototype[e]=t(),"query"!==e&&(wt.prototype[e+"Form"]=t(!0))});const Et=wt;class Ot{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 Me(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 Ot(function(t){e=t}),cancel:e}}}const Rt=Ot,St={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(St).forEach(([e,t])=>{St[t]=e});const _t=St,vt=function e(t){const n=new Et(t),r=f(Et.prototype.request,n);return oe.extend(r,Et.prototype,n,{allOwnKeys:!0}),oe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xe(t,n))},r}(Fe);vt.Axios=Et,vt.CanceledError=Me,vt.CancelToken=Rt,vt.isCancel=qe,vt.VERSION=rt,vt.toFormData=we,vt.AxiosError=pe,vt.Cancel=vt.CanceledError,vt.all=function(e){return Promise.all(e)},vt.spread=function(e){return function(t){return e.apply(null,t)}},vt.isAxiosError=function(e){return oe.isObject(e)&&!0===e.isAxiosError},vt.mergeConfig=Xe,vt.AxiosHeaders=fe,vt.formToJSON=e=>je(oe.isHTMLForm(e)?new FormData(e):e),vt.getAdapter=ft,vt.HttpStatusCode=_t,vt.default=vt;const Tt=vt;class At{constructor(e,t={}){this.VERSION=r,this.clientId=e,t.storageKey||(t.storageKey="gc_client_auth_data"),"boolean"!=typeof t.persist&&(t.persist=!1),this.config=Object.assign({},t),this.customHeaders=t.customHeaders,this.setEnvironment(t.environment),this.timeout=16e3,this.authData={},this.authentications={"PureCloud OAuth":{type:"oauth2"}};try{localStorage.setItem("genesys_cloud_local_storage_test","genesys_cloud_local_storage_test"),localStorage.removeItem("genesys_cloud_local_storage_test"),this.hasLocalStorage=!0}catch(e){this.hasLocalStorage=!1}this._loadSettings()}loginImplicitGrant(e={},t){const n=t||a();return new Promise((t,r)=>{e.org&&!e.provider?r(new Error("opts.provider must be set if opts.org is set")):e.provider&&!e.org?r(new Error("opts.org must be set if opts.provider is set")):e.redirectUri||e.usePopupAuth||r(new Error("redirectUri must be provided for implicit grant and not utilizing client-auth app for popup auth")),n&&n.error&&(n.accessToken=void 0,this._saveSettings(n),r(new Error(`[${n.error}] ${n.error_description}`))),n.accessToken&&this._saveSettings(n),this._testTokenAccess().then(()=>(!this.authData.state&&e.state&&(this.authData.state=e.state),t(this.authData))).catch(n=>{this._debug("Error encountered during login. This is normal if the application has not yet been authorized.",n);const o={client_id:encodeURIComponent(this.clientId),response_type:"token"};if(e.redirectUri&&(o.redirect_uri=encodeURIComponent(e.redirectUri)),e.state&&(o.state=encodeURIComponent(e.state)),e.org&&(o.org=encodeURIComponent(e.org)),e.provider&&(o.provider=encodeURIComponent(e.provider)),e.usePopupAuth){if(!this.hasLocalStorage)return r(new Error("localStorage is unavailable. Cannot authenticate via popup window."));this._debug("using popup auth – adding listener"),this._authenticateViaPopup(o,e.popupTimeout||15e3).then(e=>{this._saveSettings(e),t(e)}).catch(r)}else{const e=this._buildAuthUrl("oauth/authorize",o);this._debug("Implicit grant: redirecting to: "+e),window.location.replace(e),r(new Error(`Routing to login: "${e}"`))}})})}setEnvironment(e){e||(e="mypurecloud.com"),(e=e.replace(/\/+$/,"")).startsWith("https://")&&(e=e.substring(8)),e.startsWith("http://")&&(e=e.substring(7)),e.startsWith("api.")&&(e=e.substring(4)),this.environment=e,this.basePath=`https://api.${e}`,this.authUrl=`https://login.${e}`}clearAuthData(){this._saveSettings({accessToken:void 0,state:void 0,tokenExpiryTime:void 0,tokenExpiryTimeString:void 0})}logout(e){this.clearAuthData();const t={client_id:encodeURIComponent(this.clientId)};e&&(t.redirect_uri=encodeURIComponent(e));const n=this._buildAuthUrl("logout",t);window.location.replace(n)}setAccessToken(e){this._saveSettings({accessToken:e})}testAccessToken(e){return this.callApi("/api/v2/tokens/me","get",e)}parseDate(e){return new Date(e.replace(/T/i," "))}paramToString(e){return e?e instanceof Date?e.toJSON():e.toString():""}buildUrl(e,t={}){return e.match(/^\//)||(e=`/${e}`),(this.basePath+e).replace(/\{([\w-]+)\}/g,(e,n)=>{let r;return r=Object.getOwnPropertyDescriptor(t,n)?this.paramToString(t[n]):e,encodeURIComponent(r)})}callApi(e,t,n){var r;const o=this.buildUrl(e),s={Authorization:`Bearer ${n||(null===(r=this.authData)||void 0===r?void 0:r.accessToken)}`,"Content-Type":"application/json"};this.customHeaders&&Object.entries(this.customHeaders).forEach(([e,t])=>{s[e]=t});const i={method:t,url:o,headers:s,timeout:this.timeout};return Tt.request(i)}_debug(e,t){this.config.debugMode&&c(e,t)}_saveSettings(e){try{if(this.authData.accessToken=e.accessToken,this.authentications["PureCloud OAuth"].accessToken=e.accessToken,e.state&&(this.authData.state=e.state),this.authData.error=e.error,this.authData.error_description=e.error_description,e.tokenExpiryTime&&(this.authData.tokenExpiryTime=e.tokenExpiryTime,this.authData.tokenExpiryTimeString=e.tokenExpiryTimeString),!this.config.persist)return void this._debug("persist is not true. Settings will not be saved.");if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be saved.");const t=JSON.parse(JSON.stringify(this.authData));delete t.state,localStorage.setItem(this.config.storageKey,JSON.stringify(t)),this._debug("Auth data saved to local storage",t)}catch(e){console.error(e)}}_getId(e){return`gc-ca_${e=e||globalThis.crypto.randomUUID()}`}_authenticateViaPopup(e,t){const n=this._getId(),r=Object.assign(Object.assign({},e),{storageKey:this.config.storageKey});this.config.debugMode&&(r.debug=!0),localStorage.setItem(n,JSON.stringify(r)),e.state=n,e.redirect_uri||(e.redirect_uri=encodeURIComponent(`https://apps.${this.environment}/client-auth`));const o=this._buildAuthUrl("oauth/authorize",e);return new Promise((r,i)=>{this._debug("Implicit grant: opening new window: "+o),window.open(o,"_blank","width=500px,height=500px,noreferrer,noopener,resizable,scrollbars,status");const a=setTimeout(()=>{this._debug("timeout for loginImplicitGrant using popup",e);const t=new s("Popup authentation timeout. It is possible that the popup was blocked or the login page encountered an error");i(t)},t),c=e=>{if(this._debug("value was just written to storage by another app",{key:e.key,newValue:e.newValue,oldValue:e.oldValue}),e.key===this.config.storageKey){this._debug("keys matched. resolving value",{key:e.key,value:e.newValue}),window.removeEventListener("storage",c),clearTimeout(a);const t=JSON.parse(e.newValue);localStorage.removeItem(n),r(t)}};window.addEventListener("storage",c)})}_testTokenAccess(){return e=this,t=void 0,r=function*(){if(this._loadSettings(),!this.authentications["PureCloud OAuth"].accessToken)throw new i("errorTokenNotSet","No access token provided.");try{yield this.callApi("/api/v2/tokens/me","get")}catch(e){throw this._saveSettings({accessToken:void 0}),e}},new((n=void 0)||(n=Promise))(function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,a)}c((r=r.apply(e,t||[])).next())});var e,t,n,r}_loadSettings(){if(!this.config.persist)return;if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be loaded.");const e=this.authData.state,t=localStorage.getItem(this.config.storageKey);this.authData=t?JSON.parse(t):{},this.authData.accessToken&&this.setAccessToken(this.authData.accessToken),this.authData.state=e}_buildAuthUrl(e,t={}){return Object.keys(t).reduce((e,n)=>t[n]?`${e}&${n}=${t[n]}`:e,`${this.authUrl}/${e}?`)}}const Ct=()=>{const e=a();if(e.error)throw new Error(`[${e.error}]: ${e.error_description}`);if(!e.accessToken)throw new i("errorToken","No access token provided.");const t=e.state;if(!t)throw new i("errorStateParam","No state param on redirect. Unable to determine location to save auth data.");const n=JSON.parse(localStorage.getItem(t)||"false");if(!n||!n.storageKey)throw new i("errorParse","Unable to parse information from localStorage.");n.state?e.state=n.state:delete e.state,c(`setting auth data to key: ${n.storageKey}`,e),localStorage.setItem(n.storageKey,JSON.stringify(e)),n.debug?c("In debug mode. Not closing window or removing storageId",{storageId:t,authData:e,href:window.location.href}):(c(`removing temp storage key: ${t}`),localStorage.removeItem(t),c("closing window"),window.close())},Pt=new Map,xt=(e,t)=>{let n=Pt.get(e);return n||(n=new At(e,t),Pt.set(e,n)),n},Nt=xt;window.GenesysCloudClientAuth=t})();
|
|
2
|
+
//# sourceMappingURL=genesys-cloud-client-auth.browser.min.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesys-cloud-client-auth",
|
|
3
3
|
"description": "Small, lightweight library and app to handle authentication for client applications. Big advantage is utilization of popup windows to authenticate apps within iframes.",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1-patch-1.1",
|
|
5
5
|
"main": "dist/lib/cjs/index.js",
|
|
6
6
|
"module": "dist/lib/es/index.js",
|
|
7
7
|
"browser": "dist/lib/es/index.js",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"axios": "^1.
|
|
39
|
+
"axios": "^1.16.0"
|
|
40
|
+
},
|
|
41
|
+
"_snykComments": {
|
|
42
|
+
"dependencies.axios": "^1.16.0 fixes SNYK-JS-AXIOS-17111062, SNYK-JS-AXIOS-17111079, SNYK-JS-AXIOS-17172681"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@babel/core": "^7.26.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{GenesysCloudClientAuthenticator:()=>Pt,TimeoutError:()=>s,VERSION:()=>r,authenticatorFactory:()=>Nt,default:()=>kt,handleRedirectFromLogin:()=>xt,isIssuedTimeWithinTimeframe:()=>l,isIssuedTimeWithinWindow:()=>u,parseOauthParams:()=>a,tokenWasIssuedAt:()=>d});var n={};e.r(n),e.d(n,{hasBrowserEnv:()=>Oe,hasStandardBrowserEnv:()=>Se,hasStandardBrowserWebWorkerEnv:()=>ve,navigator:()=>Re,origin:()=>Te}),Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const r="2.0.0",o="color: #f29f2c";class s extends Error{constructor(){super(...arguments),this.name="TIMEOUT_ERROR"}}class i extends Error{constructor(e,t){const n=t&&t instanceof Error;super(n?t.message:t),n&&(this.name=t.name),this.translationKey=e}}const a=(e=window.location.hash)=>{const t={},n={},r=new RegExp("^#*(.+?)=(.+?)$","i");if(e.split("&").forEach(e=>{const n=r.exec(e);n&&(t[n[1]]=decodeURIComponent(decodeURIComponent(n[2].replace(/\+/g,"%20"))))}),t.error)return t;if(t.access_token){if(t.state&&(n.state=t.state),t.expires_in){const e=1e3*parseInt(t.expires_in.replace(/\+/g,"%20"));n.tokenExpiryTime=Date.now()+e,n.tokenExpiryTimeString=new Date(n.tokenExpiryTime).toISOString()}n.accessToken=t.access_token.replace(/\+/g,"%20")}return n},c=(e,t)=>{t?(console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o,t),"object"==typeof t&&console.log(`%c [DEBUG:gc-client-auth:${r}] ^ stringified: ${JSON.stringify(t)}`,o)):console.log(`%c [DEBUG:gc-client-auth:${r}] ${e}`,o)},l=(e,t=691199e3,n=168e4,r=Date.now())=>r-d(e,t)<n,u=(e,t,n)=>l(e,t,n),d=(e,t)=>e-t;function f(e,t){return function(){return e.apply(t,arguments)}}const{toString:h}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:g,toStringTag:m}=Symbol,b=(y=Object.create(null),e=>{const t=h.call(e);return y[t]||(y[t]=t.slice(8,-1).toLowerCase())});var y;const w=e=>(e=e.toLowerCase(),t=>b(t)===e),E=e=>t=>typeof t===e,{isArray:O}=Array,R=E("undefined");function S(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const v=w("ArrayBuffer"),T=E("string"),_=E("function"),A=E("number"),C=e=>null!==e&&"object"==typeof e,P=e=>{if("object"!==b(e))return!1;const t=p(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||m in e||g in e)},x=w("Date"),U=w("File"),N=w("Blob"),k=w("FileList"),D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},j=void 0!==D.FormData?D.FormData:void 0,L=w("URLSearchParams"),[I,F,B,M]=["ReadableStream","Request","Response","Headers"].map(w);function q(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),O(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(S(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 $(e,t){if(S(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 z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,H=e=>!R(e)&&e!==z,J=(W="undefined"!=typeof Uint8Array&&p(Uint8Array),e=>W&&e instanceof W);var W;const K=w("HTMLFormElement"),V=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),G=w("RegExp"),X=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};q(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)},Q=w("AsyncFunction"),Y=(Z="function"==typeof setImmediate,ee=_(z.postMessage),Z?setImmediate:ee?(te=`axios@${Math.random()}`,ne=[],z.addEventListener("message",({source:e,data:t})=>{e===z&&t===te&&ne.length&&ne.shift()()},!1),e=>{ne.push(e),z.postMessage(te,"*")}):e=>setTimeout(e));var Z,ee,te,ne;const re="undefined"!=typeof queueMicrotask?queueMicrotask.bind(z):"undefined"!=typeof process&&process.nextTick||Y,oe={isArray:O,isArrayBuffer:v,isBuffer:S,isFormData:e=>{if(!e)return!1;if(j&&e instanceof j)return!0;const t=p(e);if(!t||t===Object.prototype)return!1;if(!_(e.append))return!1;const n=b(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&&v(e.buffer),t},isString:T,isNumber:A,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:P,isEmptyObject:e=>{if(!C(e)||S(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:I,isRequest:F,isResponse:B,isHeaders:M,isUndefined:R,isDate:x,isFile:U,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:N,isRegExp:G,isFunction:_,isStream:e=>C(e)&&_(e.pipe),isURLSearchParams:L,isTypedArray:J,isFileList:k,forEach:q,merge:function e(){const{caseless:t,skipUndefined:n}=H(this)&&this||{},r={},o=(o,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=t&&$(r,s)||s;P(r[i])&&P(o)?r[i]=e(r[i],o):P(o)?r[i]=e({},o):O(o)?r[i]=o.slice():n&&R(o)||(r[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&q(arguments[e],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(q(t,(t,r)=>{n&&_(t)?Object.defineProperty(e,r,{value:f(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&p(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:b,kindOfTest:w,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(O(e))return e;let t=e.length;if(!A(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[g]).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:K,hasOwnProperty:V,hasOwnProp:V,reduceDescriptors:X,freezeMethods:e=>{X(e,(t,n)=>{if(_(e)&&-1!==["arguments","caller","callee"].indexOf(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 O(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:$,global:z,isContextDefined:H,isSpecCompliantForm:function(e){return!!(e&&_(e.append)&&"FormData"===e[m]&&e[g])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(S(e))return e;if(!("toJSON"in e)){t[r]=e;const o=O(e)?[]:{};return q(e,(e,t)=>{const s=n(e,r+1);!R(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Q,isThenable:e=>e&&(C(e)||_(e))&&_(e.then)&&_(e.catch),setImmediate:Y,asap:re,isIterable:e=>null!=e&&_(e[g])};class se extends Error{static from(e,t,n,r,o,s){const i=new se(e.message,t||e.code,n,r,o);return i.cause=e,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",{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(){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:oe.toJSONObject(this.config),code:this.code,status:this.status}}}se.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",se.ERR_BAD_OPTION="ERR_BAD_OPTION",se.ECONNABORTED="ECONNABORTED",se.ETIMEDOUT="ETIMEDOUT",se.ERR_NETWORK="ERR_NETWORK",se.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",se.ERR_DEPRECATED="ERR_DEPRECATED",se.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",se.ERR_BAD_REQUEST="ERR_BAD_REQUEST",se.ERR_CANCELED="ERR_CANCELED",se.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",se.ERR_INVALID_URL="ERR_INVALID_URL",se.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ie=se;function ae(e){return oe.isPlainObject(e)||oe.isArray(e)}function ce(e){return oe.endsWith(e,"[]")?e.slice(0,-2):e}function le(e,t,n){return e?e.concat(t).map(function(e,t){return e=ce(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ue=oe.toFlatObject(oe,{},null,function(e){return/^is[A-Z]/.test(e)}),de=function(e,t,n){if(!oe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!oe.isUndefined(t[e])})).metaTokens,o=n.visitor||d,s=n.dots,i=n.indexes,a=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,l=a&&oe.isSpecCompliantForm(t);if(!oe.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(oe.isDate(e))return e.toISOString();if(oe.isBoolean(e))return e.toString();if(!l&&oe.isBlob(e))throw new ie("Blob is not supported. Use a Buffer instead.");return oe.isArrayBuffer(e)||oe.isTypedArray(e)?l&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,o){let a=e;if(oe.isReactNative(t)&&oe.isReactNativeBlob(e))return t.append(le(o,n,s),u(e)),!1;if(e&&!o&&"object"==typeof e)if(oe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(oe.isArray(e)&&function(e){return oe.isArray(e)&&!e.some(ae)}(e)||(oe.isFileList(e)||oe.endsWith(n,"[]"))&&(a=oe.toArray(e)))return n=ce(n),a.forEach(function(e,r){!oe.isUndefined(e)&&null!==e&&t.append(!0===i?le([n],r,s):null===i?n:n+"[]",u(e))}),!1;return!!ae(e)||(t.append(le(o,n,s),u(e)),!1)}const f=[],h=Object.assign(ue,{defaultVisitor:d,convertValue:u,isVisitable:ae});if(!oe.isObject(e))throw new TypeError("data must be an object");return function e(n,r,s=0){if(!oe.isUndefined(n)){if(s>c)throw new ie("Object is too deeply nested ("+s+" levels). Max depth: "+c,ie.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),oe.forEach(n,function(n,i){!0===(!(oe.isUndefined(n)||null===n)&&o.call(t,n,oe.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i],s+1)}),f.pop()}}(e),t};function fe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function he(e,t){this._pairs=[],e&&de(e,this,t)}const pe=he.prototype;pe.append=function(e,t){this._pairs.push([e,t])},pe.toString=function(e){const t=e?function(t){return e.call(this,t,fe)}:fe;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const ge=he;function me(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function be(e,t,n){if(!t)return e;const r=n&&n.encode||me,o=oe.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let i;if(i=s?s(t,o):oe.isURLSearchParams(t)?t.toString():new ge(t,o).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const ye=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){oe.forEach(this.handlers,function(t){null!==t&&e(t)})}},we={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ee={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ge,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Oe="undefined"!=typeof window&&"undefined"!=typeof document,Re="object"==typeof navigator&&navigator||void 0,Se=Oe&&(!Re||["ReactNative","NativeScript","NS"].indexOf(Re.product)<0),ve="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Te=Oe&&window.location.href||"http://localhost",_e={...n,...Ee},Ae=function(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;return s=!s&&oe.isArray(r)?r.length:s,a?(oe.hasOwnProp(r,s)?r[s]=oe.isArray(r[s])?r[s].concat(n):[r[s],n]:r[s]=n,!i):(r[s]&&oe.isObject(r[s])||(r[s]=[]),t(e,n,r[s],o)&&oe.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(oe.isFormData(e)&&oe.isFunction(e.entries)){const n={};return oe.forEachEntry(e,(e,r)=>{t(function(e){return oe.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Ce=(e,t)=>null!=e&&oe.hasOwnProp(e,t)?e[t]:void 0,Pe={transitional:we,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=oe.isObject(e);if(o&&oe.isHTMLForm(e)&&(e=new FormData(e)),oe.isFormData(e))return r?JSON.stringify(Ae(e)):e;if(oe.isArrayBuffer(e)||oe.isBuffer(e)||oe.isStream(e)||oe.isFile(e)||oe.isBlob(e)||oe.isReadableStream(e))return e;if(oe.isArrayBufferView(e))return e.buffer;if(oe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){const t=Ce(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return de(e,new _e.classes.URLSearchParams,{visitor:function(e,t,n,r){return _e.isNode&&oe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((s=oe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ce(this,"env"),r=n&&n.FormData;return de(s?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e){if(oe.isString(e))try{return(0,JSON.parse)(e),oe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ce(this,"transitional")||Pe.transitional,n=t&&t.forcedJSONParsing,r=Ce(this,"responseType"),o="json"===r;if(oe.isResponse(e)||oe.isReadableStream(e))return e;if(e&&oe.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ce(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ie.from(e,ie.ERR_BAD_RESPONSE,this,null,Ce(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};oe.forEach(["delete","get","head","post","put","patch"],e=>{Pe.headers[e]={}});const xe=Pe,Ue=oe.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"]),Ne=Symbol("internals"),ke=/[^\x09\x20-\x7E\x80-\xFF]/g;function De(e){return e&&String(e).trim().toLowerCase()}function je(e){return!1===e||null==e?e:oe.isArray(e)?e.map(je):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(ke,""))}function Le(e,t,n,r,o){return oe.isFunction(r)?r.call(this,t,n):(o&&(t=n),oe.isString(t)?oe.isString(r)?-1!==t.indexOf(r):oe.isRegExp(r)?r.test(t):void 0:void 0)}class Ie{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=De(t);if(!o)throw new Error("header name must be a non-empty string");const s=oe.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=je(e))}const s=(e,t)=>oe.forEach(e,(e,n)=>o(e,n,t));if(oe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(oe.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]&&Ue[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(oe.isObject(e)&&oe.isIterable(e)){let n,r,o={};for(const t of e){if(!oe.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?oe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=De(e)){const n=oe.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(oe.isFunction(t))return t.call(this,e,n);if(oe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=De(e)){const n=oe.findKey(this,e);return!(!n||void 0===this[n]||t&&!Le(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=De(e)){const o=oe.findKey(n,e);!o||t&&!Le(0,n[o],o,t)||(delete n[o],r=!0)}}return oe.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&&!Le(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return oe.forEach(this,(r,o)=>{const s=oe.findKey(n,o);if(s)return t[s]=je(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]=je(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return oe.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&oe.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[Ne]=this[Ne]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=De(e);t[r]||(function(e,t){const n=oe.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return oe.isArray(e)?e.forEach(r):r(e),this}}Ie.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(Ie.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),oe.freezeMethods(Ie);const Fe=Ie;function Be(e,t){const n=this||xe,r=t||n,o=Fe.from(r.headers);let s=r.data;return oe.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Me(e){return!(!e||!e.__CANCEL__)}const qe=class extends ie{constructor(e,t,n){super(null==e?"canceled":e,ie.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $e(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ie("Request failed with status code "+n.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const ze=(e,t,n=3)=>{let r=0;const o=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 c=Date.now(),l=r[i];o||(o=c),n[s]=a,r[s]=c;let u=i,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=l&&c-l;return f?Math.round(1e3*d/f):void 0}}(50,250);return 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)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=null!=i?Math.min(s,i):s,c=Math.max(0,a-r),l=o(c);r=Math.max(r,a),e({loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:l||void 0,estimated:l&&i?(i-a)/l:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},He=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Je=e=>(...t)=>oe.asap(()=>e(...t)),We=_e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,_e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(_e.origin),_e.navigator&&/(msie|trident)/i.test(_e.navigator.userAgent)):()=>!0,Ke=_e.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];oe.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),oe.isString(r)&&a.push(`path=${r}`),oe.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),oe.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ve(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ge=e=>e instanceof Fe?{...e}:e;function Xe(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return oe.isPlainObject(e)&&oe.isPlainObject(t)?oe.merge.call({caseless:r},e,t):oe.isPlainObject(t)?oe.merge({},t):oe.isArray(t)?t.slice():t}function o(e,t,n,o){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!oe.isUndefined(t))return r(void 0,t)}function i(e,t){return oe.isUndefined(t)?oe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return oe.hasOwnProp(t,s)?r(n,o):oe.hasOwnProp(e,s)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={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(Ge(e),Ge(t),0,!0)};return oe.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=oe.hasOwnProp(c,r)?c[r]:o,i=s(oe.hasOwnProp(e,r)?e[r]:void 0,oe.hasOwnProp(t,r)?t[r]:void 0,r);oe.isUndefined(i)&&s!==a||(n[r]=i)}),n}const Qe=e=>{const t=Xe({},e),n=e=>oe.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 c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");if(t.headers=a=Fe.from(a),t.url=be(Ve(l,d,u),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),oe.isFormData(r))if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(oe.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(_e.hasStandardBrowserEnv&&(oe.isFunction(o)&&(o=o(t)),!0===o||null==o&&We(t.url))){const e=s&&i&&Ke.read(i);e&&a.set(s,e)}return t},Ye="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Qe(e);let o=r.data;const s=Fe.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=Fe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());$e(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new ie("Request aborted",ie.ECONNABORTED,e,g)),g=null)},g.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ie(r,ie.ERR_NETWORK,e,g);o.event=t||null,n(o),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||we;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ie(t,o.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,g)),g=null},void 0===o&&s.setContentType(null),"setRequestHeader"in g&&oe.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),oe.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),d&&"json"!==d&&(g.responseType=r.responseType),h&&([c,u]=ze(h,!0),g.addEventListener("progress",c)),f&&g.upload&&([a,l]=ze(f),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{g&&(n(!t||t.type?new qe(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);b&&-1===_e.protocols.indexOf(b)?n(new ie("Unsupported protocol "+b+":",ie.ERR_BAD_REQUEST,e)):g.send(o||null)})},Ze=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ie?t:new qe(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new ie(`timeout of ${t}ms exceeded`,ie.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));const{signal:a}=r;return a.unsubscribe=()=>oe.asap(i),a}},et=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},tt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of 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()}}(e))yield*et(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})},{isFunction:nt}=oe,rt=(({Request:e,Response:t})=>({Request:e,Response:t}))(oe.global),{ReadableStream:ot,TextEncoder:st}=oe.global,it=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},at=e=>{e=oe.merge.call({skipUndefined:!0},rt,e);const{fetch:t,Request:n,Response:r}=e,o=t?nt(t):"function"==typeof fetch,s=nt(n),i=nt(r);if(!o)return!1;const a=o&&nt(ot),c=o&&("function"==typeof st?(l=new st,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=s&&a&&it(()=>{let e=!1;const t=new n(_e.origin,{body:new ot,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),d=i&&a&&it(()=>oe.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ie(`Response type '${e}' is not supported`,ie.ERR_NOT_SUPPORT,n)})});return async e=>{let{url:o,method:i,data:a,signal:l,cancelToken:h,timeout:p,onDownloadProgress:g,onUploadProgress:m,responseType:b,headers:y,withCredentials:w="same-origin",fetchOptions:E}=Qe(e),O=t||fetch;b=b?(b+"").toLowerCase():"text";let R=Ze([l,h&&h.toAbortSignal()],p),S=null;const v=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let T;try{if(m&&u&&"get"!==i&&"head"!==i&&0!==(T=await(async(e,t)=>{const r=oe.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e)){const t=new n(_e.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return oe.isArrayBufferView(e)||oe.isArrayBuffer(e)?e.byteLength:(oe.isURLSearchParams(e)&&(e+=""),oe.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(y,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(oe.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,n]=He(T,ze(Je(m)));a=tt(t.body,65536,e,n)}}oe.isString(w)||(w=w?"include":"omit");const t=s&&"credentials"in n.prototype;if(oe.isFormData(a)){const e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete("content-type")}const l={...E,signal:R,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};S=s&&new n(o,l);let h=await(s?O(S,E):O(o,l));const p=d&&("stream"===b||"response"===b);if(d&&(g||p&&v)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=h[t]});const t=oe.toFiniteNumber(h.headers.get("content-length")),[n,o]=g&&He(t,ze(Je(g),!0))||[];h=new r(tt(h.body,65536,n,()=>{o&&o(),v&&v()}),e)}b=b||"text";let _=await f[oe.findKey(f,b)||"text"](h,e);return!p&&v&&v(),await new Promise((t,n)=>{$e(t,n,{data:_,headers:Fe.from(h.headers),status:h.status,statusText:h.statusText,config:e,request:S})})}catch(t){if(v&&v(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ie("Network Error",ie.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw ie.from(t,t&&t.code,e,S,t&&t.response)}}},ct=new Map,lt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,c=s.length,l=ct;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:at(t)),l=a;return a},ut=(lt(),{http:null,xhr:Ye,fetch:{get:lt}});oe.forEach(ut,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const dt=e=>`- ${e}`,ft=e=>oe.isFunction(e)||null===e||!1===e,ht=function(e,t){e=oe.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,!ft(r)&&(o=ut[(n=String(r)).toLowerCase()],void 0===o))throw new ie(`Unknown adapter '${n}'`);if(o&&(oe.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(dt).join("\n"):" "+dt(e[0]):"as no adapter specified";throw new ie("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o};function pt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qe(null,e)}function gt(e){return pt(e),e.headers=Fe.from(e.headers),e.data=Be.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ht(e.adapter||xe.adapter,e)(e).then(function(t){return pt(e),t.data=Be.call(e,e.transformResponse,t),t.headers=Fe.from(t.headers),t},function(t){return Me(t)||(pt(e),t&&t.response&&(t.response.data=Be.call(e,e.transformResponse,t.response),t.response.headers=Fe.from(t.response.headers))),Promise.reject(t)})}const mt="1.15.2",bt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{bt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const yt={};bt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+mt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new ie(r(o," has been removed"+(t?" in "+t:"")),ie.ERR_DEPRECATED);return t&&!yt[o]&&(yt[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)}},bt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const wt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ie("options must be an object",ie.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 ie("option "+s+" must be "+n,ie.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ie("Unknown option "+s,ie.ERR_BAD_OPTION)}},validators:bt},Et=wt.validators;class Ot{constructor(e){this.defaults=e||{},this.interceptors={request:new ye,response:new ye}}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=Xe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&wt.assertOptions(n,{silentJSONParsing:Et.transitional(Et.boolean),forcedJSONParsing:Et.transitional(Et.boolean),clarifyTimeoutError:Et.transitional(Et.boolean),legacyInterceptorReqResOrdering:Et.transitional(Et.boolean)},!1),null!=r&&(oe.isFunction(r)?t.paramsSerializer={serialize:r}:wt.assertOptions(r,{encode:Et.function,serialize:Et.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),wt.assertOptions(t,{baseUrl:Et.spelling("baseURL"),withXsrfToken:Et.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&oe.merge(o.common,o[t.method]);o&&oe.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Fe.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||we;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[gt.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let f=t;for(;d<u;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=gt.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return be(Ve((e=Xe(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}oe.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(t,n){return this.request(Xe(n||{},{method:e,url:t,data:(n||{}).data}))}}),oe.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Xe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)});const Rt=Ot;class St{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 qe(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 St(function(t){e=t}),cancel:e}}}const vt=St,Tt={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(Tt).forEach(([e,t])=>{Tt[t]=e});const _t=Tt,At=function e(t){const n=new Rt(t),r=f(Rt.prototype.request,n);return oe.extend(r,Rt.prototype,n,{allOwnKeys:!0}),oe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xe(t,n))},r}(xe);At.Axios=Rt,At.CanceledError=qe,At.CancelToken=vt,At.isCancel=Me,At.VERSION=mt,At.toFormData=de,At.AxiosError=ie,At.Cancel=At.CanceledError,At.all=function(e){return Promise.all(e)},At.spread=function(e){return function(t){return e.apply(null,t)}},At.isAxiosError=function(e){return oe.isObject(e)&&!0===e.isAxiosError},At.mergeConfig=Xe,At.AxiosHeaders=Fe,At.formToJSON=e=>Ae(oe.isHTMLForm(e)?new FormData(e):e),At.getAdapter=ht,At.HttpStatusCode=_t,At.default=At;const Ct=At;class Pt{constructor(e,t={}){this.VERSION=r,this.clientId=e,t.storageKey||(t.storageKey="gc_client_auth_data"),"boolean"!=typeof t.persist&&(t.persist=!1),this.config=Object.assign({},t),this.customHeaders=t.customHeaders,this.setEnvironment(t.environment),this.timeout=16e3,this.authData={},this.authentications={"PureCloud OAuth":{type:"oauth2"}};try{localStorage.setItem("genesys_cloud_local_storage_test","genesys_cloud_local_storage_test"),localStorage.removeItem("genesys_cloud_local_storage_test"),this.hasLocalStorage=!0}catch(e){this.hasLocalStorage=!1}this._loadSettings()}loginImplicitGrant(e={},t){const n=t||a();return new Promise((t,r)=>{e.org&&!e.provider?r(new Error("opts.provider must be set if opts.org is set")):e.provider&&!e.org?r(new Error("opts.org must be set if opts.provider is set")):e.redirectUri||e.usePopupAuth||r(new Error("redirectUri must be provided for implicit grant and not utilizing client-auth app for popup auth")),n&&n.error&&(n.accessToken=void 0,this._saveSettings(n),r(new Error(`[${n.error}] ${n.error_description}`))),n.accessToken&&this._saveSettings(n),this._testTokenAccess().then(()=>(!this.authData.state&&e.state&&(this.authData.state=e.state),t(this.authData))).catch(n=>{this._debug("Error encountered during login. This is normal if the application has not yet been authorized.",n);const o={client_id:encodeURIComponent(this.clientId),response_type:"token"};if(e.redirectUri&&(o.redirect_uri=encodeURIComponent(e.redirectUri)),e.state&&(o.state=encodeURIComponent(e.state)),e.org&&(o.org=encodeURIComponent(e.org)),e.provider&&(o.provider=encodeURIComponent(e.provider)),e.usePopupAuth){if(!this.hasLocalStorage)return r(new Error("localStorage is unavailable. Cannot authenticate via popup window."));this._debug("using popup auth – adding listener"),this._authenticateViaPopup(o,e.popupTimeout||15e3).then(e=>{this._saveSettings(e),t(e)}).catch(r)}else{const e=this._buildAuthUrl("oauth/authorize",o);this._debug("Implicit grant: redirecting to: "+e),window.location.replace(e),r(new Error(`Routing to login: "${e}"`))}})})}setEnvironment(e){e||(e="mypurecloud.com"),(e=e.replace(/\/+$/,"")).startsWith("https://")&&(e=e.substring(8)),e.startsWith("http://")&&(e=e.substring(7)),e.startsWith("api.")&&(e=e.substring(4)),this.environment=e,this.basePath=`https://api.${e}`,this.authUrl=`https://login.${e}`}clearAuthData(){this._saveSettings({accessToken:void 0,state:void 0,tokenExpiryTime:void 0,tokenExpiryTimeString:void 0})}logout(e){this.clearAuthData();const t={client_id:encodeURIComponent(this.clientId)};e&&(t.redirect_uri=encodeURIComponent(e));const n=this._buildAuthUrl("logout",t);window.location.replace(n)}setAccessToken(e){this._saveSettings({accessToken:e})}testAccessToken(e){return this.callApi("/api/v2/tokens/me","get",e)}parseDate(e){return new Date(e.replace(/T/i," "))}paramToString(e){return e?e instanceof Date?e.toJSON():e.toString():""}buildUrl(e,t={}){return e.match(/^\//)||(e=`/${e}`),(this.basePath+e).replace(/\{([\w-]+)\}/g,(e,n)=>{let r;return r=Object.getOwnPropertyDescriptor(t,n)?this.paramToString(t[n]):e,encodeURIComponent(r)})}callApi(e,t,n){var r;const o=this.buildUrl(e),s={Authorization:`Bearer ${n||(null===(r=this.authData)||void 0===r?void 0:r.accessToken)}`,"Content-Type":"application/json"};this.customHeaders&&Object.entries(this.customHeaders).forEach(([e,t])=>{s[e]=t});const i={method:t,url:o,headers:s,timeout:this.timeout};return Ct.request(i)}_debug(e,t){this.config.debugMode&&c(e,t)}_saveSettings(e){try{if(this.authData.accessToken=e.accessToken,this.authentications["PureCloud OAuth"].accessToken=e.accessToken,e.state&&(this.authData.state=e.state),this.authData.error=e.error,this.authData.error_description=e.error_description,e.tokenExpiryTime&&(this.authData.tokenExpiryTime=e.tokenExpiryTime,this.authData.tokenExpiryTimeString=e.tokenExpiryTimeString),!this.config.persist)return void this._debug("persist is not true. Settings will not be saved.");if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be saved.");const t=JSON.parse(JSON.stringify(this.authData));delete t.state,localStorage.setItem(this.config.storageKey,JSON.stringify(t)),this._debug("Auth data saved to local storage",t)}catch(e){console.error(e)}}_getId(e){return`gc-ca_${e=e||globalThis.crypto.randomUUID()}`}_authenticateViaPopup(e,t){const n=this._getId(),r=Object.assign(Object.assign({},e),{storageKey:this.config.storageKey});this.config.debugMode&&(r.debug=!0),localStorage.setItem(n,JSON.stringify(r)),e.state=n,e.redirect_uri||(e.redirect_uri=encodeURIComponent(`https://apps.${this.environment}/client-auth`));const o=this._buildAuthUrl("oauth/authorize",e);return new Promise((r,i)=>{this._debug("Implicit grant: opening new window: "+o),window.open(o,"_blank","width=500px,height=500px,noreferrer,noopener,resizable,scrollbars,status");const a=setTimeout(()=>{this._debug("timeout for loginImplicitGrant using popup",e);const t=new s("Popup authentation timeout. It is possible that the popup was blocked or the login page encountered an error");i(t)},t),c=e=>{if(this._debug("value was just written to storage by another app",{key:e.key,newValue:e.newValue,oldValue:e.oldValue}),e.key===this.config.storageKey){this._debug("keys matched. resolving value",{key:e.key,value:e.newValue}),window.removeEventListener("storage",c),clearTimeout(a);const t=JSON.parse(e.newValue);localStorage.removeItem(n),r(t)}};window.addEventListener("storage",c)})}_testTokenAccess(){return e=this,t=void 0,r=function*(){if(this._loadSettings(),!this.authentications["PureCloud OAuth"].accessToken)throw new i("errorTokenNotSet","No access token provided.");try{yield this.callApi("/api/v2/tokens/me","get")}catch(e){throw this._saveSettings({accessToken:void 0}),e}},new((n=void 0)||(n=Promise))(function(o,s){function i(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,a)}c((r=r.apply(e,t||[])).next())});var e,t,n,r}_loadSettings(){if(!this.config.persist)return;if(!this.hasLocalStorage)return void this._debug("Warning: Cannot access local storage. Settings will not be loaded.");const e=this.authData.state,t=localStorage.getItem(this.config.storageKey);this.authData=t?JSON.parse(t):{},this.authData.accessToken&&this.setAccessToken(this.authData.accessToken),this.authData.state=e}_buildAuthUrl(e,t={}){return Object.keys(t).reduce((e,n)=>t[n]?`${e}&${n}=${t[n]}`:e,`${this.authUrl}/${e}?`)}}const xt=()=>{const e=a();if(e.error)throw new Error(`[${e.error}]: ${e.error_description}`);if(!e.accessToken)throw new i("errorToken","No access token provided.");const t=e.state;if(!t)throw new i("errorStateParam","No state param on redirect. Unable to determine location to save auth data.");const n=JSON.parse(localStorage.getItem(t)||"false");if(!n||!n.storageKey)throw new i("errorParse","Unable to parse information from localStorage.");n.state?e.state=n.state:delete e.state,c(`setting auth data to key: ${n.storageKey}`,e),localStorage.setItem(n.storageKey,JSON.stringify(e)),n.debug?c("In debug mode. Not closing window or removing storageId",{storageId:t,authData:e,href:window.location.href}):(c(`removing temp storage key: ${t}`),localStorage.removeItem(t),c("closing window"),window.close())},Ut=new Map,Nt=(e,t)=>{let n=Ut.get(e);return n||(n=new Pt(e,t),Ut.set(e,n)),n},kt=Nt;window.GenesysCloudClientAuth=t})();
|
|
2
|
-
//# sourceMappingURL=genesys-cloud-client-auth.browser.min.js.map
|