@clerk/clerk-js
Version:
Clerk JS library
1 lines • 447 kB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var r in i)("object"==typeof exports?exports:t)[r]=i[r]}}(globalThis,()=>(()=>{var t,e,i,r={9498(t,e,i){"use strict";let r,n,s,a,o,l,c,u,h,d,p,f,_;i(6395),i(4302),i(686),i(8978),i(2205),i(768),i(6235),i(5281),i(6954);try{let t=new URL(document.currentScript.src),e=new URL(t.href.split("/").slice(0,-1).join("/")).href;i.p=(e+=e.endsWith("/")?"":"/").replace(/(^.*\/@clerk\/clerk-js@)(.+?)(\/dist.*)/,"$1".concat("6.25.13","$3"))}catch{}function g(t,e){return e.get?e.get.call(t):e.value}function v(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function m(t,e){var i=v(t,e,"get");return g(t,i)}function y(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function w(t,e,i){y(t,e),e.set(t,i)}function b(t,e,i){var r=v(t,e,"set");if(r.set)r.set.call(t,i);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=i}return i}function k(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function S(t,e){y(t,e),e.add(t)}i(5254);var A,I,C,U,x,E,P,T,O,R,M,N,z,W,D,F,L,j,B,V,J,K,q,H,G,Y,$,Q,X,Z,tt,te,ti,tr,tn,ts,ta,to,tl,tc,tu,th,td,tp,tf,t_,tg,tv,tm,ty,tw,tb,tk,tS,tA=i(7213);function tI(){return"u">typeof window}i(3560),i(2949),i(9678),i(4104),i(8723),i(2277),i(2021),i(1178),i(7891),i(498),i(807);let tC=RegExp("bot|spider|crawl|APIs-Google|AdsBot|Googlebot|mediapartners|Google Favicon|FeedFetcher|Google-Read-Aloud|DuplexWeb-Google|googleweblight|bing|yandex|baidu|duckduck|yahoo|ecosia|ia_archiver|facebook|instagram|pinterest|reddit|slack|twitter|whatsapp|youtube|semrush","i"),tU=/^(Cloudflare-Workers|Node\.js|Deno|Bun)\b/i;function tx(){var t;if("u">typeof window&&window.navigator)return window.navigator;let e=globalThis;return"function"==typeof e.WorkerGlobalScope&&e.self instanceof e.WorkerGlobalScope&&e.self.navigator&&!tU.test(null!=(t=e.self.navigator.userAgent)?t:"")?e.self.navigator:null}function tE(){var t;let e=tx();return!!e&&!((t=null==e?void 0:e.userAgent)&&tC.test(t))&&!(null==e?void 0:e.webdriver)}function tP(){let t=tx();return!!t&&("boolean"!=typeof t.onLine||!!t.onLine)}function tT(){return tP()&&tE()}let tO=(t,e,i,r,n)=>{let{notify:s}=n||{},a=t.get(i);a||(a=[],t.set(i,a)),a.push(r),s&&e.has(i)&&r(e.get(i))},tR=(t,e,i)=>(t.get(e)||[]).map(t=>t(i)),tM=(t,e,i)=>{let r=t.get(e);r&&(i?r.splice(r.indexOf(i)>>>0,1):t.set(e,[]))},tN=()=>{let t=new Map,e=new Map,i=new Map;return{on:function(){for(var i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];return tO(t,e,...r)},prioritizedOn:function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return tO(i,e,...r)},emit:(r,n)=>{e.set(r,n),tR(i,r,n),tR(t,r,n)},off:function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return tM(t,...i)},prioritizedOff:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return tM(i,...e)},internal:{retrieveListeners:e=>t.get(e)||[]}}},tz="status";function tW(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function tD(t){return function(e){let i=null!=e?e:this;if(!i)throw TypeError("".concat(t.kind||t.name," type guard requires an error object"));if(t.kind&&"object"==typeof i&&null!==i&&"constructor"in i){var r;if((null==(r=i.constructor)?void 0:r.kind)===t.kind)return!0}return i instanceof t}}var tF=(C=class t extends Error{get name(){return this.constructor.name}toString(){return"[".concat(this.name,"]\nMessage:").concat(this.message)}static formatMessage(t,e,i,r){let n="Clerk:",s=RegExp(n.replace(" ","\\s*"),"i");return e=e.replace(s,""),e="".concat(n," ").concat(e.trim(),'\n\n(code="').concat(i,'")\n\n'),r&&(e+="\n\nDocs: ".concat(r)),e}constructor(e){super(new.target.formatMessage(new.target.kind,e.message,e.code,e.docsUrl),{cause:e.cause}),tW(this,"clerkError",!0),tW(this,"code",void 0),tW(this,"longMessage",void 0),tW(this,"docsUrl",void 0),tW(this,"cause",void 0),Object.setPrototypeOf(this,t.prototype),this.code=e.code,this.docsUrl=e.docsUrl,this.longMessage=e.longMessage,this.cause=e.cause}},tW(C,"kind","ClerkError"),C),tL=(U=class t extends tF{constructor(e,i){super({...i,message:e}),tW(this,"clerkRuntimeError",!0),Object.setPrototypeOf(this,t.prototype)}},tW(U,"kind","ClerkRuntimeError"),U);let tj=tD(tL);function tB(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i(9381),i(7548),i(954),i(8803),i(9162),i(5385),i(9342),i(9152);var tV=(x=class{constructor(t){var e,i,r,n,s,a,o,l,c;tB(this,"code",void 0),tB(this,"message",void 0),tB(this,"longMessage",void 0),tB(this,"meta",void 0);const u={code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:null==(e=t.meta)?void 0:e.param_name,sessionId:null==(i=t.meta)?void 0:i.session_id,emailAddresses:null==(r=t.meta)?void 0:r.email_addresses,identifiers:null==(n=t.meta)?void 0:n.identifiers,zxcvbn:null==(s=t.meta)?void 0:s.zxcvbn,plan:null==(a=t.meta)?void 0:a.plan,isPlanUpgradePossible:null==(o=t.meta)?void 0:o.is_plan_upgrade_possible,seatsQuantityToAdd:null==(l=t.meta)?void 0:l.seats_quantity_to_add,seatsQuantity:null==(c=t.meta)?void 0:c.seats_quantity}};this.code=u.code,this.message=u.message,this.longMessage=u.longMessage,this.meta=u.meta}},tB(x,"kind","ClerkAPIError"),x);tD(tV);var tJ=(E=class t extends tF{toString(){let t="[".concat(this.name,"]\nMessage:").concat(this.message,"\nStatus:").concat(this.status,"\nSerialized errors: ").concat(this.errors.map(t=>JSON.stringify(t)));return this.clerkTraceId&&(t+="\nClerk Trace ID: ".concat(this.clerkTraceId)),t}static formatMessage(t,e,i,r){return e}constructor(e,i){const{data:r,status:n,clerkTraceId:s,retryAfter:a}=i;super({...i,message:e,code:"api_response_error"}),tB(this,"status",void 0),tB(this,"clerkTraceId",void 0),tB(this,"retryAfter",void 0),tB(this,"errors",void 0),Object.setPrototypeOf(this,t.prototype),this.status=n,this.clerkTraceId=s,this.retryAfter=a,this.errors=(r||[]).map(t=>new tV(t))}},tB(E,"kind","ClerkAPIResponseError"),E);let tK=tD(tJ);var tq=(tB(P=class t extends tJ{static is(e){return tK(e)&&e.status===t.STATUS&&e.errors.length>0&&e.errors[0].code===t.ERROR_CODE}},"kind","MissingExpiredTokenError"),tB(P,"ERROR_CODE","missing_expired_token"),tB(P,"STATUS",422),P),tH=(tB(T=class t extends tL{static is(e){return null!=e&&(e instanceof t||tj(e)&&e.code===t.ERROR_CODE)}constructor(e){super(e,{code:t.ERROR_CODE}),Object.setPrototypeOf(this,t.prototype)}},"kind","ClerkOfflineError"),tB(T,"ERROR_CODE","clerk_offline"),T);let tG=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"});function tY(t){let{packageName:e,customMessages:i}=t,r=e;function n(t,e){if(!e)return"".concat(r,": ").concat(t);let i=t;for(let r of t.matchAll(/{{([a-zA-Z0-9-_]+)}}/g)){let t=(e[r[1]]||"").toString();i=i.replace("{{".concat(r[1],"}}"),t)}return"".concat(r,": ").concat(i)}let s={...tG,...i};return{setPackageName(t){let{packageName:e}=t;return"string"==typeof e&&(r=e),this},setMessages(t){let{customMessages:e}=t;return Object.assign(s,e||{}),this},throwInvalidPublishableKeyError(t){throw Error(n(s.InvalidPublishableKeyErrorMessage,t))},throwInvalidProxyUrl(t){throw Error(n(s.InvalidProxyUrlErrorMessage,t))},throwMissingPublishableKeyError(){throw Error(n(s.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw Error(n(s.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(t){throw Error(n(s.MissingClerkProvider,t))},throw(t){throw Error(n(t))}}}var t$=class t extends Error{constructor(e){super(e),tB(this,"code",void 0),this.code=e,this.name="EmailLinkError",Object.setPrototypeOf(this,t.prototype)}},tQ=class extends tL{constructor(t,e){super(t,e),tB(this,"code",void 0),this.code=e.code}};function tX(t){return["captcha_invalid","captcha_not_enabled","captcha_missing_token"].includes(t.errors[0].code)}function tZ(t){let e=null==t?void 0:t.status;return!!e&&e>=400&&e<500}let t0=new Set(["user_banned","user_deactivated"]);function t1(t){let e=null==t?void 0:t.status,i=Array.isArray(null==t?void 0:t.errors)&&t.errors.some(t=>t0.has(null==t?void 0:t.code));return 401===e||422===e||403===e&&i}function t2(t){for(let[e,i]of Object.entries({isClerkAPIResponseError:tK,isClerkRuntimeError:tj}))Object.assign(t,{[e]:i});return t}let t3=(t,e)=>!!(t.isSignedIn&&(null==e?void 0:e.authConfig.singleSessionMode)),t8=(t,e)=>!(null==e?void 0:e.commerceSettings.billing.user.enabled)&&!(null==e?void 0:e.commerceSettings.billing.organization.enabled),t5=(t,e)=>{var i;return!(null==e||null==(i=e.apiKeysSettings)?void 0:i.user_api_keys_enabled)},t6=(t,e)=>{var i;return!(null==e||null==(i=e.apiKeysSettings)?void 0:i.orgs_api_keys_enabled)},t4="__clerk_synced",t9="false",t7="true",et="suffixed_cookies",ee="__clerk_satellite_url",ei="external_account_exists",er="clerk-captcha",en="clerk-invisible-captcha";function es(t){return t?t.replace(/([-_][a-z])/g,t=>t.toUpperCase().replace(/-|_/,"")):""}function ea(t){return t?t.replace(/[A-Z]/g,t=>"_".concat(t.toLowerCase())):""}i(4086),i(4330),i(6455);let eo=t=>{let e=i=>{if(!i)return i;if(Array.isArray(i))return i.map(t=>"object"==typeof t||Array.isArray(t)?e(t):t);let r={...i};for(let i of Object.keys(r)){let n=t(i.toString());n!==i&&(r[n]=r[i],delete r[i]),"object"==typeof r[n]&&(r[n]=e(r[n]))}return r};return e},el=eo(ea),ec=eo(es);function eu(t){if("boolean"==typeof t)return t;if(null==t)return!1;if("string"==typeof t){if("true"===t.toLowerCase())return!0;if("false"===t.toLowerCase())return!1}let e=parseInt(t,10);return!isNaN(e)&&e>0}let eh=(t,e)=>{let i={};for(let r in t)i[r]=e(t[r],r);return i},ed=(t,e)=>{let i={};for(let r in t)t[r]&&e(t[r])&&(i[r]=t[r]);return i};i(9780),i(303),i(9166),i(6106),i(3619),i(2742),i(1949),i(7553),i(2148),i(9055),i(1435),i(4586),i(5850),i(5135);let ep=[".lcl.dev",".lclstage.dev",".lclclerk.com"],ef=[".accounts.dev",".accountsstage.dev",".accounts.lclclerk.com"],e_=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"];i(2037);let eg=t=>"u">typeof atob&&"function"==typeof atob?atob(t):void 0!==globalThis.Buffer?globalThis.Buffer.from(t,"base64").toString():t,ev="pk_live_";function em(t){if(!t.endsWith("$"))return!1;let e=t.slice(0,-1);return!e.includes("$")&&e.includes(".")}function ey(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t=t||"")||!ew(t)){if(i.fatal&&!t)throw Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(i.fatal&&!ew(t))throw Error("Publishable key not valid.");return null}let r=t.startsWith(ev)?"production":"development";try{e=eg(t.split("_")[2])}catch{if(i.fatal)throw Error("Publishable key not valid: Failed to decode key.");return null}if(!em(e)){if(i.fatal)throw Error("Publishable key not valid: Decoded key has invalid format.");return null}let n=e.slice(0,-1);return i.proxyUrl?n=i.proxyUrl:"development"!==r&&i.domain&&i.isSatellite&&(n="clerk.".concat(i.domain)),{instanceType:r,frontendApi:n}}function ew(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{if(!(t.startsWith(ev)||t.startsWith("pk_test_")))return!1;let e=t.split("_");if(3!==e.length)return!1;let i=e[2];if(!i)return!1;return em(eg(i))}catch{return!1}}async function eb(t){var e;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis.crypto.subtle,r=new TextEncoder().encode(t);return(e=String.fromCharCode(...new Uint8Array(await i.digest("sha-1",r))),"u">typeof btoa&&"function"==typeof btoa?btoa(e):void 0!==globalThis.Buffer?globalThis.Buffer.from(e).toString("base64"):e).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}let ek=(t,e)=>"".concat(t,"_").concat(e);var eS=i(547);function eA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(t||"").replace(/^.+:\/\//,"")}let eI=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,eC=new Set,eU=t=>{eC.has(t)||(eC.add(t),console.warn(t))},ex=RegExp("/{1,}","g"),eE=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||!t||"object"!=typeof t)return"";let i=new URLSearchParams;return Object.keys(t).forEach(r=>{let n=e.keyEncoder?e.keyEncoder(r):r,s=t[r];if(Array.isArray(s))s.forEach(t=>void 0!==t&&i.append(n,t||""));else{if(void 0===s)return;"object"==typeof s&&null!==s?i.append(n,JSON.stringify(s)):i.append(n,String(null!=s?s:""))}}),i.toString()},eP="http://clerk-dummy",eT=["javascript:"],{isDevOrStagingUrl:eO}=(a=new Map,{isDevOrStagingUrl:t=>{if(!t)return!1;let e="string"==typeof t?t:t.hostname,i=a.get(e);return void 0===i&&(i=e_.some(t=>e.endsWith(t)),a.set(e,i)),i}}),eR=new Map;function eM(t){return t.replace("clerk.","")}function eN(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{base:i,hashPath:r,hashSearch:n,searchParams:s,hashSearchParams:a,...o}=t,l=new URL(i||"","u">typeof window&&window.location?window.location.href:"http://react-native-fake-base-url");if(s instanceof URLSearchParams&&s.forEach((t,e)=>{null!=t&&l.searchParams.set(ea(e),t)}),Object.assign(l,o),r||n||a){var c;let t,e=new URL(eP+l.hash.substring(1));for(let[i,s]of(c=e.pathname,e.pathname=[c,r||""].filter(t=>t).join("/").replace(ex,"/"),Object.entries((t={},new URLSearchParams(n||"").forEach((e,i)=>{if(i in t){let r=t[i];Array.isArray(r)?r.push(e):t[i]=[r,e]}else t[i]=e}),t))))e.searchParams.append(i,s);if(a)for(let t of Array.isArray(a)?a:[a])(t instanceof URLSearchParams||"object"==typeof t)&&new URLSearchParams(t).forEach((t,i)=>{null!=t&&e.searchParams.set(ea(i),t)});let i=e.href.replace(eP,"");"/"!==i&&(l.hash=i)}let{stringify:u,skipOrigin:h}=e;return u?h?l.href.replace(l.origin,""):l.href:l}function ez(t){return void 0===window.location&&"string"==typeof t?t:(t=new URL(t.toString(),window.location.origin)).href.replace(t.origin,"")}let eW=t=>(t||"").replace(/\/+$/,"");function eD(t,e){try{return new URL(t)}catch{return new URL(t,e)}}let eF=[/\0/,/^\/\//,/[\x00-\x1F]/],eL=["/oauth/authorize"],ej=["/v1/verify","/v1/tickets/accept","/oauth/authorize-with-immediate-redirect","/oauth/end_session"];function eB(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function eV(t,e){var i=function(t,e){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return e.get(t)}(t,e);return i.get?i.get.call(t):i.value}function eJ(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function eK(t,e){eB(t,e),e.add(t)}function eq(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var eH=(O=new WeakSet,R=new WeakSet,M=new WeakSet,N=new WeakSet,z=new WeakSet,W=new WeakSet,D=new WeakSet,F=new WeakMap,L=class{getAfterSignInUrl(){return eJ(this,N,eQ).call(this,"signIn")}getAfterSignUpUrl(){return eJ(this,N,eQ).call(this,"signUp")}getPreservedSearchParams(){return eJ(this,O,eG).call(this,eJ(this,R,eY).call(this))}toSearchParams(){return eJ(this,O,eG).call(this,eJ(this,M,e$).call(this))}constructor(t,e={},i={},r){eK(this,O),eK(this,R),eK(this,M),eK(this,N),eK(this,z),eK(this,W),eK(this,D),eq(this,"options",void 0),eq(this,"fromOptions",void 0),eq(this,"fromProps",void 0),eq(this,"fromSearchParams",void 0),eq(this,"mode",void 0),function(t,e,i){eB(t,e),e.set(t,i)}(this,F,{writable:!0,value:t=>{var e;let i,r;return ed(t,(i=null==(e=this.options)?void 0:e.allowedRedirectOrigins,r=window.location.origin,t=>{let e=t;if("string"==typeof e&&(e=eD(e,r)),!i)return!0;let n=r===e.origin,s=!function(t){if(function(t){if(!function(t){if(!t)return!1;try{return new URL(t),!0}catch{return!1}}(t))return!1;let e=new URL(t).protocol;return eT.some(t=>t===e)}(t))return!0;for(let e of eF)if(e.test(t.pathname))return!0;return!1}(e)&&(n||i.map(t=>"string"==typeof t?(t=>{try{return eS(t)}catch(e){throw Error("Invalid pattern: ".concat(t,".\nConsult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.\n").concat(e.message))}})(eW(t)):t).some(t=>t.test(eW(e.origin))));return s||eU("Clerk: Redirect URL ".concat(e," is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.")),s}))}}),this.options=t,this.fromOptions=eJ(this,z,eX).call(this,t||{}),this.fromProps=eJ(this,z,eX).call(this,e||{}),this.fromSearchParams=eJ(this,W,eZ).call(this,i||{}),this.mode=r}},eq(L,"keys",["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","redirectUrl"]),eq(L,"preserved",["redirectUrl"]),L);function eG(t){return new URLSearchParams(Object.entries(Object.fromEntries(Object.entries(t).map(t=>{let[e,i]=t;return[ea(e),i]}))).reduce((t,e)=>{let[i,r]=e;return null!=r&&(t[i]=r),t},{}))}function eY(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter(t=>{let[e]=t;return L.preserved.includes(e)}))}function e$(){let t=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,e=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,i=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,r={signUpForceRedirectUrl:t,signUpFallbackRedirectUrl:e,signInFallbackRedirectUrl:this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,signInForceRedirectUrl:i,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl};return t&&delete r.signUpFallbackRedirectUrl,i&&delete r.signInFallbackRedirectUrl,r}function eQ(t){let e,i="".concat(t,"ForceRedirectUrl"),r="".concat(t,"FallbackRedirectUrl");return((e=this.fromSearchParams[i]||this.fromProps[i]||this.fromOptions[i])||(e=this.fromSearchParams.redirectUrl),e||(e=this.fromSearchParams[r]||this.fromProps[r]||this.fromOptions[r]),e||"modal"!==this.mode)?e||"/":window.location.href}function eX(t){let e={};return L.keys.forEach(i=>{e[i]=t[i]}),eh(eV(this,F).call(this,eJ(this,D,e0).call(this,ed(e,Boolean))),t=>t.toString())}function eZ(t){let e={};return L.keys.forEach(i=>{t instanceof URLSearchParams?e[i]=t.get(ea(i)):e[i]=t[ea(i)]}),eh(eV(this,F).call(this,eJ(this,D,e0).call(this,ed(e,Boolean))),t=>t.toString())}function e0(t){return eh(t,t=>eD(t,window.location.origin))}let e1="__clerk_netlify_cache_bust",e2=["__clerk_status","__clerk_created_session","__clerk_invitation_token","__clerk_ticket","__clerk_modal_state","__clerk_handshake","__clerk_handshake_nonce","__clerk_help",e1,t4,ee,et];function e3(t){return new URL(window.location.href).searchParams.get(t)||null}function e8(t){let e=new URL(window.location.href);e.searchParams.has(t)&&(e.searchParams.delete(t),window.history.replaceState(window.history.state,"",e))}function e5(t){let e=new URLSearchParams(window.location.search),i=t||new URLSearchParams;for(let t of e2){let r=e.get(t);r&&i.set(t,r)}return i}let e6={"choose-organization":"choose-organization","reset-password":"reset-password","setup-mfa":"setup-mfa"},e4=t=>"/tasks/".concat(e6[t.key]);function e9(t,e){let{navigate:i,baseUrl:r}=e,n=t.currentTask;if(n){var s;let t;return i((s={base:r},t=e5(),eN({base:s.base,hashPath:e4(n),searchParams:t},{stringify:!0})))}}let e7=t=>"🔒 Clerk:\n".concat(t.trim(),"\n(This notice only appears in development)"),it=t=>e7("".concat(t," as a function is not supported in this environment. The value will be ignored. Provide an absolute URL instead.")),ie={proxyUrlAsFunctionNotSupported:it("proxyUrl"),domainAsFunctionNotSupported:it("domain"),cannotRenderComponentWhenSessionExists:"The <SignUp/> and <SignIn/> components cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the Home URL instead.",cannotRenderSignUpComponentWhenSessionExists:"The <SignUp/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the value set in `afterSignUp` URL instead.",cannotRenderSignUpComponentWhenTaskExists:"The <SignUp/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenTaskDoesNotExist:"<TaskChooseOrganization/> cannot render unless a session task is pending. Clerk is redirecting to the value set in `redirectUrlComplete` instead.",cannotRenderSignInComponentWhenSessionExists:"The <SignIn/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `afterSignIn` URL instead.",cannotRenderSignInComponentWhenTaskExists:"The <SignIn/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenUserDoesNotExist:"<UserProfile/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.",createCannotRenderComponentWhenOrgDoesNotExist:t=>e7("<".concat(t,"/> cannot render unless an organization is active. Since no organization is currently active, this is no-op.")),cannotRenderAnyOrganizationComponent:t=>e7("The <".concat(t,"/> cannot be rendered when the feature is turned off. Visit 'dashboard.clerk.com' to enable the feature. Since the feature is turned off, this is no-op.")),cannotRenderAnyBillingComponent:t=>e7("The <".concat(t,"/> component cannot be rendered when billing is disabled. Visit 'https://dashboard.clerk.com/last-active?path=billing/settings' to follow the necessary steps to enable billing. Since billing is disabled, this is no-op.")),cannotOpenUserProfile:"The UserProfile modal cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenCheckout:"The Checkout drawer cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenSignInOrSignUp:"The <SignIn/> and <SignUp/> modals are hidden because a user is already signed in and this application is configured for single-session mode. This is expected behavior — no action is needed. To allow rendering while signed in, enable multi-session mode in your Clerk Dashboard.",cannotRenderAPIKeysComponent:"The <APIKeys/> component cannot be rendered when API keys is disabled. Since API keys is disabled, this is no-op.",cannotRenderAPIKeysComponentForOrgWhenUnauthorized:"The <APIKeys/> component cannot be rendered for an organization unless a user has the required permissions. Since the user does not have the necessary permissions, this is no-op.",cannotRenderAPIKeysComponentForUserWhenDisabled:"The <APIKeys/> component cannot be rendered when user API keys are disabled. Since user API keys are disabled, this is no-op.",cannotRenderAPIKeysComponentForOrgWhenDisabled:"The <APIKeys/> component cannot be rendered when organization API keys are disabled. Since organization API keys are disabled, this is no-op.",cannotRenderOAuthConsentComponentWhenUserDoesNotExist:"<OAuthConsent/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotRenderConfigureSSOComponentWhenUserDoesNotExist:"<ConfigureSSO/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotRenderConfigureSSOComponentWhenDisabled:"The <ConfigureSSO/> component cannot be rendered when self-serve SSO is disabled. Visit `https://dashboard.clerk.com` to enable the feature. Since self-serve SSO is disabled, this is no-op.",cannotRenderConfigureSSOComponentWhenEmailAddressDisabled:"The <ConfigureSSO/> component cannot be rendered when email addresses are disabled on the instance. Visit `https://dashboard.clerk.com` to enable email addresses. Since email addresses are disabled, this is no-op."};for(let t of Object.keys(ie)){let e=ie[t];"function"!=typeof e&&(ie[t]=e7(e))}let ii="clerk:beforeunload",ir=["http:","https:","wails:","chrome-extension:"],is=/^[/\\][/\\]/;function ia(t){return/^http(s)?:\/\//.test(t||"")}function io(t){return t.startsWith("/")}let il=[".vercel.app"];var ic=i(1311);function iu(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function ih(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function id(t,e){var i=ih(t,e,"get");return i.get?i.get.call(t):i.value}function ip(t,e,i){iu(t,e),e.set(t,i)}function i_(t,e,i){var r=ih(t,e,"set");if(r.set)r.set.call(t,i);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=i}return i}function ig(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function iv(t,e){iu(t,e),e.add(t)}let im=Symbol.for("@clerk/shared.telemetryNoticeShown"),iy=["Attention: Clerk collects telemetry data from its SDKs when connected to development instances.","The data collected is used to inform Clerk's product roadmap.","To learn more, including how to opt-out from the telemetry program, visit: https://clerk.com/docs/telemetry."];var iw=(j=new WeakMap,B=new WeakMap,V=new WeakSet,class{isEventThrottled(t){let e=Date.now(),i=ig(this,V,iT).call(this,t),r=id(this,j).getItem(i);return!(!r||e-r>id(this,B))||(id(this,j).setItem(i,e),!1)}constructor(t){iv(this,V),ip(this,j,{writable:!0,value:void 0}),ip(this,B,{writable:!0,value:864e5}),i_(this,j,t)}}),ib=(J=new WeakMap,K=new WeakSet,class{getItem(t){return ig(this,K,iO).call(this)[t]}setItem(t,e){try{let i=ig(this,K,iO).call(this);i[t]=e,localStorage.setItem(id(this,J),JSON.stringify(i))}catch(t){t instanceof DOMException&&("QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&localStorage.length>0&&localStorage.removeItem(id(this,J))}}removeItem(t){try{let e=ig(this,K,iO).call(this);delete e[t],localStorage.setItem(id(this,J),JSON.stringify(e))}catch{}}static isSupported(){return"u">typeof window&&!!window.localStorage}constructor(){iv(this,K),ip(this,J,{writable:!0,value:"clerk_telemetry_throttler"})}}),ik=(q=new WeakMap,H=new WeakMap,class{getItem(t){return id(this,q).size>id(this,H)?void id(this,q).clear():id(this,q).get(t)}setItem(t,e){id(this,q).set(t,e)}removeItem(t){id(this,q).delete(t)}constructor(){ip(this,q,{writable:!0,value:new Map}),ip(this,H,{writable:!0,value:1e4})}});let iS=new Set(["error","warn","info","debug","trace"]);var iA=(G=new WeakMap,Y=new WeakMap,$=new WeakMap,Q=new WeakMap,X=new WeakMap,Z=new WeakSet,tt=new WeakSet,te=new WeakSet,ti=new WeakSet,tr=new WeakSet,tn=new WeakSet,ts=new WeakSet,ta=new WeakSet,to=new WeakSet,class{get isEnabled(){var t,e;return!("development"!==id(this,$).instanceType||id(this,G).disabled||"u">typeof process&&process.env&&eu(process.env.CLERK_TELEMETRY_DISABLED)||"u">typeof window&&(null==(e=window)||null==(t=e.navigator)?void 0:t.webdriver))}get isDebug(){return id(this,G).debug||"u">typeof process&&process.env&&eu(process.env.CLERK_TELEMETRY_DEBUG)}record(t){try{let e=ig(this,ta,iL).call(this,t.event,t.payload);if(ig(this,tn,iD).call(this,e.event,e),!ig(this,Z,iR).call(this,e,t.eventSamplingRate))return;id(this,Q).push({kind:"event",value:e}),ig(this,ti,iz).call(this)}catch(t){console.error("[clerk/telemetry] Error recording telemetry event",t)}}recordLog(t){try{var e;if(!ig(this,tt,iM).call(this,t))return;let i="string"==typeof(null==t?void 0:t.level)&&iS.has(t.level),r="string"==typeof(null==t?void 0:t.message)&&t.message.trim().length>0,n=null,s=null==t?void 0:t.timestamp;if("number"==typeof s||"string"==typeof s){let t=new Date(s);Number.isNaN(t.getTime())||(n=t)}if(!i||!r||null===n){this.isDebug&&"u">typeof console&&console.warn("[clerk/telemetry] Dropping invalid telemetry log entry",{levelIsValid:i,messageIsValid:r,timestampIsValid:null!==n});return}let a=ig(this,ts,iF).call(this),o={sdk:a.name,sdkv:a.version,cv:null!=(e=id(this,$).clerkVersion)?e:"",lvl:t.level,msg:t.message,ts:n.toISOString(),pk:id(this,$).publishableKey||null,payload:ig(this,to,ij).call(this,t.context)};id(this,Q).push({kind:"log",value:o}),ig(this,ti,iz).call(this)}catch(t){console.error("[clerk/telemetry] Error recording telemetry log entry",t)}}constructor(t){var e,i,r,n,s,a,o;iv(this,Z),iv(this,tt),iv(this,te),iv(this,ti),iv(this,tr),iv(this,tn),iv(this,ts),iv(this,ta),iv(this,to),ip(this,G,{writable:!0,value:void 0}),ip(this,Y,{writable:!0,value:void 0}),ip(this,$,{writable:!0,value:{}}),ip(this,Q,{writable:!0,value:[]}),ip(this,X,{writable:!0,value:null}),i_(this,G,{maxBufferSize:null!=(e=t.maxBufferSize)?e:5,samplingRate:null!=(i=t.samplingRate)?i:1,perEventSampling:null==(r=t.perEventSampling)||r,disabled:null!=(n=t.disabled)&&n,debug:null!=(s=t.debug)&&s,endpoint:"https://clerk-telemetry.com"}),!t.clerkVersion&&"u"<typeof window?id(this,$).clerkVersion="":id(this,$).clerkVersion=null!=(a=t.clerkVersion)?a:"",id(this,$).sdk=t.sdk,id(this,$).sdkVersion=t.sdkVersion,id(this,$).publishableKey=null!=(o=t.publishableKey)?o:"";const l=ey(t.publishableKey);l&&(id(this,$).instanceType=l.instanceType),t.secretKey&&(id(this,$).secretKey=t.secretKey.substring(0,16)),i_(this,Y,new iw(ib.isSupported()?new ib:new ik)),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t.skip)try{if("u">typeof window||void 0!==globalThis.EdgeRuntime||!("u"<typeof process)&&process.env&&ic.t.some(t=>eu(process.env[t]))||globalThis[im])return;if("u">typeof console&&"function"==typeof console.log){for(let t of iy)console.log(t);console.log("")}globalThis[im]=!0}catch{}}({skip:!this.isEnabled})}});let iI="COMPONENT_MOUNTED",iC=new Set(["SignIn","SignUp"]);function iU(t){return function(e,i,r){var n,s,a;return{event:t,eventSamplingRate:t===iI?iC.has(e)?1:.1:.1,payload:{component:e,appearanceProp:!!(null==i?void 0:i.appearance),theme:!!(null==i||null==(n=i.appearance)?void 0:n.theme),elements:!!(null==i||null==(s=i.appearance)?void 0:s.elements),variables:!!(null==i||null==(a=i.appearance)?void 0:a.variables),...r}}}}function ix(t,e,i){return iU(iI)(t,e,i)}function iE(t,e,i){return iU("COMPONENT_OPENED")(t,e,i)}function iP(t){return"string"==typeof t?t:"object"==typeof t&&null!==t&&"name"in t&&"string"==typeof t.name?t.name:void 0}function iT(t){let{sk:e,pk:i,payload:r,...n}=t,s={...r,...n};return JSON.stringify(Object.keys({...r,...n}).sort().map(t=>s[t]))}function iO(){try{let t=localStorage.getItem(id(this,J));if(!t)return{};return JSON.parse(t)}catch{return{}}}function iR(t,e){return this.isEnabled&&!this.isDebug&&ig(this,te,iN).call(this,t,e)}function iM(t){return!0}function iN(t,e){let i=Math.random();return!!(i<=id(this,G).samplingRate&&(!1===id(this,G).perEventSampling||void 0===e||i<=e))&&!id(this,Y).isEventThrottled(t)}function iz(){if("u"<typeof window)return void ig(this,tr,iW).call(this);if(id(this,Q).length>=id(this,G).maxBufferSize){id(this,X)&&("u">typeof cancelIdleCallback?cancelIdleCallback(Number(id(this,X))):clearTimeout(Number(id(this,X)))),ig(this,tr,iW).call(this);return}id(this,X)||("requestIdleCallback"in window?i_(this,X,requestIdleCallback(()=>{ig(this,tr,iW).call(this),i_(this,X,null)})):i_(this,X,setTimeout(()=>{ig(this,tr,iW).call(this),i_(this,X,null)},0)))}function iW(){let t=[...id(this,Q)];if(i_(this,Q,[]),i_(this,X,null),0===t.length)return;let e=t.filter(t=>"event"===t.kind).map(t=>t.value),i=t.filter(t=>"log"===t.kind).map(t=>t.value);e.length>0&&fetch(new URL("/v1/event",id(this,G).endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({events:e})}).catch(()=>void 0),i.length>0&&fetch(new URL("/v1/logs",id(this,G).endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({logs:i})}).catch(()=>void 0)}function iD(t,e){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",t),console.log(e),console.groupEnd()):console.log("[clerk/telemetry]",t,e))}function iF(){let t={name:id(this,$).sdk,version:id(this,$).sdkVersion};if("u">typeof window){let e=window;if(e.Clerk){let i=e.Clerk;if("object"==typeof i&&null!==i&&"constructor"in i&&"function"==typeof i.constructor&&i.constructor.sdkMetadata){let{name:e,version:r}=i.constructor.sdkMetadata;void 0!==e&&(t.name=e),void 0!==r&&(t.version=r)}}}return t}function iL(t,e){var i,r;let n=ig(this,ts,iF).call(this);return{event:t,cv:null!=(i=id(this,$).clerkVersion)?i:"",it:null!=(r=id(this,$).instanceType)?r:"",sdk:n.name,sdkv:n.version,...id(this,$).publishableKey?{pk:id(this,$).publishableKey}:{},...id(this,$).secretKey?{sk:id(this,$).secretKey}:{},payload:e}}function ij(t){if(null==t||"object"!=typeof t)return null;try{let e=JSON.parse(JSON.stringify(t));if(e&&"object"==typeof e&&!Array.isArray(e))return e;return null}catch{return null}}var iB=i(8835);let iV=!1,iJ=null,iK=!1,iq=[];function iH(t,e,i,r){iV&&(iq.push({level:t,message:e,context:i,source:r,ts:Date.now()}),iq.length>200&&iq.shift())}async function iG(t){try{if(!iV||iJ)return;let{getDebugLogger:e}=await Promise.all([i.e(545),i.e(321)]).then(i.bind(i,9296)),r=await e({logLevel:null==t?void 0:t.logLevel,telemetryCollector:null==t?void 0:t.telemetryCollector});if(r&&(iJ=r)&&0!==iq.length){for(let t of iq){let e={...t.context||{},__preInit:!0,__preInitTs:t.ts};switch(t.level){case"error":iJ.error(t.message,e,t.source);break;case"warn":iJ.warn(t.message,e,t.source);break;case"info":iJ.info(t.message,e,t.source);break;case"debug":iJ.debug(t.message,e,t.source)}}iq.length=0}}catch(t){try{var e,r;null==(e=(r=console).debug)||e.call(r,"Debug logger initialization failed",t)}catch{}return}}let iY={debug(t,e,i){iJ?iJ.debug(t,e,i):iH("debug",t,e,i)},error(t,e,i){iJ?iJ.error(t,e,i):iH("error",t,e,i)},info(t,e,i){iJ?iJ.info(t,e,i):iH("info",t,e,i)},warn(t,e,i){iJ?iJ.warn(t,e,i):iH("warn",t,e,i)}},i$={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(t,e)=>e<5,retryImmediately:!1,jitter:!0},iQ=async t=>new Promise(e=>setTimeout(e,t)),iX=(t,e)=>e?t*(1+Math.random()):t,iZ=async function(t){var e;let i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,{shouldRetry:s,initialDelay:a,maxDelayBetweenRetries:o,factor:l,retryImmediately:c,jitter:u,onBeforeRetry:h}={...i$,...r},d=(e={initialDelay:a,maxDelayBetweenRetries:o,factor:l,jitter:u},i=0,async()=>{let t;await iQ((t=iX(t=e.initialDelay*Math.pow(e.factor,i),e.jitter),Math.min(e.maxDelayBetweenRetries||t,t))),i++});for(;;)try{return await t()}catch(t){if(!s(t,++n))throw t;h&&await h(n),c&&1===n?await iQ(iX(100,u)):await d()}},i0=async t=>iZ(t,{initialDelay:100,shouldRetry:(t,e)=>e<=3,retryImmediately:!0,factor:2});var i1=new WeakMap;class i2{import(t){return m(this,i1)[t]?m(this,i1)[t]():Promise.resolve(void 0)}constructor(){w(this,i1,{writable:!0,value:{"@zxcvbn-ts/core":()=>i0(()=>Promise.all([i.e(729),i.e(545)]).then(i.bind(i,3239))),"@zxcvbn-ts/language-common":()=>i0(()=>i.e(873).then(i.bind(i,9144))),"@base-org/account":()=>i0(()=>Promise.all([i.e(994),i.e(929),i.e(545)]).then(i.bind(i,7003))),"@coinbase/wallet-sdk":()=>i0(()=>Promise.all([i.e(994),i.e(929),i.e(545)]).then(i.bind(i,2172))),"@stripe/stripe-js":()=>i0(()=>i.e(279).then(i.bind(i,7544)))}})}}let i3=function(){let t,e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!i)return{track:async t=>{await t()},isUnloading:()=>!1};let r=(t=!1,e=()=>t=!0,{startListening:()=>{window.addEventListener("beforeunload",e),window.addEventListener(ii,e)},stopListening:()=>{window.removeEventListener("beforeunload",e),window.removeEventListener(ii,e)},isUnloading:()=>t});return{track:async t=>{r.startListening(),await t(),r.stopListening()},isUnloading:r.isUnloading}};function i8(t){let e=new Date(t||new Date);return e instanceof Date&&!isNaN(e.getTime())?e:new Date}let i5=t=>({amount:t.amount,amountFormatted:t.amount_formatted,currency:t.currency,currencySymbol:t.currency_symbol}),i6=t=>({quantity:t.quantity,feePerBlock:i5(t.fee_per_block),total:i5(t.total)}),i4=t=>t.map(t=>({name:t.name,blockSize:t.block_size,tiers:t.tiers.map(i6)})),i9=t=>({name:t.name,blockSize:t.block_size,tiers:t.tiers.map(t=>({id:t.id,startsAtBlock:t.starts_at_block,endsAfterBlock:t.ends_after_block,feePerBlock:i5(t.fee_per_block)}))}),i7=t=>({proration:t.proration?{amount:i5(t.proration.amount),cycleDaysRemaining:t.proration.cycle_days_remaining,cycleDaysTotal:t.proration.cycle_days_total,cycleRemainingPercent:t.proration.cycle_remaining_percent}:null,payer:t.payer?{remainingBalance:i5(t.payer.remaining_balance),appliedAmount:i5(t.payer.applied_amount)}:null,total:i5(t.total)}),rt=t=>({proration:t.proration?{amount:i5(t.proration.amount),cycleDaysPassed:t.proration.cycle_days_passed,cycleDaysTotal:t.proration.cycle_days_total,cyclePassedPercent:t.proration.cycle_passed_percent}:null,total:i5(t.total)}),re=t=>({subtotal:i5(t.subtotal),baseFee:i5(t.base_fee),taxTotal:i5(t.tax_total),grandTotal:i5(t.grand_total),perUnitTotals:t.per_unit_totals?i4(t.per_unit_totals):void 0}),ri=t=>({subtotal:i5(t.subtotal),baseFee:t.base_fee?i5(t.base_fee):null,taxTotal:i5(t.tax_total),grandTotal:i5(t.grand_total),totalDueAfterFreeTrial:t.total_due_after_free_trial?i5(t.total_due_after_free_trial):null,credit:t.credit?i5(t.credit):t.credit,credits:t.credits?i7(t.credits):null,discounts:t.discounts?rt(t.discounts):null,pastDue:t.past_due?i5(t.past_due):t.past_due,totalDueNow:t.total_due_now?i5(t.total_due_now):void 0,perUnitTotals:t.per_unit_totals?i4(t.per_unit_totals):void 0,totalsDuePerPeriod:t.totals_due_per_period?re(t.totals_due_per_period):void 0,totalDuePerPeriod:t.total_due_per_period?i5(t.total_due_per_period):void 0}),rr=t=>({amount:i5(t.amount),date:i8(t.date),perUnitTotals:t.per_unit_totals?i4(t.per_unit_totals):void 0,totals:t.totals?ri(t.totals):void 0});function rn(t){return decodeURIComponent(globalThis.atob(t.replace(/_/g,"/").replace(/-/g,"+")).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}function rs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.errors&&!!t.errors.find(t=>t.code===e)}let ra=tY({packageName:"@clerk/clerk-js"});function ro(t){let e=(t||"").split("."),[i,r,n]=e;if(3!==e.length||!i||!r||!n)throw Error("JWT could not be decoded");let s=JSON.parse(rn(r)),a={__raw:t};return Object.keys(s).forEach(t=>{a[t]=s[t]}),{encoded:{header:i,payload:r,signature:n},header:JSON.parse(rn(i)),claims:a}}function rl(){if(!tI())return null;try{var t;let e=null==(t=navigator)?void 0:t.language;if(!e||"string"!=typeof e||""===e.trim())return null;return e}catch{return null}}function rc(){return void 0!==globalThis.document}function ru(){if(!function(){if(!rc())return!1;try{return window.self!==window.top}catch{return!0}}())return!1;try{var t;return null==(t=window.top)||t.location.href,!1}catch{return!0}}i(2033);let rh={build:(t,e,i)=>[t,e,i].filter(Boolean).join("-"),parse:(t,e,i)=>{let r=rh.extractTemplate(t,e,i);return{organizationId:i,sessionId:e,template:r}},extractTemplate:(t,e,i)=>{if(t===e||i&&t==="".concat(e,"-").concat(i))return;let r=t.slice(e.length+1);return i&&r.endsWith("-".concat(i))&&(r=r.slice(0,-(i.length+1))),r||void 0}};function rd(t,e){return e.get?e.get.call(t):e.value}function rp(t,e){if(void 0===t)throw TypeError("attempted to "+e+" private static field before its declaration")}function rf(t,e){var i=function(t,e){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return e.get(t)}(t,e);return rd(t,i)}function r_(t,e,i){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object");e.set(t,i)}function rg(t,e,i){return rv(t,e),rp(i,"get"),rd(t,i)}function rv(t,e){if(t!==e)throw TypeError("Private static access of wrong provenance")}var rm=(tl=new WeakMap,tc=new WeakMap,tu=new WeakMap,th=class t{static getInstance(){return rg(t,th,td)||function(t,e,i,r){rv(t,e),rp(i,"set");if(i.set)i.set.call(t,r);else{if(!i.writable)throw TypeError("attempted to set read only private field");i.value=r}}(t,th,td,new t),rg(t,th,td)}constructor(){if(r_(this,tl,{writable:!0,value:[]}),r_(this,tc,{writable:!0,value:{metamask:"MetaMask",okx_wallet:"OKX Wallet"}}),!function(t,e){"get"in t?Object.defineProperty(t,"get",{value:e,enumerable:!0,configurable:!0,writable:!0}):t.get=e}(this,t=>{var e;let i=null==(e=rf(this,tl).find(e=>e.info.name===rf(this,tc)[t]))?void 0:e.provider;return void 0!==i?i:window.ethereum}),r_(this,tu,{writable:!0,value:t=>{rf(this,tl).some(e=>e.info.uuid===t.detail.info.uuid)||rf(this,tl).push(t.detail)}}),"u"<typeof window)return;window.addEventListener("eip6963:announceProvider",rf(this,tu)),window.dispatchEvent(new Event("eip6963:requestProvider"))}},td={writable:!0,value:null},th);function ry(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function rw(t,e){return e.get?e.get.call(t):e.value}function rb(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw TypeError("attempted to set read only private field");e.value=i}}function rk(t,e){if(void 0===t)throw TypeError("attempted to "+e+" private static field before its declaration")}function rS(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function rA(t,e){var i=rS(t,e,"get");return rw(t,i)}function rI(t,e,i){ry(t,e),e.set(t,i)}function rC(t,e,i){var r=rS(t,e,"set");return rb(t,r,i),i}function rU(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function rx(t,e){ry(t,e),e.add(t)}function rE(t,e,i){return rP(t,e),rk(i,"get"),rw(t,i)}function rP(t,e){if(t!==e)throw TypeError("Private static access of wrong provenance")}var rT=(tp=new WeakMap,tf=new WeakMap,t_=new WeakSet,tg=new WeakSet,tv=new WeakSet,tm=class t{static getInstance(){var e,i,r;return rE(t,tm,ty)||(e=tm,i=ty,r=new t,rP(t,e),rk(i,"set"),rb(t,i,r)),rE(t,tm,ty)}constructor(){rx(this,t_),rx(this,tg),rx(this,tv),rI(this,tp,{writable:!0,value:void 0}),rI(this,tf,{writable:!0,value:!1}),function(t,e){"get"in t?Object.defineProperty(t,"get",{value:e,enumerable:!0,configurable:!0,writable:!0}):t.get=e}(this,async t=>{await rU(this,t_,rO).call(this);let e=(rA(this,tp)||[]).find(e=>e.name===t&&rU(this,tg,rR).call(this,e)&&rU(this,tv,rM).call(this,e));if(e&&rU(this,tg,rR).call(this,e))return e;if("u"<typeof window)return;let i=window.solana;if(i&&"function"==typeof i.connect&&"function"==typeof i.signMessage)return i})}},ty={writable:!0,value:null},tm);async function rO(){if(rA(this,tf))return;rC(this,tf,!0);let t=await i.e(494).then(i.bind(i,1629)).then(t=>t.getWallets());rC(this,tp,t.get()),t.on("register",()=>{rC(this,tp,t.get())}),t.on("unregister",()=>{rC(this,tp,t.get())})}function rR(t){var e,i;return null!=(e=null==(i=t.chains)?void 0:i.some(t=>t.startsWith("solana:")))&&e}function rM(t){return"solana:signMessage"in t.features}let rN=()=>(function(t){let e=tY({packageName:"@clerk/shared"});async function i(t){let{provider:e,walletName:i}=t,r=await f(e,i);if(!r)return"";if("solana"===e){let t=await r.features["standard:connect"].connect();return t&&t.accounts[0].address||""}let n=await r.request({method:"eth_requestAccounts"});return n&&n[0]||""}let r=async t=>{let{identifier:e,nonce:i,provider:r,walletName:n=""}=t,s=await f(r,n);if(!s)return"";if("solana"===r)try{var a,o;let t=s.accounts.find(t=>t.address===e);if(!t)return console.warn("Wallet account with address ".concat(e," not found")),"";let r=await (null==(a=s.features["solana:signMessage"])?void 0:a.signMessage({account:t,message:new TextEncoder().encode(i)}));return(null==r||null==(o=r[0])?void 0:o.signature)?btoa(String.fromCharCode(...r[0].signature)):""}catch(t){if(t instanceof Error&&t.message.includes("User rejected the request."))throw new tL("Web3 signature request was rejected by the user.",{code:"web3_signature_request_rejected"});throw new tL("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:t instanceof Error?t:void 0})}return await s.request({method:"personal_sign",params:["0x".concat(i.split("").map(t=>t.charCodeAt(0).toString(16).padStart(2,"0")).join("")),e]})};async function n(){return await i({provider:"metamask"})}async function s(){return await i({provider:"coinbase_wallet"})}async function a(){return await i({provider:"okx_wallet"})}async function o(){return await i({provider:"base"})}async function l(t){return await i({provider:"solana",walletName:t})}async function c(t){return await r({...t,provider:"metamask"})}async function u(t){return await r({...t,provider:"coinbase_wallet"})}async function h(t){return await r({...t,provider:"okx_wallet"})}async function d(t){return await r({...t,provider:"base"})}async function p(t){return await r({...t,provider:"solana"})}async function f(i,r){var n,s,a,o,l,c;if("coinbase_wallet"===i){let e=await t.import("@coinbase/wallet-sdk");return e?e.createCoinbaseWalletSDK({appName:"u">typeof window&&(null==(a=window.Clerk)||null==(s=a.__internal_environment)||null==(n=s.displayConfig)?void 0:n.applicationName)||"u">typeof document&&document.title||"Web3 Application",preference:{options:"all"}}).getProvider():null}if("base"===i)try{let e=await t.import("@base-org/account");if(!e)return null;return e.createBaseAccountSDK({appName:"u">typeof window&&(null==(c=window.Clerk)||null==(l=c.__internal_environment)||null==(o=l.displayConfig)?void 0:o.applicationName)||"u">typeof document&&document.title||"Web3 Application"}).getProvider()}catch{return null}return"solana"===i?r&&0!==r.length?await rT.getInstance().get(r):void e.throw("Wallet name must be provided to get Solana wallet provider"):rm.getInstance().get(i)}return{getWeb3Identifier:i,generateWeb3Signature:r,getMetamaskIdentifier:n,getCoinbaseWalletIdentifier:s,getOKXWalletIdentifier:a,getBaseIdentifier:o,getSolanaIdentifier:l,generateSignatureWithMetamask:c,generateSignatureWithCoinbaseWallet:u,generateSignatureWithOKXWallet:h,generateSignatureWithBase:d,generateSignatureWithSolana:p}})(new i2),rz="environment",rW=JSON.stringify,rD=JSON.parse;class rF{static _key(t){return"".concat("__clerk_").concat(t)}static isExpired(t){return!!t.exp&&Date.now()>t.exp}static setItem(t,e,i){try{let r={value:e,...i&&{exp:Date.now()+i}};window.localStorage.setItem(this._key(t),rW(r))}catch{}}static getItem(t,e){try{var i;let r=window.localStorage.getItem(this._key(t));if(!r)return e;let n=rD(r);if(!n)return e;if(this.isExpired(n))return this.removeItem(t),e;return null!=(i=null==n?void 0:n.value)?i:e}catch{return e}}static removeItem(t){try{window.localStorage.removeItem(this._key(t))}catch{}}}i(6449);let rL="ClerkJS:";function rj(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";throw Error("".concat(rL," Something went wrong initializing Clerk in development mode.").concat(t&&" ".concat(t)))}function rB(t){throw Error("".concat(rL," Something went wrong initializing Clerk during the ").concat(t," flow. Please contact support."))}function rV(t){throw Error("".concat(rL," You need to start a ").concat(t," flow by calling ").concat(t,".create() first."))}function rJ(t,e){throw Error("".concat(rL,' Strategy "').concat(e,'" is not a valid strategy for ').concat(t,"."))}function rK(t){throw Error("".concat(rL," You need to start a ").concat(t," flow by calling ").concat(t,".create({ identifier: 'your web3 wallet address' }) first"))}function rq(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";throw Error("".concat(rL," Missing '").concat(t,"' option"))}function rH(t,e){throw Error("".concat(rL," Response: ").concat(t||0," not supported yet.\nFor more information contact us at ").concat(e))}function rG(t){throw Error("".concat(rL," Calling ").concat(t,".reload is not currently supported. Please contact support."))}function rY(t){throw Error("".concat(rL," Missing publicKey. When calling 'navigator.credentials.").concat(t,"()' it is required to pass a publicKey object."))}async function r$(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,{async:i,defer:r,beforeLoad:n,crossOrigin:s,nonce:a}=e||{};return iZ(()=>new Promise((e,o)=>{t||o(Error("loadScript cannot be called without a src")),document&&document.body||o(Error("loadScript cannot be called when document does not exist"));let l=document.createElement("script");s&&l.setAttribute("crossorigin",s),l.async=i||!1,l.defer=r||!1,l.addEventListener("load",()=>{l.remove(),e(l)}),l.addEventListener("error",e=>{var i;l.remove(),o(null!=(i=e.error)?