@ghentcdh/authentication-vue 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './lib/useAuthApi';
1
2
  export * from './lib/createAuth';
2
3
  export * from './lib/utils';
package/index.js CHANGED
@@ -1 +1,9 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`vue`),l=require(`keycloak-js`);l=s(l);var u=`GHENTCDH_AUTHENTICATION`,d=class e extends l.default{constructor(e){super(e)}async initialize(){try{await this.init({onLoad:`login-required`})?console.log(`User is authenticated`):console.log(`User is not authenticated`)}catch(e){console.error(`Failed to initialize adapter:`,e)}}static async init(t){let n=new e(t);return console.log(`KeycloakAdapter`,t),await n.initialize(),n}get userInfo(){return this.idTokenParsed}updateToken(){return console.log(`update the token`),super.updateToken(30)}get isAuthenticated(){return this.authenticated??!1}},f={skipAuthentication:!1},p=e=>{let t=(0,c.ref)(!1),n,r={...f,...e},i=async()=>{let r=await d.init(e.keycloak);return n=r,t.value=!0,r},a=()=>n?.token,o=async()=>{if(!n)return i();t.value||await new Promise(e=>{let n=(0,c.watch)(t,t=>{t&&(n(),e())})})},s=(0,c.markRaw)({install(e){e.runWithContext(()=>{e.config.globalProperties.$auth=r,e.provide(u,s)})},updateToken:async()=>(await o())?.updateToken(),token:a,user:async()=>(await o())?.userInfo,logout:async()=>(await o())?.logout(),options:r});return s},m=()=>{let e=(0,c.inject)(u);return e||console.warn(`No auth provided, authorized calls may not work`),{isAuthenticated:()=>!!e?.user(),getUser:()=>e?.user(),logout:()=>e?.logout()}};exports.createAuth=p,exports.useAuthenticate=m;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("vue"),u=require("keycloak-js");u=c(u);function d(e,t){return function(){return e.apply(t,arguments)}}var{toString:f}=Object.prototype,{getPrototypeOf:p}=Object,{iterator:m,toStringTag:h}=Symbol,g=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),_=(e,t)=>{let n=e,r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),g(n,t))return!0;n=p(n)}return!1},ee=(e,t)=>e!=null&&_(e,t)?e[t]:void 0,v=(e=>t=>{let n=f.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),y=e=>(e=e.toLowerCase(),t=>v(t)===e),b=e=>t=>typeof t===e,{isArray:x}=Array,S=b(`undefined`);function C(e){return e!==null&&!S(e)&&e.constructor!==null&&!S(e.constructor)&&D(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var w=y(`ArrayBuffer`);function T(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&w(e.buffer),t}var E=b(`string`),D=b(`function`),te=b(`number`),O=e=>typeof e==`object`&&!!e,k=e=>e===!0||e===!1,A=e=>{if(!O(e))return!1;let t=p(e);return(t===null||t===Object.prototype||p(t)===null)&&!_(e,h)&&!_(e,m)},j=e=>{if(!O(e)||C(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},M=y(`Date`),ne=y(`File`),re=e=>!!(e&&e.uri!==void 0),ie=e=>e&&e.getParts!==void 0,N=y(`Blob`),ae=y(`FileList`),oe=e=>O(e)&&D(e.pipe);function P(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var se=P(),ce=se.FormData===void 0?void 0:se.FormData,le=e=>{if(!e)return!1;if(ce&&e instanceof ce)return!0;let t=p(e);if(!t||t===Object.prototype||!D(e.append))return!1;let n=v(e);return n===`formdata`||n===`object`&&D(e.toString)&&e.toString()===`[object FormData]`},ue=y(`URLSearchParams`),[de,fe,pe,me]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(y),he=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function F(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),x(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(C(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function ge(e,t){if(C(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var I=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,_e=e=>!S(e)&&e!==I;function ve(...e){let{caseless:t,skipUndefined:n}=_e(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&typeof i==`string`&&ge(r,i)||i,o=g(r,a)?r[a]:void 0;A(o)&&A(e)?r[a]=ve(o,e):A(e)?r[a]=ve({},e):x(e)?r[a]=e.slice():(!n||!S(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++){let n=e[t];if(!n||C(n)||(F(n,i),typeof n!=`object`||x(n)))continue;let r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){let t=r[e];Ae.call(n,t)&&i(n[t],t)}}return r}var ye=(e,t,n,{allOwnKeys:r}={})=>(F(t,(t,r)=>{n&&D(t)?Object.defineProperty(e,r,{__proto__:null,value:d(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),be=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),xe=(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)},Se=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&p(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ce=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},we=e=>{if(!e)return null;if(x(e))return e;let t=e.length;if(!te(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},Te=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&p(Uint8Array)),Ee=(e,t)=>{let n=(e&&e[m]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},De=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Oe=y(`HTMLFormElement`),ke=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),{propertyIsEnumerable:Ae}=Object.prototype,je=y(`RegExp`),Me=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};F(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Ne=e=>{Me(e,(t,n)=>{if(D(e)&&[`arguments`,`caller`,`callee`].includes(n))return!1;let r=e[n];if(D(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},Pe=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return x(e)?r(e):r(String(e).split(t)),n},Fe=()=>{},Ie=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Le(e){return!!(e&&D(e.append)&&e[h]===`FormData`&&e[m])}var Re=e=>{let t=new WeakSet,n=e=>{if(O(e)){if(t.has(e))return;if(C(e))return e;if(!(`toJSON`in e)){t.add(e);let r=x(e)?[]:{};return F(e,(e,t)=>{let i=n(e);!S(i)&&(r[t]=i)}),t.delete(e),r}}return e};return n(e)},ze=y(`AsyncFunction`),Be=e=>e&&(O(e)||D(e))&&D(e.then)&&D(e.catch),Ve=((e,t)=>e?setImmediate:t?((e,t)=>(I.addEventListener(`message`,({source:n,data:r})=>{n===I&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),I.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,D(I.postMessage)),He=typeof queueMicrotask<`u`?queueMicrotask.bind(I):typeof process<`u`&&process.nextTick||Ve,Ue=e=>e!=null&&D(e[m]),L={isArray:x,isArrayBuffer:w,isBuffer:C,isFormData:le,isArrayBufferView:T,isString:E,isNumber:te,isBoolean:k,isObject:O,isPlainObject:A,isEmptyObject:j,isReadableStream:de,isRequest:fe,isResponse:pe,isHeaders:me,isUndefined:S,isDate:M,isFile:ne,isReactNativeBlob:re,isReactNative:ie,isBlob:N,isRegExp:je,isFunction:D,isStream:oe,isURLSearchParams:ue,isTypedArray:Te,isFileList:ae,forEach:F,merge:ve,extend:ye,trim:he,stripBOM:be,inherits:xe,toFlatObject:Se,kindOf:v,kindOfTest:y,endsWith:Ce,toArray:we,forEachEntry:Ee,matchAll:De,isHTMLForm:Oe,hasOwnProperty:g,hasOwnProp:g,hasOwnInPrototypeChain:_,getSafeProp:ee,reduceDescriptors:Me,freezeMethods:Ne,toObjectSet:Pe,toCamelCase:ke,noop:Fe,toFiniteNumber:Ie,findKey:ge,global:I,isContextDefined:_e,isSpecCompliantForm:Le,toJSONObject:Re,isAsyncFn:ze,isThenable:Be,setImmediate:Ve,asap:He,isIterable:Ue,isSafeIterable:e=>e!=null&&_(e,m)&&Ue(e)},We=L.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`]),Ge=e=>{let t={},n,r,i;return e&&e.split(`
2
+ `).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&We[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t};function Ke(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}var qe=RegExp(`[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+`,`g`),Je=RegExp(`[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+`,`g`);function Ye(e,t){return L.isArray(e)?e.map(e=>Ye(e,t)):Ke(String(e).replace(t,``))}var Xe=e=>Ye(e,qe),Ze=e=>Ye(e,Je);function Qe(e){let t=Object.create(null);return L.forEach(e.toJSON(),(e,n)=>{t[n]=Ze(e)}),t}var $e=Symbol(`internals`);function R(e){return e&&String(e).trim().toLowerCase()}function et(e){return e===!1||e==null?e:L.isArray(e)?e.map(et):Xe(String(e))}function tt(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var nt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function rt(e,t,n,r,i){if(L.isFunction(r))return r.call(this,t,n);if(i&&(t=n),L.isString(t)){if(L.isString(r))return t.indexOf(r)!==-1;if(L.isRegExp(r))return r.test(t)}}function it(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function at(e,t){let n=L.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var z=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=R(t);if(!i)return;let a=L.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=et(e))}let a=(e,t)=>L.forEach(e,(e,n)=>i(e,n,t));if(L.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(L.isString(e)&&(e=e.trim())&&!nt(e))a(Ge(e),t);else if(L.isObject(e)&&L.isSafeIterable(e)){let n=Object.create(null),r,i;for(let t of e){if(!L.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);i=t[0],L.hasOwnProp(n,i)?(r=n[i],n[i]=L.isArray(r)?[...r,t[1]]:[r,t[1]]):n[i]=t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=R(e),e){let n=L.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return tt(e);if(L.isFunction(t))return t.call(this,e,n);if(L.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=R(e),e){let n=L.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||rt(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=R(e),e){let i=L.findKey(n,e);i&&(!t||rt(n,n[i],i,t))&&(delete n[i],r=!0)}}return L.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||rt(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return L.forEach(this,(r,i)=>{let a=L.findKey(n,i);if(a){t[a]=et(r),delete t[i];return}let o=e?it(i):String(i).trim();o!==i&&delete t[i],t[o]=et(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return L.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&L.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(`
3
+ `)}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){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[$e]=this[$e]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=R(e);t[r]||(at(n,e),t[r]=!0)}return L.isArray(e)?e.forEach(r):r(e),this}};z.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),L.reduceDescriptors(z.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),L.freezeMethods(z);var ot=`[REDACTED ****]`;function st(e){if(L.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(L.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function ct(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||L.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof z&&(e=e.toJSON()),r.push(e);let t;if(L.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);L.isUndefined(r)||(t[n]=r)});else{if(!L.isPlainObject(e)&&st(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?ot:i(a);L.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var B=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return Object.defineProperty(s,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){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),i&&(this.response=i,this.status=i.status)}toJSON(){let e=this.config,t=e&&L.hasOwnProp(e,`redact`)?e.redact:void 0,n=L.isArray(t)&&t.length>0?ct(e,t):L.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}}};B.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,B.ERR_BAD_OPTION=`ERR_BAD_OPTION`,B.ECONNABORTED=`ECONNABORTED`,B.ETIMEDOUT=`ETIMEDOUT`,B.ECONNREFUSED=`ECONNREFUSED`,B.ERR_NETWORK=`ERR_NETWORK`,B.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,B.ERR_DEPRECATED=`ERR_DEPRECATED`,B.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,B.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,B.ERR_CANCELED=`ERR_CANCELED`,B.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,B.ERR_INVALID_URL=`ERR_INVALID_URL`,B.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function lt(e){return L.isPlainObject(e)||L.isArray(e)}function ut(e){return L.endsWith(e,`[]`)?e.slice(0,-2):e}function dt(e,t,n){return e?e.concat(t).map(function(e,t){return e=ut(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function ft(e){return L.isArray(e)&&!e.some(lt)}var pt=L.toFlatObject(L,{},null,function(e){return/^is[A-Z]/.test(e)});function V(e,t,n){if(!L.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!L.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||m,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&L.isSpecCompliantForm(t),u=[];if(!L.isFunction(i))throw TypeError(`visitor must be a function`);function d(e){if(e===null)return``;if(L.isDate(e))return e.toISOString();if(L.isBoolean(e))return e.toString();if(!l&&L.isBlob(e))throw new B(`Blob is not supported. Use a Buffer instead.`);if(L.isArrayBuffer(e)||L.isTypedArray(e)){if(l&&typeof s==`function`)return new s([e]);if(typeof Buffer<`u`)return Buffer.from(e);throw new B(`Blob is not supported. Use a Buffer instead.`,B.ERR_NOT_SUPPORT)}return e}function f(e){if(e>c)throw new B(`Object is too deeply nested (`+e+` levels). Max depth: `+c,B.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(e,t){if(c===1/0)return JSON.stringify(e);let n=[];return JSON.stringify(e,function(e,r){if(!L.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),f(t+n.length-1),r})}function m(e,n,i){let s=e;if(L.isReactNative(t)&&L.isReactNativeBlob(e))return t.append(dt(i,n,a),d(e)),!1;if(e&&!i&&typeof e==`object`){if(L.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=p(e,1);else if(L.isArray(e)&&ft(e)||(L.isFileList(e)||L.endsWith(n,`[]`))&&(s=L.toArray(e)))return n=ut(n),s.forEach(function(e,r){!(L.isUndefined(e)||e===null)&&t.append(o===!0?dt([n],r,a):o===null?n:n+`[]`,d(e))}),!1}return lt(e)?!0:(t.append(dt(i,n,a),d(e)),!1)}let h=Object.assign(pt,{defaultVisitor:m,convertValue:d,isVisitable:lt});function g(e,n,r=0){if(!L.isUndefined(e)){if(f(r),u.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));u.push(e),L.forEach(e,function(e,a){(!(L.isUndefined(e)||e===null)&&i.call(t,e,L.isString(a)?a.trim():a,n,h))===!0&&g(e,n?n.concat(a):[a],r+1)}),u.pop()}}if(!L.isObject(e))throw TypeError(`data must be an object`);return g(e),t}function mt(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function ht(e,t){this._pairs=[],e&&V(e,this,t)}var gt=ht.prototype;gt.append=function(e,t){this._pairs.push([e,t])},gt.toString=function(e){let t=e?t=>e.call(this,t,mt):mt;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function _t(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function vt(e,t,n){if(!t)return e;e||=``;let r=L.isFunction(n)?{serialize:n}:n,i=L.getSafeProp(r,`encode`)||_t,a=L.getSafeProp(r,`serialize`),o;if(o=a?a(t,r):L.isURLSearchParams(t)?t.toString():new ht(t,r).toString(i),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var yt=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){L.forEach(this.handlers,function(t){t!==null&&e(t)})}},bt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},xt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:ht,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},St=o({hasBrowserEnv:()=>Ct,hasStandardBrowserEnv:()=>Tt,hasStandardBrowserWebWorkerEnv:()=>Et,navigator:()=>wt,origin:()=>Dt}),Ct=typeof window<`u`&&typeof document<`u`,wt=typeof navigator==`object`&&navigator||void 0,Tt=Ct&&(!wt||[`ReactNative`,`NativeScript`,`NS`].indexOf(wt.product)<0),Et=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,Dt=Ct&&window.location.href||`http://localhost`,H={...St,...xt};function Ot(e,t){return V(e,new H.classes.URLSearchParams,{visitor:function(e,t,n,r){return H.isNode&&L.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}var kt=100;function At(e){if(e>kt)throw new B(`FormData field is too deeply nested (`+e+` levels). Max depth: `+kt,B.ERR_FORM_DATA_DEPTH_EXCEEDED)}function jt(e){let t=[],n=/\w+|\[(\w*)]/g,r;for(;(r=n.exec(e))!==null;)At(t.length),t.push(r[0]===`[]`?``:r[1]||r[0]);return t}function Mt(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function Nt(e){function t(e,n,r,i){At(i);let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&L.isArray(r)?r.length:a,s?(L.hasOwnProp(r,a)?r[a]=L.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!L.hasOwnProp(r,a)||!L.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&L.isArray(r[a])&&(r[a]=Mt(r[a])),!o)}if(L.isFormData(e)&&L.isFunction(e.entries)){let n={};return L.forEachEntry(e,(e,r)=>{t(jt(e),r,n,0)}),n}return null}var U=(e,t)=>e!=null&&L.hasOwnProp(e,t)?e[t]:void 0;function Pt(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var W={transitional:bt,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=L.isObject(e);if(i&&L.isHTMLForm(e)&&(e=new FormData(e)),L.isFormData(e))return r?JSON.stringify(Nt(e)):e;if(L.isArrayBuffer(e)||L.isBuffer(e)||L.isStream(e)||L.isFile(e)||L.isBlob(e)||L.isReadableStream(e))return e;if(L.isArrayBufferView(e))return e.buffer;if(L.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=U(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return Ot(e,t).toString();if((a=L.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=U(this,`env`),r=n&&n.FormData;return V(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),Pt(e)):e}],transformResponse:[function(e){let t=U(this,`transitional`)||W.transitional,n=t&&t.forcedJSONParsing,r=U(this,`responseType`),i=r===`json`;if(L.isResponse(e)||L.isReadableStream(e))return e;if(e&&L.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,U(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?B.from(e,B.ERR_BAD_RESPONSE,this,null,U(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:H.classes.FormData,Blob:H.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};L.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{W.headers[e]={}});function Ft(e,t){let n=this||W,r=t||n,i=z.from(r.headers),a=r.data;return L.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function It(e){return!!(e&&e.__CANCEL__)}var G=class extends B{constructor(e,t,n){super(e??`canceled`,B.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Lt(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new B(`Request failed with status code `+n.status,n.status>=400&&n.status<500?B.ERR_BAD_REQUEST:B.ERR_BAD_RESPONSE,n.config,n.request,n))}function Rt(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function zt(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function Bt(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var K=(e,t,n=3)=>{let r=0,i=zt(50,250);return Bt(n=>{if(!n||typeof n.loaded!=`number`)return;let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Vt=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ht=e=>(...t)=>L.asap(()=>e(...t)),Ut=H.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,H.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(H.origin),H.navigator&&/(msie|trident)/i.test(H.navigator.userAgent)):()=>!0,Wt=H.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];L.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),L.isString(r)&&s.push(`path=${r}`),L.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),L.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)try{return decodeURIComponent(r.slice(i+1))}catch{return r.slice(i+1)}}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Gt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Kt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}var qt=/^https?:(?!\/\/)/i,Jt=/[\t\n\r]/g;function Yt(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Xt(e){return Yt(e).replace(Jt,``)}function Zt(e,t){if(typeof e==`string`&&qt.test(Xt(e)))throw new B(`Invalid URL: missing "//" after protocol`,B.ERR_INVALID_URL,t)}function Qt(e,t,n,r){Zt(t,r);let i=!Gt(t);return e&&(i||n===!1)?(Zt(e,r),Kt(e,t)):t}var $t=e=>e instanceof z?{...e}:e;function q(e,t){e||={},t||={};let n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return L.isPlainObject(e)&&L.isPlainObject(t)?L.merge.call({caseless:r},e,t):L.isPlainObject(t)?L.merge({},t):L.isArray(t)?t.slice():t}function i(e,t,n,i){if(!L.isUndefined(t))return r(e,t,n,i);if(!L.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!L.isUndefined(t))return r(void 0,t)}function o(e,t){if(!L.isUndefined(t))return r(void 0,t);if(!L.isUndefined(e))return r(void 0,e)}function s(n){let r=L.hasOwnProp(t,`transitional`)?t.transitional:void 0;if(!L.isUndefined(r))if(L.isPlainObject(r)){if(L.hasOwnProp(r,n))return r[n]}else return;let i=L.hasOwnProp(e,`transitional`)?e.transitional:void 0;if(L.isPlainObject(i)&&L.hasOwnProp(i,n))return i[n]}function c(n,i,a){if(L.hasOwnProp(t,a))return r(n,i);if(L.hasOwnProp(e,a))return r(void 0,n)}let l={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(e,t,n)=>i($t(e),$t(t),n,!0)};return L.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=L.hasOwnProp(l,r)?l[r]:i,o=a(L.hasOwnProp(e,r)?e[r]:void 0,L.hasOwnProp(t,r)?t[r]:void 0,r);L.isUndefined(o)&&a!==c||(n[r]=o)}),L.hasOwnProp(t,`validateStatus`)&&L.isUndefined(t.validateStatus)&&s(`validateStatusUndefinedResolves`)===!1&&(L.hasOwnProp(e,`validateStatus`)?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}var en=[`content-type`,`content-length`];function tn(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t||{}).forEach(([t,n])=>{en.includes(t.toLowerCase())&&e.set(t,n)})}var nn=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)));function rn(e){let t=q({},e),n=e=>L.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=z.from(s),t.url=vt(Qt(l,d,u,t),n(`params`),n(`paramsSerializer`)),c){let t=L.getSafeProp(c,`username`)||``,n=L.getSafeProp(c,`password`)||``;try{s.set(`Authorization`,`Basic `+btoa(t+`:`+(n?nn(n):``)))}catch(t){throw B.from(t,B.ERR_BAD_OPTION_VALUE,e)}}if(L.isFormData(r)&&(H.hasStandardBrowserEnv||H.hasStandardBrowserWebWorkerEnv||L.isReactNative(r)?s.setContentType(void 0):L.isFunction(r.getHeaders)&&tn(s,r.getHeaders(),n(`formDataHeaderPolicy`))),H.hasStandardBrowserEnv&&(L.isFunction(i)&&(i=i(t)),i===!0||i==null&&Ut(t.url))){let e=a&&o&&Wt.read(o);e&&s.set(a,e)}return t}var an=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=rn(e),i=r.data,a=z.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=z.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Lt(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new B(`Request aborted`,B.ECONNABORTED,e,h)),m(),null)},h.onerror=function(t){let r=new B(t&&t.message?t.message:`Network Error`,B.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||bt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new B(t,i.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,e,h)),m(),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&L.forEach(Qe(a),function(e,t){h.setRequestHeader(t,e)}),L.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=K(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=K(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new G(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Rt(r.url);if(_&&!H.protocols.includes(_)){n(new B(`Unsupported protocol `+_+`:`,B.ERR_BAD_REQUEST,e)),m();return}h.send(i||null)})},on=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;let n=new AbortController,r=!1,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof B?t:new G(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new B(`timeout of ${t}ms exceeded`,B.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i,{once:!0}));let{signal:s}=n;return s.unsubscribe=()=>L.asap(o),s},sn=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},cn=async function*(e,t){for await(let n of ln(e))yield*sn(n,t)},ln=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},un=(e,t,n,r)=>{let i=cn(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})},J=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,dn=(e,t,n)=>t+2<n&&J(e.charCodeAt(t+1))&&J(e.charCodeAt(t+2));function fn(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);J(t)&&J(i)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n===37&&dn(r,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var pn=`1.18.1`,mn=64*1024,{isFunction:Y}=L,hn=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),gn=e=>{if(!L.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_n=(e,...t)=>{try{return!!e(...t)}catch{return!1}},vn=e=>{let t=e.indexOf(`://`),n=e;return t!==-1&&(n=n.slice(t+3)),n.includes(`@`)||n.includes(`:`)},yn=e=>{let t=L.global!==void 0&&L.global!==null?L.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=L.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?Y(i):typeof fetch==`function`,c=Y(a),l=Y(o);if(!s)return!1;let u=s&&Y(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&_n(()=>{let e=!1,t=new a(H.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&_n(()=>L.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new B(`Response type '${e}' is not supported`,B.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new a(H.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(L.isArrayBufferView(e)||L.isArrayBuffer(e))return e.byteLength;if(L.isURLSearchParams(e)&&(e+=``),L.isString(e))return(await d(e)).byteLength},g=async(e,t)=>L.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:d,timeout:_,onDownloadProgress:ee,onUploadProgress:v,responseType:y,headers:b,withCredentials:x=`same-origin`,fetchOptions:S,maxContentLength:C,maxBodyLength:w}=rn(e),T=L.isNumber(C)&&C>-1,E=L.isNumber(w)&&w>-1,D=t=>L.hasOwnProp(e,t)?e[t]:void 0,te=i||fetch;y=y?(y+``).toLowerCase():`text`;let O=on([l,d&&d.toAbortSignal()],_),k=null,A=O&&O.unsubscribe&&(()=>{O.unsubscribe()}),j,M=null,ne=()=>new B(`Request body larger than maxBodyLength limit`,B.ERR_BAD_REQUEST,e,k);try{let i,l=D(`auth`);if(l&&(i={username:L.getSafeProp(l,`username`)||``,password:L.getSafeProp(l,`password`)||``}),vn(t)){let e=new URL(t,H.origin);!i&&(e.username||e.password)&&(i={username:gn(e.username),password:gn(e.password)}),(e.username||e.password)&&(e.username=``,e.password=``,t=e.href)}if(i&&(b.delete(`authorization`),b.set(`Authorization`,`Basic `+btoa(hn((i.username||``)+`:`+(i.password||``))))),T&&typeof t==`string`&&t.startsWith(`data:`)&&fn(t)>C)throw new B(`maxContentLength size of `+C+` exceeded`,B.ERR_BAD_RESPONSE,e,k);if(E&&n!==`get`&&n!==`head`){let e=await h(s);if(typeof e==`number`&&isFinite(e)&&(j=e,e>w))throw ne()}let d=E&&(L.isReadableStream(s)||L.isStream(s)),_=(e,t,n)=>un(e,mn,e=>{if(E&&e>w)throw M=ne();t&&t(e)},n);if(f&&n!==`get`&&n!==`head`&&(v||d)){if(j??=await g(b,s),j!==0||d){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(L.isFormData(s)&&(n=e.headers.get(`content-type`))&&b.setContentType(n),e.body){let[t,n]=v&&Vt(j,K(Ht(v)))||[];s=_(e.body,t,n)}}}else if(d&&!c&&u&&n!==`get`&&n!==`head`)s=_(s);else if(d&&c&&!f&&n!==`get`&&n!==`head`)throw new B(`Stream request bodies are not supported by the current fetch implementation`,B.ERR_NOT_SUPPORT,e,k);L.isString(x)||(x=x?`include`:`omit`);let re=c&&`credentials`in a.prototype;if(L.isFormData(s)){let e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete(`content-type`)}b.set(`User-Agent`,`axios/`+pn,!1);let ie={...S,signal:O,method:n.toUpperCase(),headers:Qe(b.normalize()),body:s,duplex:`half`,credentials:re?x:void 0};k=c&&new a(t,ie);let N=await(c?te(k,S):te(t,ie)),ae=z.from(N.headers);if(T){let t=L.toFiniteNumber(ae.getContentLength());if(t!=null&&t>C)throw new B(`maxContentLength size of `+C+` exceeded`,B.ERR_BAD_RESPONSE,e,k)}let oe=p&&(y===`stream`||y===`response`);if(p&&N.body&&(ee||T||oe&&A)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=N[e]});let n=L.toFiniteNumber(ae.getContentLength()),[r,i]=ee&&Vt(n,K(Ht(ee),!0))||[],a=0;N=new o(un(N.body,mn,t=>{if(T&&(a=t,a>C))throw new B(`maxContentLength size of `+C+` exceeded`,B.ERR_BAD_RESPONSE,e,k);r&&r(t)},()=>{i&&i(),A&&A()}),t)}y||=`text`;let P=await m[L.findKey(m,y)||`text`](N,e);if(T&&!p&&!oe){let t;if(P!=null&&(typeof P.byteLength==`number`?t=P.byteLength:typeof P.size==`number`?t=P.size:typeof P==`string`&&(t=typeof r==`function`?new r().encode(P).byteLength:P.length)),typeof t==`number`&&t>C)throw new B(`maxContentLength size of `+C+` exceeded`,B.ERR_BAD_RESPONSE,e,k)}return!oe&&A&&A(),await new Promise((t,n)=>{Lt(t,n,{data:P,headers:z.from(N.headers),status:N.status,statusText:N.statusText,config:e,request:k})})}catch(t){if(A&&A(),O&&O.aborted&&O.reason instanceof B){let n=O.reason;throw n.config=e,k&&(n.request=k),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(M)throw k&&!M.request&&(M.request=k),M;if(t instanceof B)throw k&&!t.request&&(t.request=k),t;if(t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)){let n=new B(`Network Error`,B.ERR_NETWORK,e,k,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw B.from(t,t&&t.code,e,k,t&&t.response)}}},bn=new Map,xn=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=bn;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:yn(t)),l=c;return c};xn();var Sn={http:null,xhr:an,fetch:{get:xn}};L.forEach(Sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});var Cn=e=>`- ${e}`,wn=e=>L.isFunction(e)||e===null||e===!1;function Tn(e,t){e=L.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!wn(r)&&(i=Sn[(n=String(r)).toLowerCase()],i===void 0))throw new B(`Unknown adapter '${n}'`);if(i&&(L.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new B(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
4
+ `+e.map(Cn).join(`
5
+ `):` `+Cn(e[0]):`as no adapter specified`),B.ERR_NOT_SUPPORT)}return i}var En={getAdapter:Tn,adapters:Sn};function Dn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G(null,e)}function On(e){return Dn(e),e.headers=z.from(e.headers),e.data=Ft.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),En.getAdapter(e.adapter||W.adapter,e)(e).then(function(t){Dn(e),e.response=t;try{t.data=Ft.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=z.from(t.headers),t},function(t){if(!It(t)&&(Dn(e),t&&t.response)){e.response=t.response;try{t.response.data=Ft.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=z.from(t.response.headers)}return Promise.reject(t)})}var kn={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{kn[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var An={};kn.transitional=function(e,t,n){function r(e,t){return`[Axios v`+pn+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new B(r(i,` has been removed`+(t?` in `+t:``)),B.ERR_DEPRECATED);return t&&!An[i]&&(An[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},kn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function jn(e,t,n){if(typeof e!=`object`||!e)throw new B(`options must be an object`,B.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new B(`option `+a+` must be `+n,B.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new B(`Unknown option `+a,B.ERR_BAD_OPTION)}}var Mn={assertOptions:jn,validators:kn},X=Mn.validators,Z=class{constructor(e){this.defaults=e||{},this.interceptors={request:new yt,response:new yt}}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=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
6
+ `);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
7
+ `),r=t===-1?-1:n.indexOf(`
8
+ `,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
9
+ `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=q(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Mn.assertOptions(n,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean),legacyInterceptorReqResOrdering:X.transitional(X.boolean),advertiseZstdAcceptEncoding:X.transitional(X.boolean),validateStatusUndefinedResolves:X.transitional(X.boolean)},!1),r!=null&&(L.isFunction(r)?t.paramsSerializer={serialize:r}:Mn.assertOptions(r,{encode:X.function,serialize:X.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Mn.assertOptions(t,{baseUrl:X.spelling(`baseURL`),withXsrfToken:X.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&L.merge(i.common,i[t.method]);i&&L.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=z.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||bt;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[On.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=On.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=q(this.defaults,e),vt(Qt(e.baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}};L.forEach([`delete`,`get`,`head`,`options`],function(e){Z.prototype[e]=function(t,n){return this.request(q(n||{},{method:e,url:t,data:n&&L.hasOwnProp(n,`data`)?n.data:void 0}))}}),L.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(q(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}Z.prototype[e]=t(),e!==`query`&&(Z.prototype[e+`Form`]=t(!0))});var Nn=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let 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,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new G(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function Pn(e){return function(t){return e.apply(null,t)}}function Fn(e){return L.isObject(e)&&e.isAxiosError===!0}var In={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(In).forEach(([e,t])=>{In[t]=e});function Ln(e){let t=new Z(e),n=d(Z.prototype.request,t);return L.extend(n,Z.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return Ln(q(e,t))},n}var Q=Ln(W);Q.Axios=Z,Q.CanceledError=G,Q.CancelToken=Nn,Q.isCancel=It,Q.VERSION=pn,Q.toFormData=V,Q.AxiosError=B,Q.Cancel=Q.CanceledError,Q.all=function(e){return Promise.all(e)},Q.spread=Pn,Q.isAxiosError=Fn,Q.mergeConfig=q,Q.AxiosHeaders=z,Q.formToJSON=e=>Nt(L.isHTMLForm(e)?new FormData(e):e),Q.getAdapter=En.getAdapter,Q.HttpStatusCode=In,Q.default=Q;var Rn=`GHENTCDH_AUTHENTICATION`,zn=`${Rn}_token`,Bn=e=>{localStorage.setItem(zn,e)},Vn=()=>{localStorage.removeItem(zn)},Hn=()=>localStorage.getItem(zn),Un=Q.create({headers:{"Content-Type":`application/json`}}),Wn=e=>{let t=Q.create({baseURL:e,headers:{"Content-Type":`application/json`}});return t.interceptors.request.use(e=>{let t=Hn();t&&(e.headers.Authorization=`Bearer ${t}`);let n=localStorage.getItem(`active-invertor-id`);return n&&(e.headers[`X-Inverter-Id`]=n),e}),t.interceptors.response.use(e=>e,e=>(e.response?.status===401&&(localStorage.removeItem(`token`),window.location.href=`/login`),Promise.reject(e))),t},$=null;function Gn(){if(!$)throw Error("first create the auth api with `createAuthApi`");return $}var Kn=e=>$?(console.warn(`Use cached API, authApi is already initialized `),$):($=Wn(e),$),qn=class e extends u.default{constructor(e){super(e)}async initialize(){try{await this.init({onLoad:`login-required`})?(console.log(`User is authenticated`),Bn(this.token)):(console.log(`User is not authenticated`),Vn())}catch(e){console.error(`Failed to initialize adapter:`,e)}}static async instance(t){let n=new e(t);return await n.initialize(),n}updateToken(){return console.log(`update the token`),super.updateToken(30)}},Jn={skipAuthentication:!1},Yn=e=>{let t=(0,l.ref)(!1),n;Kn(e.baseUrl);let r={...Jn,...e},i=async()=>{let r=await qn.instance(e.keycloak);return n=r,t.value=!0,r},a=()=>n?.token,o=async()=>n?(t.value||await new Promise(e=>{let n=(0,l.watch)(t,t=>{t&&(n(),e())})}),n):i(),s=(0,l.markRaw)({install(e){e.runWithContext(()=>{e.config.globalProperties.$auth=r,e.provide(Rn,s)})},updateToken:async()=>(await o())?.updateToken(),token:a,user:async()=>(await o())?.idTokenParsed,logout:async()=>(await o())?.logout(),options:r});return s},Xn=()=>{let e=(0,l.inject)(Rn);return e||console.warn(`No auth provided, authorized calls may not work`),{token:()=>!!e?.token(),isAuthenticated:()=>!!e?.user(),getUser:()=>e?.user(),logout:()=>e?.logout()}};exports.apiNoAuth=Un,exports.createAuth=Yn,exports.createAuthApi=Kn,exports.useAuthApi=Gn,exports.useAuthenticate=Xn;