@firebase-oss/ui-react 0.0.1 → 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2016 Google Inc
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -1,3 +1,10 @@
1
- 'use strict';var uiCore=require('@firebase-oss/ui-core'),react=require('react'),react$1=require('@nanostores/react'),jsxRuntime=require('react/jsx-runtime'),reactForm=require('@tanstack/react-form'),reactSlot=require('@radix-ui/react-slot'),uiStyles=require('@firebase-oss/ui-styles'),tailwindMerge=require('tailwind-merge'),clsx=require('clsx'),auth=require('firebase/auth');var Qt={version:"0.0.1"};var yt=react.createContext({});function be({children:t,ui:e,policies:r}){let o=react$1.useStore(e);return jsxRuntime.jsx(yt.Provider,{value:o,children:jsxRuntime.jsx(Yt,{policies:r,children:t})})}function s(){let t=react.useContext(yt);if(!t)throw new Error("No FirebaseUI context found. Your application must be wrapped in a <FirebaseUIProvider> component.");return t}function Kt(){let t=s();return react.useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function Xt(){let t=s();return react.useMemo(()=>uiCore.createSignInAuthFormSchema(t),[t])}function Zt(){let t=s();return react.useMemo(()=>uiCore.createSignUpAuthFormSchema(t),[t])}function jt(){let t=s();return react.useMemo(()=>uiCore.createForgotPasswordAuthFormSchema(t),[t])}function tr(){let t=s();return react.useMemo(()=>uiCore.createEmailLinkAuthFormSchema(t),[t])}function rr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthNumberFormSchema(t),[t])}function er(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthVerifyFormSchema(t),[t])}function it(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function st(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function or(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthNumberFormSchema(t),[t])}function at(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function O(t){let e=s(),r=react.useRef(null),o=react.useRef(e),n=react.useRef(null);return o.current=e,react.useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=uiCore.getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}var At=react.createContext(void 0);function Yt({children:t,policies:e}){return jsxRuntime.jsx(At.Provider,{value:e,children:t})}function b(){let t=s(),e=react.useContext(At);if(!e)return null;let{termsOfServiceUrl:r,privacyPolicyUrl:o,onNavigate:n}=e,a=uiCore.getTranslation(t,"messages","termsAndPrivacy").split(/(\{tos\}|\{privacy\})/),N=n?jsxRuntime.jsx("button",{}):jsxRuntime.jsx("a",{target:"_blank",rel:"noopener noreferrer"});return jsxRuntime.jsx("div",{className:"fui-policies",children:a.map((y,T)=>y==="{tos}"?react.cloneElement(N,{key:T,onClick:n?()=>n(r):void 0,href:n?void 0:r,children:uiCore.getTranslation(t,"labels","termsOfService")}):y==="{privacy}"?react.cloneElement(N,{key:T,onClick:n?()=>n(o):void 0,href:n?void 0:o,children:uiCore.getTranslation(t,"labels","privacyPolicy")}):jsxRuntime.jsx("span",{children:y},T))})}function u(...t){return tailwindMerge.twMerge(clsx.clsx(...t))}function I({className:t,variant:e="primary",asChild:r,...o}){return jsxRuntime.jsx(r?reactSlot.Slot:"button",{className:u(uiStyles.buttonVariant({variant:e}),t),...o})}var{fieldContext:We,useFieldContext:qe,formContext:ze,useFormContext:ir}=reactForm.createFormHookContexts();function $e({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsxRuntime.jsx("div",{children:jsxRuntime.jsx("div",{role:"alert","aria-live":"polite",className:u("fui-form__error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function Qe({children:t,before:e,label:r,action:o,...n}){let i=qe();return jsxRuntime.jsxs("label",{htmlFor:i.name,children:[jsxRuntime.jsxs("div",{"data-input-label":true,children:[jsxRuntime.jsx("div",{children:r}),o?jsxRuntime.jsx("div",{children:o}):null]}),jsxRuntime.jsxs("div",{"data-input-group":true,children:[e,jsxRuntime.jsx("input",{...n,"aria-invalid":i.state.meta.isTouched&&i.state.meta.errors.length>0,id:i.name,name:i.name,value:i.state.value,onBlur:()=>{i.handleBlur();},onChange:a=>{i.handleChange(a.target.value);}})]}),t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):null,jsxRuntime.jsx($e,{field:i})]})}function Je({className:t,...e}){return jsxRuntime.jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function Ye(t){let e=ir();return jsxRuntime.jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsxRuntime.jsx(I,{...t,type:"submit",disabled:r})})}function Ke(){let t=ir();return jsxRuntime.jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsxRuntime.jsx("div",{className:"fui-form__error",children:e.onSubmit}):null})}var m=reactForm.createFormHook({fieldComponents:{Input:Qe},formComponents:{SubmitButton:Ye,ErrorMessage:Ke,Action:Je},fieldContext:We,formContext:ze});function ar(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function ur(t){let e=tr(),r=ar();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmit:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function mr(t){let e=s();react.useEffect(()=>{(async()=>{let o=await uiCore.completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[e,t]);}function Ct({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=react.useState(false),i=ur(()=>{n(!0),t?.();});return mr(e),o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","signInLinkSent")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(b,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","sendSignInLink")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function lr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendPasswordResetEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function pr(t){let e=jt(),r=lr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmit:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function It({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=react.useState(false),i=pr(()=>{n(!0),e?.();});return o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","checkEmailForReset")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(b,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","resetPassword")}),jsxRuntime.jsx(i.ErrorMessage,{})]}),t?jsxRuntime.jsx(i.Action,{onClick:t,children:uiCore.getTranslation(r,"labels","backToSignIn")}):null]})})}function dr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().allowedCountries}function hr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().defaultCountry}var W=react.forwardRef(({className:t,...e},r)=>{let o=dr(),n=hr(),[i,a]=react.useState(n),N=react.useCallback(y=>{let T=o.find(gt=>gt.code===y);a(T);},[o]);return react.useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:N}),[i,N]),jsxRuntime.jsx("div",{className:u("fui-country-selector",t),...e,children:jsxRuntime.jsxs("div",{className:"fui-country-selector__wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxRuntime.jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsxRuntime.jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:y=>{let T=o.find(gt=>gt.code===y.target.value);T&&a(T);},children:o.map(y=>jsxRuntime.jsxs("option",{value:y.code,children:[y.dialCode," (",y.name,")"]},`${y.code}-${y.dialCode}`))})]})]})})});W.displayName="CountrySelector";function yr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,e,r),[t])}function br({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=yr(),n=rr();return m.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmit:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,N=await o({phoneNumber:a,recaptchaVerifier:t});return e(N)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function So(t){let e=s(),r=react.useRef(null),o=O(r),n=react.useRef(null),i=br({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(W,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsx(b,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function vr(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>await uiCore.confirmPhoneNumber(t,e,r),[t])}function Ar({verificationId:t,onSuccess:e}){let r=er(),o=vr();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onSubmit:r,onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function go(t){let e=s(),r=Ar({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function wt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(go,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsxRuntime.jsx(So,{onSubmit:r})}function Pr(){let t=s();return react.useCallback(async({email:e,password:r})=>{try{return await uiCore.signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof uiCore.FirebaseUIError?new Error(o.message):(console.error(o),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Cr(t){let e=Xt(),r=Pr();return m.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmit:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Et({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=Cr(t);return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","password"),type:"password",action:e?jsxRuntime.jsx(n.Action,{onClick:e,children:uiCore.getTranslation(o,"labels","forgotPassword")}):null})})}),jsxRuntime.jsx(b,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(o,"labels","signIn")}),jsxRuntime.jsx(n.ErrorMessage,{})]}),r?jsxRuntime.jsxs(n.Action,{onClick:r,children:[uiCore.getTranslation(o,"prompts","noAccount")," ",uiCore.getTranslation(o,"labels","signUp")]}):null]})})}function Tt(){let t=s();return uiCore.hasBehavior(t,"requireDisplayName")}function Ir(){let t=s();return react.useCallback(async({email:e,password:r,displayName:o})=>{try{return await uiCore.createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof uiCore.FirebaseUIError?new Error(n.message):(console.error(n),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function xr(t){let e=Zt(),r=Ir(),o=Tt();return m.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmit:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Vt({onBackToSignInClick:t,onSignUp:e}){let r=s(),o=xr(e),n=Tt();return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxRuntime.jsxs(o.AppForm,{children:[n?jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"displayName",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","displayName")})})}):null,jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","password"),type:"password"})})}),jsxRuntime.jsx(b,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(o.SubmitButton,{children:uiCore.getTranslation(r,"labels","createAccount")}),jsxRuntime.jsx(o.ErrorMessage,{})]}),t?jsxRuntime.jsxs(o.Action,{onClick:t,children:[uiCore.getTranslation(r,"prompts","haveAccount")," ",uiCore.getTranslation(r,"labels","signIn")]}):null]})})}function M({className:t,children:e,...r}){return e?jsxRuntime.jsxs("div",{className:u("fui-divider",t),...r,children:[jsxRuntime.jsx("div",{className:"fui-divider__line"}),jsxRuntime.jsx("div",{className:"fui-divider__text",children:e}),jsxRuntime.jsx("div",{className:"fui-divider__line"})]}):jsxRuntime.jsx("div",{className:u("fui-divider",t),...r,children:jsxRuntime.jsx("div",{className:"fui-divider__line"})})}function f({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card",e),...r,children:t})}function d({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__header",e),...r,children:t})}function h({children:t,className:e,...r}){return jsxRuntime.jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function F({children:t,className:e,...r}){return jsxRuntime.jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function S({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__content",e),...r,children:t})}function w(){let t=Kt();return t?jsxRuntime.jsx("div",{className:"fui-form__error",children:t}):null}function No({children:t,onEmailSent:e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:o}),jsxRuntime.jsx(F,{children:n})]}),jsxRuntime.jsxs(S,{children:[jsxRuntime.jsx(Ct,{onEmailSent:e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(M,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(w,{})]})]}):null]})]})})}function Mo(t){let e=s(),r=uiCore.getTranslation(e,"labels","resetPassword"),o=uiCore.getTranslation(e,"prompts","enterEmailToReset");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:r}),jsxRuntime.jsx(F,{children:o})]}),jsxRuntime.jsx(S,{children:jsxRuntime.jsx(It,{...t})})]})})}function Tr(){let t=s();return react.useCallback(async({verificationCode:e,hint:r})=>{let o=auth.TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await uiCore.signInWithMultiFactorAssertion(t,o)},[t])}function ko({hint:t,onSuccess:e}){let r=Tr(),o=at();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onSubmit:o,onBlur:o,onSubmitAsync:async({value:n})=>{try{return await r({verificationCode:n.verificationCode,hint:t}),e()}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Bt(t){let e=s(),r=ko({hint:t.hint,onSuccess:()=>{t.onSuccess?.();}});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Br(){let t=s();return react.useCallback(async({hint:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,"",r,void 0,e),[t])}function Oo({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=Br(),n=it();return m.useAppForm({defaultValues:{phoneNumber:t.phoneNumber||""},validators:{onBlur:n,onSubmit:n,onSubmitAsync:async()=>{try{let i=await o({hint:t,recaptchaVerifier:e});return r(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Wo(t){let e=s(),r=react.useRef(null),o=O(r),n=Oo({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"phoneNumber",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",disabled:true,value:t.hint.phoneNumber||""})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(n.ErrorMessage,{})]})]})})}function kr(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>{let o=auth.PhoneAuthProvider.credential(e,r),n=auth.PhoneMultiFactorGenerator.assertion(o);return await uiCore.signInWithMultiFactorAssertion(t,n)},[t])}function qo({verificationId:t,onSuccess:e}){let r=kr(),o=st();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onSubmit:o,onBlur:o,onSubmitAsync:async({value:n})=>{try{return await r(n),e()}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function zo(t){let e=s(),r=qo({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function kt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(zo,{verificationId:e.verificationId,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(Wo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function U(){let e=s().multiFactorResolver;if(!e)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[r,o]=react.useState(e.hints.length===1?e.hints[0]:void 0);if(r){if(r.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(kt,{hint:r});if(r.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(Bt,{hint:r})}return jsxRuntime.jsxs("div",{className:"fui-content",children:[jsxRuntime.jsx("p",{children:"TODO: Select a multi-factor authentication method"}),e.hints.map(n=>n.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(Qo,{onClick:()=>o(n)},n.factorId):n.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(Jo,{onClick:()=>o(n)},n.factorId):null)]})}function Qo(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(I,{...t,children:r})}function Jo(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(I,{...t,children:r})}function Ko({children:t}){let e=s(),r=uiCore.getTranslation(e,"labels","signIn"),o=uiCore.getTranslation(e,"prompts","signInToAccount"),n=e.multiFactorResolver;return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:r}),jsxRuntime.jsx(F,{children:o})]}),jsxRuntime.jsx(S,{className:"fui-screen__children",children:n?jsxRuntime.jsx(U,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t,jsxRuntime.jsx(w,{}),jsxRuntime.jsx(b,{})]})})]})})}function Zo({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:o}),jsxRuntime.jsx(F,{children:n})]}),jsxRuntime.jsx(S,{children:i?jsxRuntime.jsx(U,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wt,{...e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(M,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(w,{})]})]}):null]})})]})})}function jo({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:o}),jsxRuntime.jsx(F,{children:n})]}),jsxRuntime.jsx(S,{children:i?jsxRuntime.jsx(U,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Et,{...e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(M,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(w,{})]})]}):null]})})]})})}function tn({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signUp"),n=uiCore.getTranslation(r,"prompts","enterDetailsToCreate"),i=r.multiFactorResolver;return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:o}),jsxRuntime.jsx(F,{children:n})]}),jsxRuntime.jsx(S,{children:i?jsxRuntime.jsx(U,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Vt,{...e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(M,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(w,{})]})]}):null]})})]})})}function qr(t){let e=s(),[r,o]=react.useState(null),n=react.useCallback(async()=>{o(null);try{await uiCore.signInWithProvider(e,t);}catch(i){if(i instanceof uiCore.FirebaseUIError){o(i.message);return}console.error(i),o(uiCore.getTranslation(e,"errors","unknownError"));}},[e,t,o]);return {error:r,callback:n}}function A({provider:t,children:e,themed:r}){let o=s(),{error:n,callback:i}=qr(t);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(I,{type:"button","data-themed":r,"data-provider":t.providerId,disabled:o.state!=="idle",onClick:i,className:"fui-provider__button",children:e}),n&&jsxRuntime.jsx("div",{className:"fui-form__error",children:n})]})}var un=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),$r=un;function ln({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.OAuthProvider("apple.com"),themed:e,children:[jsxRuntime.jsx(Qr,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithApple")})]})}function Qr({className:t,...e}){return jsxRuntime.jsx($r,{className:u("fui-provider__icon",t),...e})}var fn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Yr=fn;function Fn({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.FacebookAuthProvider,themed:e,children:[jsxRuntime.jsx(Kr,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithFacebook")})]})}function Kr({className:t,...e}){return jsxRuntime.jsx(Yr,{className:u("fui-provider__icon",t),...e})}var gn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),Zr=gn;function vn({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.GithubAuthProvider,themed:e,children:[jsxRuntime.jsx(jr,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGitHub")})]})}function jr({className:t,...e}){return jsxRuntime.jsx(Zr,{className:u("fui-provider__icon",t),...e})}var Pn=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsxRuntime.jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsxRuntime.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsxRuntime.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),te=Pn;function wn({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.GoogleAuthProvider,themed:e,children:[jsxRuntime.jsx(re,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGoogle")})]})}function re({className:t,...e}){return jsxRuntime.jsx(te,{className:u("fui-provider__icon",t),...e})}var En=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsxRuntime.jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsxRuntime.jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsxRuntime.jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),ee=En;function Un({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.OAuthProvider("microsoft.com"),themed:e,children:[jsxRuntime.jsx(oe,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithMicrosoft")})]})}function oe({className:t,...e}){return jsxRuntime.jsx(ee,{className:u("fui-provider__icon",t),...e})}var kn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),ie=kn;function Ln({provider:t,themed:e}){let r=s();return jsxRuntime.jsxs(A,{provider:t||new auth.TwitterAuthProvider,themed:e,children:[jsxRuntime.jsx(se,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithTwitter")})]})}function se({className:t,...e}){return jsxRuntime.jsx(ie,{className:u("fui-provider__icon",t),...e})}function Qn(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=auth.multiFactor(t.auth.currentUser);return await uiCore.verifyPhoneNumber(t,e,r,o)},[t])}function Jn({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Qn(),n=it();return m.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmit:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,N=await o({phoneNumber:a,recaptchaVerifier:t});return e(N,i.displayName)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Yn(t){let e=s(),r=react.useRef(null),o=O(r),n=react.useRef(null),i=Jn({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"displayName",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(W,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function Kn(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=auth.PhoneAuthProvider.credential(e,r),i=auth.PhoneMultiFactorGenerator.assertion(n);return await uiCore.enrollWithMultiFactorAssertion(t,i,o)},[t])}function Xn({verificationId:t,displayName:e,onSuccess:r}){let o=st(),n=Kn();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onSubmit:o,onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Zn(t){let e=s(),r=Xn({...t,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function ce(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Zn,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(Yn,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function ni(){let t=s();return react.useCallback(async()=>await uiCore.generateTotpSecret(t),[t])}function ii({onSuccess:t}){let e=ni(),r=or();return m.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmit:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function si(t){let e=s(),r=ii({onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"displayName",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","generateQrCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function ai(){let t=s();return react.useCallback(async({secret:e,verificationCode:r})=>{let o=auth.TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await uiCore.enrollWithMultiFactorAssertion(t,o,r)},[t])}function ui({secret:t,displayName:e,onSuccess:r}){let o=at(),n=ai();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onSubmit:o,onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function mi(t){let e=s(),r=ui({...t,onSuccess:t.onSuccess}),o=uiCore.generateTotpQrCode(e,t.secret,t.displayName);return jsxRuntime.jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxRuntime.jsxs("div",{className:"fui-qr-code-container",children:[jsxRuntime.jsx("img",{src:o,alt:"TOTP QR Code"}),jsxRuntime.jsx("p",{children:"TODO: Scan this QR code with your authenticator app"})]}),jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:n=>jsxRuntime.jsx(n.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})]})}function fe(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(mi,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(si,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var li=[auth.FactorId.TOTP,auth.FactorId.PHONE];function $t(t){let e=t.hints??li;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=react.useState(e.length===1?e[0]:void 0);if(r){if(r===auth.FactorId.TOTP)return jsxRuntime.jsx(fe,{onSuccess:t.onEnrollment});if(r===auth.FactorId.PHONE)return jsxRuntime.jsx(ce,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsxRuntime.jsx("div",{className:"fui-content",children:e.map(n=>n===auth.FactorId.TOTP?jsxRuntime.jsx(pi,{onClick:()=>o(n)},n):n===auth.FactorId.PHONE?jsxRuntime.jsx(fi,{onClick:()=>o(n)},n):null)})}function pi(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(I,{...t,children:r})}function fi(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(I,{...t,children:r})}function di(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorEnrollment"),o=uiCore.getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(f,{children:[jsxRuntime.jsxs(d,{children:[jsxRuntime.jsx(h,{children:r}),jsxRuntime.jsx(F,{children:o})]}),jsxRuntime.jsx(S,{children:jsxRuntime.jsx($t,{...t})})]})})}undefined.PROD&&uiCore.registerFramework("react",Qt.version);
2
- exports.AppleLogo=Qr;exports.AppleSignInButton=ln;exports.Button=I;exports.Card=f;exports.CardContent=S;exports.CardHeader=d;exports.CardSubtitle=F;exports.CardTitle=h;exports.CountrySelector=W;exports.Divider=M;exports.EmailLinkAuthForm=Ct;exports.EmailLinkAuthScreen=No;exports.FacebookLogo=Kr;exports.FacebookSignInButton=Fn;exports.FirebaseUIProvider=be;exports.ForgotPasswordAuthForm=It;exports.ForgotPasswordAuthScreen=Mo;exports.GitHubLogo=jr;exports.GitHubSignInButton=vn;exports.GoogleLogo=re;exports.GoogleSignInButton=wn;exports.MicrosoftLogo=oe;exports.MicrosoftSignInButton=Un;exports.MultiFactorAuthEnrollmentForm=$t;exports.MultiFactorAuthEnrollmentScreen=di;exports.OAuthButton=A;exports.OAuthScreen=Ko;exports.PhoneAuthForm=wt;exports.PhoneAuthScreen=Zo;exports.Policies=b;exports.PolicyContext=At;exports.SignInAuthForm=Et;exports.SignInAuthScreen=jo;exports.SignUpAuthForm=Vt;exports.SignUpAuthScreen=tn;exports.SmsMultiFactorAssertionForm=kt;exports.TotpMultiFactorAssertionForm=Bt;exports.TwitterLogo=se;exports.TwitterSignInButton=Ln;exports.form=m;exports.useCountries=dr;exports.useDefaultCountry=hr;exports.useEmailLinkAuthForm=ur;exports.useEmailLinkAuthFormAction=ar;exports.useEmailLinkAuthFormCompleteSignIn=mr;exports.useEmailLinkAuthFormSchema=tr;exports.useForgotPasswordAuthForm=pr;exports.useForgotPasswordAuthFormAction=lr;exports.useForgotPasswordAuthFormSchema=jt;exports.useMultiFactorPhoneAuthNumberFormSchema=it;exports.useMultiFactorPhoneAuthVerifyFormSchema=st;exports.useMultiFactorTotpAuthNumberFormSchema=or;exports.useMultiFactorTotpAuthVerifyFormSchema=at;exports.usePhoneAuthNumberFormSchema=rr;exports.usePhoneAuthVerifyFormSchema=er;exports.usePhoneNumberForm=br;exports.usePhoneNumberFormAction=yr;exports.useRecaptchaVerifier=O;exports.useRedirectError=Kt;exports.useRequireDisplayName=Tt;exports.useSignInAuthForm=Cr;exports.useSignInAuthFormAction=Pr;exports.useSignInAuthFormSchema=Xt;exports.useSignInWithProvider=qr;exports.useSignUpAuthForm=xr;exports.useSignUpAuthFormAction=Ir;exports.useSignUpAuthFormSchema=Zt;exports.useSmsMultiFactorAssertionPhoneFormAction=Br;exports.useSmsMultiFactorAssertionVerifyFormAction=kr;exports.useTotpMultiFactorAssertionFormAction=Tr;exports.useUI=s;exports.useVerifyPhoneNumberForm=Ar;exports.useVerifyPhoneNumberFormAction=vr;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var uiCore=require('@firebase-oss/ui-core'),react=require('react'),react$1=require('@nanostores/react'),jsxRuntime=require('react/jsx-runtime'),reactForm=require('@tanstack/react-form'),reactSlot=require('@radix-ui/react-slot'),uiStyles=require('@firebase-oss/ui-styles'),tailwindMerge=require('tailwind-merge'),clsx=require('clsx'),auth=require('firebase/auth');var tr={version:"0.0.2"};var vt=react.createContext(void 0);function er({children:t,policies:e}){return jsxRuntime.jsx(vt.Provider,{value:e,children:t})}function A(){let t=s(),e=react.useContext(vt);if(!e)return null;let{termsOfServiceUrl:r,privacyPolicyUrl:o,onNavigate:n}=e,a=uiCore.getTranslation(t,"messages","termsAndPrivacy").split(/(\{tos\}|\{privacy\})/),C=n?jsxRuntime.jsx("button",{}):jsxRuntime.jsx("a",{target:"_blank",rel:"noopener noreferrer"});return jsxRuntime.jsx("div",{className:"fui-policies",children:a.map((y,T)=>y==="{tos}"?react.cloneElement(C,{key:T,onClick:n?()=>n(r):void 0,href:n?void 0:r,children:uiCore.getTranslation(t,"labels","termsOfService")}):y==="{privacy}"?react.cloneElement(C,{key:T,onClick:n?()=>n(o):void 0,href:n?void 0:o,children:uiCore.getTranslation(t,"labels","privacyPolicy")}):jsxRuntime.jsx("span",{children:y},T))})}var Pt=react.createContext(null);function Ge({children:t,ui:e,policies:r}){let o=react$1.useStore(e);return jsxRuntime.jsx(Pt.Provider,{value:o,children:jsxRuntime.jsx(er,{policies:r,children:t})})}function s(){let t=react.useContext(Pt);if(!t)throw new Error(`No FirebaseUI context found. Your application must be wrapped in a FirebaseUIProvider:
2
+
3
+ const ui = initializeUI(...);
4
+
5
+ <FirebaseUIProvider ui={ui}>
6
+ <App />
7
+ </FirebaseUIProvider>
8
+ `);return t}function N(t){let r=s().auth;react.useEffect(()=>r.onAuthStateChanged(o=>{o&&!o.isAnonymous&&t?.(o);}),[r,t]);}function ir(){let t=s();return react.useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function sr(){let t=s();return react.useMemo(()=>uiCore.createSignInAuthFormSchema(t),[t])}function ar(){let t=s();return react.useMemo(()=>uiCore.createSignUpAuthFormSchema(t),[t])}function ur(){let t=s();return react.useMemo(()=>uiCore.createForgotPasswordAuthFormSchema(t),[t])}function cr(){let t=s();return react.useMemo(()=>uiCore.createEmailLinkAuthFormSchema(t),[t])}function mr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthNumberFormSchema(t),[t])}function lr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthVerifyFormSchema(t),[t])}function pr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function mt(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function fr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthNumberFormSchema(t),[t])}function lt(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function W(t){let e=s(),r=react.useRef(null),o=react.useRef(e),n=react.useRef(null);return o.current=e,react.useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=uiCore.getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}function u(...t){return tailwindMerge.twMerge(clsx.clsx(...t))}function x({className:t,variant:e="primary",asChild:r,...o}){return jsxRuntime.jsx(r?reactSlot.Slot:"button",{className:u(uiStyles.buttonVariant({variant:e}),t),...o})}var{fieldContext:oo,useFieldContext:no,formContext:io,useFormContext:dr}=reactForm.createFormHookContexts();function so({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsxRuntime.jsx("div",{children:jsxRuntime.jsx("div",{role:"alert","aria-live":"polite",className:u("fui-error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function ao({children:t,before:e,label:r,action:o,description:n,...i}){let a=no();return jsxRuntime.jsxs("label",{htmlFor:a.name,children:[jsxRuntime.jsxs("div",{"data-input-label":true,children:[jsxRuntime.jsx("div",{children:r}),o?jsxRuntime.jsx("div",{children:o}):null]}),n?jsxRuntime.jsx("div",{"data-input-description":true,children:n}):null,jsxRuntime.jsxs("div",{"data-input-group":true,children:[e,jsxRuntime.jsx("input",{...i,"aria-invalid":a.state.meta.isTouched&&a.state.meta.errors.length>0,id:a.name,name:a.name,value:a.state.value,onBlur:()=>{a.handleBlur();},onChange:C=>{a.handleChange(C.target.value);}})]}),t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):null,jsxRuntime.jsx(so,{field:a})]})}function uo({className:t,...e}){return jsxRuntime.jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function co(t){let e=dr();return jsxRuntime.jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsxRuntime.jsx(x,{...t,type:"submit",disabled:r})})}function mo(){let t=dr();return jsxRuntime.jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsxRuntime.jsx("div",{className:"fui-error",children:e.onSubmit}):null})}var c=reactForm.createFormHook({fieldComponents:{Input:ao},formComponents:{SubmitButton:co,ErrorMessage:mo,Action:uo},fieldContext:oo,formContext:io});function Fr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Sr(t){let e=cr(),r=Fr();return c.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function gr(t){let e=s();react.useEffect(()=>{(async()=>{let o=await uiCore.completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[t]);}function It({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=react.useState(false),i=Sr(()=>{n(!0),t?.();});return gr(e),o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","signInLinkSent")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","sendSignInLink")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function yr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendPasswordResetEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Ar(t){let e=ur(),r=yr();return c.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Mt({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=react.useState(false),i=Ar(()=>{n(!0),e?.();});return o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","checkEmailForReset")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","resetPassword")}),jsxRuntime.jsx(i.ErrorMessage,{})]}),t?jsxRuntime.jsxs(i.Action,{onClick:t,children:["\u2190 ",uiCore.getTranslation(r,"labels","backToSignIn")]}):null]})})}function Pr(){let t=s();return react.useCallback(async({verificationCode:e,hint:r})=>{let o=auth.TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await uiCore.signInWithMultiFactorAssertion(t,o)},[t])}function br({hint:t,onSuccess:e}){let r=Pr(),o=lt();return c.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r({verificationCode:n.verificationCode,hint:t});return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function wt(t){let e=s(),r=br({hint:t.hint,onSuccess:o=>{t.onSuccess?.(o);}});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","enterVerificationCode"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function xr(){let t=s();return react.useCallback(async({hint:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,"",r,void 0,e),[t])}function Vo({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=xr();return c.useAppForm({validators:{onSubmitAsync:async()=>{try{let n=await o({hint:t,recaptchaVerifier:e});return r(n)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function Bo(t){let e=s(),r=react.useRef(null),o=W(r),n=Vo({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("label",{children:jsxRuntime.jsx("div",{"data-input-description":true,children:uiCore.getTranslation(e,"messages","mfaSmsAssertionPrompt",{phoneNumber:t.hint.phoneNumber||""})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(n.ErrorMessage,{})]})]})})}function Mr(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>{let o=auth.PhoneAuthProvider.credential(e,r),n=auth.PhoneMultiFactorGenerator.assertion(o);return await uiCore.signInWithMultiFactorAssertion(t,n)},[t])}function ko({verificationId:t,onSuccess:e}){let r=Mr(),o=mt();return c.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Ro(t){let e=s(),r=ko({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Nt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(Ro,{verificationId:e.verificationId,onSuccess:o=>{t.onSuccess?.(o);}}):jsxRuntime.jsx(Bo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function Nr(){let t=s();react.useEffect(()=>()=>{t.setMultiFactorResolver();},[]);}function Tt(t){let e=s(),r=e.multiFactorResolver,o=uiCore.getTranslation(e,"prompts","mfaAssertionFactorPrompt");if(Nr(),!r)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[n,i]=react.useState(r.hints.length===1?r.hints[0]:void 0);if(n){if(n.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(Nt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}});if(n.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(wt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}})}return jsxRuntime.jsxs("div",{className:"fui-content",children:[jsxRuntime.jsx("p",{children:o}),r.hints.map(a=>a.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(_o,{onClick:()=>i(a)},a.factorId):a.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(Do,{onClick:()=>i(a)},a.factorId):null)]})}function _o(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{...t,children:r})}function Do(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{...t,children:r})}function Tr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().allowedCountries}function Vr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().defaultCountry}var q=react.forwardRef(({className:t,...e},r)=>{let o=Tr(),n=Vr(),[i,a]=react.useState(n),C=react.useCallback(y=>{let T=o.find(yt=>yt.code===y);a(T);},[o]);return react.useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:C}),[i,C]),jsxRuntime.jsx("div",{className:u("fui-country-selector",t),...e,children:jsxRuntime.jsxs("div",{className:"fui-country-selector__wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxRuntime.jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsxRuntime.jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:y=>{let T=o.find(yt=>yt.code===y.target.value);T&&a(T);},children:o.map(y=>jsxRuntime.jsxs("option",{value:y.code,children:[y.dialCode," (",y.name,")"]},`${y.code}-${y.dialCode}`))})]})]})})});q.displayName="CountrySelector";function Gr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=auth.multiFactor(t.auth.currentUser);return await uiCore.verifyPhoneNumber(t,e,r,o)},[t])}function Lr({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Gr(),n=pr();return c.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C,i.displayName)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function jo(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=Lr({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"displayName",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(q,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function _r(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=auth.PhoneAuthProvider.credential(e,r),i=auth.PhoneMultiFactorGenerator.assertion(n);return await uiCore.enrollWithMultiFactorAssertion(t,i,o)},[t])}function Dr({verificationId:t,displayName:e,onSuccess:r}){let o=mt(),n=_r();return c.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Or(t){let e=s(),r=Dr({...t,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Bt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Or,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(jo,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function zr(){let t=s();return react.useCallback(async()=>await uiCore.generateTotpSecret(t),[t])}function qr({onSuccess:t}){let e=zr(),r=fr();return c.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function sn(t){let e=s(),r=qr({onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"displayName",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","generateQrCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function $r(){let t=s();return react.useCallback(async({secret:e,verificationCode:r,displayName:o})=>{let n=auth.TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await uiCore.enrollWithMultiFactorAssertion(t,n,o)},[t])}function Qr({secret:t,displayName:e,onSuccess:r}){let o=lt(),n=$r();return c.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Jr(t){let e=s(),r=Qr({...t,onSuccess:t.onSuccess}),o=uiCore.generateTotpQrCode(e,t.secret,t.displayName);return jsxRuntime.jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxRuntime.jsxs("div",{className:"fui-qr-code-container",children:[jsxRuntime.jsx("img",{src:o,alt:"TOTP QR Code"}),jsxRuntime.jsx("code",{children:t.secret.secretKey.toString()}),jsxRuntime.jsx("p",{children:uiCore.getTranslation(e,"prompts","mfaTotpQrCodePrompt")})]}),jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:n=>jsxRuntime.jsx(n.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","mfaTotpEnrollmentVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})]})}function kt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Jr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(sn,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var un=[auth.FactorId.TOTP,auth.FactorId.PHONE];function Rt(t){let e=t.hints??un;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=react.useState(e.length===1?e[0]:void 0);if(r){if(r===auth.FactorId.TOTP)return jsxRuntime.jsx(kt,{onSuccess:t.onEnrollment});if(r===auth.FactorId.PHONE)return jsxRuntime.jsx(Bt,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsxRuntime.jsx("div",{className:"fui-content",children:e.map(n=>n===auth.FactorId.TOTP?jsxRuntime.jsx(cn,{onClick:()=>o(n)},n):n===auth.FactorId.PHONE?jsxRuntime.jsx(mn,{onClick:()=>o(n)},n):null)})}function cn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function mn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function jr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,e,r),[t])}function te({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=jr(),n=mr();return c.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function hn(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=te({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(q,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function re(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>await uiCore.confirmPhoneNumber(t,e,r),[t])}function ee({verificationId:t,onSuccess:e}){let r=lr(),o=re();return c.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Fn(t){let e=s(),r=ee({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Gt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(Fn,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsxRuntime.jsx(hn,{onSubmit:r})}function oe(){let t=s();return react.useCallback(async({email:e,password:r})=>{try{return await uiCore.signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof uiCore.FirebaseUIError?new Error(o.message):(console.error(o),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function ne(t){let e=sr(),r=oe();return c.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function _t({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=ne(t);return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","password"),type:"password",action:e?jsxRuntime.jsx(n.Action,{onClick:e,children:uiCore.getTranslation(o,"labels","forgotPassword")}):null})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(o,"labels","signIn")}),jsxRuntime.jsx(n.ErrorMessage,{})]}),r?jsxRuntime.jsxs(n.Action,{onClick:r,children:[uiCore.getTranslation(o,"prompts","noAccount")," ",uiCore.getTranslation(o,"labels","signUp")]}):null]})})}function Ot(){let t=s();return uiCore.hasBehavior(t,"requireDisplayName")}function ie(){let t=s();return react.useCallback(async({email:e,password:r,displayName:o})=>{try{return await uiCore.createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof uiCore.FirebaseUIError?new Error(n.message):(console.error(n),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function se(t){let e=ar(),r=ie(),o=Ot();return c.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Ht({onSignInClick:t,onSignUp:e}){let r=s(),o=se(e),n=Ot();return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxRuntime.jsxs(o.AppForm,{children:[n?jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"displayName",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","displayName")})})}):null,jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","password"),type:"password"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(o.SubmitButton,{children:uiCore.getTranslation(r,"labels","createAccount")}),jsxRuntime.jsx(o.ErrorMessage,{})]}),t?jsxRuntime.jsxs(o.Action,{onClick:t,children:[uiCore.getTranslation(r,"prompts","haveAccount")," ",uiCore.getTranslation(r,"labels","signIn")]}):null]})})}function U({className:t,children:e,...r}){return e?jsxRuntime.jsxs("div",{className:u("fui-divider",t),...r,children:[jsxRuntime.jsx("div",{className:"fui-divider__line"}),jsxRuntime.jsx("div",{className:"fui-divider__text",children:e}),jsxRuntime.jsx("div",{className:"fui-divider__line"})]}):jsxRuntime.jsx("div",{className:u("fui-divider",t),...r,children:jsxRuntime.jsx("div",{className:"fui-divider__line"})})}function p({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card",e),...r,children:t})}function f({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__header",e),...r,children:t})}function d({children:t,className:e,...r}){return jsxRuntime.jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function h({children:t,className:e,...r}){return jsxRuntime.jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function F({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__content",e),...r,children:t})}function E(){let t=ir();return t?jsxRuntime.jsx("div",{className:"fui-error",children:t}):null}function w(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorAssertion"),o=uiCore.getTranslation(e,"prompts","mfaAssertionPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Tt,{...t})})]})})}function xn({children:t,onEmailSent:e,onSignIn:r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount"),a=o.multiFactorResolver;return N(r),a?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(It,{onEmailSent:e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function En(t){let e=s(),r=uiCore.getTranslation(e,"labels","resetPassword"),o=uiCore.getTranslation(e,"prompts","enterEmailToReset");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Mt,{...t})})]})})}function wn(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorEnrollment"),o=uiCore.getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Rt,{...t})})]})})}function Nn({children:t,onSignIn:e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{}),jsxRuntime.jsx(A,{})]})]})})}function Un({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e.onSignIn),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Gt,{}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function Vn({children:t,onSignIn:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(_t,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function kn({children:t,onSignUp:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signUp"),i=uiCore.getTranslation(o,"prompts","enterDetailsToCreate");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Ht,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function he(t,e){let r=s(),[o,n]=react.useState(null),i=react.useCallback(async()=>{n(null);try{let a=await uiCore.signInWithProvider(r,t);e?.(a);}catch(a){if(a instanceof uiCore.FirebaseUIError){n(a.message);return}console.error(a),n(uiCore.getTranslation(r,"errors","unknownError"));}},[r,t,n,e]);return {error:o,callback:i}}function b({provider:t,children:e,themed:r,onSignIn:o}){let n=s(),{error:i,callback:a}=he(t,o);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(x,{type:"button",variant:r?"primary":"secondary","data-themed":r,"data-provider":t.providerId,disabled:n.state!=="idle",onClick:a,className:"fui-provider__button",children:e}),i&&jsxRuntime.jsx("div",{className:"fui-error",children:i})]})}var Wn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),Se=Wn;function $n({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.OAuthProvider("apple.com"),children:[jsxRuntime.jsx(ge,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithApple")})]})}function ge({className:t,...e}){return jsxRuntime.jsx(Se,{className:u("fui-provider__icon",t),...e})}var Jn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Ae=Jn;function Xn({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.FacebookAuthProvider,children:[jsxRuntime.jsx(ve,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithFacebook")})]})}function ve({className:t,...e}){return jsxRuntime.jsx(Ae,{className:u("fui-provider__icon",t),...e})}var jn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),be=jn;function ei({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.GithubAuthProvider,children:[jsxRuntime.jsx(Ce,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGitHub")})]})}function Ce({className:t,...e}){return jsxRuntime.jsx(be,{className:u("fui-provider__icon",t),...e})}var ni=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsxRuntime.jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsxRuntime.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsxRuntime.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),Ie=ni;function ui({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.GoogleAuthProvider,children:[jsxRuntime.jsx(xe,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGoogle")})]})}function xe({className:t,...e}){return jsxRuntime.jsx(Ie,{className:u("fui-provider__icon",t),...e})}var mi=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsxRuntime.jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsxRuntime.jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsxRuntime.jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),Me=mi;function di({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.OAuthProvider("microsoft.com"),children:[jsxRuntime.jsx(Ee,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithMicrosoft")})]})}function Ee({className:t,...e}){return jsxRuntime.jsx(Me,{className:u("fui-provider__icon",t),...e})}var Fi=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),Ne=Fi;function yi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.TwitterAuthProvider,children:[jsxRuntime.jsx(Ue,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithTwitter")})]})}function Ue({className:t,...e}){return jsxRuntime.jsx(Ne,{className:u("fui-provider__icon",t),...e})}uiCore.registerFramework("react",tr.version);
9
+ exports.AppleLogo=ge;exports.AppleSignInButton=$n;exports.Button=x;exports.Card=p;exports.CardContent=F;exports.CardHeader=f;exports.CardSubtitle=h;exports.CardTitle=d;exports.CountrySelector=q;exports.Divider=U;exports.EmailLinkAuthForm=It;exports.EmailLinkAuthScreen=xn;exports.FacebookLogo=ve;exports.FacebookSignInButton=Xn;exports.FirebaseUIProvider=Ge;exports.ForgotPasswordAuthForm=Mt;exports.ForgotPasswordAuthScreen=En;exports.GitHubLogo=Ce;exports.GitHubSignInButton=ei;exports.GoogleLogo=xe;exports.GoogleSignInButton=ui;exports.MicrosoftLogo=Ee;exports.MicrosoftSignInButton=di;exports.MultiFactorAuthAssertionForm=Tt;exports.MultiFactorAuthAssertionScreen=w;exports.MultiFactorAuthEnrollmentForm=Rt;exports.MultiFactorAuthEnrollmentScreen=wn;exports.MultiFactorEnrollmentVerifyPhoneNumberForm=Or;exports.MultiFactorEnrollmentVerifyTotpForm=Jr;exports.OAuthButton=b;exports.OAuthScreen=Nn;exports.PhoneAuthForm=Gt;exports.PhoneAuthScreen=Un;exports.Policies=A;exports.PolicyContext=vt;exports.RedirectError=E;exports.SignInAuthForm=_t;exports.SignInAuthScreen=Vn;exports.SignUpAuthForm=Ht;exports.SignUpAuthScreen=kn;exports.SmsMultiFactorAssertionForm=Nt;exports.SmsMultiFactorEnrollmentForm=Bt;exports.TotpMultiFactorAssertionForm=wt;exports.TotpMultiFactorEnrollmentForm=kt;exports.TwitterLogo=Ue;exports.TwitterSignInButton=yi;exports.form=c;exports.useCountries=Tr;exports.useDefaultCountry=Vr;exports.useEmailLinkAuthForm=Sr;exports.useEmailLinkAuthFormAction=Fr;exports.useEmailLinkAuthFormCompleteSignIn=gr;exports.useEmailLinkAuthFormSchema=cr;exports.useForgotPasswordAuthForm=Ar;exports.useForgotPasswordAuthFormAction=yr;exports.useForgotPasswordAuthFormSchema=ur;exports.useMultiFactorAssertionCleanup=Nr;exports.useMultiFactorEnrollmentVerifyPhoneNumberForm=Dr;exports.useMultiFactorEnrollmentVerifyPhoneNumberFormAction=_r;exports.useMultiFactorEnrollmentVerifyTotpForm=Qr;exports.useMultiFactorEnrollmentVerifyTotpFormAction=$r;exports.useMultiFactorPhoneAuthNumberFormSchema=pr;exports.useMultiFactorPhoneAuthVerifyFormSchema=mt;exports.useMultiFactorTotpAuthNumberFormSchema=fr;exports.useMultiFactorTotpAuthVerifyFormSchema=lt;exports.useOnUserAuthenticated=N;exports.usePhoneAuthNumberFormSchema=mr;exports.usePhoneAuthVerifyFormSchema=lr;exports.usePhoneNumberForm=te;exports.usePhoneNumberFormAction=jr;exports.useRecaptchaVerifier=W;exports.useRedirectError=ir;exports.useRequireDisplayName=Ot;exports.useSignInAuthForm=ne;exports.useSignInAuthFormAction=oe;exports.useSignInAuthFormSchema=sr;exports.useSignInWithProvider=he;exports.useSignUpAuthForm=se;exports.useSignUpAuthFormAction=ie;exports.useSignUpAuthFormSchema=ar;exports.useSmsMultiFactorAssertionPhoneFormAction=xr;exports.useSmsMultiFactorAssertionVerifyFormAction=Mr;exports.useSmsMultiFactorEnrollmentPhoneAuthFormAction=Gr;exports.useSmsMultiFactorEnrollmentPhoneNumberForm=Lr;exports.useTotpMultiFactorAssertionForm=br;exports.useTotpMultiFactorAssertionFormAction=Pr;exports.useTotpMultiFactorSecretGenerationForm=qr;exports.useTotpMultiFactorSecretGenerationFormAction=zr;exports.useUI=s;exports.useVerifyPhoneNumberForm=ee;exports.useVerifyPhoneNumberFormAction=re;//# sourceMappingURL=index.cjs.map
3
10
  //# sourceMappingURL=index.cjs.map