PageSourceSearch

https://caliwmace.pl/_next/static/chunks/df133f68.fd678aa8ffc624b2.js

js caliwmace.pl collected 2026-10-02 02:06:34 UTC 87,762 bytes, 7 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[500],{1662:(e,t,r)=>{r.d(t,{Bs:()=>rO,nr:()=>ru,y3:()=>tK});var s,i,a=r(4018),n=r(4976),o=r(141),d=r(6513),c=r(1825),u=r(8373),h=r(2120),l=r(6337),p=r(9597),m=r(9982),y=(0,d.P$)({"../../node_modules/.pnpm/[email protected]/node_modules/cookie/dist/index.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parse=function(e,t){let r=new n,s=e.length;if(s<2)return r;let i=t?.decode||c,a=0;do{let t=e.indexOf("=",a);if(-1===t)break;let n=e.indexOf(";",a),c=-1===n?s:n;if(t>c){a=e.lastIndexOf(";",t-1)+1;continue}let u=o(e,a,t),h=d(e,t,u),l=e.slice(u,h);if(void 0===r[l]){let s=o(e,t+1,c),a=d(e,c,s),n=i(e.slice(s,a));r[l]=n}a=c+1}while(a<s);return r},e.serialize=function(e,n,o){let d=o?.encode||encodeURIComponent;if(!t.test(e))throw TypeError(`argument name is invalid: ${e}`);let c=d(n);if(!r.test(c))throw TypeError(`argument val is invalid: ${n}`);let u=e+"="+c;if(!o)return u;if(void 0!==o.maxAge){if(!Number.isInteger(o.maxAge))throw TypeError(`option maxAge is invalid: ${o.maxAge}`);u+="; Max-Age="+o.maxAge}if(o.domain){if(!s.test(o.domain))throw TypeError(`option domain is invalid: ${o.domain}`);u+="; Domain="+o.domain}if(o.path){if(!i.test(o.path))throw TypeError(`option path is invalid: ${o.path}`);u+="; Path="+o.path}if(o.expires){var h;if(h=o.expires,"[object Date]"!==a.call(h)||!Number.isFinite(o.expires.valueOf()))throw TypeError(`option expires is invali
1d: ${o.expires}`);u+="; Expires="+o.expires.toUTCString()}if(o.httpOnly&&(u+="; HttpOnly"),o.secure&&(u+="; Secure"),o.partitioned&&(u+="; Partitioned"),o.priority)switch("string"==typeof o.priority?o.priority.toLowerCase():void 0){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${o.priority}`)}if(o.sameSite)switch("string"==typeof o.sameSite?o.sameSite.toLowerCase():o.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${o.sameSite}`)}return u};var t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,r=/^[\u0021-\u003A\u003C-\u007E]*$/,s=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,n=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function o(e,t,r){do{let r=e.charCodeAt(t);if(32!==r&&9!==r)return t}while(++t<r);return r}function d(e,t,r){for(;t>r;){let r=e.charCodeAt(--t);if(32!==r&&9!==r)return t+1}return r}function c(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(t){return e}}}}),f="https://api.clerk.com",k="@clerk/[email protected]",g="2025-11-10",_={Session:"__session",Refresh:"__refresh",ClientUat:"__client_uat",Handshake:"__clerk_handshake",DevBrowser:"__clerk_db_jwt",RedirectCount:"__clerk_redirect_count",HandshakeNonce:"__clerk_handshake_nonce"},S={ClerkSynced:"__clerk_synced",SuffixedCookies:"suffixed_cookies",ClerkRedirectUrl:"__clerk_redirect_url",DevBrowser:_.DevBrowser,Handshake:_.Handshake,HandshakeHelp:"__clerk_help",LegacyDevBrowser:"__dev_session",HandshakeReason:"__clerk_hs_reason",HandshakeNonce:_.HandshakeNonce,HandshakeFormat:"format",Session:"__session"},T={Cookies:_,Headers:{Accept:"accept",AuthMessage:"x-clerk-auth-message",Authorization:"authorization",AuthReason:"x-clerk-auth-reason",AuthSignature:"x-clerk-auth-signature",AuthStatus:"x-clerk-auth-status",AuthToken:"x-clerk-auth-token",CacheControl:"cache-control",ClerkRedirectTo:"x-clerk-redirect-to",ClerkRequestData:"x-clerk-request-data",ClerkUrl:"x-clerk-clerk-url",CloudFrontForwardedProto:"cloudfront-forwarded-proto",ContentType:"content-type",ContentSecurityPolicy:"content-security-policy",ContentSecurityPolicyReportOnly:"content-security-policy-report-only",EnableDebug:"x-clerk-debug",ForwardedHost:"x-forwarded-host",ForwardedPort:"x-forwarded-port",ForwardedProto:"x-forwarded-proto",Host:"host",Location:"location",Nonce:"x-nonce",Origin:"origin",Referrer:"referer",SecFetchDest:"sec-fetch-dest",SecFetchSite:"sec-fetch-site",UserAgent:"user-agent",ReportingEndpoints:"reporting-endpoints"},ContentTypes:{Json:"application/json"},QueryParameters:S};function b(e,t){return Object.keys(e).reduce((e,r)=>({...e,[r]:t[r]||e[r]}),{...e})}function w(e){if(!e||"string"!=typeof e)throw Error("Missing Clerk Secret Key. Go to https://dashboard.clerk.com and get your key for your instance.")}var A={SessionToken:"session_token",ApiKey:"api_key",M2MToken:"m2m_token",OAuthToken:"oauth_token"},I=class{constructor(e,t,r){this.cookieSuffix=e,this.clerkRequest=t,this.originalFrontendApi="",r.acceptsToken===A.M2MToken||r.acceptsToken===A.ApiKey?this.initHeaderValues():(this.initPublishableKeyValues(r),this.initHeaderValues(),this.initCookieValues(),this.initHandshakeValues()),Object.assign(this,r),this.clerkUrl=this.clerkRequest.clerkUrl}get sessionToken(){return this.sessionTokenInCookie||this.tokenInHeader}usesSuffixedCookies(){let e=this.getSuffixedCookie(T.Cookies.ClientUat),t=this.getCookie(T.Cookies.ClientUat),r=this.getSuffixedCookie(T.Cookies.Session)||"",s=this.getCookie(T.Cookies.Session)||"";if(s&&!this.tokenHasIssuer(s))return!1;if(s&&!this.tokenBelongsToInstance(s))return!0;if(!e&&!r)return!1;let{data:i}=(0,n.iU)(s),a=i?.payload.iat||0,{data:o}=(0,n.iU)(r),d=o?.payload.iat||0;if("0"!==e&&"0"!==t&&a>d||"0"===e&&"0"!==t)return!1;if("production"!==this.instanceType){let r=this.sessionExpired(o);if("0"!==e&&"0"===t&&r)return!1}return!!e||!r}isCrossOriginReferrer(){if(!this.referrer||!this.clerkUrl.origin)return!1;try{return new URL(this.referrer).origin!==this.clerkUrl.origin}catch{return!1}}isKnownClerkReferrer(){if(!this.referrer)return!1;try{let e=new URL(this.referrer),t=e.hostname;if(this.frontendApi){let e=this.frontendApi.startsWith("http")?new URL(this.frontendApi).hostname:this.frontendApi;if(t===e)return!0}if((0,u.sB)(t)||(0,u.Ab)(t))return!0;let r=(0,c.j)(this.frontendApi);if(r){let t=new URL(r).origin;if(e.origin===t)return!0}if(t.startsWith("accounts."))return!0;return!1}catch{return!1}}initPublishableKeyValues(e){var t;t=e.publishableKey,(0,a.q5)(t,{fatal:!0}),this.publishableKey=e.publishableKey;let r=(0,a.q5)(this.publishableKey,{fatal:!0,domain:e.domain,isSatellite:e.isSatellite});this.originalFrontendApi=r.frontendApi;let s=(0,a.q5)(this.publishableKey,{fatal:!0,proxyUrl:e.proxyUrl,domain:e.domain,isSatellite:e.isSatellite});this.instanceType=s.instanceType,this.frontendApi=s.frontendApi}initHeaderValues(){this.tokenInHeader=this.parseAuthorizationHeader(this.getHeader(T.Headers.Authorization)),this.origin=this.getHeader(T.Headers.Origin),this.host=this.getHeader(T.Headers.Host),this.forwardedHost=this.getHeader(T.Headers.ForwardedHost),this.forwardedProto=this.getHeader(T.Headers.CloudFrontForwardedProto)||this.getHeader(T.Headers.ForwardedProto),this.referrer=this.getHeader(T.Headers.Referrer),this.userAgent=this.getHeader(T.Headers.UserAgent),this.secFetchDest=this.getHeader(T.Headers.SecFetchDest),this.accept=this.getHeader(T.Headers.Accept)}initCookieValues(){this.sessionTokenInCookie=this.getSuffixedOrUnSuffixedCookie(T.Cookies.Session),this.refreshTokenInCookie=this.getSuffixedCookie(T.Cookies.Refresh),this.clientUat=Number.parseInt(this.getSuffixedOrUnSuffixedCookie(T.Cookies.ClientUat)||"")||
10}initHandshakeValues(){this.devBrowserToken=this.getQueryParam(T.QueryParameters.DevBrowser)||this.getSuffixedOrUnSuffixedCookie(T.Cookies.DevBrowser),this.handshakeToken=this.getQueryParam(T.QueryParameters.Handshake)||this.getCookie(T.Cookies.Handshake),this.handshakeRedirectLoopCounter=Number(this.getCookie(T.Cookies.RedirectCount))||0,this.handshakeNonce=this.getQueryParam(T.QueryParameters.HandshakeNonce)||this.getCookie(T.Cookies.HandshakeNonce)}getQueryParam(e){return this.clerkRequest.clerkUrl.searchParams.get(e)}getHeader(e){return this.clerkRequest.headers.get(e)||void 0}getCookie(e){return this.clerkRequest.cookies.get(e)||void 0}getSuffixedCookie(e){return this.getCookie((0,a.ky)(e,this.cookieSuffix))||void 0}getSuffixedOrUnSuffixedCookie(e){return this.usesSuffixedCookies()?this.getSuffixedCookie(e):this.getCookie(e)}parseAuthorizationHeader(e){if(!e)return;let[t,r]=e.split(" ",2);return r?"Bearer"===t?r:void 0:t}tokenHasIssuer(e){let{data:t,errors:r}=(0,n.iU)(e);return!r&&!!t.payload.iss}tokenBelongsToInstance(e){if(!e)return!1;let{data:t,errors:r}=(0,n.iU)(e);if(r)return!1;let s=t.payload.iss.replace(/https?:\/\//gi,"");return this.originalFrontendApi===s}sessionExpired(e){return!!e&&e?.payload.exp<=(Date.now()/1e3|0)}},v=async(e,t)=>new I(t.publishableKey?await (0,a.qS)(t.publishableKey,n.fA.crypto.subtle):"",e,t),O=RegExp("(?<!:)/{1,}","g");function q(...e){return e.filter(e=>e).join("/").replace(O,"/")}var P=class{constructor(e){this.request=e}requireId(e){if(!e)throw Error("A valid resource ID is required.")}},C="/actor_tokens",x=class extends P{async create(e){return this.request({method:"POST",path:C,bodyParams:e})}async revoke(e){return this.requireId(e),this.request({method:"POST",path:q(C,e,"revoke")})}},E="/accountless_applications",U=class extends P{async createAccountlessApplication(e){let t=e?.requestHeaders?Object.fromEntries(e.requestHeaders.entries()):void 0;return this.request({method:"POST",path:E,headerParams:t})}async completeAccountlessApplicationOnboarding(e){let t=e?.requestHeaders?Object.fromEntries(e.requestHeaders.entries()):void 0;return this.request({method:"POST",path:q(E,"complete"),headerParams:t})}},N="/allowlist_identifiers",J=class extends P{async getAllowlistIdentifierList(e={}){return this.request({method:"GET",path:N,queryParams:{...e,paginated:!0}})}async createAllowlistIdentifier(e){return this.request({method:"POST",path:N,bodyParams:e})}async deleteAllowlistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:q(N,e)})}},z="/api_keys",H=class extends P{async list(e){return this.request({method:"GET",path:z,queryParams:e})}async create(e){return this.request({method:"POST",path:z,bodyParams:e})}async get(e){return this.requireId(e),this.request({method:"GET",path:q(z,e)})}async update(e){let{apiKeyId:t,...r}=e;return this.requireId(t),this.request({method:"PATCH",path:q(z,t),bodyParams:r})}async delete(e){return this.requireId(e),this.request({method:"DELETE",path:q(z,e)})}async revoke(e){let{apiKeyId:t,revocationReason:r=null}=e;return this.requireId(t),this.request({method:"POST",path:q(z,t,"revoke"),bodyParams:{revocationReason:r}})}async getSecret(e){return this.requireId(e),this.request({method:"GET",path:q(z,e,"secret")})}async verify(e){return this.request({method:"POST",path:q(z,"verify"),bodyParams:{secret:e}})}async verifySecret(e){return(0,a.io)("apiKeys.verifySecret()","Use `apiKeys.verify()` instead."),this.verify(e)}},M=class extends P{async changeDomain(e){return this.request({method:"POST",path:q("/beta_features","change_domain"),bodyParams:e})}},F="/blocklist_identifiers",j=class extends P{async getBlocklistIdentifierList(e={}){return this.request({method:"GET",path:F,queryParams:e})}async createBlocklistIdentifier(e){return this.request({method:"POST",path:F,bodyParams:e})}async deleteBlocklistIdentifier(e){return this.requireId(e),this.request({method:"DELETE",path:q(F,e)})}},R="/clients",L=class extends P{async getClientList(e={}){return this.request({method:"GET",path:R,queryParams:{...e,paginated:!0}})}async getClient(e){return this.requireId(e),this.request({method:"GET",path:q(R,e)})}verifyClient(e){return this.request({method:"POST",path:q(R,"verify"),bodyParams:{token:e}})}async getHandshakePayload(e){return this.request({method:"GET",path:q(R,"handshake_payload"),queryParams:e})}},D="/domains",K=class extends P{async list(){return this.request({method:"GET",path:D})}async add(e){return this.request({method:"POST",path:D,bodyParams:e})}async update(e){let{domainId:t,...r}=e;return this.requireId(t),this.request({method:"PATCH",path:q(D,t),bodyParams:r})}async delete(e){return this.deleteDomain(e)}async deleteDomain(e){return this.requireId(e),this.request({method:"DELETE",path:q(D,e)})}},B="/email_addresses",W=class extends P{async getEmailAddress(e){return this.requireId(e),this.request({method:"GET",path:q(B,e)})}async createEmailAddress(e){return this.request({method:"POST",path:B,bodyParams:e})}async updateEmailAddress(e,t={}){return this.requireId(e),this.request({method:"PATCH",path:q(B,e),bodyParams:t})}async deleteEmailAddress(e){return this.requireId(e),this.request({method:"DELETE",path:q(B,e)})}},G=class extends P{async verify(e){return this.request({method:"POST",path:q("/oauth_applications/access_tokens","verify"),bodyParams:{access_token:e}})}async verifyAccessToken(e){return(0,a.io)("idPOAuthAccessToken.verifyAccessToken()","Use `idPOAuthAccessToken.verify()` instead."),this.verify(e)}},$="/instance",V=class extends P{async get(){return this.request({method:"GET",path:$})}async update(e){return this.request({method:"PATCH",path:$,bodyParams:e})}async updateRestrictions(e){return this.request({method:"PATCH",path:q($,"restrictions"),bodyParams:e})}async updateOrganizationSettings(e){return this.request({method:"PATCH",path:q($,"organization_settings"),bodyParams:e})}},Q="/invitations",Y=class extends P{async getInvitationList(e={}){return this.request({method:"GET",path:Q,queryParams:{...e,paginated:!0}})}async createInvitation(e){return this.request({method:"POST",path:Q,bodyParams:e})}async createInvitationBulk(e){return this.request({method:"POST",path:q(Q,"bulk"),bodyParams:e})}async revokeInvitation(e){return this.requireId(e),this.request({method:"POST",path:q(Q,e,"revoke")})}},Z="/machines",X=class extends P{async get(e){return this.requireId(e),this.request({method:"GET",path:q(Z,e)})}async list(e={}){return this.request({method:"GET",path:Z,queryParams:e})}async create(e){return this.request({method:"POST",path:Z,bodyParams:e})}async update(e){let{machineId:t,...r}=e;return this.requireId(t),this.request({method:"PATCH",path:q(Z,t),bodyParams:r})}async delete(e){return this.requireId(e),this.request({method:"DELETE",path:q(Z,e)})}async getSecretKey(e){return this.requireId(e),this.request({method:"GET",path:q(Z,e,"secret_key")})}async rotateSecretKey(e){let{machineId:t,previousTokenTtl:r}=e;return this.requireId(t),this.request({method:"POST",path:q(Z,t,"secret_key","rotate"),bodyParams:{previousTokenTtl:r}})}async createScope(e,t){return this.requireId(e),this.request({method:"POST",path:q(Z,e,"scopes"),bodyParams:{toMachineId:t}})}async deleteScope(e,t){return this.requireId(e),this.request({method:"DELETE",path:q(Z,e,"scopes",t)})}},ee="/m2m_tokens",et=class extends P{constructor(){super(...arguments),(0,d.VK)(this,s)}async createToken(e){let{claims:t=null,machineSecretKey:r,secondsUntilExpiration:a=null}=e||{},n=(0,d.jq)(this,s,i).call(this,{method:"POST",path:ee,bodyParams:{secondsUntilExpiration:a,claims:t}},r);return this.request(n)}async revokeToken(e){let{m2mTokenId:t,revocationReason:r=null,machineSecretKey:a}=e;this.requireId(t);let n=(0,d.jq)(this,s,i).call(this,{method:"POST",path:q(ee,t,"revoke"),bodyParams:{revocationReason:r}},a);return this.request(n)}async verify(e){let{token:t,machineSecretKey:r}=e,a=(0,d.jq)(this,s,i).call(this,{method:"POST",path:q(ee,"verify"),bodyParams:{token:t}},r);return this.request(a)}async verifyToken(e){return(0,a.io)("m2m.verifyToken()","Use `m2m.verify()` instead."),this.verify(e)}};s=new WeakSet,i=function(e,t){return t?{...e,headerParams:{...e.headerParams,Authorization:`Bearer ${t}`}}:e};var er=class extends P{async getJwks(){return this.request({method:"GET",path:"/jwks"})}},es="/jwt_templates",ei=class extends P{async list(e={}){return this.request({method:"GET",path:es,queryParams:{...e,paginated:!0}})}async get(e){return this.requireId(e),this.request({method:"GET",path:q(es,e)})}async create(e){return this.request({method:"POST",path:es,bodyParams:e})}async update(e){let{templateId:t,...r}=e;return this.requireId(t),this.request({method:"PATCH",path:q(es,t),bodyParams:r})}async delete(e){return this.requireId(e),this.request({method:"DELETE",path:q(es,e)})}},ea="/organizations",en=class extends P{async getOrganizationList(e){return this.request({method:"GET",path:ea,queryParams:e})}async createOrganization(e){return this.request({method:"POST",path:ea,bodyParams:e})}async getOrganization(e){let{includeMembersCount:t}=e,r="organizationId"in e?e.organizationId:e.slug;return this.requireId(r),this.request({method:"GET",path:q(ea,r),queryParams:{includeMembersCount:t}})}async updateOrganization(e,t){return this.requireId(e),this.request({method:"PATCH",path:q(ea,e),bodyParams:t})}async updateOrganizationLogo(e,t){this.requireId(e);let r=new n.fA.FormData;return r.append("file",t?.file),t?.uploaderUserId&&r.append("uploader_user_id",t?.uploaderUserId),this.request({method:"PUT",path:q(ea,e,"logo"),formData:r})}async deleteOrganizationLogo(e){return this.requireId(e),this.request({method:"DELETE",path:q(ea,e,"logo")})}async updateOrganizationMetadata(e,t){return this.requireId(e),this.request({method:"PATCH",path:q(ea,e,"metadata"),bodyParams:t})}async deleteOrganization(e){return this.request({method:"DELETE",path:q(ea,e)})}async getOrganizationMembershipList(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"GET",path:q(ea,t,"memberships"),queryParams:r})}async getInstanceOrganizationMembershipList(e){return this.request({method:"GET",path:"/organization_memberships",queryParams:e})}async createOrganizationMembership(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"POST",path:q(ea,t,"memberships"),bodyParams:r})}async updateOrganizationMembership(e){let{organizationId:t,userId:r,...s}=e;return this.requireId(t),this.request({method:"PATCH",path:q(ea,t,"memberships",r),bodyParams:s})}async updateOrganizationMembershipMetadata(e){let{organizationId:t,userId:r,...s}=e;return this.request({method:"PATCH",path:q(ea,t,"memberships",r,"metadata"),bodyParams:s})}async deleteOrganizationMembership(e){let{organizationId:t,userId:r}=e;return this.requireId(t),this.request({method:"DELETE",path:q(ea,t,"memberships",r)}
1)}async getOrganizationInvitationList(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"GET",path:q(ea,t,"invitations"),queryParams:r})}async createOrganizationInvitation(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"POST",path:q(ea,t,"invitations"),bodyParams:r})}async createOrganizationInvitationBulk(e,t){return this.requireId(e),this.request({method:"POST",path:q(ea,e,"invitations","bulk"),bodyParams:t})}async getOrganizationInvitation(e){let{organizationId:t,invitationId:r}=e;return this.requireId(t),this.requireId(r),this.request({method:"GET",path:q(ea,t,"invitations",r)})}async revokeOrganizationInvitation(e){let{organizationId:t,invitationId:r,...s}=e;return this.requireId(t),this.request({method:"POST",path:q(ea,t,"invitations",r,"revoke"),bodyParams:s})}async getOrganizationDomainList(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"GET",path:q(ea,t,"domains"),queryParams:r})}async createOrganizationDomain(e){let{organizationId:t,...r}=e;return this.requireId(t),this.request({method:"POST",path:q(ea,t,"domains"),bodyParams:{...r,verified:r.verified??!0}})}async updateOrganizationDomain(e){let{organizationId:t,domainId:r,...s}=e;return this.requireId(t),this.requireId(r),this.request({method:"PATCH",path:q(ea,t,"domains",r),bodyParams:s})}async deleteOrganizationDomain(e){let{organizationId:t,domainId:r}=e;return this.requireId(t),this.requireId(r),this.request({method:"DELETE",path:q(ea,t,"domains",r)})}},eo="/oauth_applications",ed=class extends P{async list(e={}){return this.request({method:"GET",path:eo,queryParams:e})}async get(e){return this.requireId(e),this.request({method:"GET",path:q(eo,e)})}async create(e){return this.request({method:"POST",path:eo,bodyParams:e})}async update(e){let{oauthApplicationId:t,...r}=e;return this.requireId(t),this.request({method:"PATCH",path:q(eo,t),bodyParams:r})}async delete(e){return this.requireId(e),this.request({method:"DELETE",path:q(eo,e)})}async rotateSecret(e){return this.requireId(e),this.request({method:"POST",path:q(eo,e,"rotate_secret")})}},ec="/phone_numbers",eu=class extends P{async getPhoneNumber(e){return this.requireId(e),this.request({method:"GET",path:q(ec,e)})}async createPhoneNumber(e){return this.request({method:"POST",path:ec,bodyParams:e})}async updatePhoneNumber(e,t={}){return this.requireId(e),this.request({method:"PATCH",path:q(ec,e),bodyParams:t})}async deletePhoneNumber(e){return this.requireId(e),this.request({method:"DELETE",path:q(ec,e)})}},eh=class extends P{async verify(e){return this.request({method:"POST",path:"/proxy_checks",bodyParams:e})}},el="/redirect_urls",ep=class extends P{async getRedirectUrlList(
1){return this.request({method:"GET",path:el,queryParams:{paginated:!0}})}async getRedirectUrl(e){return this.requireId(e),this.request({method:"GET",path:q(el,e)})}async createRedirectUrl(e){return this.request({method:"POST",path:el,bodyParams:e})}async deleteRedirectUrl(e){return this.requireId(e),this.request({method:"DELETE",path:q(el,e)})}},em="/saml_connections",ey=class extends P{async getSamlConnectionList(e={}){return this.request({method:"GET",path:em,queryParams:e})}async createSamlConnection(e){return this.request({method:"POST",path:em,bodyParams:e,options:{deepSnakecaseBodyParamKeys:!0}})}async getSamlConnection(e){return this.requireId(e),this.request({method:"GET",path:q(em,e)})}async updateSamlConnection(e,t={}){return this.requireId(e),this.request({method:"PATCH",path:q(em,e),bodyParams:t,options:{deepSnakecaseBodyParamKeys:!0}})}async deleteSamlConnection(e){return this.requireId(e),this.request({method:"DELETE",path:q(em,e)})}},ef="/sessions",ek=class extends P{async getSessionList(e={}){return this.request({method:"GET",path:ef,queryParams:{...e,paginated:!0}})}async getSession(e){return this.requireId(e),this.request({method:"GET",path:q(ef,e)})}async createSession(e){return this.request({method:"POST",path:ef,bodyParams:e})}async revokeSession(e){return this.requireId(e),this.request({method:"POST",path:q(ef,e,"revoke")})}async verifySession(e,t){return this.requireId(e),this.request({method:"POST",path:q(ef,e,"verify"),bodyParams:{token:t}})}async getToken(e,t,r){this.requireId(e);let s={method:"POST",path:t?q(ef,e,"tokens",t):q(ef,e,"tokens")};return void 0!==r&&(s.bodyParams={expires_in_seconds:r}),this.request(s)}async refreshSession(e,t){this.requireId(e);let{suffixed_cookies:r,...s}=t;return this.request({method:"POST",path:q(ef,e,"refresh"),bodyParams:s,queryParams:{suffixed_cookies:r}})}},eg="/sign_in_tokens",e_=class extends P{async createSignInToken(e){return this.request({method:"POST",path:eg,bodyParams:e})}async revokeSignInToken(e){return this.requireId(e),this.request({method:"POST",path:q(eg,e,"revoke")})}},eS="/sign_ups",eT=class extends P{async get(e){return this.requireId(e),this.request({method:"GET",path:q(eS,e)})}async update(e){let{signUpAttemptId:t,...r}=e;return this.request({method:"PATCH",path:q(eS,t),bodyParams:r})}},eb=class extends P{async createTestingToken(){return this.request({method:"POST",path:"/testing_tokens"})}},ew="/users",eA=class extends P{async getUserList(e={}){let{limit:t,offset:r,orderBy:s,...i}=e,[a,n]=await Promise.all([this.request({method:"GET",path:ew,queryParams:e}),this.getCount(i)]);return{data:a,totalCount:n}}async getUser(e){return this.requireId(e),this.request({method:"GET",path:q(ew,e)})}async createUser(e){return this.request({method:"POST",path:ew,bodyParams:e})}async updateUser(e,t={}){return this.requireId(e),this.request({method:"PATCH",path:q(ew,e),bodyParams:t})}async updateUserProfileImage(e,t){this.requireId(e);let r=new n.fA.FormData;return r.append("file",t?.file),this.request({method:"POST",path:q(ew,e,"profile_image"),formData:r})}async updateUserMetadata(e,t){return this.requireId(e),this.request({method:"PATCH",path:q(ew,e,"metadata"),bodyParams:t})}async deleteUser(e){return this.requireId(e),this.request({method:"DELETE",path:q(ew,e)})}async getCount(e={}){return this.request({method:"GET",path:q(ew,"count"),queryParams:e})}async getUserOauthAccessToken(e,t){this.requireId(e);let r=t.startsWith("oauth_"),s=r?t:`oauth_${t}`;return r&&(0,a.io)("getUserOauthAccessToken(userId, provider)","Remove the `oauth_` prefix from the `provider` argument."),this.request({method:"GET",path:q(ew,e,"oauth_access_tokens",s),queryParams:{paginated:!0}})}async disableUserMFA(e){return this.requireId(e),this.request({method:"DELETE",path:q(ew,e,"mfa")})}async getOrganizationMembershipList(e){let{userId:t,limit:r,offset:s}=e;return this.requireId(t),this.request({method:"GET",path:q(ew,t,"organization_memberships"),queryParams:{limit:r,offset:s}})}async getOrganizationInvitationList(e){let{userId:t,...r}=e;return this.requireId(t),this.request({method:"GET",path:q(ew,t,"organization_invitations"),queryParams:r})}async verifyPassword(e){let{userId:t,password:r}=e;return this.requireId(t),this.request({method:"POST",path:q(ew,t,"verify_password"),bodyParams:{password:r}})}async verifyTOTP(e){let{userId:t,code:r}=e;return this.requireId(t),this.request({method:"POST",path:q(ew,t,"verify_totp"),bodyParams:{code:r}})}async banUser(e){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"ban")})}async unbanUser(e){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"unban")})}async lockUser(e){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"lock")})}async unlockUser(e){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"unlock")})}async deleteUserProfileImage(e){return this.requireId(e),this.request({method:"DELETE",path:q(ew,e,"profile_image")})}async deleteUserPasskey(e){return this.requireId(e.userId),this.requireId(e.passkeyIdentificationId),this.request({method:"DELETE",path:q(ew,e.userId,"passkeys",e.passkeyIdentificationId)})}async deleteUserWeb3Wallet(e){return this.requireId(e.userId),this.requireId(e.web3WalletIdentificationId),this.request({method:"DELETE",path:q(ew,e.userId,"web3_wallets",e.web3WalletIdentificationId)})}async deleteUserExternalAccount(e){return this.requireId(e.userId),this.requireId(e.externalAccountId),this.request({method:"DELETE",path:q(ew,e.userId,"external_accounts",e.externalAccountId)})}async deleteUserBackupCodes(e){return this.requireId(e),this.request({method:"DELETE",path:q(ew,e,"backup_code")})}async deleteUserTOTP(e){return this.requireId(e),this.request({method:"DELETE",path:q(ew,e,"totp")})}async setPasswordCompromised(e,t={revokeAllSessions:!1}){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"password","set_compromised"),bodyParams:t})}async unsetPasswordCompromised(e){return this.requireId(e),this.request({method:"POST",path:q(ew,e,"password","unset_compromised")})}}
1,eI="/waitlist_entries",ev=class extends P{async list(e={}){return this.request({method:"GET",path:eI,queryParams:e})}async create(e){return this.request({method:"POST",path:eI,bodyParams:e})}async invite(e,t={}){return this.requireId(e),this.request({method:"POST",path:q(eI,e,"invite"),bodyParams:t})}async reject(e){return this.requireId(e),this.request({method:"POST",path:q(eI,e,"reject")})}async delete(e){return this.requireId(e),this.request({method:"DELETE",path:q(eI,e)})}},eO="/webhooks",eq=class extends P{async createSvixApp(){return this.request({method:"POST",path:q(eO,"svix")})}async generateSvixAuthURL(){return this.request({method:"POST",path:q(eO,"svix_url")})}async deleteSvixApp(){return this.request({method:"DELETE",path:q(eO,"svix")})}},eP="/billing",eC=class extends P{async getPlanList(e){return this.request({method:"GET",path:q(eP,"plans"),queryParams:e})}async cancelSubscriptionItem(e,t){return this.requireId(e),this.request({method:"DELETE",path:q(eP,"subscription_items",e),queryParams:t})}async extendSubscriptionItemFreeTrial(e,t){return this.requireId(e),this.request({method:"POST",path:q("/billing","subscription_items",e,"extend_free_trial"),bodyParams:t})}async getOrganizationBillingSubscription(e){return this.requireId(e),this.request({method:"GET",path:q("/organizations",e,"billing","subscription")})}async getUserBillingSubscription(e){return this.requireId(e),this.request({method:"GET",path:q("/users",e,"billing","subscription")})}},ex=e=>"object"==typeof e&&null!==e,eE=e=>ex(e)&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Date)&&!(globalThis.Blob&&e instanceof globalThis.Blob),eU=Symbol("mapObjectSkip"),eN=(e,t,r,s=new WeakMap)=>{if(r={deep:!1,target:{},...r},s.has(e))return s.get(e);s.set(e,r.target);let{target:i}=r;delete r.target;let a=e=>e.map(e=>eE(e)?eN(e,t,r,s):e);if(Array.isArray(e))return a(e);for(let[n,o]of Object.entries(e)){let d=t(n,o,e);if(d===eU)continue;let[c,u,{shouldRecurse:h=!0}={}]=d;"__proto__"!==c&&(r.deep&&h&&eE(u)&&(u=Array.isArray(u)?a(u):eN(u,t,r,s)),i[c]=u)}return i};function eJ(e,t,r){if(!ex(e))throw TypeError(`Expected an object, got \`${e}\` (${typeof e})`);if(Array.isArray(e))throw TypeError("Expected an object, got an array");return eN(e,t,r)}var ez=/([\p{Ll}\d])(\p{Lu})/gu,eH=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,eM=/(\d)\p{Ll}|(\p{L})\d/u,eF=/[^\p{L}\d]+/giu,ej="$1\0$2";function eR(e){let t=e.trim();t=(t=t.replace(ez,ej).replace(eH,ej)).replace(eF,"\0");let r=0,s=t.length;for(;"\0"===t.charAt(r);)r++;if(r===s)return[];for(;"\0"===t.charAt(s-1);)s--;return t.slice(r,s).split(/\0/g)}function eL(e){let t=eR(e);for(let e=0;e<t.length;e++){let r=t[e],s=eM.exec(r);if(s){let i=s.index+(s[1]??s[2]).length;t.splice(e,1,r.slice(0,i),r.slice(i))}}return t}function eD(e,t){var r,s={delimiter:"_",...t};let[i,a,n]=function(e,t={}){let r=t.split??(t.separateNumbers?eL:eR),s=t.prefixCharacters??"",i=t.suffixCharacters??"",a=0,n=e.length;for(;a<e.length;){let t=e.charAt(a);if(!s.includes(t))break;a++}for(;n>a;){let t=n-1,r=e.charAt(t);if(!i.includes(r))break;n=t}return[e.slice(0,a),r(e.slice(a,n)),e.slice(n)]}(e,s);return i+a.map(!1===(r=s?.locale)?e=>e.toLowerCase():e=>e.toLocaleLowerCase(r)).join(s?.delimiter??" ")+n}var eK={}.constructor;function eB(e,t){return e.some(e=>"string"==typeof e?e===t:e.test(t))}function eW(e,t,r){return r.shouldRecurse?{shouldRecurse:r.shouldRecurse(e,t)}:void 0}var eG=function(e,t){if(Array.isArray(e)){if(e.some(e=>e.constructor!==eK))throw Error("obj must be array of plain objects");let r=(t={deep:!0,exclude:[],parsingOptions:{},...t}).snakeCase||(e=>eD(e,t.parsingOptions));return e.map(e=>eJ(e,(e,s)=>[eB(t.exclude,e)?e:r(e),s,eW(e,s,t)],t))}if(e.constructor!==eK)throw Error("obj must be an plain object");let r=(t={deep:!0,exclude:[],parsingOptions:{},...t}).snakeCase||(e=>eD(e,t.parsingOptions));return eJ(e,(e,s)=>[eB(t.exclude,e)?e:r(e),s,eW(e,s,t)],t)},e$=class e{constructor(e,t,r,s){this.publishableKey=e,this.secretKey=t,this.claimUrl=r,this.apiKeysUrl=s}static fromJSON(t){return new e(t.publishable_key,t.secret_key,t.claim_url,t.api_keys_url)}},eV=class e{constructor(e,t,r,s,i,a,n,o){this.id=e,this.status=t,this.userId=r,this.actor=s,this.token=i,this.url=a,this.createdAt=n,this.updatedAt=o}static fromJSON(t){return new e(t.id,t.status,t.user_id,t.actor,t.token,t.url,t.created_at,t.updated_at)}},eQ=class e{constructor(e,t,r,s,i,a,n){this.id=e,this.identifier=t,this.identifierType=r,this.createdAt=s,this.updatedAt=i,this.instanceId=a,this.invitationId=n}static fromJSON(t){return new e(t.id,t.identifier,t.identifier_type,t.created_at,t.updated_at,t.instance_id,t.invitation_id)}},eY=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y){this.id=e,this.type=t,this.name=r,this.subject=s,this.scopes=i,this.claims=a,this.revoked=n,this.revocationReason=o,this.expired=d,this.expiration=c,this.createdBy=u,this.description=h,this.lastUsedAt=l,this.createdAt=p,this.updatedAt=m,this.secret=y}static fromJSON(t){return new e(t.id,t.type,t.name,t.subject,t.scopes,t.claims,t.revoked,t.revocation_reason,t.expired,t.expiration,t.created_by,t.description,t.last_used_at,t.created_at,t.updated_at,t.secret)}},eZ=class e{constructor(e,t,r,s,i,a){this.id=e,this.identifier=t,this.identifierType=r,this.createdAt=s,this.updatedAt=i,this.instanceId=a}static fromJSON(t){return new e(t.id,t.identifier,t.identifier_type,t.created_at,t.updated_at,t.instance_id)}},eX=class e{constructor(e,t,r,s,i,a,n,o){this.id=e,this.isMobile=t,this.ipAddress=r,this.city=s,this.country=i,this.browserVersion=a,this.browserName=n,this.deviceType=o}static fromJSON(t){return new e(t.id,t.is_mobile,t.ip_address,t.city,t.country,t.browser_version,t.browser_name,t.device_type)}},e0=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h=null){this.id=e,this.clientId=t,this.userId=r,this.status=s,this.lastActiveAt=i,this.expireAt=a,this.abandonAt=n,this.createdAt=o,this.updatedAt=d,this.lastActiveOrganizationId=c,this.latestActivity=u,this.actor=h}static fromJSON(t){return new e(t.id,t.client_id,t.user_id,t.status,t.last_active_at,t.expire_at,t.abandon_at,t.created_at,t.updated_at,t.last_active_organization_id,t.latest_activity&&eX.fromJSON(t.latest_activity),t.actor)}},e1=class e{constructor(e,t,r,s,i,a,n,o,d){this.id=e,this.sessionIds=t,this.sessions=r,this.signInId=s,this.signUpId=i,this.lastActiveSessionId=a,this.lastAuthenticationStrategy=n,this.createdAt=o,this.updatedAt=d}static fromJSON(t){return new e(t.id,t.session_ids,t.sessions.map(e=>e0.fromJSON(e)),t.sign_in_id,t.sign_up_id,t.last_active_session_id,t.last_authentication_strategy,t.created_at,t.updated_at)}},e2=class e{constructor(e,t,r){this.host=e,this.value=t,this.required=r}static fromJSON(t){return new e(t.host,t.value,t.required)}},e3=class e{constructor(e){this.cookies=e}static fromJSON(t){return new e(t.cookies)}},e5=class e{constructor(e,t,r,s){this.object=e,this.id=t,this.slug=r,this.deleted=s}static fromJSON(t){return new e(t.object,t.id||null,t.slug||null,t.deleted)}},e9=class e{constructor(e,t,r,s,i,a,n,o){this.id=e,this.name=t,this.isSatellite=r,this.frontendApiUrl=s,this.developmentOrigin=i,this.cnameTargets=a,this.accountsPortalUrl=n,this.proxyUrl=o}static fromJSON(t){return new e(t.id,t.name,t.is_satellite,t.frontend_api_url,t.development_origin,t.cname_targets&&t.cname_targets.map(e=>e2.fromJSON(e)),t.accounts_portal_url,t.proxy_url)}},e7=class e{constructor(e,t,r,s,i,a,n,o,d,c,u){this.id=e,this.fromEmailName=t,this.emailAddressId=r,this.toEmailAddress=s,this.subject=i,this.body=a,this.bodyPlain=n,this.status=o,this.slug=d,this.data=c,this.deliveredByClerk=u}static fromJSON(t){return new e(t.id,t.from_email_name,t.email_address_id,t.to_email_address,t.subject,t.body,t.body_plain,t.status,t.slug,t.data,t.delivered_by_clerk)}},e6=class e{constructor(e,t){this.id=e,this.type=t}static fromJSON(t){return new e(t.id,t.type)}},e4=class e{constructor(e,t,r=null,s=null,i=null,a=null,n=null){this.status=e,this.strategy=t,this.externalVerificationRedirectURL=r,this.attempts=s,this.expireAt=i,this.nonce=a,this.message=n}static fromJSON(t){return new e(t.status,t.strategy,t.external_verification_redirect_url?new URL(t.external_verification_redirect_url):null,t.attempts,t.expire_at,t.nonce)}},e8=class e{constructor(e,t,r,s){this.id=e,this.emailAddress=t,this.verification=r,this.linkedTo=s}static fromJSON(t){return new e(t.id,t.email_address,t.verification&&e4.fromJSON(t.verification),t.linked_to.map(e=>e6.fromJSON(e)))}},te=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h={},l,p){this.id=e,this.provider=t,this.identificationId=r,this.externalId=s,this.approvedScopes=i,this.emailAddress=a,this.firstName=n,this.lastName=o,this.imageUrl=d,this.username=c,this.phoneNumber=u,this.publicMetadata=h,this.label=l,this.verification=p}static fromJSON(t){return new e(t.id,t.provider,t.identification_id,t.provider_user_id,t.approved_scopes,t.email_address,t.first_name,t.last_name,t.image_url||"",t.username,t.phone_number,t.public_metadata,t.label,t.verification&&e4.fromJSON(t.verification))}},tt=class e{constructor(e,t,r,s,i,a,n,o,d,c,u){this.id=e,this.clientId=t,this.type=r,this.subject=s,this.scopes=i,this.revoked=a,this.revocationReason=n,this.expired=o,this.expiration=d,this.createdAt=c,this.updatedAt=u}static fromJSON(t){return new e(t.id,t.client_id,t.type,t.subject,t.scopes,t.revoked,t.revocation_reason,t.expired,t.expiration,t.created_at,t.updated_at)}static fromJwtPayload(t,r=5e3){return new e(t.jti??"",t.client_id??"","oauth_token",t.sub,t.scp??t.scope?.split(" ")??[],!1,null,1e3*t.exp<=Date.now()-r,t.exp,t.iat,t.i
1at)}},tr=class e{constructor(e,t,r){this.id=e,this.environmentType=t,this.allowedOrigins=r}static fromJSON(t){return new e(t.id,t.environment_type,t.allowed_origins)}},ts=class e{constructor(e,t,r,s,i){this.allowlist=e,this.blocklist=t,this.blockEmailSubaddresses=r,this.blockDisposableEmailDomains=s,this.ignoreDotsForGmailAddresses=i}static fromJSON(t){return new e(t.allowlist,t.blocklist,t.block_email_subaddresses,t.block_disposable_email_domains,t.ignore_dots_for_gmail_addresses)}},ti=class e{constructor(e,t,r,s,i){this.id=e,this.restrictedToAllowlist=t,this.fromEmailAddress=r,this.progressiveSignUp=s,this.enhancedEmailDeliverability=i}static fromJSON(t){return new e(t.id,t.restricted_to_allowlist,t.from_email_address,t.progressive_sign_up,t.enhanced_email_deliverability)}},ta=class e{constructor(e,t,r,s,i,a,n,o){this.id=e,this.emailAddress=t,this.publicMetadata=r,this.createdAt=s,this.updatedAt=i,this.status=a,this.url=n,this.revoked=o,this._raw=null}get raw(){return this._raw}static fromJSON(t){let r=new e(t.id,t.email_address,t.public_metadata,t.created_at,t.updated_at,t.status,t.url,t.revoked);return r._raw=t,r}},tn={AccountlessApplication:"accountless_application",ActorToken:"actor_token",AllowlistIdentifier:"allowlist_identifier",ApiKey:"api_key",BlocklistIdentifier:"blocklist_identifier",Client:"client",Cookies:"cookies",Domain:"domain",Email:"email",EmailAddress:"email_address",Instance:"instance",InstanceRestrictions:"instance_restrictions",InstanceSettings:"instance_settings",Invitation:"invitation",Machine:"machine",MachineScope:"machine_scope",MachineSecretKey:"machine_secret_key",M2MToken:"machine_to_machine_token",JwtTemplate:"jwt_template",OauthAccessToken:"oauth_access_token",IdpOAuthAccessToken:"clerk_idp_oauth_access_token",OAuthApplication:"oauth_application",Organization:"organization",OrganizationInvitation:"organization_invitation",OrganizationMembership:"organization_membership",OrganizationSettings:"organization_settings",PhoneNumber:"phone_number",ProxyCheck:"proxy_check",RedirectUrl:"redirect_url",SamlConnection:"saml_connection",Session:"session",SignInToken:"sign_in_token",SignUpAttempt:"sign_up_attempt",SmsMessage:"sms_message",User:"user",WaitlistEntry:"waitlist_entry",Token:"token",TotalCount:"total_count",BillingSubscription:"commerce_subscription",BillingSubscriptionItem:"commerce_subscription_item",BillingPlan:"commerce_plan",Feature:"feature"},to=class e{constructor(e,t,r,s,i,a,n,o){this.id=e,this.name=t,this.instanceId=r,this.createdAt=s,this.updatedAt=i,this.scopedMachines=a,this.defaultTokenTtl=n,this.secretKey=o}static fromJSON(t){return new e(t.id,t.name,t.instance_id,t.created_at,t.updated_at,t.scoped_machines.map(t=>new e(t.id,t.name,t.instance_id,t.created_at,t.updated_at,[],t.default_token_ttl)),t.default_token_ttl,t.secret_key)}},td=class e{constructor(e,t,r,s){this.fromMachineId=e,this.toMachineId=t,this.createdAt=r,this.deleted=s}static fromJSON(t){return new e(t.from_machine_id,t.to_machine_id,t.created_at,t.deleted)}},tc=class e{constructor(e){this.secret=e}static fromJSON(t){return new e(t.secret)}},tu=class e{constructor(e,t,r,s,i,a,n,o,d,c,u){this.id=e,this.subject=t,this.scopes=r,this.claims=s,this.revoked=i,this.revocationReason=a,this.expired=n,this.expiration=o,this.createdAt=d,this.updatedAt=c,this.token=u}static fromJSON(t){return new e(t.id,t.subject,t.scopes,t.claims,t.revoked,t.revocation_reason,t.expired,t.expiration,t.created_at,t.updated_at,t.token)}},th=class e{constructor(e,t,r,s,i,a,n,o,d){this.id=e,this.name=t,this.claims=r,this.lifetime=s,this.allowedClockSkew=i,this.customSigningKey=a,this.signingAlgorithm=n,this.createdAt=o,this.updatedAt=d}static fromJSON(t){return new e(t.id,t.name,t.claims,t.lifetime,t.allowed_clock_skew,t.custom_signing_key,t.signing_algorithm,t.created_at,t.updated_at)}},tl=class e{constructor(e,t,r,s={},i,a,n,o,d){this.externalAccountId=e,this.provider=t,this.token=r,this.publicMetadata=s,this.label=i,this.scopes=a,this.tokenSecret=n,this.expiresAt=o,this.idToken=d}static fromJSON(t){return new e(t.external_account_id,t.provider,t.token,t.public_metadata,t.label||"",t.scopes,t.token_secret,t.expires_at,t.id_token)}},tp=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y,f,k,g,_){this.id=e,this.instanceId=t,this.name=r,this.clientId=s,this.clientUri=i,this.clientImageUrl=a,this.dynamicallyRegistered=n,this.consentScreenEnabled=o,this.pkceRequired=d,this.isPublic=c,this.scopes=u,this.redirectUris=h,this.authorizeUrl=l,this.tokenFetchUrl=p,this.userInfoUrl=m,this.discoveryUrl=y,this.tokenIntrospectionUrl=f,this.createdAt=k,this.updatedAt=g,this.clientSecret=_}static fromJSON(t){return new e(t.id,t.instance_id,t.name,t.client_id,t.client_uri,t.client_image_url,t.dynamically_registered,t.consent_screen_enabled,t.pkce_required,t.public,t.scopes,t.redirect_uris,t.authorize_url,t.token_fetch_url,t.user_info_url,t.discovery_url,t.token_introspection_url,t.created_at,t.updated_at,t.client_secret)}},tm=class e{constructor(e,t,r,s,i,a,n,o={},d={},c,u,h,l){this.id=e,this.name=t,this.slug=r,this.imageUrl=s,this.hasImage=i,this.createdAt=a,this.updatedAt=n,this.publicMetadata=o,this.privateMetadata=d,this.maxAllowedMemberships=c,this.adminDeleteEnabled=u,this.membersCount=h,this.createdBy=l,this._raw=null}get raw(){return this._raw}static fromJSON(t){let r=new e(t.id,t.name,t.slug,t.image_url||"",t.has_image,t.created_at,t.updated_at,t.public_metadata,t.private_metadata,t.max_allowed_memberships,t.admin_delete_enabled,t.members_count,t.created_by);return r._raw=t,r}},ty=class e{constructor(e,t,r,s,i,a,n,o,d,c,u={},h={},l){this.id=e,this.emailAddress=t,this.role=r,this.roleName=s,this.organizationId=i,this.createdAt=a,this.updatedAt=n,this.expiresAt=o,this.url=d,this.status=c,this.publicMetadata=u,this.privateMetadata=h,this.publicOrganizationData=l,this._raw=null}get raw(){return this._raw}static fromJSON(t){let r=new e(t.id,t.email_address,t.role,t.role_name,t.organization_id,t.created_at,t.updated_at,t.expires_at,t.url,t.status,t.public_metadata,t.private_metadata,t.public_organization_data);return r._raw=t,r}},tf=class e{constructor(e,t,r,s={},i={},a,n,o,d){this.id=e,this.role=t,this.permissions=r,this.publicMetadata=s,this.privateMetadata=i,this.createdAt=a,this.updatedAt=n,this.organization=o,this.publicUserData=d,this._raw=null}get raw(){return this._raw}static fromJSON(t){let r=new e(t.id,t.role,t.permissions,t.public_metadata,t.private_metadata,t.created_at,t.updated_at,tm.fromJSON(t.organization),tk.fromJSON(t.public_user_data));return r._raw=t,r}},tk=class e{constructor(e,t,r,s,i,a){this.identifier=e,this.firstName=t,this.lastName=r,this.imageUrl=s,this.hasImage=i,this.userId=a}static fromJSON(t){return new e(t.identifier,t.first_name,t.last_name,t.image_url,t.has_image,t.user_id)}},tg=class e{constructor(e,t,r,s,i,a,n,o,d,c){this.enabled=e,this.maxAllowedMemberships=t,this.maxAllowedRoles=r,this.maxAllowedPermissions=s,this.creatorRole=i,this.adminDeleteEnabled=a,this.domainsEnabled=n,this.slugDisabled=o,this.domainsEnrollmentModes=d,this.domainsDefaultRole=c}static fromJSON(t){return new e(t.enabled,t.max_allowed_memberships,t.max_allowed_roles,t.max_allowed_permissions,t.creator_role,t.admin_delete_enabled,t.domains_enabled,t.slug_disabled,t.domains_enrollment_modes,t.domains_default_role)}},t_=class e{constructor(e,t,r,s,i,a){this.id=e,this.phoneNumber=t,this.reservedForSecondFactor=r,this.defaultSecondFactor=s,this.verification=i,this.linkedTo=a}static fromJSON(t){return new e(t.id,t.phone_number,t.reserved_for_second_factor,t.default_second_factor,t.verification&&e4.fromJSON(t.verification),t.linked_to.map(e=>e6.fromJSON(e)))}},tS=class e{constructor(e,t,r,s,i,a,n){this.id=e,this.domainId=t,this.lastRunAt=r,this.proxyUrl=s,this.successful=i,this.createdAt=a,this.updatedAt=n}static fromJSON(t){return new e(t.id,t.domain_id,t.last_run_at,t.proxy_url,t.successful,t.created_at,t.updated_at)}},tT=class e{constructor(e,t,r,s){this.id=e,this.url=t,this.createdAt=r,this.updatedAt=s}static fromJSON(t){return new e(t.id,t.url,t.created_at,t.updated_at)}},tb=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y,f,k,g,_,S){this.id=e,this.name=t,this.domain=r,this.organizationId=s,this.idpEntityId=i,this.idpSsoUrl=a,this.idpCertificate=n,this.idpMetadataUrl=o,this.idpMetadata=d,this.acsUrl=c,this.spEntityId=u,this.spMetadataUrl=h,this.active=l,this.provider=p,this.userCount=m,this.syncUserAttributes=y,this.allowSubdomains=f,this.allowIdpInitiated=k,this.createdAt=g,this.updatedAt=_,this.attributeMapping=S}static fromJSON(t){return new e(t.id,t.name,t.domain,t.organization_id,t.idp_entity_id,t.idp_sso_url,t.idp_certificate,t.idp_metadata_url,t.idp_metadata,t.acs_url,t.sp_entity_id,t.sp_metadata_url,t.active,t.provider,t.user_count,t.sync_user_attributes,t.allow_subdomains,t.allow_idp_initiated,t.created_at,t.updated_at,t.attribute_mapping&&tA.fromJSON(t.attribute_mapping))}},tw=class e{constructor(e,t,r,s,i,a,n,o,d,c){this.id=e,this.name=t,this.domain=r,this.active=s,this.provider=i,this.syncUserAttributes=a,this.allowSubdomains=n,this.allowIdpInitiated=o,this.createdAt=d,this.updatedAt=c}static fromJSON(t){return new e(t.id,t.name,t.domain,t.active,t.provider,t.sync_user_attributes,t.allow_subdomains,t.allow_idp_initiated,t.created_at,t.updated_at)}},tA=class e{constructor(e,t,r,s){this.userId=e,this.emailAddress=t,this.firstName=r,this.lastName=s}static fromJSON(t){return new e(t.user_id,t.email_address,t.first_name,t.last_name)}},tI=class e{constructor(e,t,r,s,i,a,n,o,d,c,u){this.id=e,this.provider=t,this.providerUserId=r,this.active=s,this.emailAddress=i,this.firstName=a,this.lastName=n,this.verification=o,this.samlConnection=d,this.lastAuthenticatedAt=c,this.enterpriseConnectionId=u}static fromJSON(t){return new e(t.id,t.provider,t.provider_user_id,t.active,t.email_address,t.first_name,t.last_name,t.verification&&e4.fromJSON(t.verification),t.saml_connection&&tw.fromJSON(t.saml_connection),t.last_authenticated_at??null,t.enterprise_connection_id)}},tv=class e{constructor(e,t,r,s,i,a,n){this.id=e,this.userId=t,this.token=r,this.status=s,this.url=i,this.createdAt=a,this.updatedAt=n}static fromJSON(t){return new e(t.id,t.user_id,t.token,t.status,t.url,t.created_at,t.updated_at)}},tO=class e{constructor(e,t){this.nextAction=e,this.supportedStrategies=t}static fromJSON(t){return new e(t.next_action,t.supported_strategies)}},tq=class e{constructor(e,t,r,s){this.emailAddress=e,this.phoneNumber=t,this.web3Wallet=r,this.externalAccount=s}static fromJSON(t){return new e(t.email_address&&tO.fromJSON(t.email_address),t.phone_number&&tO.fromJSON(t.phone_number),t.web3_wallet&&tO.fromJSON(t.web3_wallet),t.external_account)}},tP=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y,f,k,g,_,S,T){this.id=e,this.status=t,this.requiredFields=r,this.optionalFields=s,this.missingFields=i,this.unverifiedFields=a,this.verifications=n,this.username=o,this.emailAddress=d,this.phoneNumber=c,this.web3Wallet=u,this.passwordEnabled=h,this.firstName=l,this.lastName=p,this.customAction=m,this.externalId=y,this.createdSe
1ssionId=f,this.createdUserId=k,this.abandonAt=g,this.legalAcceptedAt=_,this.publicMetadata=S,this.unsafeMetadata=T}static fromJSON(t){return new e(t.id,t.status,t.required_fields,t.optional_fields,t.missing_fields,t.unverified_fields,t.verifications?tq.fromJSON(t.verifications):null,t.username,t.email_address,t.phone_number,t.web3_wallet,t.password_enabled,t.first_name,t.last_name,t.custom_action,t.external_id,t.created_session_id,t.created_user_id,t.abandon_at,t.legal_accepted_at,t.public_metadata,t.unsafe_metadata)}},tC=class e{constructor(e,t,r,s,i,a,n){this.id=e,this.fromPhoneNumber=t,this.toPhoneNumber=r,this.message=s,this.status=i,this.phoneNumberId=a,this.data=n}static fromJSON(t){return new e(t.id,t.from_phone_number,t.to_phone_number,t.message,t.status,t.phone_number_id,t.data)}},tx=class e{constructor(e){this.jwt=e}static fromJSON(t){return new e(t.jwt)}},tE=class e{constructor(e,t,r){this.id=e,this.web3Wallet=t,this.verification=r}static fromJSON(t){return new e(t.id,t.web3_wallet,t.verification&&e4.fromJSON(t.verification))}},tU=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y,f,k,g,_={},S={},T={},b=[],w=[],A=[],I=[],v=[],O,q,P=null,C,x,E){this.id=e,this.passwordEnabled=t,this.totpEnabled=r,this.backupCodeEnabled=s,this.twoFactorEnabled=i,this.banned=a,this.locked=n,this.createdAt=o,this.updatedAt=d,this.imageUrl=c,this.hasImage=u,this.primaryEmailAddressId=h,this.primaryPhoneNumberId=l,this.primaryWeb3WalletId=p,this.lastSignInAt=m,this.externalId=y,this.username=f,this.firstName=k,this.lastName=g,this.publicMetadata=_,this.privateMetadata=S,this.unsafeMetadata=T,this.emailAddresses=b,this.phoneNumbers=w,this.web3Wallets=A,this.externalAccounts=I,this.samlAccounts=v,this.lastActiveAt=O,this.createOrganizationEnabled=q,this.createOrganizationsLimit=P,this.deleteSelfEnabled=C,this.legalAcceptedAt=x,this.locale=E,this._raw=null}get raw(){return this._raw}static fromJSON(t){let r=new e(t.id,t.password_enabled,t.totp_enabled,t.backup_code_enabled,t.two_factor_enabled,t.banned,t.locked,t.created_at,t.updated_at,t.image_url,t.has_image,t.primary_email_address_id,t.primary_phone_number_id,t.primary_web3_wallet_id,t.last_sign_in_at,t.external_id,t.username,t.first_name,t.last_name,t.public_metadata,t.private_metadata,t.unsafe_metadata,(t.email_addresses||[]).map(e=>e8.fromJSON(e)),(t.phone_numbers||[]).map(e=>t_.fromJSON(e)),(t.web3_wallets||[]).map(e=>tE.fromJSON(e)),(t.external_accounts||[]).map(e=>te.fromJSON(e)),(t.saml_accounts||[]).map(e=>tI.fromJSON(e)),t.last_active_at,t.create_organization_enabled,t.create_organizations_limit,t.delete_self_enabled,t.legal_accepted_at,t.locale);return r._raw=t,r}get primaryEmailAddress(){return this.emailAddresses.find(({id:e})=>e===this.primaryEmailAddressId)??null}get primaryPhoneNumber(){return this.phoneNumbers.find(({id:e})=>e===this.primaryPhoneNumberId)??null}get primaryWeb3Wallet(){return this.web3Wallets.find(({id:e})=>e===this.primaryWeb3WalletId)??null}get fullName(){return[this.firstName,this.lastName].join(" ").trim()||null}},tN=class e{constructor(e,t,r,s,i,a,n){this.id=e,this.emailAddress=t,this.status=r,this.invitation=s,this.createdAt=i,this.updatedAt=a,this.isLocked=n}static fromJSON(t){return new e(t.id,t.email_address,t.status,t.invitation&&ta.fromJSON(t.invitation),t.created_at,t.updated_at,t.is_locked)}},tJ=class e{constructor(e,t,r,s,i){this.id=e,this.name=t,this.description=r,this.slug=s,this.avatarUrl=i}static fromJSON(t){return new e(t.id,t.name,t.description??null,t.slug,t.avatar_url??null)}},tz=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l){this.id=e,this.name=t,this.slug=r,this.description=s,this.isDefault=i,this.isRecurring=a,this.hasBaseFee=n,this.publiclyVisible=o,this.fee=d,this.annualFee=c,this.annualMonthlyFee=u,this.forPayerType=h,this.features=l}static fromJSON(t){let r=e=>e?{amount:e.amount,amountFormatted:e.amount_formatted,currency:e.currency,currencySymbol:e.currency_symbol}:null;return new e(t.id,t.name,t.slug,t.description??null,t.is_default,t.is_recurring,t.has_base_fee,t.publicly_visible,r(t.fee),r(t.annual_fee),r(t.annual_monthly_fee),t.for_payer_type,(t.features??[]).map(e=>tJ.fromJSON(e)))}},tH=class e{constructor(e,t,r,s,i,a,n,o,d,c,u,h,l,p,m,y,f){this.id=e,this.status=t,this.planPeriod=r,this.periodStart=s,this.nextPayment=i,this.amount=a,this.plan=n,this.planId=o,this.createdAt=d,this.updatedAt=c,this.periodEnd=u,this.canceledAt=h,this.pastDueAt=l,this.endedAt=p,this.payerId=m,this.isFreeTrial=y,this.lifetimePaid=f}static fromJSON(t){function r(e){return e?{amount:e.amount,amountFormatted:e.amount_formatted,currency:e.currency,currencySymbol:e.currency_symbol}:e}return new e(t.id,t.status,t.plan_period,t.period_start,t.next_payment,r(t.amount)??void 0,t.plan?tz.fromJSON(t.plan):null,t.plan_id??null,t.created_at,t.updated_at,t.period_end,t.canceled_at,t.past_due_at,t.ended_at,t.payer_id,t.is_free_trial,r(t.lifetime_paid)??void 0)}},tM=class e{constructor(e,t,r,s,i,a,n,o,d,c){this.id=e,this.status=t,this.payerId=r,this.createdAt=s,this.updatedAt=i,this.activeAt=a,this.pastDueAt=n,this.subscriptionItems=o,this.nextPayment=d,this.eligibleForFreeTrial=c}static fromJSON(t){let r=t.next_payment?{date:t.next_payment.date,amount:{amount:t.next_payment.amount.amount,amountFormatted:t.next_payment.amount.amount_formatted,currency:t.next_payment.amount.currency,currencySymbol:t.next_payment.amount.currency_symbol}}:null;return new e(t.id,t.status,t.payer_id,t.created_at,t.updated_at,t.active_at??null,t.past_due_at??null,(t.subscription_items??[]).map(e=>tH.fromJSON(e)),r,t.eligible_for_free_trial??!1)}};function tF(e){if("string"!=typeof e&&"object"in e&&"deleted"in e)return e5.fromJSON(e);switch(e.object){case tn.AccountlessApplication:return e$.fromJSON(e);case tn.ActorToken:return eV.fromJSON(e);case tn.AllowlistIdentifier:return eQ.fromJSON(e);case tn.ApiKey:return eY.fromJSON(e);case tn.BlocklistIdentifier:return eZ.fromJSON(e);case tn.Client:return e1.fromJSON(e);case tn.Cookies:return e3.fromJSON(e);case tn.Domain:return e9.fromJSON(e);case tn.EmailAddress:return e8.fromJSON(e);case tn.Email:return e7.fromJSON(e);case tn.IdpOAuthAccessToken:return tt.fromJSON(e);case tn.Instance:return tr.fromJSON(e);case tn.InstanceRestrictions:return ts.fromJSON(e);case tn.InstanceSettings:return ti.fromJSON(e);case tn.Invitation:return ta.fromJSON(e);case tn.JwtTemplate:return th.fromJSON(e);case tn.Machine:return to.fromJSON(e);case tn.MachineScope:return td.fromJSON(e);case tn.MachineSecretKey:return tc.fromJSON(e);case tn.M2MToken:return tu.fromJSON(e);case tn.OauthAccessToken:return tl.fromJSON(e);case tn.OAuthApplication:return tp.fromJSON(e);case tn.Organization:return tm.fromJSON(e);case tn.OrganizationInvitation:return ty.fromJSON(e);case tn.OrganizationMembership:return tf.fromJSON(e);case tn.OrganizationSettings:return tg.fromJSON(e);case tn.PhoneNumber:return t_.fromJSON(e);case tn.ProxyCheck:return tS.fromJSON(e);case tn.RedirectUrl:return tT.fromJSON(e);case tn.SamlConnection:return tb.fromJSON(e);case tn.SignInToken:return tv.fromJSON(e);case tn.SignUpAttempt:return tP.fromJSON(e);case tn.Session:return e0.fromJSON(e);case tn.SmsMessage:return tC.fromJSON(e);case tn.Token:return tx.fromJSON(e);case tn.TotalCount:return e.total_count;case tn.User:return tU.fromJSON(e);case tn.WaitlistEntry:return tN.fromJSON(e);case tn.BillingPlan:return tz.fromJSON(e);case tn.BillingSubscription:return tM.fromJSON(e);case tn.BillingSubscriptionItem:return tH.fromJSON(e);case tn.Feature:return tJ.fromJSON(e);default:return e}}function tj(e){var t;return t=async t=>{let r,{secretKey:s,machineSecretKey:i,useMachineSecretKey:a=!1,requireSecretKey:o=!0,apiUrl:d=f,apiVersion:c="v1",userAgent:u=k,skipApiVersionInUrl:h=!1}=e,{path:l,method:p,queryParams:m,headerParams:y,bodyParams:_,formData:S,options:b}=t,{deepSnakecaseBodyParamKeys:A=!1}=b||{};o&&w(s);let I=new URL(h?q(d,l):q(d,c,l));if(m)for(let[e,t]of Object.entries(eG({...m}
1)))t&&[t].flat().forEach(t=>I.searchParams.append(e,t));let v=new Headers({"Clerk-API-Version":g,[T.Headers.UserAgent]:u,...y}),O=T.Headers.Authorization;!v.has(O)&&(a&&i?v.set(O,`Bearer ${i}`):s&&v.set(O,`Bearer ${s}`));try{var P;S?r=await n.fA.fetch(I.href,{method:p,headers:v,body:S}):(v.set("Content-Type","application/json"),r=await n.fA.fetch(I.href,{method:p,headers:v,...(()=>{if(!("GET"!==p&&_&&Object.keys(_).length>0))return null;let e=e=>eG(e,{deep:A});return{body:JSON.stringify(Array.isArray(_)?_.map(e):e(_))}})()}));let e=r?.headers&&r.headers?.get(T.Headers.ContentType)===T.ContentTypes.Json,t=await (e?r.json():r.text());if(!r.ok)return{data:null,errors:tD(t),status:r?.status,statusText:r?.statusText,clerkTraceId:tR(t,r?.headers),retryAfter:tL(r?.headers)};return{...Array.isArray(t)?{data:t.map(e=>tF(e))}:(P=t)&&"object"==typeof P&&"data"in P&&Array.isArray(P.data)&&void 0!==P.data?{data:t.data.map(e=>tF(e)),totalCount:t.total_count}:{data:tF(t)},errors:null}}catch(e){if(e instanceof Error)return{data:null,errors:[{code:"unexpected_error",message:e.message||"Unexpected error"}],clerkTraceId:tR(e,r?.headers)};return{data:null,errors:tD(e),status:r?.status,statusText:r?.statusText,clerkTraceId:tR(e,r?.headers),retryAfter:tL(r?.headers)}}},async(...e)=>{let{data:r,errors:s,totalCount:i,status:a,statusText:n,clerkTraceId:o,retryAfter:d}=await t(...e);if(s){let e=new p.LR(n||"",{data:[],status:a,clerkTraceId:o,retryAfter:d});throw e.errors=s,e}return void 0!==i?{data:r,totalCount:i}:r}}function tR(e,t){return e&&"object"==typeof e&&"clerk_trace_id"in e&&"string"==typeof e.clerk_trace_id?e.clerk_trace_id:t?.get("cf-ray")||""}function tL(e){let t=e?.get("Retry-After");if(!t)return;let r=parseInt(t,10);if(!isNaN(r))return r}function tD(e){if(e&&"object"==typeof e&&"errors"in e){let t=e.errors;return t.length>0?t.map(p.u$):[]}return[]}function tK(e){let t=tj(e);return{__experimental_accountlessApplications:new U(tj({...e,requireSecretKey:!1})),actorTokens:new x(t),allowlistIdentifiers:new J(t),apiKeys:new H(tj({...e,skipApiVersionInUrl:!0})),betaFeatures:new M(t),blocklistIdentifiers:new j(t),billing:new eC(t),clients:new L(t),domains:new K(t),emailAddresses:new W(t),idPOAuthAccessToken:new G(tj({...e,skipApiVersionInUrl:!0})),instance:new V(t),invitations:new Y(t),jwks:new er(t),jwtTemplates:new ei(t),machines:new X(t),m2m:new et(tj({...e,skipApiVersionInUrl:!0,requireSecretKey:!1,useMachineSecretKey:!0})),oauthApplications:new ed(t),organizations:new en(t),phoneNumbers:new eu(t),proxyChecks:new eh(t),redirectUrls:new ep(t),samlConnections:new ey(t),sessions:new ek(t),signInTokens:new e_(t),signUps:new eT(t),testingTokens:new eb(t),users:new eA(t),waitlistEntries:new ev(t),webhooks:new eq(t)}}var tB="oat_",tW=["mt_",tB,"ak_"],tG=/^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/;function t$(e){return tG.test(e)}var tV=["at+jwt","application/at+jwt"];function tQ(e){if(!t$(e))return!1;try{let{data:t,errors:r}=(0,n.iU)(e);return!r&&!!t&&tV.includes(t.header.typ)}catch{return!1}}function tY(e){return tW.some(t=>e.startsWith(t))||tQ(e)}function tZ(e){if(e.startsWith("mt_"))return A.M2MToken;if(e.startsWith(tB)||tQ(e))return A.OAuthToken;if(e.startsWith("ak_"))return A.ApiKey;throw Error("Unknown machine token type")}var tX=(e,t)=>!!e&&("any"===t||(Array.isArray(t)?t:[t]).includes(e)),t0=e=>()=>{let t={...e};return t.secretKey=(t.secretKey||"").substring(0,7),t.jwtKey=(t.jwtKey||"").substring(0,7),{...t}};function t1(e,t){return{tokenType:A.SessionToken,sessionClaims:null,sessionId:null,
1sessionStatus:t??null,userId:null,actor:null,orgId:null,orgRole:null,orgSlug:null,orgPermissions:null,factorVerificationAge:null,getToken:()=>Promise.resolve(null),has:()=>!1,debug:t0(e),isAuthenticated:!1}}var t2={SignedIn:"signed-in",SignedOut:"signed-out",Handshake:"handshake"},t3={ClientUATWithoutSessionToken:"client-uat-but-no-session-token",DevBrowserMissing:"dev-browser-missing",DevBrowserSync:"dev-browser-sync",PrimaryRespondsToSyncing:"primary-responds-to-syncing",PrimaryDomainCrossOriginSync:"primary-domain-cross-origin-sync",SatelliteCookieNeedsSyncing:"satellite-needs-syncing",SessionTokenAndUATMissing:"session-token-and-uat-missing",SessionTokenMissing:"session-token-missing",SessionTokenExpired:"session-token-expired",SessionTokenIATBeforeClientUAT:"session-token-iat-before-client-uat",SessionTokenNBF:"session-token-nbf",SessionTokenIatInTheFuture:"session-token-iat-in-the-future",SessionTokenWithoutClientUAT:"session-token-but-no-client-uat",ActiveOrganizationMismatch:"active-organization-mismatch",TokenTypeMismatch:"token-type-mismatch",UnexpectedError:"unexpected-error"};function t5(e){let{authenticateContext:t,headers:r=new Headers,token:s}=e;return{status:t2.SignedIn,reason:null,message:null,proxyUrl:t.proxyUrl||"",publishableKey:t.publishableKey||"",isSatellite:t.isSatellite||!1,domain:t.domain||"",signInUrl:t.signInUrl||"",signUpUrl:t.signUpUrl||"",afterSignInUrl:t.afterSignInUrl||"",afterSignUpUrl:t.afterSignUpUrl||"",isSignedIn:!0,isAuthenticated:!0,tokenType:e.tokenType,toAuth:({treatPendingAsSignedOut:r=!0}={})=>{if(e.tokenType===A.SessionToken){let{sessionClaims:i}=e,a=function(e,t,r){let{actor:s,sessionId:i,sessionStatus:a,userId:n,orgId:o,orgRole:d,orgSlug:c,orgPermissions:u,factorVerificationAge:p}=(0,l.Y)(r),m=tK(e),y=(e=>{let{fetcher:t,sessionToken:r,sessionId:s}=e||{};return async(e={})=>s?e.template||void 0!==e.expiresInSeconds?t(s,e.template,e.expiresInSeconds):r:null})({sessionId:i,sessionToken:t,fetcher:async(e,t,r)=>(await m.sessions.getToken(e,t||"",r)).jwt});return{tokenType:A.SessionToken,actor:s,sessionClaims:r,sessionId:i,sessionStatus:a,userId:n,orgId:o,orgRole:d,orgSlug:c,orgPermissions:u,factorVerificationAge:p,getToken:y,has:(0,h.MR)({orgId:o,orgRole:d,orgPermissions:u,userId:n,factorVerificationAge:p,features:r.fea||"",plans:r.pla||""}),debug:t0({...e,sessionToken:t}),isAuthenticated:!0}}(t,s,i);return r&&"pending"===a.sessionStatus?t1(void 0,a.sessionStatus):a}let{machineData:i}=e;var a=e.tokenType;let n={id:i.id,subject:i.subject,getToken:()=>Promise.resolve(s),has:()=>!1,debug:t0(t),isAuthenticated:!0};switch(a){case A.ApiKey:return{...n,tokenType:a,name:i.name,claims:i.claims,scopes:i.scopes,userId:i.subject.startsWith("user_")?i.subject:null,orgId:i.subject.startsWith("org_")?i.subject:null};case A.M2MToken:return{...n,tokenType:a,claims:i.claims,scopes:i.scopes,machineId:i.subject};case A.OAuthToken:return{...n,tokenType:a,scopes:i.scopes,userId:i.subject,clientId:i.clientId};default:throw Error(`Invalid token type: ${a}`)}},headers:r,token:s}}function t9(e){let{authenticateContext:t,headers:r=new Headers,reason:s,message:i="",tokenType:a}=e;return t7({status:t2.SignedOut,reason:s,message:i,proxyUrl:t.proxyUrl||"",publishableKey:t.publishableKey||"",isSatellite:t.isSatellite||!1,domain:t.domain||"",signInUrl:t.signInUrl||"",signUpUrl:t.signUpUrl||"",afterSignInUrl:t.afterSignInUrl||"",afterSignUpUrl:t.afterSignUpUrl||"",isSignedIn:!1,isAuthenticated:!1,tokenType:a,toAuth:()=>{if(a===A.SessionToken)return t1({...t,status:t2.SignedOut,reason:s,message:i});let e={id:null,subject:null,scopes:null,has:()=>!1,getToken:()=>Promise.resolve(null),debug:t0({reason:s,message:i,headers:r}),isAuthenticated:!1};switch(a){case A.ApiKey:return{...e,tokenType:a,name:null,claims:null,scopes:null,userId:null,orgId:null};case A.M2MToken:return{...e,tokenType:a,claims:null,scopes:null,machineId:null};case A.OAuthToken:return{...e,tokenType:a,scopes:null,userId:null,clientId:null};default:throw Error(`Invalid token type: ${a}`)}},headers:r,token:null})}var t7=e=>{let t=new Headers(e.headers||{});if(e.message)try{t.set(T.Headers.AuthMessage,e.message)}catch{}if(e.reason)try{t.set(T.Headers.AuthReason,e.reason)}catch{}if(e.status)try{t.set(T.Headers.AuthStatus,e.status)}catch{}return e.headers=t,e},t6=(0,d.f1)(y()),t4=class extends URL{isCrossOrigin(e){return this.origin!==new URL(e.toString()).origin}},t8=(...e)=>new t4(...e),re=class extends Request{constructor(e,t){super("string"!=typeof e&&"url"in e?e.url:String(e),t||"string"==typeof e?void 0:e),this.clerkUrl=this.deriveUrlFromHeaders(this),this.cookies=this.parseCookies(this)}toJSON(){return{url:this.clerkUrl.href,method:this.method,headers:JSON.stringify(Object.fromEntries(this.headers)),clerkUrl:this.clerkUrl.toString(),cookies:JSON.stringify(Object.fromEntries(this.cookies))}}deriveUrlFromHeaders(e){let t=new URL(e.url),r=e.headers.get(T.Headers.ForwardedProto),s=e.headers.get(T.Headers.ForwardedHost),i=e.headers.get(T.Headers.Host),a=t.protocol,n=this.getFirstValueFromHeader(s)??i,o=this.getFirstValueFromHeader(r)??a?.replace(/[:/]/,""),d=n&&o?`${o}://${n}`:t.origin;return d===t.origin?t8(t):t8(t.pathname+t.search,d)}getFirstValueFromHeader(e){return e?.split(",")[0]}parseCookies(e){return new Map(Object.entries((0,t6.parse)(this.decodeCookieValue(e.headers.get("cookie")||""))))}decodeCookieValue(e){return e?e.replace(/(%[0-9A-Z]{2}
1)+/g,decodeURIComponent):e}},rt=e=>e.split(";")[0]?.split("=")[0],rr=e=>e.split(";")[0]?.split("=")[1],rs={},ri=0;function ra(e,t,r=!0){rs[e]=t,ri=r?Date.now():-1}function rn(e){let{kid:t,pem:r}=e,s=`local-${t}`,i=rs[s];if(i)return i;if(!r)throw new o.zF({action:o.z.SetClerkJWTKey,message:"Missing local JWK.",reason:o.jn.LocalJWKMissing});let a={kid:s,kty:"RSA",alg:"RS256",n:r.replace(/\r\n|\n|\r/g,"").replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").replace("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA","").replace("IDAQAB","").replace(/\+/g,"-").replace(/\//g,"_"),e:"AQAB"};return ra(s,a,!1),a}async function ro(e){let{secretKey:t,apiUrl:r=f,apiVersion:s="v1",kid:i,skipJwksCache:n}=e;if(n||function(){if(-1===ri)return!1;let e=Date.now()-ri>=3e5;return e&&(rs={}),e}()||!rs[i]){if(!t)throw new o.zF({action:o.z.ContactSupport,message:"Failed to load JWKS from Clerk Backend or Frontend API.",reason:o.jn.RemoteJWKFailedToLoad});let{keys:e}=await (0,a.L5)(()=>rd(r,t,s));if(!e||!e.length)throw new o.zF({action:o.z.ContactSupport,message:"The JWKS endpoint did not contain any signing keys. Contact [email protected].",reason:o.jn.RemoteJWKFailedToLoad});e.forEach(e=>ra(e.kid,e))}let d=rs[i];if(!d){let e=Object.values(rs).map(e=>e.kid).sort().join(", ");throw new o.zF({action:`Go to your Dashboard and validate your secret and public keys are correct. ${o.z.ContactSupport} if the issue persists.`,message:`Unable to find a signing key in JWKS that matches the kid='${i}' of the provided session token. Please make sure that the __session cookie or the HTTP authorization header contain a Clerk-generated session JWT. The following kid is available: ${e}`,reason:o.jn.JWKKidMismatch})}return d}async function rd(e,t,r){if(!t)throw new o.zF({action:o.z.SetClerkSecretKey,message:"Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.",reason:o.jn.RemoteJWKFailedToLoad});let s=new URL(e);s.pathname=q(s.pathname,r,"/jwks");let i=await n.fA.fetch(s.href,{headers:{Authorization:`Bearer ${t}`,"Clerk-API-Version":g,"Content-Type":"application/json","User-Agent":k}});if(!i.ok){let e=await i.json(),t=rc(e?.errors,o.qu.InvalidSecretKey);if(t){let e=o.jn.InvalidSecretKey;throw new o.zF({action:o.z.ContactSupport,message:t.message,reason:e})}throw new o.zF({action:o.z.ContactSupport,message:`Error loading Clerk JWKS from ${s.href} with code=${i.status}`,reason:o.jn.RemoteJWKFailedToLoad})}return i.json()}var rc=(e,t)=>e?e.find(e=>e.code===t):null;async function ru(e,t){let{data:r,errors:s}=(0,n.iU)(e);if(s)return{errors:s};let{header:i}=r,{kid:a}=i;try{let r;if(t.jwtKey)r=rn({kid:a,pem:t.jwtKey});else{if(!t.secretKey)return{errors:[new o.zF({action:o.z.SetClerkJWTKey,message:"Failed to resolve JWK during verification.",reason:o.jn.JWKFailedToResolve})]};r=await ro({...t,kid:a})}return await (0,n.J0)(e,{...t,key:r})}catch(e){return{errors:[e]}}}function rh(e,t,r){if((0,p.$R)(t)){let s,i;switch(t.status){case 401:s=o.h5.InvalidSecretKey,i=t.errors[0]?.message||"Invalid secret key";break;case 404:s=o.h5.TokenInvalid,i=r;break;default:s=o.h5.UnexpectedError,i="Unexpected error"}return{data:void 0,tokenType:e,errors:[new o.sM({message:i,code:s,status:t.status})]}}return{data:void 0,tokenType:e,errors:[new o.sM({message:"Unexpected error",code:o.h5.UnexpectedError,status:t.status})]}}async function rl(e,t){try{let r=tK(t);return{data:await r.m2m.verify({token:e}),tokenType:A.M2MToken,errors:void 0}}catch(e){return rh(A.M2MToken,e,"Machine token not found")}}async function rp(e,t){let r,s;try{r=(0,n.iU)(e)}catch(e){return{data:void 0,tokenType:A.OAuthToken,errors:[new o.sM({code:o.h5.TokenInvalid,message:e.message})]}}let{data:i,errors:a}=r;if(a)return{data:void 0,tokenType:A.OAuthToken,errors:[new o.sM({code:o.h5.TokenInvalid,message:a[0].message})]};let{header:d}=i,{kid:c}=d;try{if(t.jwtKey)s=rn({kid:c,pem:t.jwtKey});else{if(!t.secretKey)return{data:void 0,tokenType:A.OAuthToken,errors:[new o.sM({action:o.z.SetClerkJWTKey,message:"Failed to resolve JWK during verification.",code:o.h5.TokenVerificationFailed})]};s=await ro({...t,kid:c})}let{data:r,errors:i}=await (0,n.J0)(e,{...t,key:s,headerType:tV});if(i)return{data:void 0,tokenType:A.OAuthToken,errors:[new o.sM({code:o.h5.TokenVerificationFailed,message:i[0].message})]};return{data:tt.fromJwtPayload(r,t.clockSkewInMs),tokenType:A.OAuthToken,errors:void 0}}catch(e){return{tokenType:A.OAuthToken,errors:[new o.sM({code:o.h5.TokenVerificationFailed,message:e.message})]}}}async function rm(e,t){if(t$(e))return rp(e,t);try{let r=tK(t);return{data:await r.idPOAuthAccessToken.verify(e),tokenType:A.OAuthToken,errors:void 0}}catch(e){return rh(A.OAuthToken,e,"OAuth token not found")}}async function ry(e,t){try{let r=tK(t);return{data:await r.apiKeys.verify(e),tokenType:A.ApiKey,errors:void 0}}catch(e){return rh(A.ApiKey,e,"API key not found")}}async function rf(e,t){if(e.startsWith("mt_"))return rl(e,t);if(e.startsWith(tB)||t$(e))return rm(e,t);if(e.startsWith("ak_"))return ry(e,t);throw Error("Unknown machine token type")}async function rk(e,{key:t}){let{data:r,errors:s}=(0,n.iU)(e);if(s)throw s[0];let{header:i,payload:a}=r,{typ:d,alg:c}=i;(0,n.qf)(d),(0,n.l3)(c);let{data:u,errors:h}=await (0,n.nk)(r,t);if(h)throw new o.zF({reason:o.jn.TokenVerificationFailed,message:`Error verifying handshake token. ${h[0]}`});if(!u)throw new o.zF({reason:o.jn.TokenInvalidSignature,message:"Handshake signature is invali
1d."});return a}async function rg(e,t){let r,{secretKey:s,apiUrl:i,apiVersion:a,jwksCacheTtlInMs:d,jwtKey:c,skipJwksCache:u}=t,{data:h,errors:l}=(0,n.iU)(e);if(l)throw l[0];let{kid:p}=h.header;if(c)r=rn({kid:p,pem:c});else if(s)r=await ro({secretKey:s,apiUrl:i,apiVersion:a,kid:p,jwksCacheTtlInMs:d,skipJwksCache:u});else throw new o.zF({action:o.z.SetClerkJWTKey,message:"Failed to resolve JWK during handshake verification.",reason:o.jn.JWKFailedToResolve});return rk(e,{key:r})}var r_=class{constructor(e,t,r){this.authenticateContext=e,this.options=t,this.organizationMatcher=r}isRequestEligibleForHandshake(){let{accept:e,secFetchDest:t}=this.authenticateContext;return!!("document"===t||"iframe"===t||!t&&e?.startsWith("text/html"))}buildRedirectToHandshake(e){if(!this.authenticateContext?.clerkUrl)throw Error("Missing clerkUrl in authenticateContext");let t=this.removeDevBrowserFromURL(this.authenticateContext.clerkUrl),r=this.authenticateContext.frontendApi.startsWith("http")?this.authenticateContext.frontendApi:`https://${this.authenticateContext.frontendApi}`,s=new URL("v1/client/handshake",r=r.replace(/\/+$/,"")+"/");s.searchParams.append("redirect_url",t?.href||""),s.searchParams.append("__clerk_api_version",g),s.searchParams.append(T.QueryParameters.SuffixedCookies,this.authenticateContext.usesSuffixedCookies().toString()),s.searchParams.append(T.QueryParameters.HandshakeReason,e),s.searchParams.append(T.QueryParameters.HandshakeFormat,"nonce"),this.authenticateContext.sessionToken&&s.searchParams.append(T.QueryParameters.Session,this.authenticateContext.sessionToken),"development"===this.authenticateContext.instanceType&&this.authenticateContext.devBrowserToken&&s.searchParams.append(T.QueryParameters.DevBrowser,this.authenticateContext.devBrowserToken);let i=this.getOrganizationSyncTarget(this.authenticateContext.clerkUrl,this.organizationMatcher);return i&&this.getOrganizationSyncQueryParams(i).forEach((e,t)=>{s.searchParams.append(t,e)}),new Headers({[T.Headers.Location]:s.href})}async getCookiesFromHandshake(){let e=[];
1if(this.authenticateContext.handshakeNonce)try{let t=await this.authenticateContext.apiClient?.clients.getHandshakePayload({nonce:this.authenticateContext.handshakeNonce});t&&e.push(...t.directives)}catch(e){console.error("Clerk: HandshakeService: error getting handshake payload:",e)}else if(this.authenticateContext.handshakeToken){let t=await rg(this.authenticateContext.handshakeToken,this.authenticateContext);t&&Array.isArray(t.handshake)&&e.push(...t.handshake)}return e}async resolveHandshake(){let e=new Headers({"Access-Control-Allow-Origin":"null","Access-Control-Allow-Credentials":"true"}),t=await this.getCookiesFromHandshake(),r="";if(t.forEach(t=>{e.append("Set-Cookie",t),rt(t).startsWith(T.Cookies.Session)&&(r=rr(t))}),"development"===this.authenticateContext.instanceType){let t=new URL(this.authenticateContext.clerkUrl);t.searchParams.delete(T.QueryParameters.Handshake),t.searchParams.delete(T.QueryParameters.HandshakeHelp),t.searchParams.delete(T.QueryParameters.DevBrowser),t.searchParams.delete(T.QueryParameters.HandshakeNonce),e.append(T.Headers.Location,t.toString()),e.set(T.Headers.CacheControl,"no-store")}if(""===r)return t9({tokenType:A.SessionToken,authenticateContext:this.authenticateContext,reason:t3.SessionTokenMissing,message:"",headers:e});let{data:s,errors:[i]=[]}=await ru(r,this.authenticateContext);if(s)return t5({tokenType:A.SessionToken,authenticateContext:this.authenticateContext,sessionClaims:s,headers:e,token:r});if("development"===this.authenticateContext.instanceType&&(i?.reason===o.jn.TokenExpired||i?.reason===o.jn.TokenNotActiveYet||i?.reason===o.jn.TokenIatInTheFuture)){let t=new o.zF({action:i.action,message:i.message,reason:i.reason});t.tokenCarrier="cookie",console.error(`Clerk: Clock skew detected. This usually means that your system clock is inaccurate. Clerk will attempt to account for the clock skew in development.
2
3To resolve this issue, make sure your system's clock is set to the correct time (e.g. turn off and on automatic time synchronization).
4
5---
6
7${t.getFullMessage()}`);let{data:s,errors:[a]=[]}=await ru(r,{...this.authenticateContext,clockSkewInMs:864e5});if(s)return t5({tokenType:A.SessionToken,authenticateContext:this.authenticateContext,sessionClaims:s,headers:e,token:r});throw Error(a?.message||"Clerk: Handshake retry failed.")}throw Error(i?.message||"Clerk: Handshake failed.")}handleTokenVerificationErrorInDevelopment(e){if(e.reason===o.jn.TokenInvalidSignature)throw Error("Clerk: Handshake token verification failed due to an invalid signature. If you have switched Clerk keys locally, clear your cookies and try again.");throw Error(`Clerk: Handshake token verification failed: ${e.getFullMessage()}.`)}checkAndTrackRedirectLoop(e){if(3===this.authenticateContext.handshakeRedirectLoopCounter)return!0;let t=this.authenticateContext.handshakeRedirectLoopCounter+1,r=T.Cookies.RedirectCount;return e.append("Set-Cookie",`${r}=${t}; SameSite=Lax; HttpOnly; Max-Age=2`),!1}removeDevBrowserFromURL(e){let t=new URL(e);return t.searchParams.delete(T.QueryParameters.DevBrowser),t.searchParams.delete(T.QueryParameters.LegacyDevBrowser),t}getOrganizationSyncTarget(e,t){return t.findTarget(e)}getOrganizationSyncQueryParams(e){let t=new Map;return"personalAccount"===e.type&&t.set("organization_id",""),"organization"===e.type&&(e.organizationId&&t.set("organization_id",e.organizationId),e.organizationSlug&&t.set("organization_id",e.organizationSlug)),t}},rS=class{constructor(e){this.organizationPattern=this.createMatcher(e?.organizationPatterns),this.personalAccountPattern=this.createMatcher(e?.personalAccountPatterns)}createMatcher(e){if(!e)return null;try{return(0,m.Y)(e)}catch(t){throw Error(`Invalid pattern "${e}": ${t}`)}}findTarget(e){let t=this.findOrganizationTarget(e);return t||this.findPersonalAccountTarget(e)}findOrganizationTarget(e){if(!this.organizationPattern)return null;try{let t=this.organizationPattern(e.pathname);if(!t||!("params"in t))return null;let r=t.params;if(r.id)return{type:"organization",organizationId:r.id};if(r.slug)return{type:"organization",organizationSlug:r.slug};return null}catch(e){return console.error("Failed to match organization pattern:",e),null}}findPersonalAccountTarget(e){if(!this.personalAccountPattern)return null;try{return this.personalAccountPattern(e.pathname)?{type:"personalAccount"}:null}catch(e){return console.error("Failed to match personal account pattern:",e),null}}},rT={NonEligibleNoCookie:"non-eligible-no-refresh-cookie",NonEligibleNonGet:"non-eligible-non-get",InvalidSessionToken:"invalid-session-token",MissingApiClient:"missing-api-client",MissingSessionToken:"missing-session-token",MissingRefreshToken:"missing-refresh-token",ExpiredSessionTokenDecodeFailed:"expired-session-token-decode-failed",ExpiredSessionTokenMissingSidClaim:"expired-session-token-missing-sid-claim",FetchError:"fetch-error",UnexpectedSDKError:"unexpected-sdk-error",UnexpectedBAPIError:"unexpected-bapi-error"};function rb(e,t,r){return tX(e,t)?null:t9({tokenType:"string"==typeof t?t:e,authenticateContext:r,reason:t3.TokenTypeMismatch})}var rw=async(e,t)=>{let r=await v(((...e)=>e[0]&&"object"==typeof e[0]&&"clerkUrl"in e[0]&&"cookies"in e[0]?e[0]:new re(...e))(e),t),s=t.acceptsToken??A.SessionToken;if(s!==A.M2MToken&&(w(r.secretKey),r.isSatellite)){var i=r.signInUrl,d=r.secretKey;if(!i&&(0,a.Ve)(d))throw Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite");if(r.signInUrl&&r.origin&&function(e,t){let r;try{r=new URL(e)}catch{throw Error("The signInUrl needs to have a absolute url format.")}if(r.origin===t)throw Error("The signInUrl needs to be on a different origin than your satellite application.")}(r.signInUrl,r.origin),!(r.proxyUrl||r.domain))throw Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl")}s===A.M2MToken&&function(e){if(!e.machineSecretKey&&!e.secretKey)throw Error("Machine token authentication requires either a Machine secret key or a Clerk secret key. Ensure a Clerk secret key or Machine secret key is set.")}(r);let c=new rS(t.organizationSyncOptions),u=new r_(r,{organizationSyncOptions:t.organizationSyncOptions},c);async function h(r){if(!t.apiClient)return{data:null,error:{message:"An apiClient is needed to perform token refresh.",cause:{reason:rT.MissingApiClient}}};let{sessionToken:s,refreshTokenInCookie:i}=r;if(!s)return{data:null,error:{message:"Session token must be provided.",cause:{reason:rT.MissingSessionToken}}};if(!i)return{data:null,error:{message:"Refresh token must be provided.",cause:{reason:rT.MissingRefreshToken}}};let{data:a,errors:o}=(0,n.iU)(s);if(!a||o)return{data:null,error:{message:"Unable to decode the expired session token.",cause:{reason:rT.ExpiredSessionTokenDecodeFailed,errors:o}}};if(!a?.payload?.sid)return{data:null,error:{message:"Expired session token is missing the `sid` claim.",cause:{reason:rT.ExpiredSessionTokenMissingSidClaim}}};try{return{data:(await t.apiClient.sessions.refreshSession(a.payload.sid,{format:"cookie",suffixed_cookies:r.usesSuffixedCookies(),expired_token:s||"",refresh_token:i||"",request_origin:r.clerkUrl.origin,request_headers:Object.fromEntries(Array.from(e.headers.entries()).map(([e,t])=>[e,[t]]))})).cookies,error:null}}catch(e){if(!e?.errors?.length)return{data:null,error:{message:"Unexpected Server/BAPI error",cause:{reason:rT.UnexpectedBAPIError,errors:[e]}}};if("unexpected_error"===e.errors[0].code)return{data:null,error:{message:"Fetch unexpected error",cause:{reason:rT.FetchError,errors:e.errors}}};return{data:null,error:{message:e.errors[0].code,cause:{reason:e.errors[0].code,errors:e.errors}}}}}async function l(e){let{data:t,error:r}=await h(e);if(!t||0===t.length)return{data:null,error:r};let s=new Headers,i="";
7t.forEach(e=>{s.append("Set-Cookie",e),rt(e).startsWith(T.Cookies.Session)&&(i=rr(e))});let{data:a,errors:n}=await ru(i,e);return n?{data:null,error:{message:"Clerk: unable to verify refreshed session token.",cause:{reason:rT.InvalidSessionToken,errors:n}}}:{data:{jwtPayload:a,sessionToken:i,headers:s},error:null}}function p(e,t,r,s){if(!u.isRequestEligibleForHandshake())return t9({tokenType:A.SessionToken,authenticateContext:e,reason:t,message:r});let i=s??u.buildRedirectToHandshake(t);return(i.get(T.Headers.Location)&&i.set(T.Headers.CacheControl,"no-store"),u.checkAndTrackRedirectLoop(i))?(console.log("Clerk: Refreshing the session token resulted in an infinite redirect loop. This usually means that your Clerk instance keys do not match - make sure to copy the correct publishable and secret keys from the Clerk dashboard."),t9({tokenType:A.SessionToken,authenticateContext:e,reason:t,message:r})):function(e,t,r="",s){return t7({status:t2.Handshake,reason:t,message:r,publishableKey:e.publishableKey||"",isSatellite:e.isSatellite||!1,domain:e.domain||"",proxyUrl:e.proxyUrl||"",signInUrl:e.signInUrl||"",signUpUrl:e.signUpUrl||"",afterSignInUrl:e.afterSignInUrl||"",afterSignUpUrl:e.afterSignUpUrl||"",isSignedIn:!1,isAuthenticated:!1,tokenType:A.SessionToken,toAuth:()=>null,headers:s,token:null})}(e,t,r,i)}async function m(){let{tokenInHeader:e}=r;try{let{data:t,errors:s}=await ru(e,r);if(s)throw s[0];return t5({tokenType:A.SessionToken,authenticateContext:r,sessionClaims:t,headers:new Headers,token:e})}catch(e){return f(e,"header")}}async function y(){let e=r.clientUat,t=!!r.sessionTokenInCookie,s=!!r.devBrowserToken;if(r.handshakeNonce||r.handshakeToken)try{return await u.resolveHandshake()}catch(e){e instanceof o.zF&&"development"===r.instanceType?u.handleTokenVerificationErrorInDevelopment(e):console.error("Clerk: unable to resolve handshake:",e)}let i=r.isSatellite&&"document"===r.secFetchDest;if("production"===r.instanceType&&i)return p(r,t3.SatelliteCookieNeedsSyncing,"");if("development"===r.instanceType&&i&&!r.clerkUrl.searchParams.has(T.QueryParameters.ClerkSynced)){let e=new URL(r.signInUrl);e.searchParams.append(T.QueryParameters.ClerkRedirectUrl,r.clerkUrl.toString());let t=new Headers({[T.Headers.Location]:e.toString()});return p(r,t3.SatelliteCookieNeedsSyncing,"",t)}let a=new URL(r.clerkUrl).searchParams.get(T.QueryParameters.ClerkRedirectUrl);if("development"===r.instanceType&&!r.isSatellite&&a){let e=new URL(a);r.devBrowserToken&&e.searchParams.append(T.QueryParameters.DevBrowser,r.devBrowserToken),e.searchParams.append(T.QueryParameters.ClerkSynced,"true");let t=new Headers({[T.Headers.Location]:e.toString()});return p(r,t3.PrimaryRespondsToSyncing,"",t)}if("development"===r.instanceType&&r.clerkUrl.searchParams.has(T.QueryParameters.DevBrowser))return p(r,t3.DevBrowserSync,"");if("development"===r.instanceType&&!s)return p(r,t3.DevBrowserMissing,"");if(!e&&!t)return t9({tokenType:A.SessionToken,authenticateContext:r,reason:t3.SessionTokenAndUATMissing});if(!e&&t)return p(r,t3.SessionTokenWithoutClientUAT,"");if(e&&!t)return p(r,t3.ClientUATWithoutSessionToken,"");let{data:d,errors:h}=(0,n.iU)(r.sessionTokenInCookie);if(h)return f(h[0],"cookie");if(d.payload.iat<r.clientUat)return p(r,t3.SessionTokenIATBeforeClientUAT,"");try{let{data:e,errors:t}=await ru(r.sessionTokenInCookie,r);if(t)throw t[0];let s=t5({tokenType:A.SessionToken,authenticateContext:r,sessionClaims:e,headers:new Headers,token:r.sessionTokenInCookie});if(!r.isSatellite&&"document"===r.secFetchDest&&r.isCrossOriginReferrer()&&!r.isKnownClerkReferrer()&&0===r.handshakeRedirectLoopCounter)return p(r,t3.PrimaryDomainCrossOriginSync,"Cross-origin request from satellite domain requires handshake");let i=s.toAuth();if(i.userId){let e=function(e,t){let r=c.findTarget(e.clerkUrl);if(!r)return null;let s=!1;if("organization"===r.type&&(r.organizationSlug&&r.organizationSlug!==t.orgSlug&&(s=!0),r.organizationId&&r.organizationId!==t.orgId&&(s=!0)),"personalAccount"===r.type&&t.orgId&&(s=!0),!s)return null;if(e.handshakeRedirectLoopCounter>=3)return console.warn("Clerk: Organization activation handshake loop detected. This is likely due to an invali
7d organization ID or slug. Skipping organization activation."),null;let i=p(e,t3.ActiveOrganizationMismatch,"");return"handshake"!==i.status?null:i}(r,i);if(e)return e}return s}catch(e){return f(e,"cookie")}}async function f(t,s){let i;if(!(t instanceof o.zF))return t9({tokenType:A.SessionToken,authenticateContext:r,reason:t3.UnexpectedError});if(t.reason===o.jn.TokenExpired&&r.refreshTokenInCookie&&"GET"===e.method){let{data:e,error:t}=await l(r);if(e)return t5({tokenType:A.SessionToken,authenticateContext:r,sessionClaims:e.jwtPayload,headers:e.headers,token:e.sessionToken});i=t?.cause?.reason?t.cause.reason:rT.UnexpectedSDKError}else i="GET"!==e.method?rT.NonEligibleNonGet:r.refreshTokenInCookie?null:rT.NonEligibleNoCookie;return(t.tokenCarrier=s,[o.jn.TokenExpired,o.jn.TokenNotActiveYet,o.jn.TokenIatInTheFuture].includes(t.reason))?p(r,rI({tokenError:t.reason,refreshError:i}),t.getFullMessage()):t9({tokenType:A.SessionToken,authenticateContext:r,reason:t.reason,message:t.getFullMessage()})}function k(e,t){return t instanceof o.sM?t9({tokenType:e,authenticateContext:r,reason:t.code,message:t.getFullMessage()}):t9({tokenType:e,authenticateContext:r,reason:t3.UnexpectedError})}async function g(){let{tokenInHeader:e}=r;if(!e)return f(Error("Missing token in header"),"header");if(!tY(e))return t9({tokenType:s,authenticateContext:r,reason:t3.TokenTypeMismatch,message:""});let t=rb(tZ(e),s,r);if(t)return t;let{data:i,tokenType:a,errors:n}=await rf(e,r);return n?k(a,n[0]):t5({tokenType:a,authenticateContext:r,machineData:i,token:e})}async function _(){let{tokenInHeader:e}=r;if(!e)return f(Error("Missing token in header"),"header");if(tY(e)){let t=rb(tZ(e),s,r);if(t)return t;let{data:i,tokenType:a,errors:n}=await rf(e,r);return n?k(a,n[0]):t5({tokenType:a,authenticateContext:r,machineData:i,token:e})}let{data:t,errors:i}=await ru(e,r);return i?f(i[0],"header"):t5({tokenType:A.SessionToken,authenticateContext:r,sessionClaims:t,token:e})}return Array.isArray(s)&&!function(e,t){let r=null,{tokenInHeader:s}=t;return s&&(r=tY(s)?tZ(s):A.SessionToken),tX(r??A.SessionToken,e)}(s,r)?function(){let e={isAuthenticated:!1,tokenType:null,getToken:()=>Promise.resolve(null),has:()=>!1,debug:()=>({})};return t7({status:t2.SignedOut,reason:t3.TokenTypeMismatch,message:"",proxyUrl:"",publishableKey:"",isSatellite:!1,domain:"",signInUrl:"",signUpUrl:"",afterSignInUrl:"",afterSignUpUrl:"",isSignedIn:!1,isAuthenticated:!1,tokenType:null,toAuth:()=>e,headers:new Headers,token:null})}():r.tokenInHeader?"any"===s||Array.isArray(s)?_():s===A.SessionToken?m():g():s===A.OAuthToken||s===A.ApiKey||s===A.M2MToken?t9({tokenType:s,authenticateContext:r,reason:"No token in header"}):y()},rA=e=>{let{isSignedIn:t,isAuthenticated:r,proxyUrl:s,reason:i,message:a,publishableKey:n,isSatellite:o,domain:d}=e;return{isSignedIn:t,isAuthenticated:r,proxyUrl:s,reason:i,message:a,publishableKey:n,isSatellite:o,domain:d}},rI=({tokenError:e,refreshError:t})=>{switch(e){case o.jn.TokenExpired:return`${t3.SessionTokenExpired}-refresh-${t}`;case o.jn.TokenNotActiveYet:return t3.SessionTokenNBF;case o.jn.TokenIatInTheFuture:return t3.SessionTokenIatInTheFuture;default:return t3.UnexpectedError}},rv={secretKey:"",machineSecretKey:"",jwtKey:"",apiUrl:void 0,apiVersion:void 0,proxyUrl:"",publishableKey:"",isSatellite:!1,domain:"",audience:""};function rO(e){let t=b(rv,e.options),r=e.apiClient;return{authenticateRequest:(e,s={})=>{let{apiUrl:i,apiVersion:a}=t,n=b(t,s);return rw(e,{...s,...n,apiUrl:i,apiVersion:a,apiClient:r})},debugRequestState:rA}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.