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IAAI,QAAShB,GAAY,CAC9B,OAAO,sBAAsBA,CAAO,EACrC,CACH,EAEMpB,EAAO,IAAIqC,EAAK,cAAe,GAAMtC,EAAeuC,GAA+B,CAC5ExC,EAAAwC,EAEDf,EAAA,SAAS,gBAAgB,YAAY,YAAa,CAAC,EAAG,kBAAmB,SAAUe,CAAA,CAAU,CACzG,CAAC","names":["authCode","onFirstMount","page","LoginPage","avatarPreview","addIco","Icon","uploadAvatar","PopupElement","PopupAvatar","_uploadAvatar","handleInput","e","name","nameInputField","lastName","lastNameInputField","fullName","replaceContent","wrapEmojiText","i18n","sendAvatar","resolve","reject","inputFile","rootScope","InputField","btnSignUp","Button","btnI18n","I18n","params","preloader","putPreloader","response","__vitePreload","m","err","blurActiveElement","Page","_authCode"],"ignoreList":[],"sources":["../src/pages/pageSignUp.ts"],"sourcesContent":["/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nimport type {CancellablePromise} from '../helpers/cancellablePromise';\nimport type {InputFile} from '../layer';\nimport type {AuthState} from '../types';\nimport LoginPage from './loginPage';\nimport Page from './page';\nimport blurActiveElement from '../helpers/dom/blurActiveElement';\nimport rootScope from '../lib/rootScope';\nimport InputField from '../components/inputField';\nimport PopupElement from '../components/popups';\nimport PopupAvatar from '../components/popups/avatar';\nimport replaceContent from '../helpers/dom/replaceContent';\nimport I18n, {i18n} from '../lib/langPack';\nimport wrapEmojiText from '../lib/richTextProcessor/wrapEmojiText';\nimport Button from '../components/button';\nimport {putPreloader} from '../components/putPreloader';\nimport Icon from '../components/icon';\n\nlet authCode: AuthState.signUp['authCode'] = null;\n\nconst onFirstMount = async() => {\n const page = new LoginPage({\n className: 'page-signUp',\n withInputWrapper: true,\n titleLangKey: 'YourName',\n subtitleLangKey: 'Login.Register.Subtitle'\n });\n\n page.imageDiv.classList.add('avatar-edit');\n\n page.title.classList.add('fullName');\n\n const avatarPreview = document.createElement('canvas');\n avatarPreview.id = 'canvas-avatar';\n avatarPreview.className = 'avatar-edit-canvas';\n\n const addIco = Icon('cameraadd', 'avatar-edit-icon');\n page.imageDiv.append(avatarPreview, addIco);\n\n let uploadAvatar: () => CancellablePromise<InputFile>;\n page.imageDiv.addEventListener('click', () => {\n PopupElement.createPopup(PopupAvatar).open(avatarPreview, (_uploadAvatar) => {\n uploadAvatar = _uploadAvatar;\n });\n });\n\n const handleInput = (e: Event) => {\n const name = nameInputField.value || '';\n const lastName = lastNameInputField.value || '';\n\n const fullName = name || lastName ?\n (name + ' ' + lastName).trim() :\n '';\n\n if(fullName) replaceContent(page.title, wrapEmojiText(fullName));\n else replaceContent(page.title, i18n('YourName'));\n };\n\n const sendAvatar = () => new Promise<void>((resolve, reject) => {\n if(!uploadAvatar) {\n // console.log('User has not selected avatar');\n return resolve();\n }\n\n // console.log('invoking uploadFile...');\n uploadAvatar().then((inputFile) => {\n // console.log('uploaded smthn', inputFile);\n\n rootScope.managers.appProfileManager.uploadProfilePhoto(inputFile).then(resolve, reject);\n }, reject);\n });\n\n const nameInputField = new InputField({\n label: 'FirstName',\n maxLength: 70\n });\n\n const lastNameInputField = new InputField({\n label: 'LastName',\n maxLength: 64\n });\n\n const btnSignUp = Button('btn-primary btn-color-primary');\n const btnI18n = new I18n.IntlElement({key: 'StartMessaging'});\n btnSignUp.append(btnI18n.element);\n\n page.inputWrapper.append(nameInputField.container, lastNameInputField.container, btnSignUp);\n\n nameInputField.input.addEventListener('input', handleInput);\n lastNameInputField.input.addEventListener('input', handleInput);\n\n btnSignUp.addEventListener('click', function(this: typeof btnSignUp, e) {\n if(nameInputField.input.classList.contains('error') || lastNameInputField.input.classList.contains('error')) {\n return false;\n }\n\n if(!nameInputField.value.length) {\n nameInputField.input.classList.add('error');\n return false;\n }\n\n this.disabled = true;\n\n const name = nameInputField.value.trim();\n const lastName = lastNameInputField.value.trim();\n\n const params = {\n phone_number: authCode.phone_number,\n phone_code_hash: authCode.phone_code_hash,\n first_name: name,\n last_name: lastName\n };\n\n // console.log('invoking auth.signUp with params:', params);\n\n btnI18n.update({key: 'PleaseWait'});\n const preloader = putPreloader(this);\n\n rootScope.managers.apiManager.invokeApi('auth.signUp', params)\n .then(async(response) => {\n // console.log('auth.signUp response:', response);\n\n switch(response._) {\n case 'auth.authorization': // success\n await rootScope.managers.apiManager.setUser(response.user);\n\n sendAvatar().finally(() => {\n import('./pageIm').then((m) => {\n m.default.mount();\n });\n });\n\n break;\n default:\n btnI18n.update({key: response._ as any});\n this.removeAttribute('disabled');\n preloader.remove();\n break;\n }\n\n /* (document.body.getElementsByClassName('page-sign')[0] as HTMLDivElement).style.display = 'none';\n pageAuthCode(Object.assign(code, {phoneNumber})); */\n }).catch((err) => {\n this.removeAttribute('disabled');\n preloader.remove();\n\n switch(err.type) {\n default:\n btnI18n.update({key: err.type});\n break;\n }\n });\n });\n\n blurActiveElement();\n return new Promise((resolve) => {\n window.requestAnimationFrame(resolve);\n });\n};\n\nconst page = new Page('page-signUp', true, onFirstMount, (_authCode: typeof authCode) => {\n authCode = _authCode;\n\n rootScope.managers.appStateManager.pushToState('authState', {_: 'authStateSignUp', authCode: _authCode});\n});\n\nexport default page;\n"],"file":"pageSignUp-B7-bzav6.js"}