@neuctra/authix 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authix.css +1 -1
- package/dist/neuctra-authix.es.js +1352 -1240
- package/dist/neuctra-authix.umd.js +17 -17
- package/dist/src/react/UserSignUp.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(te,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(te=typeof globalThis<"u"?globalThis:te||self,b(te.NeuctraAuthix={},te.React))})(this,(function(te,b){"use strict";function dt(e,t){return function(){return e.apply(t,arguments)}}const{toString:lr}=Object.prototype,{getPrototypeOf:Ve}=Object,{iterator:Oe,toStringTag:ut}=Symbol,_e=(e=>t=>{const r=lr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),se=e=>(e=e.toLowerCase(),t=>_e(t)===e),Ae=e=>t=>typeof t===e,{isArray:ye}=Array,be=Ae("undefined");function ve(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const pt=se("ArrayBuffer");function cr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&pt(e.buffer),t}const dr=Ae("string"),re=Ae("function"),ft=Ae("number"),ke=e=>e!==null&&typeof e=="object",ur=e=>e===!0||e===!1,ze=e=>{if(_e(e)!=="object")return!1;const t=Ve(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ut in e)&&!(Oe in e)},pr=e=>{if(!ke(e)||ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},fr=se("Date"),xr=se("File"),hr=se("Blob"),gr=se("FileList"),mr=e=>ke(e)&&re(e.pipe),yr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=_e(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},br=se("URLSearchParams"),[wr,Sr,jr,vr]=["ReadableStream","Request","Response","Headers"].map(se),kr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),ye(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(ve(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let l;for(s=0;s<a;s++)l=i[s],t.call(null,e[l],l,e)}}function xt(e,t){if(ve(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,o;for(;s-- >0;)if(o=r[s],t===o.toLowerCase())return o;return null}const de=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ht=e=>!be(e)&&e!==de;function Ye(){const{caseless:e,skipUndefined:t}=ht(this)&&this||{},r={},s=(o,i)=>{const a=e&&xt(r,i)||i;ze(r[a])&&ze(o)?r[a]=Ye(r[a],o):ze(o)?r[a]=Ye({},o):ye(o)?r[a]=o.slice():(!t||!be(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&Ee(arguments[o],s);return r}const Er=(e,t,r,{allOwnKeys:s}={})=>(Ee(t,(o,i)=>{r&&re(o)?e[i]=dt(o,r):e[i]=o},{allOwnKeys:s}),e),Cr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tr=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Rr=(e,t,r,s)=>{let o,i,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!s||s(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=r!==!1&&Ve(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ir=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Pr=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!ft(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Or=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ve(Uint8Array)),_r=(e,t)=>{const s=(e&&e[Oe]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},Ar=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},zr=se("HTMLFormElement"),Nr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),gt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ur=se("RegExp"),mt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ee(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Dr=e=>{mt(e,(t,r)=>{if(re(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(re(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Fr=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Lr=()=>{},Mr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Br(e){return!!(e&&re(e.append)&&e[ut]==="FormData"&&e[Oe])}const Wr=e=>{const t=new Array(10),r=(s,o)=>{if(ke(s)){if(t.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ee(s,(a,l)=>{const g=r(a,o+1);!be(g)&&(i[l]=g)}),t[o]=void 0,i}}return s};return r(e,0)},Hr=se("AsyncFunction"),$r=e=>e&&(ke(e)||re(e))&&re(e.then)&&re(e.catch),yt=((e,t)=>e?setImmediate:t?((r,s)=>(de.addEventListener("message",({source:o,data:i})=>{o===de&&i===r&&s.length&&s.shift()()},!1),o=>{s.push(o),de.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(de.postMessage)),Vr=typeof queueMicrotask<"u"?queueMicrotask.bind(de):typeof process<"u"&&process.nextTick||yt,u={isArray:ye,isArrayBuffer:pt,isBuffer:ve,isFormData:yr,isArrayBufferView:cr,isString:dr,isNumber:ft,isBoolean:ur,isObject:ke,isPlainObject:ze,isEmptyObject:pr,isReadableStream:wr,isRequest:Sr,isResponse:jr,isHeaders:vr,isUndefined:be,isDate:fr,isFile:xr,isBlob:hr,isRegExp:Ur,isFunction:re,isStream:mr,isURLSearchParams:br,isTypedArray:Or,isFileList:gr,forEach:Ee,merge:Ye,extend:Er,trim:kr,stripBOM:Cr,inherits:Tr,toFlatObject:Rr,kindOf:_e,kindOfTest:se,endsWith:Ir,toArray:Pr,forEachEntry:_r,matchAll:Ar,isHTMLForm:zr,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Dr,toObjectSet:Fr,toCamelCase:Nr,noop:Lr,toFiniteNumber:Mr,findKey:xt,global:de,isContextDefined:ht,isSpecCompliantForm:Br,toJSONObject:Wr,isAsyncFn:Hr,isThenable:$r,setImmediate:yt,asap:Vr,isIterable:e=>e!=null&&re(e[Oe])};function A(e,t,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}u.inherits(A,Error,{toJSON:function(){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:u.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=A.prototype,wt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{wt[e]={value:e}}),Object.defineProperties(A,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),A.from=(e,t,r,s,o,i)=>{const a=Object.create(bt);u.toFlatObject(e,a,function(c){return c!==Error.prototype},p=>p!=="isAxiosError");const l=e&&e.message?e.message:"Error",g=t==null&&e?e.code:t;return A.call(a,l,g,r,s,o),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",i&&Object.assign(a,i),a};const Yr=null;function qe(e){return u.isPlainObject(e)||u.isArray(e)}function St(e){return u.endsWith(e,"[]")?e.slice(0,-2):e}function jt(e,t,r){return e?e.concat(t).map(function(o,i){return o=St(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function qr(e){return u.isArray(e)&&!e.some(qe)}const Kr=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Ne(e,t,r){if(!u.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=u.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,h){return!u.isUndefined(h[S])});const s=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,g=(r.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(t);if(!u.isFunction(o))throw new TypeError("visitor must be a function");function p(d){if(d===null)return"";if(u.isDate(d))return d.toISOString();if(u.isBoolean(d))return d.toString();if(!g&&u.isBlob(d))throw new A("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(d)||u.isTypedArray(d)?g&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,S,h){let U=d;if(d&&!h&&typeof d=="object"){if(u.endsWith(S,"{}"))S=s?S:S.slice(0,-2),d=JSON.stringify(d);else if(u.isArray(d)&&qr(d)||(u.isFileList(d)||u.endsWith(S,"[]"))&&(U=u.toArray(d)))return S=St(S),U.forEach(function(P,E){!(u.isUndefined(P)||P===null)&&t.append(a===!0?jt([S],E,i):a===null?S:S+"[]",p(P))}),!1}return qe(d)?!0:(t.append(jt(h,S,i),p(d)),!1)}const m=[],I=Object.assign(Kr,{defaultVisitor:c,convertValue:p,isVisitable:qe});function j(d,S){if(!u.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(d),u.forEach(d,function(U,z){(!(u.isUndefined(U)||U===null)&&o.call(t,U,u.isString(z)?z.trim():z,S,I))===!0&&j(U,S?S.concat(z):[z])}),m.pop()}}if(!u.isObject(e))throw new TypeError("data must be an object");return j(e),t}function vt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ke(e,t){this._pairs=[],e&&Ne(e,this,t)}const kt=Ke.prototype;kt.append=function(t,r){this._pairs.push([t,r])},kt.toString=function(t){const r=t?function(s){return t.call(this,s,vt)}:vt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Jr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Et(e,t,r){if(!t)return e;const s=r&&r.encode||Jr;u.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=u.isURLSearchParams(t)?t.toString():new Ke(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ct{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){u.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ke,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Je=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Gr=Je&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Zr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qr=Je&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Je,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Zr,navigator:Xe,origin:Qr},Symbol.toStringTag,{value:"Module"})),...Xr};function en(e,t){return Ne(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,i){return ee.isNode&&u.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function tn(e){return u.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function rn(e){const t={},r=Object.keys(e);let s;const o=r.length;let i;for(s=0;s<o;s++)i=r[s],t[i]=e[i];return t}function Rt(e){function t(r,s,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),g=i>=r.length;return a=!a&&u.isArray(o)?o.length:a,g?(u.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!u.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&u.isArray(o[a])&&(o[a]=rn(o[a])),!l)}if(u.isFormData(e)&&u.isFunction(e.entries)){const r={};return u.forEachEntry(e,(s,o)=>{t(tn(s),o,r,0)}),r}return null}function nn(e,t,r){if(u.isString(e))try{return(t||JSON.parse)(e),u.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Ce={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=u.isObject(t);if(i&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return o?JSON.stringify(Rt(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return en(t,this.formSerializer).toString();if((l=u.isFileList(t))||s.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return Ne(l?{"files[]":t}:t,g&&new g,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const r=this.transitional||Ce.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(s&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?A.from(l,A.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ee.classes.FormData,Blob:ee.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],e=>{Ce.headers[e]={}});const sn=u.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"]),on=e=>{const t={};let r,s,o;return e&&e.split(`
|
|
2
|
-
`).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),s=a.substring(o+1).trim(),!(!r||t[r]&&sn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},It=Symbol("internals");function Te(e){return e&&String(e).trim().toLowerCase()}function Ue(e){return e===!1||e==null?e:
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[It]=this[It]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Te(a);s[l]||(dn(o,a),s[l]=!0)}return u.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),u.freezeMethods(ne);function Ze(e,t){const r=this||Ce,s=t||r,o=ne.from(s.headers);let i=s.data;return u.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Pt(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){A.call(this,e??"canceled",A.ERR_CANCELED,t,r),this.name="CanceledError"}u.inherits(we,A,{__CANCEL__:!0});function Ot(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new A("Request failed with status code "+r.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function un(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(e,t){e=e||10;const r=new Array(e),s=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),c=s[i];a||(a=p),r[o]=g,s[o]=p;let m=i,I=0;for(;m!==o;)I+=r[m++],m=m%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),p-a<t)return;const j=c&&p-c;return j?Math.round(I*1e3/j):void 0}}function fn(e,t){let r=0,s=1e3/t,o,i;const a=(p,c=Date.now())=>{r=c,o=null,i&&(clearTimeout(i),i=null),e(...p)};return[(...p)=>{const c=Date.now(),m=c-r;m>=s?a(p,c):(o=p,i||(i=setTimeout(()=>{i=null,a(o)},s-m)))},()=>o&&a(o)]}const De=(e,t,r=3)=>{let s=0;const o=pn(50,250);return fn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,g=a-s,p=o(g),c=a<=l;s=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:g,rate:p||void 0,estimated:p&&l&&c?(l-a)/p:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},r)},_t=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},At=e=>(...t)=>u.asap(()=>e(...t)),xn=ee.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ee.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,hn=ee.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];u.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),u.isString(s)&&a.push("path="+s),u.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function gn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function mn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function zt(e,t,r){let s=!gn(t);return e&&(s||r==!1)?mn(e,t):t}const Nt=e=>e instanceof ne?{...e}:e;function ue(e,t){t=t||{};const r={};function s(p,c,m,I){return u.isPlainObject(p)&&u.isPlainObject(c)?u.merge.call({caseless:I},p,c):u.isPlainObject(c)?u.merge({},c):u.isArray(c)?c.slice():c}function o(p,c,m,I){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p,m,I)}else return s(p,c,m,I)}function i(p,c){if(!u.isUndefined(c))return s(void 0,c)}function a(p,c){if(u.isUndefined(c)){if(!u.isUndefined(p))return s(void 0,p)}else return s(void 0,c)}function l(p,c,m){if(m in t)return s(p,c);if(m in e)return s(void 0,p)}const g={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(p,c,m)=>o(Nt(p),Nt(c),m,!0)};return u.forEach(Object.keys({...e,...t}),function(c){const m=g[c]||o,I=m(e[c],t[c],c);u.isUndefined(I)&&m!==l||(r[c]=I)}),r}const Ut=e=>{const t=ue({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=ne.from(a),t.url=Et(zt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),u.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(u.isFunction(r.getHeaders)){const g=r.getHeaders(),p=["content-type","content-length"];Object.entries(g).forEach(([c,m])=>{p.includes(c.toLowerCase())&&a.set(c,m)})}}if(ee.hasStandardBrowserEnv&&(s&&u.isFunction(s)&&(s=s(t)),s||s!==!1&&xn(t.url))){const g=o&&i&&hn.read(i);g&&a.set(o,g)}return t},yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Ut(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:p}=o,c,m,I,j,d;function S(){j&&j(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let h=new XMLHttpRequest;h.open(o.method.toUpperCase(),o.url,!0),h.timeout=o.timeout;function U(){if(!h)return;const P=ne.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:P,config:e,request:h};Ot(function(O){r(O),S()},function(O){s(O),S()},M),h=null}"onloadend"in h?h.onloadend=U:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(U)},h.onabort=function(){h&&(s(new A("Request aborted",A.ECONNABORTED,e,h)),h=null)},h.onerror=function(E){const M=E&&E.message?E.message:"Network Error",y=new A(M,A.ERR_NETWORK,e,h);y.event=E||null,s(y),h=null},h.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||Tt;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),s(new A(E,M.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,e,h)),h=null},i===void 0&&a.setContentType(null),"setRequestHeader"in h&&u.forEach(a.toJSON(),function(E,M){h.setRequestHeader(M,E)}),u.isUndefined(o.withCredentials)||(h.withCredentials=!!o.withCredentials),l&&l!=="json"&&(h.responseType=o.responseType),p&&([I,d]=De(p,!0),h.addEventListener("progress",I)),g&&h.upload&&([m,j]=De(g),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",j)),(o.cancelToken||o.signal)&&(c=P=>{h&&(s(!P||P.type?new we(null,e,h):P),h.abort(),h=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const z=un(o.url);if(z&&ee.protocols.indexOf(z)===-1){s(new A("Unsupported protocol "+z+":",A.ERR_BAD_REQUEST,e));return}h.send(i||null)})},bn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(p){if(!o){o=!0,l();const c=p instanceof Error?p:this.reason;s.abort(c instanceof A?c:new we(c instanceof Error?c.message:c))}};let a=t&&setTimeout(()=>{a=null,i(new A(`timeout ${t} of ms exceeded`,A.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),e=null)};e.forEach(p=>p.addEventListener("abort",i));const{signal:g}=s;return g.unsubscribe=()=>u.asap(l),g}},wn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,o;for(;s<r;)o=s+t,yield e.slice(s,o),s=o},Sn=async function*(e,t){for await(const r of jn(e))yield*wn(r,t)},jn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Dt=(e,t,r,s)=>{const o=Sn(e,t);let i=0,a,l=g=>{a||(a=!0,s&&s(g))};return new ReadableStream({async pull(g){try{const{done:p,value:c}=await o.next();if(p){l(),g.close();return}let m=c.byteLength;if(r){let I=i+=m;r(I)}g.enqueue(new Uint8Array(c))}catch(p){throw l(p),p}},cancel(g){return l(g),o.return()}},{highWaterMark:2})},Ft=64*1024,{isFunction:Fe}=u,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(u.global),{ReadableStream:Lt,TextEncoder:Mt}=u.global,Bt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kn=e=>{e=u.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Fe(t):typeof fetch=="function",i=Fe(r),a=Fe(s);if(!o)return!1;const l=o&&Fe(Lt),g=o&&(typeof Mt=="function"?(d=>S=>d.encode(S))(new Mt):async d=>new Uint8Array(await new r(d).arrayBuffer())),p=i&&l&&Bt(()=>{let d=!1;const S=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!S}),c=a&&l&&Bt(()=>u.isReadableStream(new s("").body)),m={stream:c&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(S,h)=>{let U=S&&S[d];if(U)return U.call(S);throw new A(`Response type '${d}' is not supported`,A.ERR_NOT_SUPPORT,h)})});const I=async d=>{if(d==null)return 0;if(u.isBlob(d))return d.size;if(u.isSpecCompliantForm(d))return(await new r(ee.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(u.isArrayBufferView(d)||u.isArrayBuffer(d))return d.byteLength;if(u.isURLSearchParams(d)&&(d=d+""),u.isString(d))return(await g(d)).byteLength},j=async(d,S)=>{const h=u.toFiniteNumber(d.getContentLength());return h??I(S)};return async d=>{let{url:S,method:h,data:U,signal:z,cancelToken:P,timeout:E,onDownloadProgress:M,onUploadProgress:y,responseType:O,headers:w,withCredentials:N="same-origin",fetchOptions:J}=Ut(d),F=t||fetch;O=O?(O+"").toLowerCase():"text";let V=bn([z,P&&P.toAbortSignal()],E),Q=null;const k=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let G;try{if(y&&p&&h!=="get"&&h!=="head"&&(G=await j(w,U))!==0){let x=new r(S,{method:"POST",body:U,duplex:"half"}),R;if(u.isFormData(U)&&(R=x.headers.get("content-type"))&&w.setContentType(R),x.body){const[D,f]=_t(G,De(At(y)));U=Dt(x.body,Ft,D,f)}}u.isString(N)||(N=N?"include":"omit");const B=i&&"credentials"in r.prototype,L={...J,signal:V,method:h.toUpperCase(),headers:w.normalize().toJSON(),body:U,duplex:"half",credentials:B?N:void 0};Q=i&&new r(S,L);let T=await(i?F(Q,J):F(S,L));const Y=c&&(O==="stream"||O==="response");if(c&&(M||Y&&k)){const x={};["status","statusText","headers"].forEach(v=>{x[v]=T[v]});const R=u.toFiniteNumber(T.headers.get("content-length")),[D,f]=M&&_t(R,De(At(M),!0))||[];T=new s(Dt(T.body,Ft,D,()=>{f&&f(),k&&k()}),x)}O=O||"text";let K=await m[u.findKey(m,O)||"text"](T,d);return!Y&&k&&k(),await new Promise((x,R)=>{Ot(x,R,{data:K,headers:ne.from(T.headers),status:T.status,statusText:T.statusText,config:d,request:Q})})}catch(B){throw k&&k(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,d,Q),{cause:B.cause||B}):A.from(B,B&&B.code,d,Q)}}},En=new Map,Wt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:o}=t,i=[s,o,r];let a=i.length,l=a,g,p,c=En;for(;l--;)g=i[l],p=c.get(g),p===void 0&&c.set(g,p=l?new Map:kn(t)),c=p;return p};Wt();const Qe={http:Yr,xhr:yn,fetch:{get:Wt}};u.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ht=e=>`- ${e}`,Cn=e=>u.isFunction(e)||e===null||e===!1,$t={getAdapter:(e,t)=>{e=u.isArray(e)?e:[e];const{length:r}=e;let s,o;const i={};for(let a=0;a<r;a++){s=e[a];let l;if(o=s,!Cn(s)&&(o=Qe[(l=String(s)).toLowerCase()],o===void 0))throw new A(`Unknown adapter '${l}'`);if(o&&(u.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([g,p])=>`adapter ${g} `+(p===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
|
|
1
|
+
(function(te,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(te=typeof globalThis<"u"?globalThis:te||self,b(te.NeuctraAuthix={},te.React))})(this,(function(te,b){"use strict";function dt(e,t){return function(){return e.apply(t,arguments)}}const{toString:lr}=Object.prototype,{getPrototypeOf:Ve}=Object,{iterator:Oe,toStringTag:ut}=Symbol,_e=(e=>t=>{const r=lr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),se=e=>(e=e.toLowerCase(),t=>_e(t)===e),ze=e=>t=>typeof t===e,{isArray:ye}=Array,be=ze("undefined");function ve(e){return e!==null&&!be(e)&&e.constructor!==null&&!be(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const pt=se("ArrayBuffer");function cr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&pt(e.buffer),t}const dr=ze("string"),re=ze("function"),ft=ze("number"),ke=e=>e!==null&&typeof e=="object",ur=e=>e===!0||e===!1,Ae=e=>{if(_e(e)!=="object")return!1;const t=Ve(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ut in e)&&!(Oe in e)},pr=e=>{if(!ke(e)||ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},fr=se("Date"),xr=se("File"),hr=se("Blob"),gr=se("FileList"),mr=e=>ke(e)&&re(e.pipe),yr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||re(e.append)&&((t=_e(e))==="formdata"||t==="object"&&re(e.toString)&&e.toString()==="[object FormData]"))},br=se("URLSearchParams"),[wr,Sr,jr,vr]=["ReadableStream","Request","Response","Headers"].map(se),kr=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),ye(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(ve(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let l;for(s=0;s<a;s++)l=i[s],t.call(null,e[l],l,e)}}function xt(e,t){if(ve(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,o;for(;s-- >0;)if(o=r[s],t===o.toLowerCase())return o;return null}const de=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ht=e=>!be(e)&&e!==de;function Ye(){const{caseless:e,skipUndefined:t}=ht(this)&&this||{},r={},s=(o,i)=>{const a=e&&xt(r,i)||i;Ae(r[a])&&Ae(o)?r[a]=Ye(r[a],o):Ae(o)?r[a]=Ye({},o):ye(o)?r[a]=o.slice():(!t||!be(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&Ee(arguments[o],s);return r}const Er=(e,t,r,{allOwnKeys:s}={})=>(Ee(t,(o,i)=>{r&&re(o)?e[i]=dt(o,r):e[i]=o},{allOwnKeys:s}),e),Cr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tr=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Rr=(e,t,r,s)=>{let o,i,a;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],(!s||s(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=r!==!1&&Ve(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ir=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Pr=e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!ft(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Or=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ve(Uint8Array)),_r=(e,t)=>{const s=(e&&e[Oe]).call(e);let o;for(;(o=s.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},zr=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},Ar=se("HTMLFormElement"),Nr=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,o){return s.toUpperCase()+o}),gt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ur=se("RegExp"),mt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Ee(r,(o,i)=>{let a;(a=t(o,i,e))!==!1&&(s[i]=a||o)}),Object.defineProperties(e,s)},Dr=e=>{mt(e,(t,r)=>{if(re(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(re(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Fr=(e,t)=>{const r={},s=o=>{o.forEach(i=>{r[i]=!0})};return ye(e)?s(e):s(String(e).split(t)),r},Lr=()=>{},Mr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Br(e){return!!(e&&re(e.append)&&e[ut]==="FormData"&&e[Oe])}const Wr=e=>{const t=new Array(10),r=(s,o)=>{if(ke(s)){if(t.indexOf(s)>=0)return;if(ve(s))return s;if(!("toJSON"in s)){t[o]=s;const i=ye(s)?[]:{};return Ee(s,(a,l)=>{const h=r(a,o+1);!be(h)&&(i[l]=h)}),t[o]=void 0,i}}return s};return r(e,0)},Hr=se("AsyncFunction"),$r=e=>e&&(ke(e)||re(e))&&re(e.then)&&re(e.catch),yt=((e,t)=>e?setImmediate:t?((r,s)=>(de.addEventListener("message",({source:o,data:i})=>{o===de&&i===r&&s.length&&s.shift()()},!1),o=>{s.push(o),de.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",re(de.postMessage)),Vr=typeof queueMicrotask<"u"?queueMicrotask.bind(de):typeof process<"u"&&process.nextTick||yt,p={isArray:ye,isArrayBuffer:pt,isBuffer:ve,isFormData:yr,isArrayBufferView:cr,isString:dr,isNumber:ft,isBoolean:ur,isObject:ke,isPlainObject:Ae,isEmptyObject:pr,isReadableStream:wr,isRequest:Sr,isResponse:jr,isHeaders:vr,isUndefined:be,isDate:fr,isFile:xr,isBlob:hr,isRegExp:Ur,isFunction:re,isStream:mr,isURLSearchParams:br,isTypedArray:Or,isFileList:gr,forEach:Ee,merge:Ye,extend:Er,trim:kr,stripBOM:Cr,inherits:Tr,toFlatObject:Rr,kindOf:_e,kindOfTest:se,endsWith:Ir,toArray:Pr,forEachEntry:_r,matchAll:zr,isHTMLForm:Ar,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:mt,freezeMethods:Dr,toObjectSet:Fr,toCamelCase:Nr,noop:Lr,toFiniteNumber:Mr,findKey:xt,global:de,isContextDefined:ht,isSpecCompliantForm:Br,toJSONObject:Wr,isAsyncFn:Hr,isThenable:$r,setImmediate:yt,asap:Vr,isIterable:e=>e!=null&&re(e[Oe])};function N(e,t,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(N,Error,{toJSON:function(){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:p.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=N.prototype,wt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{wt[e]={value:e}}),Object.defineProperties(N,wt),Object.defineProperty(bt,"isAxiosError",{value:!0}),N.from=(e,t,r,s,o,i)=>{const a=Object.create(bt);p.toFlatObject(e,a,function(c){return c!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return N.call(a,l,h,r,s,o),e&&a.cause==null&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",i&&Object.assign(a,i),a};const Yr=null;function qe(e){return p.isPlainObject(e)||p.isArray(e)}function St(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function jt(e,t,r){return e?e.concat(t).map(function(o,i){return o=St(o),!r&&i?"["+o+"]":o}).join(r?".":""):t}function qr(e){return p.isArray(e)&&!e.some(qe)}const Kr=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function Ne(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,m){return!p.isUndefined(m[w])});const s=r.metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function d(u){if(u===null)return"";if(p.isDate(u))return u.toISOString();if(p.isBoolean(u))return u.toString();if(!h&&p.isBlob(u))throw new N("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(u)||p.isTypedArray(u)?h&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function c(u,w,m){let F=u;if(u&&!m&&typeof u=="object"){if(p.endsWith(w,"{}"))w=s?w:w.slice(0,-2),u=JSON.stringify(u);else if(p.isArray(u)&&qr(u)||(p.isFileList(u)||p.endsWith(w,"[]"))&&(F=p.toArray(u)))return w=St(w),F.forEach(function(O,T){!(p.isUndefined(O)||O===null)&&t.append(a===!0?jt([w],T,i):a===null?w:w+"[]",d(O))}),!1}return qe(u)?!0:(t.append(jt(m,w,i),d(u)),!1)}const g=[],I=Object.assign(Kr,{defaultVisitor:c,convertValue:d,isVisitable:qe});function j(u,w){if(!p.isUndefined(u)){if(g.indexOf(u)!==-1)throw Error("Circular reference detected in "+w.join("."));g.push(u),p.forEach(u,function(F,P){(!(p.isUndefined(F)||F===null)&&o.call(t,F,p.isString(P)?P.trim():P,w,I))===!0&&j(F,w?w.concat(P):[P])}),g.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return j(e),t}function vt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ke(e,t){this._pairs=[],e&&Ne(e,this,t)}const kt=Ke.prototype;kt.append=function(t,r){this._pairs.push([t,r])},kt.toString=function(t){const r=t?function(s){return t.call(this,s,vt)}:vt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Jr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Et(e,t,r){if(!t)return e;const s=r&&r.encode||Jr;p.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(t,r):i=p.isURLSearchParams(t)?t.toString():new Ke(t,r).toString(s),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ct{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ke,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Je=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Gr=Je&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Zr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qr=Je&&window.location.href||"http://localhost",Q={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Je,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Zr,navigator:Xe,origin:Qr},Symbol.toStringTag,{value:"Module"})),...Xr};function en(e,t){return Ne(e,new Q.classes.URLSearchParams,{visitor:function(r,s,o,i){return Q.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function tn(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function rn(e){const t={},r=Object.keys(e);let s;const o=r.length;let i;for(s=0;s<o;s++)i=r[s],t[i]=e[i];return t}function Rt(e){function t(r,s,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),h=i>=r.length;return a=!a&&p.isArray(o)?o.length:a,h?(p.hasOwnProp(o,a)?o[a]=[o[a],s]:o[a]=s,!l):((!o[a]||!p.isObject(o[a]))&&(o[a]=[]),t(r,s,o[a],i)&&p.isArray(o[a])&&(o[a]=rn(o[a])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const r={};return p.forEachEntry(e,(s,o)=>{t(tn(s),o,r,0)}),r}return null}function nn(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const Ce={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,i=p.isObject(t);if(i&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Rt(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)||p.isReadableStream(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return en(t,this.formSerializer).toString();if((l=p.isFileList(t))||s.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ne(l?{"files[]":t}:t,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const r=this.transitional||Ce.transitional,s=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(s&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?N.from(l,N.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ce.headers[e]={}});const sn=p.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"]),on=e=>{const t={};let r,s,o;return e&&e.split(`
|
|
2
|
+
`).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),s=a.substring(o+1).trim(),!(!r||t[r]&&sn[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},It=Symbol("internals");function Te(e){return e&&String(e).trim().toLowerCase()}function Ue(e){return e===!1||e==null?e:p.isArray(e)?e.map(Ue):String(e)}function an(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}const ln=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ge(e,t,r,s,o){if(p.isFunction(s))return s.call(this,t,r);if(o&&(t=r),!!p.isString(t)){if(p.isString(s))return t.indexOf(s)!==-1;if(p.isRegExp(s))return s.test(t)}}function cn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function dn(e,t){const r=p.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(o,i,a){return this[s].call(this,t,o,i,a)},configurable:!0})})}let ne=class{constructor(t){t&&this.set(t)}set(t,r,s){const o=this;function i(l,h,d){const c=Te(h);if(!c)throw new Error("header name must be a non-empty string");const g=p.findKey(o,c);(!g||o[g]===void 0||d===!0||d===void 0&&o[g]!==!1)&&(o[g||h]=Ue(l))}const a=(l,h)=>p.forEach(l,(d,c)=>i(d,c,h));if(p.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(p.isString(t)&&(t=t.trim())&&!ln(t))a(on(t),r);else if(p.isObject(t)&&p.isIterable(t)){let l={},h,d;for(const c of t){if(!p.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[d=c[0]]=(h=l[d])?p.isArray(h)?[...h,c[1]]:[h,c[1]]:c[1]}a(l,r)}else t!=null&&i(r,t,s);return this}get(t,r){if(t=Te(t),t){const s=p.findKey(this,t);if(s){const o=this[s];if(!r)return o;if(r===!0)return an(o);if(p.isFunction(r))return r.call(this,o,s);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Te(t),t){const s=p.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Ge(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let o=!1;function i(a){if(a=Te(a),a){const l=p.findKey(s,a);l&&(!r||Ge(s,s[l],l,r))&&(delete s[l],o=!0)}}return p.isArray(t)?t.forEach(i):i(t),o}clear(t){const r=Object.keys(this);let s=r.length,o=!1;for(;s--;){const i=r[s];(!t||Ge(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const r=this,s={};return p.forEach(this,(o,i)=>{const a=p.findKey(s,i);if(a){r[a]=Ue(o),delete r[i];return}const l=t?cn(i):String(i).trim();l!==i&&delete r[i],r[l]=Ue(o),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return p.forEach(this,(s,o)=>{s!=null&&s!==!1&&(r[o]=t&&p.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[It]=this[It]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=Te(a);s[l]||(dn(o,a),s[l]=!0)}return p.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),p.freezeMethods(ne);function Ze(e,t){const r=this||Ce,s=t||r,o=ne.from(s.headers);let i=s.data;return p.forEach(e,function(l){i=l.call(r,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Pt(e){return!!(e&&e.__CANCEL__)}function we(e,t,r){N.call(this,e??"canceled",N.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(we,N,{__CANCEL__:!0});function Ot(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new N("Request failed with status code "+r.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function un(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(e,t){e=e||10;const r=new Array(e),s=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(h){const d=Date.now(),c=s[i];a||(a=d),r[o]=h,s[o]=d;let g=i,I=0;for(;g!==o;)I+=r[g++],g=g%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),d-a<t)return;const j=c&&d-c;return j?Math.round(I*1e3/j):void 0}}function fn(e,t){let r=0,s=1e3/t,o,i;const a=(d,c=Date.now())=>{r=c,o=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const c=Date.now(),g=c-r;g>=s?a(d,c):(o=d,i||(i=setTimeout(()=>{i=null,a(o)},s-g)))},()=>o&&a(o)]}const De=(e,t,r=3)=>{let s=0;const o=pn(50,250);return fn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-s,d=o(h),c=a<=l;s=a;const g={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:d||void 0,estimated:d&&l&&c?(l-a)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(g)},r)},_t=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},zt=e=>(...t)=>p.asap(()=>e(...t)),xn=Q.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Q.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Q.origin),Q.navigator&&/(msie|trident)/i.test(Q.navigator.userAgent)):()=>!0,hn=Q.hasStandardBrowserEnv?{write(e,t,r,s,o,i){const a=[e+"="+encodeURIComponent(t)];p.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),p.isString(s)&&a.push("path="+s),p.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function gn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function mn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function At(e,t,r){let s=!gn(t);return e&&(s||r==!1)?mn(e,t):t}const Nt=e=>e instanceof ne?{...e}:e;function ue(e,t){t=t||{};const r={};function s(d,c,g,I){return p.isPlainObject(d)&&p.isPlainObject(c)?p.merge.call({caseless:I},d,c):p.isPlainObject(c)?p.merge({},c):p.isArray(c)?c.slice():c}function o(d,c,g,I){if(p.isUndefined(c)){if(!p.isUndefined(d))return s(void 0,d,g,I)}else return s(d,c,g,I)}function i(d,c){if(!p.isUndefined(c))return s(void 0,c)}function a(d,c){if(p.isUndefined(c)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,c)}function l(d,c,g){if(g in t)return s(d,c);if(g in e)return s(void 0,d)}const h={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(d,c,g)=>o(Nt(d),Nt(c),g,!0)};return p.forEach(Object.keys({...e,...t}),function(c){const g=h[c]||o,I=g(e[c],t[c],c);p.isUndefined(I)&&g!==l||(r[c]=I)}),r}const Ut=e=>{const t=ue({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;if(t.headers=a=ne.from(a),t.url=Et(At(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(Q.hasStandardBrowserEnv||Q.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),d=["content-type","content-length"];Object.entries(h).forEach(([c,g])=>{d.includes(c.toLowerCase())&&a.set(c,g)})}}if(Q.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(t)),s||s!==!1&&xn(t.url))){const h=o&&i&&hn.read(i);h&&a.set(o,h)}return t},yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Ut(e);let i=o.data;const a=ne.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:d}=o,c,g,I,j,u;function w(){j&&j(),u&&u(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout;function F(){if(!m)return;const O=ne.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:O,config:e,request:m};Ot(function(A){r(A),w()},function(A){s(A),w()},M),m=null}"onloadend"in m?m.onloadend=F:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(F)},m.onabort=function(){m&&(s(new N("Request aborted",N.ECONNABORTED,e,m)),m=null)},m.onerror=function(T){const M=T&&T.message?T.message:"Network Error",y=new N(M,N.ERR_NETWORK,e,m);y.event=T||null,s(y),m=null},m.ontimeout=function(){let T=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||Tt;o.timeoutErrorMessage&&(T=o.timeoutErrorMessage),s(new N(T,M.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,e,m)),m=null},i===void 0&&a.setContentType(null),"setRequestHeader"in m&&p.forEach(a.toJSON(),function(T,M){m.setRequestHeader(M,T)}),p.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),l&&l!=="json"&&(m.responseType=o.responseType),d&&([I,u]=De(d,!0),m.addEventListener("progress",I)),h&&m.upload&&([g,j]=De(h),m.upload.addEventListener("progress",g),m.upload.addEventListener("loadend",j)),(o.cancelToken||o.signal)&&(c=O=>{m&&(s(!O||O.type?new we(null,e,m):O),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const P=un(o.url);if(P&&Q.protocols.indexOf(P)===-1){s(new N("Unsupported protocol "+P+":",N.ERR_BAD_REQUEST,e));return}m.send(i||null)})},bn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const i=function(d){if(!o){o=!0,l();const c=d instanceof Error?d:this.reason;s.abort(c instanceof N?c:new we(c instanceof Error?c.message:c))}};let a=t&&setTimeout(()=>{a=null,i(new N(`timeout ${t} of ms exceeded`,N.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},wn=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,o;for(;s<r;)o=s+t,yield e.slice(s,o),s=o},Sn=async function*(e,t){for await(const r of jn(e))yield*wn(r,t)},jn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Dt=(e,t,r,s)=>{const o=Sn(e,t);let i=0,a,l=h=>{a||(a=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:d,value:c}=await o.next();if(d){l(),h.close();return}let g=c.byteLength;if(r){let I=i+=g;r(I)}h.enqueue(new Uint8Array(c))}catch(d){throw l(d),d}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Ft=64*1024,{isFunction:Fe}=p,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Lt,TextEncoder:Mt}=p.global,Bt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kn=e=>{e=p.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:r,Response:s}=e,o=t?Fe(t):typeof fetch=="function",i=Fe(r),a=Fe(s);if(!o)return!1;const l=o&&Fe(Lt),h=o&&(typeof Mt=="function"?(u=>w=>u.encode(w))(new Mt):async u=>new Uint8Array(await new r(u).arrayBuffer())),d=i&&l&&Bt(()=>{let u=!1;const w=new r(Q.origin,{body:new Lt,method:"POST",get duplex(){return u=!0,"half"}}).headers.has("Content-Type");return u&&!w}),c=a&&l&&Bt(()=>p.isReadableStream(new s("").body)),g={stream:c&&(u=>u.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!g[u]&&(g[u]=(w,m)=>{let F=w&&w[u];if(F)return F.call(w);throw new N(`Response type '${u}' is not supported`,N.ERR_NOT_SUPPORT,m)})});const I=async u=>{if(u==null)return 0;if(p.isBlob(u))return u.size;if(p.isSpecCompliantForm(u))return(await new r(Q.origin,{method:"POST",body:u}).arrayBuffer()).byteLength;if(p.isArrayBufferView(u)||p.isArrayBuffer(u))return u.byteLength;if(p.isURLSearchParams(u)&&(u=u+""),p.isString(u))return(await h(u)).byteLength},j=async(u,w)=>{const m=p.toFiniteNumber(u.getContentLength());return m??I(w)};return async u=>{let{url:w,method:m,data:F,signal:P,cancelToken:O,timeout:T,onDownloadProgress:M,onUploadProgress:y,responseType:A,headers:S,withCredentials:U="same-origin",fetchOptions:$}=Ut(u),B=t||fetch;A=A?(A+"").toLowerCase():"text";let q=bn([P,O&&O.toAbortSignal()],T),K=null;const k=q&&q.unsubscribe&&(()=>{q.unsubscribe()});let Z;try{if(y&&d&&m!=="get"&&m!=="head"&&(Z=await j(S,F))!==0){let f=new r(w,{method:"POST",body:F,duplex:"half"}),E;if(p.isFormData(F)&&(E=f.headers.get("content-type"))&&S.setContentType(E),f.body){const[_,x]=_t(Z,De(zt(y)));F=Dt(f.body,Ft,_,x)}}p.isString(U)||(U=U?"include":"omit");const L=i&&"credentials"in r.prototype,D={...$,signal:q,method:m.toUpperCase(),headers:S.normalize().toJSON(),body:F,duplex:"half",credentials:L?U:void 0};K=i&&new r(w,D);let R=await(i?B(K,$):B(w,D));const ee=c&&(A==="stream"||A==="response");if(c&&(M||ee&&k)){const f={};["status","statusText","headers"].forEach(v=>{f[v]=R[v]});const E=p.toFiniteNumber(R.headers.get("content-length")),[_,x]=M&&_t(E,De(zt(M),!0))||[];R=new s(Dt(R.body,Ft,_,()=>{x&&x(),k&&k()}),f)}A=A||"text";let X=await g[p.findKey(g,A)||"text"](R,u);return!ee&&k&&k(),await new Promise((f,E)=>{Ot(f,E,{data:X,headers:ne.from(R.headers),status:R.status,statusText:R.statusText,config:u,request:K})})}catch(L){throw k&&k(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new N("Network Error",N.ERR_NETWORK,u,K),{cause:L.cause||L}):N.from(L,L&&L.code,u,K)}}},En=new Map,Wt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:o}=t,i=[s,o,r];let a=i.length,l=a,h,d,c=En;for(;l--;)h=i[l],d=c.get(h),d===void 0&&c.set(h,d=l?new Map:kn(t)),c=d;return d};Wt();const Qe={http:Yr,xhr:yn,fetch:{get:Wt}};p.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ht=e=>`- ${e}`,Cn=e=>p.isFunction(e)||e===null||e===!1,$t={getAdapter:(e,t)=>{e=p.isArray(e)?e:[e];const{length:r}=e;let s,o;const i={};for(let a=0;a<r;a++){s=e[a];let l;if(o=s,!Cn(s)&&(o=Qe[(l=String(s)).toLowerCase()],o===void 0))throw new N(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(t))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,d])=>`adapter ${h} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
|
|
4
4
|
`+a.map(Ht).join(`
|
|
5
|
-
`):" "+Ht(a[0]):"as no adapter specified";throw new
|
|
6
|
-
`+i):s.stack=i}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ue(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:i}=r;s!==void 0&&Me.assertOptions(s,{silentJSONParsing:oe.transitional(oe.boolean),forcedJSONParsing:oe.transitional(oe.boolean),clarifyTimeoutError:oe.transitional(oe.boolean)},!1),o!=null&&(
|
|
5
|
+
`):" "+Ht(a[0]):"as no adapter specified";throw new N("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Qe};function et(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new we(null,e)}function Vt(e){return et(e),e.headers=ne.from(e.headers),e.data=Ze.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$t.getAdapter(e.adapter||Ce.adapter,e)(e).then(function(s){return et(e),s.data=Ze.call(e,e.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return Pt(s)||(et(e),s&&s.response&&(s.response.data=Ze.call(e,e.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Yt="1.12.2",Le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Le[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const qt={};Le.transitional=function(t,r,s){function o(i,a){return"[Axios v"+Yt+"] Transitional option '"+i+"'"+a+(s?". "+s:"")}return(i,a,l)=>{if(t===!1)throw new N(o(a," has been removed"+(r?" in "+r:"")),N.ERR_DEPRECATED);return r&&!qt[a]&&(qt[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,l):!0}},Le.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Tn(e,t,r){if(typeof e!="object")throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const i=s[o],a=t[i];if(a){const l=e[i],h=l===void 0||a(l,i,e);if(h!==!0)throw new N("option "+i+" must be "+h,N.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new N("Unknown option "+i,N.ERR_BAD_OPTION)}}const Me={assertOptions:Tn,validators:Le},oe=Me.validators;let pe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ct,response:new Ct}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
6
|
+
`+i):s.stack=i}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ue(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:i}=r;s!==void 0&&Me.assertOptions(s,{silentJSONParsing:oe.transitional(oe.boolean),forcedJSONParsing:oe.transitional(oe.boolean),clarifyTimeoutError:oe.transitional(oe.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Me.assertOptions(o,{encode:oe.function,serialize:oe.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Me.assertOptions(r,{baseUrl:oe.spelling("baseURL"),withXsrfToken:oe.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],u=>{delete i[u]}),r.headers=ne.concat(a,i);const l=[];let h=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(r)===!1||(h=h&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let c,g=0,I;if(!h){const u=[Vt.bind(this),void 0];for(u.unshift(...l),u.push(...d),I=u.length,c=Promise.resolve(r);g<I;)c=c.then(u[g++],u[g++]);return c}I=l.length;let j=r;for(;g<I;){const u=l[g++],w=l[g++];try{j=u(j)}catch(m){w.call(this,m);break}}try{c=Vt.call(this,j)}catch(u){return Promise.reject(u)}for(g=0,I=d.length;g<I;)c=c.then(d[g++],d[g++]);return c}getUri(t){t=ue(this.defaults,t);const r=At(t.baseURL,t.url,t.allowAbsoluteUrls);return Et(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){pe.prototype[t]=function(r,s){return this.request(ue(s||{},{method:t,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(t){function r(s){return function(i,a,l){return this.request(ue(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}pe.prototype[t]=r(),pe.prototype[t+"Form"]=r(!0)});let Rn=class ir{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(o=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](o);s._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{s.subscribe(l),i=l}).then(o);return a.cancel=function(){s.unsubscribe(i)},a},t(function(i,a,l){s.reason||(s.reason=new we(i,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new ir(function(o){t=o}),cancel:t}}};function In(e){return function(r){return e.apply(null,r)}}function Pn(e){return p.isObject(e)&&e.isAxiosError===!0}const tt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(tt).forEach(([e,t])=>{tt[t]=e});function Kt(e){const t=new pe(e),r=dt(pe.prototype.request,t);return p.extend(r,pe.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Kt(ue(e,o))},r}const W=Kt(Ce);W.Axios=pe,W.CanceledError=we,W.CancelToken=Rn,W.isCancel=Pt,W.VERSION=Yt,W.toFormData=Ne,W.AxiosError=N,W.Cancel=W.CanceledError,W.all=function(t){return Promise.all(t)},W.spread=In,W.isAxiosError=Pn,W.mergeConfig=ue,W.AxiosHeaders=ne,W.formToJSON=e=>Rt(p.isHTMLForm(e)?new FormData(e):e),W.getAdapter=$t.getAdapter,W.HttpStatusCode=tt,W.default=W;const{Axios:ys,AxiosError:bs,CanceledError:ws,isCancel:Ss,CancelToken:js,VERSION:vs,all:ks,Cancel:Es,isAxiosError:Cs,spread:Ts,toFormData:Rs,AxiosHeaders:Is,HttpStatusCode:Ps,formToJSON:Os,getAdapter:_s,mergeConfig:zs}=W;class On{baseUrl;apiKey;appId;client;constructor(t){if(!t||!t.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=t.baseUrl.replace(/\/$/,""),this.apiKey=t.apiKey||null,this.appId=t.appId||null,this.client=W.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(t,r,s,o={}){if(!t)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:t,data:i,headers:o})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const a=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${a}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}async signup(t){const{name:r,email:s,password:o}=t;if(!r||!s||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",t)}async login(t){const{email:r,password:s,appId:o}=t;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:o||this.appId})}async updateUser(t){const{userId:r,appId:s}=t;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...t,appId:s||this.appId})}async changePassword(t){const{userId:r,currentPassword:s,newPassword:o,appId:i}=t;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!o)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:o,appId:i||this.appId})}async deleteUser(t){const{userId:r,appId:s}=t;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(t){const{token:r}=t;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(t){const{token:r,appId:s}=t;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:s||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(t){const{token:r,otp:s,appId:o}=t;if(!r)throw new Error("verifyEmail: 'token' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:s,appId:o||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(t){const{email:r,appId:s}=t;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(t){const{email:r,otp:s,newPassword:o,appId:i}=t;if(!r||!s||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:o,appId:i||this.appId})}async getUserData(t){const{userId:r}=t;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(t){const{userId:r,dataId:s}=t;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(t){const{userId:r,data:s}=t;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,s)}async updateUserData(t){const{userId:r,dataId:s,data:o}=t;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!o)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,o)}async deleteUserData(t){const{userId:r,dataId:s}=t;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}}var Be={exports:{}},Re={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
9
9
|
*
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var Xt;function
|
|
22
|
+
*/var Xt;function zn(){return Xt||(Xt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===B?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case P:return"Profiler";case F:return"StrictMode";case y:return"Suspense";case A:return"SuspenseList";case $:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case w:return"Portal";case T:return f.displayName||"Context";case O:return(f._context.displayName||"Context")+".Consumer";case M:var E=f.render;return f=f.displayName,f||(f=E.displayName||E.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case S:return E=f.displayName||null,E!==null?E:e(f.type)||"Memo";case U:E=f._payload,f=f._init;try{return e(f(E))}catch{}}return null}function t(f){return""+f}function r(f){try{t(f);var E=!1}catch{E=!0}if(E){E=console;var _=E.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return _.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),t(f)}}function s(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===U)return"<...>";try{var E=e(f);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function o(){var f=q.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function a(f){if(K.call(f,"key")){var E=Object.getOwnPropertyDescriptor(f,"key").get;if(E&&E.isReactWarning)return!1}return f.key!==void 0}function l(f,E){function _(){L||(L=!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))}_.isReactWarning=!0,Object.defineProperty(f,"key",{get:_,configurable:!0})}function h(){var f=e(this.type);return D[f]||(D[f]=!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.")),f=this.props.ref,f!==void 0?f:null}function d(f,E,_,x,v,J){var Y=_.ref;return f={$$typeof:u,type:f,key:E,props:_,_owner:x},(Y!==void 0?Y:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:h}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:v}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function c(f,E,_,x,v,J){var Y=E.children;if(Y!==void 0)if(x)if(k(Y)){for(x=0;x<Y.length;x++)g(Y[x]);Object.freeze&&Object.freeze(Y)}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 g(Y);if(K.call(E,"key")){Y=e(f);var ae=Object.keys(E).filter(function(ge){return ge!=="key"});x=0<ae.length?"{key: someKey, "+ae.join(": ..., ")+": ...}":"{key: someKey}",X[Y+x]||(ae=0<ae.length?"{"+ae.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,
|
|
27
|
+
<%s key={someKey} {...props} />`,x,Y,ae,Y),X[Y+x]=!0)}if(Y=null,_!==void 0&&(r(_),Y=""+_),a(E)&&(r(E.key),Y=""+E.key),"key"in E){_={};for(var ce in E)ce!=="key"&&(_[ce]=E[ce])}else _=E;return Y&&l(_,typeof f=="function"?f.displayName||f.name||"Unknown":f),d(f,Y,_,o(),v,J)}function g(f){I(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===U&&(f._payload.status==="fulfilled"?I(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function I(f){return typeof f=="object"&&f!==null&&f.$$typeof===u}var j=b,u=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),T=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),q=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,k=Array.isArray,Z=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(f){return f()}};var L,D={},R=j.react_stack_bottom_frame.bind(j,i)(),ee=Z(s(i)),X={};Ie.Fragment=m,Ie.jsx=function(f,E,_){var x=1e4>q.recentlyCreatedOwnerStacks++;return c(f,E,_,!1,x?Error("react-stack-top-frame"):R,x?Z(s(f)):ee)},Ie.jsxs=function(f,E,_){var x=1e4>q.recentlyCreatedOwnerStacks++;return c(f,E,_,!0,x?Error("react-stack-top-frame"):R,x?Z(s(f)):ee)}})()),Ie}var Gt;function An(){return Gt||(Gt=1,process.env.NODE_ENV==="production"?Be.exports=_n():Be.exports=zn()),Be.exports}var n=An();const Nn=async(e,t)=>{const{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:d=!0,role:c="user"}=e,{baseUrl:g,apiKey:I}=t;if(!I)throw new Error("API key is required for signup");if(!r||!s||!o||!i)throw new Error("Name, email, password, and appId are required");try{const j=await W.post(`${g}/users/signup`,{name:r,email:s,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:d,role:c},{headers:{"Content-Type":"application/json","x-api-key":I}});return j.data?.user&&localStorage.setItem("userInfo",JSON.stringify(j.data.user)),j.data.user}catch(j){const u=j.response?.data?.message||j.message||"Signup failed";if(console.error("Signup API Error:",u),j.response?.status===400){if(u.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(u.includes("inactive"))throw{success:!1,message:"Cannot signup under an inactive app",status:400}}throw j.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:u,status:j.response?.status||500}}};/**
|
|
28
28
|
* @license lucide-react v0.544.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
@@ -39,7 +39,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Mn=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},
|
|
42
|
+
*/const Mn=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},h)=>b.createElement("svg",{ref:h,...Ln,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:Qt("lucide",o),...!i&&!Fn(l)&&{"aria-hidden":"true"},...l},[...a.map(([d,c])=>b.createElement(d,c)),...Array.isArray(i)?i:[i]]));/**
|
|
43
43
|
* @license lucide-react v0.544.0 - ISC
|
|
44
44
|
*
|
|
45
45
|
* This source code is licensed under the ISC license.
|
|
@@ -199,12 +199,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
199
199
|
*
|
|
200
200
|
* This source code is licensed under the ISC license.
|
|
201
201
|
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const Pe=H("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),He={baseUrl:"",apiKey:"",appId:""},Qn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");He.baseUrl=e.baseUrl,He.apiKey=e.apiKey,He.appId=e.appId},he=()=>He,es=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:
|
|
202
|
+
*/const Pe=H("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),He={baseUrl:"",apiKey:"",appId:""},Qn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");He.baseUrl=e.baseUrl,He.apiKey=e.apiKey,He.appId=e.appId},he=()=>He,es=({logoUrl:e,logoLinkUrl:t,title:r="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:h=!1,roles:d=[],showRoleSelector:c=!1,loginUrl:g,onSuccess:I,onError:j})=>{const{baseUrl:u,apiKey:w,appId:m}=he(),F={name:"",email:"",password:"",role:d.length?d[0]:"user",...h&&{avatarUrl:""}},[P,O]=b.useState(F),[T,M]=b.useState(!1),[y,A]=b.useState(!1),[S,U]=b.useState(null),[$,B]=b.useState({}),q=typeof window<"u"?window.innerWidth<768:!1,K=l?"#ffffff":"#111827",k=l?"#a1a1aa":"#6b7280",Z=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",L=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",D=f=>{const{name:E,value:_}=f.target;O(x=>({...x,[E]:_})),$[E]&&B(x=>({...x,[E]:void 0}))},R=()=>{const f={};return P.name.trim()||(f.name="Name is required"),P.email.trim()?/\S+@\S+\.\S+/.test(P.email)||(f.email="Invalid email address"):f.email="Email is required",P.password?P.password.length<6&&(f.password="Password must be at least 6 characters"):f.password="Password is required",B(f),Object.keys(f).length===0},ee=async f=>{if(f.preventDefault(),!!R()){A(!0),U(null);try{const E={...P,appId:m},_=await Nn(E,{baseUrl:u,apiKey:w});U({type:"success",text:"Account created successfully!"}),I&&I(_)}catch(E){const _=E.message||"Signup failed. Please try again.";U({type:"error",text:_}),j&&j(E)}finally{A(!1)}}},X={width:"100%",padding:q?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:Z,border:`1px solid ${L}`,borderRadius:"10px",color:K,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return n.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[n.jsxs("div",{style:{minWidth:q?"320px":"380px",width:"100%",maxWidth:q?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:q?"30px 24px":"20px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:K,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:k},children:s})]}),h&&P.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:P.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${i}30`},onError:f=>{const E=f.target;E.style.display="none"}})}),n.jsxs("form",{onSubmit:ee,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[c&&d&&d.length===2&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{style:{fontSize:"14px",fontWeight:500,color:K},children:"Select Role"}),n.jsxs("div",{style:{position:"relative",display:"flex",borderRadius:"10px",border:`1px solid ${L}`,backgroundColor:Z,overflow:"hidden",cursor:"pointer",height:"42px"},children:[n.jsx("div",{style:{position:"absolute",top:0,left:0,width:"50%",height:"100%",backgroundColor:l?"#000000":"#ffffff",boxShadow:l?"0 1px 3px rgba(255,255,255,0.05)":"0 1px 3px rgba(0,0,0,0.1)",borderRadius:"10px",transition:"transform 0.3s ease, background-color 0.3s ease",transform:P.role===d[1]?"translateX(100%)":"translateX(0)",zIndex:0}}),n.jsx("button",{type:"button",onClick:()=>O(f=>({...f,role:d[0]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[0]?i:l?"#9ca3af":"#6b7280",fontWeight:P.role===d[0]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:d[0].charAt(0).toUpperCase()+d[0].slice(1)}),n.jsx("button",{type:"button",onClick:()=>O(f=>({...f,role:d[1]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[1]?i:l?"#9ca3af":"#6b7280",fontWeight:P.role===d[1]?600:500,fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.2s ease"},children:d[1].charAt(0).toUpperCase()+d[1].slice(1)})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:K},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(je,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:k}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:P.name,onChange:D,style:{...X,borderColor:$.name?"#ef4444":L}})]}),$.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:$.name})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:K},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(xe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:k}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:P.email,onChange:D,style:{...X,borderColor:$.email?"#ef4444":L}})]}),$.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:$.email})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:K},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:k}}),n.jsx("input",{id:"signup-password",type:T?"text":"password",name:"password",placeholder:"Create a secure password",value:P.password,onChange:D,style:{...X,borderColor:$.password?"#ef4444":L}}),n.jsx("button",{type:"button",onClick:()=>M(!T),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:k,cursor:"pointer",padding:"4px"},children:T?n.jsx(st,{size:20}):n.jsx(ot,{size:20})})]}),$.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:$.password})]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:K},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(er,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:k}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:P.avatarUrl||"",onChange:D,style:X})]})]}),g&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:g,style:{color:i,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),S&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:S.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:S.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:S.type==="success"?i:"#ef4444"},children:[S.type==="success"?n.jsx(fe,{size:20}):n.jsx(ie,{size:20}),n.jsx("span",{children:S.text})]}),n.jsx("button",{type:"submit",disabled:y,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:y?"not-allowed":"pointer",opacity:y?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:y?n.jsxs(n.Fragment,{children:[n.jsx(Yn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:k,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
|
|
203
203
|
@keyframes spin {
|
|
204
204
|
from { transform: rotate(0deg); }
|
|
205
205
|
to { transform: rotate(360deg); }
|
|
206
206
|
}
|
|
207
|
-
`})]})},ts=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const g=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",g),{success:!1,message:g,status:l.response?.status||500}}},rs=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:g,onSuccess:p,onError:c})=>{const{baseUrl:m,apiKey:I,appId:j}=he(),[d,S]=b.useState("login"),[h,U]=b.useState(1),[z,P]=b.useState(!1),[E,M]=b.useState(!1),[y,O]=b.useState(null),[w,N]=b.useState(""),[J,F]=b.useState(""),[V,Q]=b.useState({email:"",otp:"",newPassword:"",appId:j}),k=window.innerWidth<768,G=l?"#ffffff":"#111827",B=l?"#a1a1aa":"#6b7280",L=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",T=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",Y=async f=>{f.preventDefault(),M(!0),O(null);try{const v=await ts({email:w,password:J,appId:j},{baseUrl:m,apiKey:I});O({type:"success",text:`Welcome ${v.name}`}),p?.(v)}catch(v){const X=v.message||"Login failed";O({type:"error",text:X}),c?.(v)}finally{M(!1)}},K=f=>{Q({...V,[f.target.name]:f.target.value})},x=async f=>{f.preventDefault(),M(!0),O(null);try{const v=await W.post(`${m}/users/forgot-password`,{email:V.email,appId:j},{headers:{"x-api-key":I}});v.data.success?(U(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:v.data.message||"Failed to send OTP"})}catch(v){O({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{M(!1)}},R=async f=>{f.preventDefault(),M(!0),O(null);try{const v=await W.post(`${m}/users/reset-password`,V,{headers:{"x-api-key":I}});v.data.success?(O({type:"success",text:"Password reset successfully!"}),U(1),Q({email:"",otp:"",newPassword:"",appId:j}),S("login")):O({type:"error",text:v.data.message||"Reset failed"})}catch(v){O({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{M(!1)}},D={width:"100%",padding:k?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:L,border:`1px solid ${T}`,borderRadius:"10px",color:G,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:k?"320px":"380px",maxWidth:k?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:k?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:G,margin:0},children:d==="login"?r:h===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:B},children:d==="login"?s:"Follow the steps to reset your password"})]}),d==="login"&&n.jsxs("form",{onSubmit:Y,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(xe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:w,onChange:f=>N(f.target.value),style:D})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"login-password",type:z?"text":"password",placeholder:"Enter your password",value:J,onChange:f=>F(f.target.value),style:D}),n.jsx("button",{type:"button",onClick:()=>P(!z),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:B,cursor:"pointer"},children:z?n.jsx(st,{size:20}):n.jsx(ot,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[g&&n.jsx("a",{href:g,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>S("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:E?"Signing In...":"Sign In"})]}),d==="forgot"&&n.jsxs("form",{onSubmit:h===1?x:R,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[h===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(xe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:V.email,onChange:K,style:D})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:V.otp,onChange:K,style:D})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:B}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:V.newPassword,onChange:K,style:D})]})]})]}),n.jsx("button",{type:"submit",disabled:E,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:E?"Please wait...":h===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{S("login"),U(1)},style:{background:"none",border:"none",fontSize:"14px",color:B,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),y&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(fe,{size:20}):n.jsx(ie,{size:20}),n.jsx("span",{children:y.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:B,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ns=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{const[o,i]=b.useState(!1);return b.useEffect(()=>{const a=()=>i(ns());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},ar=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},os=({children:e,fallback:t=null,width:r,height:s})=>{const[o,i]=b.useState(!ar());return b.useEffect(()=>{const a=()=>i(!ar());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},as=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:g,appId:p}=he(),[c,m]=b.useState(!1),[I,j]=b.useState(""),[d,S]=b.useState("warning"),[h,U]=b.useState(!1);if(b.useEffect(()=>{const y=()=>{U(window.innerWidth<640)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),!e)return null;const z=async()=>{m(!0),S("processing");try{const{data:y}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:p},headers:{"x-api-key":g}});y.success?(r(y.message||"Account deleted successfully"),S("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(y.message||"Failed to delete account"),S("warning"))}catch(y){s(y.response?.data?.message||"Something went wrong"),S("warning")}finally{m(!1)}},P=I.toLowerCase()==="delete my account",E=y=>{y.target===y.currentTarget&&d!=="processing"&&d!=="success"&&t()},M=()=>{switch(d){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.color=a.textPrimary},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(or,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Wn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Zn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(at,{size:16}),text:"You will lose access to all services"}].map((y,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:y.icon}),n.jsx("span",{children:y.text})]},O))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>S("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:y=>{y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(or,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:I,onChange:y=>j(y.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${P?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:y=>{y.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:y=>{y.target.style.boxShadow="none"},autoFocus:!0}),P&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(nt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{S("warning"),j("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:z,disabled:!P||c,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!P||c?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",opacity:!P||c?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!P||c?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:y=>{P&&!c&&(y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(le,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((y,O)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:y.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:y.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:y.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:y.active?a.textPrimary:a.textSecondary,fontWeight:y.active?500:400},children:y.text})]},O))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(sr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(nt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(nt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:E,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:M()}),n.jsx("style",{children:`
|
|
207
|
+
`})]})},ts=async(e,t)=>{const{email:r,password:s,appId:o}=e,{baseUrl:i,apiKey:a}=t;if(!a)throw new Error("API key is required for login");try{const l=await W.post(`${i}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},rs=({logoUrl:e,logoLinkUrl:t,title:r="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:i="#00C214",gradient:a="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:h,onSuccess:d,onError:c})=>{const{baseUrl:g,apiKey:I,appId:j}=he(),[u,w]=b.useState("login"),[m,F]=b.useState(1),[P,O]=b.useState(!1),[T,M]=b.useState(!1),[y,A]=b.useState(null),[S,U]=b.useState(""),[$,B]=b.useState(""),[q,K]=b.useState({email:"",otp:"",newPassword:"",appId:j}),k=window.innerWidth<768,Z=l?"#ffffff":"#111827",L=l?"#a1a1aa":"#6b7280",D=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",R=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",ee=async x=>{x.preventDefault(),M(!0),A(null);try{const v=await ts({email:S,password:$,appId:j},{baseUrl:g,apiKey:I});A({type:"success",text:`Welcome ${v.name}`}),d?.(v)}catch(v){const J=v.message||"Login failed";A({type:"error",text:J}),c?.(v)}finally{M(!1)}},X=x=>{K({...q,[x.target.name]:x.target.value})},f=async x=>{x.preventDefault(),M(!0),A(null);try{const v=await W.post(`${g}/users/forgot-password`,{email:q.email,appId:j},{headers:{"x-api-key":I}});v.data.success?(F(2),A({type:"success",text:"OTP sent to your email"})):A({type:"error",text:v.data.message||"Failed to send OTP"})}catch(v){A({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{M(!1)}},E=async x=>{x.preventDefault(),M(!0),A(null);try{const v=await W.post(`${g}/users/reset-password`,q,{headers:{"x-api-key":I}});v.data.success?(A({type:"success",text:"Password reset successfully!"}),F(1),K({email:"",otp:"",newPassword:"",appId:j}),w("login")):A({type:"error",text:v.data.message||"Reset failed"})}catch(v){A({type:"error",text:v.response?.data?.message||"Something went wrong"})}finally{M(!1)}},_={width:"100%",padding:k?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:D,border:`1px solid ${R}`,borderRadius:"10px",color:Z,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return n.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:n.jsxs("div",{style:{minWidth:k?"320px":"380px",maxWidth:k?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:k?"30px 24px":"18px 28px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?n.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:n.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):n.jsx(je,{size:40,color:i,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:Z,margin:0},children:u==="login"?r:m===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:L},children:u==="login"?s:"Follow the steps to reset your password"})]}),u==="login"&&n.jsxs("form",{onSubmit:ee,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(xe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:L}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:S,onChange:x=>U(x.target.value),style:_})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:L}}),n.jsx("input",{id:"login-password",type:P?"text":"password",placeholder:"Enter your password",value:$,onChange:x=>B(x.target.value),style:_}),n.jsx("button",{type:"button",onClick:()=>O(!P),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:L,cursor:"pointer"},children:P?n.jsx(st,{size:20}):n.jsx(ot,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[h&&n.jsx("a",{href:h,style:{color:i,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>w("forgot"),style:{background:"none",border:"none",color:i,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),u==="forgot"&&n.jsxs("form",{onSubmit:m===1?f:E,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[m===1?n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(xe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:L}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:q.email,onChange:X,style:_})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:L}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:q.otp,onChange:X,style:_})]})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:L}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:q.newPassword,onChange:X,style:_})]})]})]}),n.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:a,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":m===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{w("login"),F(1)},style:{background:"none",border:"none",fontSize:"14px",color:L,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),y&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:y.type==="success"?`${i}15`:"rgba(239,68,68,0.1)",border:y.type==="success"?`1px solid ${i}30`:"1px solid rgba(239,68,68,0.3)",color:y.type==="success"?i:"#ef4444"},children:[y.type==="success"?n.jsx(fe,{size:20}):n.jsx(ie,{size:20}),n.jsx("span",{children:y.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:L,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:i,fontWeight:600},children:"Neuctra Authix"})]})]})})},ns=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},ss=({children:e,fallback:t=null,width:r,height:s})=>{const[o,i]=b.useState(!1);return b.useEffect(()=>{const a=()=>i(ns());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},ar=()=>{if(typeof window>"u")return!1;try{const e=localStorage.getItem("userInfo");return!!(e&&e!=="undefined"&&e!=="null")}catch{return!1}},os=({children:e,fallback:t=null,width:r,height:s})=>{const[o,i]=b.useState(!ar());return b.useEffect(()=>{const a=()=>i(!ar());return a(),window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},as=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:d}=he(),[c,g]=b.useState(!1),[I,j]=b.useState(""),[u,w]=b.useState("warning"),[m,F]=b.useState(!1);if(b.useEffect(()=>{const y=()=>{F(window.innerWidth<640)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]),!e)return null;const P=async()=>{g(!0),w("processing");try{const{data:y}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:d},headers:{"x-api-key":h}});y.success?(r(y.message||"Account deleted successfully"),w("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(y.message||"Failed to delete account"),w("warning"))}catch(y){s(y.response?.data?.message||"Something went wrong"),w("warning")}finally{g(!1)}},O=I.toLowerCase()==="delete my account",T=y=>{y.target===y.currentTarget&&u!=="processing"&&u!=="success"&&t()},M=()=>{switch(u){case"warning":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #ef4444, #dc2626)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(We,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.color=a.textPrimary},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(or,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:n.jsx(Wn,{size:16}),text:"All your data will be permanently deleted"},{icon:n.jsx(Zn,{size:16}),text:"This action cannot be reversed"},{icon:n.jsx(at,{size:16}),text:"You will lose access to all services"}].map((y,A)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx("div",{style:{color:a.error,flexShrink:0},children:y.icon}),n.jsx("span",{children:y.text})]},A))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:m?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),n.jsxs("button",{onClick:()=>w("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:y=>{y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[n.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #f59e0b, #d97706)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(or,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),n.jsxs("div",{style:{marginBottom:"24px"},children:[n.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:I,onChange:y=>j(y.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${O?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:y=>{y.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:y=>{y.target.style.boxShadow="none"},autoFocus:!0}),O&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[n.jsx(nt,{size:16}),n.jsx("span",{children:"Confirmation accepted"})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:()=>{w("warning"),j("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:y=>{y.currentTarget.style.backgroundColor=a.border,y.currentTarget.style.transform="translateY(-1px)"},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent",y.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:P,disabled:!O||c,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!O||c?"not-allowed":"pointer",flex:m?"none":1,minWidth:m?"100%":"140px",opacity:!O||c?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!O||c?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:y=>{O&&!c&&(y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:y=>{O&&!c&&(y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[n.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #6b7280, #4b5563)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(le,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),n.jsx("div",{style:{marginBottom:"20px"},children:n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[{text:"Removing your data",active:!0},{text:"Closing active sessions",active:!1},{text:"Finalizing deletion",active:!1}].map((y,A)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:y.active?`${a.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:y.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:y.active?`0 0 0 4px ${a.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:y.active?a.textPrimary:a.textSecondary,fontWeight:y.active?500:400},children:y.text})]},A))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[n.jsx(sr,{size:18,style:{color:a.accent,flexShrink:0}}),n.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"12px",background:"linear-gradient(135deg, #10b981, #059669)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:n.jsx(nt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),n.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(nt,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:a.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary,justifyContent:"center"},children:[n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),n.jsx("span",{children:"Redirecting to login page..."})]})]})}};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:T,children:[n.jsx("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"scaleIn 0.3s ease-out"},className:"delete-modal-container",children:M()}),n.jsx("style",{children:`
|
|
208
208
|
@keyframes fadeIn {
|
|
209
209
|
from { opacity: 0; }
|
|
210
210
|
to { opacity: 1; }
|
|
@@ -258,7 +258,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
258
258
|
animation: none !important;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
`})]})},is=({isOpen:e,onClose:t,onUpdate:r,colors:s})=>{const[o,i]=b.useState(""),[a,l]=b.useState(!1),[
|
|
261
|
+
`})]})},is=({isOpen:e,onClose:t,onUpdate:r,colors:s})=>{const[o,i]=b.useState(""),[a,l]=b.useState(!1),[h,d]=b.useState(!1),[c,g]=b.useState({isValid:!1,message:"",type:null});if(b.useEffect(()=>{const u=()=>{d(window.innerWidth<640)};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]),b.useEffect(()=>{if(!o.trim()){g({isValid:!1,message:"",type:null});return}try{const u=new URL(o),w=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(u.pathname);g(w?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{g({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[o]),!e)return null;const I=async()=>{if(!(!o||!c.isValid)){l(!0);try{await r(o)&&(i(""),t())}finally{l(!1)}}},j=u=>{u.target===u.currentTarget&&t()};return n.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e3},onClick:j,children:[n.jsxs("div",{style:{backgroundColor:s.surface,border:`1px solid ${s.border}`,borderRadius:"20px",width:"100%",maxWidth:"480px",padding:"24px",boxShadow:"0 32px 64px rgba(0,0,0,0.4)",animation:"modalSlideIn 0.3s ease-out"},className:"avatar-modal-container",children:[n.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"44px",height:"44px",borderRadius:"12px",background:`linear-gradient(135deg, ${s.accent}20, ${s.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:s.accent,flexShrink:0},children:n.jsx(rt,{size:22})}),n.jsx("div",{children:n.jsx("h3",{style:{color:s.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close avatar modal",style:{background:"transparent",border:"none",color:s.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},onMouseOver:u=>{u.currentTarget.style.backgroundColor=s.border,u.currentTarget.style.color=s.textPrimary},onMouseOut:u=>{u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.color=s.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:s.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[n.jsx(Vn,{size:16}),"Avatar URL"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:o,onChange:u=>i(u.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${c.type==="error"?s.error:c.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:u=>{u.target.style.borderColor=s.accent,u.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:u=>{u.target.style.borderColor=c.type==="error"?s.error:c.type==="success"?s.success:s.border,u.target.style.boxShadow="none"},disabled:a}),n.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:n.jsx(er,{size:18})})]}),c.message&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:c.type==="success"?s.success:c.type==="error"?s.error:s.textTertiary},children:[c.type==="success"&&n.jsx(fe,{size:14}),c.type==="error"&&n.jsx(ie,{size:14}),c.type==="warning"&&n.jsx(ie,{size:14}),c.message]})]}),o&&c.type==="success"&&n.jsxs("div",{style:{padding:"16px",backgroundColor:`${s.success}10`,border:`1px solid ${s.success}20`,borderRadius:"12px",textAlign:"center"},children:[n.jsx("p",{style:{color:s.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),n.jsx("img",{src:o,alt:"Avatar preview",style:{width:"80px",height:"80px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${s.success}40`,margin:"0 auto"},onError:u=>{u.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:t,disabled:a,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:a?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",opacity:a?.6:1,transition:"all 0.2s ease"},onMouseOver:u=>{a||(u.currentTarget.style.backgroundColor=s.border,u.currentTarget.style.transform="translateY(-1px)")},onMouseOut:u=>{a||(u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:I,disabled:a||!c.isValid,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${s.accent}, ${s.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:a||!c.isValid?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"140px",opacity:a||!c.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:a||!c.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:u=>{!a&&c.isValid&&(u.currentTarget.style.transform="translateY(-1px)",u.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:u=>{!a&&c.isValid&&(u.currentTarget.style.transform="translateY(0)",u.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:a?n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(rt,{size:16}),"Update Avatar"]})})]})]}),n.jsx("style",{children:`
|
|
262
262
|
@keyframes modalSlideIn {
|
|
263
263
|
from {
|
|
264
264
|
opacity: 0;
|
|
@@ -306,7 +306,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
306
306
|
transition: none !important;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
`})]})},ls=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:
|
|
309
|
+
`})]})},ls=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=he(),[d,c]=b.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[g,I]=b.useState({}),[j,u]=b.useState(!1),[w,m]=b.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[F,P]=b.useState(!1);if(b.useEffect(()=>{const S=()=>{P(window.innerWidth<640)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),!e)return null;const O=S=>{const{name:U,value:$}=S.target;c(B=>({...B,[U]:$})),g[U]&&I(B=>({...B,[U]:""}))},T=S=>{m(U=>({...U,[S]:!U[S]}))},M=()=>{const S={};return d.currentPassword||(S.currentPassword="Current password is required"),d.newPassword?d.newPassword.length<6&&(S.newPassword="Password must be at least 6 characters"):S.newPassword="New password is required",d.newPassword!==d.confirmPassword&&(S.confirmPassword="Passwords do not match"),I(S),Object.keys(S).length===0},y=async S=>{if(S.preventDefault(),!!M()){u(!0);try{const{data:U}=await W.put(`${a}/users/change-password/${o}`,{appId:h,currentPassword:d.currentPassword,newPassword:d.newPassword},{headers:{"x-api-key":l}});U.success?(r(U.message||"Password updated successfully"),c({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(U.message||"Failed to update password")}catch(U){s(U.response?.data?.message||"Something went wrong")}finally{u(!1)}}},A=[{field:"currentPassword",label:"Current Password",icon:n.jsx(rr,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(Se,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(Se,{size:18})}];return n.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(6px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e3},children:n.jsxs("div",{style:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:"16px",maxWidth:"440px",width:"100%",padding:"24px",boxShadow:"0 20px 60px rgba(0,0,0,0.4)",maxHeight:"90vh",overflowY:"auto"},className:"change-password-modal",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px",gap:"12px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[n.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"10px",background:`linear-gradient(135deg, ${i.accent}20, ${i.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:i.accent,flexShrink:0},children:n.jsx(Se,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"18px",fontWeight:600,lineHeight:"1.4"},children:"Change Password"})})]}),n.jsx("button",{onClick:t,"aria-label":"Close password change modal",style:{background:"transparent",border:"none",color:i.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:S=>{S.currentTarget.style.backgroundColor=i.border,S.currentTarget.style.color=i.textPrimary},onMouseOut:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=i.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("form",{onSubmit:y,children:[A.map(({field:S,label:U,icon:$})=>n.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[n.jsx("label",{htmlFor:S,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:U}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:i.textTertiary,zIndex:2},children:$}),n.jsx("input",{type:w[S]?"text":"password",id:S,name:S,placeholder:`Enter ${U.toLowerCase()}`,value:d[S],onChange:O,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${g[S]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:B=>{B.target.style.borderColor=i.accent,B.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:B=>{B.target.style.borderColor=g[S]?i.error:i.border,B.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>T(S),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",cursor:"pointer",color:i.textTertiary,padding:"4px",borderRadius:"4px",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:B=>{B.currentTarget.style.backgroundColor=i.border,B.currentTarget.style.color=i.textPrimary},onMouseOut:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=i.textTertiary},children:w[S]?n.jsx(st,{size:18}):n.jsx(ot,{size:18})})]}),g[S]&&n.jsxs("div",{style:{fontSize:"13px",color:i.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[n.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),g[S]]})]},S)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:F?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{type:"button",onClick:t,disabled:j,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:j?"not-allowed":"pointer",flex:F?"none":1,minWidth:F?"100%":"120px",opacity:j?.6:1,transition:"all 0.2s ease"},onMouseOver:S=>{j||(S.currentTarget.style.backgroundColor=i.border,S.currentTarget.style.transform="translateY(-1px)")},onMouseOut:S=>{j||(S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{type:"submit",disabled:j,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:j?"not-allowed":"pointer",flex:F?"none":1,minWidth:F?"100%":"140px",opacity:j?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:j?"none":`0 4px 12px ${i.accent}40`},onMouseOver:S=>{j||(S.currentTarget.style.transform="translateY(-1px)",S.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:S=>{j||(S.currentTarget.style.transform="translateY(0)",S.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:j?n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
|
|
310
310
|
@keyframes spin {
|
|
311
311
|
from { transform: rotate(0deg); }
|
|
312
312
|
to { transform: rotate(360deg); }
|
|
@@ -344,7 +344,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
344
344
|
padding: 16px 12px;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
`})]})})},cs=({isOpen:e,onClose:t,onVerify:r,onSendOTP:s,verifyFormData:o,setVerifyFormData:i,otpSent:a,verifying:l,user:
|
|
347
|
+
`})]})})},cs=({isOpen:e,onClose:t,onVerify:r,onSendOTP:s,verifyFormData:o,setVerifyFormData:i,otpSent:a,verifying:l,user:h,colors:d,darkMode:c})=>{if(!e)return null;const g=()=>{t(),i({email:h?.email||"",otp:"",appId:o.appId})};return n.jsxs("div",{className:"modal-overlay",style:{backgroundColor:c?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.5)"},children:[n.jsxs("div",{className:"verify-email-modal",style:{backgroundColor:d.surface,border:`1px solid ${d.border}`},children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("h3",{style:{color:d.textPrimary},children:"Verify Your Email"}),n.jsx("button",{onClick:g,className:"close-btn",style:{color:d.textTertiary},"aria-label":"Close verification modal",children:n.jsx(Pe,{size:20,"aria-hidden":"true"})})]}),n.jsxs("form",{className:"verify-form",onSubmit:r,children:[n.jsxs("div",{className:"form-group",children:[n.jsx("label",{style:{color:d.textSecondary},children:"Email"}),n.jsxs("div",{className:"input-container",children:[n.jsx(xe,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"email",value:o.email,onChange:I=>i(j=>({...j,email:I.target.value})),placeholder:"Enter your email",style:{backgroundColor:d.surfaceLight,color:d.textPrimary,borderColor:d.border},required:!0,"aria-required":"true","aria-label":"Email address"})]})]}),a&&n.jsxs("div",{className:"form-group",children:[n.jsx("label",{style:{color:d.textSecondary},children:"OTP"}),n.jsxs("div",{className:"input-container",children:[n.jsx(tr,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"text",value:o.otp,onChange:I=>i(j=>({...j,otp:I.target.value})),placeholder:"Enter OTP",style:{backgroundColor:d.surfaceLight,color:d.textPrimary,borderColor:d.border},required:!0,"aria-required":"true","aria-label":"One-time password"})]})]}),n.jsx("div",{className:"modal-actions",children:a?n.jsxs("button",{type:"submit",disabled:l,className:"btn-primary",style:{background:`linear-gradient(to right, ${d.accent}, ${d.accentHover})`,opacity:l?.7:1},"aria-label":l?"Verifying email":"Verify email",children:[l?n.jsx(le,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(fe,{size:16,"aria-hidden":"true"}),l?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:s,disabled:l,className:"btn-primary",style:{background:`linear-gradient(to right, ${d.accent}, ${d.accentHover})`,opacity:l?.7:1},"aria-label":l?"Sending OTP":"Send OTP",children:[l?n.jsx(le,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(nr,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]}),n.jsx("style",{children:`
|
|
348
348
|
.modal-overlay {
|
|
349
349
|
position: fixed;
|
|
350
350
|
top: 0;
|
|
@@ -437,8 +437,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
.input-container input:focus {
|
|
440
|
-
border-color: ${
|
|
441
|
-
box-shadow: 0 0 0 3px ${
|
|
440
|
+
border-color: ${d.accent};
|
|
441
|
+
box-shadow: 0 0 0 3px ${d.accent}20;
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
.modal-actions {
|
|
@@ -491,7 +491,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
491
491
|
animation: none;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
`})]})},ds=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,onVerify:i,primaryColor:a="#00C212"})=>{const{baseUrl:l,apiKey:g,appId:p}=he(),[c,m]=b.useState(t),[I,j]=b.useState(!0),[d,S]=b.useState(!1),[h,U]=b.useState(!1),[z,P]=b.useState(!1),[E,M]=b.useState(!1),[y,O]=b.useState(!1),[w,N]=b.useState(!1),[J,F]=b.useState(!1),[V,Q]=b.useState(!1),[k,G]=b.useState(null),[B,L]=b.useState(!1),[T,Y]=b.useState({email:"",otp:"",appId:p}),[K,x]=b.useState(!1),[R,D]=b.useState(!1),f=(C,$)=>{G({type:C,message:$}),setTimeout(()=>G(null),3e3)},v=()=>{Q(!0);const C=setTimeout(()=>{F(!1),Q(!1)},150);return()=>clearTimeout(C)};b.useEffect(()=>{const C=$=>{const Z=document.querySelector(".dropdown-container");Z&&!Z.contains($.target)&&v()};return J&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[J]);const X=async()=>{if(!T.email||!/\S+@\S+\.\S+/.test(T.email)){f("error","Please enter a valid email");return}try{D(!0);const C=await W.post(`${l}/users/send-verify-otp/${c?.id}`,{email:T.email},{headers:{"x-api-key":g,"x-app-id":p}});C.data.success?(f("success",C.data.message||"OTP sent to email!"),x(!0)):f("error",C.data.message||"Failed to send OTP")}catch(C){f("error",C.response?.data?.message||"Server error")}finally{D(!1)}},q=async C=>{if(C.preventDefault(),!T.email||!T.otp){f("error","Please fill in all fields");return}try{D(!0);const $=await W.post(`${l}/users/verify-email`,T);if($.data.success){if(f("success",$.data.message||"Email verified!"),c){const Z={...c,isVerified:!0};m(Z),localStorage.setItem("userInfo",JSON.stringify({...Z,token:e})),typeof i=="function"&&i(Z)}Y({email:"",otp:"",appId:p}),x(!1),N(!1)}else f("error",$.data.message||"Verification failed")}catch($){f("error",$.response?.data?.message||"Something went wrong")}finally{D(!1)}},ae=async C=>{if(!c)return!1;try{const $={...c,avatarUrl:C},{data:Z}=await W.put(`${l}/users/update/${c.id}`,$,{headers:{"x-api-key":g}});return Z.success?(m($),localStorage.setItem("userInfo",JSON.stringify({...$,token:e})),f("success","Avatar updated successfully!"),!0):(f("error",Z.message||"Failed to update avatar"),!1)}catch($){return console.error("Avatar update error:",$),f("error","Failed to update avatar"),!1}},ce=async()=>{if(c){U(!0);try{const{data:C}=await W.put(`${l}/users/update/${c.id}`,c,{headers:{"x-api-key":g}});C.success?(m(C.user),S(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:e})),f("success","Profile updated successfully")):f("error",C.message)}catch(C){console.error(C),f("error","Update failed")}finally{U(!1)}}},ge=async C=>{try{const{data:$}=await W.get(`${l}/users/check-user/${C}?appId=${p}`,{headers:{"x-api-key":g}});(!$.success||!$.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),m(null))}catch($){console.error("User check failed:",$),localStorage.removeItem("userInfo"),m(null)}};b.useEffect(()=>{(()=>{if(t)m(t),j(!1),ge(t.id);else{const $=localStorage.getItem("userInfo");if($){const Z=JSON.parse($);m(Z),j(!1),ge(Z.id)}else j(!1)}})()},[t]),b.useEffect(()=>{c?.email&&Y(C=>({...C,email:c.email}))},[c?.email]);const $e=(C,$)=>{let Z=parseInt(C.replace("#",""),16),me=(Z>>16)+$,lt=(Z>>8&255)+$,ct=(Z&255)+$;return me=Math.min(255,Math.max(0,me)),lt=Math.min(255,Math.max(0,lt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|lt<<8|me<<16).toString(16).padStart(6,"0")}`},_=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:$e(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:$e(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(I)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:_.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(le,{size:40,color:_.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:_.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:_.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(ie,{size:40,color:_.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:_.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const it=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:xe},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:Jn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:qn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:_.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[k&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...k.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[k.type==="success"?n.jsx(fe,{size:20,"aria-hidden":"true"}):n.jsx(ie,{size:20,"aria-hidden":"true"}),k.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:_.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx($n,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${_.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>P(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:_.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(rt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:_.textPrimary},children:c.name}),n.jsx("p",{style:{color:_.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?_.success:_.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(fe,{size:16,"aria-hidden":"true"}):n.jsx(ie,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:d?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>S(!1),style:{backgroundColor:_.surfaceLight,border:`1px solid ${_.border}`,color:_.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:ce,disabled:h,style:{background:`linear-gradient(to right, ${_.accent}, ${_.accentHover})`,opacity:h?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:h?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[h?n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Xn,{size:16,"aria-hidden":"true"}),h?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>S(!0),style:{background:`linear-gradient(to right, ${_.accent}, ${_.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Kn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>N(!0),disabled:B,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:B?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:B?.7:1,flex:window.innerWidth<1024?"1":"auto"},children:[B?n.jsx(le,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(nr,{size:14,"aria-hidden":"true"}),B?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:_.surfaceLight,color:_.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>F(!J),children:[n.jsx(Hn,{size:16,"aria-hidden":"true"}),"More Actions"]}),J&&n.jsxs("div",{className:`dropdown-container ${V?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:_.surface,border:`1px solid ${_.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${V?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{M(!0),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:_.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>C.currentTarget.style.backgroundColor=_.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(rr,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(at,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{O(!0),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:_.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:_.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:it.map(C=>{const $=C.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:_.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx($,{size:16,"aria-hidden":"true"}),C.label]}),d?n.jsx("input",{type:C.type,name:C.name,value:c[C.name],onChange:Z=>m(me=>me&&{...me,[Z.target.name]:Z.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${a}`,backgroundColor:"transparent",color:_.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${C.label.toLowerCase()}`,"aria-label":C.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:_.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:C.value})]},C.name)})})]}),n.jsxs("section",{style:{backgroundColor:_.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:_.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(sr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:_.textSecondary},children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:_.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:_.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(fe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(ie,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:_.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(is,{isOpen:z,onClose:()=>{P(!1)},onUpdate:ae,colors:_}),n.jsx(ls,{baseUrl:l,apiKey:g,appId:p,userId:c.id,isOpen:E,onClose:()=>M(!1),onSuccess:C=>f("success",C),onError:C=>f("error",C),colors:_}),n.jsx(as,{baseUrl:l,apiKey:g,appId:p,userId:c.id,token:e,isOpen:y,onClose:()=>O(!1),onSuccess:C=>f("success",C),onError:C=>f("error",C),colors:_}),n.jsx(cs,{isOpen:w,onClose:()=>{N(!1),x(!1),Y({email:c?.email||"",otp:"",appId:p})},onVerify:q,onSendOTP:X,verifyFormData:T,setVerifyFormData:Y,otpSent:K,verifying:R,user:c,colors:_,darkMode:r}),n.jsx("style",{children:`
|
|
494
|
+
`})]})},ds=({token:e,user:t=null,darkMode:r=!0,homeUrl:s,onLogout:o,onVerify:i,primaryColor:a="#00C212"})=>{const{baseUrl:l,apiKey:h,appId:d}=he(),[c,g]=b.useState(t),[I,j]=b.useState(!0),[u,w]=b.useState(!1),[m,F]=b.useState(!1),[P,O]=b.useState(!1),[T,M]=b.useState(!1),[y,A]=b.useState(!1),[S,U]=b.useState(!1),[$,B]=b.useState(!1),[q,K]=b.useState(!1),[k,Z]=b.useState(null),[L,D]=b.useState(!1),[R,ee]=b.useState({email:"",otp:"",appId:d}),[X,f]=b.useState(!1),[E,_]=b.useState(!1),x=(C,V)=>{Z({type:C,message:V}),setTimeout(()=>Z(null),3e3)},v=()=>{K(!0);const C=setTimeout(()=>{B(!1),K(!1)},150);return()=>clearTimeout(C)};b.useEffect(()=>{const C=V=>{const G=document.querySelector(".dropdown-container");G&&!G.contains(V.target)&&v()};return $&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[$]);const J=async()=>{if(!R.email||!/\S+@\S+\.\S+/.test(R.email)){x("error","Please enter a valid email");return}try{_(!0);const C=await W.post(`${l}/users/send-verify-otp/${c?.id}`,{email:R.email},{headers:{"x-api-key":h,"x-app-id":d}});C.data.success?(x("success",C.data.message||"OTP sent to email!"),f(!0)):x("error",C.data.message||"Failed to send OTP")}catch(C){x("error",C.response?.data?.message||"Server error")}finally{_(!1)}},Y=async C=>{if(C.preventDefault(),!R.email||!R.otp){x("error","Please fill in all fields");return}try{_(!0);const V=await W.post(`${l}/users/verify-email`,R);if(V.data.success){if(x("success",V.data.message||"Email verified!"),c){const G={...c,isVerified:!0};g(G),localStorage.setItem("userInfo",JSON.stringify({...G,token:e})),typeof i=="function"&&i(G)}ee({email:"",otp:"",appId:d}),f(!1),U(!1)}else x("error",V.data.message||"Verification failed")}catch(V){x("error",V.response?.data?.message||"Something went wrong")}finally{_(!1)}},ae=async C=>{if(!c)return!1;try{const V={...c,avatarUrl:C},{data:G}=await W.put(`${l}/users/update/${c.id}`,V,{headers:{"x-api-key":h}});return G.success?(g(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),x("success","Avatar updated successfully!"),!0):(x("error",G.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),x("error","Failed to update avatar"),!1}},ce=async()=>{if(c){F(!0);try{const{data:C}=await W.put(`${l}/users/update/${c.id}`,c,{headers:{"x-api-key":h}});C.success?(g(C.user),w(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:e})),x("success","Profile updated successfully")):x("error",C.message)}catch(C){console.error(C),x("error","Update failed")}finally{F(!1)}}},ge=async C=>{try{const{data:V}=await W.get(`${l}/users/check-user/${C}?appId=${d}`,{headers:{"x-api-key":h}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),g(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),g(null)}};b.useEffect(()=>{(()=>{if(t)g(t),j(!1),ge(t.id);else{const V=localStorage.getItem("userInfo");if(V){const G=JSON.parse(V);g(G),j(!1),ge(G.id)}else j(!1)}})()},[t]),b.useEffect(()=>{c?.email&&ee(C=>({...C,email:c.email}))},[c?.email]);const $e=(C,V)=>{let G=parseInt(C.replace("#",""),16),me=(G>>16)+V,lt=(G>>8&255)+V,ct=(G&255)+V;return me=Math.min(255,Math.max(0,me)),lt=Math.min(255,Math.max(0,lt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|lt<<8|me<<16).toString(16).padStart(6,"0")}`},z=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:a,accentHover:$e(a,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:a,accentHover:$e(a,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(I)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[n.jsx(le,{size:40,color:z.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:z.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[n.jsx(ie,{size:40,color:z.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:z.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const it=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:je},{label:"Email Address",value:c.email,name:"email",type:"email",icon:xe},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:Jn},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:qn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:z.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[k&&n.jsxs("div",{style:{position:"fixed",top:"20px",right:"20px",padding:"12px 24px",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",backdropFilter:"blur(8px)",border:"1px solid",zIndex:1e3,display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",fontWeight:500,maxWidth:"400px",animation:"slideIn 0.3s ease-out",...k.type==="success"?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:r?"#34d399":"#059669"}:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:r?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:r?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[k.type==="success"?n.jsx(fe,{size:20,"aria-hidden":"true"}):n.jsx(ie,{size:20,"aria-hidden":"true"}),k.message]}),n.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:n.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...window.innerWidth>=768&&window.innerWidth<1024&&{gap:"10px"},...window.innerWidth>=600&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",position:"relative",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",textAlign:"center",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",flex:1,minHeight:"300px"},children:[s&&n.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:n.jsx($n,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${z.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>O(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:z.accent,color:"white",padding:"8px",borderRadius:"50%",border:"none",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px"},"aria-label":"Change profile picture",children:n.jsx(rt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:z.textPrimary},children:c.name}),n.jsx("p",{style:{color:z.textTertiary,margin:"0 0 8px 0"},children:c.email}),n.jsxs("div",{style:{backgroundColor:c.isVerified?r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:c.isVerified?z.success:z.warning,border:`1px solid ${c.isVerified?r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`,padding:"6px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"8px"},children:[c.isVerified?n.jsx(fe,{size:16,"aria-hidden":"true"}):n.jsx(ie,{size:16,"aria-hidden":"true"}),c.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:u?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>w(!1),style:{backgroundColor:z.surfaceLight,border:`1px solid ${z.border}`,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",borderStyle:"solid",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:ce,disabled:m,style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,opacity:m?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:m?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[m?n.jsx(le,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Xn,{size:16,"aria-hidden":"true"}),m?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>w(!0),style:{background:`linear-gradient(to right, ${z.accent}, ${z.accentHover})`,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",flex:window.innerWidth<1024?"1":"auto"},children:[n.jsx(Kn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!c.isVerified&&n.jsxs("button",{onClick:()=>U(!0),disabled:L,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:L?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:L?.7:1,flex:window.innerWidth<1024?"1":"auto"},children:[L?n.jsx(le,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(nr,{size:14,"aria-hidden":"true"}),L?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:z.surfaceLight,color:z.textPrimary,padding:"10px 20px",borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",textDecoration:"none",minHeight:"36px",width:"100%",boxSizing:"border-box"},onClick:()=>B(!$),children:[n.jsx(Hn,{size:16,"aria-hidden":"true"}),"More Actions"]}),$&&n.jsxs("div",{className:`dropdown-container ${q?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:z.surface,border:`1px solid ${z.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${q?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{M(!0),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:z.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>C.currentTarget.style.backgroundColor=z.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(rr,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:r?"#fca5a5":"#dc2626",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(at,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{A(!0),v()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:"#ef4444",cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:600,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[n.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),n.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[n.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(je,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:it.map(C=>{const V=C.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:z.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(V,{size:16,"aria-hidden":"true"}),C.label]}),u?n.jsx("input",{type:C.type,name:C.name,value:c[C.name],onChange:G=>g(me=>me&&{...me,[G.target.name]:G.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${a}`,backgroundColor:"transparent",color:z.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${C.label.toLowerCase()}`,"aria-label":C.label}):n.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:z.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:C.value})]},C.name)})})]}),n.jsxs("section",{style:{backgroundColor:z.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[n.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:z.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(sr,{size:20,"aria-hidden":"true"}),"Security Status"]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:z.textSecondary},children:[n.jsx(xe,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:"Email Verification"})]}),n.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...c.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:z.success,border:`1px solid ${r?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:r?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:z.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:c.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(fe,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(ie,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!c.isVerified&&n.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:r?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:n.jsx("p",{style:{color:z.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(is,{isOpen:P,onClose:()=>{O(!1)},onUpdate:ae,colors:z}),n.jsx(ls,{baseUrl:l,apiKey:h,appId:d,userId:c.id,isOpen:T,onClose:()=>M(!1),onSuccess:C=>x("success",C),onError:C=>x("error",C),colors:z}),n.jsx(as,{baseUrl:l,apiKey:h,appId:d,userId:c.id,token:e,isOpen:y,onClose:()=>A(!1),onSuccess:C=>x("success",C),onError:C=>x("error",C),colors:z}),n.jsx(cs,{isOpen:S,onClose:()=>{U(!1),f(!1),ee({email:c?.email||"",otp:"",appId:d})},onVerify:Y,onSendOTP:J,verifyFormData:R,setVerifyFormData:ee,otpSent:X,verifying:E,user:c,colors:z,darkMode:r}),n.jsx("style",{children:`
|
|
495
495
|
@keyframes slideIn {
|
|
496
496
|
from {
|
|
497
497
|
transform: translateX(100%);
|
|
@@ -579,4 +579,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
579
579
|
transition-duration: 0.01ms !important;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
`})]})},us=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:g=!0,showSettingsMenuItem:p=!0,showViewProfileMenuItem:c=!0,profileLabel:m="My Profile",settingsLabel:I="Settings",viewProfileLabel:j="View Profile",logoutLabel:d="Sign Out"})=>{const{baseUrl:S,apiKey:h,appId:U}=he(),[z,P]=b.useState(!1),[E,M]=b.useState(null),[y,O]=b.useState(!0),[w,N]=b.useState(null),J=b.useRef(null),F=b.useRef(null),[V,Q]=b.useState(!1),[k,G]=b.useState(!1);b.useEffect(()=>{const f=()=>{G(window.innerWidth<768)};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const B=async f=>{try{if(!f)throw new Error("Invalid user ID");const{data:v}=await W.get(`${S}/users/check-user/${f}?appId=${U}`,{headers:{"x-api-key":h},timeout:1e4});(!v.success||!v.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),N("Session expired"))}catch(v){console.error("User validation failed:",v);const X=v.response?.status===404?"User not found":v.code==="NETWORK_ERROR"?"Network error":"Validation failed";N(X),v.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};b.useEffect(()=>{(async()=>{try{if(O(!0),N(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await B(o.id)}else{const v=localStorage.getItem("userInfo");if(v)try{const X=JSON.parse(v);if(!X.id||!X.name||!X.email)throw new Error("Invalid stored user data");M(X),await B(X.id)}catch(X){console.error("Failed to parse stored user data:",X),localStorage.removeItem("userInfo"),N("Invalid user data")}}}catch(v){console.error("User initialization failed:",v),N(v.message||"Failed to load user")}finally{O(!1)}})()},[o]),b.useEffect(()=>{const f=()=>{if(z&&F.current){const v=F.current.getBoundingClientRect(),X=window.innerWidth,q=window.innerHeight,ae=280,ce=300,ge=X-v.right,$e=v.left,_=q-v.bottom,it=ge>=ae||ge>$e;Q(it),_<ce&&v.top>ce}};return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[z]),b.useEffect(()=>{const f=q=>{J.current&&!J.current.contains(q.target)&&!F.current?.contains(q.target)&&P(!1)},v=q=>{q.key==="Escape"&&P(!1)},X=()=>{z&&P(!1)};return z&&(document.addEventListener("mousedown",f),document.addEventListener("keydown",v),window.addEventListener("scroll",X,{passive:!0})),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v),window.removeEventListener("scroll",X)}},[z]);const L=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},T={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:k?"6px":"8px",padding:k?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:L.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:k?"auto":"140px",maxWidth:k?"200px":"none",outline:"none"},avatarImage:{width:k?"28px":"32px",height:k?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:k?"13px":"14px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},userEmail:{fontSize:k?"11px":"12px",color:L.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:z?"rotate(180deg)":"rotate(0deg)",color:L.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[V?"left":"right"]:"0",backgroundColor:L.surfaceElevated,border:`1px solid ${L.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:z?1:0,pointerEvents:z?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:z?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:k?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"14px":"16px"},dropdownAvatar:{width:k?"40px":"48px",height:k?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:k?"15px":"16px",fontWeight:600,color:L.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:k?"13px":"14px",color:L.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:L.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:k?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:k?"16px":"18px",height:k?"16px":"18px",color:L.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:k?"13px":"14px",color:L.error,textAlign:"left",outline:"none"},loadingText:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px"},errorState:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:L.textSecondary,fontSize:k?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:L.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},Y=()=>{N(null),O(!0);const f=localStorage.getItem("userInfo");if(f)try{const v=JSON.parse(f);M(v),B(v.id)}catch{N("Invalid user data")}O(!1)},K=(f,v)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),v())},x=()=>a||E?.profileUrl,R=()=>{const f=x();f&&window.open(f,"_self","noopener,noreferrer")},D=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:T.wrapper,ref:J,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:F,onClick:()=>P(f=>!f),onKeyDown:f=>K(f,()=>P(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",children:E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E?.name||"User"}'s avatar`,style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy",onError:f=>{const v=f.target;v.onerror=null,v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(E?.name||"User")}`,alt:"Default user avatar",style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${L.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:F,style:T.avatarButton,onClick:()=>P(f=>!f),onKeyDown:f=>K(f,()=>P(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":z,"aria-label":"Toggle user menu",onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover,f.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.surface,f.currentTarget.style.boxShadow="none"},onBlur:f=>{f.currentTarget.style.outline="none"},children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s avatar`,style:T.avatarImage,loading:"lazy",onError:f=>{const v=f.target;v.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:T.avatarImage,loading:"lazy"}),!k&&n.jsxs("div",{style:T.userInfo,children:[n.jsx("div",{style:T.userName,title:E?.name,children:E?.name||"Guest"}),E?.email&&n.jsx("div",{style:T.userEmail,title:E.email,children:E.email})]}),n.jsx(Bn,{size:k?14:16,style:T.chevron,"aria-hidden":"true"})]}),z&&n.jsx("div",{style:T.dropdown,role:"menu","aria-label":"User options",children:y?n.jsx("div",{style:T.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):E?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:T.userSection,children:[E?.avatarUrl?n.jsx("img",{src:E.avatarUrl,alt:`${E.name}'s profile picture`,style:T.dropdownAvatar,loading:"lazy",onError:f=>{const v=f.target;v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${E.name}`,alt:`${E.name}'s default avatar`,style:T.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:T.dropdownUserInfo,children:[n.jsx("div",{style:T.dropdownUserName,title:E.name,children:E.name}),n.jsx("div",{style:T.dropdownUserEmail,title:E.email,children:E.email})]})]}),n.jsxs("div",{style:T.dropdownSection,children:[g&&x()&&n.jsxs("button",{style:T.menuItem,onClick:R,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,R),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:m})]}),p&&l&&n.jsxs("button",{style:T.menuItem,onClick:D,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,D),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:I})]}),c&&E.profileUrl&&n.jsxs("a",{href:E.profileUrl,target:"_self",rel:"noopener noreferrer",style:T.menuItem,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(xe,{style:T.icon,"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:j})]})]}),n.jsx("div",{style:T.dropdownSection,children:n.jsxs("button",{style:T.logoutButton,onClick:r,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.surfaceHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor="transparent"},onKeyDown:f=>K(f,r),role:"menuitem",tabIndex:0,children:[n.jsx(at,{style:{...T.icon,color:L.error},"aria-hidden":"true"}),n.jsx("span",{style:T.menuItemText,children:d})]})})]}):n.jsxs("div",{style:T.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(ie,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:w||"Not signed in"})]}),w&&w!=="Not signed in"&&n.jsx("button",{style:T.retryButton,onClick:Y,onMouseOver:f=>{f.currentTarget.style.backgroundColor=L.accentHover},onMouseOut:f=>{f.currentTarget.style.backgroundColor=L.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=On,te.ReactSignedIn=ss,te.ReactSignedOut=os,te.ReactUserButton=us,te.ReactUserLogin=rs,te.ReactUserProfile=ds,te.ReactUserSignUp=es,te.getSdkConfig=he,te.setSdkConfig=Qn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
582
|
+
`})]})},us=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:i="",profileUrl:a,settingsUrl:l,showProfileMenuItem:h=!0,showSettingsMenuItem:d=!0,showViewProfileMenuItem:c=!0,profileLabel:g="My Profile",settingsLabel:I="Settings",viewProfileLabel:j="View Profile",logoutLabel:u="Sign Out"})=>{const{baseUrl:w,apiKey:m,appId:F}=he(),[P,O]=b.useState(!1),[T,M]=b.useState(null),[y,A]=b.useState(!0),[S,U]=b.useState(null),$=b.useRef(null),B=b.useRef(null),[q,K]=b.useState(!1),[k,Z]=b.useState(!1);b.useEffect(()=>{const x=()=>{Z(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const L=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:v}=await W.get(`${w}/users/check-user/${x}?appId=${F}`,{headers:{"x-api-key":m},timeout:1e4});(!v.success||!v.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),U("Session expired"))}catch(v){console.error("User validation failed:",v);const J=v.response?.status===404?"User not found":v.code==="NETWORK_ERROR"?"Network error":"Validation failed";U(J),v.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};b.useEffect(()=>{(async()=>{try{if(A(!0),U(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await L(o.id)}else{const v=localStorage.getItem("userInfo");if(v)try{const J=JSON.parse(v);if(!J.id||!J.name||!J.email)throw new Error("Invalid stored user data");M(J),await L(J.id)}catch(J){console.error("Failed to parse stored user data:",J),localStorage.removeItem("userInfo"),U("Invalid user data")}}}catch(v){console.error("User initialization failed:",v),U(v.message||"Failed to load user")}finally{A(!1)}})()},[o]),b.useEffect(()=>{const x=()=>{if(P&&B.current){const v=B.current.getBoundingClientRect(),J=window.innerWidth,Y=window.innerHeight,ae=280,ce=300,ge=J-v.right,$e=v.left,z=Y-v.bottom,it=ge>=ae||ge>$e;K(it),z<ce&&v.top>ce}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[P]),b.useEffect(()=>{const x=Y=>{$.current&&!$.current.contains(Y.target)&&!B.current?.contains(Y.target)&&O(!1)},v=Y=>{Y.key==="Escape"&&O(!1)},J=()=>{P&&O(!1)};return P&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",v),window.addEventListener("scroll",J,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",v),window.removeEventListener("scroll",J)}},[P]);const D=e?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:t,accentHover:`${t}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:t,accentHover:`${t}e6`,error:"#ef4444"},R={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:k?"6px":"8px",padding:k?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:D.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:k?"auto":"140px",maxWidth:k?"200px":"none",outline:"none"},avatarImage:{width:k?"28px":"32px",height:k?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${D.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:k?"13px":"14px",fontWeight:600,color:D.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},userEmail:{fontSize:k?"11px":"12px",color:D.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:k?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:P?"rotate(180deg)":"rotate(0deg)",color:D.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[q?"left":"right"]:"0",backgroundColor:D.surfaceElevated,border:`1px solid ${D.border}`,borderRadius:"12px",boxShadow:"0 20px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1)",width:"min(280px, 90vw)",maxWidth:"calc(100vw - 20px)",padding:"6px 6px 16px 6px",zIndex:1e3,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",opacity:P?1:0,pointerEvents:P?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:P?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:k?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"14px":"16px"},dropdownAvatar:{width:k?"40px":"48px",height:k?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${D.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:k?"15px":"16px",fontWeight:600,color:D.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:k?"13px":"14px",color:D.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:D.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:k?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:k?"16px":"18px",height:k?"16px":"18px",color:D.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:k?"10px":"12px",padding:k?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:k?"13px":"14px",color:D.error,textAlign:"left",outline:"none"},loadingText:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:D.textSecondary,fontSize:k?"13px":"14px"},errorState:{padding:k?"16px 12px":"20px 16px",textAlign:"center",color:D.textSecondary,fontSize:k?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:D.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},ee=()=>{U(null),A(!0);const x=localStorage.getItem("userInfo");if(x)try{const v=JSON.parse(x);M(v),L(v.id)}catch{U("Invalid user data")}A(!1)},X=(x,v)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),v())},f=()=>a||T?.profileUrl,E=()=>{const x=f();x&&window.open(x,"_self","noopener,noreferrer")},_=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:R.wrapper,ref:$,className:i,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:B,onClick:()=>O(x=>!x),onKeyDown:x=>X(x,()=>O(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",children:T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${D.borderLight}`,flexShrink:0},loading:"lazy",onError:x=>{const v=x.target;v.onerror=null,v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:k?"34px":"40px",height:k?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${D.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:B,style:R.avatarButton,onClick:()=>O(x=>!x),onKeyDown:x=>X(x,()=>O(v=>!v)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=D.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:x=>{const v=x.target;v.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):n.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:R.avatarImage,loading:"lazy"}),!k&&n.jsxs("div",{style:R.userInfo,children:[n.jsx("div",{style:R.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&n.jsx("div",{style:R.userEmail,title:T.email,children:T.email})]}),n.jsx(Bn,{size:k?14:16,style:R.chevron,"aria-hidden":"true"})]}),P&&n.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:y?n.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):T?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:R.userSection,children:[T?.avatarUrl?n.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:x=>{const v=x.target;v.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`,alt:`${T.name}'s default avatar`,style:R.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:R.dropdownUserInfo,children:[n.jsx("div",{style:R.dropdownUserName,title:T.name,children:T.name}),n.jsx("div",{style:R.dropdownUserEmail,title:T.email,children:T.email})]})]}),n.jsxs("div",{style:R.dropdownSection,children:[h&&f()&&n.jsxs("button",{style:R.menuItem,onClick:E,onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>X(x,E),role:"menuitem",tabIndex:0,children:[n.jsx(je,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:g})]}),d&&l&&n.jsxs("button",{style:R.menuItem,onClick:_,onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>X(x,_),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:I})]}),c&&T.profileUrl&&n.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(xe,{style:R.icon,"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:j})]})]}),n.jsx("div",{style:R.dropdownSection,children:n.jsxs("button",{style:R.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>X(x,r),role:"menuitem",tabIndex:0,children:[n.jsx(at,{style:{...R.icon,color:D.error},"aria-hidden":"true"}),n.jsx("span",{style:R.menuItemText,children:u})]})})]}):n.jsxs("div",{style:R.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(ie,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:S||"Not signed in"})]}),S&&S!=="Not signed in"&&n.jsx("button",{style:R.retryButton,onClick:ee,onMouseOver:x=>{x.currentTarget.style.backgroundColor=D.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=D.accent},children:"Try Again"})]})})]})};te.NeuctraAuthix=On,te.ReactSignedIn=ss,te.ReactSignedOut=os,te.ReactUserButton=us,te.ReactUserLogin=rs,te.ReactUserProfile=ds,te.ReactUserSignUp=es,te.getSdkConfig=he,te.setSdkConfig=Qn,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|