module.exports=[16841,a=>{"use strict";function b(a){return function(b){let c=b??this;if(!c)throw TypeError(`${a.kind||a.name} type guard requires an error object`);return!!a.kind&&"object"==typeof c&&null!==c&&"constructor"in c&&c.constructor?.kind===a.kind||c instanceof a}}var c=class a extends Error{static kind="ClerkError";clerkError=!0;code;longMessage;docsUrl;cause;get name(){return this.constructor.name}constructor(b){super(new.target.formatMessage(new.target.kind,b.message,b.code,b.docsUrl),{cause:b.cause}),Object.setPrototypeOf(this,a.prototype),this.code=b.code,this.docsUrl=b.docsUrl,this.longMessage=b.longMessage,this.cause=b.cause}toString(){return`[${this.name}]
Message:${this.message}`}static formatMessage(a,b,c,d){let e="Clerk:",f=RegExp(e.replace(" ","\\s*"),"i");return b=b.replace(f,""),b=`${e} ${b.trim()}

(code="${c}")

`,d&&(b+=`

Docs: ${d}`),b}},d=class a extends c{static kind="ClerkRuntimeError";clerkRuntimeError=!0;constructor(b,c){super({...c,message:b}),Object.setPrototypeOf(this,a.prototype)}};let e=b(d);a.s(["a",0,b,"i",0,function(a){return b(c)(a)||!!a&&"object"==typeof a&&"clerkError"in a&&!0===a.clerkError},"n",0,e,"r",0,c,"t",0,d])},2220,a=>{"use strict";var b=a.i(16841),c=class{static kind="ClerkAPIError";code;message;longMessage;meta;constructor(a){const b={code:a.code,message:a.message,longMessage:a.long_message,meta:{paramName:a.meta?.param_name,sessionId:a.meta?.session_id,emailAddresses:a.meta?.email_addresses,identifiers:a.meta?.identifiers,zxcvbn:a.meta?.zxcvbn,plan:a.meta?.plan,isPlanUpgradePossible:a.meta?.is_plan_upgrade_possible}};this.code=b.code,this.message=b.message,this.longMessage=b.longMessage,this.meta=b.meta}};let d=(0,b.a)(c);var e=class a extends b.r{static kind="ClerkAPIResponseError";status;clerkTraceId;retryAfter;errors;constructor(b,d){const{data:e,status:f,clerkTraceId:g,retryAfter:h}=d;super({...d,message:b,code:"api_response_error"}),Object.setPrototypeOf(this,a.prototype),this.status=f,this.clerkTraceId=g,this.retryAfter=h,this.errors=(e||[]).map(a=>new c(a))}toString(){let a=`[${this.name}]
Message:${this.message}
Status:${this.status}
Serialized errors: ${this.errors.map(a=>JSON.stringify(a))}`;return this.clerkTraceId&&(a+=`
Clerk Trace ID: ${this.clerkTraceId}`),a}static formatMessage(a,b,c,d){return b}};let f=(0,b.a)(e);var g=class a extends e{static kind="MissingExpiredTokenError";static ERROR_CODE="missing_expired_token";static STATUS=422;static is(b){return f(b)&&b.status===a.STATUS&&b.errors.length>0&&b.errors[0].code===a.ERROR_CODE}},h=class a extends b.t{static kind="ClerkOfflineError";static ERROR_CODE="clerk_offline";constructor(b){super(b,{code:a.ERROR_CODE}),Object.setPrototypeOf(this,a.prototype)}static is(c){return null!=c&&(c instanceof a||(0,b.n)(c)&&c.code===a.ERROR_CODE)}};let i=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});var j=class a extends Error{code;constructor(b){super(b),this.code=b,this.name="EmailLinkError",Object.setPrototypeOf(this,a.prototype)}},k=class extends b.t{code;constructor(a,{code:b}){super(a,{code:b}),this.code=b}};function l(a){return"code"in a&&[4001,32602,32603].includes(a.code)&&"message"in a}a.s(["C",0,f,"D",0,c,"E",0,function(a=[]){return a.length>0?a.map(a=>new c(a)):[]},"O",0,d,"S",0,e,"T",0,function(a){return new c(a)},"_",0,{Expired:"expired",Failed:"failed",ClientMismatch:"client_mismatch"},"a",0,function(a){return"EmailLinkError"===a.name},"b",0,h,"c",0,function(a){return(`${a.message}${a.name}`||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")},"d",0,function(a){return(0,b.n)(a)&&"reverification_cancelled"===a.code},"f",0,function(a){let b=a?.status;return 401===b||422===b},"g",0,j,"h",0,k,"i",0,function(a){return["captcha_invalid","captcha_not_enabled","captcha_missing_token"].includes(a.errors[0].code)},"l",0,function(a){return f(a)&&a.errors?.[0]?.code==="form_password_compromised"},"m",0,function(a){return f(a)&&a.errors?.[0]?.code==="user_locked"},"n",0,function(a){return a?.status===429},"o",0,function(a){return f(a)||l(a)||(0,b.n)(a)},"p",0,function(a){let b=a?.status;return a?.errors?.[0]?.code==="authentication_invalid"&&401===b},"r",0,function(a){let b=a?.status;return!!b&&b>=400&&b<500},"s",0,l,"t",0,function(a){for(let[c,d]of Object.entries({isClerkAPIResponseError:f,isClerkRuntimeError:b.n}))Object.assign(a,{[c]:d});return a},"u",0,function(a){return f(a)&&a.errors?.[0]?.code==="form_password_pwned"},"v",0,{Expired:"expired",Failed:"failed",ClientMismatch:"client_mismatch"},"w",0,function(a){return{code:a?.code||"",message:a?.message||"",long_message:a?.longMessage,meta:{param_name:a?.meta?.paramName,session_id:a?.meta?.sessionId,email_addresses:a?.meta?.emailAddresses,identifiers:a?.meta?.identifiers,zxcvbn:a?.meta?.zxcvbn,plan:a?.meta?.plan,is_plan_upgrade_possible:a?.meta?.isPlanUpgradePossible}}},"x",0,g,"y",0,function({packageName:a,customMessages:b}){let c=a;function d(a,b){if(!b)return`${c}: ${a}`;let d=a;for(let c of a.matchAll(/{{([a-zA-Z0-9-_]+)}}/g)){let a=(b[c[1]]||"").toString();d=d.replace(`{{${c[1]}}}`,a)}return`${c}: ${d}`}let e={...i,...b};return{setPackageName({packageName:a}){return"string"==typeof a&&(c=a),this},setMessages({customMessages:a}){return Object.assign(e,a||{}),this},throwInvalidPublishableKeyError(a){throw Error(d(e.InvalidPublishableKeyErrorMessage,a))},throwInvalidProxyUrl(a){throw Error(d(e.InvalidProxyUrlErrorMessage,a))},throwMissingPublishableKeyError(){throw Error(d(e.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw Error(d(e.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(a){throw Error(d(e.MissingClerkProvider,a))},throw(a){throw Error(d(a))}}}])},53515,94674,81281,a=>{"use strict";let b="reverification-error";a.s(["n",0,a=>({clerk_error:{type:"forbidden",reason:b,metadata:{reverification:a}}}),"t",0,a=>a&&"object"==typeof a&&"clerk_error"in a&&a.clerk_error?.type==="forbidden"&&a.clerk_error?.reason===b],53515);let c={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},d=new Set(["first_factor","second_factor","multi_factor"]),e=new Set(["strict_mfa","strict","moderate","lax"]),f=new Set(["o","org","organization"]),g=new Set(["u","user"]),h=(a,b)=>{let{org:c,user:d}=i(a),[e,h]=b.split(":"),j=void 0!==h,k=h||e;if(j&&!f.has(e)&&!g.has(e))throw Error(`Invalid scope: ${e}`);if(j){if(f.has(e))return c.includes(k);if(g.has(e))return d.includes(k)}return[...c,...d].includes(k)},i=a=>{let b=[],c=[];if(!a)return{org:b,user:c};let d=a.split(",");for(let a=0;a<d.length;a++){let e=d[a].trim(),f=e.indexOf(":");if(-1===f)throw Error(`Invalid claim element (missing colon): ${e}`);let g=e.slice(0,f),h=e.slice(f+1);"o"===g?b.push(h):"u"===g?c.push(h):("ou"===g||"uo"===g)&&(b.push(h),c.push(h))}return{org:b,user:c}},j=a=>{let b,f;if(!a)return!1;let g="string"==typeof a&&e.has(a),h="object"==typeof a&&(b=a.level,d.has(b))&&"number"==typeof(f=a.afterMinutes)&&f>0;return(!!g||!!h)&&(a=>"string"==typeof a?c[a]:a).bind(null,a)};a.s(["i",0,j,"n",0,({authObject:{sessionId:a,sessionStatus:b,userId:c,actor:d,orgId:e,orgRole:f,orgSlug:g,signOut:h,getToken:i,has:j,sessionClaims:k},options:{treatPendingAsSignedOut:l=!0}})=>void 0===a&&void 0===c?{actor:void 0,getToken:i,has:()=>!1,isLoaded:!1,isSignedIn:void 0,orgId:void 0,orgRole:void 0,orgSlug:void 0,sessionClaims:void 0,sessionId:a,signOut:h,userId:c}:null===a&&null===c?{actor:null,getToken:i,has:()=>!1,isLoaded:!0,isSignedIn:!1,orgId:null,orgRole:null,orgSlug:null,sessionClaims:null,sessionId:a,signOut:h,userId:c}:l&&"pending"===b?{actor:null,getToken:i,has:()=>!1,isLoaded:!0,isSignedIn:!1,orgId:null,orgRole:null,orgSlug:null,sessionClaims:null,sessionId:null,signOut:h,userId:null}:a&&k&&c&&e&&f?{actor:d||null,getToken:i,has:j,isLoaded:!0,isSignedIn:!0,orgId:e,orgRole:f,orgSlug:g||null,sessionClaims:k,sessionId:a,signOut:h,userId:c}:a&&k&&c&&!e?{actor:d||null,getToken:i,has:j,isLoaded:!0,isSignedIn:!0,orgId:null,orgRole:null,orgSlug:null,sessionClaims:k,sessionId:a,signOut:h,userId:c}:void 0,"t",0,a=>b=>{if(!a.userId)return!1;let c=((a,b)=>{let{features:c,plans:d}=b;return a.feature&&c?h(c,a.feature):a.plan&&d?h(d,a.plan):null})(b,a),d=((a,b)=>{let{orgId:c,orgRole:d,orgPermissions:e}=b;return(a.role||a.permission)&&c&&d&&e?a.permission?e.includes(a.permission.replace(/^(org:)*/,"org:")):a.role?d.replace(/^(org:)*/,"org:")===a.role.replace(/^(org:)*/,"org:"):null:null})(b,a),e=((a,{factorVerificationAge:b})=>{if(!a.reverification||!b)return null;let c=j(a.reverification);if(!c)return null;let{level:d,afterMinutes:e}=c(),[f,g]=b,h=-1!==f?e>f:null,i=-1!==g?e>g:null;switch(d){case"first_factor":return h;case"second_factor":return -1!==g?i:h;case"multi_factor":return -1===g?h:h&&i}})(b,a);return[c||d,e].some(a=>null===a)?[c||d,e].some(a=>!0===a):[c||d,e].every(a=>!0===a)}],94674);let k=a=>{let b=a.userId,c=a.user,d=a.sessionId,e=a.sessionStatus,f=a.sessionClaims;return{userId:b,user:c,sessionId:d,session:a.session,sessionStatus:e,sessionClaims:f,organization:a.organization,orgId:a.orgId,orgRole:a.orgRole,orgPermissions:a.orgPermissions,orgSlug:a.orgSlug,actor:a.actor,factorVerificationAge:a.factorVerificationAge}};a.s(["n",0,k,"r",0,(a,b,c)=>{var d;let e,f,g,h,i,j,l,m,n,o,p,q,r;return!a&&c?k(c):(e=(d=b).user?d.user.id:d.user,f=d.user,g=d.session?d.session.id:d.session,h=d.session,i=d.session?.status,j=d.session?d.session.lastActiveToken?.jwt?.claims:null,l=d.session?d.session.factorVerificationAge:null,m=h?.actor,n=d.organization,o=d.organization?d.organization.id:d.organization,p=n?.slug,r=(q=n?f?.organizationMemberships?.find(a=>a.organization.id===o):n)?q.permissions:q,{userId:e,user:f,sessionId:g,session:h,sessionStatus:i,sessionClaims:j,organization:n,orgId:o,orgRole:q?q.role:q,orgSlug:p,orgPermissions:r,actor:m,factorVerificationAge:l})}],81281)},98003,16545,a=>{"use strict";let b,c,d,e,f,g,h,i,j;var k,l=a.i(53515),m=a.i(94674),n=a.i(81281),o=a.i(16841),p=a.i(2220),q=a.i(5773),r=a.i(50905),s=class{#a;#b=864e5;constructor(a){this.#a=a}isEventThrottled(a){let b=Date.now(),c=this.#c(a),d=this.#a.getItem(c);return!!d&&!(b-d>this.#b)||(this.#a.setItem(c,b),!1)}#c(a){let{sk:b,pk:c,payload:d,...e}=a,f={...d,...e};return JSON.stringify(Object.keys({...d,...e}).sort().map(a=>f[a]))}},t=class{#d="clerk_telemetry_throttler";getItem(a){return this.#e()[a]}setItem(a,b){try{let c=this.#e();c[a]=b,localStorage.setItem(this.#d,JSON.stringify(c))}catch(a){a instanceof DOMException&&("QuotaExceededError"===a.name||"NS_ERROR_DOM_QUOTA_REACHED"===a.name)&&localStorage.length>0&&localStorage.removeItem(this.#d)}}removeItem(a){try{let b=this.#e();delete b[a],localStorage.setItem(this.#d,JSON.stringify(b))}catch{}}#e(){try{let a=localStorage.getItem(this.#d);if(!a)return{};return JSON.parse(a)}catch{return{}}}static isSupported(){return!1}},u=class{#a=new Map;#f=1e4;getItem(a){return this.#a.size>this.#f?void this.#a.clear():this.#a.get(a)}setItem(a,b){this.#a.set(a,b)}removeItem(a){this.#a.delete(a)}};let v=new Set(["error","warn","info","debug","trace"]);var w=class{#g;#h;#i={};#j=[];#k=null;constructor(a){this.#g={maxBufferSize:a.maxBufferSize??5,samplingRate:a.samplingRate??1,perEventSampling:a.perEventSampling??!0,disabled:a.disabled??!1,debug:a.debug??!1,endpoint:"https://clerk-telemetry.com"},a.clerkVersion?this.#i.clerkVersion=a.clerkVersion??"":this.#i.clerkVersion="",this.#i.sdk=a.sdk,this.#i.sdkVersion=a.sdkVersion,this.#i.publishableKey=a.publishableKey??"";const b=(0,r.u)(a.publishableKey);b&&(this.#i.instanceType=b.instanceType),a.secretKey&&(this.#i.secretKey=a.secretKey.substring(0,16)),this.#h=new s(t.isSupported()?new t:new u)}get isEnabled(){return!("development"!==this.#i.instanceType||this.#g.disabled||"u">typeof process&&process.env&&(0,q.o)(process.env.CLERK_TELEMETRY_DISABLED))}get isDebug(){return this.#g.debug||"u">typeof process&&process.env&&(0,q.o)(process.env.CLERK_TELEMETRY_DEBUG)}record(a){try{let b=this.#l(a.event,a.payload);if(this.#m(b.event,b),!this.#n(b,a.eventSamplingRate))return;this.#j.push({kind:"event",value:b}),this.#o()}catch(a){console.error("[clerk/telemetry] Error recording telemetry event",a)}}recordLog(a){try{if(!this.#p(a))return;let b="string"==typeof a?.level&&v.has(a.level),c="string"==typeof a?.message&&a.message.trim().length>0,d=null,e=a?.timestamp;if("number"==typeof e||"string"==typeof e){let a=new Date(e);Number.isNaN(a.getTime())||(d=a)}if(!b||!c||null===d){this.isDebug&&"u">typeof console&&console.warn("[clerk/telemetry] Dropping invalid telemetry log entry",{levelIsValid:b,messageIsValid:c,timestampIsValid:null!==d});return}let f=this.#q(),g={sdk:f.name,sdkv:f.version,cv:this.#i.clerkVersion??"",lvl:a.level,msg:a.message,ts:d.toISOString(),pk:this.#i.publishableKey||null,payload:this.#r(a.context)};this.#j.push({kind:"log",value:g}),this.#o()}catch(a){console.error("[clerk/telemetry] Error recording telemetry log entry",a)}}#n(a,b){return this.isEnabled&&!this.isDebug&&this.#s(a,b)}#p(a){return!0}#s(a,b){let c=Math.random();return!!(c<=this.#g.samplingRate&&(!1===this.#g.perEventSampling||void 0===b||c<=b))&&!this.#h.isEventThrottled(a)}#o(){this.#t()}#t(){let a=[...this.#j];if(this.#j=[],this.#k=null,0===a.length)return;let b=a.filter(a=>"event"===a.kind).map(a=>a.value),c=a.filter(a=>"log"===a.kind).map(a=>a.value);b.length>0&&fetch(new URL("/v1/event",this.#g.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({events:b})}).catch(()=>void 0),c.length>0&&fetch(new URL("/v1/logs",this.#g.endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({logs:c})}).catch(()=>void 0)}#m(a,b){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",a),console.log(b),console.groupEnd()):console.log("[clerk/telemetry]",a,b))}#q(){return{name:this.#i.sdk,version:this.#i.sdkVersion}}#l(a,b){let c=this.#q();return{event:a,cv:this.#i.clerkVersion??"",it:this.#i.instanceType??"",sdk:c.name,sdkv:c.version,...this.#i.publishableKey?{pk:this.#i.publishableKey}:{},...this.#i.secretKey?{sk:this.#i.secretKey}:{},payload:b}}#r(a){if(null==a||"object"!=typeof a)return null;try{let b=JSON.parse(JSON.stringify(a));if(b&&"object"==typeof b&&!Array.isArray(b))return b;return null}catch{return null}}};let x="COMPONENT_MOUNTED",y=new Set(["SignIn","SignUp"]);function z(a){return y.has(a)?1:.1}function A(a){return function(b,c,d){return{event:a,eventSamplingRate:a===x?z(b):.1,payload:{component:b,appearanceProp:!!c?.appearance,theme:!!c?.appearance?.theme,elements:!!c?.appearance?.elements,variables:!!c?.appearance?.variables,...d}}}}function B(a,b){return{event:"METHOD_CALLED",eventSamplingRate:.1,payload:{method:a,...b}}}let C="THEME_USAGE";function D(a){return"string"==typeof a?a:"object"==typeof a&&null!==a&&"name"in a&&"string"==typeof a.name?a.name:void 0}a.s(["a",0,B,"c",0,function(a,b,c){return A("COMPONENT_OPENED")(a,b,c)},"i",0,function(a){return{event:"FRAMEWORK_METADATA",eventSamplingRate:.1,payload:a}},"l",0,w,"n",0,C,"o",0,function(a,b={}){return{event:x,eventSamplingRate:z(a),payload:{component:a,...b}}},"r",0,function(a){return{event:C,eventSamplingRate:1,payload:function(a){let b;if(!a||"object"!=typeof a)return{};let c=a.theme;if(!c)return{};if(Array.isArray(c))for(let a of c){let c=D(a);if(c){b=c;break}}else b=D(c);return{themeName:b}}(a)}},"s",0,function(a,b,c){return A(x)(a,b,c)},"t",0,1],16545);let E=(...a)=>{};var F=a.i(72131),G=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},H={setTimeout:(a,b)=>setTimeout(a,b),clearTimeout:a=>clearTimeout(a),setInterval:(a,b)=>setInterval(a,b),clearInterval:a=>clearInterval(a)},I=new class{#u=H;#v=!1;setTimeoutProvider(a){this.#u=a}setTimeout(a,b){return this.#u.setTimeout(a,b)}clearTimeout(a){this.#u.clearTimeout(a)}setInterval(a,b){return this.#u.setInterval(a,b)}clearInterval(a){this.#u.clearInterval(a)}};function J(){}function K(a,b){return"function"==typeof a?a(b):a}function L(a,b){return"function"==typeof a?a(b):a}var M=Object.prototype.hasOwnProperty;function N(a,b){if(!b||Object.keys(a).length!==Object.keys(b).length)return!1;for(let c in a)if(a[c]!==b[c])return!1;return!0}function O(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function P(a){if(!Q(a))return!1;let b=a.constructor;if(void 0===b)return!0;let c=b.prototype;return!!Q(c)&&!!c.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(a)===Object.prototype}function Q(a){return"[object Object]"===Object.prototype.toString.call(a)}function R(a,b,c){return"function"==typeof c.structuralSharing?c.structuralSharing(a,b):!1!==c.structuralSharing?function a(b,c){if(b===c)return b;let d=O(b)&&O(c);if(!d&&!(P(b)&&P(c)))return c;let e=(d?b:Object.keys(b)).length,f=d?c:Object.keys(c),g=f.length,h=d?Array(g):{},i=0;for(let j=0;j<g;j++){let g=d?j:f[j],k=b[g],l=c[g];if(k===l){h[g]=k,(d?j<e:M.call(b,g))&&i++;continue}if(null===k||null===l||"object"!=typeof k||"object"!=typeof l){h[g]=l;continue}let m=a(k,l);h[g]=m,m===k&&i++}return e===g&&i===e?b:h}(a,b):b}function S(a,b,c=0){let d=[...a,b];return c&&d.length>c?d.slice(1):d}function T(a,b,c=0){let d=[b,...a];return c&&d.length>c?d.slice(0,-1):d}var U=Symbol(),V=(new class extends G{#w;#x;#y;constructor(){super(),this.#y=a=>{}}onSubscribe(){this.#x||this.setEventListener(this.#y)}onUnsubscribe(){this.hasListeners()||(this.#x?.(),this.#x=void 0)}setEventListener(a){this.#y=a,this.#x?.(),this.#x=a(a=>{"boolean"==typeof a?this.setFocused(a):this.onFocus()})}setFocused(a){this.#w!==a&&(this.#w=a,this.onFocus())}onFocus(){let a=this.isFocused();this.listeners.forEach(b=>{b(a)})}isFocused(){return"boolean"==typeof this.#w?this.#w:globalThis.document?.visibilityState!=="hidden"}},b=[],c=0,d=a=>{a()},e=a=>{a()},f=function(a){setTimeout(a,0)},{batch:a=>{let g;c++;try{g=a()}finally{let a;--c||(a=b,b=[],a.length&&f(()=>{e(()=>{a.forEach(a=>{d(a)})})}))}return g},batchCalls:a=>(...b)=>{g(()=>{a(...b)})},schedule:g=a=>{c?b.push(a):f(()=>{d(a)})},setNotifyFunction:a=>{d=a},setBatchNotifyFunction:a=>{e=a},setScheduler:a=>{f=a}}),W=new class extends G{#z=!0;#x;#y;constructor(){super(),this.#y=a=>{}}onSubscribe(){this.#x||this.setEventListener(this.#y)}onUnsubscribe(){this.hasListeners()||(this.#x?.(),this.#x=void 0)}setEventListener(a){this.#y=a,this.#x?.(),this.#x=a(this.setOnline.bind(this))}setOnline(a){this.#z!==a&&(this.#z=a,this.listeners.forEach(b=>{b(a)}))}isOnline(){return this.#z}};function X(){let a,b,c=new Promise((c,d)=>{a=c,b=d});function d(a){Object.assign(c,a),delete c.resolve,delete c.reject}return c.status="pending",c.catch(()=>{}),c.resolve=b=>{d({status:"fulfilled",value:b}),a(b)},c.reject=a=>{d({status:"rejected",reason:a}),b(a)},c}var Y=class extends G{constructor(a,b){super(),this.options=b,this.#A=a,this.#B=null,this.#C=X(),this.bindMethods(),this.setOptions(b)}#A;#D=void 0;#E=void 0;#F=void 0;#G;#H;#C;#B;#I;#J;#K;#L;#M;#N;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#D.addObserver(this),Z(this.#D,this.options)?this.#P():this.updateResult(),this.#Q())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $(this.#D,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $(this.#D,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#R(),this.#S(),this.#D.removeObserver(this)}setOptions(a){let b=this.options,c=this.#D;if(this.options=this.#A.defaultQueryOptions(a),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof L(this.options.enabled,this.#D))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#T(),this.#D.setOptions(this.options),b._defaulted&&!N(this.options,b)&&this.#A.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#D,observer:this});let d=this.hasListeners();d&&_(this.#D,c,this.options,b)&&this.#P(),this.updateResult(),d&&(this.#D!==c||L(this.options.enabled,this.#D)!==L(b.enabled,this.#D)||K(this.options.staleTime,this.#D)!==K(b.staleTime,this.#D))&&this.#U();let e=this.#V();d&&(this.#D!==c||L(this.options.enabled,this.#D)!==L(b.enabled,this.#D)||e!==this.#N)&&this.#W(e)}getOptimisticResult(a){var b,c;let d=this.#A.getQueryCache().build(this.#A,a),e=this.createResult(d,a);return b=this,c=e,N(b.getCurrentResult(),c)||(this.#F=e,this.#H=this.options,this.#G=this.#D.state),e}getCurrentResult(){return this.#F}trackResult(a,b){return new Proxy(a,{get:(a,c)=>(this.trackProp(c),b?.(c),"promise"===c&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#C.status||this.#C.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,c))})}trackProp(a){this.#O.add(a)}getCurrentQuery(){return this.#D}refetch({...a}={}){return this.fetch({...a})}fetchOptimistic(a){let b=this.#A.defaultQueryOptions(a),c=this.#A.getQueryCache().build(this.#A,b);return c.fetch().then(()=>this.createResult(c,b))}fetch(a){return this.#P({...a,cancelRefetch:a.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#F))}#P(a){this.#T();let b=this.#D.fetch(this.options,a);return a?.throwOnError||(b=b.catch(J)),b}#U(){this.#R(),K(this.options.staleTime,this.#D)}#V(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#D):this.options.refetchInterval)??!1}#W(a){this.#S(),this.#N=a}#Q(){this.#U(),this.#W(this.#V())}#R(){this.#L&&(I.clearTimeout(this.#L),this.#L=void 0)}#S(){this.#M&&(I.clearInterval(this.#M),this.#M=void 0)}createResult(a,b){let c,d=this.#D,e=this.options,f=this.#F,g=this.#G,h=this.#H,i=a!==d?a.state:this.#E,{state:j}=a,k={...j},l=!1;if(b._optimisticResults){var m;let c=this.hasListeners(),f=!c&&Z(a,b),g=c&&_(a,d,b,e);(f||g)&&(k={...k,...(m=j.data,{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(a.options.networkMode??"online")!=="online"||W.isOnline()?"fetching":"paused",...void 0===m&&{error:null,status:"pending"}})}),"isRestoring"===b._optimisticResults&&(k.fetchStatus="idle")}let{error:n,errorUpdatedAt:o,status:p}=k;c=k.data;let q=!1;if(void 0!==b.placeholderData&&void 0===c&&"pending"===p){let a;f?.isPlaceholderData&&b.placeholderData===h?.placeholderData?(a=f.data,q=!0):a="function"==typeof b.placeholderData?b.placeholderData(this.#K?.state.data,this.#K):b.placeholderData,void 0!==a&&(p="success",c=R(f?.data,a,b),l=!0)}if(b.select&&void 0!==c&&!q)if(f&&c===g?.data&&b.select===this.#I)c=this.#J;else try{this.#I=b.select,c=b.select(c),c=R(f?.data,c,b),this.#J=c,this.#B=null}catch(a){this.#B=a}this.#B&&(n=this.#B,c=this.#J,o=Date.now(),p="error");let r="fetching"===k.fetchStatus,s="pending"===p,t="error"===p,u=s&&r,v=void 0!==c,w={status:p,fetchStatus:k.fetchStatus,isPending:s,isSuccess:"success"===p,isError:t,isInitialLoading:u,isLoading:u,data:c,dataUpdatedAt:k.dataUpdatedAt,error:n,errorUpdatedAt:o,failureCount:k.fetchFailureCount,failureReason:k.fetchFailureReason,errorUpdateCount:k.errorUpdateCount,isFetched:k.dataUpdateCount>0||k.errorUpdateCount>0,isFetchedAfterMount:k.dataUpdateCount>i.dataUpdateCount||k.errorUpdateCount>i.errorUpdateCount,isFetching:r,isRefetching:r&&!s,isLoadingError:t&&!v,isPaused:"paused"===k.fetchStatus,isPlaceholderData:l,isRefetchError:t&&v,isStale:aa(a,b),refetch:this.refetch,promise:this.#C,isEnabled:!1!==L(b.enabled,a)};if(this.options.experimental_prefetchInRender){let b=a=>{"error"===w.status?a.reject(w.error):void 0!==w.data&&a.resolve(w.data)},c=()=>{b(this.#C=w.promise=X())},e=this.#C;switch(e.status){case"pending":a.queryHash===d.queryHash&&b(e);break;case"fulfilled":("error"===w.status||w.data!==e.value)&&c();break;case"rejected":("error"!==w.status||w.error!==e.reason)&&c()}}return w}updateResult(){let a=this.#F,b=this.createResult(this.#D,this.options);if(this.#G=this.#D.state,this.#H=this.options,void 0!==this.#G.data&&(this.#K=this.#D),N(b,a))return;this.#F=b;let c=()=>{if(!a)return!0;let{notifyOnChangeProps:b}=this.options,c="function"==typeof b?b():b;if("all"===c||!c&&!this.#O.size)return!0;let d=new Set(c??this.#O);return this.options.throwOnError&&d.add("error"),Object.keys(this.#F).some(b=>this.#F[b]!==a[b]&&d.has(b))};this.#X({listeners:c()})}#T(){let a=this.#A.getQueryCache().build(this.#A,this.options);if(a===this.#D)return;let b=this.#D;this.#D=a,this.#E=a.state,this.hasListeners()&&(b?.removeObserver(this),a.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#Q()}#X(a){V.batch(()=>{a.listeners&&this.listeners.forEach(a=>{a(this.#F)}),this.#A.getQueryCache().notify({query:this.#D,type:"observerResultsUpdated"})})}};function Z(a,b){return!1!==L(b.enabled,a)&&void 0===a.state.data&&("error"!==a.state.status||!1!==b.retryOnMount)||void 0!==a.state.data&&$(a,b,b.refetchOnMount)}function $(a,b,c){if(!1!==L(b.enabled,a)&&"static"!==K(b.staleTime,a)){let d="function"==typeof c?c(a):c;return"always"===d||!1!==d&&aa(a,b)}return!1}function _(a,b,c,d){return(a!==b||!1===L(d.enabled,a))&&(!c.suspense||"error"!==a.state.status)&&aa(a,c)}function aa(a,b){return!1!==L(b.enabled,a)&&a.isStaleByTime(K(b.staleTime,a))}function ab(a){return{onFetch:(b,c)=>{let d=b.options,e=b.fetchOptions?.meta?.fetchMore?.direction,f=b.state.data?.pages||[],g=b.state.data?.pageParams||[],h={pages:[],pageParams:[]},i=0,j=async()=>{var c,j;let k=!1,l=(c=b.options,j=b.fetchOptions,!c.queryFn&&j?.initialPromise?()=>j.initialPromise:c.queryFn&&c.queryFn!==U?c.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${c.queryHash}'`))),m=async(a,c,d)=>{if(k)return Promise.reject();if(null==c&&a.pages.length)return Promise.resolve(a);let e=(()=>{var a,e;let f,g,h={client:b.client,queryKey:b.queryKey,pageParam:c,direction:d?"backward":"forward",meta:b.options.meta};return a=()=>b.signal,e=()=>k=!0,g=!1,Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(f??=a(),g||(g=!0,f.aborted?e():f.addEventListener("abort",e,{once:!0})),f)}),h})(),f=await l(e),{maxPages:g}=b.options,h=d?T:S;return{pages:h(a.pages,f,g),pageParams:h(a.pageParams,c,g)}};if(e&&f.length){let a="backward"===e,b={pages:f,pageParams:g},c=(a?ad:ac)(d,b);h=await m(b,c,a)}else{let b=a??f.length;do{let a=0===i?g[0]??d.initialPageParam:ac(d,h);if(i>0&&null==a)break;h=await m(h,a),i++}while(i<b)}return h};b.options.persister?b.fetchFn=()=>b.options.persister?.(j,{client:b.client,queryKey:b.queryKey,meta:b.options.meta,signal:b.signal},c):b.fetchFn=j}}}function ac(a,{pages:b,pageParams:c}){let d=b.length-1;return b.length>0?a.getNextPageParam(b[d],b,c[d],c):void 0}function ad(a,{pages:b,pageParams:c}){return b.length>0?a.getPreviousPageParam?.(b[0],b,c[0],c):void 0}var ae=class extends Y{constructor(a,b){super(a,b)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(a){super.setOptions({...a,behavior:ab()})}getOptimisticResult(a){return a.behavior=ab(),super.getOptimisticResult(a)}fetchNextPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"backward"}}})}createResult(a,b){var c,d;let{state:e}=a,f=super.createResult(a,b),{isFetching:g,isRefetching:h,isError:i,isRefetchError:j}=f,k=e.fetchMeta?.fetchMore?.direction,l=i&&"forward"===k,m=g&&"forward"===k,n=i&&"backward"===k,o=g&&"backward"===k;return{...f,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:!!(c=e.data)&&null!=ac(b,c),hasPreviousPage:!!(d=e.data)&&!!b.getPreviousPageParam&&null!=ad(b,d),isFetchNextPageError:l,isFetchingNextPage:m,isFetchPreviousPageError:n,isFetchingPreviousPage:o,isRefetchError:j&&!l&&!n,isRefetching:h&&!m&&!o}}},af=Object.prototype.hasOwnProperty;function ag(a,b,c){for(c of a.keys())if(ah(c,b))return c}function ah(a,b){var c,d,e;if(a===b)return!0;if(a&&b&&(c=a.constructor)===b.constructor){if(c===Date)return a.getTime()===b.getTime();if(c===RegExp)return a.toString()===b.toString();if(c===Array){if((d=a.length)===b.length)for(;d--&&ah(a[d],b[d]););return -1===d}if(c===Set){if(a.size!==b.size)return!1;for(d of a)if((e=d)&&"object"==typeof e&&!(e=ag(b,e))||!b.has(e))return!1;return!0}if(c===Map){if(a.size!==b.size)return!1;for(d of a)if((e=d[0])&&"object"==typeof e&&!(e=ag(b,e))||!ah(d[1],b.get(e)))return!1;return!0}if(c===ArrayBuffer)a=new Uint8Array(a),b=new Uint8Array(b);else if(c===DataView){if((d=a.byteLength)===b.byteLength)for(;d--&&a.getInt8(d)===b.getInt8(d););return -1===d}if(ArrayBuffer.isView(a)){if((d=a.byteLength)===b.byteLength)for(;d--&&a[d]===b[d];);return -1===d}if(!c||"object"==typeof a){for(c in d=0,a)if(af.call(a,c)&&++d&&!af.call(b,c)||!(c in b)||!ah(a[c],b[c]))return!1;return Object.keys(b).length===d}}return a!=a&&b!=b}function ai(a,b){if(!a)throw"string"==typeof b?Error(b):Error(`${b.displayName} not found`)}let aj=(a,b)=>{let{assertCtxFn:c=ai}=b||{},d=F.default.createContext(void 0);return d.displayName=a,[d,()=>{let b=F.default.useContext(d);return c(b,`${a} not found`),b.value},()=>{let a=F.default.useContext(d);return a?a.value:{}}]},[ak,al]=aj("ClerkInstanceContext"),[am,an]=aj("InitialStateContext");function ao({children:a,initialState:b}){let[c]=(0,F.useState)(b),d=F.default.useMemo(()=>({value:c}),[c]);return F.default.createElement(am.Provider,{value:d},a)}function ap(){let a=an();if(a instanceof Promise)if("use"in F.default&&"function"==typeof F.default.use)return F.default.use(a);else throw Error("initialState cannot be a promise if React version is less than 19");return a}F.default.createContext({});let[aq,ar]=aj("CheckoutContext"),as=({children:a,...b})=>F.default.createElement(aq.Provider,{value:{value:b}},a);function at(a){if(!F.default.useContext(ak)){if("function"==typeof a)return void a();throw Error(`${a} can only be used within the <ClerkProvider /> component.

Possible fixes:
1. Ensure that the <ClerkProvider /> is correctly wrapping your application where this component is used.
2. Check for multiple versions of the \`@clerk/shared\` package in your project. Use a tool like \`npm ls @clerk/shared\` to identify multiple versions, and update your dependencies to only rely on one.

Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}function au(a){return{queryKey:[a.stablePrefix,a.authenticated,a.tracked,a.untracked],invalidationKey:[a.stablePrefix,a.authenticated,a.tracked],stableKey:a.stablePrefix,authenticated:a.authenticated}}function av(a){if(a)return function(a){return a}}let aw=h=new Proxy(function(){},{get(a,b){if("then"!==b)return"toString"===b?()=>"[ClerkMockQueryClient]":b===Symbol.toPrimitive?()=>0:h},apply:()=>h,construct:()=>h,has:()=>!1,set:()=>!1}),ax=()=>{let a=al(),b=a.__internal_queryClient,[,c]=(0,F.useState)("object"==typeof b&&"__tag"in b&&"clerk-rq-client"===b.__tag);(0,F.useEffect)(()=>{let b=()=>c(!0);return a.on("queryClientStatus",b),()=>{a.off("queryClientStatus",b)}},[a,c]);let d="object"==typeof b&&"__tag"in b&&"clerk-rq-client"===b.__tag;return[b?.client||aw,d]};function ay(a,b){let[c,d]=ax(),e=d?c.defaultQueryOptions(a):a;e._optimisticResults="optimistic";let f=F.useMemo(()=>new b(c,e),[c]),g=f.getOptimisticResult(e),h=!1!==a.subscribed;return(F.useSyncExternalStore(F.useCallback(a=>{let b=h?f.subscribe(V.batchCalls(a)):J;return f.updateResult(),b},[f,h]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),F.useEffect(()=>{f.setOptions(e)},[e,f]),d)?e.notifyOnChangeProps?g:f.trackResult(g):{data:void 0,error:null,isLoading:!1,isFetching:!1,status:"pending"}}function az(a){var b;let c,d,{isSignedOut:e,stableKeys:f,authenticated:g=!0,onCleanup:h}=a,i=(0,F.useRef)(f),[j]=ax(),k=(b=!e,c=(0,F.useRef)(b),d=(0,F.useRef)(null),c.current!==b&&(d.current=c.current,c.current=b),d.current);(0,F.useEffect)(()=>{!0===g&&k&&!0===e&&(j.removeQueries({predicate:a=>{let[b,c]=a.queryKey;return!0===c&&"string"==typeof b&&(Array.isArray(i.current)?i.current.includes(b):i.current===b)}}),h?.())},[g,e,k,j])}let aA=(a,b)=>{let c="boolean"==typeof a&&a,d=(0,F.useRef)(c?b.initialPage:a?.initialPage??b.initialPage),e=(0,F.useRef)(c?b.pageSize:a?.pageSize??b.pageSize),f={};for(let d of Object.keys(b))f[d]=c?b[d]:a?.[d]??b[d];return{...f,initialPage:d.current,pageSize:e.current}},aB=a=>{let b,{fetcher:c,config:d,keys:e}=a,[f,g]=(0,F.useState)(d.initialPage??1),h=(0,F.useRef)(d.initialPage??1),i=(0,F.useRef)(d.pageSize??10),j=d.enabled??!0,k=d.isSignedIn,l=d.infinite??!1,m="cache"===d.__experimental_mode,n=d.keepPreviousData??!1,[o]=ax(),p=j&&!!c&&!m&&!1!==k,[q,r]=(0,F.useState)(0),s=(0,F.useCallback)(a=>{r(a)},[]),t=(0,F.useMemo)(()=>{let[a,b,c,d]=e.queryKey;return[a,b,c,{...d,args:{...d.args,initialPage:f,pageSize:i.current}}]},[e.queryKey,f]),u=ay({queryKey:t,queryFn:({queryKey:a})=>{let{args:b}=a[3];if(c)return c(b)},staleTime:6e4,enabled:p&&!l,placeholderData:av(n)},Y),v=(0,F.useMemo)(()=>{let[a,b,c,d]=e.queryKey;return[a+"-inf",b,c,d]},[e.queryKey]),w=ay({queryKey:v,initialPageParam:d.initialPage??1,getNextPageParam:(a,b,c)=>{let e=a?.total_count??0;return(b.length+(d.initialPage?d.initialPage-1:0))*(d.pageSize??10)<e?c+1:void 0},queryFn:({pageParam:a,queryKey:b})=>{let{args:d}=b[3];if(c)return c({...d,initialPage:a,pageSize:i.current})},staleTime:6e4,enabled:p&&l},ae);az({isSignedOut:!1===k,authenticated:e.authenticated,stableKeys:[b=e.stableKey,`${b}-inf`],onCleanup:()=>{g(h.current),Promise.resolve().then(()=>s(a=>a+1))}});let{data:x,count:y,page:z}=(0,F.useMemo)(()=>{if(l){let a=o.getQueryData(v),b=p?w.data?.pages??a?.pages??[]:a?.pages??[],c=Array.isArray(b)?b.filter(Boolean):[];return{data:c.map(a=>a?.data).flat().filter(Boolean)??[],count:c[c.length-1]?.total_count??0,page:c.length>0?c.length:h.current}}let a=p?u.data??o.getQueryData(t):o.getQueryData(t);return{data:Array.isArray(a?.data)?a.data:[],count:"number"==typeof a?.total_count?a.total_count:0,page:f}},[p,q,l,w.data?.pages,u.data,o,v,t,f]),A=(0,F.useCallback)(a=>{if(l){let b=Math.max(0,"function"==typeof a?a(z):a),c=o.getQueryData(v);b-(w.data?.pages??c?.pages??[]).length>0&&w.fetchNextPage({cancelRefetch:!1});return}return g(a)},[w,z,l,o,v]),B=l?w.isLoading:u.isLoading,C=l?w.isFetching:u.isFetching,D=(l?w.error:u.error)??null,E=(0,F.useCallback)(()=>{l?w.fetchNextPage({cancelRefetch:!1}):g(a=>Math.max(0,a+1))},[w,l]),G=(0,F.useCallback)(()=>{l||g(a=>Math.max(0,a-1))},[l]),H=(h.current-1)*i.current,I=Math.ceil((y-H)/i.current),J=l?!!w.hasNextPage:y-H>z*i.current,K=l?!!w.hasPreviousPage:(z-1)*i.current>H;return{data:x,count:y,error:D,isLoading:B,isFetching:C,isError:!!D,page:z,pageCount:I,fetchPage:A,fetchNext:E,fetchPrevious:G,hasNextPage:J,hasPreviousPage:K,revalidate:async()=>{await o.invalidateQueries({queryKey:e.invalidationKey});let[a,...b]=e.invalidationKey;return o.invalidateQueries({queryKey:[a+"-inf",...b]})},setData:a=>(l?(o.setQueryData(v,(b={})=>{let c=Array.isArray(b?.pages)?b.pages:[],d="function"==typeof a?a(c):a;return{...b,pages:d}}),s(a=>a+1)):(o.setQueryData(t,(b={data:[],total_count:0})=>"function"==typeof a?a(b):a),s(a=>a+1)),Promise.resolve())}};function aC(){let a=al(),b=ap(),c=(0,F.useCallback)(()=>b?.organization,[b?.organization]);return(0,F.useSyncExternalStore)((0,F.useCallback)(b=>a.addListener(b,{skipInitialEmit:!0}),[a]),(0,F.useCallback)(()=>a.loaded&&a.__internal_lastEmittedResources?a.__internal_lastEmittedResources.organization:c(),[a,c]),c)}function aD(){let a=al(),b=ap(),c=(0,F.useCallback)(()=>b?(0,n.n)(b)?.session:void 0,[b]);return(0,F.useSyncExternalStore)((0,F.useCallback)(b=>a.addListener(b,{skipInitialEmit:!0}),[a]),(0,F.useCallback)(()=>a.loaded&&a.__internal_lastEmittedResources?a.__internal_lastEmittedResources.session:c(),[a,c]),c)}let aE=()=>(at("useClerk"),al());function aF(a){let b=aE(),c=(0,F.useRef)(!1);(0,F.useEffect)(()=>{c.current||(c.current=!0,b.__internal_attemptToEnableEnvironmentSetting?.({for:"organizations",caller:a}))},[b,a])}let aG={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0};function aH(){let a=al(),b=ap(),c=(0,F.useCallback)(()=>b?.user,[b?.user]);return(0,F.useSyncExternalStore)((0,F.useCallback)(b=>a.addListener(b,{skipInitialEmit:!0}),[a]),(0,F.useCallback)(()=>a.loaded&&a.__internal_lastEmittedResources?a.__internal_lastEmittedResources.user:c(),[a,c]),c)}let aI="useOrganizationCreationDefaults",aJ={data:void 0,count:void 0,error:void 0,isLoading:!1,isFetching:!1,isError:!1,page:void 0,pageCount:void 0,fetchPage:void 0,fetchNext:void 0,fetchPrevious:void 0,hasNextPage:!1,hasPreviousPage:!1,revalidate:void 0,setData:void 0},aK=F.default.useEffect,aL="useSession",aM,aN=()=>aM,aO="useSessionList",aP="useUser";function aQ(){at(aP);let a=aH();return(al().telemetry?.record(B(aP)),void 0===a)?{isLoaded:!1,isSignedIn:void 0,user:void 0}:null===a?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:a}}async function aR(a){try{let b=await a;if(b instanceof Response)return b.json();return b}catch(a){if((0,p.C)(a)&&a.errors.find(({code:a})=>"session_reverification_required"===a))return(0,l.n)();throw a}}function aS(a){let b=al(),c=a?.enabled??!0,d=b.__internal_environment,e=aH(),f=aC(),g=d?.commerceSettings.billing.user.enabled,h=d?.commerceSettings.billing.organization.enabled,i=a?.for==="organization"?h:a?.for==="user"?g:g||h,j=a?.for==="organization",k=!(a?.authenticated??!0)||(!j||!!f?.id)&&!!e?.id;return i&&c&&b.loaded&&k}function aT({hookName:a,resourceType:b,useFetcher:c,options:d}){return function(e){let{for:f,enabled:g,...h}=e||{},i=f||"user";at(a);let j=c(i),k=aA(h,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1,__experimental_mode:void 0}),l=al(),m=aH(),n=aC();l.telemetry?.record(B(a));let o="organization"===i,p=aS({for:i,enabled:g,authenticated:!d?.unauthenticated}),q=void 0===h?void 0:{initialPage:k.initialPage,pageSize:k.pageSize,...d?.unauthenticated?{}:o?{orgId:n?.id}:{}},r=!!q&&l.loaded&&!!p;return aB({fetcher:j,config:{keepPreviousData:k.keepPreviousData,infinite:k.infinite,enabled:r,...d?.unauthenticated?{}:{isSignedIn:null!==m},__experimental_mode:k.__experimental_mode,initialPage:k.initialPage,pageSize:k.pageSize},keys:au({stablePrefix:b,authenticated:!d?.unauthenticated,tracked:d?.unauthenticated?{for:i}:{userId:m?.id,...o?{orgId:n?.id}:{}},untracked:{args:q}})})}}aT({hookName:"useStatements",resourceType:"billing-statements",useFetcher:()=>{let a=al();if(a.loaded)return a.billing.getStatements}}),aT({hookName:"usePaymentAttempts",resourceType:"billing-payment-attempts",useFetcher:()=>{let a=al();if(a.loaded)return a.billing.getPaymentAttempts}}),aT({hookName:"usePaymentMethods",resourceType:"billing-payment-methods",useFetcher:a=>{let b=aC(),c=aH();return"organization"===a?b?.getPaymentMethods:c?.getPaymentMethods}}),aT({hookName:"usePlans",resourceType:"billing-plans",useFetcher:a=>{let b=al();if(b.loaded)return c=>b.billing.getPlans({...c,for:a})},options:{unauthenticated:!0}});let aU=a=>{let b=(0,F.useRef)(a);return(0,F.useEffect)(()=>{b.current=a},[a]),b.current},aV=(a,b,c)=>{let d=!!c,e=(0,F.useRef)(c);(0,F.useEffect)(()=>{e.current=c},[c]),(0,F.useEffect)(()=>{if(!d||!a)return()=>{};let c=(...a)=>{e.current&&e.current(...a)};return a.on(b,c),()=>{a.off(b,c)}},[d,b,a,e])},aW=F.default.createContext(null);aW.displayName="ElementsContext";let aX=(a,b)=>{if(!a)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${b} in an <Elements> provider.`);return a},aY=({stripe:a,options:b,children:c})=>{let d=F.default.useMemo(()=>a_(a),[a]),[e,f]=F.default.useState(()=>({stripe:"sync"===d.tag?d.stripe:null,elements:"sync"===d.tag?d.stripe.elements(b):null}));F.default.useEffect(()=>{let a=!0,c=a=>{f(c=>c.stripe?c:{stripe:a,elements:a.elements(b)})};return"async"!==d.tag||e.stripe?"sync"!==d.tag||e.stripe||c(d.stripe):d.stripePromise.then(b=>{b&&a&&c(b)}),()=>{a=!1}},[d,e,b]);let g=aU(a);F.default.useEffect(()=>{null!==g&&g!==a&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[g,a]);let h=aU(b);return F.default.useEffect(()=>{if(!e.elements)return;let a=a3(b,h,["clientSecret","fonts"]);a&&e.elements.update(a)},[b,h,e.elements]),F.default.createElement(aW.Provider,{value:e},c)},aZ="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",a$=(a,b=aZ)=>{if(null===a||a2(a))return a;throw Error(b)},a_=(a,b=aZ)=>{if(a1(a))return{tag:"async",stripePromise:Promise.resolve(a).then(a=>a$(a,b))};let c=a$(a,b);return null===c?{tag:"empty"}:{tag:"sync",stripe:c}},a0=a=>null!==a&&"object"==typeof a,a1=a=>a0(a)&&"function"==typeof a.then,a2=a=>a0(a)&&"function"==typeof a.elements&&"function"==typeof a.createToken&&"function"==typeof a.createPaymentMethod&&"function"==typeof a.confirmCardPayment,a3=(a,b,c)=>a0(a)?Object.keys(a).reduce((d,e)=>{let f=!a0(b)||!a5(a[e],b[e]);return c.includes(e)?(f&&console.warn(`Unsupported prop change: options.${e} is not a mutable property.`),d):f?{...d||{},[e]:a[e]}:d},null):null,a4="[object Object]",a5=(a,b)=>{if(!a0(a)||!a0(b))return a===b;let c=Array.isArray(a);if(c!==Array.isArray(b))return!1;let d=Object.prototype.toString.call(a)===a4;if(d!==(Object.prototype.toString.call(b)===a4))return!1;if(!d&&!c)return a===b;let e=Object.keys(a),f=Object.keys(b);if(e.length!==f.length)return!1;let g={};for(let a=0;a<e.length;a+=1)g[e[a]]=!0;for(let a=0;a<f.length;a+=1)g[f[a]]=!0;let h=Object.keys(g);return h.length===e.length&&h.every(c=>a5(a[c],b[c]))},a6=a=>aX(F.default.useContext(aW),a),a7=(k="payment",i=`${k.charAt(0).toUpperCase()+k.slice(1)}Element`,(j=a=>{a6(`mounts <${i}>`);let{id:b,className:c}=a;return F.default.createElement("div",{id:b,className:c})}).displayName=i,j.__elementType=k,j),[a8,a9]=aj("PaymentElementContext"),[ba,bb]=aj("StripeUtilsContext"),bc=({children:a})=>{let b=(()=>{let{stripe:a}=a6("calls useStripe()");return a})(),c=(()=>{let{elements:a}=aX(F.default.useContext(aW),"calls useElements()");return a})();return F.default.createElement(ba.Provider,{value:{value:{stripe:b,elements:c}}},a)},bd=({children:a})=>F.default.createElement(ba.Provider,{value:{value:{}}},a),be=({children:a,...b})=>{let c=((a="user")=>{let b,c=(b=aE(),ay({queryKey:["clerk-stripe-sdk"],queryFn:async()=>({loadStripe:await b.__internal_loadStripeJs()}),staleTime:1/0,refetchOnWindowFocus:!1,placeholderData:av(!0)},Y).data??null),d=aE().__internal_environment,{initializedPaymentMethod:e,initializePaymentMethod:f}=function(a){let{for:b}=a??{},c=aC(),d=aH(),e="organization"===b?c:d,f=aS(a),g="billing-payment-method-initialize",h=(0,F.useMemo)(()=>[g,!0,{resourceId:e?.id},{}],[e?.id]),i=!!e?.id&&f;az({isSignedOut:null===d,authenticated:!0,stableKeys:g});let j=ay({queryKey:h,queryFn:async()=>{if(e)return e.initializePaymentMethod({gateway:"stripe"})},enabled:i,staleTime:6e4,refetchOnWindowFocus:!1,placeholderData:av(i)},Y),[k]=ax(),l=(0,F.useCallback)(async()=>{if(!e)return;let a=await e.initializePaymentMethod({gateway:"stripe"});return k.setQueryData(h,a),a},[k,h,e]);return{initializedPaymentMethod:j.data??void 0,initializePaymentMethod:l}}({for:a}),g=d?.commerceSettings.billing.stripePublishableKey??void 0;return{stripe:function(a){let{stripeClerkLibs:b,externalGatewayId:c,stripePublishableKey:d}=a,e=(0,F.useMemo)(()=>["stripe-sdk",{externalGatewayId:c,stripePublishableKey:d}],[c,d]),f=aS({authenticated:!0});return ay({queryKey:e,queryFn:()=>b&&c&&d?b.loadStripe(d,{stripeAccount:c}):null,enabled:!!(b&&c&&d)&&f,staleTime:6e4,refetchOnWindowFocus:!1,placeholderData:av(!0)},Y).data}({stripeClerkLibs:c,externalGatewayId:e?.externalGatewayId,stripePublishableKey:g}),initializePaymentMethod:f,externalClientSecret:e?.externalClientSecret,paymentMethodOrder:e?.paymentMethodOrder}})(b.for),[d,e]=(0,F.useState)(!1);return F.default.createElement(a8.Provider,{value:{value:{...b,...c,setIsPaymentElementReady:e,isPaymentElementReady:d}}},a)},bf=a=>{let{stripe:b,externalClientSecret:c,stripeAppearance:d}=a9(),e=(()=>{let a=aE(),b="en";try{b=a.__internal_getOption("localization")?.locale||"en"}catch{}return b.split("-")[0]})();return b&&c?F.default.createElement(aY,{key:c,stripe:b,options:{loader:"never",clientSecret:c,appearance:{variables:d},locale:e}},F.default.createElement(bc,null,a.children)):F.default.createElement(bd,null,a.children)},bg=()=>{throw Error("Clerk: Unable to submit, Stripe libraries are not yet loaded. Be sure to check `isFormReady` before calling `submit`.")},[bh,,bi]=aj("PortalProvider"),bj=({children:a,getContainer:b})=>{let c=F.default.useMemo(()=>({value:{getContainer:b}}),[b]);return F.default.createElement(bh.Provider,{value:c},a)};bj.displayName="UNSAFE_PortalProvider",a.s(["ClerkContextProvider",0,function(a){let b=a.clerk;if(b||function(){throw Error("ClerkJS: Clerk instance not found. Make sure Clerk is initialized before using any Clerk components.")}(),a.initialState instanceof Promise&&!("use"in F.default&&"function"==typeof F.default.use))throw Error("initialState cannot be a promise if React version is less than 19");let c=F.default.useMemo(()=>({value:b}),[a.clerkStatus]);return F.default.createElement(ao,{initialState:a.initialState},F.default.createElement(ak.Provider,{value:c},F.default.createElement(as,{value:void 0},a.children)))},"InitialStateProvider",0,ao,"UNSAFE_PortalProvider",0,bj,"__experimental_CheckoutProvider",0,as,"__experimental_PaymentElement",0,({fallback:a})=>{let{setIsPaymentElementReady:b,paymentMethodOrder:c,checkout:d,stripe:e,externalClientSecret:f,paymentDescription:g,for:h}=a9(),i=aE().__internal_environment,j=(0,F.useMemo)(()=>{if(d&&d.totals&&d.plan)return{recurringPaymentRequest:{paymentDescription:g||"",managementURL:"organization"===h?i?.displayConfig.organizationProfileUrl||"":i?.displayConfig.userProfileUrl||"",regularBilling:{amount:d.totals.totalDueNow?.amount||d.totals.grandTotal.amount,label:d.plan.name,recurringPaymentIntervalUnit:"annual"===d.planPeriod?"year":"month"}}}},[d,g,h,i]),k=(0,F.useMemo)(()=>({layout:{type:"tabs",defaultCollapsed:!1},paymentMethodOrder:c,applePay:j}),[j,c]),l=(0,F.useCallback)(()=>{b(!0)},[b]);return e&&f?F.default.createElement(a7,{fallback:a,onReady:l,options:k}):F.default.createElement(F.default.Fragment,null,a)},"__experimental_PaymentElementProvider",0,({children:a,...b})=>F.default.createElement(be,b,F.default.createElement(bf,null,a)),"__experimental_useCheckout",0,a=>{let b=ar(),{for:c,planId:d,planPeriod:e}=a||b,f=aC(),{isLoaded:g,user:h}=aQ(),i=al();if(null===h&&g)throw Error('Clerk: Ensure that `useCheckout` is inside a component wrapped with `<Show when="signed-in" />`.');if(g&&"organization"===c&&null===f)throw Error("Clerk: Ensure your flow checks for an active organization. Retrieve `orgId` from `useAuth()` and confirm it is defined. For SSR, see: https://clerk.com/docs/reference/backend/types/auth-object#how-to-access-the-auth-object");let j=(0,F.useCallback)(()=>i.__experimental_checkout({planId:d,planPeriod:e,for:c}),[h?.id,f?.id,d,e,c]),k=(0,F.useCallback)(a=>i.loaded?i.__internal_state.__internal_effect(()=>{j(),a()}):()=>{},[j,i.loaded,i.__internal_state]),l=(0,F.useCallback)(()=>j(),[j]);return(0,F.useSyncExternalStore)(k,l,l)},"__experimental_usePaymentElement",0,()=>{let{isPaymentElementReady:a,initializePaymentMethod:b}=a9(),{stripe:c,elements:d}=bb(),{externalClientSecret:e}=a9(),f=(0,F.useCallback)(async()=>{if(!c||!d)return bg();let{setupIntent:a,error:b}=await c.confirmSetup({elements:d,confirmParams:{return_url:window.location.href},redirect:"if_required"});return b?{data:null,error:{gateway:"stripe",error:{code:b.code,message:b.message,type:b.type}}}:{data:{gateway:"stripe",paymentToken:a.payment_method},error:null}},[c,d]),g=(0,F.useCallback)(async()=>{if(!c||!d)return bg();await b()},[c,d,b]),h=!!(c&&e);return h?{submit:f,reset:g,isFormReady:a,provider:{name:"stripe"},isProviderReady:h}:{submit:bg,reset:bg,isFormReady:!1,provider:void 0,isProviderReady:!1}},"__internal_useSessionBase",0,aD,"isDeeplyEqual",0,ah,"useAssertWrappedByClerkProvider",0,at,"useClerk",0,aE,"useClerkInstanceContext",0,al,"useInitialStateContext",0,ap,"useOrganization",0,function(a){var b,c;let{domains:d,membershipRequests:e,memberships:f,invitations:g}=a||{};at("useOrganization"),aF("useOrganization");let h=aC(),i=aD(),j=aA(d,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1,enrollmentMode:void 0}),k=aA(e,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),l=aA(f,{initialPage:1,pageSize:10,role:void 0,keepPreviousData:!1,infinite:!1,query:void 0}),m=aA(g,{initialPage:1,pageSize:10,status:["pending"],keepPreviousData:!1,infinite:!1}),n=al();n.telemetry?.record(B("useOrganization"));let o=void 0===d?void 0:{initialPage:j.initialPage,pageSize:j.pageSize,enrollmentMode:j.enrollmentMode},p=void 0===e?void 0:{initialPage:k.initialPage,pageSize:k.pageSize,status:k.status},q=void 0===f?void 0:{initialPage:l.initialPage,pageSize:l.pageSize,role:l.role,query:l.query},r=void 0===g?void 0:{initialPage:m.initialPage,pageSize:m.pageSize,status:m.status},s=aB({fetcher:h?.getDomains,config:{keepPreviousData:j.keepPreviousData,infinite:j.infinite,enabled:!!o,isSignedIn:null!==h,initialPage:j.initialPage,pageSize:j.pageSize},keys:au({stablePrefix:"domains",authenticated:!0,tracked:{organizationId:h?.id},untracked:{args:o}})}),t=aB({fetcher:h?.getMembershipRequests,config:{keepPreviousData:k.keepPreviousData,infinite:k.infinite,enabled:!!p,isSignedIn:null!==h,initialPage:k.initialPage,pageSize:k.pageSize},keys:au({stablePrefix:"membershipRequests",authenticated:!0,tracked:{organizationId:h?.id},untracked:{args:p}})}),u=aB({fetcher:h?.getMemberships,config:{keepPreviousData:l.keepPreviousData,infinite:l.infinite,enabled:!!q,isSignedIn:null!==h,initialPage:l.initialPage,pageSize:l.pageSize},keys:au({stablePrefix:"memberships",authenticated:!0,tracked:{organizationId:h?.id},untracked:{args:q}})}),v=aB({fetcher:h?.getInvitations,config:{keepPreviousData:m.keepPreviousData,infinite:m.infinite,enabled:!!r,isSignedIn:null!==h,initialPage:m.initialPage,pageSize:m.pageSize},keys:au({stablePrefix:"invitations",authenticated:!0,tracked:{organizationId:h?.id},untracked:{args:r}})});return void 0===h?{isLoaded:!1,organization:void 0,membership:void 0,domains:aG,membershipRequests:aG,memberships:aG,invitations:aG}:null===h?{isLoaded:!0,organization:null,membership:null,domains:null,membershipRequests:null,memberships:null,invitations:null}:!n.loaded&&h?{isLoaded:!0,organization:h,membership:void 0,domains:aG,membershipRequests:aG,memberships:aG,invitations:aG}:{isLoaded:n.loaded,organization:h,membership:(b=i.user.organizationMemberships,c=h.id,b.find(a=>a.organization.id===c)),domains:s,membershipRequests:t,memberships:u,invitations:v}},"useOrganizationCreationDefaults",0,function(a={}){at(aI);let{keepPreviousData:b=!0,enabled:c=!0}=a,d=al(),e=aH(),f=d.__internal_environment?.organizationSettings?.organizationCreationDefaults?.enabled??!1;d.telemetry?.record(B(aI));let{queryKey:g}=function(a){let{userId:b}=a;return(0,F.useMemo)(()=>au({stablePrefix:"organizationCreationDefaults",authenticated:!!b,tracked:{userId:b??null},untracked:{args:{}}}),[b])}({userId:e?.id??null}),h=!!e&&c&&f&&d.loaded,i=ay({queryKey:g,queryFn:e?.getOrganizationCreationDefaults,enabled:h,placeholderData:av(b)},Y);return{data:i.data,error:i.error??null,isLoading:i.isLoading,isFetching:i.isFetching}},"useOrganizationList",0,function(a){let{userMemberships:b,userInvitations:c,userSuggestions:d}=a||{};at("useOrganizationList"),aF("useOrganizationList");let e=aA(b,{initialPage:1,pageSize:10,keepPreviousData:!1,infinite:!1}),f=aA(c,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),g=aA(d,{initialPage:1,pageSize:10,status:"pending",keepPreviousData:!1,infinite:!1}),h=al(),i=aH();h.telemetry?.record(B("useOrganizationList"));let j=void 0===b?void 0:{initialPage:e.initialPage,pageSize:e.pageSize},k=void 0===c?void 0:{initialPage:f.initialPage,pageSize:f.pageSize,status:f.status},l=void 0===d?void 0:{initialPage:g.initialPage,pageSize:g.pageSize,status:g.status},m=!!(h.loaded&&i),n=aB({fetcher:i?.getOrganizationMemberships,config:{keepPreviousData:e.keepPreviousData,infinite:e.infinite,enabled:!!j,isSignedIn:null!==i,initialPage:e.initialPage,pageSize:e.pageSize},keys:au({stablePrefix:"userMemberships",authenticated:!0,tracked:{userId:i?.id},untracked:{args:j}})}),o=aB({fetcher:i?.getOrganizationInvitations,config:{keepPreviousData:f.keepPreviousData,infinite:f.infinite,enabled:!!k,isSignedIn:null!==i,initialPage:f.initialPage,pageSize:f.pageSize},keys:au({stablePrefix:"userInvitations",authenticated:!0,tracked:{userId:i?.id},untracked:{args:k}})}),p=aB({fetcher:i?.getOrganizationSuggestions,config:{keepPreviousData:g.keepPreviousData,infinite:g.infinite,enabled:!!l,isSignedIn:null!==i,initialPage:g.initialPage,pageSize:g.pageSize},keys:au({stablePrefix:"userSuggestions",authenticated:!0,tracked:{userId:i?.id},untracked:{args:l}})});return m?{isLoaded:m,setActive:h.setActive,createOrganization:h.createOrganization,userMemberships:n,userInvitations:o,userSuggestions:p}:{isLoaded:!1,createOrganization:void 0,setActive:void 0,userMemberships:aJ,userInvitations:aJ,userSuggestions:aJ}},"usePortalRoot",0,()=>{let a=bi();return a&&"getContainer"in a&&a.getContainer?a.getContainer:()=>null},"useReverification",0,(a,b)=>{let{__internal_openReverification:c,telemetry:d}=aE(),e=(0,F.useRef)(a),f=(0,F.useRef)(b);return d?.record(B("useReverification",{onNeedsReverification:!!b?.onNeedsReverification})),aK(()=>{e.current=a,f.current=b}),(0,F.useCallback)((...a)=>{var b;return(b={openUIComponent:c,telemetry:d,...f.current},function(a){return async(...c)=>{let d=await aR(a(...c));if((0,l.t)(d)){let e,f,g=(e=E,f=E,{promise:new Promise((a,b)=>{e=a,f=b}),resolve:e,reject:f}),h=(0,m.i)(d.clerk_error.metadata?.reverification),i=h?h().level:void 0,j=()=>{g.reject(new o.t("User cancelled attempted verification",{code:"reverification_cancelled"}))},k=()=>{g.resolve(!0)};void 0===b.onNeedsReverification?b.openUIComponent?.({level:i,afterVerification:k,afterVerificationCancelled:j}):b.onNeedsReverification({cancel:j,complete:k,level:i}),await g.promise,d=await aR(a(...c))}return d}})(e.current)(...a)},[c,d])},"useSession",0,()=>{at(aL);let a=aD(),b=al();return(b.telemetry?.record(B(aL)),void 0===a)?{isLoaded:!1,isSignedIn:void 0,session:void 0}:null===a?{isLoaded:!0,isSignedIn:!1,session:null}:{isLoaded:!0,isSignedIn:b.isSignedIn,session:a}},"useSessionList",0,()=>{let a;at(aO);let b=al(),c=(a=al(),(0,F.useSyncExternalStore)((0,F.useCallback)(b=>a.addListener(b,{skipInitialEmit:!0}),[a]),(0,F.useCallback)(()=>a.loaded&&a.__internal_lastEmittedResources?a.__internal_lastEmittedResources.client:aM,[a]),aN));return(al().telemetry?.record(B(aO)),c)?{isLoaded:!0,sessions:c.sessions,setActive:b.setActive}:{isLoaded:!1,sessions:void 0,setActive:void 0}},"useUser",0,aQ],98003)}];

//# sourceMappingURL=node_modules_%40clerk_shared_dist_runtime_09r2rsh._.js.map