@zackbart/connecta 0.28.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +855 -5
- package/README.md +125 -116
- package/bin/connecta.mjs +121 -139
- package/bin/meta-tool-names.d.mts +2 -0
- package/bin/meta-tool-names.mjs +9 -0
- package/bin/version.mjs +3 -0
- package/dist/access-tokens.js +53 -63
- package/dist/activity-request.js +8 -0
- package/dist/activity.d.ts +76 -42
- package/dist/activity.js +110 -42
- package/dist/argument-redaction.js +230 -0
- package/dist/auth/clerk-sdk/client.d.ts +65 -0
- package/dist/auth/clerk-sdk/client.js +5 -0
- package/dist/auth/clerk-sdk/generated.js +1845 -0
- package/dist/auth/clerk-transport.js +19 -0
- package/dist/auth/clerk.d.ts +17 -7
- package/dist/auth/clerk.js +189 -107
- package/dist/auth/cloudflare-access.js +25 -26
- package/dist/auth/downstream-client-metadata.d.ts +29 -0
- package/dist/auth/downstream-client-metadata.js +133 -0
- package/dist/auth/downstream-oauth.js +1584 -1580
- package/dist/auth/downstream-revocation.js +106 -0
- package/dist/auth/oauth-token-response.js +231 -0
- package/dist/auth/oauth-v2-migration.js +116 -0
- package/dist/auth/static-oauth.js +93 -71
- package/dist/auth-elicitation.js +288 -0
- package/dist/authorization-handoff.js +111 -0
- package/dist/branding.d.ts +8 -16
- package/dist/branding.js +26 -59
- package/dist/byte-read-response.js +39 -0
- package/dist/call-admission.js +12 -16
- package/dist/catalog-cache.js +739 -0
- package/dist/catalog-drift.d.ts +50 -15
- package/dist/catalog-drift.js +365 -128
- package/dist/catalog-fingerprint.js +2 -4
- package/dist/catalog-freshness.js +13 -0
- package/dist/catalog-limits.js +2 -2
- package/dist/catalog-service.js +409 -225
- package/dist/catalog.js +43 -84
- package/dist/concurrency.js +3 -4
- package/dist/config-defaults.d.ts +39 -0
- package/dist/config-defaults.js +46 -0
- package/dist/config-schema.d.ts +181 -0
- package/dist/config-schema.js +435 -0
- package/dist/config-value-sources.js +102 -0
- package/dist/config.d.ts +633 -0
- package/dist/config.js +508 -0
- package/dist/connector-access.d.ts +1 -0
- package/dist/connector-access.js +13 -15
- package/dist/connector-caller.d.ts +8 -0
- package/dist/connector-caller.js +15 -6
- package/dist/connector-scope.js +1 -1
- package/dist/connectors/api-connector.d.ts +59 -7
- package/dist/connectors/api-connector.js +106 -19
- package/dist/connectors/api.js +4 -1
- package/dist/connectors/guarded-fetch.d.ts +144 -0
- package/dist/connectors/guarded-fetch.js +87 -38
- package/dist/connectors/negotiation-cache.js +46 -0
- package/dist/connectors/option-shapes.js +27 -0
- package/dist/connectors/remote-mcp.d.ts +30 -4
- package/dist/connectors/remote-mcp.js +1774 -320
- package/dist/connectors/resource-uri.js +335 -0
- package/dist/credential-contract.d.ts +10 -0
- package/dist/credential-rules.js +1 -3
- package/dist/credential-url.js +108 -0
- package/dist/credentials.d.ts +6 -1
- package/dist/credentials.js +27 -18
- package/dist/d1.d.ts +130 -0
- package/dist/d1.js +290 -0
- package/dist/describe-config.d.ts +165 -0
- package/dist/describe-config.js +315 -0
- package/dist/described.js +106 -0
- package/dist/downstream-input-context.js +128 -0
- package/dist/downstream-input.js +325 -0
- package/dist/errors.d.ts +132 -31
- package/dist/errors.js +175 -87
- package/dist/execute.js +798 -318
- package/dist/executor-admission.d.ts +1 -0
- package/dist/executor-admission.js +11 -15
- package/dist/executor-contract.d.ts +20 -0
- package/dist/executor-contract.js +48 -0
- package/dist/executor-result.js +30 -13
- package/dist/executors/quickjs-child.js +15 -9
- package/dist/executors/quickjs-protocol.js +5 -6
- package/dist/executors/quickjs-runtime.js +152 -59
- package/dist/executors/quickjs.js +49 -39
- package/dist/favicon.js +1 -2
- package/dist/fix-prompt.js +1 -3
- package/dist/guest-runtime.js +238 -0
- package/dist/guest-types.d.ts +218 -0
- package/dist/guest-types.js +1 -0
- package/dist/html-security.js +24 -0
- package/dist/identity.js +1 -3
- package/dist/inbound-credential.js +52 -0
- package/dist/index.d.ts +24 -256
- package/dist/index.js +65 -478
- package/dist/invocation-auth.js +69 -0
- package/dist/invocation.js +262 -79
- package/dist/json-schema.d.ts +1 -1
- package/dist/mcp-client-context.js +35 -0
- package/dist/mcp-result.js +11 -7
- package/dist/meta-output.js +61 -0
- package/dist/meta-tool-names.d.ts +2 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/meta-tools.js +419 -272
- package/dist/module-contracts.d.ts +8 -23
- package/dist/node.d.ts +0 -2
- package/dist/node.js +2 -2
- package/dist/oauth-callback-outcome.js +1 -3
- package/dist/oauth-handoff.js +194 -0
- package/dist/oauth-sealing.js +20 -0
- package/dist/operator-record.d.ts +137 -0
- package/dist/operator-record.js +420 -0
- package/dist/operator-ui/assets.js +31 -0
- package/dist/operator-ui/contract.d.ts +72 -0
- package/dist/operator-ui/contract.js +1 -0
- package/dist/operator-ui/fix-prompts.d.ts +18 -0
- package/dist/operator-ui/generated.js +5 -4
- package/dist/operator-ui/model.d.ts +12 -87
- package/dist/operator-ui/model.js +2 -9
- package/dist/operator-ui/setup-commands.js +1 -3
- package/dist/operator-ui/view.d.ts +323 -0
- package/dist/operator-ui/view.js +62 -189
- package/dist/page-styles.js +2 -3
- package/dist/program-result.js +5 -0
- package/dist/program-source.js +14 -2
- package/dist/{exempt-writes.js → program-writes.js} +60 -19
- package/dist/provider.d.ts +142 -0
- package/dist/provider.js +187 -0
- package/dist/providers/_shared/google/result-size.js +57 -0
- package/dist/providers/_shared/google/service-account.d.ts +58 -0
- package/dist/providers/_shared/google/service-account.js +500 -0
- package/dist/providers/_shared/google/workspace.d.ts +276 -0
- package/dist/providers/_shared/google/workspace.js +518 -0
- package/dist/providers/_shared/request-token.js +83 -0
- package/dist/providers/{basecamp.d.ts → basecamp/index.d.ts} +6 -28
- package/dist/providers/basecamp/index.js +997 -0
- package/dist/providers/basecamp/skill.generated.js +9 -0
- package/dist/providers/{breeze.d.ts → breeze/index.d.ts} +2 -2
- package/dist/providers/{breeze.js → breeze/index.js} +184 -140
- package/dist/providers/breeze/skill.generated.js +9 -0
- package/dist/providers/{ccb.d.ts → ccb/index.d.ts} +2 -2
- package/dist/providers/{ccb.js → ccb/index.js} +271 -116
- package/dist/providers/ccb/skill.generated.js +9 -0
- package/dist/providers/{cloudflare.d.ts → cloudflare/index.d.ts} +8 -7
- package/dist/providers/{cloudflare.js → cloudflare/index.js} +171 -738
- package/dist/providers/cloudflare/skill.generated.js +10 -0
- package/dist/providers/docs/index.d.ts +54 -0
- package/dist/providers/docs/index.js +1237 -0
- package/dist/providers/docs/skill.generated.js +9 -0
- package/dist/providers/drive/index.d.ts +53 -0
- package/dist/providers/drive/index.js +1523 -0
- package/dist/providers/drive/skill.generated.js +9 -0
- package/dist/providers/forms/index.d.ts +54 -0
- package/dist/providers/forms/index.js +1217 -0
- package/dist/providers/forms/skill.generated.js +11 -0
- package/dist/providers/github/auth.d.ts +32 -0
- package/dist/providers/github/auth.js +361 -0
- package/dist/providers/github/hosted.js +218 -0
- package/dist/providers/github/index.d.ts +13 -0
- package/dist/providers/github/index.js +140 -0
- package/dist/providers/github/key.js +100 -0
- package/dist/providers/github/rest.js +321 -0
- package/dist/providers/github/scope.d.ts +29 -0
- package/dist/providers/github/scope.js +124 -0
- package/dist/providers/github/skill.generated.js +8 -0
- package/dist/providers/gmail/index.d.ts +51 -0
- package/dist/providers/gmail/index.js +1436 -0
- package/dist/providers/gmail/skill.generated.js +9 -0
- package/dist/providers/infisical/index.d.ts +7 -0
- package/dist/providers/infisical/index.js +713 -0
- package/dist/providers/infisical/skill.generated.js +8 -0
- package/dist/providers/{linear.d.ts → linear/index.d.ts} +11 -14
- package/dist/providers/linear/index.js +352 -0
- package/dist/providers/linear/skill.generated.js +8 -0
- package/dist/providers/{mixpanel.d.ts → mixpanel/index.d.ts} +5 -10
- package/dist/providers/mixpanel/index.js +416 -0
- package/dist/providers/mixpanel/skill.generated.js +9 -0
- package/dist/providers/{notion.d.ts → notion/index.d.ts} +8 -8
- package/dist/providers/{notion.js → notion/index.js} +226 -239
- package/dist/providers/notion/skill.generated.js +10 -0
- package/dist/providers/{overflow.d.ts → overflow/index.d.ts} +2 -2
- package/dist/providers/{overflow.js → overflow/index.js} +74 -111
- package/dist/providers/overflow/skill.generated.js +8 -0
- package/dist/providers/{planning-center.d.ts → planning-center/index.d.ts} +2 -2
- package/dist/providers/{planning-center.js → planning-center/index.js} +264 -104
- package/dist/providers/planning-center/skill.generated.js +10 -0
- package/dist/providers/{revenuecat.d.ts → revenuecat/index.d.ts} +5 -10
- package/dist/providers/revenuecat/index.js +557 -0
- package/dist/providers/revenuecat/skill.generated.js +11 -0
- package/dist/providers/sheets/index.d.ts +54 -0
- package/dist/providers/sheets/index.js +1237 -0
- package/dist/providers/sheets/skill.generated.js +10 -0
- package/dist/providers/slides/index.d.ts +53 -0
- package/dist/providers/slides/index.js +2645 -0
- package/dist/providers/slides/skill.generated.js +9 -0
- package/dist/providers/{stripe.d.ts → stripe/index.d.ts} +5 -12
- package/dist/providers/stripe/index.js +266 -0
- package/dist/providers/stripe/skill.generated.js +11 -0
- package/dist/providers/{tithely.d.ts → tithely/index.d.ts} +2 -2
- package/dist/providers/{tithely.js → tithely/index.js} +60 -91
- package/dist/providers/tithely/skill.generated.js +8 -0
- package/dist/providers/{vercel.d.ts → vercel/index.d.ts} +8 -8
- package/dist/providers/vercel/index.js +1038 -0
- package/dist/providers/vercel/mcp-ownership.js +212 -0
- package/dist/providers/vercel/skill.generated.js +11 -0
- package/dist/registry.d.ts +110 -171
- package/dist/registry.js +588 -927
- package/dist/request-state.js +21 -0
- package/dist/resource-read.js +103 -0
- package/dist/result-shapes.js +17 -49
- package/dist/retired-toolkits.js +1 -1
- package/dist/routes/access-tokens.js +3 -6
- package/dist/routes/activity-context.js +21 -0
- package/dist/routes/activity-disclosure.js +40 -0
- package/dist/routes/activity.js +59 -21
- package/dist/routes/actor-labels.js +3 -50
- package/dist/routes/connect.js +221 -0
- package/dist/routes/credentials.js +15 -27
- package/dist/routes/mcp.js +365 -130
- package/dist/routes/oauth-client-metadata.js +15 -0
- package/dist/routes/oauth-management.js +45 -107
- package/dist/routes/oauth.js +110 -57
- package/dist/routes/operator.js +3 -3
- package/dist/routes/shared.d.ts +25 -64
- package/dist/routes/shared.js +160 -80
- package/dist/routes/skills.js +30 -0
- package/dist/routes/ui-config.js +225 -0
- package/dist/routes/ui-data.js +40 -35
- package/dist/routes/ui.js +66 -56
- package/dist/runtime/admission.js +4 -2
- package/dist/runtime/call-admission.js +3 -1
- package/dist/runtime/connector-scope.js +1 -4
- package/dist/runtime/run.js +10 -39
- package/dist/runtime/services.js +12 -117
- package/dist/runtime/shared-read.js +1 -3
- package/dist/runtime/storage.js +8 -1
- package/dist/sent-secrets.d.ts +93 -0
- package/dist/sent-secrets.js +1013 -0
- package/dist/server.js +28 -71
- package/dist/skills.js +416 -174
- package/dist/sqlite.d.ts +48 -0
- package/dist/sqlite.js +181 -0
- package/dist/storage/keys.js +443 -0
- package/dist/storage/memory.js +16 -4
- package/dist/storage/sql.d.ts +66 -0
- package/dist/storage/sql.js +543 -0
- package/dist/timeout.js +4 -2
- package/dist/tool-name.js +17 -0
- package/dist/tool-safety.d.ts +9 -35
- package/dist/tool-safety.js +20 -40
- package/dist/types.d.ts +336 -56
- package/dist/types.js +0 -1
- package/dist/ui.d.ts +7 -19
- package/dist/ui.js +76 -90
- package/dist/url-safety.js +3 -6
- package/dist/usage-guide.js +146 -0
- package/dist/validate.d.ts +7 -0
- package/dist/validate.js +309 -47
- package/dist/version.d.ts +1 -7
- package/dist/version.js +3 -7
- package/dist/worker.d.ts +11 -0
- package/dist/worker.js +435 -0
- package/documentation/README.md +63 -0
- package/documentation/architecture.md +696 -231
- package/documentation/auth.md +1069 -546
- package/documentation/code-mode.md +662 -356
- package/documentation/deploying.md +146 -0
- package/documentation/integrating.md +159 -0
- package/documentation/meta-tools.md +570 -216
- package/documentation/operating.md +135 -0
- package/documentation/operator-tests.md +97 -0
- package/documentation/operator-ui.md +132 -0
- package/documentation/provider-migration-0.29.md +65 -0
- package/examples/worker/AGENTS.md +34 -12
- package/examples/worker/README.md +293 -255
- package/examples/worker/kv-to-d1.wrangler.jsonc +26 -0
- package/examples/worker/scripts/copy-kv-to-d1.mjs +162 -0
- package/examples/worker/src/connecta.config.ts +151 -0
- package/examples/worker/src/index.ts +14 -197
- package/examples/worker/wrangler.jsonc +15 -35
- package/package.json +126 -54
- package/templates/node/.dockerignore +1 -2
- package/templates/node/.env.example +20 -21
- package/templates/node/AGENTS.md +21 -17
- package/templates/node/Dockerfile +3 -5
- package/templates/node/README.md +140 -58
- package/templates/node/docker-compose.yml +11 -12
- package/templates/node/package.json +4 -2
- package/templates/node/src/connecta.config.ts +119 -0
- package/templates/node/src/index.ts +9 -154
- package/templates/node/src/provision-token.ts +17 -0
- package/AGENTS.md +0 -170
- package/dist/artifacts/connector.d.ts +0 -58
- package/dist/artifacts/connector.js +0 -730
- package/dist/artifacts/document.js +0 -86
- package/dist/artifacts/guide.js +0 -140
- package/dist/artifacts/html-scan.js +0 -329
- package/dist/artifacts/json.js +0 -78
- package/dist/artifacts/kv-store.d.ts +0 -20
- package/dist/artifacts/kv-store.js +0 -140
- package/dist/artifacts/markdown.js +0 -478
- package/dist/artifacts/module.d.ts +0 -37
- package/dist/artifacts/module.js +0 -66
- package/dist/artifacts/operations.d.ts +0 -197
- package/dist/artifacts/operations.js +0 -1002
- package/dist/artifacts/refresh.d.ts +0 -55
- package/dist/artifacts/refresh.js +0 -236
- package/dist/artifacts/routes.js +0 -206
- package/dist/artifacts/types.d.ts +0 -214
- package/dist/artifacts/types.js +0 -22
- package/dist/artifacts/validate.d.ts +0 -62
- package/dist/artifacts/validate.js +0 -651
- package/dist/artifacts.d.ts +0 -6
- package/dist/artifacts.js +0 -9
- package/dist/auth/bearer.d.ts +0 -11
- package/dist/auth/bearer.js +0 -50
- package/dist/providers/basecamp.js +0 -445
- package/dist/providers/linear.js +0 -217
- package/dist/providers/mixpanel.js +0 -247
- package/dist/providers/revenuecat.js +0 -317
- package/dist/providers/stripe.js +0 -253
- package/dist/providers/vercel.js +0 -1253
- package/dist/storage/file.d.ts +0 -15
- package/dist/storage/file.js +0 -455
- package/ethos.md +0 -93
- package/examples/worker/src/cloudflare-kv.ts +0 -43
- package/examples/worker/src/d1-activity-row.ts +0 -155
- package/examples/worker/src/d1-activity.ts +0 -147
- package/examples/worker/src/d1-storage.ts +0 -138
- package/examples/worker/src/r2-artifact-blobs.ts +0 -29
- package/templates/node/src/file-activity.ts +0 -182
|
@@ -0,0 +1,1845 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Generated by scripts/build-clerk-sdk.mjs from @clerk/backend 3.12.0. Do not edit.
|
|
3
|
+
// Runtime-neutral SDK copy with instance fetch and checked diagnostic hooks.
|
|
4
|
+
/*!
|
|
5
|
+
Clerk Backend SDK 3.12.0:
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2022 Clerk, Inc.
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Clerk Shared:
|
|
29
|
+
MIT License
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2022 Clerk Inc
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
35
|
+
in the Software without restriction, including without limitation the rights
|
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
38
|
+
furnished to do so, subject to the following conditions:
|
|
39
|
+
|
|
40
|
+
The above copyright notice and this permission notice shall be included in all
|
|
41
|
+
copies or substantial portions of the Software.
|
|
42
|
+
|
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
+
SOFTWARE.
|
|
50
|
+
*/
|
|
51
|
+
import { clerkSdkFailure as oe } from "../clerk-transport.js";
|
|
52
|
+
var Kt = ["CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "GITLAB_CI", "CIRCLECI", "TRAVIS", "BUILDKITE", "BITBUCKET_BUILD_NUMBER", "APPVEYOR", "CODEBUILD_BUILD_ID", "TF_BUILD", "TEAMCITY_VERSION", "JENKINS_URL", "HUDSON_URL", "BAMBOO_BUILDKEY", "CF_PAGES"];
|
|
53
|
+
var Ht = () => { try {
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
catch { } return !1; }, zt = () => { try {
|
|
57
|
+
return !0;
|
|
58
|
+
}
|
|
59
|
+
catch { } return !1; };
|
|
60
|
+
var Wt = new Set, de = (t, e, r) => {
|
|
61
|
+
let s = Ht() || zt(), n = r ?? t;
|
|
62
|
+
Wt.has(n) || s || (Wt.add(n), console.warn(`Clerk - DEPRECATION WARNING: "${t}" is deprecated and will be removed in the next major release.
|
|
63
|
+
${e}`));
|
|
64
|
+
};
|
|
65
|
+
var We = [".lcl.dev", ".lclstage.dev", ".lclclerk.com"], Bt = [".accounts.dev", ".accountsstage.dev", ".accounts.lclclerk.com"], jt = [".lcl.dev", ".stg.dev", ".lclstage.dev", ".stgstage.dev", ".dev.lclclerk.com", ".stg.lclclerk.com", ".accounts.lclclerk.com", "accountsstage.dev", "accounts.dev"];
|
|
66
|
+
var fe = t => typeof atob < "u" && typeof atob == "function" ? atob(t) : typeof globalThis.Buffer < "u" ? globalThis.Buffer.from(t, "base64").toString() : t;
|
|
67
|
+
var Vt = t => typeof btoa < "u" && typeof btoa == "function" ? btoa(t) : typeof globalThis.Buffer < "u" ? globalThis.Buffer.from(t).toString("base64") : t;
|
|
68
|
+
var Gt = "pk_live_", Kn = "pk_test_";
|
|
69
|
+
function Qt(t) { if (!t.endsWith("$"))
|
|
70
|
+
return !1; let e = t.slice(0, -1); return e.includes("$") ? !1 : e.includes("."); }
|
|
71
|
+
function ee(t, e = {}) { if (t = t || "", !t || !$t(t)) {
|
|
72
|
+
if (e.fatal && !t)
|
|
73
|
+
throw new Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");
|
|
74
|
+
if (e.fatal && !$t(t))
|
|
75
|
+
throw new Error("Publishable key not valid.");
|
|
76
|
+
return null;
|
|
77
|
+
} let r = t.startsWith(Gt) ? "production" : "development", s; try {
|
|
78
|
+
s = fe(t.split("_")[2]);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
if (e.fatal)
|
|
82
|
+
throw new Error("Publishable key not valid: Failed to decode key.");
|
|
83
|
+
return null;
|
|
84
|
+
} if (!Qt(s)) {
|
|
85
|
+
if (e.fatal)
|
|
86
|
+
throw new Error("Publishable key not valid: Decoded key has invalid format.");
|
|
87
|
+
return null;
|
|
88
|
+
} let n = s.slice(0, -1); return e.proxyUrl ? n = e.proxyUrl : r !== "development" && e.domain && e.isSatellite && (n = `clerk.${e.domain}`), { instanceType: r, frontendApi: n }; }
|
|
89
|
+
function $t(t = "") { try {
|
|
90
|
+
if (!(t.startsWith(Gt) || t.startsWith(Kn)))
|
|
91
|
+
return !1;
|
|
92
|
+
let e = t.split("_");
|
|
93
|
+
if (e.length !== 3)
|
|
94
|
+
return !1;
|
|
95
|
+
let r = e[2];
|
|
96
|
+
return r ? Qt(fe(r)) : !1;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return !1;
|
|
100
|
+
} }
|
|
101
|
+
function Yt() { let t = new Map; return { isDevOrStagingUrl: e => { if (!e)
|
|
102
|
+
return !1; let r = typeof e == "string" ? e : e.hostname, s = t.get(r); return s === void 0 && (s = jt.some(n => r.endsWith(n)), t.set(r, s)), s; } }; }
|
|
103
|
+
function Xt(t) { return t.startsWith("live_") || t.startsWith("pk_live_"); }
|
|
104
|
+
function Be(t) { return t.startsWith("test_") || t.startsWith("sk_test_"); }
|
|
105
|
+
async function je(t, e = globalThis.crypto.subtle) { let r = new TextEncoder().encode(t), s = await e.digest("sha-1", r); return Vt(String.fromCharCode(...new Uint8Array(s))).replace(/\+/gi, "-").replace(/\//gi, "_").substring(0, 8); }
|
|
106
|
+
var Ve = (t, e) => `${t}_${e}`;
|
|
107
|
+
var Hn = { initialDelay: 125, maxDelayBetweenRetries: 0, factor: 2, shouldRetry: (t, e) => e < 5, retryImmediately: !1, jitter: !0 }, zn = 100, Zt = async (t) => new Promise(e => setTimeout(e, t)), er = (t, e) => e ? t * (1 + Math.random()) : t, Wn = t => { let e = 0, r = () => { let s = t.initialDelay, n = t.factor, i = s * Math.pow(n, e); return i = er(i, t.jitter), Math.min(t.maxDelayBetweenRetries || i, i); }; return async () => { await Zt(r()), e++; }; }, $e = async (t, e = {}) => { let r = 0, { shouldRetry: s, initialDelay: n, maxDelayBetweenRetries: i, factor: o, retryImmediately: a, jitter: c, onBeforeRetry: d } = { ...Hn, ...e }, f = Wn({ initialDelay: n, maxDelayBetweenRetries: i, factor: o, jitter: c }); for (;;)
|
|
108
|
+
try {
|
|
109
|
+
return await t();
|
|
110
|
+
}
|
|
111
|
+
catch (p) {
|
|
112
|
+
if (r++, !s(p, r))
|
|
113
|
+
throw p;
|
|
114
|
+
d && await d(r), a && r === 1 ? await Zt(er(zn, c)) : await f();
|
|
115
|
+
} };
|
|
116
|
+
function tr(t) { return We.some(e => t.startsWith("accounts.") && t.endsWith(e)); }
|
|
117
|
+
function rr(t) { return Bt.some(e => t.endsWith(e) && !t.endsWith(".clerk" + e)); }
|
|
118
|
+
function we(t) { function e(r) { let s = r ?? this; if (!s)
|
|
119
|
+
throw new TypeError(`${t.kind || t.name} type guard requires an error object`); return t.kind && typeof s == "object" && s !== null && "constructor" in s && s.constructor?.kind === t.kind ? !0 : s instanceof t; } return e; }
|
|
120
|
+
var ae = class sr extends Error {
|
|
121
|
+
static kind = "ClerkError";
|
|
122
|
+
clerkError = !0;
|
|
123
|
+
code;
|
|
124
|
+
longMessage;
|
|
125
|
+
docsUrl;
|
|
126
|
+
cause;
|
|
127
|
+
get name() { return this.constructor.name; }
|
|
128
|
+
constructor(e) { super(new.target.formatMessage(new.target.kind, e.message, e.code, e.docsUrl), { cause: e.cause }), Object.setPrototypeOf(this, sr.prototype), this.code = e.code, this.docsUrl = e.docsUrl, this.longMessage = e.longMessage, this.cause = e.cause; }
|
|
129
|
+
toString() {
|
|
130
|
+
return `[${this.name}]
|
|
131
|
+
Message:${this.message}`;
|
|
132
|
+
}
|
|
133
|
+
static formatMessage(e, r, s, n) {
|
|
134
|
+
let i = "Clerk:", o = new RegExp(i.replace(" ", "\\s*"), "i");
|
|
135
|
+
return r = r.replace(o, ""), r = `${i} ${r.trim()}
|
|
136
|
+
|
|
137
|
+
(code="${s}")
|
|
138
|
+
|
|
139
|
+
`, n && (r += `
|
|
140
|
+
|
|
141
|
+
Docs: ${n}`), r;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var Ge = class nr extends ae {
|
|
145
|
+
static kind = "ClerkRuntimeError";
|
|
146
|
+
clerkRuntimeError = !0;
|
|
147
|
+
constructor(e, r) { super({ ...r, message: e }), Object.setPrototypeOf(this, nr.prototype); }
|
|
148
|
+
}, ir = we(Ge);
|
|
149
|
+
var Ae = class {
|
|
150
|
+
static kind = "ClerkAPIError";
|
|
151
|
+
code;
|
|
152
|
+
message;
|
|
153
|
+
longMessage;
|
|
154
|
+
meta;
|
|
155
|
+
constructor(t) { let e = { code: t.code, message: t.message, longMessage: t.long_message, meta: { paramName: t.meta?.param_name, sessionId: t.meta?.session_id, emailAddresses: t.meta?.email_addresses, identifiers: t.meta?.identifiers, zxcvbn: t.meta?.zxcvbn, plan: t.meta?.plan, isPlanUpgradePossible: t.meta?.is_plan_upgrade_possible, seatsQuantityToAdd: t.meta?.seats_quantity_to_add, seatsQuantity: t.meta?.seats_quantity } }; this.code = e.code, this.message = e.message, this.longMessage = e.longMessage, this.meta = e.meta; }
|
|
156
|
+
}, Bn = we(Ae);
|
|
157
|
+
function Qe(t) { return new Ae(t); }
|
|
158
|
+
var pe = class or extends ae {
|
|
159
|
+
static kind = "ClerkAPIResponseError";
|
|
160
|
+
status;
|
|
161
|
+
clerkTraceId;
|
|
162
|
+
retryAfter;
|
|
163
|
+
errors;
|
|
164
|
+
constructor(e, r) { let { data: s, status: n, clerkTraceId: i, retryAfter: o } = r; super({ ...r, message: e, code: "api_response_error" }), Object.setPrototypeOf(this, or.prototype), this.status = n, this.clerkTraceId = i, this.retryAfter = o, this.errors = (s || []).map(a => new Ae(a)); }
|
|
165
|
+
toString() {
|
|
166
|
+
let e = `[${this.name}]
|
|
167
|
+
Message:${this.message}
|
|
168
|
+
Status:${this.status}
|
|
169
|
+
Serialized errors: ${this.errors.map(r => JSON.stringify(r))}`;
|
|
170
|
+
return this.clerkTraceId && (e += `
|
|
171
|
+
Clerk Trace ID: ${this.clerkTraceId}`), e;
|
|
172
|
+
}
|
|
173
|
+
static formatMessage(e, r, s, n) { return r; }
|
|
174
|
+
}, Pe = we(pe);
|
|
175
|
+
var jn = Object.freeze({ InvalidProxyUrlErrorMessage: "The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})", InvalidPublishableKeyErrorMessage: "The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})", MissingPublishableKeyErrorMessage: "Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.", MissingSecretKeyErrorMessage: "Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.", MissingClerkProvider: "{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider" });
|
|
176
|
+
function Ye({ packageName: t, customMessages: e }) { let r = t; function s(i, o) { if (!o)
|
|
177
|
+
return `${r}: ${i}`; let a = i, c = i.matchAll(/{{([a-zA-Z0-9-_]+)}}/g); for (let d of c) {
|
|
178
|
+
let f = (o[d[1]] || "").toString();
|
|
179
|
+
a = a.replace(`{{${d[1]}}}`, f);
|
|
180
|
+
} return `${r}: ${a}`; } let n = { ...jn, ...e }; return { setPackageName({ packageName: i }) { return typeof i == "string" && (r = i), this; }, setMessages({ customMessages: i }) { return Object.assign(n, i || {}), this; }, throwInvalidPublishableKeyError(i) { throw new Error(s(n.InvalidPublishableKeyErrorMessage, i)); }, throwInvalidProxyUrl(i) { throw new Error(s(n.InvalidProxyUrlErrorMessage, i)); }, throwMissingPublishableKeyError() { throw new Error(s(n.MissingPublishableKeyErrorMessage)); }, throwMissingSecretKeyError() { throw new Error(s(n.MissingSecretKeyErrorMessage)); }, throwMissingClerkProviderError(i) { throw new Error(s(n.MissingClerkProvider, i)); }, throw(i) { throw new Error(s(i)); } }; }
|
|
181
|
+
var Vn = Ye({ packageName: "@clerk/backend" }), { isDevOrStagingUrl: il } = Yt();
|
|
182
|
+
var ar = { InvalidSecretKey: "clerk_key_invalid" }, I = { TokenExpired: "token-expired", TokenInvalid: "token-invalid", TokenInvalidAlgorithm: "token-invalid-algorithm", TokenInvalidAuthorizedParties: "token-invalid-authorized-parties", TokenInvalidSignature: "token-invalid-signature", TokenNotActiveYet: "token-not-active-yet", TokenIatInTheFuture: "token-iat-in-the-future", TokenVerificationFailed: "token-verification-failed", InvalidSecretKey: "secret-key-invalid", LocalJWKMissing: "jwk-local-missing", RemoteJWKFailedToLoad: "jwk-remote-failed-to-load", RemoteJWKInvalid: "jwk-remote-invalid", RemoteJWKMissing: "jwk-remote-missing", JWKFailedToResolve: "jwk-failed-to-resolve", JWKKidMismatch: "jwk-kid-mismatch" }, L = { ContactSupport: "Contact support@clerk.com", EnsureClerkJWT: "Make sure that this is a valid Clerk-generated JWT.", SetClerkJWTKey: "Set the CLERK_JWT_KEY environment variable.", SetClerkSecretKey: "Set the CLERK_SECRET_KEY environment variable.", EnsureClockSync: "Make sure your system clock is in sync (e.g. turn off and on automatic time synchronization)." }, U = class cr extends Error {
|
|
183
|
+
constructor({ action: e, message: r, reason: s }) { super(r), Object.setPrototypeOf(this, cr.prototype), this.reason = s, this.message = r, this.action = e; }
|
|
184
|
+
getFullMessage() { return `${[this.message, this.action].filter(e => e).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`; }
|
|
185
|
+
};
|
|
186
|
+
var W = { TokenInvalid: "token-invalid", InvalidSecretKey: "secret-key-invalid", UnexpectedError: "unexpected-error", TokenVerificationFailed: "token-verification-failed" }, ur = class lr extends ae {
|
|
187
|
+
constructor({ message: e, code: r, status: s, action: n }) { super({ message: e, code: r }), Object.setPrototypeOf(this, lr.prototype), this.status = s, this.action = n; }
|
|
188
|
+
static formatMessage(e, r, s, n) { return r; }
|
|
189
|
+
getFullMessage() { return `${this.message} (code=${this.code}, status=${this.status || "n/a"})`; }
|
|
190
|
+
};
|
|
191
|
+
ur.kind = "MachineTokenVerificationError";
|
|
192
|
+
var B = ur;
|
|
193
|
+
var hr = crypto;
|
|
194
|
+
var $n = fetch.bind(globalThis), te = { crypto: hr, get fetch() { return $n; }, AbortController: globalThis.AbortController, Blob: globalThis.Blob, FormData: globalThis.FormData, Headers: globalThis.Headers, Request: globalThis.Request, Response: globalThis.Response }, Xe = { parse(t, e) { return Gn(t, dr, e); }, stringify(t, e) { return Qn(t, dr, e); } }, dr = { chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bits: 6 };
|
|
195
|
+
function Gn(t, e, r = {}) { if (!e.codes) {
|
|
196
|
+
e.codes = {};
|
|
197
|
+
for (let c = 0; c < e.chars.length; ++c)
|
|
198
|
+
e.codes[e.chars[c]] = c;
|
|
199
|
+
} if (!r.loose && t.length * e.bits & 7)
|
|
200
|
+
throw new SyntaxError("Invalid padding"); let s = t.length; for (; t[s - 1] === "=";)
|
|
201
|
+
if (--s, !r.loose && !((t.length - s) * e.bits & 7))
|
|
202
|
+
throw new SyntaxError("Invalid padding"); let n = new (r.out ?? Uint8Array)(s * e.bits / 8 | 0), i = 0, o = 0, a = 0; for (let c = 0; c < s; ++c) {
|
|
203
|
+
let d = e.codes[t[c]];
|
|
204
|
+
if (d === void 0)
|
|
205
|
+
throw new SyntaxError("Invalid character " + t[c]);
|
|
206
|
+
o = o << e.bits | d, i += e.bits, i >= 8 && (i -= 8, n[a++] = 255 & o >> i);
|
|
207
|
+
} if (i >= e.bits || 255 & o << 8 - i)
|
|
208
|
+
throw new SyntaxError("Unexpected end of data"); return n; }
|
|
209
|
+
function Qn(t, e, r = {}) { let { pad: s = !0 } = r, n = (1 << e.bits) - 1, i = "", o = 0, a = 0; for (let c = 0; c < t.length; ++c)
|
|
210
|
+
for (a = a << 8 | 255 & t[c], o += 8; o > e.bits;)
|
|
211
|
+
o -= e.bits, i += e.chars[n & a >> o]; if (o && (i += e.chars[n & a << e.bits - o]), s)
|
|
212
|
+
for (; i.length * e.bits & 7;)
|
|
213
|
+
i += "="; return i; }
|
|
214
|
+
var et = { RS256: "SHA-256", RS384: "SHA-384", RS512: "SHA-512" }, Ze = "RSASSA-PKCS1-v1_5", fr = { RS256: Ze, RS384: Ze, RS512: Ze }, tt = Object.keys(et);
|
|
215
|
+
function Yn(t) { let e = et[t], r = fr[t]; if (!e || !r)
|
|
216
|
+
throw new Error(`Unsupported algorithm ${t}, expected one of ${tt.join(",")}.`); return { hash: { name: et[t] }, name: fr[t] }; }
|
|
217
|
+
var Xn = t => Array.isArray(t) && t.length > 0 && t.every(e => typeof e == "string"), Zn = (t, e) => { let r = [e].flat().filter(i => !!i), s = [t].flat().filter(i => !!i); if (r.length > 0 && s.length > 0) {
|
|
218
|
+
if (typeof t == "string") {
|
|
219
|
+
if (!r.includes(t))
|
|
220
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT audience claim (aud) ${JSON.stringify(t)}. Is not included in "${JSON.stringify(r)}".` });
|
|
221
|
+
}
|
|
222
|
+
else if (Xn(t) && !t.some(i => r.includes(i)))
|
|
223
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT audience claim array (aud) ${JSON.stringify(t)}. Is not included in "${JSON.stringify(r)}".` });
|
|
224
|
+
} }, rt = (t, e) => { if (typeof t > "u" && typeof e > "u")
|
|
225
|
+
return; let r = e ?? "JWT", s = Array.isArray(r) ? r : [r]; if (!s.includes(t))
|
|
226
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalid, message: `Invalid JWT type ${JSON.stringify(t)}. Expected "${s.join(", ")}".` }); }, st = t => { if (!tt.includes(t))
|
|
227
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalidAlgorithm, message: `Invalid JWT algorithm ${JSON.stringify(t)}. Supported: ${tt}.` }); }, ei = t => { if (typeof t != "string")
|
|
228
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Subject claim (sub) is required and must be a string. Received ${JSON.stringify(t)}.` }); }, ti = (t, e) => { if (!(!e || e.length === 0) && (!t || !e.includes(t)))
|
|
229
|
+
throw new U({ reason: I.TokenInvalidAuthorizedParties, message: `Invalid JWT Authorized party claim (azp) ${JSON.stringify(t)}. Expected "${e}".` }); }, ri = (t, e) => { if (typeof t != "number")
|
|
230
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT expiry date claim (exp) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() <= r.getTime() - e)
|
|
231
|
+
throw new U({ reason: I.TokenExpired, message: `JWT is expired. Expiry date: ${s.toUTCString()}, Current date: ${r.toUTCString()}.` }); }, si = (t, e) => { if (typeof t > "u")
|
|
232
|
+
return; if (typeof t != "number")
|
|
233
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT not before date claim (nbf) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() > r.getTime() + e)
|
|
234
|
+
throw new U({ reason: I.TokenNotActiveYet, message: `JWT cannot be used prior to not before date claim (nbf). Not before date: ${s.toUTCString()}; Current date: ${r.toUTCString()};` }); }, ni = (t, e) => { if (typeof t > "u")
|
|
235
|
+
return; if (typeof t != "number")
|
|
236
|
+
throw new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Invalid JWT issued at date claim (iat) ${JSON.stringify(t)}. Expected number.` }); let r = new Date(Date.now()), s = new Date(0); if (s.setUTCSeconds(t), s.getTime() > r.getTime() + e)
|
|
237
|
+
throw new U({ reason: I.TokenIatInTheFuture, message: `JWT issued at date claim (iat) is in the future. Issued at date: ${s.toUTCString()}; Current date: ${r.toUTCString()};` }); };
|
|
238
|
+
function ii(t) { let e = t.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, ""), r = fe(e), s = new ArrayBuffer(r.length), n = new Uint8Array(s); for (let i = 0, o = r.length; i < o; i++)
|
|
239
|
+
n[i] = r.charCodeAt(i); return n; }
|
|
240
|
+
function oi(t, e, r) { if (typeof t == "object")
|
|
241
|
+
return te.crypto.subtle.importKey("jwk", t, e, !1, [r]); let s = ii(t), n = r === "sign" ? "pkcs8" : "spki"; return te.crypto.subtle.importKey(n, s, e, !1, [r]); }
|
|
242
|
+
var ai = 5 * 1e3;
|
|
243
|
+
async function nt(t, e) { let { header: r, signature: s, raw: n } = t, o = new TextEncoder().encode([n.header, n.payload].join(".")), a = Yn(r.alg); try {
|
|
244
|
+
let c = await oi(e, a, "verify");
|
|
245
|
+
return { data: await te.crypto.subtle.verify(a.name, c, s, o) };
|
|
246
|
+
}
|
|
247
|
+
catch (c) {
|
|
248
|
+
return { errors: [new U({ reason: I.TokenInvalidSignature, message: c?.message })] };
|
|
249
|
+
} }
|
|
250
|
+
function K(t) { let e = (t || "").toString().split("."); if (e.length !== 3)
|
|
251
|
+
return { errors: [new U({ reason: I.TokenInvalid, message: "Invalid JWT form. A JWT consists of three parts separated by dots." })] }; let [r, s, n] = e, i = new TextDecoder, o = JSON.parse(i.decode(Xe.parse(r, { loose: !0 }))), a = JSON.parse(i.decode(Xe.parse(s, { loose: !0 }))), c = Xe.parse(n, { loose: !0 }); return { data: { header: o, payload: a, signature: c, raw: { header: r, payload: s, signature: n, text: t } } }; }
|
|
252
|
+
async function it(t, e) { let { audience: r, authorizedParties: s, clockSkewInMs: n, key: i, headerType: o } = e, a = typeof n == "number" && Number.isFinite(n) ? n : ai, { data: c, errors: d } = K(t); if (d)
|
|
253
|
+
return { errors: d }; let { header: f, payload: p } = c; try {
|
|
254
|
+
let { typ: A, alg: P } = f;
|
|
255
|
+
rt(A, o), st(P);
|
|
256
|
+
}
|
|
257
|
+
catch (A) {
|
|
258
|
+
return { errors: [A] };
|
|
259
|
+
} let { data: E, errors: S } = await nt(c, i); if (S)
|
|
260
|
+
return { errors: [new U({ action: L.EnsureClerkJWT, reason: I.TokenVerificationFailed, message: `Error verifying JWT signature. ${S[0]}` })] }; if (!E)
|
|
261
|
+
return { errors: [new U({ reason: I.TokenInvalidSignature, message: "JWT signature is invalid." })] }; try {
|
|
262
|
+
let { azp: A, sub: P, aud: x, iat: l, exp: y, nbf: m } = p;
|
|
263
|
+
ei(P), Zn(x, r), ti(A, s), ri(y, a), si(m, a), ni(l, a);
|
|
264
|
+
}
|
|
265
|
+
catch (A) {
|
|
266
|
+
return { errors: [A] };
|
|
267
|
+
} return { data: p }; }
|
|
268
|
+
var ci = Object.create, pr = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, mr = Object.getOwnPropertyNames, li = Object.getPrototypeOf, hi = Object.prototype.hasOwnProperty, yr = t => { throw TypeError(t); }, gr = (t, e) => function () { return e || (0, t[mr(t)[0]])((e = { exports: {} }).exports, e), e.exports; }, di = (t, e, r, s) => { if (e && typeof e == "object" || typeof e == "function")
|
|
269
|
+
for (let n of mr(e))
|
|
270
|
+
!hi.call(t, n) && n !== r && pr(t, n, { get: () => e[n], enumerable: !(s = ui(e, n)) || s.enumerable }); return t; }, kr = (t, e, r) => (r = t != null ? ci(li(t)) : {}, di(e || !t || !t.__esModule ? pr(r, "default", { value: t, enumerable: !0 }) : r, t)), ot = (t, e, r) => e.has(t) || yr("Cannot " + r), _r = (t, e, r) => (ot(t, e, "read from private field"), r ? r.call(t) : e.get(t)), at = (t, e, r) => e.has(t) ? yr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), vr = (t, e, r, s) => (ot(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), ce = (t, e, r) => (ot(t, e, "access private method"), r);
|
|
271
|
+
function ct(t) { return t ? `https://${t.replace(/clerk\.accountsstage\./, "accountsstage.").replace(/clerk\.accounts\.|clerk\./, "accounts.")}` : ""; }
|
|
272
|
+
var Ie = new Set, Sr = { warnOnce: t => { Ie.has(t) || (Ie.add(t), console.warn(t)); }, logOnce: t => { Ie.has(t) || (console.log(t), Ie.add(t)); } };
|
|
273
|
+
function fi(t) { return t ? t.replace(/([-_][a-z])/g, e => e.toUpperCase().replace(/-|_/, "")) : ""; }
|
|
274
|
+
function pi(t) { return t ? t.replace(/[A-Z]/g, e => `_${e.toLowerCase()}`) : ""; }
|
|
275
|
+
var Tr = t => { let e = r => { if (!r)
|
|
276
|
+
return r; if (Array.isArray(r))
|
|
277
|
+
return r.map(i => typeof i == "object" || Array.isArray(i) ? e(i) : i); let s = { ...r }, n = Object.keys(s); for (let i of n) {
|
|
278
|
+
let o = t(i.toString());
|
|
279
|
+
o !== i && (s[o] = s[i], delete s[i]), typeof s[o] == "object" && (s[o] = e(s[o]));
|
|
280
|
+
} return s; }; return e; }, kl = Tr(pi), _l = Tr(fi);
|
|
281
|
+
function ue(t) { if (typeof t == "boolean")
|
|
282
|
+
return t; if (t == null)
|
|
283
|
+
return !1; if (typeof t == "string") {
|
|
284
|
+
if (t.toLowerCase() === "true")
|
|
285
|
+
return !0;
|
|
286
|
+
if (t.toLowerCase() === "false")
|
|
287
|
+
return !1;
|
|
288
|
+
} let e = parseInt(t, 10); return isNaN(e) ? !1 : e > 0; }
|
|
289
|
+
var mi = [".vercel.app"], yi = "/__clerk";
|
|
290
|
+
function gi(t) { return mi.some(e => t?.endsWith(e)) ?? !1; }
|
|
291
|
+
function br() { return typeof process < "u" && process.env ? process.env : {}; }
|
|
292
|
+
function ki(t = br()) { return ue(t.CLERK_DISABLE_AUTO_PROXY); }
|
|
293
|
+
function _i(t) { if (t.startsWith("http://") || t.startsWith("https://"))
|
|
294
|
+
try {
|
|
295
|
+
return new URL(t).hostname;
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return "";
|
|
299
|
+
} return t.split("/")[0] || ""; }
|
|
300
|
+
function Er({ publishableKey: t, hasDomain: e = !1, hasProxyUrl: r = !1, environment: s = br() }) { if (r || e || !Xt(t) || ki(s) || s.VERCEL_TARGET_ENV !== "production")
|
|
301
|
+
return ""; let n = s.VERCEL_PROJECT_PRODUCTION_URL; return !n || !gi(_i(n)) ? "" : yi; }
|
|
302
|
+
var vi = { strict_mfa: { afterMinutes: 10, level: "multi_factor" }, strict: { afterMinutes: 10, level: "second_factor" }, moderate: { afterMinutes: 60, level: "second_factor" }, lax: { afterMinutes: 1440, level: "second_factor" } }, Si = new Set(["first_factor", "second_factor", "multi_factor"]), Ti = new Set(["strict_mfa", "strict", "moderate", "lax"]), wr = new Set(["o", "org", "organization"]), Ar = new Set(["u", "user"]), bi = t => typeof t == "number" && t > 0, Ei = t => Si.has(t), wi = t => Ti.has(t), Pr = t => typeof t == "number" && Number.isFinite(t) && (t === -1 || t >= 0), ut = t => t.replace(/^(org:)*/, "org:"), Ai = (t, e) => { let { orgId: r, orgRole: s, orgPermissions: n } = e, i = t.role !== void 0, o = t.permission !== void 0; return !i && !o ? "skip" : i && typeof t.role != "string" || o && typeof t.permission != "string" || !r || i && (typeof s != "string" || !s || ut(s) !== ut(t.role)) || o && (!Array.isArray(n) || !n.includes(ut(t.permission))) ? "fail" : "pass"; }, Ir = (t, e) => { let { org: r, user: s } = lt(t), [n, i] = e.split(":"), o = i !== void 0, a = n, c = i || n; if (o && !wr.has(a) && !Ar.has(a))
|
|
303
|
+
throw new Error(`Invalid scope: ${a}`); if (o) {
|
|
304
|
+
if (wr.has(a))
|
|
305
|
+
return r.includes(c);
|
|
306
|
+
if (Ar.has(a))
|
|
307
|
+
return s.includes(c);
|
|
308
|
+
} return [...r, ...s].includes(c); }, Pi = (t, e) => { let { features: r, plans: s } = e, n = t.feature !== void 0, i = t.plan !== void 0; if (!n && !i)
|
|
309
|
+
return "skip"; if (n && typeof t.feature != "string" || i && typeof t.plan != "string")
|
|
310
|
+
return "fail"; if (n) {
|
|
311
|
+
if (typeof r != "string" || !r)
|
|
312
|
+
return "fail";
|
|
313
|
+
try {
|
|
314
|
+
if (!Ir(r, t.feature))
|
|
315
|
+
return "fail";
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return "fail";
|
|
319
|
+
}
|
|
320
|
+
} if (i) {
|
|
321
|
+
if (typeof s != "string" || !s)
|
|
322
|
+
return "fail";
|
|
323
|
+
try {
|
|
324
|
+
if (!Ir(s, t.plan))
|
|
325
|
+
return "fail";
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return "fail";
|
|
329
|
+
}
|
|
330
|
+
} return "pass"; }, lt = t => { let e = [], r = []; if (!t)
|
|
331
|
+
return { org: e, user: r }; let s = t.split(","); for (let n = 0; n < s.length; n++) {
|
|
332
|
+
let i = s[n].trim(), o = i.indexOf(":");
|
|
333
|
+
if (o === -1)
|
|
334
|
+
throw new Error(`Invalid claim element (missing colon): ${i}`);
|
|
335
|
+
let a = i.slice(0, o), c = i.slice(o + 1);
|
|
336
|
+
a === "o" ? e.push(c) : a === "u" ? r.push(c) : (a === "ou" || a === "uo") && (e.push(c), r.push(c));
|
|
337
|
+
} return { org: e, user: r }; }, Ii = t => { if (!t)
|
|
338
|
+
return !1; let e = n => typeof n == "string" ? vi[n] : n, r = typeof t == "string" && wi(t), s = typeof t == "object" && Ei(t.level) && bi(t.afterMinutes); return r || s ? e.bind(null, t) : !1; }, Oi = (t, { factorVerificationAge: e }) => { if (t.reverification === void 0)
|
|
339
|
+
return "skip"; if (!e || !Array.isArray(e) || e.length !== 2 || !Pr(e[0]) || !Pr(e[1]))
|
|
340
|
+
return "fail"; let r = Ii(t.reverification); if (!r)
|
|
341
|
+
return "fail"; let { level: s, afterMinutes: n } = r(), [i, o] = e; if (i === -1 && o === -1)
|
|
342
|
+
return "fail"; let a = i !== -1 && n > i, c = o !== -1 && n > o; switch (s) {
|
|
343
|
+
case "first_factor": return a ? "pass" : "fail";
|
|
344
|
+
case "second_factor": return o === -1 ? a ? "pass" : "fail" : c ? "pass" : "fail";
|
|
345
|
+
case "multi_factor": return o === -1 ? a ? "pass" : "fail" : i === -1 ? "fail" : a && c ? "pass" : "fail";
|
|
346
|
+
} }, Ci = t => t.some(e => e === "pass") && t.every(e => e === "pass" || e === "skip"), Or = t => e => t.userId ? Ci([Ai(e, t), Pi(e, t), Oi(e, t)]) : !1;
|
|
347
|
+
var xi = ({ per: t, fpm: e }) => { if (!t || !e)
|
|
348
|
+
return { permissions: [], featurePermissionMap: [] }; let r = t.split(",").map(s => s.trim()); return { permissions: r, featurePermissionMap: e.split(",").map(s => Number.parseInt(s.trim(), 10)).map(s => s.toString(2).padStart(r.length, "0").split("").map(n => Number.parseInt(n, 10)).reverse()).filter(Boolean) }; };
|
|
349
|
+
function Ui({ features: t, permissions: e, featurePermissionMap: r }) { if (!t || !e || !r)
|
|
350
|
+
return []; let s = []; for (let n = 0; n < t.length; n++) {
|
|
351
|
+
let i = t[n];
|
|
352
|
+
if (n >= r.length)
|
|
353
|
+
continue;
|
|
354
|
+
let o = r[n];
|
|
355
|
+
if (o)
|
|
356
|
+
for (let a = 0; a < o.length; a++)
|
|
357
|
+
o[a] === 1 && s.push(`org:${i}:${e[a]}`);
|
|
358
|
+
} return s; }
|
|
359
|
+
var Cr = t => { let e, r, s, n, i = t.fva ?? null, o = t.sts ?? null; switch (t.v) {
|
|
360
|
+
case 2:
|
|
361
|
+
if (t.o) {
|
|
362
|
+
e = t.o?.id, s = t.o?.slg, t.o?.rol && (r = `org:${t.o?.rol}`);
|
|
363
|
+
let { org: a } = lt(t.fea), { permissions: c, featurePermissionMap: d } = xi({ per: t.o?.per, fpm: t.o?.fpm });
|
|
364
|
+
n = Ui({ features: a, featurePermissionMap: d, permissions: c });
|
|
365
|
+
}
|
|
366
|
+
break;
|
|
367
|
+
default:
|
|
368
|
+
e = t.org_id, r = t.org_role, s = t.org_slug, n = t.org_permissions;
|
|
369
|
+
break;
|
|
370
|
+
} return { sessionClaims: t, sessionId: t.sid, sessionStatus: o, actor: t.act, userId: t.sub, orgId: e, orgRole: r, orgSlug: s, orgPermissions: n, factorVerificationAge: i }; };
|
|
371
|
+
function Ri(t) { for (var e = [], r = 0; r < t.length;) {
|
|
372
|
+
var s = t[r];
|
|
373
|
+
if (s === "*" || s === "+" || s === "?") {
|
|
374
|
+
e.push({ type: "MODIFIER", index: r, value: t[r++] });
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
if (s === "\\") {
|
|
378
|
+
e.push({ type: "ESCAPED_CHAR", index: r++, value: t[r++] });
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (s === "{") {
|
|
382
|
+
e.push({ type: "OPEN", index: r, value: t[r++] });
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (s === "}") {
|
|
386
|
+
e.push({ type: "CLOSE", index: r, value: t[r++] });
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if (s === ":") {
|
|
390
|
+
for (var n = "", i = r + 1; i < t.length;) {
|
|
391
|
+
var o = t.charCodeAt(i);
|
|
392
|
+
if (o >= 48 && o <= 57 || o >= 65 && o <= 90 || o >= 97 && o <= 122 || o === 95) {
|
|
393
|
+
n += t[i++];
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
if (!n)
|
|
399
|
+
throw new TypeError("Missing parameter name at ".concat(r));
|
|
400
|
+
e.push({ type: "NAME", index: r, value: n }), r = i;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
if (s === "(") {
|
|
404
|
+
var a = 1, c = "", i = r + 1;
|
|
405
|
+
if (t[i] === "?")
|
|
406
|
+
throw new TypeError('Pattern cannot start with "?" at '.concat(i));
|
|
407
|
+
for (; i < t.length;) {
|
|
408
|
+
if (t[i] === "\\") {
|
|
409
|
+
c += t[i++] + t[i++];
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (t[i] === ")") {
|
|
413
|
+
if (a--, a === 0) {
|
|
414
|
+
i++;
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else if (t[i] === "(" && (a++, t[i + 1] !== "?"))
|
|
419
|
+
throw new TypeError("Capturing groups are not allowed at ".concat(i));
|
|
420
|
+
c += t[i++];
|
|
421
|
+
}
|
|
422
|
+
if (a)
|
|
423
|
+
throw new TypeError("Unbalanced pattern at ".concat(r));
|
|
424
|
+
if (!c)
|
|
425
|
+
throw new TypeError("Missing pattern at ".concat(r));
|
|
426
|
+
e.push({ type: "PATTERN", index: r, value: c }), r = i;
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
e.push({ type: "CHAR", index: r, value: t[r++] });
|
|
430
|
+
} return e.push({ type: "END", index: r, value: "" }), e; }
|
|
431
|
+
function qi(t, e) { e === void 0 && (e = {}); for (var r = Ri(t), s = e.prefixes, n = s === void 0 ? "./" : s, i = e.delimiter, o = i === void 0 ? "/#?" : i, a = [], c = 0, d = 0, f = "", p = function (_) { if (d < r.length && r[d].type === _)
|
|
432
|
+
return r[d++].value; }, E = function (_) { var O = p(_); if (O !== void 0)
|
|
433
|
+
return O; var q = r[d], z = q.type, D = q.index; throw new TypeError("Unexpected ".concat(z, " at ").concat(D, ", expected ").concat(_)); }, S = function () { for (var _ = "", O; O = p("CHAR") || p("ESCAPED_CHAR");)
|
|
434
|
+
_ += O; return _; }, A = function (_) { for (var O = 0, q = o; O < q.length; O++) {
|
|
435
|
+
var z = q[O];
|
|
436
|
+
if (_.indexOf(z) > -1)
|
|
437
|
+
return !0;
|
|
438
|
+
} return !1; }, P = function (_) { var O = a[a.length - 1], q = _ || (O && typeof O == "string" ? O : ""); if (O && !q)
|
|
439
|
+
throw new TypeError('Must have text between two parameters, missing text after "'.concat(O.name, '"')); return !q || A(q) ? "[^".concat(G(o), "]+?") : "(?:(?!".concat(G(q), ")[^").concat(G(o), "])+?"); }; d < r.length;) {
|
|
440
|
+
var x = p("CHAR"), l = p("NAME"), y = p("PATTERN");
|
|
441
|
+
if (l || y) {
|
|
442
|
+
var m = x || "";
|
|
443
|
+
n.indexOf(m) === -1 && (f += m, m = ""), f && (a.push(f), f = ""), a.push({ name: l || c++, prefix: m, suffix: "", pattern: y || P(m), modifier: p("MODIFIER") || "" });
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
var h = x || p("ESCAPED_CHAR");
|
|
447
|
+
if (h) {
|
|
448
|
+
f += h;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (f && (a.push(f), f = ""), p("OPEN")) {
|
|
452
|
+
var m = S(), g = p("NAME") || "", k = p("PATTERN") || "", T = S();
|
|
453
|
+
E("CLOSE"), a.push({ name: g || (k ? c++ : ""), pattern: g && !k ? P(m) : k, prefix: m, suffix: T, modifier: p("MODIFIER") || "" });
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
E("END");
|
|
457
|
+
} return a; }
|
|
458
|
+
function Mi(t, e) { var r = []; return Ni(Ur(t, r, e), r, e); }
|
|
459
|
+
function Ni(t, e, r) { r === void 0 && (r = {}); var s = r.decode, n = s === void 0 ? function (i) { return i; } : s; return function (i) { var o = t.exec(i); if (!o)
|
|
460
|
+
return !1; for (var a = o[0], c = o.index, d = Object.create(null), f = function (E) { if (o[E] === void 0)
|
|
461
|
+
return "continue"; var S = e[E - 1]; S.modifier === "*" || S.modifier === "+" ? d[S.name] = o[E].split(S.prefix + S.suffix).map(function (A) { return n(A, S); }) : d[S.name] = n(o[E], S); }, p = 1; p < o.length; p++)
|
|
462
|
+
f(p); return { path: a, index: c, params: d }; }; }
|
|
463
|
+
function G(t) { return t.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); }
|
|
464
|
+
function xr(t) { return t && t.sensitive ? "" : "i"; }
|
|
465
|
+
function Ji(t, e) { if (!e)
|
|
466
|
+
return t; for (var r = /\((?:\?<(.*?)>)?(?!\?)/g, s = 0, n = r.exec(t.source); n;)
|
|
467
|
+
e.push({ name: n[1] || s++, prefix: "", suffix: "", modifier: "", pattern: "" }), n = r.exec(t.source); return t; }
|
|
468
|
+
function Li(t, e, r) { var s = t.map(function (n) { return Ur(n, e, r).source; }); return new RegExp("(?:".concat(s.join("|"), ")"), xr(r)); }
|
|
469
|
+
function Di(t, e, r) { return Fi(qi(t, r), e, r); }
|
|
470
|
+
function Fi(t, e, r) { r === void 0 && (r = {}); for (var s = r.strict, n = s === void 0 ? !1 : s, i = r.start, o = i === void 0 ? !0 : i, a = r.end, c = a === void 0 ? !0 : a, d = r.encode, f = d === void 0 ? function (q) { return q; } : d, p = r.delimiter, E = p === void 0 ? "/#?" : p, S = r.endsWith, A = S === void 0 ? "" : S, P = "[".concat(G(A), "]|$"), x = "[".concat(G(E), "]"), l = o ? "^" : "", y = 0, m = t; y < m.length; y++) {
|
|
471
|
+
var h = m[y];
|
|
472
|
+
if (typeof h == "string")
|
|
473
|
+
l += G(f(h));
|
|
474
|
+
else {
|
|
475
|
+
var g = G(f(h.prefix)), k = G(f(h.suffix));
|
|
476
|
+
if (h.pattern)
|
|
477
|
+
if (e && e.push(h), g || k)
|
|
478
|
+
if (h.modifier === "+" || h.modifier === "*") {
|
|
479
|
+
var T = h.modifier === "*" ? "?" : "";
|
|
480
|
+
l += "(?:".concat(g, "((?:").concat(h.pattern, ")(?:").concat(k).concat(g, "(?:").concat(h.pattern, "))*)").concat(k, ")").concat(T);
|
|
481
|
+
}
|
|
482
|
+
else
|
|
483
|
+
l += "(?:".concat(g, "(").concat(h.pattern, ")").concat(k, ")").concat(h.modifier);
|
|
484
|
+
else {
|
|
485
|
+
if (h.modifier === "+" || h.modifier === "*")
|
|
486
|
+
throw new TypeError('Can not repeat "'.concat(h.name, '" without a prefix and suffix'));
|
|
487
|
+
l += "(".concat(h.pattern, ")").concat(h.modifier);
|
|
488
|
+
}
|
|
489
|
+
else
|
|
490
|
+
l += "(?:".concat(g).concat(k, ")").concat(h.modifier);
|
|
491
|
+
}
|
|
492
|
+
} if (c)
|
|
493
|
+
n || (l += "".concat(x, "?")), l += r.endsWith ? "(?=".concat(P, ")") : "$";
|
|
494
|
+
else {
|
|
495
|
+
var _ = t[t.length - 1], O = typeof _ == "string" ? x.indexOf(_[_.length - 1]) > -1 : _ === void 0;
|
|
496
|
+
n || (l += "(?:".concat(x, "(?=").concat(P, "))?")), O || (l += "(?=".concat(x, "|").concat(P, ")"));
|
|
497
|
+
} return new RegExp(l, xr(r)); }
|
|
498
|
+
function Ur(t, e, r) { return t instanceof RegExp ? Ji(t, e) : Array.isArray(t) ? Li(t, e, r) : Di(t, e, r); }
|
|
499
|
+
function ht(t, e) {
|
|
500
|
+
try {
|
|
501
|
+
return Mi(t, e);
|
|
502
|
+
}
|
|
503
|
+
catch (r) {
|
|
504
|
+
throw new Error(`Invalid path and options: Consult the documentation of path-to-regexp here: https://github.com/pillarjs/path-to-regexp/tree/6.x
|
|
505
|
+
${r.message}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
var Ki = gr({ "../../node_modules/.pnpm/cookie@1.1.1/node_modules/cookie/dist/index.js"(t) {
|
|
509
|
+
"use strict";
|
|
510
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.parseCookie = c, t.parse = c, t.stringifyCookie = d, t.stringifySetCookie = f, t.serialize = f, t.parseSetCookie = p, t.stringifySetCookie = f, t.serialize = f;
|
|
511
|
+
var e = /^[\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, n = /^[\u0020-\u003A\u003D-\u007E]*$/, i = /^-?\d+$/, o = Object.prototype.toString, a = (() => { let l = function () { }; return l.prototype = Object.create(null), l; })();
|
|
512
|
+
function c(l, y) { let m = new a, h = l.length; if (h < 2)
|
|
513
|
+
return m; let g = y?.decode || P, k = 0; do {
|
|
514
|
+
let T = S(l, k, h);
|
|
515
|
+
if (T === -1)
|
|
516
|
+
break;
|
|
517
|
+
let _ = E(l, k, h);
|
|
518
|
+
if (T > _) {
|
|
519
|
+
k = l.lastIndexOf(";", T - 1) + 1;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
let O = A(l, k, T);
|
|
523
|
+
m[O] === void 0 && (m[O] = g(A(l, T + 1, _))), k = _ + 1;
|
|
524
|
+
} while (k < h); return m; }
|
|
525
|
+
function d(l, y) { let m = y?.encode || encodeURIComponent, h = []; for (let g of Object.keys(l)) {
|
|
526
|
+
let k = l[g];
|
|
527
|
+
if (k === void 0)
|
|
528
|
+
continue;
|
|
529
|
+
if (!e.test(g))
|
|
530
|
+
throw new TypeError(`cookie name is invalid: ${g}`);
|
|
531
|
+
let T = m(k);
|
|
532
|
+
if (!r.test(T))
|
|
533
|
+
throw new TypeError(`cookie val is invalid: ${k}`);
|
|
534
|
+
h.push(`${g}=${T}`);
|
|
535
|
+
} return h.join("; "); }
|
|
536
|
+
function f(l, y, m) { let h = typeof l == "object" ? l : { ...m, name: l, value: String(y) }, k = (typeof y == "object" ? y : m)?.encode || encodeURIComponent; if (!e.test(h.name))
|
|
537
|
+
throw new TypeError(`argument name is invalid: ${h.name}`); let T = h.value ? k(h.value) : ""; if (!r.test(T))
|
|
538
|
+
throw new TypeError(`argument val is invalid: ${h.value}`); let _ = h.name + "=" + T; if (h.maxAge !== void 0) {
|
|
539
|
+
if (!Number.isInteger(h.maxAge))
|
|
540
|
+
throw new TypeError(`option maxAge is invalid: ${h.maxAge}`);
|
|
541
|
+
_ += "; Max-Age=" + h.maxAge;
|
|
542
|
+
} if (h.domain) {
|
|
543
|
+
if (!s.test(h.domain))
|
|
544
|
+
throw new TypeError(`option domain is invalid: ${h.domain}`);
|
|
545
|
+
_ += "; Domain=" + h.domain;
|
|
546
|
+
} if (h.path) {
|
|
547
|
+
if (!n.test(h.path))
|
|
548
|
+
throw new TypeError(`option path is invalid: ${h.path}`);
|
|
549
|
+
_ += "; Path=" + h.path;
|
|
550
|
+
} if (h.expires) {
|
|
551
|
+
if (!x(h.expires) || !Number.isFinite(h.expires.valueOf()))
|
|
552
|
+
throw new TypeError(`option expires is invalid: ${h.expires}`);
|
|
553
|
+
_ += "; Expires=" + h.expires.toUTCString();
|
|
554
|
+
} if (h.httpOnly && (_ += "; HttpOnly"), h.secure && (_ += "; Secure"), h.partitioned && (_ += "; Partitioned"), h.priority)
|
|
555
|
+
switch (typeof h.priority == "string" ? h.priority.toLowerCase() : void 0) {
|
|
556
|
+
case "low":
|
|
557
|
+
_ += "; Priority=Low";
|
|
558
|
+
break;
|
|
559
|
+
case "medium":
|
|
560
|
+
_ += "; Priority=Medium";
|
|
561
|
+
break;
|
|
562
|
+
case "high":
|
|
563
|
+
_ += "; Priority=High";
|
|
564
|
+
break;
|
|
565
|
+
default: throw new TypeError(`option priority is invalid: ${h.priority}`);
|
|
566
|
+
} if (h.sameSite)
|
|
567
|
+
switch (typeof h.sameSite == "string" ? h.sameSite.toLowerCase() : h.sameSite) {
|
|
568
|
+
case !0:
|
|
569
|
+
case "strict":
|
|
570
|
+
_ += "; SameSite=Strict";
|
|
571
|
+
break;
|
|
572
|
+
case "lax":
|
|
573
|
+
_ += "; SameSite=Lax";
|
|
574
|
+
break;
|
|
575
|
+
case "none":
|
|
576
|
+
_ += "; SameSite=None";
|
|
577
|
+
break;
|
|
578
|
+
default: throw new TypeError(`option sameSite is invalid: ${h.sameSite}`);
|
|
579
|
+
} return _; }
|
|
580
|
+
function p(l, y) { let m = y?.decode || P, h = l.length, g = E(l, 0, h), k = S(l, 0, g), T = k === -1 ? { name: "", value: m(A(l, 0, g)) } : { name: A(l, 0, k), value: m(A(l, k + 1, g)) }, _ = g + 1; for (; _ < h;) {
|
|
581
|
+
let O = E(l, _, h), q = S(l, _, O), z = q === -1 ? A(l, _, O) : A(l, _, q), D = q === -1 ? void 0 : A(l, q + 1, O);
|
|
582
|
+
switch (z.toLowerCase()) {
|
|
583
|
+
case "httponly":
|
|
584
|
+
T.httpOnly = !0;
|
|
585
|
+
break;
|
|
586
|
+
case "secure":
|
|
587
|
+
T.secure = !0;
|
|
588
|
+
break;
|
|
589
|
+
case "partitioned":
|
|
590
|
+
T.partitioned = !0;
|
|
591
|
+
break;
|
|
592
|
+
case "domain":
|
|
593
|
+
T.domain = D;
|
|
594
|
+
break;
|
|
595
|
+
case "path":
|
|
596
|
+
T.path = D;
|
|
597
|
+
break;
|
|
598
|
+
case "max-age":
|
|
599
|
+
D && i.test(D) && (T.maxAge = Number(D));
|
|
600
|
+
break;
|
|
601
|
+
case "expires":
|
|
602
|
+
if (!D)
|
|
603
|
+
break;
|
|
604
|
+
let J = new Date(D);
|
|
605
|
+
Number.isFinite(J.valueOf()) && (T.expires = J);
|
|
606
|
+
break;
|
|
607
|
+
case "priority":
|
|
608
|
+
if (!D)
|
|
609
|
+
break;
|
|
610
|
+
let H = D.toLowerCase();
|
|
611
|
+
(H === "low" || H === "medium" || H === "high") && (T.priority = H);
|
|
612
|
+
break;
|
|
613
|
+
case "samesite":
|
|
614
|
+
if (!D)
|
|
615
|
+
break;
|
|
616
|
+
let V = D.toLowerCase();
|
|
617
|
+
(V === "lax" || V === "strict" || V === "none") && (T.sameSite = V);
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
_ = O + 1;
|
|
621
|
+
} return T; }
|
|
622
|
+
function E(l, y, m) { let h = l.indexOf(";", y); return h === -1 ? m : h; }
|
|
623
|
+
function S(l, y, m) { let h = l.indexOf("=", y); return h < m ? h : -1; }
|
|
624
|
+
function A(l, y, m) { let h = y, g = m; do {
|
|
625
|
+
let k = l.charCodeAt(h);
|
|
626
|
+
if (k !== 32 && k !== 9)
|
|
627
|
+
break;
|
|
628
|
+
} while (++h < g); for (; g > h;) {
|
|
629
|
+
let k = l.charCodeAt(g - 1);
|
|
630
|
+
if (k !== 32 && k !== 9)
|
|
631
|
+
break;
|
|
632
|
+
g--;
|
|
633
|
+
} return l.slice(h, g); }
|
|
634
|
+
function P(l) { if (l.indexOf("%") === -1)
|
|
635
|
+
return l; try {
|
|
636
|
+
return decodeURIComponent(l);
|
|
637
|
+
}
|
|
638
|
+
catch {
|
|
639
|
+
return l;
|
|
640
|
+
} }
|
|
641
|
+
function x(l) { return o.call(l) === "[object Date]"; }
|
|
642
|
+
} }), ts = "https://api.clerk.com", rs = "v1", ss = "@clerk/backend@3.12.0", Hi = 300, Pt = "2026-05-12", zi = { AuthToken: "__clerkAuthToken", AuthSignature: "__clerkAuthSignature", AuthStatus: "__clerkAuthStatus", AuthReason: "__clerkAuthReason", AuthMessage: "__clerkAuthMessage", ClerkUrl: "__clerkUrl" }, Je = { Session: "__session", Refresh: "__refresh", ClientUat: "__client_uat", Handshake: "__clerk_handshake", DevBrowser: "__clerk_db_jwt", RedirectCount: "__clerk_redirect_count", HandshakeNonce: "__clerk_handshake_nonce" }, Wi = { ClerkSynced: "__clerk_synced", SuffixedCookies: "suffixed_cookies", ClerkRedirectUrl: "__clerk_redirect_url", DevBrowser: Je.DevBrowser, Handshake: Je.Handshake, HandshakeHelp: "__clerk_help", LegacyDevBrowser: "__dev_session", HandshakeReason: "__clerk_hs_reason", HandshakeNonce: Je.HandshakeNonce, HandshakeFormat: "format", Session: "__session" }, Bi = { 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" }, ji = { Json: "application/json" }, Vi = { NeedsSync: "false", Completed: "true" }, v = { Attributes: zi, Cookies: Je, Headers: Bi, ContentTypes: ji, QueryParameters: Wi, ClerkSyncStatus: Vi };
|
|
643
|
+
function Rr(t, e) { return Object.keys(t).reduce((r, s) => ({ ...r, [s]: e[s] || r[s] }), { ...t }); }
|
|
644
|
+
function ns(t) { if (!t || typeof t != "string")
|
|
645
|
+
throw Error("Missing Clerk Secret Key. Go to https://dashboard.clerk.com and get your key for your instance."); }
|
|
646
|
+
function $i(t) { ee(t, { fatal: !0 }); }
|
|
647
|
+
var b = { SessionToken: "session_token", ApiKey: "api_key", M2MToken: "m2m_token", OAuthToken: "oauth_token" }, Gi = class {
|
|
648
|
+
constructor(t, e, r) { this.cookieSuffix = t, this.clerkRequest = e, this.originalFrontendApi = ""; let s = Er({ publishableKey: r.publishableKey ?? "", hasProxyUrl: !!r.proxyUrl, hasDomain: !!r.domain }); s && (r = { ...r, proxyUrl: `${e.clerkUrl.origin}${s}` }), r.acceptsToken === b.M2MToken || r.acceptsToken === b.ApiKey ? this.initHeaderValues() : (this.initPublishableKeyValues(r), this.initHeaderValues(), this.initCookieValues(), this.initHandshakeValues()), Object.assign(this, r), this.clerkUrl = this.clerkRequest.clerkUrl, this.proxyUrl?.startsWith("/") && (this.proxyUrl = `${this.clerkUrl.origin}${this.proxyUrl}`); }
|
|
649
|
+
get sessionToken() { return this.sessionTokenInCookie || this.tokenInHeader; }
|
|
650
|
+
usesSuffixedCookies() { let t = this.getSuffixedCookie(v.Cookies.ClientUat), e = this.getCookie(v.Cookies.ClientUat), r = this.getSuffixedCookie(v.Cookies.Session) || "", s = this.getCookie(v.Cookies.Session) || ""; if (s && !this.tokenHasIssuer(s))
|
|
651
|
+
return !1; if (s && !this.tokenBelongsToInstance(s))
|
|
652
|
+
return !0; if (!t && !r)
|
|
653
|
+
return !1; let { data: n } = K(s), i = n?.payload.iat || 0, { data: o } = K(r), a = o?.payload.iat || 0; if (t !== "0" && e !== "0" && i > a || t === "0" && e !== "0")
|
|
654
|
+
return !1; if (this.instanceType !== "production") {
|
|
655
|
+
let c = this.sessionExpired(o);
|
|
656
|
+
if (t !== "0" && e === "0" && c)
|
|
657
|
+
return !1;
|
|
658
|
+
} return !(!t && r); }
|
|
659
|
+
isCrossOriginReferrer() { if (!this.referrer || !this.clerkUrl.origin)
|
|
660
|
+
return !1; try {
|
|
661
|
+
return new URL(this.referrer).origin !== this.clerkUrl.origin;
|
|
662
|
+
}
|
|
663
|
+
catch {
|
|
664
|
+
return !1;
|
|
665
|
+
} }
|
|
666
|
+
isKnownClerkReferrer() { if (!this.referrer)
|
|
667
|
+
return !1; try {
|
|
668
|
+
let t = new URL(this.referrer), e = t.hostname;
|
|
669
|
+
if (this.frontendApi) {
|
|
670
|
+
let s = this.frontendApi.startsWith("http") ? new URL(this.frontendApi).hostname : this.frontendApi;
|
|
671
|
+
if (e === s)
|
|
672
|
+
return !0;
|
|
673
|
+
}
|
|
674
|
+
if (this.instanceType !== "production" && (tr(e) || rr(e)))
|
|
675
|
+
return !0;
|
|
676
|
+
let r = ct(this.frontendApi);
|
|
677
|
+
if (r) {
|
|
678
|
+
let s = new URL(r).origin;
|
|
679
|
+
if (t.origin === s)
|
|
680
|
+
return !0;
|
|
681
|
+
}
|
|
682
|
+
return !1;
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
return !1;
|
|
686
|
+
} }
|
|
687
|
+
initPublishableKeyValues(t) { $i(t.publishableKey), this.publishableKey = t.publishableKey; let e = t.proxyUrl; e?.startsWith("/") && (e = `${this.clerkRequest.clerkUrl.origin}${e}`); let r = ee(this.publishableKey, { fatal: !0, domain: t.domain, isSatellite: t.isSatellite }); this.originalFrontendApi = r.frontendApi; let s = ee(this.publishableKey, { fatal: !0, proxyUrl: e, domain: t.domain, isSatellite: t.isSatellite }); this.instanceType = s.instanceType, this.frontendApi = s.frontendApi; }
|
|
688
|
+
initHeaderValues() { this.method = this.clerkRequest.method, this.tokenInHeader = this.parseAuthorizationHeader(this.getHeader(v.Headers.Authorization)), this.origin = this.getHeader(v.Headers.Origin), this.host = this.getHeader(v.Headers.Host), this.forwardedHost = this.getHeader(v.Headers.ForwardedHost), this.forwardedProto = this.getHeader(v.Headers.CloudFrontForwardedProto) || this.getHeader(v.Headers.ForwardedProto), this.referrer = this.getHeader(v.Headers.Referrer), this.userAgent = this.getHeader(v.Headers.UserAgent), this.secFetchDest = this.getHeader(v.Headers.SecFetchDest), this.accept = this.getHeader(v.Headers.Accept); }
|
|
689
|
+
initCookieValues() { this.sessionTokenInCookie = this.getSuffixedOrUnSuffixedCookie(v.Cookies.Session), this.refreshTokenInCookie = this.getSuffixedCookie(v.Cookies.Refresh), this.clientUat = Number.parseInt(this.getSuffixedOrUnSuffixedCookie(v.Cookies.ClientUat) || "") || 0; }
|
|
690
|
+
initHandshakeValues() { this.devBrowserToken = this.getQueryParam(v.QueryParameters.DevBrowser) || this.getSuffixedOrUnSuffixedCookie(v.Cookies.DevBrowser), this.handshakeToken = this.getQueryParam(v.QueryParameters.Handshake) || this.getCookie(v.Cookies.Handshake), this.handshakeRedirectLoopCounter = Number(this.getCookie(v.Cookies.RedirectCount)) || 0, this.handshakeNonce = this.getQueryParam(v.QueryParameters.HandshakeNonce) || this.getCookie(v.Cookies.HandshakeNonce); }
|
|
691
|
+
getQueryParam(t) { return this.clerkRequest.clerkUrl.searchParams.get(t); }
|
|
692
|
+
getHeader(t) { return this.clerkRequest.headers.get(t) || void 0; }
|
|
693
|
+
getCookie(t) { return this.clerkRequest.cookies.get(t) || void 0; }
|
|
694
|
+
getSuffixedCookie(t) { return this.getCookie(Ve(t, this.cookieSuffix)) || void 0; }
|
|
695
|
+
getSuffixedOrUnSuffixedCookie(t) { return this.usesSuffixedCookies() ? this.getSuffixedCookie(t) : this.getCookie(t); }
|
|
696
|
+
parseAuthorizationHeader(t) { if (!t)
|
|
697
|
+
return; let [e, r] = t.split(" ", 2); if (!r)
|
|
698
|
+
return e; if (e === "Bearer")
|
|
699
|
+
return r; }
|
|
700
|
+
tokenHasIssuer(t) { let { data: e, errors: r } = K(t); return r ? !1 : !!e.payload.iss; }
|
|
701
|
+
tokenBelongsToInstance(t) { if (!t)
|
|
702
|
+
return !1; let { data: e, errors: r } = K(t); if (r)
|
|
703
|
+
return !1; let s = e.payload.iss.replace(/https?:\/\//gi, ""); return this.originalFrontendApi === s; }
|
|
704
|
+
sessionExpired(t) { return !!t && t?.payload.exp <= Date.now() / 1e3 >> 0; }
|
|
705
|
+
}, Qi = async (t, e) => { let r = e.publishableKey ? await je(e.publishableKey, te.crypto.subtle) : ""; return new Gi(r, t, e); }, Le = "/", Yi = new RegExp("(?<!:)" + Le + "{1,}", "g"), qr = 10;
|
|
706
|
+
function Xi(t) { let e = t; for (let r = 0; r <= qr; r++) {
|
|
707
|
+
if (e.split(/[/\\]/).some(s => s === "." || s === ".."))
|
|
708
|
+
return !0;
|
|
709
|
+
if (r === qr)
|
|
710
|
+
throw new Error(`joinPaths: too many layers of encoding in ${t}`);
|
|
711
|
+
try {
|
|
712
|
+
let s = decodeURIComponent(e);
|
|
713
|
+
if (s === e)
|
|
714
|
+
break;
|
|
715
|
+
e = s;
|
|
716
|
+
}
|
|
717
|
+
catch {
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
} return !1; }
|
|
721
|
+
function u(...t) { let e = t.filter(r => r).join(Le).replace(Yi, Le); for (let r of e.split(Le))
|
|
722
|
+
if (Xi(r))
|
|
723
|
+
throw new Error(`joinPaths: "." and ".." path segments are not allowed (received "${e}")`); return e; }
|
|
724
|
+
var C = class {
|
|
725
|
+
constructor(t) { this.request = t; }
|
|
726
|
+
requireId(t) { if (!t)
|
|
727
|
+
throw new Error("A valid resource ID is required."); }
|
|
728
|
+
}, Mr = "/actor_tokens", Zi = class extends C {
|
|
729
|
+
async create(t) { return this.request({ method: "POST", path: Mr, bodyParams: t }); }
|
|
730
|
+
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(Mr, t, "revoke") }); }
|
|
731
|
+
}, Nr = "/agents/tasks", eo = class extends C {
|
|
732
|
+
async create(t) { return this.request({ method: "POST", path: Nr, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
733
|
+
async revoke(t) { return this.requireId(t), this.request({ method: "POST", path: u(Nr, t, "revoke") }); }
|
|
734
|
+
}, Jr = "/accountless_applications", to = class extends C {
|
|
735
|
+
async createAccountlessApplication(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path: Jr, headerParams: e, queryParams: { source: t?.source } }); }
|
|
736
|
+
async completeAccountlessApplicationOnboarding(t) { let e = t?.requestHeaders ? Object.fromEntries(t.requestHeaders.entries()) : void 0; return this.request({ method: "POST", path: u(Jr, "complete"), headerParams: e, queryParams: { source: t?.source } }); }
|
|
737
|
+
}, dt = "/allowlist_identifiers", ro = class extends C {
|
|
738
|
+
async getAllowlistIdentifierList(t = {}) { return this.request({ method: "GET", path: dt, queryParams: { ...t, paginated: !0 } }); }
|
|
739
|
+
async createAllowlistIdentifier(t) { return this.request({ method: "POST", path: dt, bodyParams: t }); }
|
|
740
|
+
async deleteAllowlistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(dt, t) }); }
|
|
741
|
+
}, Q = "/api_keys", so = class extends C {
|
|
742
|
+
async list(t) { return this.request({ method: "GET", path: Q, queryParams: t }); }
|
|
743
|
+
async create(t) { return this.request({ method: "POST", path: Q, bodyParams: t }); }
|
|
744
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(Q, t) }); }
|
|
745
|
+
async update(t) { let { apiKeyId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(Q, e), bodyParams: r }); }
|
|
746
|
+
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(Q, t) }); }
|
|
747
|
+
async revoke(t) { let { apiKeyId: e, revocationReason: r = null } = t; return this.requireId(e), this.request({ method: "POST", path: u(Q, e, "revoke"), bodyParams: { revocationReason: r } }); }
|
|
748
|
+
async getSecret(t) { return this.requireId(t), this.request({ method: "GET", path: u(Q, t, "secret") }); }
|
|
749
|
+
async verify(t) { return this.request({ method: "POST", path: u(Q, "verify"), bodyParams: { secret: t } }); }
|
|
750
|
+
}, no = "/beta_features", io = class extends C {
|
|
751
|
+
async changeDomain(t) { return this.request({ method: "POST", path: u(no, "change_domain"), bodyParams: t }); }
|
|
752
|
+
}, ft = "/blocklist_identifiers", oo = class extends C {
|
|
753
|
+
async getBlocklistIdentifierList(t = {}) { return this.request({ method: "GET", path: ft, queryParams: t }); }
|
|
754
|
+
async createBlocklistIdentifier(t) { return this.request({ method: "POST", path: ft, bodyParams: t }); }
|
|
755
|
+
async deleteBlocklistIdentifier(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ft, t) }); }
|
|
756
|
+
}, Oe = "/clients", ao = class extends C {
|
|
757
|
+
async getClientList(t = {}) { return this.request({ method: "GET", path: Oe, queryParams: { ...t, paginated: !0 } }); }
|
|
758
|
+
async getClient(t) { return this.requireId(t), this.request({ method: "GET", path: u(Oe, t) }); }
|
|
759
|
+
verifyClient(t) { return this.request({ method: "POST", path: u(Oe, "verify"), bodyParams: { token: t } }); }
|
|
760
|
+
async getHandshakePayload(t) { return this.request({ method: "GET", path: u(Oe, "handshake_payload"), queryParams: t }); }
|
|
761
|
+
}, Ce = "/domains", co = class extends C {
|
|
762
|
+
async list() { return this.request({ method: "GET", path: Ce }); }
|
|
763
|
+
async add(t) { return this.request({ method: "POST", path: Ce, bodyParams: t }); }
|
|
764
|
+
async update(t) { let { domainId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(Ce, e), bodyParams: r }); }
|
|
765
|
+
async delete(t) { return this.deleteDomain(t); }
|
|
766
|
+
async deleteDomain(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(Ce, t) }); }
|
|
767
|
+
}, xe = "/email_addresses", uo = class extends C {
|
|
768
|
+
async getEmailAddress(t) { return this.requireId(t), this.request({ method: "GET", path: u(xe, t) }); }
|
|
769
|
+
async createEmailAddress(t) { return this.request({ method: "POST", path: xe, bodyParams: t }); }
|
|
770
|
+
async updateEmailAddress(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(xe, t), bodyParams: e }); }
|
|
771
|
+
async deleteEmailAddress(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(xe, t) }); }
|
|
772
|
+
}, lo = "/email", ho = class extends C {
|
|
773
|
+
async create(t) { return this.request({ method: "POST", path: lo, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
774
|
+
}, me = "/enterprise_connections", fo = class extends C {
|
|
775
|
+
async createEnterpriseConnection(t) { return this.request({ method: "POST", path: me, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
776
|
+
async updateEnterpriseConnection(t, e) { return this.requireId(t), this.request({ method: "PATCH", path: u(me, t), bodyParams: e, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
777
|
+
async getEnterpriseConnectionList(t = {}) { return this.request({ method: "GET", path: me, queryParams: t }); }
|
|
778
|
+
async getEnterpriseConnection(t) { return this.requireId(t), this.request({ method: "GET", path: u(me, t) }); }
|
|
779
|
+
async deleteEnterpriseConnection(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(me, t) }); }
|
|
780
|
+
}, po = "/oauth_applications/access_tokens", mo = class extends C {
|
|
781
|
+
async verify(t) { return this.request({ method: "POST", path: u(po, "verify"), bodyParams: { access_token: t } }); }
|
|
782
|
+
}, ye = "/instance", yo = class extends C {
|
|
783
|
+
async get() { return this.request({ method: "GET", path: ye }); }
|
|
784
|
+
async update(t) { return this.request({ method: "PATCH", path: ye, bodyParams: t }); }
|
|
785
|
+
async updateRestrictions(t) { return this.request({ method: "PATCH", path: u(ye, "restrictions"), bodyParams: t }); }
|
|
786
|
+
async getOrganizationSettings() { return this.request({ method: "GET", path: u(ye, "organization_settings") }); }
|
|
787
|
+
async updateOrganizationSettings(t) { return this.request({ method: "PATCH", path: u(ye, "organization_settings"), bodyParams: t }); }
|
|
788
|
+
}, Ue = "/invitations", go = class extends C {
|
|
789
|
+
async getInvitationList(t = {}) { return this.request({ method: "GET", path: Ue, queryParams: { ...t, paginated: !0 } }); }
|
|
790
|
+
async createInvitation(t) { return this.request({ method: "POST", path: Ue, bodyParams: t }); }
|
|
791
|
+
async createInvitationBulk(t) { return this.request({ method: "POST", path: u(Ue, "bulk"), bodyParams: t }); }
|
|
792
|
+
async revokeInvitation(t) { return this.requireId(t), this.request({ method: "POST", path: u(Ue, t, "revoke") }); }
|
|
793
|
+
}, $ = "/machines", ko = class extends C {
|
|
794
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u($, t) }); }
|
|
795
|
+
async list(t = {}) { return this.request({ method: "GET", path: $, queryParams: t }); }
|
|
796
|
+
async create(t) { return this.request({ method: "POST", path: $, bodyParams: t }); }
|
|
797
|
+
async update(t) { let { machineId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u($, e), bodyParams: r }); }
|
|
798
|
+
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u($, t) }); }
|
|
799
|
+
async getSecretKey(t) { return this.requireId(t), this.request({ method: "GET", path: u($, t, "secret_key") }); }
|
|
800
|
+
async rotateSecretKey(t) { let { machineId: e, previousTokenTtl: r } = t; return this.requireId(e), this.request({ method: "POST", path: u($, e, "secret_key", "rotate"), bodyParams: { previousTokenTtl: r } }); }
|
|
801
|
+
async createScope(t, e) { return this.requireId(t), this.request({ method: "POST", path: u($, t, "scopes"), bodyParams: { toMachineId: e } }); }
|
|
802
|
+
async deleteScope(t, e) { return this.requireId(t), this.request({ method: "DELETE", path: u($, t, "scopes", e) }); }
|
|
803
|
+
}, is = class _t {
|
|
804
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.clientId = r, this.type = s, this.subject = n, this.scopes = i, this.revoked = o, this.revocationReason = a, this.expired = c, this.expiration = d, this.createdAt = f, this.updatedAt = p; }
|
|
805
|
+
static fromJSON(e) { return new _t(e.id, e.client_id, e.type, e.subject, e.scopes, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_at, e.updated_at); }
|
|
806
|
+
static fromJwtPayload(e, r = 5e3) { let s = e; return new _t(s.jti ?? "", s.client_id ?? "", "oauth_token", e.sub, s.scp ?? s.scope?.split(" ") ?? [], !1, null, e.exp * 1e3 <= Date.now() - r, e.exp * 1e3, e.iat * 1e3, e.iat * 1e3); }
|
|
807
|
+
}, _o = new Set(["iss", "sub", "exp", "nbf", "iat", "jti"]);
|
|
808
|
+
function vo(t) { let e = {}; for (let r of Object.keys(t))
|
|
809
|
+
_o.has(r) || (e[r] = t[r]); return Object.keys(e).length > 0 ? e : null; }
|
|
810
|
+
var os = class vt {
|
|
811
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.subject = r, this.scopes = s, this.claims = n, this.revoked = i, this.revocationReason = o, this.expired = a, this.expiration = c, this.createdAt = d, this.updatedAt = f, this.token = p; }
|
|
812
|
+
static fromJSON(e) { return new vt(e.id, e.subject, e.scopes, e.claims, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_at, e.updated_at, e.token); }
|
|
813
|
+
static fromJwtPayload(e, r = 5e3) { return new vt(e.jti ?? "", e.sub, e.scopes?.split(" ") ?? e.aud ?? [], vo(e), !1, null, e.exp * 1e3 <= Date.now() - r, e.exp * 1e3, e.iat * 1e3, e.iat * 1e3); }
|
|
814
|
+
}, Ke = {}, St = 0;
|
|
815
|
+
function Tt(t) { return Ke[t]; }
|
|
816
|
+
function So() { return Object.values(Ke); }
|
|
817
|
+
function as(t, e, r = !0) { Ke[t] = e, St = r ? Date.now() : -1; }
|
|
818
|
+
var To = "-----BEGIN PUBLIC KEY-----", bo = "-----END PUBLIC KEY-----", Eo = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA", wo = "IDAQAB";
|
|
819
|
+
function It(t) { let { kid: e, pem: r } = t, s = `local-${e}`, n = Tt(s); if (n)
|
|
820
|
+
return n; if (!r)
|
|
821
|
+
throw new U({ action: L.SetClerkJWTKey, message: "Missing local JWK.", reason: I.LocalJWKMissing }); let i = r.replace(/\r\n|\n|\r/g, "").replace(To, "").replace(bo, "").replace(Eo, "").replace(wo, "").replace(/\+/g, "-").replace(/\//g, "_"), o = { kid: s, kty: "RSA", alg: "RS256", n: i, e: "AQAB" }; return as(s, o, !1), o; }
|
|
822
|
+
async function Ot(t) { let { secretKey: e, apiUrl: r = ts, apiVersion: s = rs, kid: n, skipJwksCache: i } = t; if (i || Po() || !Tt(n)) {
|
|
823
|
+
if (!e)
|
|
824
|
+
throw new U({ action: L.ContactSupport, message: "Failed to load JWKS from Clerk Backend or Frontend API.", reason: I.RemoteJWKFailedToLoad });
|
|
825
|
+
let a = () => Ao(r, e, s, t.fetch), { keys: c } = await $e(a);
|
|
826
|
+
if (!c || !c.length)
|
|
827
|
+
throw new U({ action: L.ContactSupport, message: "The JWKS endpoint did not contain any signing keys. Contact support@clerk.com.", reason: I.RemoteJWKFailedToLoad });
|
|
828
|
+
c.forEach(d => as(d.kid, d));
|
|
829
|
+
} let o = Tt(n); if (!o) {
|
|
830
|
+
let c = So().map(d => d.kid).sort().join(", ");
|
|
831
|
+
throw new U({ action: `Go to your Dashboard and validate your secret and public keys are correct. ${L.ContactSupport} if the issue persists.`, message: `Unable to find a signing key in JWKS that matches the kid='${n}' 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: ${c}`, reason: I.JWKKidMismatch });
|
|
832
|
+
} return o; }
|
|
833
|
+
async function Ao(t, e, r, s) { if (!e)
|
|
834
|
+
throw new U({ action: L.SetClerkSecretKey, message: "Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.", reason: I.RemoteJWKFailedToLoad }); let n = new URL(t); n.pathname = u(n.pathname, r, "/jwks"); let i = await s(n.href, { headers: { Authorization: `Bearer ${e}`, "Clerk-API-Version": Pt, "Content-Type": "application/json", "User-Agent": ss } }); if (!i.ok) {
|
|
835
|
+
let o = await i.json(), a = Io(o?.errors, ar.InvalidSecretKey);
|
|
836
|
+
if (a) {
|
|
837
|
+
let c = I.InvalidSecretKey;
|
|
838
|
+
throw new U({ action: L.ContactSupport, message: a.message, reason: c });
|
|
839
|
+
}
|
|
840
|
+
throw new U({ action: L.ContactSupport, message: `Error loading Clerk JWKS from ${n.href} with code=${i.status}`, reason: I.RemoteJWKFailedToLoad });
|
|
841
|
+
} return i.json(); }
|
|
842
|
+
function Po() { if (St === -1)
|
|
843
|
+
return !1; let t = Date.now() - St >= Hi * 1e3; return t && (Ke = {}), t; }
|
|
844
|
+
var Io = (t, e) => t ? t.find(r => r.code === e) : null, Ct = "mt_", cs = "mch_", xt = "oat_", Ut = "ak_", us = "cl_B7d4PD333AAA", Oo = [Ct, xt, Ut], Co = /^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/;
|
|
845
|
+
function Rt(t) { return Co.test(t); }
|
|
846
|
+
var De = ["at+jwt", "application/at+jwt"];
|
|
847
|
+
function qt(t) { if (!Rt(t))
|
|
848
|
+
return !1; try {
|
|
849
|
+
let { data: e, errors: r } = K(t);
|
|
850
|
+
return !r && !!e && De.includes(e.header.typ);
|
|
851
|
+
}
|
|
852
|
+
catch {
|
|
853
|
+
return !1;
|
|
854
|
+
} }
|
|
855
|
+
function He(t) { if (!Rt(t))
|
|
856
|
+
return !1; try {
|
|
857
|
+
let { data: e, errors: r } = K(t);
|
|
858
|
+
return !r && !!e && typeof e.payload.sub == "string" && e.payload.sub.startsWith(cs);
|
|
859
|
+
}
|
|
860
|
+
catch {
|
|
861
|
+
return !1;
|
|
862
|
+
} }
|
|
863
|
+
function Lr(t) { return qt(t) || He(t); }
|
|
864
|
+
function xo(t) { return Oo.some(e => t.startsWith(e)); }
|
|
865
|
+
function bt(t) { return xo(t) || qt(t) || He(t); }
|
|
866
|
+
function Et(t) { if (t.startsWith(Ct) || He(t))
|
|
867
|
+
return b.M2MToken; if (t.startsWith(xt) || qt(t))
|
|
868
|
+
return b.OAuthToken; if (t.startsWith(Ut))
|
|
869
|
+
return b.ApiKey; throw new Error("Unknown machine token type"); }
|
|
870
|
+
var ls = (t, e) => t ? e === "any" ? !0 : (Array.isArray(e) ? e : [e]).includes(t) : !1, jl = new Set([b.ApiKey, b.M2MToken, b.OAuthToken]);
|
|
871
|
+
async function hs(t, e, r, s) { try {
|
|
872
|
+
let n;
|
|
873
|
+
if (r.jwtKey)
|
|
874
|
+
n = It({ kid: e, pem: r.jwtKey });
|
|
875
|
+
else if (r.secretKey)
|
|
876
|
+
n = await Ot({ ...r, kid: e });
|
|
877
|
+
else
|
|
878
|
+
return { error: new B({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during verification.", code: W.TokenVerificationFailed }) };
|
|
879
|
+
let { data: i, errors: o } = await it(t, { ...r, key: n, ...s ? { headerType: s } : {} });
|
|
880
|
+
return o ? { error: new B({ code: W.TokenVerificationFailed, message: o[0].message }) } : { payload: i };
|
|
881
|
+
}
|
|
882
|
+
catch (n) {
|
|
883
|
+
return { error: new B({ code: W.TokenVerificationFailed, message: n.message }) };
|
|
884
|
+
} }
|
|
885
|
+
async function ds(t, e, r) { let s = e.header.cat; if (s !== void 0 && s !== us)
|
|
886
|
+
return { data: void 0, tokenType: b.M2MToken, errors: [new B({ code: W.TokenInvalid, message: "Invalid M2M JWT category." })] }; let n = await hs(t, e.header.kid, r); return "error" in n ? { data: void 0, tokenType: b.M2MToken, errors: [n.error] } : { data: os.fromJwtPayload(n.payload, r.clockSkewInMs), tokenType: b.M2MToken, errors: void 0 }; }
|
|
887
|
+
async function Uo(t, e, r) { let s = await hs(t, e.header.kid, r, De); return "error" in s ? { data: void 0, tokenType: b.OAuthToken, errors: [s.error] } : { data: is.fromJwtPayload(s.payload, r.clockSkewInMs), tokenType: b.OAuthToken, errors: void 0 }; }
|
|
888
|
+
var Re = "/m2m_tokens", Fe, ie, Se, fs, Ro = class extends C {
|
|
889
|
+
constructor(t, e = {}) { super(t), at(this, ie), at(this, Fe), vr(this, Fe, e); }
|
|
890
|
+
async list(t) { let { machineSecretKey: e, ...r } = t, s = ce(this, ie, Se).call(this, { method: "GET", path: Re, queryParams: r }, e); return this.request(s); }
|
|
891
|
+
async createToken(t) { let { claims: e = null, machineSecretKey: r, minRemainingTtlSeconds: s, secondsUntilExpiration: n = null, tokenFormat: i = "opaque" } = t || {}, o = ce(this, ie, Se).call(this, { method: "POST", path: Re, bodyParams: { secondsUntilExpiration: n, claims: e, minRemainingTtlSeconds: s, tokenFormat: i } }, r); return this.request(o); }
|
|
892
|
+
async revokeToken(t) { let { m2mTokenId: e, revocationReason: r = null, machineSecretKey: s } = t; this.requireId(e); let n = ce(this, ie, Se).call(this, { method: "POST", path: u(Re, e, "revoke"), bodyParams: { revocationReason: r } }, s); return this.request(n); }
|
|
893
|
+
async verify(t) { let { token: e, machineSecretKey: r } = t; if (He(e))
|
|
894
|
+
return ce(this, ie, fs).call(this, e); let s = ce(this, ie, Se).call(this, { method: "POST", path: u(Re, "verify"), bodyParams: { token: e } }, r); return this.request(s); }
|
|
895
|
+
};
|
|
896
|
+
Fe = new WeakMap;
|
|
897
|
+
ie = new WeakSet;
|
|
898
|
+
Se = function (t, e) { return e ? { ...t, headerParams: { ...t.headerParams, Authorization: `Bearer ${e}` } } : t; };
|
|
899
|
+
fs = async function (t) { let e; try {
|
|
900
|
+
let { data: s, errors: n } = K(t);
|
|
901
|
+
if (n)
|
|
902
|
+
throw n[0];
|
|
903
|
+
e = s;
|
|
904
|
+
}
|
|
905
|
+
catch (s) {
|
|
906
|
+
throw new B({ code: W.TokenInvalid, message: s.message });
|
|
907
|
+
} let r = await ds(t, e, _r(this, Fe)); if (r.errors)
|
|
908
|
+
throw r.errors[0]; return r.data; };
|
|
909
|
+
var qo = "/jwks", Mo = class extends C {
|
|
910
|
+
async getJwks() { return this.request({ method: "GET", path: qo }); }
|
|
911
|
+
}, ge = "/jwt_templates", No = class extends C {
|
|
912
|
+
async list(t = {}) { return this.request({ method: "GET", path: ge, queryParams: { ...t, paginated: !0 } }); }
|
|
913
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(ge, t) }); }
|
|
914
|
+
async create(t) { return this.request({ method: "POST", path: ge, bodyParams: t }); }
|
|
915
|
+
async update(t) { let { templateId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(ge, e), bodyParams: r }); }
|
|
916
|
+
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ge, t) }); }
|
|
917
|
+
}, N = "/organizations", Jo = class extends C {
|
|
918
|
+
async getOrganizationList(t) { return this.request({ method: "GET", path: N, queryParams: t }); }
|
|
919
|
+
async createOrganization(t) { return this.request({ method: "POST", path: N, bodyParams: t }); }
|
|
920
|
+
async getOrganization(t) { let { includeMembersCount: e } = t, r = "organizationId" in t ? t.organizationId : t.slug; return this.requireId(r), this.request({ method: "GET", path: u(N, r), queryParams: { includeMembersCount: e } }); }
|
|
921
|
+
async updateOrganization(t, e) { this.requireId(t); let { publicMetadata: r, privateMetadata: s, ...n } = e, i = r !== void 0 || s !== void 0, o = Object.keys(n).length > 0; return i && de("updateOrganization(organizationId, { publicMetadata | privateMetadata })", "Use updateOrganizationMetadata for partial updates (merge) or replaceOrganizationMetadata for full replacement."), i ? (o && await this.request({ method: "PATCH", path: u(N, t), bodyParams: n }), this.request({ method: "PUT", path: u(N, t, "metadata"), bodyParams: { publicMetadata: r, privateMetadata: s } })) : this.request({ method: "PATCH", path: u(N, t), bodyParams: n }); }
|
|
922
|
+
async updateOrganizationLogo(t, e) { this.requireId(t); let r = new te.FormData; return r.append("file", e?.file), e?.uploaderUserId && r.append("uploader_user_id", e?.uploaderUserId), this.request({ method: "PUT", path: u(N, t, "logo"), formData: r }); }
|
|
923
|
+
async deleteOrganizationLogo(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(N, t, "logo") }); }
|
|
924
|
+
async updateOrganizationMetadata(t, e) { return this.requireId(t), this.request({ method: "PATCH", path: u(N, t, "metadata"), bodyParams: e }); }
|
|
925
|
+
async replaceOrganizationMetadata(t, e) { return this.requireId(t), this.request({ method: "PUT", path: u(N, t, "metadata"), bodyParams: e }); }
|
|
926
|
+
async deleteOrganization(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(N, t) }); }
|
|
927
|
+
async getOrganizationMembershipList(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "GET", path: u(N, e, "memberships"), queryParams: r }); }
|
|
928
|
+
async getInstanceOrganizationMembershipList(t) { return this.request({ method: "GET", path: "/organization_memberships", queryParams: t }); }
|
|
929
|
+
async createOrganizationMembership(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(N, e, "memberships"), bodyParams: r }); }
|
|
930
|
+
async updateOrganizationMembership(t) { let { organizationId: e, userId: r, ...s } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(N, e, "memberships", r), bodyParams: s }); }
|
|
931
|
+
async updateOrganizationMembershipMetadata(t) { let { organizationId: e, userId: r, ...s } = t; return this.request({ method: "PATCH", path: u(N, e, "memberships", r, "metadata"), bodyParams: s }); }
|
|
932
|
+
async deleteOrganizationMembership(t) { let { organizationId: e, userId: r } = t; return this.requireId(e), this.request({ method: "DELETE", path: u(N, e, "memberships", r) }); }
|
|
933
|
+
async getOrganizationInvitationList(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "GET", path: u(N, e, "invitations"), queryParams: r }); }
|
|
934
|
+
async createOrganizationInvitation(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(N, e, "invitations"), bodyParams: r }); }
|
|
935
|
+
async createOrganizationInvitationBulk(t, e) { return this.requireId(t), this.request({ method: "POST", path: u(N, t, "invitations", "bulk"), bodyParams: e }); }
|
|
936
|
+
async getOrganizationInvitation(t) { let { organizationId: e, invitationId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "GET", path: u(N, e, "invitations", r) }); }
|
|
937
|
+
async revokeOrganizationInvitation(t) { let { organizationId: e, invitationId: r, ...s } = t; return this.requireId(e), this.request({ method: "POST", path: u(N, e, "invitations", r, "revoke"), bodyParams: s }); }
|
|
938
|
+
async getOrganizationDomainList(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "GET", path: u(N, e, "domains"), queryParams: r }); }
|
|
939
|
+
async createOrganizationDomain(t) { let { organizationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(N, e, "domains"), bodyParams: { ...r, verified: r.verified ?? !0 } }); }
|
|
940
|
+
async updateOrganizationDomain(t) { let { organizationId: e, domainId: r, ...s } = t; return this.requireId(e), this.requireId(r), this.request({ method: "PATCH", path: u(N, e, "domains", r), bodyParams: s }); }
|
|
941
|
+
async deleteOrganizationDomain(t) { let { organizationId: e, domainId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "DELETE", path: u(N, e, "domains", r) }); }
|
|
942
|
+
}, ke = "/organization_permissions", Lo = class extends C {
|
|
943
|
+
async getOrganizationPermissionList(t = {}) { return this.request({ method: "GET", path: ke, queryParams: t }); }
|
|
944
|
+
async getOrganizationPermission(t) { return this.requireId(t), this.request({ method: "GET", path: u(ke, t) }); }
|
|
945
|
+
async createOrganizationPermission(t) { return this.request({ method: "POST", path: ke, bodyParams: t }); }
|
|
946
|
+
async updateOrganizationPermission(t) { let { permissionId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(ke, e), bodyParams: r }); }
|
|
947
|
+
async deleteOrganizationPermission(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(ke, t) }); }
|
|
948
|
+
}, re = "/organization_roles", Do = class extends C {
|
|
949
|
+
async getOrganizationRoleList(t = {}) { return this.request({ method: "GET", path: re, queryParams: t }); }
|
|
950
|
+
async getOrganizationRole(t) { return this.requireId(t), this.request({ method: "GET", path: u(re, t) }); }
|
|
951
|
+
async createOrganizationRole(t) { return this.request({ method: "POST", path: re, bodyParams: t }); }
|
|
952
|
+
async updateOrganizationRole(t) { let { organizationRoleId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(re, e), bodyParams: r }); }
|
|
953
|
+
async deleteOrganizationRole(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(re, t) }); }
|
|
954
|
+
async assignPermissionToOrganizationRole(t) { let { organizationRoleId: e, permissionId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "POST", path: u(re, e, "permissions", r) }); }
|
|
955
|
+
async removePermissionFromOrganizationRole(t) { let { organizationRoleId: e, permissionId: r } = t; return this.requireId(e), this.requireId(r), this.request({ method: "DELETE", path: u(re, e, "permissions", r) }); }
|
|
956
|
+
}, se = "/oauth_applications", Fo = class extends C {
|
|
957
|
+
async list(t = {}) { return this.request({ method: "GET", path: se, queryParams: t }); }
|
|
958
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(se, t) }); }
|
|
959
|
+
async create(t) { return this.request({ method: "POST", path: se, bodyParams: t }); }
|
|
960
|
+
async update(t) { let { oauthApplicationId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(se, e), bodyParams: r }); }
|
|
961
|
+
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(se, t) }); }
|
|
962
|
+
async rotateSecret(t) { return this.requireId(t), this.request({ method: "POST", path: u(se, t, "rotate_secret") }); }
|
|
963
|
+
async revokeToken(t) { let { oauthApplicationId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(se, e, "revoke_token"), bodyParams: r }); }
|
|
964
|
+
}, qe = "/phone_numbers", Ko = class extends C {
|
|
965
|
+
async getPhoneNumber(t) { return this.requireId(t), this.request({ method: "GET", path: u(qe, t) }); }
|
|
966
|
+
async createPhoneNumber(t) { return this.request({ method: "POST", path: qe, bodyParams: t }); }
|
|
967
|
+
async updatePhoneNumber(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(qe, t), bodyParams: e }); }
|
|
968
|
+
async deletePhoneNumber(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(qe, t) }); }
|
|
969
|
+
}, Ho = "/proxy_checks", zo = class extends C {
|
|
970
|
+
async verify(t) { return this.request({ method: "POST", path: Ho, bodyParams: t }); }
|
|
971
|
+
}, Me = "/redirect_urls", Wo = class extends C {
|
|
972
|
+
async getRedirectUrlList() { return this.request({ method: "GET", path: Me, queryParams: { paginated: !0 } }); }
|
|
973
|
+
async getRedirectUrl(t) { return this.requireId(t), this.request({ method: "GET", path: u(Me, t) }); }
|
|
974
|
+
async createRedirectUrl(t) { return this.request({ method: "POST", path: Me, bodyParams: t }); }
|
|
975
|
+
async deleteRedirectUrl(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(Me, t) }); }
|
|
976
|
+
}, ne = "/role_sets", Bo = class extends C {
|
|
977
|
+
async getRoleSetList(t = {}) { return this.request({ method: "GET", path: ne, queryParams: t }); }
|
|
978
|
+
async getRoleSet(t) { return this.requireId(t), this.request({ method: "GET", path: u(ne, t) }); }
|
|
979
|
+
async createRoleSet(t) { return this.request({ method: "POST", path: ne, bodyParams: t }); }
|
|
980
|
+
async updateRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "PATCH", path: u(ne, e), bodyParams: r }); }
|
|
981
|
+
async addRolesToRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "roles"), bodyParams: r }); }
|
|
982
|
+
async replaceRoleInRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "roles", "replace"), bodyParams: r }); }
|
|
983
|
+
async replaceRoleSet(t) { let { roleSetKeyOrId: e, ...r } = t; return this.requireId(e), this.request({ method: "POST", path: u(ne, e, "replace"), bodyParams: r }); }
|
|
984
|
+
}, _e = "/saml_connections", jo = class extends C {
|
|
985
|
+
async getSamlConnectionList(t = {}) { return this.request({ method: "GET", path: _e, queryParams: t }); }
|
|
986
|
+
async createSamlConnection(t) { return this.request({ method: "POST", path: _e, bodyParams: t, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
987
|
+
async getSamlConnection(t) { return this.requireId(t), this.request({ method: "GET", path: u(_e, t) }); }
|
|
988
|
+
async updateSamlConnection(t, e = {}) { return this.requireId(t), this.request({ method: "PATCH", path: u(_e, t), bodyParams: e, options: { deepSnakecaseBodyParamKeys: !0 } }); }
|
|
989
|
+
async deleteSamlConnection(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(_e, t) }); }
|
|
990
|
+
}, Y = "/sessions", Vo = class extends C {
|
|
991
|
+
async getSessionList(t = {}) { return this.request({ method: "GET", path: Y, queryParams: { ...t, paginated: !0 } }); }
|
|
992
|
+
async getSession(t) { return this.requireId(t), this.request({ method: "GET", path: u(Y, t) }); }
|
|
993
|
+
async createSession(t) { return this.request({ method: "POST", path: Y, bodyParams: t }); }
|
|
994
|
+
async revokeSession(t) { return this.requireId(t), this.request({ method: "POST", path: u(Y, t, "revoke") }); }
|
|
995
|
+
async verifySession(t, e) { return this.requireId(t), this.request({ method: "POST", path: u(Y, t, "verify"), bodyParams: { token: e } }); }
|
|
996
|
+
async getToken(t, e, r) { this.requireId(t); let n = { method: "POST", path: e ? u(Y, t, "tokens", e) : u(Y, t, "tokens") }; return r !== void 0 && (n.bodyParams = { expires_in_seconds: r }), this.request(n); }
|
|
997
|
+
async refreshSession(t, e) { this.requireId(t); let { suffixed_cookies: r, ...s } = e; return this.request({ method: "POST", path: u(Y, t, "refresh"), bodyParams: s, queryParams: { suffixed_cookies: r } }); }
|
|
998
|
+
}, Dr = "/sign_in_tokens", $o = class extends C {
|
|
999
|
+
async createSignInToken(t) { return this.request({ method: "POST", path: Dr, bodyParams: t }); }
|
|
1000
|
+
async revokeSignInToken(t) { return this.requireId(t), this.request({ method: "POST", path: u(Dr, t, "revoke") }); }
|
|
1001
|
+
}, Fr = "/sign_ups", Go = class extends C {
|
|
1002
|
+
async get(t) { return this.requireId(t), this.request({ method: "GET", path: u(Fr, t) }); }
|
|
1003
|
+
async update(t) { let { signUpAttemptId: e, ...r } = t; return this.request({ method: "PATCH", path: u(Fr, e), bodyParams: r }); }
|
|
1004
|
+
}, Qo = "/testing_tokens", Yo = class extends C {
|
|
1005
|
+
async createTestingToken() { return this.request({ method: "POST", path: Qo }); }
|
|
1006
|
+
}, R = "/users", Xo = class extends C {
|
|
1007
|
+
async getUserList(t = {}) { let { limit: e, offset: r, orderBy: s, ...n } = t, [i, o] = await Promise.all([this.request({ method: "GET", path: R, queryParams: t }), this.getCount(n)]); return { data: i, totalCount: o }; }
|
|
1008
|
+
async getUser(t) { return this.requireId(t), this.request({ method: "GET", path: u(R, t) }); }
|
|
1009
|
+
async createUser(t) { return this.request({ method: "POST", path: R, bodyParams: t }); }
|
|
1010
|
+
async updateUser(t, e = {}) { this.requireId(t); let { publicMetadata: r, privateMetadata: s, unsafeMetadata: n, ...i } = e, o = r !== void 0 || s !== void 0 || n !== void 0, a = Object.keys(i).length > 0; return o && de("updateUser(userId, { publicMetadata | privateMetadata | unsafeMetadata })", "Use updateUserMetadata for partial updates (merge) or replaceUserMetadata for full replacement."), o ? (a && await this.request({ method: "PATCH", path: u(R, t), bodyParams: i }), this.request({ method: "PUT", path: u(R, t, "metadata"), bodyParams: { publicMetadata: r, privateMetadata: s, unsafeMetadata: n } })) : this.request({ method: "PATCH", path: u(R, t), bodyParams: i }); }
|
|
1011
|
+
async replaceUserEmailAddress(t, e) { return this.requireId(t), this.request({ method: "PUT", path: u(R, t, "email_address"), bodyParams: e }); }
|
|
1012
|
+
async replaceUserPhoneNumber(t, e) { return this.requireId(t), this.request({ method: "PUT", path: u(R, t, "phone_number"), bodyParams: e }); }
|
|
1013
|
+
async updateUserProfileImage(t, e) { this.requireId(t); let r = new te.FormData; return r.append("file", e?.file), this.request({ method: "POST", path: u(R, t, "profile_image"), formData: r }); }
|
|
1014
|
+
async updateUserMetadata(t, e) { return this.requireId(t), this.request({ method: "PATCH", path: u(R, t, "metadata"), bodyParams: e }); }
|
|
1015
|
+
async replaceUserMetadata(t, e) { return this.requireId(t), this.request({ method: "PUT", path: u(R, t, "metadata"), bodyParams: e }); }
|
|
1016
|
+
async deleteUser(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t) }); }
|
|
1017
|
+
async getCount(t = {}) { return this.request({ method: "GET", path: u(R, "count"), queryParams: t }); }
|
|
1018
|
+
async getUserOauthAccessToken(t, e) { this.requireId(t); let r = e.startsWith("oauth_"), s = r ? e : `oauth_${e}`; return r && de("getUserOauthAccessToken(userId, provider)", "Remove the `oauth_` prefix from the `provider` argument."), this.request({ method: "GET", path: u(R, t, "oauth_access_tokens", s), queryParams: { paginated: !0 } }); }
|
|
1019
|
+
async disableUserMFA(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t, "mfa") }); }
|
|
1020
|
+
async getOrganizationMembershipList(t) { let { userId: e, limit: r, offset: s } = t; return this.requireId(e), this.request({ method: "GET", path: u(R, e, "organization_memberships"), queryParams: { limit: r, offset: s } }); }
|
|
1021
|
+
async getOrganizationInvitationList(t) { let { userId: e, ...r } = t; return this.requireId(e), this.request({ method: "GET", path: u(R, e, "organization_invitations"), queryParams: r }); }
|
|
1022
|
+
async verifyPassword(t) { let { userId: e, password: r } = t; return this.requireId(e), this.request({ method: "POST", path: u(R, e, "verify_password"), bodyParams: { password: r } }); }
|
|
1023
|
+
async verifyTOTP(t) { let { userId: e, code: r } = t; return this.requireId(e), this.request({ method: "POST", path: u(R, e, "verify_totp"), bodyParams: { code: r } }); }
|
|
1024
|
+
async banUser(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "ban") }); }
|
|
1025
|
+
async unbanUser(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "unban") }); }
|
|
1026
|
+
async lockUser(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "lock") }); }
|
|
1027
|
+
async unlockUser(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "unlock") }); }
|
|
1028
|
+
async deleteUserProfileImage(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t, "profile_image") }); }
|
|
1029
|
+
async deleteUserPasskey(t) { return this.requireId(t.userId), this.requireId(t.passkeyIdentificationId), this.request({ method: "DELETE", path: u(R, t.userId, "passkeys", t.passkeyIdentificationId) }); }
|
|
1030
|
+
async deleteUserWeb3Wallet(t) { return this.requireId(t.userId), this.requireId(t.web3WalletIdentificationId), this.request({ method: "DELETE", path: u(R, t.userId, "web3_wallets", t.web3WalletIdentificationId) }); }
|
|
1031
|
+
async deleteUserExternalAccount(t) { return this.requireId(t.userId), this.requireId(t.externalAccountId), this.request({ method: "DELETE", path: u(R, t.userId, "external_accounts", t.externalAccountId) }); }
|
|
1032
|
+
async deleteUserBackupCodes(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t, "backup_code") }); }
|
|
1033
|
+
async deleteUserTOTP(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(R, t, "totp") }); }
|
|
1034
|
+
async setPasswordCompromised(t, e = { revokeAllSessions: !1 }) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "password", "set_compromised"), bodyParams: e }); }
|
|
1035
|
+
async unsetPasswordCompromised(t) { return this.requireId(t), this.request({ method: "POST", path: u(R, t, "password", "unset_compromised") }); }
|
|
1036
|
+
}, le = "/waitlist_entries", Zo = class extends C {
|
|
1037
|
+
async list(t = {}) { return this.request({ method: "GET", path: le, queryParams: t }); }
|
|
1038
|
+
async create(t) { return this.request({ method: "POST", path: le, bodyParams: t }); }
|
|
1039
|
+
async createBulk(t) { return this.request({ method: "POST", path: u(le, "bulk"), bodyParams: t }); }
|
|
1040
|
+
async invite(t, e = {}) { return this.requireId(t), this.request({ method: "POST", path: u(le, t, "invite"), bodyParams: e }); }
|
|
1041
|
+
async reject(t) { return this.requireId(t), this.request({ method: "POST", path: u(le, t, "reject") }); }
|
|
1042
|
+
async delete(t) { return this.requireId(t), this.request({ method: "DELETE", path: u(le, t) }); }
|
|
1043
|
+
}, pt = "/webhooks", ea = class extends C {
|
|
1044
|
+
async createSvixApp() { return this.request({ method: "POST", path: u(pt, "svix") }); }
|
|
1045
|
+
async generateSvixAuthURL() { return this.request({ method: "POST", path: u(pt, "svix_url") }); }
|
|
1046
|
+
async deleteSvixApp() { return this.request({ method: "DELETE", path: u(pt, "svix") }); }
|
|
1047
|
+
}, Kr = "/billing", ta = "/organizations", ra = "/users", sa = class extends C {
|
|
1048
|
+
async getPlanList(t) { return this.request({ method: "GET", path: u(Kr, "plans"), queryParams: t }); }
|
|
1049
|
+
async cancelSubscriptionItem(t, e) { return this.requireId(t), this.request({ method: "DELETE", path: u(Kr, "subscription_items", t), queryParams: e }); }
|
|
1050
|
+
async extendSubscriptionItemFreeTrial(t, e) { return this.requireId(t), this.request({ method: "POST", path: u("/billing", "subscription_items", t, "extend_free_trial"), bodyParams: e }); }
|
|
1051
|
+
async getOrganizationBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(ta, t, "billing", "subscription") }); }
|
|
1052
|
+
async getUserBillingSubscription(t) { return this.requireId(t), this.request({ method: "GET", path: u(ra, t, "billing", "subscription") }); }
|
|
1053
|
+
}, ps = t => typeof t == "object" && t !== null, Hr = t => ps(t) && !(t instanceof RegExp) && !(t instanceof Error) && !(t instanceof Date) && !(globalThis.Blob && t instanceof globalThis.Blob), na = Symbol("mapObjectSkip"), wt = (t, e, r, s = new WeakMap) => { if (r = { deep: !1, target: {}, ...r }, s.has(t))
|
|
1054
|
+
return s.get(t); s.set(t, r.target); let { target: n } = r; delete r.target; let i = o => o.map(a => Hr(a) ? wt(a, e, r, s) : a); if (Array.isArray(t))
|
|
1055
|
+
return i(t); for (let [o, a] of Object.entries(t)) {
|
|
1056
|
+
let c = e(o, a, t);
|
|
1057
|
+
if (c === na)
|
|
1058
|
+
continue;
|
|
1059
|
+
let [d, f, { shouldRecurse: p = !0 } = {}] = c;
|
|
1060
|
+
d !== "__proto__" && (r.deep && p && Hr(f) && (f = Array.isArray(f) ? i(f) : wt(f, e, r, s)), n[d] = f);
|
|
1061
|
+
} return n; };
|
|
1062
|
+
function zr(t, e, r) { if (!ps(t))
|
|
1063
|
+
throw new TypeError(`Expected an object, got \`${t}\` (${typeof t})`); if (Array.isArray(t))
|
|
1064
|
+
throw new TypeError("Expected an object, got an array"); return wt(t, e, r); }
|
|
1065
|
+
var ia = /([\p{Ll}\d])(\p{Lu})/gu, oa = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu, aa = /(\d)\p{Ll}|(\p{L})\d/u, ca = /[^\p{L}\d]+/giu, Wr = "$1\0$2", Br = "";
|
|
1066
|
+
function ms(t) { let e = t.trim(); e = e.replace(ia, Wr).replace(oa, Wr), e = e.replace(ca, "\0"); let r = 0, s = e.length; for (; e.charAt(r) === "\0";)
|
|
1067
|
+
r++; if (r === s)
|
|
1068
|
+
return []; for (; e.charAt(s - 1) === "\0";)
|
|
1069
|
+
s--; return e.slice(r, s).split(/\0/g); }
|
|
1070
|
+
function ua(t) { let e = ms(t); for (let r = 0; r < e.length; r++) {
|
|
1071
|
+
let s = e[r], n = aa.exec(s);
|
|
1072
|
+
if (n) {
|
|
1073
|
+
let i = n.index + (n[1] ?? n[2]).length;
|
|
1074
|
+
e.splice(r, 1, s.slice(0, i), s.slice(i));
|
|
1075
|
+
}
|
|
1076
|
+
} return e; }
|
|
1077
|
+
function la(t, e) { let [r, s, n] = da(t, e); return r + s.map(ha(e?.locale)).join(e?.delimiter ?? " ") + n; }
|
|
1078
|
+
function jr(t, e) { return la(t, { delimiter: "_", ...e }); }
|
|
1079
|
+
function ha(t) { return t === !1 ? e => e.toLowerCase() : e => e.toLocaleLowerCase(t); }
|
|
1080
|
+
function da(t, e = {}) { let r = e.split ?? (e.separateNumbers ? ua : ms), s = e.prefixCharacters ?? Br, n = e.suffixCharacters ?? Br, i = 0, o = t.length; for (; i < t.length;) {
|
|
1081
|
+
let a = t.charAt(i);
|
|
1082
|
+
if (!s.includes(a))
|
|
1083
|
+
break;
|
|
1084
|
+
i++;
|
|
1085
|
+
} for (; o > i;) {
|
|
1086
|
+
let a = o - 1, c = t.charAt(a);
|
|
1087
|
+
if (!n.includes(c))
|
|
1088
|
+
break;
|
|
1089
|
+
o = a;
|
|
1090
|
+
} return [t.slice(0, i), r(t.slice(i, o)), t.slice(o)]; }
|
|
1091
|
+
var Vr = {}.constructor;
|
|
1092
|
+
function fa(t, e) { if (Array.isArray(t)) {
|
|
1093
|
+
if (t.some(n => n.constructor !== Vr))
|
|
1094
|
+
throw new Error("obj must be array of plain objects");
|
|
1095
|
+
e = { deep: !0, exclude: [], parsingOptions: {}, ...e };
|
|
1096
|
+
let s = e.snakeCase || (n => jr(n, e.parsingOptions));
|
|
1097
|
+
return t.map(n => zr(n, (i, o) => [$r(e.exclude, i) ? i : s(i), o, Gr(i, o, e)], e));
|
|
1098
|
+
}
|
|
1099
|
+
else if (t.constructor !== Vr)
|
|
1100
|
+
throw new Error("obj must be an plain object"); e = { deep: !0, exclude: [], parsingOptions: {}, ...e }; let r = e.snakeCase || (s => jr(s, e.parsingOptions)); return zr(t, (s, n) => [$r(e.exclude, s) ? s : r(s), n, Gr(s, n, e)], e); }
|
|
1101
|
+
function $r(t, e) { return t.some(r => typeof r == "string" ? r === e : r.test(e)); }
|
|
1102
|
+
function Gr(t, e, r) { return r.shouldRecurse ? { shouldRecurse: r.shouldRecurse(t, e) } : void 0; }
|
|
1103
|
+
var Qr = fa, pa = class ys {
|
|
1104
|
+
constructor(e, r, s, n) { this.publishableKey = e, this.secretKey = r, this.claimUrl = s, this.apiKeysUrl = n; }
|
|
1105
|
+
static fromJSON(e) { return new ys(e.publishable_key, e.secret_key, e.claim_url, e.api_keys_url); }
|
|
1106
|
+
}, ma = class gs {
|
|
1107
|
+
constructor(e, r, s, n) { this.agentId = e, this.taskId = r, this.agentTaskId = s, this.url = n; }
|
|
1108
|
+
static fromJSON(e) { let r = e.agent_task_id ?? e.task_id ?? ""; return new gs(e.agent_id, r, r, e.url); }
|
|
1109
|
+
}, ya = class ks {
|
|
1110
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.status = r, this.userId = s, this.actor = n, this.token = i, this.url = o, this.createdAt = a, this.updatedAt = c; }
|
|
1111
|
+
static fromJSON(e) { return new ks(e.id, e.status, e.user_id, e.actor, e.token, e.url, e.created_at, e.updated_at); }
|
|
1112
|
+
}, ga = class _s {
|
|
1113
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.identifier = r, this.identifierType = s, this.createdAt = n, this.updatedAt = i, this.instanceId = o, this.invitationId = a; }
|
|
1114
|
+
static fromJSON(e) { return new _s(e.id, e.identifier, e.identifier_type, e.created_at, e.updated_at, e.instance_id, e.invitation_id); }
|
|
1115
|
+
}, ka = class vs {
|
|
1116
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x) { this.id = e, this.type = r, this.name = s, this.subject = n, this.scopes = i, this.claims = o, this.revoked = a, this.revocationReason = c, this.expired = d, this.expiration = f, this.createdBy = p, this.description = E, this.lastUsedAt = S, this.createdAt = A, this.updatedAt = P, this.secret = x; }
|
|
1117
|
+
static fromJSON(e) { return new vs(e.id, e.type, e.name, e.subject, e.scopes, e.claims, e.revoked, e.revocation_reason, e.expired, e.expiration, e.created_by, e.description, e.last_used_at, e.created_at, e.updated_at, e.secret); }
|
|
1118
|
+
}, _a = class Ss {
|
|
1119
|
+
constructor(e, r, s, n, i, o) { this.id = e, this.identifier = r, this.identifierType = s, this.createdAt = n, this.updatedAt = i, this.instanceId = o; }
|
|
1120
|
+
static fromJSON(e) { return new Ss(e.id, e.identifier, e.identifier_type, e.created_at, e.updated_at, e.instance_id); }
|
|
1121
|
+
}, va = class Ts {
|
|
1122
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.isMobile = r, this.ipAddress = s, this.city = n, this.country = i, this.browserVersion = o, this.browserName = a, this.deviceType = c; }
|
|
1123
|
+
static fromJSON(e) { return new Ts(e.id, e.is_mobile, e.ip_address, e.city, e.country, e.browser_version, e.browser_name, e.device_type); }
|
|
1124
|
+
}, bs = class Es {
|
|
1125
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E = null) { this.id = e, this.clientId = r, this.userId = s, this.status = n, this.lastActiveAt = i, this.expireAt = o, this.abandonAt = a, this.createdAt = c, this.updatedAt = d, this.lastActiveOrganizationId = f, this.latestActivity = p, this.actor = E; }
|
|
1126
|
+
static fromJSON(e) { return new Es(e.id, e.client_id, e.user_id, e.status, e.last_active_at, e.expire_at, e.abandon_at, e.created_at, e.updated_at, e.last_active_organization_id, e.latest_activity && va.fromJSON(e.latest_activity), e.actor); }
|
|
1127
|
+
}, Sa = class ws {
|
|
1128
|
+
constructor(e, r, s, n, i, o, a, c, d) { this.id = e, this.sessionIds = r, this.sessions = s, this.signInId = n, this.signUpId = i, this.lastActiveSessionId = o, this.lastAuthenticationStrategy = a, this.createdAt = c, this.updatedAt = d; }
|
|
1129
|
+
static fromJSON(e) { return new ws(e.id, e.session_ids, e.sessions.map(r => bs.fromJSON(r)), e.sign_in_id, e.sign_up_id, e.last_active_session_id, e.last_authentication_strategy, e.created_at, e.updated_at); }
|
|
1130
|
+
}, Ta = class As {
|
|
1131
|
+
constructor(e, r, s) { this.host = e, this.value = r, this.required = s; }
|
|
1132
|
+
static fromJSON(e) { return new As(e.host, e.value, e.required); }
|
|
1133
|
+
}, ba = class Ps {
|
|
1134
|
+
constructor(e) { this.cookies = e; }
|
|
1135
|
+
static fromJSON(e) { return new Ps(e.cookies); }
|
|
1136
|
+
}, Ea = class Is {
|
|
1137
|
+
constructor(e, r, s, n) { this.object = e, this.id = r, this.slug = s, this.deleted = n; }
|
|
1138
|
+
static fromJSON(e) { return new Is(e.object, e.id || null, e.slug || null, e.deleted); }
|
|
1139
|
+
}, wa = class Os {
|
|
1140
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.isSatellite = s, this.frontendApiUrl = n, this.developmentOrigin = i, this.cnameTargets = o, this.accountsPortalUrl = a, this.proxyUrl = c; }
|
|
1141
|
+
static fromJSON(e) { return new Os(e.id, e.name, e.is_satellite, e.frontend_api_url, e.development_origin, e.cname_targets && e.cname_targets.map(r => Ta.fromJSON(r)), e.accounts_portal_url, e.proxy_url); }
|
|
1142
|
+
}, Aa = class Cs {
|
|
1143
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E) { this.id = e, this.fromEmailName = r, this.emailAddressId = s, this.toEmailAddress = n, this.subject = i, this.body = o, this.bodyPlain = a, this.status = c, this.slug = d, this.data = f, this.deliveredByClerk = p, this.userId = E; }
|
|
1144
|
+
static fromJSON(e) { return new Cs(e.id, e.from_email_name, e.email_address_id, e.to_email_address, e.subject, e.body, e.body_plain, e.status, e.slug, e.data, e.delivered_by_clerk, e.user_id); }
|
|
1145
|
+
}, xs = class Us {
|
|
1146
|
+
constructor(e, r) { this.id = e, this.type = r; }
|
|
1147
|
+
static fromJSON(e) { return new Us(e.id, e.type); }
|
|
1148
|
+
}, be = class Rs {
|
|
1149
|
+
constructor(e, r, s = null, n = null, i = null, o = null, a = null) { this.status = e, this.strategy = r, this.externalVerificationRedirectURL = s, this.attempts = n, this.expireAt = i, this.nonce = o, this.message = a; }
|
|
1150
|
+
static fromJSON(e) { return new Rs(e.status, e.strategy, e.external_verification_redirect_url ? new URL(e.external_verification_redirect_url) : null, e.attempts, e.expire_at, e.nonce); }
|
|
1151
|
+
}, qs = class Ms {
|
|
1152
|
+
constructor(e, r, s, n) { this.id = e, this.emailAddress = r, this.verification = s, this.linkedTo = n; }
|
|
1153
|
+
static fromJSON(e) { return new Ms(e.id, e.email_address, e.verification && be.fromJSON(e.verification), e.linked_to.map(r => xs.fromJSON(r))); }
|
|
1154
|
+
}, Ns = class Js {
|
|
1155
|
+
constructor(e, r, s, n, i) { this.id = e, this.name = r, this.description = s, this.slug = n, this.avatarUrl = i; }
|
|
1156
|
+
static fromJSON(e) { return new Js(e.id, e.name, e.description ?? null, e.slug, e.avatar_url ?? null); }
|
|
1157
|
+
}, Ls = class Ds {
|
|
1158
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x) { this.id = e, this.name = r, this.slug = s, this.description = n, this.isDefault = i, this.isRecurring = o, this.hasBaseFee = a, this.publiclyVisible = c, this.fee = d, this.annualFee = f, this.annualMonthlyFee = p, this.forPayerType = E, this.features = S, this.avatarUrl = A, this.freeTrialDays = P, this.freeTrialEnabled = x; }
|
|
1159
|
+
static fromJSON(e) { let r = s => s ? { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol } : null; return new Ds(e.id, e.name, e.slug, e.description ?? null, e.is_default, e.is_recurring, e.has_base_fee, e.publicly_visible, r(e.fee), r(e.annual_fee), r(e.annual_monthly_fee), e.for_payer_type, (e.features ?? []).map(s => Ns.fromJSON(s)), e.avatar_url, e.free_trial_days, e.free_trial_enabled); }
|
|
1160
|
+
}, Fs = class Ks {
|
|
1161
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l) { this.id = e, this.status = r, this.planPeriod = s, this.periodStart = n, this.nextPayment = i, this.amount = o, this.plan = a, this.planId = c, this.createdAt = d, this.updatedAt = f, this.periodEnd = p, this.canceledAt = E, this.pastDueAt = S, this.endedAt = A, this.payerId = P, this.isFreeTrial = x, this.lifetimePaid = l; }
|
|
1162
|
+
static fromJSON(e) { function r(s) { return s && { amount: s.amount, amountFormatted: s.amount_formatted, currency: s.currency, currencySymbol: s.currency_symbol }; } return new Ks(e.id, e.status, e.plan_period, e.period_start, e.next_payment, r(e.amount) ?? void 0, e.plan ? Ls.fromJSON(e.plan) : null, e.plan_id ?? null, e.created_at, e.updated_at, e.period_end, e.canceled_at, e.past_due_at, e.ended_at, e.payer_id, e.is_free_trial, r(e.lifetime_paid) ?? void 0); }
|
|
1163
|
+
}, Pa = class Hs {
|
|
1164
|
+
constructor(e, r, s, n, i, o, a, c, d, f) { this.id = e, this.status = r, this.payerId = s, this.createdAt = n, this.updatedAt = i, this.activeAt = o, this.pastDueAt = a, this.subscriptionItems = c, this.nextPayment = d, this.eligibleForFreeTrial = f; }
|
|
1165
|
+
static fromJSON(e) { let r = e.next_payment ? { date: e.next_payment.date, amount: { amount: e.next_payment.amount.amount, amountFormatted: e.next_payment.amount.amount_formatted, currency: e.next_payment.amount.currency, currencySymbol: e.next_payment.amount.currency_symbol } } : null; return new Hs(e.id, e.status, e.payer_id, e.created_at, e.updated_at, e.active_at ?? null, e.past_due_at ?? null, (e.subscription_items ?? []).map(s => Fs.fromJSON(s)), r, e.eligible_for_free_trial ?? !1); }
|
|
1166
|
+
}, Ia = class zs {
|
|
1167
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.active = r, this.allowIdpInitiated = s, this.allowSubdomains = n, this.disableAdditionalIdentifications = i, this.domain = o, this.logoPublicUrl = a, this.name = c, this.protocol = d, this.provider = f, this.syncUserAttributes = p, this.createdAt = E, this.updatedAt = S; }
|
|
1168
|
+
static fromJSON(e) { return new zs(e.id, e.active, e.allow_idp_initiated, e.allow_subdomains, e.disable_additional_identifications, e.domain, e.logo_public_url, e.name, e.protocol, e.provider, e.sync_user_attributes, e.created_at, e.updated_at); }
|
|
1169
|
+
}, Ws = class Bs {
|
|
1170
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.active = r, this.emailAddress = s, this.enterpriseConnection = n, this.firstName = i, this.lastName = o, this.protocol = a, this.provider = c, this.providerUserId = d, this.publicMetadata = f, this.verification = p, this.lastAuthenticatedAt = E, this.enterpriseConnectionId = S; }
|
|
1171
|
+
static fromJSON(e) { return new Bs(e.id, e.active, e.email_address, e.enterprise_connection && Ia.fromJSON(e.enterprise_connection), e.first_name, e.last_name, e.protocol, e.provider, e.provider_user_id, e.public_metadata, e.verification && be.fromJSON(e.verification), e.last_authenticated_at, e.enterprise_connection_id); }
|
|
1172
|
+
}, Oa = class js {
|
|
1173
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P) { this.id = e, this.name = r, this.idpEntityId = s, this.idpSsoUrl = n, this.idpCertificate = i, this.idpCertificateIssuedAt = o, this.idpCertificateExpiresAt = a, this.idpMetadataUrl = c, this.idpMetadata = d, this.acsUrl = f, this.spEntityId = p, this.spMetadataUrl = E, this.syncUserAttributes = S, this.allowSubdomains = A, this.allowIdpInitiated = P; }
|
|
1174
|
+
static fromJSON(e) { return new js(e.id, e.name, e.idp_entity_id, e.idp_sso_url, e.idp_certificate, e.idp_certificate_issued_at, e.idp_certificate_expires_at, e.idp_metadata_url, e.idp_metadata, e.acs_url, e.sp_entity_id, e.sp_metadata_url, e.sync_user_attributes, e.allow_subdomains, e.allow_idp_initiated); }
|
|
1175
|
+
}, Ca = class Vs {
|
|
1176
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.name = r, this.clientId = s, this.discoveryUrl = n, this.logoPublicUrl = i, this.createdAt = o, this.updatedAt = a; }
|
|
1177
|
+
static fromJSON(e) { return new Vs(e.id, e.name, e.client_id, e.discovery_url, e.logo_public_url, e.created_at, e.updated_at); }
|
|
1178
|
+
}, xa = class $s {
|
|
1179
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E) { this.id = e, this.name = r, this.domains = s, this.organizationId = n, this.active = i, this.syncUserAttributes = o, this.allowSubdomains = a, this.disableAdditionalIdentifications = c, this.createdAt = d, this.updatedAt = f, this.samlConnection = p, this.oauthConfig = E; }
|
|
1180
|
+
static fromJSON(e) { return new $s(e.id, e.name, e.domains, e.organization_id, e.active, e.sync_user_attributes, e.allow_subdomains, e.disable_additional_identifications, e.created_at, e.updated_at, e.saml_connection != null ? Oa.fromJSON(e.saml_connection) : null, e.oauth_config != null ? Ca.fromJSON(e.oauth_config) : null); }
|
|
1181
|
+
}, Ua = class Gs {
|
|
1182
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S = {}, A, P, x) { this.id = e, this.provider = r, this.providerUserId = s, this.identificationId = n, this.externalId = i, this.approvedScopes = o, this.emailAddress = a, this.firstName = c, this.lastName = d, this.imageUrl = f, this.username = p, this.phoneNumber = E, this.publicMetadata = S, this.label = A, this.verification = P, this.externalAccountId = x; }
|
|
1183
|
+
static fromJSON(e) { return new Gs(e.id, e.provider, e.provider_user_id, e.identification_id, e.provider_user_id, e.approved_scopes, e.email_address, e.first_name, e.last_name, e.image_url || "", e.username, e.phone_number, e.public_metadata, e.label, e.verification && be.fromJSON(e.verification), e.external_account_id); }
|
|
1184
|
+
}, Ra = class Qs {
|
|
1185
|
+
constructor(e, r, s) { this.id = e, this.environmentType = r, this.allowedOrigins = s; }
|
|
1186
|
+
static fromJSON(e) { return new Qs(e.id, e.environment_type, e.allowed_origins); }
|
|
1187
|
+
}, qa = class Ys {
|
|
1188
|
+
constructor(e, r, s, n, i) { this.allowlist = e, this.blocklist = r, this.blockEmailSubaddresses = s, this.blockDisposableEmailDomains = n, this.ignoreDotsForGmailAddresses = i; }
|
|
1189
|
+
static fromJSON(e) { return new Ys(e.allowlist, e.blocklist, e.block_email_subaddresses, e.block_disposable_email_domains, e.ignore_dots_for_gmail_addresses); }
|
|
1190
|
+
}, Ma = class Xs {
|
|
1191
|
+
constructor(e, r, s, n, i) { this.id = e, this.restrictedToAllowlist = r, this.fromEmailAddress = s, this.progressiveSignUp = n, this.enhancedEmailDeliverability = i; }
|
|
1192
|
+
static fromJSON(e) { return new Xs(e.id, e.restricted_to_allowlist, e.from_email_address, e.progressive_sign_up, e.enhanced_email_deliverability); }
|
|
1193
|
+
}, Zs = class en {
|
|
1194
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.emailAddress = r, this.publicMetadata = s, this.createdAt = n, this.updatedAt = i, this.status = o, this.url = a, this.revoked = c, this._raw = null; }
|
|
1195
|
+
get raw() { return this._raw; }
|
|
1196
|
+
static fromJSON(e) { let r = new en(e.id, e.email_address, e.public_metadata, e.created_at, e.updated_at, e.status, e.url, e.revoked); return r._raw = e, r; }
|
|
1197
|
+
}, w = { AccountlessApplication: "accountless_application", ActorToken: "actor_token", AgentTask: "agent_task", AllowlistIdentifier: "allowlist_identifier", ApiKey: "api_key", BlocklistIdentifier: "blocklist_identifier", Client: "client", Cookies: "cookies", Domain: "domain", Email: "email", EnterpriseAccount: "enterprise_account", EnterpriseConnection: "enterprise_connection", EmailAddress: "email_address", ExternalAccount: "external_account", FacebookAccount: "facebook_account", GoogleAccount: "google_account", 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", OrganizationDomain: "organization_domain", OrganizationInvitation: "organization_invitation", OrganizationMembership: "organization_membership", OrganizationSettings: "organization_settings", PhoneNumber: "phone_number", ProxyCheck: "proxy_check", RedirectUrl: "redirect_url", SamlConnection: "saml_connection", Session: "session", SignInAttempt: "sign_in_attempt", SignInToken: "sign_in_token", SignUpAttempt: "sign_up_attempt", SmsMessage: "sms_message", User: "user", WaitlistEntry: "waitlist_entry", Web3Wallet: "web3_wallet", Token: "token", TotalCount: "total_count", TestingToken: "testing_token", Role: "role", RoleSet: "role_set", RoleSetItem: "role_set_item", RoleSetMigration: "role_set_migration", Permission: "permission", BillingPayer: "commerce_payer", BillingPaymentAttempt: "commerce_payment_attempt", BillingSubscription: "commerce_subscription", BillingSubscriptionItem: "commerce_subscription_item", BillingPlan: "commerce_plan", Feature: "feature" }, Na = class tn {
|
|
1198
|
+
constructor(e, r, s, n, i, o, a, c, d) { this.id = e, this.name = r, this.claims = s, this.lifetime = n, this.allowedClockSkew = i, this.customSigningKey = o, this.signingAlgorithm = a, this.createdAt = c, this.updatedAt = d; }
|
|
1199
|
+
static fromJSON(e) { return new tn(e.id, e.name, e.claims, e.lifetime, e.allowed_clock_skew, e.custom_signing_key, e.signing_algorithm, e.created_at, e.updated_at); }
|
|
1200
|
+
}, Ja = class At {
|
|
1201
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.instanceId = s, this.createdAt = n, this.updatedAt = i, this.scopedMachines = o, this.defaultTokenTtl = a, this.secretKey = c; }
|
|
1202
|
+
static fromJSON(e) { return new At(e.id, e.name, e.instance_id, e.created_at, e.updated_at, e.scoped_machines.map(r => new At(r.id, r.name, r.instance_id, r.created_at, r.updated_at, [], r.default_token_ttl)), e.default_token_ttl, e.secret_key); }
|
|
1203
|
+
}, La = class rn {
|
|
1204
|
+
constructor(e, r, s, n) { this.fromMachineId = e, this.toMachineId = r, this.createdAt = s, this.deleted = n; }
|
|
1205
|
+
static fromJSON(e) { return new rn(e.from_machine_id, e.to_machine_id, e.created_at, e.deleted); }
|
|
1206
|
+
}, Da = class sn {
|
|
1207
|
+
constructor(e) { this.secret = e; }
|
|
1208
|
+
static fromJSON(e) { return new sn(e.secret); }
|
|
1209
|
+
}, Fa = class nn {
|
|
1210
|
+
constructor(e, r, s, n = {}, i, o, a, c, d) { this.externalAccountId = e, this.provider = r, this.token = s, this.publicMetadata = n, this.label = i, this.scopes = o, this.tokenSecret = a, this.expiresAt = c, this.idToken = d; }
|
|
1211
|
+
static fromJSON(e) { return new nn(e.external_account_id, e.provider, e.token, e.public_metadata, e.label || "", e.scopes, e.token_secret, e.expires_at, e.id_token); }
|
|
1212
|
+
}, Ka = class on {
|
|
1213
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h) { this.id = e, this.instanceId = r, this.name = s, this.clientId = n, this.clientUri = i, this.clientImageUrl = o, this.dynamicallyRegistered = a, this.consentScreenEnabled = c, this.pkceRequired = d, this.isPublic = f, this.scopes = p, this.redirectUris = E, this.authorizeUrl = S, this.tokenFetchUrl = A, this.userInfoUrl = P, this.discoveryUrl = x, this.tokenIntrospectionUrl = l, this.createdAt = y, this.updatedAt = m, this.clientSecret = h; }
|
|
1214
|
+
static fromJSON(e) { return new on(e.id, e.instance_id, e.name, e.client_id, e.client_uri, e.client_image_url, e.dynamically_registered, e.consent_screen_enabled, e.pkce_required, e.public, e.scopes, e.redirect_uris, e.authorize_url, e.token_fetch_url, e.user_info_url, e.discovery_url, e.token_introspection_url, e.created_at, e.updated_at, e.client_secret); }
|
|
1215
|
+
}, an = class cn {
|
|
1216
|
+
constructor(e, r, s, n, i, o, a, c = {}, d = {}, f, p, E, S) { this.id = e, this.name = r, this.slug = s, this.imageUrl = n, this.hasImage = i, this.createdAt = o, this.updatedAt = a, this.publicMetadata = c, this.privateMetadata = d, this.maxAllowedMemberships = f, this.adminDeleteEnabled = p, this.membersCount = E, this.createdBy = S, this._raw = null; }
|
|
1217
|
+
get raw() { return this._raw; }
|
|
1218
|
+
static fromJSON(e) { let r = new cn(e.id, e.name, e.slug, e.image_url || "", e.has_image, e.created_at, e.updated_at, e.public_metadata, e.private_metadata, e.max_allowed_memberships, e.admin_delete_enabled, e.members_count, e.created_by); return r._raw = e, r; }
|
|
1219
|
+
}, Ha = class un {
|
|
1220
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p = {}, E = {}, S) { this.id = e, this.emailAddress = r, this.role = s, this.roleName = n, this.organizationId = i, this.createdAt = o, this.updatedAt = a, this.expiresAt = c, this.url = d, this.status = f, this.publicMetadata = p, this.privateMetadata = E, this.publicOrganizationData = S, this._raw = null; }
|
|
1221
|
+
get raw() { return this._raw; }
|
|
1222
|
+
static fromJSON(e) { let r = new un(e.id, e.email_address, e.role, e.role_name, e.organization_id, e.created_at, e.updated_at, e.expires_at, e.url, e.status, e.public_metadata, e.private_metadata, e.public_organization_data); return r._raw = e, r; }
|
|
1223
|
+
}, za = class ln {
|
|
1224
|
+
constructor(e, r, s, n = {}, i = {}, o, a, c, d) { this.id = e, this.role = r, this.permissions = s, this.publicMetadata = n, this.privateMetadata = i, this.createdAt = o, this.updatedAt = a, this.organization = c, this.publicUserData = d, this._raw = null; }
|
|
1225
|
+
get raw() { return this._raw; }
|
|
1226
|
+
static fromJSON(e) { let r = new ln(e.id, e.role, e.permissions, e.public_metadata, e.private_metadata, e.created_at, e.updated_at, an.fromJSON(e.organization), Wa.fromJSON(e.public_user_data)); return r._raw = e, r; }
|
|
1227
|
+
}, Wa = class hn {
|
|
1228
|
+
constructor(e, r, s, n, i, o) { this.identifier = e, this.firstName = r, this.lastName = s, this.imageUrl = n, this.hasImage = i, this.userId = o; }
|
|
1229
|
+
static fromJSON(e) { return new hn(e.identifier, e.first_name, e.last_name, e.image_url, e.has_image, e.user_id); }
|
|
1230
|
+
}, Ba = class dn {
|
|
1231
|
+
constructor(e, r, s, n, i, o, a, c, d, f) { this.enabled = e, this.maxAllowedMemberships = r, this.maxAllowedRoles = s, this.maxAllowedPermissions = n, this.creatorRole = i, this.adminDeleteEnabled = o, this.domainsEnabled = a, this.slugDisabled = c, this.domainsEnrollmentModes = d, this.domainsDefaultRole = f; }
|
|
1232
|
+
static fromJSON(e) { return new dn(e.enabled, e.max_allowed_memberships, e.max_allowed_roles, e.max_allowed_permissions, e.creator_role, e.admin_delete_enabled, e.domains_enabled, e.slug_disabled, e.domains_enrollment_modes, e.domains_default_role); }
|
|
1233
|
+
}, fn = class pn {
|
|
1234
|
+
constructor(e, r, s, n, i, o) { this.id = e, this.name = r, this.key = s, this.description = n, this.createdAt = i, this.updatedAt = o; }
|
|
1235
|
+
static fromJSON(e) { return new pn(e.id, e.name, e.key, e.description, e.created_at, e.updated_at); }
|
|
1236
|
+
}, mn = class yn {
|
|
1237
|
+
constructor(e, r, s, n, i, o) { this.id = e, this.phoneNumber = r, this.reservedForSecondFactor = s, this.defaultSecondFactor = n, this.verification = i, this.linkedTo = o; }
|
|
1238
|
+
static fromJSON(e) { return new yn(e.id, e.phone_number, e.reserved_for_second_factor, e.default_second_factor, e.verification && be.fromJSON(e.verification), e.linked_to.map(r => xs.fromJSON(r))); }
|
|
1239
|
+
}, ja = class gn {
|
|
1240
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.domainId = r, this.lastRunAt = s, this.proxyUrl = n, this.successful = i, this.createdAt = o, this.updatedAt = a; }
|
|
1241
|
+
static fromJSON(e) { return new gn(e.id, e.domain_id, e.last_run_at, e.proxy_url, e.successful, e.created_at, e.updated_at); }
|
|
1242
|
+
}, Va = class kn {
|
|
1243
|
+
constructor(e, r, s, n) { this.id = e, this.url = r, this.createdAt = s, this.updatedAt = n; }
|
|
1244
|
+
static fromJSON(e) { return new kn(e.id, e.url, e.created_at, e.updated_at); }
|
|
1245
|
+
}, $a = class _n {
|
|
1246
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.key = s, this.description = n, this.permissions = i, this.isCreatorEligible = o, this.createdAt = a, this.updatedAt = c; }
|
|
1247
|
+
static fromJSON(e) { return new _n(e.id, e.name, e.key, e.description, (e.permissions ?? []).map(r => fn.fromJSON(r)), e.is_creator_eligible, e.created_at, e.updated_at); }
|
|
1248
|
+
}, mt = class vn {
|
|
1249
|
+
constructor(e, r, s, n, i, o, a, c) { this.id = e, this.name = r, this.key = s, this.description = n, this.createdAt = i, this.updatedAt = o, this.membersCount = a, this.hasMembers = c; }
|
|
1250
|
+
static fromJSON(e) { return new vn(e.id, e.name, e.key, e.description, e.created_at, e.updated_at, e.members_count, e.has_members); }
|
|
1251
|
+
}, Ga = class Sn {
|
|
1252
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S) { this.id = e, this.organizationId = r, this.instanceId = s, this.sourceRoleSetId = n, this.destRoleSetId = i, this.triggerType = o, this.status = a, this.migratedMembers = c, this.mappings = d, this.createdAt = f, this.updatedAt = p, this.startedAt = E, this.completedAt = S; }
|
|
1253
|
+
static fromJSON(e) { return new Sn(e.id, e.organization_id, e.instance_id, e.source_role_set_id, e.dest_role_set_id, e.trigger_type, e.status, e.migrated_members, e.mappings, e.created_at, e.updated_at, e.started_at, e.completed_at); }
|
|
1254
|
+
}, Qa = class Tn {
|
|
1255
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p) { this.id = e, this.name = r, this.key = s, this.description = n, this.roles = i, this.defaultRole = o, this.creatorRole = a, this.type = c, this.roleSetMigration = d, this.createdAt = f, this.updatedAt = p; }
|
|
1256
|
+
static fromJSON(e) { return new Tn(e.id, e.name, e.key, e.description, (e.roles ?? []).map(r => mt.fromJSON(r)), e.default_role ? mt.fromJSON(e.default_role) : null, e.creator_role ? mt.fromJSON(e.creator_role) : null, e.type, e.role_set_migration ? Ga.fromJSON(e.role_set_migration) : null, e.created_at, e.updated_at); }
|
|
1257
|
+
}, Ya = class bn {
|
|
1258
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h, g, k, T) { this.id = e, this.name = r, this.domain = s, this.organizationId = n, this.idpEntityId = i, this.idpSsoUrl = o, this.idpCertificate = a, this.idpCertificateIssuedAt = c, this.idpCertificateExpiresAt = d, this.idpMetadataUrl = f, this.idpMetadata = p, this.acsUrl = E, this.spEntityId = S, this.spMetadataUrl = A, this.active = P, this.provider = x, this.userCount = l, this.syncUserAttributes = y, this.allowSubdomains = m, this.allowIdpInitiated = h, this.createdAt = g, this.updatedAt = k, this.attributeMapping = T; }
|
|
1259
|
+
static fromJSON(e) { return new bn(e.id, e.name, e.domain, e.organization_id, e.idp_entity_id, e.idp_sso_url, e.idp_certificate, e.idp_certificate_issued_at, e.idp_certificate_expires_at, e.idp_metadata_url, e.idp_metadata, e.acs_url, e.sp_entity_id, e.sp_metadata_url, e.active, e.provider, e.user_count, e.sync_user_attributes, e.allow_subdomains, e.allow_idp_initiated, e.created_at, e.updated_at, e.attribute_mapping && Xa.fromJSON(e.attribute_mapping)); }
|
|
1260
|
+
}, Xa = class En {
|
|
1261
|
+
constructor(e, r, s, n) { this.userId = e, this.emailAddress = r, this.firstName = s, this.lastName = n; }
|
|
1262
|
+
static fromJSON(e) { return new En(e.user_id, e.email_address, e.first_name, e.last_name); }
|
|
1263
|
+
}, Za = class wn {
|
|
1264
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.userId = r, this.token = s, this.status = n, this.url = i, this.createdAt = o, this.updatedAt = a; }
|
|
1265
|
+
static fromJSON(e) { return new wn(e.id, e.user_id, e.token, e.status, e.url, e.created_at, e.updated_at); }
|
|
1266
|
+
}, yt = class An {
|
|
1267
|
+
constructor(e, r) { this.nextAction = e, this.supportedStrategies = r; }
|
|
1268
|
+
static fromJSON(e) { return new An(e.next_action, e.supported_strategies); }
|
|
1269
|
+
}, ec = class Pn {
|
|
1270
|
+
constructor(e, r, s, n) { this.emailAddress = e, this.phoneNumber = r, this.web3Wallet = s, this.externalAccount = n; }
|
|
1271
|
+
static fromJSON(e) { return new Pn(e.email_address && yt.fromJSON(e.email_address), e.phone_number && yt.fromJSON(e.phone_number), e.web3_wallet && yt.fromJSON(e.web3_wallet), e.external_account); }
|
|
1272
|
+
}, tc = class In {
|
|
1273
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h, g, k) { this.id = e, this.status = r, this.requiredFields = s, this.optionalFields = n, this.missingFields = i, this.unverifiedFields = o, this.verifications = a, this.username = c, this.emailAddress = d, this.phoneNumber = f, this.web3Wallet = p, this.passwordEnabled = E, this.firstName = S, this.lastName = A, this.customAction = P, this.externalId = x, this.createdSessionId = l, this.createdUserId = y, this.abandonAt = m, this.legalAcceptedAt = h, this.publicMetadata = g, this.unsafeMetadata = k; }
|
|
1274
|
+
static fromJSON(e) { return new In(e.id, e.status, e.required_fields, e.optional_fields, e.missing_fields, e.unverified_fields, e.verifications ? ec.fromJSON(e.verifications) : null, e.username, e.email_address, e.phone_number, e.web3_wallet, e.password_enabled, e.first_name, e.last_name, e.custom_action, e.external_id, e.created_session_id, e.created_user_id, e.abandon_at, e.legal_accepted_at, e.public_metadata, e.unsafe_metadata); }
|
|
1275
|
+
}, rc = class On {
|
|
1276
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.fromPhoneNumber = r, this.toPhoneNumber = s, this.message = n, this.status = i, this.phoneNumberId = o, this.data = a; }
|
|
1277
|
+
static fromJSON(e) { return new On(e.id, e.from_phone_number, e.to_phone_number, e.message, e.status, e.phone_number_id, e.data); }
|
|
1278
|
+
}, sc = class Cn {
|
|
1279
|
+
constructor(e) { this.jwt = e; }
|
|
1280
|
+
static fromJSON(e) { return new Cn(e.jwt); }
|
|
1281
|
+
}, nc = class xn {
|
|
1282
|
+
constructor(e, r, s) { this.id = e, this.web3Wallet = r, this.verification = s; }
|
|
1283
|
+
static fromJSON(e) { return new xn(e.id, e.web3_wallet, e.verification && be.fromJSON(e.verification)); }
|
|
1284
|
+
}, ic = class Un {
|
|
1285
|
+
constructor(e, r, s, n, i, o, a, c, d, f, p, E, S, A, P, x, l, y, m, h = {}, g = {}, k = {}, T = [], _ = [], O = [], q = [], z = [], D, J, H = null, V, Dt, Ee) { this.id = e, this.passwordEnabled = r, this.totpEnabled = s, this.backupCodeEnabled = n, this.twoFactorEnabled = i, this.banned = o, this.locked = a, this.createdAt = c, this.updatedAt = d, this.imageUrl = f, this.hasImage = p, this.primaryEmailAddressId = E, this.primaryPhoneNumberId = S, this.primaryWeb3WalletId = A, this.lastSignInAt = P, this.externalId = x, this.username = l, this.firstName = y, this.lastName = m, this.publicMetadata = h, this.privateMetadata = g, this.unsafeMetadata = k, this.emailAddresses = T, this.phoneNumbers = _, this.web3Wallets = O, this.externalAccounts = q, this.enterpriseAccounts = z, this.lastActiveAt = D, this.createOrganizationEnabled = J, this.createOrganizationsLimit = H, this.deleteSelfEnabled = V, this.legalAcceptedAt = Dt, this.locale = Ee, this._raw = null; }
|
|
1286
|
+
get raw() { return this._raw; }
|
|
1287
|
+
static fromJSON(e) { let r = new Un(e.id, e.password_enabled, e.totp_enabled, e.backup_code_enabled, e.two_factor_enabled, e.banned, e.locked, e.created_at, e.updated_at, e.image_url, e.has_image, e.primary_email_address_id, e.primary_phone_number_id, e.primary_web3_wallet_id, e.last_sign_in_at, e.external_id, e.username, e.first_name, e.last_name, e.public_metadata, e.private_metadata, e.unsafe_metadata, (e.email_addresses || []).map(s => qs.fromJSON(s)), (e.phone_numbers || []).map(s => mn.fromJSON(s)), (e.web3_wallets || []).map(s => nc.fromJSON(s)), (e.external_accounts || []).map(s => Ua.fromJSON(s)), (e.enterprise_accounts || []).map(s => Ws.fromJSON(s)), e.last_active_at, e.create_organization_enabled, e.create_organizations_limit, e.delete_self_enabled, e.legal_accepted_at, e.locale); return r._raw = e, r; }
|
|
1288
|
+
get primaryEmailAddress() { return this.emailAddresses.find(({ id: e }) => e === this.primaryEmailAddressId) ?? null; }
|
|
1289
|
+
get primaryPhoneNumber() { return this.phoneNumbers.find(({ id: e }) => e === this.primaryPhoneNumberId) ?? null; }
|
|
1290
|
+
get primaryWeb3Wallet() { return this.web3Wallets.find(({ id: e }) => e === this.primaryWeb3WalletId) ?? null; }
|
|
1291
|
+
get fullName() { return [this.firstName, this.lastName].join(" ").trim() || null; }
|
|
1292
|
+
}, oc = class Rn {
|
|
1293
|
+
constructor(e, r, s, n, i, o, a) { this.id = e, this.emailAddress = r, this.status = s, this.invitation = n, this.createdAt = i, this.updatedAt = o, this.isLocked = a; }
|
|
1294
|
+
static fromJSON(e) { return new Rn(e.id, e.email_address, e.status, e.invitation && Zs.fromJSON(e.invitation), e.created_at, e.updated_at, e.is_locked); }
|
|
1295
|
+
};
|
|
1296
|
+
function ac(t) { let e, r; return Array.isArray(t) ? { data: t.map(n => Ne(n)) } : uc(t) ? (e = t.m2m_tokens.map(s => Ne(s)), r = t.total_count, { data: e, totalCount: r }) : cc(t) ? (e = t.data.map(s => Ne(s)), r = t.total_count, { data: e, totalCount: r }) : { data: Ne(t) }; }
|
|
1297
|
+
function cc(t) { return !t || typeof t != "object" || !("data" in t) ? !1 : Array.isArray(t.data) && t.data !== void 0; }
|
|
1298
|
+
function uc(t) { return !t || typeof t != "object" || !("m2m_tokens" in t) ? !1 : Array.isArray(t.m2m_tokens); }
|
|
1299
|
+
function lc(t) { return t.total_count; }
|
|
1300
|
+
function Ne(t) { if (typeof t != "string" && "object" in t && "deleted" in t)
|
|
1301
|
+
return Ea.fromJSON(t); switch (t.object) {
|
|
1302
|
+
case w.AccountlessApplication: return pa.fromJSON(t);
|
|
1303
|
+
case w.ActorToken: return ya.fromJSON(t);
|
|
1304
|
+
case w.AllowlistIdentifier: return ga.fromJSON(t);
|
|
1305
|
+
case w.ApiKey: return ka.fromJSON(t);
|
|
1306
|
+
case w.BlocklistIdentifier: return _a.fromJSON(t);
|
|
1307
|
+
case w.Client: return Sa.fromJSON(t);
|
|
1308
|
+
case w.Cookies: return ba.fromJSON(t);
|
|
1309
|
+
case w.Domain: return wa.fromJSON(t);
|
|
1310
|
+
case w.EmailAddress: return qs.fromJSON(t);
|
|
1311
|
+
case w.EnterpriseAccount: return Ws.fromJSON(t);
|
|
1312
|
+
case w.Email: return Aa.fromJSON(t);
|
|
1313
|
+
case w.IdpOAuthAccessToken: return is.fromJSON(t);
|
|
1314
|
+
case w.Instance: return Ra.fromJSON(t);
|
|
1315
|
+
case w.InstanceRestrictions: return qa.fromJSON(t);
|
|
1316
|
+
case w.InstanceSettings: return Ma.fromJSON(t);
|
|
1317
|
+
case w.Invitation: return Zs.fromJSON(t);
|
|
1318
|
+
case w.JwtTemplate: return Na.fromJSON(t);
|
|
1319
|
+
case w.Machine: return Ja.fromJSON(t);
|
|
1320
|
+
case w.MachineScope: return La.fromJSON(t);
|
|
1321
|
+
case w.MachineSecretKey: return Da.fromJSON(t);
|
|
1322
|
+
case w.M2MToken: return os.fromJSON(t);
|
|
1323
|
+
case w.OauthAccessToken: return Fa.fromJSON(t);
|
|
1324
|
+
case w.OAuthApplication: return Ka.fromJSON(t);
|
|
1325
|
+
case w.Organization: return an.fromJSON(t);
|
|
1326
|
+
case w.OrganizationInvitation: return Ha.fromJSON(t);
|
|
1327
|
+
case w.OrganizationMembership: return za.fromJSON(t);
|
|
1328
|
+
case w.OrganizationSettings: return Ba.fromJSON(t);
|
|
1329
|
+
case w.Permission: return fn.fromJSON(t);
|
|
1330
|
+
case w.PhoneNumber: return mn.fromJSON(t);
|
|
1331
|
+
case w.ProxyCheck: return ja.fromJSON(t);
|
|
1332
|
+
case w.RedirectUrl: return Va.fromJSON(t);
|
|
1333
|
+
case w.Role: return $a.fromJSON(t);
|
|
1334
|
+
case w.RoleSet: return Qa.fromJSON(t);
|
|
1335
|
+
case w.EnterpriseConnection: return xa.fromJSON(t);
|
|
1336
|
+
case w.SamlConnection: return Ya.fromJSON(t);
|
|
1337
|
+
case w.SignInToken: return Za.fromJSON(t);
|
|
1338
|
+
case w.AgentTask: return ma.fromJSON(t);
|
|
1339
|
+
case w.SignUpAttempt: return tc.fromJSON(t);
|
|
1340
|
+
case w.Session: return bs.fromJSON(t);
|
|
1341
|
+
case w.SmsMessage: return rc.fromJSON(t);
|
|
1342
|
+
case w.Token: return sc.fromJSON(t);
|
|
1343
|
+
case w.TotalCount: return lc(t);
|
|
1344
|
+
case w.User: return ic.fromJSON(t);
|
|
1345
|
+
case w.WaitlistEntry: return oc.fromJSON(t);
|
|
1346
|
+
case w.BillingPlan: return Ls.fromJSON(t);
|
|
1347
|
+
case w.BillingSubscription: return Pa.fromJSON(t);
|
|
1348
|
+
case w.BillingSubscriptionItem: return Fs.fromJSON(t);
|
|
1349
|
+
case w.Feature: return Ns.fromJSON(t);
|
|
1350
|
+
default: return t;
|
|
1351
|
+
} }
|
|
1352
|
+
function ve(t) { return hc(async (r) => { let { secretKey: s, machineSecretKey: n, useMachineSecretKey: i = !1, requireSecretKey: o = !0, apiUrl: a = ts, apiVersion: c = rs, userAgent: d = ss, skipApiVersionInUrl: f = !1 } = t, { path: p, method: E, queryParams: S, headerParams: A, bodyParams: P, formData: x, options: l } = r, { deepSnakecaseBodyParamKeys: y = !1 } = l || {}; o && ns(s); let m = f ? u(a, p) : u(a, c, p), h = new URL(m); if (S) {
|
|
1353
|
+
let _ = Qr({ ...S });
|
|
1354
|
+
for (let [O, q] of Object.entries(_))
|
|
1355
|
+
q && [q].flat().forEach(z => h.searchParams.append(O, z));
|
|
1356
|
+
} let g = new Headers({ "Clerk-API-Version": Pt, [v.Headers.UserAgent]: d, ...A }), k = v.Headers.Authorization; g.has(k) || (i && n ? g.set(k, `Bearer ${n}`) : s && g.set(k, `Bearer ${s}`)); let T; try {
|
|
1357
|
+
if (x)
|
|
1358
|
+
T = await t.fetch(h.href, { method: E, headers: g, body: x });
|
|
1359
|
+
else {
|
|
1360
|
+
g.set("Content-Type", "application/json");
|
|
1361
|
+
let q = () => { if (!(E !== "GET" && P && Object.keys(P).length > 0))
|
|
1362
|
+
return null; let D = J => Qr(J, { deep: y }); return { body: JSON.stringify(Array.isArray(P) ? P.map(D) : D(P)) }; };
|
|
1363
|
+
T = await t.fetch(h.href, { method: E, headers: g, ...q() });
|
|
1364
|
+
}
|
|
1365
|
+
if (T.status === 204)
|
|
1366
|
+
return { data: void 0, errors: null };
|
|
1367
|
+
let O = await (T?.headers && T.headers?.get(v.Headers.ContentType) === v.ContentTypes.Json ? T.json() : T.text());
|
|
1368
|
+
return T.ok ? { ...ac(O), errors: null } : { data: null, errors: Xr(O), status: T?.status, statusText: T?.statusText, clerkTraceId: gt(O, T?.headers), retryAfter: Yr(T?.headers) };
|
|
1369
|
+
}
|
|
1370
|
+
catch (_) {
|
|
1371
|
+
return _ instanceof Error ? { data: null, errors: [{ code: "unexpected_error", message: _.message || "Unexpected error" }], clerkTraceId: gt(_, T?.headers) } : { data: null, errors: Xr(_), status: T?.status, statusText: T?.statusText, clerkTraceId: gt(_, T?.headers), retryAfter: Yr(T?.headers) };
|
|
1372
|
+
} }); }
|
|
1373
|
+
function gt(t, e) { return t && typeof t == "object" && "clerk_trace_id" in t && typeof t.clerk_trace_id == "string" ? t.clerk_trace_id : e?.get("cf-ray") || ""; }
|
|
1374
|
+
function Yr(t) { let e = t?.get("Retry-After"); if (!e)
|
|
1375
|
+
return; let r = parseInt(e, 10); if (!isNaN(r))
|
|
1376
|
+
return r; }
|
|
1377
|
+
function Xr(t) { if (t && typeof t == "object" && "errors" in t) {
|
|
1378
|
+
let e = t.errors;
|
|
1379
|
+
return e.length > 0 ? e.map(Qe) : [];
|
|
1380
|
+
} return []; }
|
|
1381
|
+
function hc(t) { return async (...e) => { let { data: r, errors: s, totalCount: n, status: i, statusText: o, clerkTraceId: a, retryAfter: c } = await t(...e); if (s) {
|
|
1382
|
+
let d = new pe(o || "", { data: [], status: i, clerkTraceId: a, retryAfter: c });
|
|
1383
|
+
throw d.errors = s, d;
|
|
1384
|
+
} return typeof n < "u" ? { data: r, totalCount: n } : r; }; }
|
|
1385
|
+
function he(t) { let e = ve(t); return { __experimental_accountlessApplications: new to(ve({ ...t, requireSecretKey: !1 })), actorTokens: new Zi(e), agentTasks: new eo(e), allowlistIdentifiers: new ro(e), apiKeys: new so(ve({ ...t, skipApiVersionInUrl: !0 })), betaFeatures: new io(e), blocklistIdentifiers: new oo(e), billing: new sa(e), clients: new ao(e), domains: new co(e), emailAddresses: new uo(e), emails: new ho(e), enterpriseConnections: new fo(e), idPOAuthAccessToken: new mo(ve({ ...t, skipApiVersionInUrl: !0 })), instance: new yo(e), invitations: new go(e), jwks: new Mo(e), jwtTemplates: new No(e), machines: new ko(e), m2m: new Ro(ve({ ...t, skipApiVersionInUrl: !0, requireSecretKey: !1, useMachineSecretKey: !0 }), { secretKey: t.secretKey, apiUrl: t.apiUrl, jwtKey: t.jwtKey, fetch: t.fetch }), oauthApplications: new Fo(e), organizations: new Jo(e), organizationPermissions: new Lo(e), organizationRoles: new Do(e), phoneNumbers: new Ko(e), proxyChecks: new zo(e), redirectUrls: new Wo(e), roleSets: new Bo(e), sessions: new Vo(e), signInTokens: new $o(e), signUps: new Go(e), testingTokens: new Yo(e), users: new Xo(e), waitlistEntries: new Zo(e), webhooks: new ea(e), samlConnections: new jo(e) }; }
|
|
1386
|
+
var ze = t => () => { let e = { ...t }; return e.secretKey = (e.secretKey || "").substring(0, 7), e.jwtKey = (e.jwtKey || "").substring(0, 7), e.sessionToken = (e.sessionToken || "").substring(0, 7), e.tokenInHeader = (e.tokenInHeader || "").substring(0, 7), e.sessionTokenInCookie = (e.sessionTokenInCookie || "").substring(0, 7), e.refreshTokenInCookie = (e.refreshTokenInCookie || "").substring(0, 7), e.devBrowserToken = (e.devBrowserToken || "").substring(0, 7), e.handshakeToken = (e.handshakeToken || "").substring(0, 7), { ...e }; };
|
|
1387
|
+
function dc(t, e, r) { let { actor: s, sessionId: n, sessionStatus: i, userId: o, orgId: a, orgRole: c, orgSlug: d, orgPermissions: f, factorVerificationAge: p } = Cr(r), E = he(t), S = yc({ sessionId: n, sessionToken: e, fetcher: async (A, P, x) => (await E.sessions.getToken(A, P || "", x)).jwt }); return { tokenType: b.SessionToken, actor: s, sessionClaims: r, sessionId: n, sessionStatus: i, userId: o, orgId: a, orgRole: c, orgSlug: d, orgPermissions: f, factorVerificationAge: p, getToken: S, has: Or({ orgId: a, orgRole: c, orgPermissions: f, userId: o, factorVerificationAge: p, features: r.fea || "", plans: r.pla || "" }), debug: ze({ ...t, sessionToken: e }), isAuthenticated: !0 }; }
|
|
1388
|
+
function qn(t, e) { return { tokenType: b.SessionToken, sessionClaims: null, sessionId: null, sessionStatus: e ?? null, userId: null, actor: null, orgId: null, orgRole: null, orgSlug: null, orgPermissions: null, factorVerificationAge: null, getToken: () => Promise.resolve(null), has: () => !1, debug: ze(t), isAuthenticated: !1 }; }
|
|
1389
|
+
function fc(t, e, r, s) { let n = { id: r.id, subject: r.subject, getToken: () => Promise.resolve(e), has: () => !1, debug: ze(s), isAuthenticated: !0 }; switch (t) {
|
|
1390
|
+
case b.ApiKey: {
|
|
1391
|
+
let i = r;
|
|
1392
|
+
return { ...n, tokenType: t, 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 };
|
|
1393
|
+
}
|
|
1394
|
+
case b.M2MToken: {
|
|
1395
|
+
let i = r;
|
|
1396
|
+
return { ...n, tokenType: t, claims: i.claims, scopes: i.scopes, machineId: i.subject };
|
|
1397
|
+
}
|
|
1398
|
+
case b.OAuthToken: {
|
|
1399
|
+
let i = r;
|
|
1400
|
+
return { ...n, tokenType: t, scopes: i.scopes, userId: i.subject, clientId: i.clientId };
|
|
1401
|
+
}
|
|
1402
|
+
default: throw new Error(`Invalid token type: ${t}`);
|
|
1403
|
+
} }
|
|
1404
|
+
function pc(t, e) { let r = { id: null, subject: null, scopes: null, has: () => !1, getToken: () => Promise.resolve(null), debug: ze(e), isAuthenticated: !1 }; switch (t) {
|
|
1405
|
+
case b.ApiKey: return { ...r, tokenType: t, name: null, claims: null, scopes: null, userId: null, orgId: null };
|
|
1406
|
+
case b.M2MToken: return { ...r, tokenType: t, claims: null, scopes: null, machineId: null };
|
|
1407
|
+
case b.OAuthToken: return { ...r, tokenType: t, scopes: null, userId: null, clientId: null };
|
|
1408
|
+
default: throw new Error(`Invalid token type: ${t}`);
|
|
1409
|
+
} }
|
|
1410
|
+
function mc() { return { isAuthenticated: !1, tokenType: null, getToken: () => Promise.resolve(null), has: () => !1, debug: () => ({}) }; }
|
|
1411
|
+
var yc = t => { let { fetcher: e, sessionToken: r, sessionId: s } = t || {}; return async (n = {}) => s ? n.template || n.expiresInSeconds !== void 0 ? e(s, n.template, n.expiresInSeconds) : r : null; };
|
|
1412
|
+
var Te = { SignedIn: "signed-in", SignedOut: "signed-out", Handshake: "handshake" }, M = { 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" };
|
|
1413
|
+
function X(t) { let { authenticateContext: e, headers: r = new Headers, token: s } = t, n = (({ treatPendingAsSignedOut: i = !0 } = {}) => { if (t.tokenType === b.SessionToken) {
|
|
1414
|
+
let { sessionClaims: a } = t, c = dc(e, s, a);
|
|
1415
|
+
return i && c.sessionStatus === "pending" ? qn(void 0, c.sessionStatus) : c;
|
|
1416
|
+
} let { machineData: o } = t; return fc(t.tokenType, s, o, e); }); return { status: Te.SignedIn, reason: null, message: null, proxyUrl: e.proxyUrl || "", publishableKey: e.publishableKey || "", isSatellite: e.isSatellite || !1, domain: e.domain || "", signInUrl: e.signInUrl || "", signUpUrl: e.signUpUrl || "", afterSignInUrl: e.afterSignInUrl || "", afterSignUpUrl: e.afterSignUpUrl || "", isSignedIn: !0, isAuthenticated: !0, tokenType: t.tokenType, toAuth: n, headers: r, token: s }; }
|
|
1417
|
+
function F(t) { let { authenticateContext: e, headers: r = new Headers, reason: s, message: n = "", tokenType: i } = t, o = (() => i === b.SessionToken ? qn({ ...e, status: Te.SignedOut, reason: s, message: n }) : pc(i, { reason: s, message: n, headers: r })); return Mt({ status: Te.SignedOut, reason: s, message: n, proxyUrl: e.proxyUrl || "", publishableKey: e.publishableKey || "", isSatellite: e.isSatellite || !1, domain: e.domain || "", signInUrl: e.signInUrl || "", signUpUrl: e.signUpUrl || "", afterSignInUrl: e.afterSignInUrl || "", afterSignUpUrl: e.afterSignUpUrl || "", isSignedIn: !1, isAuthenticated: !1, tokenType: i, toAuth: o, headers: r, token: null }); }
|
|
1418
|
+
function gc(t, e, r = "", s) { return Mt({ status: Te.Handshake, reason: e, message: r, publishableKey: t.publishableKey || "", isSatellite: t.isSatellite || !1, domain: t.domain || "", proxyUrl: t.proxyUrl || "", signInUrl: t.signInUrl || "", signUpUrl: t.signUpUrl || "", afterSignInUrl: t.afterSignInUrl || "", afterSignUpUrl: t.afterSignUpUrl || "", isSignedIn: !1, isAuthenticated: !1, tokenType: b.SessionToken, toAuth: () => null, headers: s, token: null }); }
|
|
1419
|
+
function kc() { let t = mc(); return Mt({ status: Te.SignedOut, reason: M.TokenTypeMismatch, message: "", proxyUrl: "", publishableKey: "", isSatellite: !1, domain: "", signInUrl: "", signUpUrl: "", afterSignInUrl: "", afterSignUpUrl: "", isSignedIn: !1, isAuthenticated: !1, tokenType: null, toAuth: () => t, headers: new Headers, token: null }); }
|
|
1420
|
+
var Mt = t => { let e = new Headers(t.headers || {}); if (t.message)
|
|
1421
|
+
try {
|
|
1422
|
+
e.set(v.Headers.AuthMessage, t.message);
|
|
1423
|
+
}
|
|
1424
|
+
catch { } if (t.reason)
|
|
1425
|
+
try {
|
|
1426
|
+
e.set(v.Headers.AuthReason, t.reason);
|
|
1427
|
+
}
|
|
1428
|
+
catch { } if (t.status)
|
|
1429
|
+
try {
|
|
1430
|
+
e.set(v.Headers.AuthStatus, t.status);
|
|
1431
|
+
}
|
|
1432
|
+
catch { } return t.headers = e, t; }, _c = kr(Ki()), vc = class extends URL {
|
|
1433
|
+
isCrossOrigin(t) { return this.origin !== new URL(t.toString()).origin; }
|
|
1434
|
+
}, kt = (...t) => new vc(...t), Sc = class extends Request {
|
|
1435
|
+
constructor(t, e) { let r = typeof t != "string" && "url" in t ? t.url : String(t), s; e ? s = e : typeof t != "string" && (s = new Proxy(t, { get(n, i) { if (!(i === "signal" || i === "body"))
|
|
1436
|
+
return Reflect.get(n, i, n); } })), super(r, s), this.clerkUrl = this.deriveUrlFromHeaders(this), this.cookies = this.parseCookies(this); }
|
|
1437
|
+
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)) }; }
|
|
1438
|
+
deriveUrlFromHeaders(t) { let e = new URL(t.url), r = t.headers.get(v.Headers.ForwardedProto), s = t.headers.get(v.Headers.ForwardedHost), n = t.headers.get(v.Headers.Host), i = e.protocol, o = this.getFirstValueFromHeader(s) ?? n, a = this.getFirstValueFromHeader(r) ?? i?.replace(/[:/]/, ""), c = o && a ? `${a}://${o}` : e.origin; if (c === e.origin)
|
|
1439
|
+
return kt(e); try {
|
|
1440
|
+
return kt(e.pathname + e.search, c);
|
|
1441
|
+
}
|
|
1442
|
+
catch {
|
|
1443
|
+
return kt(e);
|
|
1444
|
+
} }
|
|
1445
|
+
getFirstValueFromHeader(t) { return t?.split(",")[0]; }
|
|
1446
|
+
parseCookies(t) { let e = (0, _c.parse)(this.decodeCookieValue(t.headers.get("cookie") || "")); return new Map(Object.entries(e)); }
|
|
1447
|
+
decodeCookieValue(t) { return t && t.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); }
|
|
1448
|
+
}, Tc = (...t) => t[0] && typeof t[0] == "object" && "clerkUrl" in t[0] && "cookies" in t[0] ? t[0] : new Sc(...t), Mn = t => t.split(";")[0]?.split("=")[0], Nn = t => t.split(";")[0]?.split("=")[1];
|
|
1449
|
+
async function Z(t, e) { let { data: r, errors: s } = K(t); if (s)
|
|
1450
|
+
return { errors: s }; let { header: n } = r, { kid: i } = n; if (n.cat === us)
|
|
1451
|
+
return { errors: [new U({ action: L.EnsureClerkJWT, reason: I.TokenInvalid, message: "Invalid session token category." })] }; try {
|
|
1452
|
+
let o;
|
|
1453
|
+
if (e.jwtKey)
|
|
1454
|
+
o = It({ kid: i, pem: e.jwtKey });
|
|
1455
|
+
else if (e.secretKey)
|
|
1456
|
+
o = await Ot({ ...e, kid: i });
|
|
1457
|
+
else
|
|
1458
|
+
return { errors: [new U({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during verification.", reason: I.JWKFailedToResolve })] };
|
|
1459
|
+
return await it(t, { ...e, key: o });
|
|
1460
|
+
}
|
|
1461
|
+
catch (o) {
|
|
1462
|
+
return { errors: [o] };
|
|
1463
|
+
} }
|
|
1464
|
+
function Nt(t, e, r) { if (Pe(e)) {
|
|
1465
|
+
let s, n;
|
|
1466
|
+
switch (e.status) {
|
|
1467
|
+
case 401:
|
|
1468
|
+
s = W.InvalidSecretKey, n = e.errors[0]?.message || "Invalid secret key";
|
|
1469
|
+
break;
|
|
1470
|
+
case 404:
|
|
1471
|
+
s = W.TokenInvalid, n = r;
|
|
1472
|
+
break;
|
|
1473
|
+
default: s = W.UnexpectedError, n = "Unexpected error";
|
|
1474
|
+
}
|
|
1475
|
+
return { data: void 0, tokenType: t, errors: [new B({ message: n, code: s, status: e.status })] };
|
|
1476
|
+
} return { data: void 0, tokenType: t, errors: [new B({ message: "Unexpected error", code: W.UnexpectedError, status: e.status })] }; }
|
|
1477
|
+
async function bc(t, e) { try {
|
|
1478
|
+
return { data: await he(e).m2m.verify({ token: t }), tokenType: b.M2MToken, errors: void 0 };
|
|
1479
|
+
}
|
|
1480
|
+
catch (r) {
|
|
1481
|
+
return Nt(b.M2MToken, r, "Machine token not found");
|
|
1482
|
+
} }
|
|
1483
|
+
async function Ec(t, e) { try {
|
|
1484
|
+
return { data: await he(e).idPOAuthAccessToken.verify(t), tokenType: b.OAuthToken, errors: void 0 };
|
|
1485
|
+
}
|
|
1486
|
+
catch (r) {
|
|
1487
|
+
return Nt(b.OAuthToken, r, "OAuth token not found");
|
|
1488
|
+
} }
|
|
1489
|
+
async function wc(t, e) { try {
|
|
1490
|
+
return { data: await he(e).apiKeys.verify(t), tokenType: b.ApiKey, errors: void 0 };
|
|
1491
|
+
}
|
|
1492
|
+
catch (r) {
|
|
1493
|
+
return Nt(b.ApiKey, r, "API key not found");
|
|
1494
|
+
} }
|
|
1495
|
+
async function Zr(t, e) { if (Rt(t)) {
|
|
1496
|
+
let r;
|
|
1497
|
+
try {
|
|
1498
|
+
let { data: s, errors: n } = K(t);
|
|
1499
|
+
if (n)
|
|
1500
|
+
throw n[0];
|
|
1501
|
+
r = s;
|
|
1502
|
+
}
|
|
1503
|
+
catch (s) {
|
|
1504
|
+
return { data: void 0, tokenType: b.M2MToken, errors: [new B({ code: W.TokenInvalid, message: s.message })] };
|
|
1505
|
+
}
|
|
1506
|
+
return typeof r.payload.sub == "string" && r.payload.sub.startsWith(cs) ? ds(t, r, e) : De.includes(r.header.typ) ? Uo(t, r, e) : { data: void 0, tokenType: b.OAuthToken, errors: [new B({ code: W.TokenVerificationFailed, message: `Invalid JWT type: ${r.header.typ ?? "missing"}. Expected one of: ${De.join(", ")} for OAuth, or sub starting with 'mch_' for M2M` })] };
|
|
1507
|
+
} if (t.startsWith(Ct))
|
|
1508
|
+
return bc(t, e); if (t.startsWith(xt))
|
|
1509
|
+
return Ec(t, e); if (t.startsWith(Ut))
|
|
1510
|
+
return wc(t, e); throw new Error("Unknown machine token type"); }
|
|
1511
|
+
async function Ac(t, { key: e }) { let { data: r, errors: s } = K(t); if (s)
|
|
1512
|
+
throw s[0]; let { header: n, payload: i } = r, { typ: o, alg: a } = n; rt(o), st(a); let { data: c, errors: d } = await nt(r, e); if (d)
|
|
1513
|
+
throw new U({ reason: I.TokenVerificationFailed, message: `Error verifying handshake token. ${d[0]}` }); if (!c)
|
|
1514
|
+
throw new U({ reason: I.TokenInvalidSignature, message: "Handshake signature is invalid." }); return i; }
|
|
1515
|
+
async function Pc(t, e) { let { secretKey: r, apiUrl: s, apiVersion: n, jwksCacheTtlInMs: i, jwtKey: o, skipJwksCache: a } = e, { data: c, errors: d } = K(t); if (d)
|
|
1516
|
+
throw d[0]; let { kid: f } = c.header, p; if (o)
|
|
1517
|
+
p = It({ kid: f, pem: o });
|
|
1518
|
+
else if (r)
|
|
1519
|
+
p = await Ot({ secretKey: r, apiUrl: s, apiVersion: n, kid: f, jwksCacheTtlInMs: i, skipJwksCache: a, fetch: e.fetch });
|
|
1520
|
+
else
|
|
1521
|
+
throw new U({ action: L.SetClerkJWTKey, message: "Failed to resolve JWK during handshake verification.", reason: I.JWKFailedToResolve }); return Ac(t, { key: p }); }
|
|
1522
|
+
var Ic = class {
|
|
1523
|
+
constructor(t, e, r) { this.authenticateContext = t, this.options = e, this.organizationMatcher = r; }
|
|
1524
|
+
isRequestEligibleForHandshake() { let { accept: t, method: e, secFetchDest: r } = this.authenticateContext; return e !== "GET" ? !1 : !!(r === "document" || r === "iframe" || !r && t?.startsWith("text/html")); }
|
|
1525
|
+
buildRedirectToHandshake(t) { if (!this.authenticateContext?.clerkUrl)
|
|
1526
|
+
throw new Error("Missing clerkUrl in authenticateContext"); let e = this.removeDevBrowserFromURL(this.authenticateContext.clerkUrl), r = this.authenticateContext.frontendApi.startsWith("http") ? this.authenticateContext.frontendApi : `https://${this.authenticateContext.frontendApi}`; r = r.replace(/\/+$/, "") + "/"; let s = new URL("v1/client/handshake", r); s.searchParams.append("redirect_url", e?.href || ""), s.searchParams.append("__clerk_api_version", Pt), s.searchParams.append(v.QueryParameters.SuffixedCookies, this.authenticateContext.usesSuffixedCookies().toString()), s.searchParams.append(v.QueryParameters.HandshakeReason, t), s.searchParams.append(v.QueryParameters.HandshakeFormat, "nonce"), this.authenticateContext.sessionToken && s.searchParams.append(v.QueryParameters.Session, this.authenticateContext.sessionToken), this.authenticateContext.instanceType === "development" && this.authenticateContext.devBrowserToken && s.searchParams.append(v.QueryParameters.DevBrowser, this.authenticateContext.devBrowserToken); let n = this.getOrganizationSyncTarget(this.authenticateContext.clerkUrl, this.organizationMatcher); return n && this.getOrganizationSyncQueryParams(n).forEach((o, a) => { s.searchParams.append(a, o); }), new Headers({ [v.Headers.Location]: s.href }); }
|
|
1527
|
+
async getCookiesFromHandshake() { let t = []; if (this.authenticateContext.handshakeNonce)
|
|
1528
|
+
try {
|
|
1529
|
+
let e = await this.authenticateContext.apiClient?.clients.getHandshakePayload({ nonce: this.authenticateContext.handshakeNonce });
|
|
1530
|
+
e && t.push(...e.directives);
|
|
1531
|
+
}
|
|
1532
|
+
catch (e) {
|
|
1533
|
+
oe(e);
|
|
1534
|
+
}
|
|
1535
|
+
else if (this.authenticateContext.handshakeToken) {
|
|
1536
|
+
let e = await Pc(this.authenticateContext.handshakeToken, this.authenticateContext);
|
|
1537
|
+
e && Array.isArray(e.handshake) && t.push(...e.handshake);
|
|
1538
|
+
} return t; }
|
|
1539
|
+
async resolveHandshake() { let t = new Headers({ "Access-Control-Allow-Origin": "null", "Access-Control-Allow-Credentials": "true" }), e = await this.getCookiesFromHandshake(), r = ""; if (e.forEach(i => { t.append("Set-Cookie", i), Mn(i).startsWith(v.Cookies.Session) && (r = Nn(i)); }), this.authenticateContext.instanceType === "development") {
|
|
1540
|
+
let i = new URL(this.authenticateContext.clerkUrl);
|
|
1541
|
+
i.searchParams.delete(v.QueryParameters.Handshake), i.searchParams.delete(v.QueryParameters.HandshakeHelp), i.searchParams.delete(v.QueryParameters.DevBrowser), i.searchParams.delete(v.QueryParameters.HandshakeNonce), t.append(v.Headers.Location, i.toString()), t.set(v.Headers.CacheControl, "no-store");
|
|
1542
|
+
} if (r === "")
|
|
1543
|
+
return F({ tokenType: b.SessionToken, authenticateContext: this.authenticateContext, reason: M.SessionTokenMissing, message: "", headers: t }); let { data: s, errors: [n] = [] } = await Z(r, this.authenticateContext); if (s)
|
|
1544
|
+
return X({ tokenType: b.SessionToken, authenticateContext: this.authenticateContext, sessionClaims: s, headers: t, token: r }); if (this.authenticateContext.instanceType === "development" && (n?.reason === I.TokenExpired || n?.reason === I.TokenNotActiveYet || n?.reason === I.TokenIatInTheFuture)) {
|
|
1545
|
+
let i = new U({ action: n.action, message: n.message, reason: n.reason });
|
|
1546
|
+
i.tokenCarrier = "cookie", oe();
|
|
1547
|
+
let { data: o, errors: [a] = [] } = await Z(r, { ...this.authenticateContext, clockSkewInMs: 864e5 });
|
|
1548
|
+
if (o)
|
|
1549
|
+
return X({ tokenType: b.SessionToken, authenticateContext: this.authenticateContext, sessionClaims: o, headers: t, token: r });
|
|
1550
|
+
throw new Error(a?.message || "Clerk: Handshake retry failed.");
|
|
1551
|
+
} throw new Error(n?.message || "Clerk: Handshake failed."); }
|
|
1552
|
+
handleTokenVerificationErrorInDevelopment(t) { if (t.reason === I.TokenInvalidSignature) {
|
|
1553
|
+
let e = "Clerk: Handshake token verification failed due to an invalid signature. If you have switched Clerk keys locally, clear your cookies and try again.";
|
|
1554
|
+
throw new Error(e);
|
|
1555
|
+
} throw new Error(`Clerk: Handshake token verification failed: ${t.getFullMessage()}.`); }
|
|
1556
|
+
checkAndTrackRedirectLoop(t) { if (this.authenticateContext.handshakeRedirectLoopCounter === 3)
|
|
1557
|
+
return !0; let e = this.authenticateContext.handshakeRedirectLoopCounter + 1, r = v.Cookies.RedirectCount; return t.append("Set-Cookie", `${r}=${e}; SameSite=Lax; HttpOnly; Max-Age=2`), !1; }
|
|
1558
|
+
removeDevBrowserFromURL(t) { let e = new URL(t); return e.searchParams.delete(v.QueryParameters.DevBrowser), e.searchParams.delete(v.QueryParameters.LegacyDevBrowser), e; }
|
|
1559
|
+
getOrganizationSyncTarget(t, e) { return e.findTarget(t); }
|
|
1560
|
+
getOrganizationSyncQueryParams(t) { let e = new Map; return t.type === "personalAccount" && e.set("organization_id", ""), t.type === "organization" && (t.organizationId && e.set("organization_id", t.organizationId), t.organizationSlug && e.set("organization_id", t.organizationSlug)), e; }
|
|
1561
|
+
}, Oc = class {
|
|
1562
|
+
constructor(t) { this.organizationPattern = this.createMatcher(t?.organizationPatterns), this.personalAccountPattern = this.createMatcher(t?.personalAccountPatterns); }
|
|
1563
|
+
createMatcher(t) { if (!t)
|
|
1564
|
+
return null; try {
|
|
1565
|
+
return ht(t);
|
|
1566
|
+
}
|
|
1567
|
+
catch (e) {
|
|
1568
|
+
throw new Error(`Invalid pattern "${t}": ${e}`);
|
|
1569
|
+
} }
|
|
1570
|
+
findTarget(t) { let e = this.findOrganizationTarget(t); return e || this.findPersonalAccountTarget(t); }
|
|
1571
|
+
findOrganizationTarget(t) { if (!this.organizationPattern)
|
|
1572
|
+
return null; try {
|
|
1573
|
+
let e = this.organizationPattern(t.pathname);
|
|
1574
|
+
if (!e || !("params" in e))
|
|
1575
|
+
return null;
|
|
1576
|
+
let r = e.params;
|
|
1577
|
+
return r.id ? { type: "organization", organizationId: r.id } : r.slug ? { type: "organization", organizationSlug: r.slug } : null;
|
|
1578
|
+
}
|
|
1579
|
+
catch (e) {
|
|
1580
|
+
return oe(e), null;
|
|
1581
|
+
} }
|
|
1582
|
+
findPersonalAccountTarget(t) { if (!this.personalAccountPattern)
|
|
1583
|
+
return null; try {
|
|
1584
|
+
return this.personalAccountPattern(t.pathname) ? { type: "personalAccount" } : null;
|
|
1585
|
+
}
|
|
1586
|
+
catch (e) {
|
|
1587
|
+
return oe(e), null;
|
|
1588
|
+
} }
|
|
1589
|
+
}, j = { 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" };
|
|
1590
|
+
function Cc(t, e) { if (!t && Be(e))
|
|
1591
|
+
throw new Error("Missing signInUrl. Pass a signInUrl for dev instances if an app is satellite"); }
|
|
1592
|
+
function xc(t) { if (!t)
|
|
1593
|
+
throw new Error("Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl"); }
|
|
1594
|
+
function Uc(t, e) { let r; try {
|
|
1595
|
+
r = new URL(t);
|
|
1596
|
+
}
|
|
1597
|
+
catch {
|
|
1598
|
+
throw new Error("The signInUrl needs to have a absolute url format.");
|
|
1599
|
+
} if (r.origin === e)
|
|
1600
|
+
throw new Error("The signInUrl needs to be on a different origin than your satellite application."); }
|
|
1601
|
+
function Rc(t) { if (!t.machineSecretKey && !t.secretKey)
|
|
1602
|
+
throw new 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."); }
|
|
1603
|
+
function qc(t, e, r) { return t.reason === I.TokenExpired && !!e.refreshTokenInCookie && r.method === "GET"; }
|
|
1604
|
+
function es(t, e, r) { return ls(t, e) ? null : F({ tokenType: typeof e == "string" ? e : t, authenticateContext: r, reason: M.TokenTypeMismatch }); }
|
|
1605
|
+
function Mc(t, e) { let r = null, { tokenInHeader: s } = e; s && (bt(s) ? r = Et(s) : r = b.SessionToken); let n = r ?? b.SessionToken; return ls(n, t); }
|
|
1606
|
+
var Nc = (async (t, e) => { let r = await Qi(Tc(t), e), s = e.acceptsToken ?? b.SessionToken; s !== b.M2MToken && (ns(r.secretKey), r.isSatellite && (Cc(r.signInUrl, r.secretKey), r.signInUrl && r.origin && Uc(r.signInUrl, r.origin), xc(r.proxyUrl || r.domain))), s === b.M2MToken && Rc(r); let n = new Oc(e.organizationSyncOptions), i = new Ic(r, { organizationSyncOptions: e.organizationSyncOptions }, n); async function o(l) { if (!e.apiClient)
|
|
1607
|
+
return { data: null, error: { message: "An apiClient is needed to perform token refresh.", cause: { reason: j.MissingApiClient } } }; let { sessionToken: y, refreshTokenInCookie: m } = l; if (!y)
|
|
1608
|
+
return { data: null, error: { message: "Session token must be provided.", cause: { reason: j.MissingSessionToken } } }; if (!m)
|
|
1609
|
+
return { data: null, error: { message: "Refresh token must be provided.", cause: { reason: j.MissingRefreshToken } } }; let { data: h, errors: g } = K(y); if (!h || g)
|
|
1610
|
+
return { data: null, error: { message: "Unable to decode the expired session token.", cause: { reason: j.ExpiredSessionTokenDecodeFailed, errors: g } } }; if (!h?.payload?.sid)
|
|
1611
|
+
return { data: null, error: { message: "Expired session token is missing the `sid` claim.", cause: { reason: j.ExpiredSessionTokenMissingSidClaim } } }; try {
|
|
1612
|
+
return { data: (await e.apiClient.sessions.refreshSession(h.payload.sid, { format: "cookie", suffixed_cookies: l.usesSuffixedCookies(), expired_token: y || "", refresh_token: m || "", request_origin: l.clerkUrl.origin, request_headers: Object.fromEntries(Array.from(t.headers.entries()).map(([T, _]) => [T, [_]])) })).cookies, error: null };
|
|
1613
|
+
}
|
|
1614
|
+
catch (k) {
|
|
1615
|
+
return k?.errors?.length ? k.errors[0].code === "unexpected_error" ? { data: null, error: { message: "Fetch unexpected error", cause: { reason: j.FetchError, errors: k.errors } } } : { data: null, error: { message: k.errors[0].code, cause: { reason: k.errors[0].code, errors: k.errors } } } : { data: null, error: { message: "Unexpected Server/BAPI error", cause: { reason: j.UnexpectedBAPIError, errors: [k] } } };
|
|
1616
|
+
} } async function a(l) { let { data: y, error: m } = await o(l); if (!y || y.length === 0)
|
|
1617
|
+
return { data: null, error: m }; let h = new Headers, g = ""; y.forEach(_ => { h.append("Set-Cookie", _), Mn(_).startsWith(v.Cookies.Session) && (g = Nn(_)); }); let { data: k, errors: T } = await Z(g, l); return T ? { data: null, error: { message: "Clerk: unable to verify refreshed session token.", cause: { reason: j.InvalidSessionToken, errors: T } } } : { data: { jwtPayload: k, sessionToken: g, headers: h }, error: null }; } function c(l, y, m, h) { if (!i.isRequestEligibleForHandshake())
|
|
1618
|
+
return F({ tokenType: b.SessionToken, authenticateContext: l, reason: y, message: m }); let g = h ?? i.buildRedirectToHandshake(y); if (g.get(v.Headers.Location) && g.set(v.Headers.CacheControl, "no-store"), i.checkAndTrackRedirectLoop(g)) {
|
|
1619
|
+
let T = d(y);
|
|
1620
|
+
return oe(), F({ tokenType: b.SessionToken, authenticateContext: l, reason: y, message: m });
|
|
1621
|
+
} return gc(l, y, m, g); } function d(l) { return l === M.SatelliteCookieNeedsSyncing ? "Clerk: Satellite-domain authentication resulted in an infinite redirect loop. Check that this request is using a configured primary or satellite domain for the production instance. For preview deployments, use a development/staging Clerk instance or a supported configured preview-domain setup." : "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."; } function f(l, y) { let m = n.findTarget(l.clerkUrl); if (!m)
|
|
1622
|
+
return null; let h = !1; if (m.type === "organization" && (m.organizationSlug && m.organizationSlug !== y.orgSlug && (h = !0), m.organizationId && m.organizationId !== y.orgId && (h = !0)), m.type === "personalAccount" && y.orgId && (h = !0), !h)
|
|
1623
|
+
return null; if (l.handshakeRedirectLoopCounter >= 3)
|
|
1624
|
+
return oe(), null; let g = c(l, M.ActiveOrganizationMismatch, ""); return g.status !== "handshake" ? null : g; } async function p() { let { tokenInHeader: l } = r; if (Lr(l))
|
|
1625
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); try {
|
|
1626
|
+
let { data: y, errors: m } = await Z(l, r);
|
|
1627
|
+
if (m)
|
|
1628
|
+
throw m[0];
|
|
1629
|
+
return X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: y, headers: new Headers, token: l });
|
|
1630
|
+
}
|
|
1631
|
+
catch (y) {
|
|
1632
|
+
return S(y, "header");
|
|
1633
|
+
} } async function E() { let l = r.clientUat, y = !!r.sessionTokenInCookie, m = !!r.devBrowserToken; if (r.handshakeNonce || r.handshakeToken)
|
|
1634
|
+
try {
|
|
1635
|
+
return await i.resolveHandshake();
|
|
1636
|
+
}
|
|
1637
|
+
catch (J) {
|
|
1638
|
+
J instanceof U && r.instanceType === "development" ? i.handleTokenVerificationErrorInDevelopment(J) : oe(J);
|
|
1639
|
+
} let h = r.isSatellite && r.secFetchDest === "document" && r.method === "GET", g = r.clerkUrl.searchParams.get(v.QueryParameters.ClerkSynced), k = g === v.ClerkSyncStatus.NeedsSync, T = g === v.ClerkSyncStatus.Completed, _ = y || l, O = r.satelliteAutoSync !== !0 && !_ && !k; if (r.instanceType === "production" && h && !T) {
|
|
1640
|
+
if (O)
|
|
1641
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.SessionTokenAndUATMissing });
|
|
1642
|
+
if (!_ || k)
|
|
1643
|
+
return c(r, M.SatelliteCookieNeedsSyncing, "");
|
|
1644
|
+
} if (r.instanceType === "development" && h && !T) {
|
|
1645
|
+
if (O)
|
|
1646
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.SessionTokenAndUATMissing });
|
|
1647
|
+
if (!_ || k) {
|
|
1648
|
+
let J = new URL(r.signInUrl);
|
|
1649
|
+
J.searchParams.append(v.QueryParameters.ClerkRedirectUrl, r.clerkUrl.toString());
|
|
1650
|
+
let H = new Headers({ [v.Headers.Location]: J.toString() });
|
|
1651
|
+
return c(r, M.SatelliteCookieNeedsSyncing, "", H);
|
|
1652
|
+
}
|
|
1653
|
+
} let q = new URL(r.clerkUrl).searchParams.get(v.QueryParameters.ClerkRedirectUrl); if (r.instanceType === "development" && !r.isSatellite && q) {
|
|
1654
|
+
let J = new URL(q);
|
|
1655
|
+
r.devBrowserToken && J.searchParams.append(v.QueryParameters.DevBrowser, r.devBrowserToken), J.searchParams.set(v.QueryParameters.ClerkSynced, v.ClerkSyncStatus.Completed);
|
|
1656
|
+
let H = new Headers({ [v.Headers.Location]: J.toString() });
|
|
1657
|
+
return c(r, M.PrimaryRespondsToSyncing, "", H);
|
|
1658
|
+
} if (r.instanceType === "development" && r.clerkUrl.searchParams.has(v.QueryParameters.DevBrowser))
|
|
1659
|
+
return c(r, M.DevBrowserSync, ""); if (r.instanceType === "development" && !m)
|
|
1660
|
+
return c(r, M.DevBrowserMissing, ""); if (!l && !y)
|
|
1661
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.SessionTokenAndUATMissing }); if (!l && y)
|
|
1662
|
+
return c(r, M.SessionTokenWithoutClientUAT, ""); if (l && !y)
|
|
1663
|
+
return c(r, M.ClientUATWithoutSessionToken, ""); let { data: z, errors: D } = K(r.sessionTokenInCookie); if (D)
|
|
1664
|
+
return S(D[0], "cookie"); if (Lr(r.sessionTokenInCookie))
|
|
1665
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); if (z.payload.iat < r.clientUat)
|
|
1666
|
+
return c(r, M.SessionTokenIATBeforeClientUAT, ""); try {
|
|
1667
|
+
let { data: J, errors: H } = await Z(r.sessionTokenInCookie, r);
|
|
1668
|
+
if (H)
|
|
1669
|
+
throw H[0];
|
|
1670
|
+
J.azp || Sr.warnOnce("Clerk: Session token from cookie is missing the azp claim. In a future version of Clerk, this token will be considered invalid. Please contact Clerk support if you see this warning.");
|
|
1671
|
+
let V = X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: J, headers: new Headers, token: r.sessionTokenInCookie });
|
|
1672
|
+
if (!r.isSatellite && r.method === "GET" && r.secFetchDest === "document" && r.isCrossOriginReferrer() && !r.isKnownClerkReferrer() && r.handshakeRedirectLoopCounter === 0)
|
|
1673
|
+
return c(r, M.PrimaryDomainCrossOriginSync, "Cross-origin request from satellite domain requires handshake");
|
|
1674
|
+
let Ee = V.toAuth();
|
|
1675
|
+
if (Ee.userId) {
|
|
1676
|
+
let Ft = f(r, Ee);
|
|
1677
|
+
if (Ft)
|
|
1678
|
+
return Ft;
|
|
1679
|
+
}
|
|
1680
|
+
return V;
|
|
1681
|
+
}
|
|
1682
|
+
catch (J) {
|
|
1683
|
+
return S(J, "cookie");
|
|
1684
|
+
} return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.UnexpectedError }); } async function S(l, y) { if (!(l instanceof U))
|
|
1685
|
+
return F({ tokenType: b.SessionToken, authenticateContext: r, reason: M.UnexpectedError }); let m; if (qc(l, r, t)) {
|
|
1686
|
+
let { data: g, error: k } = await a(r);
|
|
1687
|
+
if (g)
|
|
1688
|
+
return X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: g.jwtPayload, headers: g.headers, token: g.sessionToken });
|
|
1689
|
+
k?.cause?.reason ? m = k.cause.reason : m = j.UnexpectedSDKError;
|
|
1690
|
+
}
|
|
1691
|
+
else
|
|
1692
|
+
t.method !== "GET" ? m = j.NonEligibleNonGet : r.refreshTokenInCookie ? m = null : m = j.NonEligibleNoCookie; return l.tokenCarrier = y, [I.TokenExpired, I.TokenNotActiveYet, I.TokenIatInTheFuture].includes(l.reason) ? c(r, Lc({ tokenError: l.reason, refreshError: m }), l.getFullMessage()) : F({ tokenType: b.SessionToken, authenticateContext: r, reason: l.reason, message: l.getFullMessage() }); } function A(l, y) { return y instanceof B ? F({ tokenType: l, authenticateContext: r, reason: y.code, message: y.getFullMessage() }) : F({ tokenType: l, authenticateContext: r, reason: M.UnexpectedError }); } async function P() { let { tokenInHeader: l } = r; if (!l)
|
|
1693
|
+
return S(new Error("Missing token in header"), "header"); if (!bt(l))
|
|
1694
|
+
return F({ tokenType: s, authenticateContext: r, reason: M.TokenTypeMismatch, message: "" }); let y = Et(l), m = es(y, s, r); if (m)
|
|
1695
|
+
return m; let { data: h, tokenType: g, errors: k } = await Zr(l, r); return k ? A(g, k[0]) : X({ tokenType: g, authenticateContext: r, machineData: h, token: l }); } async function x() { let { tokenInHeader: l } = r; if (!l)
|
|
1696
|
+
return S(new Error("Missing token in header"), "header"); if (bt(l)) {
|
|
1697
|
+
let h = Et(l), g = es(h, s, r);
|
|
1698
|
+
if (g)
|
|
1699
|
+
return g;
|
|
1700
|
+
let { data: k, tokenType: T, errors: _ } = await Zr(l, r);
|
|
1701
|
+
return _ ? A(T, _[0]) : X({ tokenType: T, authenticateContext: r, machineData: k, token: l });
|
|
1702
|
+
} let { data: y, errors: m } = await Z(l, r); return m ? S(m[0], "header") : X({ tokenType: b.SessionToken, authenticateContext: r, sessionClaims: y, token: l }); } return Array.isArray(s) && !Mc(s, r) ? kc() : r.tokenInHeader ? s === "any" || Array.isArray(s) ? x() : s === b.SessionToken ? p() : P() : s === b.OAuthToken || s === b.ApiKey || s === b.M2MToken ? F({ tokenType: s, authenticateContext: r, reason: "No token in header" }) : E(); }), Jc = t => { let { isSignedIn: e, isAuthenticated: r, proxyUrl: s, reason: n, message: i, publishableKey: o, isSatellite: a, domain: c } = t; return { isSignedIn: e, isAuthenticated: r, proxyUrl: s, reason: n, message: i, publishableKey: o, isSatellite: a, domain: c }; }, Lc = ({ tokenError: t, refreshError: e }) => { switch (t) {
|
|
1703
|
+
case I.TokenExpired: return `${M.SessionTokenExpired}-refresh-${e}`;
|
|
1704
|
+
case I.TokenNotActiveYet: return M.SessionTokenNBF;
|
|
1705
|
+
case I.TokenIatInTheFuture: return M.SessionTokenIatInTheFuture;
|
|
1706
|
+
default: return M.UnexpectedError;
|
|
1707
|
+
} }, Dc = { fetch: void 0, secretKey: "", machineSecretKey: "", jwtKey: "", apiUrl: void 0, apiVersion: void 0, proxyUrl: "", publishableKey: "", isSatellite: !1, domain: "", audience: "" };
|
|
1708
|
+
function Jn(t) { let e = Rr(Dc, t.options), r = t.apiClient; return { authenticateRequest: (n, i = {}) => { let { apiUrl: o, apiVersion: a } = e, c = Rr(e, i); return Nc(n, { ...i, ...c, apiUrl: o, apiVersion: a, apiClient: r }); }, debugRequestState: Jc }; }
|
|
1709
|
+
function Ln(t) { return async (...e) => { let { data: r, errors: s } = await t(...e); if (s)
|
|
1710
|
+
throw s[0]; return r; }; }
|
|
1711
|
+
var Fn = Symbol.for("@clerk/shared.telemetryNoticeShown"), Fc = ["Attention: Clerk collects telemetry data from its SDKs when connected to development instances.", "The data collected is used to inform Clerk's product roadmap.", "To learn more, including how to opt-out from the telemetry program, visit: https://clerk.com/docs/telemetry."];
|
|
1712
|
+
function Kc() { return !(typeof window < "u" || typeof globalThis.EdgeRuntime < "u"); }
|
|
1713
|
+
function Hc() { return typeof process > "u" || !process.env ? !1 : Kt.some(t => ue(process.env[t])); }
|
|
1714
|
+
function zc() { return !!globalThis[Fn]; }
|
|
1715
|
+
function Wc() { globalThis[Fn] = !0; }
|
|
1716
|
+
function Bc() { if (!(typeof console > "u" || typeof console.log != "function")) {
|
|
1717
|
+
for (let t of Fc)
|
|
1718
|
+
console.log(t);
|
|
1719
|
+
console.log("");
|
|
1720
|
+
} }
|
|
1721
|
+
function jc(t = {}) { if (!t.skip)
|
|
1722
|
+
try {
|
|
1723
|
+
if (!Kc() || Hc() || zc())
|
|
1724
|
+
return;
|
|
1725
|
+
Bc(), Wc();
|
|
1726
|
+
}
|
|
1727
|
+
catch { } }
|
|
1728
|
+
var Vc = 864e5, $c = class {
|
|
1729
|
+
#e;
|
|
1730
|
+
#r = Vc;
|
|
1731
|
+
constructor(t) { this.#e = t; }
|
|
1732
|
+
isEventThrottled(t) { let e = Date.now(), r = this.#t(t), s = this.#e.getItem(r); return s ? e - s > this.#r ? (this.#e.setItem(r, e), !1) : !0 : (this.#e.setItem(r, e), !1); }
|
|
1733
|
+
#t(t) { let { sk: e, pk: r, payload: s, ...n } = t, i = { ...s, ...n }; return JSON.stringify(Object.keys({ ...s, ...n }).sort().map(o => i[o])); }
|
|
1734
|
+
}, Dn = class {
|
|
1735
|
+
#e = "clerk_telemetry_throttler";
|
|
1736
|
+
getItem(t) { return this.#r()[t]; }
|
|
1737
|
+
setItem(t, e) { try {
|
|
1738
|
+
let r = this.#r();
|
|
1739
|
+
r[t] = e, localStorage.setItem(this.#e, JSON.stringify(r));
|
|
1740
|
+
}
|
|
1741
|
+
catch (r) {
|
|
1742
|
+
r instanceof DOMException && (r.name === "QuotaExceededError" || r.name === "NS_ERROR_DOM_QUOTA_REACHED") && localStorage.length > 0 && localStorage.removeItem(this.#e);
|
|
1743
|
+
} }
|
|
1744
|
+
removeItem(t) { try {
|
|
1745
|
+
let e = this.#r();
|
|
1746
|
+
delete e[t], localStorage.setItem(this.#e, JSON.stringify(e));
|
|
1747
|
+
}
|
|
1748
|
+
catch { } }
|
|
1749
|
+
#r() { try {
|
|
1750
|
+
let t = localStorage.getItem(this.#e);
|
|
1751
|
+
return t ? JSON.parse(t) : {};
|
|
1752
|
+
}
|
|
1753
|
+
catch {
|
|
1754
|
+
return {};
|
|
1755
|
+
} }
|
|
1756
|
+
static isSupported() { return typeof window < "u" && !!window.localStorage; }
|
|
1757
|
+
}, Gc = class {
|
|
1758
|
+
#e = new Map;
|
|
1759
|
+
#r = 1e4;
|
|
1760
|
+
getItem(t) { if (this.#e.size > this.#r) {
|
|
1761
|
+
this.#e.clear();
|
|
1762
|
+
return;
|
|
1763
|
+
} return this.#e.get(t); }
|
|
1764
|
+
setItem(t, e) { this.#e.set(t, e); }
|
|
1765
|
+
removeItem(t) { this.#e.delete(t); }
|
|
1766
|
+
};
|
|
1767
|
+
function Qc(t) { return typeof t == "object" && t !== null && "constructor" in t && typeof t.constructor == "function"; }
|
|
1768
|
+
var Yc = new Set(["error", "warn", "info", "debug", "trace"]), Jt = { samplingRate: 1, maxBufferSize: 5, endpoint: "https://clerk-telemetry.com" }, Lt = class {
|
|
1769
|
+
#e;
|
|
1770
|
+
#r;
|
|
1771
|
+
#t = {};
|
|
1772
|
+
#n = [];
|
|
1773
|
+
#s = null;
|
|
1774
|
+
constructor(t) { this.#e = { maxBufferSize: t.maxBufferSize ?? Jt.maxBufferSize, samplingRate: t.samplingRate ?? Jt.samplingRate, perEventSampling: t.perEventSampling ?? !0, disabled: t.disabled ?? !1, debug: t.debug ?? !1, endpoint: Jt.endpoint }, !t.clerkVersion && typeof window > "u" ? this.#t.clerkVersion = "" : this.#t.clerkVersion = t.clerkVersion ?? "", this.#t.sdk = t.sdk, this.#t.sdkVersion = t.sdkVersion, this.#t.publishableKey = t.publishableKey ?? ""; let e = ee(t.publishableKey); e && (this.#t.instanceType = e.instanceType), t.secretKey && (this.#t.secretKey = t.secretKey.substring(0, 16)); let r = Dn.isSupported() ? new Dn : new Gc; this.#r = new $c(r), jc({ skip: !this.isEnabled }); }
|
|
1775
|
+
get isEnabled() { return !(this.#t.instanceType !== "development" || this.#e.disabled || typeof process < "u" && process.env && ue(process.env.CLERK_TELEMETRY_DISABLED) || typeof window < "u" && window?.navigator?.webdriver); }
|
|
1776
|
+
get isDebug() { return this.#e.debug || typeof process < "u" && process.env && ue(process.env.CLERK_TELEMETRY_DEBUG); }
|
|
1777
|
+
record(t) { try {
|
|
1778
|
+
let e = this.#d(t.event, t.payload);
|
|
1779
|
+
if (this.#h(e.event, e), !this.#c(e, t.eventSamplingRate))
|
|
1780
|
+
return;
|
|
1781
|
+
this.#n.push({ kind: "event", value: e }), this.#o();
|
|
1782
|
+
}
|
|
1783
|
+
catch (e) {
|
|
1784
|
+
console.error("[clerk/telemetry] Error recording telemetry event", e);
|
|
1785
|
+
} }
|
|
1786
|
+
recordLog(t) { try {
|
|
1787
|
+
if (!this.#u(t))
|
|
1788
|
+
return;
|
|
1789
|
+
let e = typeof t?.level == "string" && Yc.has(t.level), r = typeof t?.message == "string" && t.message.trim().length > 0, s = null, n = t?.timestamp;
|
|
1790
|
+
if (typeof n == "number" || typeof n == "string") {
|
|
1791
|
+
let a = new Date(n);
|
|
1792
|
+
Number.isNaN(a.getTime()) || (s = a);
|
|
1793
|
+
}
|
|
1794
|
+
if (!e || !r || s === null) {
|
|
1795
|
+
this.isDebug && typeof console < "u" && console.warn("[clerk/telemetry] Dropping invalid telemetry log entry", { levelIsValid: e, messageIsValid: r, timestampIsValid: s !== null });
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
let i = this.#a(), o = { sdk: i.name, sdkv: i.version, cv: this.#t.clerkVersion ?? "", lvl: t.level, msg: t.message, ts: s.toISOString(), pk: this.#t.publishableKey || null, payload: this.#f(t.context) };
|
|
1799
|
+
this.#n.push({ kind: "log", value: o }), this.#o();
|
|
1800
|
+
}
|
|
1801
|
+
catch (e) {
|
|
1802
|
+
console.error("[clerk/telemetry] Error recording telemetry log entry", e);
|
|
1803
|
+
} }
|
|
1804
|
+
#c(t, e) { return this.isEnabled && !this.isDebug && this.#l(t, e); }
|
|
1805
|
+
#u(t) { return !0; }
|
|
1806
|
+
#l(t, e) { let r = Math.random(); return r <= this.#e.samplingRate && (this.#e.perEventSampling === !1 || typeof e > "u" || r <= e) ? !this.#r.isEventThrottled(t) : !1; }
|
|
1807
|
+
#o() { if (typeof window > "u") {
|
|
1808
|
+
this.#i();
|
|
1809
|
+
return;
|
|
1810
|
+
} if (this.#n.length >= this.#e.maxBufferSize) {
|
|
1811
|
+
this.#s && (typeof cancelIdleCallback < "u" ? cancelIdleCallback(Number(this.#s)) : clearTimeout(Number(this.#s))), this.#i();
|
|
1812
|
+
return;
|
|
1813
|
+
} this.#s || ("requestIdleCallback" in window ? this.#s = requestIdleCallback(() => { this.#i(), this.#s = null; }) : this.#s = setTimeout(() => { this.#i(), this.#s = null; }, 0)); }
|
|
1814
|
+
#i() { let t = [...this.#n]; if (this.#n = [], this.#s = null, t.length === 0)
|
|
1815
|
+
return; let e = t.filter(s => s.kind === "event").map(s => s.value), r = t.filter(s => s.kind === "log").map(s => s.value); if (e.length > 0) {
|
|
1816
|
+
let s = new URL("/v1/event", this.#e.endpoint);
|
|
1817
|
+
fetch(s, { headers: { "Content-Type": "application/json" }, keepalive: !0, method: "POST", body: JSON.stringify({ events: e }) }).catch(() => { });
|
|
1818
|
+
} if (r.length > 0) {
|
|
1819
|
+
let s = new URL("/v1/logs", this.#e.endpoint);
|
|
1820
|
+
fetch(s, { headers: { "Content-Type": "application/json" }, keepalive: !0, method: "POST", body: JSON.stringify({ logs: r }) }).catch(() => { });
|
|
1821
|
+
} }
|
|
1822
|
+
#h(t, e) { this.isDebug && (typeof console.groupCollapsed < "u" ? (console.groupCollapsed("[clerk/telemetry]", t), console.log(e), console.groupEnd()) : console.log("[clerk/telemetry]", t, e)); }
|
|
1823
|
+
#a() { let t = { name: this.#t.sdk, version: this.#t.sdkVersion }; if (typeof window < "u") {
|
|
1824
|
+
let e = window;
|
|
1825
|
+
if (e.Clerk) {
|
|
1826
|
+
let r = e.Clerk;
|
|
1827
|
+
if (Qc(r) && r.constructor.sdkMetadata) {
|
|
1828
|
+
let { name: s, version: n } = r.constructor.sdkMetadata;
|
|
1829
|
+
s !== void 0 && (t.name = s), n !== void 0 && (t.version = n);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
} return t; }
|
|
1833
|
+
#d(t, e) { let r = this.#a(); return { event: t, cv: this.#t.clerkVersion ?? "", it: this.#t.instanceType ?? "", sdk: r.name, sdkv: r.version, ...this.#t.publishableKey ? { pk: this.#t.publishableKey } : {}, ...this.#t.secretKey ? { sk: this.#t.secretKey } : {}, payload: e }; }
|
|
1834
|
+
#f(t) { if (t === null || typeof t > "u" || typeof t != "object")
|
|
1835
|
+
return null; try {
|
|
1836
|
+
let e = JSON.parse(JSON.stringify(t));
|
|
1837
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : null;
|
|
1838
|
+
}
|
|
1839
|
+
catch {
|
|
1840
|
+
return null;
|
|
1841
|
+
} }
|
|
1842
|
+
};
|
|
1843
|
+
var fd = Ln(Z);
|
|
1844
|
+
function Xc(t) { let e = { ...t }, r = he(e), s = Jn({ options: e, apiClient: r }), n = new Lt({ publishableKey: e.publishableKey, secretKey: e.secretKey, samplingRate: .1, ...e.sdkMetadata ? { sdk: e.sdkMetadata.name, sdkVersion: e.sdkMetadata.version } : {}, ...e.telemetry || {} }); return { ...r, ...s, telemetry: n }; }
|
|
1845
|
+
export { Xc as createClerkClient };
|