@vertesia/ui 1.6.0-dev.20261004.085740Z → 1.6.0-dev.20261009.095813Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/lib/boot/vite.d.ts +3 -0
- package/lib/boot/vite.d.ts.map +1 -1
- package/lib/boot/vite.js +12 -0
- package/lib/boot/vite.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts +1 -0
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +2 -2
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/core/components/shadcn/selectBox.js +2 -2
- package/lib/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/core/components/shadcn/tabs.d.ts +2 -1
- package/lib/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/core/components/shadcn/tabs.js +6 -4
- package/lib/core/components/shadcn/tabs.js.map +1 -1
- package/lib/env/index.d.ts +9 -1
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +1 -1
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.js +16 -10
- package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.d.ts +7 -1
- package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.js +17 -16
- package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +2 -253
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.d.ts +1 -3
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.js +2 -8
- package/lib/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.d.ts +4 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.d.ts.map +1 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.js +248 -0
- package/lib/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.js.map +1 -0
- package/lib/features/media-viewer/ImagePanel.d.ts +1 -1
- package/lib/features/media-viewer/ImagePanel.d.ts.map +1 -1
- package/lib/features/media-viewer/ImagePanel.js +40 -10
- package/lib/features/media-viewer/ImagePanel.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
- package/lib/i18n/locales/ar.json +15 -0
- package/lib/i18n/locales/de.json +15 -0
- package/lib/i18n/locales/en.json +15 -0
- package/lib/i18n/locales/es.json +15 -0
- package/lib/i18n/locales/fr.json +15 -0
- package/lib/i18n/locales/it.json +15 -0
- package/lib/i18n/locales/ja.json +15 -0
- package/lib/i18n/locales/ko.json +15 -0
- package/lib/i18n/locales/pt.json +15 -0
- package/lib/i18n/locales/ru.json +15 -0
- package/lib/i18n/locales/tr.json +15 -0
- package/lib/i18n/locales/zh-TW.json +15 -0
- package/lib/i18n/locales/zh.json +15 -0
- package/lib/session/auth/composable.d.ts +1 -5
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +1 -10
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/firebase.d.ts.map +1 -1
- package/lib/session/auth/firebase.js +8 -5
- package/lib/session/auth/firebase.js.map +1 -1
- package/lib/session/auth/oauth.d.ts.map +1 -1
- package/lib/session/auth/oauth.js +43 -17
- package/lib/session/auth/oauth.js.map +1 -1
- package/lib/session/auth/vertesiaHosts.d.ts +0 -40
- package/lib/session/auth/vertesiaHosts.d.ts.map +1 -1
- package/lib/session/auth/vertesiaHosts.js +2 -45
- package/lib/session/auth/vertesiaHosts.js.map +1 -1
- package/lib/session/index.d.ts +1 -1
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +1 -1
- package/lib/session/index.js.map +1 -1
- package/lib/session/scopeSelection.d.ts +4 -0
- package/lib/session/scopeSelection.d.ts.map +1 -1
- package/lib/session/scopeSelection.js +11 -0
- package/lib/session/scopeSelection.js.map +1 -1
- package/lib/shell/AuthScreenPreview.d.ts.map +1 -1
- package/lib/shell/AuthScreenPreview.js +1 -0
- package/lib/shell/AuthScreenPreview.js.map +1 -1
- package/lib/shell/login/SignInFlow.d.ts +3 -1
- package/lib/shell/login/SignInFlow.d.ts.map +1 -1
- package/lib/shell/login/SignInFlow.js +13 -4
- package/lib/shell/login/SignInFlow.js.map +1 -1
- package/lib/shell/login/SignInIcons.d.ts.map +1 -1
- package/lib/shell/login/SignInIcons.js +2 -1
- package/lib/shell/login/SignInIcons.js.map +1 -1
- package/lib/shell/login/SignInPasswordStep.d.ts +9 -0
- package/lib/shell/login/SignInPasswordStep.d.ts.map +1 -0
- package/lib/shell/login/SignInPasswordStep.js +58 -0
- package/lib/shell/login/SignInPasswordStep.js.map +1 -0
- package/lib/shell/login/SignInPrimitives.d.ts +13 -0
- package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
- package/lib/shell/login/SignInPrimitives.js +11 -1
- package/lib/shell/login/SignInPrimitives.js.map +1 -1
- package/lib/shell/login/SignInProvidersStep.d.ts +3 -1
- package/lib/shell/login/SignInProvidersStep.d.ts.map +1 -1
- package/lib/shell/login/SignInProvidersStep.js +4 -2
- package/lib/shell/login/SignInProvidersStep.js.map +1 -1
- package/lib/shell/login/SignInReturningStep.d.ts +3 -1
- package/lib/shell/login/SignInReturningStep.d.ts.map +1 -1
- package/lib/shell/login/SignInReturningStep.js +18 -8
- package/lib/shell/login/SignInReturningStep.js.map +1 -1
- package/lib/shell/login/SignInTenantStep.d.ts +3 -1
- package/lib/shell/login/SignInTenantStep.d.ts.map +1 -1
- package/lib/shell/login/SignInTenantStep.js +2 -2
- package/lib/shell/login/SignInTenantStep.js.map +1 -1
- package/lib/shell/login/SignInWithProviderButton.d.ts +5 -3
- package/lib/shell/login/SignInWithProviderButton.d.ts.map +1 -1
- package/lib/shell/login/SignInWithProviderButton.js +8 -7
- package/lib/shell/login/SignInWithProviderButton.js.map +1 -1
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +9 -3
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/signInUtils.d.ts +24 -4
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +53 -1
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-boot.js.map +1 -1
- package/lib/vertesia-ui-core.js +42 -42
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +574 -589
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.1NWiB6fw.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.1NWiB6fw.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.6Ozlf6Ks.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.6Ozlf6Ks.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.AttJpg8U.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.AttJpg8U.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BI_xdp49.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BI_xdp49.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.C-2EEX6w.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.C-2EEX6w.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CAmo54FO.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CAmo54FO.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CbBzmHNP.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CbBzmHNP.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DZgTzkIg.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DZgTzkIg.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DZsITxq5.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DZsITxq5.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.Dbf2GHth.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.Dbf2GHth.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.lleWnH5n.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.lleWnH5n.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.wG_XSkbr.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.wG_XSkbr.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +15 -15
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +40 -40
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +54 -47
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +47 -47
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +20 -20
- package/src/boot/vite.ts +15 -0
- package/src/core/components/shadcn/button.tsx +3 -2
- package/src/core/components/shadcn/selectBox.tsx +12 -4
- package/src/core/components/shadcn/tabs.tsx +9 -3
- package/src/css/index.css +1 -1
- package/src/css/typography.css +111 -88
- package/src/env/index.ts +10 -3
- package/src/features/agent/chat/AgentRequestInputOverlay.tsx +73 -34
- package/src/features/agent/chat/AskUserWidget.tsx +225 -206
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +2 -253
- package/src/features/agent/chat/ModernAgentOutput/CollapsibleAgentMarkdown.tsx +2 -8
- package/src/features/agent/chat/ModernAgentOutput/agentMarkdownStyles.ts +248 -0
- package/src/features/media-viewer/ImagePanel.tsx +51 -10
- package/src/features/store/types/IntakePolicyEditor.tsx +2 -1
- package/src/i18n/locales/ar.json +15 -0
- package/src/i18n/locales/de.json +15 -0
- package/src/i18n/locales/en.json +15 -0
- package/src/i18n/locales/es.json +15 -0
- package/src/i18n/locales/fr.json +15 -0
- package/src/i18n/locales/it.json +15 -0
- package/src/i18n/locales/ja.json +15 -0
- package/src/i18n/locales/ko.json +15 -0
- package/src/i18n/locales/pt.json +15 -0
- package/src/i18n/locales/ru.json +15 -0
- package/src/i18n/locales/tr.json +15 -0
- package/src/i18n/locales/zh-TW.json +15 -0
- package/src/i18n/locales/zh.json +15 -0
- package/src/session/auth/composable.ts +1 -11
- package/src/session/auth/firebase.ts +9 -6
- package/src/session/auth/oauth.ts +47 -16
- package/src/session/auth/vertesiaHosts.ts +2 -47
- package/src/session/index.ts +1 -1
- package/src/session/scopeSelection.ts +13 -0
- package/src/shell/AuthScreenPreview.tsx +1 -0
- package/src/shell/login/SignInFlow.tsx +23 -2
- package/src/shell/login/SignInIcons.tsx +2 -1
- package/src/shell/login/SignInPasswordStep.tsx +103 -0
- package/src/shell/login/SignInPrimitives.tsx +53 -1
- package/src/shell/login/SignInProvidersStep.tsx +8 -4
- package/src/shell/login/SignInReturningStep.tsx +20 -8
- package/src/shell/login/SignInTenantStep.tsx +6 -2
- package/src/shell/login/SignInWithProviderButton.tsx +11 -7
- package/src/shell/login/SigninScreen.tsx +8 -3
- package/src/shell/login/signInUtils.ts +68 -8
- package/lib/vertesia-ui-i18n.BCPusS2_.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BCPusS2_.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BHWlHchf.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BHWlHchf.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BkNx8SZu.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BkNx8SZu.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.C1LasLrO.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.C1LasLrO.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D8PQ5yKU.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D8PQ5yKU.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DUtVV1Bq.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DUtVV1Bq.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DgA36_k5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DgA36_k5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DmG-fjjZ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DmG-fjjZ.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DreWvQIk.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DreWvQIk.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.Pp8Tj48d.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.Pp8Tj48d.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.gais--x5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.gais--x5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.xkqaKpY_.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.xkqaKpY_.chunk.js.map +0 -1
|
@@ -10,7 +10,7 @@ import SignInRecoveryStep from './SignInRecoveryStep';
|
|
|
10
10
|
import SignInRestrictedEnvStep from './SignInRestrictedEnvStep';
|
|
11
11
|
import SignInTenantBlockedStep from './SignInTenantBlockedStep';
|
|
12
12
|
import SignupForm from './SignupForm';
|
|
13
|
-
import { isInviteRequiredError, readPendingSignin, resetSignInState } from './signInUtils';
|
|
13
|
+
import { isInviteRequiredError, isTenantSignIn, readPendingSignin, resetSignInState } from './signInUtils';
|
|
14
14
|
export function SigninScreen({ allowedPrefix, isNested = false, lightLogo, darkLogo, preservePath, suppressAuthErrorPrefix, View, }) {
|
|
15
15
|
const pathname = typeof window === 'undefined' ? '' : window.location.pathname;
|
|
16
16
|
const allow = matchesPathPrefix(pathname, allowedPrefix);
|
|
@@ -70,7 +70,13 @@ function SigninScreenImpl({ isNested = false, lightLogo, darkLogo, preservePath,
|
|
|
70
70
|
if (!authError)
|
|
71
71
|
return;
|
|
72
72
|
if (authError instanceof UserNotFoundError) {
|
|
73
|
-
|
|
73
|
+
if (isTenantSignIn()) {
|
|
74
|
+
setEmail(authError.email);
|
|
75
|
+
setMode('blocked');
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
setMode('signup');
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
else if (authError instanceof RestrictedEnvironmentError) {
|
|
76
82
|
setMode('restricted');
|
|
@@ -170,7 +176,7 @@ function SigninScreenImpl({ isNested = false, lightLogo, darkLogo, preservePath,
|
|
|
170
176
|
else if (mode === 'serviceFailure' && authError instanceof AuthenticationServiceError) {
|
|
171
177
|
content = (_jsx(SignInRecoveryStep, { details: { errorCode: authError.errorCode, message: authError.message, status: authError.status }, kind: "service", onContinue: retryAuthentication, onUseDifferentAccount: useDifferentAccount }));
|
|
172
178
|
}
|
|
173
|
-
else if (mode === 'signup' && !
|
|
179
|
+
else if (mode === 'signup' && !isTenantSignIn()) {
|
|
174
180
|
content = _jsx(SignupForm, { onSignup: onSignup, goBack: startOver });
|
|
175
181
|
}
|
|
176
182
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SigninScreen.js","sourceRoot":"","sources":["../../../src/shell/login/SigninScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sCAAsC,EAAuC,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACH,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACd,aAAa,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsC,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,EAA6B,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,kBAA+C,MAAM,sBAAsB,CAAC;AACnF,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SigninScreen.js","sourceRoot":"","sources":["../../../src/shell/login/SigninScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sCAAsC,EAAuC,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACH,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACd,aAAa,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAsC,WAAW,EAAE,SAAS,EAAE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AQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,YAEb,QAAQ,GACK,GAChB,CACT,CAAC;AACN,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,iBAAiB;IAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACjC,OAAO,CACH,cAAK,SAAS,EAAC,mDAAmD,YAC9D,0BACK,CAAC,CAAC,kBAAkB,CAAC,EACtB,cAAM,EACL,CAAC,CAAC,yBAAyB,CAAC,EAC7B,YAAG,SAAS,EAAC,gBAAgB,EAAC,IAAI,EAAC,+BAA+B,uCAE9D,EACH,CAAC,CAAC,0BAA0B,CAAC,IAC5B,GACJ,CACT,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export type ProviderId = 'google' | 'github' | 'microsoft' | 'oidc';
|
|
1
|
+
export type ProviderId = 'google' | 'github' | 'microsoft' | 'oidc' | 'password';
|
|
2
|
+
/** Providers that sign in by redirecting to an identity provider. `password` signs in in place. */
|
|
3
|
+
export type RedirectProviderId = Exclude<ProviderId, 'password'>;
|
|
2
4
|
export interface LastSuccessfulLogin {
|
|
3
5
|
email: string;
|
|
4
6
|
name?: string;
|
|
@@ -15,6 +17,10 @@ interface PendingSignin {
|
|
|
15
17
|
}
|
|
16
18
|
export declare function readPendingSignin(): PendingSignin | null;
|
|
17
19
|
export declare function clearPendingSignin(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Detects a tenant sign-in by the key's presence, including tenants with an empty label or name.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isTenantSignIn(): boolean;
|
|
18
24
|
/**
|
|
19
25
|
* Promotes the pending sign-in record to the last-successful-login entry, stamping the
|
|
20
26
|
* authenticated user's display name.
|
|
@@ -32,14 +38,28 @@ export declare function signOutOfFirebase(): Promise<void>;
|
|
|
32
38
|
* are swallowed.
|
|
33
39
|
*/
|
|
34
40
|
export declare function resetSignInState(): Promise<void>;
|
|
35
|
-
export declare function startSignIn(provider:
|
|
41
|
+
export declare function startSignIn(provider: RedirectProviderId, email: string, redirectTo?: string): Promise<{
|
|
42
|
+
ok: true;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
reason: 'no-email' | 'password-required';
|
|
46
|
+
}>;
|
|
47
|
+
export type PasswordSignInFailure = 'not-password-tenant' | 'invalid-credentials' | 'too-many-attempts' | 'failed';
|
|
48
|
+
export declare function passwordFailureReason(err: unknown): Exclude<PasswordSignInFailure, 'not-password-tenant'>;
|
|
49
|
+
/**
|
|
50
|
+
* Signs in a user of a password tenant, in place — there is no redirect. Only an address whose
|
|
51
|
+
* domain resolves to a tenant configured for password sign-in may use it; the tenant is resolved
|
|
52
|
+
* again here rather than trusted from the caller, so a returning session cannot carry a stale one.
|
|
53
|
+
* On success the session's auth-state listener completes the login.
|
|
54
|
+
*/
|
|
55
|
+
export declare function signInWithPassword(email: string, password: string): Promise<{
|
|
36
56
|
ok: true;
|
|
37
57
|
} | {
|
|
38
58
|
ok: false;
|
|
39
|
-
reason:
|
|
59
|
+
reason: PasswordSignInFailure;
|
|
40
60
|
}>;
|
|
41
61
|
/** Starts sign-in without email discovery, preserving an explicitly configured tenant. */
|
|
42
|
-
export declare function startSignInWithoutTenant(provider:
|
|
62
|
+
export declare function startSignInWithoutTenant(provider: RedirectProviderId, redirectTo?: string): void;
|
|
43
63
|
export declare function providerLabel(id: ProviderId): string;
|
|
44
64
|
export declare function emailLocalPart(email: string): string;
|
|
45
65
|
export declare function emailDomain(email: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signInUtils.d.ts","sourceRoot":"","sources":["../../../src/shell/login/signInUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signInUtils.d.ts","sourceRoot":"","sources":["../../../src/shell/login/signInUtils.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAA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,qBAAqB,GAAG,qBAAqB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,QAAQ,CAAC;AAYnH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAKzG;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAC,CAetE;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAYhG;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,CAKpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKxD;AASD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQnD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQ3D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Env } from '@vertesia/ui/env';
|
|
2
2
|
import { getFirebaseAuth, setFirebaseTenant } from '@vertesia/ui/session';
|
|
3
|
-
import {
|
|
3
|
+
import { FirebaseError } from 'firebase/app';
|
|
4
|
+
import { signOut as firebaseSignOut, GithubAuthProvider, GoogleAuthProvider, OAuthProvider, signInWithEmailAndPassword, signInWithRedirect, } from 'firebase/auth';
|
|
4
5
|
const LAST_SUCCESSFUL_LOGIN_KEY = 'vt.lastSuccessfulLogin';
|
|
5
6
|
const PENDING_SIGNIN_KEY = 'vt.pendingSignin';
|
|
6
7
|
export function readLastSuccessfulLogin() {
|
|
@@ -58,6 +59,12 @@ export function clearPendingSignin() {
|
|
|
58
59
|
// ignore
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Detects a tenant sign-in by the key's presence, including tenants with an empty label or name.
|
|
64
|
+
*/
|
|
65
|
+
export function isTenantSignIn() {
|
|
66
|
+
return localStorage.getItem('tenantName') !== null;
|
|
67
|
+
}
|
|
61
68
|
/**
|
|
62
69
|
* Promotes the pending sign-in record to the last-successful-login entry, stamping the
|
|
63
70
|
* authenticated user's display name.
|
|
@@ -164,10 +171,55 @@ export async function startSignIn(provider, email, redirectTo) {
|
|
|
164
171
|
localStorage.removeItem('tenantName');
|
|
165
172
|
auth.tenantId = Env.firebase?.tenantId ?? null;
|
|
166
173
|
}
|
|
174
|
+
// A password tenant has no identity provider to redirect to; its step collects the password.
|
|
175
|
+
if (effectiveIdp === 'password')
|
|
176
|
+
return { ok: false, reason: 'password-required' };
|
|
167
177
|
writePendingSignin({ email, provider: effectiveIdp, tenantName });
|
|
168
178
|
void signInWithRedirect(auth, buildFirebaseProvider(effectiveIdp, email, redirectTo));
|
|
169
179
|
return { ok: true };
|
|
170
180
|
}
|
|
181
|
+
// Firebase reports an unknown user, a wrong password and a disabled user with distinct codes on
|
|
182
|
+
// some SDK versions; they are folded into one answer so the form does not reveal which it was.
|
|
183
|
+
const INVALID_CREDENTIAL_CODES = new Set([
|
|
184
|
+
'auth/invalid-credential',
|
|
185
|
+
'auth/invalid-email',
|
|
186
|
+
'auth/user-disabled',
|
|
187
|
+
'auth/user-not-found',
|
|
188
|
+
'auth/wrong-password',
|
|
189
|
+
]);
|
|
190
|
+
export function passwordFailureReason(err) {
|
|
191
|
+
if (!(err instanceof FirebaseError))
|
|
192
|
+
return 'failed';
|
|
193
|
+
if (INVALID_CREDENTIAL_CODES.has(err.code))
|
|
194
|
+
return 'invalid-credentials';
|
|
195
|
+
if (err.code === 'auth/too-many-requests')
|
|
196
|
+
return 'too-many-attempts';
|
|
197
|
+
return 'failed';
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Signs in a user of a password tenant, in place — there is no redirect. Only an address whose
|
|
201
|
+
* domain resolves to a tenant configured for password sign-in may use it; the tenant is resolved
|
|
202
|
+
* again here rather than trusted from the caller, so a returning session cannot carry a stale one.
|
|
203
|
+
* On success the session's auth-state listener completes the login.
|
|
204
|
+
*/
|
|
205
|
+
export async function signInWithPassword(email, password) {
|
|
206
|
+
const tenant = await setFirebaseTenant(email);
|
|
207
|
+
if (!tenant)
|
|
208
|
+
return { ok: false, reason: 'failed' };
|
|
209
|
+
if (tenant.provider !== 'password')
|
|
210
|
+
return { ok: false, reason: 'not-password-tenant' };
|
|
211
|
+
const tenantName = tenant.label || tenant.name || undefined;
|
|
212
|
+
localStorage.setItem('tenantName', tenantName ?? '');
|
|
213
|
+
writePendingSignin({ email, provider: 'password', tenantName });
|
|
214
|
+
try {
|
|
215
|
+
await signInWithEmailAndPassword(getFirebaseAuth(), email, password);
|
|
216
|
+
return { ok: true };
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
clearPendingSignin();
|
|
220
|
+
return { ok: false, reason: passwordFailureReason(err) };
|
|
221
|
+
}
|
|
222
|
+
}
|
|
171
223
|
/** Starts sign-in without email discovery, preserving an explicitly configured tenant. */
|
|
172
224
|
export function startSignInWithoutTenant(provider, redirectTo) {
|
|
173
225
|
const auth = getFirebaseAuth();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signInUtils.js","sourceRoot":"","sources":["../../../src/shell/login/signInUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AAE,CAAC;IACnC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAE3D,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC9C,IAAI,OAAO,GAAY,GAAG,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,OAAO,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACxD,MAAM,GAAG,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzE,IAAI,GAAG,CAAC,QAAQ,CAAC,iDAAiD,CAAC;YAAE,OAAO,IAAI,CAAC;QACjF,OAAO,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertesia-ui-boot.js","names":[],"sources":["boot/branding.js","boot/loading.js","boot/index.js"],"sourcesContent":["export function defineAppBranding(branding) {\n return branding;\n}\nexport function escapeBrandHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[char] ?? char);\n}\nfunction cssString(value) {\n return JSON.stringify(value).replace(/</g, '\\\\3c ');\n}\nfunction colorDeclarations(colors) {\n const variables = {\n background: ['--background', '--color-background', '--vb-bg'],\n foreground: ['--foreground', '--color-foreground', '--vb-fg'],\n accent: ['--info', '--info-foreground', '--color-info', '--color-info-foreground'],\n button: ['--primary', '--color-primary', '--vb-primary', '--auth-button'],\n buttonText: ['--primary-foreground', '--color-primary-foreground', '--vb-primary-fg', '--auth-button-text'],\n };\n return Object.entries(colors ?? {})\n .map(([key, value]) => {\n if (!Object.hasOwn(variables, key) || /[;{}<>]/.test(value))\n throw new Error(`Invalid branding color: ${key}`);\n return variables[key].map((name) => `${name}:${value};`).join('');\n })\n .join('');\n}\n/** Theme tokens only: branding must never replace the shared page layout. */\nexport function renderBrandStyles(brand, selector = '.vbrand') {\n const animation = brand.loadingIcon?.animation;\n const keyframes = brand.loadingIcon?.keyframes ?? '';\n if (animation !== undefined && /[;{}<>]/.test(animation))\n throw new Error('Invalid loading icon animation');\n if (/[<>]/.test(keyframes))\n throw new Error('Invalid loading icon keyframes');\n const motion = animation === undefined\n ? ''\n : `--vertesia-loading-animation:${animation};--vertesia-loading-pulse-animation:none;`;\n const font = brand.font;\n const faces = font\n ? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.regular)});font-weight:400;font-display:swap; }\n${font.bold ? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.bold)});font-weight:700;font-display:swap; }` : ''}`\n : '';\n return `${faces}\n${keyframes}\n${selector} { ${motion}${colorDeclarations(brand.colors?.light)}${font ? `font-family:${cssString(font.family)};` : ''} }\n.dark ${selector},${selector}.vboot-dark { ${colorDeclarations(brand.colors?.dark)} }\n`;\n}\nexport function brandedBootOptions(brand) {\n return {\n iconSrc: brand.loadingIcon?.light,\n darkIconSrc: brand.loadingIcon?.dark,\n loadingLabel: brand.copy?.loading,\n slowLoadingLabel: brand.copy?.slowLoading,\n reloadLabel: brand.copy?.reload,\n html: brand.boot?.html,\n styles: `${renderBrandStyles(brand, '#loading-indicator')}\n${brand.colors?.light?.background ? `:root{--vertesia-boot-background:${brand.colors.light.background}}` : ''}\n${brand.colors?.dark?.background ? `:root.dark{--vertesia-boot-background:${brand.colors.dark.background}}` : ''}\n${brand.boot?.styles ?? ''}`,\n };\n}\n/** Platform defaults shared by boot markup and Firebase/OAuth React screens. */\nexport const vertesiaBranding = {\n name: 'Vertesia',\n logo: { light: '/logo-light.png', dark: '/logo-dark.png', alt: 'Vertesia' },\n loadingIcon: { light: '/icon.svg' },\n favicon: '/icon.svg',\n};\n//# sourceMappingURL=branding.js.map","/** Shared by server-rendered boot markup and React auth loaders. No React dependency. */\nexport const LOADING_ICON_SIZE = 40;\nexport const LOADING_INDICATOR_STYLES = `\n@keyframes vertesia-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n.vertesia-loading-motion {\n animation: var(--vertesia-loading-animation, vertesia-loading-spin 2s linear infinite);\n}\n.vertesia-loading-icon {\n width: ${LOADING_ICON_SIZE}px !important;\n min-width: ${LOADING_ICON_SIZE}px !important;\n max-width: ${LOADING_ICON_SIZE}px !important;\n height: ${LOADING_ICON_SIZE}px !important;\n min-height: ${LOADING_ICON_SIZE}px !important;\n max-height: ${LOADING_ICON_SIZE}px !important;\n margin: 0;\n padding: 0;\n object-fit: contain;\n flex: none;\n border-radius: 100% !important;\n}\n@media (prefers-reduced-motion: reduce) {\n .vertesia-loading-motion { animation: none !important; }\n}\n`;\n//# sourceMappingURL=loading.js.map","import { vertesiaBranding } from './branding.js';\nimport { LOADING_ICON_SIZE, LOADING_INDICATOR_STYLES } from './loading.js';\nconst DEFAULT_STORAGE_KEY = 'vite-ui-theme';\nconst DEFAULT_ICON_SRC = vertesiaBranding.loadingIcon.light;\nconst DEFAULT_LOADING_LABEL = 'Loading';\nexport const BOOT_SCREEN_STYLES = `\n${LOADING_INDICATOR_STYLES}\n .vboot {\n --vb-bg: #ffffff;\n --vb-fg: #0a0a0a;\n --vb-muted: #636363;\n --vb-muted-bg: #f5f5f5;\n --vb-border: #e5e5e5;\n --vb-primary: #0048bd;\n --vb-primary-fg: #ffffff;\n --vb-glow: rgba(50, 49, 189, 0.12);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n color: var(--vb-fg);\n }\n .vboot.vboot-dark {\n --vb-bg: #0a0a0a;\n --vb-fg: #fafafa;\n --vb-muted: #a1a1a1;\n --vb-muted-bg: #262626;\n --vb-border: rgba(255, 255, 255, 0.1);\n --vb-primary: #2b69d1;\n --vb-primary-fg: #fafafa;\n --vb-glow: rgba(79, 70, 229, 0.2);\n }\n .vboot-overlay {\n position: absolute !important;\n inset: 0 !important;\n box-sizing: border-box !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0 !important;\n padding: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 1.5rem !important;\n transform: none !important;\n background: var(--vb-bg) !important;\n }\n #loading-indicator {\n position: fixed !important;\n inset: 0 !important;\n z-index: 2147483647 !important;\n box-sizing: border-box !important;\n width: 100vw !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n transform: none !important;\n }\n .vboot-icon-dark { display: none; }\n .vboot-dark .vboot-icon-light { display: none; }\n .vboot-dark .vboot-icon-dark { display: block; }\n .vboot-slow {\n text-align: center;\n }\n .vboot-slow p {\n color: var(--vb-muted);\n font-size: 0.875rem;\n margin: 0 0 0.75rem;\n }\n .vboot-btn {\n display: inline-block;\n padding: 0.5rem 1rem;\n background: var(--vb-primary);\n color: var(--vb-primary-fg);\n border: none;\n border-radius: 0.375rem;\n font: inherit;\n font-size: 0.875rem;\n font-weight: 500;\n cursor: pointer;\n }\n .vboot-btn:hover {\n opacity: 0.9;\n }\n`;\nfunction inlineJson(value) {\n return JSON.stringify(value).replaceAll('<', '\\\\u003c');\n}\nfunction normalizedOptions(options) {\n return {\n storageKey: options.storageKey ?? DEFAULT_STORAGE_KEY,\n iconSrc: options.iconSrc ?? DEFAULT_ICON_SRC,\n loadingLabel: options.loadingLabel ?? DEFAULT_LOADING_LABEL,\n autoStart: options.autoStart ?? true,\n html: options.html,\n styles: options.styles,\n };\n}\n/** Default markup shared by Studio and configurable applications. */\nexport function renderDefaultBootContent(options = {}) {\n const escapeMarkup = (value) => value.replace(/[&<>\"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[char] ?? char);\n const { iconSrc, loadingLabel } = normalizedOptions(options);\n const icon = (src, className = '') => `<img class=\"vboot-spinner vertesia-loading-icon vertesia-loading-motion ${className}\" width=\"${LOADING_ICON_SIZE}\" height=\"${LOADING_ICON_SIZE}\" src=\"${escapeMarkup(src)}\" alt=\"${escapeMarkup(loadingLabel)}\" />`;\n return `<div class=\"vboot-overlay\" role=\"status\" aria-live=\"polite\">${options.darkIconSrc ? icon(iconSrc, 'vboot-icon-light') + icon(options.darkIconSrc, 'vboot-icon-dark') : icon(iconSrc)}\n<div id=\"loading-slow-notice\" class=\"vboot-slow\" style=\"display: none;\">\n<p>${escapeMarkup(options.slowLoadingLabel ?? 'Still loading — this is taking longer than usual.')}</p>\n<div id=\"loading-slow-reload\" style=\"display: none;\"><button type=\"button\" class=\"vboot-btn\" data-boot-reload>${escapeMarkup(options.reloadLabel ?? 'Reload page')}</button></div></div></div>`;\n}\nexport function renderBootScreenRuntime(options = {}) {\n const { storageKey, html } = normalizedOptions(options);\n const defaultHtml = renderDefaultBootContent(options);\n return `(() => {\n const storageKey = ${inlineJson(storageKey)};\n\n const customHtml = ${html === undefined ? 'undefined' : inlineJson(html)};\n let slowNoticeTimer;\n let slowReloadTimer;\n const previewTheme = (() => {\n try {\n const value = new URL(window.location.href).searchParams.get('__vertesia_boot_theme');\n return value === 'dark' || value === 'light' ? value : null;\n } catch (_error) {\n return null;\n }\n })();\n const prefersDarkTheme = () => {\n if (previewTheme) return previewTheme === 'dark';\n try {\n const stored = window.localStorage.getItem(storageKey);\n if (stored === 'dark') return true;\n if (stored === 'light') return false;\n } catch (_error) {\n // Storage can be unavailable in private or restricted browsing contexts.\n }\n try {\n return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches;\n } catch (_error) {\n return false;\n }\n };\n const applyTheme = () => {\n const dark = prefersDarkTheme();\n const root = document.documentElement;\n root.classList.remove('light', 'dark');\n root.classList.add(dark ? 'dark' : 'light');\n return dark;\n };\n const paintDocumentBackground = () => {\n const dark = applyTheme();\n const root = document.documentElement;\n const background = window.getComputedStyle(root).getPropertyValue('--vertesia-boot-background').trim()\n || (dark ? '#0a0a0a' : '#ffffff');\n root.style.backgroundColor = background;\n root.style.colorScheme = dark ? 'dark' : 'light';\n if (document.body) document.body.style.backgroundColor = background;\n };\n const restoreDocumentBackground = () => {\n applyTheme();\n const root = document.documentElement;\n root.style.removeProperty('background-color');\n root.style.removeProperty('color-scheme');\n if (document.body) document.body.style.removeProperty('background-color');\n };\n const bootThemeClass = () => prefersDarkTheme() ? 'vboot vboot-dark' : 'vboot';\n const ensureLoadingIndicator = () => {\n if (document.getElementById('loading-indicator') || !document.body) return;\n paintDocumentBackground();\n const loading = document.createElement('div');\n loading.id = 'loading-indicator';\n loading.className = bootThemeClass();\n loading.innerHTML = customHtml ?? ${inlineJson(defaultHtml)};\n loading.querySelectorAll('[data-boot-title]').forEach((heading) => {\n if (document.title) heading.textContent = document.title;\n });\n loading.querySelectorAll('[data-boot-reload]').forEach((button) => {\n button.addEventListener('click', () => window.location.reload());\n });\n // Custom landmarks and controls must stay in body to enter the accessibility tree.\n const loadingParent = customHtml === undefined && typeof document.documentElement.appendChild === 'function'\n ? document.documentElement\n : document.body;\n loadingParent.appendChild(loading);\n };\n const hideLoadingIndicator = () => {\n clearTimeout(slowNoticeTimer);\n clearTimeout(slowReloadTimer);\n const loading = document.getElementById('loading-indicator');\n if (loading) loading.style.display = 'none';\n };\n const hasAppRendered = (rootId = 'root') => {\n const root = document.getElementById(rootId);\n return Boolean(root && root.innerHTML && root.innerHTML.trim() !== '');\n };\n const hideLoadingIndicatorOnFirstRender = (rootId = 'root') => {\n if (typeof MutationObserver !== 'function') return;\n const root = document.getElementById(rootId);\n if (!root) return;\n if (hasAppRendered(rootId)) {\n hideLoadingIndicator();\n restoreDocumentBackground();\n return;\n }\n const observer = new MutationObserver(() => {\n if (!hasAppRendered(rootId)) return;\n hideLoadingIndicator();\n restoreDocumentBackground();\n observer.disconnect();\n });\n observer.observe(root, { childList: true });\n };\n // Used by standalone apps. Hosts with their own error handler keep autoStart disabled.\n const scheduleSlowLoadingNotice = () => {\n clearTimeout(slowNoticeTimer);\n clearTimeout(slowReloadTimer);\n if (hasAppRendered()) return;\n slowNoticeTimer = setTimeout(() => {\n const notice = document.getElementById('loading-slow-notice');\n if (notice) notice.style.display = '';\n }, 10000);\n slowReloadTimer = setTimeout(() => {\n const reload = document.getElementById('loading-slow-reload');\n if (reload) reload.style.display = '';\n }, 30000);\n };\n window.__vertesiaBoot = {\n scheduleSlowLoadingNotice,\n applyTheme,\n bootThemeClass,\n ensureLoadingIndicator,\n hasAppRendered,\n hideLoadingIndicator,\n hideLoadingIndicatorOnFirstRender,\n paintDocumentBackground,\n prefersDarkTheme,\n restoreDocumentBackground,\n };\n paintDocumentBackground();\n})();`;\n}\nexport function renderBootScreenHead(options = {}) {\n return `<style id=\"vertesia-boot-styles\">${BOOT_SCREEN_STYLES}\\n${options.styles ?? ''}</style>\\n<script>${renderBootScreenRuntime(options)}</script>`;\n}\nexport function renderBootScreenInitializer() {\n return `<script>window.__vertesiaBoot.ensureLoadingIndicator(); window.__vertesiaBoot.hideLoadingIndicatorOnFirstRender(); window.__vertesiaBoot.scheduleSlowLoadingNotice();</script>`;\n}\nfunction isHtmlWhitespace(character) {\n return character === ' ' || character === '\\t' || character === '\\n' || character === '\\r' || character === '\\f';\n}\nfunction hasAttribute(openingTag, attributeName) {\n const lowerTag = openingTag.toLowerCase();\n let searchFrom = 0;\n while (searchFrom < lowerTag.length) {\n const attributeIndex = lowerTag.indexOf(attributeName, searchFrom);\n if (attributeIndex === -1)\n return false;\n const before = lowerTag[attributeIndex - 1];\n let afterIndex = attributeIndex + attributeName.length;\n while (isHtmlWhitespace(lowerTag[afterIndex]))\n afterIndex += 1;\n if (isHtmlWhitespace(before) && lowerTag[afterIndex] === '=')\n return true;\n searchFrom = attributeIndex + attributeName.length;\n }\n return false;\n}\nfunction findOpeningTagEnd(html, tagName, attributeName) {\n const lowerHtml = html.toLowerCase();\n const tagStart = `<${tagName}`;\n let searchFrom = 0;\n while (searchFrom < lowerHtml.length) {\n const start = lowerHtml.indexOf(tagStart, searchFrom);\n if (start === -1)\n return undefined;\n const boundary = lowerHtml[start + tagStart.length];\n if (boundary === '>' || isHtmlWhitespace(boundary)) {\n const end = lowerHtml.indexOf('>', start + tagStart.length);\n if (end === -1)\n return undefined;\n if (!attributeName || hasAttribute(lowerHtml.slice(start, end + 1), attributeName))\n return end + 1;\n searchFrom = end + 1;\n }\n else {\n searchFrom = start + tagStart.length;\n }\n }\n return undefined;\n}\nfunction insertAt(html, index, content) {\n return `${html.slice(0, index)}${content}${html.slice(index)}`;\n}\nexport function injectBootScreenHtml(html, options = {}) {\n const normalized = normalizedOptions(options);\n const head = renderBootScreenHead(normalized);\n const insertionPoint = findOpeningTagEnd(html, 'meta', 'charset') ?? findOpeningTagEnd(html, 'head');\n const withHead = insertionPoint === undefined ? html : insertAt(html, insertionPoint, `\\n${head}`);\n if (!normalized.autoStart)\n return withHead;\n const bodyEnd = withHead.toLowerCase().indexOf('</body>');\n return bodyEnd === -1 ? withHead : insertAt(withHead, bodyEnd, `${renderBootScreenInitializer()}\\n`);\n}\nexport function createBootScreenVitePlugin(options = {}) {\n return {\n name: 'vertesia-boot-screen',\n transformIndexHtml: (html) => injectBootScreenHtml(html, options),\n };\n}\nexport * from './branding.js';\n//# sourceMappingURL=index.js.map"],"mappings":"AAAA,SAAgB,EAAkB,EAAU,CACxC,O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AAS,EAAM,EAAgB,KAAK,GAAM,EACjG,GAAI,CAAC,EAAW,UACZ,OAAO,EACX,IAAM,EAAU,EAAS,YAAY,CAAC,CAAC,QAAQ,SAAS,EACxD,OAAO,IAAY,GAAK,EAAW,EAAS,EAAU,EAAS,GAAG,EAA4B,EAAE,GAAG,CACvG,CACA,SAAgB,EAA2B,EAAU,CAAC,EAAG,CACrD,MAAO,CACH,KAAM,uBACN,mBAAqB,GAAS,EAAqB,EAAM,CAAO,CACpE,CACJ"}
|
|
1
|
+
{"version":3,"file":"vertesia-ui-boot.js","names":["defineAppBranding","branding","escapeBrandHtml","value","char","cssString","colorDeclarations","variables","colors","key","name","renderBrandStyles","animation","brand","keyframes","motion","font","selector","brandedBootOptions","vertesiaBranding","DEFAULT_ICON_SRC","BOOT_SCREEN_STYLES","inlineJson","normalizedOptions","options","renderDefaultBootContent","escapeMarkup","icon","className","src","loadingLabel","iconSrc","renderBootScreenRuntime","defaultHtml","storageKey","html","renderBootScreenHead","renderBootScreenInitializer","isHtmlWhitespace","character","hasAttribute","lowerTag","openingTag","searchFrom","attributeIndex","attributeName","before","afterIndex","findOpeningTagEnd","lowerHtml","tagStart","tagName","start","boundary","end","insertAt","index","content","injectBootScreenHtml","normalized","head","insertionPoint","withHead","bodyEnd","createBootScreenVitePlugin"],"sources":["boot/branding.js","boot/loading.js","boot/index.js"],"sourcesContent":["export function defineAppBranding(branding) {\n return branding;\n}\nexport function escapeBrandHtml(value) {\n return value.replace(/[&<>\"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[char] ?? char);\n}\nfunction cssString(value) {\n return JSON.stringify(value).replace(/</g, '\\\\3c ');\n}\nfunction colorDeclarations(colors) {\n const variables = {\n background: ['--background', '--color-background', '--vb-bg'],\n foreground: ['--foreground', '--color-foreground', '--vb-fg'],\n accent: ['--info', '--info-foreground', '--color-info', '--color-info-foreground'],\n button: ['--primary', '--color-primary', '--vb-primary', '--auth-button'],\n buttonText: ['--primary-foreground', '--color-primary-foreground', '--vb-primary-fg', '--auth-button-text'],\n };\n return Object.entries(colors ?? {})\n .map(([key, value]) => {\n if (!Object.hasOwn(variables, key) || /[;{}<>]/.test(value))\n throw new Error(`Invalid branding color: ${key}`);\n return variables[key].map((name) => `${name}:${value};`).join('');\n })\n .join('');\n}\n/** Theme tokens only: branding must never replace the shared page layout. */\nexport function renderBrandStyles(brand, selector = '.vbrand') {\n const animation = brand.loadingIcon?.animation;\n const keyframes = brand.loadingIcon?.keyframes ?? '';\n if (animation !== undefined && /[;{}<>]/.test(animation))\n throw new Error('Invalid loading icon animation');\n if (/[<>]/.test(keyframes))\n throw new Error('Invalid loading icon keyframes');\n const motion = animation === undefined\n ? ''\n : `--vertesia-loading-animation:${animation};--vertesia-loading-pulse-animation:none;`;\n const font = brand.font;\n const faces = font\n ? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.regular)});font-weight:400;font-display:swap; }\n${font.bold ? `@font-face { font-family:${cssString(font.family)};src:url(${cssString(font.bold)});font-weight:700;font-display:swap; }` : ''}`\n : '';\n return `${faces}\n${keyframes}\n${selector} { ${motion}${colorDeclarations(brand.colors?.light)}${font ? `font-family:${cssString(font.family)};` : ''} }\n.dark ${selector},${selector}.vboot-dark { ${colorDeclarations(brand.colors?.dark)} }\n`;\n}\nexport function brandedBootOptions(brand) {\n return {\n iconSrc: brand.loadingIcon?.light,\n darkIconSrc: brand.loadingIcon?.dark,\n loadingLabel: brand.copy?.loading,\n slowLoadingLabel: brand.copy?.slowLoading,\n reloadLabel: brand.copy?.reload,\n html: brand.boot?.html,\n styles: `${renderBrandStyles(brand, '#loading-indicator')}\n${brand.colors?.light?.background ? `:root{--vertesia-boot-background:${brand.colors.light.background}}` : ''}\n${brand.colors?.dark?.background ? `:root.dark{--vertesia-boot-background:${brand.colors.dark.background}}` : ''}\n${brand.boot?.styles ?? ''}`,\n };\n}\n/** Platform defaults shared by boot markup and Firebase/OAuth React screens. */\nexport const vertesiaBranding = {\n name: 'Vertesia',\n logo: { light: '/logo-light.png', dark: '/logo-dark.png', alt: 'Vertesia' },\n loadingIcon: { light: '/icon.svg' },\n favicon: '/icon.svg',\n};\n//# sourceMappingURL=branding.js.map","/** Shared by server-rendered boot markup and React auth loaders. No React dependency. */\nexport const LOADING_ICON_SIZE = 40;\nexport const LOADING_INDICATOR_STYLES = `\n@keyframes vertesia-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n.vertesia-loading-motion {\n animation: var(--vertesia-loading-animation, vertesia-loading-spin 2s linear infinite);\n}\n.vertesia-loading-icon {\n width: ${LOADING_ICON_SIZE}px !important;\n min-width: ${LOADING_ICON_SIZE}px !important;\n max-width: ${LOADING_ICON_SIZE}px !important;\n height: ${LOADING_ICON_SIZE}px !important;\n min-height: ${LOADING_ICON_SIZE}px !important;\n max-height: ${LOADING_ICON_SIZE}px !important;\n margin: 0;\n padding: 0;\n object-fit: contain;\n flex: none;\n border-radius: 100% !important;\n}\n@media (prefers-reduced-motion: reduce) {\n .vertesia-loading-motion { animation: none !important; }\n}\n`;\n//# sourceMappingURL=loading.js.map","import { vertesiaBranding } from './branding.js';\nimport { LOADING_ICON_SIZE, LOADING_INDICATOR_STYLES } from './loading.js';\nconst DEFAULT_STORAGE_KEY = 'vite-ui-theme';\nconst DEFAULT_ICON_SRC = vertesiaBranding.loadingIcon.light;\nconst DEFAULT_LOADING_LABEL = 'Loading';\nexport const BOOT_SCREEN_STYLES = `\n${LOADING_INDICATOR_STYLES}\n .vboot {\n --vb-bg: #ffffff;\n --vb-fg: #0a0a0a;\n --vb-muted: #636363;\n --vb-muted-bg: #f5f5f5;\n --vb-border: #e5e5e5;\n --vb-primary: #0048bd;\n --vb-primary-fg: #ffffff;\n --vb-glow: rgba(50, 49, 189, 0.12);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n color: var(--vb-fg);\n }\n .vboot.vboot-dark {\n --vb-bg: #0a0a0a;\n --vb-fg: #fafafa;\n --vb-muted: #a1a1a1;\n --vb-muted-bg: #262626;\n --vb-border: rgba(255, 255, 255, 0.1);\n --vb-primary: #2b69d1;\n --vb-primary-fg: #fafafa;\n --vb-glow: rgba(79, 70, 229, 0.2);\n }\n .vboot-overlay {\n position: absolute !important;\n inset: 0 !important;\n box-sizing: border-box !important;\n width: 100% !important;\n height: 100% !important;\n margin: 0 !important;\n padding: 0 !important;\n display: flex !important;\n flex-direction: column !important;\n align-items: center !important;\n justify-content: center !important;\n gap: 1.5rem !important;\n transform: none !important;\n background: var(--vb-bg) !important;\n }\n #loading-indicator {\n position: fixed !important;\n inset: 0 !important;\n z-index: 2147483647 !important;\n box-sizing: border-box !important;\n width: 100vw !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n transform: none !important;\n }\n .vboot-icon-dark { display: none; }\n .vboot-dark .vboot-icon-light { display: none; }\n .vboot-dark .vboot-icon-dark { display: block; }\n .vboot-slow {\n text-align: center;\n }\n .vboot-slow p {\n color: var(--vb-muted);\n font-size: 0.875rem;\n margin: 0 0 0.75rem;\n }\n .vboot-btn {\n display: inline-block;\n padding: 0.5rem 1rem;\n background: var(--vb-primary);\n color: var(--vb-primary-fg);\n border: none;\n border-radius: 0.375rem;\n font: inherit;\n font-size: 0.875rem;\n font-weight: 500;\n cursor: pointer;\n }\n .vboot-btn:hover {\n opacity: 0.9;\n }\n`;\nfunction inlineJson(value) {\n return JSON.stringify(value).replaceAll('<', '\\\\u003c');\n}\nfunction normalizedOptions(options) {\n return {\n storageKey: options.storageKey ?? DEFAULT_STORAGE_KEY,\n iconSrc: options.iconSrc ?? DEFAULT_ICON_SRC,\n loadingLabel: options.loadingLabel ?? DEFAULT_LOADING_LABEL,\n autoStart: options.autoStart ?? true,\n html: options.html,\n styles: options.styles,\n };\n}\n/** Default markup shared by Studio and configurable applications. */\nexport function renderDefaultBootContent(options = {}) {\n const escapeMarkup = (value) => value.replace(/[&<>\"']/g, (char) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[char] ?? char);\n const { iconSrc, loadingLabel } = normalizedOptions(options);\n const icon = (src, className = '') => `<img class=\"vboot-spinner vertesia-loading-icon vertesia-loading-motion ${className}\" width=\"${LOADING_ICON_SIZE}\" height=\"${LOADING_ICON_SIZE}\" src=\"${escapeMarkup(src)}\" alt=\"${escapeMarkup(loadingLabel)}\" />`;\n return `<div class=\"vboot-overlay\" role=\"status\" aria-live=\"polite\">${options.darkIconSrc ? icon(iconSrc, 'vboot-icon-light') + icon(options.darkIconSrc, 'vboot-icon-dark') : icon(iconSrc)}\n<div id=\"loading-slow-notice\" class=\"vboot-slow\" style=\"display: none;\">\n<p>${escapeMarkup(options.slowLoadingLabel ?? 'Still loading — this is taking longer than usual.')}</p>\n<div id=\"loading-slow-reload\" style=\"display: none;\"><button type=\"button\" class=\"vboot-btn\" data-boot-reload>${escapeMarkup(options.reloadLabel ?? 'Reload page')}</button></div></div></div>`;\n}\nexport function renderBootScreenRuntime(options = {}) {\n const { storageKey, html } = normalizedOptions(options);\n const defaultHtml = renderDefaultBootContent(options);\n return `(() => {\n const storageKey = ${inlineJson(storageKey)};\n\n const customHtml = ${html === undefined ? 'undefined' : inlineJson(html)};\n let slowNoticeTimer;\n let slowReloadTimer;\n const previewTheme = (() => {\n try {\n const value = new URL(window.location.href).searchParams.get('__vertesia_boot_theme');\n return value === 'dark' || value === 'light' ? value : null;\n } catch (_error) {\n return null;\n }\n })();\n const prefersDarkTheme = () => {\n if (previewTheme) return previewTheme === 'dark';\n try {\n const stored = window.localStorage.getItem(storageKey);\n if (stored === 'dark') return true;\n if (stored === 'light') return false;\n } catch (_error) {\n // Storage can be unavailable in private or restricted browsing contexts.\n }\n try {\n return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches;\n } catch (_error) {\n return false;\n }\n };\n const applyTheme = () => {\n const dark = prefersDarkTheme();\n const root = document.documentElement;\n root.classList.remove('light', 'dark');\n root.classList.add(dark ? 'dark' : 'light');\n return dark;\n };\n const paintDocumentBackground = () => {\n const dark = applyTheme();\n const root = document.documentElement;\n const background = window.getComputedStyle(root).getPropertyValue('--vertesia-boot-background').trim()\n || (dark ? '#0a0a0a' : '#ffffff');\n root.style.backgroundColor = background;\n root.style.colorScheme = dark ? 'dark' : 'light';\n if (document.body) document.body.style.backgroundColor = background;\n };\n const restoreDocumentBackground = () => {\n applyTheme();\n const root = document.documentElement;\n root.style.removeProperty('background-color');\n root.style.removeProperty('color-scheme');\n if (document.body) document.body.style.removeProperty('background-color');\n };\n const bootThemeClass = () => prefersDarkTheme() ? 'vboot vboot-dark' : 'vboot';\n const ensureLoadingIndicator = () => {\n if (document.getElementById('loading-indicator') || !document.body) return;\n paintDocumentBackground();\n const loading = document.createElement('div');\n loading.id = 'loading-indicator';\n loading.className = bootThemeClass();\n loading.innerHTML = customHtml ?? ${inlineJson(defaultHtml)};\n loading.querySelectorAll('[data-boot-title]').forEach((heading) => {\n if (document.title) heading.textContent = document.title;\n });\n loading.querySelectorAll('[data-boot-reload]').forEach((button) => {\n button.addEventListener('click', () => window.location.reload());\n });\n // Custom landmarks and controls must stay in body to enter the accessibility tree.\n const loadingParent = customHtml === undefined && typeof document.documentElement.appendChild === 'function'\n ? document.documentElement\n : document.body;\n loadingParent.appendChild(loading);\n };\n const hideLoadingIndicator = () => {\n clearTimeout(slowNoticeTimer);\n clearTimeout(slowReloadTimer);\n const loading = document.getElementById('loading-indicator');\n if (loading) loading.style.display = 'none';\n };\n const hasAppRendered = (rootId = 'root') => {\n const root = document.getElementById(rootId);\n return Boolean(root && root.innerHTML && root.innerHTML.trim() !== '');\n };\n const hideLoadingIndicatorOnFirstRender = (rootId = 'root') => {\n if (typeof MutationObserver !== 'function') return;\n const root = document.getElementById(rootId);\n if (!root) return;\n if (hasAppRendered(rootId)) {\n hideLoadingIndicator();\n restoreDocumentBackground();\n return;\n }\n const observer = new MutationObserver(() => {\n if (!hasAppRendered(rootId)) return;\n hideLoadingIndicator();\n restoreDocumentBackground();\n observer.disconnect();\n });\n observer.observe(root, { childList: true });\n };\n // Used by standalone apps. Hosts with their own error handler keep autoStart disabled.\n const scheduleSlowLoadingNotice = () => {\n clearTimeout(slowNoticeTimer);\n clearTimeout(slowReloadTimer);\n if (hasAppRendered()) return;\n slowNoticeTimer = setTimeout(() => {\n const notice = document.getElementById('loading-slow-notice');\n if (notice) notice.style.display = '';\n }, 10000);\n slowReloadTimer = setTimeout(() => {\n const reload = document.getElementById('loading-slow-reload');\n if (reload) reload.style.display = '';\n }, 30000);\n };\n window.__vertesiaBoot = {\n scheduleSlowLoadingNotice,\n applyTheme,\n bootThemeClass,\n ensureLoadingIndicator,\n hasAppRendered,\n hideLoadingIndicator,\n hideLoadingIndicatorOnFirstRender,\n paintDocumentBackground,\n prefersDarkTheme,\n restoreDocumentBackground,\n };\n paintDocumentBackground();\n})();`;\n}\nexport function renderBootScreenHead(options = {}) {\n return `<style id=\"vertesia-boot-styles\">${BOOT_SCREEN_STYLES}\\n${options.styles ?? ''}</style>\\n<script>${renderBootScreenRuntime(options)}</script>`;\n}\nexport function renderBootScreenInitializer() {\n return `<script>window.__vertesiaBoot.ensureLoadingIndicator(); window.__vertesiaBoot.hideLoadingIndicatorOnFirstRender(); window.__vertesiaBoot.scheduleSlowLoadingNotice();</script>`;\n}\nfunction isHtmlWhitespace(character) {\n return character === ' ' || character === '\\t' || character === '\\n' || character === '\\r' || character === '\\f';\n}\nfunction hasAttribute(openingTag, attributeName) {\n const lowerTag = openingTag.toLowerCase();\n let searchFrom = 0;\n while (searchFrom < lowerTag.length) {\n const attributeIndex = lowerTag.indexOf(attributeName, searchFrom);\n if (attributeIndex === -1)\n return false;\n const before = lowerTag[attributeIndex - 1];\n let afterIndex = attributeIndex + attributeName.length;\n while (isHtmlWhitespace(lowerTag[afterIndex]))\n afterIndex += 1;\n if (isHtmlWhitespace(before) && lowerTag[afterIndex] === '=')\n return true;\n searchFrom = attributeIndex + attributeName.length;\n }\n return false;\n}\nfunction findOpeningTagEnd(html, tagName, attributeName) {\n const lowerHtml = html.toLowerCase();\n const tagStart = `<${tagName}`;\n let searchFrom = 0;\n while (searchFrom < lowerHtml.length) {\n const start = lowerHtml.indexOf(tagStart, searchFrom);\n if (start === -1)\n return undefined;\n const boundary = lowerHtml[start + tagStart.length];\n if (boundary === '>' || isHtmlWhitespace(boundary)) {\n const end = lowerHtml.indexOf('>', start + tagStart.length);\n if (end === -1)\n return undefined;\n if (!attributeName || hasAttribute(lowerHtml.slice(start, end + 1), attributeName))\n return end + 1;\n searchFrom = end + 1;\n }\n else {\n searchFrom = start + tagStart.length;\n }\n }\n return undefined;\n}\nfunction insertAt(html, index, content) {\n return `${html.slice(0, index)}${content}${html.slice(index)}`;\n}\nexport function injectBootScreenHtml(html, options = {}) {\n const normalized = normalizedOptions(options);\n const head = renderBootScreenHead(normalized);\n const insertionPoint = findOpeningTagEnd(html, 'meta', 'charset') ?? findOpeningTagEnd(html, 'head');\n const withHead = insertionPoint === undefined ? html : insertAt(html, insertionPoint, `\\n${head}`);\n if (!normalized.autoStart)\n return withHead;\n const bodyEnd = withHead.toLowerCase().indexOf('</body>');\n return bodyEnd === -1 ? withHead : insertAt(withHead, bodyEnd, `${renderBootScreenInitializer()}\\n`);\n}\nexport function createBootScreenVitePlugin(options = {}) {\n return {\n name: 'vertesia-boot-screen',\n transformIndexHtml: (html) => injectBootScreenHtml(html, options),\n };\n}\nexport * from './branding.js';\n//# sourceMappingURL=index.js.map"],"mappings":"AAAA,SAAgBA,EAAkB,EAAU,CACxC,OAAOC,CACX,CACA,SAAgBC,EAAgB,EAAO,CACnC,OAAOC,EAAM,QAAQ,WAAa,IAAU,CAAE,IAAK,QAAS,IAAK,OAAQ,IAAK,OAAQ,IAAK,SAAU,IAAK,OAAQ,EAAA,CAAGC,IAASA,CAAI,CACtI,CACA,SAASC,EAAU,EAAO,CACtB,OAAO,KAAK,UAAUF,CAAK,CAAC,CAAC,QAAQ,KAAM,OAAO,CACtD,CACA,SA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