{"version":3,"file":"keycloakify-angular-login-components-user-profile-form-fields.mjs","names":[],"sources":["../../src/login/components/user-profile-form-fields/user-profile-form-fields.component.ts","../../src/login/components/user-profile-form-fields/user-profile-form-fields.component.html"],"sourcesContent":["import { AsyncPipe, NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, ContentChild, forwardRef, inject, type TemplateRef } from '@angular/core';\nimport { USE_DEFAULT_CSS } from '@keycloakify/angular/lib/tokens/use-default-css';\nimport { ComponentReference } from '@keycloakify/angular/login/classes/component-reference';\nimport { FieldErrorsComponent } from '@keycloakify/angular/login/components/field-errors';\nimport { GroupLabelComponent } from '@keycloakify/angular/login/components/group-label';\nimport { InputFieldByTypeComponent } from '@keycloakify/angular/login/components/input-field-by-type';\nimport { KcClassDirective } from '@keycloakify/angular/login/directives/kc-class';\nimport type { I18n } from '@keycloakify/angular/login/i18n';\nimport type { KcContext } from '@keycloakify/angular/login/KcContext';\nimport { type FormAction, UserProfileFormService } from '@keycloakify/angular/login/services/user-profile-form';\nimport { LOGIN_CLASSES } from '@keycloakify/angular/login/tokens/classes';\nimport { LOGIN_I18N } from '@keycloakify/angular/login/tokens/i18n';\nimport { KC_LOGIN_CONTEXT } from '@keycloakify/angular/login/tokens/kc-context';\nimport { DO_MAKE_USER_CONFIRM_PASSWORD } from '@keycloakify/angular/login/tokens/make-user-confirm-password';\nimport type { ClassKey } from 'keycloakify/login/lib/kcClsx';\n\n@Component({\n    styles: [\n        `\n            :host {\n                display: contents;\n            }\n        `\n    ],\n    imports: [KcClassDirective, FieldErrorsComponent, InputFieldByTypeComponent, GroupLabelComponent, NgTemplateOutlet, AsyncPipe],\n    selector: 'kc-user-profile-form-fields',\n    templateUrl: 'user-profile-form-fields.component.html',\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    providers: [\n        UserProfileFormService,\n        {\n            provide: ComponentReference,\n            useExisting: forwardRef(() => UserProfileFormFieldsComponent)\n        }\n    ]\n})\nexport class UserProfileFormFieldsComponent extends ComponentReference {\n    i18n = inject<I18n>(LOGIN_I18N);\n    kcContext = inject<KcContext>(KC_LOGIN_CONTEXT);\n    #userProfileFormService = inject(UserProfileFormService);\n    doMakeUserConfirmPassword = inject(DO_MAKE_USER_CONFIRM_PASSWORD);\n    override doUseDefaultCss = inject<boolean>(USE_DEFAULT_CSS);\n    override classes = inject<Partial<Record<ClassKey, string>>>(LOGIN_CLASSES);\n\n    formState$ = this.#userProfileFormService.formState$;\n\n    @ContentChild('beforeField') beforeField: TemplateRef<unknown> | undefined;\n    @ContentChild('afterField') afterField: TemplateRef<unknown> | undefined;\n\n    onDispatch(formAction: FormAction) {\n        this.#userProfileFormService.dispatchFormAction(formAction);\n    }\n}\n","@let formState = formState$ | async;\n@if (formState) {\n    @let formFieldStates = formState.formFieldStates;\n\n    @for (fieldState of formFieldStates; track fieldState.attribute) {\n        <kc-group-label [attribute]=\"fieldState.attribute\" />\n\n        @if (beforeField) {\n            <ng-container\n                [ngTemplateOutlet]=\"beforeField\"\n                [ngTemplateOutletContext]=\"{\n                    attribute: fieldState.attribute,\n                    valueOrValues: fieldState.valueOrValues,\n                    displayableErrors: fieldState.displayableErrors\n                }\"\n            />\n        }\n\n        <div\n            [kcClass]=\"'kcFormGroupClass'\"\n            [style.display]=\"\n                fieldState.attribute.annotations.inputType === 'hidden' ||\n                (fieldState.attribute.name === 'password-confirm' && !doMakeUserConfirmPassword)\n                    ? 'none'\n                    : 'block'\n            \"\n        >\n            <div [kcClass]=\"'kcLabelWrapperClass'\">\n                <label\n                    [for]=\"fieldState.attribute.name\"\n                    [kcClass]=\"'kcLabelClass'\"\n                >\n                    {{ i18n.advancedMsgStr(fieldState.attribute.displayName ?? '') }}\n                    @if (fieldState.attribute.required) {\n                        *\n                    }\n                </label>\n            </div>\n\n            <div [kcClass]=\"'kcInputWrapperClass'\">\n                @if (fieldState.attribute.annotations.inputHelperTextBefore) {\n                    <div\n                        aria-live=\"polite\"\n                        [kcClass]=\"'kcInputHelperTextBeforeClass'\"\n                        [id]=\"'form-help-text-before-' + fieldState.attribute.name\"\n                    >\n                        {{ i18n.advancedMsgStr(fieldState.attribute.annotations.inputHelperTextBefore) }}\n                    </div>\n                }\n\n                <kc-input-field-by-type\n                    [attribute]=\"fieldState.attribute\"\n                    [valueOrValues]=\"fieldState.valueOrValues\"\n                    [displayableErrors]=\"fieldState.displayableErrors\"\n                    (dispatchFormAction)=\"onDispatch($event)\"\n                />\n\n                <kc-field-errors\n                    [attribute]=\"fieldState.attribute\"\n                    [displayableErrors]=\"fieldState.displayableErrors\"\n                />\n                @if (fieldState.attribute.annotations.inputHelperTextAfter) {\n                    <div\n                        aria-live=\"polite\"\n                        [kcClass]=\"'kcInputHelperTextAfterClass'\"\n                        [id]=\"'form-help-text-after-' + fieldState.attribute.name\"\n                    >\n                        {{ i18n.advancedMsgStr(fieldState.attribute.annotations.inputHelperTextAfter) }}\n                    </div>\n                }\n\n                @if (afterField) {\n                    <ng-container\n                        [ngTemplateOutlet]=\"afterField\"\n                        [ngTemplateOutletContext]=\"{\n                            attribute: fieldState.attribute,\n                            valueOrValues: fieldState.valueOrValues,\n                            displayableErrors: fieldState.displayableErrors\n                        }\"\n                    />\n                }\n                <!-- NOTE: Downloading of html5DataAnnotations scripts is done in the useUserProfileForm hook -->\n            </div>\n        </div>\n    }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAa,iCAAb,MAAa,uCAAuC,mBAAkB;CApBtE,cAAA;;EAqBI,KAAA,OAAO,OAAa,UAAU;EAC9B,KAAA,YAAY,OAAkB,gBAAgB;EAC9C,KAAA,0BAA0B,OAAO,sBAAsB;EACvD,KAAA,4BAA4B,OAAO,6BAA6B;EACvD,KAAA,kBAAkB,OAAgB,eAAe;EACjD,KAAA,UAAU,OAA0C,aAAa;EAE1E,KAAA,aAAa,KAAK,wBAAwB;CAQ7C;CAbG;CAUA,WAAW,YAAsB;EAC7B,KAAK,wBAAwB,mBAAmB,UAAU;CAC9D;CAfS;EAAA,KAAA,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