chordia-ui 3.3.8 → 3.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/AgentLiftCard.cjs.js.map +1 -1
  2. package/dist/AgentLiftCard.es.js +5 -3
  3. package/dist/AgentLiftCard.es.js.map +1 -1
  4. package/dist/CustomFilterChips.cjs.js.map +1 -1
  5. package/dist/CustomFilterChips.es.js +2 -1
  6. package/dist/CustomFilterChips.es.js.map +1 -1
  7. package/dist/FileUploadingState.cjs.js.map +1 -1
  8. package/dist/FileUploadingState.es.js +16 -10
  9. package/dist/FileUploadingState.es.js.map +1 -1
  10. package/dist/IntegrationCard.cjs.js.map +1 -1
  11. package/dist/IntegrationCard.es.js +3 -3
  12. package/dist/IntegrationCard.es.js.map +1 -1
  13. package/dist/SectionLabel.cjs.js.map +1 -1
  14. package/dist/SectionLabel.es.js.map +1 -1
  15. package/dist/SmallButton.cjs.js.map +1 -1
  16. package/dist/SmallButton.es.js +16 -16
  17. package/dist/SmallButton.es.js.map +1 -1
  18. package/dist/SummarySection.cjs.js.map +1 -1
  19. package/dist/SummarySection.es.js +11 -9
  20. package/dist/SummarySection.es.js.map +1 -1
  21. package/dist/TextInput.cjs.js.map +1 -1
  22. package/dist/TextInput.es.js.map +1 -1
  23. package/dist/Timeline.cjs.js.map +1 -1
  24. package/dist/Timeline.es.js +14 -8
  25. package/dist/Timeline.es.js.map +1 -1
  26. package/dist/Tooltip.cjs.js +1 -1
  27. package/dist/Tooltip.cjs.js.map +1 -1
  28. package/dist/Tooltip.es.js +31 -20
  29. package/dist/Tooltip.es.js.map +1 -1
  30. package/dist/TourGuideTooltip.cjs.js.map +1 -1
  31. package/dist/TourGuideTooltip.es.js +2 -1
  32. package/dist/TourGuideTooltip.es.js.map +1 -1
  33. package/dist/UpdatedInteractionRecording.cjs.js +1 -1
  34. package/dist/UpdatedInteractionRecording.cjs.js.map +1 -1
  35. package/dist/UpdatedInteractionRecording.es.js +79 -97
  36. package/dist/UpdatedInteractionRecording.es.js.map +1 -1
  37. package/dist/UploadInteraction.cjs.js.map +1 -1
  38. package/dist/UploadInteraction.es.js.map +1 -1
  39. package/dist/colors.cjs.js +2 -0
  40. package/dist/colors.cjs.js.map +1 -0
  41. package/dist/colors.es.js +2 -0
  42. package/dist/colors.es.js.map +1 -0
  43. package/dist/components/UpdatedInteractionDetails.cjs.js +10 -1
  44. package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
  45. package/dist/components/UpdatedInteractionDetails.es.js +1531 -9
  46. package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
  47. package/dist/components/chat.cjs.js +30 -1
  48. package/dist/components/chat.cjs.js.map +1 -1
  49. package/dist/components/chat.es.js +2222 -7
  50. package/dist/components/chat.es.js.map +1 -1
  51. package/dist/components/common.cjs.js +1 -1
  52. package/dist/components/common.es.js +32 -25
  53. package/dist/components/common.es.js.map +1 -1
  54. package/dist/components/data.cjs.js +1 -1
  55. package/dist/components/data.cjs.js.map +1 -1
  56. package/dist/components/data.es.js +1033 -4
  57. package/dist/components/data.es.js.map +1 -1
  58. package/dist/components/layout.cjs.js +3 -1
  59. package/dist/components/layout.cjs.js.map +1 -1
  60. package/dist/components/layout.es.js +1533 -8
  61. package/dist/components/layout.es.js.map +1 -1
  62. package/dist/components/login.cjs.js +1 -1
  63. package/dist/components/login.es.js +6 -2
  64. package/dist/components/login.es.js.map +1 -1
  65. package/dist/components/media.cjs.js +1 -1
  66. package/dist/components/media.cjs.js.map +1 -1
  67. package/dist/components/media.es.js +220 -6
  68. package/dist/components/media.es.js.map +1 -1
  69. package/dist/components/models.cjs.js +1 -1
  70. package/dist/components/models.cjs.js.map +1 -1
  71. package/dist/components/models.es.js +91 -2
  72. package/dist/components/models.es.js.map +1 -1
  73. package/dist/components/navigation.cjs.js +1 -1
  74. package/dist/components/navigation.cjs.js.map +1 -1
  75. package/dist/components/navigation.es.js +766 -7
  76. package/dist/components/navigation.es.js.map +1 -1
  77. package/dist/components/notifications.cjs.js +1 -1
  78. package/dist/components/notifications.cjs.js.map +1 -1
  79. package/dist/components/notifications.es.js +368 -3
  80. package/dist/components/notifications.es.js.map +1 -1
  81. package/dist/components/onboarding.cjs.js +1 -1
  82. package/dist/components/onboarding.cjs.js.map +1 -1
  83. package/dist/components/onboarding.es.js +985 -7
  84. package/dist/components/onboarding.es.js.map +1 -1
  85. package/dist/components/primitives.cjs.js +1 -1
  86. package/dist/components/primitives.cjs.js.map +1 -1
  87. package/dist/components/primitives.es.js +635 -25
  88. package/dist/components/primitives.es.js.map +1 -1
  89. package/dist/debugger-wc.cjs.js +4 -4
  90. package/dist/debugger-wc.cjs.js.map +1 -1
  91. package/dist/debugger-wc.es.js +15 -11
  92. package/dist/debugger-wc.es.js.map +1 -1
  93. package/dist/index.cjs.js +1 -1
  94. package/dist/index.cjs2.js +2 -49
  95. package/dist/index.cjs2.js.map +1 -1
  96. package/dist/index.cjs3.js +50 -0
  97. package/dist/index.cjs3.js.map +1 -0
  98. package/dist/index.es.js +104 -99
  99. package/dist/index.es.js.map +1 -1
  100. package/dist/index.es2.js +2632 -1776
  101. package/dist/index.es2.js.map +1 -1
  102. package/dist/index.es3.js +1944 -0
  103. package/dist/index.es3.js.map +1 -0
  104. package/dist/pages/interactionDetails.cjs.js +1 -1
  105. package/dist/pages/interactionDetails.cjs.js.map +1 -1
  106. package/dist/pages/interactionDetails.es.js +70 -47
  107. package/dist/pages/interactionDetails.es.js.map +1 -1
  108. package/dist/sortable.esm.cjs.js +1 -1
  109. package/dist/sortable.esm.cjs.js.map +1 -1
  110. package/dist/sortable.esm.es.js +55 -53
  111. package/dist/sortable.esm.es.js.map +1 -1
  112. package/dist/{chordia-ui.css → style.css} +1 -1
  113. package/package.json +1 -1
  114. package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +318 -77
  115. package/src/components/UpdatedInteractionDetails/UpdatedInteractionRecording.jsx +7 -17
  116. package/dist/ChartRenderer.cjs.js +0 -31
  117. package/dist/ChartRenderer.cjs.js.map +0 -1
  118. package/dist/ChartRenderer.es.js +0 -2210
  119. package/dist/ChartRenderer.es.js.map +0 -1
  120. package/dist/GettingStarted.cjs.js +0 -2
  121. package/dist/GettingStarted.cjs.js.map +0 -1
  122. package/dist/GettingStarted.es.js +0 -983
  123. package/dist/GettingStarted.es.js.map +0 -1
  124. package/dist/InlineConfirm.cjs.js +0 -2
  125. package/dist/InlineConfirm.cjs.js.map +0 -1
  126. package/dist/InlineConfirm.es.js +0 -618
  127. package/dist/InlineConfirm.es.js.map +0 -1
  128. package/dist/InteractionSummaryCard.cjs.js +0 -2
  129. package/dist/InteractionSummaryCard.cjs.js.map +0 -1
  130. package/dist/InteractionSummaryCard.es.js +0 -216
  131. package/dist/InteractionSummaryCard.es.js.map +0 -1
  132. package/dist/LoginPage.cjs.js +0 -3
  133. package/dist/LoginPage.cjs.js.map +0 -1
  134. package/dist/LoginPage.es.js +0 -2618
  135. package/dist/LoginPage.es.js.map +0 -1
  136. package/dist/NavigationBar.cjs.js +0 -2
  137. package/dist/NavigationBar.cjs.js.map +0 -1
  138. package/dist/NavigationBar.es.js +0 -762
  139. package/dist/NavigationBar.es.js.map +0 -1
  140. package/dist/NotificationPanel.cjs.js +0 -2
  141. package/dist/NotificationPanel.cjs.js.map +0 -1
  142. package/dist/NotificationPanel.es.js +0 -371
  143. package/dist/NotificationPanel.es.js.map +0 -1
  144. package/dist/OverlayPanel.cjs.js +0 -2
  145. package/dist/OverlayPanel.cjs.js.map +0 -1
  146. package/dist/OverlayPanel.es.js +0 -93
  147. package/dist/OverlayPanel.es.js.map +0 -1
  148. package/dist/SplitPane.cjs.js +0 -4
  149. package/dist/SplitPane.cjs.js.map +0 -1
  150. package/dist/SplitPane.es.js +0 -1531
  151. package/dist/SplitPane.es.js.map +0 -1
  152. package/dist/SummaryStatsPanel.cjs.js +0 -2
  153. package/dist/SummaryStatsPanel.cjs.js.map +0 -1
  154. package/dist/SummaryStatsPanel.es.js +0 -1027
  155. package/dist/SummaryStatsPanel.es.js.map +0 -1
  156. package/dist/UpdatedInteractionDetails.cjs.js +0 -11
  157. package/dist/UpdatedInteractionDetails.cjs.js.map +0 -1
  158. package/dist/UpdatedInteractionDetails.es.js +0 -1310
  159. package/dist/UpdatedInteractionDetails.es.js.map +0 -1
package/dist/index.es2.js CHANGED
@@ -1,1876 +1,2732 @@
1
- import { b as y, _ as r, a as S, c as be, h as R, r as j, s as zi, $ as he, W as Yi, X as Qi } from "./LoginPage.es.js";
2
- const Ge = typeof localStorage < "u", Ht = "J151000", Xi = "J151001", St = "E103205", Zi = "E102004", es = "E103202", ts = Ge && localStorage.getItem("base.content.url") || "", is = "https://static.descope.com/pages", ss = "v2-beta", os = "v2-alpha", ns = "config.json", kt = "base.ui.components.url";
3
- Ge && localStorage.getItem(kt), Ge && localStorage.getItem(kt);
4
- const ot = "descope-login-flow", nt = "t", rt = "code", Gt = "redirect_mode", Jt = "err", rs = "ra-challenge", as = "ra-callback", ls = "ra-backup-callback", cs = "ra-initiator", ds = "data-descope-", at = "data-exclude-field", At = "data-exclude-next", zt = "dls_last_auth", Yt = "state_id", Qt = "saml_idp_state_id", Xt = "saml_idp_username", Zt = "descope_idp_initiated", ei = "sso_app_id", ti = "third_party_app_id", ii = "third_party_app_state_id", si = "oidc_login_hint", oi = "oidc_prompt", ni = "oidc_resource", ri = "oidc_error_redirect_uri", ai = "application_scopes", De = "data-type", us = "sdkScriptsResults", q = { redirect: "redirect", poll: "poll", webauthnCreate: "webauthnCreate", webauthnGet: "webauthnGet", nativeBridge: "nativeBridge", loadForm: "loadForm" }, pe = { submit: "submit", polling: "polling" }, hs = "data-has-dynamic-attr-values", ps = ["descope-multi-select-combo-box", "descope-text-area"], li = 5e3, gs = ["cssVars", "componentsConfig", "inputs", "errorText", "errorType", "clientScripts"];
5
- var Pe;
6
- (function(i) {
7
- i.backward = "backward", i.forward = "forward";
8
- })(Pe || (Pe = {}));
9
- const fs = ["descope-enriched-text"];
10
- function ms(i, e, t) {
11
- return (...s) => y(this, void 0, void 0, (function* () {
12
- let o;
13
- const n = t + 1;
14
- for (let a = 0; a < n; a++) try {
15
- return yield i(...s);
16
- } catch (l) {
17
- o = l, a < t && (yield new Promise(((d) => {
18
- setTimeout(d, e * Math.pow(2, a + 1));
19
- })));
1
+ import { jsxs as k, jsx as d, Fragment as me } from "react/jsx-runtime";
2
+ import ce, { useMemo as pt, useState as C, useRef as Se, useEffect as de, useCallback as lt, useImperativeHandle as no, lazy as ar, Suspense as sr } from "react";
3
+ import { CircleCheckBig as lr, ShieldCheck as cr, Radar as dr, ChevronDown as oo, EyeOff as ur, Eye as pr } from "lucide-react";
4
+ import "./colors.es.js";
5
+ const ro = ce.createContext(void 0), Dn = (e) => (...t) => {
6
+ if (!e)
7
+ throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");
8
+ return e(...t);
9
+ }, hr = () => typeof window < "u" && !!window.descopeBridge, st = { "x-descope-sdk-name": "react", "x-descope-sdk-version": "2.27.1" }, Pn = typeof window < "u";
10
+ var ct = function() {
11
+ return ct = Object.assign || function(t) {
12
+ for (var n, o = 1, r = arguments.length; o < r; o++) {
13
+ n = arguments[o];
14
+ for (var i in n)
15
+ Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
20
16
  }
21
- throw o;
22
- }));
23
- }
24
- function x(i) {
25
- return new URLSearchParams(window.location.search).get(i);
26
- }
27
- function $(i) {
28
- if (window.history.replaceState && x(i)) {
29
- const e = new URL(window.location.href), t = new URLSearchParams(e.search);
30
- t.delete(i), e.search = t.toString(), window.history.replaceState({}, "", e.toString());
31
- }
32
- }
33
- function vs(i, e) {
34
- return y(this, void 0, void 0, (function* () {
35
- const t = yield fetch(i, { cache: "default" });
36
- if (!t.ok) throw Error(`Error fetching URL ${i} [${t.status}]`);
37
- return { body: yield t[e](), headers: Object.fromEntries(t.headers.entries()) };
38
- }));
39
- }
40
- function bs({ projectId: i, filename: e, assetsFolder: t = ss, baseUrl: s }) {
41
- const o = new URL(ts || s || is);
42
- return o.pathname = ((...n) => n.join("/").replace(/\/+/g, "/"))(o.pathname, i, t, e), o.toString();
43
- }
44
- function ws(i, e) {
45
- if (!e) return;
46
- const t = +i, s = +e;
47
- return Number.isNaN(t) || Number.isNaN(s) ? void 0 : t > s ? Pe.forward : t < s ? Pe.backward : void 0;
48
- }
49
- const ci = (i) => {
50
- let [e = "", t = ""] = (x(ot) || "").split("_");
51
- const s = ((o) => {
52
- var n;
53
- return ((n = /(.*)\|#\|.*/.exec(o)) === null || n === void 0 ? void 0 : n[1]) || "";
54
- })(e);
55
- return (!i || s && s !== i) && (e = "", t = ""), { executionId: e, stepId: t, executionFlowId: s };
17
+ return t;
18
+ }, ct.apply(this, arguments);
56
19
  };
57
- function ys() {
58
- return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
59
- }
60
- function di() {
61
- $(ot);
62
- }
63
- function Cs() {
64
- return x(nt) || void 0;
65
- }
66
- function Ss() {
67
- $(nt);
20
+ function q(e, t) {
21
+ var n = {};
22
+ for (var o in e)
23
+ Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
24
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
25
+ for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
26
+ t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]);
27
+ return n;
68
28
  }
69
- function ks() {
70
- return x(rt) || void 0;
71
- }
72
- function As() {
73
- return x(Gt) === "popup";
29
+ function La(e, t, n, o) {
30
+ function r(i) {
31
+ return i instanceof n ? i : new n(function(a) {
32
+ a(i);
33
+ });
34
+ }
35
+ return new (n || (n = Promise))(function(i, a) {
36
+ function l(u) {
37
+ try {
38
+ c(o.next(u));
39
+ } catch (p) {
40
+ a(p);
41
+ }
42
+ }
43
+ function s(u) {
44
+ try {
45
+ c(o.throw(u));
46
+ } catch (p) {
47
+ a(p);
48
+ }
49
+ }
50
+ function c(u) {
51
+ u.done ? i(u.value) : r(u.value).then(l, s);
52
+ }
53
+ c((o = o.apply(e, t || [])).next());
54
+ });
74
55
  }
75
- function Es() {
76
- return x(Jt) || void 0;
56
+ function gr(e, t, n) {
57
+ if (n || arguments.length === 2)
58
+ for (var o = 0, r = t.length, i; o < r; o++)
59
+ (i || !(o in t)) && (i || (i = Array.prototype.slice.call(t, 0, o)), i[o] = t[o]);
60
+ return e.concat(i || Array.prototype.slice.call(t));
77
61
  }
78
- function xs() {
79
- $(rt);
62
+ function za(e, t, n, o) {
63
+ if (n === "a" && !o)
64
+ throw new TypeError("Private accessor was defined without a getter");
65
+ if (typeof t == "function" ? e !== t || !o : !t.has(e))
66
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
67
+ return n === "m" ? o : n === "a" ? o.call(e) : o ? o.value : t.get(e);
80
68
  }
81
- function Is() {
82
- $(Gt);
69
+ function Ba(e, t, n, o, r) {
70
+ if (o === "m")
71
+ throw new TypeError("Private method is not writable");
72
+ if (o === "a" && !r)
73
+ throw new TypeError("Private accessor was defined without a setter");
74
+ if (typeof t == "function" ? e !== t || !r : !t.has(e))
75
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
76
+ return o === "a" ? r.call(e, n) : r ? r.value = n : t.set(e, n), n;
83
77
  }
84
- function _s() {
85
- $(Jt);
78
+ class $e extends Error {
86
79
  }
87
- function $s() {
88
- return { redirectAuthCodeChallenge: x(rs), redirectAuthCallbackUrl: x(as), redirectAuthBackupCallbackUri: x(ls), redirectAuthInitiator: x(cs) };
80
+ $e.prototype.name = "InvalidTokenError";
81
+ function fr(e) {
82
+ return decodeURIComponent(atob(e).replace(/(.)/g, (t, n) => {
83
+ let o = n.charCodeAt(0).toString(16).toUpperCase();
84
+ return o.length < 2 && (o = "0" + o), "%" + o;
85
+ }));
89
86
  }
90
- function Os() {
91
- return x(Yt);
87
+ function vr(e) {
88
+ let t = e.replace(/-/g, "+").replace(/_/g, "/");
89
+ switch (t.length % 4) {
90
+ case 0:
91
+ break;
92
+ case 2:
93
+ t += "==";
94
+ break;
95
+ case 3:
96
+ t += "=";
97
+ break;
98
+ default:
99
+ throw new Error("base64 string is not of the correct length");
100
+ }
101
+ try {
102
+ return fr(t);
103
+ } catch {
104
+ return atob(t);
105
+ }
92
106
  }
93
- function Us() {
94
- $(Yt);
107
+ function Yt(e, t) {
108
+ if (typeof e != "string")
109
+ throw new $e("Invalid token specified: must be a string");
110
+ t || (t = {});
111
+ const n = t.header === !0 ? 0 : 1, o = e.split(".")[n];
112
+ if (typeof o != "string")
113
+ throw new $e(`Invalid token specified: missing part #${n + 1}`);
114
+ let r;
115
+ try {
116
+ r = vr(o);
117
+ } catch (i) {
118
+ throw new $e(`Invalid token specified: invalid base64 for part #${n + 1} (${i.message})`);
119
+ }
120
+ try {
121
+ return JSON.parse(r);
122
+ } catch (i) {
123
+ throw new $e(`Invalid token specified: invalid json for part #${n + 1} (${i.message})`);
124
+ }
95
125
  }
96
- function Ms() {
97
- return x(Qt);
126
+ var w = { accessKey: { exchange: "/v1/auth/accesskey/exchange" }, otp: { verify: "/v1/auth/otp/verify", signIn: "/v1/auth/otp/signin", signUp: "/v1/auth/otp/signup", update: { email: "/v1/auth/otp/update/email", phone: "/v1/auth/otp/update/phone" }, signUpOrIn: "/v1/auth/otp/signup-in" }, magicLink: { verify: "/v1/auth/magiclink/verify", signIn: "/v1/auth/magiclink/signin", signUp: "/v1/auth/magiclink/signup", update: { email: "/v1/auth/magiclink/update/email", phone: "/v1/auth/magiclink/update/phone" }, signUpOrIn: "/v1/auth/magiclink/signup-in" }, enchantedLink: { verify: "/v1/auth/enchantedlink/verify", signIn: "/v1/auth/enchantedlink/signin", signUp: "/v1/auth/enchantedlink/signup", session: "/v1/auth/enchantedlink/pending-session", update: { email: "/v1/auth/enchantedlink/update/email" }, signUpOrIn: "/v1/auth/enchantedlink/signup-in" }, oauth: { start: "/v1/auth/oauth/authorize", exchange: "/v1/auth/oauth/exchange", startNative: "v1/auth/oauth/native/start", finishNative: "v1/auth/oauth/native/finish", oneTap: { getOneTapClientId: "/v1/auth/onetap/clientid/{provider}", exchangeOneTapIDToken: "/v1/auth/onetap/idtoken/exchange", verifyOneTapIDToken: "/v1/auth/onetap/idtoken/verify" } }, outbound: { connect: "/v1/outbound/oauth/connect" }, saml: { start: "/v1/auth/saml/authorize", exchange: "/v1/auth/saml/exchange" }, totp: { verify: "/v1/auth/totp/verify", signUp: "/v1/auth/totp/signup", update: "/v1/auth/totp/update" }, notp: { signIn: "/v1/auth/notp/whatsapp/signin", signUp: "/v1/auth/notp/whatsapp/signup", signUpOrIn: "/v1/auth/notp/whatsapp/signup-in", session: "/v1/auth/notp/pending-session" }, webauthn: { signUp: { start: "/v1/auth/webauthn/signup/start", finish: "/v1/auth/webauthn/signup/finish" }, signIn: { start: "/v1/auth/webauthn/signin/start", finish: "/v1/auth/webauthn/signin/finish" }, signUpOrIn: { start: "/v1/auth/webauthn/signup-in/start" }, update: { start: "v1/auth/webauthn/update/start", finish: "/v1/auth/webauthn/update/finish" } }, password: { signUp: "/v1/auth/password/signup", signIn: "/v1/auth/password/signin", sendReset: "/v1/auth/password/reset", update: "/v1/auth/password/update", replace: "/v1/auth/password/replace", policy: "/v1/auth/password/policy" }, refresh: "/v1/auth/refresh", tryRefresh: "/v1/auth/try-refresh", selectTenant: "/v1/auth/tenant/select", logout: "/v1/auth/logout", logoutAll: "/v1/auth/logoutall", me: "/v1/auth/me", myTenants: "/v1/auth/me/tenants", history: "/v1/auth/me/history", flow: { start: "/v1/flow/start", next: "/v1/flow/next" } };
127
+ const io = "<region>", mr = `https://api.${io}descope.com`, Rn = 1e3, Nn = 6e5, ao = "dct", Fn = () => {
128
+ const e = {};
129
+ return { headers(t) {
130
+ const n = typeof t.entries == "function" ? Object.fromEntries(t.entries()) : t;
131
+ return e.Headers = JSON.stringify(n), this;
132
+ }, body(t) {
133
+ return e.Body = t, this;
134
+ }, url(t) {
135
+ return e.Url = t.toString(), this;
136
+ }, method(t) {
137
+ return e.Method = t, this;
138
+ }, title(t) {
139
+ return e.Title = t, this;
140
+ }, status(t) {
141
+ return e.Status = t, this;
142
+ }, retries(t) {
143
+ return e.Retries = t, this;
144
+ }, build: () => Object.keys(e).flatMap((t) => e[t] ? [`${t !== "Title" ? `${t}: ` : ""}${e[t]}`] : []).join(`
145
+ `) };
146
+ }, yr = [503, 521, 522, 524, 530], Ln = [100, 5e3, 5e3], wr = (e) => new Promise((t) => setTimeout(t, e)), zn = (e) => async (...t) => {
147
+ let n = await e(...t), o = 0;
148
+ for (; yr.includes(n.status) && o < Ln.length; )
149
+ await wr(Ln[o]), n = await e(...t), o++;
150
+ o > 0 && (n.retries = o);
151
+ const r = await n.text();
152
+ return n.text = () => Promise.resolve(r), n.json = () => Promise.resolve(JSON.parse(r)), n.clone = () => n, n;
153
+ }, br = (e, t) => {
154
+ const n = t || fetch;
155
+ return n || e == null || e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"), e ? async (...o) => {
156
+ if (!n)
157
+ throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");
158
+ e.log(((i) => Fn().title("Request").url(i[0]).method(i[1].method).headers(i[1].headers).body(i[1].body).build())(o));
159
+ const r = await zn(n)(...o);
160
+ return e[r.ok ? "log" : "error"](await (async (i) => {
161
+ const a = await i.text();
162
+ return Fn().title("Response").url(i.url.toString()).status(`${i.status} ${i.statusText}`).headers(i.headers).body(a).retries(i.retries).build();
163
+ })(r)), r;
164
+ } : zn(n);
165
+ };
166
+ let tt;
167
+ const xr = () => {
168
+ if (tt)
169
+ return tt;
170
+ const e = /* @__PURE__ */ new Date(), t = `${e.getUTCFullYear().toString()}-${(e.getUTCMonth() + 1).toString().padStart(2, "0")}-${e.getUTCDate().toString().padStart(2, "0")}-${e.getUTCHours().toString().padStart(2, "0")}:${e.getUTCMinutes().toString().padStart(2, "0")}:${e.getUTCSeconds().toString().padStart(2, "0")}:${e.getUTCMilliseconds().toString()}`, n = Math.floor(1e3 + 9e3 * Math.random());
171
+ return tt = `${t}-${n}`, tt;
172
+ };
173
+ var Ee;
174
+ (function(e) {
175
+ e.get = "GET", e.delete = "DELETE", e.post = "POST", e.put = "PUT", e.patch = "PATCH";
176
+ })(Ee || (Ee = {}));
177
+ const Bn = ({ path: e, baseUrl: t, queryParams: n, projectId: o }) => {
178
+ const r = o.slice(1, -27);
179
+ t = t.replace(io, r ? r + "." : "");
180
+ let i = e ? `${t.replace(/\/$/, "")}/${e == null ? void 0 : e.replace(/^\//, "")}` : t;
181
+ if (n) {
182
+ const a = Object.keys(n);
183
+ a.forEach((l, s) => {
184
+ i = `${i}${s === 0 ? "?" : ""}${l}=${encodeURIComponent(n[l])}${s === a.length - 1 ? "" : "&"}`;
185
+ });
186
+ }
187
+ return i;
188
+ }, kr = (...e) => new Headers(e.reduce((t, n) => (((o) => Array.isArray(o) ? o : o instanceof Headers ? Array.from(o.entries()) : o ? Object.entries(o) : [])(n).forEach(([o, r]) => {
189
+ t[o] = typeof r == "function" ? r() : r;
190
+ }), t), {})), Ir = { "Content-Type": "application/json" }, Sr = (e, t = "") => {
191
+ let n = e;
192
+ return t && (n = n + ":" + t), { Authorization: `Bearer ${n}` };
193
+ }, Cr = (e, t) => {
194
+ const n = { "x-descope-sdk-session-id": xr(), "x-descope-sdk-name": "core-js", "x-descope-sdk-version": "2.58.0", "x-descope-project-id": e };
195
+ return t && (n["x-descope-refresh-cookie-name"] = t), n;
196
+ }, Or = (e) => {
197
+ try {
198
+ e = JSON.parse(e);
199
+ } catch {
200
+ return !1;
201
+ }
202
+ return typeof e == "object" && e !== null;
203
+ };
204
+ var Ar = ((e) => (t) => {
205
+ var n;
206
+ return e(Object.assign(Object.assign({}, t), { hooks: { beforeRequest: (o) => {
207
+ var r;
208
+ const i = [].concat(((r = t.hooks) === null || r === void 0 ? void 0 : r.beforeRequest) || []);
209
+ return i == null ? void 0 : i.reduce((a, l) => l(a), o);
210
+ }, afterRequest: async (o, r) => {
211
+ var i;
212
+ const a = [].concat(((i = t.hooks) === null || i === void 0 ? void 0 : i.afterRequest) || []);
213
+ a.length != 0 && (await Promise.allSettled(a == null ? void 0 : a.map((l) => l(o, r == null ? void 0 : r.clone())))).forEach((l) => {
214
+ var s;
215
+ return l.status === "rejected" && ((s = t.logger) === null || s === void 0 ? void 0 : s.error(l.reason));
216
+ });
217
+ }, transformResponse: (n = t.hooks) === null || n === void 0 ? void 0 : n.transformResponse } }));
218
+ })(({ baseUrl: e, projectId: t, baseConfig: n, refreshCookieName: o, logger: r, hooks: i, cookiePolicy: a, fetch: l }) => {
219
+ const s = e || mr, c = br(r, l), u = async (p) => {
220
+ var f;
221
+ const x = i != null && i.beforeRequest ? i.beforeRequest(p) : p, { path: h, body: m, headers: y, queryParams: E, method: T, token: N } = x, D = ((B) => B === void 0 ? void 0 : JSON.stringify(B))(m), v = { headers: kr(Sr(t, N), Cr(t, o), (n == null ? void 0 : n.baseHeaders) || {}, Or(D) ? Ir : {}, y), method: T, body: D };
222
+ a !== null && (v.credentials = a || "include");
223
+ const A = await c(Bn({ path: h, baseUrl: s, queryParams: E, projectId: t }), v);
224
+ if (i != null && i.afterRequest && await i.afterRequest(p, A == null ? void 0 : A.clone()), i == null ? void 0 : i.transformResponse) {
225
+ const B = await A.json(), V = (((f = A.headers) === null || f === void 0 ? void 0 : f.get("set-cookie")) || "").split(";").reduce((_, H) => {
226
+ const [$, Q] = H.split("=");
227
+ return Object.assign(Object.assign({}, _), { [$.trim()]: Q });
228
+ }, {}), Z = Object.assign(Object.assign({}, A), { json: () => Promise.resolve(B), cookies: V });
229
+ return Z.clone = () => Z, i.transformResponse(Z);
230
+ }
231
+ return A;
232
+ };
233
+ return { get: (p, { headers: f, queryParams: x, token: h } = {}) => u({ path: p, headers: f, queryParams: x, body: void 0, method: Ee.get, token: h }), post: (p, f, { headers: x, queryParams: h, token: m } = {}) => u({ path: p, headers: x, queryParams: h, body: f, method: Ee.post, token: m }), patch: (p, f, { headers: x, queryParams: h, token: m } = {}) => u({ path: p, headers: x, queryParams: h, body: f, method: Ee.patch, token: m }), put: (p, f, { headers: x, queryParams: h, token: m } = {}) => u({ path: p, headers: x, queryParams: h, body: f, method: Ee.put, token: m }), delete: (p, { headers: f, queryParams: x, token: h } = {}) => u({ path: p, headers: f, queryParams: x, body: void 0, method: Ee.delete, token: h }), hooks: i, buildUrl: (p, f) => Bn({ projectId: t, baseUrl: s, path: p, queryParams: f }) };
234
+ }), Ur = { TOO_MANY_REQUESTS: 429 };
235
+ function so(e, t, n) {
236
+ var o;
237
+ let r = ht(e);
238
+ if (t) {
239
+ if (!(r != null && r.tenants) && (r == null ? void 0 : r[ao]) === t)
240
+ return (r == null ? void 0 : r[n]) || [];
241
+ r = (o = r == null ? void 0 : r.tenants) === null || o === void 0 ? void 0 : o[t];
242
+ }
243
+ const i = r == null ? void 0 : r[n];
244
+ return Array.isArray(i) ? i : [];
98
245
  }
99
- function Rs() {
100
- $(Qt);
246
+ function ht(e) {
247
+ if (typeof e != "string" || !e)
248
+ throw new Error("Invalid token provided");
249
+ return Yt(e);
101
250
  }
102
- function js() {
103
- return x(Xt);
251
+ function Tr(e) {
252
+ const { exp: t } = ht(e);
253
+ return (/* @__PURE__ */ new Date()).getTime() / 1e3 > t;
104
254
  }
105
- function Ts() {
106
- $(Xt);
255
+ function Er(e) {
256
+ let t = ht(e);
257
+ const n = Object.keys(t == null ? void 0 : t.tenants);
258
+ return Array.isArray(n) ? n : [];
107
259
  }
108
- function Ls() {
109
- return x(Zt);
260
+ function jr(e, t) {
261
+ return so(e, t, "permissions");
110
262
  }
111
- function Ws() {
112
- $(Zt);
263
+ function Dr(e, t) {
264
+ return so(e, t, "roles");
113
265
  }
114
- function Ps() {
115
- return x(ei);
266
+ const se = (...e) => e.join("/").replace(/\/{2,}/g, "/");
267
+ async function b(e, t) {
268
+ var n;
269
+ const o = await e, r = { code: o.status, ok: o.ok, response: o }, i = await o.clone().json();
270
+ return o.ok ? r.data = t ? t(i) : i : (r.error = i, o.status === Ur.TOO_MANY_REQUESTS && Object.assign(r.error, { retryAfter: Number.parseInt((n = o.headers) === null || n === void 0 ? void 0 : n.get("retry-after")) || 0 })), r;
116
271
  }
117
- function Ns() {
118
- return x(ti);
272
+ function Pr(e) {
273
+ var t;
274
+ return ((t = ht(e)) === null || t === void 0 ? void 0 : t[ao]) || "";
119
275
  }
120
- function Ds() {
121
- $(ei);
276
+ const Oe = (e, t) => (n = t) => (o) => !e(o) && n.replace("{val}", o), lo = (e, t) => (n = t) => (o) => {
277
+ const r = e.filter((i) => i(o));
278
+ return !(r.length < e.length) && (n ? n.replace("{val}", o) : r.join(" OR "));
279
+ }, co = (...e) => ({ validate: (t) => (e.forEach((n) => {
280
+ const o = n(t);
281
+ if (o)
282
+ throw new Error(o);
283
+ }), !0) }), uo = (e) => (t) => e.test(t), Rr = uo(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/), Nr = uo(/^\+[1-9]{1}[0-9]{3,14}$/), Fr = (e, t) => (n) => co(...t).validate(((o, r, i) => {
284
+ const a = (Array.isArray(r) ? r.join(".") : String(r)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g, (u, p, f) => "." + f).split("."), l = a.length;
285
+ let s = 0, c = o === Object(o) ? o : void 0;
286
+ for (; c != null && s < l; )
287
+ c = c[a[s++]];
288
+ return s && s === l && c !== void 0 ? c : i;
289
+ })(n, e)), Lr = Oe(Rr, '"{val}" is not a valid email'), zr = Oe(Nr, '"{val}" is not a valid phone number'), Br = Oe((Hn = 1, (e) => e.length >= Hn), "Minimum length is 1");
290
+ var Hn;
291
+ const ze = Oe((e) => typeof e == "string", "Input is not a string"), Hr = Oe((e) => Array.isArray(e), "Input is not an array"), qr = Oe((e) => typeof e == "boolean", "Input is not a boolean"), Jr = Oe((e) => e === void 0, "Input is defined"), zt = lo([ze(), Jr()], "Input is not a string or undefined"), Mr = lo([Hr(), qr()], "Input is not an array or boolean"), j = (...e) => (t) => (...n) => (e.forEach((o, r) => co(...o).validate(n[r])), t(...n)), po = (e) => [ze(`"${e}" must be a string`)], ho = (e) => [zt(`"${e}" must be string or undefined`)], F = (e) => [ze(`"${e}" must be a string`), Br(`"${e}" must not be empty`)], Qt = (e) => [ze(`"${e}" must be a string`), Lr()], go = (e) => [ze(`"${e}" must be a string`), zr()], Wr = j(F("accessKey")), Kr = (e) => ({ exchange: Wr((t, n) => b(e.post(w.accessKey.exchange, { loginOptions: n }, { token: t }))) }), Me = (e, t, n) => (t.forEach((o) => {
292
+ const r = o.split(".");
293
+ let i = r.shift(), a = e;
294
+ for (; r.length > 0; ) {
295
+ if (a = a[i], !i || !a)
296
+ throw Error(`Invalid path "${o}", "${i}" is missing or has no value`);
297
+ i = r.shift();
298
+ }
299
+ if (typeof a[i] != "function")
300
+ throw Error(`"${o}" is not a function`);
301
+ const l = a[i];
302
+ a[i] = n(l);
303
+ }), e), fo = ({ pollingIntervalMs: e = 1e3, timeoutMs: t = 6e5 } = {}) => ({ pollingIntervalMs: Math.max(e || Rn, Rn), timeoutMs: Math.min(t || Nn, Nn) });
304
+ var Ce, Bt;
305
+ (function(e) {
306
+ e.sms = "sms", e.voice = "voice", e.whatsapp = "whatsapp", e.im = "im";
307
+ })(Ce || (Ce = {})), function(e) {
308
+ e.email = "email";
309
+ }(Bt || (Bt = {}));
310
+ const ye = Object.assign(Object.assign({}, Ce), Bt);
311
+ var qn;
312
+ (function(e) {
313
+ e.waiting = "waiting", e.running = "running", e.completed = "completed", e.failed = "failed";
314
+ })(qn || (qn = {}));
315
+ const vo = F("loginId"), Vr = j(F("token")), At = j(vo), $r = j(F("pendingRef")), Yr = j(vo, Qt("email")), Qr = (e) => ({ verify: Vr((t) => b(e.post(w.enchantedLink.verify, { token: t }))), signIn: At((t, n, o = {}, r) => {
316
+ var { providerId: i } = o, a = q(o, ["providerId"]);
317
+ return b(e.post(se(w.enchantedLink.signIn, ye.email), { loginId: t, URI: n, loginOptions: a, providerId: i }, { token: r }));
318
+ }), signUpOrIn: At((t, n, o = {}) => {
319
+ var { providerId: r } = o, i = q(o, ["providerId"]);
320
+ return b(e.post(se(w.enchantedLink.signUpOrIn, ye.email), { loginId: t, URI: n, loginOptions: i, providerId: r }));
321
+ }), signUp: At((t, n, o, r = {}) => {
322
+ var { providerId: i } = r, a = q(r, ["providerId"]);
323
+ return b(e.post(se(w.enchantedLink.signUp, ye.email), { loginId: t, URI: n, user: o, loginOptions: a, providerId: i }));
324
+ }), waitForSession: $r((t, n) => new Promise((o) => {
325
+ const { pollingIntervalMs: r, timeoutMs: i } = fo(n);
326
+ let a;
327
+ const l = setInterval(async () => {
328
+ const s = await e.post(w.enchantedLink.session, { pendingRef: t });
329
+ s.ok && (clearInterval(l), a && clearTimeout(a), o(b(Promise.resolve(s))));
330
+ }, r);
331
+ a = setTimeout(() => {
332
+ o({ error: { errorDescription: `Session polling timeout exceeded: ${i}ms`, errorCode: "0" }, ok: !1 }), clearInterval(l);
333
+ }, i);
334
+ })), update: { email: Yr((t, n, o, r, i) => b(e.post(w.enchantedLink.update.email, Object.assign({ loginId: t, email: n, URI: o }, i), { token: r }))) } }), Xr = j(F("flowId")), Gr = j(F("executionId"), F("stepId"), F("interactionId")), Zr = (e) => ({ start: Xr((t, n, o, r, i, a, l, s = !1) => b(e.post(w.flow.start, { flowId: t, options: n, conditionInteractionId: o, interactionId: r, componentsVersion: i, flowVersions: a, input: l, isCustomScreen: s }))), next: Gr((t, n, o, r, i, a, l = !1) => b(e.post(w.flow.next, { executionId: t, stepId: n, interactionId: o, version: r, componentsVersion: i, input: a, isCustomScreen: l }))) }), Xt = F("loginId"), _r = j(F("token")), Ut = j(Xt), ei = j(Xt, go("phone")), ti = j(Xt, Qt("email")), Tt = Object.keys(ye).filter((e) => e !== Ce.voice && e !== Ce.im), ni = (e) => ({ verify: _r((t) => b(e.post(w.magicLink.verify, { token: t }))), signIn: Tt.reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Ut((o, r, i = {}, a) => {
335
+ var { providerId: l } = i, s = q(i, ["providerId"]);
336
+ return b(e.post(se(w.magicLink.signIn, n), { loginId: o, URI: r, loginOptions: s, providerId: l }, { token: a }));
337
+ }) }), {}), signUp: Tt.reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Ut((o, r, i, a = {}) => {
338
+ var { providerId: l } = a, s = q(a, ["providerId"]);
339
+ return b(e.post(se(w.magicLink.signUp, n), { loginId: o, URI: r, user: i, loginOptions: s, providerId: l }));
340
+ }) }), {}), signUpOrIn: Tt.reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Ut((o, r, i = {}) => {
341
+ var { providerId: a } = i, l = q(i, ["providerId"]);
342
+ return b(e.post(se(w.magicLink.signUpOrIn, n), { loginId: o, URI: r, loginOptions: l, providerId: a }));
343
+ }) }), {}), update: { email: ti((t, n, o, r, i) => b(e.post(w.magicLink.update.email, Object.assign({ loginId: t, email: n, URI: o }, i), { token: r }))), phone: Object.keys(Ce).filter((t) => t !== Ce.voice).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: ei((o, r, i, a, l) => b(e.post(se(w.magicLink.update.phone, n), Object.assign({ loginId: o, phone: r, URI: i }, l), { token: a }))) }), {}) } });
344
+ var Ht;
345
+ (function(e) {
346
+ e.facebook = "facebook", e.github = "github", e.google = "google", e.microsoft = "microsoft", e.gitlab = "gitlab", e.apple = "apple", e.discord = "discord", e.linkedin = "linkedin", e.slack = "slack";
347
+ })(Ht || (Ht = {}));
348
+ const oi = j(F("code")), ri = (e) => ({ start: Object.assign((t, n, o, r, i) => b(e.post(w.oauth.start, o || {}, { queryParams: Object.assign(Object.assign({ provider: t }, n && { redirectURL: n }), i && { loginHint: i }), token: r })), Object.keys(Ht).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: (o, r, i, a) => b(e.post(w.oauth.start, r || {}, { queryParams: Object.assign(Object.assign({ provider: n }, o && { redirectURL: o }), a && { loginHint: a }), token: i })) }), {})), exchange: oi((t) => b(e.post(w.oauth.exchange, { code: t }))), startNative: (t, n, o) => b(e.post(w.oauth.startNative, { provider: t, loginOptions: n, implicit: o })), finishNative: (t, n, o, r, i) => b(e.post(w.oauth.finishNative, { provider: t, stateId: n, user: o, code: r, idToken: i })), getOneTapClientId: (t) => b(e.get(w.oauth.oneTap.getOneTapClientId.replace("{provider}", t))), verifyOneTapIDToken: (t, n, o, r) => b(e.post(w.oauth.oneTap.verifyOneTapIDToken, { provider: t, idToken: n, nonce: o, loginOptions: r })), exchangeOneTapIDToken: (t, n, o, r) => b(e.post(w.oauth.oneTap.exchangeOneTapIDToken, { provider: t, idToken: n, nonce: o, loginOptions: r })) }), ii = F("appId"), ai = j(ii), si = (e) => ({ connect: ai((t, n, o) => {
349
+ const r = n == null ? void 0 : n.tenantId, i = n == null ? void 0 : n.tenantLevel;
350
+ return n == null || delete n.tenantId, n == null || delete n.tenantLevel, b(e.post(w.outbound.connect, { appId: t, tenantId: r, tenantLevel: i, options: n }, { token: o }));
351
+ }) }), gt = F("loginId"), li = j(gt, F("code")), Et = j(gt), ci = j(gt, go("phone")), di = j(gt, Qt("email")), ui = (e) => ({ verify: Object.keys(ye).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: li((o, r) => b(e.post(se(w.otp.verify, n), { code: r, loginId: o }))) }), {}), signIn: Object.keys(ye).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Et((o, r = {}, i) => {
352
+ var { providerId: a } = r, l = q(r, ["providerId"]);
353
+ return b(e.post(se(w.otp.signIn, n), { loginId: o, loginOptions: l, providerId: a }, { token: i }));
354
+ }) }), {}), signUp: Object.keys(ye).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Et((o, r, i = {}) => {
355
+ var { providerId: a } = i, l = q(i, ["providerId"]);
356
+ return b(e.post(se(w.otp.signUp, n), { loginId: o, user: r, loginOptions: l, providerId: a }));
357
+ }) }), {}), signUpOrIn: Object.keys(ye).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: Et((o, r = {}) => {
358
+ var { providerId: i } = r, a = q(r, ["providerId"]);
359
+ return b(e.post(se(w.otp.signUpOrIn, n), { loginId: o, loginOptions: a, providerId: i }));
360
+ }) }), {}), update: { email: di((t, n, o, r) => b(e.post(w.otp.update.email, Object.assign({ loginId: t, email: n }, r), { token: o }))), phone: Object.keys(Ce).reduce((t, n) => Object.assign(Object.assign({}, t), { [n]: ci((o, r, i, a) => b(e.post(se(w.otp.update.phone, n), Object.assign({ loginId: o, phone: r }, a), { token: i }))) }), {}) } }), pi = j(F("tenant")), hi = j(F("code")), gi = (e) => ({ start: pi((t, n, o, r, i, a, l, s) => b(e.post(w.saml.start, o || {}, Object.assign({ queryParams: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ tenant: t }, n && { redirectURL: n }), i && { ssoId: i }), a && { forceAuthn: "true" }), l && { loginHint: l }), s && { initiatedEmail: t }) }, r && { token: r })))), exchange: hi((t) => b(e.post(w.saml.exchange, { code: t }))) }), Gt = F("loginId"), fi = j(Gt, F("code")), vi = j(Gt), mi = j(Gt), yi = (e) => ({ signUp: vi((t, n) => b(e.post(w.totp.signUp, { loginId: t, user: n }))), verify: fi((t, n, o, r) => b(e.post(w.totp.verify, { loginId: t, code: n, loginOptions: o }, { token: r }))), update: mi((t, n) => b(e.post(w.totp.update, { loginId: t }, { token: n }))) }), ft = F("loginId"), mo = F("newPassword"), Jn = j(ft, F("password")), wi = j(ft), bi = j(ft, mo), xi = j(ft, F("oldPassword"), mo), ki = (e) => ({ signUp: Jn((t, n, o, r = {}) => {
361
+ var { providerId: i } = r, a = q(r, ["providerId"]);
362
+ return b(e.post(w.password.signUp, { loginId: t, password: n, user: o, loginOptions: a, providerId: i }));
363
+ }), signIn: Jn((t, n, o = {}) => {
364
+ var { providerId: r } = o, i = q(o, ["providerId"]);
365
+ return b(e.post(w.password.signIn, { loginId: t, password: n, loginOptions: i, providerId: r }));
366
+ }), sendReset: wi((t, n, o) => b(e.post(w.password.sendReset, { loginId: t, redirectUrl: n, templateOptions: o }))), update: bi((t, n, o) => b(e.post(w.password.update, { loginId: t, newPassword: n }, { token: o }))), replace: xi((t, n, o) => b(e.post(w.password.replace, { loginId: t, oldPassword: n, newPassword: o }))), policy: () => b(e.get(w.password.policy)) }), Ii = po("loginId"), Zt = F("loginId"), vt = F("origin"), Si = j(Zt, vt, F("name")), Ci = j(Zt, vt), Oi = j(Ii, vt), Ai = j(Zt, vt, ho("token")), jt = j(F("transactionId"), F("response")), Ui = (e) => ({ signUp: { start: Si((t, n, o, r) => b(e.post(w.webauthn.signUp.start, { user: { loginId: t, name: o }, origin: n, passkeyOptions: r }))), finish: jt((t, n) => b(e.post(w.webauthn.signUp.finish, { transactionId: t, response: n }))) }, signIn: { start: Oi((t, n, o, r, i) => b(e.post(w.webauthn.signIn.start, { loginId: t, origin: n, loginOptions: o, passkeyOptions: i }, { token: r }))), finish: jt((t, n) => b(e.post(w.webauthn.signIn.finish, { transactionId: t, response: n }))) }, signUpOrIn: { start: Ci((t, n, o) => b(e.post(w.webauthn.signUpOrIn.start, { loginId: t, origin: n, passkeyOptions: o }))) }, update: { start: Ai((t, n, o, r) => b(e.post(w.webauthn.update.start, { loginId: t, origin: n, passkeyOptions: r }, { token: o }))), finish: jt((t, n) => b(e.post(w.webauthn.update.finish, { transactionId: t, response: n }))) } }), Ti = po("loginId"), Dt = j(Ti), Ei = j(F("pendingRef")), ji = (e) => ({ signUpOrIn: Dt((t, n = {}) => {
367
+ var { providerId: o } = n, r = q(n, ["providerId"]);
368
+ return b(e.post(w.notp.signUpOrIn, { loginId: t, loginOptions: r, providerId: o }));
369
+ }), signUp: Dt((t, n, o = {}) => {
370
+ var { providerId: r } = o, i = q(o, ["providerId"]);
371
+ return b(e.post(w.notp.signUp, { loginId: t, user: n, providerId: r, loginOptions: i }));
372
+ }), signIn: Dt((t, n = {}, o) => {
373
+ var { providerId: r } = n, i = q(n, ["providerId"]);
374
+ return b(e.post(w.notp.signIn, { loginId: t, loginOptions: i, providerId: r }, { token: o }));
375
+ }), waitForSession: Ei((t, n) => new Promise((o) => {
376
+ const { pollingIntervalMs: r, timeoutMs: i } = fo(n);
377
+ let a;
378
+ const l = setInterval(async () => {
379
+ const s = await e.post(w.notp.session, { pendingRef: t });
380
+ s.ok && (clearInterval(l), a && clearTimeout(a), o(b(Promise.resolve(s))));
381
+ }, r);
382
+ a = setTimeout(() => {
383
+ o({ error: { errorDescription: `Session polling timeout exceeded: ${i}ms`, errorCode: "0" }, ok: !1 }), clearInterval(l);
384
+ }, i);
385
+ })) }), We = j(F("token")), Ke = j(ho("token"));
386
+ var Mn, Wn, Di = j([(Mn = "projectId", Wn = F("projectId"), Oe(Fr(Mn, Wn))())])((e) => {
387
+ const { projectId: t, logger: n, baseUrl: o, cookiePolicy: r, baseHeaders: i = {}, refreshCookieName: a, fetch: l } = e;
388
+ return s = Ar({ baseUrl: o, projectId: t, logger: n, hooks: { get beforeRequest() {
389
+ var c;
390
+ return (c = e.hooks) === null || c === void 0 ? void 0 : c.beforeRequest;
391
+ }, get afterRequest() {
392
+ var c;
393
+ return (c = e.hooks) === null || c === void 0 ? void 0 : c.afterRequest;
394
+ }, get transformResponse() {
395
+ var c;
396
+ return (c = e.hooks) === null || c === void 0 ? void 0 : c.transformResponse;
397
+ } }, cookiePolicy: r, baseConfig: { baseHeaders: i }, refreshCookieName: a, fetch: l }), { accessKey: Kr(s), otp: ui(s), magicLink: ni(s), enchantedLink: Qr(s), oauth: ri(s), outbound: si(s), saml: gi(s), totp: yi(s), notp: ji(s), webauthn: Ui(s), password: ki(s), flow: Zr(s), refresh: Ke((c, u, p, f) => {
398
+ const x = {};
399
+ p && (x.externalToken = p);
400
+ const h = f ? w.tryRefresh : w.refresh;
401
+ return b(s.post(h, x, { token: c, queryParams: u }));
402
+ }), selectTenant: j([ze("tenantId")], [zt('"token" must be string or undefined')])((c, u) => b(s.post(w.selectTenant, { tenant: c }, { token: u }))), logout: Ke((c) => b(s.post(w.logout, {}, { token: c }))), logoutAll: Ke((c) => b(s.post(w.logoutAll, {}, { token: c }))), me: Ke((c) => b(s.get(w.me, { token: c }))), myTenants: j([Mr('"tenants" must a string array or a boolean')], [zt('"token" must be string or undefined')])((c, u) => {
403
+ const p = {};
404
+ return typeof c == "boolean" ? p.dct = c : p.ids = c, b(s.post(w.myTenants, p, { token: u }));
405
+ }), history: Ke((c) => b(s.get(w.history, { token: c }))), isJwtExpired: We(Tr), getTenants: We(Er), getJwtPermissions: We(jr), getJwtRoles: We(Dr), getCurrentTenant: We(Pr), httpClient: s };
406
+ var s;
407
+ }), Pi = Object.assign(Di, { DeliveryMethods: ye });
408
+ /*! js-cookie v3.0.5 | MIT */
409
+ function nt(e) {
410
+ for (var t = 1; t < arguments.length; t++) {
411
+ var n = arguments[t];
412
+ for (var o in n)
413
+ e[o] = n[o];
414
+ }
415
+ return e;
122
416
  }
