@clerk/react 6.9.0 → 6.9.1-canary.v20260610190754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/ClerkProvider-9lxHp9j5.cjs +1623 -0
  2. package/dist/ClerkProvider-9lxHp9j5.cjs.map +1 -0
  3. package/dist/ClerkProvider-LQpPtmNL.mjs +1533 -0
  4. package/dist/ClerkProvider-LQpPtmNL.mjs.map +1 -0
  5. package/dist/errors.cjs +69 -0
  6. package/dist/errors.d.cts +2 -0
  7. package/dist/errors.d.mts +2 -1
  8. package/dist/errors.mjs +2 -29
  9. package/dist/experimental.cjs +270 -0
  10. package/dist/experimental.cjs.map +1 -0
  11. package/dist/{experimental.d.ts → experimental.d.cts} +18 -18
  12. package/dist/experimental.d.mts +18 -18
  13. package/dist/experimental.mjs +201 -165
  14. package/dist/experimental.mjs.map +1 -1
  15. package/dist/hooks-BiY5Zgpp.mjs +1369 -0
  16. package/dist/hooks-BiY5Zgpp.mjs.map +1 -0
  17. package/dist/hooks-CBghYU21.cjs +1606 -0
  18. package/dist/hooks-CBghYU21.cjs.map +1 -0
  19. package/dist/index.cjs +447 -0
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.cts +345 -0
  22. package/dist/index.d.mts +183 -157
  23. package/dist/index.mjs +285 -380
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/internal.cjs +107 -0
  26. package/dist/internal.cjs.map +1 -0
  27. package/dist/internal.d.cts +51 -0
  28. package/dist/internal.d.mts +24 -26
  29. package/dist/internal.mjs +39 -73
  30. package/dist/internal.mjs.map +1 -1
  31. package/dist/legacy.cjs +134 -0
  32. package/dist/legacy.cjs.map +1 -0
  33. package/dist/{legacy.d.ts → legacy.d.cts} +6 -3
  34. package/dist/legacy.d.mts +6 -3
  35. package/dist/legacy.mjs +126 -42
  36. package/dist/legacy.mjs.map +1 -1
  37. package/dist/types-Bwenmt7y.d.cts +10951 -0
  38. package/dist/types-CiIhevkA.d.mts +10951 -0
  39. package/dist/types.cjs +0 -0
  40. package/dist/types.d.cts +3 -0
  41. package/dist/types.d.mts +3 -109
  42. package/dist/types.mjs +1 -2
  43. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs +52 -0
  44. package/dist/useAssertWrappedByClerkProvider-Cm0djUcB.cjs.map +1 -0
  45. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs +29 -0
  46. package/dist/useAssertWrappedByClerkProvider-GaNwZpWo.mjs.map +1 -0
  47. package/dist/{useAuth-Dlg_G1_7.d.mts → useAuth-BK5Y4htK.d.mts} +58 -39
  48. package/dist/{useAuth-Cv6iRjL9.d.ts → useAuth-BMxaWktj.d.cts} +58 -39
  49. package/package.json +18 -18
  50. package/dist/chunk-E5QRIS4Z.mjs +0 -20
  51. package/dist/chunk-E5QRIS4Z.mjs.map +0 -1
  52. package/dist/chunk-FQVXBXXF.mjs +0 -1487
  53. package/dist/chunk-FQVXBXXF.mjs.map +0 -1
  54. package/dist/chunk-GVGS7DUS.mjs +0 -2097
  55. package/dist/chunk-GVGS7DUS.mjs.map +0 -1
  56. package/dist/chunk-RQWALB2R.mjs +0 -26
  57. package/dist/chunk-RQWALB2R.mjs.map +0 -1
  58. package/dist/errors.d.ts +0 -1
  59. package/dist/errors.js +0 -51
  60. package/dist/errors.js.map +0 -1
  61. package/dist/errors.mjs.map +0 -1
  62. package/dist/experimental.js +0 -1505
  63. package/dist/experimental.js.map +0 -1
  64. package/dist/index.d.ts +0 -319
  65. package/dist/index.js +0 -3919
  66. package/dist/index.js.map +0 -1
  67. package/dist/internal.d.ts +0 -53
  68. package/dist/internal.js +0 -3339
  69. package/dist/internal.js.map +0 -1
  70. package/dist/legacy.js +0 -90
  71. package/dist/legacy.js.map +0 -1
  72. package/dist/types.d.ts +0 -109
  73. package/dist/types.js +0 -19
  74. package/dist/types.js.map +0 -1
  75. package/dist/types.mjs.map +0 -1
