@neuctra/authix 1.0.0 → 1.0.1

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(G,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react"),require("vue")):typeof define=="function"&&define.amd?define(["exports","react","vue"],k):(G=typeof globalThis<"u"?globalThis:G||self,k(G.NeuctraAuthix={},G.React,G.Vue))})(this,(function(G,k,Ne){"use strict";function pt(t,e){return function(){return t.apply(e,arguments)}}const{toString:yr}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Ie,toStringTag:ft}=Symbol,ze=(t=>e=>{const r=yr.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ee=t=>(t=t.toLowerCase(),e=>ze(e)===t),Ue=t=>e=>typeof e===t,{isArray:ue}=Array,pe=Ue("undefined");function je(t){return t!==null&&!pe(t)&&t.constructor!==null&&!pe(t.constructor)&&Z(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const xt=ee("ArrayBuffer");function mr(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&xt(t.buffer),e}const br=Ue("string"),Z=Ue("function"),ht=Ue("number"),Se=t=>t!==null&&typeof t=="object",wr=t=>t===!0||t===!1,Fe=t=>{if(ze(t)!=="object")return!1;const e=Je(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ft in t)&&!(Ie in t)},jr=t=>{if(!Se(t)||je(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Sr=ee("Date"),vr=ee("File"),kr=ee("Blob"),Er=ee("FileList"),Tr=t=>Se(t)&&Z(t.pipe),Cr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Z(t.append)&&((e=ze(t))==="formdata"||e==="object"&&Z(t.toString)&&t.toString()==="[object FormData]"))},Rr=ee("URLSearchParams"),[Pr,_r,Or,Ar]=["ReadableStream","Request","Response","Headers"].map(ee),Nr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ve(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,o;if(typeof t!="object"&&(t=[t]),ue(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{if(je(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let c;for(n=0;n<a;n++)c=i[n],e.call(null,t[c],c,t)}}function gt(t,e){if(je(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,o;for(;n-- >0;)if(o=r[n],e===o.toLowerCase())return o;return null}const ie=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,yt=t=>!pe(t)&&t!==ie;function Ke(){const{caseless:t,skipUndefined:e}=yt(this)&&this||{},r={},n=(o,i)=>{const a=t&&gt(r,i)||i;Fe(r[a])&&Fe(o)?r[a]=Ke(r[a],o):Fe(o)?r[a]=Ke({},o):ue(o)?r[a]=o.slice():(!e||!pe(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&ve(arguments[o],n);return r}const Ir=(t,e,r,{allOwnKeys:n}={})=>(ve(e,(o,i)=>{r&&Z(o)?t[i]=pt(o,r):t[i]=o},{allOwnKeys:n}),t),zr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Ur=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Fr=(t,e,r,n)=>{let o,i,a;const c={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)a=o[i],(!n||n(a,t,e))&&!c[a]&&(e[a]=t[a],c[a]=!0);t=r!==!1&&Je(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Mr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},Lr=t=>{if(!t)return null;if(ue(t))return t;let e=t.length;if(!ht(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Dr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Je(Uint8Array)),Br=(t,e)=>{const n=(t&&t[Ie]).call(t);let o;for(;(o=n.next())&&!o.done;){const i=o.value;e.call(t,i[0],i[1])}},$r=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Wr=ee("HTMLFormElement"),Hr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),mt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),qr=ee("RegExp"),bt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ve(r,(o,i)=>{let a;(a=e(o,i,t))!==!1&&(n[i]=a||o)}),Object.defineProperties(t,n)},Vr=t=>{bt(t,(e,r)=>{if(Z(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(Z(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Yr=(t,e)=>{const r={},n=o=>{o.forEach(i=>{r[i]=!0})};return ue(t)?n(t):n(String(t).split(e)),r},Jr=()=>{},Kr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Xr(t){return!!(t&&Z(t.append)&&t[ft]==="FormData"&&t[Ie])}const Gr=t=>{const e=new Array(10),r=(n,o)=>{if(Se(n)){if(e.indexOf(n)>=0)return;if(je(n))return n;if(!("toJSON"in n)){e[o]=n;const i=ue(n)?[]:{};return ve(n,(a,c)=>{const x=r(a,o+1);!pe(x)&&(i[c]=x)}),e[o]=void 0,i}}return n};return r(t,0)},Zr=ee("AsyncFunction"),Qr=t=>t&&(Se(t)||Z(t))&&Z(t.then)&&Z(t.catch),wt=((t,e)=>t?setImmediate:e?((r,n)=>(ie.addEventListener("message",({source:o,data:i})=>{o===ie&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),ie.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Z(ie.postMessage)),en=typeof queueMicrotask<"u"?queueMicrotask.bind(ie):typeof process<"u"&&process.nextTick||wt,d={isArray:ue,isArrayBuffer:xt,isBuffer:je,isFormData:Cr,isArrayBufferView:mr,isString:br,isNumber:ht,isBoolean:wr,isObject:Se,isPlainObject:Fe,isEmptyObject:jr,isReadableStream:Pr,isRequest:_r,isResponse:Or,isHeaders:Ar,isUndefined:pe,isDate:Sr,isFile:vr,isBlob:kr,isRegExp:qr,isFunction:Z,isStream:Tr,isURLSearchParams:Rr,isTypedArray:Dr,isFileList:Er,forEach:ve,merge:Ke,extend:Ir,trim:Nr,stripBOM:zr,inherits:Ur,toFlatObject:Fr,kindOf:ze,kindOfTest:ee,endsWith:Mr,toArray:Lr,forEachEntry:Br,matchAll:$r,isHTMLForm:Wr,hasOwnProperty:mt,hasOwnProp:mt,reduceDescriptors:bt,freezeMethods:Vr,toObjectSet:Yr,toCamelCase:Hr,noop:Jr,toFiniteNumber:Kr,findKey:gt,global:ie,isContextDefined:yt,isSpecCompliantForm:Xr,toJSONObject:Gr,isAsyncFn:Zr,isThenable:Qr,setImmediate:wt,asap:en,isIterable:t=>t!=null&&Z(t[Ie])};function P(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}d.inherits(P,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 jt=P.prototype,St={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{St[t]={value:t}}),Object.defineProperties(P,St),Object.defineProperty(jt,"isAxiosError",{value:!0}),P.from=(t,e,r,n,o,i)=>{const a=Object.create(jt);d.toFlatObject(t,a,function(u){return u!==Error.prototype},p=>p!=="isAxiosError");const c=t&&t.message?t.message:"Error",x=e==null&&t?t.code:e;return P.call(a,c,x,r,n,o),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const tn=null;function Xe(t){return d.isPlainObject(t)||d.isArray(t)}function vt(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function kt(t,e,r){return t?t.concat(e).map(function(o,i){return o=vt(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function rn(t){return d.isArray(t)&&!t.some(Xe)}const nn=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Me(t,e,r){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=d.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!d.isUndefined(g[m])});const n=r.metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,x=(r.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(o))throw new TypeError("visitor must be a function");function p(l){if(l===null)return"";if(d.isDate(l))return l.toISOString();if(d.isBoolean(l))return l.toString();if(!x&&d.isBlob(l))throw new P("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(l)||d.isTypedArray(l)?x&&typeof Blob=="function"?new Blob([l]):Buffer.from(l):l}function u(l,m,g){let _=l;if(l&&!g&&typeof l=="object"){if(d.endsWith(m,"{}"))m=n?m:m.slice(0,-2),l=JSON.stringify(l);else if(d.isArray(l)&&rn(l)||(d.isFileList(l)||d.endsWith(m,"[]"))&&(_=d.toArray(l)))return m=vt(m),_.forEach(function(R,E){!(d.isUndefined(R)||R===null)&&e.append(a===!0?kt([m],E,i):a===null?m:m+"[]",p(R))}),!1}return Xe(l)?!0:(e.append(kt(g,m,i),p(l)),!1)}const y=[],S=Object.assign(nn,{defaultVisitor:u,convertValue:p,isVisitable:Xe});function b(l,m){if(!d.isUndefined(l)){if(y.indexOf(l)!==-1)throw Error("Circular reference detected in "+m.join("."));y.push(l),d.forEach(l,function(_,$){(!(d.isUndefined(_)||_===null)&&o.call(e,_,d.isString($)?$.trim():$,m,S))===!0&&b(_,m?m.concat($):[$])}),y.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return b(t),e}function Et(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Ge(t,e){this._pairs=[],t&&Me(t,this,e)}const Tt=Ge.prototype;Tt.append=function(e,r){this._pairs.push([e,r])},Tt.toString=function(e){const r=e?function(n){return e.call(this,n,Et)}:Et;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function sn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ct(t,e,r){if(!e)return t;const n=r&&r.encode||sn;d.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(e,r):i=d.isURLSearchParams(e)?e.toString():new Ge(e,r).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Rt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Pt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},on={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ge,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ze=typeof window<"u"&&typeof document<"u",Qe=typeof navigator=="object"&&navigator||void 0,an=Ze&&(!Qe||["ReactNative","NativeScript","NS"].indexOf(Qe.product)<0),ln=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cn=Ze&&window.location.href||"http://localhost",X={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ze,hasStandardBrowserEnv:an,hasStandardBrowserWebWorkerEnv:ln,navigator:Qe,origin:cn},Symbol.toStringTag,{value:"Module"})),...on};function dn(t,e){return Me(t,new X.classes.URLSearchParams,{visitor:function(r,n,o,i){return X.isNode&&d.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function un(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function pn(t){const e={},r=Object.keys(t);let n;const o=r.length;let i;for(n=0;n<o;n++)i=r[n],e[i]=t[i];return e}function _t(t){function e(r,n,o,i){let a=r[i++];if(a==="__proto__")return!0;const c=Number.isFinite(+a),x=i>=r.length;return a=!a&&d.isArray(o)?o.length:a,x?(d.hasOwnProp(o,a)?o[a]=[o[a],n]:o[a]=n,!c):((!o[a]||!d.isObject(o[a]))&&(o[a]=[]),e(r,n,o[a],i)&&d.isArray(o[a])&&(o[a]=pn(o[a])),!c)}if(d.isFormData(t)&&d.isFunction(t.entries)){const r={};return d.forEachEntry(t,(n,o)=>{e(un(n),o,r,0)}),r}return null}function fn(t,e,r){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const ke={transitional:Pt,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=d.isObject(e);if(i&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return o?JSON.stringify(_t(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return dn(e,this.formSerializer).toString();if((c=d.isFileList(e))||n.indexOf("multipart/form-data")>-1){const x=this.env&&this.env.FormData;return Me(c?{"files[]":e}:e,x&&new x,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),fn(e)):e}],transformResponse:[function(e){const r=this.transitional||ke.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(n&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(c){if(a)throw c.name==="SyntaxError"?P.from(c,P.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:X.classes.FormData,Blob:X.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{ke.headers[t]={}});const xn=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"]),hn=t=>{const e={};let r,n,o;return t&&t.split(`
2
- `).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),n=a.substring(o+1).trim(),!(!r||e[r]&&xn[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},Ot=Symbol("internals");function Ee(t){return t&&String(t).trim().toLowerCase()}function Le(t){return t===!1||t==null?t:d.isArray(t)?t.map(Le):String(t)}function gn(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const yn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function et(t,e,r,n,o){if(d.isFunction(n))return n.call(this,e,r);if(o&&(e=r),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function mn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function bn(t,e){const r=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(o,i,a){return this[n].call(this,e,o,i,a)},configurable:!0})})}let Q=class{constructor(e){e&&this.set(e)}set(e,r,n){const o=this;function i(c,x,p){const u=Ee(x);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||x]=Le(c))}const a=(c,x)=>d.forEach(c,(p,u)=>i(p,u,x));if(d.isPlainObject(e)||e instanceof this.constructor)a(e,r);else if(d.isString(e)&&(e=e.trim())&&!yn(e))a(hn(e),r);else if(d.isObject(e)&&d.isIterable(e)){let c={},x,p;for(const u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[p=u[0]]=(x=c[p])?d.isArray(x)?[...x,u[1]]:[x,u[1]]:u[1]}a(c,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=Ee(e),e){const n=d.findKey(this,e);if(n){const o=this[n];if(!r)return o;if(r===!0)return gn(o);if(d.isFunction(r))return r.call(this,o,n);if(d.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Ee(e),e){const n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||et(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let o=!1;function i(a){if(a=Ee(a),a){const c=d.findKey(n,a);c&&(!r||et(n,n[c],c,r))&&(delete n[c],o=!0)}}return d.isArray(e)?e.forEach(i):i(e),o}clear(e){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const i=r[n];(!e||et(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){const r=this,n={};return d.forEach(this,(o,i)=>{const a=d.findKey(n,i);if(a){r[a]=Le(o),delete r[i];return}const c=e?mn(i):String(i).trim();c!==i&&delete r[i],r[c]=Le(o),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return d.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=e&&d.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){const n=(this[Ot]=this[Ot]={accessors:{}}).accessors,o=this.prototype;function i(a){const c=Ee(a);n[c]||(bn(o,a),n[c]=!0)}return d.isArray(e)?e.forEach(i):i(e),this}};Q.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),d.reduceDescriptors(Q.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),d.freezeMethods(Q);function tt(t,e){const r=this||ke,n=e||r,o=Q.from(n.headers);let i=n.data;return d.forEach(t,function(c){i=c.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function At(t){return!!(t&&t.__CANCEL__)}function fe(t,e,r){P.call(this,t??"canceled",P.ERR_CANCELED,e,r),this.name="CanceledError"}d.inherits(fe,P,{__CANCEL__:!0});function Nt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new P("Request failed with status code "+r.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function wn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function jn(t,e){t=t||10;const r=new Array(t),n=new Array(t);let o=0,i=0,a;return e=e!==void 0?e:1e3,function(x){const p=Date.now(),u=n[i];a||(a=p),r[o]=x,n[o]=p;let y=i,S=0;for(;y!==o;)S+=r[y++],y=y%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),p-a<e)return;const b=u&&p-u;return b?Math.round(S*1e3/b):void 0}}function Sn(t,e){let r=0,n=1e3/e,o,i;const a=(p,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),t(...p)};return[(...p)=>{const u=Date.now(),y=u-r;y>=n?a(p,u):(o=p,i||(i=setTimeout(()=>{i=null,a(o)},n-y)))},()=>o&&a(o)]}const De=(t,e,r=3)=>{let n=0;const o=jn(50,250);return Sn(i=>{const a=i.loaded,c=i.lengthComputable?i.total:void 0,x=a-n,p=o(x),u=a<=c;n=a;const y={loaded:a,total:c,progress:c?a/c:void 0,bytes:x,rate:p||void 0,estimated:p&&c&&u?(c-a)/p:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(y)},r)},It=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},zt=t=>(...e)=>d.asap(()=>t(...e)),vn=X.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,X.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(X.origin),X.navigator&&/(msie|trident)/i.test(X.navigator.userAgent)):()=>!0,kn=X.hasStandardBrowserEnv?{write(t,e,r,n,o,i){const a=[t+"="+encodeURIComponent(e)];d.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),d.isString(n)&&a.push("path="+n),d.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function En(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Tn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ut(t,e,r){let n=!En(e);return t&&(n||r==!1)?Tn(t,e):e}const Ft=t=>t instanceof Q?{...t}:t;function le(t,e){e=e||{};const r={};function n(p,u,y,S){return d.isPlainObject(p)&&d.isPlainObject(u)?d.merge.call({caseless:S},p,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function o(p,u,y,S){if(d.isUndefined(u)){if(!d.isUndefined(p))return n(void 0,p,y,S)}else return n(p,u,y,S)}function i(p,u){if(!d.isUndefined(u))return n(void 0,u)}function a(p,u){if(d.isUndefined(u)){if(!d.isUndefined(p))return n(void 0,p)}else return n(void 0,u)}function c(p,u,y){if(y in e)return n(p,u);if(y in t)return n(void 0,p)}const x={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:c,headers:(p,u,y)=>o(Ft(p),Ft(u),y,!0)};return d.forEach(Object.keys({...t,...e}),function(u){const y=x[u]||o,S=y(t[u],e[u],u);d.isUndefined(S)&&y!==c||(r[u]=S)}),r}const Mt=t=>{const e=le({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:c}=e;if(e.headers=a=Q.from(a),e.url=Ct(Ut(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),d.isFormData(r)){if(X.hasStandardBrowserEnv||X.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(d.isFunction(r.getHeaders)){const x=r.getHeaders(),p=["content-type","content-length"];Object.entries(x).forEach(([u,y])=>{p.includes(u.toLowerCase())&&a.set(u,y)})}}if(X.hasStandardBrowserEnv&&(n&&d.isFunction(n)&&(n=n(e)),n||n!==!1&&vn(e.url))){const x=o&&i&&kn.read(i);x&&a.set(o,x)}return e},Cn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const o=Mt(t);let i=o.data;const a=Q.from(o.headers).normalize();let{responseType:c,onUploadProgress:x,onDownloadProgress:p}=o,u,y,S,b,l;function m(){b&&b(),l&&l(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout;function _(){if(!g)return;const R=Q.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),z={data:!c||c==="text"||c==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:R,config:t,request:g};Nt(function(I){r(I),m()},function(I){n(I),m()},z),g=null}"onloadend"in g?g.onloadend=_:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(_)},g.onabort=function(){g&&(n(new P("Request aborted",P.ECONNABORTED,t,g)),g=null)},g.onerror=function(E){const z=E&&E.message?E.message:"Network Error",h=new P(z,P.ERR_NETWORK,t,g);h.event=E||null,n(h),g=null},g.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const z=o.transitional||Pt;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),n(new P(E,z.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,t,g)),g=null},i===void 0&&a.setContentType(null),"setRequestHeader"in g&&d.forEach(a.toJSON(),function(E,z){g.setRequestHeader(z,E)}),d.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),c&&c!=="json"&&(g.responseType=o.responseType),p&&([S,l]=De(p,!0),g.addEventListener("progress",S)),x&&g.upload&&([y,b]=De(x),g.upload.addEventListener("progress",y),g.upload.addEventListener("loadend",b)),(o.cancelToken||o.signal)&&(u=R=>{g&&(n(!R||R.type?new fe(null,t,g):R),g.abort(),g=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const $=wn(o.url);if($&&X.protocols.indexOf($)===-1){n(new P("Unsupported protocol "+$+":",P.ERR_BAD_REQUEST,t));return}g.send(i||null)})},Rn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o;const i=function(p){if(!o){o=!0,c();const u=p instanceof Error?p:this.reason;n.abort(u instanceof P?u:new fe(u instanceof Error?u.message:u))}};let a=e&&setTimeout(()=>{a=null,i(new P(`timeout ${e} of ms exceeded`,P.ETIMEDOUT))},e);const c=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),t=null)};t.forEach(p=>p.addEventListener("abort",i));const{signal:x}=n;return x.unsubscribe=()=>d.asap(c),x}},Pn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},_n=async function*(t,e){for await(const r of On(t))yield*Pn(r,e)},On=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Lt=(t,e,r,n)=>{const o=_n(t,e);let i=0,a,c=x=>{a||(a=!0,n&&n(x))};return new ReadableStream({async pull(x){try{const{done:p,value:u}=await o.next();if(p){c(),x.close();return}let y=u.byteLength;if(r){let S=i+=y;r(S)}x.enqueue(new Uint8Array(u))}catch(p){throw c(p),p}},cancel(x){return c(x),o.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:Be}=d,An=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Bt,TextEncoder:$t}=d.global,Wt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Nn=t=>{t=d.merge.call({skipUndefined:!0},An,t);const{fetch:e,Request:r,Response:n}=t,o=e?Be(e):typeof fetch=="function",i=Be(r),a=Be(n);if(!o)return!1;const c=o&&Be(Bt),x=o&&(typeof $t=="function"?(l=>m=>l.encode(m))(new $t):async l=>new Uint8Array(await new r(l).arrayBuffer())),p=i&&c&&Wt(()=>{let l=!1;const m=new r(X.origin,{body:new Bt,method:"POST",get duplex(){return l=!0,"half"}}).headers.has("Content-Type");return l&&!m}),u=a&&c&&Wt(()=>d.isReadableStream(new n("").body)),y={stream:u&&(l=>l.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(l=>{!y[l]&&(y[l]=(m,g)=>{let _=m&&m[l];if(_)return _.call(m);throw new P(`Response type '${l}' is not supported`,P.ERR_NOT_SUPPORT,g)})});const S=async l=>{if(l==null)return 0;if(d.isBlob(l))return l.size;if(d.isSpecCompliantForm(l))return(await new r(X.origin,{method:"POST",body:l}).arrayBuffer()).byteLength;if(d.isArrayBufferView(l)||d.isArrayBuffer(l))return l.byteLength;if(d.isURLSearchParams(l)&&(l=l+""),d.isString(l))return(await x(l)).byteLength},b=async(l,m)=>{const g=d.toFiniteNumber(l.getContentLength());return g??S(m)};return async l=>{let{url:m,method:g,data:_,signal:$,cancelToken:R,timeout:E,onDownloadProgress:z,onUploadProgress:h,responseType:I,headers:w,withCredentials:L="same-origin",fetchOptions:q}=Mt(l),j=e||fetch;I=I?(I+"").toLowerCase():"text";let H=Rn([$,R&&R.toAbortSignal()],E),T=null;const v=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let U;try{if(h&&p&&g!=="get"&&g!=="head"&&(U=await b(w,_))!==0){let C=new r(m,{method:"POST",body:_,duplex:"half"}),O;if(d.isFormData(_)&&(O=C.headers.get("content-type"))&&w.setContentType(O),C.body){const[A,M]=It(U,De(zt(h)));_=Lt(C.body,Dt,A,M)}}d.isString(L)||(L=L?"include":"omit");const F=i&&"credentials"in r.prototype,J={...q,signal:H,method:g.toUpperCase(),headers:w.normalize().toJSON(),body:_,duplex:"half",credentials:F?L:void 0};T=i&&new r(m,J);let W=await(i?j(T,q):j(m,J));const V=u&&(I==="stream"||I==="response");if(u&&(z||V&&v)){const C={};["status","statusText","headers"].forEach(K=>{C[K]=W[K]});const O=d.toFiniteNumber(W.headers.get("content-length")),[A,M]=z&&It(O,De(zt(z),!0))||[];W=new n(Lt(W.body,Dt,A,()=>{M&&M(),v&&v()}),C)}I=I||"text";let f=await y[d.findKey(y,I)||"text"](W,l);return!V&&v&&v(),await new Promise((C,O)=>{Nt(C,O,{data:f,headers:Q.from(W.headers),status:W.status,statusText:W.statusText,config:l,request:T})})}catch(F){throw v&&v(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,l,T),{cause:F.cause||F}):P.from(F,F&&F.code,l,T)}}},In=new Map,Ht=t=>{let e=t?t.env:{};const{fetch:r,Request:n,Response:o}=e,i=[n,o,r];let a=i.length,c=a,x,p,u=In;for(;c--;)x=i[c],p=u.get(x),p===void 0&&u.set(x,p=c?new Map:Nn(e)),u=p;return p};Ht();const rt={http:tn,xhr:Cn,fetch:{get:Ht}};d.forEach(rt,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const qt=t=>`- ${t}`,zn=t=>d.isFunction(t)||t===null||t===!1,Vt={getAdapter:(t,e)=>{t=d.isArray(t)?t:[t];const{length:r}=t;let n,o;const i={};for(let a=0;a<r;a++){n=t[a];let c;if(o=n,!zn(n)&&(o=rt[(c=String(n)).toLowerCase()],o===void 0))throw new P(`Unknown adapter '${c}'`);if(o&&(d.isFunction(o)||(o=o.get(e))))break;i[c||"#"+a]=o}if(!o){const a=Object.entries(i).map(([x,p])=>`adapter ${x} `+(p===!1?"is not supported by the environment":"is not available in the build"));let c=r?a.length>1?`since :
4
- `+a.map(qt).join(`
5
- `):" "+qt(a[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return o},adapters:rt};function nt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function Yt(t){return nt(t),t.headers=Q.from(t.headers),t.data=tt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Vt.getAdapter(t.adapter||ke.adapter,t)(t).then(function(n){return nt(t),n.data=tt.call(t,t.transformResponse,n),n.headers=Q.from(n.headers),n},function(n){return At(n)||(nt(t),n&&n.response&&(n.response.data=tt.call(t,t.transformResponse,n.response),n.response.headers=Q.from(n.response.headers))),Promise.reject(n)})}const Jt="1.12.2",$e={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{$e[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Kt={};$e.transitional=function(e,r,n){function o(i,a){return"[Axios v"+Jt+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,c)=>{if(e===!1)throw new P(o(a," has been removed"+(r?" in "+r:"")),P.ERR_DEPRECATED);return r&&!Kt[a]&&(Kt[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,a,c):!0}},$e.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Un(t,e,r){if(typeof t!="object")throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let o=n.length;for(;o-- >0;){const i=n[o],a=e[i];if(a){const c=t[i],x=c===void 0||a(c,i,t);if(x!==!0)throw new P("option "+i+" must be "+x,P.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new P("Unknown option "+i,P.ERR_BAD_OPTION)}}const We={assertOptions:Un,validators:$e},te=We.validators;let ce=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Rt,response:new Rt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
6
- `+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=le(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&We.assertOptions(n,{silentJSONParsing:te.transitional(te.boolean),forcedJSONParsing:te.transitional(te.boolean),clarifyTimeoutError:te.transitional(te.boolean)},!1),o!=null&&(d.isFunction(o)?r.paramsSerializer={serialize:o}:We.assertOptions(o,{encode:te.function,serialize:te.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),We.assertOptions(r,{baseUrl:te.spelling("baseURL"),withXsrfToken:te.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"],l=>{delete i[l]}),r.headers=Q.concat(a,i);const c=[];let x=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(x=x&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const p=[];this.interceptors.response.forEach(function(m){p.push(m.fulfilled,m.rejected)});let u,y=0,S;if(!x){const l=[Yt.bind(this),void 0];for(l.unshift(...c),l.push(...p),S=l.length,u=Promise.resolve(r);y<S;)u=u.then(l[y++],l[y++]);return u}S=c.length;let b=r;for(;y<S;){const l=c[y++],m=c[y++];try{b=l(b)}catch(g){m.call(this,g);break}}try{u=Yt.call(this,b)}catch(l){return Promise.reject(l)}for(y=0,S=p.length;y<S;)u=u.then(p[y++],p[y++]);return u}getUri(e){e=le(this.defaults,e);const r=Ut(e.baseURL,e.url,e.allowAbsoluteUrls);return Ct(r,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){ce.prototype[e]=function(r,n){return this.request(le(n||{},{method:e,url:r,data:(n||{}).data}))}}),d.forEach(["post","put","patch"],function(e){function r(n){return function(i,a,c){return this.request(le(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}ce.prototype[e]=r(),ce.prototype[e+"Form"]=r(!0)});let Fn=class gr{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(c=>{n.subscribe(c),i=c}).then(o);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,c){n.reason||(n.reason=new fe(i,a,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new gr(function(o){e=o}),cancel:e}}};function Mn(t){return function(r){return t.apply(null,r)}}function Ln(t){return d.isObject(t)&&t.isAxiosError===!0}const st={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(st).forEach(([t,e])=>{st[e]=t});function Xt(t){const e=new ce(t),r=pt(ce.prototype.request,e);return d.extend(r,ce.prototype,e,{allOwnKeys:!0}),d.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return Xt(le(t,o))},r}const D=Xt(ke);D.Axios=ce,D.CanceledError=fe,D.CancelToken=Fn,D.isCancel=At,D.VERSION=Jt,D.toFormData=Me,D.AxiosError=P,D.Cancel=D.CanceledError,D.all=function(e){return Promise.all(e)},D.spread=Mn,D.isAxiosError=Ln,D.mergeConfig=le,D.AxiosHeaders=Q,D.formToJSON=t=>_t(d.isHTMLForm(t)?new FormData(t):t),D.getAdapter=Vt.getAdapter,D.HttpStatusCode=st,D.default=D;const{Axios:Ms,AxiosError:Ls,CanceledError:Ds,isCancel:Bs,CancelToken:$s,VERSION:Ws,all:Hs,Cancel:qs,isAxiosError:Vs,spread:Ys,toFormData:Js,AxiosHeaders:Ks,HttpStatusCode:Xs,formToJSON:Gs,getAdapter:Zs,mergeConfig:Qs}=D;class Dn{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=D.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(e,r,n,o={}){if(!e)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...n||{}};return(await this.client.request({url:r,method:e,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,c=i.response.data?.message||i.response.statusText;throw new Error(`API Error (${a}): ${c}`)}throw new Error(i.message||"Unknown error occurred during API request")}}async signup(e){const{name:r,email:n,password:o}=e;if(!r||!n||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:n,appId:o}=e;if(!r||!n)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:n,appId:o||this.appId})}async updateUser(e){const{userId:r,appId:n}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:n||this.appId})}async changePassword(e){const{userId:r,currentPassword:n,newPassword:o,appId:i}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!n||!o)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:n,newPassword:o,appId:i||this.appId})}async deleteUser(e){const{userId:r,appId:n}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:n||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:n}=e;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:n||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(e){const{token:r,otp:n,appId:o}=e;if(!r)throw new Error("verifyEmail: 'token' is required");if(!n)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:n,appId:o||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(e){const{email:r,appId:n}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:n||this.appId})}async resetPassword(e){const{email:r,otp:n,newPassword:o,appId:i}=e;if(!r||!n||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:n,newPassword:o,appId:i||this.appId})}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${n}`)}async addUserData(e){const{userId:r,data:n}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!n)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,n)}async updateUserData(e){const{userId:r,dataId:n,data:o}=e;if(!r||!n)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/${n}`,o)}async deleteUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${n}`)}}var He={exports:{}},Te={};/**
1
+ (function(Z,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],j):(Z=typeof globalThis<"u"?globalThis:Z||self,j(Z.NeuctraAuthix={},Z.React))})(this,(function(Z,j){"use strict";function tt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Xt}=Object.prototype,{getPrototypeOf:Le}=Object,{iterator:ke,toStringTag:rt}=Symbol,Ee=(t=>e=>{const r=Xt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Q=t=>(t=t.toLowerCase(),e=>Ee(e)===t),Te=t=>e=>typeof e===t,{isArray:le}=Array,ce=Te("undefined");function xe(t){return t!==null&&!ce(t)&&t.constructor!==null&&!ce(t.constructor)&&X(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const nt=Q("ArrayBuffer");function Gt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&nt(t.buffer),e}const Zt=Te("string"),X=Te("function"),st=Te("number"),he=t=>t!==null&&typeof t=="object",Qt=t=>t===!0||t===!1,Re=t=>{if(Ee(t)!=="object")return!1;const e=Le(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(rt in t)&&!(ke in t)},er=t=>{if(!he(t)||xe(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},tr=Q("Date"),rr=Q("File"),nr=Q("Blob"),sr=Q("FileList"),or=t=>he(t)&&X(t.pipe),ar=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||X(t.append)&&((e=Ee(t))==="formdata"||e==="object"&&X(t.toString)&&t.toString()==="[object FormData]"))},ir=Q("URLSearchParams"),[lr,cr,dr,ur]=["ReadableStream","Request","Response","Headers"].map(Q),pr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function me(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,o;if(typeof t!="object"&&(t=[t]),le(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{if(xe(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let l;for(n=0;n<a;n++)l=i[n],e.call(null,t[l],l,t)}}function ot(t,e){if(xe(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,o;for(;n-- >0;)if(o=r[n],e===o.toLowerCase())return o;return null}const ne=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,at=t=>!ce(t)&&t!==ne;function Me(){const{caseless:t,skipUndefined:e}=at(this)&&this||{},r={},n=(o,i)=>{const a=t&&ot(r,i)||i;Re(r[a])&&Re(o)?r[a]=Me(r[a],o):Re(o)?r[a]=Me({},o):le(o)?r[a]=o.slice():(!e||!ce(o))&&(r[a]=o)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&me(arguments[o],n);return r}const fr=(t,e,r,{allOwnKeys:n}={})=>(me(e,(o,i)=>{r&&X(o)?t[i]=tt(o,r):t[i]=o},{allOwnKeys:n}),t),xr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),hr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},mr=(t,e,r,n)=>{let o,i,a;const l={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)a=o[i],(!n||n(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=r!==!1&&Le(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},gr=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},yr=t=>{if(!t)return null;if(le(t))return t;let e=t.length;if(!st(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},br=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Le(Uint8Array)),wr=(t,e)=>{const n=(t&&t[ke]).call(t);let o;for(;(o=n.next())&&!o.done;){const i=o.value;e.call(t,i[0],i[1])}},vr=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Sr=Q("HTMLFormElement"),jr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),it=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),kr=Q("RegExp"),lt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};me(r,(o,i)=>{let a;(a=e(o,i,t))!==!1&&(n[i]=a||o)}),Object.defineProperties(t,n)},Er=t=>{lt(t,(e,r)=>{if(X(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(X(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Tr=(t,e)=>{const r={},n=o=>{o.forEach(i=>{r[i]=!0})};return le(t)?n(t):n(String(t).split(e)),r},Rr=()=>{},Cr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Pr(t){return!!(t&&X(t.append)&&t[rt]==="FormData"&&t[ke])}const Or=t=>{const e=new Array(10),r=(n,o)=>{if(he(n)){if(e.indexOf(n)>=0)return;if(xe(n))return n;if(!("toJSON"in n)){e[o]=n;const i=le(n)?[]:{};return me(n,(a,l)=>{const h=r(a,o+1);!ce(h)&&(i[l]=h)}),e[o]=void 0,i}}return n};return r(t,0)},Ir=Q("AsyncFunction"),_r=t=>t&&(he(t)||X(t))&&X(t.then)&&X(t.catch),ct=((t,e)=>t?setImmediate:e?((r,n)=>(ne.addEventListener("message",({source:o,data:i})=>{o===ne&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),ne.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",X(ne.postMessage)),Ar=typeof queueMicrotask<"u"?queueMicrotask.bind(ne):typeof process<"u"&&process.nextTick||ct,d={isArray:le,isArrayBuffer:nt,isBuffer:xe,isFormData:ar,isArrayBufferView:Gt,isString:Zt,isNumber:st,isBoolean:Qt,isObject:he,isPlainObject:Re,isEmptyObject:er,isReadableStream:lr,isRequest:cr,isResponse:dr,isHeaders:ur,isUndefined:ce,isDate:tr,isFile:rr,isBlob:nr,isRegExp:kr,isFunction:X,isStream:or,isURLSearchParams:ir,isTypedArray:br,isFileList:sr,forEach:me,merge:Me,extend:fr,trim:pr,stripBOM:xr,inherits:hr,toFlatObject:mr,kindOf:Ee,kindOfTest:Q,endsWith:gr,toArray:yr,forEachEntry:wr,matchAll:vr,isHTMLForm:Sr,hasOwnProperty:it,hasOwnProp:it,reduceDescriptors:lt,freezeMethods:Er,toObjectSet:Tr,toCamelCase:jr,noop:Rr,toFiniteNumber:Cr,findKey:ot,global:ne,isContextDefined:at,isSpecCompliantForm:Pr,toJSONObject:Or,isAsyncFn:Ir,isThenable:_r,setImmediate:ct,asap:Ar,isIterable:t=>t!=null&&X(t[ke])};function z(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}d.inherits(z,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 dt=z.prototype,ut={};["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(t=>{ut[t]={value:t}}),Object.defineProperties(z,ut),Object.defineProperty(dt,"isAxiosError",{value:!0}),z.from=(t,e,r,n,o,i)=>{const a=Object.create(dt);d.toFlatObject(t,a,function(u){return u!==Error.prototype},p=>p!=="isAxiosError");const l=t&&t.message?t.message:"Error",h=e==null&&t?t.code:e;return z.call(a,l,h,r,n,o),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const Nr=null;function Be(t){return d.isPlainObject(t)||d.isArray(t)}function pt(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function ft(t,e,r){return t?t.concat(e).map(function(o,i){return o=pt(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function zr(t){return d.isArray(t)&&!t.some(Be)}const Ur=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Ce(t,e,r){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=d.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!d.isUndefined(y[g])});const n=r.metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,h=(r.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);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(!h&&d.isBlob(c))throw new z("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(c)||d.isTypedArray(c)?h&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,g,y){let O=c;if(c&&!y&&typeof c=="object"){if(d.endsWith(g,"{}"))g=n?g:g.slice(0,-2),c=JSON.stringify(c);else if(d.isArray(c)&&zr(c)||(d.isFileList(c)||d.endsWith(g,"[]"))&&(O=d.toArray(c)))return g=pt(g),O.forEach(function(v,F){!(d.isUndefined(v)||v===null)&&e.append(a===!0?ft([g],F,i):a===null?g:g+"[]",p(v))}),!1}return Be(c)?!0:(e.append(ft(y,g,i),p(c)),!1)}const b=[],C=Object.assign(Ur,{defaultVisitor:u,convertValue:p,isVisitable:Be});function k(c,g){if(!d.isUndefined(c)){if(b.indexOf(c)!==-1)throw Error("Circular reference detected in "+g.join("."));b.push(c),d.forEach(c,function(O,W){(!(d.isUndefined(O)||O===null)&&o.call(e,O,d.isString(W)?W.trim():W,g,C))===!0&&k(O,g?g.concat(W):[W])}),b.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return k(t),e}function xt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function $e(t,e){this._pairs=[],t&&Ce(t,this,e)}const ht=$e.prototype;ht.append=function(e,r){this._pairs.push([e,r])},ht.toString=function(e){const r=e?function(n){return e.call(this,n,xt)}:xt;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Fr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mt(t,e,r){if(!e)return t;const n=r&&r.encode||Fr;d.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let i;if(o?i=o(e,r):i=d.isURLSearchParams(e)?e.toString():new $e(e,r).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class gt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(n){n!==null&&e(n)})}}const yt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:$e,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},We=typeof window<"u"&&typeof document<"u",He=typeof navigator=="object"&&navigator||void 0,Lr=We&&(!He||["ReactNative","NativeScript","NS"].indexOf(He.product)<0),Mr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Br=We&&window.location.href||"http://localhost",K={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:We,hasStandardBrowserEnv:Lr,hasStandardBrowserWebWorkerEnv:Mr,navigator:He,origin:Br},Symbol.toStringTag,{value:"Module"})),...Dr};function $r(t,e){return Ce(t,new K.classes.URLSearchParams,{visitor:function(r,n,o,i){return K.isNode&&d.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Wr(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Hr(t){const e={},r=Object.keys(t);let n;const o=r.length;let i;for(n=0;n<o;n++)i=r[n],e[i]=t[i];return e}function bt(t){function e(r,n,o,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),h=i>=r.length;return a=!a&&d.isArray(o)?o.length:a,h?(d.hasOwnProp(o,a)?o[a]=[o[a],n]:o[a]=n,!l):((!o[a]||!d.isObject(o[a]))&&(o[a]=[]),e(r,n,o[a],i)&&d.isArray(o[a])&&(o[a]=Hr(o[a])),!l)}if(d.isFormData(t)&&d.isFunction(t.entries)){const r={};return d.forEachEntry(t,(n,o)=>{e(Wr(n),o,r,0)}),r}return null}function qr(t,e,r){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const ge={transitional:yt,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=d.isObject(e);if(i&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return o?JSON.stringify(bt(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return $r(e,this.formSerializer).toString();if((l=d.isFileList(e))||n.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Ce(l?{"files[]":e}:e,h&&new h,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),qr(e)):e}],transformResponse:[function(e){const r=this.transitional||ge.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(n&&!this.responseType||o)){const a=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?z.from(l,z.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:K.classes.FormData,Blob:K.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{ge.headers[t]={}});const Yr=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"]),Vr=t=>{const e={};let r,n,o;return t&&t.split(`
2
+ `).forEach(function(a){o=a.indexOf(":"),r=a.substring(0,o).trim().toLowerCase(),n=a.substring(o+1).trim(),!(!r||e[r]&&Yr[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},wt=Symbol("internals");function ye(t){return t&&String(t).trim().toLowerCase()}function Pe(t){return t===!1||t==null?t:d.isArray(t)?t.map(Pe):String(t)}function Jr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Kr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function qe(t,e,r,n,o){if(d.isFunction(n))return n.call(this,e,r);if(o&&(e=r),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function Xr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Gr(t,e){const r=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(o,i,a){return this[n].call(this,e,o,i,a)},configurable:!0})})}let G=class{constructor(e){e&&this.set(e)}set(e,r,n){const o=this;function i(l,h,p){const u=ye(h);if(!u)throw new Error("header name must be a non-empty string");const b=d.findKey(o,u);(!b||o[b]===void 0||p===!0||p===void 0&&o[b]!==!1)&&(o[b||h]=Pe(l))}const a=(l,h)=>d.forEach(l,(p,u)=>i(p,u,h));if(d.isPlainObject(e)||e instanceof this.constructor)a(e,r);else if(d.isString(e)&&(e=e.trim())&&!Kr(e))a(Vr(e),r);else if(d.isObject(e)&&d.isIterable(e)){let l={},h,p;for(const u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[p=u[0]]=(h=l[p])?d.isArray(h)?[...h,u[1]]:[h,u[1]]:u[1]}a(l,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=ye(e),e){const n=d.findKey(this,e);if(n){const o=this[n];if(!r)return o;if(r===!0)return Jr(o);if(d.isFunction(r))return r.call(this,o,n);if(d.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ye(e),e){const n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||qe(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let o=!1;function i(a){if(a=ye(a),a){const l=d.findKey(n,a);l&&(!r||qe(n,n[l],l,r))&&(delete n[l],o=!0)}}return d.isArray(e)?e.forEach(i):i(e),o}clear(e){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const i=r[n];(!e||qe(this,this[i],i,e,!0))&&(delete this[i],o=!0)}return o}normalize(e){const r=this,n={};return d.forEach(this,(o,i)=>{const a=d.findKey(n,i);if(a){r[a]=Pe(o),delete r[i];return}const l=e?Xr(i):String(i).trim();l!==i&&delete r[i],r[l]=Pe(o),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return d.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=e&&d.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){const n=(this[wt]=this[wt]={accessors:{}}).accessors,o=this.prototype;function i(a){const l=ye(a);n[l]||(Gr(o,a),n[l]=!0)}return d.isArray(e)?e.forEach(i):i(e),this}};G.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),d.reduceDescriptors(G.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),d.freezeMethods(G);function Ye(t,e){const r=this||ge,n=e||r,o=G.from(n.headers);let i=n.data;return d.forEach(t,function(l){i=l.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function vt(t){return!!(t&&t.__CANCEL__)}function de(t,e,r){z.call(this,t??"canceled",z.ERR_CANCELED,e,r),this.name="CanceledError"}d.inherits(de,z,{__CANCEL__:!0});function St(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new z("Request failed with status code "+r.status,[z.ERR_BAD_REQUEST,z.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Zr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Qr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let o=0,i=0,a;return e=e!==void 0?e:1e3,function(h){const p=Date.now(),u=n[i];a||(a=p),r[o]=h,n[o]=p;let b=i,C=0;for(;b!==o;)C+=r[b++],b=b%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),p-a<e)return;const k=u&&p-u;return k?Math.round(C*1e3/k):void 0}}function en(t,e){let r=0,n=1e3/e,o,i;const a=(p,u=Date.now())=>{r=u,o=null,i&&(clearTimeout(i),i=null),t(...p)};return[(...p)=>{const u=Date.now(),b=u-r;b>=n?a(p,u):(o=p,i||(i=setTimeout(()=>{i=null,a(o)},n-b)))},()=>o&&a(o)]}const Oe=(t,e,r=3)=>{let n=0;const o=Qr(50,250);return en(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,h=a-n,p=o(h),u=a<=l;n=a;const b={loaded:a,total:l,progress:l?a/l:void 0,bytes:h,rate:p||void 0,estimated:p&&l&&u?(l-a)/p:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(b)},r)},jt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},kt=t=>(...e)=>d.asap(()=>t(...e)),tn=K.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,K.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(K.origin),K.navigator&&/(msie|trident)/i.test(K.navigator.userAgent)):()=>!0,rn=K.hasStandardBrowserEnv?{write(t,e,r,n,o,i){const a=[t+"="+encodeURIComponent(e)];d.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),d.isString(n)&&a.push("path="+n),d.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function nn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function sn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Et(t,e,r){let n=!nn(e);return t&&(n||r==!1)?sn(t,e):e}const Tt=t=>t instanceof G?{...t}:t;function se(t,e){e=e||{};const r={};function n(p,u,b,C){return d.isPlainObject(p)&&d.isPlainObject(u)?d.merge.call({caseless:C},p,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function o(p,u,b,C){if(d.isUndefined(u)){if(!d.isUndefined(p))return n(void 0,p,b,C)}else return n(p,u,b,C)}function i(p,u){if(!d.isUndefined(u))return n(void 0,u)}function a(p,u){if(d.isUndefined(u)){if(!d.isUndefined(p))return n(void 0,p)}else return n(void 0,u)}function l(p,u,b){if(b in e)return n(p,u);if(b in t)return n(void 0,p)}const h={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(p,u,b)=>o(Tt(p),Tt(u),b,!0)};return d.forEach(Object.keys({...t,...e}),function(u){const b=h[u]||o,C=b(t[u],e[u],u);d.isUndefined(C)&&b!==l||(r[u]=C)}),r}const Rt=t=>{const e=se({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=G.from(a),e.url=mt(Et(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),d.isFormData(r)){if(K.hasStandardBrowserEnv||K.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(d.isFunction(r.getHeaders)){const h=r.getHeaders(),p=["content-type","content-length"];Object.entries(h).forEach(([u,b])=>{p.includes(u.toLowerCase())&&a.set(u,b)})}}if(K.hasStandardBrowserEnv&&(n&&d.isFunction(n)&&(n=n(e)),n||n!==!1&&tn(e.url))){const h=o&&i&&rn.read(i);h&&a.set(o,h)}return e},on=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const o=Rt(t);let i=o.data;const a=G.from(o.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:p}=o,u,b,C,k,c;function g(){k&&k(),c&&c(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function O(){if(!y)return;const v=G.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),D={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:v,config:t,request:y};St(function(_){r(_),g()},function(_){n(_),g()},D),y=null}"onloadend"in y?y.onloadend=O:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(O)},y.onabort=function(){y&&(n(new z("Request aborted",z.ECONNABORTED,t,y)),y=null)},y.onerror=function(F){const D=F&&F.message?F.message:"Network Error",m=new z(D,z.ERR_NETWORK,t,y);m.event=F||null,n(m),y=null},y.ontimeout=function(){let F=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const D=o.transitional||yt;o.timeoutErrorMessage&&(F=o.timeoutErrorMessage),n(new z(F,D.clarifyTimeoutError?z.ETIMEDOUT:z.ECONNABORTED,t,y)),y=null},i===void 0&&a.setContentType(null),"setRequestHeader"in y&&d.forEach(a.toJSON(),function(F,D){y.setRequestHeader(D,F)}),d.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),l&&l!=="json"&&(y.responseType=o.responseType),p&&([C,c]=Oe(p,!0),y.addEventListener("progress",C)),h&&y.upload&&([b,k]=Oe(h),y.upload.addEventListener("progress",b),y.upload.addEventListener("loadend",k)),(o.cancelToken||o.signal)&&(u=v=>{y&&(n(!v||v.type?new de(null,t,y):v),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const W=Zr(o.url);if(W&&K.protocols.indexOf(W)===-1){n(new z("Unsupported protocol "+W+":",z.ERR_BAD_REQUEST,t));return}y.send(i||null)})},an=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o;const i=function(p){if(!o){o=!0,l();const u=p instanceof Error?p:this.reason;n.abort(u instanceof z?u:new de(u instanceof Error?u.message:u))}};let a=e&&setTimeout(()=>{a=null,i(new z(`timeout ${e} of ms exceeded`,z.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(p=>{p.unsubscribe?p.unsubscribe(i):p.removeEventListener("abort",i)}),t=null)};t.forEach(p=>p.addEventListener("abort",i));const{signal:h}=n;return h.unsubscribe=()=>d.asap(l),h}},ln=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},cn=async function*(t,e){for await(const r of dn(t))yield*ln(r,e)},dn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Ct=(t,e,r,n)=>{const o=cn(t,e);let i=0,a,l=h=>{a||(a=!0,n&&n(h))};return new ReadableStream({async pull(h){try{const{done:p,value:u}=await o.next();if(p){l(),h.close();return}let b=u.byteLength;if(r){let C=i+=b;r(C)}h.enqueue(new Uint8Array(u))}catch(p){throw l(p),p}},cancel(h){return l(h),o.return()}},{highWaterMark:2})},Pt=64*1024,{isFunction:Ie}=d,un=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Ot,TextEncoder:It}=d.global,_t=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pn=t=>{t=d.merge.call({skipUndefined:!0},un,t);const{fetch:e,Request:r,Response:n}=t,o=e?Ie(e):typeof fetch=="function",i=Ie(r),a=Ie(n);if(!o)return!1;const l=o&&Ie(Ot),h=o&&(typeof It=="function"?(c=>g=>c.encode(g))(new It):async c=>new Uint8Array(await new r(c).arrayBuffer())),p=i&&l&&_t(()=>{let c=!1;const g=new r(K.origin,{body:new Ot,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!g}),u=a&&l&&_t(()=>d.isReadableStream(new n("").body)),b={stream:u&&(c=>c.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!b[c]&&(b[c]=(g,y)=>{let O=g&&g[c];if(O)return O.call(g);throw new z(`Response type '${c}' is not supported`,z.ERR_NOT_SUPPORT,y)})});const C=async c=>{if(c==null)return 0;if(d.isBlob(c))return c.size;if(d.isSpecCompliantForm(c))return(await new r(K.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 h(c)).byteLength},k=async(c,g)=>{const y=d.toFiniteNumber(c.getContentLength());return y??C(g)};return async c=>{let{url:g,method:y,data:O,signal:W,cancelToken:v,timeout:F,onDownloadProgress:D,onUploadProgress:m,responseType:_,headers:w,withCredentials:M="same-origin",fetchOptions:V}=Rt(c),U=e||fetch;_=_?(_+"").toLowerCase():"text";let A=an([W,v&&v.toAbortSignal()],F),I=null;const E=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let N;try{if(m&&p&&y!=="get"&&y!=="head"&&(N=await k(w,O))!==0){let R=new r(g,{method:"POST",body:O,duplex:"half"}),L;if(d.isFormData(O)&&(L=R.headers.get("content-type"))&&w.setContentType(L),R.body){const[x,S]=jt(N,Oe(kt(m)));O=Ct(R.body,Pt,x,S)}}d.isString(M)||(M=M?"include":"omit");const T=i&&"credentials"in r.prototype,P={...V,signal:A,method:y.toUpperCase(),headers:w.normalize().toJSON(),body:O,duplex:"half",credentials:T?M:void 0};I=i&&new r(g,P);let B=await(i?U(I,V):U(g,P));const q=u&&(_==="stream"||_==="response");if(u&&(D||q&&E)){const R={};["status","statusText","headers"].forEach(H=>{R[H]=B[H]});const L=d.toFiniteNumber(B.headers.get("content-length")),[x,S]=D&&jt(L,Oe(kt(D),!0))||[];B=new n(Ct(B.body,Pt,x,()=>{S&&S(),E&&E()}),R)}_=_||"text";let f=await b[d.findKey(b,_)||"text"](B,c);return!q&&E&&E(),await new Promise((R,L)=>{St(R,L,{data:f,headers:G.from(B.headers),status:B.status,statusText:B.statusText,config:c,request:I})})}catch(T){throw E&&E(),T&&T.name==="TypeError"&&/Load failed|fetch/i.test(T.message)?Object.assign(new z("Network Error",z.ERR_NETWORK,c,I),{cause:T.cause||T}):z.from(T,T&&T.code,c,I)}}},fn=new Map,At=t=>{let e=t?t.env:{};const{fetch:r,Request:n,Response:o}=e,i=[n,o,r];let a=i.length,l=a,h,p,u=fn;for(;l--;)h=i[l],p=u.get(h),p===void 0&&u.set(h,p=l?new Map:pn(e)),u=p;return p};At();const Ve={http:Nr,xhr:on,fetch:{get:At}};d.forEach(Ve,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Nt=t=>`- ${t}`,xn=t=>d.isFunction(t)||t===null||t===!1,zt={getAdapter:(t,e)=>{t=d.isArray(t)?t:[t];const{length:r}=t;let n,o;const i={};for(let a=0;a<r;a++){n=t[a];let l;if(o=n,!xn(n)&&(o=Ve[(l=String(n)).toLowerCase()],o===void 0))throw new z(`Unknown adapter '${l}'`);if(o&&(d.isFunction(o)||(o=o.get(e))))break;i[l||"#"+a]=o}if(!o){const a=Object.entries(i).map(([h,p])=>`adapter ${h} `+(p===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
4
+ `+a.map(Nt).join(`
5
+ `):" "+Nt(a[0]):"as no adapter specified";throw new z("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:Ve};function Je(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new de(null,t)}function Ut(t){return Je(t),t.headers=G.from(t.headers),t.data=Ye.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),zt.getAdapter(t.adapter||ge.adapter,t)(t).then(function(n){return Je(t),n.data=Ye.call(t,t.transformResponse,n),n.headers=G.from(n.headers),n},function(n){return vt(n)||(Je(t),n&&n.response&&(n.response.data=Ye.call(t,t.transformResponse,n.response),n.response.headers=G.from(n.response.headers))),Promise.reject(n)})}const Ft="1.12.2",_e={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_e[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Dt={};_e.transitional=function(e,r,n){function o(i,a){return"[Axios v"+Ft+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,l)=>{if(e===!1)throw new z(o(a," has been removed"+(r?" in "+r:"")),z.ERR_DEPRECATED);return r&&!Dt[a]&&(Dt[a]=!0,console.warn(o(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,a,l):!0}},_e.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function hn(t,e,r){if(typeof t!="object")throw new z("options must be an object",z.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let o=n.length;for(;o-- >0;){const i=n[o],a=e[i];if(a){const l=t[i],h=l===void 0||a(l,i,t);if(h!==!0)throw new z("option "+i+" must be "+h,z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new z("Unknown option "+i,z.ERR_BAD_OPTION)}}const Ae={assertOptions:hn,validators:_e},ee=Ae.validators;let oe=class{constructor(e){this.defaults=e||{},this.interceptors={request:new gt,response:new gt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
6
+ `+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=se(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&Ae.assertOptions(n,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),o!=null&&(d.isFunction(o)?r.paramsSerializer={serialize:o}:Ae.assertOptions(o,{encode:ee.function,serialize:ee.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ae.assertOptions(r,{baseUrl:ee.spelling("baseURL"),withXsrfToken:ee.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=G.concat(a,i);const l=[];let h=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(h=h&&g.synchronous,l.unshift(g.fulfilled,g.rejected))});const p=[];this.interceptors.response.forEach(function(g){p.push(g.fulfilled,g.rejected)});let u,b=0,C;if(!h){const c=[Ut.bind(this),void 0];for(c.unshift(...l),c.push(...p),C=c.length,u=Promise.resolve(r);b<C;)u=u.then(c[b++],c[b++]);return u}C=l.length;let k=r;for(;b<C;){const c=l[b++],g=l[b++];try{k=c(k)}catch(y){g.call(this,y);break}}try{u=Ut.call(this,k)}catch(c){return Promise.reject(c)}for(b=0,C=p.length;b<C;)u=u.then(p[b++],p[b++]);return u}getUri(e){e=se(this.defaults,e);const r=Et(e.baseURL,e.url,e.allowAbsoluteUrls);return mt(r,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){oe.prototype[e]=function(r,n){return this.request(se(n||{},{method:e,url:r,data:(n||{}).data}))}}),d.forEach(["post","put","patch"],function(e){function r(n){return function(i,a,l){return this.request(se(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}oe.prototype[e]=r(),oe.prototype[e+"Form"]=r(!0)});let mn=class Kt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(l=>{n.subscribe(l),i=l}).then(o);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,l){n.reason||(n.reason=new de(i,a,l),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Kt(function(o){e=o}),cancel:e}}};function gn(t){return function(r){return t.apply(null,r)}}function yn(t){return d.isObject(t)&&t.isAxiosError===!0}const Ke={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(Ke).forEach(([t,e])=>{Ke[e]=t});function Lt(t){const e=new oe(t),r=tt(oe.prototype.request,e);return d.extend(r,oe.prototype,e,{allOwnKeys:!0}),d.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return Lt(se(t,o))},r}const $=Lt(ge);$.Axios=oe,$.CanceledError=de,$.CancelToken=mn,$.isCancel=vt,$.VERSION=Ft,$.toFormData=Ce,$.AxiosError=z,$.Cancel=$.CanceledError,$.all=function(e){return Promise.all(e)},$.spread=gn,$.isAxiosError=yn,$.mergeConfig=se,$.AxiosHeaders=G,$.formToJSON=t=>bt(d.isHTMLForm(t)?new FormData(t):t),$.getAdapter=zt.getAdapter,$.HttpStatusCode=Ke,$.default=$;const{Axios:ns,AxiosError:ss,CanceledError:os,isCancel:as,CancelToken:is,VERSION:ls,all:cs,Cancel:ds,isAxiosError:us,spread:ps,toFormData:fs,AxiosHeaders:xs,HttpStatusCode:hs,formToJSON:ms,getAdapter:gs,mergeConfig:ys}=$;class bn{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=$.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:1e4})}async request(e,r,n,o={}){if(!e)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...n||{}};return(await this.client.request({url:r,method:e,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(e){const{name:r,email:n,password:o}=e;if(!r||!n||!o)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:n,appId:o}=e;if(!r||!n)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:n,appId:o||this.appId})}async updateUser(e){const{userId:r,appId:n}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:n||this.appId})}async changePassword(e){const{userId:r,currentPassword:n,newPassword:o,appId:i}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!n||!o)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:n,newPassword:o,appId:i||this.appId})}async deleteUser(e){const{userId:r,appId:n}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:n||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:n}=e;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:n||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(e){const{token:r,otp:n,appId:o}=e;if(!r)throw new Error("verifyEmail: 'token' is required");if(!n)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:n,appId:o||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(e){const{email:r,appId:n}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:n||this.appId})}async resetPassword(e){const{email:r,otp:n,newPassword:o,appId:i}=e;if(!r||!n||!o)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:n,newPassword:o,appId:i||this.appId})}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${n}`)}async addUserData(e){const{userId:r,data:n}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!n)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,n)}async updateUserData(e){const{userId:r,dataId:n,data:o}=e;if(!r||!n)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/${n}`,o)}async deleteUserData(e){const{userId:r,dataId:n}=e;if(!r||!n)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${n}`)}}var Ne={exports:{}},be={};/**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
9
9
  *
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
- */var Gt;function Bn(){if(Gt)return Te;Gt=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,o,i){var a=null;if(i!==void 0&&(a=""+i),o.key!==void 0&&(a=""+o.key),"key"in o){i={};for(var c in o)c!=="key"&&(i[c]=o[c])}else i=o;return o=i.ref,{$$typeof:t,type:n,key:a,ref:o!==void 0?o:null,props:i}}return Te.Fragment=e,Te.jsx=r,Te.jsxs=r,Te}var Ce={};/**
14
+ */var Mt;function wn(){if(Mt)return be;Mt=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,o,i){var a=null;if(i!==void 0&&(a=""+i),o.key!==void 0&&(a=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:t,type:n,key:a,ref:o!==void 0?o:null,props:i}}return be.Fragment=e,be.jsx=r,be.jsxs=r,be}var we={};/**
15
15
  * @license React
16
16
  * react-jsx-runtime.development.js
17
17
  *
@@ -19,188 +19,177 @@
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 Zt;function $n(){return Zt||(Zt=1,process.env.NODE_ENV!=="production"&&(function(){function t(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===q?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case m:return"Fragment";case _:return"Profiler";case g:return"StrictMode";case z:return"Suspense";case h:return"SuspenseList";case L:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case l:return"Portal";case R:return(f.displayName||"Context")+".Provider";case $:return(f._context.displayName||"Context")+".Consumer";case E:var C=f.render;return f=f.displayName,f||(f=C.displayName||C.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case I:return C=f.displayName||null,C!==null?C:t(f.type)||"Memo";case w:C=f._payload,f=f._init;try{return t(f(C))}catch{}}return null}function e(f){return""+f}function r(f){try{e(f);var C=!1}catch{C=!0}if(C){C=console;var O=C.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return O.call(C,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),e(f)}}function n(f){if(f===m)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===w)return"<...>";try{var C=t(f);return C?"<"+C+">":"<...>"}catch{return"<...>"}}function o(){var f=j.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function a(f){if(H.call(f,"key")){var C=Object.getOwnPropertyDescriptor(f,"key").get;if(C&&C.isReactWarning)return!1}return f.key!==void 0}function c(f,C){function O(){U||(U=!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))}O.isReactWarning=!0,Object.defineProperty(f,"key",{get:O,configurable:!0})}function x(){var f=t(this.type);return F[f]||(F[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function p(f,C,O,A,M,K,Pe,_e){return O=K.ref,f={$$typeof:b,type:f,key:C,props:K,_owner:M},(O!==void 0?O:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:x}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Pe}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:_e}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,C,O,A,M,K,Pe,_e){var Y=C.children;if(Y!==void 0)if(A)if(T(Y)){for(A=0;A<Y.length;A++)y(Y[A]);Object.freeze&&Object.freeze(Y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(Y);if(H.call(C,"key")){Y=t(f);var re=Object.keys(C).filter(function(dt){return dt!=="key"});A=0<re.length?"{key: someKey, "+re.join(": ..., ")+": ...}":"{key: someKey}",V[Y+A]||(re=0<re.length?"{"+re.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
22
+ */var Bt;function vn(){return Bt||(Bt=1,process.env.NODE_ENV!=="production"&&(function(){function t(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===V?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case g:return"Fragment";case O:return"Profiler";case y:return"StrictMode";case D:return"Suspense";case m:return"SuspenseList";case M:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case c:return"Portal";case v:return(f.displayName||"Context")+".Provider";case W:return(f._context.displayName||"Context")+".Consumer";case F:var R=f.render;return f=f.displayName,f||(f=R.displayName||R.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case _:return R=f.displayName||null,R!==null?R:t(f.type)||"Memo";case w:R=f._payload,f=f._init;try{return t(f(R))}catch{}}return null}function e(f){return""+f}function r(f){try{e(f);var R=!1}catch{R=!0}if(R){R=console;var L=R.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return L.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),e(f)}}function n(f){if(f===g)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===w)return"<...>";try{var R=t(f);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function o(){var f=U.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function a(f){if(A.call(f,"key")){var R=Object.getOwnPropertyDescriptor(f,"key").get;if(R&&R.isReactWarning)return!1}return f.key!==void 0}function l(f,R){function L(){N||(N=!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))}L.isReactWarning=!0,Object.defineProperty(f,"key",{get:L,configurable:!0})}function h(){var f=t(this.type);return T[f]||(T[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function p(f,R,L,x,S,H,te,Se){return L=H.ref,f={$$typeof:k,type:f,key:R,props:H,_owner:S},(L!==void 0?L:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:h}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Se}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,R,L,x,S,H,te,Se){var J=R.children;if(J!==void 0)if(x)if(I(J)){for(x=0;x<J.length;x++)b(J[x]);Object.freeze&&Object.freeze(J)}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(J);if(A.call(R,"key")){J=t(f);var re=Object.keys(R).filter(function(et){return et!=="key"});x=0<re.length?"{key: someKey, "+re.join(": ..., ")+": ...}":"{key: someKey}",q[J+x]||(re=0<re.length?"{"+re.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} />`,A,Y,re,Y),V[Y+A]=!0)}if(Y=null,O!==void 0&&(r(O),Y=""+O),a(C)&&(r(C.key),Y=""+C.key),"key"in C){O={};for(var Oe in C)Oe!=="key"&&(O[Oe]=C[Oe])}else O=C;return Y&&c(O,typeof f=="function"?f.displayName||f.name||"Unknown":f),p(f,Y,K,M,o(),O,Pe,_e)}function y(f){typeof f=="object"&&f!==null&&f.$$typeof===b&&f._store&&(f._store.validated=1)}var S=k,b=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),R=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),q=Symbol.for("react.client.reference"),j=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=Object.prototype.hasOwnProperty,T=Array.isArray,v=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(f){return f()}};var U,F={},J=S.react_stack_bottom_frame.bind(S,i)(),W=v(n(i)),V={};Ce.Fragment=m,Ce.jsx=function(f,C,O,A,M){var K=1e4>j.recentlyCreatedOwnerStacks++;return u(f,C,O,!1,A,M,K?Error("react-stack-top-frame"):J,K?v(n(f)):W)},Ce.jsxs=function(f,C,O,A,M){var K=1e4>j.recentlyCreatedOwnerStacks++;return u(f,C,O,!0,A,M,K?Error("react-stack-top-frame"):J,K?v(n(f)):W)}})()),Ce}var Qt;function Wn(){return Qt||(Qt=1,process.env.NODE_ENV==="production"?He.exports=Bn():He.exports=$n()),He.exports}var s=Wn();const Hn=async(t,e)=>{const{email:r,password:n,appId:o}=t,{baseUrl:i,apiKey:a}=e;if(!a)throw new Error("API key is required for login");try{const c=await D.post(`${i}/users/login`,{email:r,password:n,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return c.data?.user&&localStorage.setItem("userInfo",JSON.stringify(c.data.user)),c.data.user}catch(c){const x=c.response?.data?.message||c.message||"Login failed";throw console.error("Login API Error:",x),{success:!1,message:x,status:c.response?.status||500}}},qe={baseUrl:"",apiKey:"",appId:""},qn=t=>{if(!t.baseUrl||!t.apiKey||!t.appId)throw new Error("baseUrl, apiKey, and appId are required");qe.baseUrl=t.baseUrl,qe.apiKey=t.apiKey,qe.appId=t.appId},xe=()=>qe;/**
27
+ <%s key={someKey} {...props} />`,x,J,re,J),q[J+x]=!0)}if(J=null,L!==void 0&&(r(L),J=""+L),a(R)&&(r(R.key),J=""+R.key),"key"in R){L={};for(var je in R)je!=="key"&&(L[je]=R[je])}else L=R;return J&&l(L,typeof f=="function"?f.displayName||f.name||"Unknown":f),p(f,J,H,S,o(),L,te,Se)}function b(f){typeof f=="object"&&f!==null&&f.$$typeof===k&&f._store&&(f._store.validated=1)}var C=j,k=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),U=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,I=Array.isArray,E=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(f){return f()}};var N,T={},P=C.react_stack_bottom_frame.bind(C,i)(),B=E(n(i)),q={};we.Fragment=g,we.jsx=function(f,R,L,x,S){var H=1e4>U.recentlyCreatedOwnerStacks++;return u(f,R,L,!1,x,S,H?Error("react-stack-top-frame"):P,H?E(n(f)):B)},we.jsxs=function(f,R,L,x,S){var H=1e4>U.recentlyCreatedOwnerStacks++;return u(f,R,L,!0,x,S,H?Error("react-stack-top-frame"):P,H?E(n(f)):B)}})()),we}var $t;function Sn(){return $t||($t=1,process.env.NODE_ENV==="production"?Ne.exports=wn():Ne.exports=vn()),Ne.exports}var s=Sn();const jn=async(t,e)=>{const{email:r,password:n,appId:o}=t,{baseUrl:i,apiKey:a}=e;if(!a)throw new Error("API key is required for login");try{const l=await $.post(`${i}/users/login`,{email:r,password:n,appId:o},{headers:{"Content-Type":"application/json","x-api-key":a}});return l.data?.user&&localStorage.setItem("userInfo",JSON.stringify(l.data.user)),l.data.user}catch(l){const h=l.response?.data?.message||l.message||"Login failed";throw console.error("Login API Error:",h),{success:!1,message:h,status:l.response?.status||500}}},ze={baseUrl:"",apiKey:"",appId:""},kn=t=>{if(!t.baseUrl||!t.apiKey||!t.appId)throw new Error("baseUrl, apiKey, and appId are required");ze.baseUrl=t.baseUrl,ze.apiKey=t.apiKey,ze.appId=t.appId},ae=()=>ze;/**
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 Vn=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Yn=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),er=t=>{const e=Yn(t);return e.charAt(0).toUpperCase()+e.slice(1)},tr=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Jn=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
32
+ */const En=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tn=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),Wt=t=>{const e=Tn(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ht=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Rn=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="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.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */var Kn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
+ */var Cn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
38
38
  * @license lucide-react v0.544.0 - ISC
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 Xn=k.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...c},x)=>k.createElement("svg",{ref:x,...Kn,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:tr("lucide",o),...!i&&!Jn(c)&&{"aria-hidden":"true"},...c},[...a.map(([p,u])=>k.createElement(p,u)),...Array.isArray(i)?i:[i]]));/**
42
+ */const Pn=j.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...l},h)=>j.createElement("svg",{ref:h,...Cn,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Ht("lucide",o),...!i&&!Rn(l)&&{"aria-hidden":"true"},...l},[...a.map(([p,u])=>j.createElement(p,u)),...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 B=(t,e)=>{const r=k.forwardRef(({className:n,...o},i)=>k.createElement(Xn,{ref:i,iconNode:e,className:tr(`lucide-${Vn(er(t))}`,`lucide-${t}`,n),...o}));return r.displayName=er(t),r};/**
47
+ */const Y=(t,e)=>{const r=j.forwardRef(({className:n,...o},i)=>j.createElement(Pn,{ref:i,iconNode:e,className:Ht(`lucide-${En(Wt(t))}`,`lucide-${t}`,n),...o}));return r.displayName=Wt(t),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 ot=B("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 Xe=Y("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 he=B("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"}]]);/**
57
+ */const On=Y("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 Ve=B("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"}]]);/**
62
+ */const ie=Y("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 at=B("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
67
+ */const Ue=Y("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 Gn=B("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"}]]);/**
72
+ */const Ge=Y("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 it=B("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"}]]);/**
77
+ */const In=Y("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 lt=B("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"}]]);/**
82
+ */const Ze=Y("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 rr=B("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"}]]);/**
87
+ */const Qe=Y("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 Zn=B("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
92
+ */const qt=Y("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 Qn=B("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 _n=Y("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 nr=B("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 Yt=Y("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 es=B("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 An=Y("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 ge=B("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
112
+ */const ue=Y("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 ts=B("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 Nn=Y("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 ye=B("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 pe=Y("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 sr=B("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 Vt=Y("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 Re=B("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 ve=Y("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 or=B("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 zn=Y("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 rs=B("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 Un=Y("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 ar=B("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 Fn=Y("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 ns=B("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
152
+ */const Dn=Y("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 ss=B("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"}]]);/**
157
+ */const Ln=Y("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"}]]);/**
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 os=B("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"}]]);/**
162
+ */const Mn=Y("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"}]]);/**
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 Ye=B("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"}]]);/**
167
+ */const Fe=Y("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"}]]);/**
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 ir=B("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"}]]);/**
172
+ */const Jt=Y("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"}]]);/**
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 lr=B("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["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"}]]);/**
177
+ */const Bn=Y("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"}]]);/**
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 ct=B("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 fe=Y("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"}]]);/**
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 de=B("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
- * @license lucide-react v0.544.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const me=B("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),as=({logoUrl:t,title:e="Sign In to Your Account",subtitle:r="Welcome back! Please enter your details",footerText:n="Secure authentication powered by Neuctra Authix",primaryColor:o="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,signupUrl:c,onSuccess:x,onError:p})=>{const{baseUrl:u,apiKey:y,appId:S}=xe(),[b,l]=k.useState("login"),[m,g]=k.useState(1),[_,$]=k.useState(!1),[R,E]=k.useState(!1),[z,h]=k.useState(null),[I,w]=k.useState(""),[L,q]=k.useState(""),[j,H]=k.useState({email:"",otp:"",newPassword:"",appId:S}),T=window.innerWidth<768,v=a?"#ffffff":"#111827",U=a?"#a1a1aa":"#6b7280",F=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",J=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",W=async A=>{A.preventDefault(),E(!0),h(null);try{const M=await Hn({email:I,password:L,appId:S},{baseUrl:u,apiKey:y});h({type:"success",text:`Welcome ${M.name}`}),x?.(M)}catch(M){const K=M.message||"Login failed";h({type:"error",text:K}),p?.(M)}finally{E(!1)}},V=A=>{H({...j,[A.target.name]:A.target.value})},f=async A=>{A.preventDefault(),E(!0),h(null);try{const M=await D.post(`${u}/users/forgot-password`,{email:j.email,appId:S},{headers:{"x-api-key":y}});M.data.success?(g(2),h({type:"success",text:"OTP sent to your email"})):h({type:"error",text:M.data.message||"Failed to send OTP"})}catch(M){h({type:"error",text:M.response?.data?.message||"Something went wrong"})}finally{E(!1)}},C=async A=>{A.preventDefault(),E(!0),h(null);try{const M=await D.post(`${u}/users/reset-password`,j,{headers:{"x-api-key":y}});M.data.success?(h({type:"success",text:"Password reset successfully!"}),g(1),H({email:"",otp:"",newPassword:"",appId:S}),l("login")):h({type:"error",text:M.data.message||"Reset failed"})}catch(M){h({type:"error",text:M.response?.data?.message||"Something went wrong"})}finally{E(!1)}},O={width:"100%",padding:T?"14px 14px 14px 44px":"16px 16px 16px 44px",backgroundColor:F,border:`1px solid ${J}`,borderRadius:"12px",color:v,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",margin:"auto"},children:s.jsxs("div",{style:{width:"390px",maxWidth:"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:T?"30px 24px":"30px 28px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"20px"},children:[t?s.jsx("img",{src:t,alt:"Logo",style:{height:"60px",width:"60px",marginBottom:"10px"}}):s.jsx(de,{size:40,color:o,style:{marginBottom:"10px"}}),s.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:v,margin:0},children:b==="login"?e:m===1?"Forgot Password":"Reset Password"}),s.jsx("p",{style:{fontSize:"14px",color:U,margin:"6px 0 0 0"},children:b==="login"?r:"Follow the steps to reset your password"})]}),b==="login"&&s.jsxs("form",{onSubmit:W,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:"#ffffff"},children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(Re,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:I,onChange:A=>w(A.target.value),style:O})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:"#ffffff"},children:"Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(ye,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"login-password",type:_?"text":"password",placeholder:"Enter your password",value:L,onChange:A=>q(A.target.value),style:O}),s.jsx("button",{type:"button",onClick:()=>$(!_),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:U,cursor:"pointer"},children:_?s.jsx(it,{size:20}):s.jsx(lt,{size:20})})]})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[c&&s.jsx("a",{href:c,style:{color:o,textDecoration:"none",fontWeight:500},children:"Create new account"}),s.jsx("button",{type:"button",onClick:()=>l("forgot"),style:{background:"none",border:"none",color:o,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),s.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontWeight:600},children:R?"Signing In...":"Sign In"})]}),b==="forgot"&&s.jsxs("form",{onSubmit:m===1?f:C,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[m===1?s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:"#ffffff"},children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(Re,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:j.email,onChange:V,style:O})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[s.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:"#ffffff"},children:"One-Time Password (OTP)"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(Qn,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:j.otp,onChange:V,style:O})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[s.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:"#ffffff"},children:"New Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(ye,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:j.newPassword,onChange:V,style:O})]})]})]}),s.jsx("button",{type:"submit",disabled:R,style:{padding:"12px",background:i,color:"#fff",border:"none",fontSize:"15px",borderRadius:"10px",fontWeight:600},children:R?"Please wait...":m===1?"Send Reset OTP":"Reset Password"}),s.jsx("button",{type:"button",onClick:()=>{l("login"),g(1)},style:{background:"none",border:"none",color:U,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),z&&s.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:z.type==="success"?`${o}15`:"rgba(239,68,68,0.1)",border:z.type==="success"?`1px solid ${o}30`:"1px solid rgba(239,68,68,0.3)",color:z.type==="success"?o:"#ef4444"},children:[z.type==="success"?s.jsx(Ve,{size:20}):s.jsx(he,{size:20}),s.jsx("span",{children:z.text})]}),s.jsxs("div",{style:{textAlign:"center",fontSize:"13px",color:U,marginTop:"20px"},children:["Secure authentication powered by"," ",s.jsx("span",{style:{color:o,fontWeight:600},children:"Neuctra Authix"})]})]})})},is=async(t,e)=>{const{name:r,email:n,password:o,appId:i,phone:a,address:c,avatarUrl:x,isActive:p=!0,role:u="user"}=t,{baseUrl:y,apiKey:S}=e;if(!S)throw new Error("❌ API key is required for signup");if(!r||!n||!o||!i)throw new Error("❌ Name, email, password, and appId are required");try{const b=await D.post(`${y}/users/signup`,{name:r,email:n,password:o,appId:i,phone:a,address:c,avatarUrl:x,isActive:p,role:u},{headers:{"Content-Type":"application/json","x-api-key":S}});return b.data?.user&&localStorage.setItem("userInfo",JSON.stringify(b.data.user)),b.data.user}catch(b){const l=b.response?.data?.message||b.message||"Signup failed";if(console.error("Signup API Error:",l),b.response?.status===400){if(l.includes("already exists"))throw{success:!1,message:"User with this email already exists for this app",status:400};if(l.includes("inactive"))throw{success:!1,message:"Cannot signup under an inactive app",status:400}}throw b.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:l,status:b.response?.status||500}}},ls=({logoUrl:t,title:e="Create Your Account",subtitle:r="Join our platform today",footerText:n="Secure authentication powered by Neuctra Authix",primaryColor:o="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,showPhone:c=!1,showAddress:x=!1,showAvatar:p=!1,showRole:u=!1,showStatus:y=!1,loginUrl:S,onSuccess:b,onError:l,onClose:m})=>{const{baseUrl:g,apiKey:_,appId:$}=xe(),R={name:"",email:"",password:"",isActive:!0,role:"user",...c&&{phone:""},...x&&{address:""},...p&&{avatarUrl:""}},[E,z]=k.useState(R),[h,I]=k.useState(!1),[w,L]=k.useState(!1),[q,j]=k.useState(null),[H,T]=k.useState({}),v=typeof window<"u"?window.innerWidth<768:!1,U=a?"#ffffff":"#111827",F=a?"#a1a1aa":"#6b7280",J=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",W=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",V=N=>{const{name:ae,value:Ae}=N.target;z(Os=>({...Os,[ae]:Ae}))},f=()=>{z(N=>({...N,isActive:!N.isActive}))},C=()=>{const N={};return E.name||(N.name="Name is required"),E.email?/\S+@\S+\.\S+/.test(E.email)||(N.email="Invalid email address"):N.email="Email is required",E.password?E.password.length<6&&(N.password="Password must be at least 6 characters"):N.password="Password is required",T(N),Object.keys(N).length===0},O=async N=>{if(N.preventDefault(),!!C()){L(!0),j(null);try{const ae={...E,appId:$},Ae=await is(ae,{baseUrl:g,apiKey:_});j({type:"success",text:"Account created successfully"}),b&&b(Ae)}catch(ae){const Ae=ae.message||"Signup failed";j({type:"error",text:Ae}),l&&l(ae)}finally{L(!1)}}},A=!v&&(c||x||u||y),M={display:"flex",justifyContent:"center",alignItems:"center",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},K={backgroundColor:a?"#000000":"#ffffff",borderRadius:"12px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",width:"100%",maxWidth:A?"900px":"390px",display:"flex",flexDirection:"column",overflow:"hidden"},Pe={display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",padding:v?"32px 24px 0px 24px":"20px 32px 0px 32px"},_e={height:v?"48px":"50px",width:v?"48px":"50px",objectFit:"contain",marginBottom:v?"16px":"20px",borderRadius:"12px"},Y={height:v?"60px":"80px",width:v?"60px":"80px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${o}20`,borderRadius:"16px",marginBottom:v?"16px":"20px"},re={fontSize:"24px",fontWeight:700,color:U,margin:"0 0 8px 0",letterSpacing:"-0.025em",lineHeight:"1.2"},Oe={fontSize:"14px",color:F,margin:0,lineHeight:"1.5"},dt={position:"absolute",top:v?"16px":"20px",right:v?"16px":"20px",color:F,backgroundColor:"transparent",border:"none",padding:"8px",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease"},hs={flex:1,padding:v?"24px":"10px 32px"},gs={display:"grid",gridTemplateColumns:A?"1fr 1fr":"1fr",gap:"20px"},cr={display:"flex",justifyContent:"end",flexDirection:"column",gap:"16px"},ne={display:"flex",flexDirection:"column",gap:"4px"},se={fontSize:"14px",fontWeight:600,color:U},oe={position:"relative",display:"flex",alignItems:"center"},be={position:"absolute",left:"16px",color:F,width:"20px",height:"20px"},we={width:"100%",padding:v?"14px 14px 14px 48px":"16px 16px 16px 52px",backgroundColor:J,border:`1px solid ${W}`,borderRadius:"12px",color:U,fontSize:"15px",outline:"none",transition:"all 0.2s ease"},dr={width:"100%",padding:v?"14px 48px 14px 16px":"16px 52px 16px 16px",backgroundColor:J,border:`1px solid ${W}`,borderRadius:"12px",color:U,fontSize:"16px",outline:"none",appearance:"none"},ys={position:"absolute",right:"16px",backgroundColor:"transparent",border:"none",color:F,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:"4px",borderRadius:"4px",transition:"all 0.2s ease"},ms={display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",margin:"10px 0px"},bs={display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",borderRadius:"16px",width:"100%",maxWidth:"200px"},ws={width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${o}30`},js={width:"60px",height:"60px",borderRadius:"50%",backgroundColor:`${o}10`,display:"flex",alignItems:"center",justifyContent:"center",color:o,border:`2px solid ${o}20`},ur={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"21px 20px",backgroundColor:J,border:`1px solid ${W}`,borderRadius:"12px"},pr={display:"flex",alignItems:"center",gap:"12px",fontSize:"12px"},fr={width:"52px",height:"28px",backgroundColor:E.isActive?o:"#9ca3af",borderRadius:"14px",position:"relative",cursor:"pointer",transition:"background-color 0.2s"},xr={position:"absolute",top:"2px",left:E.isActive?"26px":"2px",width:"24px",height:"24px",backgroundColor:"#ffffff",borderRadius:"50%",transition:"left 0.2s",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"},Ss={display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",padding:v?"0px 24px 18px 24px":"14px 32px 18px 32px"},vs={fontSize:v?"12px":"13px",color:F,textAlign:"center",lineHeight:"1.5"},ks={color:"#ffffff",textDecoration:"none",fontSize:v?"14px":"15px",fontWeight:500,textAlign:"center"},Es={display:"flex",gap:"12px",width:"100%"},ut={padding:v?"14px 20px":"14px 24px",borderRadius:"12px",border:"none",fontSize:v?"15px":"14px",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.3s ease",flex:1},Ts={...ut,backgroundColor:J,color:U,border:`1px solid ${W}`},Cs={...ut,background:w?"#9ca3af":i,color:"#ffffff",boxShadow:w?"none":`0 4px 14px 0 ${o}40`},Rs={...ut,backgroundColor:"#9ca3af",color:"#ffffff",cursor:"not-allowed",boxShadow:"none"},hr={padding:"16px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"flex-start",gap:"12px",marginTop:"20px"},Ps={...hr,backgroundColor:`${o}15`,border:`1px solid ${o}30`,color:o},_s={...hr,backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"#ef4444"};return s.jsxs("div",{style:M,children:[s.jsxs("div",{style:K,children:[s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("div",{style:Pe,children:[t?s.jsx("img",{src:t,alt:"Logo",style:_e}):s.jsx("div",{style:Y,children:s.jsx(de,{size:v?32:40,color:o})}),s.jsxs("div",{children:[s.jsx("h2",{style:re,children:e}),s.jsx("p",{style:Oe,children:r})]})]}),m&&s.jsx("button",{onClick:m,style:dt,onMouseOver:N=>{N.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"},onMouseOut:N=>{N.currentTarget.style.backgroundColor="transparent"},children:s.jsx(me,{size:24})})]}),s.jsxs("div",{style:hs,children:[p&&s.jsx("div",{style:ms,children:s.jsxs("div",{style:bs,children:[E.avatarUrl?s.jsx("img",{src:E.avatarUrl,alt:"Avatar Preview",style:ws,onError:N=>{const ae=N.target;ae.style.display="none"}}):s.jsx("div",{style:js,children:s.jsx(de,{size:40})}),s.jsx("span",{style:{fontSize:"14px",color:F,fontWeight:500},children:"Avatar Preview"})]})}),s.jsxs("form",{onSubmit:O,style:gs,children:[s.jsxs("div",{style:cr,children:[s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Full Name"}),s.jsxs("div",{style:oe,children:[s.jsx(de,{size:20,style:be}),s.jsx("input",{type:"text",name:"name",placeholder:"Enter your full name",value:E.name,onChange:V,style:we,required:!0})]}),H.name&&s.jsx("span",{style:{color:"#ef4444",fontSize:"14px",marginTop:"4px"},children:H.name})]}),s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Email Address"}),s.jsxs("div",{style:oe,children:[s.jsx(Re,{size:20,style:be}),s.jsx("input",{type:"email",name:"email",placeholder:"Enter your email address",value:E.email,onChange:V,style:we,required:!0})]}),H.email&&s.jsx("span",{style:{color:"#ef4444",fontSize:"14px",marginTop:"4px"},children:H.email})]}),s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Password"}),s.jsxs("div",{style:oe,children:[s.jsx(ye,{size:20,style:be}),s.jsx("input",{type:h?"text":"password",name:"password",placeholder:"Create a secure password",value:E.password,onChange:V,style:we,required:!0}),s.jsx("button",{type:"button",onClick:()=>I(!h),style:ys,onMouseOver:N=>{N.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"},onMouseOut:N=>{N.currentTarget.style.backgroundColor="transparent"},children:h?s.jsx(it,{size:20}):s.jsx(lt,{size:20})})]}),H.password&&s.jsx("span",{style:{color:"#ef4444",fontSize:"14px",marginTop:"4px"},children:H.password})]}),c&&s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Phone Number"}),s.jsxs("div",{style:oe,children:[s.jsx(ar,{size:20,style:be}),s.jsx("input",{type:"tel",name:"phone",placeholder:"Enter your phone number",value:E.phone||"",onChange:V,style:we})]})]})]}),A&&s.jsxs("div",{style:cr,children:[x&&s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Address"}),s.jsxs("div",{style:oe,children:[s.jsx(or,{size:20,style:be}),s.jsx("input",{type:"text",name:"address",placeholder:"Enter your address",value:E.address||"",onChange:V,style:we})]})]}),p&&s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Avatar URL"}),s.jsxs("div",{style:oe,children:[s.jsx(rr,{size:20,style:be}),s.jsx("input",{type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:E.avatarUrl||"",onChange:V,style:we})]})]}),u&&s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Role"}),s.jsx("div",{style:oe,children:s.jsxs("select",{name:"role",value:E.role,onChange:V,style:dr,children:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"}),s.jsx("option",{value:"moderator",children:"Moderator"})]})})]}),y&&s.jsxs("div",{style:ur,children:[s.jsxs("div",{style:pr,children:[E.isActive?s.jsx(lr,{size:24,color:o}):s.jsx(ct,{size:24,color:"#ef4444"}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:U},children:"Account Status"}),s.jsx("div",{style:{fontSize:"12px",color:F},children:E.isActive?"User can access the system":"User account is disabled"})]})]}),s.jsx("div",{style:fr,onClick:f,onMouseOver:N=>{N.currentTarget.style.opacity="0.8"},onMouseOut:N=>{N.currentTarget.style.opacity="1"},children:s.jsx("div",{style:xr})})]})]}),!A&&s.jsxs(s.Fragment,{children:[u&&s.jsxs("div",{style:ne,children:[s.jsx("label",{style:se,children:"Role"}),s.jsx("div",{style:oe,children:s.jsxs("select",{name:"role",value:E.role,onChange:V,style:dr,children:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"}),s.jsx("option",{value:"moderator",children:"Moderator"})]})})]}),y&&s.jsxs("div",{style:ur,children:[s.jsxs("div",{style:pr,children:[E.isActive?s.jsx(lr,{size:24,color:o}):s.jsx(ct,{size:24,color:"#ef4444"}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"16px",fontWeight:600,color:U},children:"Account Status"}),s.jsx("div",{style:{fontSize:"14px",color:F},children:E.isActive?"User can access the system":"User account is disabled"})]})]}),s.jsx("div",{style:fr,onClick:f,children:s.jsx("div",{style:xr})})]})]})]}),q&&s.jsxs("div",{style:q.type==="success"?Ps:_s,children:[q.type==="success"?s.jsx(Ve,{size:20,color:o}):s.jsx(he,{size:20,color:"#ef4444"}),s.jsx("span",{style:{fontWeight:500},children:q.text})]})]}),s.jsxs("div",{style:Ss,children:[S&&s.jsxs("a",{href:S,style:ks,children:["Already have an account?"," ",s.jsx("span",{style:{color:o},children:"Sign in"})]}),s.jsxs("div",{style:Es,children:[m&&s.jsxs("button",{type:"button",onClick:m,style:Ts,onMouseOver:N=>{N.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.05)"},onMouseOut:N=>{N.currentTarget.style.backgroundColor=J},children:[s.jsx(me,{size:18}),"Cancel"]}),s.jsxs("button",{type:"button",onClick:O,disabled:w,style:w?Rs:Cs,onMouseOver:N=>{w||(N.currentTarget.style.transform="translateY(-2px)",N.currentTarget.style.boxShadow=`0 6px 20px 0 ${o}60`)},onMouseOut:N=>{w||(N.currentTarget.style.transform="translateY(0)",N.currentTarget.style.boxShadow=`0 4px 14px 0 ${o}40`)},children:[w?s.jsx(ts,{size:18,style:{animation:"spin 1s linear infinite"}}):s.jsx(ns,{size:18}),w?"Creating...":"Create Account"]})]}),n&&s.jsx("p",{style:vs,children:n})]})]}),s.jsx("style",{children:`
187
+ */const De=Y("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$n=({logoUrl:t,title:e="Sign In to Your Account",subtitle:r="Welcome back! Please enter your details",footerText:n="Secure authentication powered by Neuctra Authix",primaryColor:o="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,signupUrl:l,onSuccess:h,onError:p})=>{const{baseUrl:u,apiKey:b,appId:C}=ae(),[k,c]=j.useState("login"),[g,y]=j.useState(1),[O,W]=j.useState(!1),[v,F]=j.useState(!1),[D,m]=j.useState(null),[_,w]=j.useState(""),[M,V]=j.useState(""),[U,A]=j.useState({email:"",otp:"",newPassword:"",appId:C}),I=window.innerWidth<768,E=a?"#ffffff":"#111827",N=a?"#a1a1aa":"#6b7280",T=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",P=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",B=async x=>{x.preventDefault(),F(!0),m(null);try{const S=await jn({email:_,password:M,appId:C},{baseUrl:u,apiKey:b});m({type:"success",text:`Welcome ${S.name}`}),h?.(S)}catch(S){const H=S.message||"Login failed";m({type:"error",text:H}),p?.(S)}finally{F(!1)}},q=x=>{A({...U,[x.target.name]:x.target.value})},f=async x=>{x.preventDefault(),F(!0),m(null);try{const S=await $.post(`${u}/users/forgot-password`,{email:U.email,appId:C},{headers:{"x-api-key":b}});S.data.success?(y(2),m({type:"success",text:"OTP sent to your email"})):m({type:"error",text:S.data.message||"Failed to send OTP"})}catch(S){m({type:"error",text:S.response?.data?.message||"Something went wrong"})}finally{F(!1)}},R=async x=>{x.preventDefault(),F(!0),m(null);try{const S=await $.post(`${u}/users/reset-password`,U,{headers:{"x-api-key":b}});S.data.success?(m({type:"success",text:"Password reset successfully!"}),y(1),A({email:"",otp:"",newPassword:"",appId:C}),c("login")):m({type:"error",text:S.data.message||"Reset failed"})}catch(S){m({type:"error",text:S.response?.data?.message||"Something went wrong"})}finally{F(!1)}},L={width:"100%",padding:I?"14px 14px 14px 44px":"16px 16px 16px 44px",backgroundColor:T,border:`1px solid ${P}`,borderRadius:"12px",color:E,fontSize:"15px",outline:"none",transition:"all 0.2s ease"};return s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:s.jsxs("div",{style:{minWidth:I?"320px":"340px",maxWidth:"390px",width:"100%",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:I?"30px 24px":"32px 28px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"20px"},children:[t?s.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}}):s.jsx(fe,{size:40,color:o,style:{marginBottom:"10px"}}),s.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:E,margin:0},children:k==="login"?e:g===1?"Forgot Password":"Reset Password"}),s.jsx("p",{style:{fontSize:"14px",color:N,margin:"6px 0 0 0"},children:k==="login"?r:"Follow the steps to reset your password"})]}),k==="login"&&s.jsxs("form",{onSubmit:B,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"login-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(ve,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:N}}),s.jsx("input",{id:"login-email",type:"email",placeholder:"Enter your email",value:_,onChange:x=>w(x.target.value),style:L})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"login-password",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:N}}),s.jsx("input",{id:"login-password",type:O?"text":"password",placeholder:"Enter your password",value:M,onChange:x=>V(x.target.value),style:L}),s.jsx("button",{type:"button",onClick:()=>W(!O),style:{position:"absolute",right:"14px",padding:"4px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:N,cursor:"pointer"},children:O?s.jsx(Ze,{size:20}):s.jsx(Qe,{size:20})})]})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px"},children:[l&&s.jsx("a",{href:l,style:{color:o,textDecoration:"none",fontWeight:500},children:"Create new account"}),s.jsx("button",{type:"button",onClick:()=>c("forgot"),style:{background:"none",border:"none",color:o,fontWeight:500,cursor:"pointer"},children:"Forgot password?"})]}),s.jsx("button",{type:"submit",disabled:v,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontWeight:600},children:v?"Signing In...":"Sign In"})]}),k==="forgot"&&s.jsxs("form",{onSubmit:g===1?f:R,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[g===1?s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"forgot-email",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(ve,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:N}}),s.jsx("input",{id:"forgot-email",type:"email",name:"email",placeholder:"Enter your email",value:U.email,onChange:q,style:L})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[s.jsx("label",{htmlFor:"otp",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"One-Time Password (OTP)"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(_n,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:N}}),s.jsx("input",{id:"otp",type:"text",name:"otp",placeholder:"Enter OTP",value:U.otp,onChange:q,style:L})]})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[s.jsx("label",{htmlFor:"newPassword",style:{fontSize:"14px",fontWeight:500,color:a?"#ffffff":"#000000"},children:"New Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:N}}),s.jsx("input",{id:"newPassword",type:"password",name:"newPassword",placeholder:"Enter new password",value:U.newPassword,onChange:q,style:L})]})]})]}),s.jsx("button",{type:"submit",disabled:v,style:{padding:"12px",background:i,color:"#fff",border:"none",fontSize:"15px",borderRadius:"10px",fontWeight:600},children:v?"Please wait...":g===1?"Send Reset OTP":"Reset Password"}),s.jsx("button",{type:"button",onClick:()=>{c("login"),y(1)},style:{background:"none",border:"none",color:N,marginTop:"6px",cursor:"pointer"},children:"Back to Login"})]}),D&&s.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:D.type==="success"?`${o}15`:"rgba(239,68,68,0.1)",border:D.type==="success"?`1px solid ${o}30`:"1px solid rgba(239,68,68,0.3)",color:D.type==="success"?o:"#ef4444"},children:[D.type==="success"?s.jsx(Ue,{size:20}):s.jsx(ie,{size:20}),s.jsx("span",{children:D.text})]}),s.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:N,marginTop:"20px",padding:"0 4px"},children:["Secure authentication powered by"," ",s.jsx("span",{style:{color:o,fontWeight:600},children:"Neuctra Authix"})]})]})})},Wn=async(t,e)=>{const{name:r,email:n,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p=!0,role:u="user"}=t,{baseUrl:b,apiKey:C}=e;if(!C)throw new Error("API key is required for signup");if(!r||!n||!o||!i)throw new Error("Name, email, password, and appId are required");try{const k=await $.post(`${b}/users/signup`,{name:r,email:n,password:o,appId:i,phone:a,address:l,avatarUrl:h,isActive:p,role:u},{headers:{"Content-Type":"application/json","x-api-key":C}});return k.data?.user&&localStorage.setItem("userInfo",JSON.stringify(k.data.user)),k.data.user}catch(k){const c=k.response?.data?.message||k.message||"Signup failed";if(console.error("Signup API Error:",c),k.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 k.response?.status===404?{success:!1,message:"Invalid or inactive app",status:404}:{success:!1,message:c,status:k.response?.status||500}}},Hn=({logoUrl:t,title:e="Create Your Account",subtitle:r="Join our platform today",footerText:n="Secure authentication powered by Neuctra Authix",primaryColor:o="#00C214",gradient:i="linear-gradient(135deg, #22c55e, #00C214)",darkMode:a=!0,showAvatar:l=!1,loginUrl:h,onSuccess:p,onError:u})=>{const{baseUrl:b,apiKey:C,appId:k}=ae(),c={name:"",email:"",password:"",...l&&{avatarUrl:""}},[g,y]=j.useState(c),[O,W]=j.useState(!1),[v,F]=j.useState(!1),[D,m]=j.useState(null),[_,w]=j.useState({}),M=typeof window<"u"?window.innerWidth<768:!1,V=a?"#ffffff":"#111827",U=a?"#a1a1aa":"#6b7280",A=a?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.02)",I=a?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",E=B=>{const{name:q,value:f}=B.target;y(R=>({...R,[q]:f})),_[q]&&w(R=>({...R,[q]:void 0}))},N=()=>{const B={};return g.name.trim()||(B.name="Name is required"),g.email.trim()?/\S+@\S+\.\S+/.test(g.email)||(B.email="Invalid email address"):B.email="Email is required",g.password?g.password.length<6&&(B.password="Password must be at least 6 characters"):B.password="Password is required",w(B),Object.keys(B).length===0},T=async B=>{if(B.preventDefault(),!!N()){F(!0),m(null);try{const q={...g,appId:k},f=await Wn(q,{baseUrl:b,apiKey:C});m({type:"success",text:"Account created successfully!"}),p&&p(f)}catch(q){const f=q.message||"Signup failed. Please try again.";m({type:"error",text:f}),u&&u(q)}finally{F(!1)}}},P={width:"100%",padding:M?"14px 14px 14px 44px":"16px 16px 16px 44px",backgroundColor:A,border:`1px solid ${I}`,borderRadius:"12px",color:V,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"};return s.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:[s.jsxs("div",{style:{minWidth:M?"320px":"340px",width:"100%",maxWidth:"390px",display:"flex",flexDirection:"column",borderRadius:"10px",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",backgroundColor:a?"#000000":"#ffffff",padding:M?"30px 24px":"32px 28px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"20px"},children:[t?s.jsx("img",{src:t,alt:"Logo",style:{height:"50px",width:"50px",marginBottom:"10px"}}):s.jsx(fe,{size:40,color:o,style:{marginBottom:"10px"}}),s.jsx("h2",{style:{fontSize:"24px",fontWeight:700,color:V,margin:0},children:e}),s.jsx("p",{style:{fontSize:"14px",color:U,margin:"6px 0 0 0"},children:r})]}),l&&g.avatarUrl&&s.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:s.jsx("img",{src:g.avatarUrl,alt:"Avatar Preview",style:{width:"60px",height:"60px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${o}30`},onError:B=>{const q=B.target;q.style.display="none"}})}),s.jsxs("form",{onSubmit:T,style:{display:"flex",flexDirection:"column",gap:"14px"},children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"signup-name",style:{fontSize:"14px",fontWeight:500,color:V},children:"Full Name"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(fe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"signup-name",type:"text",name:"name",placeholder:"Enter your full name",value:g.name,onChange:E,style:{...P,borderColor:_.name?"#ef4444":I}})]}),_.name&&s.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:_.name})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"signup-email",style:{fontSize:"14px",fontWeight:500,color:V},children:"Email Address"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(ve,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"signup-email",type:"email",name:"email",placeholder:"Enter your email address",value:g.email,onChange:E,style:{...P,borderColor:_.email?"#ef4444":I}})]}),_.email&&s.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:_.email})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"signup-password",style:{fontSize:"14px",fontWeight:500,color:V},children:"Password"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(pe,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"signup-password",type:O?"text":"password",name:"password",placeholder:"Create a secure password",value:g.password,onChange:E,style:{...P,borderColor:_.password?"#ef4444":I}}),s.jsx("button",{type:"button",onClick:()=>W(!O),style:{position:"absolute",right:"14px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:U,cursor:"pointer",padding:"4px"},children:O?s.jsx(Ze,{size:20}):s.jsx(Qe,{size:20})})]}),_.password&&s.jsx("span",{style:{color:"#ef4444",fontSize:"12px",marginTop:"2px"},children:_.password})]}),l&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[s.jsx("label",{htmlFor:"signup-avatar",style:{fontSize:"14px",fontWeight:500,color:V},children:"Avatar URL (Optional)"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(qt,{size:20,style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:U}}),s.jsx("input",{id:"signup-avatar",type:"url",name:"avatarUrl",placeholder:"Paste your avatar image URL",value:g.avatarUrl||"",onChange:E,style:P})]})]}),s.jsx("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"13px",marginTop:"6px"},children:h&&s.jsx("a",{href:h,style:{color:o,textDecoration:"none",fontWeight:500},children:"Already have an account?"})}),s.jsx("button",{type:"submit",disabled:v,style:{padding:"12px",background:i,color:"#fff",border:"none",borderRadius:"10px",fontWeight:600,cursor:v?"not-allowed":"pointer",opacity:v?.7:1,marginTop:"8px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:v?s.jsxs(s.Fragment,{children:[s.jsx(Nn,{size:18,style:{animation:"spin 1s linear infinite"}}),"Creating Account..."]}):"Create Account"})]}),D&&s.jsxs("div",{style:{marginTop:"16px",padding:"12px",borderRadius:"12px",fontSize:"14px",display:"flex",alignItems:"center",gap:"10px",backgroundColor:D.type==="success"?`${o}15`:"rgba(239,68,68,0.1)",border:D.type==="success"?`1px solid ${o}30`:"1px solid rgba(239,68,68,0.3)",color:D.type==="success"?o:"#ef4444"},children:[D.type==="success"?s.jsx(Ue,{size:20}):s.jsx(ie,{size:20}),s.jsx("span",{children:D.text})]}),s.jsxs("div",{style:{textAlign:"center",fontSize:"12px",color:U,marginTop:"20px",padding:"0 4px"},children:["Secure authentication powered by"," ",s.jsx("span",{style:{color:o,fontWeight:600},children:"Neuctra Authix"})]})]}),s.jsx("style",{children:`
193
188
  @keyframes spin {
194
189
  from { transform: rotate(0deg); }
195
190
  to { transform: rotate(360deg); }
196
191
  }
197
-
198
- @media (max-width: 480px) {
199
- input, select {
200
- font-size: 16px !important;
201
- }
202
- }
203
- `})]})},cs=({isOpen:t,onClose:e,onUpdate:r,colors:n})=>{const[o,i]=k.useState(""),[a,c]=k.useState(!1),[x,p]=k.useState(!1),[u,y]=k.useState({isValid:!1,message:"",type:null});if(k.useEffect(()=>{const l=()=>{p(window.innerWidth<640)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),k.useEffect(()=>{if(!o.trim()){y({isValid:!1,message:"",type:null});return}try{const l=new URL(o),m=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(l.pathname);y(m?{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]),!t)return null;const S=async()=>{if(!(!o||!u.isValid)){c(!0);try{await r(o)&&(i(""),e())}finally{c(!1)}}},b=l=>{l.target===l.currentTarget&&e()};return s.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:b,children:[s.jsxs("div",{style:{backgroundColor:n.surface,border:`1px solid ${n.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:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.jsx("div",{style:{width:"44px",height:"44px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.accent}20, ${n.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:n.accent,flexShrink:0},children:s.jsx(ot,{size:22})}),s.jsx("div",{children:s.jsx("h3",{style:{color:n.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),s.jsx("button",{onClick:e,"aria-label":"Close avatar modal",style:{background:"transparent",border:"none",color:n.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:l=>{l.currentTarget.style.backgroundColor=n.border,l.currentTarget.style.color=n.textPrimary},onMouseOut:l=>{l.currentTarget.style.backgroundColor="transparent",l.currentTarget.style.color=n.textTertiary},children:s.jsx(me,{size:20})})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:n.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[s.jsx(es,{size:16}),"Avatar URL"]}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("input",{type:"url",id:"avatar-url",placeholder:"https://example.com/your-avatar.jpg",value:o,onChange:l=>i(l.target.value),style:{width:"100%",padding:"14px 16px",paddingLeft:"44px",borderRadius:"12px",border:`1.5px solid ${u.type==="error"?n.error:u.type==="success"?n.success:n.border}`,backgroundColor:"transparent",color:n.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:l=>{l.target.style.borderColor=n.accent,l.target.style.boxShadow=`0 0 0 3px ${n.accent}20`},onBlur:l=>{l.target.style.borderColor=u.type==="error"?n.error:u.type==="success"?n.success:n.border,l.target.style.boxShadow="none"},disabled:a}),s.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:n.textTertiary},children:s.jsx(rr,{size:18})})]}),u.message&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:u.type==="success"?n.success:u.type==="error"?n.error:n.textTertiary},children:[u.type==="success"&&s.jsx(Ve,{size:14}),u.type==="error"&&s.jsx(he,{size:14}),u.type==="warning"&&s.jsx(he,{size:14}),u.message]})]}),o&&u.type==="success"&&s.jsxs("div",{style:{padding:"16px",backgroundColor:`${n.success}10`,border:`1px solid ${n.success}20`,borderRadius:"12px",textAlign:"center"},children:[s.jsx("p",{style:{color:n.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),s.jsx("img",{src:o,alt:"Avatar preview",style:{width:"80px",height:"80px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${n.success}40`,margin:"0 auto"},onError:l=>{l.currentTarget.style.display="none"}})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:x?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[s.jsx("button",{onClick:e,disabled:a,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${n.border}`,background:"transparent",color:n.textPrimary,fontSize:"14px",fontWeight:500,cursor:a?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"100%":"120px",opacity:a?.6:1,transition:"all 0.2s ease"},onMouseOver:l=>{a||(l.currentTarget.style.backgroundColor=n.border,l.currentTarget.style.transform="translateY(-1px)")},onMouseOut:l=>{a||(l.currentTarget.style.backgroundColor="transparent",l.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),s.jsx("button",{onClick:S,disabled:a||!u.isValid,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${n.accent}, ${n.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:a||!u.isValid?"not-allowed":"pointer",flex:x?"none":1,minWidth:x?"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 ${n.accent}40`},onMouseOver:l=>{!a&&u.isValid&&(l.currentTarget.style.transform="translateY(-1px)",l.currentTarget.style.boxShadow=`0 6px 20px ${n.accent}60`)},onMouseOut:l=>{!a&&u.isValid&&(l.currentTarget.style.transform="translateY(0)",l.currentTarget.style.boxShadow=`0 4px 12px ${n.accent}40`)},children:a?s.jsxs(s.Fragment,{children:[s.jsx(ge,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ot,{size:16}),"Update Avatar"]})})]})]}),s.jsx("style",{children:`
192
+ `})]})},qn=({isOpen:t,onClose:e,onUpdate:r,colors:n})=>{const[o,i]=j.useState(""),[a,l]=j.useState(!1),[h,p]=j.useState(!1),[u,b]=j.useState({isValid:!1,message:"",type:null});if(j.useEffect(()=>{const c=()=>{p(window.innerWidth<640)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]),j.useEffect(()=>{if(!o.trim()){b({isValid:!1,message:"",type:null});return}try{const c=new URL(o),g=/\.(jpg|jpeg|png|gif|webp|svg)$/i.test(c.pathname);b(g?{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]),!t)return null;const C=async()=>{if(!(!o||!u.isValid)){l(!0);try{await r(o)&&(i(""),e())}finally{l(!1)}}},k=c=>{c.target===c.currentTarget&&e()};return s.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:k,children:[s.jsxs("div",{style:{backgroundColor:n.surface,border:`1px solid ${n.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:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.jsx("div",{style:{width:"44px",height:"44px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.accent}20, ${n.accent}40)`,display:"flex",alignItems:"center",justifyContent:"center",color:n.accent,flexShrink:0},children:s.jsx(Xe,{size:22})}),s.jsx("div",{children:s.jsx("h3",{style:{color:n.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Update Avatar"})})]}),s.jsx("button",{onClick:e,"aria-label":"Close avatar modal",style:{background:"transparent",border:"none",color:n.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=n.border,c.currentTarget.style.color=n.textPrimary},onMouseOut:c=>{c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.color=n.textTertiary},children:s.jsx(De,{size:20})})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"avatar-url",style:{display:"flex",marginBottom:"8px",color:n.textPrimary,fontSize:"14px",fontWeight:500,alignItems:"center",gap:"6px"},children:[s.jsx(An,{size:16}),"Avatar URL"]}),s.jsxs("div",{style:{position:"relative"},children:[s.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"?n.error:u.type==="success"?n.success:n.border}`,backgroundColor:"transparent",color:n.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=n.accent,c.target.style.boxShadow=`0 0 0 3px ${n.accent}20`},onBlur:c=>{c.target.style.borderColor=u.type==="error"?n.error:u.type==="success"?n.success:n.border,c.target.style.boxShadow="none"},disabled:a}),s.jsx("div",{style:{position:"absolute",left:"16px",top:"50%",transform:"translateY(-50%)",color:n.textTertiary},children:s.jsx(qt,{size:18})})]}),u.message&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px",fontSize:"13px",color:u.type==="success"?n.success:u.type==="error"?n.error:n.textTertiary},children:[u.type==="success"&&s.jsx(Ue,{size:14}),u.type==="error"&&s.jsx(ie,{size:14}),u.type==="warning"&&s.jsx(ie,{size:14}),u.message]})]}),o&&u.type==="success"&&s.jsxs("div",{style:{padding:"16px",backgroundColor:`${n.success}10`,border:`1px solid ${n.success}20`,borderRadius:"12px",textAlign:"center"},children:[s.jsx("p",{style:{color:n.textSecondary,fontSize:"13px",fontWeight:500,margin:"0 0 12px 0"},children:"Preview"}),s.jsx("img",{src:o,alt:"Avatar preview",style:{width:"80px",height:"80px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${n.success}40`,margin:"0 auto"},onError:c=>{c.currentTarget.style.display="none"}})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:h?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch",marginTop:"24px"},children:[s.jsx("button",{onClick:e,disabled:a,style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${n.border}`,background:"transparent",color:n.textPrimary,fontSize:"14px",fontWeight:500,cursor:a?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"100%":"120px",opacity:a?.6:1,transition:"all 0.2s ease"},onMouseOver:c=>{a||(c.currentTarget.style.backgroundColor=n.border,c.currentTarget.style.transform="translateY(-1px)")},onMouseOut:c=>{a||(c.currentTarget.style.backgroundColor="transparent",c.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),s.jsx("button",{onClick:C,disabled:a||!u.isValid,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${n.accent}, ${n.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:a||!u.isValid?"not-allowed":"pointer",flex:h?"none":1,minWidth:h?"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 ${n.accent}40`},onMouseOver:c=>{!a&&u.isValid&&(c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=`0 6px 20px ${n.accent}60`)},onMouseOut:c=>{!a&&u.isValid&&(c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow=`0 4px 12px ${n.accent}40`)},children:a?s.jsxs(s.Fragment,{children:[s.jsx(ue,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Xe,{size:16}),"Update Avatar"]})})]})]}),s.jsx("style",{children:`
204
193
  @keyframes modalSlideIn {
205
194
  from {
206
195
  opacity: 0;
@@ -248,7 +237,7 @@ React keys must be passed directly to JSX without using spread:
248
237
  transition: none !important;
249
238
  }
250
239
  }
251
- `})]})},ds=({isOpen:t,onClose:e,onSuccess:r,onError:n,userId:o,colors:i})=>{const{baseUrl:a,apiKey:c,appId:x}=xe(),[p,u]=k.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[y,S]=k.useState({}),[b,l]=k.useState(!1),[m,g]=k.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[_,$]=k.useState(!1);if(k.useEffect(()=>{const w=()=>{$(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!t)return null;const R=w=>{const{name:L,value:q}=w.target;u(j=>({...j,[L]:q})),y[L]&&S(j=>({...j,[L]:""}))},E=w=>{g(L=>({...L,[w]:!L[w]}))},z=()=>{const w={};return p.currentPassword||(w.currentPassword="Current password is required"),p.newPassword?p.newPassword.length<6&&(w.newPassword="Password must be at least 6 characters"):w.newPassword="New password is required",p.newPassword!==p.confirmPassword&&(w.confirmPassword="Passwords do not match"),S(w),Object.keys(w).length===0},h=async w=>{if(w.preventDefault(),!!z()){l(!0);try{const{data:L}=await D.put(`${a}/users/change-password/${o}`,{appId:x,currentPassword:p.currentPassword,newPassword:p.newPassword},{headers:{"x-api-key":c}});L.success?(r(L.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),e()):n(L.message||"Failed to update password")}catch(L){n(L.response?.data?.message||"Something went wrong")}finally{l(!1)}}},I=[{field:"currentPassword",label:"Current Password",icon:s.jsx(nr,{size:18})},{field:"newPassword",label:"New Password",icon:s.jsx(ye,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:s.jsx(ye,{size:18})}];return s.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:s.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:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px",gap:"12px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.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:s.jsx(ye,{size:20})}),s.jsx("div",{children:s.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"18px",fontWeight:600,lineHeight:"1.4"},children:"Change Password"})})]}),s.jsx("button",{onClick:e,"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:s.jsx(me,{size:20})})]}),s.jsxs("form",{onSubmit:h,children:[I.map(({field:w,label:L,icon:q})=>s.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[s.jsx("label",{htmlFor:w,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:L}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:i.textTertiary,zIndex:2},children:q}),s.jsx("input",{type:m[w]?"text":"password",id:w,name:w,placeholder:`Enter ${L.toLowerCase()}`,value:p[w],onChange:R,style:{width:"100%",padding:"14px 48px 14px 44px",borderRadius:"10px",border:`1.5px solid ${y[w]?i.error:i.border}`,backgroundColor:"transparent",color:i.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:j=>{j.target.style.borderColor=i.accent,j.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:j=>{j.target.style.borderColor=y[w]?i.error:i.border,j.target.style.boxShadow="none"}}),s.jsx("button",{type:"button",onClick:()=>E(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:j=>{j.currentTarget.style.backgroundColor=i.border,j.currentTarget.style.color=i.textPrimary},onMouseOut:j=>{j.currentTarget.style.backgroundColor="transparent",j.currentTarget.style.color=i.textTertiary},children:m[w]?s.jsx(it,{size:18}):s.jsx(lt,{size:18})})]}),y[w]&&s.jsxs("div",{style:{fontSize:"13px",color:i.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[s.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),y[w]]})]},w)),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:_?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{type:"button",onClick:e,disabled:b,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:b?"not-allowed":"pointer",flex:_?"none":1,minWidth:_?"100%":"120px",opacity:b?.6:1,transition:"all 0.2s ease"},onMouseOver:w=>{b||(w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.transform="translateY(-1px)")},onMouseOut:w=>{b||(w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),s.jsx("button",{type:"submit",disabled:b,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:b?"not-allowed":"pointer",flex:_?"none":1,minWidth:_?"100%":"140px",opacity:b?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:b?"none":`0 4px 12px ${i.accent}40`},onMouseOver:w=>{b||(w.currentTarget.style.transform="translateY(-1px)",w.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:w=>{b||(w.currentTarget.style.transform="translateY(0)",w.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:b?s.jsxs(s.Fragment,{children:[s.jsx(ge,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),s.jsx("style",{children:`
240
+ `})]})},Yn=({isOpen:t,onClose:e,onSuccess:r,onError:n,userId:o,colors:i})=>{const{baseUrl:a,apiKey:l,appId:h}=ae(),[p,u]=j.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[b,C]=j.useState({}),[k,c]=j.useState(!1),[g,y]=j.useState({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[O,W]=j.useState(!1);if(j.useEffect(()=>{const w=()=>{W(window.innerWidth<640)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),!t)return null;const v=w=>{const{name:M,value:V}=w.target;u(U=>({...U,[M]:V})),b[M]&&C(U=>({...U,[M]:""}))},F=w=>{y(M=>({...M,[w]:!M[w]}))},D=()=>{const w={};return p.currentPassword||(w.currentPassword="Current password is required"),p.newPassword?p.newPassword.length<6&&(w.newPassword="Password must be at least 6 characters"):w.newPassword="New password is required",p.newPassword!==p.confirmPassword&&(w.confirmPassword="Passwords do not match"),C(w),Object.keys(w).length===0},m=async w=>{if(w.preventDefault(),!!D()){c(!0);try{const{data:M}=await $.put(`${a}/users/change-password/${o}`,{appId:h,currentPassword:p.currentPassword,newPassword:p.newPassword},{headers:{"x-api-key":l}});M.success?(r(M.message||"Password updated successfully"),u({currentPassword:"",newPassword:"",confirmPassword:""}),e()):n(M.message||"Failed to update password")}catch(M){n(M.response?.data?.message||"Something went wrong")}finally{c(!1)}}},_=[{field:"currentPassword",label:"Current Password",icon:s.jsx(Yt,{size:18})},{field:"newPassword",label:"New Password",icon:s.jsx(pe,{size:18})},{field:"confirmPassword",label:"Confirm Password",icon:s.jsx(pe,{size:18})}];return s.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:s.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:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px",gap:"12px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.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:s.jsx(pe,{size:20})}),s.jsx("div",{children:s.jsx("h3",{style:{color:i.textPrimary,margin:0,fontSize:"18px",fontWeight:600,lineHeight:"1.4"},children:"Change Password"})})]}),s.jsx("button",{onClick:e,"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:s.jsx(De,{size:20})})]}),s.jsxs("form",{onSubmit:m,children:[_.map(({field:w,label:M,icon:V})=>s.jsxs("div",{style:{marginBottom:"20px",position:"relative"},children:[s.jsx("label",{htmlFor:w,style:{display:"block",marginBottom:"8px",color:i.textPrimary,fontSize:"14px",fontWeight:500,lineHeight:"1.4"},children:M}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:i.textTertiary,zIndex:2},children:V}),s.jsx("input",{type:g[w]?"text":"password",id:w,name:w,placeholder:`Enter ${M.toLowerCase()}`,value:p[w],onChange:v,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:U=>{U.target.style.borderColor=i.accent,U.target.style.boxShadow=`0 0 0 3px ${i.accent}20`},onBlur:U=>{U.target.style.borderColor=b[w]?i.error:i.border,U.target.style.boxShadow="none"}}),s.jsx("button",{type:"button",onClick:()=>F(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:U=>{U.currentTarget.style.backgroundColor=i.border,U.currentTarget.style.color=i.textPrimary},onMouseOut:U=>{U.currentTarget.style.backgroundColor="transparent",U.currentTarget.style.color=i.textTertiary},children:g[w]?s.jsx(Ze,{size:18}):s.jsx(Qe,{size:18})})]}),b[w]&&s.jsxs("div",{style:{fontSize:"13px",color:i.error,marginTop:"6px",display:"flex",alignItems:"center",gap:"6px"},children:[s.jsx("span",{style:{fontSize:"16px"},children:"⚠"}),b[w]]})]},w)),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:O?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{type:"button",onClick:e,disabled:k,style:{padding:"14px 24px",borderRadius:"10px",border:`1.5px solid ${i.border}`,background:"transparent",color:i.textPrimary,fontSize:"14px",fontWeight:500,cursor:k?"not-allowed":"pointer",flex:O?"none":1,minWidth:O?"100%":"120px",opacity:k?.6:1,transition:"all 0.2s ease"},onMouseOver:w=>{k||(w.currentTarget.style.backgroundColor=i.border,w.currentTarget.style.transform="translateY(-1px)")},onMouseOut:w=>{k||(w.currentTarget.style.backgroundColor="transparent",w.currentTarget.style.transform="translateY(0)")},children:"Cancel"}),s.jsx("button",{type:"submit",disabled:k,style:{padding:"14px 24px",borderRadius:"10px",border:"none",background:`linear-gradient(135deg, ${i.accent}, ${i.accent}E6)`,color:"#fff",fontSize:"14px",fontWeight:600,cursor:k?"not-allowed":"pointer",flex:O?"none":1,minWidth:O?"100%":"140px",opacity:k?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:k?"none":`0 4px 12px ${i.accent}40`},onMouseOver:w=>{k||(w.currentTarget.style.transform="translateY(-1px)",w.currentTarget.style.boxShadow=`0 6px 20px ${i.accent}60`)},onMouseOut:w=>{k||(w.currentTarget.style.transform="translateY(0)",w.currentTarget.style.boxShadow=`0 4px 12px ${i.accent}40`)},children:k?s.jsxs(s.Fragment,{children:[s.jsx(ue,{size:16,style:{animation:"spin 1s linear infinite"}}),"Updating..."]}):"Update Password"})]})]}),s.jsx("style",{children:`
252
241
  @keyframes spin {
253
242
  from { transform: rotate(0deg); }
254
243
  to { transform: rotate(360deg); }
@@ -286,7 +275,7 @@ React keys must be passed directly to JSX without using spread:
286
275
  padding: 16px 12px;
287
276
  }
288
277
  }
289
- `})]})})},us=({isOpen:t,onClose:e,onSuccess:r,onError:n,userId:o,token:i,colors:a})=>{const{baseUrl:c,apiKey:x,appId:p}=xe(),[u,y]=k.useState(!1),[S,b]=k.useState(""),[l,m]=k.useState("warning"),[g,_]=k.useState(!1);if(k.useEffect(()=>{const h=()=>{_(window.innerWidth<640)};return h(),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[]),!t)return null;const $=async()=>{y(!0),m("processing");try{const{data:h}=await D.delete(`${c}/users/delete/${o}`,{data:{appId:p},headers:{"x-api-key":x}});h.success?(r(h.message||"Account deleted successfully"),m("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(n(h.message||"Failed to delete account"),m("warning"))}catch(h){n(h.response?.data?.message||"Something went wrong"),m("warning")}finally{y(!1)}},R=S.toLowerCase()==="delete my account",E=h=>{h.target===h.currentTarget&&l!=="processing"&&l!=="success"&&e()},z=()=>{switch(l){case"warning":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.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:s.jsx(Ye,{size:20})}),s.jsx("div",{children:s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),s.jsx("button",{onClick:e,"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:h=>{h.currentTarget.style.backgroundColor=a.border,h.currentTarget.style.color=a.textPrimary},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.color=a.textTertiary},children:s.jsx(me,{size:20})})]}),s.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[s.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:s.jsx(ir,{size:24})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:s.jsx(Gn,{size:16}),text:"All your data will be permanently deleted"},{icon:s.jsx(ct,{size:16}),text:"This action cannot be reversed"},{icon:s.jsx(sr,{size:16}),text:"You will lose access to all services"}].map((h,I)=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[s.jsx("div",{style:{color:a.error,flexShrink:0},children:h.icon}),s.jsx("span",{children:h.text})]},I))})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{onClick: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:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:h=>{h.currentTarget.style.backgroundColor=a.border,h.currentTarget.style.transform="translateY(-1px)"},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.transform="translateY(0)"},children:"Cancel"}),s.jsxs("button",{onClick:()=>m("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:g?"none":1,minWidth:g?"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:h=>{h.currentTarget.style.transform="translateY(-1px)",h.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)"},onMouseOut:h=>{h.currentTarget.style.transform="translateY(0)",h.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)"},children:[s.jsx(Ye,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(ir,{size:24})}),s.jsx("div",{style:{flex:1},children:s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),s.jsxs("div",{style:{marginBottom:"24px"},children:[s.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",s.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),s.jsx("input",{type:"text",value:S,onChange:h=>b(h.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${R?a.success:a.error}`,backgroundColor:"transparent",color:a.textPrimary,fontSize:"15px",outline:"none",transition:"all 0.2s ease",boxSizing:"border-box"},onFocus:h=>{h.target.style.boxShadow=`0 0 0 3px ${a.accent}20`},onBlur:h=>{h.target.style.boxShadow="none"},autoFocus:!0}),R&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[s.jsx(at,{size:16}),s.jsx("span",{children:"Confirmation accepted"})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:g?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{onClick:()=>{m("warning"),b("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:g?"none":1,minWidth:g?"100%":"120px",transition:"all 0.2s ease"},onMouseOver:h=>{h.currentTarget.style.backgroundColor=a.border,h.currentTarget.style.transform="translateY(-1px)"},onMouseOut:h=>{h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.transform="translateY(0)"},children:"Go Back"}),s.jsxs("button",{onClick:$,disabled:!R||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!R||u?"not-allowed":"pointer",flex:g?"none":1,minWidth:g?"100%":"140px",opacity:!R||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!R||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:h=>{R&&!u&&(h.currentTarget.style.transform="translateY(-1px)",h.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:h=>{R&&!u&&(h.currentTarget.style.transform="translateY(0)",h.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[s.jsx(Ye,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(ge,{size:20,style:{animation:"spin 1s linear infinite"}})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),s.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),s.jsx("div",{style:{marginBottom:"20px"},children:s.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((h,I)=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",transition:"all 0.2s ease",backgroundColor:h.active?`${a.accent}10`:"transparent"},children:[s.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:h.active?a.accent:a.textTertiary,transition:"all 0.3s ease",boxShadow:h.active?`0 0 0 4px ${a.accent}20`:"none"}}),s.jsx("span",{style:{fontSize:"14px",color:h.active?a.textPrimary:a.textSecondary,fontWeight:h.active?500:400},children:h.text})]},I))})}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[s.jsx(os,{size:18,style:{color:a.accent,flexShrink:0}}),s.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(at,{size:20})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),s.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),s.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[s.jsx(at,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),s.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),s.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."})]}),s.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:[s.jsx(ge,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),s.jsx("span",{children:"Redirecting to login page..."})]})]})}};return s.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4,animation:"fadeIn 0.3s ease-out"},onClick:E,children:[s.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:z()}),s.jsx("style",{children:`
278
+ `})]})})},Vn=({isOpen:t,onClose:e,onSuccess:r,onError:n,userId:o,token:i,colors:a})=>{const{baseUrl:l,apiKey:h,appId:p}=ae(),[u,b]=j.useState(!1),[C,k]=j.useState(""),[c,g]=j.useState("warning"),[y,O]=j.useState(!1);if(j.useEffect(()=>{const m=()=>{O(window.innerWidth<640)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),!t)return null;const W=async()=>{b(!0),g("processing");try{const{data:m}=await $.delete(`${l}/users/delete/${o}`,{data:{appId:p},headers:{"x-api-key":h}});m.success?(r(m.message||"Account deleted successfully"),g("success"),setTimeout(()=>{localStorage.removeItem("userInfo"),localStorage.removeItem("userToken"),window.location.href="/"},2e3)):(n(m.message||"Failed to delete account"),g("warning"))}catch(m){n(m.response?.data?.message||"Something went wrong"),g("warning")}finally{b(!1)}},v=C.toLowerCase()==="delete my account",F=m=>{m.target===m.currentTarget&&c!=="processing"&&c!=="success"&&e()},D=()=>{switch(c){case"warning":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"24px",gap:"16px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1},children:[s.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:s.jsx(Fe,{size:20})}),s.jsx("div",{children:s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Delete Account"})})]}),s.jsx("button",{onClick:e,"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:s.jsx(De,{size:20})})]}),s.jsxs("div",{style:{display:"flex",gap:"16px",padding:"20px",background:`${a.error}15`,border:`1px solid ${a.error}30`,borderRadius:"12px",marginBottom:"20px"},children:[s.jsx("div",{style:{color:a.error,flexShrink:0,display:"flex",alignItems:"flex-start"},children:s.jsx(Jt,{size:24})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h4",{style:{color:a.textPrimary,margin:"0 0 12px 0",fontSize:"16px",fontWeight:600},children:"Before you proceed..."}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[{icon:s.jsx(In,{size:16}),text:"All your data will be permanently deleted"},{icon:s.jsx(Bn,{size:16}),text:"This action cannot be reversed"},{icon:s.jsx(Vt,{size:16}),text:"You will lose access to all services"}].map((m,_)=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"14px",color:a.textSecondary},children:[s.jsx("div",{style:{color:a.error,flexShrink:0},children:m.icon}),s.jsx("span",{children:m.text})]},_))})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:y?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{onClick: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:y?"none":1,minWidth:y?"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"}),s.jsxs("button",{onClick:()=>g("confirmation"),style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:"pointer",flex:y?"none":1,minWidth:y?"100%":"140px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver: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:[s.jsx(Fe,{size:16}),"Continue to Delete"]})]})]});case"confirmation":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(Jt,{size:24})}),s.jsx("div",{style:{flex:1},children:s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Confirm Deletion"})})]}),s.jsxs("div",{style:{marginBottom:"24px"},children:[s.jsxs("p",{style:{color:a.textSecondary,marginBottom:"16px",fontSize:"14px",lineHeight:"1.5"},children:["Type"," ",s.jsx("strong",{style:{color:a.textPrimary},children:'"delete my account"'})," ","to confirm:"]}),s.jsx("input",{type:"text",value:C,onChange:m=>k(m.target.value),placeholder:"delete my account",style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`2px solid ${v?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}),v&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"10px",color:a.success,fontSize:"14px",fontWeight:500},children:[s.jsx(Ge,{size:16}),s.jsx("span",{children:"Confirmation accepted"})]})]}),s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:y?"column-reverse":"row",justifyContent:"flex-end",alignItems:"stretch"},children:[s.jsx("button",{onClick:()=>{g("warning"),k("")},style:{padding:"10px 24px",borderRadius:"10px",border:`1.5px solid ${a.border}`,background:"transparent",color:a.textPrimary,fontSize:"14px",fontWeight:500,cursor:"pointer",flex:y?"none":1,minWidth:y?"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"}),s.jsxs("button",{onClick:W,disabled:!v||u,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"linear-gradient(135deg, #ef4444, #dc2626)",color:"white",fontSize:"14px",fontWeight:600,cursor:!v||u?"not-allowed":"pointer",flex:y?"none":1,minWidth:y?"100%":"140px",opacity:!v||u?.6:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease",boxShadow:!v||u?"none":"0 4px 12px rgba(239, 68, 68, 0.4)"},onMouseOver:m=>{v&&!u&&(m.currentTarget.style.transform="translateY(-1px)",m.currentTarget.style.boxShadow="0 6px 20px rgba(239, 68, 68, 0.5)")},onMouseOut:m=>{v&&!u&&(m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.4)")},children:[s.jsx(Fe,{size:16}),"Yes, Delete My Account"]})]})]});case"processing":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(ue,{size:20,style:{animation:"spin 1s linear infinite"}})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Deleting Account"}),s.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Please wait while we process your request"})]})]}),s.jsx("div",{style:{marginBottom:"20px"},children:s.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,_)=>s.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:[s.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"}}),s.jsx("span",{style:{fontSize:"14px",color:m.active?a.textPrimary:a.textSecondary,fontWeight:m.active?500:400},children:m.text})]},_))})}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px",background:`${a.accent}10`,borderRadius:"10px",fontSize:"14px",color:a.textSecondary},children:[s.jsx(Mn,{size:18,style:{color:a.accent,flexShrink:0}}),s.jsx("span",{children:"You will be redirected to the login page shortly"})]})]});case"success":return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px"},children:[s.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:s.jsx(Ge,{size:20})}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{style:{color:a.textPrimary,margin:0,fontSize:"20px",fontWeight:700,lineHeight:"1.3"},children:"Account Deleted"}),s.jsx("p",{style:{color:a.textTertiary,margin:"4px 0 0 0",fontSize:"14px",lineHeight:"1.4"},children:"Your account has been successfully deleted"})]})]}),s.jsxs("div",{style:{textAlign:"center",padding:"20px",background:`${a.success}10`,border:`1px solid ${a.success}20`,borderRadius:"12px",marginBottom:"24px"},children:[s.jsx(Ge,{size:48,style:{color:a.success,marginBottom:"12px",display:"block",margin:"0 auto 12px auto"}}),s.jsx("p",{style:{color:a.textPrimary,fontSize:"16px",fontWeight:600,margin:"0 0 8px 0"},children:"Goodbye!"}),s.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."})]}),s.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:[s.jsx(ue,{size:16,style:{animation:"spin 1s linear infinite",color:a.accent}}),s.jsx("span",{children:"Redirecting to login page..."})]})]})}};return s.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:F,children:[s.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:D()}),s.jsx("style",{children:`
290
279
  @keyframes fadeIn {
291
280
  from { opacity: 0; }
292
281
  to { opacity: 1; }
@@ -340,7 +329,7 @@ React keys must be passed directly to JSX without using spread:
340
329
  animation: none !important;
341
330
  }
342
331
  }
343
- `})]})},ps=({token:t,user:e=null,darkMode:r=!0,primaryColor:n="#00C214"})=>{const{baseUrl:o,apiKey:i,appId:a}=xe(),[c,x]=k.useState(e),[p,u]=k.useState(!0),[y,S]=k.useState(!1),[b,l]=k.useState(!1),[m,g]=k.useState(!1),[_,$]=k.useState(!1),[R,E]=k.useState(!1),[z,h]=k.useState(null),I=(T,v)=>{h({type:T,message:v}),setTimeout(()=>h(null),3e3)},w=async T=>{if(!c)return!1;try{const v={...c,avatarUrl:T},{data:U}=await D.put(`${o}/users/update/${c.id}`,v,{headers:{"x-api-key":i}});return U.success?(x(v),localStorage.setItem("userInfo",JSON.stringify({...v,token:t})),I("success","Avatar updated successfully!"),!0):(I("error",U.message||"Failed to update avatar"),!1)}catch(v){return console.error("Avatar update error:",v),I("error","Failed to update avatar"),!1}},L=async()=>{if(c){l(!0);try{const{data:T}=await D.put(`${o}/users/update/${c.id}`,c,{headers:{"x-api-key":i}});T.success?(x(T.user),S(!1),localStorage.setItem("userInfo",JSON.stringify({...T.user,token:t})),I("success","Profile updated successfully")):I("error",T.message)}catch(T){console.error(T),I("error","Update failed")}finally{l(!1)}}};k.useEffect(()=>{if(e)x(e),u(!1);else{const T=localStorage.getItem("userInfo");T&&x(JSON.parse(T)),u(!1)}},[e]);const q=(T,v)=>{let U=parseInt(T.replace("#",""),16),F=(U>>16)+v,J=(U>>8&255)+v,W=(U&255)+v;return F=Math.min(255,Math.max(0,F)),J=Math.min(255,Math.max(0,J)),W=Math.min(255,Math.max(0,W)),`#${(W|J<<8|F<<16).toString(16).padStart(6,"0")}`},j=r?{background:"#000000",surface:"#18181b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:n,accentHover:q(n,-15),success:"#10b981",error:"#ef4444",border:"#27272a"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:n,accentHover:q(n,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7"};if(p)return s.jsx("div",{className:"profile-container",style:{color:j.textPrimary},children:s.jsxs("div",{className:"loading-container",children:[s.jsx(ge,{size:40,color:j.accent,className:"spinner","aria-hidden":"true"}),s.jsx("p",{style:{color:j.textTertiary},children:"Loading your profile..."})]})});if(!c)return s.jsx("div",{className:"profile-container",style:{color:j.textPrimary},children:s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",textAlign:"center"},children:[s.jsx(he,{size:40,color:j.error,"aria-hidden":"true"}),s.jsx("p",{style:{color:j.textTertiary},children:"No profile found. Please log in again."})]})});const H=[{label:"Full Name",value:c.name,name:"name",type:"text",icon:de},{label:"Email Address",value:c.email,name:"email",type:"email",icon:Re},{label:"Phone Number",value:c.phone||"Not set",name:"phone",type:"tel",icon:ar},{label:"Address",value:c.address||"Not provided",name:"address",type:"text",icon:or}];return s.jsxs("div",{className:"profile-container",style:{color:j.textPrimary},children:[z&&s.jsxs("div",{className:`notification ${z.type}`,style:{zIndex:1e4,...z.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:[z.type==="success"?s.jsx(Ve,{size:20,"aria-hidden":"true"}):s.jsx(he,{size:20,"aria-hidden":"true"}),z.message]}),s.jsx("div",{className:"profile-main-container",children:s.jsxs("div",{className:"profile-grid",children:[s.jsxs("aside",{className:"profile-sidebar",children:[s.jsxs("section",{className:"profile-card avatar-section",style:{backgroundColor:j.surface},children:[s.jsxs("div",{className:"avatar-container",children:[s.jsx("img",{src:c.avatarUrl||`https://api.dicebear.com/9.x/glass/svg?seed=${encodeURIComponent(c.name)}`,alt:`Profile avatar of ${c.name}`,className:"avatar-image",style:{borderColor:j.border},width:128,height:128,loading:"eager"}),s.jsx("button",{onClick:()=>g(!0),className:"avatar-edit-btn",style:{backgroundColor:j.accent},"aria-label":"Change profile picture",children:s.jsx(ot,{size:16,"aria-hidden":"true"})})]}),s.jsx("h2",{className:"avatar-name",children:c.name}),s.jsx("p",{style:{color:j.textTertiary},children:c.email})]}),s.jsx("nav",{className:"action-buttons",children:y?s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>S(!1),className:"btn btn-outline",style:{backgroundColor:j.surfaceLight,borderColor:j.border,color:j.textPrimary},children:[s.jsx(me,{size:16,"aria-hidden":"true"}),"Cancel"]}),s.jsxs("button",{onClick:L,disabled:b,className:"btn btn-primary",style:{background:`linear-gradient(to right, ${j.accent}, ${j.accentHover})`,opacity:b?.7:1},children:[b?s.jsx(ge,{size:16,className:"spinner","aria-hidden":"true"}):s.jsx(ss,{size:16,"aria-hidden":"true"}),b?"Saving...":"Save Changes"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>S(!0),className:"btn btn-primary",style:{background:`linear-gradient(to right, ${j.accent}, ${j.accentHover})`},children:[s.jsx(rs,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),s.jsxs("button",{onClick:()=>$(!0),className:"btn btn-secondary",children:[s.jsx(nr,{size:14,"aria-hidden":"true"}),"Change Password"]}),s.jsxs("button",{onClick:()=>E(!0),className:"btn btn-danger",style:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.15)",color:j.error,border:`1px solid ${r?"rgba(239, 68, 68, 0.4)":"rgba(239, 68, 68, 0.3)"}`,padding:"8px 14px",borderRadius:"8px",fontWeight:500,transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.2)":"rgba(239, 68, 68, 0.25)"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.15)"},children:[s.jsx(Ye,{size:16,"aria-hidden":"true"}),"Delete Account"]})]})})]}),s.jsx("main",{className:"profile-content",children:s.jsxs("section",{className:"profile-card",style:{backgroundColor:j.surface},children:[s.jsxs("h2",{className:"section-title",children:[s.jsx(de,{size:20,"aria-hidden":"true"}),"Personal Information"]}),s.jsx("div",{className:"fields-grid",children:H.map(T=>{const v=T.icon;return s.jsxs("div",{className:"field-group",children:[s.jsxs("label",{className:"field-label",children:[s.jsx(v,{size:16,"aria-hidden":"true"}),T.label]}),y?s.jsx("input",{type:T.type,name:T.name,value:c[T.name],onChange:U=>x(F=>F&&{...F,[U.target.name]:U.target.value}),className:"field-input",style:{borderColor:n,color:j.textPrimary},placeholder:`Enter ${T.label.toLowerCase()}`,"aria-label":T.label}):s.jsx("div",{className:"field-value",style:{color:j.textPrimary},children:T.value})]},T.name)})})]})})]})}),s.jsx(cs,{isOpen:m,onClose:()=>{g(!1)},onUpdate:w,colors:j}),s.jsx(ds,{baseUrl:o,apiKey:i,appId:a,userId:c.id,isOpen:_,onClose:()=>$(!1),onSuccess:T=>I("success",T),onError:T=>I("error",T),colors:j}),s.jsx(us,{baseUrl:o,apiKey:i,appId:a,userId:c.id,token:t,isOpen:R,onClose:()=>E(!1),onSuccess:T=>I("success",T),onError:T=>I("error",T),colors:j}),s.jsx("style",{children:`
332
+ `})]})},Jn=({token:t,user:e=null,darkMode:r=!0,primaryColor:n="#00C214"})=>{const{baseUrl:o,apiKey:i,appId:a}=ae(),[l,h]=j.useState(e),[p,u]=j.useState(!0),[b,C]=j.useState(!1),[k,c]=j.useState(!1),[g,y]=j.useState(!1),[O,W]=j.useState(!1),[v,F]=j.useState(!1),[D,m]=j.useState(null),_=(E,N)=>{m({type:E,message:N}),setTimeout(()=>m(null),3e3)},w=async E=>{if(!l)return!1;try{const N={...l,avatarUrl:E},{data:T}=await $.put(`${o}/users/update/${l.id}`,N,{headers:{"x-api-key":i}});return T.success?(h(N),localStorage.setItem("userInfo",JSON.stringify({...N,token:t})),_("success","Avatar updated successfully!"),!0):(_("error",T.message||"Failed to update avatar"),!1)}catch(N){return console.error("Avatar update error:",N),_("error","Failed to update avatar"),!1}},M=async()=>{if(l){c(!0);try{const{data:E}=await $.put(`${o}/users/update/${l.id}`,l,{headers:{"x-api-key":i}});E.success?(h(E.user),C(!1),localStorage.setItem("userInfo",JSON.stringify({...E.user,token:t})),_("success","Profile updated successfully")):_("error",E.message)}catch(E){console.error(E),_("error","Update failed")}finally{c(!1)}}},V=async E=>{try{const{data:N}=await $.get(`${o}/users/check-user/${E}?appId=${a}`,{headers:{"x-api-key":i}});(!N.success||!N.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),h(null))}catch(N){console.error("User check failed:",N),localStorage.removeItem("userInfo"),h(null)}};j.useEffect(()=>{(()=>{if(e)h(e),u(!1),V(e.id);else{const N=localStorage.getItem("userInfo");if(N){const T=JSON.parse(N);h(T),u(!1),V(T.id)}else u(!1)}})()},[e]);const U=(E,N)=>{let T=parseInt(E.replace("#",""),16),P=(T>>16)+N,B=(T>>8&255)+N,q=(T&255)+N;return P=Math.min(255,Math.max(0,P)),B=Math.min(255,Math.max(0,B)),q=Math.min(255,Math.max(0,q)),`#${(q|B<<8|P<<16).toString(16).padStart(6,"0")}`},A=r?{background:"#000000",surface:"#18181b",surfaceLight:"#27272a",surfaceLighter:"#3f3f46",textPrimary:"#ffffff",textSecondary:"#d4d4d8",textTertiary:"#a1a1aa",accent:n,accentHover:U(n,-15),success:"#10b981",error:"#ef4444",border:"#27272a"}:{background:"#ffffff",surface:"#fafafa",surfaceLight:"#f4f4f5",surfaceLighter:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#52525b",textTertiary:"#71717a",accent:n,accentHover:U(n,-15),success:"#10b981",error:"#ef4444",border:"#e4e4e7"};if(p)return s.jsx("div",{className:"profile-container",style:{color:A.textPrimary},children:s.jsxs("div",{className:"loading-container",children:[s.jsx(ue,{size:40,color:A.accent,className:"spinner","aria-hidden":"true"}),s.jsx("p",{style:{color:A.textTertiary},children:"Loading your profile..."})]})});if(!l)return s.jsx("div",{className:"profile-container",style:{color:A.textPrimary},children:s.jsxs("div",{style:{display:"flex",gap:"12px",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"400px",textAlign:"center"},children:[s.jsx(ie,{size:40,color:A.error,"aria-hidden":"true"}),s.jsx("p",{style:{color:A.textTertiary},children:"No profile found. Please log in again."})]})});const I=[{label:"Full Name",value:l.name,name:"name",type:"text",icon:fe},{label:"Email Address",value:l.email,name:"email",type:"email",icon:ve},{label:"Phone Number",value:l.phone||"Not set",name:"phone",type:"tel",icon:Fn},{label:"Address",value:l.address||"Not provided",name:"address",type:"text",icon:zn}];return s.jsxs("div",{className:"profile-container",style:{color:A.textPrimary},children:[D&&s.jsxs("div",{className:`notification ${D.type}`,style:{zIndex:1e4,...D.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:[D.type==="success"?s.jsx(Ue,{size:20,"aria-hidden":"true"}):s.jsx(ie,{size:20,"aria-hidden":"true"}),D.message]}),s.jsx("div",{className:"profile-main-container",children:s.jsxs("div",{className:"profile-grid",children:[s.jsxs("aside",{className:"profile-sidebar",children:[s.jsxs("section",{className:"profile-card avatar-section",style:{backgroundColor:A.surface},children:[s.jsxs("div",{className:"avatar-container",children:[s.jsx("img",{src:l.avatarUrl||`https://api.dicebear.com/9.x/glass/svg?seed=${encodeURIComponent(l.name)}`,alt:`Profile avatar of ${l.name}`,className:"avatar-image",style:{borderColor:A.border},width:128,height:128,loading:"eager"}),s.jsx("button",{onClick:()=>y(!0),className:"avatar-edit-btn",style:{backgroundColor:A.accent},"aria-label":"Change profile picture",children:s.jsx(Xe,{size:16,"aria-hidden":"true"})})]}),s.jsx("h2",{className:"avatar-name",children:l.name}),s.jsx("p",{style:{color:A.textTertiary},children:l.email})]}),s.jsx("nav",{className:"action-buttons",children:b?s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>C(!1),className:"btn btn-outline",style:{backgroundColor:A.surfaceLight,borderColor:A.border,color:A.textPrimary},children:[s.jsx(De,{size:16,"aria-hidden":"true"}),"Cancel"]}),s.jsxs("button",{onClick:M,disabled:k,className:"btn btn-primary",style:{background:`linear-gradient(to right, ${A.accent}, ${A.accentHover})`,opacity:k?.7:1},children:[k?s.jsx(ue,{size:16,className:"spinner","aria-hidden":"true"}):s.jsx(Dn,{size:16,"aria-hidden":"true"}),k?"Saving...":"Save Changes"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>C(!0),className:"btn btn-primary",style:{background:`linear-gradient(to right, ${A.accent}, ${A.accentHover})`},children:[s.jsx(Un,{size:16,"aria-hidden":"true"}),"Edit Profile"]}),s.jsxs("button",{onClick:()=>W(!0),className:"btn btn-secondary",children:[s.jsx(Yt,{size:14,"aria-hidden":"true"}),"Change Password"]}),s.jsxs("button",{onClick:()=>F(!0),className:"btn btn-danger",style:{backgroundColor:r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.15)",color:A.error,border:`1px solid ${r?"rgba(239, 68, 68, 0.4)":"rgba(239, 68, 68, 0.3)"}`,padding:"8px 14px",borderRadius:"8px",fontWeight:500,transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.2)":"rgba(239, 68, 68, 0.25)"},onMouseLeave:E=>{E.currentTarget.style.backgroundColor=r?"rgba(239, 68, 68, 0.1)":"rgba(239, 68, 68, 0.15)"},children:[s.jsx(Fe,{size:16,"aria-hidden":"true"}),"Delete Account"]})]})})]}),s.jsx("main",{className:"profile-content",children:s.jsxs("section",{className:"profile-card",style:{backgroundColor:A.surface},children:[s.jsxs("h2",{className:"section-title",children:[s.jsx(fe,{size:20,"aria-hidden":"true"}),"Personal Information"]}),s.jsx("div",{className:"fields-grid",children:I.map(E=>{const N=E.icon;return s.jsxs("div",{className:"field-group",children:[s.jsxs("label",{className:"field-label",children:[s.jsx(N,{size:16,"aria-hidden":"true"}),E.label]}),b?s.jsx("input",{type:E.type,name:E.name,value:l[E.name],onChange:T=>h(P=>P&&{...P,[T.target.name]:T.target.value}),className:"field-input",style:{borderColor:n,color:A.textPrimary},placeholder:`Enter ${E.label.toLowerCase()}`,"aria-label":E.label}):s.jsx("div",{className:"field-value",style:{color:A.textPrimary},children:E.value})]},E.name)})})]})})]})}),s.jsx(qn,{isOpen:g,onClose:()=>{y(!1)},onUpdate:w,colors:A}),s.jsx(Yn,{baseUrl:o,apiKey:i,appId:a,userId:l.id,isOpen:O,onClose:()=>W(!1),onSuccess:E=>_("success",E),onError:E=>_("error",E),colors:A}),s.jsx(Vn,{baseUrl:o,apiKey:i,appId:a,userId:l.id,token:t,isOpen:v,onClose:()=>F(!1),onSuccess:E=>_("success",E),onError:E=>_("error",E),colors:A}),s.jsx("style",{children:`
344
333
  .profile-container {
345
334
  width: 100%;
346
335
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
@@ -506,7 +495,7 @@ React keys must be passed directly to JSX without using spread:
506
495
  }
507
496
 
508
497
  .btn-primary {
509
- background: linear-gradient(to right, ${j.accent}, ${j.accentHover});
498
+ background: linear-gradient(to right, ${A.accent}, ${A.accentHover});
510
499
  color: white;
511
500
  }
512
501
 
@@ -533,7 +522,7 @@ React keys must be passed directly to JSX without using spread:
533
522
  font-size: 20px;
534
523
  font-weight: 600;
535
524
  margin: 0 0 24px 0;
536
- color: ${j.textSecondary};
525
+ color: ${A.textSecondary};
537
526
  display: flex;
538
527
  align-items: center;
539
528
  gap: 8px;
@@ -552,7 +541,7 @@ React keys must be passed directly to JSX without using spread:
552
541
  }
553
542
 
554
543
  .field-label {
555
- color: ${j.textTertiary};
544
+ color: ${A.textTertiary};
556
545
  font-size: 14px;
557
546
  font-weight: 500;
558
547
  display: flex;
@@ -575,8 +564,8 @@ React keys must be passed directly to JSX without using spread:
575
564
  }
576
565
 
577
566
  .field-input:focus {
578
- border-color: ${j.accent};
579
- box-shadow: 0 0 0 3px ${j.accent}20;
567
+ border-color: ${A.accent};
568
+ box-shadow: 0 0 0 3px ${A.accent}20;
580
569
  }
581
570
 
582
571
  .field-value {
@@ -662,4 +651,4 @@ React keys must be passed directly to JSX without using spread:
662
651
  border-width: 2px;
663
652
  }
664
653
  }