123
- function Fs() {
124
- $(ti);
417
+ var Ri = {
418
+ read: function(e) {
419
+ return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
420
+ },
421
+ write: function(e) {
422
+ return encodeURIComponent(e).replace(
423
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
424
+ decodeURIComponent
425
+ );
426
+ }
427
+ };
428
+ function qt(e, t) {
429
+ function n(r, i, a) {
430
+ if (!(typeof document > "u")) {
431
+ a = nt({}, t, a), typeof a.expires == "number" && (a.expires = new Date(Date.now() + a.expires * 864e5)), a.expires && (a.expires = a.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
432
+ var l = "";
433
+ for (var s in a)
434
+ a[s] && (l += "; " + s, a[s] !== !0 && (l += "=" + a[s].split(";")[0]));
435
+ return document.cookie = r + "=" + e.write(i, r) + l;
436
+ }
437
+ }
438
+ function o(r) {
439
+ if (!(typeof document > "u" || arguments.length && !r)) {
440
+ for (var i = document.cookie ? document.cookie.split("; ") : [], a = {}, l = 0; l < i.length; l++) {
441
+ var s = i[l].split("="), c = s.slice(1).join("=");
442
+ try {
443
+ var u = decodeURIComponent(s[0]);
444
+ if (a[u] = e.read(c, u), r === u)
445
+ break;
446
+ } catch {
447
+ }
448
+ }
449
+ return r ? a[r] : a;
450
+ }
451
+ }
452
+ return Object.create(
453
+ {
454
+ set: n,
455
+ get: o,
456
+ remove: function(r, i) {
457
+ n(
458
+ r,
459
+ "",
460
+ nt({}, i, {
461
+ expires: -1
462
+ })
463
+ );
464
+ },
465
+ withAttributes: function(r) {
466
+ return qt(this.converter, nt({}, this.attributes, r));
467
+ },
468
+ withConverter: function(r) {
469
+ return qt(nt({}, this.converter, r), this.attributes);
470
+ }
471
+ },
472
+ {
473
+ attributes: { value: Object.freeze(t) },
474
+ converter: { value: Object.freeze(e) }
475
+ }
476
+ );
125
477
  }
126
- function Vs() {
127
- return x(ii);
478
+ var Le = qt(Ri, { path: "/" });
479
+ function Ni(e, t) {
480
+ return function(n, o) {
481
+ return Object.prototype.hasOwnProperty.call(n, o);
482
+ }(e, t) ? e[t] : void 0;
128
483
  }
129
- function Bs() {
130
- $(ii);
484
+ function Fi(e, t, n, o) {
485
+ var r, i = document, a = "securitypolicyviolation", l = function(c) {
486
+ var u = new URL(e, location.href), p = c.blockedURI;
487
+ p !== u.href && p !== u.protocol.slice(0, -1) && p !== u.origin || (r = c, s());
488
+ };
489
+ i.addEventListener(a, l);
490
+ var s = function() {
491
+ return i.removeEventListener(a, l);
492
+ };
493
+ return o == null || o.then(s, s), Promise.resolve().then(t).then(function(c) {
494
+ return s(), c;
495
+ }, function(c) {
496
+ return new Promise(function(u) {
497
+ var p = new MessageChannel();
498
+ p.port1.onmessage = function() {
499
+ return u();
500
+ }, p.port2.postMessage(null);
501
+ }).then(function() {
502
+ if (s(), r)
503
+ return n(r);
504
+ throw c;
505
+ });
506
+ });
131
507
  }
132
- function qs() {
133
- return x(ai);
508
+ var Li = { default: "endpoint" }, yo = "Blocked by CSP", wo = "The endpoint parameter is not a valid URL", zi = "API key required", Bi = "3.11.6", _t = "Failed to load the JS script of the agent", en = "9319";
509
+ function Hi(e, t) {
510
+ var n, o, r, i, a, l, s, c = [], u = (n = function(h) {
511
+ var m = gr([], h, !0);
512
+ return { current: function() {
513
+ return m[0];
514
+ }, postpone: function() {
515
+ var y = m.shift();
516
+ y !== void 0 && m.push(y);
517
+ }, exclude: function() {
518
+ m.shift();
519
+ } };
520
+ }(e), i = 100, a = 3e3, l = 0, o = function() {
521
+ return Math.random() * Math.min(a, i * Math.pow(2, l++));
522
+ }, r = /* @__PURE__ */ new Set(), [n.current(), function(h, m) {
523
+ var y, E = m instanceof Error ? m.message : "";
524
+ if (E === yo || E === wo)
525
+ n.exclude(), y = 0;
526
+ else if (E === en)
527
+ n.exclude();
528
+ else if (E === _t) {
529
+ var T = Date.now() - h.getTime() < 50, N = n.current();
530
+ N && T && !r.has(N) && (r.add(N), y = 0), n.postpone();
531
+ } else
532
+ n.postpone();
533
+ var D = n.current();
534
+ return D === void 0 ? void 0 : [D, y ?? h.getTime() + o() - Date.now()];
535
+ }]), p = u[0], f = u[1];
536
+ if (p === void 0)
537
+ return Promise.reject(new TypeError("The list of script URL patterns is empty"));
538
+ var x = function(h) {
539
+ var m = /* @__PURE__ */ new Date(), y = function(T) {
540
+ return c.push({ url: h, startedAt: m, finishedAt: /* @__PURE__ */ new Date(), error: T });
541
+ }, E = t(h);
542
+ return E.then(function() {
543
+ return y();
544
+ }, y), E.catch(function(T) {
545
+ if (s != null || (s = T), c.length >= 5)
546
+ throw s;
547
+ var N = f(m, T);
548
+ if (!N)
549
+ throw s;
550
+ var D, v = N[0], A = N[1];
551
+ return (D = A, new Promise(function(B) {
552
+ return setTimeout(B, D);
553
+ })).then(function() {
554
+ return x(v);
555
+ });
556
+ });
557
+ };
558
+ return x(p).then(function(h) {
559
+ return [h, c];
560
+ });
134
561
  }
135
- function Ks() {
136
- $(ai);
562
+ var bo = "https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js", qi = bo;
563
+ function Ji(e) {
564
+ var t;
565
+ e.scriptUrlPattern;
566
+ var n = e.token, o = e.apiKey, r = o === void 0 ? n : o, i = q(e, ["scriptUrlPattern", "token", "apiKey"]), a = (t = Ni(e, "scriptUrlPattern")) !== null && t !== void 0 ? t : bo, l = function() {
567
+ var u = [], p = function() {
568
+ u.push({ time: /* @__PURE__ */ new Date(), state: document.visibilityState });
569
+ }, f = function(x, h, m, y) {
570
+ return x.addEventListener(h, m, y), function() {
571
+ return x.removeEventListener(h, m, y);
572
+ };
573
+ }(document, "visibilitychange", p);
574
+ return p(), [u, f];
575
+ }(), s = l[0], c = l[1];
576
+ return Promise.resolve().then(function() {
577
+ if (!r || typeof r != "string")
578
+ throw new Error(zi);
579
+ var u = function(p, f) {
580
+ return (Array.isArray(p) ? p : [p]).map(function(x) {
581
+ return function(h, m) {
582
+ var y = encodeURIComponent;
583
+ return h.replace(/<[^<>]+>/g, function(E) {
584
+ return E === "<version>" ? "3" : E === "<apiKey>" ? y(m) : E === "<loaderVersion>" ? y(Bi) : E;
585
+ });
586
+ }(String(x), f);
587
+ });
588
+ }(a, r);
589
+ return Hi(u, Mi);
590
+ }).catch(function(u) {
591
+ throw c(), function(p) {
592
+ return p instanceof Error && p.message === en ? new Error(_t) : p;
593
+ }(u);
594
+ }).then(function(u) {
595
+ var p = u[0], f = u[1];
596
+ return c(), p.load(ct(ct({}, i), { ldi: { attempts: f, visibilityStates: s } }));
597
+ });
137
598
  }
138
- function Hs() {
139
- return x(si);
599
+ function Mi(e) {
600
+ return Fi(e, function() {
601
+ return function(t) {
602
+ return new Promise(function(n, o) {
603
+ if (function(l) {
604
+ if (URL.prototype)
605
+ try {
606
+ return new URL(l, location.href), !1;
607
+ } catch (s) {
608
+ if (s instanceof Error && s.name === "TypeError")
609
+ return !0;
610
+ throw s;
611
+ }
612
+ }(t))
613
+ throw new Error(wo);
614
+ var r = document.createElement("script"), i = function() {
615
+ var l;
616
+ return (l = r.parentNode) === null || l === void 0 ? void 0 : l.removeChild(r);
617
+ }, a = document.head || document.getElementsByTagName("head")[0];
618
+ r.onload = function() {
619
+ i(), n();
620
+ }, r.onerror = function() {
621
+ i(), o(new Error(_t));
622
+ }, r.async = !0, r.src = t, a.appendChild(r);
623
+ });
624
+ }(e);
625
+ }, function() {
626
+ throw new Error(yo);
627
+ }).then(Wi);
140
628
  }
141
- function Gs() {
142
- $(si);
629
+ function Wi() {
630
+ var e = window, t = "__fpjs_p_l_b", n = e[t];
631
+ if (function(o, r) {
632
+ var i, a = (i = Object.getOwnPropertyDescriptor) === null || i === void 0 ? void 0 : i.call(Object, o, r);
633
+ a != null && a.configurable ? delete o[r] : a && !a.writable || (o[r] = void 0);
634
+ }(e, t), typeof (n == null ? void 0 : n.load) != "function")
635
+ throw new Error(en);
636
+ return n;
143
637
  }
144
- function Js() {
145
- return x(oi);
638
+ const xo = "3.2.0", te = typeof window < "u", Pt = Math.pow(2, 31) - 1, Ki = `https://descopecdn.com/npm/oidc-client-ts@${xo}/dist/browser/oidc-client-ts.min.js`, Vi = `https://cdn.jsdelivr.net/npm/oidc-client-ts@${xo}/dist/browser/oidc-client-ts.min.js`, $i = ["/v1/auth/refresh", "/v1/auth/try-refresh", "/v1/auth/me", "/v1/auth/me/tenants", "/v1/auth/me/history"];
639
+ let ge;
640
+ const ko = (e) => {
641
+ try {
642
+ return Yt(e).exp;
643
+ } catch {
644
+ return null;
645
+ }
646
+ }, Yi = (e) => {
647
+ const { refresh_expire_in: t, refresh_token: n } = e;
648
+ return t ? Math.floor(Date.now() / 1e3) + t : ko(n);
649
+ }, Qi = (e) => {
650
+ const { expires_in: t, expires_at: n, access_token: o } = e;
651
+ return n || (t ? Math.floor(Date.now() / 1e3) + t : o ? ko(o) : void 0);
652
+ }, Io = (e) => {
653
+ const { access_token: t, id_token: n, refresh_token: o, refresh_expire_in: r } = e, i = q(e, ["access_token", "id_token", "refresh_token", "refresh_expire_in"]);
654
+ return Object.assign({ sessionJwt: e.sessionJwt || t, idToken: n, refreshJwt: e.refreshJwt || o, sessionExpiration: e.sessionExpiration || Qi(e), cookieExpiration: e.cookieExpiration || Yi(e) }, i);
655
+ }, Pe = (e, t) => {
656
+ var n;
657
+ return ["beforeRequest", "afterRequest"].reduce((o, r) => {
658
+ var i;
659
+ return o[r] = [].concat(((i = e.hooks) === null || i === void 0 ? void 0 : i[r]) || []).concat((t == null ? void 0 : t[r]) || []), o;
660
+ }, (n = e.hooks) !== null && n !== void 0 ? n : e.hooks = {}), e;
661
+ }, ot = async (e) => {
662
+ if (!(e != null && e.ok))
663
+ return {};
664
+ const t = await (e == null ? void 0 : e.clone().json()), n = (t == null ? void 0 : t.authInfo) || t || {};
665
+ return Io(n);
666
+ }, Jt = () => te && !!window.descopeBridge, Rt = (e, t) => {
667
+ if (!((t == null ? void 0 : t.status) >= 400 && (t == null ? void 0 : t.status) < 500))
668
+ return !1;
669
+ const n = (e == null ? void 0 : e.path) || "";
670
+ return $i.includes(n);
671
+ }, Xi = ge !== void 0 || te && window.localStorage !== void 0, he = (e, t) => {
672
+ var n, o;
673
+ return (o = (n = ge || te && window.localStorage) === null || n === void 0 ? void 0 : n.setItem) === null || o === void 0 ? void 0 : o.call(n, e, t);
674
+ }, ue = (e) => {
675
+ var t, n;
676
+ return (n = (t = ge || te && window.localStorage) === null || t === void 0 ? void 0 : t.getItem) === null || n === void 0 ? void 0 : n.call(t, e);
677
+ }, re = (e) => {
678
+ var t, n;
679
+ return (n = (t = ge || te && window.localStorage) === null || t === void 0 ? void 0 : t.removeItem) === null || n === void 0 ? void 0 : n.call(t, e);
680
+ }, Gi = (e) => {
681
+ var t, n, o, r, i;
682
+ return (i = (n = (t = ge == null ? void 0 : ge.key) === null || t === void 0 ? void 0 : t.call(ge, e)) !== null && n !== void 0 ? n : te && ((r = (o = window.localStorage) === null || o === void 0 ? void 0 : o.key) === null || r === void 0 ? void 0 : r.call(o, e))) !== null && i !== void 0 ? i : null;
683
+ }, M = (...e) => {
684
+ console.debug(...e);
685
+ }, rt = (...e) => {
686
+ console.warn(...e);
687
+ }, Zi = (e, t) => {
688
+ let n;
689
+ var o;
690
+ return t > 0 ? (n = 1e3 * t, M(`Using provided nextRefreshSeconds: ${t}s`)) : n = ((o = e) ? o.getTime() - (/* @__PURE__ */ new Date()).getTime() : 0) - 2e4, n > Pt && (M(`Timeout is too large (${n}ms), setting it to ${Pt}ms`), n = Pt), n;
691
+ }, mt = "DS", Xe = "DSR", tn = "DSI", dt = "DSRCN";
692
+ function Kn(e, t, n) {
693
+ if (t) {
694
+ const { cookieDomain: o, cookiePath: r, cookieSameSite: i, cookieExpiration: a, cookieSecure: l } = n, s = new Date(1e3 * a), c = Mt(o);
695
+ Le.set(e, t, { path: r, domain: c ? o : void 0, expires: s, sameSite: i, secure: l });
696
+ }
146
697
  }
147
- function zs() {
148
- $(oi);
698
+ function Mt(e) {
699
+ const t = window.location.hostname.split("."), n = e == null ? void 0 : e.split(".");
700
+ return t.slice(-(n == null ? void 0 : n.length)).join(".") === e;
149
701
  }
150
- function Ys() {
151
- return x(ri);
702
+ const nn = (e) => (e == null ? void 0 : e.cookieName) || mt, ut = (e) => (e == null ? void 0 : e.cookieName) || Xe;
703
+ function Ne(e = "", t) {
704
+ return Le.get(ut(t)) || ue(`${e}${Xe}`) || "";
152
705
  }
153
- function Qs() {
154
- $(ri);
706
+ function Vn(e = "", t) {
707
+ return Le.get(nn(t)) || ue(`${e}${mt}`) || "";
155
708
  }
156
- function Xs() {
157
- return x(ni);
709
+ function So(e = "") {
710
+ return ue(`${e}${tn}`) || "";
158
711
  }
159
- function Zs() {
160
- $(ni);
712
+ function Co(e = "", t, n, o) {
713
+ re(`${e}${Xe}`), re(`${e}${mt}`), re(`${e}${tn}`), re(`${e}${dt}`);
714
+ const r = nn(t);
715
+ Le.remove(r, o == null ? void 0 : o.session);
716
+ const i = ut(n);
717
+ Le.remove(i, o == null ? void 0 : o.refresh);
161
718
  }
162
- const ui = (i) => i.replace(/-./g, ((e) => e[1].toUpperCase())), eo = (i, e) => (t) => i[t] !== e[t], to = (i) => Array.from((i == null ? void 0 : i.attributes) || []).reduce(((e, t) => {
163
- var s;
164
- const o = (s = new RegExp(`^${ds}(\\S+)$`).exec(t.name)) === null || s === void 0 ? void 0 : s[1];
165
- return o ? Object.assign(e, { [o]: t.value }) : e;
166
- }), {}), io = (i, e) => {
167
- const { executionId: t, stepId: s, executionFlowId: o } = ci(i);
168
- if (o && i !== o) return e.debug("Flow id does not match the execution flow id, skipping url params handling"), { ssoQueryParams: {} };
169
- (t || s) && di();
170
- const n = Cs();
171
- n && Ss();
172
- const a = ks();
173
- a && xs();
174
- const l = As();
175
- l && Is();
176
- const d = Es();
177
- d && _s();
178
- const { redirectAuthCodeChallenge: u, redirectAuthCallbackUrl: c, redirectAuthBackupCallbackUri: h, redirectAuthInitiator: p } = $s(), f = Os();
179
- f && Us();
180
- const m = Ms();
181
- m && Rs();
182
- const A = js();
183
- m && Ts();
184
- const C = Ls();
185
- C && Ws();
186
- const g = Ps();
187
- g && Ds();
188
- const v = Ns();
189
- v && Fs();
190
- const b = Vs();
191
- b && Bs();
192
- const k = qs();
193
- k && Ks();
194
- const T = Hs();
195
- T && Gs();
196
- const L = Js();
197
- L && zs();
198
- const P = Ys();
199
- P && Qs();
200
- const D = Xs();
201
- return D && Zs(), { executionId: t, stepId: s, token: n, code: a, isPopup: l, exchangeError: d, redirectAuthCodeChallenge: u, redirectAuthCallbackUrl: c, redirectAuthBackupCallbackUri: h, redirectAuthInitiator: p, ssoQueryParams: { oidcIdpStateId: f, samlIdpStateId: m, samlIdpUsername: A, descopeIdpInitiated: C === "true", ssoAppId: g, oidcLoginHint: T, oidcPrompt: L, oidcErrorRedirectUri: P, oidcResource: D, thirdPartyAppId: v, thirdPartyAppStateId: b, applicationScopes: k } };
202
- }, hi = (i) => {
203
- let e, t;
204
- return Object.assign(((...s) => {
205
- return e && (n = s, (o = e).length === n.length && o.every(((a, l) => a === n[l]))) || (e = s, t = i(...s)), t;
206
- var o, n;
207
- }), { reset: () => {
208
- e = void 0, t = void 0;
209
- } });
210
- }, so = '*[name]:not([auto-focus="false"]):not([aria-hidden="true"])', pi = (i, e, t) => {
211
- if (e === !0 || e === "skipFirstScreen" && !t) {
212
- const s = i.querySelector(so);
213
- setTimeout((() => {
214
- s == null || s.focus();
215
- }));
719
+ const _i = (e, t, n) => (o) => {
720
+ const r = Object.assign(o, { token: o.token || Ne(e, t) });
721
+ if (!n) {
722
+ const a = function(l = "") {
723
+ return ue(`${l}${dt}`);
724
+ }(e);
725
+ a && (r.headers = Object.assign(Object.assign({}, r.headers || {}), { "x-descope-refresh-cookie-name": a }));
726
+ }
727
+ const i = function(a = "") {
728
+ return ue(`${a}DTD`) || "";
729
+ }(e);
730
+ return i && (r.headers = Object.assign(Object.assign({}, r.headers || {}), { "x-descope-trusted-device-token": i })), r;
731
+ }, ea = te && (localStorage == null ? void 0 : localStorage.getItem("fingerprint.endpoint.url")) || "https://api.descope.com", ta = "vsid", na = "vrid", on = "fp", Oo = (e = !1) => {
732
+ const t = ue(on);
733
+ if (!t)
734
+ return null;
735
+ const n = JSON.parse(t);
736
+ return (/* @__PURE__ */ new Date()).getTime() > n.expiry && !e ? null : n.value;
737
+ }, oa = async (e, t = ea) => {
738
+ try {
739
+ if (Oo())
740
+ return;
741
+ const n = (Date.now().toString(36) + Math.random().toString(36).substring(2) + Math.random().toString(36).substring(2)).substring(0, 27), o = new URL(t);
742
+ o.pathname = "/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";
743
+ const r = new URL(t);
744
+ r.pathname = "/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";
745
+ const i = r.toString() + "?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>", a = Ji({ apiKey: e, endpoint: [o.toString(), Li], scriptUrlPattern: [i, qi] }), l = await a, { requestId: s } = await l.get({ linkedId: n }), c = ((u, p) => ({ [ta]: u, [na]: p }))(n, s);
746
+ ((u) => {
747
+ const p = { value: u, expiry: (/* @__PURE__ */ new Date()).getTime() + 864e5 };
748
+ he(on, JSON.stringify(p));
749
+ })(c);
750
+ } catch (n) {
751
+ console.warn("Could not load fingerprint", n);
752
+ }
753
+ }, Ha = () => {
754
+ re(on);
755
+ }, ra = (e) => {
756
+ const t = Oo(!0);
757
+ return t && e.body && (e.body.fpData = t), e;
758
+ }, Fe = "descopeFlowNonce", $n = "X-Descope-Flow-Nonce", Yn = "/v1/flow/start", Wt = "/v1/flow/next", Kt = (e, t = Fe) => `${t}${e}`, ia = (e, t = Fe) => {
759
+ try {
760
+ const n = Kt(e, t);
761
+ re(n);
762
+ } catch (n) {
763
+ console.error("Error removing flow nonce:", n);
216
764
  }
217
- }, oo = (i) => {
218
- i.querySelectorAll("*[name]").forEach(((e) => {
219
- e.addEventListener("blur", (() => {
220
- var t;
221
- const s = () => {
222
- var a;
223
- const l = e.focus;
224
- e.focus = () => {
225
- }, (a = e.reportValidity) === null || a === void 0 || a.call(e), setTimeout((() => {
226
- e.focus = l;
227
- }));
228
- };
229
- if (e.getAttribute("invalid") === "true" || !((t = e.value) === null || t === void 0) && t.length) return void s();
230
- const o = { timer: void 0 }, n = (a) => {
231
- a.target.getAttribute("formnovalidate") === "true" && (clearTimeout(o.timer), o.timer = void 0);
232
- };
233
- o.timer = setTimeout((() => {
234
- i.removeEventListener("click", n), s(), o.timer = void 0;
235
- }), 150), i.addEventListener("click", n, { once: !0 });
236
- }));
237
- }));
765
+ }, Ao = (e) => {
766
+ var t;
767
+ return ((t = /.*\|#\|(.*)/.exec(e)) === null || t === void 0 ? void 0 : t[1]) || null;
768
+ }, Qn = (e) => {
769
+ var t;
770
+ return e.path === Wt && (!((t = e.body) === null || t === void 0) && t.executionId) ? Ao(e.body.executionId) : null;
771
+ }, rn = "dls_last_user_login_id", an = "dls_last_user_display_name", Xn = (e) => he(rn, e), Vt = () => ue(rn), $t = () => ue(an), aa = (e) => async (...t) => {
772
+ var n;
773
+ t[1] = t[1] || {};
774
+ const [, o = {}] = t, r = Vt(), i = $t();
775
+ return r && ((n = o.lastAuth) !== null && n !== void 0 || (o.lastAuth = {}), o.lastAuth.loginId = r, o.lastAuth.name = i), await e(...t);
776
+ }, sa = (e) => (t) => async (...n) => {
777
+ const o = await t(...n);
778
+ return e || (re(rn), re(an)), o;
238
779
  };
239
- function lt(i, e, t) {
240
- return new Promise(((s, o) => {
241
- let n = !1;
242
- const a = setTimeout((() => {
243
- n = !0, t !== void 0 ? s(t) : o(new Error(`Promise timed out after ${i} ms`));
244
- }), i);
245
- e.then(((l) => {
246
- n || (clearTimeout(a), s(l));
247
- })).catch(((l) => {
248
- n || (clearTimeout(a), o(l));
249
- }));
250
- }));
780
+ function it() {
781
+ const e = [];
782
+ return { pub: (t) => {
783
+ e.forEach((n) => n(t));
784
+ }, sub: (t) => {
785
+ const n = e.push(t) - 1;
786
+ return () => e.splice(n, 1);
787
+ } };
251
788
  }
252
- const no = () => {
253
- var i;
254
- const e = (i = navigator == null ? void 0 : navigator.userAgentData) === null || i === void 0 ? void 0 : i.brands, t = e == null ? void 0 : e.find((({ brand: s, version: o }) => s === "Chromium" && parseFloat(o)));
255
- return t ? t.version : 0;
256
- }, Et = (i, { oidcIdpStateId: e, samlIdpStateId: t, samlIdpUsername: s, ssoAppId: o, oidcLoginHint: n, oidcPrompt: a, oidcErrorRedirectUri: l, oidcResource: d, thirdPartyAppId: u, thirdPartyAppStateId: c, applicationScopes: h }) => !(!i || e || t || s || o || n || a || l || d || u || c || h), ro = (i, e, t, s) => {
257
- const o = document.createElement("form");
258
- o.method = "POST", o.action = i, o.innerHTML = `
259
- <input type="hidden" role="saml-response" name="SAMLResponse" value="${e}" />
260
- <input type="hidden" role="saml-relay-state" name="RelayState" value="${t}" />
261
- <input style="display: none;" id="SAMLSubmitButton" type="submit" value="Continue" />
262
- `, document.body.appendChild(o), s(o);
263
- }, ao = (i) => i == null ? void 0 : i.submit(), xt = (i, e) => {
264
- const t = e.find(((s) => i[s]));
265
- return t ? i[t] : null;
266
- }, lo = (i, e = 100) => {
267
- let t;
268
- return function(...s) {
269
- t || i.apply(this, s), clearTimeout(t), t = setTimeout((() => {
270
- t = null;
271
- }), e);
272
- };
789
+ const la = (e, t, n, o) => (r) => async (...i) => {
790
+ const a = await r(...i);
791
+ return Co(e, t, n, o == null ? void 0 : o()), a;
273
792
  };
274
- function qe(i) {
275
- if (i) return { locale: i.toLowerCase(), fallback: i.toLowerCase() };
276
- const e = navigator.language;
277
- return e ? e.includes("-") ? { locale: e.toLowerCase(), fallback: e.split("-")[0].toLowerCase() } : { locale: e.toLowerCase(), fallback: e.toLowerCase() } : { locale: "", fallback: "" };
793
+ async function at(e) {
794
+ const t = function(r) {
795
+ var i;
796
+ const a = JSON.parse(r);
797
+ return a.publicKey.challenge = Qe(a.publicKey.challenge), a.publicKey.user.id = Qe(a.publicKey.user.id), (i = a.publicKey.excludeCredentials) === null || i === void 0 || i.forEach((l) => {
798
+ l.id = Qe(l.id);
799
+ }), a;
800
+ }(e);
801
+ return o = await navigator.credentials.create(t), JSON.stringify({ id: o.id, rawId: Ie(o.rawId), type: o.type, response: { attestationObject: Ie(o.response.attestationObject), clientDataJSON: Ie(o.response.clientDataJSON) } });
802
+ var o;
278
803
  }
279
- const co = () => {
280
- document.querySelectorAll('[data-hidden-input="true"]').forEach(((i) => i.remove()));
281
- }, uo = (i) => fs.includes(i), ho = (i) => {
282
- var e, t, s;
283
- const o = (n = i.screenState, a = (u, c) => gs.includes(c) || c.startsWith("_"), Object.fromEntries(Object.entries(n).filter((([u, c]) => !a(c, u)))));
284
- var n, a;
285
- const { screenState: { errorText: l, errorType: d } } = i;
286
- return (l || d) && (o.error = { text: l, type: d }), i.action && (o.action = i.action), !((s = (t = (e = i.screenState) === null || e === void 0 ? void 0 : e.componentsConfig) === null || t === void 0 ? void 0 : t.thirdPartyAppApproveScopes) === null || s === void 0) && s.data && (o.inboundAppApproveScopes = i.screenState.componentsConfig.thirdPartyAppApproveScopes.data), o;
287
- }, It = (i) => {
288
- const e = Object.assign({}, i);
289
- return i.inboundAppApproveScopes && (e.thirdPartyAppApproveScopes = i.inboundAppApproveScopes), e;
290
- };
291
- function po(i, e) {
292
- return `${us}.${e ? `${i}_${e}` : i}`;
804
+ async function Nt(e) {
805
+ const t = To(e);
806
+ return Eo(await navigator.credentials.get(t));
293
807
  }
294
- const go = (i, e, t, s) => {
295
- const o = window.screenLeft !== void 0 ? window.screenLeft : window.screen.left, n = window.screenTop !== void 0 ? window.screenTop : window.screen.top, a = ((window.innerWidth || document.documentElement.clientWidth || window.screen.width) - t) / 2 + o, l = ((window.innerHeight || document.documentElement.clientHeight || window.screen.height) - s) / 2 + n, d = (function() {
296
- const c = navigator.userAgent || "", h = /\b(iPhone)\b/.test(c), p = /Safari/.test(c) && !/CriOS|FxiOS|OPiOS|EdgiOS|Chrome|Chromium/.test(c);
297
- return h && p;
298
- })() ? "about:blank" : "", u = window.open(d, e, `width=${t},height=${s},top=${l},left=${a},scrollbars=yes,resizable=yes`);
299
- return u.location.href = i, u.focus(), u;
300
- };
301
- var K, ie, re, ge;
302
- function gi(i, e) {
303
- const t = Object.getOwnPropertyNames(i), s = Object.getOwnPropertyNames(e);
304
- if (t.length !== s.length) return !1;
305
- for (let o = 0; o < t.length; o += 1) {
306
- const n = t[o], a = i[n], l = e[n];
307
- if (a === null || l === null) {
308
- if (a !== l) return !1;
309
- } else if (typeof a == "object" && typeof l == "object") {
310
- if (!gi(a, l)) return !1;
311
- } else if (a !== l) return !1;
312
- }
313
- return !0;
808
+ async function ca(e, t) {
809
+ const n = To(e);
810
+ return n.signal = t.signal, n.mediation = "conditional", Eo(await navigator.credentials.get(n));
314
811
  }
315
- let we = class {
316
- constructor(e = {}, { forceUpdate: t = !1 } = {}) {
317
- K.set(this, void 0), ie.set(this, {}), re.set(this, 0), ge.set(this, !0), this.update = (s) => {
318
- const o = typeof s == "function" ? s(r(this, K, "f")) : s, n = Object.assign(Object.assign({}, r(this, K, "f")), o), a = r(this, K, "f");
319
- S(this, K, n, "f"), Object.freeze(r(this, K, "f")), setTimeout((() => {
320
- Object.values(r(this, ie, "f")).forEach((({ cb: l, selector: d, forceUpdate: u }) => {
321
- const c = d(a), h = d(n);
322
- (r(this, ge, "f") || u || ((function(p) {
323
- if (typeof p != "object" || p === null) return !1;
324
- const f = Object.getPrototypeOf(p);
325
- return f === Object.prototype || f === null;
326
- })(h) ? !gi(c, h) : c !== h)) && l(h, c, eo(h, c));
327
- }));
328
- }), 0);
329
- }, S(this, K, e, "f"), S(this, ge, t, "f");
330
- }
331
- get current() {
332
- return Object.assign({}, r(this, K, "f"));
333
- }
334
- set forceUpdate(e) {
335
- S(this, ge, e, "f");
336
- }
337
- subscribe(e, t = (o) => o, { forceUpdate: s = !1 } = {}) {
338
- return S(this, re, r(this, re, "f") + 1, "f"), r(this, ie, "f")[r(this, re, "f")] = { cb: e, selector: t, forceUpdate: s }, r(this, re, "f").toString();
339
- }
340
- unsubscribe(e) {
341
- const t = !!r(this, ie, "f")[e];
342
- return t && delete r(this, ie, "f")[e], t;
343
- }
344
- unsubscribeAll() {
345
- return S(this, ie, {}, "f"), !0;
346
- }
347
- };
348
- K = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap();
349
- const fo = ["*", "#", "/", "(", ")", "[", "]", "_", "<", ">", "`"], mo = (i) => {
350
- const e = fo.map(((t) => `${i}${t}`)).join("|");
351
- return new RegExp(`(${e})`, "g");
352
- }, vo = (i) => typeof i != "string" ? i : i.replace(mo("\\"), "\\$1"), bo = ["disabled"], wo = (i, e, t = "") => {
353
- i.querySelectorAll(`[${De}="${e}"]`).forEach(((s) => {
354
- s.textContent = t, s.classList[t ? "remove" : "add"]("hide");
355
- }));
356
- }, _t = (i, e) => {
357
- Object.entries(e || {}).forEach((([t, s]) => {
358
- Array.from(i.querySelectorAll(`*[name="${t}"]:not([${at}])`)).forEach(((o) => {
359
- o.value = s;
360
- }));
361
- }));
362
- }, $t = (i, e) => e.split(".").reduce(((t, s) => (t == null ? void 0 : t[s]) || ""), i), Ke = (i, e, t) => i.replace(/{{(.+?)}}/g, ((s, o) => t ? vo($t(e, o)) : $t(e, o))), Ot = (i, e, t) => {
363
- i.querySelectorAll(`[${De}="${e}"]`).forEach(((s) => {
364
- s.setAttribute("href", t);
365
- }));
366
- }, yo = (i, e, t, s) => {
367
- t && Object.keys(t).forEach(((o) => {
368
- if (!e.querySelector(o)) return void s.debug(`Skipping css vars for component "${o}"`, `Got css vars for component ${o} but Could not find it on next page`);
369
- const n = customElements.get(o);
370
- n ? Object.keys(t[o]).forEach(((a) => {
371
- var l;
372
- const d = t[o], u = (l = n == null ? void 0 : n.cssVarList) === null || l === void 0 ? void 0 : l[a];
373
- if (!u) return void s.info(`Could not find css variable name for ${a} in ${o}`, "Check if the css variable is defined in the component");
374
- const c = d[a];
375
- i.style.setProperty(u, c);
376
- })) : s.debug(`Could not find component class for ${o}`, "Check if the component is registered");
377
- }));
378
- }, fi = (i, e, t) => {
379
- var s, o;
380
- const n = (s = customElements.get(e)) === null || s === void 0 ? void 0 : s.cssVarList.url;
381
- t && n && ((o = i == null ? void 0 : i.style) === null || o === void 0 || o.setProperty(n, `url(data:image/jpg;base64,${t})`));
382
- }, Co = (i, e, t, s) => {
383
- var o, n;
384
- Ot(i, "totp-link", (o = e == null ? void 0 : e.totp) === null || o === void 0 ? void 0 : o.provisionUrl), Ot(i, "notp-link", (n = e == null ? void 0 : e.notp) === null || n === void 0 ? void 0 : n.redirectUrl), ((a, l) => {
385
- a.querySelectorAll("descope-text,descope-link,descope-enriched-text,descope-code-snippet").forEach(((d) => {
386
- const u = uo(d.localName);
387
- d.textContent = Ke(d.textContent, l, u);
388
- const c = d.getAttribute("href");
389
- c && d.setAttribute("href", Ke(c, l));
390
- }));
391
- })(i, e), ((a, l, d) => {
392
- if (!l) return;
393
- const { componentsDynamicAttrs: u } = l, c = be(l, ["componentsDynamicAttrs"]), h = Object.keys(c).reduce(((p, f) => (p[`[name=${f}]`] = c[f], p)), {});
394
- u && Object.keys(u).forEach(((p) => {
395
- const f = u[p];
396
- if (f) {
397
- const { attributes: m } = f;
398
- m && Object.keys(m).length && (h[p] = m);
399
- }
400
- })), Object.keys(h).forEach(((p) => {
401
- a.querySelectorAll(p).forEach(((f) => {
402
- const m = h[p];
403
- Object.keys(m).forEach(((A) => {
404
- let C = m[A];
405
- if (typeof C != "string") try {
406
- C = JSON.stringify(C);
407
- } catch (g) {
408
- d.error(`Could not stringify value "${C}" for "${A}"`, g.message), C = "";
409
- }
410
- f.setAttribute(A, C);
411
- }));
412
- }));
413
- }));
414
- })(i, e == null ? void 0 : e.componentsConfig, s), ((a, l) => {
415
- a.querySelectorAll(`[${hs}]`).forEach(((d) => {
416
- Array.from(d.attributes).forEach(((u) => {
417
- u.value = Ke(u.value, l);
418
- }));
419
- }));
420
- })(i, e), ((a, l) => {
421
- Object.entries(l).forEach((([d, u]) => {
422
- a.querySelectorAll(`[name="${d}"]`).forEach(((c) => {
423
- Object.entries(u).forEach((([h, p]) => {
424
- bo.includes(h) && c.setAttribute(h, p);
425
- }));
426
- }));
427
- }));
428
- })(i, t), ((a, l = {}, d) => {
429
- Object.entries(l).forEach((([u, c]) => {
430
- a.querySelectorAll(`[id="${CSS.escape(u)}"]`).forEach(((h) => {
431
- switch (c) {
432
- case "disable":
433
- h.setAttribute("disabled", "true");
434
- break;
435
- case "hide":
436
- h.classList.add("hidden");
437
- break;
438
- default:
439
- d == null || d.error(`Unknown component state "${c}" for component with id "${u}"`, 'Valid states are "disable" and "hide"');
440
- }
441
- }));
442
- }));
443
- })(i, e == null ? void 0 : e.componentsState, s);
444
- }, So = (i, e) => {
445
- _t(i, e == null ? void 0 : e.inputs), _t(i, e == null ? void 0 : e.form);
446
- }, ko = (i, e) => {
447
- fi(i, "descope-totp-image", e);
448
- }, Ao = (i, e) => {
449
- fi(i, "descope-notp-image", e);
450
- }, Eo = (i, e) => {
451
- Array.from(i.querySelectorAll('[default-code="autoDetect"]')).forEach(((t) => {
452
- t.setAttribute("default-code", e);
453
- }));
454
- }, xo = (i) => {
455
- i.querySelectorAll(`descope-button[${De}="biometrics"]`).forEach(((e) => e.setAttribute("disabled", "true")));
456
- }, Io = hi((() => y(void 0, void 0, void 0, (function* () {
457
- var i, e;
458
- if (!window.PublicKeyCredential || !PublicKeyCredential.isConditionalMediationAvailable || !PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable) return !1;
459
- try {
460
- const t = Promise.all([(i = window.PublicKeyCredential) === null || i === void 0 ? void 0 : i.isConditionalMediationAvailable(), (e = window.PublicKeyCredential) === null || e === void 0 ? void 0 : e.isUserVerifyingPlatformAuthenticatorAvailable()]).then(((o) => o.every(((n) => !!n)))), s = no() >= 108;
461
- return yield lt(100, t, s);
462
- } catch (t) {
463
- return console.error("Conditional login check failed", t), !1;
464
- }
465
- }))));
466
- let Se;
467
- const mi = (i, e) => {
468
- Se ? Se.setItem(i, e) : (window == null ? void 0 : window.localStorage) !== void 0 && window.localStorage.setItem(i, e);
469
- }, vi = (i) => Se ? Se.getItem(i) : (window == null ? void 0 : window.localStorage) !== void 0 ? window.localStorage.getItem(i) : null, _o = (i) => {
470
- Se = i;
471
- }, Ut = "dls_ab_testing_id", $o = () => {
472
- const i = vi(Ut);
473
- if (!i) {
474
- const e = Math.floor(100 * Math.random() + 1);
475
- return mi(Ut, e.toString()), e;
476
- }
477
- return Number(i);
478
- }, bi = { "lastAuth.loginId": { "not-empty": (i) => {
479
- var e;
480
- return !!i.loginId || !!(!((e = i.lastAuth) === null || e === void 0) && e.loginId);
481
- }, empty: (i) => {
482
- var e;
483
- return !i.loginId && !(!((e = i.lastAuth) === null || e === void 0) && e.loginId);
484
- } }, idpInitiated: { "is-true": (i) => !!i.code, "is-false": (i) => !i.code }, externalToken: { "is-true": (i) => !!i.token, "is-false": (i) => !i.token }, abTestingKey: { "greater-than": (i, e) => (i.abTestingKey || 0) > e, "less-than": (i, e) => (i.abTestingKey || 0) < e, "greater-than-or-equal": (i, e) => (i.abTestingKey || 0) >= e, "less-than-or-equal": (i, e) => (i.abTestingKey || 0) <= e, "in-range": (i, e) => {
485
- const [t, s] = e ? e.split(",").map(Number) : [void 0, void 0];
486
- return (i.abTestingKey || 0) >= (t ?? 0) && (i.abTestingKey || 0) <= (s ?? 0);
487
- }, "not-in-range": (i, e) => {
488
- const [t, s] = e ? e.split(",").map(Number) : [void 0, void 0];
489
- return !(t !== void 0 && s !== void 0 && !Number.isNaN(t) && !Number.isNaN(s)) || (i.abTestingKey || 0) < t || (i.abTestingKey || 0) > s;
490
- }, "devised-by": (i, e) => {
491
- const t = Number(e);
492
- return !Number.isNaN(t) && (i.abTestingKey || 0) % t == 0;
493
- } } }, Oo = (i, e) => {
812
+ async function Uo(e = !1) {
813
+ var t, n;
814
+ if (!te)
815
+ return Promise.resolve(!1);
816
+ if (Jt()) {
817
+ const r = (n = (t = window.descopeBridge) === null || t === void 0 ? void 0 : t.hostInfo) === null || n === void 0 ? void 0 : n.webauthn;
818
+ if (typeof r == "boolean")
819
+ return r;
820
+ }
821
+ const o = !!(window.PublicKeyCredential && navigator.credentials && navigator.credentials.create && navigator.credentials.get);
822
+ return o && e && PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable ? PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() : o;
823
+ }
824
+ function To(e) {
494
825
  var t;
495
- const s = (t = bi[i == null ? void 0 : i.key]) === null || t === void 0 ? void 0 : t[i.operator];
496
- if (!s) return {};
497
- const o = s(e, i.predicate) ? i.met : i.unmet;
498
- return { startScreenId: o == null ? void 0 : o.screenId, startScreenName: o == null ? void 0 : o.screenName, conditionInteractionId: o == null ? void 0 : o.interactionId };
499
- }, Uo = (i, e) => {
500
- const t = e == null ? void 0 : e.find((({ key: s, operator: o, predicate: n }) => {
501
- var a;
502
- if (s === "ELSE") return !0;
503
- const l = (a = bi[s]) === null || a === void 0 ? void 0 : a[o];
504
- return !!(l != null && l(i, n));
505
- }));
506
- return t ? { startScreenId: t.met.screenId, startScreenName: t.met.screenName, conditionInteractionId: t.met.interactionId, clientScripts: t.met.clientScripts, componentsConfig: t.met.componentsConfig } : {};
507
- };
508
- function $e(i) {
509
- const e = {};
510
- try {
511
- Object.assign(e, JSON.parse(vi(zt)));
512
- } catch {
513
- }
514
- return e != null && e.loginId || i ? e : {};
826
+ const n = JSON.parse(e);
827
+ return n.publicKey.challenge = Qe(n.publicKey.challenge), (t = n.publicKey.allowCredentials) === null || t === void 0 || t.forEach((o) => {
828
+ o.id = Qe(o.id);
829
+ }), n;
515
830
  }
516
- function Mt(i, e) {
517
- i != null && i.authMethod && (e && !(i != null && i.loginId) || mi(zt, JSON.stringify(i)));
831
+ function Eo(e) {
832
+ return JSON.stringify({ id: e.id, rawId: Ie(e.rawId), type: e.type, response: { authenticatorData: Ie(e.response.authenticatorData), clientDataJSON: Ie(e.response.clientDataJSON), signature: Ie(e.response.signature), userHandle: e.response.userHandle ? Ie(e.response.userHandle) : void 0 } });
518
833
  }
519
- const Mo = ["error", "warn", "info", "debug"], Rt = {
520
- error: console.error.bind(console, "[Descope]"),
521
- warn: console.warn.bind(console, "[Descope]"),
522
- info: console.info.bind(console, "[Descope]"),
523
- debug: console.debug.bind(console, "[Descope]")
524
- }, ke = R((i) => {
525
- var e, t, s, o;
526
- return o = class extends i {
527
- constructor() {
528
- super(...arguments), e.add(this), t.set(this, r(this, e, "m", s).call(this, Rt));
529
- }
530
- set logger(a) {
531
- S(this, t, r(this, e, "m", s).call(this, a || Rt), "f");
532
- }
533
- get logger() {
534
- return r(this, t, "f");
535
- }
536
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
537
- onLogEvent(a, l) {
538
- }
539
- }, t = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakSet(), s = function(a) {
540
- return Mo.reduce((l, d) => (l[d] = (...u) => {
541
- var c;
542
- this.onLogEvent(d, u), (c = a[d]) === null || c === void 0 || c.call(a, ...u);
543
- }, l), {});
544
- }, o;
545
- }), wi = typeof localStorage < "u", Ro = "base.content.url", Ue = "https://static.descope.com/pages", jt = "https://static2.descope.com/pages", jo = wi && localStorage.getItem(Ro) || "", To = "v2-beta", ct = (i, e) => !e && `${i} cannot be empty, please make sure to set this attribute`, Ae = R((i) => {
546
- var e, t;
547
- return t = class extends i {
548
- constructor() {
549
- super(...arguments), e.set(this, !0);
550
- }
551
- connectedCallback() {
552
- var o, n;
553
- (o = super.connectedCallback) === null || o === void 0 || o.call(this), !((n = this.shadowRoot) === null || n === void 0) && n.isConnected && r(this, e, "f") && (S(this, e, !1, "f"), this.init());
554
- }
555
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-empty-function
556
- async init() {
557
- }
558
- }, e = /* @__PURE__ */ new WeakMap(), t;
559
- }), Lo = (i, e) => {
560
- Array.from(i.attributes).forEach((s) => e(s.name)), new MutationObserver((s) => {
561
- s.forEach((o) => {
562
- o.type === "attributes" && e(o.attributeName);
563
- });
564
- }).observe(i, { attributes: !0 });
565
- }, dt = R((i) => {
566
- var e, t;
567
- const s = j(ke, Ae)(i);
568
- return t = class extends s {
569
- constructor() {
570
- super(...arguments), e.set(this, {});
571
- }
572
- async init() {
573
- var n;
574
- await ((n = super.init) === null || n === void 0 ? void 0 : n.call(this)), Lo(this, (a) => {
575
- var l;
576
- (l = r(this, e, "f")[a]) === null || l === void 0 || l.forEach((d) => {
577
- d(a, this.getAttribute(a));
578
- });
579
- });
580
- }
581
- observeAttribute(n, a) {
582
- r(this, e, "f")[n] || (r(this, e, "f")[n] = []);
583
- const l = r(this, e, "f")[n].push(a);
584
- return () => r(this, e, "f")[n].splice(l, 1);
585
- }
586
- observeAttributes(n, a) {
587
- const l = n.reduce((d, u) => (d.push(this.observeAttribute(u, a)), d), []);
588
- return () => l.forEach((d) => d());
589
- }
590
- }, e = /* @__PURE__ */ new WeakMap(), t;
591
- }), Fe = (i) => (e) => {
592
- var t, s, o;
593
- const n = j(ke, Ae, dt)(e), a = Object.keys(i);
594
- return o = class extends n {
595
- constructor(...d) {
596
- super(...d), t.add(this), this.observeAttributes(a, r(this, t, "m", s).bind(this));
597
- }
598
- async init() {
599
- var d;
600
- a.forEach((u) => r(this, t, "m", s).call(this, u, this.getAttribute(u))), await ((d = super.init) === null || d === void 0 ? void 0 : d.call(this));
601
- }
602
- }, t = /* @__PURE__ */ new WeakSet(), s = function(d, u) {
603
- const c = i[d], h = typeof c == "function" ? c(d, u) : c;
604
- h && this.logger.error(h);
605
- }, o;
606
- };
607
- Fe.missingAttrValidator = ct;
608
- const Wo = R((i) => {
609
- const e = j(Fe({ "project-id": ct }))(i);
610
- return class extends e {
611
- get projectId() {
612
- return this.getAttribute("project-id");
613
- }
614
- };
615
- }), Po = R((i) => class extends i {
616
- get baseUrl() {
617
- return this.getAttribute("base-url") || "";
834
+ function Qe(e) {
835
+ const t = e.replace(/_/g, "/").replace(/-/g, "+");
836
+ return Uint8Array.from(atob(t), (n) => n.charCodeAt(0)).buffer;
837
+ }
838
+ function Ie(e) {
839
+ return btoa(String.fromCharCode.apply(null, new Uint8Array(e))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
840
+ }
841
+ var Gn, da = (Gn = (e) => ({ async signUp(t, n, o) {
842
+ const r = await e.webauthn.signUp.start(t, window.location.origin, n, o);
843
+ if (!r.ok)
844
+ return r;
845
+ const i = await at(r.data.options);
846
+ return await e.webauthn.signUp.finish(r.data.transactionId, i);
847
+ }, async signIn(t, n) {
848
+ const o = await e.webauthn.signIn.start(t, window.location.origin, void 0, void 0, n);
849
+ if (!o.ok)
850
+ return o;
851
+ const r = await Nt(o.data.options);
852
+ return await e.webauthn.signIn.finish(o.data.transactionId, r);
853
+ }, async signUpOrIn(t, n) {
854
+ var o;
855
+ const r = await e.webauthn.signUpOrIn.start(t, window.location.origin, n);
856
+ if (!r.ok)
857
+ return r;
858
+ if (!((o = r.data) === null || o === void 0) && o.create) {
859
+ const i = await at(r.data.options);
860
+ return await e.webauthn.signUp.finish(r.data.transactionId, i);
861
+ }
862
+ {
863
+ const i = await Nt(r.data.options);
864
+ return await e.webauthn.signIn.finish(r.data.transactionId, i);
865
+ }
866
+ }, async update(t, n, o) {
867
+ const r = await e.webauthn.update.start(t, window.location.origin, n, o);
868
+ if (!r.ok)
869
+ return r;
870
+ const i = await at(r.data.options);
871
+ return await e.webauthn.update.finish(r.data.transactionId, i);
872
+ }, helpers: { create: at, get: Nt, isSupported: Uo, conditional: ca } }), (...e) => {
873
+ const t = Gn(...e);
874
+ return Object.assign(t.signUp, e[0].webauthn.signUp), Object.assign(t.signIn, e[0].webauthn.signIn), Object.assign(t.signUpOrIn, e[0].webauthn.signUpOrIn), Object.assign(t.update, e[0].webauthn.update), t;
875
+ });
876
+ const Zn = { config: "/fedcm/config" }, ua = () => {
877
+ if (window.crypto && window.crypto.getRandomValues) {
878
+ const e = new Uint8Array(16);
879
+ return window.crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
618
880
  }
619
- }), Tt = "Trying the next fallback URL...", No = async (i, e, { logger: t } = {}) => {
881
+ return Math.random().toString(36).substring(2);
882
+ };
883
+ async function _n(e, t) {
884
+ var n;
620
885
  try {
621
- return await fetch(i, e);
622
- } catch (s) {
623
- return t == null || t.debug(`Network error fetching URL ${i} [${s.message}], retrying...`), fetch(i, e);
886
+ await jo(e, t);
887
+ } catch (o) {
888
+ (n = t == null ? void 0 : t.onFailed) === null || n === void 0 || n.call(t, o);
624
889
  }
625
- }, Do = async (i, e, { logger: t, onSuccess: s } = {}) => {
626
- const o = Array.isArray(i) ? i : [i];
627
- for (let n = 0; n < o.length; n++) {
628
- const a = o[n], l = n === o.length - 1;
629
- try {
630
- const d = await No(a.toString(), e, { logger: t });
631
- if (d.ok)
632
- return s == null || s(n), t == null || t.debug(`Successfully fetched URL ${a}`), d;
633
- const u = `Error fetching URL ${a} [${d.status}]`;
634
- if (l)
635
- throw new Error(u);
636
- t == null || t.debug(`${u}. ${Tt}`);
637
- } catch (d) {
638
- const u = `Error fetching URL ${a} [${d.message}]`;
639
- if (l)
640
- throw new Error(u);
641
- t == null || t.debug(`${u}. ${Tt}`);
642
- }
643
- }
644
- };
645
- function Fo({ projectId: i, filename: e, assetsFolder: t = To, baseUrl: s = Ue }) {
646
- const o = new URL(s);
647
- return o.pathname = zi(o.pathname, i, t, e), o.baseUrl = s, o;
648
890
  }
649
- const ut = R((i) => {
650
- var e, t, s, o, n, a, l;
651
- const d = j(ke, Wo, Po)(i);
652
- return l = class extends d {
653
- constructor() {
654
- super(...arguments), e.add(this), t.set(this, void 0), s.set(this, void 0), o.set(this, /* @__PURE__ */ new Set());
655
- }
656
- async fetchStaticResource(c, h) {
657
- const p = r(this, e, "m", n).call(this, c), f = Array.isArray(p) ? (m) => {
658
- const { baseUrl: A } = p[m];
659
- S(this, s, A, "f");
660
- for (let C = 0; C < m; C++) {
661
- const g = p[C].baseUrl;
662
- r(this, o, "f").add(g);
663
- }
664
- } : null;
665
- try {
666
- const m = await Do(p, { cache: "default" }, { logger: this.logger, onSuccess: f });
667
- return {
668
- body: await m[h](),
669
- headers: Object.fromEntries(m.headers.entries())
891
+ async function jo(e, t) {
892
+ var n, o;
893
+ const r = await async function(i, a = "google", l, s, c) {
894
+ const u = ua(), p = await async function() {
895
+ return new Promise((h, m) => {
896
+ if (window.google)
897
+ return void h(window.google.accounts.id);
898
+ let y = document.getElementById("google-gsi-client-script");
899
+ y || (y = document.createElement("script"), document.head.appendChild(y), y.async = !0, y.defer = !0, y.id = "google-gsi-client-script", y.src = "https://accounts.google.com/gsi/client"), y.onload = function() {
900
+ window.google ? h(window.google.accounts.id) : m("Failed to load Google GSI client script - not loaded properly");
901
+ }, y.onerror = function() {
902
+ m("Failed to load Google GSI client script - failed to load");
670
903
  };
671
- } catch (m) {
672
- this.logger.error(m.message);
673
- }
674
- }
675
- get baseStaticUrl() {
676
- return this.getAttribute("base-static-url") || "";
677
- }
678
- }, t = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakSet(), n = function(c) {
679
- const h = jo || this.baseStaticUrl;
680
- if (h)
681
- return r(this, e, "m", a).call(this, c, h);
682
- r(this, t, "f") !== this.baseUrl && (S(this, t, this.baseUrl, "f"), S(this, s, void 0, "f"), r(this, o, "f").clear());
683
- const p = [];
684
- if (r(this, s, "f"))
685
- p.push(r(this, e, "m", a).call(this, c, r(this, s, "f"))), r(this, s, "f") === Ue && p.push(r(this, e, "m", a).call(this, c, jt));
686
- else {
687
- const f = this.baseUrl + "/pages";
688
- this.baseUrl && !r(this, o, "f").has(f) && p.push(r(this, e, "m", a).call(this, c, f)), r(this, o, "f").has(Ue) || p.push(r(this, e, "m", a).call(this, c, Ue)), p.push(r(this, e, "m", a).call(this, c, jt));
689
- }
690
- return p.length === 1 ? p[0] : p;
691
- }, a = function(c, h) {
692
- return Fo({
693
- projectId: this.projectId,
694
- filename: c,
695
- baseUrl: h
696
- });
697
- }, l;
698
- }), Vo = "config.json", Bo = R((i) => {
699
- var e, t;
700
- const s = j(Fe({ "project-id": ct }))(i);
701
- return t = class extends s {
702
- constructor() {
703
- super(...arguments), e.set(this, /* @__PURE__ */ new Map());
704
- }
705
- onReset(n, a) {
706
- if (r(this, e, "f").has(n))
707
- throw new Error(`Callback for sectionId ${n} already exists`);
708
- return r(this, e, "f").set(n, a), () => {
709
- r(this, e, "f").delete(n);
904
+ });
905
+ }(), f = await i.oauth.getOneTapClientId(a);
906
+ if (!f.ok)
907
+ throw new Error("Failed to get OneTap client ID for provider " + a);
908
+ const x = f.data.clientId;
909
+ return new Promise((h) => {
910
+ var m, y;
911
+ const E = (T) => {
912
+ h({ provider: a, nonce: u, credential: T == null ? void 0 : T.credential });
710
913
  };
711
- }
712
- async reset(...n) {
713
- n.length === 0 ? await Promise.all(Array.from(r(this, e, "f").values()).map((a) => a())) : await Promise.all(n.map((a) => {
714
- var l;
715
- if (!r(this, e, "f").has(a))
716
- throw new Error(`Callback for sectionId ${a} does not exist`);
717
- return (l = r(this, e, "f").get(a)) === null || l === void 0 ? void 0 : l();
718
- }));
719
- }
720
- }, e = /* @__PURE__ */ new WeakMap(), t;
721
- }), yi = R((i) => {
722
- var e, t, s, o, n;
723
- const a = j(ut, Bo, Ae)(i);
724
- return n = class extends a {
725
- constructor() {
726
- super(...arguments), e.add(this), s.set(this, void 0), o.set(this, async () => {
727
- try {
728
- const { body: d, headers: u } = await this.fetchStaticResource(Vo, "json");
729
- return {
730
- projectConfig: d,
731
- executionContext: { geo: u["x-geo"] }
732
- };
733
- } catch {
734
- this.logger.error("Cannot fetch config file", "make sure that your projectId & flowId are correct");
914
+ p.initialize(Object.assign(Object.assign({}, l), { itp_support: (m = l == null ? void 0 : l.itp_support) === null || m === void 0 || m, use_fedcm_for_prompt: (y = l == null ? void 0 : l.use_fedcm_for_prompt) === null || y === void 0 || y, client_id: x, callback: E, nonce: u })), p.prompt((T) => {
915
+ var N, D;
916
+ if (c && (T != null && T.isDismissedMoment())) {
917
+ const v = (N = T.getDismissedReason) === null || N === void 0 ? void 0 : N.call(T);
918
+ return c == null || c(v), void E();
919
+ }
920
+ if (s && (T != null && T.isSkippedMoment())) {
921
+ const v = (D = T.getSkippedReason) === null || D === void 0 ? void 0 : D.call(T);
922
+ return s == null || s(v), void E();
735
923
  }
736
924
  });
737
- }
738
- async init() {
739
- await super.init(), this.onReset("config", r(this, e, "m", t).bind(this));
740
- }
741
- get config() {
742
- return r(this, s, "f") || S(this, s, r(this, o, "f").call(this), "f"), r(this, s, "f");
743
- }
744
- }, s = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakSet(), t = function() {
745
- S(this, s, void 0, "f");
746
- }, n;
747
- }), qo = [
748
- "https://descopecdn.com",
749
- "https://static.descope.com",
750
- "https://cdn.jsdelivr.net"
751
- ], Ko = (i) => document.querySelector(`script#${i}`), Ho = (i) => i.getAttribute("status") === "loaded", Go = (i) => i.getAttribute("status") === "error", Jo = (i) => {
752
- let e = 0;
753
- const t = i.toString();
754
- for (let s = 0; s < t.length; s++) {
755
- const o = t.charCodeAt(s);
756
- e = (e << 5) - e + o, e = e & e;
757
- }
758
- return `${Math.abs(e).toString()}`;
759
- }, zo = (i, e) => {
760
- const t = document.createElement("script");
761
- return t.id = i, e && (t.integrity = e, t.crossOrigin = "anonymous"), window.DESCOPE_NONCE && t.setAttribute("nonce", window.DESCOPE_NONCE), t;
762
- }, Yo = (i, e, t) => new Promise((s, o) => {
763
- const n = zo(i, t);
764
- n.onerror = (a) => {
765
- n.setAttribute("status", "error"), o(a);
766
- }, n.onload = () => {
767
- n.setAttribute("status", "loaded"), s(n);
768
- }, n.src = e.toString(), document.body.appendChild(n);
769
- }), Qo = (i, e) => {
770
- if (e) {
771
- const t = i.integrity;
772
- if (t !== e)
773
- return Promise.reject(new Error(`Integrity mismatch: expected ${e}, found ${t}`));
774
- }
775
- return Ho(i) ? Promise.resolve(i) : Go(i) ? Promise.reject() : new Promise((t, s) => {
776
- i.addEventListener("load", () => {
777
- t(i);
778
- }), i.addEventListener("error", (o) => {
779
- s(o);
780
925
  });
781
- });
782
- }, Xo = async (i, e) => {
783
- for (const t of i) {
784
- const { id: s, url: o, integrity: n } = t, a = Ko(s);
785
- if (a)
786
- try {
787
- return await Qo(a, n), t;
788
- } catch {
789
- e(t, !0);
790
- }
791
- else
792
- try {
793
- return await Yo(s, o, n), t;
794
- } catch {
795
- e(t, !1);
796
- }
797
- }
798
- throw new Error("All scripts failed to load");
799
- }, Zo = (i, e, t, s = "", o) => i.reduce((n, a) => {
800
- const l = a;
801
- if (!l)
802
- return n;
803
- let d;
804
- try {
805
- d = new URL(l);
806
- } catch {
807
- throw new Error(`Invalid URL: ${l}`);
926
+ }(e, t.provider, t.oneTapConfig, t.onSkipped, t.onDismissed);
927
+ if (!r.credential)
928
+ return null;
929
+ if (t != null && t.onCodeReceived) {
930
+ const i = await e.oauth.verifyOneTapIDToken(r.provider, r.credential, r.nonce, t == null ? void 0 : t.loginOptions);
931
+ if (!i.ok || !i.data)
932
+ throw new Error("Failed to verify OneTap client ID for provider " + r.provider);
933
+ (n = t == null ? void 0 : t.onCodeReceived) === null || n === void 0 || n.call(t, i.data.code);
934
+ } else {
935
+ const i = await e.oauth.exchangeOneTapIDToken(r.provider, r.credential, r.nonce, t == null ? void 0 : t.loginOptions);
936
+ if (!i.ok || !i.data)
937
+ throw new Error("Failed to exchange OneTap client ID for provider " + r.provider);
938
+ (o = t == null ? void 0 : t.onAuthenticated) === null || o === void 0 || o.call(t, i.data);
808
939
  }
809
- d.pathname !== "/" || (d.pathname = `/npm/${e}@${t}/${s}`);
810
- const c = {
811
- url: d,
812
- id: `npmlib-${e.replaceAll("@", "").replaceAll("/", "_")}-${Jo(d)}`
813
- };
814
- return o && (c.integrity = o), [...n, c];
815
- }, []), en = R((i) => {
816
- const e = j(ke)(i);
817
- return class extends e {
818
- get baseCdnUrl() {
819
- return this.getAttribute("base-cdn-url") || "";
820
- }
821
- injectNpmLib(s, o, n = "", a = [], l) {
822
- return this.logger.debug(`Injecting npm lib: "${s}" with version: "${o}"${l ? " with SRI integrity check" : ""}`), Xo(Zo([...a, this.baseCdnUrl, ...qo], s, o, n, l), (d, u) => {
823
- if (u) {
824
- this.logger.error(`Existing script cannot be loaded: "${d.url}"`);
825
- return;
826
- }
827
- this.logger.error(`Cannot load script from URL, Make sure this URL is valid and return the correct script: "${d.url}"`);
828
- });
940
+ }
941
+ var pa = (e) => Object.assign(Object.assign({}, e.flow), { start: async (...t) => {
942
+ const n = await Uo(), o = Object.assign(Object.assign({ location: window.location.href }, t[1]), { deviceInfo: { webAuthnSupport: n }, startOptionsVersion: 1 });
943
+ return t[1] = o, e.flow.start(...t);
944
+ } });
945
+ const ha = () => window.location.search.includes("code") && window.location.search.includes("state");
946
+ let Ft;
947
+ const Do = (e, t) => new Promise((n, o) => {
948
+ if (!e.length)
949
+ return o(new Error("No URLs provided to loadScriptWithFallback"));
950
+ const r = t();
951
+ if (r)
952
+ return n(r);
953
+ const i = e.shift(), a = document.createElement("script");
954
+ a.src = i, a.id = ((l) => {
955
+ let s = 0;
956
+ for (let c = 0; c < l.length; c++)
957
+ s = (s << 5) - s + l.charCodeAt(c), s |= 0;
958
+ return Math.abs(s).toString(16);
959
+ })(i), a.onload = () => {
960
+ const l = t();
961
+ if (l)
962
+ return n(l);
963
+ throw new Error("Could not get entry after loading script from URL");
964
+ }, a.addEventListener("error", () => {
965
+ Do(e, t), a.setAttribute("data-error", "true");
966
+ }), document.body.appendChild(a);
967
+ }), ga = async (e, t, n) => {
968
+ Ft || (Ft = (async () => {
969
+ try {
970
+ return require("oidc-client-ts");
971
+ } catch {
972
+ return Do([Ki, Vi], () => window.oidc);
829
973
  }
974
+ })());
975
+ const { OidcClient: o, WebStorageStateStore: r } = await Ft;
976
+ if (!o)
977
+ throw new Error("oidc-client-ts is not installed. Please install it by running `npm install oidc-client-ts`");
978
+ const i = (n == null ? void 0 : n.redirectUri) || window.location.href;
979
+ let a, l, s, c;
980
+ if (n != null && n.issuer) {
981
+ if (!n.clientId)
982
+ throw new Error("clientId is required when providing a custom issuer/authority");
983
+ a = n.issuer, l = n.clientId, s = `${l}_user`, c = "openid";
984
+ } else
985
+ n != null && n.applicationId ? (a = e.httpClient.buildUrl(t), a = `${a}/${n.applicationId}`, l = t, s = `${l}_user`, c = "openid email roles descope.custom_claims offline_access") : (a = e.httpClient.buildUrl(t), l = t, s = `${l}_user`, c = "openid email roles descope.custom_claims offline_access");
986
+ const u = { authority: a, client_id: l, redirect_uri: i, response_type: "code", scope: (n == null ? void 0 : n.scope) || c, stateStore: new r({ store: window.localStorage, prefix: l }), loadUserInfo: !0, fetchRequestCredentials: "same-origin" };
987
+ return n != null && n.redirectUri && (u.redirect_uri = n.redirectUri), { client: new o(u), stateUserKey: s };
988
+ }, fa = (e, t, n) => {
989
+ const o = async () => {
990
+ let i, a;
991
+ return i && a || ({ client: i, stateUserKey: a } = await ga(e, t, n)), { client: i, stateUserKey: a };
992
+ }, r = async (i = "") => {
993
+ var a;
994
+ const { client: l, stateUserKey: s } = await o(), c = await l.processSigninResponse(i || window.location.href);
995
+ var u;
996
+ return await ((a = e.httpClient.hooks) === null || a === void 0 ? void 0 : a.afterRequest({}, new Response(JSON.stringify(c)))), he(s, JSON.stringify({ id_token: (u = c).id_token, session_state: u.session_state, profile: u.profile })), (() => {
997
+ const p = new URL(window.location.href);
998
+ p.searchParams.delete("code"), p.searchParams.delete("state"), window.history.replaceState({}, document.title, p.toString());
999
+ })(), c;
830
1000
  };
831
- }), tn = (i) => [
832
- ...Array.from(i.content.querySelectorAll("*")).reduce((e, t) => t.localName.startsWith("descope-") ? e.add(t.localName) : e, /* @__PURE__ */ new Set())
833
- ], ht = "base.ui.components.url", sn = wi && localStorage.getItem(ht), on = "dist/umd/index.js", nn = "@descope/web-components-ui", rn = R((i) => {
834
- var e, t, s, o, n, a, l;
835
- const d = j(ke, yi, en)(i);
836
- return l = class extends d {
837
- constructor() {
838
- super(...arguments), e.add(this), o.set(this, void 0);
839
- }
840
- get descopeUi() {
841
- return r(this, o, "f") || S(this, o, r(this, e, "m", a).call(this), "f"), r(this, o, "f");
842
- }
843
- async loadDescopeUiComponents(c) {
844
- const h = Array.isArray(c) ? c : tn(c);
845
- return Promise.all(h.map((p) => r(this, e, "m", n).call(this, p)));
846
- }
847
- }, o = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakSet(), t = // eslint-disable-next-line class-methods-use-this
848
- async function() {
849
- var c;
850
- const h = await this.config, p = (c = h == null ? void 0 : h.projectConfig) === null || c === void 0 ? void 0 : c.componentsVersion;
851
- return p ? this.logger.debug(`Got component version "${p}"`) : this.logger.error("Could not get components version"), p;
852
- }, s = async function() {
853
- var c;
854
- const h = await this.config, p = (c = h == null ? void 0 : h.projectConfig) === null || c === void 0 ? void 0 : c.componentsVersionSri;
855
- return p && this.logger.debug("SRI hash available for components"), p;
856
- }, n = async function(c) {
857
- if (!!customElements.get(c)) {
858
- this.logger.debug(`Loading component "${c}" is skipped as it is already defined`);
859
- return;
860
- }
861
- const p = await this.descopeUi;
862
- if (!p[c]) {
863
- this.logger.error(`Cannot load UI component "${c}"`, `Descope UI does not have a component named "${c}", available components are: "${Object.keys(p).join(", ")}"`);
864
- return;
1001
+ return { loginWithRedirect: async (i = {}, a = !1) => {
1002
+ const { client: l } = await o(), s = await l.createSigninRequest(i), { url: c } = s;
1003
+ return a || (window.location.href = c), { ok: !0, data: s };
1004
+ }, finishLogin: r, finishLoginIfNeed: async (i = "") => {
1005
+ if (ha())
1006
+ return await r(i);
1007
+ }, refreshToken: async (i) => {
1008
+ var a;
1009
+ const { client: l, stateUserKey: s } = await o(), c = ((f) => {
1010
+ const x = ue(f);
1011
+ return x ? JSON.parse(x) : null;
1012
+ })(s);
1013
+ if (!c)
1014
+ throw new Error("User not found in storage to refresh token");
1015
+ let u = i;
1016
+ if (!u) {
1017
+ const f = {};
1018
+ e.httpClient.hooks.beforeRequest(f), u = f.token;
865
1019
  }
866
- try {
867
- return await p[c]();
868
- } catch (f) {
869
- if (f.name === "NotSupportedError")
870
- console.debug(`Encountered an error while attempting to define the "${c}" component, it is likely that this component is already defined`);
871
- else
872
- throw f;
1020
+ const p = await l.useRefreshToken({ state: { refresh_token: u, session_state: c.session_state, profile: c.profile } });
1021
+ return await ((a = e.httpClient.hooks) === null || a === void 0 ? void 0 : a.afterRequest({}, new Response(JSON.stringify(p)))), p;
1022
+ }, logout: async (i, a = !1) => {
1023
+ const { client: l, stateUserKey: s } = await o();
1024
+ i || (i = {}), i.id_token_hint = i.id_token_hint || So(), i.post_logout_redirect_uri = i.post_logout_redirect_uri || window.location.href;
1025
+ const c = await l.createSignoutRequest(i), { url: u } = c;
1026
+ return re(s), a || window.location.replace(u), c;
1027
+ } };
1028
+ }, va = function(...e) {
1029
+ return (t) => e.reduce((n, o) => o(n), t);
1030
+ }((e) => (t) => {
1031
+ var n;
1032
+ return n = t.customStorage, ge = n, e(t);
1033
+ }, (e) => (t) => {
1034
+ var { fpKey: n, fpLoad: o } = t, r = q(t, ["fpKey", "fpLoad"]);
1035
+ return te ? (n && o && oa(n).catch(() => null), e(Pe(r, { beforeRequest: ra }))) : e(r);
1036
+ }, (e) => (t) => e(Object.assign(Object.assign({}, t), { baseHeaders: Object.assign({ "x-descope-sdk-name": "web-js", "x-descope-sdk-version": "1.47.0" }, t.baseHeaders) })), (e) => (t) => {
1037
+ const n = it(), o = it(), r = it(), i = it(), a = e(Pe(t, { afterRequest: async (s, c) => {
1038
+ if (Rt(s, c))
1039
+ M("Session invalidated, notifying subscribers with empty values"), o.pub(null), r.pub(null), n.pub(null), i.pub(null);
1040
+ else {
1041
+ const u = await (async (h) => {
1042
+ const m = await ot(h);
1043
+ return (m == null ? void 0 : m.user) || (m != null && m.hasOwnProperty("userId") ? m : void 0);
1044
+ })(c);
1045
+ u && r.pub(u);
1046
+ const { sessionJwt: p, sessionExpiration: f, claims: x } = await ot(c);
1047
+ p && o.pub(p), x && i.pub(x), (f || p) && n.pub(f || 42);
873
1048
  }
874
- }, a = async function() {
875
- if (globalThis.DescopeUI)
876
- return globalThis.DescopeUI;
1049
+ } })), l = Me(a, ["logout", "logoutAll", "oidc.logout"], (s) => async (...c) => {
1050
+ const u = await s(...c);
1051
+ return o.pub(null), r.pub(null), n.pub(null), i.pub(null), u;
1052
+ });
1053
+ return Object.assign(l, { onSessionTokenChange: o.sub, onUserChange: r.sub, onClaimsChange: i.sub, onIsAuthenticatedChange: (s) => n.sub((c) => {
1054
+ s(!!c);
1055
+ }) });
1056
+ }, (e) => (t) => {
1057
+ const { enableFlowNonce: n = !0, nonceStoragePrefix: o = Fe } = t, r = q(t, ["enableFlowNonce", "nonceStoragePrefix"]);
1058
+ return n ? (((i = Fe) => {
877
1059
  try {
878
- const c = await r(this, e, "m", t).call(this), h = await r(this, e, "m", s).call(this);
879
- return await this.injectNpmLib(nn, c, on, [sn], h), this.logger.debug("DescopeUI was loaded"), globalThis.DescopeUI;
1060
+ if (!Xi)
1061
+ return;
1062
+ for (let c = 0; c < (a = void 0, l = void 0, s = void 0, (s = (a = ge == null ? void 0 : ge.length) !== null && a !== void 0 ? a : te && ((l = window.localStorage) === null || l === void 0 ? void 0 : l.length)) !== null && s !== void 0 ? s : 0); c++) {
1063
+ const u = Gi(c);
1064
+ if (u && u.startsWith(i)) {
1065
+ const p = ue(u);
1066
+ if (p)
1067
+ try {
1068
+ JSON.parse(p).expiry < Date.now() && re(u);
1069
+ } catch {
1070
+ re(u);
1071
+ }
1072
+ }
1073
+ }
880
1074
  } catch (c) {
881
- throw this.logger.error(c), new Error("DescopeUI was not loaded");
1075
+ console.error("Error cleaning up expired nonces:", c);
882
1076
  }
883
- }, l;
884
- }), an = R((i) => {
885
- var e, t, s;
886
- const o = j(Ae, dt)(i);
887
- return s = class extends o {
888
- constructor() {
889
- super(...arguments), e.add(this);
890
- }
891
- get nonce() {
892
- return this.getAttribute("nonce") || "";
893
- }
894
- async init() {
895
- var a;
896
- await ((a = super.init) === null || a === void 0 ? void 0 : a.call(this)), this.observeAttribute("nonce", r(this, e, "m", t).bind(this)), r(this, e, "m", t).call(this);
897
- }
898
- }, e = /* @__PURE__ */ new WeakSet(), t = function() {
899
- this.nonce && (window.DESCOPE_NONCE = this.nonce);
900
- }, s;
901
- });
902
- class ln {
903
- constructor(e, t, { prepend: s = !1 } = {}) {
904
- this.styleEle = document.createElement("style"), this.styleEle.setAttribute("nonce", t), this.ref = e, this.ref && (s ? this.ref.prepend(this.styleEle) : this.ref.append(this.styleEle));
905
- }
906
- replaceSync(e) {
907
- this.styleEle.textContent = e;
908
- }
909
- get cssRules() {
910
- var e;
911
- return (e = this.styleEle.sheet) === null || e === void 0 ? void 0 : e.cssRules;
912
- }
913
- }
914
- const pt = R((i) => {
915
- const e = j(an)(i);
916
- return class extends e {
917
- injectStyle(s, { prepend: o = !1 } = {}) {
918
- let n;
1077
+ var a, l, s;
1078
+ })(o), e(Pe(r, { afterRequest: async (i, a) => {
1079
+ if (i.path !== Yn && i.path !== Wt)
1080
+ return;
1081
+ const { nonce: l, executionId: s } = await (async (c, u) => {
919
1082
  try {
920
- n = new CSSStyleSheet();
1083
+ const p = u.headers.get($n);
1084
+ let f = await u.clone().json().then((x) => (x == null ? void 0 : x.executionId) || null).catch(() => null);
1085
+ return f || (f = Qn(c)), { nonce: p, executionId: Ao(f) };
921
1086
  } catch {
922
- n = new ln(this.shadowRoot, this.nonce, {
923
- prepend: o
924
- });
1087
+ return { nonce: null, executionId: null };
925
1088
  }
926
- if (s && n.replaceSync(s), n instanceof CSSStyleSheet) {
927
- const a = this.shadowRoot;
928
- if (a && "adoptedStyleSheets" in a) {
929
- const l = [...a.adoptedStyleSheets || []];
930
- l[o ? "unshift" : "push"](n), a.adoptedStyleSheets = l;
931
- }
1089
+ })(i, a);
1090
+ l && s && ((c, u, p, f = Fe) => {
1091
+ try {
1092
+ const x = Kt(c, f), h = p ? 172800 : 10800, m = { value: u, expiry: Date.now() + 1e3 * h, isStart: p };
1093
+ he(x, JSON.stringify(m));
1094
+ } catch (x) {
1095
+ console.error("Error setting flow nonce:", x);
1096
+ }
1097
+ })(s, l, i.path === Yn, o);
1098
+ }, beforeRequest: (i) => {
1099
+ if (i.path === Wt) {
1100
+ const a = Qn(i);
1101
+ if (a) {
1102
+ const l = ((s, c = Fe) => {
1103
+ try {
1104
+ const u = Kt(s, c), p = ue(u);
1105
+ if (!p)
1106
+ return null;
1107
+ const f = JSON.parse(p);
1108
+ return f.expiry < Date.now() ? (ia(s, c), null) : f.value;
1109
+ } catch (u) {
1110
+ return console.error("Error getting flow nonce:", u), null;
1111
+ }
1112
+ })(a, o);
1113
+ l && (i.headers = i.headers || {}, i.headers[$n] = l);
932
1114
  }
933
- return n;
934
- }
935
- };
936
- }), He = "content-root", Oe = "root", cn = R((i) => {
937
- const e = j(pt)(i);
938
- return class extends e {
939
- constructor(...s) {
940
- var o, n;
941
- super(...s), this.attachShadow({ mode: "open" }).innerHTML = `
942
- <div id="${Oe}">
943
- <div id="${He}"></div>
944
- </div>
945
- `, this.injectStyle(`
946
- #${Oe}, #${He} {
947
- height: 100%;
948
- }
949
- #${Oe} {
950
- position: relative;
951
- height: fit-content;
952
- }
953
- `), this.contentRootElement = (o = this.shadowRoot) === null || o === void 0 ? void 0 : o.getElementById(He), this.rootElement = (n = this.shadowRoot) === null || n === void 0 ? void 0 : n.getElementById(Oe);
954
- }
955
- };
956
- }), dn = "theme", un = (i) => {
957
- const e = document.createElement("link");
958
- e.href = i, e.rel = "stylesheet", document.head.appendChild(e);
959
- }, hn = async () => {
960
- const i = localStorage.getItem(ht), e = i == null ? void 0 : i.replace(/[^\/]+$/, "DescopeDev.js");
961
- console.warn("Trying to load DescopeDev.js from", e);
962
- const t = document.createElement("script");
963
- if (t.src = e, document.body.appendChild(t), await new Promise((s, o) => {
964
- t.onload = s, t.onerror = o;
965
- }), globalThis.DescopeDev) {
966
- const { themeToStyle: s, defaultTheme: o, darkTheme: n } = globalThis.DescopeDev;
967
- return {
968
- light: s(o),
969
- dark: s(n)
970
- };
971
- }
972
- }, pn = (i, e) => (e || !1) && e !== "light" && e !== "dark" && 'Supported theme values are "light", "dark", or leave empty for using the OS theme', gn = R((i) => {
973
- var e, t, s, o, n, a, l, d, u, c, h, p, f, m;
974
- const A = j(Fe({ theme: pn }), ut, Ae, rn, yi, cn, dt, pt)(i);
975
- return m = class extends A {
976
- constructor() {
977
- super(...arguments), e.add(this), t.set(this, void 0), s.set(this, void 0), h.set(this, () => {
978
- r(this, e, "m", p).call(this), r(this, f, "f").call(this, this.getAttribute("theme") === "os");
979
- }), f.set(this, (g) => {
980
- var v, b, k;
981
- const T = g ? "addEventListener" : "removeEventListener";
982
- (k = (b = (v = window.matchMedia) === null || v === void 0 ? void 0 : v.call(window, "(prefers-color-scheme: dark)")) === null || b === void 0 ? void 0 : b[T]) === null || k === void 0 || k.call(b, "change", () => r(this, e, "m", p).call(this));
983
- });
984
- }
985
- get theme() {
986
- var g, v;
987
- const b = this.getAttribute("theme");
988
- return b === "os" ? window.matchMedia && ((v = (g = window.matchMedia) === null || g === void 0 ? void 0 : g.call(window, "(prefers-color-scheme: dark)")) === null || v === void 0 ? void 0 : v.matches) ? "dark" : "light" : b || "light";
989
- }
990
- get styleId() {
991
- return this.getAttribute("style-id") || dn;
992
- }
993
- async init() {
994
- var g;
995
- await ((g = super.init) === null || g === void 0 ? void 0 : g.call(this)), r(this, h, "f").call(this), await Promise.all([
996
- r(this, e, "m", a).call(this),
997
- r(this, e, "m", l).call(this)
998
- ]), this.observeAttributes(["theme"], r(this, h, "f")), this.observeAttributes(["style-id"], () => {
999
- S(this, s, null, "f"), r(this, e, "m", u).call(this), r(this, e, "m", a).call(this), r(this, e, "m", l).call(this);
1000
- });
1001
1115
  }
1002
- }, t = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakSet(), o = async function() {
1003
- try {
1004
- const { body: g } = await this.fetchStaticResource(`${this.styleId}.json`, "json");
1005
- if (process.env.NODE_ENV === "development" && localStorage != null && localStorage.getItem(ht))
1116
+ return i;
1117
+ } }))) : e(r);
1118
+ }, (e) => (t) => {
1119
+ var { autoRefresh: n } = t, o = q(t, ["autoRefresh"]);
1120
+ const r = !!n, i = typeof n == "object" && (n == null ? void 0 : n.customActivityTracking);
1121
+ if (!r || Jt())
1122
+ return Object.assign(e(o), { markUserActive: () => {
1123
+ rt("markUserActive() called but has no effect");
1124
+ } });
1125
+ const { clearAllTimers: a, setTimer: l } = (() => {
1126
+ const h = [];
1127
+ return { clearAllTimers: () => {
1128
+ for (; h.length; )
1129
+ clearTimeout(h.pop());
1130
+ }, setTimer: (m, y) => {
1131
+ h.push(setTimeout(m, y));
1132
+ } };
1133
+ })();
1134
+ let s, c, u = null, p = !1, f = !1;
1135
+ i && (M("Activity-based refresh enabled"), u = (() => {
1136
+ let h = !0;
1137
+ return { hadActivity: () => h, reset: () => {
1138
+ h = !1;
1139
+ }, markActive: () => {
1140
+ h = !0;
1141
+ } };
1142
+ })()), te && document.addEventListener("visibilitychange", () => {
1143
+ document.visibilityState === "visible" && s && /* @__PURE__ */ new Date() > s && (M("Expiration time passed, refreshing session"), x.refresh(Ne() || c));
1144
+ });
1145
+ const x = e(Pe(o, { afterRequest: async (h, m) => {
1146
+ const { sessionJwt: y, refreshJwt: E, sessionExpiration: T, nextRefreshSeconds: N } = await ot(m);
1147
+ if (Rt(h, m))
1148
+ M("Session invalidated, canceling all timers"), a();
1149
+ else if (y || T) {
1150
+ if (s = ((A, B) => {
1151
+ if (B)
1152
+ return new Date(1e3 * B);
1153
+ M("Could not extract expiration time from session token, trying to decode the token");
1006
1154
  try {
1007
- this.logger.warn(`You are in DEV mode, and UI components override URL was found
1008
- trying to merge project theme with the default theme of the UI components`);
1009
- const v = await hn();
1010
- v && (g.light.components = Object.assign(Object.assign({}, g.light.components), v.light.components), g.dark.components = Object.assign(Object.assign({}, g.dark.components), v.dark.components), this.logger.warn("Theme was merged successfully"), console.log(`%cNOTICE! This is not the theme that will be used in production!
1011
-
1012
- Make sure to test it without the override UI components URL!`, "color: black; background-color:yellow; font-size: x-large"));
1013
- } catch (v) {
1014
- this.logger.error(`Failed to merge UI components theme
1015
- `, v);
1155
+ const V = Yt(A);
1156
+ if (V.exp)
1157
+ return new Date(1e3 * V.exp);
1158
+ } catch {
1159
+ return null;
1016
1160
  }
1017
- return g;
1018
- } catch {
1019
- this.logger.error("Cannot fetch theme file", "make sure that your projectId & flowId are correct");
1020
- }
1021
- }, n = function() {
1022
- return r(this, s, "f") || (S(this, s, r(this, e, "m", o).call(this), "f"), r(this, s, "f").then((g) => this.logger.debug("Fetched theme", g))), r(this, s, "f");
1023
- }, a = async function() {
1024
- var g, v;
1025
- const b = await r(this, e, "a", n);
1026
- b && (r(this, t, "f") || S(this, t, this.injectStyle(""), "f"), r(this, t, "f").replaceSync((((g = b == null ? void 0 : b.light) === null || g === void 0 ? void 0 : g.globals) || "") + (((v = b == null ? void 0 : b.dark) === null || v === void 0 ? void 0 : v.globals) || "")));
1027
- }, l = async function() {
1028
- var g, v;
1029
- const b = await r(this, e, "a", n);
1030
- if (!b)
1031
- return;
1032
- const k = await this.descopeUi;
1033
- k != null && k.componentsThemeManager && (k.componentsThemeManager.themes = {
1034
- light: (g = b == null ? void 0 : b.light) === null || g === void 0 ? void 0 : g.components,
1035
- dark: (v = b == null ? void 0 : b.dark) === null || v === void 0 ? void 0 : v.components
1036
- });
1037
- }, d = async function() {
1038
- var g, v;
1039
- const { projectConfig: b } = await this.config || {}, k = (g = b == null ? void 0 : b.styles) === null || g === void 0 ? void 0 : g[this.styleId], T = b == null ? void 0 : b.cssTemplate, L = k || T;
1040
- return (v = L == null ? void 0 : L[this.theme]) === null || v === void 0 ? void 0 : v.fonts;
1041
- }, u = async function() {
1042
- const g = await r(this, e, "m", d).call(this);
1043
- g ? Object.values(g).forEach((v) => {
1044
- v.url && (this.logger.debug(`Loading font from URL "${v.url}"`), un(v.url));
1045
- }) : this.logger.debug("No fonts to load");
1046
- }, c = async function() {
1047
- this.rootElement.setAttribute("data-theme", this.theme);
1048
- const g = await this.descopeUi;
1049
- g != null && g.componentsThemeManager && (g.componentsThemeManager.currentThemeName = this.theme);
1050
- }, p = function() {
1051
- r(this, e, "m", u).call(this), r(this, e, "m", c).call(this);
1052
- }, m;
1053
- }), Je = (i, e = "") => Object.keys(i).reduce(((t, s) => {
1054
- var o;
1055
- if (Array.isArray(i[s])) return Object.assign(Object.assign({}, t), { [s]: { value: i[s].map(((l) => typeof l == "object" && l !== null ? Je(l) : l)) } });
1056
- if (typeof i[s] == "object" && i[s] !== null && !(!((o = i[s]) === null || o === void 0) && o.value)) return Object.assign(Object.assign({}, t), Je(i[s], `${e + s}.`));
1057
- const n = typeof i[s] == "object" ? i[s] : { value: i[s] }, a = Object.assign(Object.assign({}, t), { [e + s]: n, [`form.${e}${s}`]: n });
1058
- return s === "displayName" ? Object.assign(Object.assign({}, a), { [`${e}fullName`]: n, [`form.${e}fullName`]: n }) : a;
1059
- }), []), fn = (i) => {
1060
- try {
1061
- return Je(JSON.parse(i));
1062
- } catch {
1063
- return {};
1064
- }
1065
- }, mn = (i, e) => Object.fromEntries(Object.entries(i).map((([t, s]) => [t, s[e]]))), vn = R(((i) => {
1066
- var e, t, s, o;
1067
- return o = class extends i {
1068
- constructor() {
1069
- super(...arguments), e.add(this);
1161
+ })(y, T), !s)
1162
+ return void M("Could not extract expiration time from session token");
1163
+ c = E, p = N > 0;
1164
+ const D = Zi(s, N);
1165
+ if (a(), D <= 2e4)
1166
+ return void M("Session is too close to expiration, not setting refresh timer");
1167
+ const v = new Date(Date.now() + D).toLocaleTimeString("en-US", { hour12: !1 });
1168
+ M(`Setting refresh timer for ${v}. (${D}ms)`), u && (u.reset(), f = !1), l(() => {
1169
+ if (te && document.visibilityState === "hidden")
1170
+ M("Skipping refresh due to timer - document is hidden");
1171
+ else {
1172
+ if (u && p && !u.hadActivity())
1173
+ return M("Skipping refresh due to timer - user is idle"), void (f = !0);
1174
+ M("Refreshing session due to timer"), x.refresh(Ne() || E);
1175
+ }
1176
+ }, D);
1070
1177
  }
1071
- connectedCallback() {
1072
- var n;
1073
- r(this, e, "m", t).call(this) && r(this, e, "m", s).call(this), (n = super.connectedCallback) === null || n === void 0 || n.call(this);
1178
+ } }));
1179
+ return Object.assign(Me(x, ["logout", "logoutAll", "oidc.logout"], (h) => async (...m) => {
1180
+ const y = await h(...m);
1181
+ return M("Clearing all timers"), a(), y;
1182
+ }), { markUserActive: u ? () => {
1183
+ M("markUserActive() called"), p || M("markUserActive() called but server does not have inactivity timeout configured (no nextRefreshSeconds)"), u.markActive(), f && (M("User became active after skipped refresh, triggering refresh"), f = !1, a(), x.refresh(Ne() || c));
1184
+ } : () => {
1185
+ rt("markUserActive() called but customActivityTracking is not enabled — this call has no effect");
1186
+ } });
1187
+ }, (e) => (t) => {
1188
+ var { storeLastAuthenticatedUser: n = !0, keepLastAuthenticatedUserAfterLogout: o = !1 } = t, r = q(t, ["storeLastAuthenticatedUser", "keepLastAuthenticatedUserAfterLogout"]);
1189
+ if (!n)
1190
+ return Object.assign(e(r), { getLastUserLoginId: Vt, getLastUserDisplayName: $t });
1191
+ const i = e(Pe(r, { afterRequest: async (l, s) => {
1192
+ var c;
1193
+ const { userInfo: u, lastAuth: p } = await (async (h) => {
1194
+ if (!(h != null && h.ok))
1195
+ return { userInfo: void 0, lastAuth: void 0 };
1196
+ const m = await (h == null ? void 0 : h.clone().json()), y = Io((m == null ? void 0 : m.authInfo) || m || {});
1197
+ return { userInfo: (y == null ? void 0 : y.user) || (y != null && y.hasOwnProperty("userId") ? y : void 0), lastAuth: m.lastAuth };
1198
+ })(s), f = (c = u == null ? void 0 : u.loginIds) === null || c === void 0 ? void 0 : c[0], x = u == null ? void 0 : u.name;
1199
+ f ? (Xn(f), ((h) => {
1200
+ he(an, h);
1201
+ })(x)) : p != null && p.loginId && Xn(p.loginId);
1202
+ } }));
1203
+ let a = Me(i, ["flow.start"], aa);
1204
+ return a = Me(a, ["logout", "logoutAll"], sa(o)), Object.assign(a, { getLastUserLoginId: Vt, getLastUserDisplayName: $t });
1205
+ }, (e) => (t) => {
1206
+ var { persistTokens: n, sessionTokenViaCookie: o, refreshTokenViaCookie: r, storagePrefix: i, refreshCookieName: a } = t, l = q(t, ["persistTokens", "sessionTokenViaCookie", "refreshTokenViaCookie", "storagePrefix", "refreshCookieName"]);
1207
+ if (!n || !te)
1208
+ return e(Object.assign({ refreshCookieName: a }, l));
1209
+ let s;
1210
+ const c = e(Pe(Object.assign({ refreshCookieName: a }, l), { beforeRequest: _i(i, r, a), afterRequest: async (p, f) => {
1211
+ if (Rt(p, f))
1212
+ M("Session invalidated, clearing persisted tokens"), Co(i, o, r, s);
1213
+ else {
1214
+ const x = await ot(f);
1215
+ x.cookieName ? he(`${i || ""}${dt}`, x.cookieName) : x.refreshJwt && re(`${i || ""}${dt}`);
1216
+ const h = ((m = {}, y = !1, E = "", T = !1) => {
1217
+ var N, D, v, A;
1218
+ const { sessionJwt: B, refreshJwt: V, trustedDeviceJwt: Z } = m;
1219
+ let _;
1220
+ if (V)
1221
+ if (T) {
1222
+ re(`${E}${Xe}`);
1223
+ const H = T.sameSite || "Strict", $ = (N = T.secure) === null || N === void 0 || N, Q = (D = T.domain) !== null && D !== void 0 ? D : m.cookieDomain, pe = ut(T);
1224
+ $ && window.location.protocol !== "https:" && rt("Refresh token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass refreshTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");
1225
+ const z = Object.assign(Object.assign({}, m), { cookieSameSite: H, cookieSecure: $, cookieDomain: Q });
1226
+ Kn(pe, V, z);
1227
+ const ne = Mt(Q);
1228
+ _ = Object.assign(Object.assign({}, _), { refresh: { path: z.cookiePath, domain: ne ? Q : void 0 } });
1229
+ } else {
1230
+ const H = ut(T);
1231
+ Le.remove(H), he(`${E}${Xe}`, V);
1232
+ }
1233
+ if (B)
1234
+ if (y) {
1235
+ const H = y.sameSite || "Strict", $ = (v = y.secure) === null || v === void 0 || v, Q = (A = y.domain) !== null && A !== void 0 ? A : m.cookieDomain, pe = nn(y);
1236
+ $ && window.location.protocol !== "https:" && rt("Session token cookie is configured with secure=true but the page is not using HTTPS. The cookie will not be set. To fix this, pass sessionTokenViaCookie: { secure: process.env['NODE_ENV'] !== 'development' }");
1237
+ const z = Object.assign(Object.assign({}, m), { cookieSameSite: H, cookieSecure: $, cookieDomain: Q });
1238
+ Kn(pe, B, z);
1239
+ const ne = Mt(Q);
1240
+ _ = Object.assign(Object.assign({}, _), { session: { path: z.cookiePath, domain: ne ? Q : void 0 } });
1241
+ } else
1242
+ he(`${E}${mt}`, B);
1243
+ return m.idToken && he(`${E}${tn}`, m.idToken), Z && he(`${E}DTD`, Z), _;
1244
+ })(x, o, i, r);
1245
+ h && (s = h);
1074
1246
  }
1075
- }, e = /* @__PURE__ */ new WeakSet(), t = function() {
1076
- return !this.shadowRoot.host.closest("form") && ys();
1077
- }, s = function() {
1078
- const n = this.shadowRoot.host, a = document.createElement("form");
1079
- a.style.width = "100%", a.style.height = "100%", n.parentElement.appendChild(a), a.appendChild(n);
1080
- }, o;
1081
- }));
1082
- var U, Me, Re, de, se, ae, ye, X, le, Ne, Lt, Ci, ze, Si, Wt, ki, Ai, Pt, Ei, Ye, xi, Ii;
1083
- const bn = j(gn, ut, vn, pt)(HTMLElement);
1084
- class Ce extends bn {
1085
- static get observedAttributes() {
1086
- return ["project-id", "flow-id", "base-url", "tenant", "locale", "debug", "storage-prefix", "preview", "redirect-url", "auto-focus", "store-last-authenticated-user", "refresh-cookie-name", "keep-last-authenticated-user-after-logout", "validate-on-blur", "style-id"];
1087
- }
1088
- constructor(e) {
1089
- super(), U.add(this), Re.set(this, !1), de.set(this, void 0), this.flowStatus = "initial", this.loggerWrapper = { error: (t, s = "") => {
1090
- this.logger.error(t, s, new Error()), r(this, U, "m", Ii).call(this, t, s);
1091
- }, warn: (t, s = "") => {
1092
- this.logger.warn(t, s);
1093
- }, info: (t, s = "", o = {}) => {
1094
- this.logger.info(t, s, o);
1095
- }, debug: (t, s = "") => {
1096
- this.logger.debug(t, s);
1097
- } }, se.set(this, new we()), ae.set(this, new we()), ye.set(this, {}), this.getComponentsContext = () => r(this, ye, "f"), this.nextRequestStatus = new we({ isLoading: !1 }), X.set(this, void 0), le.set(this, { popstate: r(this, U, "m", Si).bind(this), componentsContext: r(this, U, "m", Ei).bind(this) }), Ne.set(this, void 0), this.getConfig = () => y(this, void 0, void 0, (function* () {
1098
- return (yield this.config) || { isMissingConfig: !0 };
1099
- })), S(this, Ne, e, "f"), r(this, U, "m", Ci).call(this);
1100
- }
1101
- get flowId() {
1102
- return this.getAttribute("flow-id");
1103
- }
1104
- get client() {
1247
+ } })), u = Me(c, ["logout", "logoutAll", "oidc.logout"], la(i, o, r, () => s));
1248
+ return Object.assign(u, { getRefreshToken: () => Ne(i, r), getSessionToken: () => Vn(i, o), getIdToken: () => So(i) });
1249
+ })((e) => {
1250
+ const t = Pi(e), n = fa(t, e.projectId, e.oidcConfig);
1251
+ return Object.assign(Object.assign({}, t), { refresh: async (i, a) => {
1252
+ var l;
1253
+ if (Jt())
1254
+ return M(`Refresh called in native flow: ${new Error().stack}`), Promise.resolve({ ok: !1, error: { errorCode: "J171000", errorDescription: "Refresh is not supported in native flows via the web SDK" } });
1255
+ if (e.oidcConfig)
1256
+ try {
1257
+ return await n.refreshToken(i), Promise.resolve({ ok: !0 });
1258
+ } catch (p) {
1259
+ return Promise.resolve({ ok: !1, error: { errorCode: "J161001", errorDescription: p.toString() } });
1260
+ }
1261
+ const s = Vn(), c = Ne();
1262
+ let u = "";
1263
+ if (e.getExternalToken)
1264
+ try {
1265
+ u = await ((l = e.getExternalToken) === null || l === void 0 ? void 0 : l.call(e));
1266
+ } catch (p) {
1267
+ M("Error getting external token while refreshing", p);
1268
+ }
1269
+ return t.refresh(i, { dcs: s ? "t" : "f", dcr: c ? "t" : "f" }, u, a);
1270
+ }, logout: async (i) => {
1271
+ if (e.oidcConfig)
1272
+ try {
1273
+ return await n.logout({ id_token_hint: i }), Promise.resolve({ ok: !0 });
1274
+ } catch (a) {
1275
+ return Promise.resolve({ ok: !1, error: { errorCode: "J161000", errorDescription: a.toString() } });
1276
+ }
1277
+ return t.logout(i);
1278
+ }, flow: pa(t), webauthn: da(t), fedcm: (o = t, r = e.projectId, { onetap: { requestExchangeCode(i) {
1279
+ _n(o, i);
1280
+ }, requestAuthentication(i) {
1281
+ _n(o, i);
1282
+ } }, async oneTap(i, a, l, s, c) {
1283
+ await jo(o, { provider: i, oneTapConfig: a, loginOptions: l, onSkipped: s, onDismissed: c });
1284
+ }, async launch(i) {
1285
+ var a;
1286
+ const l = { identity: { context: i || "signin", providers: [{ configURL: o.httpClient.buildUrl(r + Zn.config), clientId: r }] } }, s = await ((a = navigator.credentials) === null || a === void 0 ? void 0 : a.get(l));
1287
+ return o.refresh(s.token);
1288
+ }, isSupported: () => te && "IdentityCredential" in window, async isLoggedIn(i) {
1289
+ var a;
1290
+ const l = o.httpClient.buildUrl(r + Zn.config);
1105
1291
  try {
1106
- return JSON.parse(this.getAttribute("client")) || {};
1292
+ const s = { identity: { context: i || "signin", providers: [{ configURL: l, clientId: r }] } }, c = await ((a = navigator.credentials) === null || a === void 0 ? void 0 : a.get(s));
1293
+ return !!c && !!c.token;
1107
1294
  } catch {
1108
- return {};
1295
+ return !1;
1109
1296
  }
1110
- }
1111
- get tenantId() {
1112
- return this.getAttribute("tenant") || void 0;
1113
- }
1114
- get redirectUrl() {
1115
- return this.getAttribute("redirect-url") || void 0;
1116
- }
1117
- get debug() {
1118
- return this.getAttribute("debug") === "true";
1119
- }
1120
- get locale() {
1121
- return this.getAttribute("locale") || void 0;
1122
- }
1123
- get autoFocus() {
1124
- var e;
1125
- const t = (e = this.getAttribute("auto-focus")) !== null && e !== void 0 ? e : "true";
1126
- return t === "skipFirstScreen" ? t : t === "true";
1127
- }
1128
- get validateOnBlur() {
1129
- return this.getAttribute("validate-on-blur") === "true";
1130
- }
1131
- get storeLastAuthenticatedUser() {
1132
- var e;
1133
- return ((e = this.getAttribute("store-last-authenticated-user")) !== null && e !== void 0 ? e : "true") === "true";
1134
- }
1135
- get refreshCookieName() {
1136
- return this.getAttribute("refresh-cookie-name") || "";
1137
- }
1138
- get keepLastAuthenticatedUserAfterLogout() {
1139
- return this.getAttribute("keep-last-authenticated-user-after-logout") === "true";
1140
- }
1141
- get storagePrefix() {
1142
- return this.getAttribute("storage-prefix") || "";
1143
- }
1144
- get preview() {
1145
- return !!this.getAttribute("preview");
1146
- }
1147
- get formConfig() {
1148
- return fn(this.form);
1149
- }
1150
- get form() {
1151
- return this.getAttribute("form");
1152
- }
1153
- get formConfigValues() {
1154
- return mn(this.formConfig, "value");
1155
- }
1156
- get outboundAppId() {
1157
- return this.getAttribute("outbound-app-id");
1158
- }
1159
- get outboundAppScopes() {
1160
- try {
1161
- return JSON.parse(this.getAttribute("outbound-app-scopes")) || null;
1162
- } catch {
1163
- return null;
1297
+ } }), oidc: n });
1298
+ var o, r;
1299
+ });
1300
+ let sn;
1301
+ const Po = (e) => {
1302
+ const t = va(Object.assign({ persistTokens: Pn, autoRefresh: Pn }, e));
1303
+ return sn = t, t;
1304
+ }, ma = () => Po({ projectId: "temp pid", persistTokens: !1, autoRefresh: !1, storeLastAuthenticatedUser: !1 });
1305
+ sn = ma();
1306
+ const ya = () => sn;
1307
+ var wa = ({ projectId: e, baseUrl: t, persistTokens: n, autoRefresh: o, sessionTokenViaCookie: r, refreshTokenViaCookie: i, refreshCookieName: a, oidcConfig: l, storeLastAuthenticatedUser: s, keepLastAuthenticatedUserAfterLogout: c, getExternalToken: u, hooks: p, customStorage: f }) => pt(() => {
1308
+ if (e)
1309
+ return Po({ projectId: e, baseUrl: t, sessionTokenViaCookie: r, refreshTokenViaCookie: i, baseHeaders: st, persistTokens: n, autoRefresh: o, refreshCookieName: a, oidcConfig: l, storeLastAuthenticatedUser: s, keepLastAuthenticatedUserAfterLogout: c, hooks: p, getExternalToken: u, customStorage: f });
1310
+ }, [e, t, JSON.stringify(r), JSON.stringify(i), u, f]);
1311
+ const ba = ({ projectId: e, baseUrl: t = "", baseStaticUrl: n = "", baseCdnUrl: o = "", sessionTokenViaCookie: r = !1, refreshTokenViaCookie: i = !1, hooks: a, persistTokens: l = !0, autoRefresh: s = !0, oidcConfig: c, storeLastAuthenticatedUser: u = !0, keepLastAuthenticatedUserAfterLogout: p = !1, refreshCookieName: f = "", getExternalToken: x, customStorage: h, children: m }) => {
1312
+ const [y, E] = C(), [T, N] = C(), [D, v] = C(), [A, B] = C(!1), [V, Z] = C(!1), [_, H] = C(!1), [$, Q] = C(!!c), pe = Se(!1), z = wa({ projectId: e, baseUrl: t, persistTokens: l, autoRefresh: s, sessionTokenViaCookie: r, refreshTokenViaCookie: i, hooks: a, oidcConfig: c, storeLastAuthenticatedUser: u, keepLastAuthenticatedUserAfterLogout: p, refreshCookieName: f, getExternalToken: x, customStorage: h });
1313
+ de(() => {
1314
+ if (z) {
1315
+ const je = z.onSessionTokenChange(N), ie = z.onUserChange(E), P = z.onIsAuthenticatedChange(B), Be = z.onClaimsChange(v);
1316
+ return () => {
1317
+ je(), ie(), P(), Be();
1318
+ };
1164
1319
  }
1165
- }
1166
- get popupOrigin() {
1167
- return this.getAttribute("popup-origin");
1168
- }
1169
- get customStorage() {
1170
- return r(this, de, "f");
1171
- }
1172
- set customStorage(e) {
1173
- if (e && typeof e.getItem != "function") throw new Error("Custom storage must have a getItem method");
1174
- if (e && typeof e.setItem != "function") throw new Error("Custom storage must have a setItem method");
1175
- if (e && typeof e.removeItem != "function") throw new Error("Custom storage must have a removeItem method");
1176
- S(this, de, e, "f"), _o(e);
1177
- }
1178
- get isRestartOnError() {
1179
- return this.getAttribute("restart-on-error") === "true";
1180
- }
1181
- getExecutionContext() {
1182
- return y(this, void 0, void 0, (function* () {
1183
- const e = yield this.getConfig();
1184
- return "executionContext" in e ? e.executionContext : void 0;
1320
+ }, [z]);
1321
+ const ne = Se(!1), fe = Se(!1);
1322
+ de(() => {
1323
+ z && c && !pe.current && (pe.current = !0, z.oidc.finishLoginIfNeed().finally(() => {
1324
+ Q(!1), ne.current = !0;
1185
1325
  }));
1186
- }
1187
- getProjectConfig() {
1188
- return y(this, void 0, void 0, (function* () {
1189
- const e = yield this.getConfig();
1190
- return "projectConfig" in e ? e.projectConfig : void 0;
1326
+ }, []);
1327
+ const K = lt(() => {
1328
+ hr() || ne.current || (ne.current = !0, H(!0), Dn(z == null ? void 0 : z.refresh)(void 0, !0).then(() => {
1329
+ H(!1);
1191
1330
  }));
1192
- }
1193
- getFlowConfig() {
1194
- return y(this, void 0, void 0, (function* () {
1195
- var e, t;
1196
- const s = yield this.getProjectConfig(), o = ((e = s == null ? void 0 : s.flows) === null || e === void 0 ? void 0 : e[this.flowId]) || {};
1197
- return (t = o.version) !== null && t !== void 0 || (o.version = 0), o;
1331
+ }, [z]), W = lt(() => {
1332
+ fe.current || (fe.current = !0, Z(!0), Dn(z.me)().then(() => {
1333
+ Z(!1);
1198
1334
  }));
1199
- }
1200
- getTargetLocales() {
1201
- return y(this, void 0, void 0, (function* () {
1202
- const e = yield this.getFlowConfig();
1203
- return ((e == null ? void 0 : e.targetLocales) || []).map(((t) => t.toLowerCase()));
1335
+ }, [z]), oe = pt(() => ({ fetchUser: W, user: y, isUserLoading: V, isUserFetched: fe.current, fetchSession: K, session: T, isAuthenticated: A, isSessionLoading: _, isOidcLoading: $, isSessionFetched: ne.current, projectId: e, baseUrl: t, baseStaticUrl: n, baseCdnUrl: o, storeLastAuthenticatedUser: u, keepLastAuthenticatedUserAfterLogout: p, refreshCookieName: f, customStorage: h, setUser: E, setSession: N, setIsAuthenticated: B, claims: D, sdk: z }), [W, y, V, fe.current, K, T, A, _, $, ne.current, e, t, n, o, p, f, h, E, N, B, D, z]);
1336
+ return ce.createElement(ro.Provider, { value: oe }, m);
1337
+ };
1338
+ function qa(...e) {
1339
+ return (t) => e.reduce((n, o) => o(n), t);
1340
+ }
1341
+ const Ja = (...e) => e.join("/").replace(/\/+/g, "/"), eo = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_.]+/g, "-").toLowerCase(), Ma = (e) => {
1342
+ const t = Symbol(((n) => {
1343
+ const o = n.toString();
1344
+ let r = 0;
1345
+ for (let i = 0; i < o.length; i++)
1346
+ r = (r << 5) - r + o.charCodeAt(i), r &= r;
1347
+ return r.toString(16);
1348
+ })(e));
1349
+ return (n) => {
1350
+ if (n[t])
1351
+ return n;
1352
+ const o = e(n);
1353
+ return o[t] = !0, o;
1354
+ };
1355
+ }, xa = (e) => {
1356
+ const [, t, n] = /(.*)\.(prop|attr)$/.exec(e) || [, e, "rest"];
1357
+ return { trimmedKey: t, category: n };
1358
+ }, ka = (e) => typeof e == "string" || e == null ? e : JSON.stringify(e), Ia = (e) => ce.forwardRef((t, n) => {
1359
+ const { prop: o, attr: r, rest: i } = pt(() => Object.entries(t).reduce((s, [c, u]) => {
1360
+ const { trimmedKey: p, category: f } = xa(c);
1361
+ return f === "prop" ? s.prop.push([p, u]) : f === "attr" ? s.attr.push([eo(p), ka(u)]) : Object.assign(s.rest, { [eo(p)]: u }), s;
1362
+ }, { attr: [], prop: [], rest: {} }), [t]), a = Se(null), l = lt((s) => {
1363
+ a.current = s, s && (o.forEach(([c, u]) => {
1364
+ a.current[c] = u;
1365
+ }), r.forEach(([c, u]) => {
1366
+ u == null ? s.removeAttribute(c) : s.setAttribute(c, u);
1204
1367
  }));
1205
- }
1206
- handleKeyPress() {
1207
- this.logger.debug("Enable key press handler"), this.rootElement.onkeydown = (e) => {
1208
- var t, s, o;
1209
- const n = !!(!((t = this.shadowRoot.activeElement) === null || t === void 0) && t.getAttribute("href")), a = ps.includes((o = (s = this.shadowRoot.activeElement) === null || s === void 0 ? void 0 : s.localName) !== null && o !== void 0 ? o : "");
1210
- if (e.key !== "Enter" || n || a) return;
1211
- e.preventDefault();
1212
- const l = this.rootElement.querySelectorAll("descope-button");
1213
- if (l.length === 1 && l[0].getAttribute("auto-submit") !== "false") return void l[0].click();
1214
- const d = Array.from(l).filter(((c) => c.getAttribute("auto-submit") === "true"));
1215
- if (d.length === 1) return void d[0].click();
1216
- const u = Array.from(l).filter(((c) => c.getAttribute("data-type") === "button"));
1217
- if (u.length === 1) u[0].getAttribute("auto-submit") !== "false" && u[0].click();
1218
- else if (u.length === 0) {
1219
- const c = Array.from(l).filter(((h) => h.getAttribute("data-type") === "sso"));
1220
- c.length === 1 && c[0].getAttribute("auto-submit") !== "false" && c[0].click();
1221
- }
1368
+ }, [o, r, a]);
1369
+ return no(n, () => a.current), ce.createElement(e, Object.assign({ ref: l }, i));
1370
+ }), Sa = ar(async () => (((customElements == null ? void 0 : customElements.get("descope-wc")) || await import("./index.es3.js").then((e) => e.a).then((e) => e.default)).sdkConfigOverrides = { baseHeaders: st, persistTokens: !1, hooks: { get beforeRequest() {
1371
+ return ya().httpClient.hooks.beforeRequest;
1372
+ }, set beforeRequest(e) {
1373
+ } } }, { default: Ia(ce.forwardRef((e, t) => {
1374
+ var { "external-request-id": n } = e, o = q(e, ["external-request-id"]);
1375
+ return pt(() => {
1376
+ var r, i;
1377
+ r = "x-external-rid", (i = n) ? st[r] = i : delete st[r];
1378
+ }, [n]), ce.createElement("descope-wc", Object.assign({ ref: t }, o));
1379
+ })) })), Ca = ce.forwardRef(({ flowId: e, onSuccess: t, onError: n, onReady: o, logger: r, tenant: i, theme: a, nonce: l, locale: s, debug: c, client: u, form: p, telemetryKey: f, redirectUrl: x, autoFocus: h, validateOnBlur: m, restartOnError: y, errorTransformer: E, styleId: T, onScreenUpdate: N, dismissScreenErrorOnInput: D, outboundAppId: v, outboundAppScopes: A, popupOrigin: B, children: V, externalRequestId: Z }, _) => {
1380
+ const [H, $] = C(null);
1381
+ no(_, () => H);
1382
+ const { projectId: Q, baseUrl: pe, baseStaticUrl: z, baseCdnUrl: ne, storeLastAuthenticatedUser: fe, keepLastAuthenticatedUserAfterLogout: K, refreshCookieName: W, customStorage: oe, sdk: je } = ce.useContext(ro), ie = lt(async (P) => {
1383
+ await je.httpClient.hooks.afterRequest({}, new Response(JSON.stringify(P.detail))), t && t(P);
1384
+ }, [t]);
1385
+ return de(() => {
1386
+ const P = H;
1387
+ return P == null || P.addEventListener("success", ie), n && (P == null || P.addEventListener("error", n)), o && (P == null || P.addEventListener("ready", o)), () => {
1388
+ n && (P == null || P.removeEventListener("error", n)), o && (P == null || P.removeEventListener("ready", o)), P == null || P.removeEventListener("success", ie);
1222
1389
  };
1223
- }
1224
- disableKeyPressHandler() {
1225
- this.logger.debug("Disable key press handler"), this.rootElement.onkeydown = null;
1226
- }
1227
- getComponentsVersion() {
1228
- return y(this, void 0, void 0, (function* () {
1229
- var e;
1230
- const t = yield this.getConfig();
1231
- return ("projectConfig" in t ? (e = t.projectConfig) === null || e === void 0 ? void 0 : e.componentsVersion : {}) || (this.logger.error("Did not get components version, using latest version"), "latest");
1232
- }));
1233
- }
1234
- init() {
1235
- const e = Object.create(null, { init: { get: () => super.init } });
1236
- return y(this, void 0, void 0, (function* () {
1237
- var t;
1238
- if (this.flowStatus = "loading", ["ready", "error", "success"].forEach(((A) => this.addEventListener(A, (() => {
1239
- this.flowStatus = A;
1240
- })))), yield (t = e.init) === null || t === void 0 ? void 0 : t.call(this), r(this, ae, "f").subscribe(r(this, U, "m", xi).bind(this)), r(this, ae, "f").update({ isDebug: this.debug }), r(this, U, "m", ze).call(this), yield r(this, U, "m", Ai).call(this)) return void this.loggerWrapper.error("This SDK version does not support your flows version", "Make sure to upgrade your flows to the latest version or use an older SDK version");
1241
- const s = yield this.getConfig();
1242
- if ("isMissingConfig" in s && s.isMissingConfig) return void this.loggerWrapper.error("Cannot get config file", "Make sure that your projectId & flowId are correct");
1243
- const { executionId: o, stepId: n, token: a, code: l, isPopup: d, exchangeError: u, redirectAuthCallbackUrl: c, redirectAuthBackupCallbackUri: h, redirectAuthCodeChallenge: p, redirectAuthInitiator: f, ssoQueryParams: m } = io(this.flowId, this.loggerWrapper);
1244
- window.addEventListener("popstate", r(this, le, "f").popstate), window.addEventListener("components-context", r(this, le, "f").componentsContext), r(this, se, "f").subscribe(r(this, U, "m", ki).bind(this)), r(this, se, "f").update(Object.assign({ projectId: this.projectId, flowId: this.flowId, baseUrl: this.baseUrl, tenant: this.tenantId, redirectUrl: this.redirectUrl, locale: this.locale, stepId: n, executionId: o, token: a, code: l, isPopup: d, exchangeError: u, redirectAuthCallbackUrl: c, redirectAuthBackupCallbackUri: h, redirectAuthCodeChallenge: p, redirectAuthInitiator: f }, m)), S(this, Re, !0, "f");
1245
- }));
1246
- }
1247
- disconnectedCallback() {
1248
- r(this, se, "f").unsubscribeAll(), r(this, ae, "f").unsubscribeAll(), r(this, U, "m", Ye).call(this), window.removeEventListener("popstate", r(this, le, "f").popstate), window.removeEventListener("components-context", r(this, le, "f").componentsContext);
1249
- }
1250
- attributeChangedCallback(e, t, s) {
1251
- if (this.shadowRoot.isConnected && r(this, Re, "f") && t !== s && Me.observedAttributes.includes(e)) {
1252
- r(this, U, "m", ze).call(this);
1253
- const o = t === null;
1254
- r(this, se, "f").update((({ stepId: n, executionId: a }) => {
1255
- let l = n, d = a;
1256
- return o || (d = null, l = null, di()), { [ui(e)]: s, stepId: l, executionId: d };
1257
- })), r(this, ae, "f").update({ isDebug: this.debug });
1258
- }
1259
- }
1390
+ }, [H, n, ie]), de(() => {
1391
+ const P = H;
1392
+ return P == null || P.addEventListener("success", ie), () => {
1393
+ P == null || P.removeEventListener("success", ie);
1394
+ };
1395
+ }, [H, ie]), de(() => {
1396
+ const P = H;
1397
+ return n && (P == null || P.addEventListener("error", n)), () => {
1398
+ n && (P == null || P.removeEventListener("error", n));
1399
+ };
1400
+ }, [H, n]), de(() => {
1401
+ const P = H;
1402
+ return o && (P == null || P.addEventListener("ready", o)), () => {
1403
+ o && (P == null || P.removeEventListener("error", o));
1404
+ };
1405
+ }, [H, o]), ce.createElement("form", null, ce.createElement(sr, { fallback: null }, ce.createElement(Sa, { projectId: Q, flowId: e, baseUrl: pe, baseStaticUrl: z, baseCdnUrl: ne, ref: $, telemetryKey: f, redirectUrl: x, autoFocus: h, styleId: T, validateOnBlur: m, restartOnError: y, keepLastAuthenticatedUserAfterLogout: K, tenant: i, externalRequestId: Z, customStorage: oe, "theme.attr": a, "nonce.attr": l, "locale.attr": s, "form.attr": p, "client.attr": u, "debug.attr": c, "outbound-app-id.attr": v, "outbound-app-scopes.attr": A, "popup-origin.attr": B, "store-last-authenticated-user.attr": fe, "refreshCookieName.attr": W, "dismiss-screen-error-on-input.attr": D, "errorTransformer.prop": E, "logger.prop": r, "onScreenUpdate.prop": N, "customStorage.prop": oe }, V)));
1406
+ }), Oa = "data:image/png;base64,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", Ye = "var(--color-green)", O = "var(--font-sans)", Y = {
1407
+ width: "100%",
1408
+ height: 40,
1409
+ padding: "10px 14px",
1410
+ fontSize: 16,
1411
+ fontWeight: 400,
1412
+ lineHeight: "23px",
1413
+ border: "1px solid var(--color-input-border)",
1414
+ borderRadius: 4,
1415
+ background: "white",
1416
+ color: "var(--color-text)",
1417
+ fontFamily: O,
1418
+ outline: "none",
1419
+ boxSizing: "border-box",
1420
+ transition: "border-color 0.15s, box-shadow 0.15s"
1421
+ }, X = (e) => {
1422
+ e.target.style.borderColor = "var(--color-green)", e.target.style.boxShadow = "0 0 0 3px var(--color-green-ring)";
1423
+ }, G = (e) => {
1424
+ e.target.style.borderColor = "var(--color-input-border)", e.target.style.boxShadow = "none";
1425
+ }, Aa = [
1426
+ { value: "", label: "Select team size (optional)" },
1427
+ { value: "1-10", label: "1–10" },
1428
+ { value: "11-50", label: "11–50" },
1429
+ { value: "51-200", label: "51–200" },
1430
+ { value: "200+", label: "200+" }
1431
+ ], Ua = [
1432
+ "Nextiva",
1433
+ "Five9",
1434
+ "Dialpad",
1435
+ "RingCentral",
1436
+ "NICE",
1437
+ "Genesys",
1438
+ "Talkdesk",
1439
+ "Aircall",
1440
+ "8x8",
1441
+ "Vonage",
1442
+ "Twilio",
1443
+ "Other"
1444
+ ], Ta = ["Teams", "Zoom", "Google Meet", "Webex", "Other"];
1445
+ function Re({ title: e, subtitle: t }) {
1446
+ return /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1447
+ /* @__PURE__ */ d("h2", { style: { fontFamily: O, fontWeight: 600, fontSize: "36px", lineHeight: "44px", color: "var(--color-text)", margin: 0 }, children: e }),
1448
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 400, lineHeight: "26px", color: "var(--color-text-secondary)", margin: 0 }, children: t })
1449
+ ] });
1260
1450
  }
1261
- Me = Ce, Re = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), Ne = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakSet(), Lt = function() {
1262
- this.injectStyle(`
1263
- :host {
1264
- width: 100%;
1265
- display: block;
1266
- }
1267
-
1268
- #root {
1269
- height: 100%;
1270
- display: flex;
1271
- flex-direction: column;
1272
- }
1273
-
1274
- #content-root {
1275
- all: initial;
1276
- transition: opacity 200ms ease-in-out;
1277
- }
1278
-
1279
- #root[data-theme] {
1280
- background-color: transparent;
1281
- }
1282
-
1283
- .fade-out {
1284
- opacity: 0.1!important;
1285
- }
1286
-
1287
- .hidden {
1288
- display: none;
1289
- }
1290
- `);
1291
- }, Ci = function() {
1292
- r(this, U, "m", Lt).call(this), this.slotElement = document.createElement("slot"), this.slotElement.classList.add("hidden"), this.rootElement.appendChild(this.slotElement);
1293
- }, ze = function() {
1294
- const i = ["base-url", "tenant", "locale", "debug", "redirect-url", "auto-focus", "store-last-authenticated-user", "refresh-cookie-name", "keep-last-authenticated-user-after-logout", "preview", "storage-prefix", "form", "client", "validate-on-blur", "style-id", "outbound-app-id", "outbound-app-scopes"];
1295
- Me.observedAttributes.forEach(((e) => {
1296
- if (!i.includes(e) && !this[ui(e)]) throw Error(`${e} cannot be empty`);
1297
- }));
1298
- }, Si = function() {
1299
- const { stepId: i, executionId: e } = ci(this.flowId);
1300
- r(this, se, "f").update({ stepId: i, executionId: e });
1301
- }, Wt = function(i, e) {
1302
- he && typeof he == "function" || this.logger.error("SDK was not loaded properly", he, JSON.stringify(he));
1303
- const t = Object.assign(Object.assign({ persistTokens: !0, preview: this.preview, storagePrefix: this.storagePrefix, storeLastAuthenticatedUser: this.storeLastAuthenticatedUser, keepLastAuthenticatedUserAfterLogout: this.keepLastAuthenticatedUserAfterLogout, refreshCookieName: this.refreshCookieName }, Me.sdkConfigOverrides), { projectId: i, baseUrl: e });
1304
- r(this, de, "f") && (t.customStorage = r(this, de, "f")), this.sdk = he(t), ["start", "next"].forEach(((s) => {
1305
- const o = this.sdk.flow[s], n = ms(o, 1e3, 3);
1306
- this.sdk.flow[s] = (...a) => y(this, void 0, void 0, (function* () {
1307
- try {
1308
- return yield n(...a);
1309
- } catch (l) {
1310
- return this.logger.error(`Error in sdk flow ${s} function`, l), { error: { errorCode: Ht, errorDescription: l.toString() } };
1311
- }
1312
- }));
1313
- }));
1314
- }, ki = function(i, e, t) {
1315
- return y(this, void 0, void 0, (function* () {
1316
- const { projectId: s, baseUrl: o } = i;
1317
- if (t("projectId") || t("baseUrl")) {
1318
- if (!s) return;
1319
- r(this, U, "m", Wt).call(this, s, o);
1451
+ function xe({ onClick: e, disabled: t, children: n, type: o = "button" }) {
1452
+ const r = !t;
1453
+ return /* @__PURE__ */ d(
1454
+ "button",
1455
+ {
1456
+ type: o,
1457
+ onClick: e,
1458
+ disabled: t,
1459
+ style: {
1460
+ width: "100%",
1461
+ height: 40,
1462
+ display: "flex",
1463
+ justifyContent: "center",
1464
+ alignItems: "center",
1465
+ padding: "10px",
1466
+ background: r ? "var(--color-green)" : "var(--color-green-disabled)",
1467
+ color: "white",
1468
+ border: "none",
1469
+ borderRadius: 4,
1470
+ fontSize: 16,
1471
+ fontWeight: 600,
1472
+ lineHeight: "23px",
1473
+ fontFamily: O,
1474
+ cursor: r ? "pointer" : "not-allowed",
1475
+ transition: "background 0.15s",
1476
+ boxSizing: "border-box"
1477
+ },
1478
+ onMouseEnter: (i) => {
1479
+ r && (i.currentTarget.style.background = "var(--color-green-hover)");
1480
+ },
1481
+ onMouseLeave: (i) => {
1482
+ r && (i.currentTarget.style.background = r ? "var(--color-green)" : "var(--color-green-disabled)");
1483
+ },
1484
+ children: n
1320
1485
  }
1321
- r(this, Ne, "f").call(this, i);
1322
- }));
1323
- }, Ai = function() {
1324
- return y(this, void 0, void 0, (function* () {
1325
- const i = yield this.getConfig();
1326
- return "isMissingConfig" in i && i.isMissingConfig && (yield r(this, U, "m", Pt).call(this));
1327
- }));
1328
- }, Pt = function() {
1329
- return y(this, void 0, void 0, (function* () {
1330
- const i = bs({ projectId: this.projectId, filename: ns, assetsFolder: os, baseUrl: this.baseStaticUrl });
1331
- try {
1332
- return yield vs(i, "json"), !0;
1333
- } catch {
1334
- return !1;
1486
+ );
1487
+ }
1488
+ function J({ label: e, gap: t = 12, labelSize: n = 16, labelStyle: o, children: r }) {
1489
+ return /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: t, width: "100%" }, children: [
1490
+ /* @__PURE__ */ d("label", { style: { fontSize: n, fontWeight: 400, color: "var(--color-text)", fontFamily: O, lineHeight: "100%", ...o }, children: e }),
1491
+ r
1492
+ ] });
1493
+ }
1494
+ function Lt({ show: e, onToggle: t }) {
1495
+ return /* @__PURE__ */ d(
1496
+ "button",
1497
+ {
1498
+ type: "button",
1499
+ tabIndex: -1,
1500
+ onClick: t,
1501
+ style: { position: "absolute", right: 14, top: "50%", transform: "translateY(-50%)", background: "none", border: "none", padding: 0, cursor: "pointer", color: "var(--color-text-secondary)", display: "flex", alignItems: "center" },
1502
+ children: e ? /* @__PURE__ */ d(ur, { size: 16 }) : /* @__PURE__ */ d(pr, { size: 16 })
1335
1503
  }
1336
- }));
1337
- }, Ei = function(i) {
1338
- S(this, ye, Object.assign(Object.assign({}, r(this, ye, "f")), i.detail), "f");
1339
- }, Ye = function() {
1340
- var i;
1341
- (i = r(this, X, "f")) === null || i === void 0 || i.remove(), S(this, X, null, "f");
1342
- }, xi = function(i) {
1343
- return y(this, arguments, void 0, (function* ({ isDebug: e }) {
1344
- e ? (S(this, X, document.createElement("descope-debugger"), "f"), Object.assign(r(this, X, "f").style, { position: "fixed", top: "0", right: "0", height: "100vh", width: "100vw", pointerEvents: "none", zIndex: 99999 }), yield import("./debugger-wc.es.js"), document.body.appendChild(r(this, X, "f"))) : r(this, U, "m", Ye).call(this);
1345
- }));
1346
- }, Ii = function(i, e) {
1347
- var t;
1348
- i && this.debug && ((t = r(this, X, "f")) === null || t === void 0 || t.updateData({ title: i, description: e }));
1349
- }, Ce.sdkConfigOverrides = { baseHeaders: { "x-descope-sdk-name": "web-component", "x-descope-sdk-version": "3.56.0" } };
1350
- var w, fe, G, ue, je, _i, Nt, Dt, Te, Ft, Qe, Vt, $i, Le, Oi, Xe, Ze, ce, me, et, H, tt, Bt, Ui, it, Mi, Ri, ve, ji, Ti, Li, qt, We, st, Kt, Wi, J, Pi;
1351
- class Ni extends Ce {
1352
- static set sdkConfigOverrides(e) {
1353
- Ce.sdkConfigOverrides = e;
1354
- }
1355
- static get sdkConfigOverrides() {
1356
- return Ce.sdkConfigOverrides;
1357
- }
1358
- constructor() {
1359
- const e = new we({ deferredRedirect: !1, deferredPolling: !1 });
1360
- super(e.update.bind(e)), w.add(this), this.stepState = new we({}), fe.set(this, void 0), G.set(this, null), ue.set(this, null), je.set(this, { visibilitychange: r(this, w, "m", _i).bind(this) }), this.bridgeVersion = 2, this.nativeCallbacks = {}, Le.set(this, !1), this.handleRedirect = (t) => {
1361
- window.location.assign(t);
1362
- }, Xe.set(this, ((t) => {
1363
- const s = () => {
1364
- this.contentRootElement.classList.toggle("hidden", t), this.slotElement.classList.toggle("hidden", !t), t && (this.contentRootElement.innerHTML = "");
1365
- };
1366
- t && this.contentRootElement.hasChildNodes() ? r(this, w, "m", Ze).call(this, s) : s();
1367
- })), ce.set(this, ((t, s, o, n, a = !1) => {
1368
- const l = [St, es];
1369
- if (this.flowState.current.action === q.poll) {
1370
- if (r(this, et, "f").call(this) && document.hidden) return this.logger.debug("polling - Deferring polling until in foreground"), void this.flowState.update({ deferredPolling: !0 });
1371
- this.logger.debug("polling - Scheduling polling request");
1372
- const d = Date.now(), u = a ? 500 : 2e3;
1373
- S(this, fe, setTimeout((() => y(this, void 0, void 0, (function* () {
1374
- var c, h;
1375
- this.logger.debug("polling - Calling next");
1376
- const p = this.sdk.flow.next(t, s, pe.polling, o, n, {}), f = document.hidden && !a && Date.now() - d > u + 500;
1377
- let m;
1378
- f && this.logger.debug("polling - The polling seems to be throttled");
1379
- try {
1380
- m = yield lt(f ? 1e3 : 6e3, p);
1381
- } catch {
1382
- return this.logger.warn(`polling - The ${f ? "throttled fetch" : "fetch"} call timed out or was aborted`), void r(this, ce, "f").call(this, t, s, o, n, f);
1383
- }
1384
- if (((c = m == null ? void 0 : m.error) === null || c === void 0 ? void 0 : c.errorCode) === Ht) return this.logger.debug("polling - Got a generic error due to exception in fetch call"), void r(this, ce, "f").call(this, t, s, o, n);
1385
- this.logger.debug("polling - Got a response"), m != null && m.error && this.logger.debug("polling - Response has an error", JSON.stringify(m.error, null, 4)), !((h = m == null ? void 0 : m.error) === null || h === void 0) && h.errorCode && l.includes(m.error.errorCode) ? this.logger.debug("polling - Stopping polling due to error") : r(this, ce, "f").call(this, t, s, o, n), r(this, H, "f").call(this, m);
1386
- }))), u), "f");
1387
- }
1388
- })), me.set(this, (() => {
1389
- clearTimeout(r(this, fe, "f")), S(this, fe, null, "f");
1390
- })), et.set(this, (() => !!window.descopeBridge || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))), H.set(this, ((t) => {
1391
- var s, o, n, a, l, d, u, c, h, p, f, m, A;
1392
- if (!(t != null && t.ok)) {
1393
- const B = (s = t == null ? void 0 : t.response) === null || s === void 0 ? void 0 : s.url, Z = `${(o = t == null ? void 0 : t.response) === null || o === void 0 ? void 0 : o.status} - ${(n = t == null ? void 0 : t.response) === null || n === void 0 ? void 0 : n.statusText}`;
1394
- r(this, w, "m", J).call(this, "error", (t == null ? void 0 : t.error) || { errorCode: Xi, errorDescription: Z, errorMessage: B }), this.loggerWrapper.error(((a = t == null ? void 0 : t.error) === null || a === void 0 ? void 0 : a.errorDescription) || B, ((l = t == null ? void 0 : t.error) === null || l === void 0 ? void 0 : l.errorMessage) || Z);
1395
- const M = (d = t == null ? void 0 : t.error) === null || d === void 0 ? void 0 : d.errorCode;
1396
- return void (M !== Zi && M !== St || !this.isRestartOnError || r(this, w, "m", $i).call(this));
1397
- }
1398
- (c = (u = t.data) === null || u === void 0 ? void 0 : u.runnerLogs) === null || c === void 0 || c.forEach(((B) => {
1399
- const { level: Z, title: M, log: N } = B;
1400
- Z && this.loggerWrapper[Z] ? this.loggerWrapper[Z](M, N) : this.loggerWrapper.info(M, N);
1401
- }));
1402
- const C = (f = (p = (h = t.data) === null || h === void 0 ? void 0 : h.screen) === null || p === void 0 ? void 0 : p.state) === null || f === void 0 ? void 0 : f.errorText;
1403
- !((m = t.data) === null || m === void 0) && m.error ? this.loggerWrapper.error(`[${t.data.error.code}]: ${t.data.error.description}`, `${C ? `${C} - ` : ""}${t.data.error.message}`) : C && this.loggerWrapper.error(C);
1404
- const { status: g, authInfo: v, lastAuth: b, action: k, openInNewTabUrl: T } = t.data;
1405
- if (k !== q.poll && r(this, me, "f").call(this), g === "completed") {
1406
- this.storeLastAuthenticatedUser && Mt(b);
1407
- const B = Object.assign({}, v);
1408
- return t.data.output && Object.keys(t.data.output).length > 0 && (B.flowOutput = t.data.output), void r(this, w, "m", J).call(this, "success", B);
1504
+ );
1505
+ }
1506
+ function Ve() {
1507
+ return /* @__PURE__ */ d("hr", { style: { width: "100%", border: "none", borderTop: "1px solid var(--color-divider)", margin: 0 } });
1508
+ }
1509
+ function Te({ text: e, linkText: t, onClick: n }) {
1510
+ return /* @__PURE__ */ k("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", gap: 4, width: "100%" }, children: [
1511
+ /* @__PURE__ */ d("span", { style: { fontSize: 15, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O }, children: e }),
1512
+ /* @__PURE__ */ d(
1513
+ "button",
1514
+ {
1515
+ type: "button",
1516
+ onClick: n,
1517
+ style: { background: "none", border: "none", padding: 0, fontSize: 15, fontWeight: 600, lineHeight: "22px", color: Ye, cursor: "pointer", fontFamily: O, textDecoration: "underline" },
1518
+ children: t
1409
1519
  }
1410
- this.storeLastAuthenticatedUser && Mt(b, !0), T && window.open(T, "_blank");
1411
- const { executionId: L, stepId: P, stepName: D, screen: F, redirect: oe, webauthn: z, error: Ee, samlIdpResponse: V, nativeResponse: ne } = t.data, xe = Date.now();
1412
- k !== q.poll ? (this.loggerWrapper.info(`Step "${D || `#${P}`}" is ${g}`, "", { screen: F, status: g, stepId: P, stepName: D, action: k, error: Ee }), !((A = F.state) === null || A === void 0) && A.clientScripts && S(this, ue, this.loadSdkScripts(F.state.clientScripts), "f"), this.flowState.update({ stepId: P, stepName: D, executionId: L, action: k, redirectTo: oe == null ? void 0 : oe.url, redirectIsPopup: oe == null ? void 0 : oe.isPopup, screenId: F == null ? void 0 : F.id, screenState: F == null ? void 0 : F.state, webauthnTransactionId: z == null ? void 0 : z.transactionId, webauthnOptions: z == null ? void 0 : z.options, samlIdpResponseUrl: V == null ? void 0 : V.url, samlIdpResponseSamlResponse: V == null ? void 0 : V.samlResponse, samlIdpResponseRelayState: V == null ? void 0 : V.relayState, nativeResponseType: ne == null ? void 0 : ne.type, nativePayload: ne == null ? void 0 : ne.payload, reqTimestamp: xe })) : this.flowState.update({ action: k, reqTimestamp: xe });
1413
- })), tt.set(this, hi((() => y(this, void 0, void 0, (function* () {
1414
- var t;
1415
- try {
1416
- const s = yield this.sdk.webauthn.signIn.start("", window.location.origin);
1417
- return s.ok || this.loggerWrapper.warn("Webauthn start failed", (t = s == null ? void 0 : s.error) === null || t === void 0 ? void 0 : t.errorMessage), s.data;
1418
- } catch (s) {
1419
- this.loggerWrapper.warn("Webauthn start failed", s.message);
1520
+ )
1521
+ ] });
1522
+ }
1523
+ function ke({ onTerms: e, onPrivacyPolicy: t, paddingTop: n }) {
1524
+ return /* @__PURE__ */ d("div", { style: { display: "flex", justifyContent: "center", width: "100%", marginTop: "auto", paddingTop: n || 40, flexShrink: 0 }, children: /* @__PURE__ */ k("span", { style: { fontSize: 15, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O, textAlign: "center", whiteSpace: "nowrap" }, children: [
1525
+ "By continuing, you agree to our",
1526
+ " ",
1527
+ /* @__PURE__ */ d(
1528
+ "a",
1529
+ {
1530
+ href: "https://chordia.ai/legal/terms-of-use",
1531
+ target: "_blank",
1532
+ rel: "noopener noreferrer",
1533
+ style: { fontSize: 15, fontWeight: 400, color: "var(--color-text)", fontFamily: O, textDecoration: "underline", textUnderlineOffset: 2 },
1534
+ children: "Terms"
1420
1535
  }
1421
- }))))), ve.set(this, null), We.set(this, lo(((t, s) => y(this, void 0, void 0, (function* () {
1422
- var o;
1423
- if (t.getAttribute("formnovalidate") === "true" || r(this, w, "m", Mi).call(this)) {
1424
- const n = t == null ? void 0 : t.getAttribute("id");
1425
- r(this, w, "m", ji).call(this, t);
1426
- const a = yield r(this, w, "m", Ri).call(this), l = to(t);
1427
- this.nextRequestStatus.update({ isLoading: !0 });
1428
- const d = Object.assign(Object.assign(Object.assign({}, l), a), { origin: ((o = this.nativeOptions) === null || o === void 0 ? void 0 : o.origin) || window.location.origin });
1429
- yield s(n, d), this.nextRequestStatus.update({ isLoading: !1 }), r(this, w, "m", Ti).call(this, a);
1536
+ ),
1537
+ " ",
1538
+ "and",
1539
+ " ",
1540
+ /* @__PURE__ */ d(
1541
+ "a",
1542
+ {
1543
+ href: "https://chordia.ai/legal/privacy-notice",
1544
+ target: "_blank",
1545
+ rel: "noopener noreferrer",
1546
+ style: { fontSize: 15, fontWeight: 400, color: "var(--color-text)", fontFamily: O, textDecoration: "underline", textUnderlineOffset: 2 },
1547
+ children: "Privacy Policy"
1430
1548
  }
1431
- }))))), this.flowState = e;
1432
- }
1433
- nativeResume(e, t) {
1434
- var s, o, n, a, l;
1435
- const d = JSON.parse(t);
1436
- if (e === "oauthWeb" || e === "sso") {
1437
- let { exchangeCode: u } = d;
1438
- u || (u = (s = new URL(d.url).searchParams) === null || s === void 0 ? void 0 : s.get(rt)), (n = (o = this.nativeCallbacks).complete) === null || n === void 0 || n.call(o, { exchangeCode: u, idpInitiated: !0 });
1439
- } else if (e === "magicLink") {
1440
- const u = new URL(d.url), c = u.searchParams.get(nt), h = u.searchParams.get(ot).split("_").pop();
1441
- r(this, me, "f").call(this), this.flowState.update({ token: c, stepId: h, action: void 0 });
1442
- } else if (e === "beforeScreen") {
1443
- const { screenResolve: u } = this.nativeCallbacks;
1444
- this.nativeCallbacks.screenResolve = null;
1445
- const { override: c } = d;
1446
- c || (this.nativeCallbacks.screenNext = null), u == null || u(c);
1447
- } else if (e === "resumeScreen") {
1448
- const { interactionId: u, form: c } = d, { screenNext: h } = this.nativeCallbacks;
1449
- this.nativeCallbacks.screenNext = null, h == null || h(u, c);
1450
- } else (l = (a = this.nativeCallbacks).complete) === null || l === void 0 || l.call(a, d);
1451
- }
1452
- loadSdkScriptsModules() {
1453
- const e = this.shadowRoot.querySelectorAll("div[data-script-id]");
1454
- return Array.from(e).map(((t) => t.moduleRes)).filter(((t) => !!t));
1455
- }
1456
- loadSdkScripts(e) {
1457
- if (!(e != null && e.length)) return null;
1458
- const t = (n, a) => (l) => {
1459
- this.dispatchEvent(new CustomEvent("components-context", { detail: { [po(n.id, n.resultKey)]: l }, bubbles: !0, composed: !0 })), a(n.id);
1549
+ ),
1550
+ "."
1551
+ ] }) });
1552
+ }
1553
+ function Ea({ projectId: e, onSuccess: t, onError: n }) {
1554
+ return e ? /* @__PURE__ */ d(ba, { projectId: e, children: /* @__PURE__ */ d(
1555
+ Ca,
1556
+ {
1557
+ flowId: "sign-up-or-in-otp-or-social",
1558
+ onSuccess: t,
1559
+ onError: n
1560
+ }
1561
+ ) }) : null;
1562
+ }
1563
+ function to({
1564
+ options: e,
1565
+ value: t,
1566
+ onChange: n,
1567
+ otherValue: o,
1568
+ onOtherChange: r,
1569
+ placeholder: i,
1570
+ otherPlaceholder: a = "Please specify",
1571
+ compact: l = !1
1572
+ }) {
1573
+ const [s, c] = C(!1), u = Se(null);
1574
+ de(() => {
1575
+ const v = (A) => {
1576
+ u.current && !u.current.contains(A.target) && c(!1);
1460
1577
  };
1461
- this.loggerWrapper.debug(`Preparing to load scripts: ${e.map(((n) => n.id)).join(", ")}`);
1462
- const s = Promise.all(e == null ? void 0 : e.map(((n) => y(this, void 0, void 0, (function* () {
1463
- var a, l;
1464
- const d = this.shadowRoot.querySelector(`[data-script-id="${n.id}"]`);
1465
- if (d) {
1466
- this.loggerWrapper.debug("Script already loaded", n.id);
1467
- const { moduleRes: c } = d;
1468
- return (a = c == null ? void 0 : c.start) === null || a === void 0 || a.call(c), c;
1578
+ return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
1579
+ }, []);
1580
+ const p = (v) => {
1581
+ t.includes(v) ? (n(t.filter((A) => A !== v)), v === "Other" && r("")) : n([...t, v]);
1582
+ }, f = (v) => {
1583
+ n(t.filter((A) => A !== v)), v === "Other" && r("");
1584
+ }, x = "rgba(34, 197, 94, 0.14)", h = l ? "6px 10px" : "8px 12px", m = l ? 36 : 40, y = l ? 15 : 16, E = l ? 200 : 260, T = l ? "6px 8px" : "8px 10px", N = t.includes("Other"), D = () => c((v) => !v);
1585
+ return /* @__PURE__ */ d("div", { ref: u, style: { width: "100%" }, children: /* @__PURE__ */ k("div", { style: { position: "relative", width: "100%" }, children: [
1586
+ /* @__PURE__ */ k(
1587
+ "div",
1588
+ {
1589
+ role: "combobox",
1590
+ "aria-expanded": s,
1591
+ onClick: (v) => {
1592
+ v.target instanceof HTMLInputElement || v.target instanceof HTMLElement && v.target.closest("button") || D();
1593
+ },
1594
+ style: {
1595
+ width: "100%",
1596
+ minHeight: m,
1597
+ padding: h,
1598
+ display: "flex",
1599
+ flexDirection: "row",
1600
+ alignItems: "center",
1601
+ justifyContent: "space-between",
1602
+ gap: 8,
1603
+ textAlign: "left",
1604
+ fontSize: y,
1605
+ fontWeight: 400,
1606
+ lineHeight: "23px",
1607
+ border: "1px solid var(--color-input-border)",
1608
+ borderRadius: 4,
1609
+ background: "white",
1610
+ color: t.length ? "var(--color-text)" : "var(--color-text-secondary)",
1611
+ fontFamily: O,
1612
+ boxSizing: "border-box",
1613
+ cursor: "pointer"
1614
+ },
1615
+ children: [
1616
+ /* @__PURE__ */ d(
1617
+ "div",
1618
+ {
1619
+ style: {
1620
+ flex: 1,
1621
+ display: "flex",
1622
+ flexDirection: "row",
1623
+ flexWrap: "wrap",
1624
+ alignItems: "center",
1625
+ gap: 6,
1626
+ minWidth: 0,
1627
+ cursor: "text"
1628
+ },
1629
+ children: t.length === 0 ? /* @__PURE__ */ d(
1630
+ "span",
1631
+ {
1632
+ style: { color: "var(--color-text-secondary)", cursor: "pointer" },
1633
+ onClick: (v) => {
1634
+ v.stopPropagation(), D();
1635
+ },
1636
+ onKeyDown: (v) => {
1637
+ (v.key === "Enter" || v.key === " ") && D();
1638
+ },
1639
+ role: "button",
1640
+ tabIndex: 0,
1641
+ children: i
1642
+ }
1643
+ ) : /* @__PURE__ */ k(me, { children: [
1644
+ t.map((v) => /* @__PURE__ */ k(
1645
+ "span",
1646
+ {
1647
+ onClick: (A) => A.stopPropagation(),
1648
+ style: {
1649
+ display: "inline-flex",
1650
+ alignItems: "center",
1651
+ gap: 4,
1652
+ padding: "4px 8px",
1653
+ borderRadius: 4,
1654
+ background: x,
1655
+ fontSize: 13,
1656
+ fontWeight: 500,
1657
+ color: "var(--color-text)",
1658
+ flexShrink: 0
1659
+ },
1660
+ children: [
1661
+ v,
1662
+ /* @__PURE__ */ d(
1663
+ "span",
1664
+ {
1665
+ role: "button",
1666
+ tabIndex: 0,
1667
+ onClick: (A) => {
1668
+ A.stopPropagation(), f(v);
1669
+ },
1670
+ onKeyDown: (A) => {
1671
+ (A.key === "Enter" || A.key === " ") && (A.preventDefault(), A.stopPropagation(), f(v));
1672
+ },
1673
+ style: { cursor: "pointer", fontSize: 14, lineHeight: 1, opacity: 0.7 },
1674
+ children: "×"
1675
+ }
1676
+ )
1677
+ ]
1678
+ },
1679
+ v
1680
+ )),
1681
+ N && /* @__PURE__ */ d(
1682
+ "input",
1683
+ {
1684
+ type: "text",
1685
+ value: o,
1686
+ onChange: (v) => r(v.target.value),
1687
+ placeholder: a,
1688
+ onMouseDown: (v) => v.stopPropagation(),
1689
+ onClick: (v) => v.stopPropagation(),
1690
+ onFocus: (v) => {
1691
+ v.stopPropagation(), v.target.style.borderColor = "var(--color-green)", v.target.style.boxShadow = "0 0 0 3px var(--color-green-ring)";
1692
+ },
1693
+ onBlur: (v) => {
1694
+ v.target.style.borderColor = "#cfcece", v.target.style.boxShadow = "none";
1695
+ },
1696
+ style: {
1697
+ flex: "1 1 120px",
1698
+ minWidth: 80,
1699
+ maxWidth: "100%",
1700
+ minHeight: l ? 26 : 28,
1701
+ padding: "2px 8px",
1702
+ border: "1px solid #cfcece",
1703
+ borderRadius: 4,
1704
+ outline: "none",
1705
+ background: "transparent",
1706
+ fontSize: y,
1707
+ fontFamily: O,
1708
+ color: "var(--color-text)",
1709
+ boxSizing: "border-box"
1710
+ }
1711
+ }
1712
+ )
1713
+ ] })
1714
+ }
1715
+ ),
1716
+ /* @__PURE__ */ d(
1717
+ "button",
1718
+ {
1719
+ type: "button",
1720
+ tabIndex: -1,
1721
+ onClick: (v) => {
1722
+ v.stopPropagation(), D();
1723
+ },
1724
+ style: {
1725
+ flexShrink: 0,
1726
+ display: "flex",
1727
+ alignItems: "center",
1728
+ justifyContent: "center",
1729
+ padding: 0,
1730
+ margin: 0,
1731
+ border: "none",
1732
+ background: "none",
1733
+ cursor: "pointer",
1734
+ color: "var(--color-text-secondary)"
1735
+ },
1736
+ "aria-label": s ? "Close options" : "Open options",
1737
+ children: /* @__PURE__ */ d(
1738
+ oo,
1739
+ {
1740
+ size: l ? 16 : 18,
1741
+ style: {
1742
+ transform: s ? "rotate(180deg)" : "rotate(0deg)",
1743
+ transition: "transform 0.2s ease"
1744
+ }
1745
+ }
1746
+ )
1747
+ }
1748
+ )
1749
+ ]
1469
1750
  }
1470
- yield this.injectNpmLib("@descope/flow-scripts", "1.0.13", `dist/${n.id}.js`);
1471
- const u = (l = globalThis.descope) === null || l === void 0 ? void 0 : l[n.id];
1472
- return new Promise(((c, h) => {
1473
- try {
1474
- const p = u(n.initArgs, { baseUrl: this.baseUrl, ref: this }, t(n, c), this.loggerWrapper);
1475
- if (p) {
1476
- const f = document.createElement("div");
1477
- f.setAttribute("data-script-id", n.id), f.moduleRes = p, this.shadowRoot.appendChild(f), this.nextRequestStatus.subscribe((() => {
1478
- var m;
1479
- this.loggerWrapper.debug("Unloading script", n.id), (m = p.stop) === null || m === void 0 || m.call(p);
1480
- }));
1481
- }
1482
- } catch (p) {
1483
- h(p);
1484
- }
1485
- }));
1486
- }))))), o = new Promise(((n) => {
1487
- setTimeout((() => {
1488
- this.loggerWrapper.warn("SDK scripts loading timeout"), n(!0);
1489
- }), li);
1490
- }));
1491
- return Promise.race([s, o]);
1492
- }
1493
- get isDismissScreenErrorOnInput() {
1494
- return this.getAttribute("dismiss-screen-error-on-input") === "true";
1495
- }
1496
- init() {
1497
- if (!window.descopeBridge) return this._init();
1498
- this.lazyInit = this._init;
1499
- }
1500
- _init() {
1501
- const e = Object.create(null, { init: { get: () => super.init } });
1502
- return y(this, void 0, void 0, (function* () {
1503
- var t, s;
1504
- this.shadowRoot.isConnected && ((t = this.flowState) === null || t === void 0 || t.subscribe(this.onFlowChange.bind(this)), r(this, w, "m", Qe).call(this), window.addEventListener("visibilitychange", r(this, je, "f").visibilitychange)), yield (s = e.init) === null || s === void 0 ? void 0 : s.call(this);
1505
- }));
1506
- }
1507
- disconnectedCallback() {
1508
- var e;
1509
- super.disconnectedCallback(), this.flowState.unsubscribeAll(), this.stepState.unsubscribeAll(), r(this, me, "f").call(this), (e = r(this, G, "f")) === null || e === void 0 || e.abort(), S(this, G, null, "f"), window.removeEventListener("visibilitychange", r(this, je, "f").visibilitychange);
1510
- }
1511
- getHtmlFilenameWithLocale(e, t) {
1512
- return y(this, void 0, void 0, (function* () {
1513
- let s;
1514
- const o = qe(e), n = yield this.getTargetLocales();
1515
- return n.includes(o.locale) ? s = `${t}-${o.locale}.html` : n.includes(o.fallback) && (s = `${t}-${o.fallback}.html`), s;
1516
- }));
1517
- }
1518
- getPageContent(e, t) {
1519
- return y(this, void 0, void 0, (function* () {
1520
- if (t) try {
1521
- const { body: s } = yield this.fetchStaticResource(t, "text");
1522
- return s;
1523
- } catch (s) {
1524
- this.loggerWrapper.error(`Failed to fetch flow page from ${t}. Fallback to url ${e}`, s);
1751
+ ),
1752
+ s && /* @__PURE__ */ d(
1753
+ "div",
1754
+ {
1755
+ style: {
1756
+ position: "absolute",
1757
+ left: 0,
1758
+ right: 0,
1759
+ top: "100%",
1760
+ marginTop: 4,
1761
+ padding: l ? 6 : 8,
1762
+ maxHeight: E,
1763
+ overflowY: "auto",
1764
+ background: "white",
1765
+ border: "1px solid var(--color-input-border)",
1766
+ borderRadius: 4,
1767
+ boxShadow: "0 8px 24px rgba(0,0,0,0.08)",
1768
+ zIndex: 50,
1769
+ boxSizing: "border-box"
1770
+ },
1771
+ children: e.map((v) => /* @__PURE__ */ k(
1772
+ "label",
1773
+ {
1774
+ style: {
1775
+ display: "flex",
1776
+ alignItems: "center",
1777
+ gap: 10,
1778
+ padding: T,
1779
+ borderRadius: 4,
1780
+ cursor: "pointer",
1781
+ fontSize: l ? 14 : 15,
1782
+ fontFamily: O,
1783
+ color: "var(--color-text)"
1784
+ },
1785
+ children: [
1786
+ /* @__PURE__ */ d(
1787
+ "input",
1788
+ {
1789
+ type: "checkbox",
1790
+ checked: t.includes(v),
1791
+ onChange: () => p(v),
1792
+ style: { width: 16, height: 16, accentColor: "var(--color-green)" }
1793
+ }
1794
+ ),
1795
+ v
1796
+ ]
1797
+ },
1798
+ v
1799
+ ))
1525
1800
  }
1801
+ )
1802
+ ] }) });
1803
+ }
1804
+ function Wa({
1805
+ onLogin: e,
1806
+ onForgotPassword: t,
1807
+ onOneTimeCode: n,
1808
+ onVerifyCode: o,
1809
+ onResendCode: r,
1810
+ onSignUp: i,
1811
+ onJoinWaitlist: a,
1812
+ onWaitlistSubmit: l,
1813
+ onResetPassword: s,
1814
+ onTerms: c,
1815
+ onPrivacyPolicy: u,
1816
+ onDescopeSuccess: p,
1817
+ onDescopeError: f,
1818
+ descopeProjectId: x,
1819
+ onGoToLogin: h,
1820
+ loading: m,
1821
+ error: y,
1822
+ codeError: E,
1823
+ defaultView: T = "signin",
1824
+ signupMode: N = "signup"
1825
+ }) {
1826
+ var En, jn;
1827
+ const [D, v] = C(""), [A, B] = C(""), [V, Z] = C(!1), [_, H] = C(!1), [$, Q] = C(!1), [pe, z] = C(!1), [ne, fe] = C(null), [K, W] = C(T), [oe, je] = C(""), [ie, P] = C(""), [Be, ln] = C(""), [ve, Ge] = C(["", "", "", "", "", ""]), He = Se([]), [yt, Ro] = C(""), [wt, No] = C(""), [qe, Fo] = C(""), [Ze, Lo] = C(""), [bt, zo] = C(""), [xt, Bo] = C(!1), [kt, Ho] = C(!1), [cn, De] = C(""), [It, qo] = C(""), [dn, un] = C(0), pn = 3, [hn, Jo] = C(""), [gn, Mo] = C(""), [fn, Wo] = C(""), [vn, Ko] = C(""), [St, Vo] = C(""), [mn, $o] = C([]), [yn, Yo] = C([]), [Ct, Qo] = C(""), [Ot, Xo] = C(""), [wn, we] = C(""), [bn, xn] = C(!1), [Go, Zo] = C(!1), [_o, er] = C(1267), [Je, tr] = C("");
1828
+ de(() => {
1829
+ const g = setInterval(() => un((S) => (S + 1) % pn), 4e3);
1830
+ return () => clearInterval(g);
1831
+ }, []);
1832
+ const Ae = Se(null), Ue = Se(null);
1833
+ de(() => {
1834
+ const g = (ae) => {
1835
+ if (!ae)
1836
+ return !1;
1526
1837
  try {
1527
- const { body: s } = yield this.fetchStaticResource(e, "text");
1528
- return s;
1529
- } catch (s) {
1530
- this.loggerWrapper.error("Failed to fetch flow page", s.message);
1531
- }
1532
- return null;
1533
- }));
1534
- }
1535
- onFlowChange(e, t, s) {
1536
- return y(this, void 0, void 0, (function* () {
1537
- var o, n;
1538
- const { projectId: a, flowId: l, tenant: d, stepId: u, executionId: c, action: h, screenId: p, screenState: f, redirectTo: m, redirectIsPopup: A, redirectUrl: C, token: g, code: v, isPopup: b, exchangeError: k, webauthnTransactionId: T, webauthnOptions: L, redirectAuthCodeChallenge: P, redirectAuthCallbackUrl: D, redirectAuthBackupCallbackUri: F, redirectAuthInitiator: oe, locale: z, samlIdpResponseUrl: Ee, samlIdpResponseSamlResponse: V, samlIdpResponseRelayState: ne, nativeResponseType: xe, nativePayload: B, reqTimestamp: Z } = e, M = be(e, ["projectId", "flowId", "tenant", "stepId", "executionId", "action", "screenId", "screenState", "redirectTo", "redirectIsPopup", "redirectUrl", "token", "code", "isPopup", "exchangeError", "webauthnTransactionId", "webauthnOptions", "redirectAuthCodeChallenge", "redirectAuthCallbackUrl", "redirectAuthBackupCallbackUri", "redirectAuthInitiator", "locale", "samlIdpResponseUrl", "samlIdpResponseSamlResponse", "samlIdpResponseRelayState", "nativeResponseType", "nativePayload", "reqTimestamp"]);
1539
- let N, Ve, Ie;
1540
- const _e = $o(), { outboundAppId: gt } = this, { outboundAppScopes: ft } = this, Y = this.sdk.getLastUserLoginId(), _ = yield this.getFlowConfig(), Q = yield this.getProjectConfig(), mt = Object.entries(Q.flows || {}).reduce(((I, [E, W]) => (I[E] = W.version, I)), {}), vt = D && P ? { callbackUrl: D, codeChallenge: P, backupCallbackUri: F } : void 0, bt = this.nativeOptions ? { platform: this.nativeOptions.platform, bridgeVersion: this.nativeOptions.bridgeVersion, oauthProvider: this.nativeOptions.oauthProvider, oauthRedirect: this.nativeOptions.oauthRedirect, magicLinkRedirect: this.nativeOptions.magicLinkRedirect, ssoRedirect: this.nativeOptions.ssoRedirect } : void 0;
1541
- let wt = {};
1542
- if (!c) {
1543
- const I = [..._.clientScripts || [], ..._.sdkScripts || []];
1544
- if (_.conditions) {
1545
- let E = [];
1546
- ({ startScreenId: N, conditionInteractionId: Ie, startScreenName: Ve, clientScripts: E, componentsConfig: wt } = Uo({ loginId: Y, code: v, token: g, abTestingKey: _e, lastAuth: $e(Y) }, _.conditions)), I.push(...E || []);
1547
- } else _.condition ? { startScreenId: N, conditionInteractionId: Ie } = Oo(_.condition, { loginId: Y, code: v, token: g, abTestingKey: _e, lastAuth: $e(Y) }) : (Ve = _.startScreenName, N = _.startScreenId);
1548
- if (S(this, ue, this.loadSdkScripts(I), "f"), _.fingerprintEnabled && _.fingerprintKey ? yield Yi(_.fingerprintKey, this.baseUrl) : Qi(), !Et(N, M)) {
1549
- const E = yield this.sdk.flow.start(l, Object.assign(Object.assign(Object.assign(Object.assign({ tenant: d, redirectAuth: vt }, M), { client: this.client }), C && { redirectUrl: C }), { lastAuth: $e(Y), abTestingKey: _e, locale: qe(z).locale, nativeOptions: bt, outboundAppId: gt, outboundAppScopes: ft }), Ie, "", Q.componentsVersion, mt, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.formConfigValues), v ? { exchangeCode: v, idpInitiated: !0 } : {}), M.descopeIdpInitiated && { idpInitiated: !0 }), g ? { token: g } : {}), M.oidcLoginHint ? { externalId: M.oidcLoginHint } : {}));
1550
- return r(this, H, "f").call(this, E), void (((o = E == null ? void 0 : E.data) === null || o === void 0 ? void 0 : o.status) !== "completed" && this.flowState.update({ code: void 0, token: void 0 }));
1551
- }
1552
- }
1553
- if (this.loggerWrapper.debug("Before popup postmessage send", JSON.stringify({ isPopup: b, code: v, exchangeError: k, isCodeChanged: s("code"), isExchangeErrorChanged: s("exchangeError") })), b && (s("code") && v || s("exchangeError") && k)) return void r(this, w, "m", Pi).call(this, c, v, k);
1554
- if (c && (s("token") && g || s("code") && v || s("exchangeError") && k)) {
1555
- const I = yield this.sdk.flow.next(c, u, pe.submit, _.version, Q.componentsVersion, { token: g, exchangeCode: v, exchangeError: k });
1556
- return r(this, H, "f").call(this, I), void this.flowState.update({ token: void 0, code: void 0, exchangeError: void 0 });
1557
- }
1558
- if (h === q.loadForm && ["samlIdpResponseUrl", "samlIdpResponseSamlResponse", "samlIdpResponseRelayState"].some(((I) => s(I)))) {
1559
- if (!Ee || !V) return void this.loggerWrapper.error("Did not get saml idp params data to load");
1560
- ro(Ee, V, ne || "", ao);
1561
- }
1562
- if (h === q.redirect && (s("redirectTo") || s("deferredRedirect"))) {
1563
- if (!m) return void this.loggerWrapper.error("Did not get redirect url");
1564
- if (m === "no-op") return;
1565
- if (oe === "android" && document.hidden) return void this.flowState.update({ deferredRedirect: !0 });
1566
- if (this.loggerWrapper.debug(`Redirect is popup ${A}`), A) {
1567
- this.loggerWrapper.debug("Opening redirect in popup");
1568
- const I = go(m, "?", 598, 700), E = this.shouldUsePopupPostMessage();
1569
- E && (I.name = `descope-wc|${window.location.origin}`), this.loggerWrapper.debug("Popup communication method: " + (E ? "postMessage" : "BroadcastChannel"));
1570
- const W = (te) => {
1571
- this.loggerWrapper.debug("Received popup message", JSON.stringify(te.data));
1572
- const yt = E ? this.popupOrigin : window.location.origin;
1573
- if (te.origin !== yt) return void this.loggerWrapper.debug(`Ignoring message from unexpected origin. received: "${te.origin}", expected: "${yt}"`);
1574
- const { action: Ji, data: Ct } = te.data || {};
1575
- Ji === "code" && this.flowState.update({ code: Ct.code, exchangeError: Ct.exchangeError });
1576
- };
1577
- let O;
1578
- this.loggerWrapper.debug("Starting popup closed detection");
1579
- const Gi = setInterval((() => {
1580
- I.closed && (this.loggerWrapper.debug("Popup closed, dispatching popupclosed event"), clearInterval(Gi), r(this, w, "m", J).call(this, "popupclosed", {}), this.loggerWrapper.debug("Cleaning up popup listeners"), O == null || O());
1581
- }), 1e3);
1582
- if (E) window.addEventListener("message", W), O = () => {
1583
- this.loggerWrapper.debug("Cleaning up popup postMessage listener"), window.removeEventListener("message", W);
1584
- };
1585
- else {
1586
- this.loggerWrapper.debug("Creating broadcast channel");
1587
- const te = new BroadcastChannel(c);
1588
- te.onmessage = W, O = () => {
1589
- this.loggerWrapper.debug("Closing channel"), te.close();
1590
- };
1591
- }
1592
- } else this.handleRedirect(m), this.flowState.update({ redirectTo: "no-op" }), r(this, w, "m", J).call(this, "popupclosed", {});
1593
- return;
1838
+ return ae.matches(":-webkit-autofill, :autofill");
1839
+ } catch {
1840
+ return !1;
1594
1841
  }
1595
- if (h === q.webauthnCreate || h === q.webauthnGet) {
1596
- if (!T || !L) return void this.loggerWrapper.error("Did not get webauthn transaction id or options");
1597
- let I, E;
1598
- (n = r(this, G, "f")) === null || n === void 0 || n.abort(), S(this, G, null, "f");
1599
- try {
1600
- I = h === q.webauthnCreate ? yield this.sdk.webauthn.helpers.create(L) : yield this.sdk.webauthn.helpers.get(L);
1601
- } catch (O) {
1602
- O.name === "InvalidStateError" ? this.loggerWrapper.warn("WebAuthn operation failed", O.message) : O.name !== "NotAllowedError" && this.loggerWrapper.error(O.message), E = O.name;
1603
- }
1604
- const W = yield this.sdk.flow.next(c, u, pe.submit, _.version, Q.componentsVersion, { transactionId: T, response: I, failure: E });
1605
- r(this, H, "f").call(this, W);
1842
+ }, S = () => {
1843
+ const ae = Ae.current, et = Ue.current;
1844
+ ae && ae.value && v(ae.value), et && et.value && B(et.value), Z(g(ae)), H(g(et));
1845
+ }, U = [100, 300, 600, 1e3, 2e3].map((ae) => setTimeout(S, ae)), L = (ae) => {
1846
+ (ae.animationName === "onAutoFillStart" || ae.target.matches(":-webkit-autofill")) && setTimeout(S, 50);
1847
+ }, R = Ae.current, I = Ue.current;
1848
+ R == null || R.addEventListener("animationstart", L), I == null || I.addEventListener("animationstart", L);
1849
+ const ee = () => setTimeout(S, 0), le = () => setTimeout(S, 0);
1850
+ return R == null || R.addEventListener("input", ee), I == null || I.addEventListener("input", ee), R == null || R.addEventListener("change", le), I == null || I.addEventListener("change", le), () => {
1851
+ U.forEach(clearTimeout), R == null || R.removeEventListener("animationstart", L), I == null || I.removeEventListener("animationstart", L), R == null || R.removeEventListener("input", ee), I == null || I.removeEventListener("input", ee), R == null || R.removeEventListener("change", le), I == null || I.removeEventListener("change", le);
1852
+ };
1853
+ }, []), de(() => {
1854
+ const g = (L) => {
1855
+ if (!L)
1856
+ return !1;
1857
+ try {
1858
+ return L.matches(":-webkit-autofill, :autofill");
1859
+ } catch {
1860
+ return !1;
1606
1861
  }
1607
- if (h === q.nativeBridge) return this.nativeCallbacks.complete = (I) => y(this, void 0, void 0, (function* () {
1608
- const E = yield this.sdk.flow.next(c, u, pe.submit, _.version, Q.componentsVersion, I);
1609
- r(this, H, "f").call(this, E);
1610
- })), r(this, w, "m", Te).call(this, xe, B), void setTimeout((() => {
1611
- this.dispatchEvent(new Event("popupclosed"));
1612
- }), 500);
1613
- if ((s("action") || s("deferredPolling")) && r(this, ce, "f").call(this, c, u, _.version, Q.componentsVersion), !p && !N) return void this.loggerWrapper.warn("No screen was found to show");
1614
- const Be = N || p, Di = yield this.getHtmlFilenameWithLocale(z, Be), { oidcLoginHint: Fi, oidcPrompt: Vi, oidcErrorRedirectUri: Bi, oidcResource: qi, samlIdpUsername: Ki } = M, ee = { direction: ws(u, t.stepId), screenState: Object.assign(Object.assign({}, f), { form: Object.assign(Object.assign({}, this.formConfigValues), f == null ? void 0 : f.form), lastAuth: { loginId: Y, name: this.sdk.getLastUserDisplayName() || Y }, componentsConfig: Object.assign(Object.assign(Object.assign({}, _.componentsConfig), wt), f == null ? void 0 : f.componentsConfig) }), htmlFilename: `${Be}.html`, htmlLocaleFilename: Di, screenId: Be, stepName: e.stepName || Ve, samlIdpUsername: Ki, oidcLoginHint: Fi, oidcPrompt: Vi, oidcErrorRedirectUri: Bi, oidcResource: qi, action: h }, Hi = $e(Y);
1615
- Et(N, M) ? ee.next = (I, E) => y(this, void 0, void 0, (function* () {
1616
- const W = (_ == null ? void 0 : _.clientScripts) || [];
1617
- yield r(this, w, "m", st).call(this, W);
1618
- const O = yield this.sdk.flow.start(l, Object.assign(Object.assign(Object.assign(Object.assign({ tenant: d, redirectAuth: vt }, M), { lastAuth: Hi, preview: this.preview, abTestingKey: _e, client: this.client }), C && { redirectUrl: C }), { locale: qe(z).locale, nativeOptions: bt, outboundAppId: gt, outboundAppScopes: ft }), Ie, I, Q.componentsVersion, mt, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.formConfigValues), this.getComponentsContext()), It(E)), v && { exchangeCode: v, idpInitiated: !0 }), M.descopeIdpInitiated && { idpInitiated: !0 }), g && { token: g }), ee.next.isCustomScreen);
1619
- return r(this, H, "f").call(this, O), O;
1620
- })) : (s("projectId") || s("baseUrl") || s("executionId") || s("stepId")) && (ee.next = (I, E) => y(this, void 0, void 0, (function* () {
1621
- const W = (f == null ? void 0 : f.clientScripts) || [];
1622
- yield r(this, w, "m", st).call(this, W);
1623
- const O = yield this.sdk.flow.next(c, u, I, _.version, Q.componentsVersion, Object.assign(Object.assign({}, this.getComponentsContext()), It(E)), ee.next.isCustomScreen);
1624
- return r(this, H, "f").call(this, O), O;
1625
- }))), this.loggerWrapper.debug("Got a screen with id", ee.screenId), yield r(this, w, "m", Oi).call(this, ee), this.stepState.update(ee);
1626
- }));
1627
- }
1628
- onStepChange(e, t) {
1629
- return y(this, void 0, void 0, (function* () {
1630
- var s, o;
1631
- const { htmlFilename: n, htmlLocaleFilename: a, direction: l, next: d, screenState: u } = e;
1632
- this.loggerWrapper.debug("Rendering a flow screen");
1633
- const c = document.createElement("template");
1634
- c.innerHTML = yield this.getPageContent(n, a);
1635
- const h = c.content.cloneNode(!0), p = this.loadDescopeUiComponents(c);
1636
- this.sdk.webauthn.helpers.isSupported() ? yield r(this, w, "m", Ui).call(this, h, d) : xo(h), !e.samlIdpUsername || !((s = u.form) === null || s === void 0) && s.loginId || !((o = u.form) === null || o === void 0) && o.email || (u.form || (u.form = {}), u.form.loginId = e.samlIdpUsername, u.form.email = e.samlIdpUsername), Co(h, u, this.formConfig, this.loggerWrapper);
1637
- const { geo: f } = yield this.getExecutionContext();
1638
- Eo(h, f);
1639
- const m = () => y(this, void 0, void 0, (function* () {
1640
- var A, C;
1641
- yield p;
1642
- const g = this.contentRootElement;
1643
- ko(g, (A = u == null ? void 0 : u.totp) === null || A === void 0 ? void 0 : A.image), Ao(g, (C = u == null ? void 0 : u.notp) === null || C === void 0 ? void 0 : C.image), yo(g, h, u.cssVars, this.loggerWrapper), g.replaceChildren(h);
1644
- const v = !t.htmlFilename;
1645
- setTimeout((() => {
1646
- r(this, w, "m", Li).call(this), this.validateOnBlur && oo(g), So(g, u), r(this, w, "m", it).call(this, { isFirstScreen: v, isCustomScreen: !1, stepName: e.stepName }), pi(g, this.autoFocus, v);
1647
- })), r(this, w, "m", Wi).call(this, d), g.querySelector(`[${De}="polling"]`) && d(pe.polling, {});
1648
- }));
1649
- l ? r(this, w, "m", Ze).call(this, m) : m();
1650
- }));
1651
- }
1652
- getInputs() {
1653
- return Array.from(this.shadowRoot.querySelectorAll(`*:not(slot)[name]:not([${at}])`));
1654
- }
1655
- shouldUsePopupPostMessage() {
1656
- if (!this.popupOrigin) return !1;
1657
- try {
1658
- new URL(this.popupOrigin);
1659
- } catch {
1660
- return !1;
1661
- }
1662
- return !0;
1663
- }
1664
- }
1665
- fe = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), ve = /* @__PURE__ */ new WeakMap(), We = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakSet(), _i = function() {
1666
- document.hidden || setTimeout((() => {
1667
- this.flowState.update({ deferredRedirect: !1, deferredPolling: !1 });
1668
- }), 300);
1669
- }, Nt = function(i, e, t) {
1670
- return y(this, void 0, void 0, (function* () {
1671
- var s;
1672
- return ((s = this.nativeOptions) === null || s === void 0 ? void 0 : s.bridgeVersion) >= 2 && new Promise(((o) => {
1673
- this.nativeCallbacks.screenNext = t, this.nativeCallbacks.screenResolve = o, r(this, w, "m", Te).call(this, "beforeScreen", { screen: i, context: e });
1674
- }));
1675
- }));
1676
- }, Dt = function(i) {
1677
- var e;
1678
- ((e = this.nativeOptions) === null || e === void 0 ? void 0 : e.bridgeVersion) >= 2 && r(this, w, "m", Te).call(this, "afterScreen", { screen: i });
1679
- }, Te = function(i, e) {
1680
- r(this, w, "m", J).call(this, "bridge", { type: i, payload: e });
1681
- }, Ft = function({ errorText: i, errorType: e }) {
1682
- const t = () => {
1683
- var s;
1684
- let o = i;
1685
- try {
1686
- o = ((s = this.errorTransformer) === null || s === void 0 ? void 0 : s.call(this, { text: i, type: e })) || i;
1687
- } catch (n) {
1688
- this.loggerWrapper.error("Error transforming error message", n.message);
1689
- }
1690
- wo(this.contentRootElement, "error-message", o);
1691
- };
1692
- this.addEventListener("screen-updated", t, { once: !0 }), t();
1693
- }, Qe = function() {
1694
- var i, e, t;
1695
- (i = this.stepState) === null || i === void 0 || i.subscribe(this.onStepChange.bind(this), ((s) => {
1696
- var o = s.screenState, n = be(o === void 0 ? {} : o, ["errorText", "errorType"]), a = be(s, ["screenState"]);
1697
- return Object.assign(Object.assign({}, a), { screenState: n });
1698
- })), (e = this.stepState) === null || e === void 0 || e.subscribe(r(this, w, "m", Ft).bind(this), ((s) => {
1699
- var o, n;
1700
- return { errorText: (o = s == null ? void 0 : s.screenState) === null || o === void 0 ? void 0 : o.errorText, errorType: (n = s == null ? void 0 : s.screenState) === null || n === void 0 ? void 0 : n.errorType };
1701
- }), { forceUpdate: !0 }), (t = this.stepState) === null || t === void 0 || t.subscribe(r(this, w, "m", Vt).bind(this), ((s) => {
1702
- var o, n;
1703
- return { errorText: (o = s == null ? void 0 : s.screenState) === null || o === void 0 ? void 0 : o.errorText, errorType: (n = s == null ? void 0 : s.screenState) === null || n === void 0 ? void 0 : n.errorType };
1704
- }), { forceUpdate: !0 });
1705
- }, Vt = function({ errorText: i, errorType: e }) {
1706
- (e || i) && (this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach(((t) => {
1707
- t.shadowRoot.querySelectorAll("descope-text-field[data-id]").forEach(((s) => {
1708
- s.value = "";
1709
- }));
1710
- })), pi(this.contentRootElement, this.autoFocus, !1));
1711
- }, $i = function() {
1712
- return y(this, void 0, void 0, (function* () {
1713
- this.loggerWrapper.debug("Trying to restart the flow");
1714
- const i = yield this.getComponentsVersion();
1715
- this.reset(), i === (yield this.getComponentsVersion()) ? (this.loggerWrapper.debug("Components version was not changed, restarting flow"), this.flowState.update({ stepId: null, executionId: null })) : this.loggerWrapper.error("Components version mismatch, please reload the page");
1716
- }));
1717
- }, Oi = function(i) {
1718
- return y(this, void 0, void 0, (function* () {
1719
- var e;
1720
- const t = Object.assign(Object.assign({}, this.stepState.current), i), { next: s, stepName: o } = t, n = be(t, ["next", "stepName"]), a = ho(n);
1721
- let l = yield r(this, w, "m", Nt).call(this, o, a, s);
1722
- l || (l = !!(yield (e = this.onScreenUpdate) === null || e === void 0 ? void 0 : e.call(this, o, a, s, this)));
1723
- const d = !this.stepState.current.htmlFilename;
1724
- if (r(this, Xe, "f").call(this, l), s && (s.isCustomScreen = l), r(this, Le, "f") !== l) {
1725
- const [u, c] = ["flow", "custom"].sort((() => l ? -1 : 1));
1726
- this.loggerWrapper.debug(`Switching from ${c} screen to ${u} screen`), S(this, Le, l, "f"), l ? this.stepState.unsubscribeAll() : r(this, w, "m", Qe).call(this);
1862
+ }, S = () => {
1863
+ var I, ee;
1864
+ const L = ((I = Ae.current) == null ? void 0 : I.value) || "", R = ((ee = Ue.current) == null ? void 0 : ee.value) || "";
1865
+ L && L !== D && v(L), R && R !== A && B(R), Z(g(Ae.current)), H(g(Ue.current));
1866
+ }, U = setInterval(S, 250);
1867
+ return window.addEventListener("focus", S), document.addEventListener("visibilitychange", S), () => {
1868
+ clearInterval(U), window.removeEventListener("focus", S), document.removeEventListener("visibilitychange", S);
1869
+ };
1870
+ }, [D, A]), de(() => {
1871
+ E && K === "verifycode" && (Ge(["", "", "", "", "", ""]), W("getcodewithname"));
1872
+ }, [E]);
1873
+ const kn = m ?? pe, be = y ?? ne, nr = (D || ((En = Ae.current) == null ? void 0 : En.value) || "").trim(), or = A || ((jn = Ue.current) == null ? void 0 : jn.value) || "", In = !!(!!(nr || V) && !!(or || _) && !kn), _e = K === "verifycode" || K === "getcodewithname" ? be : null, Sn = (g) => {
1874
+ g.target.style.borderColor = be ? "var(--color-text)" : "var(--color-green)", g.target.style.boxShadow = be ? "none" : "0 0 0 3px var(--color-green-ring)";
1875
+ }, Cn = (g) => {
1876
+ g.target.style.borderColor = be ? "var(--color-text)" : "var(--color-input-border)", g.target.style.boxShadow = "none";
1877
+ }, On = (g, S) => {
1878
+ var ee;
1879
+ const U = (S || "").replace(/\D/g, "");
1880
+ if (!U)
1881
+ return;
1882
+ const L = [...ve];
1883
+ let R = g;
1884
+ for (let le = 0; le < U.length && g + le < L.length; le += 1)
1885
+ L[g + le] = U[le], R = g + le;
1886
+ Ge(L);
1887
+ const I = Math.min(R + 1, L.length - 1);
1888
+ (ee = He.current[I]) == null || ee.focus();
1889
+ }, An = (g, S) => {
1890
+ var I;
1891
+ const U = S.replace(/\D/g, "");
1892
+ if (U.length > 1) {
1893
+ On(g, U);
1894
+ return;
1727
1895
  }
1728
- l ? (this.loggerWrapper.debug("Showing a custom screen"), r(this, w, "m", it).call(this, { isFirstScreen: d, isCustomScreen: l, stepName: i.stepName }), this.disableKeyPressHandler()) : this.handleKeyPress(), this.stepState.forceUpdate = l;
1729
- }));
1730
- }, Ze = function(i) {
1731
- this.contentRootElement.addEventListener("transitionend", (() => {
1732
- this.loggerWrapper.debug("page switch transition end"), this.contentRootElement.classList.remove("fade-out"), i();
1733
- }), { once: !0 }), this.loggerWrapper.debug("page switch transition start"), this.contentRootElement.classList.add("fade-out");
1734
- }, Bt = function(i) {
1735
- const e = i.getAttribute("name");
1736
- if (!["email"].includes(e)) {
1737
- const t = `user-${e}`;
1738
- i.setAttribute("name", t), i.addEventListener("input", (() => {
1739
- i.setAttribute("name", i.value ? e : t);
1740
- }));
1741
- }
1742
- }, Ui = function(i, e) {
1743
- return y(this, void 0, void 0, (function* () {
1744
- var t;
1745
- (t = r(this, G, "f")) === null || t === void 0 || t.abort();
1746
- const s = i.querySelector('*[autocomplete="webauthn"]');
1747
- if (s && (yield Io())) {
1748
- const { options: o, transactionId: n } = (yield r(this, tt, "f").call(this)) || {};
1749
- o && n && (r(this, w, "m", Bt).call(this, s), S(this, G, new AbortController(), "f"), this.sdk.webauthn.helpers.conditional(o, r(this, G, "f")).then(((a) => y(this, void 0, void 0, (function* () {
1750
- e(s.id, { transactionId: n, response: a });
1751
- })))).catch(((a) => {
1752
- a.name !== "AbortError" && this.loggerWrapper.error("Conditional login failed", a.message);
1753
- })));
1896
+ const L = U.slice(-1), R = [...ve];
1897
+ R[g] = L, Ge(R), L && g < 5 && ((I = He.current[g + 1]) == null || I.focus());
1898
+ }, Un = (g, S) => {
1899
+ var U;
1900
+ S.key === "Backspace" && !ve[g] && g > 0 && ((U = He.current[g - 1]) == null || U.focus());
1901
+ }, Tn = (g, S) => {
1902
+ var L;
1903
+ S.preventDefault();
1904
+ const U = ((L = S.clipboardData) == null ? void 0 : L.getData("text")) || "";
1905
+ On(g, U);
1906
+ }, rr = async (g) => {
1907
+ var L, R;
1908
+ if (g.preventDefault(), !In)
1909
+ return;
1910
+ const S = D || ((L = Ae.current) == null ? void 0 : L.value) || "", U = A || ((R = Ue.current) == null ? void 0 : R.value) || "";
1911
+ if (!(!S || !U)) {
1912
+ fe(null), z(!0);
1913
+ try {
1914
+ await (e == null ? void 0 : e(S, U));
1915
+ } catch (I) {
1916
+ fe((I == null ? void 0 : I.message) || "Something went wrong. Please try again.");
1917
+ } finally {
1918
+ z(!1);
1919
+ }
1754
1920
  }
1755
- }));
1756
- }, it = function({ isFirstScreen: i, isCustomScreen: e, stepName: t }) {
1757
- i && r(this, w, "m", J).call(this, "ready", {}), e || r(this, w, "m", Dt).call(this, t), r(this, w, "m", J).call(this, "page-updated", { screenName: t }), r(this, w, "m", J).call(this, "screen-updated", { screenName: t });
1758
- }, Mi = function() {
1759
- let i = !0;
1760
- return Array.from(this.shadowRoot.querySelectorAll("*[name]")).reverse().forEach(((e) => {
1761
- var t, s;
1762
- e.localName === "slot" || e.classList.contains("hidden") || ((t = e.reportValidity) === null || t === void 0 || t.call(e), i && (i = (s = e.checkValidity) === null || s === void 0 ? void 0 : s.call(e)));
1763
- })), i;
1764
- }, Ri = function() {
1765
- return y(this, void 0, void 0, (function* () {
1766
- const i = this.getInputs();
1767
- return (yield Promise.all(i.map(((e) => y(this, void 0, void 0, (function* () {
1768
- return { name: e.getAttribute("name"), value: e.value };
1769
- })))))).reduce(((e, t) => Object.assign(Object.assign({}, e), { [t.name]: t.value })), {});
1770
- }));
1771
- }, ji = function(i) {
1772
- const e = Array.from(this.contentRootElement.querySelectorAll(':not([disabled]), [disabled="false"]')).filter(((n) => n !== i)), t = () => y(this, void 0, void 0, (function* () {
1773
- this.loggerWrapper.debug("Restoring components state"), this.removeEventListener("popupclosed", t), i.removeAttribute("loading"), e.forEach(((l) => {
1774
- l.removeAttribute("disabled");
1775
- }));
1776
- const n = yield this.getFlowConfig(), a = [...n.clientScripts || [], ...n.sdkScripts || []];
1777
- this.loadSdkScripts(a);
1778
- })), s = () => {
1779
- var n;
1780
- window.removeEventListener("pageshow", r(this, ve, "f")), S(this, ve, ((l) => {
1781
- l.persisted && (this.logger.debug("Page was loaded from cache, restoring components state"), t());
1782
- }), "f"), window.addEventListener("pageshow", r(this, ve, "f"), { once: !0 });
1783
- const a = (n = this.stepState) === null || n === void 0 ? void 0 : n.subscribe(((l, d) => {
1784
- l === d && t(), this.removeEventListener("popupclosed", t), this.stepState.unsubscribe(a);
1785
- }), ((l) => l.screenId), { forceUpdate: !0 });
1786
- }, o = this.nextRequestStatus.subscribe((({ isLoading: n }) => {
1787
- n ? (this.addEventListener("popupclosed", t, { once: !0 }), i.setAttribute("loading", "true"), e.forEach(((a) => a.setAttribute("disabled", "true")))) : (this.nextRequestStatus.unsubscribe(o), s());
1788
- }));
1789
- }, Ti = function(i = {}) {
1790
- var e, t;
1791
- const s = xt(i, ["externalId", "email", "phone"]), o = xt(i, ["newPassword", "password"]);
1792
- if (s && o) try {
1793
- if (!globalThis.PasswordCredential) return;
1794
- const n = new globalThis.PasswordCredential({ id: s, password: o });
1795
- (t = (e = navigator == null ? void 0 : navigator.credentials) === null || e === void 0 ? void 0 : e.store) === null || t === void 0 || t.call(e, n);
1796
- } catch (n) {
1797
- this.loggerWrapper.error("Could not store credentials", n.message);
1798
- }
1799
- }, Li = function() {
1800
- co(), this.contentRootElement.querySelectorAll('[external-input="true"]').forEach(((i) => r(this, w, "m", qt).call(this, i)));
1801
- }, qt = function(i) {
1802
- i && i.querySelectorAll("input").forEach(((e) => {
1803
- const t = e.getAttribute("slot"), s = `input-${i.id}-${t}`, o = document.createElement("slot");
1804
- o.setAttribute("name", s), o.setAttribute("slot", t), i.appendChild(o), e.setAttribute("slot", s), this.appendChild(e);
1805
- }));
1806
- }, st = function(i) {
1807
- return y(this, void 0, void 0, (function* () {
1808
- if (r(this, ue, "f")) {
1809
- this.loggerWrapper.debug("Waiting for sdk scripts to load");
1810
- const o = Date.now();
1811
- yield r(this, ue, "f"), this.loggerWrapper.debug("Sdk scripts loaded for", (Date.now() - o).toString());
1921
+ }, ir = async () => {
1922
+ we("");
1923
+ const g = hn.trim(), S = gn.trim(), U = fn.trim();
1924
+ if (g.length < 2) {
1925
+ we("Please enter your full name.");
1926
+ return;
1812
1927
  }
1813
- const e = this.loadSdkScriptsModules(), t = i.map(((o) => o.id));
1814
- for (const o of e) if (t.includes(o.id)) try {
1815
- typeof o.present == "function" && ((yield o.present()) || this.loggerWrapper.debug(`Sdk script ${o.id} was cancelled`));
1816
- } catch (n) {
1817
- this.loggerWrapper.error(`Failed to present ${o.id} script module`, n.message);
1928
+ if (!S) {
1929
+ we("Please enter your work email.");
1930
+ return;
1818
1931
  }
1819
- const s = [];
1820
- for (const o of e) typeof o.refresh == "function" && s.push(o.refresh());
1821
- if (s.length > 0) try {
1822
- yield lt(li, Promise.all(s), null);
1823
- } catch (o) {
1824
- this.loggerWrapper.error("Failed to refresh script module", o.message);
1932
+ if (U.length < 2) {
1933
+ we("Please enter your company name (at least 2 characters).");
1934
+ return;
1825
1935
  }
1826
- }));
1827
- }, Kt = function(i) {
1828
- this.contentRootElement.querySelectorAll('descope-passcode[data-auto-submit="true"]').forEach(((e) => {
1829
- e.addEventListener("input", (() => {
1830
- var t;
1831
- !((t = e.checkValidity) === null || t === void 0) && t.call(e) && r(this, We, "f").call(this, e, i);
1832
- }));
1833
- }));
1834
- }, Wi = function(i) {
1835
- this.contentRootElement.querySelectorAll(`descope-button:not([${At}]), [data-type="button"]:not([${At}]`).forEach(((e) => {
1836
- e.onclick = () => {
1837
- r(this, We, "f").call(this, e, i);
1838
- };
1839
- })), r(this, w, "m", Kt).call(this, i), this.isDismissScreenErrorOnInput && this.contentRootElement.querySelectorAll(`*[name]:not([${at}])`).forEach(((e) => {
1840
- e.addEventListener("input", (() => {
1841
- this.stepState.update(((t) => Object.assign(Object.assign({}, t), { screenState: Object.assign(Object.assign({}, t.screenState), { errorText: "", errorType: "" }) })));
1842
- }));
1843
- }));
1844
- }, J = function(i, e) {
1845
- this.dispatchEvent(new CustomEvent(i, { detail: e }));
1846
- }, Pi = function(i, e, t) {
1847
- var s;
1848
- const [o, n] = ((s = window.name) === null || s === void 0 ? void 0 : s.split("|")) || [], a = { data: { code: e, exchangeError: t }, action: "code" };
1849
- if (o === "descope-wc" && n) {
1850
- this.loggerWrapper.debug("Using postMessage fallback to notify opener in origin", n);
1936
+ const L = mn.map((I) => I === "Other" && Ct.trim() ? `Other: ${Ct.trim()}` : I), R = yn.map((I) => I === "Other" && Ot.trim() ? `Other: ${Ot.trim()}` : I);
1937
+ xn(!0);
1851
1938
  try {
1852
- window.opener.postMessage(a, n);
1853
- } catch (l) {
1854
- this.loggerWrapper.error("Failed to send postMessage fallback (likely COOP isolation)", l == null ? void 0 : l.message);
1939
+ const I = await (l == null ? void 0 : l({
1940
+ name: g,
1941
+ email: S,
1942
+ company_name: U,
1943
+ job_title: vn.trim() || void 0,
1944
+ team_size: St || void 0,
1945
+ phone_systems: L,
1946
+ meeting_tools: R,
1947
+ source: "website"
1948
+ })), ee = Number(I == null ? void 0 : I.position);
1949
+ Number.isFinite(ee) && ee > 0 && er(ee), I != null && I.calendly_url && tr(String(I.calendly_url)), Zo(!0);
1950
+ } catch (I) {
1951
+ we((I == null ? void 0 : I.message) || "Unable to join waitlist right now. Please try again.");
1952
+ } finally {
1953
+ xn(!1);
1855
1954
  }
1856
- } else {
1857
- this.loggerWrapper.debug("Creating popup channel", i);
1858
- const l = new BroadcastChannel(i);
1859
- l.postMessage(a), l.close();
1860
- }
1861
- try {
1862
- window.close();
1863
- } catch {
1864
- }
1865
- };
1866
- customElements.get("descope-wc") ? console.log("descope-wc is already defined") : customElements.define("descope-wc", Ni);
1867
- const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1868
- __proto__: null,
1869
- default: Ni
1870
- }, Symbol.toStringTag, { value: "Module" }));
1955
+ };
1956
+ return /* @__PURE__ */ k("div", { style: { position: "fixed", inset: 0, display: "flex", overflow: "hidden", fontFamily: O, background: "white" }, children: [
1957
+ /* @__PURE__ */ k("div", { style: {
1958
+ flex: "0 0 628px",
1959
+ width: 628,
1960
+ minHeight: 0,
1961
+ background: "var(--surface-dark)",
1962
+ display: "flex",
1963
+ flexDirection: "column",
1964
+ padding: "48px 0 40px 48px",
1965
+ position: "relative",
1966
+ overflow: "hidden"
1967
+ }, children: [
1968
+ /* @__PURE__ */ d("img", { src: Oa, alt: "Chordia", style: {
1969
+ width: 175,
1970
+ height: 48,
1971
+ objectFit: "contain",
1972
+ marginBottom: 100,
1973
+ flexShrink: 0
1974
+ } }),
1975
+ /* @__PURE__ */ k("div", { style: { flex: 1, display: "flex", flexDirection: "column", justifyContent: "flex-start", gap: 22 }, children: [
1976
+ /* @__PURE__ */ d("h1", { style: {
1977
+ fontFamily: O,
1978
+ fontSize: "clamp(28px, 2.8vw, 28px)",
1979
+ fontWeight: 800,
1980
+ color: "var(--color-text-inverse)",
1981
+ lineHeight: 1.08,
1982
+ margin: 0,
1983
+ letterSpacing: "-0.02em",
1984
+ paddingRight: 48
1985
+ }, children: "Three Solutions. One Platform." }),
1986
+ /* @__PURE__ */ k("div", { style: { position: "relative", width: 412, height: 320, overflow: "hidden", WebkitMaskImage: "-webkit-radial-gradient(white, black)" }, children: [
1987
+ /* @__PURE__ */ d("div", { style: {
1988
+ display: "flex",
1989
+ gap: 16,
1990
+ height: "100%",
1991
+ transform: `translateX(${-dn * 280}px)`,
1992
+ transition: "transform 0.5s cubic-bezier(0.4, 0, 0.2, 1)"
1993
+ }, children: [
1994
+ {
1995
+ Icon: lr,
1996
+ title: "Evaluation Quality Monitoring",
1997
+ info: "Stop sampling 2% of calls and hoping for the best. Chordia analyzes every conversation for quality, compliance, and coaching signals — with evidence, not opinions."
1998
+ },
1999
+ {
2000
+ Icon: cr,
2001
+ title: "Compliance Monitoring",
2002
+ info: "Continuously monitor customer service conversations for missed disclosures, risky language, and compliance gaps."
2003
+ },
2004
+ {
2005
+ Icon: dr,
2006
+ title: "Signal Intelligence",
2007
+ info: "Identify emerging themes, sentiment shifts, and customer issues hidden inside everyday service conversations."
2008
+ }
2009
+ ].map(({ Icon: g, title: S, info: U }, L) => /* @__PURE__ */ k("div", { style: {
2010
+ flexShrink: 0,
2011
+ width: 264,
2012
+ height: 320,
2013
+ padding: 32,
2014
+ boxSizing: "border-box",
2015
+ display: "flex",
2016
+ flexDirection: "column",
2017
+ alignItems: "flex-start",
2018
+ gap: 24,
2019
+ borderRadius: 16,
2020
+ border: "1px solid var(--surface-card-dark-border)",
2021
+ background: "var(--surface-card-dark)"
2022
+ }, children: [
2023
+ /* @__PURE__ */ d(g, { width: 36, height: 36, color: "var(--color-card-icon)", strokeWidth: 2.5 }),
2024
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
2025
+ /* @__PURE__ */ d("span", { style: {
2026
+ fontFamily: O,
2027
+ fontSize: 24,
2028
+ fontStyle: "normal",
2029
+ fontWeight: 600,
2030
+ lineHeight: "28px",
2031
+ color: "var(--color-card-text)"
2032
+ }, children: S }),
2033
+ /* @__PURE__ */ d("span", { style: {
2034
+ fontFamily: O,
2035
+ fontSize: 12,
2036
+ fontStyle: "normal",
2037
+ fontWeight: 400,
2038
+ lineHeight: "normal",
2039
+ color: "rgba(255,255,255,0.65)"
2040
+ }, children: U })
2041
+ ] })
2042
+ ] }, L)) }),
2043
+ /* @__PURE__ */ d("div", { style: {
2044
+ position: "absolute",
2045
+ top: 0,
2046
+ left: 280,
2047
+ right: 0,
2048
+ height: "100%",
2049
+ background: "linear-gradient(270deg, #1D1E20 0%, rgba(29,30,32,0.80) 100%)",
2050
+ pointerEvents: "none"
2051
+ } })
2052
+ ] }),
2053
+ /* @__PURE__ */ d("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", gap: 8, height: 4, marginTop: "auto", flexShrink: 0 }, children: Array.from({ length: pn }).map((g, S) => /* @__PURE__ */ d(
2054
+ "button",
2055
+ {
2056
+ onClick: () => un(S),
2057
+ style: {
2058
+ width: 80,
2059
+ height: 4,
2060
+ borderRadius: 6,
2061
+ border: "none",
2062
+ padding: 0,
2063
+ cursor: "pointer",
2064
+ background: S === dn ? "rgba(255,255,255,0.7)" : "rgba(255,255,255,0.25)",
2065
+ transition: "background 0.3s ease"
2066
+ }
2067
+ },
2068
+ S
2069
+ )) })
2070
+ ] })
2071
+ ] }),
2072
+ /* @__PURE__ */ d("div", { style: {
2073
+ flex: 1,
2074
+ minWidth: 0,
2075
+ display: "flex",
2076
+ flexDirection: "column",
2077
+ justifyContent: "center",
2078
+ alignItems: "center",
2079
+ padding: K === "waitlist" ? "20px 48px" : "32px 72px",
2080
+ position: "relative",
2081
+ background: "white",
2082
+ overflowY: "auto",
2083
+ minHeight: 0
2084
+ }, children: /* @__PURE__ */ d("div", { style: {
2085
+ display: "flex",
2086
+ flexDirection: "column",
2087
+ alignItems: "flex-start",
2088
+ width: "100%",
2089
+ maxWidth: K === "waitlist" ? 430 : 360,
2090
+ gap: K === "waitlist" ? 22 : 28
2091
+ }, children: K === "waitlist" ? (
2092
+ /* ── Join Waitlist (matches Sign Up panel styling) ── */
2093
+ /* @__PURE__ */ d(me, { children: Go ? /* @__PURE__ */ k("div", { style: { width: "100%", display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", gap: 24 }, children: [
2094
+ /* @__PURE__ */ d("h2", { style: { fontFamily: O, fontWeight: 700, fontSize: "32px", lineHeight: "44px", color: "var(--color-text)", margin: 0 }, children: "Chordia" }),
2095
+ /* @__PURE__ */ d("h3", { style: { fontFamily: O, fontWeight: 700, fontSize: "32px", lineHeight: "52px", color: "var(--color-text)", margin: 0 }, children: "You're on the list!" }),
2096
+ /* @__PURE__ */ k("p", { style: { fontFamily: O, fontWeight: 700, fontSize: "56px", lineHeight: "68px", color: "var(--color-green)", margin: 0 }, children: [
2097
+ "#",
2098
+ _o.toLocaleString()
2099
+ ] }),
2100
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontWeight: 400, fontSize: 18, lineHeight: "26px", color: "var(--color-text-secondary)", margin: 0, maxWidth: 470 }, children: "We’re working hard to increase capacity and will notify you very quickly. Check your email for confirmation." }),
2101
+ /* @__PURE__ */ k("div", { style: {
2102
+ width: "100%",
2103
+ borderRadius: 12,
2104
+ border: "1px solid var(--color-input-border)",
2105
+ background: "white",
2106
+ boxShadow: "0 1px 6px rgba(0,0,0,0.06)",
2107
+ padding: "24px 20px",
2108
+ boxSizing: "border-box",
2109
+ display: "flex",
2110
+ flexDirection: "column",
2111
+ alignItems: "center",
2112
+ gap: 14
2113
+ }, children: [
2114
+ /* @__PURE__ */ d("p", { style: { margin: 0, fontFamily: O, fontSize: "24px", lineHeight: "40px", fontWeight: 700, color: "var(--color-text)" }, children: "Want to skip the line?" }),
2115
+ /* @__PURE__ */ d("p", { style: { margin: 0, fontFamily: O, fontSize: "18px", lineHeight: "24px", fontWeight: 400, color: "var(--color-text-secondary)" }, children: "Schedule a demo with our CEO and get immediate access." }),
2116
+ /* @__PURE__ */ d(
2117
+ "button",
2118
+ {
2119
+ type: "button",
2120
+ onClick: () => {
2121
+ Je && window.open(Je, "_blank", "noopener,noreferrer");
2122
+ },
2123
+ style: {
2124
+ minWidth: 220,
2125
+ height: 48,
2126
+ padding: "0 20px",
2127
+ borderRadius: 8,
2128
+ border: "2px solid #111111",
2129
+ background: "white",
2130
+ color: "var(--color-text)",
2131
+ fontFamily: O,
2132
+ fontSize: 20,
2133
+ fontWeight: 700,
2134
+ lineHeight: "28px",
2135
+ cursor: Je ? "pointer" : "default",
2136
+ opacity: Je ? 1 : 0.65
2137
+ },
2138
+ disabled: !Je,
2139
+ children: "Schedule a Demo"
2140
+ }
2141
+ )
2142
+ ] })
2143
+ ] }) : /* @__PURE__ */ k(me, { children: [
2144
+ /* @__PURE__ */ d(Re, { title: "Join the Waitlist", subtitle: "Get early access to Chordia. We onboard new companies every week." }),
2145
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 12 }, children: [
2146
+ /* @__PURE__ */ d(J, { label: "Full Name", gap: 8, children: /* @__PURE__ */ d(
2147
+ "input",
2148
+ {
2149
+ type: "text",
2150
+ value: hn,
2151
+ onChange: (g) => {
2152
+ Jo(g.target.value), we("");
2153
+ },
2154
+ placeholder: "Your full name",
2155
+ autoFocus: !0,
2156
+ autoComplete: "name",
2157
+ style: Y,
2158
+ onFocus: X,
2159
+ onBlur: G
2160
+ }
2161
+ ) }),
2162
+ /* @__PURE__ */ k("div", { style: { display: "flex", gap: 16, width: "100%" }, children: [
2163
+ /* @__PURE__ */ d("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ d(J, { label: "Work Email", gap: 8, children: /* @__PURE__ */ d(
2164
+ "input",
2165
+ {
2166
+ type: "email",
2167
+ value: gn,
2168
+ onChange: (g) => {
2169
+ Mo(g.target.value), we("");
2170
+ },
2171
+ placeholder: "workemail@example.com",
2172
+ autoComplete: "email",
2173
+ style: Y,
2174
+ onFocus: X,
2175
+ onBlur: G
2176
+ }
2177
+ ) }) }),
2178
+ /* @__PURE__ */ d("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ d(J, { label: "Company Name", gap: 8, children: /* @__PURE__ */ d(
2179
+ "input",
2180
+ {
2181
+ type: "text",
2182
+ value: fn,
2183
+ onChange: (g) => {
2184
+ Wo(g.target.value), we("");
2185
+ },
2186
+ placeholder: "Your Company",
2187
+ autoComplete: "organization",
2188
+ style: Y,
2189
+ onFocus: X,
2190
+ onBlur: G
2191
+ }
2192
+ ) }) })
2193
+ ] }),
2194
+ /* @__PURE__ */ k("div", { style: { display: "flex", gap: 16, width: "100%" }, children: [
2195
+ /* @__PURE__ */ d("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ d(J, { label: "Job Title", gap: 8, children: /* @__PURE__ */ d(
2196
+ "input",
2197
+ {
2198
+ type: "text",
2199
+ value: vn,
2200
+ onChange: (g) => Ko(g.target.value),
2201
+ placeholder: "Optional",
2202
+ autoComplete: "organization-title",
2203
+ style: Y,
2204
+ onFocus: X,
2205
+ onBlur: G
2206
+ }
2207
+ ) }) }),
2208
+ /* @__PURE__ */ d("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ d(J, { label: "Team Size", gap: 8, children: /* @__PURE__ */ k("div", { style: { position: "relative" }, children: [
2209
+ /* @__PURE__ */ d(
2210
+ "select",
2211
+ {
2212
+ value: St,
2213
+ onChange: (g) => Vo(g.target.value),
2214
+ style: {
2215
+ ...Y,
2216
+ appearance: "none",
2217
+ WebkitAppearance: "none",
2218
+ paddingRight: 36,
2219
+ cursor: "pointer",
2220
+ fontSize: 15,
2221
+ color: St ? "var(--color-text)" : "var(--color-text-secondary)"
2222
+ },
2223
+ children: Aa.map((g) => /* @__PURE__ */ d("option", { value: g.value, children: g.label }, g.value || "empty"))
2224
+ }
2225
+ ),
2226
+ /* @__PURE__ */ d(
2227
+ oo,
2228
+ {
2229
+ size: 16,
2230
+ style: {
2231
+ position: "absolute",
2232
+ right: 10,
2233
+ top: "50%",
2234
+ transform: "translateY(-50%)",
2235
+ pointerEvents: "none",
2236
+ color: "var(--color-text-secondary)"
2237
+ }
2238
+ }
2239
+ )
2240
+ ] }) }) })
2241
+ ] }),
2242
+ /* @__PURE__ */ d(J, { label: "Phone systems", gap: 8, children: /* @__PURE__ */ d(
2243
+ to,
2244
+ {
2245
+ compact: !0,
2246
+ options: Ua,
2247
+ value: mn,
2248
+ onChange: $o,
2249
+ otherValue: Ct,
2250
+ onOtherChange: Qo,
2251
+ placeholder: "Select (optional)",
2252
+ otherPlaceholder: "Please specify your phone system"
2253
+ }
2254
+ ) }),
2255
+ /* @__PURE__ */ d(J, { label: "Meeting tools", gap: 8, children: /* @__PURE__ */ d(
2256
+ to,
2257
+ {
2258
+ compact: !0,
2259
+ options: Ta,
2260
+ value: yn,
2261
+ onChange: Yo,
2262
+ otherValue: Ot,
2263
+ onOtherChange: Xo,
2264
+ placeholder: "Select (optional)",
2265
+ otherPlaceholder: "Please specify your meeting tool"
2266
+ }
2267
+ ) }),
2268
+ wn && /* @__PURE__ */ k("div", { style: {
2269
+ display: "flex",
2270
+ flexDirection: "row",
2271
+ alignItems: "center",
2272
+ padding: 8,
2273
+ gap: 6,
2274
+ width: "100%",
2275
+ boxSizing: "border-box",
2276
+ background: "var(--color-error-bg)",
2277
+ borderRadius: 5,
2278
+ fontSize: 14,
2279
+ fontWeight: 400,
2280
+ lineHeight: "22px",
2281
+ color: "var(--color-text)",
2282
+ fontFamily: O
2283
+ }, children: [
2284
+ /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "var(--color-text)", style: { flexShrink: 0 }, children: /* @__PURE__ */ d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
2285
+ wn
2286
+ ] }),
2287
+ /* @__PURE__ */ d(xe, { type: "button", onClick: ir, disabled: bn, children: bn ? "Joining..." : "Join Waitlist" }),
2288
+ /* @__PURE__ */ d(Te, { text: "I am already a member", linkText: "Log In", onClick: () => {
2289
+ W("signin"), h == null || h();
2290
+ } }),
2291
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 16 })
2292
+ ] })
2293
+ ] }) })
2294
+ ) : K === "signup" ? (
2295
+ /* ── Sign Up ── */
2296
+ /* @__PURE__ */ k(me, { children: [
2297
+ /* @__PURE__ */ d(Re, { title: "Sign Up", subtitle: "Please enter your basic details to continue" }),
2298
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 16 }, children: [
2299
+ /* @__PURE__ */ k("div", { style: { display: "flex", gap: 16, width: "100%" }, children: [
2300
+ /* @__PURE__ */ d(J, { label: "First Name", gap: 8, children: /* @__PURE__ */ d(
2301
+ "input",
2302
+ {
2303
+ type: "text",
2304
+ value: yt,
2305
+ onChange: (g) => Ro(g.target.value),
2306
+ placeholder: "First name",
2307
+ autoFocus: !0,
2308
+ autoComplete: "given-name",
2309
+ style: Y,
2310
+ onFocus: X,
2311
+ onBlur: G
2312
+ }
2313
+ ) }),
2314
+ /* @__PURE__ */ d(J, { label: "Last Name", gap: 8, children: /* @__PURE__ */ d(
2315
+ "input",
2316
+ {
2317
+ type: "text",
2318
+ value: wt,
2319
+ onChange: (g) => No(g.target.value),
2320
+ placeholder: "Last name",
2321
+ autoComplete: "family-name",
2322
+ style: Y,
2323
+ onFocus: X,
2324
+ onBlur: G
2325
+ }
2326
+ ) })
2327
+ ] }),
2328
+ /* @__PURE__ */ d(J, { label: "Email", gap: 8, children: /* @__PURE__ */ d(
2329
+ "input",
2330
+ {
2331
+ type: "text",
2332
+ value: qe,
2333
+ onChange: (g) => {
2334
+ Fo(g.target.value), De("");
2335
+ },
2336
+ placeholder: "workemail@example.com",
2337
+ autoComplete: "email",
2338
+ style: Y,
2339
+ onFocus: X,
2340
+ onBlur: G
2341
+ }
2342
+ ) }),
2343
+ /* @__PURE__ */ d(J, { label: "Create Password", gap: 8, children: /* @__PURE__ */ k("div", { style: { position: "relative" }, children: [
2344
+ /* @__PURE__ */ d(
2345
+ "input",
2346
+ {
2347
+ type: xt ? "text" : "password",
2348
+ value: Ze,
2349
+ onChange: (g) => {
2350
+ Lo(g.target.value), De("");
2351
+ },
2352
+ placeholder: "Enter password",
2353
+ autoComplete: "new-password",
2354
+ style: { ...Y, padding: "10px 44px 10px 14px" },
2355
+ onFocus: X,
2356
+ onBlur: G
2357
+ }
2358
+ ),
2359
+ /* @__PURE__ */ d(Lt, { show: xt, onToggle: () => Bo(!xt) })
2360
+ ] }) }),
2361
+ /* @__PURE__ */ d(J, { label: "Confirm Password", gap: 8, children: /* @__PURE__ */ k("div", { style: { position: "relative" }, children: [
2362
+ /* @__PURE__ */ d(
2363
+ "input",
2364
+ {
2365
+ type: kt ? "text" : "password",
2366
+ value: bt,
2367
+ onChange: (g) => {
2368
+ zo(g.target.value), De("");
2369
+ },
2370
+ placeholder: "Enter password",
2371
+ autoComplete: "new-password",
2372
+ style: { ...Y, padding: "10px 44px 10px 14px" },
2373
+ onFocus: X,
2374
+ onBlur: G
2375
+ }
2376
+ ),
2377
+ /* @__PURE__ */ d(Lt, { show: kt, onToggle: () => Ho(!kt) })
2378
+ ] }) }),
2379
+ cn && /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", padding: 8, gap: 6, width: "100%", boxSizing: "border-box", background: "var(--color-error-bg)", borderRadius: 5, fontSize: 14, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O }, children: [
2380
+ /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "var(--color-text)", style: { flexShrink: 0 }, children: /* @__PURE__ */ d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
2381
+ cn
2382
+ ] }),
2383
+ (() => /* @__PURE__ */ d(xe, { onClick: () => {
2384
+ if (De(""), !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(qe)) {
2385
+ De("Please enter a valid email address.");
2386
+ return;
2387
+ }
2388
+ if (Ze !== bt) {
2389
+ De("Password and Confirm Password do not match!");
2390
+ return;
2391
+ }
2392
+ i == null || i({ firstName: yt, lastName: wt, email: qe, password: Ze }), W("verifyemail");
2393
+ }, disabled: !(yt && wt && qe && Ze && bt), children: "Create Account" }))(),
2394
+ /* @__PURE__ */ d(Te, { text: "I am already a member", linkText: "Sign In", onClick: () => {
2395
+ W("signin"), h == null || h();
2396
+ } }),
2397
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u })
2398
+ ] })
2399
+ ] })
2400
+ ) : K === "verifyemail" ? (
2401
+ /* ── Verify Email ── */
2402
+ /* @__PURE__ */ k(me, { children: [
2403
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
2404
+ /* @__PURE__ */ d("h2", { style: { fontFamily: O, fontWeight: 600, fontSize: "36px", lineHeight: "52px", color: "var(--color-text)", margin: 0 }, children: "Verify Email" }),
2405
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 400, lineHeight: "26px", color: "var(--color-text-secondary)", margin: 0 }, children: "Verify your email to continue the signup process." })
2406
+ ] }),
2407
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 24 }, children: [
2408
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
2409
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 400, lineHeight: "24px", color: "var(--color-text-secondary)", margin: 0 }, children: "We have sent a verification link to:" }),
2410
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 600, lineHeight: "24px", color: "var(--color-text)", margin: 0 }, children: qe || "youremail@workemail.com" })
2411
+ ] }),
2412
+ /* @__PURE__ */ d("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 400, lineHeight: "24px", color: "var(--color-text-secondary)", margin: 0 }, children: "Click on the link to complete the verification process. You might need to check your Spam folder" }),
2413
+ /* @__PURE__ */ d(xe, { onClick: () => {
2414
+ W("signin"), h == null || h();
2415
+ }, children: "Go To Login" })
2416
+ ] }),
2417
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 40 })
2418
+ ] })
2419
+ ) : K === "verifycode" ? (
2420
+ /* ── Verify Code ── */
2421
+ /* @__PURE__ */ k(me, { children: [
2422
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
2423
+ /* @__PURE__ */ d("h2", { style: { fontFamily: O, fontWeight: 600, fontSize: "36px", lineHeight: "52px", color: "var(--color-text)", margin: 0 }, children: "Sign In with code" }),
2424
+ /* @__PURE__ */ k("p", { style: { fontFamily: O, fontSize: 18, fontWeight: 400, lineHeight: "26px", color: "var(--color-text-secondary)", margin: 0 }, children: [
2425
+ "We have sent a one-time code to your email:",
2426
+ " ",
2427
+ /* @__PURE__ */ d("span", { style: { color: "var(--color-text)" }, children: Be || "workemail@example.com" }),
2428
+ " ",
2429
+ /* @__PURE__ */ d(
2430
+ "button",
2431
+ {
2432
+ type: "button",
2433
+ onClick: () => W("getcode"),
2434
+ style: { background: "none", border: "none", padding: 0, fontSize: 18, fontWeight: 400, color: Ye, cursor: "pointer", fontFamily: O, textDecoration: "underline" },
2435
+ children: "Change email"
2436
+ }
2437
+ )
2438
+ ] })
2439
+ ] }),
2440
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 16 }, children: [
2441
+ /* @__PURE__ */ d(J, { label: "Enter one-time code", gap: 12, children: /* @__PURE__ */ d("div", { style: { display: "flex", gap: 8 }, children: ve.map((g, S) => /* @__PURE__ */ d(
2442
+ "input",
2443
+ {
2444
+ ref: (U) => {
2445
+ He.current[S] = U;
2446
+ },
2447
+ type: "text",
2448
+ inputMode: "numeric",
2449
+ maxLength: 1,
2450
+ value: g,
2451
+ onChange: (U) => An(S, U.target.value),
2452
+ onKeyDown: (U) => Un(S, U),
2453
+ onPaste: (U) => Tn(S, U),
2454
+ autoFocus: S === 0,
2455
+ style: {
2456
+ flex: 1,
2457
+ minWidth: 0,
2458
+ height: 40,
2459
+ textAlign: "center",
2460
+ fontSize: 16,
2461
+ fontWeight: 600,
2462
+ fontFamily: O,
2463
+ color: "var(--color-text)",
2464
+ border: "1px solid var(--color-input-border)",
2465
+ borderRadius: 4,
2466
+ outline: "none",
2467
+ background: "white",
2468
+ boxSizing: "border-box",
2469
+ transition: "border-color 0.15s, box-shadow 0.15s",
2470
+ caretColor: Ye
2471
+ },
2472
+ onFocus: X,
2473
+ onBlur: G
2474
+ },
2475
+ S
2476
+ )) }) }),
2477
+ /* @__PURE__ */ d(xe, { onClick: () => o == null ? void 0 : o(Be, ve.join("")), disabled: ve.some((g) => !g), children: "Verify Code" }),
2478
+ _e && /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", padding: 8, gap: 6, width: "100%", boxSizing: "border-box", background: "var(--color-error-bg)", borderRadius: 5, fontSize: 15, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O }, children: [
2479
+ /* @__PURE__ */ d("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "var(--color-text)", style: { flexShrink: 0 }, children: /* @__PURE__ */ d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
2480
+ _e
2481
+ ] }),
2482
+ /* @__PURE__ */ d(Ve, {}),
2483
+ /* @__PURE__ */ d(Te, { text: "Not received yet?", linkText: "Resend", onClick: () => r == null ? void 0 : r(Be) }),
2484
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 24 })
2485
+ ] })
2486
+ ] })
2487
+ ) : K === "getcode" ? (
2488
+ /* ── Get Code (original — email only) ── */
2489
+ /* @__PURE__ */ k(me, { children: [
2490
+ /* @__PURE__ */ d(Re, { title: "Get code", subtitle: "We'll send a one time pass-code to your email" }),
2491
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 16 }, children: [
2492
+ /* @__PURE__ */ d(J, { label: "Email", gap: 12, children: /* @__PURE__ */ d(
2493
+ "input",
2494
+ {
2495
+ type: "email",
2496
+ value: oe,
2497
+ onChange: (g) => je(g.target.value),
2498
+ placeholder: "workemail@example.com",
2499
+ autoFocus: !0,
2500
+ autoComplete: "email",
2501
+ style: Y,
2502
+ onFocus: X,
2503
+ onBlur: G
2504
+ }
2505
+ ) }),
2506
+ /* @__PURE__ */ d(xe, { onClick: () => {
2507
+ ln(oe), Ge(["", "", "", "", "", ""]), W("verifycode"), n == null || n(oe);
2508
+ }, disabled: !oe, children: "Send One-time Code" }),
2509
+ /* @__PURE__ */ d(Ve, {}),
2510
+ /* @__PURE__ */ d(Te, { text: "I have my password", linkText: "Back to Sign in", onClick: () => {
2511
+ W("signin"), h == null || h();
2512
+ } }),
2513
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 40 })
2514
+ ] })
2515
+ ] })
2516
+ ) : K === "getcodewithname" ? (
2517
+ /* ── Get Code with Full Name (unregistered email) ── */
2518
+ /* @__PURE__ */ k(me, { children: [
2519
+ /* @__PURE__ */ d(Re, { title: "Complete your sign in", subtitle: "We’ve sent a one-time code to your email. Please enter the code and your full name to sign in" }),
2520
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 16 }, children: [
2521
+ /* @__PURE__ */ d(J, { label: "Email", gap: 12, children: /* @__PURE__ */ d(
2522
+ "input",
2523
+ {
2524
+ type: "email",
2525
+ value: oe,
2526
+ onChange: (g) => je(g.target.value),
2527
+ placeholder: "workemail@example.com",
2528
+ autoComplete: "email",
2529
+ style: Y,
2530
+ onFocus: X,
2531
+ onBlur: G
2532
+ }
2533
+ ) }),
2534
+ /* @__PURE__ */ d(J, { label: "Full Name", gap: 12, children: /* @__PURE__ */ d(
2535
+ "input",
2536
+ {
2537
+ type: "text",
2538
+ value: ie,
2539
+ onChange: (g) => P(g.target.value),
2540
+ placeholder: "Enter your full name",
2541
+ autoComplete: "name",
2542
+ style: Y,
2543
+ onFocus: X,
2544
+ onBlur: G
2545
+ }
2546
+ ) }),
2547
+ /* @__PURE__ */ d(J, { label: "Enter one-time code", gap: 12, children: /* @__PURE__ */ d("div", { style: { display: "flex", gap: 8 }, children: ve.map((g, S) => /* @__PURE__ */ d(
2548
+ "input",
2549
+ {
2550
+ ref: (U) => {
2551
+ He.current[S] = U;
2552
+ },
2553
+ type: "text",
2554
+ inputMode: "numeric",
2555
+ maxLength: 1,
2556
+ value: g,
2557
+ onChange: (U) => An(S, U.target.value),
2558
+ onKeyDown: (U) => Un(S, U),
2559
+ onPaste: (U) => Tn(S, U),
2560
+ autoFocus: S === 0,
2561
+ style: {
2562
+ flex: 1,
2563
+ minWidth: 0,
2564
+ height: 40,
2565
+ textAlign: "center",
2566
+ fontSize: 16,
2567
+ fontWeight: 600,
2568
+ fontFamily: O,
2569
+ color: "var(--color-text)",
2570
+ border: "1px solid var(--color-input-border)",
2571
+ borderRadius: 4,
2572
+ outline: "none",
2573
+ background: "white",
2574
+ boxSizing: "border-box",
2575
+ transition: "border-color 0.15s, box-shadow 0.15s",
2576
+ caretColor: Ye
2577
+ },
2578
+ onFocus: X,
2579
+ onBlur: G
2580
+ },
2581
+ S
2582
+ )) }) }),
2583
+ /* @__PURE__ */ d(xe, { onClick: () => {
2584
+ ln(oe), n == null || n(oe, ie, ve.join(""));
2585
+ }, disabled: !oe || !ie || ve.some((g) => !g), children: "Verify & Sign In" }),
2586
+ _e && /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", padding: 8, gap: 6, width: "100%", boxSizing: "border-box", background: "var(--color-error-bg)", borderRadius: 5, fontSize: 15, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O }, children: [
2587
+ /* @__PURE__ */ d("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "var(--color-text)", style: { flexShrink: 0 }, children: /* @__PURE__ */ d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
2588
+ _e
2589
+ ] }),
2590
+ /* @__PURE__ */ d(Ve, {}),
2591
+ /* @__PURE__ */ d(Te, { text: "I have my password", linkText: "Back to Sign in", onClick: () => {
2592
+ W("signin"), h == null || h();
2593
+ } }),
2594
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 40 })
2595
+ ] })
2596
+ ] })
2597
+ ) : K === "resetpassword" ? (
2598
+ /* ── Reset Password ── */
2599
+ /* @__PURE__ */ k(me, { children: [
2600
+ /* @__PURE__ */ d(Re, { title: "Reset Password", subtitle: "We'll send an email to reset your password" }),
2601
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 16 }, children: [
2602
+ /* @__PURE__ */ d(J, { label: "Email", gap: 12, children: /* @__PURE__ */ d(
2603
+ "input",
2604
+ {
2605
+ type: "email",
2606
+ value: It,
2607
+ onChange: (g) => qo(g.target.value),
2608
+ placeholder: "workemail@example.com",
2609
+ autoFocus: !0,
2610
+ autoComplete: "email",
2611
+ style: Y,
2612
+ onFocus: X,
2613
+ onBlur: G
2614
+ }
2615
+ ) }),
2616
+ /* @__PURE__ */ d(xe, { onClick: () => s == null ? void 0 : s(It), disabled: !It, children: "Send Reset Link" }),
2617
+ /* @__PURE__ */ d(Ve, {}),
2618
+ /* @__PURE__ */ d(Te, { text: "I have my password", linkText: "Back to Sign in", onClick: () => {
2619
+ W("signin"), h == null || h();
2620
+ } }),
2621
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 40 })
2622
+ ] })
2623
+ ] })
2624
+ ) : (
2625
+ /* ── Sign In ── */
2626
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", width: "100%", gap: 48 }, children: [
2627
+ /* @__PURE__ */ d(Re, { title: "Sign in", subtitle: "Enter your email & password to continue" }),
2628
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", width: "100%", gap: 8 }, children: [
2629
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-start", width: "100%", gap: 16 }, children: [
2630
+ /* @__PURE__ */ k("form", { onSubmit: rr, style: { width: "100%", display: "flex", flexDirection: "column", gap: 16 }, children: [
2631
+ /* @__PURE__ */ d(J, { label: "Email", gap: 12, children: /* @__PURE__ */ d(
2632
+ "input",
2633
+ {
2634
+ ref: Ae,
2635
+ type: "email",
2636
+ value: D,
2637
+ onChange: (g) => v(g.target.value),
2638
+ placeholder: "workemail@example.com",
2639
+ required: !0,
2640
+ autoComplete: "email",
2641
+ style: { ...Y, border: `1px solid ${be ? "var(--color-text)" : "var(--color-input-border)"}` },
2642
+ onFocus: Sn,
2643
+ onBlur: Cn
2644
+ }
2645
+ ) }),
2646
+ /* @__PURE__ */ d(J, { label: "Password", gap: 12, children: /* @__PURE__ */ k("div", { style: { position: "relative" }, children: [
2647
+ /* @__PURE__ */ d(
2648
+ "input",
2649
+ {
2650
+ ref: Ue,
2651
+ type: $ ? "text" : "password",
2652
+ value: A,
2653
+ onChange: (g) => B(g.target.value),
2654
+ placeholder: "Enter password",
2655
+ required: !0,
2656
+ autoComplete: "current-password",
2657
+ style: { ...Y, padding: "10px 44px 10px 16px", border: `1px solid ${be ? "var(--color-text)" : "var(--color-input-border)"}` },
2658
+ onFocus: Sn,
2659
+ onBlur: Cn
2660
+ }
2661
+ ),
2662
+ /* @__PURE__ */ d(Lt, { show: $, onToggle: () => Q(!$) })
2663
+ ] }) }),
2664
+ /* @__PURE__ */ d(xe, { type: "submit", disabled: !In, children: kn ? "Signing in…" : "Sign In" })
2665
+ ] }),
2666
+ be && /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", padding: 8, gap: 6, width: "100%", boxSizing: "border-box", background: "var(--color-error-bg)", borderRadius: 5, fontSize: 15, fontWeight: 400, lineHeight: "22px", color: "var(--color-text)", fontFamily: O }, children: [
2667
+ /* @__PURE__ */ d("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "var(--color-text)", style: { flexShrink: 0 }, children: /* @__PURE__ */ d("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
2668
+ be
2669
+ ] }),
2670
+ /* @__PURE__ */ k("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%" }, children: [
2671
+ /* @__PURE__ */ d(
2672
+ "button",
2673
+ {
2674
+ type: "button",
2675
+ onClick: () => {
2676
+ W("resetpassword"), t == null || t();
2677
+ },
2678
+ style: { background: "none", border: "none", padding: 0, fontSize: 15, fontWeight: 400, lineHeight: "100%", color: "var(--color-text)", cursor: "pointer", fontFamily: O, textDecoration: "underline" },
2679
+ children: "Forgot Password?"
2680
+ }
2681
+ ),
2682
+ /* @__PURE__ */ d(
2683
+ "button",
2684
+ {
2685
+ type: "button",
2686
+ onClick: () => {
2687
+ W("getcode"), n == null || n();
2688
+ },
2689
+ style: { background: "none", border: "none", padding: 0, fontSize: 15, fontWeight: 600, lineHeight: "100%", color: Ye, cursor: "pointer", fontFamily: O, textDecoration: "underline solid", textUnderlineOffset: 0, textDecorationSkipInk: "none" },
2690
+ children: "Sign in with one-time code"
2691
+ }
2692
+ )
2693
+ ] }),
2694
+ /* @__PURE__ */ k("div", { style: { display: "flex", flexDirection: "column", width: "100%", gap: 2 }, children: [
2695
+ /* @__PURE__ */ d(Ve, {}),
2696
+ /* @__PURE__ */ d(Ea, { projectId: x, onSuccess: p, onError: f })
2697
+ ] })
2698
+ ] }),
2699
+ /* @__PURE__ */ d(
2700
+ Te,
2701
+ {
2702
+ text: N === "waitlist" ? "Don't have an account yet?" : "Not a member yet?",
2703
+ linkText: N === "waitlist" ? "Join Waitlist" : "Sign Up",
2704
+ onClick: () => {
2705
+ if (N === "waitlist") {
2706
+ W("waitlist"), a == null || a();
2707
+ return;
2708
+ }
2709
+ W("signup"), i == null || i();
2710
+ }
2711
+ }
2712
+ ),
2713
+ /* @__PURE__ */ d(ke, { onTerms: c, onPrivacyPolicy: u, paddingTop: 16 })
2714
+ ] })
2715
+ ] })
2716
+ ) }) })
2717
+ ] });
2718
+ }
1871
2719
  export {
1872
- Ln as a,
1873
- we as c,
1874
- pt as i
2720
+ va as E,
2721
+ Wa as L,
2722
+ oa as X,
2723
+ Ha as Z,
2724
+ za as _,
2725
+ Ba as a,
2726
+ La as b,
2727
+ q as c,
2728
+ Ma as h,
2729
+ qa as r,
2730
+ Ja as s
1875
2731
  };
1876
2732
  //# sourceMappingURL=index.es2.js.map