@neuctra/authix 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- (function(Q,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(Q=typeof globalThis<"u"?globalThis:Q||self,w(Q.NeuctraAuthix={},Q.React))})(this,(function(Q,w){"use strict";function ut(e,t){return function(){return e.apply(t,arguments)}}const{toString:lr}=Object.prototype,{getPrototypeOf:qe}=Object,{iterator:Re,toStringTag:pt}=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:me}=Array,ye=ze("undefined");function je(e){return e!==null&&!ye(e)&&e.constructor!==null&&!ye(e.constructor)&&te(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ft=se("ArrayBuffer");function dr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ft(e.buffer),t}const cr=ze("string"),te=ze("function"),xt=ze("number"),ve=e=>e!==null&&typeof e=="object",ur=e=>e===!0||e===!1,Ae=e=>{if(_e(e)!=="object")return!1;const t=qe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(pt in e)&&!(Re in e)},pr=e=>{if(!ve(e)||je(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=>ve(e)&&te(e.pipe),yr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||te(e.append)&&((t=_e(e))==="formdata"||t==="object"&&te(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 ke(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),me(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(je(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),i=a.length;let l;for(s=0;s<i;s++)l=a[s],t.call(null,e[l],l,e)}}function ht(e,t){if(je(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 fe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gt=e=>!ye(e)&&e!==fe;function He(){const{caseless:e,skipUndefined:t}=gt(this)&&this||{},r={},s=(o,a)=>{const i=e&&ht(r,a)||a;Ae(r[i])&&Ae(o)?r[i]=He(r[i],o):Ae(o)?r[i]=He({},o):me(o)?r[i]=o.slice():(!t||!ye(o))&&(r[i]=o)};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&ke(arguments[o],s);return r}const Er=(e,t,r,{allOwnKeys:s}={})=>(ke(t,(o,a)=>{r&&te(o)?e[a]=ut(o,r):e[a]=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)},Ir=(e,t,r,s)=>{let o,a,i;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)i=o[a],(!s||s(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=r!==!1&&qe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Pr=(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},Or=e=>{if(!e)return null;if(me(e))return e;let t=e.length;if(!xt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Rr=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qe(Uint8Array)),_r=(e,t)=>{const s=(e&&e[Re]).call(e);let o;for(;(o=s.next())&&!o.done;){const a=o.value;t.call(e,a[0],a[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}),mt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$r=se("RegExp"),yt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};ke(r,(o,a)=>{let i;(i=t(o,a,e))!==!1&&(s[a]=i||o)}),Object.defineProperties(e,s)},Ur=e=>{yt(e,(t,r)=>{if(te(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(te(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+"'")})}})},Dr=(e,t)=>{const r={},s=o=>{o.forEach(a=>{r[a]=!0})};return me(e)?s(e):s(String(e).split(t)),r},Lr=()=>{},Fr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Mr(e){return!!(e&&te(e.append)&&e[pt]==="FormData"&&e[Re])}const Wr=e=>{const t=new Array(10),r=(s,o)=>{if(ve(s)){if(t.indexOf(s)>=0)return;if(je(s))return s;if(!("toJSON"in s)){t[o]=s;const a=me(s)?[]:{};return ke(s,(i,l)=>{const x=r(i,o+1);!ye(x)&&(a[l]=x)}),t[o]=void 0,a}}return s};return r(e,0)},Br=se("AsyncFunction"),qr=e=>e&&(ve(e)||te(e))&&te(e.then)&&te(e.catch),bt=((e,t)=>e?setImmediate:t?((r,s)=>(fe.addEventListener("message",({source:o,data:a})=>{o===fe&&a===r&&s.length&&s.shift()()},!1),o=>{s.push(o),fe.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",te(fe.postMessage)),Hr=typeof queueMicrotask<"u"?queueMicrotask.bind(fe):typeof process<"u"&&process.nextTick||bt,p={isArray:me,isArrayBuffer:ft,isBuffer:je,isFormData:yr,isArrayBufferView:dr,isString:cr,isNumber:xt,isBoolean:ur,isObject:ve,isPlainObject:Ae,isEmptyObject:pr,isReadableStream:wr,isRequest:Sr,isResponse:jr,isHeaders:vr,isUndefined:ye,isDate:fr,isFile:xr,isBlob:hr,isRegExp:$r,isFunction:te,isStream:mr,isURLSearchParams:br,isTypedArray:Rr,isFileList:gr,forEach:ke,merge:He,extend:Er,trim:kr,stripBOM:Cr,inherits:Tr,toFlatObject:Ir,kindOf:_e,kindOfTest:se,endsWith:Pr,toArray:Or,forEachEntry:_r,matchAll:zr,isHTMLForm:Ar,hasOwnProperty:mt,hasOwnProp:mt,reduceDescriptors:yt,freezeMethods:Ur,toObjectSet:Dr,toCamelCase:Nr,noop:Lr,toFiniteNumber:Fr,findKey:ht,global:fe,isContextDefined:gt,isSpecCompliantForm:Mr,toJSONObject:Wr,isAsyncFn:Br,isThenable:qr,setImmediate:bt,asap:Hr,isIterable:e=>e!=null&&te(e[Re])};function U(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(U,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 wt=U.prototype,St={};["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=>{St[e]={value:e}}),Object.defineProperties(U,St),Object.defineProperty(wt,"isAxiosError",{value:!0}),U.from=(e,t,r,s,o,a)=>{const i=Object.create(wt);p.toFlatObject(e,i,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",x=t==null&&e?e.code:t;return U.call(i,l,x,r,s,o),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",a&&Object.assign(i,a),i};const Vr=null;function Ve(e){return p.isPlainObject(e)||p.isArray(e)}function jt(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function vt(e,t,r){return e?e.concat(t).map(function(o,a){return o=jt(o),!r&&a?"["+o+"]":o}).join(r?".":""):t}function Yr(e){return p.isArray(e)&&!e.some(Ve)}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(S,y){return!p.isUndefined(y[S])});const s=r.metaTokens,o=r.visitor||u,a=r.dots,i=r.indexes,x=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(p.isDate(c))return c.toISOString();if(p.isBoolean(c))return c.toString();if(!x&&p.isBlob(c))throw new U("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(c)||p.isTypedArray(c)?x&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,S,y){let R=c;if(c&&!y&&typeof c=="object"){if(p.endsWith(S,"{}"))S=s?S:S.slice(0,-2),c=JSON.stringify(c);else if(p.isArray(c)&&Yr(c)||(p.isFileList(c)||p.endsWith(S,"[]"))&&(R=p.toArray(c)))return S=jt(S),R.forEach(function(A,P){!(p.isUndefined(A)||A===null)&&t.append(i===!0?vt([S],P,a):i===null?S:S+"[]",d(A))}),!1}return Ve(c)?!0:(t.append(vt(y,S,a),d(c)),!1)}const m=[],g=Object.assign(Kr,{defaultVisitor:u,convertValue:d,isVisitable:Ve});function j(c,S){if(!p.isUndefined(c)){if(m.indexOf(c)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(c),p.forEach(c,function(R,C){(!(p.isUndefined(R)||R===null)&&o.call(t,R,p.isString(C)?C.trim():C,S,g))===!0&&j(R,S?S.concat(C):[C])}),m.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return j(e),t}function kt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ye(e,t){this._pairs=[],e&&Ne(e,this,t)}const Et=Ye.prototype;Et.append=function(t,r){this._pairs.push([t,r])},Et.toString=function(t){const r=t?function(s){return t.call(this,s,kt)}:kt;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 Ct(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 a;if(o?a=o(t,r):a=p.isURLSearchParams(t)?t.toString():new Ye(t,r).toString(s),a){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class Tt{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 It={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ye,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Gr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Zr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Zr,navigator:Je,origin:Qr},Symbol.toStringTag,{value:"Module"})),...Xr};function en(e,t){return Ne(e,new ee.classes.URLSearchParams,{visitor:function(r,s,o,a){return ee.isNode&&p.isBuffer(r)?(this.append(s,r.toString("base64")),!1):a.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 a;for(s=0;s<o;s++)a=r[s],t[a]=e[a];return t}function Pt(e){function t(r,s,o,a){let i=r[a++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),x=a>=r.length;return i=!i&&p.isArray(o)?o.length:i,x?(p.hasOwnProp(o,i)?o[i]=[o[i],s]:o[i]=s,!l):((!o[i]||!p.isObject(o[i]))&&(o[i]=[]),t(r,s,o[i],a)&&p.isArray(o[i])&&(o[i]=rn(o[i])),!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 Ee={transitional:It,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",o=s.indexOf("application/json")>-1,a=p.isObject(t);if(a&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Pt(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(a){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 x=this.env&&this.env.FormData;return Ne(l?{"files[]":t}:t,x&&new x,this.formSerializer)}}return a||o?(r.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const r=this.transitional||Ee.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 i=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?U.from(l,U.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}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ee.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(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),s=i.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},Ot=Symbol("internals");function Ce(e){return e&&String(e).trim().toLowerCase()}function $e(e){return e===!1||e==null?e:p.isArray(e)?e.map($e):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 Xe(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 dn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function cn(e,t){const r=p.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(o,a,i){return this[s].call(this,t,o,a,i)},configurable:!0})})}let re=class{constructor(t){t&&this.set(t)}set(t,r,s){const o=this;function a(l,x,d){const u=Ce(x);if(!u)throw new Error("header name must be a non-empty string");const m=p.findKey(o,u);(!m||o[m]===void 0||d===!0||d===void 0&&o[m]!==!1)&&(o[m||x]=$e(l))}const i=(l,x)=>p.forEach(l,(d,u)=>a(d,u,x));if(p.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(p.isString(t)&&(t=t.trim())&&!ln(t))i(on(t),r);else if(p.isObject(t)&&p.isIterable(t)){let l={},x,d;for(const u of t){if(!p.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[d=u[0]]=(x=l[d])?p.isArray(x)?[...x,u[1]]:[x,u[1]]:u[1]}i(l,r)}else t!=null&&a(r,t,s);return this}get(t,r){if(t=Ce(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=Ce(t),t){const s=p.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Xe(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let o=!1;function a(i){if(i=Ce(i),i){const l=p.findKey(s,i);l&&(!r||Xe(s,s[l],l,r))&&(delete s[l],o=!0)}}return p.isArray(t)?t.forEach(a):a(t),o}clear(t){const r=Object.keys(this);let s=r.length,o=!1;for(;s--;){const a=r[s];(!t||Xe(this,this[a],a,t,!0))&&(delete this[a],o=!0)}return o}normalize(t){const r=this,s={};return p.forEach(this,(o,a)=>{const i=p.findKey(s,a);if(i){r[i]=$e(o),delete r[a];return}const l=t?dn(a):String(a).trim();l!==a&&delete r[a],r[l]=$e(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[Ot]=this[Ot]={accessors:{}}).accessors,o=this.prototype;function a(i){const l=Ce(i);s[l]||(cn(o,i),s[l]=!0)}return p.isArray(t)?t.forEach(a):a(t),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(re.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),p.freezeMethods(re);function Ge(e,t){const r=this||Ee,s=t||r,o=re.from(s.headers);let a=s.data;return p.forEach(e,function(l){a=l.call(r,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Rt(e){return!!(e&&e.__CANCEL__)}function be(e,t,r){U.call(this,e??"canceled",U.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(be,U,{__CANCEL__:!0});function _t(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new U("Request failed with status code "+r.status,[U.ERR_BAD_REQUEST,U.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,a=0,i;return t=t!==void 0?t:1e3,function(x){const d=Date.now(),u=s[a];i||(i=d),r[o]=x,s[o]=d;let m=a,g=0;for(;m!==o;)g+=r[m++],m=m%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),d-i<t)return;const j=u&&d-u;return j?Math.round(g*1e3/j):void 0}}function fn(e,t){let r=0,s=1e3/t,o,a;const i=(d,u=Date.now())=>{r=u,o=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=s?i(d,u):(o=d,a||(a=setTimeout(()=>{a=null,i(o)},s-m)))},()=>o&&i(o)]}const Ue=(e,t,r=3)=>{let s=0;const o=pn(50,250);return fn(a=>{const i=a.loaded,l=a.lengthComputable?a.total:void 0,x=i-s,d=o(x),u=i<=l;s=i;const m={loaded:i,total:l,progress:l?i/l:void 0,bytes:x,rate:d||void 0,estimated:d&&l&&u?(l-i)/d:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},r)},zt=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},At=e=>(...t)=>p.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,a){const i=[e+"="+encodeURIComponent(t)];p.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),p.isString(s)&&i.push("path="+s),p.isString(o)&&i.push("domain="+o),a===!0&&i.push("secure"),document.cookie=i.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 Nt(e,t,r){let s=!gn(t);return e&&(s||r==!1)?mn(e,t):t}const $t=e=>e instanceof re?{...e}:e;function xe(e,t){t=t||{};const r={};function s(d,u,m,g){return p.isPlainObject(d)&&p.isPlainObject(u)?p.merge.call({caseless:g},d,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(d,u,m,g){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d,m,g)}else return s(d,u,m,g)}function a(d,u){if(!p.isUndefined(u))return s(void 0,u)}function i(d,u){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,u)}function l(d,u,m){if(m in t)return s(d,u);if(m in e)return s(void 0,d)}const x={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(d,u,m)=>o($t(d),$t(u),m,!0)};return p.forEach(Object.keys({...e,...t}),function(u){const m=x[u]||o,g=m(e[u],t[u],u);p.isUndefined(g)&&m!==l||(r[u]=g)}),r}const Ut=e=>{const t=xe({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:l}=t;if(t.headers=i=re.from(i),t.url=Ct(Nt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const x=r.getHeaders(),d=["content-type","content-length"];Object.entries(x).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(t)),s||s!==!1&&xn(t.url))){const x=o&&a&&hn.read(a);x&&i.set(o,x)}return t},yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const o=Ut(e);let a=o.data;const i=re.from(o.headers).normalize();let{responseType:l,onUploadProgress:x,onDownloadProgress:d}=o,u,m,g,j,c;function S(){j&&j(),c&&c(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function R(){if(!y)return;const A=re.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:A,config:e,request:y};_t(function($){r($),S()},function($){s($),S()},M),y=null}"onloadend"in y?y.onloadend=R:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(R)},y.onabort=function(){y&&(s(new U("Request aborted",U.ECONNABORTED,e,y)),y=null)},y.onerror=function(P){const M=P&&P.message?P.message:"Network Error",b=new U(M,U.ERR_NETWORK,e,y);b.event=P||null,s(b),y=null},y.ontimeout=function(){let P=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||It;o.timeoutErrorMessage&&(P=o.timeoutErrorMessage),s(new U(P,M.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,e,y)),y=null},a===void 0&&i.setContentType(null),"setRequestHeader"in y&&p.forEach(i.toJSON(),function(P,M){y.setRequestHeader(M,P)}),p.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),l&&l!=="json"&&(y.responseType=o.responseType),d&&([g,c]=Ue(d,!0),y.addEventListener("progress",g)),x&&y.upload&&([m,j]=Ue(x),y.upload.addEventListener("progress",m),y.upload.addEventListener("loadend",j)),(o.cancelToken||o.signal)&&(u=A=>{y&&(s(!A||A.type?new be(null,e,y):A),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const C=un(o.url);if(C&&ee.protocols.indexOf(C)===-1){s(new U("Unsupported protocol "+C+":",U.ERR_BAD_REQUEST,e));return}y.send(a||null)})},bn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,o;const a=function(d){if(!o){o=!0,l();const u=d instanceof Error?d:this.reason;s.abort(u instanceof U?u:new be(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,a(new U(`timeout ${t} of ms exceeded`,U.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(a):d.removeEventListener("abort",a)}),e=null)};e.forEach(d=>d.addEventListener("abort",a));const{signal:x}=s;return x.unsubscribe=()=>p.asap(l),x}},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 a=0,i,l=x=>{i||(i=!0,s&&s(x))};return new ReadableStream({async pull(x){try{const{done:d,value:u}=await o.next();if(d){l(),x.close();return}let m=u.byteLength;if(r){let g=a+=m;r(g)}x.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(x){return l(x),o.return()}},{highWaterMark:2})},Lt=64*1024,{isFunction:De}=p,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Ft,TextEncoder:Mt}=p.global,Wt=(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?De(t):typeof fetch=="function",a=De(r),i=De(s);if(!o)return!1;const l=o&&De(Ft),x=o&&(typeof Mt=="function"?(c=>S=>c.encode(S))(new Mt):async c=>new Uint8Array(await new r(c).arrayBuffer())),d=a&&l&&Wt(()=>{let c=!1;const S=new r(ee.origin,{body:new Ft,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!S}),u=i&&l&&Wt(()=>p.isReadableStream(new s("").body)),m={stream:u&&(c=>c.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!m[c]&&(m[c]=(S,y)=>{let R=S&&S[c];if(R)return R.call(S);throw new U(`Response type '${c}' is not supported`,U.ERR_NOT_SUPPORT,y)})});const g=async c=>{if(c==null)return 0;if(p.isBlob(c))return c.size;if(p.isSpecCompliantForm(c))return(await new r(ee.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(p.isArrayBufferView(c)||p.isArrayBuffer(c))return c.byteLength;if(p.isURLSearchParams(c)&&(c=c+""),p.isString(c))return(await x(c)).byteLength},j=async(c,S)=>{const y=p.toFiniteNumber(c.getContentLength());return y??g(S)};return async c=>{let{url:S,method:y,data:R,signal:C,cancelToken:A,timeout:P,onDownloadProgress:M,onUploadProgress:b,responseType:$,headers:k,withCredentials:L="same-origin",fetchOptions:V}=Ut(c),W=t||fetch;$=$?($+"").toLowerCase():"text";let Y=bn([C,A&&A.toAbortSignal()],P),Z=null;const I=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let X;try{if(b&&d&&y!=="get"&&y!=="head"&&(X=await j(k,R))!==0){let f=new r(S,{method:"POST",body:R,duplex:"half"}),v;if(p.isFormData(R)&&(v=f.headers.get("content-type"))&&k.setContentType(v),f.body){const[N,h]=zt(X,Ue(At(b)));R=Dt(f.body,Lt,N,h)}}p.isString(L)||(L=L?"include":"omit");const K=a&&"credentials"in r.prototype,z={...V,signal:Y,method:y.toUpperCase(),headers:k.normalize().toJSON(),body:R,duplex:"half",credentials:K?L:void 0};Z=a&&new r(S,z);let O=await(a?W(Z,V):W(S,z));const ne=u&&($==="stream"||$==="response");if(u&&(M||ne&&I)){const f={};["status","statusText","headers"].forEach(E=>{f[E]=O[E]});const v=p.toFiniteNumber(O.headers.get("content-length")),[N,h]=M&&zt(v,Ue(At(M),!0))||[];O=new s(Dt(O.body,Lt,N,()=>{h&&h(),I&&I()}),f)}$=$||"text";let J=await m[p.findKey(m,$)||"text"](O,c);return!ne&&I&&I(),await new Promise((f,v)=>{_t(f,v,{data:J,headers:re.from(O.headers),status:O.status,statusText:O.statusText,config:c,request:Z})})}catch(K){throw I&&I(),K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,c,Z),{cause:K.cause||K}):U.from(K,K&&K.code,c,Z)}}},En=new Map,Bt=e=>{let t=e?e.env:{};const{fetch:r,Request:s,Response:o}=t,a=[s,o,r];let i=a.length,l=i,x,d,u=En;for(;l--;)x=a[l],d=u.get(x),d===void 0&&u.set(x,d=l?new Map:kn(t)),u=d;return d};Bt();const Ze={http:Vr,xhr:yn,fetch:{get:Bt}};p.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const qt=e=>`- ${e}`,Cn=e=>p.isFunction(e)||e===null||e===!1,Ht={getAdapter:(e,t)=>{e=p.isArray(e)?e:[e];const{length:r}=e;let s,o;const a={};for(let i=0;i<r;i++){s=e[i];let l;if(o=s,!Cn(s)&&(o=Ze[(l=String(s)).toLowerCase()],o===void 0))throw new U(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(t))))break;a[l||"#"+i]=o}if(!o){const i=Object.entries(a).map(([x,d])=>`adapter ${x} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?i.length>1?`since :
1
+ (function(Q,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(Q=typeof globalThis<"u"?globalThis:Q||self,w(Q.NeuctraAuthix={},Q.React))})(this,(function(Q,w){"use strict";function ut(e,t){return function(){return e.apply(t,arguments)}}const{toString:lr}=Object.prototype,{getPrototypeOf:qe}=Object,{iterator:Re,toStringTag:pt}=Symbol,ze=(e=>t=>{const n=lr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),se=e=>(e=e.toLowerCase(),t=>ze(t)===e),_e=e=>t=>typeof t===e,{isArray:me}=Array,ye=_e("undefined");function je(e){return e!==null&&!ye(e)&&e.constructor!==null&&!ye(e.constructor)&&te(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ft=se("ArrayBuffer");function dr(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ft(e.buffer),t}const cr=_e("string"),te=_e("function"),xt=_e("number"),ve=e=>e!==null&&typeof e=="object",ur=e=>e===!0||e===!1,Ae=e=>{if(ze(e)!=="object")return!1;const t=qe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(pt in e)&&!(Re in e)},pr=e=>{if(!ve(e)||je(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=>ve(e)&&te(e.pipe),yr=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||te(e.append)&&((t=ze(e))==="formdata"||t==="object"&&te(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 ke(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,o;if(typeof e!="object"&&(e=[e]),me(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{if(je(e))return;const a=n?Object.getOwnPropertyNames(e):Object.keys(e),i=a.length;let l;for(s=0;s<i;s++)l=a[s],t.call(null,e[l],l,e)}}function ht(e,t){if(je(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,o;for(;s-- >0;)if(o=n[s],t===o.toLowerCase())return o;return null}const fe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gt=e=>!ye(e)&&e!==fe;function He(){const{caseless:e,skipUndefined:t}=gt(this)&&this||{},n={},s=(o,a)=>{const i=e&&ht(n,a)||a;Ae(n[i])&&Ae(o)?n[i]=He(n[i],o):Ae(o)?n[i]=He({},o):me(o)?n[i]=o.slice():(!t||!ye(o))&&(n[i]=o)};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&ke(arguments[o],s);return n}const Er=(e,t,n,{allOwnKeys:s}={})=>(ke(t,(o,a)=>{n&&te(o)?e[a]=ut(o,n):e[a]=o},{allOwnKeys:s}),e),Cr=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tr=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Ir=(e,t,n,s)=>{let o,a,i;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)i=o[a],(!s||s(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&qe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Pr=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Or=e=>{if(!e)return null;if(me(e))return e;let t=e.length;if(!xt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Rr=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qe(Uint8Array)),zr=(e,t)=>{const s=(e&&e[Re]).call(e);let o;for(;(o=s.next())&&!o.done;){const a=o.value;t.call(e,a[0],a[1])}},_r=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Ar=se("HTMLFormElement"),$r=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,o){return s.toUpperCase()+o}),mt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Nr=se("RegExp"),yt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};ke(n,(o,a)=>{let i;(i=t(o,a,e))!==!1&&(s[a]=i||o)}),Object.defineProperties(e,s)},Ur=e=>{yt(e,(t,n)=>{if(te(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(te(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Dr=(e,t)=>{const n={},s=o=>{o.forEach(a=>{n[a]=!0})};return me(e)?s(e):s(String(e).split(t)),n},Lr=()=>{},Fr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Mr(e){return!!(e&&te(e.append)&&e[pt]==="FormData"&&e[Re])}const Wr=e=>{const t=new Array(10),n=(s,o)=>{if(ve(s)){if(t.indexOf(s)>=0)return;if(je(s))return s;if(!("toJSON"in s)){t[o]=s;const a=me(s)?[]:{};return ke(s,(i,l)=>{const x=n(i,o+1);!ye(x)&&(a[l]=x)}),t[o]=void 0,a}}return s};return n(e,0)},Br=se("AsyncFunction"),qr=e=>e&&(ve(e)||te(e))&&te(e.then)&&te(e.catch),bt=((e,t)=>e?setImmediate:t?((n,s)=>(fe.addEventListener("message",({source:o,data:a})=>{o===fe&&a===n&&s.length&&s.shift()()},!1),o=>{s.push(o),fe.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",te(fe.postMessage)),Hr=typeof queueMicrotask<"u"?queueMicrotask.bind(fe):typeof process<"u"&&process.nextTick||bt,p={isArray:me,isArrayBuffer:ft,isBuffer:je,isFormData:yr,isArrayBufferView:dr,isString:cr,isNumber:xt,isBoolean:ur,isObject:ve,isPlainObject:Ae,isEmptyObject:pr,isReadableStream:wr,isRequest:Sr,isResponse:jr,isHeaders:vr,isUndefined:ye,isDate:fr,isFile:xr,isBlob:hr,isRegExp:Nr,isFunction:te,isStream:mr,isURLSearchParams:br,isTypedArray:Rr,isFileList:gr,forEach:ke,merge:He,extend:Er,trim:kr,stripBOM:Cr,inherits:Tr,toFlatObject:Ir,kindOf:ze,kindOfTest:se,endsWith:Pr,toArray:Or,forEachEntry:zr,matchAll:_r,isHTMLForm:Ar,hasOwnProperty:mt,hasOwnProp:mt,reduceDescriptors:yt,freezeMethods:Ur,toObjectSet:Dr,toCamelCase:$r,noop:Lr,toFiniteNumber:Fr,findKey:ht,global:fe,isContextDefined:gt,isSpecCompliantForm:Mr,toJSONObject:Wr,isAsyncFn:Br,isThenable:qr,setImmediate:bt,asap:Hr,isIterable:e=>e!=null&&te(e[Re])};function D(e,t,n,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),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(D,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 wt=D.prototype,St={};["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=>{St[e]={value:e}}),Object.defineProperties(D,St),Object.defineProperty(wt,"isAxiosError",{value:!0}),D.from=(e,t,n,s,o,a)=>{const i=Object.create(wt);p.toFlatObject(e,i,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",x=t==null&&e?e.code:t;return D.call(i,l,x,n,s,o),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",a&&Object.assign(i,a),i};const Vr=null;function Ve(e){return p.isPlainObject(e)||p.isArray(e)}function jt(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function vt(e,t,n){return e?e.concat(t).map(function(o,a){return o=jt(o),!n&&a?"["+o+"]":o}).join(n?".":""):t}function Yr(e){return p.isArray(e)&&!e.some(Ve)}const Kr=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function $e(e,t,n){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=p.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(j,m){return!p.isUndefined(m[j])});const s=n.metaTokens,o=n.visitor||u,a=n.dots,i=n.indexes,x=(n.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(p.isDate(c))return c.toISOString();if(p.isBoolean(c))return c.toString();if(!x&&p.isBlob(c))throw new D("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(c)||p.isTypedArray(c)?x&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,j,m){let A=c;if(c&&!m&&typeof c=="object"){if(p.endsWith(j,"{}"))j=s?j:j.slice(0,-2),c=JSON.stringify(c);else if(p.isArray(c)&&Yr(c)||(p.isFileList(c)||p.endsWith(j,"[]"))&&(A=p.toArray(c)))return j=jt(j),A.forEach(function($,T){!(p.isUndefined($)||$===null)&&t.append(i===!0?vt([j],T,a):i===null?j:j+"[]",d($))}),!1}return Ve(c)?!0:(t.append(vt(m,j,a),d(c)),!1)}const b=[],y=Object.assign(Kr,{defaultVisitor:u,convertValue:d,isVisitable:Ve});function S(c,j){if(!p.isUndefined(c)){if(b.indexOf(c)!==-1)throw Error("Circular reference detected in "+j.join("."));b.push(c),p.forEach(c,function(A,P){(!(p.isUndefined(A)||A===null)&&o.call(t,A,p.isString(P)?P.trim():P,j,y))===!0&&S(A,j?j.concat(P):[P])}),b.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return S(e),t}function kt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ye(e,t){this._pairs=[],e&&$e(e,this,t)}const Et=Ye.prototype;Et.append=function(t,n){this._pairs.push([t,n])},Et.toString=function(t){const n=t?function(s){return t.call(this,s,kt)}:kt;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function Jr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ct(e,t,n){if(!t)return e;const s=n&&n.encode||Jr;p.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let a;if(o?a=o(t,n):a=p.isURLSearchParams(t)?t.toString():new Ye(t,n).toString(s),a){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class Tt{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,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 It={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ye,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ke=typeof window<"u"&&typeof document<"u",Je=typeof navigator=="object"&&navigator||void 0,Gr=Ke&&(!Je||["ReactNative","NativeScript","NS"].indexOf(Je.product)<0),Zr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qr=Ke&&window.location.href||"http://localhost",ee={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ke,hasStandardBrowserEnv:Gr,hasStandardBrowserWebWorkerEnv:Zr,navigator:Je,origin:Qr},Symbol.toStringTag,{value:"Module"})),...Xr};function en(e,t){return $e(e,new ee.classes.URLSearchParams,{visitor:function(n,s,o,a){return ee.isNode&&p.isBuffer(n)?(this.append(s,n.toString("base64")),!1):a.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={},n=Object.keys(e);let s;const o=n.length;let a;for(s=0;s<o;s++)a=n[s],t[a]=e[a];return t}function Pt(e){function t(n,s,o,a){let i=n[a++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),x=a>=n.length;return i=!i&&p.isArray(o)?o.length:i,x?(p.hasOwnProp(o,i)?o[i]=[o[i],s]:o[i]=s,!l):((!o[i]||!p.isObject(o[i]))&&(o[i]=[]),t(n,s,o[i],a)&&p.isArray(o[i])&&(o[i]=rn(o[i])),!l)}if(p.isFormData(e)&&p.isFunction(e.entries)){const n={};return p.forEachEntry(e,(s,o)=>{t(tn(s),o,n,0)}),n}return null}function nn(e,t,n){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Ee={transitional:It,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",o=s.indexOf("application/json")>-1,a=p.isObject(t);if(a&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o?JSON.stringify(Pt(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 n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){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 x=this.env&&this.env.FormData;return $e(l?{"files[]":t}:t,x&&new x,this.formSerializer)}}return a||o?(n.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const n=this.transitional||Ee.transitional,s=n&&n.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(t)||p.isReadableStream(t))return t;if(t&&p.isString(t)&&(s&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?D.from(l,D.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}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ee.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 n,s,o;return e&&e.split(`
2
+ `).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),s=i.substring(o+1).trim(),!(!n||t[n]&&sn[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},Ot=Symbol("internals");function Ce(e){return e&&String(e).trim().toLowerCase()}function Ne(e){return e===!1||e==null?e:p.isArray(e)?e.map(Ne):String(e)}function an(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const ln=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Xe(e,t,n,s,o){if(p.isFunction(s))return s.call(this,t,n);if(o&&(t=n),!!p.isString(t)){if(p.isString(s))return t.indexOf(s)!==-1;if(p.isRegExp(s))return s.test(t)}}function dn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function cn(e,t){const n=p.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(o,a,i){return this[s].call(this,t,o,a,i)},configurable:!0})})}let re=class{constructor(t){t&&this.set(t)}set(t,n,s){const o=this;function a(l,x,d){const u=Ce(x);if(!u)throw new Error("header name must be a non-empty string");const b=p.findKey(o,u);(!b||o[b]===void 0||d===!0||d===void 0&&o[b]!==!1)&&(o[b||x]=Ne(l))}const i=(l,x)=>p.forEach(l,(d,u)=>a(d,u,x));if(p.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(p.isString(t)&&(t=t.trim())&&!ln(t))i(on(t),n);else if(p.isObject(t)&&p.isIterable(t)){let l={},x,d;for(const u of t){if(!p.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[d=u[0]]=(x=l[d])?p.isArray(x)?[...x,u[1]]:[x,u[1]]:u[1]}i(l,n)}else t!=null&&a(n,t,s);return this}get(t,n){if(t=Ce(t),t){const s=p.findKey(this,t);if(s){const o=this[s];if(!n)return o;if(n===!0)return an(o);if(p.isFunction(n))return n.call(this,o,s);if(p.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ce(t),t){const s=p.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Xe(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let o=!1;function a(i){if(i=Ce(i),i){const l=p.findKey(s,i);l&&(!n||Xe(s,s[l],l,n))&&(delete s[l],o=!0)}}return p.isArray(t)?t.forEach(a):a(t),o}clear(t){const n=Object.keys(this);let s=n.length,o=!1;for(;s--;){const a=n[s];(!t||Xe(this,this[a],a,t,!0))&&(delete this[a],o=!0)}return o}normalize(t){const n=this,s={};return p.forEach(this,(o,a)=>{const i=p.findKey(s,a);if(i){n[i]=Ne(o),delete n[a];return}const l=t?dn(a):String(a).trim();l!==a&&delete n[a],n[l]=Ne(o),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return p.forEach(this,(s,o)=>{s!=null&&s!==!1&&(n[o]=t&&p.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).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,...n){const s=new this(t);return n.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Ot]=this[Ot]={accessors:{}}).accessors,o=this.prototype;function a(i){const l=Ce(i);s[l]||(cn(o,i),s[l]=!0)}return p.isArray(t)?t.forEach(a):a(t),this}};re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(re.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}}),p.freezeMethods(re);function Ge(e,t){const n=this||Ee,s=t||n,o=re.from(s.headers);let a=s.data;return p.forEach(e,function(l){a=l.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Rt(e){return!!(e&&e.__CANCEL__)}function be(e,t,n){D.call(this,e??"canceled",D.ERR_CANCELED,t,n),this.name="CanceledError"}p.inherits(be,D,{__CANCEL__:!0});function zt(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new D("Request failed with status code "+n.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function un(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function pn(e,t){e=e||10;const n=new Array(e),s=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(x){const d=Date.now(),u=s[a];i||(i=d),n[o]=x,s[o]=d;let b=a,y=0;for(;b!==o;)y+=n[b++],b=b%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),d-i<t)return;const S=u&&d-u;return S?Math.round(y*1e3/S):void 0}}function fn(e,t){let n=0,s=1e3/t,o,a;const i=(d,u=Date.now())=>{n=u,o=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const u=Date.now(),b=u-n;b>=s?i(d,u):(o=d,a||(a=setTimeout(()=>{a=null,i(o)},s-b)))},()=>o&&i(o)]}const Ue=(e,t,n=3)=>{let s=0;const o=pn(50,250);return fn(a=>{const i=a.loaded,l=a.lengthComputable?a.total:void 0,x=i-s,d=o(x),u=i<=l;s=i;const b={loaded:i,total:l,progress:l?i/l:void 0,bytes:x,rate:d||void 0,estimated:d&&l&&u?(l-i)/d:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(b)},n)},_t=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},At=e=>(...t)=>p.asap(()=>e(...t)),xn=ee.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ee.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,hn=ee.hasStandardBrowserEnv?{write(e,t,n,s,o,a){const i=[e+"="+encodeURIComponent(t)];p.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),p.isString(s)&&i.push("path="+s),p.isString(o)&&i.push("domain="+o),a===!0&&i.push("secure"),document.cookie=i.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 $t(e,t,n){let s=!gn(t);return e&&(s||n==!1)?mn(e,t):t}const Nt=e=>e instanceof re?{...e}:e;function xe(e,t){t=t||{};const n={};function s(d,u,b,y){return p.isPlainObject(d)&&p.isPlainObject(u)?p.merge.call({caseless:y},d,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(d,u,b,y){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d,b,y)}else return s(d,u,b,y)}function a(d,u){if(!p.isUndefined(u))return s(void 0,u)}function i(d,u){if(p.isUndefined(u)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,u)}function l(d,u,b){if(b in t)return s(d,u);if(b in e)return s(void 0,d)}const x={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(d,u,b)=>o(Nt(d),Nt(u),b,!0)};return p.forEach(Object.keys({...e,...t}),function(u){const b=x[u]||o,y=b(e[u],t[u],u);p.isUndefined(y)&&b!==l||(n[u]=y)}),n}const Ut=e=>{const t=xe({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:l}=t;if(t.headers=i=re.from(i),t.url=Ct($t(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(n)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(p.isFunction(n.getHeaders)){const x=n.getHeaders(),d=["content-type","content-length"];Object.entries(x).forEach(([u,b])=>{d.includes(u.toLowerCase())&&i.set(u,b)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(t)),s||s!==!1&&xn(t.url))){const x=o&&a&&hn.read(a);x&&i.set(o,x)}return t},yn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,s){const o=Ut(e);let a=o.data;const i=re.from(o.headers).normalize();let{responseType:l,onUploadProgress:x,onDownloadProgress:d}=o,u,b,y,S,c;function j(){S&&S(),c&&c(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout;function A(){if(!m)return;const $=re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),M={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:$,config:e,request:m};zt(function(O){n(O),j()},function(O){s(O),j()},M),m=null}"onloadend"in m?m.onloadend=A:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(A)},m.onabort=function(){m&&(s(new D("Request aborted",D.ECONNABORTED,e,m)),m=null)},m.onerror=function(T){const M=T&&T.message?T.message:"Network Error",g=new D(M,D.ERR_NETWORK,e,m);g.event=T||null,s(g),m=null},m.ontimeout=function(){let T=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const M=o.transitional||It;o.timeoutErrorMessage&&(T=o.timeoutErrorMessage),s(new D(T,M.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,e,m)),m=null},a===void 0&&i.setContentType(null),"setRequestHeader"in m&&p.forEach(i.toJSON(),function(T,M){m.setRequestHeader(M,T)}),p.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),l&&l!=="json"&&(m.responseType=o.responseType),d&&([y,c]=Ue(d,!0),m.addEventListener("progress",y)),x&&m.upload&&([b,S]=Ue(x),m.upload.addEventListener("progress",b),m.upload.addEventListener("loadend",S)),(o.cancelToken||o.signal)&&(u=$=>{m&&(s(!$||$.type?new be(null,e,m):$),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const P=un(o.url);if(P&&ee.protocols.indexOf(P)===-1){s(new D("Unsupported protocol "+P+":",D.ERR_BAD_REQUEST,e));return}m.send(a||null)})},bn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,o;const a=function(d){if(!o){o=!0,l();const u=d instanceof Error?d:this.reason;s.abort(u instanceof D?u:new be(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,a(new D(`timeout ${t} of ms exceeded`,D.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(a):d.removeEventListener("abort",a)}),e=null)};e.forEach(d=>d.addEventListener("abort",a));const{signal:x}=s;return x.unsubscribe=()=>p.asap(l),x}},wn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,o;for(;s<n;)o=s+t,yield e.slice(s,o),s=o},Sn=async function*(e,t){for await(const n of jn(e))yield*wn(n,t)},jn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},Dt=(e,t,n,s)=>{const o=Sn(e,t);let a=0,i,l=x=>{i||(i=!0,s&&s(x))};return new ReadableStream({async pull(x){try{const{done:d,value:u}=await o.next();if(d){l(),x.close();return}let b=u.byteLength;if(n){let y=a+=b;n(y)}x.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(x){return l(x),o.return()}},{highWaterMark:2})},Lt=64*1024,{isFunction:De}=p,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(p.global),{ReadableStream:Ft,TextEncoder:Mt}=p.global,Wt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kn=e=>{e=p.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:n,Response:s}=e,o=t?De(t):typeof fetch=="function",a=De(n),i=De(s);if(!o)return!1;const l=o&&De(Ft),x=o&&(typeof Mt=="function"?(c=>j=>c.encode(j))(new Mt):async c=>new Uint8Array(await new n(c).arrayBuffer())),d=a&&l&&Wt(()=>{let c=!1;const j=new n(ee.origin,{body:new Ft,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!j}),u=i&&l&&Wt(()=>p.isReadableStream(new s("").body)),b={stream:u&&(c=>c.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!b[c]&&(b[c]=(j,m)=>{let A=j&&j[c];if(A)return A.call(j);throw new D(`Response type '${c}' is not supported`,D.ERR_NOT_SUPPORT,m)})});const y=async c=>{if(c==null)return 0;if(p.isBlob(c))return c.size;if(p.isSpecCompliantForm(c))return(await new n(ee.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(p.isArrayBufferView(c)||p.isArrayBuffer(c))return c.byteLength;if(p.isURLSearchParams(c)&&(c=c+""),p.isString(c))return(await x(c)).byteLength},S=async(c,j)=>{const m=p.toFiniteNumber(c.getContentLength());return m??y(j)};return async c=>{let{url:j,method:m,data:A,signal:P,cancelToken:$,timeout:T,onDownloadProgress:M,onUploadProgress:g,responseType:O,headers:v,withCredentials:U="same-origin",fetchOptions:q}=Ut(c),F=t||fetch;O=O?(O+"").toLowerCase():"text";let Y=bn([P,$&&$.toAbortSignal()],T),Z=null;const I=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let X;try{if(g&&d&&m!=="get"&&m!=="head"&&(X=await S(v,A))!==0){let f=new n(j,{method:"POST",body:A,duplex:"half"}),k;if(p.isFormData(A)&&(k=f.headers.get("content-type"))&&v.setContentType(k),f.body){const[N,h]=_t(X,Ue(At(g)));A=Dt(f.body,Lt,N,h)}}p.isString(U)||(U=U?"include":"omit");const K=a&&"credentials"in n.prototype,_={...q,signal:Y,method:m.toUpperCase(),headers:v.normalize().toJSON(),body:A,duplex:"half",credentials:K?U:void 0};Z=a&&new n(j,_);let R=await(a?F(Z,q):F(j,_));const ne=u&&(O==="stream"||O==="response");if(u&&(M||ne&&I)){const f={};["status","statusText","headers"].forEach(E=>{f[E]=R[E]});const k=p.toFiniteNumber(R.headers.get("content-length")),[N,h]=M&&_t(k,Ue(At(M),!0))||[];R=new s(Dt(R.body,Lt,N,()=>{h&&h(),I&&I()}),f)}O=O||"text";let J=await b[p.findKey(b,O)||"text"](R,c);return!ne&&I&&I(),await new Promise((f,k)=>{zt(f,k,{data:J,headers:re.from(R.headers),status:R.status,statusText:R.statusText,config:c,request:Z})})}catch(K){throw I&&I(),K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,c,Z),{cause:K.cause||K}):D.from(K,K&&K.code,c,Z)}}},En=new Map,Bt=e=>{let t=e?e.env:{};const{fetch:n,Request:s,Response:o}=t,a=[s,o,n];let i=a.length,l=i,x,d,u=En;for(;l--;)x=a[l],d=u.get(x),d===void 0&&u.set(x,d=l?new Map:kn(t)),u=d;return d};Bt();const Ze={http:Vr,xhr:yn,fetch:{get:Bt}};p.forEach(Ze,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const qt=e=>`- ${e}`,Cn=e=>p.isFunction(e)||e===null||e===!1,Ht={getAdapter:(e,t)=>{e=p.isArray(e)?e:[e];const{length:n}=e;let s,o;const a={};for(let i=0;i<n;i++){s=e[i];let l;if(o=s,!Cn(s)&&(o=Ze[(l=String(s)).toLowerCase()],o===void 0))throw new D(`Unknown adapter '${l}'`);if(o&&(p.isFunction(o)||(o=o.get(t))))break;a[l||"#"+i]=o}if(!o){const i=Object.entries(a).map(([x,d])=>`adapter ${x} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
4
4
  `+i.map(qt).join(`
5
- `):" "+qt(i[0]):"as no adapter specified";throw new U("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Ze};function Qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new be(null,e)}function Vt(e){return Qe(e),e.headers=re.from(e.headers),e.data=Ge.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ht.getAdapter(e.adapter||Ee.adapter,e)(e).then(function(s){return Qe(e),s.data=Ge.call(e,e.transformResponse,s),s.headers=re.from(s.headers),s},function(s){return Rt(s)||(Qe(e),s&&s.response&&(s.response.data=Ge.call(e,e.transformResponse,s.response),s.response.headers=re.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 Kt={};Le.transitional=function(t,r,s){function o(a,i){return"[Axios v"+Yt+"] Transitional option '"+a+"'"+i+(s?". "+s:"")}return(a,i,l)=>{if(t===!1)throw new U(o(i," has been removed"+(r?" in "+r:"")),U.ERR_DEPRECATED);return r&&!Kt[i]&&(Kt[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(a,i,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 U("options must be an object",U.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const a=s[o],i=t[a];if(i){const l=e[a],x=l===void 0||i(l,a,e);if(x!==!0)throw new U("option "+a+" must be "+x,U.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new U("Unknown option "+a,U.ERR_BAD_OPTION)}}const Fe={assertOptions:Tn,validators:Le},ie=Fe.validators;let he=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Tt,response:new Tt}}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 a=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?a&&!String(s.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+a):s.stack=a}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=xe(this.defaults,r);const{transitional:s,paramsSerializer:o,headers:a}=r;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:Fe.assertOptions(o,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Fe.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=a&&p.merge(a.common,a[r.method]);a&&p.forEach(["delete","get","head","post","put","patch","common"],c=>{delete a[c]}),r.headers=re.concat(i,a);const l=[];let x=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(r)===!1||(x=x&&S.synchronous,l.unshift(S.fulfilled,S.rejected))});const d=[];this.interceptors.response.forEach(function(S){d.push(S.fulfilled,S.rejected)});let u,m=0,g;if(!x){const c=[Vt.bind(this),void 0];for(c.unshift(...l),c.push(...d),g=c.length,u=Promise.resolve(r);m<g;)u=u.then(c[m++],c[m++]);return u}g=l.length;let j=r;for(;m<g;){const c=l[m++],S=l[m++];try{j=c(j)}catch(y){S.call(this,y);break}}try{u=Vt.call(this,j)}catch(c){return Promise.reject(c)}for(m=0,g=d.length;m<g;)u=u.then(d[m++],d[m++]);return u}getUri(t){t=xe(this.defaults,t);const r=Nt(t.baseURL,t.url,t.allowAbsoluteUrls);return Ct(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){he.prototype[t]=function(r,s){return this.request(xe(s||{},{method:t,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(t){function r(s){return function(a,i,l){return this.request(xe(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}he.prototype[t]=r(),he.prototype[t+"Form"]=r(!0)});let In=class ar{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(a){r=a});const s=this;this.promise.then(o=>{if(!s._listeners)return;let a=s._listeners.length;for(;a-- >0;)s._listeners[a](o);s._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{s.subscribe(l),a=l}).then(o);return i.cancel=function(){s.unsubscribe(a)},i},t(function(a,i,l){s.reason||(s.reason=new be(a,i,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 ar(function(o){t=o}),cancel:t}}};function Pn(e){return function(r){return e.apply(null,r)}}function On(e){return p.isObject(e)&&e.isAxiosError===!0}const et={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(et).forEach(([e,t])=>{et[t]=e});function Jt(e){const t=new he(e),r=ut(he.prototype.request,t);return p.extend(r,he.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Jt(xe(e,o))},r}const F=Jt(Ee);F.Axios=he,F.CanceledError=be,F.CancelToken=In,F.isCancel=Rt,F.VERSION=Yt,F.toFormData=Ne,F.AxiosError=U,F.Cancel=F.CanceledError,F.all=function(t){return Promise.all(t)},F.spread=Pn,F.isAxiosError=On,F.mergeConfig=xe,F.AxiosHeaders=re,F.formToJSON=e=>Pt(p.isHTMLForm(e)?new FormData(e):e),F.getAdapter=Ht.getAdapter,F.HttpStatusCode=et,F.default=F;const{Axios:bs,AxiosError:ws,CanceledError:Ss,isCancel:js,CancelToken:vs,VERSION:ks,all:Es,Cancel:Cs,isAxiosError:Ts,spread:Is,toFormData:Ps,AxiosHeaders:Os,HttpStatusCode:Rs,formToJSON:_s,getAdapter:zs,mergeConfig:As}=F;class Rn{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=F.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 a={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:t,data:a,headers:o})).data}catch(a){if(console.error("❌ [Request Error]:",a),a.isAxiosError){const i=a.response?.status||0,l=a.response?.data?.message||a.message||"Unknown Axios error occurred";throw new Error(`Request failed (${i}): ${l}`)}throw new Error(`Unexpected error: ${a.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:a}=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:a||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:a}=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:a||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 Me={exports:{}},Te={};/**
5
+ `):" "+qt(i[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Ze};function Qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new be(null,e)}function Vt(e){return Qe(e),e.headers=re.from(e.headers),e.data=Ge.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ht.getAdapter(e.adapter||Ee.adapter,e)(e).then(function(s){return Qe(e),s.data=Ge.call(e,e.transformResponse,s),s.headers=re.from(s.headers),s},function(s){return Rt(s)||(Qe(e),s&&s.response&&(s.response.data=Ge.call(e,e.transformResponse,s.response),s.response.headers=re.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 Kt={};Le.transitional=function(t,n,s){function o(a,i){return"[Axios v"+Yt+"] Transitional option '"+a+"'"+i+(s?". "+s:"")}return(a,i,l)=>{if(t===!1)throw new D(o(i," has been removed"+(n?" in "+n:"")),D.ERR_DEPRECATED);return n&&!Kt[i]&&(Kt[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,l):!0}},Le.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Tn(e,t,n){if(typeof e!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const a=s[o],i=t[a];if(i){const l=e[a],x=l===void 0||i(l,a,e);if(x!==!0)throw new D("option "+a+" must be "+x,D.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new D("Unknown option "+a,D.ERR_BAD_OPTION)}}const Fe={assertOptions:Tn,validators:Le},ie=Fe.validators;let he=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Tt,response:new Tt}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?a&&!String(s.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
+ `+a):s.stack=a}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=xe(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:a}=n;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),o!=null&&(p.isFunction(o)?n.paramsSerializer={serialize:o}:Fe.assertOptions(o,{encode:ie.function,serialize:ie.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Fe.assertOptions(n,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&p.merge(a.common,a[n.method]);a&&p.forEach(["delete","get","head","post","put","patch","common"],c=>{delete a[c]}),n.headers=re.concat(i,a);const l=[];let x=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(n)===!1||(x=x&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let u,b=0,y;if(!x){const c=[Vt.bind(this),void 0];for(c.unshift(...l),c.push(...d),y=c.length,u=Promise.resolve(n);b<y;)u=u.then(c[b++],c[b++]);return u}y=l.length;let S=n;for(;b<y;){const c=l[b++],j=l[b++];try{S=c(S)}catch(m){j.call(this,m);break}}try{u=Vt.call(this,S)}catch(c){return Promise.reject(c)}for(b=0,y=d.length;b<y;)u=u.then(d[b++],d[b++]);return u}getUri(t){t=xe(this.defaults,t);const n=$t(t.baseURL,t.url,t.allowAbsoluteUrls);return Ct(n,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){he.prototype[t]=function(n,s){return this.request(xe(s||{},{method:t,url:n,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(t){function n(s){return function(a,i,l){return this.request(xe(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}he.prototype[t]=n(),he.prototype[t+"Form"]=n(!0)});let In=class ar{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const s=this;this.promise.then(o=>{if(!s._listeners)return;let a=s._listeners.length;for(;a-- >0;)s._listeners[a](o);s._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{s.subscribe(l),a=l}).then(o);return i.cancel=function(){s.unsubscribe(a)},i},t(function(a,i,l){s.reason||(s.reason=new be(a,i,l),n(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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ar(function(o){t=o}),cancel:t}}};function Pn(e){return function(n){return e.apply(null,n)}}function On(e){return p.isObject(e)&&e.isAxiosError===!0}const et={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(et).forEach(([e,t])=>{et[t]=e});function Jt(e){const t=new he(e),n=ut(he.prototype.request,t);return p.extend(n,he.prototype,t,{allOwnKeys:!0}),p.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Jt(xe(e,o))},n}const W=Jt(Ee);W.Axios=he,W.CanceledError=be,W.CancelToken=In,W.isCancel=Rt,W.VERSION=Yt,W.toFormData=$e,W.AxiosError=D,W.Cancel=W.CanceledError,W.all=function(t){return Promise.all(t)},W.spread=Pn,W.isAxiosError=On,W.mergeConfig=xe,W.AxiosHeaders=re,W.formToJSON=e=>Pt(p.isHTMLForm(e)?new FormData(e):e),W.getAdapter=Ht.getAdapter,W.HttpStatusCode=et,W.default=W;const{Axios:bs,AxiosError:ws,CanceledError:Ss,isCancel:js,CancelToken:vs,VERSION:ks,all:Es,Cancel:Cs,isAxiosError:Ts,spread:Is,toFormData:Ps,AxiosHeaders:Os,HttpStatusCode:Rs,formToJSON:zs,getAdapter:_s,mergeConfig:As}=W;class Rn{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,n,s,o={}){if(!t)throw new Error("HTTP method is required");if(!n)throw new Error("Request path is required");try{const a={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:n,method:t,data:a,headers:o})).data}catch(a){if(console.error("❌ [Request Error]:",a),a.isAxiosError){const i=a.response?.status||0,l=a.response?.data?.message||a.message||"Unknown Axios error occurred";throw new Error(`Request failed (${i}): ${l}`)}throw new Error(`Unexpected error: ${a.message||"Unknown failure"}`)}}async signup(t){const{name:n,email:s,password:o}=t;if(!n||!s||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",t)}async login(t){const{email:n,password:s,appId:o}=t;if(!n||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:n,password:s,appId:o||this.appId})}async updateUser(t){const{userId:n,appId:s}=t;if(!n)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${n}`,{...t,appId:s||this.appId})}async changePassword(t){const{userId:n,currentPassword:s,newPassword:o,appId:a}=t;if(!n)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/${n}`,{currentPassword:s,newPassword:o,appId:a||this.appId})}async deleteUser(t){const{userId:n,appId:s}=t;if(!n)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${n}`,{appId:s||this.appId})}async getProfile(t){const{token:n}=t;if(!n)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${n}`})}async sendVerifyOTP(t){const{token:n,appId:s}=t;if(!n)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:s||this.appId},{Authorization:`Bearer ${n}`})}async verifyEmail(t){const{token:n,otp:s,appId:o}=t;if(!n)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 ${n}`})}async forgotPassword(t){const{email:n,appId:s}=t;if(!n)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:n,appId:s||this.appId})}async resetPassword(t){const{email:n,otp:s,newPassword:o,appId:a}=t;if(!n||!s||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:n,otp:s,newPassword:o,appId:a||this.appId})}async getUserData(t){const{userId:n}=t;if(!n)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${n}/data`)}async getSingleUserData(t){const{userId:n,dataId:s}=t;if(!n||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${n}/data/${s}`)}async addUserData(t){const{userId:n,data:s}=t;if(!n)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${n}/data`,s)}async updateUserData(t){const{userId:n,dataId:s,data:o}=t;if(!n||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!o)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${n}/data/${s}`,o)}async deleteUserData(t){const{userId:n,dataId:s}=t;if(!n||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${n}/data/${s}`)}}var Me={exports:{}},Te={};/**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
9
9
  *
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
- */var Xt;function _n(){if(Xt)return Te;Xt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,a){var i=null;if(a!==void 0&&(i=""+a),o.key!==void 0&&(i=""+o.key),"key"in o){a={};for(var l in o)l!=="key"&&(a[l]=o[l])}else a=o;return o=a.ref,{$$typeof:e,type:s,key:i,ref:o!==void 0?o:null,props:a}}return Te.Fragment=t,Te.jsx=r,Te.jsxs=r,Te}var Ie={};/**
14
+ */var Xt;function zn(){if(Xt)return Te;Xt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,o,a){var i=null;if(a!==void 0&&(i=""+a),o.key!==void 0&&(i=""+o.key),"key"in o){a={};for(var l in o)l!=="key"&&(a[l]=o[l])}else a=o;return o=a.ref,{$$typeof:e,type:s,key:i,ref:o!==void 0?o:null,props:a}}return Te.Fragment=t,Te.jsx=n,Te.jsxs=n,Te}var Ie={};/**
15
15
  * @license React
16
16
  * react-jsx-runtime.development.js
17
17
  *
@@ -19,17 +19,17 @@
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 Gt;function zn(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===W?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case y:return"Fragment";case C:return"Profiler";case R:return"StrictMode";case b:return"Suspense";case $:return"SuspenseList";case V: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 S:return"Portal";case P:return f.displayName||"Context";case A:return(f._context.displayName||"Context")+".Consumer";case M:var v=f.render;return f=f.displayName,f||(f=v.displayName||v.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case k:return v=f.displayName||null,v!==null?v:e(f.type)||"Memo";case L:v=f._payload,f=f._init;try{return e(f(v))}catch{}}return null}function t(f){return""+f}function r(f){try{t(f);var v=!1}catch{v=!0}if(v){v=console;var N=v.error,h=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return N.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),t(f)}}function s(f){if(f===y)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===L)return"<...>";try{var v=e(f);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function o(){var f=Y.A;return f===null?null:f.getOwner()}function a(){return Error("react-stack-top-frame")}function i(f){if(Z.call(f,"key")){var v=Object.getOwnPropertyDescriptor(f,"key").get;if(v&&v.isReactWarning)return!1}return f.key!==void 0}function l(f,v){function N(){K||(K=!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)",v))}N.isReactWarning=!0,Object.defineProperty(f,"key",{get:N,configurable:!0})}function x(){var f=e(this.type);return z[f]||(z[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,v,N,h,E,_){var B=N.ref;return f={$$typeof:c,type:f,key:v,props:N,_owner:h},(B!==void 0?B:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:x}):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:E}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,v,N,h,E,_){var B=v.children;if(B!==void 0)if(h)if(I(B)){for(h=0;h<B.length;h++)m(B[h]);Object.freeze&&Object.freeze(B)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(B);if(Z.call(v,"key")){B=e(f);var ae=Object.keys(v).filter(function(Oe){return Oe!=="key"});h=0<ae.length?"{key: someKey, "+ae.join(": ..., ")+": ...}":"{key: someKey}",J[B+h]||(ae=0<ae.length?"{"+ae.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
22
+ */var Gt;function _n(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===F?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case P:return"Profiler";case A:return"StrictMode";case g:return"Suspense";case O:return"SuspenseList";case q: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 j:return"Portal";case T:return f.displayName||"Context";case $:return(f._context.displayName||"Context")+".Consumer";case M:var k=f.render;return f=f.displayName,f||(f=k.displayName||k.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case v:return k=f.displayName||null,k!==null?k:e(f.type)||"Memo";case U:k=f._payload,f=f._init;try{return e(f(k))}catch{}}return null}function t(f){return""+f}function n(f){try{t(f);var k=!1}catch{k=!0}if(k){k=console;var N=k.error,h=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return N.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",h),t(f)}}function s(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===U)return"<...>";try{var k=e(f);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function o(){var f=Y.A;return f===null?null:f.getOwner()}function a(){return Error("react-stack-top-frame")}function i(f){if(Z.call(f,"key")){var k=Object.getOwnPropertyDescriptor(f,"key").get;if(k&&k.isReactWarning)return!1}return f.key!==void 0}function l(f,k){function N(){K||(K=!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)",k))}N.isReactWarning=!0,Object.defineProperty(f,"key",{get:N,configurable:!0})}function x(){var f=e(this.type);return _[f]||(_[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,k,N,h,E,z){var B=N.ref;return f={$$typeof:c,type:f,key:k,props:N,_owner:h},(B!==void 0?B:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:x}):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:E}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,k,N,h,E,z){var B=k.children;if(B!==void 0)if(h)if(I(B)){for(h=0;h<B.length;h++)b(B[h]);Object.freeze&&Object.freeze(B)}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 b(B);if(Z.call(k,"key")){B=e(f);var le=Object.keys(k).filter(function(Oe){return Oe!=="key"});h=0<le.length?"{key: someKey, "+le.join(": ..., ")+": ...}":"{key: someKey}",J[B+h]||(le=0<le.length?"{"+le.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} />`,h,B,ae,B),J[B+h]=!0)}if(B=null,N!==void 0&&(r(N),B=""+N),i(v)&&(r(v.key),B=""+v.key),"key"in v){N={};for(var pe in v)pe!=="key"&&(N[pe]=v[pe])}else N=v;return B&&l(N,typeof f=="function"?f.displayName||f.name||"Unknown":f),d(f,B,N,o(),E,_)}function m(f){g(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===L&&(f._payload.status==="fulfilled"?g(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function g(f){return typeof f=="object"&&f!==null&&f.$$typeof===c}var j=w,c=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),P=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),W=Symbol.for("react.client.reference"),Y=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,I=Array.isArray,X=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(f){return f()}};var K,z={},O=j.react_stack_bottom_frame.bind(j,a)(),ne=X(s(a)),J={};Ie.Fragment=y,Ie.jsx=function(f,v,N){var h=1e4>Y.recentlyCreatedOwnerStacks++;return u(f,v,N,!1,h?Error("react-stack-top-frame"):O,h?X(s(f)):ne)},Ie.jsxs=function(f,v,N){var h=1e4>Y.recentlyCreatedOwnerStacks++;return u(f,v,N,!0,h?Error("react-stack-top-frame"):O,h?X(s(f)):ne)}})()),Ie}var Zt;function An(){return Zt||(Zt=1,process.env.NODE_ENV==="production"?Me.exports=_n():Me.exports=zn()),Me.exports}var n=An();const Nn=async(e,t)=>{const{name:r,email:s,password:o,appId:a,phone:i,address:l,avatarUrl:x,isActive:d=!0,role:u="user"}=e,{baseUrl:m,apiKey:g}=t;if(!g)throw new Error("API key is required for signup");if(!r||!s||!o||!a)throw new Error("Name, email, password, and appId are required");try{const j=await F.post(`${m}/users/signup`,{name:r,email:s,password:o,appId:a,phone:i,address:l,avatarUrl:x,isActive:d,role:u},{headers:{"Content-Type":"application/json","x-api-key":g}});return j.data?.user&&localStorage.setItem("userInfo",JSON.stringify(j.data.user)),j.data.user}catch(j){const c=j.response?.data?.message||j.message||"Signup failed";if(console.error("Signup API Error:",c),j.response?.status===400){if(c.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(c.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:c,status:j.response?.status||500}}};/**
27
+ <%s key={someKey} {...props} />`,h,B,le,B),J[B+h]=!0)}if(B=null,N!==void 0&&(n(N),B=""+N),i(k)&&(n(k.key),B=""+k.key),"key"in k){N={};for(var pe in k)pe!=="key"&&(N[pe]=k[pe])}else N=k;return B&&l(N,typeof f=="function"?f.displayName||f.name||"Unknown":f),d(f,B,N,o(),E,z)}function b(f){y(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===U&&(f._payload.status==="fulfilled"?y(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function y(f){return typeof f=="object"&&f!==null&&f.$$typeof===c}var S=w,c=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),T=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),Y=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,I=Array.isArray,X=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(f){return f()}};var K,_={},R=S.react_stack_bottom_frame.bind(S,a)(),ne=X(s(a)),J={};Ie.Fragment=m,Ie.jsx=function(f,k,N){var h=1e4>Y.recentlyCreatedOwnerStacks++;return u(f,k,N,!1,h?Error("react-stack-top-frame"):R,h?X(s(f)):ne)},Ie.jsxs=function(f,k,N){var h=1e4>Y.recentlyCreatedOwnerStacks++;return u(f,k,N,!0,h?Error("react-stack-top-frame"):R,h?X(s(f)):ne)}})()),Ie}var Zt;function An(){return Zt||(Zt=1,process.env.NODE_ENV==="production"?Me.exports=zn():Me.exports=_n()),Me.exports}var r=An();const $n=async(e,t)=>{const{name:n,email:s,password:o,appId:a,phone:i,address:l,avatarUrl:x,isActive:d=!0,role:u="user"}=e,{baseUrl:b,apiKey:y}=t;if(!y)throw new Error("API key is required for signup");if(!n||!s||!o||!a)throw new Error("Name, email, password, and appId are required");try{const S=await W.post(`${b}/users/signup`,{name:n,email:s,password:o,appId:a,phone:i,address:l,avatarUrl:x,isActive:d,role:u},{headers:{"Content-Type":"application/json","x-api-key":y}});return S.data?.user&&localStorage.setItem("userInfo",JSON.stringify(S.data.user)),S.data.user}catch(S){const c=S.response?.data?.message||S.message||"Signup failed";if(console.error("Signup API Error:",c),S.response?.status===400){if(c.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(c.includes("inactive"))throw{success:!1,message:"Cannot signup under an inactive app",status:400}}throw S.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:c,status:S.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.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */const $n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Un=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase()),Qt=e=>{const t=Un(e);return t.charAt(0).toUpperCase()+t.slice(1)},er=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim(),Dn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
32
+ */const Nn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Un=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase()),Qt=e=>{const t=Un(e);return t.charAt(0).toUpperCase()+t.slice(1)},er=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim(),Dn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
33
33
  * @license lucide-react v0.544.0 - ISC
34
34
  *
35
35
  * This source code is licensed under the ISC license.
@@ -39,172 +39,172 @@ 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 Fn=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:o="",children:a,iconNode:i,...l},x)=>w.createElement("svg",{ref:x,...Ln,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:er("lucide",o),...!a&&!Dn(l)&&{"aria-hidden":"true"},...l},[...i.map(([d,u])=>w.createElement(d,u)),...Array.isArray(a)?a:[a]]));/**
42
+ */const Fn=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:a,iconNode:i,...l},x)=>w.createElement("svg",{ref:x,...Ln,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:er("lucide",o),...!a&&!Dn(l)&&{"aria-hidden":"true"},...l},[...i.map(([d,u])=>w.createElement(d,u)),...Array.isArray(a)?a:[a]]));/**
43
43
  * @license lucide-react v0.544.0 - ISC
44
44
  *
45
45
  * This source code is licensed under the ISC license.
46
46
  * See the LICENSE file in the root directory of this source tree.
47
- */const q=(e,t)=>{const r=w.forwardRef(({className:s,...o},a)=>w.createElement(Fn,{ref:a,iconNode:t,className:er(`lucide-${$n(Qt(e))}`,`lucide-${e}`,s),...o}));return r.displayName=Qt(e),r};/**
47
+ */const H=(e,t)=>{const n=w.forwardRef(({className:s,...o},a)=>w.createElement(Fn,{ref:a,iconNode:t,className:er(`lucide-${Nn(Qt(e))}`,`lucide-${e}`,s),...o}));return n.displayName=Qt(e),n};/**
48
48
  * @license lucide-react v0.544.0 - ISC
49
49
  *
50
50
  * This source code is licensed under the ISC license.
51
51
  * See the LICENSE file in the root directory of this source tree.
52
- */const tt=q("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
52
+ */const tt=H("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
53
53
  * @license lucide-react v0.544.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const Mn=q("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
57
+ */const Mn=H("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
58
58
  * @license lucide-react v0.544.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */const le=q("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
62
+ */const ae=H("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
63
63
  * @license lucide-react v0.544.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */const de=q("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
67
+ */const de=H("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
68
68
  * @license lucide-react v0.544.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const rt=q("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
72
+ */const rt=H("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
73
73
  * @license lucide-react v0.544.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const Wn=q("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
77
+ */const Wn=H("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
78
78
  * @license lucide-react v0.544.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const Bn=q("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
82
+ */const Bn=H("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
83
83
  * @license lucide-react v0.544.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
86
86
  * See the LICENSE file in the root directory of this source tree.
87
- */const nt=q("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
87
+ */const nt=H("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
88
88
  * @license lucide-react v0.544.0 - ISC
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const st=q("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
92
+ */const st=H("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
93
93
  * @license lucide-react v0.544.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
97
- */const qn=q("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/**
97
+ */const qn=H("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/**
98
98
  * @license lucide-react v0.544.0 - ISC
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const tr=q("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
102
+ */const tr=H("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
103
103
  * @license lucide-react v0.544.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const ot=q("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
107
+ */const rr=H("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
108
108
  * @license lucide-react v0.544.0 - ISC
109
109
  *
110
110
  * This source code is licensed under the ISC license.
111
111
  * See the LICENSE file in the root directory of this source tree.
112
- */const rr=q("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
112
+ */const ot=H("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
113
113
  * @license lucide-react v0.544.0 - ISC
114
114
  *
115
115
  * This source code is licensed under the ISC license.
116
116
  * See the LICENSE file in the root directory of this source tree.
117
- */const Hn=q("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
117
+ */const Hn=H("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
118
118
  * @license lucide-react v0.544.0 - ISC
119
119
  *
120
120
  * This source code is licensed under the ISC license.
121
121
  * See the LICENSE file in the root directory of this source tree.
122
- */const oe=q("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
122
+ */const oe=H("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
123
123
  * @license lucide-react v0.544.0 - ISC
124
124
  *
125
125
  * This source code is licensed under the ISC license.
126
126
  * See the LICENSE file in the root directory of this source tree.
127
- */const Vn=q("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
127
+ */const Vn=H("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
128
128
  * @license lucide-react v0.544.0 - ISC
129
129
  *
130
130
  * This source code is licensed under the ISC license.
131
131
  * See the LICENSE file in the root directory of this source tree.
132
- */const we=q("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
132
+ */const we=H("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
133
133
  * @license lucide-react v0.544.0 - ISC
134
134
  *
135
135
  * This source code is licensed under the ISC license.
136
136
  * See the LICENSE file in the root directory of this source tree.
137
- */const it=q("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
137
+ */const it=H("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);/**
138
138
  * @license lucide-react v0.544.0 - ISC
139
139
  *
140
140
  * This source code is licensed under the ISC license.
141
141
  * See the LICENSE file in the root directory of this source tree.
142
- */const ce=q("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
142
+ */const ce=H("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);/**
143
143
  * @license lucide-react v0.544.0 - ISC
144
144
  *
145
145
  * This source code is licensed under the ISC license.
146
146
  * See the LICENSE file in the root directory of this source tree.
147
- */const Yn=q("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
147
+ */const Yn=H("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
148
148
  * @license lucide-react v0.544.0 - ISC
149
149
  *
150
150
  * This source code is licensed under the ISC license.
151
151
  * See the LICENSE file in the root directory of this source tree.
152
- */const Kn=q("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
152
+ */const Kn=H("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
153
153
  * @license lucide-react v0.544.0 - ISC
154
154
  *
155
155
  * This source code is licensed under the ISC license.
156
156
  * See the LICENSE file in the root directory of this source tree.
157
- */const Jn=q("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);/**
157
+ */const Jn=H("phone",[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]);/**
158
158
  * @license lucide-react v0.544.0 - ISC
159
159
  *
160
160
  * This source code is licensed under the ISC license.
161
161
  * See the LICENSE file in the root directory of this source tree.
162
- */const Xn=q("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
162
+ */const Xn=H("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
163
163
  * @license lucide-react v0.544.0 - ISC
164
164
  *
165
165
  * This source code is licensed under the ISC license.
166
166
  * See the LICENSE file in the root directory of this source tree.
167
- */const at=q("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
167
+ */const at=H("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
168
168
  * @license lucide-react v0.544.0 - ISC
169
169
  *
170
170
  * This source code is licensed under the ISC license.
171
171
  * See the LICENSE file in the root directory of this source tree.
172
- */const Gn=q("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
172
+ */const Gn=H("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
173
173
  * @license lucide-react v0.544.0 - ISC
174
174
  *
175
175
  * This source code is licensed under the ISC license.
176
176
  * See the LICENSE file in the root directory of this source tree.
177
- */const nr=q("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
177
+ */const nr=H("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
178
178
  * @license lucide-react v0.544.0 - ISC
179
179
  *
180
180
  * This source code is licensed under the ISC license.
181
181
  * See the LICENSE file in the root directory of this source tree.
182
- */const We=q("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
182
+ */const We=H("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
183
183
  * @license lucide-react v0.544.0 - ISC
184
184
  *
185
185
  * This source code is licensed under the ISC license.
186
186
  * See the LICENSE file in the root directory of this source tree.
187
- */const sr=q("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
187
+ */const sr=H("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
188
188
  * @license lucide-react v0.544.0 - ISC
189
189
  *
190
190
  * This source code is licensed under the ISC license.
191
191
  * See the LICENSE file in the root directory of this source tree.
192
- */const Zn=q("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
192
+ */const Zn=H("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
193
193
  * @license lucide-react v0.544.0 - ISC
194
194
  *
195
195
  * This source code is licensed under the ISC license.
196
196
  * See the LICENSE file in the root directory of this source tree.
197
- */const Se=q("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
197
+ */const Se=H("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
198
198
  * @license lucide-react v0.544.0 - ISC
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=q("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be={baseUrl:"",apiKey:"",appId:""},Qn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");Be.baseUrl=e.baseUrl,Be.apiKey=e.apiKey,Be.appId=e.appId},ue=()=>Be,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:a="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:x=!1,roles:d=[],showRoleSelector:u=!1,loginUrl:m,onSuccess:g,onError:j})=>{const{baseUrl:c,apiKey:S,appId:y}=ue(),R={name:"",email:"",password:"",role:d.length?d[0]:"user",...x&&{avatarUrl:""}},[C,A]=w.useState(R),[P,M]=w.useState(!1),[b,$]=w.useState(!1),[k,L]=w.useState(null),[V,W]=w.useState({}),[Y,Z]=w.useState(!1),I=l?"#ffffff":"#111827",X=l?"#a1a1aa":"#6b7280",K=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",z=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const v=()=>Z(window.innerWidth<768);return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)}},[]);const O=v=>{const{name:N,value:h}=v.target;A(E=>({...E,[N]:h})),V[N]&&W(E=>({...E,[N]:void 0}))},ne=()=>{const v={};return C.name.trim()||(v.name="Name is required"),C.email.trim()?/\S+@\S+\.\S+/.test(C.email)||(v.email="Invalid email address"):v.email="Email is required",C.password?C.password.length<6&&(v.password="Password must be at least 6 characters"):v.password="Password is required",W(v),Object.keys(v).length===0},J=async v=>{if(v.preventDefault(),!!ne()){$(!0),L(null);try{const N={...C,appId:y},h=await Nn(N,{baseUrl:c,apiKey:S});L({type:"success",text:"Account created successfully!"}),g&&g(h)}catch(N){const h=N.message||"Signup failed. Please try again.";L({type:"error",text:h}),j&&j(N)}finally{$(!1)}}},f={width:"100%",padding:Y?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:K,border:`1px solid ${z}`,borderRadius:"10px",color:I,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:Y?"320px":"380px",width:"100%",maxWidth:Y?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:Y?"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(Se,{size:40,color:a,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:I,margin:0},children:r}),n.jsx("p",{style:{fontSize:"14px",color:X},children:s})]}),x&&C.avatarUrl&&n.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:n.jsx("img",{src:C.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${a}30`},onError:v=>{const N=v.target;N.style.display="none"}})}),n.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[u&&d&&d.length===2&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{style:{fontSize:"14px",fontWeight:500,color:I},children:"Select Role"}),n.jsxs("div",{style:{position:"relative",display:"flex",borderRadius:"10px",border:`1px solid ${z}`,backgroundColor:K,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:C.role===d[1]?"translateX(100%)":"translateX(0)",zIndex:0}}),n.jsx("button",{type:"button",onClick:()=>A(v=>({...v,role:d[0]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:C.role===d[0]?a:l?"#9ca3af":"#6b7280",fontWeight:C.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:()=>A(v=>({...v,role:d[1]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:C.role===d[1]?a:l?"#9ca3af":"#6b7280",fontWeight:C.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:I},children:"Full Name"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),n.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:C.name,onChange:O,style:{...f,borderColor:V.name?"#ef4444":z}})]}),V.name&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:V.name})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:I},children:"Email Address"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),n.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:C.email,onChange:O,style:{...f,borderColor:V.email?"#ef4444":z}})]}),V.email&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:V.email})]}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:I},children:"Password"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),n.jsx("input",{id:"signup-password",type:P?"text":"password",name:"password",placeholder:"Create a secure password",value:C.password,onChange:O,style:{...f,borderColor:V.password?"#ef4444":z}}),n.jsx("button",{type:"button",onClick:()=>M(!P),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:X,cursor:"pointer",padding:"4px"},children:P?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]}),V.password&&n.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:V.password})]}),x&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[n.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:I},children:"Avatar URL (Optional)"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),n.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:C.avatarUrl||"",onChange:O,style:f})]})]}),m&&n.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:n.jsx("a",{href:m,style:{color:a,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),k&&n.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:k.type==="success"?`${a}15`:"rgba(239,68,68,0.1)",border:k.type==="success"?`1px solid ${a}30`:"1px solid rgba(239,68,68,0.3)",color:k.type==="success"?a:"#ef4444"},children:[k.type==="success"?n.jsx(de,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:k.text})]}),n.jsx("button",{type:"submit",disabled:b,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:b?"not-allowed":"pointer",opacity:b?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:b?n.jsxs(n.Fragment,{children:[n.jsx(Vn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:X,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:a,fontWeight:600},children:"Neuctra Authix"})]})]}),n.jsx("style",{children:`
202
+ */const Pe=H("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be={baseUrl:"",apiKey:"",appId:""},Qn=e=>{if(!e.baseUrl||!e.apiKey||!e.appId)throw new Error("baseUrl, apiKey, and appId are required");Be.baseUrl=e.baseUrl,Be.apiKey=e.apiKey,Be.appId=e.appId},ue=()=>Be,es=({logoUrl:e,logoLinkUrl:t,title:n="Create Your Account",subtitle:s="Join our platform today",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:a="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,showAvatar:x=!1,roles:d=[],showRoleSelector:u=!1,loginUrl:b,onSuccess:y,onError:S})=>{const{baseUrl:c,apiKey:j,appId:m}=ue(),A={name:"",email:"",password:"",role:d.length?d[0]:"user",...x&&{avatarUrl:""}},[P,$]=w.useState(A),[T,M]=w.useState(!1),[g,O]=w.useState(!1),[v,U]=w.useState(null),[q,F]=w.useState({}),[Y,Z]=w.useState(!1),I=l?"#ffffff":"#111827",X=l?"#a1a1aa":"#6b7280",K=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",_=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const k=()=>Z(window.innerWidth<768);return k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)}},[]);const R=k=>{const{name:N,value:h}=k.target;$(E=>({...E,[N]:h})),q[N]&&F(E=>({...E,[N]:void 0}))},ne=()=>{const k={};return P.name.trim()||(k.name="Name is required"),P.email.trim()?/\S+@\S+\.\S+/.test(P.email)||(k.email="Invalid email address"):k.email="Email is required",P.password?P.password.length<6&&(k.password="Password must be at least 6 characters"):k.password="Password is required",F(k),Object.keys(k).length===0},J=async k=>{if(k.preventDefault(),!!ne()){O(!0),U(null);try{const N={...P,appId:m},h=await $n(N,{baseUrl:c,apiKey:j});U({type:"success",text:"Account created successfully!"}),y&&y(h)}catch(N){const h=N.message||"Signup failed. Please try again.";U({type:"error",text:h}),S&&S(N)}finally{O(!1)}}},f={width:"100%",padding:Y?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:K,border:`1px solid ${_}`,borderRadius:"10px",color:I,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return r.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[r.jsxs("div",{style:{minWidth:Y?"320px":"380px",width:"100%",maxWidth:Y?"340px":"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:Y?"30px 24px":"20px 28px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?r.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:r.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):r.jsx(Se,{size:40,color:a,style:{marginBottom:"10px"}}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:I,margin:0},children:n}),r.jsx("p",{style:{fontSize:"14px",color:X},children:s})]}),x&&P.avatarUrl&&r.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:r.jsx("img",{src:P.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${a}30`},onError:k=>{const N=k.target;N.style.display="none"}})}),r.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[u&&d&&d.length===2&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{style:{fontSize:"14px",fontWeight:500,color:I},children:"Select Role"}),r.jsxs("div",{style:{position:"relative",display:"flex",borderRadius:"10px",border:`1px solid ${_}`,backgroundColor:K,overflow:"hidden",cursor:"pointer",height:"42px"},children:[r.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}}),r.jsx("button",{type:"button",onClick:()=>$(k=>({...k,role:d[0]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[0]?a: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)}),r.jsx("button",{type:"button",onClick:()=>$(k=>({...k,role:d[1]})),style:{flex:1,zIndex:10,border:"none",background:"transparent",color:P.role===d[1]?a: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)})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:I},children:"Full Name"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(Se,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),r.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:P.name,onChange:R,style:{...f,borderColor:q.name?"#ef4444":_}})]}),q.name&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:q.name})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:I},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),r.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:P.email,onChange:R,style:{...f,borderColor:q.email?"#ef4444":_}})]}),q.email&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:q.email})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:I},children:"Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),r.jsx("input",{id:"signup-password",type:T?"text":"password",name:"password",placeholder:"Create a secure password",value:P.password,onChange:R,style:{...f,borderColor:q.password?"#ef4444":_}}),r.jsx("button",{type:"button",onClick:()=>M(!T),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:X,cursor:"pointer",padding:"4px"},children:T?r.jsx(nt,{size:20}):r.jsx(st,{size:20})})]}),q.password&&r.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:q.password})]}),x&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:I},children:"Avatar URL (Optional)"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(tr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:X}}),r.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:P.avatarUrl||"",onChange:R,style:f})]})]}),b&&r.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:r.jsx("a",{href:b,style:{color:a,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),v&&r.jsxs("div",{style:{padding:"12px",borderRadius:"12px",fontSize:"12px",display:"flex",alignItems:"start",gap:"10px",backgroundColor:v.type==="success"?`${a}15`:"rgba(239,68,68,0.1)",border:v.type==="success"?`1px solid ${a}30`:"1px solid rgba(239,68,68,0.3)",color:v.type==="success"?a:"#ef4444"},children:[v.type==="success"?r.jsx(de,{size:20}):r.jsx(ae,{size:20}),r.jsx("span",{children:v.text})]}),r.jsx("button",{type:"submit",disabled:g,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600,cursor:g?"not-allowed":"pointer",opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:g?r.jsxs(r.Fragment,{children:[r.jsx(Vn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),r.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:X,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",r.jsx("span",{style:{color:a,fontWeight:600},children:"Neuctra Authix"})]})]}),r.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:a,apiKey:i}=t;if(!i)throw new Error("API key is required for login");try{const l=await F.post(`${a}/users/login`,{email:r,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":i}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const x=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",x),{success:!1,message:x,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:a="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:x,onSuccess:d,onError:u})=>{const{baseUrl:m,apiKey:g,appId:j}=ue(),[c,S]=w.useState("login"),[y,R]=w.useState(1),[C,A]=w.useState(!1),[P,M]=w.useState(!1),[b,$]=w.useState(null),[k,L]=w.useState(""),[V,W]=w.useState(""),[Y,Z]=w.useState({email:"",otp:"",newPassword:"",appId:j}),[I,X]=w.useState(!1),K=l?"#ffffff":"#111827",z=l?"#a1a1aa":"#6b7280",O=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",ne=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const E=()=>X(window.innerWidth<768);return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)}},[]);const J=async E=>{E.preventDefault(),M(!0),$(null);try{const _=await ts({email:k,password:V,appId:j},{baseUrl:m,apiKey:g});$({type:"success",text:`Welcome ${_.name}`}),d?.(_)}catch(_){const B=_.message||"Login failed";$({type:"error",text:B}),u?.(_)}finally{M(!1)}},f=E=>{Z({...Y,[E.target.name]:E.target.value})},v=async E=>{E.preventDefault(),M(!0),$(null);try{const _=await F.post(`${m}/users/forgot-password`,{email:Y.email,appId:j},{headers:{"x-api-key":g}});_.data.success?(R(2),$({type:"success",text:"OTP sent to your email"})):$({type:"error",text:_.data.message||"Failed to send OTP"})}catch(_){$({type:"error",text:_.response?.data?.message||"Something went wrong"})}finally{M(!1)}},N=async E=>{E.preventDefault(),M(!0),$(null);try{const _=await F.post(`${m}/users/reset-password`,Y,{headers:{"x-api-key":g}});_.data.success?($({type:"success",text:"Password reset successfully!"}),R(1),Z({email:"",otp:"",newPassword:"",appId:j}),S("login")):$({type:"error",text:_.data.message||"Reset failed"})}catch(_){$({type:"error",text:_.response?.data?.message||"Something went wrong"})}finally{M(!1)}},h={width:"100%",padding:I?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:O,border:`1px solid ${ne}`,borderRadius:"10px",color:K,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:I?"320px":"380px",maxWidth:I?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:I?"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(Se,{size:40,color:a,style:{marginBottom:"10px"}}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:K,margin:0},children:c==="login"?r:y===1?"Forgot Password":"Reset Password"}),n.jsx("p",{style:{fontSize:"14px",color:z},children:c==="login"?s:"Follow the steps to reset your password"})]}),c==="login"&&n.jsxs("form",{onSubmit:J,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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:z}}),n.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:k,onChange:E=>L(E.target.value),style:h})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:z}}),n.jsx("input",{id:"login-password",type:C?"text":"password",placeholder:"Enter your password",value:V,onChange:E=>W(E.target.value),style:h}),n.jsx("button",{type:"button",onClick:()=>A(!C),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:z,cursor:"pointer"},children:C?n.jsx(nt,{size:20}):n.jsx(st,{size:20})})]})]}),n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[x&&n.jsx("a",{href:x,style:{color:a,textDecoration:"none",fontWeight:500},children:"Create new account"}),n.jsx("button",{type:"button",onClick:()=>S("forgot"),style:{background:"none",border:"none",color:a,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),n.jsx("button",{type:"submit",disabled:P,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:P?"Signing In...":"Sign In"})]}),c==="forgot"&&n.jsxs("form",{onSubmit:y===1?v:N,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[y===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(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:z}}),n.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:h})]})]}):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(ot,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:z}}),n.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:h})]})]}),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(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:z}}),n.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:h})]})]})]}),n.jsx("button",{type:"submit",disabled:P,style:{padding:"12px",background:i,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:P?"Please wait...":y===1?"Send Reset OTP":"Reset Password"}),n.jsx("button",{type:"button",onClick:()=>{S("login"),R(1)},style:{background:"none",border:"none",fontSize:"14px",color:z,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),b&&n.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:b.type==="success"?`${a}15`:"rgba(239,68,68,0.1)",border:b.type==="success"?`1px solid ${a}30`:"1px solid rgba(239,68,68,0.3)",color:b.type==="success"?a:"#ef4444"},children:[b.type==="success"?n.jsx(de,{size:20}):n.jsx(le,{size:20}),n.jsx("span",{children:b.text})]}),n.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:z,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",n.jsx("span",{style:{color:a,fontWeight:600},children:"Neuctra Authix"})]})]})})},ns=({children:e,fallback:t=null,width:r,height:s})=>{const[o,a]=w.useState(!1);return w.useEffect(()=>{const i=()=>{if(typeof window>"u")return!1;try{const x=localStorage.getItem("userInfo");return!!(x&&x!=="undefined"&&x!=="null")}catch{return!1}},l=()=>a(i());return l(),typeof window<"u"&&window.addEventListener("storage",l),()=>{typeof window<"u"&&window.removeEventListener("storage",l)}},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},ss=({children:e,fallback:t=null,width:r,height:s})=>{const[o,a]=w.useState(!0);return w.useEffect(()=>{const i=()=>{try{const x=localStorage.getItem("userInfo");return!!(x&&x!=="undefined"&&x!=="null")}catch{return!1}},l=()=>a(!i());return l(),window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]),o?n.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:r,height:s},children:e}):n.jsx(n.Fragment,{children:t})},os=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,token:a,colors:i})=>{const{baseUrl:l,apiKey:x,appId:d}=ue(),[u,m]=w.useState(!1),[g,j]=w.useState(""),[c,S]=w.useState("warning"),[y,R]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const b=()=>{R(window.innerWidth<640)};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[]),!e)return null;const C=async()=>{m(!0),S("processing");try{const{data:b}=await F.delete(`${l}/users/delete/${o}`,{data:{appId:d},headers:{"x-api-key":x}});b.success?(r(b.message||"Account deleted successfully"),S("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(b.message||"Failed to delete account"),S("warning"))}catch(b){s(b.response?.data?.message||"Something went wrong"),S("warning")}finally{m(!1)}},A=g.toLowerCase()==="delete my account",P=b=>{b.target===b.currentTarget&&c!=="processing"&&c!=="success"&&t()},M=()=>{switch(c){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:i.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:i.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: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:n.jsx(Pe,{size:20})})]}),n.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${i.error}15`,border:`1px solid ${i.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[n.jsx("div",{style:{color:i.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:n.jsx(sr,{size:24})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h4",{style:{color:i.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(it,{size:16}),text:"You will lose access to all services"}].map((b,$)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:i.textSecondary},children:[n.jsx("div",{style:{color:i.error,flexShrink:0},children:b.icon}),n.jsx("span",{children:b.text})]},$))})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:y?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[n.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:y?"none":1,minWidth:y?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:b=>{b.currentTarget.style.backgroundColor=i.border,b.currentTarget.style.transform="translateY(-1px)"},onMouseOut:b=>{b.currentTarget.style.backgroundColor="transparent",b.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:y?"none":1,minWidth:y?"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:b=>{b.currentTarget.style.transform="translateY(-1px)",b.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:b=>{b.currentTarget.style.transform="translateY(0)",b.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(sr,{size:24})}),n.jsx("div",{style:{flex:1},children:n.jsx("h3",{style:{color:i.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:i.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",n.jsx("strong",{style:{color:i.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),n.jsx("input",{type:"text",value:g,onChange:b=>j(b.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${A?i.success:i.error}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:b=>{b.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:b=>{b.target.style.boxShadow="none"},autoFocus:!0}),A&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:i.success,fontSize:"14px",fontWeight:500},children:[n.jsx(rt,{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 ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:y?"none":1,minWidth:y?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:b=>{b.currentTarget.style.backgroundColor=i.border,b.currentTarget.style.transform="translateY(-1px)"},onMouseOut:b=>{b.currentTarget.style.backgroundColor="transparent",b.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),n.jsxs("button",{onClick:C,disabled:!A||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!A||u?"not-allowed":"pointer",flex:y?"none":1,minWidth:y?"100%":"140px",opacity:!A||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!A||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:b=>{A&&!u&&(b.currentTarget.style.transform="translateY(-1px)",b.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:b=>{A&&!u&&(b.currentTarget.style.transform="translateY(0)",b.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(oe,{size:20,style:{animation:"spin 1s linear infinite"}})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),n.jsx("p",{style:{color:i.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((b,$)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:b.active?`${i.accent}10`:"transparent"},children:[n.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:b.active?i.accent:i.textTertiary,transition:"all 0.3s ease",boxShadow:b.active?`0 0 0 4px ${i.accent}20`:"none"}}),n.jsx("span",{style:{fontSize:"14px",color:b.active?i.textPrimary:i.textSecondary,fontWeight:b.active?500:400},children:b.text})]},$))})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${i.accent}10`,borderRadius:"10px",fontSize:"14px",color:i.textSecondary},children:[n.jsx(nr,{size:18,style:{color:i.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(rt,{size:20})}),n.jsxs("div",{style:{flex:1},children:[n.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),n.jsx("p",{style:{color:i.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:`${i.success}10`,border:`1px solid ${i.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[n.jsx(rt,{size:48,style:{color:i.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),n.jsx("p",{style:{color:i.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),n.jsx("p",{style:{color:i.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:`${i.accent}10`,borderRadius:"10px",fontSize:"14px",color:i.textSecondary,justifyContent:"center"},children:[n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite",color:i.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:P,children:[n.jsx("div",{style:{backgroundColor:i.surface,border:`1px solid ${i.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:n,password:s,appId:o}=e,{baseUrl:a,apiKey:i}=t;if(!i)throw new Error("API key is required for login");try{const l=await W.post(`${a}/users/login`,{email:n,password:s,appId:o},{headers:{"Content-Type":"application/json","x-api-key":i}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const x=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",x),{success:!1,message:x,status:l.response?.status||500}}},rs=({logoUrl:e,logoLinkUrl:t,title:n="Sign In to Your Account",subtitle:s="Welcome back! Please enter your details",footerText:o="Secure authentication powered by Neuctra Authix",primaryColor:a="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:l=!0,signupUrl:x,onSuccess:d,onError:u})=>{const{baseUrl:b,apiKey:y,appId:S}=ue(),[c,j]=w.useState("login"),[m,A]=w.useState(1),[P,$]=w.useState(!1),[T,M]=w.useState(!1),[g,O]=w.useState(null),[v,U]=w.useState(""),[q,F]=w.useState(""),[Y,Z]=w.useState({email:"",otp:"",newPassword:"",appId:S}),[I,X]=w.useState(!1),K=l?"#ffffff":"#111827",_=l?"#a1a1aa":"#6b7280",R=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",ne=l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)";w.useEffect(()=>{if(typeof window<"u"){const E=()=>X(window.innerWidth<768);return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)}},[]);const J=async E=>{E.preventDefault(),M(!0),O(null);try{const z=await ts({email:v,password:q,appId:S},{baseUrl:b,apiKey:y});O({type:"success",text:`Welcome ${z.name}`}),d?.(z)}catch(z){const B=z.message||"Login failed";O({type:"error",text:B}),u?.(z)}finally{M(!1)}},f=E=>{Z({...Y,[E.target.name]:E.target.value})},k=async E=>{E.preventDefault(),M(!0),O(null);try{const z=await W.post(`${b}/users/forgot-password`,{email:Y.email,appId:S},{headers:{"x-api-key":y}});z.data.success?(A(2),O({type:"success",text:"OTP sent to your email"})):O({type:"error",text:z.data.message||"Failed to send OTP"})}catch(z){O({type:"error",text:z.response?.data?.message||"Something went wrong"})}finally{M(!1)}},N=async E=>{E.preventDefault(),M(!0),O(null);try{const z=await W.post(`${b}/users/reset-password`,Y,{headers:{"x-api-key":y}});z.data.success?(O({type:"success",text:"Password reset successfully!"}),A(1),Z({email:"",otp:"",newPassword:"",appId:S}),j("login")):O({type:"error",text:z.data.message||"Reset failed"})}catch(z){O({type:"error",text:z.response?.data?.message||"Something went wrong"})}finally{M(!1)}},h={width:"100%",padding:I?"10px 14px 10px 44px":"10px 16px 10px 44px",backgroundColor:R,border:`1px solid ${ne}`,borderRadius:"10px",color:K,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return r.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:r.jsxs("div",{style:{minWidth:I?"320px":"380px",maxWidth:I?"340px":"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:l?"#000000":"#ffffff",padding:I?"30px 24px":"18px 28px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px"},children:[e?r.jsx("a",{href:t||"/",target:"_self",rel:"noopener noreferrer",children:r.jsx("img",{src:e,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}})}):r.jsx(Se,{size:40,color:a,style:{marginBottom:"10px"}}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:K,margin:0},children:c==="login"?n:m===1?"Forgot Password":"Reset Password"}),r.jsx("p",{style:{fontSize:"14px",color:_},children:c==="login"?s:"Follow the steps to reset your password"})]}),c==="login"&&r.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:_}}),r.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:v,onChange:E=>U(E.target.value),style:h})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:_}}),r.jsx("input",{id:"login-password",type:P?"text":"password",placeholder:"Enter your password",value:q,onChange:E=>F(E.target.value),style:h}),r.jsx("button",{type:"button",onClick:()=>$(!P),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:_,cursor:"pointer"},children:P?r.jsx(nt,{size:20}):r.jsx(st,{size:20})})]})]}),r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[x&&r.jsx("a",{href:x,style:{color:a,textDecoration:"none",fontWeight:500},children:"Create new account"}),r.jsx("button",{type:"button",onClick:()=>j("forgot"),style:{background:"none",border:"none",color:a,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),r.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontSize:"14px",fontWeight:600},children:T?"Signing In...":"Sign In"})]}),c==="forgot"&&r.jsxs("form",{onSubmit:m===1?k:N,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[m===1?r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[r.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"Email Address"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(ce,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:_}}),r.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:Y.email,onChange:f,style:h})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(rr,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:_}}),r.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:Y.otp,onChange:f,style:h})]})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[r.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:l?"#ffffff":"#000000"},children:"New Password"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(we,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:_}}),r.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:Y.newPassword,onChange:f,style:h})]})]})]}),r.jsx("button",{type:"submit",disabled:T,style:{padding:"12px",background:i,color:"#fff",border:"none",fontSize:"14px",borderRadius:"10px",fontWeight:600},children:T?"Please wait...":m===1?"Send Reset OTP":"Reset Password"}),r.jsx("button",{type:"button",onClick:()=>{j("login"),A(1)},style:{background:"none",border:"none",fontSize:"14px",color:_,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),g&&r.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:g.type==="success"?`${a}15`:"rgba(239,68,68,0.1)",border:g.type==="success"?`1px solid ${a}30`:"1px solid rgba(239,68,68,0.3)",color:g.type==="success"?a:"#ef4444"},children:[g.type==="success"?r.jsx(de,{size:20}):r.jsx(ae,{size:20}),r.jsx("span",{children:g.text})]}),r.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:_,marginTop:"16px",padding:"0 4px"},children:["Secure authentication powered by"," ",r.jsx("span",{style:{color:a,fontWeight:600},children:"Neuctra Authix"})]})]})})},ns=({children:e,fallback:t=null,width:n,height:s})=>{const[o,a]=w.useState(!1);return w.useEffect(()=>{const i=()=>{if(typeof window>"u")return!1;try{const x=localStorage.getItem("userInfo");return!!(x&&x!=="undefined"&&x!=="null")}catch{return!1}},l=()=>a(i());return l(),typeof window<"u"&&window.addEventListener("storage",l),()=>{typeof window<"u"&&window.removeEventListener("storage",l)}},[]),o?r.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:n,height:s},children:e}):r.jsx(r.Fragment,{children:t})},ss=({children:e,fallback:t=null,width:n,height:s})=>{const[o,a]=w.useState(!0);return w.useEffect(()=>{const i=()=>{try{const x=localStorage.getItem("userInfo");return!!(x&&x!=="undefined"&&x!=="null")}catch{return!1}},l=()=>a(!i());return l(),window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]),o?r.jsx("span",{style:{display:"inline-flex",alignItems:"center",verticalAlign:"middle",width:n,height:s},children:e}):r.jsx(r.Fragment,{children:t})},os=({isOpen:e,onClose:t,onSuccess:n,onError:s,userId:o,token:a,colors:i})=>{const{baseUrl:l,apiKey:x,appId:d}=ue(),[u,b]=w.useState(!1),[y,S]=w.useState(""),[c,j]=w.useState("warning"),[m,A]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const g=()=>{A(window.innerWidth<640)};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]),!e)return null;const P=async()=>{b(!0),j("processing");try{const{data:g}=await W.delete(`${l}/users/delete/${o}`,{data:{appId:d},headers:{"x-api-key":x}});g.success?(n(g.message||"Account deleted successfully"),j("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(s(g.message||"Failed to delete account"),j("warning"))}catch(g){s(g.response?.data?.message||"Something went wrong"),j("warning")}finally{b(!1)}},$=y.toLowerCase()==="delete my account",T=g=>{g.target===g.currentTarget&&c!=="processing"&&c!=="success"&&t()},M=()=>{switch(c){case"warning":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[r.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:r.jsx(We,{size:20})}),r.jsx("div",{children:r.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),r.jsx("button",{onClick:t,"aria-label":"Close modal",style:{background:"transparent",border:"none",color:i.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:g=>{g.currentTarget.style.backgroundColor=i.border,g.currentTarget.style.color=i.textPrimary},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.color=i.textTertiary},children:r.jsx(Pe,{size:20})})]}),r.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${i.error}15`,border:`1px solid ${i.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[r.jsx("div",{style:{color:i.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:r.jsx(sr,{size:24})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h4",{style:{color:i.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:r.jsx(Wn,{size:16}),text:"All your data will be permanently deleted"},{icon:r.jsx(Zn,{size:16}),text:"This action cannot be reversed"},{icon:r.jsx(it,{size:16}),text:"You will lose access to all services"}].map((g,O)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:i.textSecondary},children:[r.jsx("div",{style:{color:i.error,flexShrink:0},children:g.icon}),r.jsx("span",{children:g.text})]},O))})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:m?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:t,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=i.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),r.jsxs("button",{onClick:()=>j("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:g=>{g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[r.jsx(We,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.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:r.jsx(sr,{size:24})}),r.jsx("div",{style:{flex:1},children:r.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),r.jsxs("div",{style:{marginBottom:"24px"},children:[r.jsxs("p",{style:{color:i.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",r.jsx("strong",{style:{color:i.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),r.jsx("input",{type:"text",value:y,onChange:g=>S(g.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${$?i.success:i.error}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:g=>{g.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:g=>{g.target.style.boxShadow="none"},autoFocus:!0}),$&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:i.success,fontSize:"14px",fontWeight:500},children:[r.jsx(rt,{size:16}),r.jsx("span",{children:"Confirmation accepted"})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column-reverse",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{onClick:()=>{j("warning"),S("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:m?"none":1,minWidth:m?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:g=>{g.currentTarget.style.backgroundColor=i.border,g.currentTarget.style.transform="translateY(-1px)"},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent",g.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),r.jsxs("button",{onClick:P,disabled:!$||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!$||u?"not-allowed":"pointer",flex:m?"none":1,minWidth:m?"100%":"140px",opacity:!$||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!$||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:g=>{$&&!u&&(g.currentTarget.style.transform="translateY(-1px)",g.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:g=>{$&&!u&&(g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[r.jsx(We,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.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:r.jsx(oe,{size:20,style:{animation:"spin 1s linear infinite"}})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),r.jsx("p",{style:{color:i.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),r.jsx("div",{style:{marginBottom:"20px"},children:r.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((g,O)=>r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:g.active?`${i.accent}10`:"transparent"},children:[r.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:g.active?i.accent:i.textTertiary,transition:"all 0.3s ease",boxShadow:g.active?`0 0 0 4px ${i.accent}20`:"none"}}),r.jsx("span",{style:{fontSize:"14px",color:g.active?i.textPrimary:i.textSecondary,fontWeight:g.active?500:400},children:g.text})]},O))})}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${i.accent}10`,borderRadius:"10px",fontSize:"14px",color:i.textSecondary},children:[r.jsx(nr,{size:18,style:{color:i.accent,flexShrink:0}}),r.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[r.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:r.jsx(rt,{size:20})}),r.jsxs("div",{style:{flex:1},children:[r.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),r.jsx("p",{style:{color:i.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),r.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${i.success}10`,border:`1px solid ${i.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[r.jsx(rt,{size:48,style:{color:i.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),r.jsx("p",{style:{color:i.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),r.jsx("p",{style:{color:i.textSecondary,fontSize:"14px",margin:0,lineHeight:"1.5"},children:"Your account and all associated data have been permanently removed from our systems."})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${i.accent}10`,borderRadius:"10px",fontSize:"14px",color:i.textSecondary,justifyContent:"center"},children:[r.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite",color:i.accent}}),r.jsx("span",{children:"Redirecting to login page..."})]})]})}};return r.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:[r.jsx("div",{style:{backgroundColor:i.surface,border:`1px solid ${i.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()}),r.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,a]=w.useState(""),[i,l]=w.useState(!1),[x,d]=w.useState(!1),[u,m]=w.useState({isValid:!1,message:"",type:null});if(w.useEffect(()=>{if(typeof window>"u")return;const c=()=>{d(window.innerWidth<640)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]),w.useEffect(()=>{if(!o.trim()){m({isValid:!1,message:"",type:null});return}try{const c=new URL(o),S=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(c.pathname);m(S?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{m({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[o]),!e)return null;const g=async()=>{if(!(!o||!u.isValid)){l(!0);try{await r(o)&&(a(""),t())}finally{l(!1)}}},j=c=>{c.target===c.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(tt,{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:c=>{c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.color=s.textPrimary},onMouseOut:c=>{c.currentTarget.style.backgroundColor="transparent",c.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(Hn,{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:c=>a(c.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${u.type==="error"?s.error:u.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=s.accent,c.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:c=>{c.target.style.borderColor=u.type==="error"?s.error:u.type==="success"?s.success:s.border,c.target.style.boxShadow="none"},disabled:i}),n.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:n.jsx(tr,{size:18})})]}),u.message&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:u.type==="success"?s.success:u.type==="error"?s.error:s.textTertiary},children:[u.type==="success"&&n.jsx(de,{size:14}),u.type==="error"&&n.jsx(le,{size:14}),u.type==="warning"&&n.jsx(le,{size:14}),u.message]})]}),o&&u.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:c=>{c.currentTarget.style.display="none"}})]})]}),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:x?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[n.jsx("button",{onClick:t,disabled:i,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:i?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"100%":"120px",opacity:i?.6:1,transition:"all 0.2s ease"},onMouseOver:c=>{i||(c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.transform="translateY(-1px)")},onMouseOut:c=>{i||(c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),n.jsx("button",{onClick:g,disabled:i||!u.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:i||!u.isValid?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"100%":"140px",opacity:i||!u.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:i||!u.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:c=>{!i&&u.isValid&&(c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:c=>{!i&&u.isValid&&(c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:i?n.jsxs(n.Fragment,{children:[n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):n.jsxs(n.Fragment,{children:[n.jsx(tt,{size:16}),"Update Avatar"]})})]})]}),n.jsx("style",{children:`
261
+ `})]})},is=({isOpen:e,onClose:t,onUpdate:n,colors:s})=>{const[o,a]=w.useState(""),[i,l]=w.useState(!1),[x,d]=w.useState(!1),[u,b]=w.useState({isValid:!1,message:"",type:null});if(w.useEffect(()=>{if(typeof window>"u")return;const c=()=>{d(window.innerWidth<640)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]),w.useEffect(()=>{if(!o.trim()){b({isValid:!1,message:"",type:null});return}try{const c=new URL(o),j=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(c.pathname);b(j?{isValid:!0,message:"Valid image URL",type:"success"}:{isValid:!1,message:"URL should point to an image file",type:"warning"})}catch{b({isValid:!1,message:"Please enter a valid URL",type:"error"})}},[o]),!e)return null;const y=async()=>{if(!(!o||!u.isValid)){l(!0);try{await n(o)&&(a(""),t())}finally{l(!1)}}},S=c=>{c.target===c.currentTarget&&t()};return r.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:S,children:[r.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:[r.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[r.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:r.jsx(tt,{size:22})}),r.jsx("div",{children:r.jsx("h3",{style:{color:s.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),r.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:c=>{c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.color=s.textPrimary},onMouseOut:c=>{c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.color=s.textTertiary},children:r.jsx(Pe,{size:20})})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[r.jsxs("div",{children:[r.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:s.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[r.jsx(Hn,{size:16}),"Avatar URL"]}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:o,onChange:c=>a(c.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${u.type==="error"?s.error:u.type==="success"?s.success:s.border}`,backgroundColor:"transparent",color:s.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=s.accent,c.target.style.boxShadow=`0 0 0 3px ${s.accent}20`},onBlur:c=>{c.target.style.borderColor=u.type==="error"?s.error:u.type==="success"?s.success:s.border,c.target.style.boxShadow="none"},disabled:i}),r.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:s.textTertiary},children:r.jsx(tr,{size:18})})]}),u.message&&r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:u.type==="success"?s.success:u.type==="error"?s.error:s.textTertiary},children:[u.type==="success"&&r.jsx(de,{size:14}),u.type==="error"&&r.jsx(ae,{size:14}),u.type==="warning"&&r.jsx(ae,{size:14}),u.message]})]}),o&&u.type==="success"&&r.jsxs("div",{style:{padding:"16px",backgroundColor:`${s.success}10`,border:`1px solid ${s.success}20`,borderRadius:"12px",textAlign:"center"},children:[r.jsx("p",{style:{color:s.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),r.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:c=>{c.currentTarget.style.display="none"}})]})]}),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:x?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[r.jsx("button",{onClick:t,disabled:i,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${s.border}`,background:"transparent",color:s.textPrimary,fontSize:"14px",fontWeight:500,cursor:i?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"100%":"120px",opacity:i?.6:1,transition:"all 0.2s ease"},onMouseOver:c=>{i||(c.currentTarget.style.backgroundColor=s.border,c.currentTarget.style.transform="translateY(-1px)")},onMouseOut:c=>{i||(c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),r.jsx("button",{onClick:y,disabled:i||!u.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:i||!u.isValid?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"100%":"140px",opacity:i||!u.isValid?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:i||!u.isValid?"none":`0 4px 12px ${s.accent}40`},onMouseOver:c=>{!i&&u.isValid&&(c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=`0 6px 20px ${s.accent}60`)},onMouseOut:c=>{!i&&u.isValid&&(c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow=`0 4px 12px ${s.accent}40`)},children:i?r.jsxs(r.Fragment,{children:[r.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(tt,{size:16}),"Update Avatar"]})})]})]}),r.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
- `})]})},as=({isOpen:e,onClose:t,onSuccess:r,onError:s,userId:o,colors:a})=>{const{baseUrl:i,apiKey:l,appId:x}=ue(),[d,u]=w.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[m,g]=w.useState({}),[j,c]=w.useState(!1),[S,y]=w.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[R,C]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const k=()=>{C(window.innerWidth<640)};return k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[]),!e)return null;const A=k=>{const{name:L,value:V}=k.target;u(W=>({...W,[L]:V})),m[L]&&g(W=>({...W,[L]:""}))},P=k=>{y(L=>({...L,[k]:!L[k]}))},M=()=>{const k={};return d.currentPassword||(k.currentPassword="Current password is required"),d.newPassword?d.newPassword.length<6&&(k.newPassword="Password must be at least 6 characters"):k.newPassword="New password is required",d.newPassword!==d.confirmPassword&&(k.confirmPassword="Passwords do not match"),g(k),Object.keys(k).length===0},b=async k=>{if(k.preventDefault(),!!M()){c(!0);try{const{data:L}=await F.put(`${i}/users/change-password/${o}`,{appId:x,currentPassword:d.currentPassword,newPassword:d.newPassword},{headers:{"x-api-key":l}});L.success?(r(L.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(L.message||"Failed to update password")}catch(L){s(L.response?.data?.message||"Something went wrong")}finally{c(!1)}}},$=[{field:"currentPassword",label:"Current Password",icon:n.jsx(rr,{size:18})},{field:"newPassword",label:"New Password",icon:n.jsx(we,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:n.jsx(we,{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:a.surface,border:`1px solid ${a.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, ${a.accent}20, ${a.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:a.accent,flexShrink:0},children:n.jsx(we,{size:20})}),n.jsx("div",{children:n.jsx("h3",{style:{color:a.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:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:k=>{k.currentTarget.style.backgroundColor=a.border,k.currentTarget.style.color=a.textPrimary},onMouseOut:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=a.textTertiary},children:n.jsx(Pe,{size:20})})]}),n.jsxs("form",{onSubmit:b,children:[$.map(({field:k,label:L,icon:V})=>n.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[n.jsx("label",{htmlFor:k,style:{display:"block",marginBottom:"8px",color:a.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:L}),n.jsxs("div",{style:{position:"relative"},children:[n.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:a.textTertiary,zIndex:2},children:V}),n.jsx("input",{type:S[k]?"text":"password",id:k,name:k,placeholder:`Enter ${L.toLowerCase()}`,value:d[k],onChange:A,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${m[k]?a.error:a.border}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:W=>{W.target.style.borderColor=a.accent,W.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:W=>{W.target.style.borderColor=m[k]?a.error:a.border,W.target.style.boxShadow="none"}}),n.jsx("button",{type:"button",onClick:()=>P(k),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",cursor:"pointer",color:a.textTertiary,padding:"4px",borderRadius:"4px",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:W=>{W.currentTarget.style.backgroundColor=a.border,W.currentTarget.style.color=a.textPrimary},onMouseOut:W=>{W.currentTarget.style.backgroundColor="transparent",W.currentTarget.style.color=a.textTertiary},children:S[k]?n.jsx(nt,{size:18}):n.jsx(st,{size:18})})]}),m[k]&&n.jsxs("div",{style:{fontSize:"13px",color:a.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[n.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),m[k]]})]},k)),n.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:R?"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 ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:j?"not-allowed":"pointer",flex:R?"none":1,minWidth:R?"100%":"120px",opacity:j?.6:1,transition:"all 0.2s ease"},onMouseOver:k=>{j||(k.currentTarget.style.backgroundColor=a.border,k.currentTarget.style.transform="translateY(-1px)")},onMouseOut:k=>{j||(k.currentTarget.style.backgroundColor="transparent",k.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, ${a.accent}, ${a.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:j?"not-allowed":"pointer",flex:R?"none":1,minWidth:R?"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 ${a.accent}40`},onMouseOver:k=>{j||(k.currentTarget.style.transform="translateY(-1px)",k.currentTarget.style.boxShadow=`0 6px 20px ${a.accent}60`)},onMouseOut:k=>{j||(k.currentTarget.style.transform="translateY(0)",k.currentTarget.style.boxShadow=`0 4px 12px ${a.accent}40`)},children:j?n.jsxs(n.Fragment,{children:[n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),n.jsx("style",{children:`
309
+ `})]})},as=({isOpen:e,onClose:t,onSuccess:n,onError:s,userId:o,colors:a})=>{const{baseUrl:i,apiKey:l,appId:x}=ue(),[d,u]=w.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[b,y]=w.useState({}),[S,c]=w.useState(!1),[j,m]=w.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[A,P]=w.useState(!1);if(w.useEffect(()=>{if(typeof window>"u")return;const v=()=>{P(window.innerWidth<640)};return v(),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]),!e)return null;const $=v=>{const{name:U,value:q}=v.target;u(F=>({...F,[U]:q})),b[U]&&y(F=>({...F,[U]:""}))},T=v=>{m(U=>({...U,[v]:!U[v]}))},M=()=>{const v={};return d.currentPassword||(v.currentPassword="Current password is required"),d.newPassword?d.newPassword.length<6&&(v.newPassword="Password must be at least 6 characters"):v.newPassword="New password is required",d.newPassword!==d.confirmPassword&&(v.confirmPassword="Passwords do not match"),y(v),Object.keys(v).length===0},g=async v=>{if(v.preventDefault(),!!M()){c(!0);try{const{data:U}=await W.put(`${i}/users/change-password/${o}`,{appId:x,currentPassword:d.currentPassword,newPassword:d.newPassword},{headers:{"x-api-key":l}});U.success?(n(U.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),t()):s(U.message||"Failed to update password")}catch(U){s(U.response?.data?.message||"Something went wrong")}finally{c(!1)}}},O=[{field:"currentPassword",label:"Current Password",icon:r.jsx(ot,{size:18})},{field:"newPassword",label:"New Password",icon:r.jsx(we,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:r.jsx(we,{size:18})}];return r.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:r.jsxs("div",{style:{backgroundColor:a.surface,border:`1px solid ${a.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:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px",gap:"12px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[r.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"10px",background:`linear-gradient(135deg, ${a.accent}20, ${a.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:a.accent,flexShrink:0},children:r.jsx(we,{size:20})}),r.jsx("div",{children:r.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"18px",fontWeight:600,lineHeight:"1.4"},children:"Change Password"})})]}),r.jsx("button",{onClick:t,"aria-label":"Close password change modal",style:{background:"transparent",border:"none",color:a.textTertiary,cursor:"pointer",padding:"8px",borderRadius:"8px",flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:v=>{v.currentTarget.style.backgroundColor=a.border,v.currentTarget.style.color=a.textPrimary},onMouseOut:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=a.textTertiary},children:r.jsx(Pe,{size:20})})]}),r.jsxs("form",{onSubmit:g,children:[O.map(({field:v,label:U,icon:q})=>r.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[r.jsx("label",{htmlFor:v,style:{display:"block",marginBottom:"8px",color:a.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:U}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:a.textTertiary,zIndex:2},children:q}),r.jsx("input",{type:j[v]?"text":"password",id:v,name:v,placeholder:`Enter ${U.toLowerCase()}`,value:d[v],onChange:$,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${b[v]?a.error:a.border}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:F=>{F.target.style.borderColor=a.accent,F.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:F=>{F.target.style.borderColor=b[v]?a.error:a.border,F.target.style.boxShadow="none"}}),r.jsx("button",{type:"button",onClick:()=>T(v),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",cursor:"pointer",color:a.textTertiary,padding:"4px",borderRadius:"4px",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseOver:F=>{F.currentTarget.style.backgroundColor=a.border,F.currentTarget.style.color=a.textPrimary},onMouseOut:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=a.textTertiary},children:j[v]?r.jsx(nt,{size:18}):r.jsx(st,{size:18})})]}),b[v]&&r.jsxs("div",{style:{fontSize:"13px",color:a.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[r.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),b[v]]})]},v)),r.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:A?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[r.jsx("button",{type:"button",onClick:t,disabled:S,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:S?"not-allowed":"pointer",flex:A?"none":1,minWidth:A?"100%":"120px",opacity:S?.6:1,transition:"all 0.2s ease"},onMouseOver:v=>{S||(v.currentTarget.style.backgroundColor=a.border,v.currentTarget.style.transform="translateY(-1px)")},onMouseOut:v=>{S||(v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),r.jsx("button",{type:"submit",disabled:S,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${a.accent}, ${a.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:S?"not-allowed":"pointer",flex:A?"none":1,minWidth:A?"100%":"140px",opacity:S?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:S?"none":`0 4px 12px ${a.accent}40`},onMouseOver:v=>{S||(v.currentTarget.style.transform="translateY(-1px)",v.currentTarget.style.boxShadow=`0 6px 20px ${a.accent}60`)},onMouseOut:v=>{S||(v.currentTarget.style.transform="translateY(0)",v.currentTarget.style.boxShadow=`0 4px 12px ${a.accent}40`)},children:S?r.jsxs(r.Fragment,{children:[r.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),r.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
- `})]})})},ls=({isOpen:e,onClose:t,onVerify:r,onSendOTP:s,verifyFormData:o,setVerifyFormData:a,otpSent:i,verifying:l,user:x,colors:d,darkMode:u})=>{if(!e)return null;const m=()=>{t(),a({email:x?.email||"",otp:"",appId:o.appId})};return n.jsxs("div",{className:"modal-overlay",style:{backgroundColor:u?"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:m,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(ce,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"email",value:o.email,onChange:g=>a(j=>({...j,email:g.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"})]})]}),i&&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(ot,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),n.jsx("input",{type:"text",value:o.otp,onChange:g=>a(j=>({...j,otp:g.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:i?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(oe,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(de,{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(oe,{size:16,className:"spinner","aria-hidden":"true"}):n.jsx(at,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]}),n.jsx("style",{children:`
347
+ `})]})})},ls=({isOpen:e,onClose:t,onVerify:n,onSendOTP:s,verifyFormData:o,setVerifyFormData:a,otpSent:i,verifying:l,user:x,colors:d,darkMode:u})=>{if(!e)return null;const b=()=>{t(),a({email:x?.email||"",otp:"",appId:o.appId})};return r.jsxs("div",{className:"modal-overlay",style:{backgroundColor:u?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.5)"},children:[r.jsxs("div",{className:"verify-email-modal",style:{backgroundColor:d.surface,border:`1px solid ${d.border}`},children:[r.jsxs("div",{className:"modal-header",children:[r.jsx("h3",{style:{color:d.textPrimary},children:"Verify Your Email"}),r.jsx("button",{onClick:b,className:"close-btn",style:{color:d.textTertiary},"aria-label":"Close verification modal",children:r.jsx(Pe,{size:20,"aria-hidden":"true"})})]}),r.jsxs("form",{className:"verify-form",onSubmit:n,children:[r.jsxs("div",{className:"form-group",children:[r.jsx("label",{style:{color:d.textSecondary},children:"Email"}),r.jsxs("div",{className:"input-container",children:[r.jsx(ce,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),r.jsx("input",{type:"email",value:o.email,onChange:y=>a(S=>({...S,email:y.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"})]})]}),i&&r.jsxs("div",{className:"form-group",children:[r.jsx("label",{style:{color:d.textSecondary},children:"OTP"}),r.jsxs("div",{className:"input-container",children:[r.jsx(rr,{size:18,style:{color:d.textTertiary},"aria-hidden":"true"}),r.jsx("input",{type:"text",value:o.otp,onChange:y=>a(S=>({...S,otp:y.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"})]})]}),r.jsx("div",{className:"modal-actions",children:i?r.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?r.jsx(oe,{size:16,className:"spinner","aria-hidden":"true"}):r.jsx(de,{size:16,"aria-hidden":"true"}),l?"Verifying...":"Verify Email"]}):r.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?r.jsx(oe,{size:16,className:"spinner","aria-hidden":"true"}):r.jsx(at,{size:16,"aria-hidden":"true"}),l?"Sending...":"Send OTP"]})})]})]}),r.jsx("style",{children:`
348
348
  .modal-overlay {
349
349
  position: fixed;
350
350
  top: 0;
@@ -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:a,primaryColor:i="#00C212"})=>{const{baseUrl:l,apiKey:x,appId:d}=ue(),[u,m]=w.useState(null),[g,j]=w.useState(t),[c,S]=w.useState(!0),[y,R]=w.useState(!1),[C,A]=w.useState(!1),[P,M]=w.useState(!1),[b,$]=w.useState(!1),[k,L]=w.useState(!1),[V,W]=w.useState(!1),[Y,Z]=w.useState(!1),[I,X]=w.useState(!1),[K,z]=w.useState(null),[O,ne]=w.useState(!1),[J,f]=w.useState({email:"",otp:"",appId:d}),[v,N]=w.useState(!1),[h,E]=w.useState(!1);w.useEffect(()=>{if(typeof window<"u"){const T=()=>m(window.innerWidth);return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)}},[]);const _=(T,H)=>{z({type:T,message:H}),setTimeout(()=>z(null),3e3)},B=()=>{X(!0);const T=setTimeout(()=>{Z(!1),X(!1)},150);return()=>clearTimeout(T)};w.useEffect(()=>{const T=H=>{const G=document.querySelector(".dropdown-container");G&&!G.contains(H.target)&&B()};return Y&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[Y]);const ae=async()=>{if(!J.email||!/\S+@\S+\.\S+/.test(J.email)){_("error","Please enter a valid email");return}try{E(!0);const T=await F.post(`${l}/users/send-verify-otp/${g?.id}`,{email:J.email},{headers:{"x-api-key":x,"x-app-id":d}});T.data.success?(_("success",T.data.message||"OTP sent to email!"),N(!0)):_("error",T.data.message||"Failed to send OTP")}catch(T){_("error",T.response?.data?.message||"Server error")}finally{E(!1)}},pe=async T=>{if(T.preventDefault(),!J.email||!J.otp){_("error","Please fill in all fields");return}try{E(!0);const H=await F.post(`${l}/users/verify-email`,J);if(H.data.success){if(_("success",H.data.message||"Email verified!"),g){const G={...g,isVerified:!0};j(G),localStorage.setItem("userInfo",JSON.stringify({...G,token:e})),typeof a=="function"&&a(G)}f({email:"",otp:"",appId:d}),N(!1),W(!1)}else _("error",H.data.message||"Verification failed")}catch(H){_("error",H.response?.data?.message||"Something went wrong")}finally{E(!1)}},Oe=async T=>{if(!g)return!1;try{const H={...g,avatarUrl:T},{data:G}=await F.put(`${l}/users/update/${g.id}`,H,{headers:{"x-api-key":x}});return G.success?(j(H),localStorage.setItem("userInfo",JSON.stringify({...H,token:e})),_("success","Avatar updated successfully!"),!0):(_("error",G.message||"Failed to update avatar"),!1)}catch(H){return console.error("Avatar update error:",H),_("error","Failed to update avatar"),!1}},lt=async()=>{if(g){A(!0);try{const{data:T}=await F.put(`${l}/users/update/${g.id}`,g,{headers:{"x-api-key":x}});T.success?(j(T.user),R(!1),localStorage.setItem("userInfo",JSON.stringify({...T.user,token:e})),_("success","Profile updated successfully")):_("error",T.message)}catch(T){console.error(T),_("error","Update failed")}finally{A(!1)}}},or=async T=>{try{const{data:H}=await F.get(`${l}/users/check-user/${T}?appId=${d}`,{headers:{"x-api-key":x}});(!H.success||!H.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),j(null))}catch(H){console.error("User check failed:",H),localStorage.removeItem("userInfo"),j(null)}};w.useEffect(()=>{(()=>{if(t)j(t),S(!1),or(t.id);else{const H=localStorage.getItem("userInfo");if(H){const G=JSON.parse(H);j(G),S(!1),or(G.id)}else S(!1)}})()},[t]),w.useEffect(()=>{g?.email&&f(T=>({...T,email:g.email}))},[g?.email]);const ir=(T,H)=>{let G=parseInt(T.replace("#",""),16),ge=(G>>16)+H,dt=(G>>8&255)+H,ct=(G&255)+H;return ge=Math.min(255,Math.max(0,ge)),dt=Math.min(255,Math.max(0,dt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|dt<<8|ge<<16).toString(16).padStart(6,"0")}`},D=r?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:ir(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:ir(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(c)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:D.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(oe,{size:40,color:D.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),n.jsx("p",{style:{color:D.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!g)return n.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:D.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(le,{size:40,color:D.error,"aria-hidden":"true"}),n.jsx("p",{style:{color:D.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const ps=[{label:"Full Name",value:g.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:g.email,name:"email",type:"email",icon:ce},{label:"Phone Number",value:g.phone||"Not set",name:"phone",type:"tel",icon:Jn},{label:"Address",value:g.address||"Not provided",name:"address",type:"text",icon:Yn}];return n.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:D.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(de,{size:20,"aria-hidden":"true"}):n.jsx(le,{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",...u&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...u&&window.innerWidth>=768&&u&&window.innerWidth<1024&&{gap:"10px"},...u&&window.innerWidth>=600&&u&&window.innerWidth<768&&{gap:"28px"}},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[n.jsxs("section",{style:{backgroundColor:D.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(qn,{size:20,style:{color:r?"#ffffff":"#000000"}})}),n.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[n.jsx("img",{src:g.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(g.name)}`,alt:`Profile avatar of ${g.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${D.border}`},width:128,height:128,loading:"eager"}),n.jsx("button",{onClick:()=>M(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:D.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(tt,{size:16,"aria-hidden":"true"})})]}),n.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:D.textPrimary},children:g.name}),n.jsx("p",{style:{color:D.textTertiary,margin:"0 0 8px 0"},children:g.email}),n.jsxs("div",{style:{backgroundColor:g.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:g.isVerified?D.success:D.warning,border:`1px solid ${g.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:[g.isVerified?n.jsx(de,{size:16,"aria-hidden":"true"}):n.jsx(le,{size:16,"aria-hidden":"true"}),g.isVerified?"Email Verified":"Not Verified"]})]}),n.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:y?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>R(!1),style:{backgroundColor:D.surfaceLight,border:`1px solid ${D.border}`,color:D.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),n.jsxs("button",{onClick:lt,disabled:C,style:{background:`linear-gradient(to right, ${D.accent}, ${D.accentHover})`,opacity:C?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:C?"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:u&&window.innerWidth<1024?"1":"auto"},children:[C?n.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(Xn,{size:16,"aria-hidden":"true"}),C?"Saving...":"Save Changes"]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:()=>R(!0),style:{background:`linear-gradient(to right, ${D.accent}, ${D.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:u&&window.innerWidth<1024?"1":"auto"},children:[n.jsx(Kn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!g.isVerified&&n.jsxs("button",{onClick:()=>W(!0),disabled:O,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:O?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:O?.7:1,flex:u&&window.innerWidth<1024?"1":"auto"},children:[O?n.jsx(oe,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):n.jsx(at,{size:14,"aria-hidden":"true"}),O?"Sending...":"Verify Email"]}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("button",{style:{backgroundColor:D.surfaceLight,color:D.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:()=>Z(!Y),children:[n.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),Y&&n.jsxs("div",{className:`dropdown-container ${I?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:D.surface,border:`1px solid ${D.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${I?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[n.jsxs("button",{onClick:()=>{$(!0),B()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:D.textPrimary,cursor:"pointer",transition:"all 0.2s ease",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px",textAlign:"left"},onMouseEnter:T=>T.currentTarget.style.backgroundColor=D.surfaceLight,onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(rr,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&n.jsxs("button",{onClick:()=>{o(),B()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.currentTarget.style.backgroundColor="transparent",children:[n.jsx(it,{size:14,"aria-hidden":"true"}),"Logout"]}),n.jsxs("button",{onClick:()=>{L(!0),B()},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:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:T=>T.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:D.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:D.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),n.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...u&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:ps.map(T=>{const H=T.icon;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[n.jsxs("label",{style:{color:D.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(H,{size:16,"aria-hidden":"true"}),T.label]}),y?n.jsx("input",{type:T.type,name:T.name,value:g[T.name],onChange:G=>j(ge=>ge&&{...ge,[G.target.name]:G.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:D.textPrimary,fontSize:"12px",outline:"none",transition:"border-color 0.2s ease",minHeight:"44px",width:"100%",boxSizing:"border-box"},placeholder:`Enter ${T.label.toLowerCase()}`,"aria-label":T.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:D.textPrimary,backgroundColor:r?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:T.value})]},T.name)})})]}),n.jsxs("section",{style:{backgroundColor:D.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:D.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(nr,{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:D.textSecondary},children:[n.jsx(ce,{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",...g.isVerified?{backgroundColor:r?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:D.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:D.warning,border:`1px solid ${r?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:g.isVerified?n.jsxs(n.Fragment,{children:[n.jsx(de,{size:16,"aria-hidden":"true"}),"Verified"]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!g.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:D.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),n.jsx(is,{isOpen:P,onClose:()=>{M(!1)},onUpdate:Oe,colors:D}),n.jsx(as,{baseUrl:l,apiKey:x,appId:d,userId:g.id,isOpen:b,onClose:()=>$(!1),onSuccess:T=>_("success",T),onError:T=>_("error",T),colors:D}),n.jsx(os,{baseUrl:l,apiKey:x,appId:d,userId:g.id,token:e,isOpen:k,onClose:()=>L(!1),onSuccess:T=>_("success",T),onError:T=>_("error",T),colors:D}),n.jsx(ls,{isOpen:V,onClose:()=>{W(!1),N(!1),f({email:g?.email||"",otp:"",appId:d})},onVerify:pe,onSendOTP:ae,verifyFormData:J,setVerifyFormData:f,otpSent:v,verifying:h,user:g,colors:D,darkMode:r}),n.jsx("style",{children:`
494
+ `})]})},ds=({token:e,user:t=null,darkMode:n=!0,homeUrl:s,onLogout:o,onVerify:a,primaryColor:i="#00C212"})=>{const{baseUrl:l,apiKey:x,appId:d}=ue(),[u,b]=w.useState(null),[y,S]=w.useState(t),[c,j]=w.useState(!0),[m,A]=w.useState(!1),[P,$]=w.useState(!1),[T,M]=w.useState(!1),[g,O]=w.useState(!1),[v,U]=w.useState(!1),[q,F]=w.useState(!1),[Y,Z]=w.useState(!1),[I,X]=w.useState(!1),[K,_]=w.useState(null),[R,ne]=w.useState(!1),[J,f]=w.useState({email:"",otp:"",appId:d}),[k,N]=w.useState(!1),[h,E]=w.useState(!1);w.useEffect(()=>{if(typeof window<"u"){const C=()=>b(window.innerWidth);return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)}},[]);const z=(C,V)=>{_({type:C,message:V}),setTimeout(()=>_(null),3e3)},B=()=>{X(!0);const C=setTimeout(()=>{Z(!1),X(!1)},150);return()=>clearTimeout(C)};w.useEffect(()=>{const C=V=>{const G=document.querySelector(".dropdown-container");G&&!G.contains(V.target)&&B()};return Y&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[Y]);const le=async()=>{if(!J.email||!/\S+@\S+\.\S+/.test(J.email)){z("error","Please enter a valid email");return}try{E(!0);const C=await W.post(`${l}/users/send-verify-otp/${y?.id}`,{email:J.email},{headers:{"x-api-key":x,"x-app-id":d}});C.data.success?(z("success",C.data.message||"OTP sent to email!"),N(!0)):z("error",C.data.message||"Failed to send OTP")}catch(C){z("error",C.response?.data?.message||"Server error")}finally{E(!1)}},pe=async C=>{if(C.preventDefault(),!J.email||!J.otp){z("error","Please fill in all fields");return}try{E(!0);const V=await W.post(`${l}/users/verify-email`,J);if(V.data.success){if(z("success",V.data.message||"Email verified!"),y){const G={...y,isVerified:!0};S(G),localStorage.setItem("userInfo",JSON.stringify({...G,token:e})),typeof a=="function"&&a(G)}f({email:"",otp:"",appId:d}),N(!1),F(!1)}else z("error",V.data.message||"Verification failed")}catch(V){z("error",V.response?.data?.message||"Something went wrong")}finally{E(!1)}},Oe=async C=>{if(!y)return!1;try{const V={...y,avatarUrl:C},{data:G}=await W.put(`${l}/users/update/${y.id}`,V,{headers:{"x-api-key":x}});return G.success?(S(V),localStorage.setItem("userInfo",JSON.stringify({...V,token:e})),z("success","Avatar updated successfully!"),!0):(z("error",G.message||"Failed to update avatar"),!1)}catch(V){return console.error("Avatar update error:",V),z("error","Failed to update avatar"),!1}},lt=async()=>{if(y){$(!0);try{const{data:C}=await W.put(`${l}/users/update/${y.id}`,y,{headers:{"x-api-key":x}});C.success?(S(C.user),A(!1),localStorage.setItem("userInfo",JSON.stringify({...C.user,token:e})),z("success","Profile updated successfully")):z("error",C.message)}catch(C){console.error(C),z("error","Update failed")}finally{$(!1)}}},or=async C=>{try{const{data:V}=await W.get(`${l}/users/check-user/${C}?appId=${d}`,{headers:{"x-api-key":x}});(!V.success||!V.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),S(null))}catch(V){console.error("User check failed:",V),localStorage.removeItem("userInfo"),S(null)}};w.useEffect(()=>{(()=>{if(t)S(t),j(!1),or(t.id);else{const V=localStorage.getItem("userInfo");if(V){const G=JSON.parse(V);S(G),j(!1),or(G.id)}else j(!1)}})()},[t]),w.useEffect(()=>{y?.email&&f(C=>({...C,email:y.email}))},[y?.email]);const ir=(C,V)=>{let G=parseInt(C.replace("#",""),16),ge=(G>>16)+V,dt=(G>>8&255)+V,ct=(G&255)+V;return ge=Math.min(255,Math.max(0,ge)),dt=Math.min(255,Math.max(0,dt)),ct=Math.min(255,Math.max(0,ct)),`#${(ct|dt<<8|ge<<16).toString(16).padStart(6,"0")}`},L=n?{background:"#000000",surface:"#09090b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:i,accentHover:ir(i,-15),success:"#10b981",error:"#ef4444",border:"#27272a",warning:"#f59e0b"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:i,accentHover:ir(i,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7",warning:"#d97706"};if(c)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",textAlign:"center"},children:[r.jsx(oe,{size:40,color:L.accent,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}),r.jsx("p",{style:{color:L.textTertiary,margin:0},children:"Loading your profile..."})]})});if(!y)return r.jsx("div",{style:{width:"100%",minHeight:"400px",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif"},children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",textAlign:"center"},children:[r.jsx(ae,{size:40,color:L.error,"aria-hidden":"true"}),r.jsx("p",{style:{color:L.textTertiary,margin:0},children:"No profile found. Please log in again."})]})});const ps=[{label:"Full Name",value:y.name,name:"name",type:"text",icon:Se},{label:"Email Address",value:y.email,name:"email",type:"email",icon:ce},{label:"Phone Number",value:y.phone||"Not set",name:"phone",type:"tel",icon:Jn},{label:"Address",value:y.address||"Not provided",name:"address",type:"text",icon:Yn}];return r.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:L.textPrimary,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",lineHeight:1.5,minHeight:"80vh"},children:[K&&r.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:n?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",borderColor:n?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)",color:n?"#34d399":"#059669"}:{backgroundColor:n?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)",borderColor:n?"rgba(239, 68, 68, 0.3)":"rgba(239, 68, 68, 0.2)",color:n?"#f87171":"#dc2626"}},role:"alert","aria-live":"polite",children:[K.type==="success"?r.jsx(de,{size:20,"aria-hidden":"true"}):r.jsx(ae,{size:20,"aria-hidden":"true"}),K.message]}),r.jsx("div",{style:{maxWidth:"1200px",margin:"0 auto",width:"100%",boxSizing:"border-box"},children:r.jsxs("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:"1fr",...u&&window.innerWidth>=1024&&{gridTemplateColumns:"1fr 2fr",gap:"10px"},...u&&window.innerWidth>=768&&u&&window.innerWidth<1024&&{gap:"10px"},...u&&window.innerWidth>=600&&u&&window.innerWidth<768&&{gap:"28px"}},children:[r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",height:"100%"},children:[r.jsxs("section",{style:{backgroundColor:L.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&&r.jsx("a",{href:s||"/",target:"_self",rel:"noopener noreferrer",style:{position:"absolute",top:"18px",left:"18px"},children:r.jsx(qn,{size:20,style:{color:n?"#ffffff":"#000000"}})}),r.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:"16px"},children:[r.jsx("img",{src:y.avatarUrl||`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(y.name)}`,alt:`Profile avatar of ${y.name}`,style:{width:"128px",height:"128px",borderRadius:"50%",objectFit:"cover",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.3)",border:`3px solid ${L.border}`},width:128,height:128,loading:"eager"}),r.jsx("button",{onClick:()=>M(!0),style:{position:"absolute",bottom:"8px",right:"8px",backgroundColor:L.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:r.jsx(tt,{size:16,"aria-hidden":"true"})})]}),r.jsx("h2",{style:{fontSize:"24px",fontWeight:600,margin:"0 0 4px 0",color:L.textPrimary},children:y.name}),r.jsx("p",{style:{color:L.textTertiary,margin:"0 0 8px 0"},children:y.email}),r.jsxs("div",{style:{backgroundColor:y.isVerified?n?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)":n?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:y.isVerified?L.success:L.warning,border:`1px solid ${y.isVerified?n?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)":n?"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:[y.isVerified?r.jsx(de,{size:16,"aria-hidden":"true"}):r.jsx(ae,{size:16,"aria-hidden":"true"}),y.isVerified?"Email Verified":"Not Verified"]})]}),r.jsx("nav",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:m?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>A(!1),style:{backgroundColor:L.surfaceLight,border:`1px solid ${L.border}`,color:L.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:u&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Pe,{size:16,"aria-hidden":"true"}),"Cancel"]}),r.jsxs("button",{onClick:lt,disabled:P,style:{background:`linear-gradient(to right, ${L.accent}, ${L.accentHover})`,opacity:P?.7:1,color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:P?"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:u&&window.innerWidth<1024?"1":"auto"},children:[P?r.jsx(oe,{size:16,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(Xn,{size:16,"aria-hidden":"true"}),P?"Saving...":"Save Changes"]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>A(!0),style:{background:`linear-gradient(to right, ${L.accent}, ${L.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:u&&window.innerWidth<1024?"1":"auto"},children:[r.jsx(Kn,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),!y.isVerified&&r.jsxs("button",{onClick:()=>F(!0),disabled:R,style:{background:"linear-gradient(to right, #fbbf24, #f59e0b)",color:"white",padding:"10px 20px",borderRadius:"6px",border:"none",cursor:R?"not-allowed":"pointer",transition:"all 0.2s ease",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",minHeight:"36px",opacity:R?.7:1,flex:u&&window.innerWidth<1024?"1":"auto"},children:[R?r.jsx(oe,{size:14,style:{animation:"spin 1s linear infinite"},"aria-hidden":"true"}):r.jsx(at,{size:14,"aria-hidden":"true"}),R?"Sending...":"Verify Email"]}),r.jsxs("div",{style:{position:"relative"},children:[r.jsxs("button",{style:{backgroundColor:L.surfaceLight,color:L.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:()=>Z(!Y),children:[r.jsx(Bn,{size:16,"aria-hidden":"true"}),"More Actions"]}),Y&&r.jsxs("div",{className:`dropdown-container ${I?"closing":""}`,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:L.surface,border:`1px solid ${L.border}`,borderRadius:"12px 12px 0 0",boxShadow:"0 -8px 24px rgba(0, 0, 0, 0.25)",zIndex:200,marginBottom:"6px",overflow:"hidden",animation:`${I?"drawerSlideDown":"drawerSlideUp"} 0.25s ease-out forwards`},children:[r.jsxs("button",{onClick:()=>{O(!0),B()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:L.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=L.surfaceLight,onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[r.jsx(ot,{size:14,"aria-hidden":"true"}),"Change Password"]}),o&&r.jsxs("button",{onClick:()=>{o(),B()},style:{width:"100%",padding:"14px 18px",backgroundColor:"transparent",border:"none",color:n?"#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=n?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[r.jsx(it,{size:14,"aria-hidden":"true"}),"Logout"]}),r.jsxs("button",{onClick:()=>{U(!0),B()},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=n?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.05)"},onMouseLeave:C=>C.currentTarget.style.backgroundColor="transparent",children:[r.jsx(We,{size:14,"aria-hidden":"true"}),"Delete Account"]})]})]})]})})]}),r.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"12px"},children:[r.jsxs("section",{style:{backgroundColor:L.surface,borderRadius:"16px",padding:"24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(Se,{size:20,"aria-hidden":"true"}),"Personal Information"]}),r.jsx("div",{style:{display:"grid",gap:"20px",gridTemplateColumns:"1fr",...u&&window.innerWidth>=600&&{gridTemplateColumns:"1fr 1fr",gap:"20px"}},children:ps.map(C=>{const V=C.icon;return r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[r.jsxs("label",{style:{color:L.textTertiary,fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(V,{size:16,"aria-hidden":"true"}),C.label]}),m?r.jsx("input",{type:C.type,name:C.name,value:y[C.name],onChange:G=>S(ge=>ge&&{...ge,[G.target.name]:G.target.value}),style:{padding:"12px",borderRadius:"8px",border:`1px solid ${i}`,backgroundColor:"transparent",color:L.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}):r.jsx("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid transparent",fontSize:"12px",minHeight:"44px",display:"flex",alignItems:"center",boxSizing:"border-box",color:L.textPrimary,backgroundColor:n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},children:C.value})]},C.name)})})]}),r.jsxs("section",{style:{backgroundColor:L.surface,borderRadius:"16px",padding:"30px 24px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r.jsxs("h2",{style:{fontSize:"20px",fontWeight:600,margin:"0 0 24px 0",color:L.textSecondary,display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(nr,{size:20,"aria-hidden":"true"}),"Security Status"]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",color:L.textSecondary},children:[r.jsx(ce,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:"Email Verification"})]}),r.jsx("div",{style:{padding:"6px 12px",borderRadius:"8px",fontSize:"12px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",...y.isVerified?{backgroundColor:n?"rgba(16, 185, 129, 0.1)":"rgba(16, 185, 129, 0.05)",color:L.success,border:`1px solid ${n?"rgba(16, 185, 129, 0.3)":"rgba(16, 185, 129, 0.2)"}`}:{backgroundColor:n?"rgba(245, 158, 11, 0.1)":"rgba(245, 158, 11, 0.05)",color:L.warning,border:`1px solid ${n?"rgba(245, 158, 11, 0.3)":"rgba(245, 158, 11, 0.2)"}`}},children:y.isVerified?r.jsxs(r.Fragment,{children:[r.jsx(de,{size:16,"aria-hidden":"true"}),"Verified"]}):r.jsxs(r.Fragment,{children:[r.jsx(ae,{size:16,"aria-hidden":"true"}),"Not Verified"]})})]}),!y.isVerified&&r.jsx("div",{style:{padding:"12px",borderRadius:"8px",backgroundColor:n?"rgba(100, 100, 100, 0.1)":"rgba(0, 0, 0, 0.05)"},children:r.jsx("p",{style:{color:L.textTertiary,fontSize:"12px",margin:0},children:"Verify your email to unlock all features and enhance your account security."})})]})]})]})]})}),r.jsx(is,{isOpen:T,onClose:()=>{M(!1)},onUpdate:Oe,colors:L}),r.jsx(as,{baseUrl:l,apiKey:x,appId:d,userId:y.id,isOpen:g,onClose:()=>O(!1),onSuccess:C=>z("success",C),onError:C=>z("error",C),colors:L}),r.jsx(os,{baseUrl:l,apiKey:x,appId:d,userId:y.id,token:e,isOpen:v,onClose:()=>U(!1),onSuccess:C=>z("success",C),onError:C=>z("error",C),colors:L}),r.jsx(ls,{isOpen:q,onClose:()=>{F(!1),N(!1),f({email:y?.email||"",otp:"",appId:d})},onVerify:pe,onSendOTP:le,verifyFormData:J,setVerifyFormData:f,otpSent:k,verifying:h,user:y,colors:L,darkMode:n}),r.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
- `})]})},cs=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:r,varient:s="classic",propUser:o,className:a="",profileUrl:i,settingsUrl:l,showProfileMenuItem:x=!0,showSettingsMenuItem:d=!0,showViewProfileMenuItem:u=!0,profileLabel:m="My Profile",settingsLabel:g="Settings",viewProfileLabel:j="View Profile",logoutLabel:c="Sign Out"})=>{const{baseUrl:S,apiKey:y,appId:R}=ue(),[C,A]=w.useState(!1),[P,M]=w.useState(null),[b,$]=w.useState(!0),[k,L]=w.useState(null),V=w.useRef(null),W=w.useRef(null),[Y,Z]=w.useState(!1),[I,X]=w.useState(!1),K=async h=>{try{if(!h)throw new Error("Invalid user ID");const{data:E}=await F.get(`${S}/users/check-user/${h}?appId=${R}`,{headers:{"x-api-key":y},timeout:1e4});(!E.success||!E.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),L("Session expired"))}catch(E){console.error("User validation failed:",E);const _=E.response?.status===404?"User not found":E.code==="NETWORK_ERROR"?"Network error":"Validation failed";L(_),E.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};w.useEffect(()=>{if(typeof window>"u")return;const h=()=>{X(window.innerWidth<768)};return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]),w.useEffect(()=>{(async()=>{try{if($(!0),L(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await K(o.id)}else if(typeof window<"u"){const E=localStorage.getItem("userInfo");if(E)try{const _=JSON.parse(E);if(!_.id||!_.name||!_.email)throw new Error("Invalid stored user data");M(_),await K(_.id)}catch(_){console.error("Failed to parse stored user data:",_),localStorage.removeItem("userInfo"),L("Invalid user data")}}}catch(E){console.error("User initialization failed:",E),L(E.message||"Failed to load user")}finally{$(!1)}})()},[o]),w.useEffect(()=>{if(typeof window>"u")return;const h=()=>{if(!C||!W.current)return;const E=W.current.getBoundingClientRect(),_=window.innerWidth,B=window.innerHeight,ae=280,pe=_-E.right,Oe=E.left;B-E.bottom;const lt=pe>=ae||pe>Oe;Z(lt)};return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[C]),w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const h=B=>{V.current&&!V.current.contains(B.target)&&!W.current?.contains(B.target)&&A(!1)},E=B=>{B.key==="Escape"&&A(!1)},_=()=>{C&&A(!1)};return C&&(document.addEventListener("mousedown",h),document.addEventListener("keydown",E),window.addEventListener("scroll",_)),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",E),window.removeEventListener("scroll",_)}},[C]);const z=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"},O={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:z.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${z.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:z.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:z.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:C?"rotate(180deg)":"rotate(0deg)",color:z.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[Y?"left":"right"]:"0",backgroundColor:z.surfaceElevated,border:`1px solid ${z.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:C?1:0,pointerEvents:C?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:C?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${z.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:z.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:z.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:z.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:z.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:z.error,textAlign:"left",outline:"none"},loadingText:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:z.textSecondary,fontSize:I?"13px":"14px"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:z.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:z.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},ne=()=>{L(null),$(!0);const h=localStorage.getItem("userInfo");if(h)try{const E=JSON.parse(h);M(E),K(E.id)}catch{L("Invalid user data")}$(!1)},J=(h,E)=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E())},f=()=>i||P?.profileUrl,v=()=>{const h=f();h&&window.open(h,"_self","noopener,noreferrer")},N=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return n.jsxs("div",{style:O.wrapper,ref:V,className:a,role:"menu","aria-label":"User menu",children:[s==="classic"?n.jsx("div",{ref:W,onClick:()=>A(h=>!h),onKeyDown:h=>J(h,()=>A(E=>!E)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":C,"aria-label":"Toggle user menu",children:P?.avatarUrl?n.jsx("img",{src:P.avatarUrl,alt:`${P?.name||"User"}'s avatar`,style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${z.borderLight}`,flexShrink:0},loading:"lazy",onError:h=>{const E=h.target;E.onerror=null,E.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(P?.name||"User")}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(P?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${z.borderLight}`,flexShrink:0},loading:"lazy"})}):n.jsxs("div",{ref:W,style:O.avatarButton,onClick:()=>A(h=>!h),onKeyDown:h=>J(h,()=>A(E=>!E)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":C,"aria-label":"Toggle user menu",onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.surfaceHover,h.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:h=>{h.currentTarget.style.backgroundColor=z.surface,h.currentTarget.style.boxShadow="none"},onBlur:h=>{h.currentTarget.style.outline="none"},children:[P?.avatarUrl?n.jsx("img",{src:P.avatarUrl,alt:`${P.name}'s avatar`,style:O.avatarImage,loading:"lazy",onError:h=>{const E=h.target;E.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:O.avatarImage,loading:"lazy"}),!I&&n.jsxs("div",{style:O.userInfo,children:[n.jsx("div",{style:O.userName,title:P?.name,children:P?.name||"Guest"}),P?.email&&n.jsx("div",{style:O.userEmail,title:P.email,children:P.email})]}),n.jsx(Mn,{size:I?14:16,style:O.chevron,"aria-hidden":"true"})]}),C&&n.jsx("div",{style:O.dropdown,role:"menu","aria-label":"User options",children:b?n.jsx("div",{style:O.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):P?n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:O.userSection,children:[P?.avatarUrl?n.jsx("img",{src:P.avatarUrl,alt:`${P.name}'s profile picture`,style:O.dropdownAvatar,loading:"lazy",onError:h=>{const E=h.target;E.src=`https://api.dicebear.com/9.x/initials/svg?seed=${P.name}`}}):n.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${P.name}`,alt:`${P.name}'s default avatar`,style:O.dropdownAvatar,loading:"lazy"}),n.jsxs("div",{style:O.dropdownUserInfo,children:[n.jsx("div",{style:O.dropdownUserName,title:P.name,children:P.name}),n.jsx("div",{style:O.dropdownUserEmail,title:P.email,children:P.email})]})]}),n.jsxs("div",{style:O.dropdownSection,children:[x&&f()&&n.jsxs("button",{style:O.menuItem,onClick:v,onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,v),role:"menuitem",tabIndex:0,children:[n.jsx(Se,{style:O.icon,"aria-hidden":"true"}),n.jsx("span",{style:O.menuItemText,children:m})]}),d&&l&&n.jsxs("button",{style:O.menuItem,onClick:N,onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,N),role:"menuitem",tabIndex:0,children:[n.jsx(Gn,{style:O.icon,"aria-hidden":"true"}),n.jsx("span",{style:O.menuItemText,children:g})]}),u&&P.profileUrl&&n.jsxs("a",{href:P.profileUrl,target:"_self",rel:"noopener noreferrer",style:O.menuItem,onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[n.jsx(ce,{style:O.icon,"aria-hidden":"true"}),n.jsx("span",{style:O.menuItemText,children:j})]})]}),n.jsx("div",{style:O.dropdownSection,children:n.jsxs("button",{style:O.logoutButton,onClick:r,onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,r),role:"menuitem",tabIndex:0,children:[n.jsx(it,{style:{...O.icon,color:z.error},"aria-hidden":"true"}),n.jsx("span",{style:O.menuItemText,children:c})]})})]}):n.jsxs("div",{style:O.errorState,role:"alert",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[n.jsx(le,{size:16,"aria-hidden":"true"}),n.jsx("span",{children:k||"Not signed in"})]}),k&&k!=="Not signed in"&&n.jsx("button",{style:O.retryButton,onClick:ne,onMouseOver:h=>{h.currentTarget.style.backgroundColor=z.accentHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor=z.accent},children:"Try Again"})]})})]})},us=({user:e,darkMode:t=!0,colors:r,onVerify:s})=>{const{appId:o,baseUrl:a,apiKey:i}=ue(),[l,x]=w.useState({email:e?.email||"",otp:"",appId:o}),[d,u]=w.useState(!1),[m,g]=w.useState(!1);w.useEffect(()=>{e?.email&&x(R=>({...R,email:e.email}))},[e?.email]);const j=async()=>{if(!(!l.email||!/\S+@\S+\.\S+/.test(l.email)))try{g(!0),(await F.post(`${a}/users/send-verify-otp/${e?.id}`,{email:l.email},{headers:{"x-api-key":i,"x-app-id":o}})).data.success&&u(!0)}catch(R){console.error(R)}finally{g(!1)}},c=async R=>{if(R.preventDefault(),!(!l.email||!l.otp))try{if(g(!0),(await F.post(`${a}/users/verify-email`,l)).data.success&&e){const A={...e,isVerified:!0};s?.(A),u(!1),x({email:e.email,otp:"",appId:o})}}catch(C){console.error(C)}finally{g(!1)}},S={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${r.border}`,backgroundColor:r.surfaceLight,color:r.textPrimary,fontSize:14,outline:"none"},y=(R=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:R?"not-allowed":"pointer",background:`linear-gradient(to right, ${r.accent}, ${r.accentHover})`,opacity:R?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return n.jsxs("form",{onSubmit:c,style:{display:"flex",flexDirection:"column",gap:16,backgroundColor:r.surface,padding:24,borderRadius:16,border:`1px solid ${r.border}`},children:[n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:r.textSecondary},children:"Email"}),n.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.jsx(ce,{size:18,style:{position:"absolute",left:12,pointerEvents:"none",color:r.textTertiary}}),n.jsx("input",{type:"email",value:l.email,onChange:R=>x(C=>({...C,email:R.target.value})),placeholder:"Enter your email",style:S,required:!0})]})]}),d&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[n.jsx("label",{style:{color:r.textSecondary},children:"OTP"}),n.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[n.jsx(ot,{size:18,style:{position:"absolute",left:12,pointerEvents:"none",color:r.textTertiary}}),n.jsx("input",{type:"text",value:l.otp,onChange:R=>x(C=>({...C,otp:R.target.value})),placeholder:"Enter OTP",style:S,required:!0})]})]}),n.jsx("div",{style:{display:"flex",gap:12},children:d?n.jsxs("button",{type:"submit",disabled:m,style:y(m),children:[m?n.jsx(oe,{size:16,className:"spinner"}):n.jsx(de,{size:16}),m?"Verifying...":"Verify Email"]}):n.jsxs("button",{type:"button",onClick:j,disabled:m,style:y(m),children:[m?n.jsx(oe,{size:16,className:"spinner"}):n.jsx(at,{size:16}),m?"Sending...":"Send OTP"]})})]})};Q.NeuctraAuthix=Rn,Q.ReactEmailVerification=us,Q.ReactSignedIn=ns,Q.ReactSignedOut=ss,Q.ReactUserButton=cs,Q.ReactUserLogin=rs,Q.ReactUserProfile=ds,Q.ReactUserSignUp=es,Q.getSdkConfig=ue,Q.setSdkConfig=Qn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
582
+ `})]})},cs=({darkMode:e=!0,primaryColor:t="#3b82f6",onLogout:n,varient:s="classic",propUser:o,className:a="",profileUrl:i,settingsUrl:l,showProfileMenuItem:x=!0,showSettingsMenuItem:d=!0,showViewProfileMenuItem:u=!0,profileLabel:b="My Profile",settingsLabel:y="Settings",viewProfileLabel:S="View Profile",logoutLabel:c="Sign Out"})=>{const{baseUrl:j,apiKey:m,appId:A}=ue(),[P,$]=w.useState(!1),[T,M]=w.useState(null),[g,O]=w.useState(!0),[v,U]=w.useState(null),q=w.useRef(null),F=w.useRef(null),[Y,Z]=w.useState(!1),[I,X]=w.useState(!1),K=async h=>{try{if(!h)throw new Error("Invalid user ID");const{data:E}=await W.get(`${j}/users/check-user/${h}?appId=${A}`,{headers:{"x-api-key":m},timeout:1e4});(!E.success||!E.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),M(null),U("Session expired"))}catch(E){console.error("User validation failed:",E);const z=E.response?.status===404?"User not found":E.code==="NETWORK_ERROR"?"Network error":"Validation failed";U(z),E.response?.status===404&&(localStorage.removeItem("userInfo"),M(null))}};w.useEffect(()=>{if(typeof window>"u")return;const h=()=>{X(window.innerWidth<768)};return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]),w.useEffect(()=>{(async()=>{try{if(O(!0),U(null),o){if(!o.id||!o.name||!o.email)throw new Error("Invalid user data provided");M(o),await K(o.id)}else if(typeof window<"u"){const E=localStorage.getItem("userInfo");if(E)try{const z=JSON.parse(E);if(!z.id||!z.name||!z.email)throw new Error("Invalid stored user data");M(z),await K(z.id)}catch(z){console.error("Failed to parse stored user data:",z),localStorage.removeItem("userInfo"),U("Invalid user data")}}}catch(E){console.error("User initialization failed:",E),U(E.message||"Failed to load user")}finally{O(!1)}})()},[o]),w.useEffect(()=>{if(typeof window>"u")return;const h=()=>{if(!P||!F.current)return;const E=F.current.getBoundingClientRect(),z=window.innerWidth,B=window.innerHeight,le=280,pe=z-E.right,Oe=E.left;B-E.bottom;const lt=pe>=le||pe>Oe;Z(lt)};return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[P]),w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const h=B=>{q.current&&!q.current.contains(B.target)&&!F.current?.contains(B.target)&&$(!1)},E=B=>{B.key==="Escape"&&$(!1)},z=()=>{P&&$(!1)};return P&&(document.addEventListener("mousedown",h),document.addEventListener("keydown",E),window.addEventListener("scroll",z)),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",E),window.removeEventListener("scroll",z)}},[P]);const _=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:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:_.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${_.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:_.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:_.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:P?"rotate(180deg)":"rotate(0deg)",color:_.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[Y?"left":"right"]:"0",backgroundColor:_.surfaceElevated,border:`1px solid ${_.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:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${_.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:_.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:_.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:_.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:_.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:_.error,textAlign:"left",outline:"none"},loadingText:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:_.textSecondary,fontSize:I?"13px":"14px"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:_.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:_.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},ne=()=>{U(null),O(!0);const h=localStorage.getItem("userInfo");if(h)try{const E=JSON.parse(h);M(E),K(E.id)}catch{U("Invalid user data")}O(!1)},J=(h,E)=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E())},f=()=>i||T?.profileUrl,k=()=>{const h=f();h&&window.open(h,"_self","noopener,noreferrer")},N=()=>{l&&window.open(l,"_self","noopener,noreferrer")};return r.jsxs("div",{style:R.wrapper,ref:q,className:a,role:"menu","aria-label":"User menu",children:[s==="classic"?r.jsx("div",{ref:F,onClick:()=>$(h=>!h),onKeyDown:h=>J(h,()=>$(E=>!E)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",children:T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T?.name||"User"}'s avatar`,style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${_.borderLight}`,flexShrink:0},loading:"lazy",onError:h=>{const E=h.target;E.onerror=null,E.src=`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`}}):r.jsx("img",{src:`https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(T?.name||"User")}`,alt:"Default user avatar",style:{width:I?"34px":"40px",height:I?"34px":"40px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${_.borderLight}`,flexShrink:0},loading:"lazy"})}):r.jsxs("div",{ref:F,style:R.avatarButton,onClick:()=>$(h=>!h),onKeyDown:h=>J(h,()=>$(E=>!E)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":P,"aria-label":"Toggle user menu",onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.surfaceHover,h.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:h=>{h.currentTarget.style.backgroundColor=_.surface,h.currentTarget.style.boxShadow="none"},onBlur:h=>{h.currentTarget.style.outline="none"},children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s avatar`,style:R.avatarImage,loading:"lazy",onError:h=>{const E=h.target;E.src="https://api.dicebear.com/9.x/glass/svg?seed=Kingston"}}):r.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Kingston",alt:"Default user avatar",style:R.avatarImage,loading:"lazy"}),!I&&r.jsxs("div",{style:R.userInfo,children:[r.jsx("div",{style:R.userName,title:T?.name,children:T?.name||"Guest"}),T?.email&&r.jsx("div",{style:R.userEmail,title:T.email,children:T.email})]}),r.jsx(Mn,{size:I?14:16,style:R.chevron,"aria-hidden":"true"})]}),P&&r.jsx("div",{style:R.dropdown,role:"menu","aria-label":"User options",children:g?r.jsx("div",{style:R.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):T?r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:R.userSection,children:[T?.avatarUrl?r.jsx("img",{src:T.avatarUrl,alt:`${T.name}'s profile picture`,style:R.dropdownAvatar,loading:"lazy",onError:h=>{const E=h.target;E.src=`https://api.dicebear.com/9.x/initials/svg?seed=${T.name}`}}):r.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"}),r.jsxs("div",{style:R.dropdownUserInfo,children:[r.jsx("div",{style:R.dropdownUserName,title:T.name,children:T.name}),r.jsx("div",{style:R.dropdownUserEmail,title:T.email,children:T.email})]})]}),r.jsxs("div",{style:R.dropdownSection,children:[x&&f()&&r.jsxs("button",{style:R.menuItem,onClick:k,onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,k),role:"menuitem",tabIndex:0,children:[r.jsx(Se,{style:R.icon,"aria-hidden":"true"}),r.jsx("span",{style:R.menuItemText,children:b})]}),d&&l&&r.jsxs("button",{style:R.menuItem,onClick:N,onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,N),role:"menuitem",tabIndex:0,children:[r.jsx(Gn,{style:R.icon,"aria-hidden":"true"}),r.jsx("span",{style:R.menuItemText,children:y})]}),u&&T.profileUrl&&r.jsxs("a",{href:T.profileUrl,target:"_self",rel:"noopener noreferrer",style:R.menuItem,onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[r.jsx(ce,{style:R.icon,"aria-hidden":"true"}),r.jsx("span",{style:R.menuItemText,children:S})]})]}),r.jsx("div",{style:R.dropdownSection,children:r.jsxs("button",{style:R.logoutButton,onClick:n,onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.surfaceHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent"},onKeyDown:h=>J(h,n),role:"menuitem",tabIndex:0,children:[r.jsx(it,{style:{...R.icon,color:_.error},"aria-hidden":"true"}),r.jsx("span",{style:R.menuItemText,children:c})]})})]}):r.jsxs("div",{style:R.errorState,role:"alert",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx(ae,{size:16,"aria-hidden":"true"}),r.jsx("span",{children:v||"Not signed in"})]}),v&&v!=="Not signed in"&&r.jsx("button",{style:R.retryButton,onClick:ne,onMouseOver:h=>{h.currentTarget.style.backgroundColor=_.accentHover},onMouseOut:h=>{h.currentTarget.style.backgroundColor=_.accent},children:"Try Again"})]})})]})},us=({user:e,darkMode:t=!0,primaryColor:n="#00C212",onVerify:s})=>{const{appId:o,baseUrl:a,apiKey:i}=ue(),[l,x]=w.useState({email:e?.email||"",otp:"",appId:o}),[d,u]=w.useState(!1),[b,y]=w.useState(!1),[S,c]=w.useState(null),j=(g,O)=>{let v=parseInt(g.replace("#",""),16),U=(v>>16)+O,q=(v>>8&255)+O,F=(v&255)+O;return U=Math.min(255,Math.max(0,U)),q=Math.min(255,Math.max(0,q)),F=Math.min(255,Math.max(0,F)),`#${(F|q<<8|U<<16).toString(16).padStart(6,"0")}`},m=t?{surface:"#09090b",surfaceLight:"#27272a",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",border:"#27272a",accent:n,accentHover:j(n,-15),success:j(n,0),warning:"#f59e0b"}:{surface:"#fafafa",surfaceLight:"#f4f4f5",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",border:"#e4e4e7",accent:n,accentHover:j(n,-15),success:j(n,0),warning:"#d97706"};w.useEffect(()=>{e?.email&&x(g=>({...g,email:e.email}))},[e?.email]);const A=(g,O)=>{c({type:g,message:O}),setTimeout(()=>c(null),3e3)},P=async()=>{if(!l.email||!/\S+@\S+\.\S+/.test(l.email)){A("error","Please enter a valid email");return}try{y(!0);const g=await W.post(`${a}/users/send-verify-otp/${e?.id}`,{email:l.email},{headers:{"x-api-key":i,"x-app-id":o}});g.data.success?(A("success",g.data.message||"OTP sent!"),u(!0)):A("error",g.data.message||"Failed to send OTP")}catch(g){A("error",g.response?.data?.message||"Server error")}finally{y(!1)}},$=async g=>{if(g.preventDefault(),!l.email||!l.otp){A("error","Please fill in all fields");return}try{y(!0);const O=await W.post(`${a}/users/verify-email`,l);if(O.data.success&&e){const v={...e,isVerified:!0};s?.(v),A("success",O.data.message||"Email verified!"),u(!1),x({email:e.email,otp:"",appId:o})}else A("error",O.data.message||"Verification failed")}catch(O){A("error",O.response?.data?.message||"Server error")}finally{y(!1)}},T={width:"100%",padding:"12px 12px 12px 40px",borderRadius:8,border:`1px solid ${m.border}`,backgroundColor:m.surfaceLight,color:m.textPrimary,fontSize:14,outline:"none"},M=(g=!1)=>({flex:1,padding:12,borderRadius:8,color:"#fff",fontWeight:500,cursor:g?"not-allowed":"pointer",background:`linear-gradient(to right, ${m.accent}, ${m.accentHover})`,opacity:g?.7:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontSize:14,border:"none"});return r.jsxs("form",{onSubmit:$,style:{display:"flex",flexDirection:"column",gap:16,backgroundColor:m.surface,padding:24,borderRadius:16,border:`1px solid ${m.border}`},children:[S&&r.jsxs("div",{style:{padding:"12px 20px",borderRadius:12,fontSize:13,fontWeight:500,color:S.type==="success"?m.success:m.warning,border:`1px solid ${S.type==="success"?m.success:m.warning}`,backgroundColor:S.type==="success"?`${m.success}20`:`${m.warning}20`,display:"flex",alignItems:"center",gap:8},children:[S.type==="success"?r.jsx(de,{size:16}):r.jsx(ae,{size:16}),S.message]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[r.jsx("label",{style:{color:m.textSecondary},children:"Email"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(ce,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"email",value:l.email,onChange:g=>x(O=>({...O,email:g.target.value})),placeholder:"Enter your email",style:T,required:!0})]})]}),d&&r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[r.jsx("label",{style:{color:m.textSecondary},children:"OTP"}),r.jsxs("div",{style:{position:"relative"},children:[r.jsx(ot,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:m.textTertiary,pointerEvents:"none"}}),r.jsx("input",{type:"text",value:l.otp,onChange:g=>x(O=>({...O,otp:g.target.value})),placeholder:"Enter OTP",style:T,required:!0})]})]}),r.jsx("div",{style:{display:"flex",gap:12},children:d?r.jsxs("button",{type:"submit",disabled:b,style:M(b),children:[b?r.jsx(oe,{size:16,className:"spinner"}):r.jsx(de,{size:16}),b?"Verifying...":"Verify Email"]}):r.jsxs("button",{type:"button",onClick:P,disabled:b,style:M(b),children:[b?r.jsx(oe,{size:16,className:"spinner"}):r.jsx(at,{size:16}),b?"Sending...":"Send OTP"]})})]})};Q.NeuctraAuthix=Rn,Q.ReactEmailVerification=us,Q.ReactSignedIn=ns,Q.ReactSignedOut=ss,Q.ReactUserButton=cs,Q.ReactUserLogin=rs,Q.ReactUserProfile=ds,Q.ReactUserSignUp=es,Q.getSdkConfig=ue,Q.setSdkConfig=Qn,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));