{"version":3,"sources":["src/app/core/components/feature-announcement/feature-announcement.component.ts","src/app/core/components/feature-announcement/feature-announcement.component.html","src/app/phone/components/dialog-message/dialog-message.component.ts","src/app/phone/components/dialog-message/dialog-message.component.html","src/app/core/services/feature-announcement.service.ts","src/app/phone/models/recording-call.model.ts","src/app/phone/services/recording.service.ts","src/app/core/services/hid-renderer.service.ts","src/app/core/services/favicon.service.ts","src/app/core/services/app-initializer.service.ts","src/app/shared/guards/auth-guard.ts","../../node_modules/ngx-mask/fesm2020/ngx-mask.mjs"],"sourcesContent":["import { Component, Inject } from '@angular/core';\nimport { MAT_SNACK_BAR_DATA, MatSnackBarRef } from '@angular/material/snack-bar';\nimport { FeatureAnnouncementBarData } from '@app/core/models/feature-announcement.model';\n\n@Component({\n selector: 'app-feature-annoucement',\n templateUrl: './feature-announcement.component.html',\n styleUrls: ['./feature-announcement.component.scss'],\n})\nexport class FeatureAnnoucementComponent {\n constructor(\n @Inject(MAT_SNACK_BAR_DATA) protected data: FeatureAnnouncementBarData,\n private snackBar: MatSnackBarRef\n ) {}\n\n protected closeAction() {\n this.snackBar.dismiss();\n }\n\n protected onAction() {\n this.closeAction();\n this.data.action();\n }\n}\n","
\n
\n
{{ data.label }}
\n
\n {{ data.text }}\n
\n
\n
\n \n close\n \n \n {{ data.actionLabel }}\n chevron_right\n
\n
\n\n","import { Component, Inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { LocalStorageService } from '@app/core/services/local-storage.service';\n\n@Component({\n selector: 'app-dialog-message',\n templateUrl: './dialog-message.component.html',\n styleUrls: ['./dialog-message.component.scss'],\n})\nexport class DialogMessageComponent {\n constructor(\n private dialogRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data,\n private storage: LocalStorageService\n ) {}\n\n close(): void {\n this.storage.set('dialogMessage', true);\n this.dialogRef.close();\n }\n}\n","

Call Recordings

\n\n

{{data.message}}

\n
\n\n \n\n","import { Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport { PreferenceLayoutComponent } from '@app/preferences/components/preference-layout/preference-layout.component';\n\nimport { FeatureAnnoucementComponent } from '../components/feature-announcement/feature-announcement.component';\nimport {\n ConfirmedAnnouncements,\n FeatureAnnouncement,\n FeatureAnnouncementBarData,\n} from '../models/feature-announcement.model';\nimport { GoogleAnalyticsService } from './google-analytics.service';\nimport { LocalStorageService } from './local-storage.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FeatureAnnouncementService {\n private readonly STORAGE_KEY = 'announcements';\n private confirmedAnnoucements: ConfirmedAnnouncements = [];\n\n private readonly announcement: FeatureAnnouncement | null = null;\n\n constructor(\n private matSnackBar: MatSnackBar,\n private dialog: MatDialog,\n private localStorage: LocalStorageService,\n private googleAnalyticsService: GoogleAnalyticsService\n ) {}\n\n public init(): void {\n this.confirmedAnnoucements = this.localStorage.get(this.STORAGE_KEY) || [];\n if (this.announcement && !this.confirmedAnnoucements.includes(this.announcement.id)) {\n this.open(this.announcement.data);\n }\n }\n\n private confirmAnnouncement(): void {\n if (this.announcement) {\n this.confirmedAnnoucements.push(this.announcement.id);\n this.localStorage.set(this.STORAGE_KEY, this.confirmedAnnoucements);\n }\n }\n\n private open(data: FeatureAnnouncementBarData): void {\n const config = { duration: 0, panelClass: ['feature-announcement'], data: data };\n\n this.matSnackBar\n .openFromComponent(FeatureAnnoucementComponent, config)\n .afterDismissed()\n .subscribe(() => {\n this.confirmAnnouncement();\n });\n }\n\n private openPreferences(): void {\n this.dialog.open(PreferenceLayoutComponent);\n this.googleAnalyticsService.preferencesSelected();\n }\n}\n","export enum CallRecordingAction {\n START = 'start',\n STOP = 'stop',\n RESUME = 'resume',\n PAUSE = 'pause',\n}\n\nexport enum RecordingState {\n NotRecording = 'notRecording',\n Recording = 'recording',\n Paused = 'paused',\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { AuthService } from '@app/auth/services/auth.service';\nimport { AppFeature } from '@app/core/models/config.models';\nimport { ApiService } from '@app/core/services/api.service';\nimport { AppConfigService } from '@app/core/services/app-config.service';\nimport { GoogleAnalyticsService } from '@app/core/services/google-analytics.service';\nimport { LocalStorageService } from '@app/core/services/local-storage.service';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { SessionStatus } from '@shared/session-status.model';\nimport { BehaviorSubject, distinctUntilChanged, firstValueFrom } from 'rxjs';\n\nimport { DialogMessageComponent } from '../components/dialog-message/dialog-message.component';\nimport { Call, CallId } from '../models/call.model';\nimport { CallRecordingAction, RecordingState } from '../models/recording-call.model';\nimport { SipjsService } from './sipjs.service';\n\n/**\n * Service for managing the recording of calls. This service is responsible for starting, pausing and resuming, and stopping.\n * It also tracks the current recording state of each call.\n *\n * This service also manages the automatic recording feature. When enabled, calls will automatically start recording when answered.\n * This is accomplished by listening to the SessionStatus of each call and starting recording when the call is answered.\n */\n@UntilDestroy()\n@Injectable({\n providedIn: 'root',\n})\nexport class RecordingService extends ApiService {\n /** In milliseconds */\n public static readonly AutomaticRecordingResumeDuration = 60 * 1000;\n\n protected override baseUrl = 'users/{me}/recordings';\n private readonly callRecordingStateSubject = new BehaviorSubject(\n new Map()\n );\n private readonly loadingSubject = new BehaviorSubject(false);\n\n /**\n * Subject that tracks the number of outstanding http requests being made. Since this serice\n * may be used to record multiple calls at once, we need to track the number of requests being made\n * so we can show a loading spinner when requests are in progress.\n */\n private readonly httpRequestCountSubject = new BehaviorSubject(0);\n\n /**\n * Observable that emits any time the state of a call recording changes. This emits a map\n * containing all call recording states so it's possible an event will be\n * emitted for a call that you're not currently interested in. If so, use `distinctUntilChanged`\n * to filter state you don't care about.\n */\n public readonly callRecordingState$ = this.callRecordingStateSubject.asObservable();\n public readonly loading$ = this.loadingSubject.asObservable().pipe(distinctUntilChanged());\n\n private readonly callRecordingStateMap = new Map(); // [callId, RecordingState]\n private readonly callWasRecordedMap = new Map(); // [callId, wasRecorded]\n private automaticResumeRecordingTimerMap = new Map(); // [callId, timer]\n\n private _isAutomaticRecordingEnabled = false;\n\n // ========== Getters / Setters ==========\n\n public get isAutomaticRecordingEnabled(): boolean {\n return this._isAutomaticRecordingEnabled;\n }\n\n public get isRecordingPlaybackFeatureEnabled(): boolean {\n return this.configService.features[AppFeature.CallRecordingPlayback];\n }\n\n public get isRecordingOnDemandFeatureEnabled(): boolean {\n return this.configService.features[AppFeature.OnDemandRecording];\n }\n\n public get isPauseRecordingFeatureEnabled(): boolean {\n return this.configService.features[AppFeature.CallRecordingPause];\n }\n\n private get hasPresentedCallRecordingDialog(): boolean {\n return this.localStorageService.get('didPresentCallRecordingDialog') || false;\n }\n\n private set hasPresentedCallRecordingDialog(value: boolean) {\n this.localStorageService.set('didPresentCallRecordingDialog', value);\n }\n\n // ========== Lifecycle ==========\n\n constructor(\n httpClient: HttpClient,\n private configService: AppConfigService,\n private sipJsService: SipjsService,\n private googleAnalyticsService: GoogleAnalyticsService,\n private localStorageService: LocalStorageService,\n private matDialog: MatDialog,\n private authService: AuthService\n ) {\n super(httpClient);\n\n this.authService.isAuthenticated$.pipe(untilDestroyed(this)).subscribe((isAuthenticated) => {\n if (isAuthenticated) {\n this.fetchAutomaticRecordingEnabled().then((result) => {\n this._isAutomaticRecordingEnabled = result;\n });\n }\n });\n\n this.httpRequestCountSubject\n .asObservable()\n .pipe(untilDestroyed(this))\n .subscribe((count) => {\n this.loadingSubject.next(count > 0);\n });\n\n // Observe SessionStatus changes from SipjsService. For each session, track the current recording state.\n this.sipJsService.sessionStatus$.pipe(untilDestroyed(this)).subscribe(async ({ call, status }) => {\n switch (status) {\n case SessionStatus.Created: {\n this.updateRecordingState(call.id, RecordingState.NotRecording);\n break;\n }\n case SessionStatus.Answered: {\n // Update the answering state only the first time the call is answered. That ensures we don't accidentally\n // change state when transitioning from hold to answered.\n if (this.getAnsweredStatusCountForCall(call) === 1) {\n this.updateRecordingState(\n call.id,\n this.isAutomaticRecordingEnabled ? RecordingState.Recording : RecordingState.NotRecording\n );\n }\n break;\n }\n case SessionStatus.Hangup: {\n clearTimeout(this.automaticResumeRecordingTimerMap.get(call.id));\n this.automaticResumeRecordingTimerMap.delete(call.id);\n\n this.updateRecordingState(call.id, RecordingState.NotRecording);\n\n // If the call was recorded, show the call recording dialog.\n if (!this.hasPresentedCallRecordingDialog && this.wasCallRecorded(call.id)) {\n this.matDialog.open(DialogMessageComponent, {\n disableClose: true,\n data: { message: 'Call recordings will be available in call history when they are ready.' },\n });\n this.hasPresentedCallRecordingDialog = true;\n }\n\n break;\n }\n case SessionStatus.Destroy: {\n this.callRecordingStateMap.delete(call.id);\n this.callRecordingStateSubject.next(new Map(this.callRecordingStateMap));\n break;\n }\n }\n });\n }\n\n // ========== Recording Methods ==========\n\n public async startRecording(callId: CallId) {\n await this.postRecordAction(CallRecordingAction.START, callId);\n }\n\n public async pauseRecording(callId: CallId) {\n if (!this.wasCallRecorded(callId)) {\n console.debug(`Ignoring pausing recording for call ${callId} since it was not started`);\n return;\n }\n\n // If a call is paused that has automatic recording enabled, start a timer\n // that when fired, will automatically restart call recording.\n if (this._isAutomaticRecordingEnabled) {\n clearTimeout(this.automaticResumeRecordingTimerMap.get(callId));\n\n const timer = setTimeout(async () => {\n this.automaticResumeRecordingTimerMap.delete(callId);\n await this.resumeRecording(callId);\n }, RecordingService.AutomaticRecordingResumeDuration);\n this.automaticResumeRecordingTimerMap.set(callId, timer);\n }\n await this.postRecordAction(CallRecordingAction.PAUSE, callId);\n }\n\n public async resumeRecording(callId: CallId) {\n if (!this.wasCallRecorded(callId)) {\n console.debug(`Ignoring resuming recording for call ${callId} since it was not started.`);\n return;\n }\n\n clearTimeout(this.automaticResumeRecordingTimerMap.get(callId));\n await this.postRecordAction(CallRecordingAction.RESUME, callId);\n }\n\n public async stopRecording(callId: CallId) {\n if (!this.wasCallRecorded(callId)) {\n console.debug(`Ignoring stopping recording for call ${callId} since it was not started.`);\n return;\n }\n\n clearTimeout(this.automaticResumeRecordingTimerMap.get(callId));\n await this.postRecordAction(CallRecordingAction.STOP, callId);\n }\n\n private async postRecordAction(action: CallRecordingAction, callId: CallId): Promise {\n //When a call starts recording show that on the Google Analytics dashboard (we don't need events when paused/resumed/stopped)\n if (action == CallRecordingAction.START) {\n this.googleAnalyticsService.callRecording();\n }\n\n try {\n this.incrementHttpRequestCount();\n\n const normalizedCallId = this.sipJsService.getNormalizedCallId(callId);\n const result = await firstValueFrom(\n this.post<{ success: boolean }>('manage', {\n action,\n orig_callid: normalizedCallId,\n })\n );\n\n const success = result.success;\n if (success) {\n switch (action) {\n case CallRecordingAction.START: {\n this.updateRecordingState(callId, RecordingState.Recording);\n break;\n }\n case CallRecordingAction.PAUSE: {\n this.updateRecordingState(callId, RecordingState.Paused);\n break;\n }\n case CallRecordingAction.RESUME: {\n this.updateRecordingState(callId, RecordingState.Recording);\n break;\n }\n case CallRecordingAction.STOP: {\n this.updateRecordingState(callId, RecordingState.NotRecording);\n break;\n }\n }\n }\n return result.success;\n } catch {\n return false;\n } finally {\n this.decrementHttpRequestCount();\n }\n }\n\n private async fetchAutomaticRecordingEnabled(): Promise {\n try {\n this.incrementHttpRequestCount();\n\n const result = await firstValueFrom(this.get<{ enabled: boolean }>('auto-recording'));\n return result.enabled;\n } catch {\n return false;\n } finally {\n this.decrementHttpRequestCount();\n }\n }\n\n // ========== Helper Methods ==========\n\n public isCallRecording(callId: CallId): boolean {\n return this.callRecordingStateMap.get(callId) === RecordingState.Recording;\n }\n\n public wasCallRecorded(callId: CallId): boolean {\n return this.callWasRecordedMap.get(callId) || false;\n }\n\n private updateRecordingState(callId: CallId, state: RecordingState) {\n this.callRecordingStateMap.set(callId, state);\n if (state === RecordingState.Recording) {\n this.callWasRecordedMap.set(callId, true);\n }\n this.callRecordingStateSubject.next(new Map(this.callRecordingStateMap));\n }\n\n private getAnsweredStatusCountForCall(call: Call): number {\n return call.statusHistory.filter((s) => s === SessionStatus.Answered).length;\n }\n\n private incrementHttpRequestCount() {\n this.httpRequestCountSubject.next(this.httpRequestCountSubject.value + 1);\n }\n\n private decrementHttpRequestCount() {\n this.httpRequestCountSubject.next(this.httpRequestCountSubject.value - 1);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ElectronService } from '@app/electron/electron.service';\nimport { PhoneService } from '@app/phone/services/phone.service';\nimport { SipjsService } from '@app/phone/services/sipjs.service';\nimport { AudioSettings } from '@app/preferences/models/settings.models';\nimport { SettingsService } from '@app/preferences/services/settings.service';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { ElectronChannel, HidEvent } from '@shared/types';\nimport { combineLatest, filter, Observable, of, startWith, switchMap } from 'rxjs';\n\n/**\n * Monitors messages from Electron (aka \"main\") as events occur related to HID.\n * If an HID is available, the user should be able to control calls (answer, hang up, mute, unmute) using the HID.\n *\n * If no HID is connected, the operations will result in no-ops.\n */\n@UntilDestroy()\n@Injectable({\n providedIn: 'root',\n})\nexport class HidRendererService {\n constructor(\n private electronService: ElectronService,\n private sipJsService: SipjsService,\n private phoneService: PhoneService,\n private settingsService: SettingsService\n ) {\n // Observe the status of the current visible call and send the status to the HID device\n this.setUpCallStatusMonitoring();\n this.setUpElectronEventHandlers();\n }\n\n public init() {}\n public refreshData(): Observable {\n return of(void 0);\n }\n\n private setUpCallStatusMonitoring() {\n this.phoneService.currentVisibleCall$\n .pipe(\n untilDestroyed(this),\n filter((call) => call !== undefined),\n switchMap((call) => this.phoneService.observeStatusChanges(call.id))\n )\n .subscribe((status) => {\n this.electronService.send(ElectronChannel.CurrentCallSessionStatus, { status });\n });\n\n // Observe the current visible call as well as the muted states. Emit events to the HID\n // whenver the current call's muted state changes\n combineLatest([\n this.phoneService.currentVisibleCall$,\n this.phoneService.callMuted$.pipe(\n startWith({\n call: this.phoneService.currentVisibleCall,\n isMuted: this.phoneService.currentVisibleCall?.muted ?? false,\n })\n ),\n ])\n .pipe(\n untilDestroyed(this),\n filter(([currentCall, muteEvent]) => currentCall?.id === muteEvent.call?.id)\n )\n .subscribe(([_, muteEvent]) => {\n this.electronService.send(ElectronChannel.CallMute, { muted: muteEvent.isMuted ?? false });\n });\n\n // Observe calls and send the status to the HID device\n combineLatest([this.phoneService.visibleCalls$, this.phoneService.incomingCalls$, this.sipJsService.calls$])\n .pipe(untilDestroyed(this))\n .subscribe(([visibleCalls, incomingCalls, calls]) => {\n this.electronService.send(ElectronChannel.CallState, {\n hasIncoming: incomingCalls.length > 0,\n hasVisible: visibleCalls.length > 0,\n hasActive: calls.length > 0,\n });\n });\n\n this.settingsService.audioSettings$.pipe(untilDestroyed(this)).subscribe((settings) => {\n this.sendAudioSettings(settings);\n });\n }\n\n /**\n * Set up handlers for HID events from the Electron main process. For these actions, we infer the call\n * to be acted upon based on current app state since the HID device does not have a direct reference to the call.\n *\n * Typically we'll be acting upon the current visible call, but in some cases we may need to act upon an incoming call.\n */\n private setUpElectronEventHandlers() {\n this.electronService.on(ElectronChannel.HID, (data) => {\n switch (data.event) {\n case HidEvent.Mute: {\n const currentCall = this.phoneService.currentVisibleCall;\n if (currentCall) {\n this.phoneService.toggleCallMuted(currentCall.id);\n }\n\n break;\n }\n case HidEvent.RingingRequest: {\n // If there are incoming calls, answer the most recent one.\n const currentCall = this.phoneService.currentVisibleCall;\n const incomingCalls = this.phoneService.incomingCalls;\n\n if (incomingCalls.length > 0) {\n const mostRecentIncomingCall = incomingCalls.at(-1)!;\n this.phoneService.answerIncomingCall(mostRecentIncomingCall.id);\n } else if (currentCall) {\n this.phoneService.endCallOrConference(currentCall.id);\n }\n }\n }\n });\n\n this.electronService.on(ElectronChannel.RequestEmitAudioSettings, () => {\n this.sendAudioSettings(this.settingsService.audioSettings);\n });\n }\n\n private sendAudioSettings(settings: AudioSettings) {\n this.electronService.send(ElectronChannel.AudioSettingsChange, {\n speakerDevice: settings.speakerDevice,\n speakerLabel: settings.speakerLabel,\n microphoneDevice: settings.microphoneDevice,\n microphoneLabel: settings.microphoneLabel,\n });\n }\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class FaviconService {\n changeFavicon(iconUrl: string): void {\n const link: HTMLLinkElement | null = document.querySelector('#favicon');\n if (link) {\n link.href = iconUrl;\n } else {\n // If the favicon link element doesn't exist, create one\n const newLink = document.createElement('link');\n newLink.id = 'favicon';\n newLink.rel = 'icon';\n newLink.type = 'image/x-icon';\n newLink.href = iconUrl;\n document.head.append(newLink);\n }\n }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { AuthService } from '@app/auth/services/auth.service';\nimport { CallHistoryService } from '@app/call-history/services/call-history.service';\nimport { ChannelService } from '@app/chat/services/channel.service';\nimport { ContactService } from '@app/contacts/services/contact.service';\nimport { BrandingField } from '@app/core/models/branding.models';\nimport { AppConfigService } from '@app/core/services/app-config.service';\nimport { BrandingService } from '@app/core/services/branding.service';\nimport { FaviconService } from '@app/core/services/favicon.service';\nimport { HidRendererService } from '@app/core/services/hid-renderer.service';\nimport { FaxService } from '@app/fax/services/fax.service';\nimport { ActiveMeetingService } from '@app/meetings/services/active-meeting.service';\nimport { MeetingService } from '@app/meetings/services/meeting.service';\nimport { CallParkService } from '@app/parking/services/call-park.service';\nimport { RecordingService } from '@app/phone/services/recording.service';\nimport { IntegrationsService } from '@app/preferences/services/integrations.service';\nimport { SMSService } from '@app/sms/services/sms.service';\nimport { SMSUnreadMessageService } from '@app/sms/services/sms-unread-message.service';\nimport { UnreadMessageService } from '@app/sms/services/unread-message.service';\nimport { VoicemailService } from '@app/voicemail/services/voicemail.service';\nimport { environment } from '@environment/environment';\nimport {\n BehaviorSubject,\n combineLatest,\n concatMap,\n distinctUntilChanged,\n filter,\n finalize,\n firstValueFrom,\n forkJoin,\n map,\n Observable,\n startWith,\n tap,\n} from 'rxjs';\n\nimport { FeatureAnnouncementService } from './feature-announcement.service';\nimport { UcLinkSocketService } from './uc-link-socket.service';\nimport { WsService } from './ws.service';\n\n/*\n *\n * Some socket events are delivered as soon as the socket is connected.\n * For those events, it is important the interested service\n * is initialized _before_ the socket service, so we don't miss any events needed to bootstrap our application.\n * Angular provides\n * no way to explicitly control how services get initialized.\n *\n * Any service meeting the criteria outlined above should implement this interface\n * and be added to `websocketDependentServices`\n * an array in this class.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class AppInitializerService {\n isLoading$ = new BehaviorSubject(false);\n initialLoading$ = new BehaviorSubject(false);\n progress$ = new BehaviorSubject(0);\n services = [\n this.contactService,\n this.voicemailService,\n this.callHistoryService,\n this.meetingService,\n this.callParkService,\n this.channelService,\n this.smsService,\n this.faxService,\n this.integrationsService,\n this.hidRendererService,\n ];\n\n constructor(\n private voicemailService: VoicemailService,\n private callHistoryService: CallHistoryService,\n private contactService: ContactService,\n private channelService: ChannelService,\n private meetingService: MeetingService,\n private authService: AuthService,\n private callParkService: CallParkService,\n private smsService: SMSService,\n private activeMeetingService: ActiveMeetingService,\n private unreadMessageService: UnreadMessageService,\n private unreadSMSMessageService: SMSUnreadMessageService,\n private faxService: FaxService,\n private wsService: WsService,\n private appConfigService: AppConfigService,\n private featureAnnouncementService: FeatureAnnouncementService,\n private brandingService: BrandingService,\n // Added the recordingService and hidRendererService because it was needed to be initialized at the start of the app\n private recordingService: RecordingService,\n private hidRendererService: HidRendererService,\n private faviconService: FaviconService,\n private integrationsService: IntegrationsService,\n private ucLinkSocketService: UcLinkSocketService\n ) {}\n\n static init(injector: Injector): () => Promise {\n const initializer = injector.get(AppInitializerService);\n return () =>\n new Promise((resolve) => {\n initializer.init();\n resolve();\n });\n }\n\n init() {\n // Before initializing the services, check if there is a query parameter in the url for injecting\n // a token for the user. If so, set it on local storage. This is used for masquerading as a user.\n const urlParams = new URLSearchParams(window.location.search);\n const token = urlParams.get('token');\n if (token) {\n this.authService.updateWithMasqueradeToken(token);\n\n // Redirect to the same URL without the token query parameter\n window.history.replaceState({}, document.title, window.location.pathname);\n }\n\n this.initWsService();\n this.initServices();\n }\n\n private initServices() {\n this.services.forEach((service) => service.init());\n const dataFetches = this.services.map((service: { refreshData(): Observable }, index: number) =>\n service.refreshData().pipe(tap(() => this.progress$.next((index * 100) / Math.max(this.services.length, 1))))\n );\n combineLatest([this.authService.isAuthenticated$, this.wsService.isConnected$])\n .pipe(\n map(([loggedIn, isConnected]) => loggedIn && (isConnected || environment.name === 'mocked')),\n startWith(false),\n distinctUntilChanged(),\n filter((shouldFetch) => shouldFetch),\n tap(() => this.isLoading$.next(true)),\n concatMap(() => this.brandingService.refreshData()),\n concatMap(() => forkJoin(dataFetches)),\n finalize(() => this.isLoading$.next(false))\n )\n .subscribe(() => {\n this.isLoading$.next(false);\n this.appConfigService.getUserRoles();\n this.featureAnnouncementService.init();\n firstValueFrom(this.brandingService.brandingData$).then((brandingData) => {\n if (brandingData) {\n this.faviconService.changeFavicon(brandingData[BrandingField.FieldFavicon]);\n }\n });\n });\n }\n\n private initWsService() {\n [\n this.activeMeetingService,\n this.unreadMessageService,\n this.unreadSMSMessageService,\n this.ucLinkSocketService,\n ].forEach((service) => service.bindSocketEvents());\n this.wsService.init();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { UrlTree } from '@angular/router';\nimport { AuthService } from '@app/auth/services/auth.service';\nimport { BrandingService } from '@app/core/services/branding.service';\n\n@Injectable()\nexport class AuthGuard {\n constructor(\n private authService: AuthService,\n private brandingService: BrandingService\n ) {}\n\n async canActivate(): Promise {\n const url = await this.authService.getAuthUrl();\n\n const token = await this.authService.getRefreshedAccessToken();\n // following code has to be executed synchroneously otherwise it gets\n // into logout loop when token is empty\n if (token === '') {\n window.location.href = url;\n return false;\n }\n return true;\n }\n}\n","import * as i0 from '@angular/core';\nimport { InjectionToken, EventEmitter, inject, Injectable, ElementRef, Renderer2, makeEnvironmentProviders, Directive, Input, Output, HostListener, Pipe } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';\nconst NGX_MASK_CONFIG = new InjectionToken('ngx-mask config');\nconst NEW_CONFIG = new InjectionToken('new ngx-mask config');\nconst INITIAL_CONFIG = new InjectionToken('initial ngx-mask config');\nconst initialConfig = {\n suffix: '',\n prefix: '',\n thousandSeparator: ' ',\n decimalMarker: ['.', ','],\n clearIfNotMatch: false,\n showTemplate: false,\n showMaskTyped: false,\n placeHolderCharacter: '_',\n dropSpecialCharacters: true,\n hiddenInput: undefined,\n shownMaskExpression: '',\n separatorLimit: '',\n allowNegativeNumbers: false,\n validation: true,\n // eslint-disable-next-line @typescript-eslint/quotes\n specialCharacters: ['-', '/', '(', ')', '.', ':', ' ', '+', ',', '@', '[', ']', '\"', \"'\"],\n leadZeroDateTime: false,\n apm: false,\n leadZero: false,\n keepCharacterPositions: false,\n triggerOnMaskChange: false,\n inputTransformFn: value => value,\n outputTransformFn: value => value,\n maskFilled: new EventEmitter(),\n patterns: {\n '0': {\n pattern: new RegExp('\\\\d')\n },\n '9': {\n pattern: new RegExp('\\\\d'),\n optional: true\n },\n X: {\n pattern: new RegExp('\\\\d'),\n symbol: '*'\n },\n A: {\n pattern: new RegExp('[a-zA-Z0-9]')\n },\n S: {\n pattern: new RegExp('[a-zA-Z]')\n },\n U: {\n pattern: new RegExp('[A-Z]')\n },\n L: {\n pattern: new RegExp('[a-z]')\n },\n d: {\n pattern: new RegExp('\\\\d')\n },\n m: {\n pattern: new RegExp('\\\\d')\n },\n M: {\n pattern: new RegExp('\\\\d')\n },\n H: {\n pattern: new RegExp('\\\\d')\n },\n h: {\n pattern: new RegExp('\\\\d')\n },\n s: {\n pattern: new RegExp('\\\\d')\n }\n }\n};\nconst timeMasks = [\"Hh:m0:s0\" /* MaskExpression.HOURS_MINUTES_SECONDS */, \"Hh:m0\" /* MaskExpression.HOURS_MINUTES */, \"m0:s0\" /* MaskExpression.MINUTES_SECONDS */];\nconst withoutValidation = [\"percent\" /* MaskExpression.PERCENT */, \"Hh\" /* MaskExpression.HOURS_HOUR */, \"s0\" /* MaskExpression.SECONDS */, \"m0\" /* MaskExpression.MINUTES */, \"separator\" /* MaskExpression.SEPARATOR */, \"d0/M0/0000\" /* MaskExpression.DAYS_MONTHS_YEARS */, \"d0/M0\" /* MaskExpression.DAYS_MONTHS */, \"d0\" /* MaskExpression.DAYS */, \"M0\" /* MaskExpression.MONTHS */];\nlet NgxMaskApplierService = /*#__PURE__*/(() => {\n class NgxMaskApplierService {\n constructor() {\n this._config = inject(NGX_MASK_CONFIG);\n this.dropSpecialCharacters = this._config.dropSpecialCharacters;\n this.hiddenInput = this._config.hiddenInput;\n this.clearIfNotMatch = this._config.clearIfNotMatch;\n this.specialCharacters = this._config.specialCharacters;\n this.patterns = this._config.patterns;\n this.prefix = this._config.prefix;\n this.suffix = this._config.suffix;\n this.thousandSeparator = this._config.thousandSeparator;\n this.decimalMarker = this._config.decimalMarker;\n this.showMaskTyped = this._config.showMaskTyped;\n this.placeHolderCharacter = this._config.placeHolderCharacter;\n this.validation = this._config.validation;\n this.separatorLimit = this._config.separatorLimit;\n this.allowNegativeNumbers = this._config.allowNegativeNumbers;\n this.leadZeroDateTime = this._config.leadZeroDateTime;\n this.leadZero = this._config.leadZero;\n this.apm = this._config.apm;\n this.inputTransformFn = this._config.inputTransformFn;\n this.outputTransformFn = this._config.outputTransformFn;\n this.keepCharacterPositions = this._config.keepCharacterPositions;\n this._shift = new Set();\n this.plusOnePosition = false;\n this.maskExpression = '';\n this.actualValue = '';\n this.showKeepCharacterExp = '';\n this.shownMaskExpression = '';\n this.deletedSpecialCharacter = false;\n this._formatWithSeparators = (str, thousandSeparatorChar, decimalChars, precision) => {\n let x = [];\n let decimalChar = '';\n if (Array.isArray(decimalChars)) {\n const regExp = new RegExp(decimalChars.map(v => '[\\\\^$.|?*+()'.indexOf(v) >= 0 ? `\\\\${v}` : v).join('|'));\n x = str.split(regExp);\n decimalChar = str.match(regExp)?.[0] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n } else {\n x = str.split(decimalChars);\n decimalChar = decimalChars;\n }\n const decimals = x.length > 1 ? `${decimalChar}${x[1]}` : \"\" /* MaskExpression.EMPTY_STRING */;\n let res = x[0] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n const separatorLimit = this.separatorLimit.replace(/\\s/g, \"\" /* MaskExpression.EMPTY_STRING */);\n if (separatorLimit && +separatorLimit) {\n if (res[0] === \"-\" /* MaskExpression.MINUS */) {\n res = `-${res.slice(1, res.length).slice(0, separatorLimit.length)}`;\n } else {\n res = res.slice(0, separatorLimit.length);\n }\n }\n const rgx = /(\\d+)(\\d{3})/;\n while (thousandSeparatorChar && rgx.test(res)) {\n res = res.replace(rgx, '$1' + thousandSeparatorChar + '$2');\n }\n if (precision === undefined) {\n return res + decimals;\n } else if (precision === 0) {\n return res;\n }\n return res + decimals.substring(0, precision + 1);\n };\n this.percentage = str => {\n const sanitizedStr = str.replace(',', '.');\n const value = Number(sanitizedStr);\n return !isNaN(value) && value >= 0 && value <= 100;\n };\n this.getPrecision = maskExpression => {\n const x = maskExpression.split(\".\" /* MaskExpression.DOT */);\n if (x.length > 1) {\n return Number(x[x.length - 1]);\n }\n return Infinity;\n };\n this.checkAndRemoveSuffix = inputValue => {\n for (let i = this.suffix?.length - 1; i >= 0; i--) {\n const substr = this.suffix.substring(i, this.suffix?.length);\n if (inputValue.includes(substr) && i !== this.suffix?.length - 1 && (i - 1 < 0 || !inputValue.includes(this.suffix.substring(i - 1, this.suffix?.length)))) {\n return inputValue.replace(substr, \"\" /* MaskExpression.EMPTY_STRING */);\n }\n }\n return inputValue;\n };\n this.checkInputPrecision = (inputValue, precision, decimalMarker) => {\n if (precision < Infinity) {\n // TODO need think about decimalMarker\n if (Array.isArray(decimalMarker)) {\n const marker = decimalMarker.find(dm => dm !== this.thousandSeparator);\n // eslint-disable-next-line no-param-reassign\n decimalMarker = marker ? marker : decimalMarker[0];\n }\n const precisionRegEx = new RegExp(this._charToRegExpExpression(decimalMarker) + `\\\\d{${precision}}.*$`);\n const precisionMatch = inputValue.match(precisionRegEx);\n const precisionMatchLength = (precisionMatch && precisionMatch[0]?.length) ?? 0;\n if (precisionMatchLength - 1 > precision) {\n const diff = precisionMatchLength - 1 - precision;\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.substring(0, inputValue.length - diff);\n }\n if (precision === 0 && this._compareOrIncludes(inputValue[inputValue.length - 1], decimalMarker, this.thousandSeparator)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.substring(0, inputValue.length - 1);\n }\n }\n return inputValue;\n };\n }\n applyMaskWithPattern(inputValue, maskAndPattern) {\n const [mask, customPattern] = maskAndPattern;\n this.customPattern = customPattern;\n return this.applyMask(inputValue, mask);\n }\n applyMask(inputValue, maskExpression, position = 0, justPasted = false, backspaced = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n cb = () => {}) {\n if (!maskExpression || typeof inputValue !== 'string') {\n return \"\" /* MaskExpression.EMPTY_STRING */;\n }\n let cursor = 0;\n let result = '';\n let multi = false;\n let backspaceShift = false;\n let shift = 1;\n let stepBack = false;\n if (inputValue.slice(0, this.prefix.length) === this.prefix) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.slice(this.prefix.length, inputValue.length);\n }\n if (!!this.suffix && inputValue?.length > 0) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this.checkAndRemoveSuffix(inputValue);\n }\n if (inputValue === '(' && this.prefix) {\n // eslint-disable-next-line no-param-reassign\n inputValue = '';\n }\n const inputArray = inputValue.toString().split(\"\" /* MaskExpression.EMPTY_STRING */);\n if (this.allowNegativeNumbers && inputValue.slice(cursor, cursor + 1) === \"-\" /* MaskExpression.MINUS */) {\n // eslint-disable-next-line no-param-reassign\n result += inputValue.slice(cursor, cursor + 1);\n }\n if (maskExpression === \"IP\" /* MaskExpression.IP */) {\n const valuesIP = inputValue.split(\".\" /* MaskExpression.DOT */);\n this.ipError = this._validIP(valuesIP);\n // eslint-disable-next-line no-param-reassign\n maskExpression = '099.099.099.099';\n }\n const arr = [];\n for (let i = 0; i < inputValue.length; i++) {\n if (inputValue[i]?.match('\\\\d')) {\n arr.push(inputValue[i] ?? \"\" /* MaskExpression.EMPTY_STRING */);\n }\n }\n if (maskExpression === \"CPF_CNPJ\" /* MaskExpression.CPF_CNPJ */) {\n this.cpfCnpjError = arr.length !== 11 && arr.length !== 14;\n if (arr.length > 11) {\n // eslint-disable-next-line no-param-reassign\n maskExpression = '00.000.000/0000-00';\n } else {\n // eslint-disable-next-line no-param-reassign\n maskExpression = '000.000.000-00';\n }\n }\n if (maskExpression.startsWith(\"percent\" /* MaskExpression.PERCENT */)) {\n if (inputValue.match('[a-z]|[A-Z]') ||\n // eslint-disable-next-line no-useless-escape\n inputValue.match(/[-!$%^&*()_+|~=`{}\\[\\]:\";'<>?,\\/.]/) && !backspaced) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this._stripToDecimal(inputValue);\n const precision = this.getPrecision(maskExpression);\n // eslint-disable-next-line no-param-reassign\n inputValue = this.checkInputPrecision(inputValue, precision, this.decimalMarker);\n }\n const decimalMarker = typeof this.decimalMarker === 'string' ? this.decimalMarker : \".\" /* MaskExpression.DOT */;\n if (inputValue.indexOf(decimalMarker) > 0 && !this.percentage(inputValue.substring(0, inputValue.indexOf(decimalMarker)))) {\n let base = inputValue.substring(0, inputValue.indexOf(decimalMarker) - 1);\n if (this.allowNegativeNumbers && inputValue.slice(cursor, cursor + 1) === \"-\" /* MaskExpression.MINUS */ && !backspaced) {\n base = inputValue.substring(0, inputValue.indexOf(decimalMarker));\n }\n // eslint-disable-next-line no-param-reassign\n inputValue = `${base}${inputValue.substring(inputValue.indexOf(decimalMarker), inputValue.length)}`;\n }\n let value = '';\n this.allowNegativeNumbers && inputValue.slice(cursor, cursor + 1) === \"-\" /* MaskExpression.MINUS */ ? value = inputValue.slice(cursor + 1, cursor + inputValue.length) : value = inputValue;\n if (this.percentage(value)) {\n result = this._splitPercentZero(inputValue);\n } else {\n result = this._splitPercentZero(inputValue.substring(0, inputValue.length - 1));\n }\n } else if (maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */)) {\n if (inputValue.match('[wа-яА-Я]') || inputValue.match('[ЁёА-я]') || inputValue.match('[a-z]|[A-Z]') || inputValue.match(/[-@#!$%\\\\^&*()_£¬'+|~=`{}\\]:\";<>.?/]/) || inputValue.match('[^A-Za-z0-9,]')) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this._stripToDecimal(inputValue);\n }\n const precision = this.getPrecision(maskExpression);\n const decimalMarker = Array.isArray(this.decimalMarker) ? \".\" /* MaskExpression.DOT */ : this.decimalMarker;\n if (precision === 0) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this.allowNegativeNumbers ? inputValue.length > 2 && inputValue[0] === \"-\" /* MaskExpression.MINUS */ && inputValue[1] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue[2] !== this.thousandSeparator && inputValue[2] !== \",\" /* MaskExpression.COMMA */ && inputValue[2] !== \".\" /* MaskExpression.DOT */ ? '-' + inputValue.slice(2, inputValue.length) : inputValue[0] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue.length > 1 && inputValue[1] !== this.thousandSeparator && inputValue[1] !== \",\" /* MaskExpression.COMMA */ && inputValue[1] !== \".\" /* MaskExpression.DOT */ ? inputValue.slice(1, inputValue.length) : inputValue : inputValue.length > 1 && inputValue[0] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] !== this.thousandSeparator && inputValue[1] !== \",\" /* MaskExpression.COMMA */ && inputValue[1] !== \".\" /* MaskExpression.DOT */ ? inputValue.slice(1, inputValue.length) : inputValue;\n } else {\n // eslint-disable-next-line no-param-reassign\n if (inputValue[0] === decimalMarker && inputValue.length > 1) {\n // eslint-disable-next-line no-param-reassign\n inputValue = \"0\" /* MaskExpression.NUMBER_ZERO */ + inputValue.slice(0, inputValue.length + 1);\n this.plusOnePosition = true;\n }\n if (inputValue[0] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] !== decimalMarker && inputValue[1] !== this.thousandSeparator) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.length > 1 ? inputValue.slice(0, 1) + decimalMarker + inputValue.slice(1, inputValue.length + 1) : inputValue;\n this.plusOnePosition = true;\n }\n if (this.allowNegativeNumbers && inputValue[0] === \"-\" /* MaskExpression.MINUS */ && (inputValue[1] === decimalMarker || inputValue[1] === \"0\" /* MaskExpression.NUMBER_ZERO */)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue[1] === decimalMarker && inputValue.length > 2 ? inputValue.slice(0, 1) + \"0\" /* MaskExpression.NUMBER_ZERO */ + inputValue.slice(1, inputValue.length) : inputValue[1] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue.length > 2 && inputValue[2] !== decimalMarker ? inputValue.slice(0, 2) + decimalMarker + inputValue.slice(2, inputValue.length) : inputValue;\n this.plusOnePosition = true;\n }\n }\n if (backspaced) {\n if (inputValue[0] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] === this.decimalMarker && (inputValue[position] === \"0\" /* MaskExpression.NUMBER_ZERO */ || inputValue[position] === this.decimalMarker)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.slice(2, inputValue.length);\n }\n if (inputValue[0] === \"-\" /* MaskExpression.MINUS */ && inputValue[1] === \"0\" /* MaskExpression.NUMBER_ZERO */ && inputValue[2] === this.decimalMarker && (inputValue[position] === \"0\" /* MaskExpression.NUMBER_ZERO */ || inputValue[position] === this.decimalMarker)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = \"-\" /* MaskExpression.MINUS */ + inputValue.slice(3, inputValue.length);\n }\n // eslint-disable-next-line no-param-reassign\n inputValue = this._compareOrIncludes(inputValue[inputValue.length - 1], this.decimalMarker, this.thousandSeparator) ? inputValue.slice(0, inputValue.length - 1) : inputValue;\n }\n // TODO: we had different rexexps here for the different cases... but tests dont seam to bother - check this\n // separator: no COMMA, dot-sep: no SPACE, COMMA OK, comma-sep: no SPACE, COMMA OK\n const thousandSeparatorCharEscaped = this._charToRegExpExpression(this.thousandSeparator);\n let invalidChars = '@#!$%^&*()_+|~=`{}\\\\[\\\\]:\\\\s,\\\\.\";<>?\\\\/'.replace(thousandSeparatorCharEscaped, '');\n //.replace(decimalMarkerEscaped, '');\n if (Array.isArray(this.decimalMarker)) {\n for (const marker of this.decimalMarker) {\n invalidChars = invalidChars.replace(this._charToRegExpExpression(marker), \"\" /* MaskExpression.EMPTY_STRING */);\n }\n } else {\n invalidChars = invalidChars.replace(this._charToRegExpExpression(this.decimalMarker), '');\n }\n const invalidCharRegexp = new RegExp('[' + invalidChars + ']');\n if (inputValue.match(invalidCharRegexp)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.substring(0, inputValue.length - 1);\n }\n // eslint-disable-next-line no-param-reassign\n inputValue = this.checkInputPrecision(inputValue, precision, this.decimalMarker);\n const strForSep = inputValue.replace(new RegExp(thousandSeparatorCharEscaped, 'g'), '');\n result = this._formatWithSeparators(strForSep, this.thousandSeparator, this.decimalMarker, precision);\n const commaShift = result.indexOf(\",\" /* MaskExpression.COMMA */) - inputValue.indexOf(\",\" /* MaskExpression.COMMA */);\n const shiftStep = result.length - inputValue.length;\n if (shiftStep > 0 && result[position] !== this.thousandSeparator) {\n backspaceShift = true;\n let _shift = 0;\n do {\n this._shift.add(position + _shift);\n _shift++;\n } while (_shift < shiftStep);\n } else if (result[position - 1] === this.decimalMarker || shiftStep === -4 || shiftStep === -3 || result[position] === \",\" /* MaskExpression.COMMA */) {\n this._shift.clear();\n this._shift.add(position - 1);\n } else if (commaShift !== 0 && position > 0 && !(result.indexOf(\",\" /* MaskExpression.COMMA */) >= position && position > 3) || !(result.indexOf(\".\" /* MaskExpression.DOT */) >= position && position > 3) && shiftStep <= 0) {\n this._shift.clear();\n backspaceShift = true;\n shift = shiftStep;\n // eslint-disable-next-line no-param-reassign\n position += shiftStep;\n this._shift.add(position);\n } else {\n this._shift.clear();\n }\n } else {\n for (\n // eslint-disable-next-line\n let i = 0, inputSymbol = inputArray[0]; i < inputArray.length; i++, inputSymbol = inputArray[i] ?? \"\" /* MaskExpression.EMPTY_STRING */) {\n if (cursor === maskExpression.length) {\n break;\n }\n const symbolStarInPattern = \"*\" /* MaskExpression.SYMBOL_STAR */ in this.patterns;\n if (this._checkSymbolMask(inputSymbol, maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */) && maskExpression[cursor + 1] === \"?\" /* MaskExpression.SYMBOL_QUESTION */) {\n result += inputSymbol;\n cursor += 2;\n } else if (maskExpression[cursor + 1] === \"*\" /* MaskExpression.SYMBOL_STAR */ && multi && this._checkSymbolMask(inputSymbol, maskExpression[cursor + 2] ?? \"\" /* MaskExpression.EMPTY_STRING */)) {\n result += inputSymbol;\n cursor += 3;\n multi = false;\n } else if (this._checkSymbolMask(inputSymbol, maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */) && maskExpression[cursor + 1] === \"*\" /* MaskExpression.SYMBOL_STAR */ && !symbolStarInPattern) {\n result += inputSymbol;\n multi = true;\n } else if (maskExpression[cursor + 1] === \"?\" /* MaskExpression.SYMBOL_QUESTION */ && this._checkSymbolMask(inputSymbol, maskExpression[cursor + 2] ?? \"\" /* MaskExpression.EMPTY_STRING */)) {\n result += inputSymbol;\n cursor += 3;\n } else if (this._checkSymbolMask(inputSymbol, maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */)) {\n if (maskExpression[cursor] === \"H\" /* MaskExpression.HOURS */) {\n if (this.apm ? Number(inputSymbol) > 9 : Number(inputSymbol) > 2) {\n // eslint-disable-next-line no-param-reassign\n position = !this.leadZeroDateTime ? position + 1 : position;\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n if (maskExpression[cursor] === \"h\" /* MaskExpression.HOUR */) {\n if (this.apm ? result.length === 1 && Number(result) > 1 || result === '1' && Number(inputSymbol) > 2 || inputValue.slice(cursor - 1, cursor).length === 1 && Number(inputValue.slice(cursor - 1, cursor)) > 2 || inputValue.slice(cursor - 1, cursor) === '1' && Number(inputSymbol) > 2 : result === '2' && Number(inputSymbol) > 3 || (result.slice(cursor - 2, cursor) === '2' || result.slice(cursor - 3, cursor) === '2' || result.slice(cursor - 4, cursor) === '2' || result.slice(cursor - 1, cursor) === '2') && Number(inputSymbol) > 3 && cursor > 10) {\n // eslint-disable-next-line no-param-reassign\n position = position + 1;\n cursor += 1;\n i--;\n continue;\n }\n }\n if (maskExpression[cursor] === \"m\" /* MaskExpression.MINUTE */ || maskExpression[cursor] === \"s\" /* MaskExpression.SECOND */) {\n if (Number(inputSymbol) > 5) {\n // eslint-disable-next-line no-param-reassign\n position = !this.leadZeroDateTime ? position + 1 : position;\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n const daysCount = 31;\n const inputValueCursor = inputValue[cursor];\n const inputValueCursorPlusOne = inputValue[cursor + 1];\n const inputValueCursorPlusTwo = inputValue[cursor + 2];\n const inputValueCursorMinusOne = inputValue[cursor - 1];\n const inputValueCursorMinusTwo = inputValue[cursor - 2];\n const inputValueCursorMinusThree = inputValue[cursor - 3];\n const inputValueSliceMinusThreeMinusOne = inputValue.slice(cursor - 3, cursor - 1);\n const inputValueSliceMinusOnePlusOne = inputValue.slice(cursor - 1, cursor + 1);\n const inputValueSliceCursorPlusTwo = inputValue.slice(cursor, cursor + 2);\n const inputValueSliceMinusTwoCursor = inputValue.slice(cursor - 2, cursor);\n if (maskExpression[cursor] === \"d\" /* MaskExpression.DAY */) {\n const maskStartWithMonth = maskExpression.slice(0, 2) === \"M0\" /* MaskExpression.MONTHS */;\n const startWithMonthInput = maskExpression.slice(0, 2) === \"M0\" /* MaskExpression.MONTHS */ && this.specialCharacters.includes(inputValueCursorMinusTwo);\n if (Number(inputSymbol) > 3 && this.leadZeroDateTime || !maskStartWithMonth && (Number(inputValueSliceCursorPlusTwo) > daysCount || Number(inputValueSliceMinusOnePlusOne) > daysCount || this.specialCharacters.includes(inputValueCursorPlusOne)) || (startWithMonthInput ? Number(inputValueSliceMinusOnePlusOne) > daysCount || !this.specialCharacters.includes(inputValueCursor) && this.specialCharacters.includes(inputValueCursorPlusTwo) || this.specialCharacters.includes(inputValueCursor) : Number(inputValueSliceCursorPlusTwo) > daysCount || this.specialCharacters.includes(inputValueCursorPlusOne))) {\n // eslint-disable-next-line no-param-reassign\n position = !this.leadZeroDateTime ? position + 1 : position;\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n if (maskExpression[cursor] === \"M\" /* MaskExpression.MONTH */) {\n const monthsCount = 12;\n // mask without day\n const withoutDays = cursor === 0 && (Number(inputSymbol) > 2 || Number(inputValueSliceCursorPlusTwo) > monthsCount || this.specialCharacters.includes(inputValueCursorPlusOne));\n // day<10 && month<12 for input\n const specialChart = maskExpression.slice(cursor + 2, cursor + 3);\n const day1monthInput = inputValueSliceMinusThreeMinusOne.includes(specialChart) && (this.specialCharacters.includes(inputValueCursorMinusTwo) && Number(inputValueSliceMinusOnePlusOne) > monthsCount && !this.specialCharacters.includes(inputValueCursor) || this.specialCharacters.includes(inputValueCursor) || this.specialCharacters.includes(inputValueCursorMinusThree) && Number(inputValueSliceMinusTwoCursor) > monthsCount && !this.specialCharacters.includes(inputValueCursorMinusOne) || this.specialCharacters.includes(inputValueCursorMinusOne));\n // month<12 && day<10 for input\n const day2monthInput = Number(inputValueSliceMinusThreeMinusOne) <= daysCount && !this.specialCharacters.includes(inputValueSliceMinusThreeMinusOne) && this.specialCharacters.includes(inputValueCursorMinusOne) && (Number(inputValueSliceCursorPlusTwo) > monthsCount || this.specialCharacters.includes(inputValueCursorPlusOne));\n // cursor === 5 && without days\n const day2monthInputDot = Number(inputValueSliceCursorPlusTwo) > monthsCount && cursor === 5 || this.specialCharacters.includes(inputValueCursorPlusOne) && cursor === 5;\n // // day<10 && month<12 for paste whole data\n const day1monthPaste = Number(inputValueSliceMinusThreeMinusOne) > daysCount && !this.specialCharacters.includes(inputValueSliceMinusThreeMinusOne) && !this.specialCharacters.includes(inputValueSliceMinusTwoCursor) && Number(inputValueSliceMinusTwoCursor) > monthsCount;\n // 10 monthsCount;\n if (Number(inputSymbol) > 1 && this.leadZeroDateTime || withoutDays || day1monthInput || day2monthPaste || day1monthPaste || day2monthInput || day2monthInputDot && !this.leadZeroDateTime) {\n // eslint-disable-next-line no-param-reassign\n position = !this.leadZeroDateTime ? position + 1 : position;\n cursor += 1;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n if (this.leadZeroDateTime) {\n result += '0';\n }\n continue;\n }\n }\n result += inputSymbol;\n cursor++;\n } else if (inputSymbol === \" \" /* MaskExpression.WHITE_SPACE */ && maskExpression[cursor] === \" \" /* MaskExpression.WHITE_SPACE */ || inputSymbol === \"/\" /* MaskExpression.SLASH */ && maskExpression[cursor] === \"/\" /* MaskExpression.SLASH */) {\n result += inputSymbol;\n cursor++;\n } else if (this.specialCharacters.indexOf(maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */) !== -1) {\n result += maskExpression[cursor];\n cursor++;\n this._shiftStep(maskExpression, cursor, inputArray.length);\n i--;\n } else if (maskExpression[cursor] === \"9\" /* MaskExpression.NUMBER_NINE */ && this.showMaskTyped) {\n this._shiftStep(maskExpression, cursor, inputArray.length);\n } else if (this.patterns[maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */] && this.patterns[maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */]?.optional) {\n if (!!inputArray[cursor] && maskExpression !== '099.099.099.099' && maskExpression !== '000.000.000-00' && maskExpression !== '00.000.000/0000-00' && !maskExpression.match(/^9+\\.0+$/) && !this.patterns[maskExpression[cursor] ?? \"\" /* MaskExpression.EMPTY_STRING */]?.optional) {\n result += inputArray[cursor];\n }\n if (maskExpression.includes(\"9\" /* MaskExpression.NUMBER_NINE */ + \"*\" /* MaskExpression.SYMBOL_STAR */) && maskExpression.includes(\"0\" /* MaskExpression.NUMBER_ZERO */ + \"*\" /* MaskExpression.SYMBOL_STAR */)) {\n cursor++;\n }\n cursor++;\n i--;\n } else if (this.maskExpression[cursor + 1] === \"*\" /* MaskExpression.SYMBOL_STAR */ && this._findSpecialChar(this.maskExpression[cursor + 2] ?? \"\" /* MaskExpression.EMPTY_STRING */) && this._findSpecialChar(inputSymbol) === this.maskExpression[cursor + 2] && multi) {\n cursor += 3;\n result += inputSymbol;\n } else if (this.maskExpression[cursor + 1] === \"?\" /* MaskExpression.SYMBOL_QUESTION */ && this._findSpecialChar(this.maskExpression[cursor + 2] ?? \"\" /* MaskExpression.EMPTY_STRING */) && this._findSpecialChar(inputSymbol) === this.maskExpression[cursor + 2] && multi) {\n cursor += 3;\n result += inputSymbol;\n } else if (this.showMaskTyped && this.specialCharacters.indexOf(inputSymbol) < 0 && inputSymbol !== this.placeHolderCharacter && this.placeHolderCharacter.length === 1) {\n stepBack = true;\n }\n }\n }\n if (result.length + 1 === maskExpression.length && this.specialCharacters.indexOf(maskExpression[maskExpression.length - 1] ?? \"\" /* MaskExpression.EMPTY_STRING */) !== -1) {\n result += maskExpression[maskExpression.length - 1];\n }\n let newPosition = position + 1;\n while (this._shift.has(newPosition)) {\n shift++;\n newPosition++;\n }\n let actualShift = justPasted && !maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) ? cursor : this._shift.has(position) ? shift : 0;\n if (stepBack) {\n actualShift--;\n }\n cb(actualShift, backspaceShift);\n if (shift < 0) {\n this._shift.clear();\n }\n let onlySpecial = false;\n if (backspaced) {\n onlySpecial = inputArray.every(char => this.specialCharacters.includes(char));\n }\n let res = `${this.prefix}${onlySpecial ? \"\" /* MaskExpression.EMPTY_STRING */ : result}${this.showMaskTyped ? '' : this.suffix}`;\n if (result.length === 0) {\n res = !this.dropSpecialCharacters ? `${this.prefix}${result}` : `${result}`;\n }\n if (result.includes(\"-\" /* MaskExpression.MINUS */) && this.prefix && this.allowNegativeNumbers) {\n if (backspaced && result === \"-\" /* MaskExpression.MINUS */) {\n return '';\n }\n res = `${\"-\" /* MaskExpression.MINUS */}${this.prefix}${result.split(\"-\" /* MaskExpression.MINUS */).join(\"\" /* MaskExpression.EMPTY_STRING */)}${this.suffix}`;\n }\n return res;\n }\n _findDropSpecialChar(inputSymbol) {\n if (Array.isArray(this.dropSpecialCharacters)) {\n return this.dropSpecialCharacters.find(val => val === inputSymbol);\n }\n return this._findSpecialChar(inputSymbol);\n }\n _findSpecialChar(inputSymbol) {\n return this.specialCharacters.find(val => val === inputSymbol);\n }\n _checkSymbolMask(inputSymbol, maskSymbol) {\n this.patterns = this.customPattern ? this.customPattern : this.patterns;\n return (this.patterns[maskSymbol]?.pattern && this.patterns[maskSymbol]?.pattern.test(inputSymbol)) ?? false;\n }\n _stripToDecimal(str) {\n return str.split(\"\" /* MaskExpression.EMPTY_STRING */).filter((i, idx) => {\n const isDecimalMarker = typeof this.decimalMarker === 'string' ? i === this.decimalMarker :\n // TODO (inepipenko) use utility type\n this.decimalMarker.includes(i);\n return i.match('^-?\\\\d') || i === this.thousandSeparator || isDecimalMarker || i === \"-\" /* MaskExpression.MINUS */ && idx === 0 && this.allowNegativeNumbers;\n }).join(\"\" /* MaskExpression.EMPTY_STRING */);\n }\n _charToRegExpExpression(char) {\n // if (Array.isArray(char)) {\n // \treturn char.map((v) => ('[\\\\^$.|?*+()'.indexOf(v) >= 0 ? `\\\\${v}` : v)).join('|');\n // }\n if (char) {\n const charsToEscape = '[\\\\^$.|?*+()';\n return char === ' ' ? '\\\\s' : charsToEscape.indexOf(char) >= 0 ? `\\\\${char}` : char;\n }\n return char;\n }\n _shiftStep(maskExpression, cursor, inputLength) {\n const shiftStep = /[*?]/g.test(maskExpression.slice(0, cursor)) ? inputLength : cursor;\n this._shift.add(shiftStep + this.prefix.length || 0);\n }\n _compareOrIncludes(value, comparedValue, excludedValue) {\n return Array.isArray(comparedValue) ? comparedValue.filter(v => v !== excludedValue).includes(value) : value === comparedValue;\n }\n _validIP(valuesIP) {\n return !(valuesIP.length === 4 && !valuesIP.some((value, index) => {\n if (valuesIP.length !== index + 1) {\n return value === \"\" /* MaskExpression.EMPTY_STRING */ || Number(value) > 255;\n }\n return value === \"\" /* MaskExpression.EMPTY_STRING */ || Number(value.substring(0, 3)) > 255;\n }));\n }\n _splitPercentZero(value) {\n const decimalIndex = typeof this.decimalMarker === 'string' ? value.indexOf(this.decimalMarker) : value.indexOf(\".\" /* MaskExpression.DOT */);\n if (decimalIndex === -1) {\n const parsedValue = parseInt(value, 10);\n return isNaN(parsedValue) ? \"\" /* MaskExpression.EMPTY_STRING */ : parsedValue.toString();\n } else {\n const integerPart = parseInt(value.substring(0, decimalIndex), 10);\n const decimalPart = value.substring(decimalIndex + 1);\n const integerString = isNaN(integerPart) ? '' : integerPart.toString();\n const decimal = typeof this.decimalMarker === 'string' ? this.decimalMarker : \".\" /* MaskExpression.DOT */;\n return integerString === \"\" /* MaskExpression.EMPTY_STRING */ ? \"\" /* MaskExpression.EMPTY_STRING */ : integerString + decimal + decimalPart;\n }\n }\n }\n NgxMaskApplierService.ɵfac = function NgxMaskApplierService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NgxMaskApplierService)();\n };\n NgxMaskApplierService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NgxMaskApplierService,\n factory: NgxMaskApplierService.ɵfac\n });\n return NgxMaskApplierService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet NgxMaskService = /*#__PURE__*/(() => {\n class NgxMaskService extends NgxMaskApplierService {\n constructor() {\n super(...arguments);\n this.isNumberValue = false;\n this.maskIsShown = '';\n this.selStart = null;\n this.selEnd = null;\n /**\n * Whether we are currently in writeValue function, in this case when applying the mask we don't want to trigger onChange function,\n * since writeValue should be a one way only process of writing the DOM value based on the Angular model value.\n */\n this.writingValue = false;\n this.maskChanged = false;\n this._maskExpressionArray = [];\n this.triggerOnMaskChange = false;\n this._previousValue = '';\n this._currentValue = '';\n this._emitValue = false;\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n this.onChange = _ => {};\n this._elementRef = inject(ElementRef, {\n optional: true\n });\n this.document = inject(DOCUMENT);\n this._config = inject(NGX_MASK_CONFIG);\n this._renderer = inject(Renderer2, {\n optional: true\n });\n }\n // eslint-disable-next-line complexity\n applyMask(inputValue, maskExpression, position = 0, justPasted = false, backspaced = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n cb = () => {}) {\n if (!maskExpression) {\n return inputValue !== this.actualValue ? this.actualValue : inputValue;\n }\n this.maskIsShown = this.showMaskTyped ? this.showMaskInInput() : \"\" /* MaskExpression.EMPTY_STRING */;\n if (this.maskExpression === \"IP\" /* MaskExpression.IP */ && this.showMaskTyped) {\n this.maskIsShown = this.showMaskInInput(inputValue || \"#\" /* MaskExpression.HASH */);\n }\n if (this.maskExpression === \"CPF_CNPJ\" /* MaskExpression.CPF_CNPJ */ && this.showMaskTyped) {\n this.maskIsShown = this.showMaskInInput(inputValue || \"#\" /* MaskExpression.HASH */);\n }\n if (!inputValue && this.showMaskTyped) {\n this.formControlResult(this.prefix);\n return this.prefix + this.maskIsShown + this.suffix;\n }\n const getSymbol = !!inputValue && typeof this.selStart === 'number' ? inputValue[this.selStart] ?? \"\" /* MaskExpression.EMPTY_STRING */ : \"\" /* MaskExpression.EMPTY_STRING */;\n let newInputValue = '';\n if (this.hiddenInput !== undefined && !this.writingValue) {\n let actualResult = inputValue && inputValue.length === 1 ? inputValue.split(\"\" /* MaskExpression.EMPTY_STRING */) : this.actualValue.split(\"\" /* MaskExpression.EMPTY_STRING */);\n // eslint-disable @typescript-eslint/no-unused-expressions\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n if (typeof this.selStart === 'object' && typeof this.selEnd === 'object') {\n this.selStart = Number(this.selStart);\n this.selEnd = Number(this.selEnd);\n } else {\n inputValue !== \"\" /* MaskExpression.EMPTY_STRING */ && actualResult.length ? typeof this.selStart === 'number' && typeof this.selEnd === 'number' ? inputValue.length > actualResult.length ? actualResult.splice(this.selStart, 0, getSymbol) : inputValue.length < actualResult.length ? actualResult.length - inputValue.length === 1 ? backspaced ? actualResult.splice(this.selStart - 1, 1) : actualResult.splice(inputValue.length - 1, 1) : actualResult.splice(this.selStart, this.selEnd - this.selStart) : null : null : actualResult = [];\n }\n if (this.showMaskTyped) {\n if (!this.hiddenInput) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this.removeMask(inputValue);\n }\n }\n // eslint-enable @typescript-eslint/no-unused-expressions\n newInputValue = this.actualValue.length && actualResult.length <= inputValue.length ? this.shiftTypedSymbols(actualResult.join(\"\" /* MaskExpression.EMPTY_STRING */)) : inputValue;\n }\n if (justPasted && (this.hiddenInput || !this.hiddenInput)) {\n newInputValue = inputValue;\n }\n if (backspaced && this.specialCharacters.indexOf(this.maskExpression[position] ?? \"\" /* MaskExpression.EMPTY_STRING */) !== -1 && this.showMaskTyped) {\n newInputValue = this._currentValue;\n }\n if (this.deletedSpecialCharacter && position) {\n if (this.specialCharacters.includes(this.actualValue.slice(position, position + 1))) {\n // eslint-disable-next-line no-param-reassign\n position = position + 1;\n } else if (maskExpression.slice(position - 1, position + 1) !== \"M0\" /* MaskExpression.MONTHS */) {\n // eslint-disable-next-line no-param-reassign\n position = position - 2;\n }\n // eslint-disable-next-line no-param-reassign\n this.deletedSpecialCharacter = false;\n }\n if (this.showMaskTyped && this.placeHolderCharacter.length === 1 && !this.leadZeroDateTime) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this.removeMask(inputValue);\n }\n if (this.maskChanged) {\n newInputValue = inputValue;\n } else {\n newInputValue = Boolean(newInputValue) && newInputValue.length ? newInputValue : inputValue;\n }\n if (this.showMaskTyped && this.keepCharacterPositions && this.actualValue && !justPasted) {\n const value = this.dropSpecialCharacters ? this.removeMask(this.actualValue) : this.actualValue;\n this.formControlResult(value);\n return this.actualValue ? this.actualValue : this.prefix + this.maskIsShown + this.suffix;\n }\n const result = super.applyMask(newInputValue, maskExpression, position, justPasted, backspaced, cb);\n this.actualValue = this.getActualValue(result);\n // handle some separator implications:\n // a.) adjust decimalMarker default (. -> ,) if thousandSeparator is a dot\n if (this.thousandSeparator === \".\" /* MaskExpression.DOT */ && this.decimalMarker === \".\" /* MaskExpression.DOT */) {\n this.decimalMarker = \",\" /* MaskExpression.COMMA */;\n }\n // b) remove decimal marker from list of special characters to mask\n if (this.maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && this.dropSpecialCharacters === true) {\n this.specialCharacters = this.specialCharacters.filter(item => !this._compareOrIncludes(item, this.decimalMarker, this.thousandSeparator) //item !== this.decimalMarker, // !\n );\n }\n if (result || result === '') {\n this._previousValue = this._currentValue;\n this._currentValue = result;\n this._emitValue = this._previousValue !== this._currentValue || this.maskChanged || this._previousValue === this._currentValue && justPasted;\n }\n this._emitValue ? this.formControlResult(result) : '';\n if (!this.showMaskTyped || this.showMaskTyped && this.hiddenInput) {\n if (this.hiddenInput) {\n if (backspaced) {\n return this.hideInput(result, this.maskExpression);\n }\n return this.hideInput(result, this.maskExpression) + this.maskIsShown.slice(result.length);\n }\n return result;\n }\n const resLen = result.length;\n const prefNmask = this.prefix + this.maskIsShown + this.suffix;\n if (this.maskExpression.includes(\"H\" /* MaskExpression.HOURS */)) {\n const countSkipedSymbol = this._numberSkipedSymbols(result);\n return result + prefNmask.slice(resLen + countSkipedSymbol);\n } else if (this.maskExpression === \"IP\" /* MaskExpression.IP */ || this.maskExpression === \"CPF_CNPJ\" /* MaskExpression.CPF_CNPJ */) {\n return result + prefNmask;\n }\n return result + prefNmask.slice(resLen);\n }\n // get the number of characters that were shifted\n _numberSkipedSymbols(value) {\n const regex = /(^|\\D)(\\d\\D)/g;\n let match = regex.exec(value);\n let countSkipedSymbol = 0;\n while (match != null) {\n countSkipedSymbol += 1;\n match = regex.exec(value);\n }\n return countSkipedSymbol;\n }\n applyValueChanges(position, justPasted, backspaced,\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n cb = () => {}) {\n const formElement = this._elementRef?.nativeElement;\n if (!formElement) {\n return;\n }\n formElement.value = this.applyMask(formElement.value, this.maskExpression, position, justPasted, backspaced, cb);\n if (formElement === this._getActiveElement()) {\n return;\n }\n this.clearIfNotMatchFn();\n }\n hideInput(inputValue, maskExpression) {\n return inputValue.split(\"\" /* MaskExpression.EMPTY_STRING */).map((curr, index) => {\n if (this.patterns && this.patterns[maskExpression[index] ?? \"\" /* MaskExpression.EMPTY_STRING */] && this.patterns[maskExpression[index] ?? \"\" /* MaskExpression.EMPTY_STRING */]?.symbol) {\n return this.patterns[maskExpression[index] ?? \"\" /* MaskExpression.EMPTY_STRING */]?.symbol;\n }\n return curr;\n }).join(\"\" /* MaskExpression.EMPTY_STRING */);\n }\n // this function is not necessary, it checks result against maskExpression\n getActualValue(res) {\n const compare = res.split(\"\" /* MaskExpression.EMPTY_STRING */).filter((symbol, i) => {\n const maskChar = this.maskExpression[i] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n return this._checkSymbolMask(symbol, maskChar) || this.specialCharacters.includes(maskChar) && symbol === maskChar;\n });\n if (compare.join(\"\" /* MaskExpression.EMPTY_STRING */) === res) {\n return compare.join(\"\" /* MaskExpression.EMPTY_STRING */);\n }\n return res;\n }\n shiftTypedSymbols(inputValue) {\n let symbolToReplace = '';\n const newInputValue = inputValue && inputValue.split(\"\" /* MaskExpression.EMPTY_STRING */).map((currSymbol, index) => {\n if (this.specialCharacters.includes(inputValue[index + 1] ?? \"\" /* MaskExpression.EMPTY_STRING */) && inputValue[index + 1] !== this.maskExpression[index + 1]) {\n symbolToReplace = currSymbol;\n return inputValue[index + 1];\n }\n if (symbolToReplace.length) {\n const replaceSymbol = symbolToReplace;\n symbolToReplace = \"\" /* MaskExpression.EMPTY_STRING */;\n return replaceSymbol;\n }\n return currSymbol;\n }) || [];\n return newInputValue.join(\"\" /* MaskExpression.EMPTY_STRING */);\n }\n /**\n * Convert number value to string\n * 3.1415 -> '3.1415'\n * 1e-7 -> '0.0000001'\n */\n numberToString(value) {\n if (!value && value !== 0 || this.maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && (this.leadZero || !this.dropSpecialCharacters) || this.maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && this.separatorLimit.length > 14 && String(value).length > 14) {\n return String(value);\n }\n return Number(value).toLocaleString('fullwide', {\n useGrouping: false,\n maximumFractionDigits: 20\n }).replace(`/${\"-\" /* MaskExpression.MINUS */}/`, \"-\" /* MaskExpression.MINUS */);\n }\n showMaskInInput(inputVal) {\n if (this.showMaskTyped && !!this.shownMaskExpression) {\n if (this.maskExpression.length !== this.shownMaskExpression.length) {\n throw new Error('Mask expression must match mask placeholder length');\n } else {\n return this.shownMaskExpression;\n }\n } else if (this.showMaskTyped) {\n if (inputVal) {\n if (this.maskExpression === \"IP\" /* MaskExpression.IP */) {\n return this._checkForIp(inputVal);\n }\n if (this.maskExpression === \"CPF_CNPJ\" /* MaskExpression.CPF_CNPJ */) {\n return this._checkForCpfCnpj(inputVal);\n }\n }\n if (this.placeHolderCharacter.length === this.maskExpression.length) {\n return this.placeHolderCharacter;\n }\n return this.maskExpression.replace(/\\w/g, this.placeHolderCharacter);\n }\n return '';\n }\n clearIfNotMatchFn() {\n const formElement = this._elementRef?.nativeElement;\n if (!formElement) {\n return;\n }\n if (this.clearIfNotMatch && this.prefix.length + this.maskExpression.length + this.suffix.length !== formElement.value.replace(this.placeHolderCharacter, \"\" /* MaskExpression.EMPTY_STRING */).length) {\n this.formElementProperty = ['value', \"\" /* MaskExpression.EMPTY_STRING */];\n this.applyMask('', this.maskExpression);\n }\n }\n set formElementProperty([name, value]) {\n if (!this._renderer || !this._elementRef) {\n return;\n }\n Promise.resolve().then(() => this._renderer?.setProperty(this._elementRef?.nativeElement, name, value));\n }\n checkDropSpecialCharAmount(mask) {\n const chars = mask.split(\"\" /* MaskExpression.EMPTY_STRING */).filter(item => this._findDropSpecialChar(item));\n return chars.length;\n }\n removeMask(inputValue) {\n return this._removeMask(this._removeSuffix(this._removePrefix(inputValue)), this.specialCharacters.concat('_').concat(this.placeHolderCharacter));\n }\n _checkForIp(inputVal) {\n if (inputVal === \"#\" /* MaskExpression.HASH */) {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n const arr = [];\n for (let i = 0; i < inputVal.length; i++) {\n const value = inputVal[i] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n if (!value) {\n continue;\n }\n if (value.match('\\\\d')) {\n arr.push(value);\n }\n }\n if (arr.length <= 3) {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n if (arr.length > 3 && arr.length <= 6) {\n return `${this.placeHolderCharacter}.${this.placeHolderCharacter}`;\n }\n if (arr.length > 6 && arr.length <= 9) {\n return this.placeHolderCharacter;\n }\n if (arr.length > 9 && arr.length <= 12) {\n return '';\n }\n return '';\n }\n _checkForCpfCnpj(inputVal) {\n const cpf = `${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `-${this.placeHolderCharacter}${this.placeHolderCharacter}`;\n const cnpj = `${this.placeHolderCharacter}${this.placeHolderCharacter}` + `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `/${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}` + `-${this.placeHolderCharacter}${this.placeHolderCharacter}`;\n if (inputVal === \"#\" /* MaskExpression.HASH */) {\n return cpf;\n }\n const arr = [];\n for (let i = 0; i < inputVal.length; i++) {\n const value = inputVal[i] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n if (!value) {\n continue;\n }\n if (value.match('\\\\d')) {\n arr.push(value);\n }\n }\n if (arr.length <= 3) {\n return cpf.slice(arr.length, cpf.length);\n }\n if (arr.length > 3 && arr.length <= 6) {\n return cpf.slice(arr.length + 1, cpf.length);\n }\n if (arr.length > 6 && arr.length <= 9) {\n return cpf.slice(arr.length + 2, cpf.length);\n }\n if (arr.length > 9 && arr.length < 11) {\n return cpf.slice(arr.length + 3, cpf.length);\n }\n if (arr.length === 11) {\n return '';\n }\n if (arr.length === 12) {\n if (inputVal.length === 17) {\n return cnpj.slice(16, cnpj.length);\n }\n return cnpj.slice(15, cnpj.length);\n }\n if (arr.length > 12 && arr.length <= 14) {\n return cnpj.slice(arr.length + 4, cnpj.length);\n }\n return '';\n }\n /**\n * Recursively determine the current active element by navigating the Shadow DOM until the Active Element is found.\n */\n _getActiveElement(document = this.document) {\n const shadowRootEl = document?.activeElement?.shadowRoot;\n if (!shadowRootEl?.activeElement) {\n return document.activeElement;\n } else {\n return this._getActiveElement(shadowRootEl);\n }\n }\n /**\n * Propogates the input value back to the Angular model by triggering the onChange function. It won't do this if writingValue\n * is true. If that is true it means we are currently in the writeValue function, which is supposed to only update the actual\n * DOM element based on the Angular model value. It should be a one way process, i.e. writeValue should not be modifying the Angular\n * model value too. Therefore, we don't trigger onChange in this scenario.\n * @param inputValue the current form input value\n */\n formControlResult(inputValue) {\n if (this.writingValue || !this.triggerOnMaskChange && this.maskChanged) {\n this.maskChanged ? this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeSuffix(this._removePrefix(inputValue)))))) : '';\n this.maskChanged = false;\n return;\n }\n if (Array.isArray(this.dropSpecialCharacters)) {\n this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeMask(this._removeSuffix(this._removePrefix(inputValue)), this.dropSpecialCharacters)))));\n } else if (this.dropSpecialCharacters || !this.dropSpecialCharacters && this.prefix === inputValue) {\n this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeSuffix(this._removePrefix(inputValue))))));\n } else {\n this.onChange(this.outputTransformFn(this._toNumber(inputValue)));\n }\n }\n _toNumber(value) {\n if (!this.isNumberValue || value === \"\" /* MaskExpression.EMPTY_STRING */) {\n return value;\n }\n if (this.maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && (this.leadZero || !this.dropSpecialCharacters)) {\n return value;\n }\n if (String(value).length > 16 && this.separatorLimit.length > 14) {\n return String(value);\n }\n const num = Number(value);\n if (this.maskExpression.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && Number.isNaN(num)) {\n const val = String(value).replace(',', '.');\n return Number(val);\n }\n return Number.isNaN(num) ? value : num;\n }\n _removeMask(value, specialCharactersForRemove) {\n if (this.maskExpression.startsWith(\"percent\" /* MaskExpression.PERCENT */) && value.includes(\".\" /* MaskExpression.DOT */)) {\n return value;\n }\n return value ? value.replace(this._regExpForRemove(specialCharactersForRemove), \"\" /* MaskExpression.EMPTY_STRING */) : value;\n }\n _removePrefix(value) {\n if (!this.prefix) {\n return value;\n }\n return value ? value.replace(this.prefix, \"\" /* MaskExpression.EMPTY_STRING */) : value;\n }\n _removeSuffix(value) {\n if (!this.suffix) {\n return value;\n }\n return value ? value.replace(this.suffix, \"\" /* MaskExpression.EMPTY_STRING */) : value;\n }\n _retrieveSeparatorValue(result) {\n let specialCharacters = Array.isArray(this.dropSpecialCharacters) ? this.specialCharacters.filter(v => {\n return this.dropSpecialCharacters.includes(v);\n }) : this.specialCharacters;\n if (!this.deletedSpecialCharacter && this._checkPatternForSpace() && result.includes(\" \" /* MaskExpression.WHITE_SPACE */) && this.maskExpression.includes(\"*\" /* MaskExpression.SYMBOL_STAR */)) {\n specialCharacters = specialCharacters.filter(char => char !== \" \" /* MaskExpression.WHITE_SPACE */);\n }\n return this._removeMask(result, specialCharacters);\n }\n _regExpForRemove(specialCharactersForRemove) {\n return new RegExp(specialCharactersForRemove.map(item => `\\\\${item}`).join('|'), 'gi');\n }\n _replaceDecimalMarkerToDot(value) {\n const markers = Array.isArray(this.decimalMarker) ? this.decimalMarker : [this.decimalMarker];\n return value.replace(this._regExpForRemove(markers), \".\" /* MaskExpression.DOT */);\n }\n _checkSymbols(result) {\n if (result === \"\" /* MaskExpression.EMPTY_STRING */) {\n return result;\n }\n if (this.maskExpression.startsWith(\"percent\" /* MaskExpression.PERCENT */) && this.decimalMarker === \",\" /* MaskExpression.COMMA */) {\n // eslint-disable-next-line no-param-reassign\n result = result.replace(\",\" /* MaskExpression.COMMA */, \".\" /* MaskExpression.DOT */);\n }\n const separatorPrecision = this._retrieveSeparatorPrecision(this.maskExpression);\n const separatorValue = this._replaceDecimalMarkerToDot(this._retrieveSeparatorValue(result));\n if (!this.isNumberValue) {\n return separatorValue;\n }\n if (separatorPrecision) {\n if (result === this.decimalMarker) {\n return null;\n }\n if (this.separatorLimit.length > 14) {\n return String(separatorValue);\n }\n return this._checkPrecision(this.maskExpression, separatorValue);\n } else {\n return separatorValue;\n }\n }\n _checkPatternForSpace() {\n for (const key in this.patterns) {\n // eslint-disable-next-line no-prototype-builtins\n if (this.patterns[key] && this.patterns[key]?.hasOwnProperty('pattern')) {\n const patternString = this.patterns[key]?.pattern.toString();\n const pattern = this.patterns[key]?.pattern;\n if (patternString?.includes(\" \" /* MaskExpression.WHITE_SPACE */) && pattern?.test(this.maskExpression)) {\n return true;\n }\n }\n }\n return false;\n }\n // TODO should think about helpers or separting decimal precision to own property\n _retrieveSeparatorPrecision(maskExpretion) {\n const matcher = maskExpretion.match(new RegExp(`^separator\\\\.([^d]*)`));\n return matcher ? Number(matcher[1]) : null;\n }\n _checkPrecision(separatorExpression, separatorValue) {\n const separatorPrecision = separatorExpression.slice(10, 11);\n if (separatorExpression.indexOf('2') > 0 || this.leadZero && Number(separatorPrecision) > 1) {\n if (this.decimalMarker === \",\" /* MaskExpression.COMMA */ && this.leadZero) {\n // eslint-disable-next-line no-param-reassign\n separatorValue = separatorValue.replace(',', '.');\n }\n return this.leadZero ? Number(separatorValue).toFixed(Number(separatorPrecision)) : Number(separatorValue).toFixed(2);\n }\n return this.numberToString(separatorValue);\n }\n _repeatPatternSymbols(maskExp) {\n return maskExp.match(/{[0-9]+}/) && maskExp.split(\"\" /* MaskExpression.EMPTY_STRING */).reduce((accum, currVal, index) => {\n this._start = currVal === \"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */ ? index : this._start;\n if (currVal !== \"}\" /* MaskExpression.CURLY_BRACKETS_RIGHT */) {\n return this._findSpecialChar(currVal) ? accum + currVal : accum;\n }\n this._end = index;\n const repeatNumber = Number(maskExp.slice(this._start + 1, this._end));\n const replaceWith = new Array(repeatNumber + 1).join(maskExp[this._start - 1]);\n if (maskExp.slice(0, this._start).length > 1 && maskExp.includes(\"S\" /* MaskExpression.LETTER_S */)) {\n const symbols = maskExp.slice(0, this._start - 1);\n return symbols.includes(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */) ? accum + replaceWith : symbols + accum + replaceWith;\n } else {\n return accum + replaceWith;\n }\n }, '') || maskExp;\n }\n currentLocaleDecimalMarker() {\n return 1.1.toLocaleString().substring(1, 2);\n }\n }\n NgxMaskService.ɵfac = /* @__PURE__ */(() => {\n let ɵNgxMaskService_BaseFactory;\n return function NgxMaskService_Factory(__ngFactoryType__) {\n return (ɵNgxMaskService_BaseFactory || (ɵNgxMaskService_BaseFactory = i0.ɵɵgetInheritedFactory(NgxMaskService)))(__ngFactoryType__ || NgxMaskService);\n };\n })();\n NgxMaskService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NgxMaskService,\n factory: NgxMaskService.ɵfac\n });\n return NgxMaskService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * @internal\n */\nfunction _configFactory() {\n const initConfig = inject(INITIAL_CONFIG);\n const configValue = inject(NEW_CONFIG);\n return configValue instanceof Function ? {\n ...initConfig,\n ...configValue()\n } : {\n ...initConfig,\n ...configValue\n };\n}\nfunction provideNgxMask(configValue) {\n return [{\n provide: NEW_CONFIG,\n useValue: configValue\n }, {\n provide: INITIAL_CONFIG,\n useValue: initialConfig\n }, {\n provide: NGX_MASK_CONFIG,\n useFactory: _configFactory\n }, NgxMaskService];\n}\nfunction provideEnvironmentNgxMask(configValue) {\n return makeEnvironmentProviders(provideNgxMask(configValue));\n}\nlet NgxMaskDirective = /*#__PURE__*/(() => {\n class NgxMaskDirective {\n constructor() {\n // eslint-disable-next-line @angular-eslint/no-input-rename\n this.maskExpression = '';\n this.specialCharacters = [];\n this.patterns = {};\n this.prefix = '';\n this.suffix = '';\n this.thousandSeparator = ' ';\n this.decimalMarker = '.';\n this.dropSpecialCharacters = null;\n this.hiddenInput = null;\n this.showMaskTyped = null;\n this.placeHolderCharacter = null;\n this.shownMaskExpression = null;\n this.showTemplate = null;\n this.clearIfNotMatch = null;\n this.validation = null;\n this.separatorLimit = null;\n this.allowNegativeNumbers = null;\n this.leadZeroDateTime = null;\n this.leadZero = null;\n this.triggerOnMaskChange = null;\n this.apm = null;\n this.inputTransformFn = null;\n this.outputTransformFn = null;\n this.keepCharacterPositions = null;\n this.maskFilled = new EventEmitter();\n this._maskValue = '';\n this._position = null;\n this._maskExpressionArray = [];\n this._justPasted = false;\n this._isFocused = false;\n /**For IME composition event */\n this._isComposing = false;\n this.document = inject(DOCUMENT);\n this._maskService = inject(NgxMaskService, {\n self: true\n });\n this._config = inject(NGX_MASK_CONFIG);\n // eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any\n this.onChange = _ => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n this.onTouch = () => {};\n }\n ngOnChanges(changes) {\n const {\n maskExpression,\n specialCharacters,\n patterns,\n prefix,\n suffix,\n thousandSeparator,\n decimalMarker,\n dropSpecialCharacters,\n hiddenInput,\n showMaskTyped,\n placeHolderCharacter,\n shownMaskExpression,\n showTemplate,\n clearIfNotMatch,\n validation,\n separatorLimit,\n allowNegativeNumbers,\n leadZeroDateTime,\n leadZero,\n triggerOnMaskChange,\n apm,\n inputTransformFn,\n outputTransformFn,\n keepCharacterPositions\n } = changes;\n if (maskExpression) {\n if (maskExpression.currentValue !== maskExpression.previousValue && !maskExpression.firstChange) {\n this._maskService.maskChanged = true;\n }\n if (maskExpression.currentValue && maskExpression.currentValue.split(\"||\" /* MaskExpression.OR */).length > 1) {\n this._maskExpressionArray = maskExpression.currentValue.split(\"||\" /* MaskExpression.OR */).sort((a, b) => {\n return a.length - b.length;\n });\n this._setMask();\n } else {\n this._maskExpressionArray = [];\n this._maskValue = maskExpression.currentValue || \"\" /* MaskExpression.EMPTY_STRING */;\n this._maskService.maskExpression = this._maskValue;\n }\n }\n if (specialCharacters) {\n if (!specialCharacters.currentValue || !Array.isArray(specialCharacters.currentValue)) {\n return;\n } else {\n this._maskService.specialCharacters = specialCharacters.currentValue || [];\n }\n }\n if (allowNegativeNumbers) {\n this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;\n if (this._maskService.allowNegativeNumbers) {\n this._maskService.specialCharacters = this._maskService.specialCharacters.filter(c => c !== \"-\" /* MaskExpression.MINUS */);\n }\n }\n // Only overwrite the mask available patterns if a pattern has actually been passed in\n if (patterns && patterns.currentValue) {\n this._maskService.patterns = patterns.currentValue;\n }\n if (apm && apm.currentValue) {\n this._maskService.apm = apm.currentValue;\n }\n if (prefix) {\n this._maskService.prefix = prefix.currentValue;\n }\n if (suffix) {\n this._maskService.suffix = suffix.currentValue;\n }\n if (thousandSeparator) {\n this._maskService.thousandSeparator = thousandSeparator.currentValue;\n }\n if (decimalMarker) {\n this._maskService.decimalMarker = decimalMarker.currentValue;\n }\n if (dropSpecialCharacters) {\n this._maskService.dropSpecialCharacters = dropSpecialCharacters.currentValue;\n }\n if (hiddenInput) {\n this._maskService.hiddenInput = hiddenInput.currentValue;\n }\n if (showMaskTyped) {\n this._maskService.showMaskTyped = showMaskTyped.currentValue;\n if (showMaskTyped.previousValue === false && showMaskTyped.currentValue === true && this._isFocused) {\n requestAnimationFrame(() => {\n this._maskService._elementRef?.nativeElement.click();\n });\n }\n }\n if (placeHolderCharacter) {\n this._maskService.placeHolderCharacter = placeHolderCharacter.currentValue;\n }\n if (shownMaskExpression) {\n this._maskService.shownMaskExpression = shownMaskExpression.currentValue;\n }\n if (showTemplate) {\n this._maskService.showTemplate = showTemplate.currentValue;\n }\n if (clearIfNotMatch) {\n this._maskService.clearIfNotMatch = clearIfNotMatch.currentValue;\n }\n if (validation) {\n this._maskService.validation = validation.currentValue;\n }\n if (separatorLimit) {\n this._maskService.separatorLimit = separatorLimit.currentValue;\n }\n if (leadZeroDateTime) {\n this._maskService.leadZeroDateTime = leadZeroDateTime.currentValue;\n }\n if (leadZero) {\n this._maskService.leadZero = leadZero.currentValue;\n }\n if (triggerOnMaskChange) {\n this._maskService.triggerOnMaskChange = triggerOnMaskChange.currentValue;\n }\n if (inputTransformFn) {\n this._maskService.inputTransformFn = inputTransformFn.currentValue;\n }\n if (outputTransformFn) {\n this._maskService.outputTransformFn = outputTransformFn.currentValue;\n }\n if (keepCharacterPositions) {\n this._maskService.keepCharacterPositions = keepCharacterPositions.currentValue;\n }\n this._applyMask();\n }\n // eslint-disable-next-line complexity\n validate({\n value\n }) {\n if (!this._maskService.validation || !this._maskValue) {\n return null;\n }\n if (this._maskService.ipError) {\n return this._createValidationError(value);\n }\n if (this._maskService.cpfCnpjError) {\n return this._createValidationError(value);\n }\n if (this._maskValue.startsWith(\"separator\" /* MaskExpression.SEPARATOR */)) {\n return null;\n }\n if (withoutValidation.includes(this._maskValue)) {\n return null;\n }\n if (this._maskService.clearIfNotMatch) {\n return null;\n }\n if (timeMasks.includes(this._maskValue)) {\n return this._validateTime(value);\n }\n if (value && value.toString().length >= 1) {\n let counterOfOpt = 0;\n if (this._maskValue.startsWith(\"percent\" /* MaskExpression.PERCENT */)) {\n return null;\n }\n for (const key in this._maskService.patterns) {\n if (this._maskService.patterns[key]?.optional) {\n if (this._maskValue.indexOf(key) !== this._maskValue.lastIndexOf(key)) {\n const opt = this._maskValue.split(\"\" /* MaskExpression.EMPTY_STRING */).filter(i => i === key).join(\"\" /* MaskExpression.EMPTY_STRING */);\n counterOfOpt += opt.length;\n } else if (this._maskValue.indexOf(key) !== -1) {\n counterOfOpt++;\n }\n if (this._maskValue.indexOf(key) !== -1 && value.toString().length >= this._maskValue.indexOf(key)) {\n return null;\n }\n if (counterOfOpt === this._maskValue.length) {\n return null;\n }\n }\n }\n if (this._maskValue.indexOf(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */) === 1 && value.toString().length === this._maskValue.length + Number((this._maskValue.split(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */)[1] ?? \"\" /* MaskExpression.EMPTY_STRING */).split(\"}\" /* MaskExpression.CURLY_BRACKETS_RIGHT */)[0]) - 4) {\n return null;\n } else if (this._maskValue.indexOf(\"*\" /* MaskExpression.SYMBOL_STAR */) > 1 && value.toString().length < this._maskValue.indexOf(\"*\" /* MaskExpression.SYMBOL_STAR */) || this._maskValue.indexOf(\"?\" /* MaskExpression.SYMBOL_QUESTION */) > 1 && value.toString().length < this._maskValue.indexOf(\"?\" /* MaskExpression.SYMBOL_QUESTION */) || this._maskValue.indexOf(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */) === 1) {\n return this._createValidationError(value);\n }\n if (this._maskValue.indexOf(\"*\" /* MaskExpression.SYMBOL_STAR */) === -1 || this._maskValue.indexOf(\"?\" /* MaskExpression.SYMBOL_QUESTION */) === -1) {\n // eslint-disable-next-line no-param-reassign\n value = typeof value === 'number' ? String(value) : value;\n const array = this._maskValue.split('*');\n const length = this._maskService.dropSpecialCharacters ? this._maskValue.length - this._maskService.checkDropSpecialCharAmount(this._maskValue) - counterOfOpt : this.prefix ? this._maskValue.length + this.prefix.length - counterOfOpt : this._maskValue.length - counterOfOpt;\n if (array.length === 1) {\n if (value.toString().length < length) {\n return this._createValidationError(value);\n }\n }\n if (array.length > 1) {\n const lastIndexArray = array[array.length - 1];\n if (lastIndexArray && this._maskService.specialCharacters.includes(lastIndexArray[0]) && String(value).includes(lastIndexArray[0] ?? '') && !this.dropSpecialCharacters) {\n const special = value.split(lastIndexArray[0]);\n return special[special.length - 1].length === lastIndexArray.length - 1 ? null : this._createValidationError(value);\n } else if ((lastIndexArray && !this._maskService.specialCharacters.includes(lastIndexArray[0]) || !lastIndexArray || this._maskService.dropSpecialCharacters) && value.length >= length - 1) {\n return null;\n } else {\n return this._createValidationError(value);\n }\n }\n }\n if (this._maskValue.indexOf(\"*\" /* MaskExpression.SYMBOL_STAR */) === 1 || this._maskValue.indexOf(\"?\" /* MaskExpression.SYMBOL_QUESTION */) === 1) {\n return null;\n }\n }\n if (value) {\n this.maskFilled.emit();\n return null;\n }\n return null;\n }\n onPaste() {\n this._justPasted = true;\n }\n onFocus() {\n this._isFocused = true;\n }\n onModelChange(value) {\n // on form reset we need to update the actualValue\n if ((value === \"\" /* MaskExpression.EMPTY_STRING */ || value === null || value === undefined) && this._maskService.actualValue) {\n this._maskService.actualValue = this._maskService.getActualValue(\"\" /* MaskExpression.EMPTY_STRING */);\n }\n }\n onInput(e) {\n // If IME is composing text, we wait for the composed text.\n if (this._isComposing) return;\n const el = e.target;\n const transformedValue = this._maskService.inputTransformFn(el.value);\n if (el.type !== 'number') {\n if (typeof transformedValue === 'string' || typeof transformedValue === 'number') {\n el.value = transformedValue.toString();\n this._inputValue = el.value;\n this._setMask();\n if (!this._maskValue) {\n this.onChange(el.value);\n return;\n }\n let position = el.selectionStart === 1 ? el.selectionStart + this._maskService.prefix.length : el.selectionStart;\n if (this.showMaskTyped && this.keepCharacterPositions && this._maskService.placeHolderCharacter.length === 1) {\n const inputSymbol = el.value.slice(position - 1, position);\n const prefixLength = this.prefix.length;\n const checkSymbols = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position - 1 - prefixLength] ?? \"\" /* MaskExpression.EMPTY_STRING */);\n const checkSpecialCharacter = this._maskService._checkSymbolMask(inputSymbol, this._maskService.maskExpression[position + 1 - prefixLength] ?? \"\" /* MaskExpression.EMPTY_STRING */);\n const selectRangeBackspace = this._maskService.selStart === this._maskService.selEnd;\n const selStart = Number(this._maskService.selStart) - prefixLength ?? '';\n const selEnd = Number(this._maskService.selEnd) - prefixLength ?? '';\n if (this._code === \"Backspace\" /* MaskExpression.BACKSPACE */) {\n if (!selectRangeBackspace) {\n if (this._maskService.selStart === prefixLength) {\n this._maskService.actualValue = this.prefix + this._maskService.maskIsShown.slice(0, selEnd) + this._inputValue.split(this.prefix).join('');\n } else if (this._maskService.selStart === this._maskService.maskIsShown.length + prefixLength) {\n this._maskService.actualValue = this._inputValue + this._maskService.maskIsShown.slice(selStart, selEnd);\n } else {\n this._maskService.actualValue = this.prefix + this._inputValue.split(this.prefix).join('').slice(0, selStart) + this._maskService.maskIsShown.slice(selStart, selEnd) + this._maskService.actualValue.slice(selEnd + prefixLength, this._maskService.maskIsShown.length + prefixLength) + this.suffix;\n }\n } else if (!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(position - this.prefix.length, position + 1 - this.prefix.length)) && selectRangeBackspace) {\n if (selStart === 1 && this.prefix) {\n this._maskService.actualValue = this.prefix + this._maskService.placeHolderCharacter + el.value.split(this.prefix).join('').split(this.suffix).join('') + this.suffix;\n position = position - 1;\n } else {\n const part1 = el.value.substring(0, position);\n const part2 = el.value.substring(position);\n this._maskService.actualValue = part1 + this._maskService.placeHolderCharacter + part2;\n }\n }\n }\n if (this._code !== \"Backspace\" /* MaskExpression.BACKSPACE */) {\n if (!checkSymbols && !checkSpecialCharacter && selectRangeBackspace) {\n position = Number(el.selectionStart) - 1;\n } else if (this._maskService.specialCharacters.includes(el.value.slice(position, position + 1)) && checkSpecialCharacter && !this._maskService.specialCharacters.includes(el.value.slice(position + 1, position + 2))) {\n this._maskService.actualValue = el.value.slice(0, position - 1) + el.value.slice(position, position + 1) + inputSymbol + el.value.slice(position + 2);\n position = position + 1;\n } else if (checkSymbols) {\n if (el.value.length === 1 && position === 1) {\n this._maskService.actualValue = this.prefix + inputSymbol + this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length) + this.suffix;\n } else {\n this._maskService.actualValue = el.value.slice(0, position - 1) + inputSymbol + el.value.slice(position + 1).split(this.suffix).join('') + this.suffix;\n }\n } else if (this.prefix && el.value.length === 1 && position - prefixLength === 1 && this._maskService._checkSymbolMask(el.value, this._maskService.maskExpression[position - 1 - prefixLength] ?? \"\" /* MaskExpression.EMPTY_STRING */)) {\n this._maskService.actualValue = this.prefix + el.value + this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length) + this.suffix;\n }\n }\n }\n let caretShift = 0;\n let backspaceShift = false;\n if (this._code === \"Delete\" /* MaskExpression.DELETE */ && \"separator\" /* MaskExpression.SEPARATOR */) {\n this._maskService.deletedSpecialCharacter = true;\n }\n if (this._inputValue.length >= this._maskService.maskExpression.length - 1 && this._code !== \"Backspace\" /* MaskExpression.BACKSPACE */ && this._maskService.maskExpression === \"d0/M0/0000\" /* MaskExpression.DAYS_MONTHS_YEARS */ && position < 10) {\n const inputSymbol = this._inputValue.slice(position - 1, position);\n el.value = this._inputValue.slice(0, position - 1) + inputSymbol + this._inputValue.slice(position + 1);\n }\n if (this._maskService.maskExpression === \"d0/M0/0000\" /* MaskExpression.DAYS_MONTHS_YEARS */ && this.leadZeroDateTime) {\n if (position < 3 && Number(el.value) > 31 && Number(el.value) < 40 || position === 5 && Number(el.value.slice(3, 5)) > 12) {\n position = position + 2;\n }\n }\n if (this._maskService.maskExpression === \"Hh:m0:s0\" /* MaskExpression.HOURS_MINUTES_SECONDS */ && this.apm) {\n if (this._justPasted && el.value.slice(0, 2) === \"00\" /* MaskExpression.DOUBLE_ZERO */) {\n el.value = el.value.slice(1, 2) + el.value.slice(2, el.value.length);\n }\n el.value = el.value === \"00\" /* MaskExpression.DOUBLE_ZERO */ ? \"0\" /* MaskExpression.NUMBER_ZERO */ : el.value;\n }\n this._maskService.applyValueChanges(position, this._justPasted, this._code === \"Backspace\" /* MaskExpression.BACKSPACE */ || this._code === \"Delete\" /* MaskExpression.DELETE */, (shift, _backspaceShift) => {\n this._justPasted = false;\n caretShift = shift;\n backspaceShift = _backspaceShift;\n });\n // only set the selection if the element is active\n if (this._getActiveElement() !== el) {\n return;\n }\n if (this._maskService.plusOnePosition) {\n position = position + 1;\n this._maskService.plusOnePosition = false;\n }\n // update position after applyValueChanges to prevent cursor on wrong position when it has an array of maskExpression\n if (this._maskExpressionArray.length) {\n if (this._code === \"Backspace\" /* MaskExpression.BACKSPACE */) {\n position = this.specialCharacters.includes(this._inputValue.slice(position - 1, position)) ? position - 1 : position;\n } else {\n position = el.selectionStart === 1 ? el.selectionStart + this._maskService.prefix.length : el.selectionStart;\n }\n }\n this._position = this._position === 1 && this._inputValue.length === 1 ? null : this._position;\n let positionToApply = this._position ? this._inputValue.length + position + caretShift : position + (this._code === \"Backspace\" /* MaskExpression.BACKSPACE */ && !backspaceShift ? 0 : caretShift);\n if (positionToApply > this._getActualInputLength()) {\n positionToApply = el.value === this._maskService.decimalMarker && el.value.length === 1 ? this._getActualInputLength() + 1 : this._getActualInputLength();\n }\n if (positionToApply < 0) {\n positionToApply = 0;\n }\n el.setSelectionRange(positionToApply, positionToApply);\n this._position = null;\n } else {\n console.warn('Ngx-mask writeValue work with string | number, your current value:', typeof transformedValue);\n }\n } else {\n if (!this._maskValue) {\n this.onChange(el.value);\n return;\n }\n this._maskService.applyValueChanges(el.value.length, this._justPasted, this._code === \"Backspace\" /* MaskExpression.BACKSPACE */ || this._code === \"Delete\" /* MaskExpression.DELETE */);\n }\n }\n // IME starts\n onCompositionStart() {\n this._isComposing = true;\n }\n // IME completes\n onCompositionEnd(e) {\n this._isComposing = false;\n this._justPasted = true;\n this.onInput(e);\n }\n onBlur(e) {\n if (this._maskValue) {\n const el = e.target;\n if (this.leadZero && el.value.length > 0 && typeof this.decimalMarker === 'string') {\n const maskExpression = this._maskService.maskExpression;\n const precision = Number(this._maskService.maskExpression.slice(maskExpression.length - 1, maskExpression.length));\n if (precision > 1) {\n el.value = this.suffix ? el.value.split(this.suffix).join('') : el.value;\n const decimalPart = el.value.split(this.decimalMarker)[1];\n el.value = el.value.includes(this.decimalMarker) ? el.value + \"0\" /* MaskExpression.NUMBER_ZERO */.repeat(precision - decimalPart.length) + this.suffix : el.value + this.decimalMarker + \"0\" /* MaskExpression.NUMBER_ZERO */.repeat(precision) + this.suffix;\n this._maskService.actualValue = el.value;\n }\n }\n this._maskService.clearIfNotMatchFn();\n }\n this._isFocused = false;\n this.onTouch();\n }\n onClick(e) {\n if (!this._maskValue) {\n return;\n }\n const el = e.target;\n const posStart = 0;\n const posEnd = 0;\n if (el !== null && el.selectionStart !== null && el.selectionStart === el.selectionEnd && el.selectionStart > this._maskService.prefix.length &&\n // eslint-disable-next-line\n e.keyCode !== 38) {\n if (this._maskService.showMaskTyped && !this.keepCharacterPositions) {\n // We are showing the mask in the input\n this._maskService.maskIsShown = this._maskService.showMaskInInput();\n if (el.setSelectionRange && this._maskService.prefix + this._maskService.maskIsShown === el.value) {\n // the input ONLY contains the mask, so position the cursor at the start\n el.focus();\n el.setSelectionRange(posStart, posEnd);\n } else {\n // the input contains some characters already\n if (el.selectionStart > this._maskService.actualValue.length) {\n // if the user clicked beyond our value's length, position the cursor at the end of our value\n el.setSelectionRange(this._maskService.actualValue.length, this._maskService.actualValue.length);\n }\n }\n }\n }\n const nextValue = el && (el.value === this._maskService.prefix ? this._maskService.prefix + this._maskService.maskIsShown : el.value);\n /** Fix of cursor position jumping to end in most browsers no matter where cursor is inserted onFocus */\n if (el && el.value !== nextValue) {\n el.value = nextValue;\n }\n /** fix of cursor position with prefix when mouse click occur */\n if (el && el.type !== 'number' && (el.selectionStart || el.selectionEnd) <= this._maskService.prefix.length) {\n el.selectionStart = this._maskService.prefix.length;\n return;\n }\n /** select only inserted text */\n if (el && el.selectionEnd > this._getActualInputLength()) {\n el.selectionEnd = this._getActualInputLength();\n }\n }\n // eslint-disable-next-line complexity\n onKeyDown(e) {\n if (!this._maskValue) {\n return;\n }\n if (this._isComposing) {\n // User finalize their choice from IME composition, so trigger onInput() for the composed text.\n if (e.key === 'Enter') this.onCompositionEnd(e);\n return;\n }\n this._code = e.code ? e.code : e.key;\n const el = e.target;\n this._inputValue = el.value;\n this._setMask();\n if (el.type !== 'number') {\n if (e.key === \"ArrowUp\" /* MaskExpression.ARROW_UP */) {\n e.preventDefault();\n }\n if (e.key === \"ArrowLeft\" /* MaskExpression.ARROW_LEFT */ || e.key === \"Backspace\" /* MaskExpression.BACKSPACE */ || e.key === \"Delete\" /* MaskExpression.DELETE */) {\n if (e.key === \"Backspace\" /* MaskExpression.BACKSPACE */ && el.value.length === 0) {\n el.selectionStart = el.selectionEnd;\n }\n if (e.key === \"Backspace\" /* MaskExpression.BACKSPACE */ && el.selectionStart !== 0) {\n // If specialChars is false, (shouldn't ever happen) then set to the defaults\n this.specialCharacters = this.specialCharacters?.length ? this.specialCharacters : this._config.specialCharacters;\n if (this.prefix.length > 1 && el.selectionStart <= this.prefix.length) {\n el.setSelectionRange(this.prefix.length, el.selectionEnd);\n } else {\n if (this._inputValue.length !== el.selectionStart && el.selectionStart !== 1) {\n while (this.specialCharacters.includes((this._inputValue[el.selectionStart - 1] ?? \"\" /* MaskExpression.EMPTY_STRING */).toString()) && (this.prefix.length >= 1 && el.selectionStart > this.prefix.length || this.prefix.length === 0)) {\n el.setSelectionRange(el.selectionStart - 1, el.selectionEnd);\n }\n }\n }\n }\n this.checkSelectionOnDeletion(el);\n if (this._maskService.prefix.length && el.selectionStart <= this._maskService.prefix.length && el.selectionEnd <= this._maskService.prefix.length) {\n e.preventDefault();\n }\n const cursorStart = el.selectionStart;\n if (e.key === \"Backspace\" /* MaskExpression.BACKSPACE */ && !el.readOnly && cursorStart === 0 && el.selectionEnd === el.value.length && el.value.length !== 0) {\n this._position = this._maskService.prefix ? this._maskService.prefix.length : 0;\n this._maskService.applyMask(this._maskService.prefix, this._maskService.maskExpression, this._position);\n }\n }\n if (!!this.suffix && this.suffix.length > 1 && this._inputValue.length - this.suffix.length < el.selectionStart) {\n el.setSelectionRange(this._inputValue.length - this.suffix.length, this._inputValue.length);\n } else if (e.code === 'KeyA' && e.ctrlKey || e.code === 'KeyA' && e.metaKey // Cmd + A (Mac)\n ) {\n el.setSelectionRange(0, this._getActualInputLength());\n e.preventDefault();\n }\n this._maskService.selStart = el.selectionStart;\n this._maskService.selEnd = el.selectionEnd;\n }\n }\n /** It writes the value in the input */\n async writeValue(controlValue) {\n if (typeof controlValue === 'object' && controlValue !== null && 'value' in controlValue) {\n if ('disable' in controlValue) {\n this.setDisabledState(Boolean(controlValue.disable));\n }\n // eslint-disable-next-line no-param-reassign\n controlValue = controlValue.value;\n }\n if (controlValue !== null) {\n // eslint-disable-next-line no-param-reassign\n controlValue = this.inputTransformFn ? this.inputTransformFn(controlValue) : controlValue;\n }\n if (typeof controlValue === 'string' || typeof controlValue === 'number' || controlValue === null || controlValue === undefined) {\n if (controlValue === null || controlValue === undefined || controlValue === '') {\n this._maskService._currentValue = '';\n this._maskService._previousValue = '';\n }\n // eslint-disable-next-line no-param-reassign\n let inputValue = controlValue;\n if (typeof inputValue === 'number' || this._maskValue.startsWith(\"separator\" /* MaskExpression.SEPARATOR */)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = String(inputValue);\n const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();\n if (!Array.isArray(this._maskService.decimalMarker)) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this._maskService.decimalMarker !== localeDecimalMarker ? inputValue.replace(localeDecimalMarker, this._maskService.decimalMarker) : inputValue;\n }\n if (this._maskService.leadZero && inputValue && this.maskExpression && this.dropSpecialCharacters !== false) {\n // eslint-disable-next-line no-param-reassign\n inputValue = this._maskService._checkPrecision(this._maskService.maskExpression, inputValue);\n }\n if (this._maskService.decimalMarker === \",\" /* MaskExpression.COMMA */) {\n // eslint-disable-next-line no-param-reassign\n inputValue = inputValue.toString().replace(\".\" /* MaskExpression.DOT */, \",\" /* MaskExpression.COMMA */);\n }\n if (this.maskExpression?.startsWith(\"separator\" /* MaskExpression.SEPARATOR */) && this.leadZero) {\n requestAnimationFrame(() => {\n this._maskService.applyMask(inputValue?.toString() ?? '', this._maskService.maskExpression);\n });\n }\n this._maskService.isNumberValue = true;\n }\n if (typeof inputValue !== 'string') {\n // eslint-disable-next-line no-param-reassign\n inputValue = '';\n }\n this._inputValue = inputValue;\n this._setMask();\n if (inputValue && this._maskService.maskExpression || this._maskService.maskExpression && (this._maskService.prefix || this._maskService.showMaskTyped)) {\n // Let the service we know we are writing value so that triggering onChange function won't happen during applyMask\n typeof this.inputTransformFn !== 'function' ? this._maskService.writingValue = true : '';\n this._maskService.formElementProperty = ['value', this._maskService.applyMask(inputValue, this._maskService.maskExpression)];\n // Let the service know we've finished writing value\n typeof this.inputTransformFn !== 'function' ? this._maskService.writingValue = false : '';\n } else {\n this._maskService.formElementProperty = ['value', inputValue];\n }\n this._inputValue = inputValue;\n } else {\n console.warn('Ngx-mask writeValue work with string | number, your current value:', typeof controlValue);\n }\n }\n registerOnChange(fn) {\n this._maskService.onChange = this.onChange = fn;\n }\n registerOnTouched(fn) {\n this.onTouch = fn;\n }\n _getActiveElement(document = this.document) {\n const shadowRootEl = document?.activeElement?.shadowRoot;\n if (!shadowRootEl?.activeElement) {\n return document.activeElement;\n } else {\n return this._getActiveElement(shadowRootEl);\n }\n }\n checkSelectionOnDeletion(el) {\n el.selectionStart = Math.min(Math.max(this.prefix.length, el.selectionStart), this._inputValue.length - this.suffix.length);\n el.selectionEnd = Math.min(Math.max(this.prefix.length, el.selectionEnd), this._inputValue.length - this.suffix.length);\n }\n /** It disables the input element */\n setDisabledState(isDisabled) {\n this._maskService.formElementProperty = ['disabled', isDisabled];\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _applyMask() {\n this._maskService.maskExpression = this._maskService._repeatPatternSymbols(this._maskValue || '');\n this._maskService.formElementProperty = ['value', this._maskService.applyMask(this._inputValue, this._maskService.maskExpression)];\n }\n _validateTime(value) {\n const rowMaskLen = this._maskValue.split(\"\" /* MaskExpression.EMPTY_STRING */).filter(s => s !== ':').length;\n if (!value) {\n return null; // Don't validate empty values to allow for optional form control\n }\n if (+(value[value.length - 1] ?? -1) === 0 && value.length < rowMaskLen || value.length <= rowMaskLen - 2) {\n return this._createValidationError(value);\n }\n return null;\n }\n _getActualInputLength() {\n return this._maskService.actualValue.length || this._maskService.actualValue.length + this._maskService.prefix.length;\n }\n _createValidationError(actualValue) {\n return {\n mask: {\n requiredMask: this._maskValue,\n actualValue\n }\n };\n }\n _setMask() {\n this._maskExpressionArray.some(mask => {\n const specialChart = mask.split(\"\" /* MaskExpression.EMPTY_STRING */).some(char => this._maskService.specialCharacters.includes(char));\n if (specialChart && this._inputValue && !mask.includes(\"S\" /* MaskExpression.LETTER_S */) || mask.includes(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {\n const test = this._maskService.removeMask(this._inputValue)?.length <= this._maskService.removeMask(mask)?.length;\n if (test) {\n this._maskValue = this.maskExpression = this._maskService.maskExpression = mask.includes(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */) ? this._maskService._repeatPatternSymbols(mask) : mask;\n return test;\n } else {\n const expression = this._maskExpressionArray[this._maskExpressionArray.length - 1] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n this._maskValue = this.maskExpression = this._maskService.maskExpression = expression.includes(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */) ? this._maskService._repeatPatternSymbols(expression) : expression;\n }\n } else {\n const check = this._maskService.removeMask(this._inputValue)?.split(\"\" /* MaskExpression.EMPTY_STRING */).every((character, index) => {\n const indexMask = mask.charAt(index);\n return this._maskService._checkSymbolMask(character, indexMask);\n });\n if (check) {\n this._maskValue = this.maskExpression = this._maskService.maskExpression = mask;\n return check;\n }\n }\n });\n }\n }\n NgxMaskDirective.ɵfac = function NgxMaskDirective_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NgxMaskDirective)();\n };\n NgxMaskDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgxMaskDirective,\n selectors: [[\"input\", \"mask\", \"\"], [\"textarea\", \"mask\", \"\"]],\n hostBindings: function NgxMaskDirective_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"paste\", function NgxMaskDirective_paste_HostBindingHandler() {\n return ctx.onPaste();\n })(\"focus\", function NgxMaskDirective_focus_HostBindingHandler($event) {\n return ctx.onFocus($event);\n })(\"ngModelChange\", function NgxMaskDirective_ngModelChange_HostBindingHandler($event) {\n return ctx.onModelChange($event);\n })(\"input\", function NgxMaskDirective_input_HostBindingHandler($event) {\n return ctx.onInput($event);\n })(\"compositionstart\", function NgxMaskDirective_compositionstart_HostBindingHandler($event) {\n return ctx.onCompositionStart($event);\n })(\"compositionend\", function NgxMaskDirective_compositionend_HostBindingHandler($event) {\n return ctx.onCompositionEnd($event);\n })(\"blur\", function NgxMaskDirective_blur_HostBindingHandler($event) {\n return ctx.onBlur($event);\n })(\"click\", function NgxMaskDirective_click_HostBindingHandler($event) {\n return ctx.onClick($event);\n })(\"keydown\", function NgxMaskDirective_keydown_HostBindingHandler($event) {\n return ctx.onKeyDown($event);\n });\n }\n },\n inputs: {\n maskExpression: [0, \"mask\", \"maskExpression\"],\n specialCharacters: \"specialCharacters\",\n patterns: \"patterns\",\n prefix: \"prefix\",\n suffix: \"suffix\",\n thousandSeparator: \"thousandSeparator\",\n decimalMarker: \"decimalMarker\",\n dropSpecialCharacters: \"dropSpecialCharacters\",\n hiddenInput: \"hiddenInput\",\n showMaskTyped: \"showMaskTyped\",\n placeHolderCharacter: \"placeHolderCharacter\",\n shownMaskExpression: \"shownMaskExpression\",\n showTemplate: \"showTemplate\",\n clearIfNotMatch: \"clearIfNotMatch\",\n validation: \"validation\",\n separatorLimit: \"separatorLimit\",\n allowNegativeNumbers: \"allowNegativeNumbers\",\n leadZeroDateTime: \"leadZeroDateTime\",\n leadZero: \"leadZero\",\n triggerOnMaskChange: \"triggerOnMaskChange\",\n apm: \"apm\",\n inputTransformFn: \"inputTransformFn\",\n outputTransformFn: \"outputTransformFn\",\n keepCharacterPositions: \"keepCharacterPositions\"\n },\n outputs: {\n maskFilled: \"maskFilled\"\n },\n exportAs: [\"mask\", \"ngxMask\"],\n standalone: true,\n features: [i0.ɵɵProvidersFeature([{\n provide: NG_VALUE_ACCESSOR,\n useExisting: NgxMaskDirective,\n multi: true\n }, {\n provide: NG_VALIDATORS,\n useExisting: NgxMaskDirective,\n multi: true\n }, NgxMaskService]), i0.ɵɵNgOnChangesFeature]\n });\n return NgxMaskDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet NgxMaskPipe = /*#__PURE__*/(() => {\n class NgxMaskPipe {\n constructor() {\n this.defaultOptions = {};\n this._maskService = inject(NgxMaskService);\n this._maskExpressionArray = [];\n this.mask = '';\n }\n transform(value, mask, {\n patterns,\n ...config\n } = {}) {\n const currentConfig = {\n maskExpression: mask,\n ...this.defaultOptions,\n ...config,\n patterns: {\n ...this._maskService.patterns,\n ...patterns\n }\n };\n Object.entries(currentConfig).forEach(([key, value]) => {\n //eslint-disable-next-line @typescript-eslint/no-explicit-any\n this._maskService[key] = value;\n });\n if (mask.includes('||')) {\n if (mask.split('||').length > 1) {\n this._maskExpressionArray = mask.split('||').sort((a, b) => {\n return a.length - b.length;\n });\n this._setMask(value);\n return this._maskService.applyMask(`${value}`, this.mask);\n } else {\n this._maskExpressionArray = [];\n return this._maskService.applyMask(`${value}`, this.mask);\n }\n }\n if (mask.includes(\"{\" /* MaskExpression.CURLY_BRACKETS_LEFT */)) {\n return this._maskService.applyMask(`${value}`, this._maskService._repeatPatternSymbols(mask));\n }\n if (mask.startsWith(\"separator\" /* MaskExpression.SEPARATOR */)) {\n if (config.decimalMarker) {\n this._maskService.decimalMarker = config.decimalMarker;\n }\n if (config.thousandSeparator) {\n this._maskService.thousandSeparator = config.thousandSeparator;\n }\n if (config.leadZero) {\n // eslint-disable-next-line no-param-reassign\n this._maskService.leadZero = config.leadZero;\n }\n // eslint-disable-next-line no-param-reassign\n value = String(value);\n const localeDecimalMarker = this._maskService.currentLocaleDecimalMarker();\n if (!Array.isArray(this._maskService.decimalMarker)) {\n // eslint-disable-next-line no-param-reassign\n value = this._maskService.decimalMarker !== localeDecimalMarker ? value.replace(localeDecimalMarker, this._maskService.decimalMarker) : value;\n }\n if (this._maskService.leadZero && value && this._maskService.dropSpecialCharacters !== false) {\n // eslint-disable-next-line no-param-reassign\n value = this._maskService._checkPrecision(mask, value);\n }\n if (this._maskService.decimalMarker === \",\" /* MaskExpression.COMMA */) {\n // eslint-disable-next-line no-param-reassign\n value = value.toString().replace(\".\" /* MaskExpression.DOT */, \",\" /* MaskExpression.COMMA */);\n }\n this._maskService.isNumberValue = true;\n }\n if (value === null || value === undefined) {\n return this._maskService.applyMask('', mask);\n }\n return this._maskService.applyMask(`${value}`, mask);\n }\n _setMask(value) {\n if (this._maskExpressionArray.length > 0) {\n this._maskExpressionArray.some(mask => {\n const test = this._maskService.removeMask(value)?.length <= this._maskService.removeMask(mask)?.length;\n if (value && test) {\n this.mask = mask;\n return test;\n } else {\n const expression = this._maskExpressionArray[this._maskExpressionArray.length - 1] ?? \"\" /* MaskExpression.EMPTY_STRING */;\n this.mask = expression;\n }\n });\n }\n }\n }\n NgxMaskPipe.ɵfac = function NgxMaskPipe_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NgxMaskPipe)();\n };\n NgxMaskPipe.ɵpipe = /* @__PURE__ */i0.ɵɵdefinePipe({\n name: \"mask\",\n type: NgxMaskPipe,\n pure: true,\n standalone: true\n });\n return NgxMaskPipe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { INITIAL_CONFIG, NEW_CONFIG, NGX_MASK_CONFIG, NgxMaskDirective, NgxMaskPipe, NgxMaskService, initialConfig, provideEnvironmentNgxMask, provideNgxMask, timeMasks, withoutValidation };\n"],"mappings":"wkCASA,IAAaA,IAA2B,IAAA,CAAlC,MAAOA,CAA2B,CACtCC,YACwCC,EAC9BC,EAAqD,CADvB,KAAAD,KAAAA,EAC9B,KAAAC,SAAAA,CACP,CAEOC,aAAW,CACnB,KAAKD,SAASE,QAAO,CACvB,CAEUC,UAAQ,CAChB,KAAKF,YAAW,EAChB,KAAKF,KAAKK,OAAM,CAClB,iDAbWP,GAA2BQ,EAE5BC,EAAkB,EAAAD,EAAAE,EAAA,CAAA,CAAA,CAAA,gCAFjBV,EAA2BW,UAAA,CAAA,CAAA,yBAAA,CAAA,EAAAC,MAAA,GAAAC,KAAA,EAAAC,OAAA,CAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA,EAAA,QAAA,EAAA,OAAA,EAAA,CAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,EAAA,cAAA,CAAA,EAAAC,SAAA,SAAAC,EAAAC,EAAA,CAAAD,EAAA,ICTxCE,EAAA,EAAA,MAAA,CAAA,EAAuB,EAAA,MAAA,CAAA,EACA,EAAA,MAAA,CAAA,EACAC,EAAA,CAAA,EAAgBC,EAAA,EACnCF,EAAA,EAAA,MAAA,CAAA,EACEC,EAAA,CAAA,EACFC,EAAA,EAAM,EAERF,EAAA,EAAA,MAAA,CAAA,EAAsB,EAAA,WAAA,CAAA,EAGlBG,EAAA,QAAA,UAAA,CAAA,OAASJ,EAAAb,YAAA,CAAa,CAAA,EACtBe,EAAA,EAAA,SAAA,EACFC,EAAA,EACAF,EAAA,EAAA,MAAA,CAAA,EAEEG,EAAA,QAAA,UAAA,CAAA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A,EAAe,WAA0BD,EAAmB,CAC1D,MAAOC,EACP,QAASA,EAAe,SAC1B,CAAC,EACMA,CACT,GAAG,EAQH,SAASgD,IAAiB,CACxB,IAAMC,EAAa9I,EAAO+I,EAAc,EAClCC,EAAchJ,EAAOiJ,EAAU,EACrC,OAAOD,aAAuB,SAAWE,IAAA,GACpCJ,GACAE,EAAY,GACbE,IAAA,GACCJ,GACAE,EAEP,CACA,SAASG,GAAeH,EAAa,CACnC,MAAO,CAAC,CACN,QAASC,GACT,SAAUD,CACZ,EAAG,CACD,QAASD,GACT,SAAUK,EACZ,EAAG,CACD,QAASnJ,GACT,WAAY4I,EACd,EAAGhD,EAAc,CACnB,CACA,SAASwD,GAA0BL,EAAa,CAC9C,OAAOM,GAAyBH,GAAeH,CAAW,CAAC,CAC7D","names":["FeatureAnnoucementComponent","constructor","data","snackBar","closeAction","dismiss","onAction","action","ɵɵdirectiveInject","MAT_SNACK_BAR_DATA","MatSnackBarRef","selectors","decls","vars","consts","template","rf","ctx","ɵɵelementStart","ɵɵtext","ɵɵelementEnd","ɵɵlistener","ɵɵadvance","ɵɵtextInterpolate","label","ɵɵtextInterpolate1","text","actionLabel","DialogMessageComponent","constructor","dialogRef","data","storage","close","set","ɵɵdirectiveInject","MatDialogRef","MAT_DIALOG_DATA","LocalStorageService","selectors","decls","vars","consts","template","rf","ctx","ɵɵelementStart","ɵɵtext","ɵɵelementEnd","ɵɵlistener","ɵɵadvance","ɵɵtextInterpolate","message","FeatureAnnouncementService","constructor","matSnackBar","dialog","localStorage","googleAnalyticsService","STORAGE_KEY","confirmedAnnoucements","announcement","init","get","includes","id","open","data","confirmAnnouncement","push","set","config","duration","panelClass","openFromComponent","FeatureAnnoucementComponent","afterDismissed","subscribe","openPreferences","PreferenceLayoutComponent","preferencesSelected","ɵɵinject","MatSnackBar","MatDialog","LocalStorageService","GoogleAnalyticsService","factory","ɵfac","providedIn","CallRecordingAction","RecordingState","RecordingService","ApiService","AutomaticRecordingResumeDuration","isAutomaticRecordingEnabled","_isAutomaticRecordingEnabled","isRecordingPlaybackFeatureEnabled","configService","features","AppFeature","CallRecordingPlayback","isRecordingOnDemandFeatureEnabled","OnDemandRecording","isPauseRecordingFeatureEnabled","CallRecordingPause","hasPresentedCallRecordingDialog","localStorageService","get","value","set","constructor","httpClient","sipJsService","googleAnalyticsService","matDialog","authService","baseUrl","callRecordingStateSubject","BehaviorSubject","Map","loadingSubject","httpRequestCountSubject","callRecordingState$","asObservable","loading$","pipe","distinctUntilChanged","callRecordingStateMap","callWasRecordedMap","automaticResumeRecordingTimerMap","isAuthenticated$","untilDestroyed","subscribe","isAuthenticated","fetchAutomaticRecordingEnabled","then","result","count","next","sessionStatus$","_0","__async","call","status","SessionStatus","Created","updateRecordingState","id","RecordingState","NotRecording","Answered","getAnsweredStatusCountForCall","Recording","Hangup","clearTimeout","delete","wasCallRecorded","open","DialogMessageComponent","disableClose","data","message","Destroy","startRecording","callId","postRecordAction","CallRecordingAction","START","pauseRecording","console","debug","timer","setTimeout","resumeRecording","RecordingService_1","PAUSE","RESUME","stopRecording","STOP","action","callRecording","incrementHttpRequestCount","normalizedCallId","getNormalizedCallId","firstValueFrom","post","orig_callid","success","Paused","decrementHttpRequestCount","enabled","isCallRecording","state","statusHistory","filter","s","length","ɵɵinject","HttpClient","AppConfigService","SipjsService","GoogleAnalyticsService","LocalStorageService","MatDialog","AuthService","factory","ɵfac","providedIn","__decorate","UntilDestroy","HidRendererService","constructor","electronService","sipJsService","phoneService","settingsService","setUpCallStatusMonitoring","setUpElectronEventHandlers","init","refreshData","of","currentVisibleCall$","pipe","untilDestroyed","filter","call","undefined","switchMap","observeStatusChanges","id","subscribe","status","send","ElectronChannel","CurrentCallSessionStatus","combineLatest","callMuted$","startWith","currentVisibleCall","isMuted","muted","currentCall","muteEvent","_","CallMute","visibleCalls$","incomingCalls$","calls$","visibleCalls","incomingCalls","calls","CallState","hasIncoming","length","hasVisible","hasActive","audioSettings$","settings","sendAudioSettings","on","HID","data","event","HidEvent","Mute","toggleCallMuted","RingingRequest","mostRecentIncomingCall","at","answerIncomingCall","endCallOrConference","RequestEmitAudioSettings","audioSettings","AudioSettingsChange","speakerDevice","speakerLabel","microphoneDevice","microphoneLabel","ɵɵinject","ElectronService","SipjsService","PhoneService","SettingsService","factory","ɵfac","providedIn","__decorate","UntilDestroy","FaviconService","changeFavicon","iconUrl","link","document","querySelector","href","newLink","createElement","id","rel","type","head","append","factory","ɵfac","providedIn","AppInitializerService","constructor","voicemailService","callHistoryService","contactService","channelService","meetingService","authService","callParkService","smsService","activeMeetingService","unreadMessageService","unreadSMSMessageService","faxService","wsService","appConfigService","featureAnnouncementService","brandingService","recordingService","hidRendererService","faviconService","integrationsService","ucLinkSocketService","isLoading$","BehaviorSubject","initialLoading$","progress$","services","init","injector","initializer","get","Promise","resolve","token","URLSearchParams","window","location","search","updateWithMasqueradeToken","history","replaceState","document","title","pathname","initWsService","initServices","forEach","service","dataFetches","map","index","refreshData","pipe","tap","next","Math","max","length","combineLatest","isAuthenticated$","isConnected$","loggedIn","isConnected","environment","name","startWith","distinctUntilChanged","filter","shouldFetch","concatMap","forkJoin","finalize","subscribe","getUserRoles","firstValueFrom","brandingData$","then","brandingData","changeFavicon","BrandingField","FieldFavicon","bindSocketEvents","ɵɵinject","VoicemailService","CallHistoryService","ContactService","ChannelService","MeetingService","AuthService","CallParkService","SMSService","ActiveMeetingService","UnreadMessageService","SMSUnreadMessageService","FaxService","WsService","AppConfigService","FeatureAnnouncementService","BrandingService","RecordingService","HidRendererService","FaviconService","IntegrationsService","UcLinkSocketService","factory","ɵfac","providedIn","AuthGuard","constructor","authService","brandingService","canActivate","__async","url","getAuthUrl","getRefreshedAccessToken","window","location","href","ɵɵinject","AuthService","BrandingService","factory","ɵfac","NGX_MASK_CONFIG","InjectionToken","NEW_CONFIG","INITIAL_CONFIG","initialConfig","value","EventEmitter","NgxMaskApplierService","inject","NGX_MASK_CONFIG","str","thousandSeparatorChar","decimalChars","precision","x","decimalChar","regExp","v","decimals","res","separatorLimit","rgx","sanitizedStr","value","maskExpression","inputValue","i","substr","decimalMarker","marker","dm","precisionRegEx","precisionMatch","precisionMatchLength","diff","maskAndPattern","mask","customPattern","position","justPasted","backspaced","cb","cursor","result","multi","backspaceShift","shift","stepBack","inputArray","valuesIP","arr","base","thousandSeparatorCharEscaped","invalidChars","invalidCharRegexp","strForSep","commaShift","shiftStep","_shift","inputSymbol","symbolStarInPattern","daysCount","inputValueCursor","inputValueCursorPlusOne","inputValueCursorPlusTwo","inputValueCursorMinusOne","inputValueCursorMinusTwo","inputValueCursorMinusThree","inputValueSliceMinusThreeMinusOne","inputValueSliceMinusOnePlusOne","inputValueSliceCursorPlusTwo","inputValueSliceMinusTwoCursor","maskStartWithMonth","startWithMonthInput","withoutDays","specialChart","day1monthInput","day2monthInput","day2monthInputDot","day1monthPaste","day2monthPaste","newPosition","actualShift","onlySpecial","char","val","maskSymbol","idx","isDecimalMarker","inputLength","comparedValue","excludedValue","index","decimalIndex","parsedValue","integerPart","decimalPart","integerString","decimal","__ngFactoryType__","ɵɵdefineInjectable","NgxMaskService","_","ElementRef","DOCUMENT","Renderer2","getSymbol","newInputValue","actualResult","item","resLen","prefNmask","countSkipedSymbol","regex","match","formElement","curr","compare","symbol","maskChar","symbolToReplace","currSymbol","replaceSymbol","inputVal","name","cpf","cnpj","document","shadowRootEl","num","specialCharactersForRemove","specialCharacters","markers","separatorPrecision","separatorValue","key","patternString","pattern","maskExpretion","matcher","separatorExpression","maskExp","accum","currVal","repeatNumber","replaceWith","symbols","ɵNgxMaskService_BaseFactory","ɵɵgetInheritedFactory","_configFactory","initConfig","INITIAL_CONFIG","configValue","NEW_CONFIG","__spreadValues","provideNgxMask","initialConfig","provideEnvironmentNgxMask","makeEnvironmentProviders"],"x_google_ignoreList":[11]}