@neuctra/authix 1.0.9 → 1.0.11

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