@@ -0,0 +1,1623 @@
1
+ const require_hooks = require('./hooks-CBghYU21.cjs');
2
+ const require_useAssertWrappedByClerkProvider = require('./useAssertWrappedByClerkProvider-Cm0djUcB.cjs');
3
+ let react = require("react");
4
+ react = require_hooks.__toESM(react);
5
+ let _clerk_shared_loadClerkJsScript = require("@clerk/shared/loadClerkJsScript");
6
+ let _clerk_shared_utils = require("@clerk/shared/utils");
7
+ let _clerk_shared_react = require("@clerk/shared/react");
8
+ let _clerk_shared_deprecated = require("@clerk/shared/deprecated");
9
+ let _clerk_shared_browser = require("@clerk/shared/browser");
10
+ let _clerk_shared_clerkEventBus = require("@clerk/shared/clerkEventBus");
11
+ let _clerk_shared_versionCheck = require("@clerk/shared/versionCheck");
12
+
13
+ //#region src/components/controlComponents.tsx
14
+ const ClerkLoaded = ({ children }) => {
15
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("ClerkLoaded");
16
+ if (!require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext().loaded) return null;
17
+ return children;
18
+ };
19
+ const ClerkLoading = ({ children }) => {
20
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("ClerkLoading");
21
+ if (require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext().status !== "loading") return null;
22
+ return children;
23
+ };
24
+ const ClerkFailed = ({ children }) => {
25
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("ClerkFailed");
26
+ if (require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext().status !== "error") return null;
27
+ return children;
28
+ };
29
+ const ClerkDegraded = ({ children }) => {
30
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("ClerkDegraded");
31
+ if (require_useAssertWrappedByClerkProvider.useIsomorphicClerkContext().status !== "degraded") return null;
32
+ return children;
33
+ };
34
+ /**
35
+ * Use `<Show/>` to conditionally render content based on user authorization or sign-in state.
36
+ * Returns `null` while auth is loading. Set `treatPendingAsSignedOut` to treat
37
+ * pending sessions as signed out during that period.
38
+ *
39
+ * The `when` prop supports:
40
+ * - `"signed-in"` or `"signed-out"` shorthands
41
+ * - Authorization descriptors (e.g., `{ permission: "org:billing:manage" }`, `{ role: "admin" }`)
42
+ * - A predicate function `(has) => boolean` that receives the `has` helper
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * <Show when={{ permission: "org:billing:manage" }} fallback={<p>Unauthorized</p>}>
47
+ * <BillingSettings />
48
+ * </Show>
49
+ *
50
+ * <Show when={{ role: "admin" }}>
51
+ * <AdminPanel />
52
+ * </Show>
53
+ *
54
+ * <Show when={(has) => has({ permission: "org:read" }) && isFeatureEnabled}>
55
+ * <ProtectedFeature />
56
+ * </Show>
57
+ * ```
58
+ *
59
+ */
60
+ const Show = ({ children, fallback, treatPendingAsSignedOut, when }) => {
61
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("Show");
62
+ const { has, isLoaded, userId } = require_hooks.useAuth({ treatPendingAsSignedOut });
63
+ if (!isLoaded) return null;
64
+ const resolvedWhen = when;
65
+ const authorized = children;
66
+ const unauthorized = fallback ?? null;
67
+ if (resolvedWhen === "signed-out") return userId ? unauthorized : authorized;
68
+ if (!userId) return unauthorized;
69
+ if (resolvedWhen === "signed-in") return authorized;
70
+ if (checkAuthorization(resolvedWhen, has)) return authorized;
71
+ return unauthorized;
72
+ };
73
+ function checkAuthorization(when, has) {
74
+ if (typeof when === "function") return when(has);
75
+ return has(when);
76
+ }
77
+ const RedirectToSignIn = require_hooks.withClerk(({ clerk, ...props }) => {
78
+ const { client, session } = clerk;
79
+ const hasSignedInSessions = (client.signedInSessions?.length ?? 0) > 0;
80
+ react.default.useEffect(() => {
81
+ if (session === null && hasSignedInSessions) clerk.redirectToAfterSignOut();
82
+ else clerk.redirectToSignIn(props);
83
+ }, []);
84
+ return null;
85
+ }, "RedirectToSignIn");
86
+ const RedirectToSignUp = require_hooks.withClerk(({ clerk, ...props }) => {
87
+ react.default.useEffect(() => {
88
+ clerk.redirectToSignUp(props);
89
+ }, []);
90
+ return null;
91
+ }, "RedirectToSignUp");
92
+ const RedirectToTasks = require_hooks.withClerk(({ clerk, ...props }) => {
93
+ react.default.useEffect(() => {
94
+ clerk.redirectToTasks(props);
95
+ }, []);
96
+ return null;
97
+ }, "RedirectToTasks");
98
+ /**
99
+ * @function
100
+ * @deprecated Use [`redirectToUserProfile()`](https://clerk.com/docs/reference/objects/clerk#redirect-to-user-profile) instead.
101
+ */
102
+ const RedirectToUserProfile = require_hooks.withClerk(({ clerk }) => {
103
+ react.default.useEffect(() => {
104
+ (0, _clerk_shared_deprecated.deprecated)("RedirectToUserProfile", "Use the `redirectToUserProfile()` method instead.");
105
+ clerk.redirectToUserProfile();
106
+ }, []);
107
+ return null;
108
+ }, "RedirectToUserProfile");
109
+ /**
110
+ * @function
111
+ * @deprecated Use [`redirectToOrganizationProfile()`](https://clerk.com/docs/reference/objects/clerk#redirect-to-organization-profile) instead.
112
+ */
113
+ const RedirectToOrganizationProfile = require_hooks.withClerk(({ clerk }) => {
114
+ react.default.useEffect(() => {
115
+ (0, _clerk_shared_deprecated.deprecated)("RedirectToOrganizationProfile", "Use the `redirectToOrganizationProfile()` method instead.");
116
+ clerk.redirectToOrganizationProfile();
117
+ }, []);
118
+ return null;
119
+ }, "RedirectToOrganizationProfile");
120
+ /**
121
+ * @function
122
+ * @deprecated Use [`redirectToCreateOrganization()`](https://clerk.com/docs/reference/objects/clerk#redirect-to-create-organization) instead.
123
+ */
124
+ const RedirectToCreateOrganization = require_hooks.withClerk(({ clerk }) => {
125
+ react.default.useEffect(() => {
126
+ (0, _clerk_shared_deprecated.deprecated)("RedirectToCreateOrganization", "Use the `redirectToCreateOrganization()` method instead.");
127
+ clerk.redirectToCreateOrganization();
128
+ }, []);
129
+ return null;
130
+ }, "RedirectToCreateOrganization");
131
+ const AuthenticateWithRedirectCallback = require_hooks.withClerk(({ clerk, ...handleRedirectCallbackParams }) => {
132
+ react.default.useEffect(() => {
133
+ clerk.handleRedirectCallback(handleRedirectCallbackParams);
134
+ }, []);
135
+ return null;
136
+ }, "AuthenticateWithRedirectCallback");
137
+ const MultisessionAppSupport = ({ children }) => {
138
+ require_useAssertWrappedByClerkProvider.useAssertWrappedByClerkProvider("MultisessionAppSupport");
139
+ const session = (0, _clerk_shared_react.__internal_useSessionBase)();
140
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: session ? session.id : "no-users" }, children);
141
+ };
142
+
143
+ //#endregion
144
+ //#region src/stateProxy.ts
145
+ const defaultSignInErrors = () => ({
146
+ fields: {
147
+ identifier: null,
148
+ password: null,
149
+ code: null
150
+ },
151
+ raw: null,
152
+ global: null
153
+ });
154
+ const defaultSignUpErrors = () => ({
155
+ fields: {
156
+ firstName: null,
157
+ lastName: null,
158
+ emailAddress: null,
159
+ phoneNumber: null,
160
+ password: null,
161
+ username: null,
162
+ code: null,
163
+ captcha: null,
164
+ legalAccepted: null
165
+ },
166
+ raw: null,
167
+ global: null
168
+ });
169
+ const defaultWaitlistErrors = () => ({
170
+ fields: { emailAddress: null },
171
+ raw: null,
172
+ global: null
173
+ });
174
+ const defaultVerificationResource = () => ({
175
+ pathRoot: "",
176
+ attempts: null,
177
+ error: null,
178
+ expireAt: null,
179
+ externalVerificationRedirectURL: null,
180
+ nonce: null,
181
+ message: null,
182
+ status: null,
183
+ strategy: null,
184
+ verifiedAtClient: null,
185
+ verifiedFromTheSameClient() {
186
+ return false;
187
+ },
188
+ reload() {
189
+ throw new Error("reload() called before Clerk is loaded");
190
+ },
191
+ __internal_toSnapshot() {
192
+ return {
193
+ object: "verification",
194
+ id: "",
195
+ attempts: null,
196
+ error: {
197
+ code: "",
198
+ message: ""
199
+ },
200
+ expire_at: null,
201
+ externalVerificationRedirectURL: null,
202
+ nonce: null,
203
+ message: null,
204
+ status: null,
205
+ strategy: null,
206
+ verified_at_client: null
207
+ };
208
+ }
209
+ });
210
+ const defaultSignUpVerificationResource = () => ({
211
+ ...defaultVerificationResource(),
212
+ supportedStrategies: [],
213
+ nextAction: "",
214
+ reload() {
215
+ throw new Error("reload() called before Clerk is loaded");
216
+ },
217
+ __internal_toSnapshot() {
218
+ return {
219
+ ...defaultVerificationResource().__internal_toSnapshot(),
220
+ next_action: this.nextAction,
221
+ supported_strategies: this.supportedStrategies
222
+ };
223
+ }
224
+ });
225
+ var StateProxy = class {
226
+ constructor(isomorphicClerk) {
227
+ this.isomorphicClerk = isomorphicClerk;
228
+ this.signInSignalProxy = this.buildSignInProxy();
229
+ this.signUpSignalProxy = this.buildSignUpProxy();
230
+ this.waitlistSignalProxy = this.buildWaitlistProxy();
231
+ }
232
+ signInSignal() {
233
+ return this.signInSignalProxy;
234
+ }
235
+ signUpSignal() {
236
+ return this.signUpSignalProxy;
237
+ }
238
+ waitlistSignal() {
239
+ return this.waitlistSignalProxy;
240
+ }
241
+ get __internal_waitlist() {
242
+ return this.state.__internal_waitlist;
243
+ }
244
+ checkoutSignal(params) {
245
+ return this.buildCheckoutProxy(params);
246
+ }
247
+ buildSignInProxy() {
248
+ const gateProperty = this.gateProperty.bind(this);
249
+ const target = () => this.client.signIn.__internal_future;
250
+ return {
251
+ errors: defaultSignInErrors(),
252
+ fetchStatus: "idle",
253
+ signIn: {
254
+ status: "needs_identifier",
255
+ availableStrategies: [],
256
+ get isTransferable() {
257
+ return gateProperty(target, "isTransferable", false);
258
+ },
259
+ get id() {
260
+ return gateProperty(target, "id", void 0);
261
+ },
262
+ get supportedFirstFactors() {
263
+ return gateProperty(target, "supportedFirstFactors", []);
264
+ },
265
+ get supportedSecondFactors() {
266
+ return gateProperty(target, "supportedSecondFactors", []);
267
+ },
268
+ get secondFactorVerification() {
269
+ return gateProperty(target, "secondFactorVerification", {
270
+ status: null,
271
+ error: null,
272
+ expireAt: null,
273
+ externalVerificationRedirectURL: null,
274
+ nonce: null,
275
+ attempts: null,
276
+ message: null,
277
+ strategy: null,
278
+ verifiedAtClient: null,
279
+ verifiedFromTheSameClient: () => false,
280
+ __internal_toSnapshot: () => {
281
+ throw new Error("__internal_toSnapshot called before Clerk is loaded");
282
+ },
283
+ pathRoot: "",
284
+ reload: () => {
285
+ throw new Error("__internal_toSnapshot called before Clerk is loaded");
286
+ }
287
+ });
288
+ },
289
+ get identifier() {
290
+ return gateProperty(target, "identifier", null);
291
+ },
292
+ get createdSessionId() {
293
+ return gateProperty(target, "createdSessionId", null);
294
+ },
295
+ get userData() {
296
+ return gateProperty(target, "userData", {});
297
+ },
298
+ get firstFactorVerification() {
299
+ return gateProperty(target, "firstFactorVerification", {
300
+ status: null,
301
+ error: null,
302
+ expireAt: null,
303
+ externalVerificationRedirectURL: null,
304
+ nonce: null,
305
+ attempts: null,
306
+ message: null,
307
+ strategy: null,
308
+ verifiedAtClient: null,
309
+ verifiedFromTheSameClient: () => false,
310
+ __internal_toSnapshot: () => {
311
+ throw new Error("__internal_toSnapshot called before Clerk is loaded");
312
+ },
313
+ pathRoot: "",
314
+ reload: () => {
315
+ throw new Error("__internal_toSnapshot called before Clerk is loaded");
316
+ }
317
+ });
318
+ },
319
+ get canBeDiscarded() {
320
+ return gateProperty(target, "canBeDiscarded", false);
321
+ },
322
+ create: this.gateMethod(target, "create"),
323
+ password: this.gateMethod(target, "password"),
324
+ sso: this.gateMethod(target, "sso"),
325
+ finalize: this.gateMethod(target, "finalize"),
326
+ reset: this.gateMethod(target, "reset"),
327
+ emailCode: this.wrapMethods(() => target().emailCode, ["sendCode", "verifyCode"]),
328
+ emailLink: this.wrapStruct(() => target().emailLink, ["sendLink", "waitForVerification"], ["verification"], { verification: null }),
329
+ resetPasswordEmailCode: this.wrapMethods(() => target().resetPasswordEmailCode, [
330
+ "sendCode",
331
+ "verifyCode",
332
+ "submitPassword"
333
+ ]),
334
+ resetPasswordPhoneCode: this.wrapMethods(() => target().resetPasswordPhoneCode, [
335
+ "sendCode",
336
+ "verifyCode",
337
+ "submitPassword"
338
+ ]),
339
+ phoneCode: this.wrapMethods(() => target().phoneCode, ["sendCode", "verifyCode"]),
340
+ mfa: this.wrapMethods(() => target().mfa, [
341
+ "sendPhoneCode",
342
+ "verifyPhoneCode",
343
+ "sendEmailCode",
344
+ "verifyEmailCode",
345
+ "verifyTOTP",
346
+ "verifyBackupCode"
347
+ ]),
348
+ ticket: this.gateMethod(target, "ticket"),
349
+ passkey: this.gateMethod(target, "passkey"),
350
+ web3: this.gateMethod(target, "web3")
351
+ }
352
+ };
353
+ }
354
+ buildSignUpProxy() {
355
+ const gateProperty = this.gateProperty.bind(this);
356
+ const gateMethod = this.gateMethod.bind(this);
357
+ const target = () => this.client.signUp.__internal_future;
358
+ return {
359
+ errors: defaultSignUpErrors(),
360
+ fetchStatus: "idle",
361
+ signUp: {
362
+ get id() {
363
+ return gateProperty(target, "id", void 0);
364
+ },
365
+ get requiredFields() {
366
+ return gateProperty(target, "requiredFields", []);
367
+ },
368
+ get optionalFields() {
369
+ return gateProperty(target, "optionalFields", []);
370
+ },
371
+ get missingFields() {
372
+ return gateProperty(target, "missingFields", []);
373
+ },
374
+ get username() {
375
+ return gateProperty(target, "username", null);
376
+ },
377
+ get firstName() {
378
+ return gateProperty(target, "firstName", null);
379
+ },
380
+ get lastName() {
381
+ return gateProperty(target, "lastName", null);
382
+ },
383
+ get emailAddress() {
384
+ return gateProperty(target, "emailAddress", null);
385
+ },
386
+ get phoneNumber() {
387
+ return gateProperty(target, "phoneNumber", null);
388
+ },
389
+ get web3Wallet() {
390
+ return gateProperty(target, "web3Wallet", null);
391
+ },
392
+ get hasPassword() {
393
+ return gateProperty(target, "hasPassword", false);
394
+ },
395
+ get unsafeMetadata() {
396
+ return gateProperty(target, "unsafeMetadata", {});
397
+ },
398
+ get createdSessionId() {
399
+ return gateProperty(target, "createdSessionId", null);
400
+ },
401
+ get createdUserId() {
402
+ return gateProperty(target, "createdUserId", null);
403
+ },
404
+ get abandonAt() {
405
+ return gateProperty(target, "abandonAt", null);
406
+ },
407
+ get legalAcceptedAt() {
408
+ return gateProperty(target, "legalAcceptedAt", null);
409
+ },
410
+ get locale() {
411
+ return gateProperty(target, "locale", null);
412
+ },
413
+ get status() {
414
+ return gateProperty(target, "status", "missing_requirements");
415
+ },
416
+ get unverifiedFields() {
417
+ return gateProperty(target, "unverifiedFields", []);
418
+ },
419
+ get isTransferable() {
420
+ return gateProperty(target, "isTransferable", false);
421
+ },
422
+ get canBeDiscarded() {
423
+ return gateProperty(target, "canBeDiscarded", false);
424
+ },
425
+ create: gateMethod(target, "create"),
426
+ update: gateMethod(target, "update"),
427
+ sso: gateMethod(target, "sso"),
428
+ password: gateMethod(target, "password"),
429
+ ticket: gateMethod(target, "ticket"),
430
+ web3: gateMethod(target, "web3"),
431
+ finalize: gateMethod(target, "finalize"),
432
+ reset: gateMethod(target, "reset"),
433
+ verifications: this.wrapStruct(() => target().verifications, [
434
+ "sendEmailCode",
435
+ "verifyEmailCode",
436
+ "sendEmailLink",
437
+ "waitForEmailLinkVerification",
438
+ "sendPhoneCode",
439
+ "verifyPhoneCode"
440
+ ], [
441
+ "emailAddress",
442
+ "phoneNumber",
443
+ "web3Wallet",
444
+ "externalAccount",
445
+ "emailLinkVerification"
446
+ ], {
447
+ emailAddress: defaultSignUpVerificationResource(),
448
+ phoneNumber: defaultSignUpVerificationResource(),
449
+ web3Wallet: defaultSignUpVerificationResource(),
450
+ externalAccount: defaultSignUpVerificationResource(),
451
+ emailLinkVerification: null
452
+ })
453
+ }
454
+ };
455
+ }
456
+ buildWaitlistProxy() {
457
+ const gateProperty = this.gateProperty.bind(this);
458
+ const gateMethod = this.gateMethod.bind(this);
459
+ const target = () => {
460
+ return this.state.__internal_waitlist;
461
+ };
462
+ return {
463
+ errors: defaultWaitlistErrors(),
464
+ fetchStatus: "idle",
465
+ waitlist: {
466
+ pathRoot: "/waitlist",
467
+ get id() {
468
+ return gateProperty(target, "id", "");
469
+ },
470
+ get createdAt() {
471
+ return gateProperty(target, "createdAt", null);
472
+ },
473
+ get updatedAt() {
474
+ return gateProperty(target, "updatedAt", null);
475
+ },
476
+ join: gateMethod(target, "join"),
477
+ reload: gateMethod(target, "reload")
478
+ }
479
+ };
480
+ }
481
+ buildCheckoutProxy(params) {
482
+ const gateProperty = this.gateProperty.bind(this);
483
+ const targetCheckout = () => this.checkout(params);
484
+ const target = () => targetCheckout().checkout;
485
+ return {
486
+ errors: {
487
+ raw: null,
488
+ global: null
489
+ },
490
+ fetchStatus: "idle",
491
+ checkout: {
492
+ get status() {
493
+ return gateProperty(target, "status", "needs_initialization");
494
+ },
495
+ get externalClientSecret() {
496
+ return gateProperty(target, "externalClientSecret", null);
497
+ },
498
+ get externalGatewayId() {
499
+ return gateProperty(target, "externalGatewayId", null);
500
+ },
501
+ get paymentMethod() {
502
+ return gateProperty(target, "paymentMethod", null);
503
+ },
504
+ get plan() {
505
+ return gateProperty(target, "plan", null);
506
+ },
507
+ get planPeriod() {
508
+ return gateProperty(target, "planPeriod", null);
509
+ },
510
+ get totals() {
511
+ return gateProperty(target, "totals", null);
512
+ },
513
+ get isImmediatePlanChange() {
514
+ return gateProperty(target, "isImmediatePlanChange", false);
515
+ },
516
+ get freeTrialEndsAt() {
517
+ return gateProperty(target, "freeTrialEndsAt", null);
518
+ },
519
+ get payer() {
520
+ return gateProperty(target, "payer", null);
521
+ },
522
+ get planPeriodStart() {
523
+ return gateProperty(target, "planPeriodStart", null);
524
+ },
525
+ get needsPaymentMethod() {
526
+ return gateProperty(target, "needsPaymentMethod", null);
527
+ },
528
+ start: this.gateMethod(target, "start"),
529
+ confirm: this.gateMethod(target, "confirm"),
530
+ finalize: this.gateMethod(target, "finalize")
531
+ }
532
+ };
533
+ }
534
+ __internal_effect(_) {
535
+ throw new Error("__internal_effect called before Clerk is loaded");
536
+ }
537
+ __internal_computed(_) {
538
+ throw new Error("__internal_computed called before Clerk is loaded");
539
+ }
540
+ get state() {
541
+ const s = this.isomorphicClerk.__internal_state;
542
+ if (!s) throw new Error("Clerk state not ready");
543
+ return s;
544
+ }
545
+ get client() {
546
+ const c = this.isomorphicClerk.client;
547
+ if (!c) throw new Error("Clerk client not ready");
548
+ return c;
549
+ }
550
+ get checkout() {
551
+ const c = this.isomorphicClerk.__experimental_checkout;
552
+ if (!c) throw new Error("Clerk checkout not ready");
553
+ return c;
554
+ }
555
+ gateProperty(getTarget, key, defaultValue) {
556
+ return (() => {
557
+ if (!(0, _clerk_shared_browser.inBrowser)() || !this.isomorphicClerk.loaded) return defaultValue;
558
+ return getTarget()[key];
559
+ })();
560
+ }
561
+ gateMethod(getTarget, key) {
562
+ return (async (...args) => {
563
+ if (!(0, _clerk_shared_browser.inBrowser)()) return require_useAssertWrappedByClerkProvider.errorThrower.throw(`Attempted to call a method (${key}) that is not supported on the server.`);
564
+ if (!this.isomorphicClerk.loaded) await new Promise((resolve) => this.isomorphicClerk.addOnLoaded(resolve));
565
+ const t = getTarget();
566
+ return t[key].apply(t, args);
567
+ });
568
+ }
569
+ wrapMethods(getTarget, keys) {
570
+ return Object.fromEntries(keys.map((k) => [k, this.gateMethod(getTarget, k)]));
571
+ }
572
+ wrapStruct(getTarget, methods, getters, fallbacks) {
573
+ const out = {};
574
+ for (const m of methods) out[m] = this.gateMethod(getTarget, m);
575
+ for (const g of getters) Object.defineProperty(out, g, {
576
+ get: () => this.gateProperty(getTarget, g, fallbacks[g]),
577
+ enumerable: true
578
+ });
579
+ return out;
580
+ }
581
+ };
582
+
583
+ //#endregion
584
+ //#region src/isomorphicClerk.ts
585
+ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") globalThis.__BUILD_DISABLE_RHC__ = false;
586
+ const SDK_METADATA = {
587
+ name: "@clerk/react",
588
+ version: "6.9.1-canary.v20260610190754",
589
+ environment: process.env.NODE_ENV
590
+ };
591
+ var IsomorphicClerk = class IsomorphicClerk {
592
+ #status;
593
+ #domain;
594
+ #proxyUrl;
595
+ #publishableKey;
596
+ #eventBus;
597
+ #stateProxy;
598
+ get publishableKey() {
599
+ return this.#publishableKey;
600
+ }
601
+ get loaded() {
602
+ return this.clerkjs?.loaded || false;
603
+ }
604
+ get status() {
605
+ /**
606
+ * If clerk-js is not available the returned value can either be "loading" or "error".
607
+ */
608
+ if (!this.clerkjs) return this.#status;
609
+ return this.clerkjs?.status || (this.clerkjs.loaded ? "ready" : "loading");
610
+ }
611
+ static #instance;
612
+ static getOrCreateInstance(options) {
613
+ if (!(0, _clerk_shared_browser.inBrowser)() || !this.#instance || options.Clerk && this.#instance.Clerk !== options.Clerk || this.#instance.publishableKey !== options.publishableKey) this.#instance = new IsomorphicClerk(options);
614
+ return this.#instance;
615
+ }
616
+ static clearInstance() {
617
+ this.#instance = null;
618
+ }
619
+ get domain() {
620
+ if (typeof window !== "undefined" && window.location) return (0, _clerk_shared_utils.handleValueOrFn)(this.#domain, new URL(window.location.href), "");
621
+ if (typeof this.#domain === "function") return require_useAssertWrappedByClerkProvider.errorThrower.throw(require_hooks.unsupportedNonBrowserDomainOrProxyUrlFunction);
622
+ return this.#domain || "";
623
+ }
624
+ get proxyUrl() {
625
+ if (typeof window !== "undefined" && window.location) return (0, _clerk_shared_utils.handleValueOrFn)(this.#proxyUrl, new URL(window.location.href), "");
626
+ if (typeof this.#proxyUrl === "function") return require_useAssertWrappedByClerkProvider.errorThrower.throw(require_hooks.unsupportedNonBrowserDomainOrProxyUrlFunction);
627
+ return this.#proxyUrl || "";
628
+ }
629
+ /**
630
+ * Accesses private options from the `Clerk` instance and defaults to
631
+ * `IsomorphicClerk` options when in SSR context.
632
+ * @internal
633
+ */
634
+ __internal_getOption(key) {
635
+ return this.clerkjs?.__internal_getOption ? this.clerkjs?.__internal_getOption(key) : this.options[key];
636
+ }
637
+ constructor(options) {
638
+ this.clerkjs = null;
639
+ this.preopenOneTap = null;
640
+ this.preopenUserVerification = null;
641
+ this.preopenEnableOrganizationsPrompt = null;
642
+ this.preopenSignIn = null;
643
+ this.preopenCheckout = null;
644
+ this.preopenPlanDetails = null;
645
+ this.preopenSubscriptionDetails = null;
646
+ this.preopenSignUp = null;
647
+ this.preopenUserProfile = null;
648
+ this.preopenOrganizationProfile = null;
649
+ this.preopenCreateOrganization = null;
650
+ this.preOpenWaitlist = null;
651
+ this.premountSignInNodes = /* @__PURE__ */ new Map();
652
+ this.premountSignUpNodes = /* @__PURE__ */ new Map();
653
+ this.premountUserAvatarNodes = /* @__PURE__ */ new Map();
654
+ this.premountUserProfileNodes = /* @__PURE__ */ new Map();
655
+ this.premountUserButtonNodes = /* @__PURE__ */ new Map();
656
+ this.premountOrganizationProfileNodes = /* @__PURE__ */ new Map();
657
+ this.premountCreateOrganizationNodes = /* @__PURE__ */ new Map();
658
+ this.premountOrganizationSwitcherNodes = /* @__PURE__ */ new Map();
659
+ this.premountOrganizationListNodes = /* @__PURE__ */ new Map();
660
+ this.premountMethodCalls = /* @__PURE__ */ new Map();
661
+ this.premountWaitlistNodes = /* @__PURE__ */ new Map();
662
+ this.premountPricingTableNodes = /* @__PURE__ */ new Map();
663
+ this.premountAPIKeysNodes = /* @__PURE__ */ new Map();
664
+ this.premountConfigureSSONodes = /* @__PURE__ */ new Map();
665
+ this.premountOAuthConsentNodes = /* @__PURE__ */ new Map();
666
+ this.premountTaskChooseOrganizationNodes = /* @__PURE__ */ new Map();
667
+ this.premountTaskResetPasswordNodes = /* @__PURE__ */ new Map();
668
+ this.premountTaskSetupMFANodes = /* @__PURE__ */ new Map();
669
+ this.premountAddListenerCalls = /* @__PURE__ */ new Map();
670
+ this.loadedListeners = [];
671
+ this.#status = "loading";
672
+ this.#eventBus = (0, _clerk_shared_clerkEventBus.createClerkEventBus)();
673
+ this.buildSignInUrl = (opts) => {
674
+ const callback = () => this.clerkjs?.buildSignInUrl(opts) || "";
675
+ if (this.clerkjs && this.loaded) return callback();
676
+ else this.premountMethodCalls.set("buildSignInUrl", callback);
677
+ };
678
+ this.buildSignUpUrl = (opts) => {
679
+ const callback = () => this.clerkjs?.buildSignUpUrl(opts) || "";
680
+ if (this.clerkjs && this.loaded) return callback();
681
+ else this.premountMethodCalls.set("buildSignUpUrl", callback);
682
+ };
683
+ this.buildAfterSignInUrl = (...args) => {
684
+ const callback = () => this.clerkjs?.buildAfterSignInUrl(...args) || "";
685
+ if (this.clerkjs && this.loaded) return callback();
686
+ else this.premountMethodCalls.set("buildAfterSignInUrl", callback);
687
+ };
688
+ this.buildAfterSignUpUrl = (...args) => {
689
+ const callback = () => this.clerkjs?.buildAfterSignUpUrl(...args) || "";
690
+ if (this.clerkjs && this.loaded) return callback();
691
+ else this.premountMethodCalls.set("buildAfterSignUpUrl", callback);
692
+ };
693
+ this.buildAfterSignOutUrl = () => {
694
+ const callback = () => this.clerkjs?.buildAfterSignOutUrl() || "";
695
+ if (this.clerkjs && this.loaded) return callback();
696
+ else this.premountMethodCalls.set("buildAfterSignOutUrl", callback);
697
+ };
698
+ this.buildNewSubscriptionRedirectUrl = () => {
699
+ const callback = () => this.clerkjs?.buildNewSubscriptionRedirectUrl() || "";
700
+ if (this.clerkjs && this.loaded) return callback();
701
+ else this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl", callback);
702
+ };
703
+ this.buildAfterMultiSessionSingleSignOutUrl = () => {
704
+ const callback = () => this.clerkjs?.buildAfterMultiSessionSingleSignOutUrl() || "";
705
+ if (this.clerkjs && this.loaded) return callback();
706
+ else this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl", callback);
707
+ };
708
+ this.buildUserProfileUrl = () => {
709
+ const callback = () => this.clerkjs?.buildUserProfileUrl() || "";
710
+ if (this.clerkjs && this.loaded) return callback();
711
+ else this.premountMethodCalls.set("buildUserProfileUrl", callback);
712
+ };
713
+ this.buildCreateOrganizationUrl = () => {
714
+ const callback = () => this.clerkjs?.buildCreateOrganizationUrl() || "";
715
+ if (this.clerkjs && this.loaded) return callback();
716
+ else this.premountMethodCalls.set("buildCreateOrganizationUrl", callback);
717
+ };
718
+ this.buildOrganizationProfileUrl = () => {
719
+ const callback = () => this.clerkjs?.buildOrganizationProfileUrl() || "";
720
+ if (this.clerkjs && this.loaded) return callback();
721
+ else this.premountMethodCalls.set("buildOrganizationProfileUrl", callback);
722
+ };
723
+ this.buildWaitlistUrl = () => {
724
+ const callback = () => this.clerkjs?.buildWaitlistUrl() || "";
725
+ if (this.clerkjs && this.loaded) return callback();
726
+ else this.premountMethodCalls.set("buildWaitlistUrl", callback);
727
+ };
728
+ this.buildTasksUrl = () => {
729
+ const callback = () => this.clerkjs?.buildTasksUrl() || "";
730
+ if (this.clerkjs && this.loaded) return callback();
731
+ else this.premountMethodCalls.set("buildTasksUrl", callback);
732
+ };
733
+ this.buildUrlWithAuth = (to) => {
734
+ const callback = () => this.clerkjs?.buildUrlWithAuth(to) || "";
735
+ if (this.clerkjs && this.loaded) return callback();
736
+ else this.premountMethodCalls.set("buildUrlWithAuth", callback);
737
+ };
738
+ this.handleUnauthenticated = async () => {
739
+ const callback = () => this.clerkjs?.handleUnauthenticated();
740
+ if (this.clerkjs && this.loaded) callback();
741
+ else this.premountMethodCalls.set("handleUnauthenticated", callback);
742
+ };
743
+ this.on = (...args) => {
744
+ if (this.clerkjs?.on) return this.clerkjs.on(...args);
745
+ else this.#eventBus.on(...args);
746
+ };
747
+ this.off = (...args) => {
748
+ if (this.clerkjs?.off) return this.clerkjs.off(...args);
749
+ else this.#eventBus.off(...args);
750
+ };
751
+ this.addOnLoaded = (cb) => {
752
+ this.loadedListeners.push(cb);
753
+ /**
754
+ * When IsomorphicClerk is loaded execute the callback directly
755
+ */
756
+ if (this.loaded) this.emitLoaded();
757
+ };
758
+ this.emitLoaded = () => {
759
+ this.loadedListeners.forEach((cb) => cb());
760
+ this.loadedListeners = [];
761
+ };
762
+ this.beforeLoad = (clerkjs) => {
763
+ if (!clerkjs) throw new Error("Failed to hydrate latest Clerk JS");
764
+ };
765
+ this.replayInterceptedInvocations = (clerkjs) => {
766
+ if (!clerkjs) throw new Error("Failed to hydrate latest Clerk JS");
767
+ this.clerkjs = clerkjs;
768
+ this.premountMethodCalls.forEach((cb) => cb());
769
+ this.premountAddListenerCalls.forEach((listenerExtras, listener) => {
770
+ listenerExtras.handlers.nativeUnsubscribe = clerkjs.addListener(listener, listenerExtras.options);
771
+ });
772
+ this.#eventBus.internal.retrieveListeners("status")?.forEach((listener) => {
773
+ this.on("status", listener, { notify: true });
774
+ });
775
+ if (this.preopenSignIn !== null) clerkjs.openSignIn(this.preopenSignIn);
776
+ if (this.preopenCheckout !== null) clerkjs.__internal_openCheckout(this.preopenCheckout);
777
+ if (this.preopenPlanDetails !== null) clerkjs.__internal_openPlanDetails(this.preopenPlanDetails);
778
+ if (this.preopenSubscriptionDetails !== null) clerkjs.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails);
779
+ if (this.preopenSignUp !== null) clerkjs.openSignUp(this.preopenSignUp);
780
+ if (this.preopenUserProfile !== null) clerkjs.openUserProfile(this.preopenUserProfile);
781
+ if (this.preopenUserVerification !== null) clerkjs.__internal_openReverification(this.preopenUserVerification);
782
+ if (this.preopenOneTap !== null) clerkjs.openGoogleOneTap(this.preopenOneTap);
783
+ if (this.preopenOrganizationProfile !== null) clerkjs.openOrganizationProfile(this.preopenOrganizationProfile);
784
+ if (this.preopenCreateOrganization !== null) clerkjs.openCreateOrganization(this.preopenCreateOrganization);
785
+ if (this.preOpenWaitlist !== null) clerkjs.openWaitlist(this.preOpenWaitlist);
786
+ if (this.preopenEnableOrganizationsPrompt) clerkjs.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt);
787
+ this.premountSignInNodes.forEach((props, node) => {
788
+ clerkjs.mountSignIn(node, props);
789
+ });
790
+ this.premountSignUpNodes.forEach((props, node) => {
791
+ clerkjs.mountSignUp(node, props);
792
+ });
793
+ this.premountUserProfileNodes.forEach((props, node) => {
794
+ clerkjs.mountUserProfile(node, props);
795
+ });
796
+ this.premountUserAvatarNodes.forEach((props, node) => {
797
+ clerkjs.mountUserAvatar(node, props);
798
+ });
799
+ this.premountUserButtonNodes.forEach((props, node) => {
800
+ clerkjs.mountUserButton(node, props);
801
+ });
802
+ this.premountOrganizationListNodes.forEach((props, node) => {
803
+ clerkjs.mountOrganizationList(node, props);
804
+ });
805
+ this.premountWaitlistNodes.forEach((props, node) => {
806
+ clerkjs.mountWaitlist(node, props);
807
+ });
808
+ this.premountPricingTableNodes.forEach((props, node) => {
809
+ clerkjs.mountPricingTable(node, props);
810
+ });
811
+ this.premountAPIKeysNodes.forEach((props, node) => {
812
+ clerkjs.mountAPIKeys(node, props);
813
+ });
814
+ this.premountConfigureSSONodes.forEach((props, node) => {
815
+ clerkjs.__internal_mountConfigureSSO(node, props);
816
+ });
817
+ this.premountOAuthConsentNodes.forEach((props, node) => {
818
+ clerkjs.__internal_mountOAuthConsent(node, props);
819
+ });
820
+ this.premountTaskChooseOrganizationNodes.forEach((props, node) => {
821
+ clerkjs.mountTaskChooseOrganization(node, props);
822
+ });
823
+ this.premountTaskResetPasswordNodes.forEach((props, node) => {
824
+ clerkjs.mountTaskResetPassword(node, props);
825
+ });
826
+ this.premountTaskSetupMFANodes.forEach((props, node) => {
827
+ clerkjs.mountTaskSetupMFA(node, props);
828
+ });
829
+ /**
830
+ * Only update status in case `clerk.status` is missing. In any other case, `clerk-js` should be the orchestrator.
831
+ */
832
+ if (typeof this.clerkjs.status === "undefined") this.#eventBus.emit(_clerk_shared_clerkEventBus.clerkEvents.Status, "ready");
833
+ this.emitLoaded();
834
+ return this.clerkjs;
835
+ };
836
+ this.__experimental_checkout = (...args) => {
837
+ return this.loaded && this.clerkjs ? this.clerkjs.__experimental_checkout(...args) : this.#stateProxy.checkoutSignal(...args);
838
+ };
839
+ this.__internal_updateProps = async (props) => {
840
+ const clerkjs = await this.#waitForClerkJS();
841
+ if (clerkjs && "__internal_updateProps" in clerkjs) return clerkjs.__internal_updateProps(props);
842
+ };
843
+ this.setActive = (params) => {
844
+ if (this.clerkjs) return this.clerkjs.setActive(params);
845
+ else return Promise.reject();
846
+ };
847
+ this.openSignIn = (props) => {
848
+ if (this.clerkjs && this.loaded) this.clerkjs.openSignIn(props);
849
+ else this.preopenSignIn = props;
850
+ };
851
+ this.closeSignIn = () => {
852
+ if (this.clerkjs && this.loaded) this.clerkjs.closeSignIn();
853
+ else this.preopenSignIn = null;
854
+ };
855
+ this.__internal_openCheckout = (props) => {
856
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_openCheckout(props);
857
+ else this.preopenCheckout = props;
858
+ };
859
+ this.__internal_closeCheckout = () => {
860
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_closeCheckout();
861
+ else this.preopenCheckout = null;
862
+ };
863
+ this.__internal_openPlanDetails = (props) => {
864
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_openPlanDetails(props);
865
+ else this.preopenPlanDetails = props;
866
+ };
867
+ this.__internal_closePlanDetails = () => {
868
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_closePlanDetails();
869
+ else this.preopenPlanDetails = null;
870
+ };
871
+ this.__internal_openSubscriptionDetails = (props) => {
872
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_openSubscriptionDetails(props);
873
+ else this.preopenSubscriptionDetails = props ?? null;
874
+ };
875
+ this.__internal_closeSubscriptionDetails = () => {
876
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_closeSubscriptionDetails();
877
+ else this.preopenSubscriptionDetails = null;
878
+ };
879
+ this.__internal_openReverification = (props) => {
880
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_openReverification(props);
881
+ else this.preopenUserVerification = props;
882
+ };
883
+ this.__internal_closeReverification = () => {
884
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_closeReverification();
885
+ else this.preopenUserVerification = null;
886
+ };
887
+ this.__internal_openEnableOrganizationsPrompt = (props) => {
888
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_openEnableOrganizationsPrompt(props);
889
+ else this.preopenEnableOrganizationsPrompt = props;
890
+ };
891
+ this.__internal_closeEnableOrganizationsPrompt = () => {
892
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_closeEnableOrganizationsPrompt();
893
+ else this.preopenEnableOrganizationsPrompt = null;
894
+ };
895
+ this.openGoogleOneTap = (props) => {
896
+ if (this.clerkjs && this.loaded) this.clerkjs.openGoogleOneTap(props);
897
+ else this.preopenOneTap = props;
898
+ };
899
+ this.closeGoogleOneTap = () => {
900
+ if (this.clerkjs && this.loaded) this.clerkjs.closeGoogleOneTap();
901
+ else this.preopenOneTap = null;
902
+ };
903
+ this.openUserProfile = (props) => {
904
+ if (this.clerkjs && this.loaded) this.clerkjs.openUserProfile(props);
905
+ else this.preopenUserProfile = props;
906
+ };
907
+ this.closeUserProfile = () => {
908
+ if (this.clerkjs && this.loaded) this.clerkjs.closeUserProfile();
909
+ else this.preopenUserProfile = null;
910
+ };
911
+ this.openOrganizationProfile = (props) => {
912
+ if (this.clerkjs && this.loaded) this.clerkjs.openOrganizationProfile(props);
913
+ else this.preopenOrganizationProfile = props;
914
+ };
915
+ this.closeOrganizationProfile = () => {
916
+ if (this.clerkjs && this.loaded) this.clerkjs.closeOrganizationProfile();
917
+ else this.preopenOrganizationProfile = null;
918
+ };
919
+ this.openCreateOrganization = (props) => {
920
+ if (this.clerkjs && this.loaded) this.clerkjs.openCreateOrganization(props);
921
+ else this.preopenCreateOrganization = props;
922
+ };
923
+ this.closeCreateOrganization = () => {
924
+ if (this.clerkjs && this.loaded) this.clerkjs.closeCreateOrganization();
925
+ else this.preopenCreateOrganization = null;
926
+ };
927
+ this.openWaitlist = (props) => {
928
+ if (this.clerkjs && this.loaded) this.clerkjs.openWaitlist(props);
929
+ else this.preOpenWaitlist = props;
930
+ };
931
+ this.closeWaitlist = () => {
932
+ if (this.clerkjs && this.loaded) this.clerkjs.closeWaitlist();
933
+ else this.preOpenWaitlist = null;
934
+ };
935
+ this.openSignUp = (props) => {
936
+ if (this.clerkjs && this.loaded) this.clerkjs.openSignUp(props);
937
+ else this.preopenSignUp = props;
938
+ };
939
+ this.closeSignUp = () => {
940
+ if (this.clerkjs && this.loaded) this.clerkjs.closeSignUp();
941
+ else this.preopenSignUp = null;
942
+ };
943
+ this.mountSignIn = (node, props) => {
944
+ if (this.clerkjs && this.loaded) this.clerkjs.mountSignIn(node, props);
945
+ else this.premountSignInNodes.set(node, props);
946
+ };
947
+ this.unmountSignIn = (node) => {
948
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountSignIn(node);
949
+ else this.premountSignInNodes.delete(node);
950
+ };
951
+ this.mountSignUp = (node, props) => {
952
+ if (this.clerkjs && this.loaded) this.clerkjs.mountSignUp(node, props);
953
+ else this.premountSignUpNodes.set(node, props);
954
+ };
955
+ this.unmountSignUp = (node) => {
956
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountSignUp(node);
957
+ else this.premountSignUpNodes.delete(node);
958
+ };
959
+ this.mountUserAvatar = (node, props) => {
960
+ if (this.clerkjs && this.loaded) this.clerkjs.mountUserAvatar(node, props);
961
+ else this.premountUserAvatarNodes.set(node, props);
962
+ };
963
+ this.unmountUserAvatar = (node) => {
964
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountUserAvatar(node);
965
+ else this.premountUserAvatarNodes.delete(node);
966
+ };
967
+ this.mountUserProfile = (node, props) => {
968
+ if (this.clerkjs && this.loaded) this.clerkjs.mountUserProfile(node, props);
969
+ else this.premountUserProfileNodes.set(node, props);
970
+ };
971
+ this.unmountUserProfile = (node) => {
972
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountUserProfile(node);
973
+ else this.premountUserProfileNodes.delete(node);
974
+ };
975
+ this.mountOrganizationProfile = (node, props) => {
976
+ if (this.clerkjs && this.loaded) this.clerkjs.mountOrganizationProfile(node, props);
977
+ else this.premountOrganizationProfileNodes.set(node, props);
978
+ };
979
+ this.unmountOrganizationProfile = (node) => {
980
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountOrganizationProfile(node);
981
+ else this.premountOrganizationProfileNodes.delete(node);
982
+ };
983
+ this.mountCreateOrganization = (node, props) => {
984
+ if (this.clerkjs && this.loaded) this.clerkjs.mountCreateOrganization(node, props);
985
+ else this.premountCreateOrganizationNodes.set(node, props);
986
+ };
987
+ this.unmountCreateOrganization = (node) => {
988
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountCreateOrganization(node);
989
+ else this.premountCreateOrganizationNodes.delete(node);
990
+ };
991
+ this.mountOrganizationSwitcher = (node, props) => {
992
+ if (this.clerkjs && this.loaded) this.clerkjs.mountOrganizationSwitcher(node, props);
993
+ else this.premountOrganizationSwitcherNodes.set(node, props);
994
+ };
995
+ this.unmountOrganizationSwitcher = (node) => {
996
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountOrganizationSwitcher(node);
997
+ else this.premountOrganizationSwitcherNodes.delete(node);
998
+ };
999
+ this.__experimental_prefetchOrganizationSwitcher = () => {
1000
+ const callback = () => this.clerkjs?.__experimental_prefetchOrganizationSwitcher();
1001
+ if (this.clerkjs && this.loaded) callback();
1002
+ else this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher", callback);
1003
+ };
1004
+ this.mountOrganizationList = (node, props) => {
1005
+ if (this.clerkjs && this.loaded) this.clerkjs.mountOrganizationList(node, props);
1006
+ else this.premountOrganizationListNodes.set(node, props);
1007
+ };
1008
+ this.unmountOrganizationList = (node) => {
1009
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountOrganizationList(node);
1010
+ else this.premountOrganizationListNodes.delete(node);
1011
+ };
1012
+ this.mountUserButton = (node, userButtonProps) => {
1013
+ if (this.clerkjs && this.loaded) this.clerkjs.mountUserButton(node, userButtonProps);
1014
+ else this.premountUserButtonNodes.set(node, userButtonProps);
1015
+ };
1016
+ this.unmountUserButton = (node) => {
1017
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountUserButton(node);
1018
+ else this.premountUserButtonNodes.delete(node);
1019
+ };
1020
+ this.mountWaitlist = (node, props) => {
1021
+ if (this.clerkjs && this.loaded) this.clerkjs.mountWaitlist(node, props);
1022
+ else this.premountWaitlistNodes.set(node, props);
1023
+ };
1024
+ this.unmountWaitlist = (node) => {
1025
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountWaitlist(node);
1026
+ else this.premountWaitlistNodes.delete(node);
1027
+ };
1028
+ this.mountPricingTable = (node, props) => {
1029
+ if (this.clerkjs && this.loaded) this.clerkjs.mountPricingTable(node, props);
1030
+ else this.premountPricingTableNodes.set(node, props);
1031
+ };
1032
+ this.unmountPricingTable = (node) => {
1033
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountPricingTable(node);
1034
+ else this.premountPricingTableNodes.delete(node);
1035
+ };
1036
+ this.mountAPIKeys = (node, props) => {
1037
+ if (this.clerkjs && this.loaded) this.clerkjs.mountAPIKeys(node, props);
1038
+ else this.premountAPIKeysNodes.set(node, props);
1039
+ };
1040
+ this.unmountAPIKeys = (node) => {
1041
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountAPIKeys(node);
1042
+ else this.premountAPIKeysNodes.delete(node);
1043
+ };
1044
+ this.__internal_mountConfigureSSO = (node, props) => {
1045
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_mountConfigureSSO(node, props);
1046
+ else this.premountConfigureSSONodes.set(node, props);
1047
+ };
1048
+ this.__internal_unmountConfigureSSO = (node) => {
1049
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_unmountConfigureSSO(node);
1050
+ else this.premountConfigureSSONodes.delete(node);
1051
+ };
1052
+ this.__internal_mountOAuthConsent = (node, props) => {
1053
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_mountOAuthConsent(node, props);
1054
+ else this.premountOAuthConsentNodes.set(node, props);
1055
+ };
1056
+ this.__internal_unmountOAuthConsent = (node) => {
1057
+ if (this.clerkjs && this.loaded) this.clerkjs.__internal_unmountOAuthConsent(node);
1058
+ else this.premountOAuthConsentNodes.delete(node);
1059
+ };
1060
+ this.mountOAuthConsent = (node, props) => {
1061
+ this.__internal_mountOAuthConsent(node, props);
1062
+ };
1063
+ this.unmountOAuthConsent = (node) => {
1064
+ this.__internal_unmountOAuthConsent(node);
1065
+ };
1066
+ this.mountTaskChooseOrganization = (node, props) => {
1067
+ if (this.clerkjs && this.loaded) this.clerkjs.mountTaskChooseOrganization(node, props);
1068
+ else this.premountTaskChooseOrganizationNodes.set(node, props);
1069
+ };
1070
+ this.unmountTaskChooseOrganization = (node) => {
1071
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountTaskChooseOrganization(node);
1072
+ else this.premountTaskChooseOrganizationNodes.delete(node);
1073
+ };
1074
+ this.mountTaskResetPassword = (node, props) => {
1075
+ if (this.clerkjs && this.loaded) this.clerkjs.mountTaskResetPassword(node, props);
1076
+ else this.premountTaskResetPasswordNodes.set(node, props);
1077
+ };
1078
+ this.unmountTaskResetPassword = (node) => {
1079
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountTaskResetPassword(node);
1080
+ else this.premountTaskResetPasswordNodes.delete(node);
1081
+ };
1082
+ this.mountTaskSetupMFA = (node, props) => {
1083
+ if (this.clerkjs && this.loaded) this.clerkjs.mountTaskSetupMFA(node, props);
1084
+ else this.premountTaskSetupMFANodes.set(node, props);
1085
+ };
1086
+ this.unmountTaskSetupMFA = (node) => {
1087
+ if (this.clerkjs && this.loaded) this.clerkjs.unmountTaskSetupMFA(node);
1088
+ else this.premountTaskSetupMFANodes.delete(node);
1089
+ };
1090
+ this.addListener = (listener, options) => {
1091
+ if (this.clerkjs) return this.clerkjs.addListener(listener, options);
1092
+ else {
1093
+ const unsubscribe = () => {
1094
+ const listenerExtras = this.premountAddListenerCalls.get(listener);
1095
+ if (listenerExtras?.handlers) {
1096
+ listenerExtras?.handlers.nativeUnsubscribe?.();
1097
+ this.premountAddListenerCalls.delete(listener);
1098
+ }
1099
+ };
1100
+ this.premountAddListenerCalls.set(listener, {
1101
+ options,
1102
+ handlers: {
1103
+ unsubscribe,
1104
+ nativeUnsubscribe: void 0
1105
+ }
1106
+ });
1107
+ return unsubscribe;
1108
+ }
1109
+ };
1110
+ this.navigate = (to) => {
1111
+ const callback = () => this.clerkjs?.navigate(to);
1112
+ if (this.clerkjs && this.loaded) callback();
1113
+ else this.premountMethodCalls.set("navigate", callback);
1114
+ };
1115
+ this.redirectWithAuth = async (...args) => {
1116
+ const callback = () => this.clerkjs?.redirectWithAuth(...args);
1117
+ if (this.clerkjs && this.loaded) return callback();
1118
+ else {
1119
+ this.premountMethodCalls.set("redirectWithAuth", callback);
1120
+ return;
1121
+ }
1122
+ };
1123
+ this.redirectToSignIn = async (opts) => {
1124
+ const callback = () => this.clerkjs?.redirectToSignIn(opts);
1125
+ if (this.clerkjs && this.loaded) return callback();
1126
+ else {
1127
+ this.premountMethodCalls.set("redirectToSignIn", callback);
1128
+ return;
1129
+ }
1130
+ };
1131
+ this.redirectToSignUp = async (opts) => {
1132
+ const callback = () => this.clerkjs?.redirectToSignUp(opts);
1133
+ if (this.clerkjs && this.loaded) return callback();
1134
+ else {
1135
+ this.premountMethodCalls.set("redirectToSignUp", callback);
1136
+ return;
1137
+ }
1138
+ };
1139
+ this.redirectToUserProfile = async () => {
1140
+ const callback = () => this.clerkjs?.redirectToUserProfile();
1141
+ if (this.clerkjs && this.loaded) return callback();
1142
+ else {
1143
+ this.premountMethodCalls.set("redirectToUserProfile", callback);
1144
+ return;
1145
+ }
1146
+ };
1147
+ this.redirectToAfterSignUp = () => {
1148
+ const callback = () => this.clerkjs?.redirectToAfterSignUp();
1149
+ if (this.clerkjs && this.loaded) return callback();
1150
+ else this.premountMethodCalls.set("redirectToAfterSignUp", callback);
1151
+ };
1152
+ this.redirectToAfterSignIn = () => {
1153
+ const callback = () => this.clerkjs?.redirectToAfterSignIn();
1154
+ if (this.clerkjs && this.loaded) callback();
1155
+ else this.premountMethodCalls.set("redirectToAfterSignIn", callback);
1156
+ };
1157
+ this.redirectToAfterSignOut = () => {
1158
+ const callback = () => this.clerkjs?.redirectToAfterSignOut();
1159
+ if (this.clerkjs && this.loaded) callback();
1160
+ else this.premountMethodCalls.set("redirectToAfterSignOut", callback);
1161
+ };
1162
+ this.redirectToOrganizationProfile = async () => {
1163
+ const callback = () => this.clerkjs?.redirectToOrganizationProfile();
1164
+ if (this.clerkjs && this.loaded) return callback();
1165
+ else {
1166
+ this.premountMethodCalls.set("redirectToOrganizationProfile", callback);
1167
+ return;
1168
+ }
1169
+ };
1170
+ this.redirectToCreateOrganization = async () => {
1171
+ const callback = () => this.clerkjs?.redirectToCreateOrganization();
1172
+ if (this.clerkjs && this.loaded) return callback();
1173
+ else {
1174
+ this.premountMethodCalls.set("redirectToCreateOrganization", callback);
1175
+ return;
1176
+ }
1177
+ };
1178
+ this.redirectToWaitlist = async () => {
1179
+ const callback = () => this.clerkjs?.redirectToWaitlist();
1180
+ if (this.clerkjs && this.loaded) return callback();
1181
+ else {
1182
+ this.premountMethodCalls.set("redirectToWaitlist", callback);
1183
+ return;
1184
+ }
1185
+ };
1186
+ this.redirectToTasks = async (opts) => {
1187
+ const callback = () => this.clerkjs?.redirectToTasks(opts);
1188
+ if (this.clerkjs && this.loaded) return callback();
1189
+ else {
1190
+ this.premountMethodCalls.set("redirectToTasks", callback);
1191
+ return;
1192
+ }
1193
+ };
1194
+ this.handleRedirectCallback = async (params) => {
1195
+ const callback = () => this.clerkjs?.handleRedirectCallback(params);
1196
+ if (this.clerkjs && this.loaded) callback()?.catch(() => {});
1197
+ else this.premountMethodCalls.set("handleRedirectCallback", callback);
1198
+ };
1199
+ this.handleGoogleOneTapCallback = async (signInOrUp, params) => {
1200
+ const callback = () => this.clerkjs?.handleGoogleOneTapCallback(signInOrUp, params);
1201
+ if (this.clerkjs && this.loaded) callback()?.catch(() => {});
1202
+ else this.premountMethodCalls.set("handleGoogleOneTapCallback", callback);
1203
+ };
1204
+ this.handleEmailLinkVerification = async (params) => {
1205
+ const callback = () => this.clerkjs?.handleEmailLinkVerification(params);
1206
+ if (this.clerkjs && this.loaded) return callback();
1207
+ else this.premountMethodCalls.set("handleEmailLinkVerification", callback);
1208
+ };
1209
+ this.authenticateWithMetamask = async (params) => {
1210
+ const callback = () => this.clerkjs?.authenticateWithMetamask(params);
1211
+ if (this.clerkjs && this.loaded) return callback();
1212
+ else this.premountMethodCalls.set("authenticateWithMetamask", callback);
1213
+ };
1214
+ this.authenticateWithCoinbaseWallet = async (params) => {
1215
+ const callback = () => this.clerkjs?.authenticateWithCoinbaseWallet(params);
1216
+ if (this.clerkjs && this.loaded) return callback();
1217
+ else this.premountMethodCalls.set("authenticateWithCoinbaseWallet", callback);
1218
+ };
1219
+ this.authenticateWithBase = async (params) => {
1220
+ const callback = () => this.clerkjs?.authenticateWithBase(params);
1221
+ if (this.clerkjs && this.loaded) return callback();
1222
+ else this.premountMethodCalls.set("authenticateWithBase", callback);
1223
+ };
1224
+ this.authenticateWithOKXWallet = async (params) => {
1225
+ const callback = () => this.clerkjs?.authenticateWithOKXWallet(params);
1226
+ if (this.clerkjs && this.loaded) return callback();
1227
+ else this.premountMethodCalls.set("authenticateWithOKXWallet", callback);
1228
+ };
1229
+ this.authenticateWithSolana = async (params) => {
1230
+ const callback = () => this.clerkjs?.authenticateWithSolana(params);
1231
+ if (this.clerkjs && this.loaded) return callback();
1232
+ else this.premountMethodCalls.set("authenticateWithSolana", callback);
1233
+ };
1234
+ this.authenticateWithWeb3 = async (params) => {
1235
+ const callback = () => this.clerkjs?.authenticateWithWeb3(params);
1236
+ if (this.clerkjs && this.loaded) return callback();
1237
+ else this.premountMethodCalls.set("authenticateWithWeb3", callback);
1238
+ };
1239
+ this.authenticateWithGoogleOneTap = async (params) => {
1240
+ return (await this.#waitForClerkJS()).authenticateWithGoogleOneTap(params);
1241
+ };
1242
+ this.__internal_loadStripeJs = async () => {
1243
+ return (await this.#waitForClerkJS()).__internal_loadStripeJs();
1244
+ };
1245
+ this.createOrganization = async (params) => {
1246
+ const callback = () => this.clerkjs?.createOrganization(params);
1247
+ if (this.clerkjs && this.loaded) return callback();
1248
+ else this.premountMethodCalls.set("createOrganization", callback);
1249
+ };
1250
+ this.getOrganization = async (organizationId) => {
1251
+ const callback = () => this.clerkjs?.getOrganization(organizationId);
1252
+ if (this.clerkjs && this.loaded) return callback();
1253
+ else this.premountMethodCalls.set("getOrganization", callback);
1254
+ };
1255
+ this.joinWaitlist = async (params) => {
1256
+ const callback = () => this.clerkjs?.joinWaitlist(params);
1257
+ if (this.clerkjs && this.loaded) return callback();
1258
+ else this.premountMethodCalls.set("joinWaitlist", callback);
1259
+ };
1260
+ this.signOut = async (...args) => {
1261
+ const callback = () => this.clerkjs?.signOut(...args);
1262
+ if (this.clerkjs && this.loaded) return callback();
1263
+ else this.premountMethodCalls.set("signOut", callback);
1264
+ };
1265
+ this.__internal_attemptToEnableEnvironmentSetting = (options) => {
1266
+ const callback = () => this.clerkjs?.__internal_attemptToEnableEnvironmentSetting(options);
1267
+ if (this.clerkjs && this.loaded) return callback();
1268
+ else this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting", callback);
1269
+ };
1270
+ this.#publishableKey = options?.publishableKey;
1271
+ this.#proxyUrl = options?.proxyUrl;
1272
+ this.#domain = options?.domain;
1273
+ this.options = options;
1274
+ this.Clerk = options?.Clerk || null;
1275
+ this.mode = (0, _clerk_shared_browser.inBrowser)() ? "browser" : "server";
1276
+ this.#stateProxy = new StateProxy(this);
1277
+ if (!this.options.sdkMetadata) this.options.sdkMetadata = SDK_METADATA;
1278
+ this.#eventBus.emit(_clerk_shared_clerkEventBus.clerkEvents.Status, "loading");
1279
+ this.#eventBus.prioritizedOn(_clerk_shared_clerkEventBus.clerkEvents.Status, (status) => this.#status = status);
1280
+ if (this.#publishableKey && this.options.experimental?.runtimeEnvironment === "headless" && this.options.Clerk) this.loadHeadlessClerk();
1281
+ else if (this.#publishableKey) this.getEntryChunks();
1282
+ }
1283
+ /**
1284
+ * Initialize Clerk for headless/React Native environments where a Clerk instance is provided directly.
1285
+ * Only handles Clerk construction and loading — post-load wiring is shared via replayInterceptedInvocations.
1286
+ */
1287
+ loadHeadlessClerk() {
1288
+ const clerk = require_hooks.isConstructor(this.options.Clerk) ? new this.options.Clerk(this.#publishableKey, {
1289
+ proxyUrl: this.proxyUrl,
1290
+ domain: this.domain
1291
+ }) : this.options.Clerk;
1292
+ if (!clerk) {
1293
+ this.#eventBus.emit(_clerk_shared_clerkEventBus.clerkEvents.Status, "error");
1294
+ return;
1295
+ }
1296
+ const onLoaded = () => {
1297
+ this.replayInterceptedInvocations(clerk);
1298
+ };
1299
+ if (!clerk.loaded) clerk.load(this.options).then(() => onLoaded()).catch((err) => {
1300
+ this.#eventBus.emit(_clerk_shared_clerkEventBus.clerkEvents.Status, "error");
1301
+ this.emitLoaded();
1302
+ });
1303
+ else onLoaded();
1304
+ }
1305
+ get sdkMetadata() {
1306
+ return this.clerkjs?.sdkMetadata || this.options.sdkMetadata || void 0;
1307
+ }
1308
+ get instanceType() {
1309
+ return this.clerkjs?.instanceType;
1310
+ }
1311
+ get frontendApi() {
1312
+ return this.clerkjs?.frontendApi || "";
1313
+ }
1314
+ get isStandardBrowser() {
1315
+ return this.clerkjs?.isStandardBrowser || this.options.standardBrowser || false;
1316
+ }
1317
+ get isSatellite() {
1318
+ if (typeof window !== "undefined" && window.location) return (0, _clerk_shared_utils.handleValueOrFn)(this.options.isSatellite, new URL(window.location.href), false);
1319
+ if (typeof this.options.isSatellite === "function") return require_useAssertWrappedByClerkProvider.errorThrower.throw(require_hooks.unsupportedNonBrowserDomainOrProxyUrlFunction);
1320
+ return false;
1321
+ }
1322
+ #waitForClerkJS() {
1323
+ return new Promise((resolve) => {
1324
+ this.addOnLoaded(() => resolve(this.clerkjs));
1325
+ });
1326
+ }
1327
+ async getEntryChunks() {
1328
+ if (this.mode !== "browser" || this.loaded) return;
1329
+ if (typeof window !== "undefined") {
1330
+ window.__clerk_publishable_key = this.#publishableKey;
1331
+ window.__clerk_proxy_url = this.proxyUrl;
1332
+ window.__clerk_domain = this.domain;
1333
+ }
1334
+ try {
1335
+ const clerk = await this.getClerkJsEntryChunk();
1336
+ if (!clerk.loaded) {
1337
+ this.beforeLoad(clerk);
1338
+ const ClerkUI = this.options.standardBrowser !== false && !this.options.Clerk || !!this.options.ui?.ClerkUI ? await this.getClerkUIEntryChunk() : void 0;
1339
+ await clerk.load({
1340
+ ...this.options,
1341
+ ui: {
1342
+ ...this.options.ui,
1343
+ ClerkUI
1344
+ }
1345
+ });
1346
+ }
1347
+ if (clerk.loaded) this.replayInterceptedInvocations(clerk);
1348
+ } catch (err) {
1349
+ const error = err;
1350
+ this.#eventBus.emit(_clerk_shared_clerkEventBus.clerkEvents.Status, "error");
1351
+ console.error(error.stack || error.message || error);
1352
+ return;
1353
+ }
1354
+ }
1355
+ async getClerkJsEntryChunk() {
1356
+ if ((!this.options.Clerk || this.options.__internal_clerkJSUrl) && !__BUILD_DISABLE_RHC__) await (0, _clerk_shared_loadClerkJsScript.loadClerkJSScript)({
1357
+ ...this.options,
1358
+ publishableKey: this.#publishableKey,
1359
+ proxyUrl: this.proxyUrl,
1360
+ domain: this.domain,
1361
+ nonce: this.options.nonce
1362
+ });
1363
+ if (this.options.Clerk && !this.options.__internal_clerkJSUrl) global.Clerk = require_hooks.isConstructor(this.options.Clerk) ? new this.options.Clerk(this.#publishableKey, {
1364
+ proxyUrl: this.proxyUrl,
1365
+ domain: this.domain
1366
+ }) : this.options.Clerk;
1367
+ if (!global.Clerk) throw new Error("Failed to download latest ClerkJS. Contact support@clerk.com.");
1368
+ return global.Clerk;
1369
+ }
1370
+ async getClerkUIEntryChunk() {
1371
+ const uiProp = this.options.ui;
1372
+ const hasInternalUrl = !!this.options.__internal_clerkUIUrl;
1373
+ if (uiProp?.ClerkUI && !hasInternalUrl) return uiProp.ClerkUI;
1374
+ if ((uiProp || this.options.prefetchUI === false) && !hasInternalUrl) return;
1375
+ if (!__BUILD_DISABLE_RHC__) {
1376
+ await (0, _clerk_shared_loadClerkJsScript.loadClerkUIScript)({
1377
+ ...this.options,
1378
+ publishableKey: this.#publishableKey,
1379
+ proxyUrl: this.proxyUrl,
1380
+ domain: this.domain,
1381
+ nonce: this.options.nonce
1382
+ });
1383
+ if (!global.__internal_ClerkUICtor) throw new Error("Failed to download latest Clerk UI. Contact support@clerk.com.");
1384
+ return global.__internal_ClerkUICtor;
1385
+ }
1386
+ }
1387
+ get version() {
1388
+ return this.clerkjs?.version;
1389
+ }
1390
+ get client() {
1391
+ if (this.clerkjs) return this.clerkjs.client;
1392
+ else return;
1393
+ }
1394
+ get session() {
1395
+ if (this.clerkjs) return this.clerkjs.session;
1396
+ else return;
1397
+ }
1398
+ get user() {
1399
+ if (this.clerkjs) return this.clerkjs.user;
1400
+ else return;
1401
+ }
1402
+ get organization() {
1403
+ if (this.clerkjs) return this.clerkjs.organization;
1404
+ else return;
1405
+ }
1406
+ get telemetry() {
1407
+ if (this.clerkjs) return this.clerkjs.telemetry;
1408
+ else return;
1409
+ }
1410
+ get __internal_environment() {
1411
+ if (this.clerkjs) return this.clerkjs.__internal_environment;
1412
+ else return;
1413
+ }
1414
+ get isSignedIn() {
1415
+ if (this.clerkjs) return this.clerkjs.isSignedIn;
1416
+ else return false;
1417
+ }
1418
+ get billing() {
1419
+ return this.clerkjs?.billing;
1420
+ }
1421
+ get __internal_state() {
1422
+ return this.loaded && this.clerkjs ? this.clerkjs.__internal_state : this.#stateProxy;
1423
+ }
1424
+ get apiKeys() {
1425
+ return this.clerkjs?.apiKeys;
1426
+ }
1427
+ get oauthApplication() {
1428
+ return this.clerkjs?.oauthApplication;
1429
+ }
1430
+ __internal_setEnvironment(...args) {
1431
+ if (this.clerkjs && "__internal_setEnvironment" in this.clerkjs) this.clerkjs.__internal_setEnvironment(args);
1432
+ else return;
1433
+ }
1434
+ get __internal_lastEmittedResources() {
1435
+ return this.clerkjs?.__internal_lastEmittedResources;
1436
+ }
1437
+ };
1438
+
1439
+ //#endregion
1440
+ //#region src/utils/versionCheck.ts
1441
+ /**
1442
+ * Checks if the host application's React version is compatible with @clerk/ui's shared variant.
1443
+ * The shared variant expects React to be provided via globalThis.__clerkSharedModules,
1444
+ * so we need to ensure the host's React version matches what @clerk/ui was built against.
1445
+ *
1446
+ * This function is evaluated once at module load time.
1447
+ */
1448
+ function computeReactVersionCompatibility() {
1449
+ try {
1450
+ return (0, _clerk_shared_versionCheck.isVersionCompatible)(react.default.version, [
1451
+ [
1452
+ 18,
1453
+ 0,
1454
+ -1,
1455
+ 0
1456
+ ],
1457
+ [
1458
+ 19,
1459
+ 0,
1460
+ 0,
1461
+ 3
1462
+ ],
1463
+ [
1464
+ 19,
1465
+ 1,
1466
+ 1,
1467
+ 4
1468
+ ],
1469
+ [
1470
+ 19,
1471
+ 2,
1472
+ 2,
1473
+ 3
1474
+ ],
1475
+ [
1476
+ 19,
1477
+ 3,
1478
+ 3,
1479
+ 0
1480
+ ]
1481
+ ]);
1482
+ } catch {
1483
+ return false;
1484
+ }
1485
+ }
1486
+ /**
1487
+ * Whether the host React version is compatible with the shared @clerk/ui variant.
1488
+ * This is computed once at module load time for optimal performance.
1489
+ */
1490
+ const IS_REACT_SHARED_VARIANT_COMPATIBLE = computeReactVersionCompatibility();
1491
+
1492
+ //#endregion
1493
+ //#region src/contexts/ClerkProvider.tsx
1494
+ function ClerkProviderBase(props) {
1495
+ const { initialState, children, ...restIsomorphicClerkOptions } = props;
1496
+ const { isomorphicClerk, clerkStatus } = useLoadedIsomorphicClerk(require_hooks.mergeWithEnv(restIsomorphicClerkOptions));
1497
+ return /* @__PURE__ */ react.default.createElement(_clerk_shared_react.ClerkContextProvider, {
1498
+ initialState,
1499
+ clerk: isomorphicClerk,
1500
+ clerkStatus
1501
+ }, children);
1502
+ }
1503
+ const ClerkProvider = require_hooks.withMaxAllowedInstancesGuard(ClerkProviderBase, "ClerkProvider", require_hooks.multipleClerkProvidersError);
1504
+ ClerkProvider.displayName = "ClerkProvider";
1505
+ const DEFAULT_CLERK_UI_VARIANT = IS_REACT_SHARED_VARIANT_COMPATIBLE ? "shared" : "";
1506
+ const useLoadedIsomorphicClerk = (mergedOptions) => {
1507
+ const optionsWithDefaults = react.default.useMemo(() => ({
1508
+ clerkUIVariant: DEFAULT_CLERK_UI_VARIANT,
1509
+ ...mergedOptions
1510
+ }), [mergedOptions]);
1511
+ const isomorphicClerkRef = react.default.useRef(IsomorphicClerk.getOrCreateInstance(optionsWithDefaults));
1512
+ const [clerkStatus, setClerkStatus] = react.default.useState(isomorphicClerkRef.current.status);
1513
+ react.default.useEffect(() => {
1514
+ isomorphicClerkRef.current.__internal_updateProps({ appearance: mergedOptions.appearance });
1515
+ }, [mergedOptions.appearance]);
1516
+ react.default.useEffect(() => {
1517
+ isomorphicClerkRef.current.__internal_updateProps({ options: mergedOptions });
1518
+ }, [mergedOptions.localization]);
1519
+ react.default.useEffect(() => {
1520
+ isomorphicClerkRef.current.on("status", setClerkStatus);
1521
+ return () => {
1522
+ if (isomorphicClerkRef.current) isomorphicClerkRef.current.off("status", setClerkStatus);
1523
+ IsomorphicClerk.clearInstance();
1524
+ };
1525
+ }, []);
1526
+ return {
1527
+ isomorphicClerk: isomorphicClerkRef.current,
1528
+ clerkStatus
1529
+ };
1530
+ };
1531
+
1532
+ //#endregion
1533
+ Object.defineProperty(exports, 'AuthenticateWithRedirectCallback', {
1534
+ enumerable: true,
1535
+ get: function () {
1536
+ return AuthenticateWithRedirectCallback;
1537
+ }
1538
+ });
1539
+ Object.defineProperty(exports, 'ClerkDegraded', {
1540
+ enumerable: true,
1541
+ get: function () {
1542
+ return ClerkDegraded;
1543
+ }
1544
+ });
1545
+ Object.defineProperty(exports, 'ClerkFailed', {
1546
+ enumerable: true,
1547
+ get: function () {
1548
+ return ClerkFailed;
1549
+ }
1550
+ });
1551
+ Object.defineProperty(exports, 'ClerkLoaded', {
1552
+ enumerable: true,
1553
+ get: function () {
1554
+ return ClerkLoaded;
1555
+ }
1556
+ });
1557
+ Object.defineProperty(exports, 'ClerkLoading', {
1558
+ enumerable: true,
1559
+ get: function () {
1560
+ return ClerkLoading;
1561
+ }
1562
+ });
1563
+ Object.defineProperty(exports, 'ClerkProvider', {
1564
+ enumerable: true,
1565
+ get: function () {
1566
+ return ClerkProvider;
1567
+ }
1568
+ });
1569
+ Object.defineProperty(exports, 'IS_REACT_SHARED_VARIANT_COMPATIBLE', {
1570
+ enumerable: true,
1571
+ get: function () {
1572
+ return IS_REACT_SHARED_VARIANT_COMPATIBLE;
1573
+ }
1574
+ });
1575
+ Object.defineProperty(exports, 'MultisessionAppSupport', {
1576
+ enumerable: true,
1577
+ get: function () {
1578
+ return MultisessionAppSupport;
1579
+ }
1580
+ });
1581
+ Object.defineProperty(exports, 'RedirectToCreateOrganization', {
1582
+ enumerable: true,
1583
+ get: function () {
1584
+ return RedirectToCreateOrganization;
1585
+ }
1586
+ });
1587
+ Object.defineProperty(exports, 'RedirectToOrganizationProfile', {
1588
+ enumerable: true,
1589
+ get: function () {
1590
+ return RedirectToOrganizationProfile;
1591
+ }
1592
+ });
1593
+ Object.defineProperty(exports, 'RedirectToSignIn', {
1594
+ enumerable: true,
1595
+ get: function () {
1596
+ return RedirectToSignIn;
1597
+ }
1598
+ });
1599
+ Object.defineProperty(exports, 'RedirectToSignUp', {
1600
+ enumerable: true,
1601
+ get: function () {
1602
+ return RedirectToSignUp;
1603
+ }
1604
+ });
1605
+ Object.defineProperty(exports, 'RedirectToTasks', {
1606
+ enumerable: true,
1607
+ get: function () {
1608
+ return RedirectToTasks;
1609
+ }
1610
+ });
1611
+ Object.defineProperty(exports, 'RedirectToUserProfile', {
1612
+ enumerable: true,
1613
+ get: function () {
1614
+ return RedirectToUserProfile;
1615
+ }
1616
+ });
1617
+ Object.defineProperty(exports, 'Show', {
1618
+ enumerable: true,
1619
+ get: function () {
1620
+ return Show;
1621
+ }
1622
+ });
1623
+ //# sourceMappingURL=ClerkProvider-9lxHp9j5.cjs.map