authifyer-sdk 1.0.1 → 1.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.
@@ -1,4 +1,4 @@
1
- (function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.AuthifyerSDK={},N.React))})(this,(function(N,S){"use strict";var Rn=Object.defineProperty;var Sn=(N,S,q)=>S in N?Rn(N,S,{enumerable:!0,configurable:!0,writable:!0,value:q}):N[S]=q;var Q=(N,S,q)=>Sn(N,typeof S!="symbol"?S+"":S,q);var q={exports:{}},se={};/**
1
+ (function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.AuthifyerSDK={},N.React))})(this,(function(N,S){"use strict";var Tn=Object.defineProperty;var An=(N,S,q)=>S in N?Tn(N,S,{enumerable:!0,configurable:!0,writable:!0,value:q}):N[S]=q;var Q=(N,S,q)=>An(N,typeof S!="symbol"?S+"":S,q);var q={exports:{}},se={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ve;function Ft(){if(Ve)return se;Ve=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:t,type:n,key:i,ref:s!==void 0?s:null,props:o}}return se.Fragment=e,se.jsx=r,se.jsxs=r,se}var oe={};/**
9
+ */var Ke;function Bt(){if(Ke)return se;Ke=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:t,type:n,key:i,ref:s!==void 0?s:null,props:o}}return se.Fragment=e,se.jsx=r,se.jsxs=r,se}var oe={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var $e;function It(){return $e||($e=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===xe?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case U:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case F:return"SuspenseList";case _e:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case b:return"Portal";case v:return l.displayName||"Context";case x:return(l._context.displayName||"Context")+".Consumer";case I:var E=l.render;return l=l.displayName,l||(l=E.displayName||E.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return E=l.displayName||null,E!==null?E:t(l.type)||"Memo";case J:E=l._payload,l=l._init;try{return t(l(E))}catch{}}return null}function e(l){return""+l}function r(l){try{e(l);var E=!1}catch{E=!0}if(E){E=console;var A=E.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return A.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),e(l)}}function n(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===J)return"<...>";try{var E=t(l);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function s(){var l=V.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if($.call(l,"key")){var E=Object.getOwnPropertyDescriptor(l,"key").get;if(E&&E.isReactWarning)return!1}return l.key!==void 0}function c(l,E){function A(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}A.isReactWarning=!0,Object.defineProperty(l,"key",{get:A,configurable:!0})}function p(){var l=t(this.type);return pe[l]||(pe[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function d(l,E,A,O,G,We){var C=A.ref;return l={$$typeof:f,type:l,key:E,props:A,_owner:O},(C!==void 0?C:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:p}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function u(l,E,A,O,G,We){var C=E.children;if(C!==void 0)if(O)if(W(C)){for(O=0;O<C.length;O++)m(C[O]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(C);if($.call(E,"key")){C=t(l);var ne=Object.keys(E).filter(function(wn){return wn!=="key"});O=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+O]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Ye;function Dt(){return Ye||(Ye=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===xe?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case U:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case I:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case b:return"Portal";case v:return l.displayName||"Context";case x:return(l._context.displayName||"Context")+".Consumer";case F:var E=l.render;return l=l.displayName,l||(l=E.displayName||E.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return E=l.displayName||null,E!==null?E:t(l.type)||"Memo";case J:E=l._payload,l=l._init;try{return t(l(E))}catch{}}return null}function e(l){return""+l}function r(l){try{e(l);var E=!1}catch{E=!0}if(E){E=console;var A=E.error,_=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return A.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",_),e(l)}}function n(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===J)return"<...>";try{var E=t(l);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function s(){var l=V.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if($.call(l,"key")){var E=Object.getOwnPropertyDescriptor(l,"key").get;if(E&&E.isReactWarning)return!1}return l.key!==void 0}function c(l,E){function A(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}A.isReactWarning=!0,Object.defineProperty(l,"key",{get:A,configurable:!0})}function p(){var l=t(this.type);return pe[l]||(pe[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function d(l,E,A,_,G,Ve){var C=A.ref;return l={$$typeof:f,type:l,key:E,props:A,_owner:_},(C!==void 0?C:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:p}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Ve}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function u(l,E,A,_,G,Ve){var C=E.children;if(C!==void 0)if(_)if(W(C)){for(_=0;_<C.length;_++)m(C[_]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(C);if($.call(E,"key")){C=t(l);var ne=Object.keys(E).filter(function(Sn){return Sn!=="key"});_=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+_]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,O,C,ne,C),Ne[C+O]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(E)&&(r(E.key),C=""+E.key),"key"in E){A={};for(var Je in E)Je!=="key"&&(A[Je]=E[Je])}else A=E;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,We)}function m(l){w(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?w(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function w(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),_e=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,E,A){var O=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!1,O?Error("react-stack-top-frame"):M,O?re(n(l)):me)},oe.jsxs=function(l,E,A){var O=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!0,O?Error("react-stack-top-frame"):M,O?re(n(l)):me)}})()),oe}var Ke;function Bt(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?q.exports=Ft():q.exports=It()),q.exports}var y=Bt();function Ye(t,e){return function(){return t.apply(e,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Xe}=Symbol,be=(t=>e=>{const r=Dt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=D("ArrayBuffer");function Mt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Ht=ge("string"),k=ge("function"),Qe=ge("number"),ae=t=>t!==null&&typeof t=="object",qt=t=>t===!0||t===!1,Ee=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Xe in t)&&!(ye in t)},zt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Wt=D("Date"),Jt=D("File"),Vt=D("Blob"),$t=D("FileList"),Kt=t=>ae(t)&&k(t.pipe),Yt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Xt=D("URLSearchParams"),[Gt,Qt,Zt,er]=["ReadableStream","Request","Response","Headers"].map(D),tr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function Ze(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=et(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Ze(r,o)||o;Ee(r[i])&&Ee(s)?r[i]=Pe(r[i],s):Ee(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const rr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ye(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),nr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},or=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},ar=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!Qe(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),lr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},ur=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},fr=D("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),tt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),hr=D("RegExp"),rt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},pr=t=>{rt(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mr=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},yr=()=>{},br=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function gr(t){return!!(t&&k(t.append)&&t[Xe]==="FormData"&&t[ye])}const Er=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},wr=D("AsyncFunction"),Rr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),nt=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Sr=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||nt,a={isArray:Z,isArrayBuffer:Ge,isBuffer:ie,isFormData:Yt,isArrayBufferView:Mt,isString:Ht,isNumber:Qe,isBoolean:qt,isObject:ae,isPlainObject:Ee,isEmptyObject:zt,isReadableStream:Gt,isRequest:Qt,isResponse:Zt,isHeaders:er,isUndefined:ee,isDate:Wt,isFile:Jt,isBlob:Vt,isRegExp:hr,isFunction:k,isStream:Kt,isURLSearchParams:Xt,isTypedArray:cr,isFileList:$t,forEach:ce,merge:Pe,extend:rr,trim:tr,stripBOM:nr,inherits:sr,toFlatObject:or,kindOf:be,kindOfTest:D,endsWith:ir,toArray:ar,forEachEntry:lr,matchAll:ur,isHTMLForm:fr,hasOwnProperty:tt,hasOwnProp:tt,reduceDescriptors:rt,freezeMethods:pr,toObjectSet:mr,toCamelCase:dr,noop:yr,toFiniteNumber:br,findKey:Ze,global:K,isContextDefined:et,isSpecCompliantForm:gr,toJSONObject:Er,isAsyncFn:wr,isThenable:Rr,setImmediate:nt,asap:Sr,isIterable:t=>t!=null&&k(t[ye])};let g=class Lt extends Error{static from(e,r,n,s,o,i){const c=new Lt(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),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:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const Tr=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function st(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ot(t,e,r){return t?t.concat(e).map(function(s,o){return s=st(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Ar(t){return a.isArray(t)&&!t.some(je)}const Or=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function we(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Ar(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=st(b),T.forEach(function(x,v){!(a.isUndefined(x)||x===null)&&e.append(i===!0?ot([b],v,o):i===null?b:b+"[]",d(x))}),!1}return je(f)?!0:(e.append(ot(h,b,o),d(f)),!1)}const m=[],w=Object.assign(Or,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,w))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function it(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&we(t,this,e)}const at=ve.prototype;at.append=function(e,r){this._pairs.push([e,r])},at.toString=function(e){const r=e?function(n){return e.call(this,n,it)}:it;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function _r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,r){if(!e)return t;const n=r&&r.encode||_r,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class lt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,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&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Nr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),Cr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Cr,navigator:Ue,origin:Pr},Symbol.toStringTag,{value:"Module"})),...xr};function jr(t,e){return we(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function vr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kr(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function ut(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=kr(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(vr(n),s,r,0)}),r}return null}function Lr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ut(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return we(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Lr(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Ur=a.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"]),Fr=t=>{const e={};let r,n,s;return t&&t.split(`
23
- `).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Ur[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ft=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function Ir(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Br=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Fe(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Dr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Mr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function o(c,p,d){const u=ue(p);if(!u)throw new Error("header name must be a non-empty string");const m=a.findKey(s,u);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||p]=Re(c))}const i=(c,p)=>a.forEach(c,(d,u)=>o(d,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Br(e))i(Fr(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,d;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[d=u[0]]=(p=c[d])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=ue(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Ir(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ue(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Fe(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function o(i){if(i=ue(i),i){const c=a.findKey(n,i);c&&(!r||Fe(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!e||Fe(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,o)=>{const i=a.findKey(n,o);if(i){r[i]=Re(s),delete r[o];return}const c=e?Dr(o):String(o).trim();c!==o&&delete r[o],r[c]=Re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
24
- `)}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,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ft]=this[ft]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(Mr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Ie(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function dt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function ht(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function qr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,w=0;for(;m!==s;)w+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(w*1e3/R):void 0}}function zr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=qr(50,250);return zr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},pt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},mt=t=>(...e)=>a.asap(()=>t(...e)),Wr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Jr=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Vr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $r(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function yt(t,e,r){let n=!Vr(e);return t&&(n||r==!1)?$r(t,e):e}const bt=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,w){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:w},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,w){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,w)}else return n(d,u,m,w)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,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,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(bt(d),bt(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,w=m(t[u],e[u],u);a.isUndefined(w)&&m!==c||(r[u]=w)}),r}const gt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ct(yt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Wr(e.url))){const p=s&&o&&Jr.read(o);p&&i.set(s,p)}return e},Kr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=gt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,w,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const x=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),I={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:t,request:h};ht(function(F){r(F),b()},function(F){n(F),b()},I),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const I=v&&v.message?v.message:"Network Error",z=new g(I,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const I=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,I.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,I){h.setRequestHeader(I,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([w,f]=Se(d,!0),h.addEventListener("progress",w)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=x=>{h&&(n(!x||x.type?new fe(null,t,h):x),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=Hr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Yr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Xr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Gr=async function*(t,e){for await(const r of Qr(t))yield*Xr(r,e)},Qr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Et=(t,e,r,n)=>{const s=Gr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let w=o+=m;r(w)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},wt=64*1024,{isFunction:Te}=a,Zr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,Tt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},en=t=>{t=a.merge.call({skipUndefined:!0},Zr,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Rt),p=s&&(typeof St=="function"?(f=>b=>f.encode(b))(new St):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&Tt(()=>{let f=!1;const b=new r(j.origin,{body:new Rt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&Tt(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??w(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:x,timeout:v,onDownloadProgress:I,onUploadProgress:z,responseType:F,headers:he,withCredentials:J="same-origin",fetchOptions:_e}=gt(f),xe=e||fetch;F=F?(F+"").toLowerCase():"text";let V=Yr([U,x&&x.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),E;if(a.isFormData(T)&&(E=l.headers.get("content-type"))&&he.setContentType(E),l.body){const[A,O]=pt(re,Se(mt(z)));T=Et(l.body,wt,A,O)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={..._e,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?xe($,_e):xe(b,pe));const me=u&&(F==="stream"||F==="response");if(u&&(I||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const E=a.toFiniteNumber(M.headers.get("content-length")),[A,O]=I&&pt(E,Se(mt(I),!0))||[];M=new n(Et(M.body,wt,A,()=>{O&&O(),W&&W()}),l)}F=F||"text";let Ne=await m[a.findKey(m,F)||"text"](M,f);return!me&&W&&W(),await new Promise((l,E)=>{ht(l,E,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},tn=new Map,At=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=tn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:en(e)),u=d;return d};At();const Be={http:Tr,xhr:Kr,fetch:{get:At}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ot=t=>`- ${t}`,rn=t=>a.isFunction(t)||t===null||t===!1;function nn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!rn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
25
- `+i.map(Ot).join(`
26
- `):" "+Ot(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const _t={getAdapter:nn,adapters:Be};function De(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function xt(t){return De(t),t.headers=L.from(t.headers),t.data=Ie.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),_t.getAdapter(t.adapter||le.adapter,t)(t).then(function(n){return De(t),n.data=Ie.call(t,t.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return dt(n)||(De(t),n&&n.response&&(n.response.data=Ie.call(t,t.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const Nt="1.13.5",Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Ct={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+Nt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!Ct[i]&&(Ct[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}},Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function sn(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const o=n[s],i=e[o];if(i){const c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const Oe={assertOptions:sn,validators:Ae},B=Oe.validators;let X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new lt,response:new lt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
27
- `+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&Oe.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:Oe.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Oe.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,w;if(!p){const f=[xt.bind(this),void 0];for(f.unshift(...c),f.push(...d),w=f.length,u=Promise.resolve(r);m<w;)u=u.then(f[m++],f[m++]);return u}w=c.length;let R=r;for(;m<w;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=xt.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,w=d.length;m<w;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=yt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let on=class Ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(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;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ut(function(s){e=s}),cancel:e}}};function an(t){return function(r){return t.apply(null,r)}}function cn(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={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(Me).forEach(([t,e])=>{Me[e]=t});function Pt(t){const e=new X(t),r=Ye(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Pt(Y(t,s))},r}const _=Pt(le);_.Axios=X,_.CanceledError=fe,_.CancelToken=on,_.isCancel=dt,_.VERSION=Nt,_.toFormData=we,_.AxiosError=g,_.Cancel=_.CanceledError,_.all=function(e){return Promise.all(e)},_.spread=an,_.isAxiosError=cn,_.mergeConfig=Y,_.AxiosHeaders=L,_.formToJSON=t=>ut(a.isHTMLForm(t)?new FormData(t):t),_.getAdapter=_t.getAdapter,_.HttpStatusCode=Me,_.default=_;const{Axios:Cn,AxiosError:Pn,CanceledError:jn,isCancel:vn,CancelToken:kn,VERSION:Ln,all:Un,Cancel:Fn,isAxiosError:In,spread:Bn,toFormData:Dn,AxiosHeaders:Mn,HttpStatusCode:Hn,formToJSON:qn,getAdapter:zn,mergeConfig:Wn}=_,H=_.create({baseURL:"https://authifyer-backend.onrender.com",withCredentials:!0,headers:{"Content-Type":"application/json"}}),jt=t=>{t?H.defaults.headers.common.Authorization=`Bearer ${t}`:delete H.defaults.headers.common.Authorization},He="authifyer_refresh_token",qe=t=>{try{t?localStorage.setItem(He,t):localStorage.removeItem(He)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},vt=()=>{try{return localStorage.getItem(He)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function ln(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function un(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ln(e)}catch{return atob(e)}}function fn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=un(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const dn=t=>{try{const e=fn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class hn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(H.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners();try{const r=(await H.get(`/public/config/${this.publishableKey}`)).data,n=[];r.isGoogleOauthEnabled&&n.push("google"),r.isGithubOauthEnabled&&n.push("github"),this.config={emailPasswordEnabled:r.isEmailPassEnabled,oauthProviders:n}}catch(e){console.warn("Authifyer: Failed to fetch public project configuration. Using default defaults.",e),this.config={emailPasswordEnabled:!0,oauthProviders:["google","github"]}}await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await H.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await H.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await H.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=vt(),r=await H.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&qe(s)}catch{this.clearSession()}}async rotateSession(){try{const e=vt();await H.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&qe(e.refreshToken||e.refresh_token)}setSession(e){const r=dn(e);r&&(this.session=r,jt(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,jt(null),qe(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const kt=S.createContext(void 0),pn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new hn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,w]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),w(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(kt.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(kt);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},mn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},yn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},bn=()=>{const{client:t}=te();return t},ze=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),gn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],w=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(ze,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:w,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},En=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),w=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(ze,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(ze,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&w&&y.jsx("div",{className:"authifyer-divider",children:"or"}),w&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=pn,N.SignIn=gn,N.SignUp=En,N.useAuth=te,N.useAuthifyer=bn,N.useSession=yn,N.useUser=mn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
22
+ <%s key={someKey} {...props} />`,_,C,ne,C),Ne[C+_]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(E)&&(r(E.key),C=""+E.key),"key"in E){A={};for(var $e in E)$e!=="key"&&(A[$e]=E[$e])}else A=E;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,Ve)}function m(l){w(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?w(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function w(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),Oe=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!1,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)},oe.jsxs=function(l,E,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!0,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)}})()),oe}var Xe;function Mt(){return Xe||(Xe=1,process.env.NODE_ENV==="production"?q.exports=Bt():q.exports=Dt()),q.exports}var y=Mt();function Ge(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ht}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Qe}=Symbol,be=(t=>e=>{const r=Ht.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ze=D("ArrayBuffer");function qt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ze(t.buffer),e}const zt=ge("string"),k=ge("function"),et=ge("number"),ae=t=>t!==null&&typeof t=="object",Wt=t=>t===!0||t===!1,Ee=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Qe in t)&&!(ye in t)},Jt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Vt=D("Date"),$t=D("File"),Kt=D("Blob"),Yt=D("FileList"),Xt=t=>ae(t)&&k(t.pipe),Gt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Qt=D("URLSearchParams"),[Zt,er,tr,rr]=["ReadableStream","Request","Response","Headers"].map(D),nr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function tt(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,rt=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=rt(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&tt(r,o)||o;Ee(r[i])&&Ee(s)?r[i]=Pe(r[i],s):Ee(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const sr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ge(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),or=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),ir=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},ar=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},cr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},lr=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!et(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},ur=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),fr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},dr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},hr=D("HTMLFormElement"),pr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),nt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),mr=D("RegExp"),st=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},yr=t=>{st(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},br=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},gr=()=>{},Er=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function wr(t){return!!(t&&k(t.append)&&t[Qe]==="FormData"&&t[ye])}const Rr=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Sr=D("AsyncFunction"),Tr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),ot=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Ar=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||ot,a={isArray:Z,isArrayBuffer:Ze,isBuffer:ie,isFormData:Gt,isArrayBufferView:qt,isString:zt,isNumber:et,isBoolean:Wt,isObject:ae,isPlainObject:Ee,isEmptyObject:Jt,isReadableStream:Zt,isRequest:er,isResponse:tr,isHeaders:rr,isUndefined:ee,isDate:Vt,isFile:$t,isBlob:Kt,isRegExp:mr,isFunction:k,isStream:Xt,isURLSearchParams:Qt,isTypedArray:ur,isFileList:Yt,forEach:ce,merge:Pe,extend:sr,trim:nr,stripBOM:or,inherits:ir,toFlatObject:ar,kindOf:be,kindOfTest:D,endsWith:cr,toArray:lr,forEachEntry:fr,matchAll:dr,isHTMLForm:hr,hasOwnProperty:nt,hasOwnProp:nt,reduceDescriptors:st,freezeMethods:yr,toObjectSet:br,toCamelCase:pr,noop:gr,toFiniteNumber:Er,findKey:tt,global:K,isContextDefined:rt,isSpecCompliantForm:wr,toJSONObject:Rr,isAsyncFn:Sr,isThenable:Tr,setImmediate:ot,asap:Ar,isIterable:t=>t!=null&&k(t[ye])};let g=class It extends Error{static from(e,r,n,s,o,i){const c=new It(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),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:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const _r=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function it(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function at(t,e,r){return t?t.concat(e).map(function(s,o){return s=it(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Or(t){return a.isArray(t)&&!t.some(je)}const xr=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function we(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Or(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=it(b),T.forEach(function(x,v){!(a.isUndefined(x)||x===null)&&e.append(i===!0?at([b],v,o):i===null?b:b+"[]",d(x))}),!1}return je(f)?!0:(e.append(at(h,b,o),d(f)),!1)}const m=[],w=Object.assign(xr,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,w))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function ct(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&we(t,this,e)}const lt=ve.prototype;lt.append=function(e,r){this._pairs.push([e,r])},lt.toString=function(e){const r=e?function(n){return e.call(this,n,ct)}:ct;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Nr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ut(t,e,r){if(!e)return t;const n=r&&r.encode||Nr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class ft{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,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&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Cr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Pr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),jr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Pr,hasStandardBrowserWebWorkerEnv:jr,navigator:Ue,origin:vr},Symbol.toStringTag,{value:"Module"})),...Cr};function kr(t,e){return we(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Lr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ur(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function dt(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=Ur(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(Lr(n),s,r,0)}),r}return null}function Ir(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(dt(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return kr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return we(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Ir(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Fr=a.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"]),Br=t=>{const e={};let r,n,s;return t&&t.split(`
23
+ `).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Fr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ht=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function Dr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Mr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ie(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Hr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function qr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function o(c,p,d){const u=ue(p);if(!u)throw new Error("header name must be a non-empty string");const m=a.findKey(s,u);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||p]=Re(c))}const i=(c,p)=>a.forEach(c,(d,u)=>o(d,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Mr(e))i(Br(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,d;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[d=u[0]]=(p=c[d])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=ue(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Dr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ue(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Ie(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function o(i){if(i=ue(i),i){const c=a.findKey(n,i);c&&(!r||Ie(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!e||Ie(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,o)=>{const i=a.findKey(n,o);if(i){r[i]=Re(s),delete r[o];return}const c=e?Hr(o):String(o).trim();c!==o&&delete r[o],r[c]=Re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
24
+ `)}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,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ht]=this[ht]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(qr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Fe(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function pt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function mt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function zr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Wr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,w=0;for(;m!==s;)w+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(w*1e3/R):void 0}}function Jr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=Wr(50,250);return Jr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},yt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},bt=t=>(...e)=>a.asap(()=>t(...e)),Vr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,$r=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Yr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function gt(t,e,r){let n=!Kr(e);return t&&(n||r==!1)?Yr(t,e):e}const Et=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,w){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:w},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,w){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,w)}else return n(d,u,m,w)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,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,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(Et(d),Et(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,w=m(t[u],e[u],u);a.isUndefined(w)&&m!==c||(r[u]=w)}),r}const wt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ut(gt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Vr(e.url))){const p=s&&o&&$r.read(o);p&&i.set(s,p)}return e},Xr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=wt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,w,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const x=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:t,request:h};mt(function(I){r(I),b()},function(I){n(I),b()},F),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const F=v&&v.message?v.message:"Network Error",z=new g(F,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,F.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,F){h.setRequestHeader(F,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([w,f]=Se(d,!0),h.addEventListener("progress",w)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=x=>{h&&(n(!x||x.type?new fe(null,t,h):x),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=zr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Gr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Qr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Zr=async function*(t,e){for await(const r of en(t))yield*Qr(r,e)},en=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Rt=(t,e,r,n)=>{const s=Zr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let w=o+=m;r(w)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},St=64*1024,{isFunction:Te}=a,tn=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Tt,TextEncoder:At}=a.global,_t=(t,...e)=>{try{return!!t(...e)}catch{return!1}},rn=t=>{t=a.merge.call({skipUndefined:!0},tn,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Tt),p=s&&(typeof At=="function"?(f=>b=>f.encode(b))(new At):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&_t(()=>{let f=!1;const b=new r(j.origin,{body:new Tt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&_t(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??w(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:x,timeout:v,onDownloadProgress:F,onUploadProgress:z,responseType:I,headers:he,withCredentials:J="same-origin",fetchOptions:Oe}=wt(f),xe=e||fetch;I=I?(I+"").toLowerCase():"text";let V=Gr([U,x&&x.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),E;if(a.isFormData(T)&&(E=l.headers.get("content-type"))&&he.setContentType(E),l.body){const[A,_]=yt(re,Se(bt(z)));T=Rt(l.body,St,A,_)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={...Oe,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?xe($,Oe):xe(b,pe));const me=u&&(I==="stream"||I==="response");if(u&&(F||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const E=a.toFiniteNumber(M.headers.get("content-length")),[A,_]=F&&yt(E,Se(bt(F),!0))||[];M=new n(Rt(M.body,St,A,()=>{_&&_(),W&&W()}),l)}I=I||"text";let Ne=await m[a.findKey(m,I)||"text"](M,f);return!me&&W&&W(),await new Promise((l,E)=>{mt(l,E,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},nn=new Map,Ot=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=nn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:rn(e)),u=d;return d};Ot();const Be={http:_r,xhr:Xr,fetch:{get:Ot}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const xt=t=>`- ${t}`,sn=t=>a.isFunction(t)||t===null||t===!1;function on(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!sn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
25
+ `+i.map(xt).join(`
26
+ `):" "+xt(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Nt={getAdapter:on,adapters:Be};function De(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function Ct(t){return De(t),t.headers=L.from(t.headers),t.data=Fe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Nt.getAdapter(t.adapter||le.adapter,t)(t).then(function(n){return De(t),n.data=Fe.call(t,t.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return pt(n)||(De(t),n&&n.response&&(n.response.data=Fe.call(t,t.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const Pt="1.13.5",Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const jt={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+Pt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!jt[i]&&(jt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}},Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function an(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const o=n[s],i=e[o];if(i){const c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const _e={assertOptions:an,validators:Ae},B=_e.validators;let X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ft,response:new ft}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
27
+ `+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&_e.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:_e.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),_e.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,w;if(!p){const f=[Ct.bind(this),void 0];for(f.unshift(...c),f.push(...d),w=f.length,u=Promise.resolve(r);m<w;)u=u.then(f[m++],f[m++]);return u}w=c.length;let R=r;for(;m<w;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=Ct.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,w=d.length;m<w;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=gt(e.baseURL,e.url,e.allowAbsoluteUrls);return ut(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let cn=class Ft{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(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;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ft(function(s){e=s}),cancel:e}}};function ln(t){return function(r){return t.apply(null,r)}}function un(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={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(Me).forEach(([t,e])=>{Me[e]=t});function vt(t){const e=new X(t),r=Ge(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return vt(Y(t,s))},r}const O=vt(le);O.Axios=X,O.CanceledError=fe,O.CancelToken=cn,O.isCancel=pt,O.VERSION=Pt,O.toFormData=we,O.AxiosError=g,O.Cancel=O.CanceledError,O.all=function(e){return Promise.all(e)},O.spread=ln,O.isAxiosError=un,O.mergeConfig=Y,O.AxiosHeaders=L,O.formToJSON=t=>dt(a.isHTMLForm(t)?new FormData(t):t),O.getAdapter=Nt.getAdapter,O.HttpStatusCode=Me,O.default=O;const{Axios:jn,AxiosError:vn,CanceledError:kn,isCancel:Ln,CancelToken:Un,VERSION:In,all:Fn,Cancel:Bn,isAxiosError:Dn,spread:Mn,toFormData:Hn,AxiosHeaders:qn,HttpStatusCode:zn,formToJSON:Wn,getAdapter:Jn,mergeConfig:Vn}=O,H=O.create({baseURL:"https://authifyer-backend.onrender.com",headers:{"Content-Type":"application/json"}}),He="authifyer_access_token",qe=t=>{try{t?(localStorage.setItem(He,t),H.defaults.headers.common.Authorization=`Bearer ${t}`):(localStorage.removeItem(He),delete H.defaults.headers.common.Authorization)}catch(e){console.warn("Authifyer: localStorage is not accessible.",e)}},fn=()=>{try{return localStorage.getItem(He)}catch{return null}},ze="authifyer_refresh_token",We=t=>{try{t?localStorage.setItem(ze,t):localStorage.removeItem(ze)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},kt=()=>{try{return localStorage.getItem(ze)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function dn(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function hn(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return dn(e)}catch{return atob(e)}}function pn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=hn(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const Lt=t=>{try{const e=pn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class mn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(H.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners();try{const n=(await H.get(`/public/config/${this.publishableKey}`)).data,s=[];n.isGoogleOauthEnabled&&s.push("google"),n.isGithubOauthEnabled&&s.push("github"),this.config={emailPasswordEnabled:n.isEmailPassEnabled,oauthProviders:s}}catch(r){console.warn("Authifyer: Failed to fetch public project configuration. Using defaults.",r),this.config={emailPasswordEnabled:!0,oauthProviders:["google","github"]}}const e=fn();if(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer())}this.session||await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await H.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await H.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await H.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=kt(),r=await H.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&We(s)}catch{this.clearSession()}}async rotateSession(){try{const e=kt();await H.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&We(e.refreshToken||e.refresh_token)}setSession(e){const r=Lt(e);r&&(this.session=r,qe(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,qe(null),We(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const Ut=S.createContext(void 0),yn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new mn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,w]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),w(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(Ut.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(Ut);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},bn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},gn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},En=()=>{const{client:t}=te();return t},Je=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),wn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],w=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(Je,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:w,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},Rn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),w=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(Je,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(Je,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&w&&y.jsx("div",{className:"authifyer-divider",children:"or"}),w&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=yn,N.SignIn=wn,N.SignUp=Rn,N.useAuth=te,N.useAuthifyer=En,N.useSession=gn,N.useUser=bn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authifyer-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "dist/authifyer-sdk.umd.js",
5
5
  "module": "dist/authifyer-sdk.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/core/api.ts CHANGED
@@ -1,25 +1,44 @@
1
1
  import axios from 'axios';
2
2
 
3
- // Default to the production Authifyer backend.
3
+ // Default to the production Authifyer backend.
4
4
  // Developers can override this via AuthifyerProvider's backendUrl prop if they are self-hosting.
5
5
  const BASE_URL = 'https://authifyer-backend.onrender.com'; // Default production backend URL
6
6
 
7
7
  export const api = axios.create({
8
8
  baseURL: BASE_URL,
9
- withCredentials: true, // Kept for legacy compatibility if cookies are ever used
10
9
  headers: {
11
10
  'Content-Type': 'application/json',
12
11
  },
13
12
  });
14
13
 
14
+ // --- Access Token (short-lived JWT) ---
15
+
16
+ const ACCESS_TOKEN_KEY = 'authifyer_access_token';
17
+
15
18
  export const setAuthToken = (token: string | null) => {
16
- if (token) {
17
- api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
18
- } else {
19
- delete api.defaults.headers.common['Authorization'];
19
+ try {
20
+ if (token) {
21
+ localStorage.setItem(ACCESS_TOKEN_KEY, token);
22
+ api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
23
+ } else {
24
+ localStorage.removeItem(ACCESS_TOKEN_KEY);
25
+ delete api.defaults.headers.common['Authorization'];
26
+ }
27
+ } catch (e) {
28
+ console.warn('Authifyer: localStorage is not accessible.', e);
20
29
  }
21
30
  };
22
31
 
32
+ export const getAuthToken = (): string | null => {
33
+ try {
34
+ return localStorage.getItem(ACCESS_TOKEN_KEY);
35
+ } catch (e) {
36
+ return null;
37
+ }
38
+ };
39
+
40
+ // --- Refresh Token (long-lived) ---
41
+
23
42
  const REFRESH_TOKEN_KEY = 'authifyer_refresh_token';
24
43
 
25
44
  export const setRefreshToken = (token: string | null) => {
@@ -1,4 +1,4 @@
1
- import { api, setAuthToken, setRefreshToken, getRefreshToken } from './api';
1
+ import { api, setAuthToken, getAuthToken, setRefreshToken, getRefreshToken } from './api';
2
2
  import { ProjectConfig, Session } from './types';
3
3
  import { parseToken } from '@/utils/token';
4
4
 
@@ -40,16 +40,29 @@ export class AuthifyerClient {
40
40
  oauthProviders
41
41
  };
42
42
  } catch (configError) {
43
- console.warn("Authifyer: Failed to fetch public project configuration. Using default defaults.", configError);
44
- // Fallback config if endpoint fails or key is invalid at this stage
43
+ console.warn("Authifyer: Failed to fetch public project configuration. Using defaults.", configError);
45
44
  this.config = {
46
45
  emailPasswordEnabled: true,
47
46
  oauthProviders: ['google', 'github']
48
47
  };
49
48
  }
50
49
 
51
- // 2. Refresh Session
52
- await this.refreshSession();
50
+ // 2. Restore session from localStorage (access token)
51
+ const storedToken = getAuthToken();
52
+ if (storedToken) {
53
+ const session = parseToken(storedToken);
54
+ if (session) {
55
+ // Token is still valid, restore it
56
+ this.session = session;
57
+ setAuthToken(storedToken); // Re-set the Authorization header
58
+ this.startRefreshTimer();
59
+ }
60
+ }
61
+
62
+ // 3. If no valid stored session, try to refresh using refresh token
63
+ if (!this.session) {
64
+ await this.refreshSession();
65
+ }
53
66
 
54
67
  } catch (error) {
55
68
  console.error("Failed to load Authifyer client", error);