@realtimex/folio 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/folio.js
CHANGED
|
@@ -48,7 +48,7 @@ Request ID: ${m}`),g){let k=`
|
|
|
48
48
|
Resources:`;for(const C of g){if(!C||typeof C!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${C}`);k+=`
|
|
49
49
|
- ${C}`}N+=k}return`${_}
|
|
50
50
|
${N}`}class Tt extends Error{constructor({message:e,code:s,cause:r,name:l}){var u;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(u=l??(r instanceof Error?r.name:void 0))!==null&&u!==void 0?u:"Unknown Error",this.code=s}}class au extends Tt{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function QT({error:t,options:e}){var s,r,l;const{publicKey:u}=e;if(!u)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Tt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=u.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new Tt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=u.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Tt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((l=u.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new Tt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Tt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Tt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return u.pubKeyCredParams.filter(f=>f.type==="public-key").length===0?new Tt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Tt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const d=window.location.hostname;if(yw(d)){if(u.rp.id!==d)return new Tt({message:`The RP ID "${u.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Tt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(u.user.id.byteLength<1||u.user.id.byteLength>64)return new Tt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Tt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Tt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function ZT({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Tt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Tt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(yw(r)){if(s.rpId!==r)return new Tt({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Tt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Tt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Tt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class eE{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const tE=new eE;function nE(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:r}=t,l=pi(t,["challenge","user","excludeCredentials"]),u=oi(e).buffer,d=Object.assign(Object.assign({},s),{id:oi(s.id).buffer}),f=Object.assign(Object.assign({},l),{challenge:u,user:d});if(r&&r.length>0){f.excludeCredentials=new Array(r.length);for(let m=0;m<r.length;m++){const g=r[m];f.excludeCredentials[m]=Object.assign(Object.assign({},g),{id:oi(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return f}function sE(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,r=pi(t,["challenge","allowCredentials"]),l=oi(e).buffer,u=Object.assign(Object.assign({},r),{challenge:l});if(s&&s.length>0){u.allowCredentials=new Array(s.length);for(let d=0;d<s.length;d++){const f=s[d];u.allowCredentials[d]=Object.assign(Object.assign({},f),{id:oi(f.id).buffer,type:f.type||"public-key",transports:f.transports})}}return u}function aE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:Fa(new Uint8Array(t.response.attestationObject)),clientDataJSON:Fa(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function rE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,r=t.getClientExtensionResults(),l=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Fa(new Uint8Array(l.authenticatorData)),clientDataJSON:Fa(new Uint8Array(l.clientDataJSON)),signature:Fa(new Uint8Array(l.signature)),userHandle:l.userHandle?Fa(new Uint8Array(l.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function yw(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function s0(){var t,e;return!!(Gt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function iE(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new au("Browser returned unexpected credential type",e)}:{data:null,error:new au("Empty credential response",e)}}catch(e){return{data:null,error:QT({error:e,options:t})}}}async function oE(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new au("Browser returned unexpected credential type",e)}:{data:null,error:new au("Empty credential response",e)}}catch(e){return{data:null,error:ZT({error:e,options:t})}}}const lE={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},cE={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function ru(...t){const e=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),s=l=>l instanceof ArrayBuffer||ArrayBuffer.isView(l),r={};for(const l of t)if(l)for(const u in l){const d=l[u];if(d!==void 0)if(Array.isArray(d))r[u]=d;else if(s(d))r[u]=d;else if(e(d)){const f=r[u];e(f)?r[u]=ru(f,d):r[u]=ru(d)}else r[u]=d}return r}function uE(t,e){return ru(lE,t,e||{})}function dE(t,e){return ru(cE,t,e||{})}class fE{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:r,signal:l},u){var d;try{const{data:f,error:m}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!f)return{data:null,error:m};const g=l??tE.createNewAbortSignal();if(f.webauthn.type==="create"){const{user:y}=f.webauthn.credential_options.publicKey;if(!y.name){const x=r;if(x)y.name=`${y.id}:${x}`;else{const S=(await this.client.getUser()).data.user,E=((d=S?.user_metadata)===null||d===void 0?void 0:d.name)||S?.email||S?.id||"User";y.name=`${y.id}:${E}`}}y.displayName||(y.displayName=y.name)}switch(f.webauthn.type){case"create":{const y=uE(f.webauthn.credential_options.publicKey,u?.create),{data:x,error:w}=await iE({publicKey:y,signal:g});return x?{data:{factorId:e,challengeId:f.id,webauthn:{type:f.webauthn.type,credential_response:x}},error:null}:{data:null,error:w}}case"request":{const y=dE(f.webauthn.credential_options.publicKey,u?.request),{data:x,error:w}=await oE(Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:y,signal:g}));return x?{data:{factorId:e,challengeId:f.id,webauthn:{type:f.webauthn.type,credential_response:x}},error:null}:{data:null,error:w}}}}catch(f){return Ne(f)?{data:null,error:f}:{data:null,error:new Ga("Unexpected error in challenge",f)}}}async _verify({challengeId:e,factorId:s,webauthn:r}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},u){if(!s)return{data:null,error:new zo("rpId is required for WebAuthn authentication")};try{if(!s0())return{data:null,error:new Ga("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:r},signal:l},{request:u});if(!d)return{data:null,error:f};const{webauthn:m}=d;return this._verify({factorId:e,challengeId:d.challengeId,webauthn:{type:m.type,rpId:s,rpOrigins:r,credential_response:m.credential_response}})}catch(d){return Ne(d)?{data:null,error:d}:{data:null,error:new Ga("Unexpected error in authenticate",d)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},u){if(!s)return{data:null,error:new zo("rpId is required for WebAuthn registration")};try{if(!s0())return{data:null,error:new Ga("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this._enroll({friendlyName:e});if(!d)return await this.client.mfa.listFactors().then(y=>{var x;return(x=y.data)===null||x===void 0?void 0:x.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===e&&w.status!=="unverified")}).then(y=>y?this.client.mfa.unenroll({factorId:y?.id}):void 0),{data:null,error:f};const{data:m,error:g}=await this._challenge({factorId:d.id,friendlyName:d.friendly_name,webauthn:{rpId:s,rpOrigins:r},signal:l},{create:u});return m?this._verify({factorId:d.id,challengeId:m.challengeId,webauthn:{rpId:s,rpOrigins:r,type:m.webauthn.type,credential_response:m.webauthn.credential_response}}):{data:null,error:g}}catch(d){return Ne(d)?{data:null,error:d}:{data:null,error:new Ga("Unexpected error in register",d)}}}}YT();const hE={url:uT,storageKey:dT,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:fT,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4,skipAutoInitialize:!1};async function a0(t,e,s){return await s()}const Fr={};class Lo{get jwks(){var e,s;return(s=(e=Fr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){Fr[this.storageKey]=Object.assign(Object.assign({},Fr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=Fr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Fr[this.storageKey]=Object.assign(Object.assign({},Fr[this.storageKey]),{cachedAt:e})}constructor(e){var s,r,l;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const u=Object.assign(Object.assign({},hE),e);if(this.storageKey=u.storageKey,this.instanceID=(s=Lo.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Lo.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!u.debug,typeof u.debug=="function"&&(this.logger=u.debug),this.instanceID>0&&Gt()){const d=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(d),this.logDebugMessages&&console.trace(d)}if(this.persistSession=u.persistSession,this.autoRefreshToken=u.autoRefreshToken,this.admin=new FT({url:u.url,headers:u.headers,fetch:u.fetch}),this.url=u.url,this.headers=u.headers,this.fetch=mw(u.fetch),this.lock=u.lock||a0,this.detectSessionInUrl=u.detectSessionInUrl,this.flowType=u.flowType,this.hasCustomAuthorizationHeader=u.hasCustomAuthorizationHeader,this.throwOnError=u.throwOnError,this.lockAcquireTimeout=u.lockAcquireTimeout,u.lock?this.lock=u.lock:this.persistSession&&Gt()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=KT:this.lock=a0,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new fE(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(u.storage?this.storage=u.storage:hw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=t0(this.memoryStorage)),u.userStorage&&(this.userStorage=u.userStorage)):(this.memoryStorage={},this.storage=t0(this.memoryStorage)),Gt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(d){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",d)}(l=this.broadcastChannel)===null||l===void 0||l.addEventListener("message",async d=>{this._debug("received broadcast notification from other tab or client",d);try{await this._notifyAllSubscribers(d.data.event,d.data.session,!1)}catch(f){this._debug("#broadcastChannel","error",f)}})}u.skipAutoInitialize||this.initialize().catch(d=>{this._debug("#initialize()","error",d)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${uw}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let s={},r="none";if(Gt()&&(s=TT(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),Gt()&&this.detectSessionInUrl&&r!=="none"){const{data:l,error:u}=await this._getSessionFromURL(s,r);if(u){if(this._debug("#_initialize()","error detecting session from URL",u),yT(u)){const m=(e=u.details)===null||e===void 0?void 0:e.code;if(m==="identity_already_exists"||m==="identity_not_found"||m==="single_identity_not_deletable")return{error:u}}return{error:u}}const{session:d,redirectType:f}=l;return this._debug("#_initialize()","detected session in URL",d,"redirect type",f),await this._saveSession(d),setTimeout(async()=>{f==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",d):await this._notifyAllSubscribers("SIGNED_IN",d)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return Ne(s)?this._returnResult({error:s}):this._returnResult({error:new Ga("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,r,l;try{const u=await Re(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(s=e?.options)===null||s===void 0?void 0:s.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(l=e?.options)===null||l===void 0?void 0:l.captchaToken}},xform:$n}),{data:d,error:f}=u;if(f||!d)return this._returnResult({data:{user:null,session:null},error:f});const m=d.session,g=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:g,session:m},error:null})}catch(u){if(Ne(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signUp(e){var s,r,l;try{let u;if("email"in e){const{email:y,password:x,options:w}=e;let S=null,E=null;this.flowType==="pkce"&&([S,E]=await qr(this.storage,this.storageKey)),u=await Re(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:y,password:x,data:(s=w?.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:S,code_challenge_method:E},xform:$n})}else if("phone"in e){const{phone:y,password:x,options:w}=e;u=await Re(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:y,password:x,data:(r=w?.data)!==null&&r!==void 0?r:{},channel:(l=w?.channel)!==null&&l!==void 0?l:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:$n})}else throw new Cc("You must provide either an email or phone number and a password");const{data:d,error:f}=u;if(f||!d)return await Ht(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:f});const m=d.session,g=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:g,session:m},error:null})}catch(u){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(u))return this._returnResult({data:{user:null,session:null},error:u});throw u}}async signInWithPassword(e){try{let s;if("email"in e){const{email:u,password:d,options:f}=e;s=await Re(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:u,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:Zx})}else if("phone"in e){const{phone:u,password:d,options:f}=e;s=await Re(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:u,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:Zx})}else throw new Cc("You must provide either an email or phone number and a password");const{data:r,error:l}=s;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!r||!r.session||!r.user){const u=new $r;return this._returnResult({data:{user:null,session:null},error:u})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:l})}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,r,l,u;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:(u=e.options)===null||u===void 0?void 0:u.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,r,l,u,d,f,m,g,y,x,w;let S,E;if("message"in e)S=e.message,E=e.signature;else{const{chain:j,wallet:_,statement:N,options:k}=e;let C;if(Gt())if(typeof _=="object")C=_;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")C=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof _!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=_}const A=new URL((s=k?.url)!==null&&s!==void 0?s:window.location.href),D=await C.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=gw(D[0]);let V=(r=k?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!V){const P=await C.request({method:"eth_chainId"});V=XT(P)}const R={domain:A.host,address:U,statement:N,uri:A.href,version:"1",chainId:V,nonce:(l=k?.signInWithEthereum)===null||l===void 0?void 0:l.nonce,issuedAt:(d=(u=k?.signInWithEthereum)===null||u===void 0?void 0:u.issuedAt)!==null&&d!==void 0?d:new Date,expirationTime:(f=k?.signInWithEthereum)===null||f===void 0?void 0:f.expirationTime,notBefore:(m=k?.signInWithEthereum)===null||m===void 0?void 0:m.notBefore,requestId:(g=k?.signInWithEthereum)===null||g===void 0?void 0:g.requestId,resources:(y=k?.signInWithEthereum)===null||y===void 0?void 0:y.resources};S=JT(R),E=await C.request({method:"personal_sign",params:[WT(S),U]})}try{const{data:j,error:_}=await Re(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:E},!((x=e.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(w=e.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:$n});if(_)throw _;if(!j||!j.session||!j.user){const N=new $r;return this._returnResult({data:{user:null,session:null},error:N})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:_})}catch(j){if(Ne(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(e){var s,r,l,u,d,f,m,g,y,x,w,S;let E,j;if("message"in e)E=e.message,j=e.signature;else{const{chain:_,wallet:N,statement:k,options:C}=e;let A;if(Gt())if(typeof N=="object")A=N;else{const U=window;if("solana"in U&&typeof U.solana=="object"&&("signIn"in U.solana&&typeof U.solana.signIn=="function"||"signMessage"in U.solana&&typeof U.solana.signMessage=="function"))A=U.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof N!="object"||!C?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=N}const D=new URL((s=C?.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in A&&A.signIn){const U=await A.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},C?.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),k?{statement:k}:null));let V;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")V=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)V=U;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)E=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),j=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in A)||typeof A.signMessage!="function"||!("publicKey"in A)||typeof A!="object"||!A.publicKey||!("toBase58"in A.publicKey)||typeof A.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${D.host} wants you to sign in with your Solana account:`,A.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(l=(r=C?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&l!==void 0?l:new Date().toISOString()}`,...!((u=C?.signInWithSolana)===null||u===void 0)&&u.notBefore?[`Not Before: ${C.signInWithSolana.notBefore}`]:[],...!((d=C?.signInWithSolana)===null||d===void 0)&&d.expirationTime?[`Expiration Time: ${C.signInWithSolana.expirationTime}`]:[],...!((f=C?.signInWithSolana)===null||f===void 0)&&f.chainId?[`Chain ID: ${C.signInWithSolana.chainId}`]:[],...!((m=C?.signInWithSolana)===null||m===void 0)&&m.nonce?[`Nonce: ${C.signInWithSolana.nonce}`]:[],...!((g=C?.signInWithSolana)===null||g===void 0)&&g.requestId?[`Request ID: ${C.signInWithSolana.requestId}`]:[],...!((x=(y=C?.signInWithSolana)===null||y===void 0?void 0:y.resources)===null||x===void 0)&&x.length?["Resources",...C.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(`
|
|
51
|
-
`);const U=await A.signMessage(new TextEncoder().encode(E),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=U}}try{const{data:_,error:N}=await Re(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:Fa(j)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(S=e.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:$n});if(N)throw N;if(!_||!_.session||!_.user){const k=new $r;return this._returnResult({data:{user:null,session:null},error:k})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:N})}catch(_){if(Ne(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async _exchangeCodeForSession(e){const s=await Ua(this.storage,`${this.storageKey}-code-verifier`),[r,l]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new vT;const{data:u,error:d}=await Re(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:$n});if(await Ht(this.storage,`${this.storageKey}-code-verifier`),d)throw d;if(!u||!u.session||!u.user){const f=new $r;return this._returnResult({data:{user:null,session:null,redirectType:null},error:f})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:Object.assign(Object.assign({},u),{redirectType:l??null}),error:d})}catch(u){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(u))return this._returnResult({data:{user:null,session:null,redirectType:null},error:u});throw u}}async signInWithIdToken(e){try{const{options:s,provider:r,token:l,access_token:u,nonce:d}=e,f=await Re(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:l,access_token:u,nonce:d,gotrue_meta_security:{captcha_token:s?.captchaToken}},xform:$n}),{data:m,error:g}=f;if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m||!m.session||!m.user){const y=new $r;return this._returnResult({data:{user:null,session:null},error:y})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:m,error:g})}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,r,l,u,d;try{if("email"in e){const{email:f,options:m}=e;let g=null,y=null;this.flowType==="pkce"&&([g,y]=await qr(this.storage,this.storageKey));const{error:x}=await Re(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:f,data:(s=m?.data)!==null&&s!==void 0?s:{},create_user:(r=m?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},code_challenge:g,code_challenge_method:y},redirectTo:m?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:x})}if("phone"in e){const{phone:f,options:m}=e,{data:g,error:y}=await Re(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:f,data:(l=m?.data)!==null&&l!==void 0?l:{},create_user:(u=m?.shouldCreateUser)!==null&&u!==void 0?u:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},channel:(d=m?.channel)!==null&&d!==void 0?d:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:g?.message_id},error:y})}throw new Cc("You must provide either an email or phone number.")}catch(f){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(f))return this._returnResult({data:{user:null,session:null},error:f});throw f}}async verifyOtp(e){var s,r;try{let l,u;"options"in e&&(l=(s=e.options)===null||s===void 0?void 0:s.redirectTo,u=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:d,error:f}=await Re(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:u}}),redirectTo:l,xform:$n});if(f)throw f;if(!d)throw new Error("An error occurred on token verification.");const m=d.session,g=d.user;return m?.access_token&&(await this._saveSession(m),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",m)),this._returnResult({data:{user:g,session:m},error:null})}catch(l){if(Ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(e){var s,r,l,u,d;try{let f=null,m=null;this.flowType==="pkce"&&([f,m]=await qr(this.storage,this.storageKey));const g=await Re(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&r!==void 0?r:void 0}),!((l=e?.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:f,code_challenge_method:m}),headers:this.headers,xform:qT});return!((u=g.data)===null||u===void 0)&&u.url&&Gt()&&!(!((d=e.options)===null||d===void 0)&&d.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(f){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(f))return this._returnResult({data:null,error:f});throw f}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)throw r;if(!s)throw new xn;const{error:l}=await Re(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(e){if(Ne(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:r,type:l,options:u}=e,{error:d}=await Re(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:l,gotrue_meta_security:{captcha_token:u?.captchaToken}},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}else if("phone"in e){const{phone:r,type:l,options:u}=e,{data:d,error:f}=await Re(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:l,gotrue_meta_security:{captcha_token:u?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:d?.message_id},error:f})}throw new Cc("You must provide either an email or phone number and a type")}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await r,await s()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=s();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await Ua(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<ih:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const d=await Ua(this.userStorage,this.storageKey+"-user");d?.user?e.user=d.user:e.user=ch()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const d={value:this.suppressGetSessionWarning};e.user=BT(e.user,d),d.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{session:null},error:u}):this._returnResult({data:{session:l},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await Re(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ua}):await this._useSession(async s=>{var r,l,u;const{data:d,error:f}=s;if(f)throw f;return!(!((r=d.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new xn}:await Re(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(u=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&u!==void 0?u:void 0,xform:ua})})}catch(s){if(Ne(s))return oh(s)&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async r=>{const{data:l,error:u}=r;if(u)throw u;if(!l.session)throw new xn;const d=l.session;let f=null,m=null;this.flowType==="pkce"&&e.email!=null&&([f,m]=await qr(this.storage,this.storageKey));const{data:g,error:y}=await Re(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:f,code_challenge_method:m}),jwt:d.access_token,xform:ua});if(y)throw y;return d.user=g.user,await this._saveSession(d),await this._notifyAllSubscribers("USER_UPDATED",d),this._returnResult({data:{user:d.user},error:null})})}catch(r){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new xn;const s=Date.now()/1e3;let r=s,l=!0,u=null;const{payload:d}=Rc(e.access_token);if(d.exp&&(r=d.exp,l=r<=s),l){const{data:f,error:m}=await this._callRefreshToken(e.refresh_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!f)return{data:{user:null,session:null},error:null};u=f}else{const{data:f,error:m}=await this._getUser(e.access_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});u={access_token:e.access_token,refresh_token:e.refresh_token,user:f.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(u),await this._notifyAllSubscribers("SIGNED_IN",u)}return this._returnResult({data:{user:u.user,session:u},error:null})}catch(s){if(Ne(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var r;if(!e){const{data:d,error:f}=s;if(f)throw f;e=(r=d.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new xn;const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{user:null,session:null},error:u}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!Gt())throw new Ac("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ac(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new Fx("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ac("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Fx("No code detected.");const{data:k,error:C}=await this._exchangeCodeForSession(e.code);if(C)throw C;const A=new URL(window.location.href);return A.searchParams.delete("code"),window.history.replaceState(window.history.state,"",A.toString()),{data:{session:k.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:l,access_token:u,refresh_token:d,expires_in:f,expires_at:m,token_type:g}=e;if(!u||!f||!d||!g)throw new Ac("No session defined in URL");const y=Math.round(Date.now()/1e3),x=parseInt(f);let w=y+x;m&&(w=parseInt(m));const S=w-y;S*1e3<=Jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}s`);const E=w-x;y-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,w,y):y-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,w,y);const{data:j,error:_}=await this._getUser(u);if(_)throw _;const N={provider_token:r,provider_refresh_token:l,access_token:u,expires_in:x,expires_at:w,refresh_token:d,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:N,redirectType:e.type},error:null})}catch(r){if(Ne(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await Ua(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u&&!oh(u))return this._returnResult({error:u});const d=(r=l.session)===null||r===void 0?void 0:r.access_token;if(d){const{error:f}=await this.admin.signOut(d,e);if(f&&!(gT(f)&&(f.status===404||f.status===401||f.status===403)||oh(f)))return this._returnResult({error:f})}return e!=="others"&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=NT(),r={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async s=>{var r,l;try{const{data:{session:u},error:d}=s;if(d)throw d;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",u)),this._debug("INITIAL_SESSION","callback id",e,"session",u)}catch(u){await((l=this.stateChangeEmitters.get(e))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",u),console.error(u)}})}async resetPasswordForEmail(e,s={}){let r=null,l=null;this.flowType==="pkce"&&([r,l]=await qr(this.storage,this.storageKey,!0));try{return await Re(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:l,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(u){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(u))return this._returnResult({data:null,error:u});throw u}}async getUserIdentities(){var e;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:r,error:l}=await this._useSession(async u=>{var d,f,m,g,y;const{data:x,error:w}=u;if(w)throw w;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(d=e.options)===null||d===void 0?void 0:d.redirectTo,scopes:(f=e.options)===null||f===void 0?void 0:f.scopes,queryParams:(m=e.options)===null||m===void 0?void 0:m.queryParams,skipBrowserRedirect:!0});return await Re(this.fetch,"GET",S,{headers:this.headers,jwt:(y=(g=x.session)===null||g===void 0?void 0:g.access_token)!==null&&y!==void 0?y:void 0})});if(l)throw l;return Gt()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:e.provider,url:r?.url},error:null})}catch(r){if(Ne(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var r;try{const{error:l,data:{session:u}}=s;if(l)throw l;const{options:d,provider:f,token:m,access_token:g,nonce:y}=e,x=await Re(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=u?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:f,id_token:m,access_token:g,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:$n}),{data:w,error:S}=x;return S?this._returnResult({data:{user:null,session:null},error:S}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new $r}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:S}))}catch(l){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var r,l;const{data:u,error:d}=s;if(d)throw d;return await Re(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(l=(r=u.session)===null||r===void 0?void 0:r.access_token)!==null&&l!==void 0?l:void 0})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await CT(async l=>(l>0&&await kT(200*Math.pow(2,l-1)),this._debug(s,"refreshing attempt",l),await Re(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:$n})),(l,u)=>{const d=200*Math.pow(2,l);return u&&lh(u)&&Date.now()+d-r<Jr})}catch(r){if(this._debug(s,"error",r),Ne(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",r),Gt()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const l=await Ua(this.storage,this.storageKey);if(l&&this.userStorage){let d=await Ua(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!d&&(d={user:l.user},await Qr(this.userStorage,this.storageKey+"-user",d)),l.user=(e=d?.user)!==null&&e!==void 0?e:ch()}else if(l&&!l.user&&!l.user){const d=await Ua(this.storage,this.storageKey+"-user");d&&d?.user?(l.user=d.user,await Ht(this.storage,this.storageKey+"-user"),await Qr(this.storage,this.storageKey,l)):l.user=ch()}if(this._debug(r,"session from storage",l),!this._isValidSession(l)){this._debug(r,"session is not valid"),l!==null&&await this._removeSession();return}const u=((s=l.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<ih;if(this._debug(r,`session has${u?"":" not"} expired with margin of ${ih}s`),u){if(this.autoRefreshToken&&l.refresh_token){const{error:d}=await this._callRefreshToken(l.refresh_token);d&&(console.error(d),lh(d)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",d),await this._removeSession()))}}else if(l.user&&l.user.__isUserNotAvailableProxy===!0)try{const{data:d,error:f}=await this._getUser(l.access_token);!f&&d?.user?(l.user=d.user,await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(d){console.error("Error getting user data:",d),this._debug(r,"error getting user data, skipping SIGNED_IN notification",d)}else await this._notifyAllSubscribers("SIGNED_IN",l)}catch(l){this._debug(r,"error",l),console.error(l);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var s,r;if(!e)throw new xn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const l=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(l,"begin");try{this.refreshingDeferred=new Nu;const{data:u,error:d}=await this._refreshAccessToken(e);if(d)throw d;if(!u.session)throw new xn;await this._saveSession(u.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",u.session);const f={data:u.session,error:null};return this.refreshingDeferred.resolve(f),f}catch(u){if(this._debug(l,"error",u),Ne(u)){const d={data:null,error:u};return lh(u)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(d),d}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(u),u}finally{this.refreshingDeferred=null,this._debug(l,"end")}}async _notifyAllSubscribers(e,s,r=!0){const l=`#_notifyAllSubscribers(${e})`;this._debug(l,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:s});const u=[],d=Array.from(this.stateChangeEmitters.values()).map(async f=>{try{await f.callback(e,s)}catch(m){u.push(m)}});if(await Promise.all(d),u.length>0){for(let f=0;f<u.length;f+=1)console.error(u[f]);throw u[0]}}finally{this._debug(l,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Ht(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await Qr(this.userStorage,this.storageKey+"-user",{user:s.user});const l=Object.assign({},s);delete l.user;const u=Jx(l);await Qr(this.storage,this.storageKey,u)}else{const l=Jx(s);await Qr(this.storage,this.storageKey,l)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ht(this.storage,this.storageKey),await Ht(this.storage,this.storageKey+"-code-verifier"),await Ht(this.storage,this.storageKey+"-user"),this.userStorage&&await Ht(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Gt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Jr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((r.expires_at*1e3-e)/Jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${Jr}ms, refresh threshold is ${Yh} ticks`),l<=Yh&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof pw)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Gt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,s,r){const l=[`provider=${encodeURIComponent(s)}`];if(r?.redirectTo&&l.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&l.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[u,d]=await qr(this.storage,this.storageKey),f=new URLSearchParams({code_challenge:`${encodeURIComponent(u)}`,code_challenge_method:`${encodeURIComponent(d)}`});l.push(f.toString())}if(r?.queryParams){const u=new URLSearchParams(r.queryParams);l.push(u.toString())}return r?.skipBrowserRedirect&&l.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${l.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;return u?this._returnResult({data:null,error:u}):await Re(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var r,l;const{data:u,error:d}=s;if(d)return this._returnResult({data:null,error:d});const f=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:m,error:g}=await Re(this.fetch,"POST",`${this.url}/factors`,{body:f,headers:this.headers,jwt:(r=u?.session)===null||r===void 0?void 0:r.access_token});return g?this._returnResult({data:null,error:g}):(e.factorType==="totp"&&m.type==="totp"&&(!((l=m?.totp)===null||l===void 0)&&l.qr_code)&&(m.totp.qr_code=`data:image/svg+xml;utf-8,${m.totp.qr_code}`),this._returnResult({data:m,error:null}))})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?aE(e.webauthn.credential_response):rE(e.webauthn.credential_response)})}:{code:e.code}),{data:f,error:m}=await Re(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:d,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});return m?this._returnResult({data:null,error:m}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+f.expires_in},f)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",f),this._returnResult({data:f,error:m}))})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=await Re(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});if(d.error)return d;const{data:f}=d;if(f.type!=="webauthn")return{data:f,error:null};switch(f.webauthn.type){case"create":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:nE(f.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:sE(f.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const l={all:[],phone:[],totp:[],webauthn:[]};for(const u of(e=s?.factors)!==null&&e!==void 0?e:[])l.all.push(u),u.status==="verified"&&l[u.factor_type].push(u);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(e){var s,r,l,u;if(e)try{const{payload:S}=Rc(e);let E=null;S.aal&&(E=S.aal);let j=E;const{data:{user:_},error:N}=await this.getUser(e);if(N)return this._returnResult({data:null,error:N});((r=(s=_?.factors)===null||s===void 0?void 0:s.filter(A=>A.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(j="aal2");const C=S.amr||[];return{data:{currentLevel:E,nextLevel:j,currentAuthenticationMethods:C},error:null}}catch(S){if(Ne(S))return this._returnResult({data:null,error:S});throw S}const{data:{session:d},error:f}=await this.getSession();if(f)return this._returnResult({data:null,error:f});if(!d)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:m}=Rc(d.access_token);let g=null;m.aal&&(g=m.aal);let y=g;((u=(l=d.user.factors)===null||l===void 0?void 0:l.filter(S=>S.status==="verified"))!==null&&u!==void 0?u:[]).length>0&&(y="aal2");const w=m.amr||[];return{data:{currentLevel:g,nextLevel:y,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:r},error:l}=s;return l?this._returnResult({data:null,error:l}):r?await Re(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:u=>({data:u,error:null})}):this._returnResult({data:null,error:new xn})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:l},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new xn});const d=await Re(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Gt()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:l},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new xn});const d=await Re(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Gt()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;return r?this._returnResult({data:null,error:r}):s?await Re(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new xn})})}catch(e){if(Ne(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:r},error:l}=s;return l?this._returnResult({data:null,error:l}):r?(await Re(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new xn})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let r=s.keys.find(f=>f.kid===e);if(r)return r;const l=Date.now();if(r=this.jwks.keys.find(f=>f.kid===e),r&&this.jwks_cached_at+mT>l)return r;const{data:u,error:d}=await Re(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(d)throw d;return!u.keys||u.keys.length===0||(this.jwks=u,this.jwks_cached_at=l,r=u.keys.find(f=>f.kid===e),!r)?null:r}async getClaims(e,s={}){try{let r=e;if(!r){const{data:S,error:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});r=S.session.access_token}const{header:l,payload:u,signature:d,raw:{header:f,payload:m}}=Rc(r);s?.allowExpired||zT(u.exp);const g=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,s?.keys?{keys:s.keys}:s?.jwks);if(!g){const{error:S}=await this.getUser(r);if(S)throw S;return{data:{claims:u,header:l,signature:d},error:null}}const y=LT(l.alg),x=await crypto.subtle.importKey("jwk",g,y,!0,["verify"]);if(!await crypto.subtle.verify(y,x,d,jT(`${f}.${m}`)))throw new Jh("Invalid JWT signature");return{data:{claims:u,header:l,signature:d},error:null}}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}}Lo.nextInstanceID={};const mE=Lo,pE="2.97.0";let wo="";typeof Deno<"u"?wo="deno":typeof document<"u"?wo="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wo="react-native":wo="node";const gE={"X-Client-Info":`supabase-js-${wo}/${pE}`},yE={headers:gE},vE={schema:"public"},xE={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bE={};function Uo(t){"@babel/helpers - typeof";return Uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uo(t)}function wE(t,e){if(Uo(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Uo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function SE(t){var e=wE(t,"string");return Uo(e)=="symbol"?e:e+""}function jE(t,e,s){return(e=SE(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function r0(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),s.push.apply(s,r)}return s}function yt(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?r0(Object(s),!0).forEach(function(r){jE(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _E=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),NE=()=>Headers,TE=(t,e,s)=>{const r=_E(s),l=NE();return async(u,d)=>{var f;const m=(f=await e())!==null&&f!==void 0?f:t;let g=new l(d?.headers);return g.has("apikey")||g.set("apikey",t),g.has("Authorization")||g.set("Authorization",`Bearer ${m}`),r(u,yt(yt({},d),{},{headers:g}))}};function EE(t){return t.endsWith("/")?t:t+"/"}function kE(t,e){var s,r;const{db:l,auth:u,realtime:d,global:f}=t,{db:m,auth:g,realtime:y,global:x}=e,w={db:yt(yt({},m),l),auth:yt(yt({},g),u),realtime:yt(yt({},y),d),storage:{},global:yt(yt(yt({},x),f),{},{headers:yt(yt({},(s=x?.headers)!==null&&s!==void 0?s:{}),(r=f?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function CE(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(EE(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var AE=class extends mE{constructor(t){super(t)}},RE=class{constructor(t,e,s){var r,l;this.supabaseUrl=t,this.supabaseKey=e;const u=CE(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const d=`sb-${u.hostname.split(".")[0]}-auth-token`,f={db:vE,realtime:bE,auth:yt(yt({},xE),{},{storageKey:d}),global:yE},m=kE(s??{},f);if(this.storageKey=(r=m.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(l=m.global.headers)!==null&&l!==void 0?l:{},m.accessToken)this.accessToken=m.accessToken,this.auth=new Proxy({},{get:(y,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} is not possible`)}});else{var g;this.auth=this._initSupabaseAuthClient((g=m.auth)!==null&&g!==void 0?g:{},this.headers,m.global.fetch)}this.fetch=TE(e,this._getAccessToken.bind(this),m.global.fetch),this.realtime=this._initRealtimeClient(yt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},m.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new g2(new URL("rest/v1",u).href,{headers:this.headers,schema:m.db.schema,fetch:this.fetch,timeout:m.db.timeout,urlLengthLimit:m.db.urlLengthLimit}),this.storage=new cT(this.storageUrl.href,this.headers,this.fetch,s?.storage),m.accessToken||this._listenForAuthEvents()}get functions(){return new l2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:l,storageKey:u,flowType:d,lock:f,debug:m,throwOnError:g},y,x){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new AE({url:this.authUrl.href,headers:yt(yt({},w),y),storageKey:u,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:l,flowType:d,lock:f,debug:m,throwOnError:g,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new M2(this.realtimeUrl.href,yt(yt({},t),{},{params:yt(yt({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const zm=(t,e,s)=>new RE(t,e,s);function OE(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}OE()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function vw(t){var e,s,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(e=0;e<l;e++)t[e]&&(s=vw(t[e]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s);return r}function xw(){for(var t,e,s=0,r="",l=arguments.length;s<l;s++)(t=arguments[s])&&(e=vw(t))&&(r&&(r+=" "),r+=e);return r}const ME=(t,e)=>{const s=new Array(t.length+e.length);for(let r=0;r<t.length;r++)s[r]=t[r];for(let r=0;r<e.length;r++)s[t.length+r]=e[r];return s},DE=(t,e)=>({classGroupId:t,validator:e}),bw=(t=new Map,e=null,s)=>({nextPart:t,validators:e,classGroupId:s}),iu="-",i0=[],PE="arbitrary..",zE=t=>{const e=UE(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return LE(d);const f=d.split(iu),m=f[0]===""&&f.length>1?1:0;return ww(f,m,e)},getConflictingClassGroupIds:(d,f)=>{if(f){const m=r[d],g=s[d];return m?g?ME(g,m):m:g||i0}return s[d]||i0}}},ww=(t,e,s)=>{if(t.length-e===0)return s.classGroupId;const l=t[e],u=s.nextPart.get(l);if(u){const g=ww(t,e+1,u);if(g)return g}const d=s.validators;if(d===null)return;const f=e===0?t.join(iu):t.slice(e).join(iu),m=d.length;for(let g=0;g<m;g++){const y=d[g];if(y.validator(f))return y.classGroupId}},LE=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),s=e.indexOf(":"),r=e.slice(0,s);return r?PE+r:void 0})(),UE=t=>{const{theme:e,classGroups:s}=t;return BE(s,e)},BE=(t,e)=>{const s=bw();for(const r in t){const l=t[r];Lm(l,s,r,e)}return s},Lm=(t,e,s,r)=>{const l=t.length;for(let u=0;u<l;u++){const d=t[u];VE(d,e,s,r)}},VE=(t,e,s,r)=>{if(typeof t=="string"){IE(t,e,s);return}if(typeof t=="function"){$E(t,e,s,r);return}qE(t,e,s,r)},IE=(t,e,s)=>{const r=t===""?e:Sw(e,t);r.classGroupId=s},$E=(t,e,s,r)=>{if(HE(t)){Lm(t(r),e,s,r);return}e.validators===null&&(e.validators=[]),e.validators.push(DE(s,t))},qE=(t,e,s,r)=>{const l=Object.entries(t),u=l.length;for(let d=0;d<u;d++){const[f,m]=l[d];Lm(m,Sw(e,f),s,r)}},Sw=(t,e)=>{let s=t;const r=e.split(iu),l=r.length;for(let u=0;u<l;u++){const d=r[u];let f=s.nextPart.get(d);f||(f=bw(),s.nextPart.set(d,f)),s=f}return s},HE=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,GE=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=Object.create(null),r=Object.create(null);const l=(u,d)=>{s[u]=d,e++,e>t&&(e=0,r=s,s=Object.create(null))};return{get(u){let d=s[u];if(d!==void 0)return d;if((d=r[u])!==void 0)return l(u,d),d},set(u,d){u in s?s[u]=d:l(u,d)}}},Qh="!",o0=":",FE=[],l0=(t,e,s,r,l)=>({modifiers:t,hasImportantModifier:e,baseClassName:s,maybePostfixModifierPosition:r,isExternal:l}),KE=t=>{const{prefix:e,experimentalParseClassName:s}=t;let r=l=>{const u=[];let d=0,f=0,m=0,g;const y=l.length;for(let j=0;j<y;j++){const _=l[j];if(d===0&&f===0){if(_===o0){u.push(l.slice(m,j)),m=j+1;continue}if(_==="/"){g=j;continue}}_==="["?d++:_==="]"?d--:_==="("?f++:_===")"&&f--}const x=u.length===0?l:l.slice(m);let w=x,S=!1;x.endsWith(Qh)?(w=x.slice(0,-1),S=!0):x.startsWith(Qh)&&(w=x.slice(1),S=!0);const E=g&&g>m?g-m:void 0;return l0(u,S,w,E)};if(e){const l=e+o0,u=r;r=d=>d.startsWith(l)?u(d.slice(l.length)):l0(FE,!1,d,void 0,!0)}if(s){const l=r;r=u=>s({className:u,parseClassName:l})}return r},YE=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((s,r)=>{e.set(s,1e6+r)}),s=>{const r=[];let l=[];for(let u=0;u<s.length;u++){const d=s[u],f=d[0]==="[",m=e.has(d);f||m?(l.length>0&&(l.sort(),r.push(...l),l=[]),r.push(d)):l.push(d)}return l.length>0&&(l.sort(),r.push(...l)),r}},XE=t=>({cache:GE(t.cacheSize),parseClassName:KE(t),sortModifiers:YE(t),...zE(t)}),WE=/\s+/,JE=(t,e)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:l,sortModifiers:u}=e,d=[],f=t.trim().split(WE);let m="";for(let g=f.length-1;g>=0;g-=1){const y=f[g],{isExternal:x,modifiers:w,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=s(y);if(x){m=y+(m.length>0?" "+m:m);continue}let _=!!j,N=r(_?E.substring(0,j):E);if(!N){if(!_){m=y+(m.length>0?" "+m:m);continue}if(N=r(E),!N){m=y+(m.length>0?" "+m:m);continue}_=!1}const k=w.length===0?"":w.length===1?w[0]:u(w).join(":"),C=S?k+Qh:k,A=C+N;if(d.indexOf(A)>-1)continue;d.push(A);const D=l(N,_);for(let U=0;U<D.length;++U){const V=D[U];d.push(C+V)}m=y+(m.length>0?" "+m:m)}return m},QE=(...t)=>{let e=0,s,r,l="";for(;e<t.length;)(s=t[e++])&&(r=jw(s))&&(l&&(l+=" "),l+=r);return l},jw=t=>{if(typeof t=="string")return t;let e,s="";for(let r=0;r<t.length;r++)t[r]&&(e=jw(t[r]))&&(s&&(s+=" "),s+=e);return s},ZE=(t,...e)=>{let s,r,l,u;const d=m=>{const g=e.reduce((y,x)=>x(y),t());return s=XE(g),r=s.cache.get,l=s.cache.set,u=f,f(m)},f=m=>{const g=r(m);if(g)return g;const y=JE(m,s);return l(m,y),y};return u=d,(...m)=>u(QE(...m))},ek=[],At=t=>{const e=s=>s[t]||ek;return e.isThemeGetter=!0,e},_w=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ak=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ik=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,aa=t=>tk.test(t),Ue=t=>!!t&&!Number.isNaN(Number(t)),ra=t=>!!t&&Number.isInteger(Number(t)),dh=t=>t.endsWith("%")&&Ue(t.slice(0,-1)),Es=t=>nk.test(t),Tw=()=>!0,ok=t=>sk.test(t)&&!ak.test(t),Um=()=>!1,lk=t=>rk.test(t),ck=t=>ik.test(t),uk=t=>!xe(t)&&!we(t),dk=t=>ga(t,Cw,Um),xe=t=>_w.test(t),Ba=t=>ga(t,Aw,ok),c0=t=>ga(t,xk,Ue),fk=t=>ga(t,Ow,Tw),hk=t=>ga(t,Rw,Um),u0=t=>ga(t,Ew,Um),mk=t=>ga(t,kw,ck),Oc=t=>ga(t,Mw,lk),we=t=>Nw.test(t),vo=t=>tr(t,Aw),pk=t=>tr(t,Rw),d0=t=>tr(t,Ew),gk=t=>tr(t,Cw),yk=t=>tr(t,kw),Mc=t=>tr(t,Mw,!0),vk=t=>tr(t,Ow,!0),ga=(t,e,s)=>{const r=_w.exec(t);return r?r[1]?e(r[1]):s(r[2]):!1},tr=(t,e,s=!1)=>{const r=Nw.exec(t);return r?r[1]?e(r[1]):s:!1},Ew=t=>t==="position"||t==="percentage",kw=t=>t==="image"||t==="url",Cw=t=>t==="length"||t==="size"||t==="bg-size",Aw=t=>t==="length",xk=t=>t==="number",Rw=t=>t==="family-name",Ow=t=>t==="number"||t==="weight",Mw=t=>t==="shadow",bk=()=>{const t=At("color"),e=At("font"),s=At("text"),r=At("font-weight"),l=At("tracking"),u=At("leading"),d=At("breakpoint"),f=At("container"),m=At("spacing"),g=At("radius"),y=At("shadow"),x=At("inset-shadow"),w=At("text-shadow"),S=At("drop-shadow"),E=At("blur"),j=At("perspective"),_=At("aspect"),N=At("ease"),k=At("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),we,xe],U=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],R=()=>[we,xe,m],P=()=>[aa,"full","auto",...R()],Z=()=>[ra,"none","subgrid",we,xe],te=()=>["auto",{span:["full",ra,we,xe]},ra,we,xe],me=()=>[ra,"auto",we,xe],Ee=()=>["auto","min","max","fr",we,xe],ye=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_e=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...R()],Y=()=>[aa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],J=()=>[aa,"screen","full","dvw","lvw","svw","min","max","fit",...R()],pe=()=>[aa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],se=()=>[t,we,xe],M=()=>[...A(),d0,u0,{position:[we,xe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",gk,dk,{size:[we,xe]}],ne=()=>[dh,vo,Ba],oe=()=>["","none","full",g,we,xe],ue=()=>["",Ue,vo,Ba],q=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Ue,dh,d0,u0],ze=()=>["","none",E,we,xe],Be=()=>["none",Ue,we,xe],kt=()=>["none",Ue,we,xe],et=()=>[Ue,we,xe],le=()=>[aa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Es],breakpoint:[Es],color:[Tw],container:[Es],"drop-shadow":[Es],ease:["in","out","in-out"],font:[uk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Es],shadow:[Es],spacing:["px",Ue],text:[Es],"text-shadow":[Es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",aa,xe,we,_]}],container:["container"],columns:[{columns:[Ue,xe,we,f]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[ra,"auto",we,xe]}],basis:[{basis:[aa,"full","auto",f,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ue,aa,"auto","initial","none",xe]}],grow:[{grow:["",Ue,we,xe]}],shrink:[{shrink:["",Ue,we,xe]}],order:[{order:[ra,"first","last","none",we,xe]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":me()}],"col-end":[{"col-end":me()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":me()}],"row-end":[{"row-end":me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ee()}],"auto-rows":[{"auto-rows":Ee()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ye(),"normal"]}],"justify-items":[{"justify-items":[..._e(),"normal"]}],"justify-self":[{"justify-self":["auto",..._e()]}],"align-content":[{content:["normal",...ye()]}],"align-items":[{items:[..._e(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._e(),{baseline:["","last"]}]}],"place-content":[{"place-content":ye()}],"place-items":[{"place-items":[..._e(),"baseline"]}],"place-self":[{"place-self":["auto",..._e()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...pe()]}],"min-block-size":[{"min-block":["auto",...pe()]}],"max-block-size":[{"max-block":["none",...pe()]}],w:[{w:[f,"screen",...Y()]}],"min-w":[{"min-w":[f,"screen","none",...Y()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,vo,Ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,vk,fk]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dh,xe]}],"font-family":[{font:[pk,hk,e]}],"font-features":[{"font-features":[xe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,we,xe]}],"line-clamp":[{"line-clamp":[Ue,"none",we,c0]}],leading:[{leading:[u,...R()]}],"list-image":[{"list-image":["none",we,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:se()}],"text-color":[{text:se()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ue,"from-font","auto",we,Ba]}],"text-decoration-color":[{decoration:se()}],"underline-offset":[{"underline-offset":[Ue,"auto",we,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ra,we,xe],radial:["",we,xe],conic:[ra,we,xe]},yk,mk]}],"bg-color":[{bg:se()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:se()}],"gradient-via":[{via:se()}],"gradient-to":[{to:se()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:se()}],"border-color-x":[{"border-x":se()}],"border-color-y":[{"border-y":se()}],"border-color-s":[{"border-s":se()}],"border-color-e":[{"border-e":se()}],"border-color-bs":[{"border-bs":se()}],"border-color-be":[{"border-be":se()}],"border-color-t":[{"border-t":se()}],"border-color-r":[{"border-r":se()}],"border-color-b":[{"border-b":se()}],"border-color-l":[{"border-l":se()}],"divide-color":[{divide:se()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ue,we,xe]}],"outline-w":[{outline:["",Ue,vo,Ba]}],"outline-color":[{outline:se()}],shadow:[{shadow:["","none",y,Mc,Oc]}],"shadow-color":[{shadow:se()}],"inset-shadow":[{"inset-shadow":["none",x,Mc,Oc]}],"inset-shadow-color":[{"inset-shadow":se()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:se()}],"ring-offset-w":[{"ring-offset":[Ue,Ba]}],"ring-offset-color":[{"ring-offset":se()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":se()}],"text-shadow":[{"text-shadow":["none",w,Mc,Oc]}],"text-shadow-color":[{"text-shadow":se()}],opacity:[{opacity:[Ue,we,xe]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":se()}],"mask-image-linear-to-color":[{"mask-linear-to":se()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":se()}],"mask-image-t-to-color":[{"mask-t-to":se()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":se()}],"mask-image-r-to-color":[{"mask-r-to":se()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":se()}],"mask-image-b-to-color":[{"mask-b-to":se()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":se()}],"mask-image-l-to-color":[{"mask-l-to":se()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":se()}],"mask-image-x-to-color":[{"mask-x-to":se()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":se()}],"mask-image-y-to-color":[{"mask-y-to":se()}],"mask-image-radial":[{"mask-radial":[we,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":se()}],"mask-image-radial-to-color":[{"mask-radial-to":se()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":se()}],"mask-image-conic-to-color":[{"mask-conic-to":se()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,xe]}],filter:[{filter:["","none",we,xe]}],blur:[{blur:ze()}],brightness:[{brightness:[Ue,we,xe]}],contrast:[{contrast:[Ue,we,xe]}],"drop-shadow":[{"drop-shadow":["","none",S,Mc,Oc]}],"drop-shadow-color":[{"drop-shadow":se()}],grayscale:[{grayscale:["",Ue,we,xe]}],"hue-rotate":[{"hue-rotate":[Ue,we,xe]}],invert:[{invert:["",Ue,we,xe]}],saturate:[{saturate:[Ue,we,xe]}],sepia:[{sepia:["",Ue,we,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",we,xe]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ue,we,xe]}],"backdrop-contrast":[{"backdrop-contrast":[Ue,we,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ue,we,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ue,we,xe]}],"backdrop-invert":[{"backdrop-invert":["",Ue,we,xe]}],"backdrop-opacity":[{"backdrop-opacity":[Ue,we,xe]}],"backdrop-saturate":[{"backdrop-saturate":[Ue,we,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ue,we,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ue,"initial",we,xe]}],ease:[{ease:["linear","initial",N,we,xe]}],delay:[{delay:[Ue,we,xe]}],animate:[{animate:["none",k,we,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,we,xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:kt()}],"scale-x":[{"scale-x":kt()}],"scale-y":[{"scale-y":kt()}],"scale-z":[{"scale-z":kt()}],"scale-3d":["scale-3d"],skew:[{skew:et()}],"skew-x":[{"skew-x":et()}],"skew-y":[{"skew-y":et()}],transform:[{transform:[we,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:se()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:se()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,xe]}],fill:[{fill:["none",...se()]}],"stroke-w":[{stroke:[Ue,vo,Ba,c0]}],stroke:[{stroke:["none",...se()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wk=ZE(bk);function ge(...t){return wk(xw(t))}const ft=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("rounded-xl border bg-card text-card-foreground shadow",t),...e}));ft.displayName="Card";const zt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("flex flex-col space-y-1.5 p-6",t),...e}));zt.displayName="CardHeader";const Lt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("font-semibold leading-none tracking-tight",t),...e}));Lt.displayName="CardTitle";const wn=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("text-sm text-muted-foreground",t),...e}));wn.displayName="CardDescription";const xt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("p-6 pt-0",t),...e}));xt.displayName="CardContent";const Tu=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("flex items-center p-6 pt-0",t),...e}));Tu.displayName="CardFooter";function ou({className:t}){return o.jsx("img",{src:"/folio-logo.svg",alt:"Folio Logo",className:ge("w-full h-full object-contain",t)})}const Dw=(...t)=>t.filter((e,s,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===s).join(" ").trim();const Sk=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const jk=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,r)=>r?r.toUpperCase():s.toLowerCase());const f0=t=>{const e=jk(t);return e.charAt(0).toUpperCase()+e.slice(1)};var _k={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"};const Nk=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const Tk=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:l="",children:u,iconNode:d,...f},m)=>v.createElement("svg",{ref:m,..._k,width:e,height:e,stroke:t,strokeWidth:r?Number(s)*24/Number(e):s,className:Dw("lucide",l),...!u&&!Nk(f)&&{"aria-hidden":"true"},...f},[...d.map(([g,y])=>v.createElement(g,y)),...Array.isArray(u)?u:[u]]));const fe=(t,e)=>{const s=v.forwardRef(({className:r,...l},u)=>v.createElement(Tk,{ref:u,iconNode:e,className:Dw(`lucide-${Sk(f0(t))}`,`lucide-${t}`,r),...l}));return s.displayName=f0(t),s};const Ek=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ui=fe("activity",Ek);const kk=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ck=fe("arrow-right",kk);const Ak=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Rk=fe("book-open",Ak);const Ok=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Zh=fe("bot",Ok);const Mk=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Pw=fe("brain",Mk);const Dk=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Pk=fe("building-2",Dk);const zk=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],zw=fe("calendar",zk);const Lk=[["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"}]],Uk=fe("camera",Lk);const Bk=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],as=fe("check",Bk);const Vk=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=fe("chevron-down",Vk);const Ik=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Jo=fe("chevron-left",Ik);const $k=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],di=fe("chevron-right",$k);const qk=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],lu=fe("chevron-up",qk);const Hk=[["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"}]],Sn=fe("circle-alert",Hk);const Gk=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fk=fe("circle-check-big",Gk);const Kk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],os=fe("circle-check",Kk);const Yk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Lw=fe("circle-x",Yk);const Xk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Qo=fe("clock",Xk);const Wk=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],h0=fe("cloud",Wk);const Jk=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Qk=fe("copy",Jk);const Zk=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Bm=fe("cpu",Zk);const eC=[["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"}]],Eu=fe("database",eC);const tC=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Uw=fe("external-link",tC);const nC=[["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"}]],sC=fe("eye-off",nC);const aC=[["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"}]],rC=fe("eye",aC);const iC=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]],oC=fe("file-digit",iC);const lC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Vm=fe("file-text",lC);const cC=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Bw=fe("funnel",cC);const uC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],dC=fe("globe",uC);const fC=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],hC=fe("hard-drive",fC);const mC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],pC=fe("history",mC);const gC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Im=fe("info",gC);const yC=[["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"}]],Zo=fe("key",yC);const vC=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],xC=fe("layers",vC);const bC=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],m0=fe("layout-dashboard",bC);const wC=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],it=fe("loader-circle",wC);const SC=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Vw=fe("log-in",SC);const jC=[["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"}]],Iw=fe("log-out",jC);const _C=[["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"}]],Vo=fe("mail",_C);const NC=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],cu=fe("message-square",NC);const TC=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],$w=fe("minimize-2",TC);const EC=[["path",{d:"M5 12h14",key:"1ays0h"}]],em=fe("minus",EC);const kC=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CC=fe("moon",kC);const AC=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],RC=fe("package",AC);const OC=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qw=fe("play",OC);const MC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Wa=fe("plus",MC);const DC=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],PC=fe("refresh-ccw",DC);const zC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ma=fe("refresh-cw",zC);const LC=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],UC=fe("rocket",LC);const BC=[["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"}]],VC=fe("save",BC);const IC=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Hw=fe("scroll-text",IC);const $C=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],qC=fe("search",$C);const HC=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],GC=fe("send",HC);const FC=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],KC=fe("server",FC);const YC=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],$m=fe("settings-2",YC);const XC=[["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"}]],WC=fe("settings",XC);const JC=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],p0=fe("share-2",JC);const QC=[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],uu=fe("shield-alert",QC);const ZC=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ya=fe("shield-check",ZC);const eA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Cs=fe("sparkles",eA);const tA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],nA=fe("sun",tA);const sA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],du=fe("tag",sA);const aA=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Io=fe("terminal",aA);const rA=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],iA=fe("test-tube",rA);const oA=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],lA=fe("toggle-left",oA);const cA=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],uA=fe("toggle-right",cA);const dA=[["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"}]],el=fe("trash-2",dA);const fA=[["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"}]],Gw=fe("triangle-alert",fA);const hA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],tm=fe("upload",hA);const mA=[["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:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],pA=fe("user-plus",mA);const gA=[["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"}]],ku=fe("user",gA);const yA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],nm=fe("volume-2",yA);const vA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Fw=fe("volume-x",vA);const xA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zn=fe("x",xA);const bA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],fu=fe("zap",bA),Cu="folio_supabase_config";function g0(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.url=="string"&&typeof e.anonKey=="string"&&e.url.startsWith("http")&&e.anonKey.length>20&&!e.url.includes("placeholder.supabase.co")}function $o(){try{const e=localStorage.getItem(Cu);if(e){const s=JSON.parse(e);if(g0(s))return s}}catch{}const t={url:void 0,anonKey:void 0};return g0(t)?t:null}function fh(t){localStorage.setItem(Cu,JSON.stringify(t))}function wA(){localStorage.removeItem(Cu)}async function SA(t,e){if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const s=e.startsWith("eyJ"),r=e.startsWith("sb_publishable_");if(!s&&!r)return{valid:!1,error:"Invalid anon key format"};if(r)return{valid:!0};const l=new AbortController,u=setTimeout(()=>l.abort("Validation timeout"),12e3);try{const d=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`},signal:l.signal});return d.ok?(clearTimeout(u),{valid:!0}):(clearTimeout(u),{valid:!1,error:`Connection failed (${d.status})`})}catch(d){return clearTimeout(u),d instanceof DOMException&&d.name==="AbortError"?{valid:!1,error:"Connection validation timed out (12s). Check project URL/key and network."}:{valid:!1,error:d instanceof Error?d.message:"Connection failed"}}}function jA(){return localStorage.getItem(Cu)?"ui":"none"}let Dc=null;function un(){const t=$o();return t?(Dc||(Dc=zm(t.url,t.anonKey,{auth:{autoRefreshToken:!0,persistSession:!0}})),Dc):(Dc=null,null)}function hh(){const t=$o(),e=t?`${t.url}/functions/v1`:"",s=t?.anonKey??"",u=window.location.port==="5173"?void 0||"http://localhost:3006":window.location.origin;return{edgeFunctionsUrl:e,expressApiUrl:u,anonKey:s}}class _A{edgeFunctionsUrl;expressApiUrl;anonKey;constructor(){const e=hh();this.edgeFunctionsUrl=e.edgeFunctionsUrl,this.expressApiUrl=e.expressApiUrl,this.anonKey=e.anonKey}async request(e,s,r={}){const{auth:l=!1,token:u,...d}=r,f={"Content-Type":"application/json",...d.headers||{}};l&&u&&(f.Authorization=`Bearer ${u}`);try{const m=await fetch(`${e}${s}`,{...d,headers:f}),g=await m.json().catch(()=>({}));return m.ok?{data:g}:{error:{code:g?.error?.code||"API_ERROR",message:g?.error?.message||g?.error||`Request failed (${m.status})`}}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(e,s={}){const r={...s.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,e,{...s,headers:r})}expressRequest(e,s={}){const r=hh(),l={...s.headers||{},"X-Supabase-Url":r.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":r.anonKey};return this.request(this.expressApiUrl,e,{...s,headers:l})}get(e,s={}){return this.expressRequest(e,{method:"GET",...s,auth:!0})}post(e,s,r={}){return this.expressRequest(e,{method:"POST",body:s?JSON.stringify(s):void 0,...r,auth:!0})}getChatSessions(e){return this.expressRequest("/api/chat/sessions",{method:"GET",auth:!!e,token:e})}getDashboardStats(e){return this.expressRequest("/api/stats",{method:"GET",auth:!!e,token:e})}createChatSession(e){return this.expressRequest("/api/chat/sessions",{method:"POST",auth:!!e,token:e})}getChatMessages(e,s){return this.expressRequest(`/api/chat/sessions/${e}/messages`,{method:"GET",auth:!!s,token:s})}sendChatMessage(e,s){return this.expressRequest("/api/chat/message",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getHealth(){return this.expressRequest("/api/health",{method:"GET"})}testSupabase(e,s){return this.expressRequest("/api/setup/test-supabase",{method:"POST",body:JSON.stringify({url:e,anonKey:s})})}dispatchProcessingJob(e,s){return this.expressRequest("/api/processing/dispatch",{method:"POST",auth:!!s,token:s,body:JSON.stringify({source_type:"manual",payload:e})})}getSettings(e){return this.expressRequest("/api/settings",{method:"GET",auth:!!e,token:e})}updateSettings(e,s){return this.expressRequest("/api/settings",{method:"PATCH",auth:!!s,token:s,body:JSON.stringify(e)})}getAccounts(e){return this.expressRequest("/api/accounts",{method:"GET",auth:!!e,token:e})}disconnectAccount(e,s){return this.expressRequest("/api/accounts/disconnect",{method:"POST",auth:!!s,token:s,body:JSON.stringify({accountId:e})})}getRules(e){return this.expressRequest("/api/rules",{method:"GET",auth:!!e,token:e})}createRule(e,s){return this.expressRequest("/api/rules",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}updateRule(e,s,r){return this.expressRequest(`/api/rules/${e}`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify(s)})}deleteRule(e,s){return this.expressRequest(`/api/rules/${e}`,{method:"DELETE",auth:!!s,token:s})}toggleRule(e,s){return this.expressRequest(`/api/rules/${e}/toggle`,{method:"POST",auth:!!s,token:s})}getStats(e){return this.expressRequest("/api/stats",{method:"GET",auth:!!e,token:e})}getProfile(e){return this.edgeRequest("/api-v1-profile",{method:"GET",auth:!!e,token:e})}updateProfile(e,s){return this.edgeRequest("/api-v1-profile",{method:"PATCH",auth:!!s,token:s,body:JSON.stringify(e)})}getChatProviders(e){return this.expressRequest("/api/sdk/providers/chat",{method:"GET",auth:!!e,token:e})}getEmbedProviders(e){return this.expressRequest("/api/sdk/providers/embed",{method:"GET",auth:!!e,token:e})}testLlm(e,s){return this.expressRequest("/api/sdk/test-llm",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getGmailAuthUrl(e,s,r){return this.expressRequest("/api/accounts/gmail/auth-url",{method:"POST",auth:!!r,token:r,body:JSON.stringify({clientId:e,clientSecret:s})})}connectGmail(e,s,r,l){return this.expressRequest("/api/accounts/gmail/connect",{method:"POST",auth:!!l,token:l,body:JSON.stringify({authCode:e,clientId:s,clientSecret:r})})}getGoogleDriveAuthUrl(e,s){return this.expressRequest("/api/accounts/google-drive/auth-url",{method:"POST",auth:!!s,token:s,body:JSON.stringify({clientId:e})})}connectGoogleDrive(e,s,r,l){return this.expressRequest("/api/accounts/google-drive/connect",{method:"POST",auth:!!l,token:l,body:JSON.stringify({authCode:e,clientId:s,clientSecret:r})})}startMicrosoftDeviceFlow(e,s,r){return this.expressRequest("/api/accounts/microsoft/device-flow",{method:"POST",auth:!!r,token:r,body:JSON.stringify({clientId:e,tenantId:s})})}pollMicrosoftDeviceCode(e,s,r,l){return this.expressRequest("/api/accounts/microsoft/poll",{method:"POST",auth:!!l,token:l,body:JSON.stringify({deviceCode:e,clientId:s,tenantId:r})})}connectImap(e,s){return this.expressRequest("/api/accounts/imap/connect",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}setup(e){return this.edgeRequest("/setup",{method:"POST",body:JSON.stringify(e)})}getPolicies(e){return this.expressRequest("/api/policies",{auth:!!e,token:e})}savePolicy(e,s){return this.expressRequest("/api/policies",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}deletePolicy(e,s){return this.expressRequest(`/api/policies/${e}`,{method:"DELETE",auth:!!s,token:s})}patchPolicy(e,s,r){return this.expressRequest(`/api/policies/${e}`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify(s)})}reloadPolicies(e){return this.expressRequest("/api/policies/reload",{method:"POST",auth:!!e,token:e})}synthesizePolicy(e,s){return this.expressRequest("/api/policies/synthesize",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getSDKChatProviders(){return this.expressRequest("/api/sdk/providers/chat")}getIngestions(e={},s){const r=new URLSearchParams;e.page&&r.set("page",String(e.page)),e.pageSize&&r.set("pageSize",String(e.pageSize)),e.q&&r.set("q",e.q);const l=r.toString()?`?${r}`:"";return this.expressRequest(`/api/ingestions${l}`,{auth:!!s,token:s})}uploadDocument(e,s){const r=new FormData;r.append("file",e);const l=hh(),u={"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return s&&(u.Authorization=`Bearer ${s}`),fetch(`${l.expressApiUrl}/api/ingestions/upload`,{method:"POST",headers:u,body:r}).then(d=>d.json())}rerunIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}/rerun`,{method:"POST",auth:!!s,token:s})}matchIngestionToPolicy(e,s,r){const l=s.learn!==!1,u=s.rerun!==!1;return this.expressRequest(`/api/ingestions/${e}/match`,{method:"POST",auth:!!r,token:r,body:JSON.stringify({policy_id:s.policyId,learn:l,rerun:u,allow_side_effects:s.allowSideEffects===!0})})}suggestPolicyRefinement(e,s,r){return this.expressRequest(`/api/ingestions/${e}/refine-policy`,{method:"POST",auth:!!r,token:r,body:JSON.stringify({policy_id:s.policyId,provider:s.provider,model:s.model})})}deleteIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}`,{method:"DELETE",auth:!!s,token:s})}updateIngestionTags(e,s,r){return this.expressRequest(`/api/ingestions/${e}/tags`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify({tags:s})})}summarizeIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}/summarize`,{method:"POST",auth:!!s,token:s})}getBaselineConfig(e){return this.expressRequest("/api/baseline-config",{auth:!!e,token:e})}getBaselineConfigHistory(e){return this.expressRequest("/api/baseline-config/history",{auth:!!e,token:e})}saveBaselineConfig(e,s){return this.expressRequest("/api/baseline-config",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}activateBaselineConfig(e,s){return this.expressRequest(`/api/baseline-config/${e}/activate`,{method:"POST",auth:!!s,token:s})}suggestBaselineConfig(e,s){return this.expressRequest("/api/baseline-config/suggest",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}}const Te=new _A;let ns=[],sm=new Set;function am(){sm.forEach(t=>t())}const ce={success:(t,e)=>Pc("success",t,e),error:(t,e)=>Pc("error",t,e),info:(t,e)=>Pc("info",t,e),warning:(t,e)=>Pc("warning",t,e)};function Pc(t,e,s=5e3){const r=ns.findIndex(u=>u.message===e&&u.type===t);if(r!==-1){const u=ns[r];ns=[...ns],ns[r]={...u,count:(u.count||1)+1,lastUpdated:Date.now()},am();return}const l=Math.random().toString(36).substr(2,9);ns=[...ns,{id:l,type:t,message:e,duration:s,count:1,lastUpdated:Date.now()}],am(),s>0&&setTimeout(()=>Kw(l),s)}function Kw(t){ns=ns.filter(e=>e.id!==t),am()}function NA(){const[,t]=v.useState(0);return v.useEffect(()=>{const e=()=>t(s=>s+1);return sm.add(e),()=>{sm.delete(e)}},[]),ns}const TA={success:Fk,error:Sn,info:Im,warning:Gw},EA={success:"bg-emerald-500/10 border-emerald-500/20 text-emerald-600 dark:text-emerald-400",error:"bg-destructive/10 border-destructive/20 text-destructive",info:"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400",warning:"bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-400"};function kA({toast:t}){const e=TA[t.type];return o.jsxs("div",{className:ge("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",EA[t.type]),children:[o.jsxs("div",{className:"relative",children:[o.jsx(e,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),t.count&&t.count>1&&o.jsx("span",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] font-bold px-1.5 rounded-full border border-background scale-90 animate-in zoom-in duration-200",children:t.count})]}),o.jsx("p",{className:"text-sm flex-1",children:t.message}),o.jsx("button",{onClick:()=>Kw(t.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(zn,{className:"w-4 h-4"})})]})}function CA(){const t=NA();return t.length===0?null:o.jsx("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col-reverse gap-2 max-w-sm w-full",children:t.map(e=>o.jsx(kA,{toast:e},e.id))})}function AA({configSnapshot:t,configSource:e,setActivePage:s}){const[r,l]=v.useState(null),[u,d]=v.useState(!0),[f,m]=v.useState(!1),[g,y]=v.useState(!1),x=v.useRef(null),w=v.useCallback(async()=>{d(!0);try{const j=un();if(!j)return;const{data:_}=await j.auth.getSession(),N=_.session?.access_token??null;if(!N)return;const k=await Te.getDashboardStats(N);k.data?.success&&l(k.data.stats)}catch(j){console.error("Failed to fetch dashboard stats",j)}finally{d(!1)}},[]);v.useEffect(()=>{w()},[w]);const S=async j=>{const _=Array.from(j);if(_.length){s("funnel"),y(!0);try{const N=un();if(!N)return;const{data:k}=await N.auth.getSession(),C=k.session?.access_token??null;if(!C)return;for(const A of _){ce.info(`Ingesting ${A.name}…`);const D=await Te.uploadDocument?.(A,C);if(D?.success)if(D.ingestion?.status==="duplicate"){const U=D.ingestion.extracted?.original_filename??"a previous upload";ce.warning(`${A.name} is a duplicate of "${U}" — skipped.`)}else ce.success(`${A.name} → ${D.ingestion?.status}`);else ce.error(`Failed to ingest ${A.name}`)}await w()}finally{y(!1)}}},E=j=>{j.preventDefault(),m(!1),S(j.dataTransfer.files)};return o.jsxs("div",{className:"w-full mx-auto px-8 py-10 space-y-12 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"text-center space-y-3",children:[o.jsxs("h2",{className:"text-4xl font-black tracking-tight flex items-center justify-center gap-3",children:[o.jsx(ou,{className:"w-10 h-10 animate-pulse"}),"Command Center"]}),o.jsx("p",{className:"text-muted-foreground text-lg max-w-2xl mx-auto",children:"Central intelligence hub for document ingestion, routing, and synthetic knowledge."})]}),o.jsxs("div",{className:"w-full space-y-10",children:[o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[o.jsx(zc,{title:"Documents Ingested",value:r?.totalDocuments,icon:o.jsx(Vm,{className:"w-5 h-5 text-blue-500"}),isLoading:u,colorClass:"bg-blue-500/10"}),o.jsx(zc,{title:"Active Policies",value:r?.activePolicies,icon:o.jsx(p0,{className:"w-5 h-5 text-emerald-500"}),isLoading:u,colorClass:"bg-emerald-500/10"}),o.jsx(zc,{title:"Knowledge Chunks",value:r?.ragChunks,icon:o.jsx(Eu,{className:"w-5 h-5 text-purple-500"}),isLoading:u,colorClass:"bg-purple-500/10"}),o.jsx(zc,{title:"Automation Runs",value:r?.automationRuns,icon:o.jsx(ui,{className:"w-5 h-5 text-amber-500"}),isLoading:u,colorClass:"bg-amber-500/10"})]}),o.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[o.jsx("div",{className:"lg:col-span-2",children:o.jsxs("div",{onDragOver:j=>{j.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:E,onClick:()=>x.current?.click(),className:ge("h-full rounded-2xl border-2 border-dashed transition-all cursor-pointer flex flex-col items-center justify-center gap-4 py-16",f?"border-primary bg-primary/5 scale-[1.01]":"border-muted-foreground/20 hover:border-primary/50 hover:bg-muted/30"),children:[o.jsx("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:j=>j.target.files&&S(j.target.files)}),g?o.jsx(it,{className:"w-12 h-12 animate-spin text-primary"}):o.jsx(tm,{className:ge("w-12 h-12 transition-colors",f?"text-primary":"text-muted-foreground/50")}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-lg font-medium text-foreground",children:f?"Drop to ingest...":"Drag & drop files to ingest"}),o.jsx("p",{className:"text-sm text-muted-foreground/60",children:"Supports .pdf, .docx, .md, .txt (up to 20MB)"})]})]})}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs(ft,{className:"flex-1 cursor-pointer hover:border-primary/50 hover:bg-muted/30 transition-all flex flex-col items-center justify-center p-6 text-center shadow-sm",onClick:()=>s("chat"),children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-indigo-500/10 flex items-center justify-center mb-4",children:o.jsx(cu,{className:"w-6 h-6 text-indigo-500"})}),o.jsx("h3",{className:"font-bold mb-1",children:"Chat with Data"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask questions against your vectorized knowledge base."})]}),o.jsxs(ft,{className:"flex-1 cursor-pointer hover:border-primary/50 hover:bg-muted/30 transition-all flex flex-col items-center justify-center p-6 text-center shadow-sm",onClick:()=>s("policies"),children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/10 flex items-center justify-center mb-4",children:o.jsx(p0,{className:"w-6 h-6 text-orange-500"})}),o.jsx("h3",{className:"font-bold mb-1",children:"Create Policy"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Define a new routing and automation contract."})]})]})]})]})]})}function zc({title:t,value:e,icon:s,isLoading:r,colorClass:l}){return o.jsx(ft,{className:"shadow-sm",children:o.jsxs(xt,{className:"p-6",children:[o.jsx("div",{className:"flex items-center justify-between mb-4",children:o.jsx("div",{className:ge("w-10 h-10 rounded-xl flex items-center justify-center",l),children:s})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:t}),r?o.jsx("div",{className:"h-8 w-16 bg-muted animate-pulse rounded-md"}):o.jsx("p",{className:"text-3xl font-black",children:e!==void 0?e.toLocaleString():"0"})]})]})})}function y0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Au(...t){return e=>{let s=!1;const r=t.map(l=>{const u=y0(l,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let l=0;l<r.length;l++){const u=r[l];typeof u=="function"?u():y0(t[l],null)}}}}function nr(...t){return v.useCallback(Au(...t),t)}var RA=Symbol.for("react.lazy"),hu=Mm[" use ".trim().toString()];function OA(t){return typeof t=="object"&&t!==null&&"then"in t}function Yw(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===RA&&"_payload"in t&&OA(t._payload)}function Xw(t){const e=DA(t),s=v.forwardRef((r,l)=>{let{children:u,...d}=r;Yw(u)&&typeof hu=="function"&&(u=hu(u._payload));const f=v.Children.toArray(u),m=f.find(zA);if(m){const g=m.props.children,y=f.map(x=>x===m?v.Children.count(g)>1?v.Children.only(null):v.isValidElement(g)?g.props.children:null:x);return o.jsx(e,{...d,ref:l,children:v.isValidElement(g)?v.cloneElement(g,void 0,y):null})}return o.jsx(e,{...d,ref:l,children:u})});return s.displayName=`${t}.Slot`,s}var MA=Xw("Slot");function DA(t){const e=v.forwardRef((s,r)=>{let{children:l,...u}=s;if(Yw(l)&&typeof hu=="function"&&(l=hu(l._payload)),v.isValidElement(l)){const d=UA(l),f=LA(u,l.props);return l.type!==v.Fragment&&(f.ref=r?Au(r,d):d),v.cloneElement(l,f)}return v.Children.count(l)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var PA=Symbol("radix.slottable");function zA(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===PA}function LA(t,e){const s={...e};for(const r in e){const l=t[r],u=e[r];/^on[A-Z]/.test(r)?l&&u?s[r]=(...f)=>{const m=u(...f);return l(...f),m}:l&&(s[r]=l):r==="style"?s[r]={...l,...u}:r==="className"&&(s[r]=[l,u].filter(Boolean).join(" "))}return{...t,...s}}function UA(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}const v0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,x0=xw,qm=(t,e)=>s=>{var r;if(e?.variants==null)return x0(t,s?.class,s?.className);const{variants:l,defaultVariants:u}=e,d=Object.keys(l).map(g=>{const y=s?.[g],x=u?.[g];if(y===null)return null;const w=v0(y)||v0(x);return l[g][w]}),f=s&&Object.entries(s).reduce((g,y)=>{let[x,w]=y;return w===void 0||(g[x]=w),g},{}),m=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((g,y)=>{let{class:x,className:w,...S}=y;return Object.entries(S).every(E=>{let[j,_]=E;return Array.isArray(_)?_.includes({...u,...f}[j]):{...u,...f}[j]===_})?[...g,x,w]:g},[]);return x0(t,d,m,s?.class,s?.className)},BA=qm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ae=v.forwardRef(({className:t,variant:e,size:s,asChild:r=!1,...l},u)=>{const d=r?MA:"button";return o.jsx(d,{className:ge(BA({variant:e,size:s,className:t})),ref:u,...l})});ae.displayName="Button";const je=v.forwardRef(({className:t,type:e,...s},r)=>o.jsx("input",{type:e,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...s}));je.displayName="Input";var Ww=tw();const VA=Zb(Ww);var IA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$A=IA.reduce((t,e)=>{const s=Xw(`Primitive.${e}`),r=v.forwardRef((l,u)=>{const{asChild:d,...f}=l,m=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),qA="Label",Jw=v.forwardRef((t,e)=>o.jsx($A.label,{...t,ref:e,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(t.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));Jw.displayName=qA;var HA=Jw;function Je({className:t,...e}){return o.jsx(HA,{"data-slot":"label",className:ge("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}const GA=qm("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Pt({className:t,variant:e,...s}){return o.jsx("div",{className:ge(GA({variant:e}),t),...s})}const FA=qm("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jn=v.forwardRef(({className:t,variant:e,...s},r)=>o.jsx("div",{ref:r,role:"alert",className:ge(FA({variant:e}),t),...s}));jn.displayName="Alert";const Hm=v.forwardRef(({className:t,...e},s)=>o.jsx("h5",{ref:s,className:ge("mb-1 font-medium leading-none tracking-tight",t),...e}));Hm.displayName="AlertTitle";const _n=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("text-sm [&_p]:leading-relaxed",t),...e}));_n.displayName="AlertDescription";function KA({supabase:t,initStatus:e,sessionStatus:s,sessionEmail:r,onRefresh:l}){const[u,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState(""),[x,w]=v.useState(""),[S,E]=v.useState(!1),[j,_]=v.useState(null),N=e==="empty";async function k(){E(!0),_(null);const{error:U}=await t.auth.signInWithPassword({email:u,password:f});U?_(U.message):l(),E(!1)}async function C(){E(!0),_(null);try{const U=await Te.setup({email:u,password:f,first_name:g,last_name:x});if(U.error)throw new Error(typeof U.error=="string"?U.error:U.error.message);const{error:V}=await t.auth.signInWithPassword({email:u,password:f});if(V)throw V;l()}catch(U){_(U.message||"Failed to initialize foundation.")}finally{E(!1)}}async function A(){E(!0),_(null);const{error:U}=await t.auth.signUp({email:u,password:f,options:{data:{first_name:g,last_name:x}}});U?_(U.message):l(),E(!1)}async function D(){E(!0),await t.auth.signOut(),l(),E(!1)}return s==="authenticated"?o.jsxs("div",{className:"space-y-4 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-xl bg-primary/5 border border-primary/10",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-primary flex items-center justify-center text-primary-foreground",children:o.jsx(ku,{className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground leading-none mb-1",children:"Authenticated as"}),o.jsx("p",{className:"text-sm font-medium truncate",children:r})]})]}),e==="missing_view"&&o.jsxs(jn,{variant:"destructive",className:"bg-destructive/5 text-destructive border-destructive/20",children:[o.jsx(uu,{className:"w-4 h-4"}),o.jsx(_n,{className:"text-xs",children:"Database views missing. Foundation may be corrupted."})]}),o.jsxs(ae,{variant:"outline",className:"w-full h-11 hover:bg-destructive hover:text-destructive-reveal group transition-all duration-300",onClick:D,disabled:S,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Iw,{className:"w-4 h-4 mr-2 group-hover:rotate-180 transition-transform duration-500"}),"Logout Protocol"]})]}):o.jsxs("div",{className:"space-y-4 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"grid gap-4",children:[N&&o.jsxs("div",{className:"grid grid-cols-2 gap-4 animate-in slide-in-from-top-2 duration-300",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-firstname",children:"First Name"}),o.jsx(je,{id:"auth-firstname",placeholder:"Agent",value:g,onChange:U=>y(U.target.value),className:"h-10"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-lastname",children:"Last Name"}),o.jsx(je,{id:"auth-lastname",placeholder:"Zero",value:x,onChange:U=>w(U.target.value),className:"h-10"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-email",children:"Email Address"}),o.jsxs("div",{className:"relative",children:[o.jsx(Vo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(je,{id:"auth-email",type:"email",placeholder:"admin@example.com",value:u,onChange:U=>d(U.target.value),className:"pl-9 h-10"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-password",children:"Security Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Zo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(je,{id:"auth-password",type:"password",placeholder:"••••••••",value:f,onChange:U=>m(U.target.value),className:"pl-9 h-10",autoComplete:N?"new-password":"current-password"})]})]})]}),j&&o.jsx(jn,{variant:"destructive",className:"py-2 px-3",children:o.jsx(_n,{className:"text-[11px] leading-relaxed italic",children:j})}),o.jsx("div",{className:"pt-2",children:N?o.jsxs(ae,{className:"w-full h-11 shadow-lg shadow-primary/20",onClick:C,disabled:S||!u||!f||!g,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(ya,{className:"w-4 h-4 mr-2"}),"Initialize Primary Admin"]}):o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs(ae,{className:"h-10",onClick:k,disabled:S||!u||!f,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Vw,{className:"w-4 h-4 mr-2"}),"Login"]}),o.jsxs(ae,{variant:"secondary",className:"h-10",onClick:A,disabled:S||!u||!f,children:[o.jsx(pA,{className:"w-4 h-4 mr-2"}),"Enroll"]})]})}),o.jsx("p",{className:"text-[10px] text-center text-muted-foreground uppercase tracking-widest font-bold opacity-50 pt-2",children:N?"Foundation Assembly Phase":"Foundation Access Required"})]})}const fa="0.1.5",YA="20260228000001";async function XA(t,e){const s=Promise.resolve(t);let r=null;const l=new Promise((u,d)=>{r=setTimeout(()=>{d(new Error(`Operation timed out after ${e}ms`))},e)});try{return await Promise.race([s,l])}finally{r&&clearTimeout(r)}}async function WA(t){try{const{data:e,error:s}=await XA(t.rpc("get_latest_migration_timestamp"),12e3);if(s)return s.code==="42883"?{latestMigrationTimestamp:"0"}:{latestMigrationTimestamp:null};const r=e??null;return r&&r>="29990000000000"?{latestMigrationTimestamp:null}:{latestMigrationTimestamp:r}}catch{return{latestMigrationTimestamp:null}}}async function Qw(t){const e=await WA(t);return!e.latestMigrationTimestamp||e.latestMigrationTimestamp.trim()===""?{needsMigration:!0,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database migration state unknown."}:YA>e.latestMigrationTimestamp?{needsMigration:!0,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:`Database is behind (${e.latestMigrationTimestamp}).`}:{needsMigration:!1,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database schema is up-to-date."}}function JA({supabase:t,sessionEmail:e,sessionStatus:s,initStatus:r,configSnapshot:l,configSource:u,onRefresh:d,onLaunchSetup:f,onResetSetup:m}){const[g,y]=v.useState("profile"),[x,w]=v.useState(null),[S,E]=v.useState(!1);async function j(){if(!t)return;E(!0);const{data:{user:k}}=await t.auth.getUser();if(k){const{data:C}=await t.from("profiles").select("*").eq("id",k.id).single();C&&w(C)}E(!1)}v.useEffect(()=>{s==="authenticated"&&t&&j()},[s,t]);const _=[{id:"profile",label:"Profile",icon:ku},{id:"security",label:"Security",icon:ya},{id:"supabase",label:"Supabase",icon:Eu}];async function N(){t&&(await t.auth.signOut(),d())}return o.jsxs("div",{className:"max-w-6xl mx-auto space-y-8 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-4xl font-black tracking-tight",children:"Account Settings"}),o.jsx("p",{className:"text-muted-foreground text-lg",children:"Manage your profile and foundational preferences."})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-12 items-start",children:[o.jsxs("aside",{className:"w-full md:w-72 flex flex-col gap-8 shrink-0",children:[o.jsx("nav",{className:"space-y-1",children:_.map(k=>{const C=k.icon,A=g===k.id;return o.jsxs("button",{onClick:()=>y(k.id),className:ge("w-full flex items-center gap-3 px-4 py-3 text-sm font-bold rounded-xl transition-all duration-300",A?"bg-foreground text-background shadow-lg shadow-foreground/10":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[o.jsx(C,{className:ge("w-5 h-5",A?"text-background":"text-muted-foreground/60")}),k.label]},k.id)})}),o.jsxs("div",{className:"pt-8 border-t space-y-6",children:[o.jsxs("button",{onClick:N,className:"group w-full flex items-center gap-3 px-4 py-2 text-sm font-bold rounded-xl transition-all duration-300 text-destructive hover:bg-destructive/10",children:[o.jsx(Iw,{className:"w-5 h-5 transition-transform group-hover:translate-x-1"}),"Logout"]}),o.jsxs("div",{className:"px-4",children:[o.jsx("p",{className:"text-[10px] font-black text-muted-foreground/40 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/60",children:["v",fa]})]})]})]}),o.jsxs("div",{className:"flex-1 w-full animate-in slide-in-from-right-4 duration-500",children:[g==="profile"&&o.jsx(QA,{sessionEmail:e,sessionStatus:s,supabase:t,initStatus:r,profile:x,onProfileUpdate:j,onRefresh:d,isLoading:S}),g==="security"&&o.jsx(ZA,{supabase:t}),g==="supabase"&&o.jsx(eR,{configSnapshot:l,configSource:u,onLaunchSetup:f,onResetSetup:m})]})]})]})}function QA({sessionEmail:t,sessionStatus:e,supabase:s,initStatus:r,profile:l,onProfileUpdate:u,onRefresh:d,isLoading:f}){const[m,g]=v.useState(""),[y,x]=v.useState(""),[w,S]=v.useState(!0),[E,j]=v.useState(!1),[_,N]=v.useState(!1);v.useEffect(()=>{l&&(g(l.first_name||""),x(l.last_name||""))},[l]);const k=async()=>{if(!s||!l)return;j(!0);const{error:A}=await s.from("profiles").update({first_name:m,last_name:y}).eq("id",l.id);A||u(),j(!1)},C=async A=>{const D=A.target.files?.[0];if(!(!D||!s||!l)){N(!0);try{const U=D.name.split(".").pop(),V=`${l.id}/${Math.random()}.${U}`,{error:R}=await s.storage.from("avatars").upload(V,D);if(R)throw R;const{data:{publicUrl:P}}=s.storage.from("avatars").getPublicUrl(V);await s.from("profiles").update({avatar_url:P}).eq("id",l.id),u()}catch(U){console.error("Upload error:",U)}finally{N(!1)}}};return o.jsxs(ft,{className:"border-border/40 shadow-xl shadow-black/5 bg-card/50 backdrop-blur-sm overflow-hidden",children:[o.jsxs(zt,{className:"p-8 border-b bg-muted/20",children:[o.jsx(Lt,{className:"text-2xl font-black",children:"Profile Information"}),o.jsx(wn,{className:"text-base",children:"Update your personal foundation details."})]}),o.jsx(xt,{className:"p-8 space-y-10",children:f?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(it,{className:"w-8 h-8 animate-spin text-primary"})}):e==="authenticated"?o.jsxs("div",{className:"space-y-10",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-8",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-32 h-32 rounded-full bg-primary/10 border-4 border-background shadow-2xl overflow-hidden flex items-center justify-center",children:l?.avatar_url?o.jsx("img",{src:l.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):t?o.jsx("span",{className:"text-4xl font-black text-primary",children:t.charAt(0).toUpperCase()}):o.jsx(ku,{className:"w-12 h-12 text-primary/40"})}),o.jsxs("label",{className:"absolute bottom-1 right-1 h-10 w-10 rounded-full bg-background border shadow-lg flex items-center justify-center hover:scale-110 transition-transform cursor-pointer",children:[_?o.jsx(it,{className:"w-4 h-4 animate-spin text-muted-foreground"}):o.jsx(Uk,{className:"w-5 h-5 text-muted-foreground"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:C,disabled:_})]})]}),o.jsxs("div",{className:"flex-1 w-full grid grid-cols-1 sm:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"firstName",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"First Name"}),o.jsx(je,{id:"firstName",placeholder:"Trung",value:m,onChange:A=>g(A.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"lastName",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Last Name"}),o.jsx(je,{id:"lastName",placeholder:"Le",value:y,onChange:A=>x(A.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[o.jsx(Je,{htmlFor:"email",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Email Address"}),o.jsx(je,{id:"email",value:t||"",disabled:!0,className:"h-12 rounded-xl bg-muted/40 border-border/40 opacity-70 cursor-not-allowed"}),o.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-bold ml-1",children:"This is your login email and cannot be changed."})]})]})]}),o.jsxs("div",{className:"pt-8 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"text-base font-bold",children:"Sound & Haptic Feedback"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Play chimes and haptic pulses for system events."})]}),o.jsxs(ae,{variant:w?"default":"outline",className:ge("h-11 px-6 rounded-xl font-bold transition-all",w?"shadow-lg shadow-primary/20":""),onClick:()=>S(!w),children:[w?o.jsx(nm,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),w?"Enabled":"Disabled"]})]})]}):o.jsxs("div",{className:"py-8",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(ya,{className:"w-6 h-6"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold",children:"Authentication Gateway"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Access your foundational profile."})]})]}),s&&o.jsx(KA,{supabase:s,initStatus:r,sessionStatus:e,sessionEmail:t,onRefresh:d})]})}),e==="authenticated"&&!f&&o.jsx(Tu,{className:"bg-muted/20 p-8 flex justify-end",children:o.jsxs(ae,{className:"h-12 px-8 rounded-xl font-bold shadow-xl shadow-primary/20",onClick:k,disabled:E,children:[E?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(VC,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})}function ZA({supabase:t}){const[e,s]=v.useState(""),[r,l]=v.useState(""),[u,d]=v.useState(!1),[f,m]=v.useState(null),g=async()=>{if(!t)return;if(e!==r){m({type:"error",msg:"Passwords do not match."});return}if(e.length<8){m({type:"error",msg:"Password must be at least 8 characters."});return}d(!0),m(null);const{error:y}=await t.auth.updateUser({password:e});y?m({type:"error",msg:y.message}):(m({type:"success",msg:"Password updated successfully."}),s(""),l("")),d(!1)};return o.jsxs(ft,{className:"border-border/40 shadow-xl shadow-black/5 bg-card/50 backdrop-blur-sm overflow-hidden",children:[o.jsxs(zt,{className:"p-8 border-b bg-muted/20",children:[o.jsx(Lt,{className:"text-2xl font-black",children:"Security Protocol"}),o.jsx(wn,{className:"text-base",children:"Manage your foundation credentials and access keys."})]}),o.jsxs(xt,{className:"p-8 space-y-8",children:[f&&o.jsxs(jn,{variant:f.type==="error"?"destructive":"default",className:ge("animate-in fade-in slide-in-from-top-2 duration-300",f.type==="success"?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20":""),children:[f.type==="success"?o.jsx(os,{className:"h-4 w-4"}):o.jsx(uu,{className:"h-4 w-4"}),o.jsx(_n,{className:"text-sm font-bold",children:f.msg})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"newPass",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"New Password"}),o.jsx(je,{id:"newPass",type:"password",placeholder:"••••••••",value:e,onChange:y=>s(y.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"confirmPass",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Confirm Password"}),o.jsx(je,{id:"confirmPass",type:"password",placeholder:"••••••••",value:r,onChange:y=>l(y.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]})]}),o.jsxs("div",{className:"bg-muted/30 p-6 rounded-2xl border border-border/40 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(uu,{className:"w-5 h-5"})}),o.jsx("h5",{className:"font-bold",children:"Security Tip"})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Use a password at least 12 characters long with a mix of letters, numbers, and symbols to ensure your foundational data remains secure."})]})]})]}),o.jsx(Tu,{className:"bg-muted/20 p-8 flex justify-end",children:o.jsxs(ae,{className:"h-12 px-8 rounded-xl font-bold shadow-xl shadow-primary/20",onClick:g,disabled:u||!e||!r,children:[u?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Zo,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})}function eR({configSnapshot:t,configSource:e,onLaunchSetup:s,onResetSetup:r}){return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(Eu,{className:"w-6 h-6"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-lg font-bold",children:"Supabase Configuration"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Primary storage and identity gateway."})]}),o.jsxs(Pt,{variant:"secondary",className:"text-[10px] font-black uppercase tracking-widest px-3 py-1",children:["Source: ",e]})]}),o.jsxs(ft,{className:"border-border/40 shadow-sm bg-card/50 backdrop-blur-sm",children:[o.jsx(xt,{className:"p-8 space-y-8",children:t?o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"API Endpoint"}),o.jsx("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 backdrop-blur-sm shadow-inner",children:o.jsx("p",{className:"text-sm font-semibold truncate text-foreground/80",children:t.url})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"Project Identifier"}),o.jsx("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 font-mono shadow-inner",children:o.jsx("p",{className:"text-sm font-semibold text-foreground/80",children:t.url.split("//")[1]?.split(".")[0]||"Unknown"})})]}),o.jsxs("div",{className:"md:col-span-2 space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"Service Role Access (Masked)"}),o.jsxs("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 flex items-center justify-between shadow-inner",children:[o.jsxs("p",{className:"text-sm font-mono text-muted-foreground",children:[t.anonKey.slice(0,6),"...",t.anonKey.slice(-6)]}),o.jsx(Pt,{variant:"outline",className:"text-[9px] font-bold",children:"Standard Key"})]})]})]}):o.jsxs(jn,{className:"bg-amber-500/5 border-amber-500/20 text-amber-600 dark:text-amber-400 p-6 rounded-2xl shadow-sm",children:[o.jsx(Sn,{className:"w-5 h-5"}),o.jsx(Hm,{className:"font-bold mb-1",children:"Infrastructure Standby"}),o.jsx(_n,{className:"text-sm opacity-90",children:"The foundation has not been initialized. You must run the setup wizard to continue."})]})}),o.jsxs(Tu,{className:"bg-muted/20 p-8 flex gap-4 border-t",children:[o.jsxs(ae,{variant:t?"outline":"default",className:"flex-1 h-12 rounded-xl font-bold shadow-sm",onClick:s,children:[t?o.jsx(WC,{className:"w-4 h-4 mr-2"}):o.jsx(Wa,{className:"w-4 h-4 mr-2"}),t?"Run Setup Wizard":"Launch Initializer"]}),t&&o.jsx(ae,{variant:"ghost",size:"icon",className:"h-12 w-12 rounded-xl text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",onClick:r,title:"Reset All Configuration",children:o.jsx(PC,{className:"w-5 h-5"})})]})]}),o.jsxs("div",{className:"space-y-6 pt-4",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-destructive/10 flex items-center justify-center text-destructive",children:o.jsx(Sn,{className:"w-6 h-6"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold text-destructive",children:"Advanced Maintenance"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Destructive actions and system-level overrides."})]})]}),o.jsx(ft,{className:"border-destructive/20 bg-destructive/5 overflow-hidden shadow-sm",children:o.jsxs(xt,{className:"p-8",children:[o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Fully resetting the foundation will purge all local storage cached parameters. This action is irreversible and will force a fresh bootstrap flow upon next launch."}),o.jsx(ae,{variant:"link",className:"px-0 text-destructive h-auto text-xs font-black uppercase tracking-widest mt-4 hover:no-underline hover:opacity-70 transition-opacity",onClick:r,children:"Wipe Local Foundation Buffer"})]})})]})]})}const tR={theme:"system",setTheme:()=>null},Zw=v.createContext(tR);function nR({children:t,defaultTheme:e="system",storageKey:s="vite-ui-theme"}){const[r,l]=v.useState(()=>localStorage.getItem(s)||e);v.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),r==="system"){const f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(f);return}d.classList.add(r)},[r]);const u=v.useMemo(()=>({theme:r,setTheme:d=>{localStorage.setItem(s,d),l(d)}}),[r,s]);return o.jsx(Zw.Provider,{value:u,children:t})}const sR=()=>{const t=v.useContext(Zw);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};function e1(){const{setTheme:t,theme:e}=sR();return o.jsxs(ae,{variant:"ghost",size:"icon",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:bg-muted/60 transition-all duration-300 h-9 w-9 rounded-full",title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:[e==="dark"?o.jsx(nA,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(CC,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function ha(t,e,{checkForDefaultPrevented:s=!0}={}){return function(l){if(t?.(l),s===!1||!l.defaultPrevented)return e?.(l)}}function aR(t,e){const s=v.createContext(e),r=u=>{const{children:d,...f}=u,m=v.useMemo(()=>f,Object.values(f));return o.jsx(s.Provider,{value:m,children:d})};r.displayName=t+"Provider";function l(u){const d=v.useContext(s);if(d)return d;if(e!==void 0)return e;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[r,l]}function rR(t,e=[]){let s=[];function r(u,d){const f=v.createContext(d),m=s.length;s=[...s,d];const g=x=>{const{scope:w,children:S,...E}=x,j=w?.[t]?.[m]||f,_=v.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:_,children:S})};g.displayName=u+"Provider";function y(x,w){const S=w?.[t]?.[m]||f,E=v.useContext(S);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${x}\` must be used within \`${u}\``)}return[g,y]}const l=()=>{const u=s.map(d=>v.createContext(d));return function(f){const m=f?.[t]||u;return v.useMemo(()=>({[`__scope${t}`]:{...f,[t]:m}}),[f,m])}};return l.scopeName=t,[r,iR(l,...e)]}function iR(...t){const e=t[0];if(t.length===1)return e;const s=()=>{const r=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const d=r.reduce((f,{useScope:m,scopeName:g})=>{const x=m(u)[`__scope${g}`];return{...f,...x}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return s.scopeName=e.scopeName,s}var qo=globalThis?.document?v.useLayoutEffect:()=>{},oR=Mm[" useId ".trim().toString()]||(()=>{}),lR=0;function mh(t){const[e,s]=v.useState(oR());return qo(()=>{s(r=>r??String(lR++))},[t]),t||(e?`radix-${e}`:"")}var cR=Mm[" useInsertionEffect ".trim().toString()]||qo;function uR({prop:t,defaultProp:e,onChange:s=()=>{},caller:r}){const[l,u,d]=dR({defaultProp:e,onChange:s}),f=t!==void 0,m=f?t:l;{const y=v.useRef(t!==void 0);v.useEffect(()=>{const x=y.current;x!==f&&console.warn(`${r} is changing from ${x?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=f},[f,r])}const g=v.useCallback(y=>{if(f){const x=fR(y)?y(t):y;x!==t&&d.current?.(x)}else u(y)},[f,t,u,d]);return[m,g]}function dR({defaultProp:t,onChange:e}){const[s,r]=v.useState(t),l=v.useRef(s),u=v.useRef(e);return cR(()=>{u.current=e},[e]),v.useEffect(()=>{l.current!==s&&(u.current?.(s),l.current=s)},[s,l]),[s,r,u]}function fR(t){return typeof t=="function"}function hR(t){const e=mR(t),s=v.forwardRef((r,l)=>{const{children:u,...d}=r,f=v.Children.toArray(u),m=f.find(gR);if(m){const g=m.props.children,y=f.map(x=>x===m?v.Children.count(g)>1?v.Children.only(null):v.isValidElement(g)?g.props.children:null:x);return o.jsx(e,{...d,ref:l,children:v.isValidElement(g)?v.cloneElement(g,void 0,y):null})}return o.jsx(e,{...d,ref:l,children:u})});return s.displayName=`${t}.Slot`,s}function mR(t){const e=v.forwardRef((s,r)=>{const{children:l,...u}=s;if(v.isValidElement(l)){const d=vR(l),f=yR(u,l.props);return l.type!==v.Fragment&&(f.ref=r?Au(r,d):d),v.cloneElement(l,f)}return v.Children.count(l)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var pR=Symbol("radix.slottable");function gR(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pR}function yR(t,e){const s={...e};for(const r in e){const l=t[r],u=e[r];/^on[A-Z]/.test(r)?l&&u?s[r]=(...f)=>{const m=u(...f);return l(...f),m}:l&&(s[r]=l):r==="style"?s[r]={...l,...u}:r==="className"&&(s[r]=[l,u].filter(Boolean).join(" "))}return{...t,...s}}function vR(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var xR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Os=xR.reduce((t,e)=>{const s=hR(`Primitive.${e}`),r=v.forwardRef((l,u)=>{const{asChild:d,...f}=l,m=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function bR(t,e){t&&Ww.flushSync(()=>t.dispatchEvent(e))}function Ho(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...s)=>e.current?.(...s),[])}function wR(t,e=globalThis?.document){const s=Ho(t);v.useEffect(()=>{const r=l=>{l.key==="Escape"&&s(l)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[s,e])}var SR="DismissableLayer",rm="dismissableLayer.update",jR="dismissableLayer.pointerDownOutside",_R="dismissableLayer.focusOutside",b0,t1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),n1=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:f,...m}=t,g=v.useContext(t1),[y,x]=v.useState(null),w=y?.ownerDocument??globalThis?.document,[,S]=v.useState({}),E=nr(e,V=>x(V)),j=Array.from(g.layers),[_]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),N=j.indexOf(_),k=y?j.indexOf(y):-1,C=g.layersWithOutsidePointerEventsDisabled.size>0,A=k>=N,D=ER(V=>{const R=V.target,P=[...g.branches].some(Z=>Z.contains(R));!A||P||(l?.(V),d?.(V),V.defaultPrevented||f?.())},w),U=kR(V=>{const R=V.target;[...g.branches].some(Z=>Z.contains(R))||(u?.(V),d?.(V),V.defaultPrevented||f?.())},w);return wR(V=>{k===g.layers.size-1&&(r?.(V),!V.defaultPrevented&&f&&(V.preventDefault(),f()))},w),v.useEffect(()=>{if(y)return s&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(b0=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),w0(),()=>{s&&g.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=b0)}},[y,w,s,g]),v.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),w0())},[y,g]),v.useEffect(()=>{const V=()=>S({});return document.addEventListener(rm,V),()=>document.removeEventListener(rm,V)},[]),o.jsx(Os.div,{...m,ref:E,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:ha(t.onFocusCapture,U.onFocusCapture),onBlurCapture:ha(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:ha(t.onPointerDownCapture,D.onPointerDownCapture)})});n1.displayName=SR;var NR="DismissableLayerBranch",TR=v.forwardRef((t,e)=>{const s=v.useContext(t1),r=v.useRef(null),l=nr(e,r);return v.useEffect(()=>{const u=r.current;if(u)return s.branches.add(u),()=>{s.branches.delete(u)}},[s.branches]),o.jsx(Os.div,{...t,ref:l})});TR.displayName=NR;function ER(t,e=globalThis?.document){const s=Ho(t),r=v.useRef(!1),l=v.useRef(()=>{});return v.useEffect(()=>{const u=f=>{if(f.target&&!r.current){let m=function(){s1(jR,s,g,{discrete:!0})};const g={originalEvent:f};f.pointerType==="touch"?(e.removeEventListener("click",l.current),l.current=m,e.addEventListener("click",l.current,{once:!0})):m()}else e.removeEventListener("click",l.current);r.current=!1},d=window.setTimeout(()=>{e.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(d),e.removeEventListener("pointerdown",u),e.removeEventListener("click",l.current)}},[e,s]),{onPointerDownCapture:()=>r.current=!0}}function kR(t,e=globalThis?.document){const s=Ho(t),r=v.useRef(!1);return v.useEffect(()=>{const l=u=>{u.target&&!r.current&&s1(_R,s,{originalEvent:u},{discrete:!1})};return e.addEventListener("focusin",l),()=>e.removeEventListener("focusin",l)},[e,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w0(){const t=new CustomEvent(rm);document.dispatchEvent(t)}function s1(t,e,s,{discrete:r}){const l=s.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});e&&l.addEventListener(t,e,{once:!0}),r?bR(l,u):l.dispatchEvent(u)}var ph="focusScope.autoFocusOnMount",gh="focusScope.autoFocusOnUnmount",S0={bubbles:!1,cancelable:!0},CR="FocusScope",a1=v.forwardRef((t,e)=>{const{loop:s=!1,trapped:r=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...d}=t,[f,m]=v.useState(null),g=Ho(l),y=Ho(u),x=v.useRef(null),w=nr(e,j=>m(j)),S=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let j=function(C){if(S.paused||!f)return;const A=C.target;f.contains(A)?x.current=A:oa(x.current,{select:!0})},_=function(C){if(S.paused||!f)return;const A=C.relatedTarget;A!==null&&(f.contains(A)||oa(x.current,{select:!0}))},N=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&oa(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",_);const k=new MutationObserver(N);return f&&k.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",_),k.disconnect()}}},[r,f,S.paused]),v.useEffect(()=>{if(f){_0.add(S);const j=document.activeElement;if(!f.contains(j)){const N=new CustomEvent(ph,S0);f.addEventListener(ph,g),f.dispatchEvent(N),N.defaultPrevented||(AR(PR(r1(f)),{select:!0}),document.activeElement===j&&oa(f))}return()=>{f.removeEventListener(ph,g),setTimeout(()=>{const N=new CustomEvent(gh,S0);f.addEventListener(gh,y),f.dispatchEvent(N),N.defaultPrevented||oa(j??document.body,{select:!0}),f.removeEventListener(gh,y),_0.remove(S)},0)}}},[f,g,y,S]);const E=v.useCallback(j=>{if(!s&&!r||S.paused)return;const _=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,N=document.activeElement;if(_&&N){const k=j.currentTarget,[C,A]=RR(k);C&&A?!j.shiftKey&&N===A?(j.preventDefault(),s&&oa(C,{select:!0})):j.shiftKey&&N===C&&(j.preventDefault(),s&&oa(A,{select:!0})):N===k&&j.preventDefault()}},[s,r,S.paused]);return o.jsx(Os.div,{tabIndex:-1,...d,ref:w,onKeyDown:E})});a1.displayName=CR;function AR(t,{select:e=!1}={}){const s=document.activeElement;for(const r of t)if(oa(r,{select:e}),document.activeElement!==s)return}function RR(t){const e=r1(t),s=j0(e,t),r=j0(e.reverse(),t);return[s,r]}function r1(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const l=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||l?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function j0(t,e){for(const s of t)if(!OR(s,{upTo:e}))return s}function OR(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function MR(t){return t instanceof HTMLInputElement&&"select"in t}function oa(t,{select:e=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&MR(t)&&e&&t.select()}}var _0=DR();function DR(){let t=[];return{add(e){const s=t[0];e!==s&&s?.pause(),t=N0(t,e),t.unshift(e)},remove(e){t=N0(t,e),t[0]?.resume()}}}function N0(t,e){const s=[...t],r=s.indexOf(e);return r!==-1&&s.splice(r,1),s}function PR(t){return t.filter(e=>e.tagName!=="A")}var zR="Portal",i1=v.forwardRef((t,e)=>{const{container:s,...r}=t,[l,u]=v.useState(!1);qo(()=>u(!0),[]);const d=s||l&&globalThis?.document?.body;return d?VA.createPortal(o.jsx(Os.div,{...r,ref:e}),d):null});i1.displayName=zR;function LR(t,e){return v.useReducer((s,r)=>e[s][r]??s,t)}var Ru=t=>{const{present:e,children:s}=t,r=UR(e),l=typeof s=="function"?s({present:r.isPresent}):v.Children.only(s),u=nr(r.ref,BR(l));return typeof s=="function"||r.isPresent?v.cloneElement(l,{ref:u}):null};Ru.displayName="Presence";function UR(t){const[e,s]=v.useState(),r=v.useRef(null),l=v.useRef(t),u=v.useRef("none"),d=t?"mounted":"unmounted",[f,m]=LR(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const g=Lc(r.current);u.current=f==="mounted"?g:"none"},[f]),qo(()=>{const g=r.current,y=l.current;if(y!==t){const w=u.current,S=Lc(g);t?m("MOUNT"):S==="none"||g?.display==="none"?m("UNMOUNT"):m(y&&w!==S?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,m]),qo(()=>{if(e){let g;const y=e.ownerDocument.defaultView??window,x=S=>{const j=Lc(r.current).includes(CSS.escape(S.animationName));if(S.target===e&&j&&(m("ANIMATION_END"),!l.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",g=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},w=S=>{S.target===e&&(u.current=Lc(r.current))};return e.addEventListener("animationstart",w),e.addEventListener("animationcancel",x),e.addEventListener("animationend",x),()=>{y.clearTimeout(g),e.removeEventListener("animationstart",w),e.removeEventListener("animationcancel",x),e.removeEventListener("animationend",x)}}else m("ANIMATION_END")},[e,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:v.useCallback(g=>{r.current=g?getComputedStyle(g):null,s(g)},[])}}function Lc(t){return t?.animationName||"none"}function BR(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var yh=0;function VR(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??T0()),document.body.insertAdjacentElement("beforeend",t[1]??T0()),yh++,()=>{yh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),yh--}},[])}function T0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Yc="right-scroll-bar-position",Xc="width-before-scroll-bar",IR="with-scroll-bars-hidden",$R="--removed-body-scroll-bar-size";function vh(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function qR(t,e){var s=v.useState(function(){return{value:t,callback:e,facade:{get current(){return s.value},set current(r){var l=s.value;l!==r&&(s.value=r,s.callback(r,l))}}}})[0];return s.callback=e,s.facade}var HR=typeof window<"u"?v.useLayoutEffect:v.useEffect,E0=new WeakMap;function GR(t,e){var s=qR(null,function(r){return t.forEach(function(l){return vh(l,r)})});return HR(function(){var r=E0.get(s);if(r){var l=new Set(r),u=new Set(t),d=s.current;l.forEach(function(f){u.has(f)||vh(f,null)}),u.forEach(function(f){l.has(f)||vh(f,d)})}E0.set(s,t)},[t]),s}function FR(t){return t}function KR(t,e){e===void 0&&(e=FR);var s=[],r=!1,l={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(u){var d=e(u,r);return s.push(d),function(){s=s.filter(function(f){return f!==d})}},assignSyncMedium:function(u){for(r=!0;s.length;){var d=s;s=[],d.forEach(u)}s={push:function(f){return u(f)},filter:function(){return s}}},assignMedium:function(u){r=!0;var d=[];if(s.length){var f=s;s=[],f.forEach(u),d=s}var m=function(){var y=d;d=[],y.forEach(u)},g=function(){return Promise.resolve().then(m)};g(),s={push:function(y){d.push(y),g()},filter:function(y){return d=d.filter(y),s}}}};return l}function YR(t){t===void 0&&(t={});var e=KR(null);return e.options=ss({async:!0,ssr:!1},t),e}var o1=function(t){var e=t.sideCar,s=pi(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,ss({},s))};o1.isSideCarExport=!0;function XR(t,e){return t.useMedium(e),o1}var l1=YR(),xh=function(){},Ou=v.forwardRef(function(t,e){var s=v.useRef(null),r=v.useState({onScrollCapture:xh,onWheelCapture:xh,onTouchMoveCapture:xh}),l=r[0],u=r[1],d=t.forwardProps,f=t.children,m=t.className,g=t.removeScrollBar,y=t.enabled,x=t.shards,w=t.sideCar,S=t.noRelative,E=t.noIsolation,j=t.inert,_=t.allowPinchZoom,N=t.as,k=N===void 0?"div":N,C=t.gapMode,A=pi(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=w,U=GR([s,e]),V=ss(ss({},A),l);return v.createElement(v.Fragment,null,y&&v.createElement(D,{sideCar:l1,removeScrollBar:g,shards:x,noRelative:S,noIsolation:E,inert:j,setCallbacks:u,allowPinchZoom:!!_,lockRef:s,gapMode:C}),d?v.cloneElement(v.Children.only(f),ss(ss({},V),{ref:U})):v.createElement(k,ss({},V,{className:m,ref:U}),f))});Ou.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ou.classNames={fullWidth:Xc,zeroRight:Yc};var WR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JR(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=WR();return e&&t.setAttribute("nonce",e),t}function QR(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ZR(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var eO=function(){var t=0,e=null;return{add:function(s){t==0&&(e=JR())&&(QR(e,s),ZR(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},tO=function(){var t=eO();return function(e,s){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&s])}},c1=function(){var t=tO(),e=function(s){var r=s.styles,l=s.dynamic;return t(r,l),null};return e},nO={left:0,top:0,right:0,gap:0},bh=function(t){return parseInt(t||"",10)||0},sO=function(t){var e=window.getComputedStyle(document.body),s=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],l=e[t==="padding"?"paddingRight":"marginRight"];return[bh(s),bh(r),bh(l)]},aO=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return nO;var e=sO(t),s=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-s+e[2]-e[0])}},rO=c1(),li="data-scroll-locked",iO=function(t,e,s,r){var l=t.left,u=t.top,d=t.right,f=t.gap;return s===void 0&&(s="margin"),`
|
|
51
|
+
`);const U=await A.signMessage(new TextEncoder().encode(E),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=U}}try{const{data:_,error:N}=await Re(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:Fa(j)},!((w=e.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(S=e.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:$n});if(N)throw N;if(!_||!_.session||!_.user){const k=new $r;return this._returnResult({data:{user:null,session:null},error:k})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:N})}catch(_){if(Ne(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async _exchangeCodeForSession(e){const s=await Ua(this.storage,`${this.storageKey}-code-verifier`),[r,l]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new vT;const{data:u,error:d}=await Re(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:$n});if(await Ht(this.storage,`${this.storageKey}-code-verifier`),d)throw d;if(!u||!u.session||!u.user){const f=new $r;return this._returnResult({data:{user:null,session:null,redirectType:null},error:f})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:Object.assign(Object.assign({},u),{redirectType:l??null}),error:d})}catch(u){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(u))return this._returnResult({data:{user:null,session:null,redirectType:null},error:u});throw u}}async signInWithIdToken(e){try{const{options:s,provider:r,token:l,access_token:u,nonce:d}=e,f=await Re(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:l,access_token:u,nonce:d,gotrue_meta_security:{captcha_token:s?.captchaToken}},xform:$n}),{data:m,error:g}=f;if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m||!m.session||!m.user){const y=new $r;return this._returnResult({data:{user:null,session:null},error:y})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:m,error:g})}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,r,l,u,d;try{if("email"in e){const{email:f,options:m}=e;let g=null,y=null;this.flowType==="pkce"&&([g,y]=await qr(this.storage,this.storageKey));const{error:x}=await Re(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:f,data:(s=m?.data)!==null&&s!==void 0?s:{},create_user:(r=m?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},code_challenge:g,code_challenge_method:y},redirectTo:m?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:x})}if("phone"in e){const{phone:f,options:m}=e,{data:g,error:y}=await Re(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:f,data:(l=m?.data)!==null&&l!==void 0?l:{},create_user:(u=m?.shouldCreateUser)!==null&&u!==void 0?u:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},channel:(d=m?.channel)!==null&&d!==void 0?d:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:g?.message_id},error:y})}throw new Cc("You must provide either an email or phone number.")}catch(f){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(f))return this._returnResult({data:{user:null,session:null},error:f});throw f}}async verifyOtp(e){var s,r;try{let l,u;"options"in e&&(l=(s=e.options)===null||s===void 0?void 0:s.redirectTo,u=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:d,error:f}=await Re(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:u}}),redirectTo:l,xform:$n});if(f)throw f;if(!d)throw new Error("An error occurred on token verification.");const m=d.session,g=d.user;return m?.access_token&&(await this._saveSession(m),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",m)),this._returnResult({data:{user:g,session:m},error:null})}catch(l){if(Ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(e){var s,r,l,u,d;try{let f=null,m=null;this.flowType==="pkce"&&([f,m]=await qr(this.storage,this.storageKey));const g=await Re(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&r!==void 0?r:void 0}),!((l=e?.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:f,code_challenge_method:m}),headers:this.headers,xform:qT});return!((u=g.data)===null||u===void 0)&&u.url&&Gt()&&!(!((d=e.options)===null||d===void 0)&&d.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(f){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(f))return this._returnResult({data:null,error:f});throw f}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)throw r;if(!s)throw new xn;const{error:l}=await Re(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(e){if(Ne(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:r,type:l,options:u}=e,{error:d}=await Re(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:l,gotrue_meta_security:{captcha_token:u?.captchaToken}},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}else if("phone"in e){const{phone:r,type:l,options:u}=e,{data:d,error:f}=await Re(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:l,gotrue_meta_security:{captcha_token:u?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:d?.message_id},error:f})}throw new Cc("You must provide either an email or phone number and a type")}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await r,await s()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=s();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await Ua(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<ih:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const d=await Ua(this.userStorage,this.storageKey+"-user");d?.user?e.user=d.user:e.user=ch()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const d={value:this.suppressGetSessionWarning};e.user=BT(e.user,d),d.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{session:null},error:u}):this._returnResult({data:{session:l},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await Re(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ua}):await this._useSession(async s=>{var r,l,u;const{data:d,error:f}=s;if(f)throw f;return!(!((r=d.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new xn}:await Re(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(u=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&u!==void 0?u:void 0,xform:ua})})}catch(s){if(Ne(s))return oh(s)&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async r=>{const{data:l,error:u}=r;if(u)throw u;if(!l.session)throw new xn;const d=l.session;let f=null,m=null;this.flowType==="pkce"&&e.email!=null&&([f,m]=await qr(this.storage,this.storageKey));const{data:g,error:y}=await Re(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:f,code_challenge_method:m}),jwt:d.access_token,xform:ua});if(y)throw y;return d.user=g.user,await this._saveSession(d),await this._notifyAllSubscribers("USER_UPDATED",d),this._returnResult({data:{user:d.user},error:null})})}catch(r){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new xn;const s=Date.now()/1e3;let r=s,l=!0,u=null;const{payload:d}=Rc(e.access_token);if(d.exp&&(r=d.exp,l=r<=s),l){const{data:f,error:m}=await this._callRefreshToken(e.refresh_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!f)return{data:{user:null,session:null},error:null};u=f}else{const{data:f,error:m}=await this._getUser(e.access_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});u={access_token:e.access_token,refresh_token:e.refresh_token,user:f.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(u),await this._notifyAllSubscribers("SIGNED_IN",u)}return this._returnResult({data:{user:u.user,session:u},error:null})}catch(s){if(Ne(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var r;if(!e){const{data:d,error:f}=s;if(f)throw f;e=(r=d.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new xn;const{data:l,error:u}=await this._callRefreshToken(e.refresh_token);return u?this._returnResult({data:{user:null,session:null},error:u}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(Ne(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){try{if(!Gt())throw new Ac("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ac(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new Fx("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Ac("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Fx("No code detected.");const{data:k,error:C}=await this._exchangeCodeForSession(e.code);if(C)throw C;const A=new URL(window.location.href);return A.searchParams.delete("code"),window.history.replaceState(window.history.state,"",A.toString()),{data:{session:k.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:l,access_token:u,refresh_token:d,expires_in:f,expires_at:m,token_type:g}=e;if(!u||!f||!d||!g)throw new Ac("No session defined in URL");const y=Math.round(Date.now()/1e3),x=parseInt(f);let w=y+x;m&&(w=parseInt(m));const S=w-y;S*1e3<=Jr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${x}s`);const E=w-x;y-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,w,y):y-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,w,y);const{data:j,error:_}=await this._getUser(u);if(_)throw _;const N={provider_token:r,provider_refresh_token:l,access_token:u,expires_in:x,expires_at:w,refresh_token:d,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:N,redirectType:e.type},error:null})}catch(r){if(Ne(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await Ua(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u&&!oh(u))return this._returnResult({error:u});const d=(r=l.session)===null||r===void 0?void 0:r.access_token;if(d){const{error:f}=await this.admin.signOut(d,e);if(f&&!(gT(f)&&(f.status===404||f.status===401||f.status===403)||oh(f)))return this._returnResult({error:f})}return e!=="others"&&(await this._removeSession(),await Ht(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=NT(),r={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async s=>{var r,l;try{const{data:{session:u},error:d}=s;if(d)throw d;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",u)),this._debug("INITIAL_SESSION","callback id",e,"session",u)}catch(u){await((l=this.stateChangeEmitters.get(e))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",u),console.error(u)}})}async resetPasswordForEmail(e,s={}){let r=null,l=null;this.flowType==="pkce"&&([r,l]=await qr(this.storage,this.storageKey,!0));try{return await Re(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:l,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(u){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(u))return this._returnResult({data:null,error:u});throw u}}async getUserIdentities(){var e;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:r,error:l}=await this._useSession(async u=>{var d,f,m,g,y;const{data:x,error:w}=u;if(w)throw w;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(d=e.options)===null||d===void 0?void 0:d.redirectTo,scopes:(f=e.options)===null||f===void 0?void 0:f.scopes,queryParams:(m=e.options)===null||m===void 0?void 0:m.queryParams,skipBrowserRedirect:!0});return await Re(this.fetch,"GET",S,{headers:this.headers,jwt:(y=(g=x.session)===null||g===void 0?void 0:g.access_token)!==null&&y!==void 0?y:void 0})});if(l)throw l;return Gt()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:e.provider,url:r?.url},error:null})}catch(r){if(Ne(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var r;try{const{error:l,data:{session:u}}=s;if(l)throw l;const{options:d,provider:f,token:m,access_token:g,nonce:y}=e,x=await Re(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=u?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:f,id_token:m,access_token:g,nonce:y,link_identity:!0,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:$n}),{data:w,error:S}=x;return S?this._returnResult({data:{user:null,session:null},error:S}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new $r}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:S}))}catch(l){if(await Ht(this.storage,`${this.storageKey}-code-verifier`),Ne(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var r,l;const{data:u,error:d}=s;if(d)throw d;return await Re(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(l=(r=u.session)===null||r===void 0?void 0:r.access_token)!==null&&l!==void 0?l:void 0})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await CT(async l=>(l>0&&await kT(200*Math.pow(2,l-1)),this._debug(s,"refreshing attempt",l),await Re(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:$n})),(l,u)=>{const d=200*Math.pow(2,l);return u&&lh(u)&&Date.now()+d-r<Jr})}catch(r){if(this._debug(s,"error",r),Ne(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",r),Gt()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const l=await Ua(this.storage,this.storageKey);if(l&&this.userStorage){let d=await Ua(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!d&&(d={user:l.user},await Qr(this.userStorage,this.storageKey+"-user",d)),l.user=(e=d?.user)!==null&&e!==void 0?e:ch()}else if(l&&!l.user&&!l.user){const d=await Ua(this.storage,this.storageKey+"-user");d&&d?.user?(l.user=d.user,await Ht(this.storage,this.storageKey+"-user"),await Qr(this.storage,this.storageKey,l)):l.user=ch()}if(this._debug(r,"session from storage",l),!this._isValidSession(l)){this._debug(r,"session is not valid"),l!==null&&await this._removeSession();return}const u=((s=l.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<ih;if(this._debug(r,`session has${u?"":" not"} expired with margin of ${ih}s`),u){if(this.autoRefreshToken&&l.refresh_token){const{error:d}=await this._callRefreshToken(l.refresh_token);d&&(console.error(d),lh(d)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",d),await this._removeSession()))}}else if(l.user&&l.user.__isUserNotAvailableProxy===!0)try{const{data:d,error:f}=await this._getUser(l.access_token);!f&&d?.user?(l.user=d.user,await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(d){console.error("Error getting user data:",d),this._debug(r,"error getting user data, skipping SIGNED_IN notification",d)}else await this._notifyAllSubscribers("SIGNED_IN",l)}catch(l){this._debug(r,"error",l),console.error(l);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var s,r;if(!e)throw new xn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const l=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(l,"begin");try{this.refreshingDeferred=new Nu;const{data:u,error:d}=await this._refreshAccessToken(e);if(d)throw d;if(!u.session)throw new xn;await this._saveSession(u.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",u.session);const f={data:u.session,error:null};return this.refreshingDeferred.resolve(f),f}catch(u){if(this._debug(l,"error",u),Ne(u)){const d={data:null,error:u};return lh(u)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(d),d}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(u),u}finally{this.refreshingDeferred=null,this._debug(l,"end")}}async _notifyAllSubscribers(e,s,r=!0){const l=`#_notifyAllSubscribers(${e})`;this._debug(l,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:s});const u=[],d=Array.from(this.stateChangeEmitters.values()).map(async f=>{try{await f.callback(e,s)}catch(m){u.push(m)}});if(await Promise.all(d),u.length>0){for(let f=0;f<u.length;f+=1)console.error(u[f]);throw u[0]}}finally{this._debug(l,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Ht(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await Qr(this.userStorage,this.storageKey+"-user",{user:s.user});const l=Object.assign({},s);delete l.user;const u=Jx(l);await Qr(this.storage,this.storageKey,u)}else{const l=Jx(s);await Qr(this.storage,this.storageKey,l)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ht(this.storage,this.storageKey),await Ht(this.storage,this.storageKey+"-code-verifier"),await Ht(this.storage,this.storageKey+"-user"),this.userStorage&&await Ht(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Gt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Jr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((r.expires_at*1e3-e)/Jr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${Jr}ms, refresh threshold is ${Yh} ticks`),l<=Yh&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof pw)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Gt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,s,r){const l=[`provider=${encodeURIComponent(s)}`];if(r?.redirectTo&&l.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&l.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[u,d]=await qr(this.storage,this.storageKey),f=new URLSearchParams({code_challenge:`${encodeURIComponent(u)}`,code_challenge_method:`${encodeURIComponent(d)}`});l.push(f.toString())}if(r?.queryParams){const u=new URLSearchParams(r.queryParams);l.push(u.toString())}return r?.skipBrowserRedirect&&l.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${l.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;return u?this._returnResult({data:null,error:u}):await Re(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var r,l;const{data:u,error:d}=s;if(d)return this._returnResult({data:null,error:d});const f=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:m,error:g}=await Re(this.fetch,"POST",`${this.url}/factors`,{body:f,headers:this.headers,jwt:(r=u?.session)===null||r===void 0?void 0:r.access_token});return g?this._returnResult({data:null,error:g}):(e.factorType==="totp"&&m.type==="totp"&&(!((l=m?.totp)===null||l===void 0)&&l.qr_code)&&(m.totp.qr_code=`data:image/svg+xml;utf-8,${m.totp.qr_code}`),this._returnResult({data:m,error:null}))})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?aE(e.webauthn.credential_response):rE(e.webauthn.credential_response)})}:{code:e.code}),{data:f,error:m}=await Re(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:d,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});return m?this._returnResult({data:null,error:m}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+f.expires_in},f)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",f),this._returnResult({data:f,error:m}))})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:l,error:u}=s;if(u)return this._returnResult({data:null,error:u});const d=await Re(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});if(d.error)return d;const{data:f}=d;if(f.type!=="webauthn")return{data:f,error:null};switch(f.webauthn.type){case"create":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:nE(f.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:sE(f.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const l={all:[],phone:[],totp:[],webauthn:[]};for(const u of(e=s?.factors)!==null&&e!==void 0?e:[])l.all.push(u),u.status==="verified"&&l[u.factor_type].push(u);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(e){var s,r,l,u;if(e)try{const{payload:S}=Rc(e);let E=null;S.aal&&(E=S.aal);let j=E;const{data:{user:_},error:N}=await this.getUser(e);if(N)return this._returnResult({data:null,error:N});((r=(s=_?.factors)===null||s===void 0?void 0:s.filter(A=>A.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(j="aal2");const C=S.amr||[];return{data:{currentLevel:E,nextLevel:j,currentAuthenticationMethods:C},error:null}}catch(S){if(Ne(S))return this._returnResult({data:null,error:S});throw S}const{data:{session:d},error:f}=await this.getSession();if(f)return this._returnResult({data:null,error:f});if(!d)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:m}=Rc(d.access_token);let g=null;m.aal&&(g=m.aal);let y=g;((u=(l=d.user.factors)===null||l===void 0?void 0:l.filter(S=>S.status==="verified"))!==null&&u!==void 0?u:[]).length>0&&(y="aal2");const w=m.amr||[];return{data:{currentLevel:g,nextLevel:y,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:r},error:l}=s;return l?this._returnResult({data:null,error:l}):r?await Re(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:u=>({data:u,error:null})}):this._returnResult({data:null,error:new xn})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:l},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new xn});const d=await Re(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Gt()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:l},error:u}=r;if(u)return this._returnResult({data:null,error:u});if(!l)return this._returnResult({data:null,error:new xn});const d=await Re(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&Gt()&&!s?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;return r?this._returnResult({data:null,error:r}):s?await Re(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new xn})})}catch(e){if(Ne(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:r},error:l}=s;return l?this._returnResult({data:null,error:l}):r?(await Re(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new xn})})}catch(s){if(Ne(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let r=s.keys.find(f=>f.kid===e);if(r)return r;const l=Date.now();if(r=this.jwks.keys.find(f=>f.kid===e),r&&this.jwks_cached_at+mT>l)return r;const{data:u,error:d}=await Re(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(d)throw d;return!u.keys||u.keys.length===0||(this.jwks=u,this.jwks_cached_at=l,r=u.keys.find(f=>f.kid===e),!r)?null:r}async getClaims(e,s={}){try{let r=e;if(!r){const{data:S,error:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});r=S.session.access_token}const{header:l,payload:u,signature:d,raw:{header:f,payload:m}}=Rc(r);s?.allowExpired||zT(u.exp);const g=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,s?.keys?{keys:s.keys}:s?.jwks);if(!g){const{error:S}=await this.getUser(r);if(S)throw S;return{data:{claims:u,header:l,signature:d},error:null}}const y=LT(l.alg),x=await crypto.subtle.importKey("jwk",g,y,!0,["verify"]);if(!await crypto.subtle.verify(y,x,d,jT(`${f}.${m}`)))throw new Jh("Invalid JWT signature");return{data:{claims:u,header:l,signature:d},error:null}}catch(r){if(Ne(r))return this._returnResult({data:null,error:r});throw r}}}Lo.nextInstanceID={};const mE=Lo,pE="2.97.0";let wo="";typeof Deno<"u"?wo="deno":typeof document<"u"?wo="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wo="react-native":wo="node";const gE={"X-Client-Info":`supabase-js-${wo}/${pE}`},yE={headers:gE},vE={schema:"public"},xE={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},bE={};function Uo(t){"@babel/helpers - typeof";return Uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uo(t)}function wE(t,e){if(Uo(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Uo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function SE(t){var e=wE(t,"string");return Uo(e)=="symbol"?e:e+""}function jE(t,e,s){return(e=SE(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function r0(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable})),s.push.apply(s,r)}return s}function yt(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?r0(Object(s),!0).forEach(function(r){jE(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r0(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const _E=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),NE=()=>Headers,TE=(t,e,s)=>{const r=_E(s),l=NE();return async(u,d)=>{var f;const m=(f=await e())!==null&&f!==void 0?f:t;let g=new l(d?.headers);return g.has("apikey")||g.set("apikey",t),g.has("Authorization")||g.set("Authorization",`Bearer ${m}`),r(u,yt(yt({},d),{},{headers:g}))}};function EE(t){return t.endsWith("/")?t:t+"/"}function kE(t,e){var s,r;const{db:l,auth:u,realtime:d,global:f}=t,{db:m,auth:g,realtime:y,global:x}=e,w={db:yt(yt({},m),l),auth:yt(yt({},g),u),realtime:yt(yt({},y),d),storage:{},global:yt(yt(yt({},x),f),{},{headers:yt(yt({},(s=x?.headers)!==null&&s!==void 0?s:{}),(r=f?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?w.accessToken=t.accessToken:delete w.accessToken,w}function CE(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(EE(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var AE=class extends mE{constructor(t){super(t)}},RE=class{constructor(t,e,s){var r,l;this.supabaseUrl=t,this.supabaseKey=e;const u=CE(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const d=`sb-${u.hostname.split(".")[0]}-auth-token`,f={db:vE,realtime:bE,auth:yt(yt({},xE),{},{storageKey:d}),global:yE},m=kE(s??{},f);if(this.storageKey=(r=m.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(l=m.global.headers)!==null&&l!==void 0?l:{},m.accessToken)this.accessToken=m.accessToken,this.auth=new Proxy({},{get:(y,x)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(x)} is not possible`)}});else{var g;this.auth=this._initSupabaseAuthClient((g=m.auth)!==null&&g!==void 0?g:{},this.headers,m.global.fetch)}this.fetch=TE(e,this._getAccessToken.bind(this),m.global.fetch),this.realtime=this._initRealtimeClient(yt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},m.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(y=>this.realtime.setAuth(y)).catch(y=>console.warn("Failed to set initial Realtime auth token:",y)),this.rest=new g2(new URL("rest/v1",u).href,{headers:this.headers,schema:m.db.schema,fetch:this.fetch,timeout:m.db.timeout,urlLengthLimit:m.db.urlLengthLimit}),this.storage=new cT(this.storageUrl.href,this.headers,this.fetch,s?.storage),m.accessToken||this._listenForAuthEvents()}get functions(){return new l2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:l,storageKey:u,flowType:d,lock:f,debug:m,throwOnError:g},y,x){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new AE({url:this.authUrl.href,headers:yt(yt({},w),y),storageKey:u,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:l,flowType:d,lock:f,debug:m,throwOnError:g,fetch:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new M2(this.realtimeUrl.href,yt(yt({},t),{},{params:yt(yt({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const zm=(t,e,s)=>new RE(t,e,s);function OE(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}OE()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function vw(t){var e,s,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(e=0;e<l;e++)t[e]&&(s=vw(t[e]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s);return r}function xw(){for(var t,e,s=0,r="",l=arguments.length;s<l;s++)(t=arguments[s])&&(e=vw(t))&&(r&&(r+=" "),r+=e);return r}const ME=(t,e)=>{const s=new Array(t.length+e.length);for(let r=0;r<t.length;r++)s[r]=t[r];for(let r=0;r<e.length;r++)s[t.length+r]=e[r];return s},DE=(t,e)=>({classGroupId:t,validator:e}),bw=(t=new Map,e=null,s)=>({nextPart:t,validators:e,classGroupId:s}),iu="-",i0=[],PE="arbitrary..",zE=t=>{const e=UE(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return LE(d);const f=d.split(iu),m=f[0]===""&&f.length>1?1:0;return ww(f,m,e)},getConflictingClassGroupIds:(d,f)=>{if(f){const m=r[d],g=s[d];return m?g?ME(g,m):m:g||i0}return s[d]||i0}}},ww=(t,e,s)=>{if(t.length-e===0)return s.classGroupId;const l=t[e],u=s.nextPart.get(l);if(u){const g=ww(t,e+1,u);if(g)return g}const d=s.validators;if(d===null)return;const f=e===0?t.join(iu):t.slice(e).join(iu),m=d.length;for(let g=0;g<m;g++){const y=d[g];if(y.validator(f))return y.classGroupId}},LE=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),s=e.indexOf(":"),r=e.slice(0,s);return r?PE+r:void 0})(),UE=t=>{const{theme:e,classGroups:s}=t;return BE(s,e)},BE=(t,e)=>{const s=bw();for(const r in t){const l=t[r];Lm(l,s,r,e)}return s},Lm=(t,e,s,r)=>{const l=t.length;for(let u=0;u<l;u++){const d=t[u];VE(d,e,s,r)}},VE=(t,e,s,r)=>{if(typeof t=="string"){IE(t,e,s);return}if(typeof t=="function"){$E(t,e,s,r);return}qE(t,e,s,r)},IE=(t,e,s)=>{const r=t===""?e:Sw(e,t);r.classGroupId=s},$E=(t,e,s,r)=>{if(HE(t)){Lm(t(r),e,s,r);return}e.validators===null&&(e.validators=[]),e.validators.push(DE(s,t))},qE=(t,e,s,r)=>{const l=Object.entries(t),u=l.length;for(let d=0;d<u;d++){const[f,m]=l[d];Lm(m,Sw(e,f),s,r)}},Sw=(t,e)=>{let s=t;const r=e.split(iu),l=r.length;for(let u=0;u<l;u++){const d=r[u];let f=s.nextPart.get(d);f||(f=bw(),s.nextPart.set(d,f)),s=f}return s},HE=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,GE=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=Object.create(null),r=Object.create(null);const l=(u,d)=>{s[u]=d,e++,e>t&&(e=0,r=s,s=Object.create(null))};return{get(u){let d=s[u];if(d!==void 0)return d;if((d=r[u])!==void 0)return l(u,d),d},set(u,d){u in s?s[u]=d:l(u,d)}}},Qh="!",o0=":",FE=[],l0=(t,e,s,r,l)=>({modifiers:t,hasImportantModifier:e,baseClassName:s,maybePostfixModifierPosition:r,isExternal:l}),KE=t=>{const{prefix:e,experimentalParseClassName:s}=t;let r=l=>{const u=[];let d=0,f=0,m=0,g;const y=l.length;for(let j=0;j<y;j++){const _=l[j];if(d===0&&f===0){if(_===o0){u.push(l.slice(m,j)),m=j+1;continue}if(_==="/"){g=j;continue}}_==="["?d++:_==="]"?d--:_==="("?f++:_===")"&&f--}const x=u.length===0?l:l.slice(m);let w=x,S=!1;x.endsWith(Qh)?(w=x.slice(0,-1),S=!0):x.startsWith(Qh)&&(w=x.slice(1),S=!0);const E=g&&g>m?g-m:void 0;return l0(u,S,w,E)};if(e){const l=e+o0,u=r;r=d=>d.startsWith(l)?u(d.slice(l.length)):l0(FE,!1,d,void 0,!0)}if(s){const l=r;r=u=>s({className:u,parseClassName:l})}return r},YE=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((s,r)=>{e.set(s,1e6+r)}),s=>{const r=[];let l=[];for(let u=0;u<s.length;u++){const d=s[u],f=d[0]==="[",m=e.has(d);f||m?(l.length>0&&(l.sort(),r.push(...l),l=[]),r.push(d)):l.push(d)}return l.length>0&&(l.sort(),r.push(...l)),r}},XE=t=>({cache:GE(t.cacheSize),parseClassName:KE(t),sortModifiers:YE(t),...zE(t)}),WE=/\s+/,JE=(t,e)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:l,sortModifiers:u}=e,d=[],f=t.trim().split(WE);let m="";for(let g=f.length-1;g>=0;g-=1){const y=f[g],{isExternal:x,modifiers:w,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=s(y);if(x){m=y+(m.length>0?" "+m:m);continue}let _=!!j,N=r(_?E.substring(0,j):E);if(!N){if(!_){m=y+(m.length>0?" "+m:m);continue}if(N=r(E),!N){m=y+(m.length>0?" "+m:m);continue}_=!1}const k=w.length===0?"":w.length===1?w[0]:u(w).join(":"),C=S?k+Qh:k,A=C+N;if(d.indexOf(A)>-1)continue;d.push(A);const D=l(N,_);for(let U=0;U<D.length;++U){const V=D[U];d.push(C+V)}m=y+(m.length>0?" "+m:m)}return m},QE=(...t)=>{let e=0,s,r,l="";for(;e<t.length;)(s=t[e++])&&(r=jw(s))&&(l&&(l+=" "),l+=r);return l},jw=t=>{if(typeof t=="string")return t;let e,s="";for(let r=0;r<t.length;r++)t[r]&&(e=jw(t[r]))&&(s&&(s+=" "),s+=e);return s},ZE=(t,...e)=>{let s,r,l,u;const d=m=>{const g=e.reduce((y,x)=>x(y),t());return s=XE(g),r=s.cache.get,l=s.cache.set,u=f,f(m)},f=m=>{const g=r(m);if(g)return g;const y=JE(m,s);return l(m,y),y};return u=d,(...m)=>u(QE(...m))},ek=[],At=t=>{const e=s=>s[t]||ek;return e.isThemeGetter=!0,e},_w=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ak=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ik=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,aa=t=>tk.test(t),Ue=t=>!!t&&!Number.isNaN(Number(t)),ra=t=>!!t&&Number.isInteger(Number(t)),dh=t=>t.endsWith("%")&&Ue(t.slice(0,-1)),Es=t=>nk.test(t),Tw=()=>!0,ok=t=>sk.test(t)&&!ak.test(t),Um=()=>!1,lk=t=>rk.test(t),ck=t=>ik.test(t),uk=t=>!xe(t)&&!we(t),dk=t=>ga(t,Cw,Um),xe=t=>_w.test(t),Ba=t=>ga(t,Aw,ok),c0=t=>ga(t,xk,Ue),fk=t=>ga(t,Ow,Tw),hk=t=>ga(t,Rw,Um),u0=t=>ga(t,Ew,Um),mk=t=>ga(t,kw,ck),Oc=t=>ga(t,Mw,lk),we=t=>Nw.test(t),vo=t=>tr(t,Aw),pk=t=>tr(t,Rw),d0=t=>tr(t,Ew),gk=t=>tr(t,Cw),yk=t=>tr(t,kw),Mc=t=>tr(t,Mw,!0),vk=t=>tr(t,Ow,!0),ga=(t,e,s)=>{const r=_w.exec(t);return r?r[1]?e(r[1]):s(r[2]):!1},tr=(t,e,s=!1)=>{const r=Nw.exec(t);return r?r[1]?e(r[1]):s:!1},Ew=t=>t==="position"||t==="percentage",kw=t=>t==="image"||t==="url",Cw=t=>t==="length"||t==="size"||t==="bg-size",Aw=t=>t==="length",xk=t=>t==="number",Rw=t=>t==="family-name",Ow=t=>t==="number"||t==="weight",Mw=t=>t==="shadow",bk=()=>{const t=At("color"),e=At("font"),s=At("text"),r=At("font-weight"),l=At("tracking"),u=At("leading"),d=At("breakpoint"),f=At("container"),m=At("spacing"),g=At("radius"),y=At("shadow"),x=At("inset-shadow"),w=At("text-shadow"),S=At("drop-shadow"),E=At("blur"),j=At("perspective"),_=At("aspect"),N=At("ease"),k=At("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),we,xe],U=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],R=()=>[we,xe,m],P=()=>[aa,"full","auto",...R()],Z=()=>[ra,"none","subgrid",we,xe],te=()=>["auto",{span:["full",ra,we,xe]},ra,we,xe],me=()=>[ra,"auto",we,xe],Ee=()=>["auto","min","max","fr",we,xe],ye=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_e=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...R()],Y=()=>[aa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],J=()=>[aa,"screen","full","dvw","lvw","svw","min","max","fit",...R()],pe=()=>[aa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],se=()=>[t,we,xe],M=()=>[...A(),d0,u0,{position:[we,xe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",gk,dk,{size:[we,xe]}],ne=()=>[dh,vo,Ba],oe=()=>["","none","full",g,we,xe],ue=()=>["",Ue,vo,Ba],q=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Ue,dh,d0,u0],ze=()=>["","none",E,we,xe],Be=()=>["none",Ue,we,xe],kt=()=>["none",Ue,we,xe],et=()=>[Ue,we,xe],le=()=>[aa,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Es],breakpoint:[Es],color:[Tw],container:[Es],"drop-shadow":[Es],ease:["in","out","in-out"],font:[uk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Es],shadow:[Es],spacing:["px",Ue],text:[Es],"text-shadow":[Es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",aa,xe,we,_]}],container:["container"],columns:[{columns:[Ue,xe,we,f]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[ra,"auto",we,xe]}],basis:[{basis:[aa,"full","auto",f,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ue,aa,"auto","initial","none",xe]}],grow:[{grow:["",Ue,we,xe]}],shrink:[{shrink:["",Ue,we,xe]}],order:[{order:[ra,"first","last","none",we,xe]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":me()}],"col-end":[{"col-end":me()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":me()}],"row-end":[{"row-end":me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ee()}],"auto-rows":[{"auto-rows":Ee()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ye(),"normal"]}],"justify-items":[{"justify-items":[..._e(),"normal"]}],"justify-self":[{"justify-self":["auto",..._e()]}],"align-content":[{content:["normal",...ye()]}],"align-items":[{items:[..._e(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._e(),{baseline:["","last"]}]}],"place-content":[{"place-content":ye()}],"place-items":[{"place-items":[..._e(),"baseline"]}],"place-self":[{"place-self":["auto",..._e()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...pe()]}],"min-block-size":[{"min-block":["auto",...pe()]}],"max-block-size":[{"max-block":["none",...pe()]}],w:[{w:[f,"screen",...Y()]}],"min-w":[{"min-w":[f,"screen","none",...Y()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,vo,Ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,vk,fk]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dh,xe]}],"font-family":[{font:[pk,hk,e]}],"font-features":[{"font-features":[xe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,we,xe]}],"line-clamp":[{"line-clamp":[Ue,"none",we,c0]}],leading:[{leading:[u,...R()]}],"list-image":[{"list-image":["none",we,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:se()}],"text-color":[{text:se()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ue,"from-font","auto",we,Ba]}],"text-decoration-color":[{decoration:se()}],"underline-offset":[{"underline-offset":[Ue,"auto",we,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ra,we,xe],radial:["",we,xe],conic:[ra,we,xe]},yk,mk]}],"bg-color":[{bg:se()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:se()}],"gradient-via":[{via:se()}],"gradient-to":[{to:se()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:se()}],"border-color-x":[{"border-x":se()}],"border-color-y":[{"border-y":se()}],"border-color-s":[{"border-s":se()}],"border-color-e":[{"border-e":se()}],"border-color-bs":[{"border-bs":se()}],"border-color-be":[{"border-be":se()}],"border-color-t":[{"border-t":se()}],"border-color-r":[{"border-r":se()}],"border-color-b":[{"border-b":se()}],"border-color-l":[{"border-l":se()}],"divide-color":[{divide:se()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ue,we,xe]}],"outline-w":[{outline:["",Ue,vo,Ba]}],"outline-color":[{outline:se()}],shadow:[{shadow:["","none",y,Mc,Oc]}],"shadow-color":[{shadow:se()}],"inset-shadow":[{"inset-shadow":["none",x,Mc,Oc]}],"inset-shadow-color":[{"inset-shadow":se()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:se()}],"ring-offset-w":[{"ring-offset":[Ue,Ba]}],"ring-offset-color":[{"ring-offset":se()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":se()}],"text-shadow":[{"text-shadow":["none",w,Mc,Oc]}],"text-shadow-color":[{"text-shadow":se()}],opacity:[{opacity:[Ue,we,xe]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":se()}],"mask-image-linear-to-color":[{"mask-linear-to":se()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":se()}],"mask-image-t-to-color":[{"mask-t-to":se()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":se()}],"mask-image-r-to-color":[{"mask-r-to":se()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":se()}],"mask-image-b-to-color":[{"mask-b-to":se()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":se()}],"mask-image-l-to-color":[{"mask-l-to":se()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":se()}],"mask-image-x-to-color":[{"mask-x-to":se()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":se()}],"mask-image-y-to-color":[{"mask-y-to":se()}],"mask-image-radial":[{"mask-radial":[we,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":se()}],"mask-image-radial-to-color":[{"mask-radial-to":se()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":se()}],"mask-image-conic-to-color":[{"mask-conic-to":se()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,xe]}],filter:[{filter:["","none",we,xe]}],blur:[{blur:ze()}],brightness:[{brightness:[Ue,we,xe]}],contrast:[{contrast:[Ue,we,xe]}],"drop-shadow":[{"drop-shadow":["","none",S,Mc,Oc]}],"drop-shadow-color":[{"drop-shadow":se()}],grayscale:[{grayscale:["",Ue,we,xe]}],"hue-rotate":[{"hue-rotate":[Ue,we,xe]}],invert:[{invert:["",Ue,we,xe]}],saturate:[{saturate:[Ue,we,xe]}],sepia:[{sepia:["",Ue,we,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",we,xe]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ue,we,xe]}],"backdrop-contrast":[{"backdrop-contrast":[Ue,we,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ue,we,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ue,we,xe]}],"backdrop-invert":[{"backdrop-invert":["",Ue,we,xe]}],"backdrop-opacity":[{"backdrop-opacity":[Ue,we,xe]}],"backdrop-saturate":[{"backdrop-saturate":[Ue,we,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ue,we,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ue,"initial",we,xe]}],ease:[{ease:["linear","initial",N,we,xe]}],delay:[{delay:[Ue,we,xe]}],animate:[{animate:["none",k,we,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,we,xe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:kt()}],"scale-x":[{"scale-x":kt()}],"scale-y":[{"scale-y":kt()}],"scale-z":[{"scale-z":kt()}],"scale-3d":["scale-3d"],skew:[{skew:et()}],"skew-x":[{"skew-x":et()}],"skew-y":[{"skew-y":et()}],transform:[{transform:[we,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:se()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:se()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,xe]}],fill:[{fill:["none",...se()]}],"stroke-w":[{stroke:[Ue,vo,Ba,c0]}],stroke:[{stroke:["none",...se()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wk=ZE(bk);function ge(...t){return wk(xw(t))}const ft=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("rounded-xl border bg-card text-card-foreground shadow",t),...e}));ft.displayName="Card";const zt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("flex flex-col space-y-1.5 p-6",t),...e}));zt.displayName="CardHeader";const Lt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("font-semibold leading-none tracking-tight",t),...e}));Lt.displayName="CardTitle";const wn=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("text-sm text-muted-foreground",t),...e}));wn.displayName="CardDescription";const xt=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("p-6 pt-0",t),...e}));xt.displayName="CardContent";const Tu=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("flex items-center p-6 pt-0",t),...e}));Tu.displayName="CardFooter";function ou({className:t}){return o.jsx("img",{src:"/folio-logo.svg",alt:"Folio Logo",className:ge("w-full h-full object-contain",t)})}const Dw=(...t)=>t.filter((e,s,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===s).join(" ").trim();const Sk=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const jk=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,r)=>r?r.toUpperCase():s.toLowerCase());const f0=t=>{const e=jk(t);return e.charAt(0).toUpperCase()+e.slice(1)};var _k={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"};const Nk=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const Tk=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:l="",children:u,iconNode:d,...f},m)=>v.createElement("svg",{ref:m,..._k,width:e,height:e,stroke:t,strokeWidth:r?Number(s)*24/Number(e):s,className:Dw("lucide",l),...!u&&!Nk(f)&&{"aria-hidden":"true"},...f},[...d.map(([g,y])=>v.createElement(g,y)),...Array.isArray(u)?u:[u]]));const fe=(t,e)=>{const s=v.forwardRef(({className:r,...l},u)=>v.createElement(Tk,{ref:u,iconNode:e,className:Dw(`lucide-${Sk(f0(t))}`,`lucide-${t}`,r),...l}));return s.displayName=f0(t),s};const Ek=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ui=fe("activity",Ek);const kk=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ck=fe("arrow-right",kk);const Ak=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Rk=fe("book-open",Ak);const Ok=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Zh=fe("bot",Ok);const Mk=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Pw=fe("brain",Mk);const Dk=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Pk=fe("building-2",Dk);const zk=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],zw=fe("calendar",zk);const Lk=[["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"}]],Uk=fe("camera",Lk);const Bk=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],as=fe("check",Bk);const Vk=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=fe("chevron-down",Vk);const Ik=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Jo=fe("chevron-left",Ik);const $k=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],di=fe("chevron-right",$k);const qk=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],lu=fe("chevron-up",qk);const Hk=[["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"}]],Sn=fe("circle-alert",Hk);const Gk=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fk=fe("circle-check-big",Gk);const Kk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],os=fe("circle-check",Kk);const Yk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Lw=fe("circle-x",Yk);const Xk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Qo=fe("clock",Xk);const Wk=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],h0=fe("cloud",Wk);const Jk=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Qk=fe("copy",Jk);const Zk=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Bm=fe("cpu",Zk);const eC=[["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"}]],Eu=fe("database",eC);const tC=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Uw=fe("external-link",tC);const nC=[["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"}]],sC=fe("eye-off",nC);const aC=[["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"}]],rC=fe("eye",aC);const iC=[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]],oC=fe("file-digit",iC);const lC=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Vm=fe("file-text",lC);const cC=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Bw=fe("funnel",cC);const uC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],dC=fe("globe",uC);const fC=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],hC=fe("hard-drive",fC);const mC=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],pC=fe("history",mC);const gC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Im=fe("info",gC);const yC=[["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"}]],Zo=fe("key",yC);const vC=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],xC=fe("layers",vC);const bC=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],m0=fe("layout-dashboard",bC);const wC=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],it=fe("loader-circle",wC);const SC=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Vw=fe("log-in",SC);const jC=[["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"}]],Iw=fe("log-out",jC);const _C=[["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"}]],Vo=fe("mail",_C);const NC=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],cu=fe("message-square",NC);const TC=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],$w=fe("minimize-2",TC);const EC=[["path",{d:"M5 12h14",key:"1ays0h"}]],em=fe("minus",EC);const kC=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CC=fe("moon",kC);const AC=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],RC=fe("package",AC);const OC=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],qw=fe("play",OC);const MC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Wa=fe("plus",MC);const DC=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],PC=fe("refresh-ccw",DC);const zC=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ma=fe("refresh-cw",zC);const LC=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],UC=fe("rocket",LC);const BC=[["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"}]],VC=fe("save",BC);const IC=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Hw=fe("scroll-text",IC);const $C=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],qC=fe("search",$C);const HC=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],GC=fe("send",HC);const FC=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],KC=fe("server",FC);const YC=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],$m=fe("settings-2",YC);const XC=[["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"}]],WC=fe("settings",XC);const JC=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],p0=fe("share-2",JC);const QC=[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],uu=fe("shield-alert",QC);const ZC=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ya=fe("shield-check",ZC);const eA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Cs=fe("sparkles",eA);const tA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],nA=fe("sun",tA);const sA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],du=fe("tag",sA);const aA=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Io=fe("terminal",aA);const rA=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],iA=fe("test-tube",rA);const oA=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],lA=fe("toggle-left",oA);const cA=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],uA=fe("toggle-right",cA);const dA=[["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"}]],el=fe("trash-2",dA);const fA=[["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"}]],Gw=fe("triangle-alert",fA);const hA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],tm=fe("upload",hA);const mA=[["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:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],pA=fe("user-plus",mA);const gA=[["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"}]],ku=fe("user",gA);const yA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],nm=fe("volume-2",yA);const vA=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Fw=fe("volume-x",vA);const xA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zn=fe("x",xA);const bA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],fu=fe("zap",bA),Cu="folio_supabase_config";function g0(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.url=="string"&&typeof e.anonKey=="string"&&e.url.startsWith("http")&&e.anonKey.length>20&&!e.url.includes("placeholder.supabase.co")}function $o(){try{const e=localStorage.getItem(Cu);if(e){const s=JSON.parse(e);if(g0(s))return s}}catch{}const t={url:void 0,anonKey:void 0};return g0(t)?t:null}function fh(t){localStorage.setItem(Cu,JSON.stringify(t))}function wA(){localStorage.removeItem(Cu)}async function SA(t,e){if(!t.startsWith("http://")&&!t.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const s=e.startsWith("eyJ"),r=e.startsWith("sb_publishable_");if(!s&&!r)return{valid:!1,error:"Invalid anon key format"};if(r)return{valid:!0};const l=new AbortController,u=setTimeout(()=>l.abort("Validation timeout"),12e3);try{const d=await fetch(`${t}/rest/v1/`,{method:"GET",headers:{apikey:e,Authorization:`Bearer ${e}`},signal:l.signal});return d.ok?(clearTimeout(u),{valid:!0}):(clearTimeout(u),{valid:!1,error:`Connection failed (${d.status})`})}catch(d){return clearTimeout(u),d instanceof DOMException&&d.name==="AbortError"?{valid:!1,error:"Connection validation timed out (12s). Check project URL/key and network."}:{valid:!1,error:d instanceof Error?d.message:"Connection failed"}}}function jA(){return localStorage.getItem(Cu)?"ui":"none"}let Dc=null;function un(){const t=$o();return t?(Dc||(Dc=zm(t.url,t.anonKey,{auth:{autoRefreshToken:!0,persistSession:!0}})),Dc):(Dc=null,null)}function hh(){const t=$o(),e=t?`${t.url}/functions/v1`:"",s=t?.anonKey??"",u=window.location.port==="5173"?void 0||"http://localhost:3006":window.location.origin;return{edgeFunctionsUrl:e,expressApiUrl:u,anonKey:s}}class _A{edgeFunctionsUrl;expressApiUrl;anonKey;constructor(){const e=hh();this.edgeFunctionsUrl=e.edgeFunctionsUrl,this.expressApiUrl=e.expressApiUrl,this.anonKey=e.anonKey}async request(e,s,r={}){const{auth:l=!1,token:u,...d}=r,f={"Content-Type":"application/json",...d.headers||{}};l&&u&&(f.Authorization=`Bearer ${u}`);try{const m=await fetch(`${e}${s}`,{...d,headers:f}),g=await m.json().catch(()=>({}));return m.ok?{data:g}:{error:{code:g?.error?.code||"API_ERROR",message:g?.error?.message||g?.error||`Request failed (${m.status})`}}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(e,s={}){const r={...s.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,e,{...s,headers:r})}expressRequest(e,s={}){const r=hh(),l={...s.headers||{},"X-Supabase-Url":r.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":r.anonKey};return this.request(this.expressApiUrl,e,{...s,headers:l})}get(e,s={}){return this.expressRequest(e,{method:"GET",...s,auth:!0})}post(e,s,r={}){return this.expressRequest(e,{method:"POST",body:s?JSON.stringify(s):void 0,...r,auth:!0})}getChatSessions(e){return this.expressRequest("/api/chat/sessions",{method:"GET",auth:!!e,token:e})}getDashboardStats(e){return this.expressRequest("/api/stats",{method:"GET",auth:!!e,token:e})}createChatSession(e){return this.expressRequest("/api/chat/sessions",{method:"POST",auth:!!e,token:e})}getChatMessages(e,s){return this.expressRequest(`/api/chat/sessions/${e}/messages`,{method:"GET",auth:!!s,token:s})}sendChatMessage(e,s){return this.expressRequest("/api/chat/message",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getHealth(){return this.expressRequest("/api/health",{method:"GET"})}testSupabase(e,s){return this.expressRequest("/api/setup/test-supabase",{method:"POST",body:JSON.stringify({url:e,anonKey:s})})}dispatchProcessingJob(e,s){return this.expressRequest("/api/processing/dispatch",{method:"POST",auth:!!s,token:s,body:JSON.stringify({source_type:"manual",payload:e})})}getSettings(e){return this.expressRequest("/api/settings",{method:"GET",auth:!!e,token:e})}updateSettings(e,s){return this.expressRequest("/api/settings",{method:"PATCH",auth:!!s,token:s,body:JSON.stringify(e)})}getAccounts(e){return this.expressRequest("/api/accounts",{method:"GET",auth:!!e,token:e})}disconnectAccount(e,s){return this.expressRequest("/api/accounts/disconnect",{method:"POST",auth:!!s,token:s,body:JSON.stringify({accountId:e})})}getRules(e){return this.expressRequest("/api/rules",{method:"GET",auth:!!e,token:e})}createRule(e,s){return this.expressRequest("/api/rules",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}updateRule(e,s,r){return this.expressRequest(`/api/rules/${e}`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify(s)})}deleteRule(e,s){return this.expressRequest(`/api/rules/${e}`,{method:"DELETE",auth:!!s,token:s})}toggleRule(e,s){return this.expressRequest(`/api/rules/${e}/toggle`,{method:"POST",auth:!!s,token:s})}getStats(e){return this.expressRequest("/api/stats",{method:"GET",auth:!!e,token:e})}getProfile(e){return this.edgeRequest("/api-v1-profile",{method:"GET",auth:!!e,token:e})}updateProfile(e,s){return this.edgeRequest("/api-v1-profile",{method:"PATCH",auth:!!s,token:s,body:JSON.stringify(e)})}getChatProviders(e){return this.expressRequest("/api/sdk/providers/chat",{method:"GET",auth:!!e,token:e})}getEmbedProviders(e){return this.expressRequest("/api/sdk/providers/embed",{method:"GET",auth:!!e,token:e})}testLlm(e,s){return this.expressRequest("/api/sdk/test-llm",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getGmailAuthUrl(e,s,r){return this.expressRequest("/api/accounts/gmail/auth-url",{method:"POST",auth:!!r,token:r,body:JSON.stringify({clientId:e,clientSecret:s})})}connectGmail(e,s,r,l){return this.expressRequest("/api/accounts/gmail/connect",{method:"POST",auth:!!l,token:l,body:JSON.stringify({authCode:e,clientId:s,clientSecret:r})})}getGoogleDriveAuthUrl(e,s){return this.expressRequest("/api/accounts/google-drive/auth-url",{method:"POST",auth:!!s,token:s,body:JSON.stringify({clientId:e})})}connectGoogleDrive(e,s,r,l){return this.expressRequest("/api/accounts/google-drive/connect",{method:"POST",auth:!!l,token:l,body:JSON.stringify({authCode:e,clientId:s,clientSecret:r})})}startMicrosoftDeviceFlow(e,s,r){return this.expressRequest("/api/accounts/microsoft/device-flow",{method:"POST",auth:!!r,token:r,body:JSON.stringify({clientId:e,tenantId:s})})}pollMicrosoftDeviceCode(e,s,r,l){return this.expressRequest("/api/accounts/microsoft/poll",{method:"POST",auth:!!l,token:l,body:JSON.stringify({deviceCode:e,clientId:s,tenantId:r})})}connectImap(e,s){return this.expressRequest("/api/accounts/imap/connect",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}setup(e){return this.edgeRequest("/setup",{method:"POST",body:JSON.stringify(e)})}getPolicies(e){return this.expressRequest("/api/policies",{auth:!!e,token:e})}savePolicy(e,s){return this.expressRequest("/api/policies",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}deletePolicy(e,s){return this.expressRequest(`/api/policies/${e}`,{method:"DELETE",auth:!!s,token:s})}patchPolicy(e,s,r){return this.expressRequest(`/api/policies/${e}`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify(s)})}reloadPolicies(e){return this.expressRequest("/api/policies/reload",{method:"POST",auth:!!e,token:e})}synthesizePolicy(e,s){return this.expressRequest("/api/policies/synthesize",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}getSDKChatProviders(){return this.expressRequest("/api/sdk/providers/chat")}getIngestions(e={},s){const r=new URLSearchParams;e.page&&r.set("page",String(e.page)),e.pageSize&&r.set("pageSize",String(e.pageSize)),e.q&&r.set("q",e.q);const l=r.toString()?`?${r}`:"";return this.expressRequest(`/api/ingestions${l}`,{auth:!!s,token:s})}uploadDocument(e,s){const r=new FormData;r.append("file",e);const l=hh(),u={"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return s&&(u.Authorization=`Bearer ${s}`),fetch(`${l.expressApiUrl}/api/ingestions/upload`,{method:"POST",headers:u,body:r}).then(d=>d.json())}rerunIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}/rerun`,{method:"POST",auth:!!s,token:s})}matchIngestionToPolicy(e,s,r){const l=s.learn!==!1,u=s.rerun!==!1;return this.expressRequest(`/api/ingestions/${e}/match`,{method:"POST",auth:!!r,token:r,body:JSON.stringify({policy_id:s.policyId,learn:l,rerun:u,allow_side_effects:s.allowSideEffects===!0})})}suggestPolicyRefinement(e,s,r){return this.expressRequest(`/api/ingestions/${e}/refine-policy`,{method:"POST",auth:!!r,token:r,body:JSON.stringify({policy_id:s.policyId,provider:s.provider,model:s.model})})}deleteIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}`,{method:"DELETE",auth:!!s,token:s})}updateIngestionTags(e,s,r){return this.expressRequest(`/api/ingestions/${e}/tags`,{method:"PATCH",auth:!!r,token:r,body:JSON.stringify({tags:s})})}summarizeIngestion(e,s){return this.expressRequest(`/api/ingestions/${e}/summarize`,{method:"POST",auth:!!s,token:s})}getBaselineConfig(e){return this.expressRequest("/api/baseline-config",{auth:!!e,token:e})}getBaselineConfigHistory(e){return this.expressRequest("/api/baseline-config/history",{auth:!!e,token:e})}saveBaselineConfig(e,s){return this.expressRequest("/api/baseline-config",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}activateBaselineConfig(e,s){return this.expressRequest(`/api/baseline-config/${e}/activate`,{method:"POST",auth:!!s,token:s})}suggestBaselineConfig(e,s){return this.expressRequest("/api/baseline-config/suggest",{method:"POST",auth:!!s,token:s,body:JSON.stringify(e)})}}const Te=new _A;let ns=[],sm=new Set;function am(){sm.forEach(t=>t())}const ce={success:(t,e)=>Pc("success",t,e),error:(t,e)=>Pc("error",t,e),info:(t,e)=>Pc("info",t,e),warning:(t,e)=>Pc("warning",t,e)};function Pc(t,e,s=5e3){const r=ns.findIndex(u=>u.message===e&&u.type===t);if(r!==-1){const u=ns[r];ns=[...ns],ns[r]={...u,count:(u.count||1)+1,lastUpdated:Date.now()},am();return}const l=Math.random().toString(36).substr(2,9);ns=[...ns,{id:l,type:t,message:e,duration:s,count:1,lastUpdated:Date.now()}],am(),s>0&&setTimeout(()=>Kw(l),s)}function Kw(t){ns=ns.filter(e=>e.id!==t),am()}function NA(){const[,t]=v.useState(0);return v.useEffect(()=>{const e=()=>t(s=>s+1);return sm.add(e),()=>{sm.delete(e)}},[]),ns}const TA={success:Fk,error:Sn,info:Im,warning:Gw},EA={success:"bg-emerald-500/10 border-emerald-500/20 text-emerald-600 dark:text-emerald-400",error:"bg-destructive/10 border-destructive/20 text-destructive",info:"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400",warning:"bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-400"};function kA({toast:t}){const e=TA[t.type];return o.jsxs("div",{className:ge("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",EA[t.type]),children:[o.jsxs("div",{className:"relative",children:[o.jsx(e,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),t.count&&t.count>1&&o.jsx("span",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] font-bold px-1.5 rounded-full border border-background scale-90 animate-in zoom-in duration-200",children:t.count})]}),o.jsx("p",{className:"text-sm flex-1",children:t.message}),o.jsx("button",{onClick:()=>Kw(t.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(zn,{className:"w-4 h-4"})})]})}function CA(){const t=NA();return t.length===0?null:o.jsx("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col-reverse gap-2 max-w-sm w-full",children:t.map(e=>o.jsx(kA,{toast:e},e.id))})}function AA({configSnapshot:t,configSource:e,setActivePage:s}){const[r,l]=v.useState(null),[u,d]=v.useState(!0),[f,m]=v.useState(!1),[g,y]=v.useState(!1),x=v.useRef(null),w=v.useCallback(async()=>{d(!0);try{const j=un();if(!j)return;const{data:_}=await j.auth.getSession(),N=_.session?.access_token??null;if(!N)return;const k=await Te.getDashboardStats(N);k.data?.success&&l(k.data.stats)}catch(j){console.error("Failed to fetch dashboard stats",j)}finally{d(!1)}},[]);v.useEffect(()=>{w()},[w]);const S=async j=>{const _=Array.from(j);if(_.length){s("funnel"),y(!0);try{const N=un();if(!N)return;const{data:k}=await N.auth.getSession(),C=k.session?.access_token??null;if(!C)return;for(const A of _){ce.info(`Ingesting ${A.name}…`);const D=await Te.uploadDocument?.(A,C);if(D?.success)if(D.ingestion?.status==="duplicate"){const U=D.ingestion.extracted?.original_filename??"a previous upload";ce.warning(`${A.name} is a duplicate of "${U}" — skipped.`)}else ce.success(`${A.name} → ${D.ingestion?.status}`);else ce.error(`Failed to ingest ${A.name}`)}await w()}finally{y(!1)}}},E=j=>{j.preventDefault(),m(!1),S(j.dataTransfer.files)};return o.jsxs("div",{className:"w-full mx-auto px-8 py-10 space-y-12 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"text-center space-y-3",children:[o.jsxs("h2",{className:"text-4xl font-black tracking-tight flex items-center justify-center gap-3",children:[o.jsx(ou,{className:"w-10 h-10 animate-pulse"}),"Command Center"]}),o.jsx("p",{className:"text-muted-foreground text-lg max-w-2xl mx-auto",children:"Central intelligence hub for document ingestion, routing, and synthetic knowledge."})]}),o.jsxs("div",{className:"w-full space-y-10",children:[o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[o.jsx(zc,{title:"Documents Ingested",value:r?.totalDocuments,icon:o.jsx(Vm,{className:"w-5 h-5 text-blue-500"}),isLoading:u,colorClass:"bg-blue-500/10"}),o.jsx(zc,{title:"Active Policies",value:r?.activePolicies,icon:o.jsx(p0,{className:"w-5 h-5 text-emerald-500"}),isLoading:u,colorClass:"bg-emerald-500/10"}),o.jsx(zc,{title:"Knowledge Chunks",value:r?.ragChunks,icon:o.jsx(Eu,{className:"w-5 h-5 text-purple-500"}),isLoading:u,colorClass:"bg-purple-500/10"}),o.jsx(zc,{title:"Automation Runs",value:r?.automationRuns,icon:o.jsx(ui,{className:"w-5 h-5 text-amber-500"}),isLoading:u,colorClass:"bg-amber-500/10"})]}),o.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[o.jsx("div",{className:"lg:col-span-2",children:o.jsxs("div",{onDragOver:j=>{j.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:E,onClick:()=>x.current?.click(),className:ge("h-full rounded-2xl border-2 border-dashed transition-all cursor-pointer flex flex-col items-center justify-center gap-4 py-16",f?"border-primary bg-primary/5 scale-[1.01]":"border-muted-foreground/20 hover:border-primary/50 hover:bg-muted/30"),children:[o.jsx("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:j=>j.target.files&&S(j.target.files)}),g?o.jsx(it,{className:"w-12 h-12 animate-spin text-primary"}):o.jsx(tm,{className:ge("w-12 h-12 transition-colors",f?"text-primary":"text-muted-foreground/50")}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-lg font-medium text-foreground",children:f?"Drop to ingest...":"Drag & drop files to ingest"}),o.jsx("p",{className:"text-sm text-muted-foreground/60",children:"Supports .pdf, .docx, .md, .txt (up to 20MB)"})]})]})}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs(ft,{className:"flex-1 cursor-pointer hover:border-primary/50 hover:bg-muted/30 transition-all flex flex-col items-center justify-center p-6 text-center shadow-sm",onClick:()=>s("chat"),children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-indigo-500/10 flex items-center justify-center mb-4",children:o.jsx(cu,{className:"w-6 h-6 text-indigo-500"})}),o.jsx("h3",{className:"font-bold mb-1",children:"Chat with Data"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask questions against your vectorized knowledge base."})]}),o.jsxs(ft,{className:"flex-1 cursor-pointer hover:border-primary/50 hover:bg-muted/30 transition-all flex flex-col items-center justify-center p-6 text-center shadow-sm",onClick:()=>s("policies"),children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/10 flex items-center justify-center mb-4",children:o.jsx(p0,{className:"w-6 h-6 text-orange-500"})}),o.jsx("h3",{className:"font-bold mb-1",children:"Create Policy"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Define a new routing and automation contract."})]})]})]})]})]})}function zc({title:t,value:e,icon:s,isLoading:r,colorClass:l}){return o.jsx(ft,{className:"shadow-sm",children:o.jsxs(xt,{className:"p-6",children:[o.jsx("div",{className:"flex items-center justify-between mb-4",children:o.jsx("div",{className:ge("w-10 h-10 rounded-xl flex items-center justify-center",l),children:s})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:t}),r?o.jsx("div",{className:"h-8 w-16 bg-muted animate-pulse rounded-md"}):o.jsx("p",{className:"text-3xl font-black",children:e!==void 0?e.toLocaleString():"0"})]})]})})}function y0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Au(...t){return e=>{let s=!1;const r=t.map(l=>{const u=y0(l,e);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let l=0;l<r.length;l++){const u=r[l];typeof u=="function"?u():y0(t[l],null)}}}}function nr(...t){return v.useCallback(Au(...t),t)}var RA=Symbol.for("react.lazy"),hu=Mm[" use ".trim().toString()];function OA(t){return typeof t=="object"&&t!==null&&"then"in t}function Yw(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===RA&&"_payload"in t&&OA(t._payload)}function Xw(t){const e=DA(t),s=v.forwardRef((r,l)=>{let{children:u,...d}=r;Yw(u)&&typeof hu=="function"&&(u=hu(u._payload));const f=v.Children.toArray(u),m=f.find(zA);if(m){const g=m.props.children,y=f.map(x=>x===m?v.Children.count(g)>1?v.Children.only(null):v.isValidElement(g)?g.props.children:null:x);return o.jsx(e,{...d,ref:l,children:v.isValidElement(g)?v.cloneElement(g,void 0,y):null})}return o.jsx(e,{...d,ref:l,children:u})});return s.displayName=`${t}.Slot`,s}var MA=Xw("Slot");function DA(t){const e=v.forwardRef((s,r)=>{let{children:l,...u}=s;if(Yw(l)&&typeof hu=="function"&&(l=hu(l._payload)),v.isValidElement(l)){const d=UA(l),f=LA(u,l.props);return l.type!==v.Fragment&&(f.ref=r?Au(r,d):d),v.cloneElement(l,f)}return v.Children.count(l)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var PA=Symbol("radix.slottable");function zA(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===PA}function LA(t,e){const s={...e};for(const r in e){const l=t[r],u=e[r];/^on[A-Z]/.test(r)?l&&u?s[r]=(...f)=>{const m=u(...f);return l(...f),m}:l&&(s[r]=l):r==="style"?s[r]={...l,...u}:r==="className"&&(s[r]=[l,u].filter(Boolean).join(" "))}return{...t,...s}}function UA(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}const v0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,x0=xw,qm=(t,e)=>s=>{var r;if(e?.variants==null)return x0(t,s?.class,s?.className);const{variants:l,defaultVariants:u}=e,d=Object.keys(l).map(g=>{const y=s?.[g],x=u?.[g];if(y===null)return null;const w=v0(y)||v0(x);return l[g][w]}),f=s&&Object.entries(s).reduce((g,y)=>{let[x,w]=y;return w===void 0||(g[x]=w),g},{}),m=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((g,y)=>{let{class:x,className:w,...S}=y;return Object.entries(S).every(E=>{let[j,_]=E;return Array.isArray(_)?_.includes({...u,...f}[j]):{...u,...f}[j]===_})?[...g,x,w]:g},[]);return x0(t,d,m,s?.class,s?.className)},BA=qm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ae=v.forwardRef(({className:t,variant:e,size:s,asChild:r=!1,...l},u)=>{const d=r?MA:"button";return o.jsx(d,{className:ge(BA({variant:e,size:s,className:t})),ref:u,...l})});ae.displayName="Button";const je=v.forwardRef(({className:t,type:e,...s},r)=>o.jsx("input",{type:e,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...s}));je.displayName="Input";var Ww=tw();const VA=Zb(Ww);var IA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$A=IA.reduce((t,e)=>{const s=Xw(`Primitive.${e}`),r=v.forwardRef((l,u)=>{const{asChild:d,...f}=l,m=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),qA="Label",Jw=v.forwardRef((t,e)=>o.jsx($A.label,{...t,ref:e,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(t.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));Jw.displayName=qA;var HA=Jw;function Je({className:t,...e}){return o.jsx(HA,{"data-slot":"label",className:ge("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}const GA=qm("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Pt({className:t,variant:e,...s}){return o.jsx("div",{className:ge(GA({variant:e}),t),...s})}const FA=qm("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jn=v.forwardRef(({className:t,variant:e,...s},r)=>o.jsx("div",{ref:r,role:"alert",className:ge(FA({variant:e}),t),...s}));jn.displayName="Alert";const Hm=v.forwardRef(({className:t,...e},s)=>o.jsx("h5",{ref:s,className:ge("mb-1 font-medium leading-none tracking-tight",t),...e}));Hm.displayName="AlertTitle";const _n=v.forwardRef(({className:t,...e},s)=>o.jsx("div",{ref:s,className:ge("text-sm [&_p]:leading-relaxed",t),...e}));_n.displayName="AlertDescription";function KA({supabase:t,initStatus:e,sessionStatus:s,sessionEmail:r,onRefresh:l}){const[u,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState(""),[x,w]=v.useState(""),[S,E]=v.useState(!1),[j,_]=v.useState(null),N=e==="empty";async function k(){E(!0),_(null);const{error:U}=await t.auth.signInWithPassword({email:u,password:f});U?_(U.message):l(),E(!1)}async function C(){E(!0),_(null);try{const U=await Te.setup({email:u,password:f,first_name:g,last_name:x});if(U.error)throw new Error(typeof U.error=="string"?U.error:U.error.message);const{error:V}=await t.auth.signInWithPassword({email:u,password:f});if(V)throw V;l()}catch(U){_(U.message||"Failed to initialize foundation.")}finally{E(!1)}}async function A(){E(!0),_(null);const{error:U}=await t.auth.signUp({email:u,password:f,options:{data:{first_name:g,last_name:x}}});U?_(U.message):l(),E(!1)}async function D(){E(!0),await t.auth.signOut(),l(),E(!1)}return s==="authenticated"?o.jsxs("div",{className:"space-y-4 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-xl bg-primary/5 border border-primary/10",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-primary flex items-center justify-center text-primary-foreground",children:o.jsx(ku,{className:"w-5 h-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-xs font-bold uppercase tracking-widest text-muted-foreground leading-none mb-1",children:"Authenticated as"}),o.jsx("p",{className:"text-sm font-medium truncate",children:r})]})]}),e==="missing_view"&&o.jsxs(jn,{variant:"destructive",className:"bg-destructive/5 text-destructive border-destructive/20",children:[o.jsx(uu,{className:"w-4 h-4"}),o.jsx(_n,{className:"text-xs",children:"Database views missing. Foundation may be corrupted."})]}),o.jsxs(ae,{variant:"outline",className:"w-full h-11 hover:bg-destructive hover:text-destructive-reveal group transition-all duration-300",onClick:D,disabled:S,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Iw,{className:"w-4 h-4 mr-2 group-hover:rotate-180 transition-transform duration-500"}),"Logout Protocol"]})]}):o.jsxs("div",{className:"space-y-4 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"grid gap-4",children:[N&&o.jsxs("div",{className:"grid grid-cols-2 gap-4 animate-in slide-in-from-top-2 duration-300",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-firstname",children:"First Name"}),o.jsx(je,{id:"auth-firstname",placeholder:"Agent",value:g,onChange:U=>y(U.target.value),className:"h-10"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-lastname",children:"Last Name"}),o.jsx(je,{id:"auth-lastname",placeholder:"Zero",value:x,onChange:U=>w(U.target.value),className:"h-10"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-email",children:"Email Address"}),o.jsxs("div",{className:"relative",children:[o.jsx(Vo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(je,{id:"auth-email",type:"email",placeholder:"admin@example.com",value:u,onChange:U=>d(U.target.value),className:"pl-9 h-10"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"auth-password",children:"Security Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Zo,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(je,{id:"auth-password",type:"password",placeholder:"••••••••",value:f,onChange:U=>m(U.target.value),className:"pl-9 h-10",autoComplete:N?"new-password":"current-password"})]})]})]}),j&&o.jsx(jn,{variant:"destructive",className:"py-2 px-3",children:o.jsx(_n,{className:"text-[11px] leading-relaxed italic",children:j})}),o.jsx("div",{className:"pt-2",children:N?o.jsxs(ae,{className:"w-full h-11 shadow-lg shadow-primary/20",onClick:C,disabled:S||!u||!f||!g,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(ya,{className:"w-4 h-4 mr-2"}),"Initialize Primary Admin"]}):o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs(ae,{className:"h-10",onClick:k,disabled:S||!u||!f,children:[S?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Vw,{className:"w-4 h-4 mr-2"}),"Login"]}),o.jsxs(ae,{variant:"secondary",className:"h-10",onClick:A,disabled:S||!u||!f,children:[o.jsx(pA,{className:"w-4 h-4 mr-2"}),"Enroll"]})]})}),o.jsx("p",{className:"text-[10px] text-center text-muted-foreground uppercase tracking-widest font-bold opacity-50 pt-2",children:N?"Foundation Assembly Phase":"Foundation Access Required"})]})}const fa="0.1.6",YA="20260228000001";async function XA(t,e){const s=Promise.resolve(t);let r=null;const l=new Promise((u,d)=>{r=setTimeout(()=>{d(new Error(`Operation timed out after ${e}ms`))},e)});try{return await Promise.race([s,l])}finally{r&&clearTimeout(r)}}async function WA(t){try{const{data:e,error:s}=await XA(t.rpc("get_latest_migration_timestamp"),12e3);if(s)return s.code==="42883"?{latestMigrationTimestamp:"0"}:{latestMigrationTimestamp:null};const r=e??null;return r&&r>="29990000000000"?{latestMigrationTimestamp:null}:{latestMigrationTimestamp:r}}catch{return{latestMigrationTimestamp:null}}}async function Qw(t){const e=await WA(t);return!e.latestMigrationTimestamp||e.latestMigrationTimestamp.trim()===""?{needsMigration:!0,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database migration state unknown."}:YA>e.latestMigrationTimestamp?{needsMigration:!0,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:`Database is behind (${e.latestMigrationTimestamp}).`}:{needsMigration:!1,appVersion:fa,latestMigrationTimestamp:e.latestMigrationTimestamp,message:"Database schema is up-to-date."}}function JA({supabase:t,sessionEmail:e,sessionStatus:s,initStatus:r,configSnapshot:l,configSource:u,onRefresh:d,onLaunchSetup:f,onResetSetup:m}){const[g,y]=v.useState("profile"),[x,w]=v.useState(null),[S,E]=v.useState(!1);async function j(){if(!t)return;E(!0);const{data:{user:k}}=await t.auth.getUser();if(k){const{data:C}=await t.from("profiles").select("*").eq("id",k.id).single();C&&w(C)}E(!1)}v.useEffect(()=>{s==="authenticated"&&t&&j()},[s,t]);const _=[{id:"profile",label:"Profile",icon:ku},{id:"security",label:"Security",icon:ya},{id:"supabase",label:"Supabase",icon:Eu}];async function N(){t&&(await t.auth.signOut(),d())}return o.jsxs("div",{className:"max-w-6xl mx-auto space-y-8 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-4xl font-black tracking-tight",children:"Account Settings"}),o.jsx("p",{className:"text-muted-foreground text-lg",children:"Manage your profile and foundational preferences."})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-12 items-start",children:[o.jsxs("aside",{className:"w-full md:w-72 flex flex-col gap-8 shrink-0",children:[o.jsx("nav",{className:"space-y-1",children:_.map(k=>{const C=k.icon,A=g===k.id;return o.jsxs("button",{onClick:()=>y(k.id),className:ge("w-full flex items-center gap-3 px-4 py-3 text-sm font-bold rounded-xl transition-all duration-300",A?"bg-foreground text-background shadow-lg shadow-foreground/10":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[o.jsx(C,{className:ge("w-5 h-5",A?"text-background":"text-muted-foreground/60")}),k.label]},k.id)})}),o.jsxs("div",{className:"pt-8 border-t space-y-6",children:[o.jsxs("button",{onClick:N,className:"group w-full flex items-center gap-3 px-4 py-2 text-sm font-bold rounded-xl transition-all duration-300 text-destructive hover:bg-destructive/10",children:[o.jsx(Iw,{className:"w-5 h-5 transition-transform group-hover:translate-x-1"}),"Logout"]}),o.jsxs("div",{className:"px-4",children:[o.jsx("p",{className:"text-[10px] font-black text-muted-foreground/40 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/60",children:["v",fa]})]})]})]}),o.jsxs("div",{className:"flex-1 w-full animate-in slide-in-from-right-4 duration-500",children:[g==="profile"&&o.jsx(QA,{sessionEmail:e,sessionStatus:s,supabase:t,initStatus:r,profile:x,onProfileUpdate:j,onRefresh:d,isLoading:S}),g==="security"&&o.jsx(ZA,{supabase:t}),g==="supabase"&&o.jsx(eR,{configSnapshot:l,configSource:u,onLaunchSetup:f,onResetSetup:m})]})]})]})}function QA({sessionEmail:t,sessionStatus:e,supabase:s,initStatus:r,profile:l,onProfileUpdate:u,onRefresh:d,isLoading:f}){const[m,g]=v.useState(""),[y,x]=v.useState(""),[w,S]=v.useState(!0),[E,j]=v.useState(!1),[_,N]=v.useState(!1);v.useEffect(()=>{l&&(g(l.first_name||""),x(l.last_name||""))},[l]);const k=async()=>{if(!s||!l)return;j(!0);const{error:A}=await s.from("profiles").update({first_name:m,last_name:y}).eq("id",l.id);A||u(),j(!1)},C=async A=>{const D=A.target.files?.[0];if(!(!D||!s||!l)){N(!0);try{const U=D.name.split(".").pop(),V=`${l.id}/${Math.random()}.${U}`,{error:R}=await s.storage.from("avatars").upload(V,D);if(R)throw R;const{data:{publicUrl:P}}=s.storage.from("avatars").getPublicUrl(V);await s.from("profiles").update({avatar_url:P}).eq("id",l.id),u()}catch(U){console.error("Upload error:",U)}finally{N(!1)}}};return o.jsxs(ft,{className:"border-border/40 shadow-xl shadow-black/5 bg-card/50 backdrop-blur-sm overflow-hidden",children:[o.jsxs(zt,{className:"p-8 border-b bg-muted/20",children:[o.jsx(Lt,{className:"text-2xl font-black",children:"Profile Information"}),o.jsx(wn,{className:"text-base",children:"Update your personal foundation details."})]}),o.jsx(xt,{className:"p-8 space-y-10",children:f?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(it,{className:"w-8 h-8 animate-spin text-primary"})}):e==="authenticated"?o.jsxs("div",{className:"space-y-10",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-8",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-32 h-32 rounded-full bg-primary/10 border-4 border-background shadow-2xl overflow-hidden flex items-center justify-center",children:l?.avatar_url?o.jsx("img",{src:l.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):t?o.jsx("span",{className:"text-4xl font-black text-primary",children:t.charAt(0).toUpperCase()}):o.jsx(ku,{className:"w-12 h-12 text-primary/40"})}),o.jsxs("label",{className:"absolute bottom-1 right-1 h-10 w-10 rounded-full bg-background border shadow-lg flex items-center justify-center hover:scale-110 transition-transform cursor-pointer",children:[_?o.jsx(it,{className:"w-4 h-4 animate-spin text-muted-foreground"}):o.jsx(Uk,{className:"w-5 h-5 text-muted-foreground"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:C,disabled:_})]})]}),o.jsxs("div",{className:"flex-1 w-full grid grid-cols-1 sm:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"firstName",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"First Name"}),o.jsx(je,{id:"firstName",placeholder:"Trung",value:m,onChange:A=>g(A.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"lastName",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Last Name"}),o.jsx(je,{id:"lastName",placeholder:"Le",value:y,onChange:A=>x(A.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[o.jsx(Je,{htmlFor:"email",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Email Address"}),o.jsx(je,{id:"email",value:t||"",disabled:!0,className:"h-12 rounded-xl bg-muted/40 border-border/40 opacity-70 cursor-not-allowed"}),o.jsx("p",{className:"text-[10px] text-muted-foreground/60 font-bold ml-1",children:"This is your login email and cannot be changed."})]})]})]}),o.jsxs("div",{className:"pt-8 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"text-base font-bold",children:"Sound & Haptic Feedback"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Play chimes and haptic pulses for system events."})]}),o.jsxs(ae,{variant:w?"default":"outline",className:ge("h-11 px-6 rounded-xl font-bold transition-all",w?"shadow-lg shadow-primary/20":""),onClick:()=>S(!w),children:[w?o.jsx(nm,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),w?"Enabled":"Disabled"]})]})]}):o.jsxs("div",{className:"py-8",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4 mb-6",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(ya,{className:"w-6 h-6"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold",children:"Authentication Gateway"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Access your foundational profile."})]})]}),s&&o.jsx(KA,{supabase:s,initStatus:r,sessionStatus:e,sessionEmail:t,onRefresh:d})]})}),e==="authenticated"&&!f&&o.jsx(Tu,{className:"bg-muted/20 p-8 flex justify-end",children:o.jsxs(ae,{className:"h-12 px-8 rounded-xl font-bold shadow-xl shadow-primary/20",onClick:k,disabled:E,children:[E?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(VC,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})}function ZA({supabase:t}){const[e,s]=v.useState(""),[r,l]=v.useState(""),[u,d]=v.useState(!1),[f,m]=v.useState(null),g=async()=>{if(!t)return;if(e!==r){m({type:"error",msg:"Passwords do not match."});return}if(e.length<8){m({type:"error",msg:"Password must be at least 8 characters."});return}d(!0),m(null);const{error:y}=await t.auth.updateUser({password:e});y?m({type:"error",msg:y.message}):(m({type:"success",msg:"Password updated successfully."}),s(""),l("")),d(!1)};return o.jsxs(ft,{className:"border-border/40 shadow-xl shadow-black/5 bg-card/50 backdrop-blur-sm overflow-hidden",children:[o.jsxs(zt,{className:"p-8 border-b bg-muted/20",children:[o.jsx(Lt,{className:"text-2xl font-black",children:"Security Protocol"}),o.jsx(wn,{className:"text-base",children:"Manage your foundation credentials and access keys."})]}),o.jsxs(xt,{className:"p-8 space-y-8",children:[f&&o.jsxs(jn,{variant:f.type==="error"?"destructive":"default",className:ge("animate-in fade-in slide-in-from-top-2 duration-300",f.type==="success"?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20":""),children:[f.type==="success"?o.jsx(os,{className:"h-4 w-4"}):o.jsx(uu,{className:"h-4 w-4"}),o.jsx(_n,{className:"text-sm font-bold",children:f.msg})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"newPass",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"New Password"}),o.jsx(je,{id:"newPass",type:"password",placeholder:"••••••••",value:e,onChange:y=>s(y.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Je,{htmlFor:"confirmPass",className:"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",children:"Confirm Password"}),o.jsx(je,{id:"confirmPass",type:"password",placeholder:"••••••••",value:r,onChange:y=>l(y.target.value),className:"h-12 rounded-xl bg-background/50 border-border/40"})]})]}),o.jsxs("div",{className:"bg-muted/30 p-6 rounded-2xl border border-border/40 space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(uu,{className:"w-5 h-5"})}),o.jsx("h5",{className:"font-bold",children:"Security Tip"})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Use a password at least 12 characters long with a mix of letters, numbers, and symbols to ensure your foundational data remains secure."})]})]})]}),o.jsx(Tu,{className:"bg-muted/20 p-8 flex justify-end",children:o.jsxs(ae,{className:"h-12 px-8 rounded-xl font-bold shadow-xl shadow-primary/20",onClick:g,disabled:u||!e||!r,children:[u?o.jsx(it,{className:"w-4 h-4 animate-spin mr-2"}):o.jsx(Zo,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})}function eR({configSnapshot:t,configSource:e,onLaunchSetup:s,onResetSetup:r}){return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-700",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary",children:o.jsx(Eu,{className:"w-6 h-6"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-lg font-bold",children:"Supabase Configuration"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Primary storage and identity gateway."})]}),o.jsxs(Pt,{variant:"secondary",className:"text-[10px] font-black uppercase tracking-widest px-3 py-1",children:["Source: ",e]})]}),o.jsxs(ft,{className:"border-border/40 shadow-sm bg-card/50 backdrop-blur-sm",children:[o.jsx(xt,{className:"p-8 space-y-8",children:t?o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"API Endpoint"}),o.jsx("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 backdrop-blur-sm shadow-inner",children:o.jsx("p",{className:"text-sm font-semibold truncate text-foreground/80",children:t.url})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"Project Identifier"}),o.jsx("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 font-mono shadow-inner",children:o.jsx("p",{className:"text-sm font-semibold text-foreground/80",children:t.url.split("//")[1]?.split(".")[0]||"Unknown"})})]}),o.jsxs("div",{className:"md:col-span-2 space-y-2",children:[o.jsx("span",{className:"text-[10px] font-black uppercase text-muted-foreground tracking-widest pl-1",children:"Service Role Access (Masked)"}),o.jsxs("div",{className:"bg-muted/30 p-4 rounded-2xl border border-border/40 flex items-center justify-between shadow-inner",children:[o.jsxs("p",{className:"text-sm font-mono text-muted-foreground",children:[t.anonKey.slice(0,6),"...",t.anonKey.slice(-6)]}),o.jsx(Pt,{variant:"outline",className:"text-[9px] font-bold",children:"Standard Key"})]})]})]}):o.jsxs(jn,{className:"bg-amber-500/5 border-amber-500/20 text-amber-600 dark:text-amber-400 p-6 rounded-2xl shadow-sm",children:[o.jsx(Sn,{className:"w-5 h-5"}),o.jsx(Hm,{className:"font-bold mb-1",children:"Infrastructure Standby"}),o.jsx(_n,{className:"text-sm opacity-90",children:"The foundation has not been initialized. You must run the setup wizard to continue."})]})}),o.jsxs(Tu,{className:"bg-muted/20 p-8 flex gap-4 border-t",children:[o.jsxs(ae,{variant:t?"outline":"default",className:"flex-1 h-12 rounded-xl font-bold shadow-sm",onClick:s,children:[t?o.jsx(WC,{className:"w-4 h-4 mr-2"}):o.jsx(Wa,{className:"w-4 h-4 mr-2"}),t?"Run Setup Wizard":"Launch Initializer"]}),t&&o.jsx(ae,{variant:"ghost",size:"icon",className:"h-12 w-12 rounded-xl text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",onClick:r,title:"Reset All Configuration",children:o.jsx(PC,{className:"w-5 h-5"})})]})]}),o.jsxs("div",{className:"space-y-6 pt-4",children:[o.jsxs("div",{className:"flex items-center gap-3 border-b pb-4",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-destructive/10 flex items-center justify-center text-destructive",children:o.jsx(Sn,{className:"w-6 h-6"})}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold text-destructive",children:"Advanced Maintenance"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Destructive actions and system-level overrides."})]})]}),o.jsx(ft,{className:"border-destructive/20 bg-destructive/5 overflow-hidden shadow-sm",children:o.jsxs(xt,{className:"p-8",children:[o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Fully resetting the foundation will purge all local storage cached parameters. This action is irreversible and will force a fresh bootstrap flow upon next launch."}),o.jsx(ae,{variant:"link",className:"px-0 text-destructive h-auto text-xs font-black uppercase tracking-widest mt-4 hover:no-underline hover:opacity-70 transition-opacity",onClick:r,children:"Wipe Local Foundation Buffer"})]})})]})]})}const tR={theme:"system",setTheme:()=>null},Zw=v.createContext(tR);function nR({children:t,defaultTheme:e="system",storageKey:s="vite-ui-theme"}){const[r,l]=v.useState(()=>localStorage.getItem(s)||e);v.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),r==="system"){const f=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(f);return}d.classList.add(r)},[r]);const u=v.useMemo(()=>({theme:r,setTheme:d=>{localStorage.setItem(s,d),l(d)}}),[r,s]);return o.jsx(Zw.Provider,{value:u,children:t})}const sR=()=>{const t=v.useContext(Zw);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};function e1(){const{setTheme:t,theme:e}=sR();return o.jsxs(ae,{variant:"ghost",size:"icon",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:bg-muted/60 transition-all duration-300 h-9 w-9 rounded-full",title:`Switch to ${e==="dark"?"light":"dark"} mode`,children:[e==="dark"?o.jsx(nA,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(CC,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function ha(t,e,{checkForDefaultPrevented:s=!0}={}){return function(l){if(t?.(l),s===!1||!l.defaultPrevented)return e?.(l)}}function aR(t,e){const s=v.createContext(e),r=u=>{const{children:d,...f}=u,m=v.useMemo(()=>f,Object.values(f));return o.jsx(s.Provider,{value:m,children:d})};r.displayName=t+"Provider";function l(u){const d=v.useContext(s);if(d)return d;if(e!==void 0)return e;throw new Error(`\`${u}\` must be used within \`${t}\``)}return[r,l]}function rR(t,e=[]){let s=[];function r(u,d){const f=v.createContext(d),m=s.length;s=[...s,d];const g=x=>{const{scope:w,children:S,...E}=x,j=w?.[t]?.[m]||f,_=v.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:_,children:S})};g.displayName=u+"Provider";function y(x,w){const S=w?.[t]?.[m]||f,E=v.useContext(S);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${x}\` must be used within \`${u}\``)}return[g,y]}const l=()=>{const u=s.map(d=>v.createContext(d));return function(f){const m=f?.[t]||u;return v.useMemo(()=>({[`__scope${t}`]:{...f,[t]:m}}),[f,m])}};return l.scopeName=t,[r,iR(l,...e)]}function iR(...t){const e=t[0];if(t.length===1)return e;const s=()=>{const r=t.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(u){const d=r.reduce((f,{useScope:m,scopeName:g})=>{const x=m(u)[`__scope${g}`];return{...f,...x}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return s.scopeName=e.scopeName,s}var qo=globalThis?.document?v.useLayoutEffect:()=>{},oR=Mm[" useId ".trim().toString()]||(()=>{}),lR=0;function mh(t){const[e,s]=v.useState(oR());return qo(()=>{s(r=>r??String(lR++))},[t]),t||(e?`radix-${e}`:"")}var cR=Mm[" useInsertionEffect ".trim().toString()]||qo;function uR({prop:t,defaultProp:e,onChange:s=()=>{},caller:r}){const[l,u,d]=dR({defaultProp:e,onChange:s}),f=t!==void 0,m=f?t:l;{const y=v.useRef(t!==void 0);v.useEffect(()=>{const x=y.current;x!==f&&console.warn(`${r} is changing from ${x?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=f},[f,r])}const g=v.useCallback(y=>{if(f){const x=fR(y)?y(t):y;x!==t&&d.current?.(x)}else u(y)},[f,t,u,d]);return[m,g]}function dR({defaultProp:t,onChange:e}){const[s,r]=v.useState(t),l=v.useRef(s),u=v.useRef(e);return cR(()=>{u.current=e},[e]),v.useEffect(()=>{l.current!==s&&(u.current?.(s),l.current=s)},[s,l]),[s,r,u]}function fR(t){return typeof t=="function"}function hR(t){const e=mR(t),s=v.forwardRef((r,l)=>{const{children:u,...d}=r,f=v.Children.toArray(u),m=f.find(gR);if(m){const g=m.props.children,y=f.map(x=>x===m?v.Children.count(g)>1?v.Children.only(null):v.isValidElement(g)?g.props.children:null:x);return o.jsx(e,{...d,ref:l,children:v.isValidElement(g)?v.cloneElement(g,void 0,y):null})}return o.jsx(e,{...d,ref:l,children:u})});return s.displayName=`${t}.Slot`,s}function mR(t){const e=v.forwardRef((s,r)=>{const{children:l,...u}=s;if(v.isValidElement(l)){const d=vR(l),f=yR(u,l.props);return l.type!==v.Fragment&&(f.ref=r?Au(r,d):d),v.cloneElement(l,f)}return v.Children.count(l)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var pR=Symbol("radix.slottable");function gR(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pR}function yR(t,e){const s={...e};for(const r in e){const l=t[r],u=e[r];/^on[A-Z]/.test(r)?l&&u?s[r]=(...f)=>{const m=u(...f);return l(...f),m}:l&&(s[r]=l):r==="style"?s[r]={...l,...u}:r==="className"&&(s[r]=[l,u].filter(Boolean).join(" "))}return{...t,...s}}function vR(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var xR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Os=xR.reduce((t,e)=>{const s=hR(`Primitive.${e}`),r=v.forwardRef((l,u)=>{const{asChild:d,...f}=l,m=d?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...f,ref:u})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function bR(t,e){t&&Ww.flushSync(()=>t.dispatchEvent(e))}function Ho(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...s)=>e.current?.(...s),[])}function wR(t,e=globalThis?.document){const s=Ho(t);v.useEffect(()=>{const r=l=>{l.key==="Escape"&&s(l)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[s,e])}var SR="DismissableLayer",rm="dismissableLayer.update",jR="dismissableLayer.pointerDownOutside",_R="dismissableLayer.focusOutside",b0,t1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),n1=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:f,...m}=t,g=v.useContext(t1),[y,x]=v.useState(null),w=y?.ownerDocument??globalThis?.document,[,S]=v.useState({}),E=nr(e,V=>x(V)),j=Array.from(g.layers),[_]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),N=j.indexOf(_),k=y?j.indexOf(y):-1,C=g.layersWithOutsidePointerEventsDisabled.size>0,A=k>=N,D=ER(V=>{const R=V.target,P=[...g.branches].some(Z=>Z.contains(R));!A||P||(l?.(V),d?.(V),V.defaultPrevented||f?.())},w),U=kR(V=>{const R=V.target;[...g.branches].some(Z=>Z.contains(R))||(u?.(V),d?.(V),V.defaultPrevented||f?.())},w);return wR(V=>{k===g.layers.size-1&&(r?.(V),!V.defaultPrevented&&f&&(V.preventDefault(),f()))},w),v.useEffect(()=>{if(y)return s&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(b0=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(y)),g.layers.add(y),w0(),()=>{s&&g.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=b0)}},[y,w,s,g]),v.useEffect(()=>()=>{y&&(g.layers.delete(y),g.layersWithOutsidePointerEventsDisabled.delete(y),w0())},[y,g]),v.useEffect(()=>{const V=()=>S({});return document.addEventListener(rm,V),()=>document.removeEventListener(rm,V)},[]),o.jsx(Os.div,{...m,ref:E,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:ha(t.onFocusCapture,U.onFocusCapture),onBlurCapture:ha(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:ha(t.onPointerDownCapture,D.onPointerDownCapture)})});n1.displayName=SR;var NR="DismissableLayerBranch",TR=v.forwardRef((t,e)=>{const s=v.useContext(t1),r=v.useRef(null),l=nr(e,r);return v.useEffect(()=>{const u=r.current;if(u)return s.branches.add(u),()=>{s.branches.delete(u)}},[s.branches]),o.jsx(Os.div,{...t,ref:l})});TR.displayName=NR;function ER(t,e=globalThis?.document){const s=Ho(t),r=v.useRef(!1),l=v.useRef(()=>{});return v.useEffect(()=>{const u=f=>{if(f.target&&!r.current){let m=function(){s1(jR,s,g,{discrete:!0})};const g={originalEvent:f};f.pointerType==="touch"?(e.removeEventListener("click",l.current),l.current=m,e.addEventListener("click",l.current,{once:!0})):m()}else e.removeEventListener("click",l.current);r.current=!1},d=window.setTimeout(()=>{e.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(d),e.removeEventListener("pointerdown",u),e.removeEventListener("click",l.current)}},[e,s]),{onPointerDownCapture:()=>r.current=!0}}function kR(t,e=globalThis?.document){const s=Ho(t),r=v.useRef(!1);return v.useEffect(()=>{const l=u=>{u.target&&!r.current&&s1(_R,s,{originalEvent:u},{discrete:!1})};return e.addEventListener("focusin",l),()=>e.removeEventListener("focusin",l)},[e,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w0(){const t=new CustomEvent(rm);document.dispatchEvent(t)}function s1(t,e,s,{discrete:r}){const l=s.originalEvent.target,u=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});e&&l.addEventListener(t,e,{once:!0}),r?bR(l,u):l.dispatchEvent(u)}var ph="focusScope.autoFocusOnMount",gh="focusScope.autoFocusOnUnmount",S0={bubbles:!1,cancelable:!0},CR="FocusScope",a1=v.forwardRef((t,e)=>{const{loop:s=!1,trapped:r=!1,onMountAutoFocus:l,onUnmountAutoFocus:u,...d}=t,[f,m]=v.useState(null),g=Ho(l),y=Ho(u),x=v.useRef(null),w=nr(e,j=>m(j)),S=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let j=function(C){if(S.paused||!f)return;const A=C.target;f.contains(A)?x.current=A:oa(x.current,{select:!0})},_=function(C){if(S.paused||!f)return;const A=C.relatedTarget;A!==null&&(f.contains(A)||oa(x.current,{select:!0}))},N=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&oa(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",_);const k=new MutationObserver(N);return f&&k.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",_),k.disconnect()}}},[r,f,S.paused]),v.useEffect(()=>{if(f){_0.add(S);const j=document.activeElement;if(!f.contains(j)){const N=new CustomEvent(ph,S0);f.addEventListener(ph,g),f.dispatchEvent(N),N.defaultPrevented||(AR(PR(r1(f)),{select:!0}),document.activeElement===j&&oa(f))}return()=>{f.removeEventListener(ph,g),setTimeout(()=>{const N=new CustomEvent(gh,S0);f.addEventListener(gh,y),f.dispatchEvent(N),N.defaultPrevented||oa(j??document.body,{select:!0}),f.removeEventListener(gh,y),_0.remove(S)},0)}}},[f,g,y,S]);const E=v.useCallback(j=>{if(!s&&!r||S.paused)return;const _=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,N=document.activeElement;if(_&&N){const k=j.currentTarget,[C,A]=RR(k);C&&A?!j.shiftKey&&N===A?(j.preventDefault(),s&&oa(C,{select:!0})):j.shiftKey&&N===C&&(j.preventDefault(),s&&oa(A,{select:!0})):N===k&&j.preventDefault()}},[s,r,S.paused]);return o.jsx(Os.div,{tabIndex:-1,...d,ref:w,onKeyDown:E})});a1.displayName=CR;function AR(t,{select:e=!1}={}){const s=document.activeElement;for(const r of t)if(oa(r,{select:e}),document.activeElement!==s)return}function RR(t){const e=r1(t),s=j0(e,t),r=j0(e.reverse(),t);return[s,r]}function r1(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const l=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||l?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function j0(t,e){for(const s of t)if(!OR(s,{upTo:e}))return s}function OR(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function MR(t){return t instanceof HTMLInputElement&&"select"in t}function oa(t,{select:e=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&MR(t)&&e&&t.select()}}var _0=DR();function DR(){let t=[];return{add(e){const s=t[0];e!==s&&s?.pause(),t=N0(t,e),t.unshift(e)},remove(e){t=N0(t,e),t[0]?.resume()}}}function N0(t,e){const s=[...t],r=s.indexOf(e);return r!==-1&&s.splice(r,1),s}function PR(t){return t.filter(e=>e.tagName!=="A")}var zR="Portal",i1=v.forwardRef((t,e)=>{const{container:s,...r}=t,[l,u]=v.useState(!1);qo(()=>u(!0),[]);const d=s||l&&globalThis?.document?.body;return d?VA.createPortal(o.jsx(Os.div,{...r,ref:e}),d):null});i1.displayName=zR;function LR(t,e){return v.useReducer((s,r)=>e[s][r]??s,t)}var Ru=t=>{const{present:e,children:s}=t,r=UR(e),l=typeof s=="function"?s({present:r.isPresent}):v.Children.only(s),u=nr(r.ref,BR(l));return typeof s=="function"||r.isPresent?v.cloneElement(l,{ref:u}):null};Ru.displayName="Presence";function UR(t){const[e,s]=v.useState(),r=v.useRef(null),l=v.useRef(t),u=v.useRef("none"),d=t?"mounted":"unmounted",[f,m]=LR(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const g=Lc(r.current);u.current=f==="mounted"?g:"none"},[f]),qo(()=>{const g=r.current,y=l.current;if(y!==t){const w=u.current,S=Lc(g);t?m("MOUNT"):S==="none"||g?.display==="none"?m("UNMOUNT"):m(y&&w!==S?"ANIMATION_OUT":"UNMOUNT"),l.current=t}},[t,m]),qo(()=>{if(e){let g;const y=e.ownerDocument.defaultView??window,x=S=>{const j=Lc(r.current).includes(CSS.escape(S.animationName));if(S.target===e&&j&&(m("ANIMATION_END"),!l.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",g=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},w=S=>{S.target===e&&(u.current=Lc(r.current))};return e.addEventListener("animationstart",w),e.addEventListener("animationcancel",x),e.addEventListener("animationend",x),()=>{y.clearTimeout(g),e.removeEventListener("animationstart",w),e.removeEventListener("animationcancel",x),e.removeEventListener("animationend",x)}}else m("ANIMATION_END")},[e,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:v.useCallback(g=>{r.current=g?getComputedStyle(g):null,s(g)},[])}}function Lc(t){return t?.animationName||"none"}function BR(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var yh=0;function VR(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??T0()),document.body.insertAdjacentElement("beforeend",t[1]??T0()),yh++,()=>{yh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),yh--}},[])}function T0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Yc="right-scroll-bar-position",Xc="width-before-scroll-bar",IR="with-scroll-bars-hidden",$R="--removed-body-scroll-bar-size";function vh(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function qR(t,e){var s=v.useState(function(){return{value:t,callback:e,facade:{get current(){return s.value},set current(r){var l=s.value;l!==r&&(s.value=r,s.callback(r,l))}}}})[0];return s.callback=e,s.facade}var HR=typeof window<"u"?v.useLayoutEffect:v.useEffect,E0=new WeakMap;function GR(t,e){var s=qR(null,function(r){return t.forEach(function(l){return vh(l,r)})});return HR(function(){var r=E0.get(s);if(r){var l=new Set(r),u=new Set(t),d=s.current;l.forEach(function(f){u.has(f)||vh(f,null)}),u.forEach(function(f){l.has(f)||vh(f,d)})}E0.set(s,t)},[t]),s}function FR(t){return t}function KR(t,e){e===void 0&&(e=FR);var s=[],r=!1,l={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(u){var d=e(u,r);return s.push(d),function(){s=s.filter(function(f){return f!==d})}},assignSyncMedium:function(u){for(r=!0;s.length;){var d=s;s=[],d.forEach(u)}s={push:function(f){return u(f)},filter:function(){return s}}},assignMedium:function(u){r=!0;var d=[];if(s.length){var f=s;s=[],f.forEach(u),d=s}var m=function(){var y=d;d=[],y.forEach(u)},g=function(){return Promise.resolve().then(m)};g(),s={push:function(y){d.push(y),g()},filter:function(y){return d=d.filter(y),s}}}};return l}function YR(t){t===void 0&&(t={});var e=KR(null);return e.options=ss({async:!0,ssr:!1},t),e}var o1=function(t){var e=t.sideCar,s=pi(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,ss({},s))};o1.isSideCarExport=!0;function XR(t,e){return t.useMedium(e),o1}var l1=YR(),xh=function(){},Ou=v.forwardRef(function(t,e){var s=v.useRef(null),r=v.useState({onScrollCapture:xh,onWheelCapture:xh,onTouchMoveCapture:xh}),l=r[0],u=r[1],d=t.forwardProps,f=t.children,m=t.className,g=t.removeScrollBar,y=t.enabled,x=t.shards,w=t.sideCar,S=t.noRelative,E=t.noIsolation,j=t.inert,_=t.allowPinchZoom,N=t.as,k=N===void 0?"div":N,C=t.gapMode,A=pi(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=w,U=GR([s,e]),V=ss(ss({},A),l);return v.createElement(v.Fragment,null,y&&v.createElement(D,{sideCar:l1,removeScrollBar:g,shards:x,noRelative:S,noIsolation:E,inert:j,setCallbacks:u,allowPinchZoom:!!_,lockRef:s,gapMode:C}),d?v.cloneElement(v.Children.only(f),ss(ss({},V),{ref:U})):v.createElement(k,ss({},V,{className:m,ref:U}),f))});Ou.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ou.classNames={fullWidth:Xc,zeroRight:Yc};var WR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JR(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=WR();return e&&t.setAttribute("nonce",e),t}function QR(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function ZR(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var eO=function(){var t=0,e=null;return{add:function(s){t==0&&(e=JR())&&(QR(e,s),ZR(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},tO=function(){var t=eO();return function(e,s){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&s])}},c1=function(){var t=tO(),e=function(s){var r=s.styles,l=s.dynamic;return t(r,l),null};return e},nO={left:0,top:0,right:0,gap:0},bh=function(t){return parseInt(t||"",10)||0},sO=function(t){var e=window.getComputedStyle(document.body),s=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],l=e[t==="padding"?"paddingRight":"marginRight"];return[bh(s),bh(r),bh(l)]},aO=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return nO;var e=sO(t),s=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-s+e[2]-e[0])}},rO=c1(),li="data-scroll-locked",iO=function(t,e,s,r){var l=t.left,u=t.top,d=t.right,f=t.gap;return s===void 0&&(s="margin"),`
|
|
52
52
|
.`.concat(IR,` {
|
|
53
53
|
overflow: hidden `).concat(r,`;
|
|
54
54
|
padding-right: `).concat(f,"px ").concat(r,`;
|
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>Folio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-B4oc5ysP.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DzN8-j-e.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|