665
- `})]})},fs=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:r,profileUrl:n})=>{const[o,i]=k.useState(!1),[a,c]=k.useState(null),[x,p]=k.useState(null),u=k.useRef(null);k.useEffect(()=>{const l=m=>{u.current&&!u.current.contains(m.target)&&i(!1)};return o&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),k.useEffect(()=>{try{const l=localStorage.getItem("userInfo");if(l){const m=JSON.parse(l);m?.name&&m?.email?c({...m,profileUrl:n||m.profileUrl}):p("Invalid user data format.")}else p("No user session found. Please log in to continue.")}catch(l){console.error("Failed to parse userInfo:",l),p("Error loading user data.")}},[n]);const y=(l,m)=>{let g=parseInt(l.replace("#",""),16),_=(g>>16)+m,$=(g>>8&255)+m,R=(g&255)+m;return _=Math.min(255,Math.max(0,_)),$=Math.min(255,Math.max(0,$)),R=Math.min(255,Math.max(0,R)),`#${(R|$<<8|_<<16).toString(16).padStart(6,"0")}`},S=t?{surface:"#09090B",border:"#27272a",textPrimary:"#ffffff",textSecondary:"#a1a1aa",accent:e,accentHover:y(e,-30)}:{surface:"#f9fafb",border:"#e4e4e7",textPrimary:"#111827",textSecondary:"#6b7280",accent:e,accentHover:y(e,-30)},b={wrapper:{position:"relative"},avatarButton:{width:"6vw",maxWidth:"42px",minWidth:"40px",aspectRatio:"1",borderRadius:"50%",overflow:"hidden",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"transform 0.2s ease, box-shadow 0.2s ease",backgroundColor:S.surface},avatarImage:{width:"100%",height:"100%",objectFit:"cover"},dropdown:{position:"absolute",top:"56px",right:"0",backgroundColor:S.surface,border:`1px solid ${S.border}`,borderRadius:"14px",boxShadow:"0 12px 30px rgba(0,0,0,0.25)",width:"270px",padding:"16px",zIndex:100,fontFamily:"'Inter', sans-serif",opacity:o?1:0,transform:o?"translateY(0)":"translateY(-10px)",pointerEvents:o?"auto":"none",transition:"opacity 0.2s ease, transform 0.2s ease"},arrow:{position:"absolute",top:"44px",right:"14px",width:"0",height:"0",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${S.surface}`,filter:"drop-shadow(0 -1px 1px rgba(0,0,0,0.2))"},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",marginBottom:"16px"},userName:{fontSize:"16px",fontWeight:600,color:S.textPrimary,display:"flex",alignItems:"center",gap:"6px"},userEmail:{fontSize:"14px",color:S.textSecondary,display:"flex",alignItems:"center",gap:"6px",marginTop:"4px"},profileLink:{fontSize:"14px",marginTop:"8px",color:S.accent,cursor:"pointer",textDecoration:"none",fontWeight:500},logoutButton:{marginTop:"12px",width:"100%",background:`linear-gradient(to right, ${S.accent}, ${S.accentHover})`,border:"none",borderRadius:"6px",padding:"8px 16px",color:"white",fontSize:"12px",fontWeight:500,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"opacity 0.2s ease, transform 0.1s ease"},logoutButtonHover:{opacity:.9,transform:"scale(1.02)"},errorText:{fontSize:"12px",color:"#ef4444",display:"flex",alignItems:"start",gap:"6px",padding:"6px 8px",backgroundColor:"rgba(239, 68, 68, 0.1)",borderRadius:"6px",fontWeight:500}};return s.jsxs("div",{style:b.wrapper,ref:u,children:[s.jsx("div",{style:b.avatarButton,onClick:()=>i(l=>!l),onMouseOver:l=>{l.currentTarget.style.transform="scale(1.05)",l.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.25)"},onMouseOut:l=>{l.currentTarget.style.transform="scale(1)",l.currentTarget.style.boxShadow="none"},children:a?.avatarUrl?s.jsx("img",{src:a.avatarUrl,alt:"User avatar",style:b.avatarImage}):s.jsx("img",{src:"https://api.dicebear.com/9.x/glass/svg?seed=Wyatt",alt:"User avatar",style:b.avatarImage})}),s.jsx("div",{style:b.arrow,hidden:!o}),s.jsx("div",{style:b.dropdown,children:a?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:b.userInfo,children:[s.jsxs("div",{style:b.userName,children:[s.jsx(de,{size:16})," ",a.name]}),s.jsxs("div",{style:b.userEmail,children:[s.jsx(Re,{size:16})," ",a.email]}),a.profileUrl&&s.jsx("a",{href:a.profileUrl,style:b.profileLink,target:"_blank",rel:"noopener noreferrer",children:"View Profile"})]}),s.jsxs("button",{style:b.logoutButton,onMouseOver:l=>Object.assign(l.currentTarget.style,b.logoutButtonHover),onMouseOut:l=>l.currentTarget.style.transform="scale(1)",onClick:r,children:[s.jsx(sr,{size:16})," Logout"]})]}):s.jsxs("p",{style:b.errorText,children:[s.jsx(Zn,{size:18})," ",x||"Not logged in"]})})]})},xs=Ne.defineComponent({__name:"Button",props:{label:{},onClick:{type:Function}},setup(t){return(e,r)=>(Ne.openBlock(),Ne.createElementBlock("button",{onClick:r[0]||(r[0]=(...n)=>e.onClick&&e.onClick(...n)),class:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition"},Ne.toDisplayString(e.label),1))}});G.NeuctraAuthix=Dn,G.ReactUserButton=fs,G.ReactUserLogin=as,G.ReactUserProfile=ps,G.ReactUserSignUp=ls,G.VueButton=xs,G.getSdkConfig=xe,G.setSdkConfig=qn,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
654
+ `})]})},Kn=({darkMode:t=!0,primaryColor:e="#3b82f6",onLogout:r,propUser:n,className:o="",profileUrl:i,settingsUrl:a,showProfileMenuItem:l=!0,showSettingsMenuItem:h=!0,showViewProfileMenuItem:p=!0,profileLabel:u="My Profile",settingsLabel:b="Settings",viewProfileLabel:C="View Profile",logoutLabel:k="Sign Out"})=>{const{baseUrl:c,apiKey:g,appId:y}=ae(),[O,W]=j.useState(!1),[v,F]=j.useState(null),[D,m]=j.useState(!0),[_,w]=j.useState(null),M=j.useRef(null),V=j.useRef(null),[U,A]=j.useState(!1),[I,E]=j.useState(!1);j.useEffect(()=>{const x=()=>{E(window.innerWidth<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const N=async x=>{try{if(!x)throw new Error("Invalid user ID");const{data:S}=await $.get(`${c}/users/check-user/${x}?appId=${y}`,{headers:{"x-api-key":g},timeout:1e4});(!S.success||!S.exists)&&(console.warn("User not found, clearing session..."),localStorage.removeItem("userInfo"),F(null),w("Session expired"))}catch(S){console.error("User validation failed:",S);const H=S.response?.status===404?"User not found":S.code==="NETWORK_ERROR"?"Network error":"Validation failed";w(H),S.response?.status===404&&(localStorage.removeItem("userInfo"),F(null))}};j.useEffect(()=>{(async()=>{try{if(m(!0),w(null),n){if(!n.id||!n.name||!n.email)throw new Error("Invalid user data provided");F(n),await N(n.id)}else{const S=localStorage.getItem("userInfo");if(S)try{const H=JSON.parse(S);if(!H.id||!H.name||!H.email)throw new Error("Invalid stored user data");F(H),await N(H.id)}catch(H){console.error("Failed to parse stored user data:",H),localStorage.removeItem("userInfo"),w("Invalid user data")}}}catch(S){console.error("User initialization failed:",S),w(S.message||"Failed to load user")}finally{m(!1)}})()},[n]),j.useEffect(()=>{const x=()=>{if(O&&V.current){const S=V.current.getBoundingClientRect(),H=window.innerWidth,te=window.innerHeight,Se=280,J=300,re=H-S.right,je=S.left,et=te-S.bottom,Xn=re>=Se||re>je;A(Xn),et<J&&S.top>J}};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[O]),j.useEffect(()=>{const x=te=>{M.current&&!M.current.contains(te.target)&&!V.current?.contains(te.target)&&W(!1)},S=te=>{te.key==="Escape"&&W(!1)},H=()=>{O&&W(!1)};return O&&(document.addEventListener("mousedown",x),document.addEventListener("keydown",S),window.addEventListener("scroll",H,{passive:!0})),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",S),window.removeEventListener("scroll",H)}},[O]);const T=t?{surface:"#000000",surfaceElevated:"#000000",surfaceHover:"#262626",border:"#262626",borderLight:"#404040",textPrimary:"#ffffff",textSecondary:"#a3a3a3",textTertiary:"#737373",accent:e,accentHover:`${e}e6`,error:"#ef4444"}:{surface:"#ffffff",surfaceElevated:"#fafafa",surfaceHover:"#f5f5f5",border:"#e5e5e5",borderLight:"#f0f0f0",textPrimary:"#171717",textSecondary:"#525252",textTertiary:"#a3a3a3",accent:e,accentHover:`${e}e6`,error:"#ef4444"},P={wrapper:{position:"relative",display:"inline-block"},avatarButton:{display:"flex",alignItems:"center",gap:I?"6px":"8px",padding:I?"6px 10px 6px 6px":"8px 12px 8px 8px",borderRadius:"24px",backgroundColor:T.surface,cursor:"pointer",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:I?"auto":"140px",maxWidth:I?"200px":"none",outline:"none"},avatarImage:{width:I?"28px":"32px",height:I?"28px":"32px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},userInfo:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0,overflow:"hidden"},userName:{fontSize:I?"13px":"14px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},userEmail:{fontSize:I?"11px":"12px",color:T.textTertiary,lineHeight:"1.2",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:I?"80px":"120px"},chevron:{transition:"transform 0.2s ease",transform:O?"rotate(180deg)":"rotate(0deg)",color:T.textTertiary,flexShrink:0},dropdown:{position:"absolute",top:"100%",marginTop:"8px",[U?"left":"right"]:"0",backgroundColor:T.surfaceElevated,border:`1px solid ${T.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:O?1:0,pointerEvents:O?"auto":"none",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:O?"translateY(0) scale(1)":"translateY(-8px) scale(0.95)",overflow:"hidden"},dropdownSection:{padding:I?"10px 12px":"0px 16px","&:last-child":{borderBottom:"none"}},userSection:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"14px":"16px"},dropdownAvatar:{width:I?"40px":"48px",height:I?"40px":"48px",borderRadius:"50%",objectFit:"cover",border:`2px solid ${T.borderLight}`,flexShrink:0},dropdownUserInfo:{display:"flex",flexDirection:"column",flex:1,minWidth:0},dropdownUserName:{fontSize:I?"15px":"16px",fontWeight:600,color:T.textPrimary,lineHeight:"1.2",marginBottom:"2px",overflow:"hidden",textOverflow:"ellipsis"},dropdownUserEmail:{fontSize:I?"13px":"14px",color:T.textSecondary,lineHeight:"1.2",overflow:"hidden",textOverflow:"ellipsis"},menuItem:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",color:T.textPrimary,textDecoration:"none",border:"none",background:"none",width:"100%",fontSize:I?"13px":"14px",textAlign:"left",outline:"none"},menuItemText:{flex:1},icon:{width:I?"16px":"18px",height:I?"16px":"18px",color:T.textSecondary,flexShrink:0},logoutButton:{display:"flex",alignItems:"center",gap:I?"10px":"12px",padding:I?"10px 12px":"12px 16px",borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",background:"none",border:"none",width:"100%",fontSize:I?"13px":"14px",color:T.error,textAlign:"left",outline:"none"},loadingText:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:I?"13px":"14px"},errorState:{padding:I?"16px 12px":"20px 16px",textAlign:"center",color:T.textSecondary,fontSize:I?"13px":"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexDirection:"column"},retryButton:{marginTop:"8px",padding:"8px 16px",backgroundColor:T.accent,color:"#ffffff",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:500,transition:"background-color 0.2s ease"}},B=()=>{w(null),m(!0);const x=localStorage.getItem("userInfo");if(x)try{const S=JSON.parse(x);F(S),N(S.id)}catch{w("Invalid user data")}m(!1)},q=(x,S)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),S())},f=()=>i||v?.profileUrl,R=()=>{const x=f();x&&window.open(x,"_blank","noopener,noreferrer")},L=()=>{a&&window.open(a,"_blank","noopener,noreferrer")};return s.jsxs("div",{style:P.wrapper,ref:M,className:o,role:"menu","aria-label":"User menu",children:[s.jsxs("div",{ref:V,style:P.avatarButton,onClick:()=>W(x=>!x),onKeyDown:x=>q(x,()=>W(S=>!S)),tabIndex:0,role:"button","aria-haspopup":"true","aria-expanded":O,"aria-label":"Toggle user menu",onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover,x.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.surface,x.currentTarget.style.boxShadow="none"},onBlur:x=>{x.currentTarget.style.outline="none"},children:[v?.avatarUrl?s.jsx("img",{src:v.avatarUrl,alt:`${v.name}'s avatar`,style:P.avatarImage,loading:"lazy",onError:x=>{const S=x.target;S.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${v.name||"user"}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${v?.name||"user"}`,alt:"Default user avatar",style:P.avatarImage,loading:"lazy"}),!I&&s.jsxs("div",{style:P.userInfo,children:[s.jsx("div",{style:P.userName,title:v?.name,children:v?.name||"Guest"}),v?.email&&s.jsx("div",{style:P.userEmail,title:v.email,children:v.email})]}),s.jsx(On,{size:I?14:16,style:P.chevron,"aria-hidden":"true"})]}),O&&s.jsx("div",{style:P.dropdown,role:"menu","aria-label":"User options",children:D?s.jsx("div",{style:P.loadingText,role:"status","aria-live":"polite",children:"Loading user information..."}):v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:P.userSection,children:[v?.avatarUrl?s.jsx("img",{src:v.avatarUrl,alt:`${v.name}'s profile picture`,style:P.dropdownAvatar,loading:"lazy",onError:x=>{const S=x.target;S.src=`https://api.dicebear.com/9.x/avataaars/svg?seed=${v.name}`}}):s.jsx("img",{src:`https://api.dicebear.com/9.x/avataaars/svg?seed=${v.name}`,alt:`${v.name}'s default avatar`,style:P.dropdownAvatar,loading:"lazy"}),s.jsxs("div",{style:P.dropdownUserInfo,children:[s.jsx("div",{style:P.dropdownUserName,title:v.name,children:v.name}),s.jsx("div",{style:P.dropdownUserEmail,title:v.email,children:v.email})]})]}),s.jsxs("div",{style:P.dropdownSection,children:[l&&f()&&s.jsxs("button",{style:P.menuItem,onClick:R,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,R),role:"menuitem",tabIndex:0,children:[s.jsx(fe,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:u})]}),h&&a&&s.jsxs("button",{style:P.menuItem,onClick:L,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,L),role:"menuitem",tabIndex:0,children:[s.jsx(Ln,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:b})]}),p&&v.profileUrl&&s.jsxs("a",{href:v.profileUrl,target:"_blank",rel:"noopener noreferrer",style:P.menuItem,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},role:"menuitem",tabIndex:0,children:[s.jsx(ve,{style:P.icon,"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:C})]})]}),s.jsx("div",{style:P.dropdownSection,children:s.jsxs("button",{style:P.logoutButton,onClick:r,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.surfaceHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent"},onKeyDown:x=>q(x,r),role:"menuitem",tabIndex:0,children:[s.jsx(Vt,{style:{...P.icon,color:T.error},"aria-hidden":"true"}),s.jsx("span",{style:P.menuItemText,children:k})]})})]}):s.jsxs("div",{style:P.errorState,role:"alert",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsx(ie,{size:16,"aria-hidden":"true"}),s.jsx("span",{children:_||"Not signed in"})]}),_&&_!=="Not signed in"&&s.jsx("button",{style:P.retryButton,onClick:B,onMouseOver:x=>{x.currentTarget.style.backgroundColor=T.accentHover},onMouseOut:x=>{x.currentTarget.style.backgroundColor=T.accent},children:"Try Again"})]})})]})};Z.NeuctraAuthix=bn,Z.ReactUserButton=Kn,Z.ReactUserLogin=$n,Z.ReactUserProfile=Jn,Z.ReactUserSignUp=Hn,Z.getSdkConfig=ae,Z.setSdkConfig=kn,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));